@tabler/core 1.0.0-beta10 → 1.0.0-beta11

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 (398) hide show
  1. package/README.md +33 -11
  2. package/dist/css/demo.css +2 -2
  3. package/dist/css/demo.min.css +2 -2
  4. package/dist/css/demo.rtl.css +2 -2
  5. package/dist/css/demo.rtl.min.css +2 -2
  6. package/dist/css/tabler-flags.css +2 -2
  7. package/dist/css/tabler-flags.min.css +2 -2
  8. package/dist/css/tabler-flags.rtl.css +2 -2
  9. package/dist/css/tabler-flags.rtl.min.css +2 -2
  10. package/dist/css/tabler-payments.css +2 -2
  11. package/dist/css/tabler-payments.min.css +2 -2
  12. package/dist/css/tabler-payments.rtl.css +2 -2
  13. package/dist/css/tabler-payments.rtl.min.css +2 -2
  14. package/dist/css/tabler-vendors.css +143 -29
  15. package/dist/css/tabler-vendors.min.css +3 -3
  16. package/dist/css/tabler-vendors.rtl.css +143 -29
  17. package/dist/css/tabler-vendors.rtl.min.css +3 -3
  18. package/dist/css/tabler.css +5741 -2725
  19. package/dist/css/tabler.min.css +4 -4
  20. package/dist/css/tabler.rtl.css +5743 -2743
  21. package/dist/css/tabler.rtl.min.css +4 -4
  22. package/dist/js/demo.js +2 -2
  23. package/dist/js/demo.min.js +2 -2
  24. package/dist/js/tabler.esm.js +1637 -1515
  25. package/dist/js/tabler.esm.min.js +3 -3
  26. package/dist/js/tabler.js +1637 -1515
  27. package/dist/js/tabler.min.js +3 -3
  28. package/dist/libs/apexcharts/dist/apexcharts.amd.js +2 -0
  29. package/dist/libs/apexcharts/dist/apexcharts.common.js +14 -0
  30. package/dist/libs/apexcharts/dist/apexcharts.css +691 -0
  31. package/dist/libs/apexcharts/dist/apexcharts.esm.js +14 -0
  32. package/dist/libs/apexcharts/dist/apexcharts.js +31960 -0
  33. package/dist/libs/apexcharts/dist/apexcharts.min.js +4 -4
  34. package/dist/libs/apexcharts/dist/locales/ar.json +63 -0
  35. package/dist/libs/apexcharts/dist/locales/ca.json +55 -0
  36. package/dist/libs/apexcharts/dist/locales/cs.json +55 -0
  37. package/dist/libs/apexcharts/dist/locales/de.json +55 -0
  38. package/dist/libs/apexcharts/dist/locales/el.json +55 -0
  39. package/dist/libs/apexcharts/dist/locales/en.json +55 -0
  40. package/dist/libs/apexcharts/dist/locales/es.json +55 -0
  41. package/dist/libs/apexcharts/dist/locales/et.json +63 -0
  42. package/dist/libs/apexcharts/dist/locales/fa.json +55 -0
  43. package/dist/libs/apexcharts/dist/locales/fi.json +55 -0
  44. package/dist/libs/apexcharts/dist/locales/fr.json +55 -0
  45. package/dist/libs/apexcharts/dist/locales/he.json +55 -0
  46. package/dist/libs/apexcharts/dist/locales/hi.json +55 -0
  47. package/dist/libs/apexcharts/dist/locales/hr.json +55 -0
  48. package/dist/libs/apexcharts/dist/locales/hu.json +64 -0
  49. package/dist/libs/apexcharts/dist/locales/hy.json +55 -0
  50. package/dist/libs/apexcharts/dist/locales/id.json +47 -0
  51. package/dist/libs/apexcharts/dist/locales/it.json +55 -0
  52. package/dist/libs/apexcharts/dist/locales/ja.json +55 -0
  53. package/dist/libs/apexcharts/dist/locales/ka.json +55 -0
  54. package/dist/libs/apexcharts/dist/locales/ko.json +55 -0
  55. package/dist/libs/apexcharts/dist/locales/lt.json +55 -0
  56. package/dist/libs/apexcharts/dist/locales/lv.json +64 -0
  57. package/dist/libs/apexcharts/dist/locales/nb.json +55 -0
  58. package/dist/libs/apexcharts/dist/locales/nl.json +55 -0
  59. package/dist/libs/apexcharts/dist/locales/pl.json +55 -0
  60. package/dist/libs/apexcharts/dist/locales/pt-br.json +55 -0
  61. package/dist/libs/apexcharts/dist/locales/pt.json +55 -0
  62. package/dist/libs/apexcharts/dist/locales/rs.json +55 -0
  63. package/dist/libs/apexcharts/dist/locales/ru.json +55 -0
  64. package/dist/libs/apexcharts/dist/locales/se.json +55 -0
  65. package/dist/libs/apexcharts/dist/locales/sk.json +55 -0
  66. package/dist/libs/apexcharts/dist/locales/sl.json +55 -0
  67. package/dist/libs/apexcharts/dist/locales/sq.json +55 -0
  68. package/dist/libs/apexcharts/dist/locales/th.json +55 -0
  69. package/dist/libs/apexcharts/dist/locales/tr.json +55 -0
  70. package/dist/libs/apexcharts/dist/locales/ua.json +55 -0
  71. package/dist/libs/apexcharts/dist/locales/zh-cn.json +55 -0
  72. package/dist/libs/apexcharts/dist/locales/zh-tw.json +55 -0
  73. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js +7066 -0
  74. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js.map +1 -0
  75. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js +3 -3
  76. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
  77. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js +5204 -0
  78. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js.map +1 -0
  79. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js +7 -0
  80. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -0
  81. package/dist/libs/bootstrap/dist/js/bootstrap.js +5251 -0
  82. package/dist/libs/bootstrap/dist/js/bootstrap.js.map +1 -0
  83. package/dist/libs/bootstrap/dist/js/bootstrap.min.js +7 -0
  84. package/dist/libs/bootstrap/dist/js/bootstrap.min.js.map +1 -0
  85. package/dist/libs/countup.js/dist/countUp.d.ts +61 -0
  86. package/dist/libs/countup.js/dist/countUp.js +25 -22
  87. package/dist/libs/countup.js/dist/countUp.min.js +1 -0
  88. package/dist/libs/countup.js/dist/countUp.umd.js +293 -0
  89. package/dist/libs/countup.js/dist/countUp.withPolyfill.min.js +1 -0
  90. package/dist/libs/dropzone/dist/basic.css +1 -0
  91. package/dist/libs/dropzone/dist/basic.css.map +1 -0
  92. package/dist/libs/dropzone/dist/dropzone-min.js +2 -0
  93. package/dist/libs/dropzone/dist/dropzone-min.js.map +1 -0
  94. package/dist/libs/dropzone/dist/dropzone.css +1 -0
  95. package/dist/libs/dropzone/dist/dropzone.css.map +1 -0
  96. package/dist/libs/dropzone/dist/dropzone.js +3068 -0
  97. package/dist/libs/dropzone/dist/dropzone.js.map +1 -0
  98. package/dist/libs/dropzone/dist/dropzone.mjs +2111 -0
  99. package/dist/libs/dropzone/dist/dropzone.mjs.map +1 -0
  100. package/dist/libs/fslightbox/LICENSE +21 -0
  101. package/dist/libs/fslightbox/README.md +62 -0
  102. package/dist/libs/fslightbox/index.js +1 -0
  103. package/dist/libs/fslightbox/jest-setup.js +1 -0
  104. package/dist/libs/fslightbox/package.json +72 -0
  105. package/dist/libs/jsvectormap/dist/js/jsvectormap.js +2663 -0
  106. package/dist/libs/jsvectormap/dist/js/jsvectormap.min.js +1 -1
  107. package/dist/libs/jsvectormap/dist/maps/world-merc.js +1 -1
  108. package/dist/libs/jsvectormap/dist/maps/world.js +1 -1
  109. package/dist/libs/list.js/dist/list.js +2020 -0
  110. package/dist/libs/list.js/dist/list.js.map +1 -0
  111. package/dist/libs/list.js/dist/list.min.js.map +1 -0
  112. package/dist/libs/litepicker/dist/bundle.js +52 -0
  113. package/dist/libs/litepicker/dist/css/litepicker.css +13 -0
  114. package/dist/libs/litepicker/dist/css/plugins/keyboardnav.js.css +12 -0
  115. package/dist/libs/litepicker/dist/css/plugins/mobilefriendly.js.css +133 -0
  116. package/dist/libs/litepicker/dist/css/plugins/multiselect.js.css +54 -0
  117. package/dist/libs/litepicker/dist/css/plugins/ranges.js.css +81 -0
  118. package/dist/libs/litepicker/dist/js/main.js +13 -0
  119. package/dist/libs/litepicker/dist/litepicker.amd.js +12 -0
  120. package/dist/libs/litepicker/dist/litepicker.commonjs2.js +12 -0
  121. package/dist/libs/litepicker/dist/litepicker.umd.js +12 -0
  122. package/dist/libs/litepicker/dist/nocss/litepicker.amd.js +12 -0
  123. package/dist/libs/litepicker/dist/nocss/litepicker.commonjs2.js +12 -0
  124. package/dist/libs/litepicker/dist/nocss/litepicker.js +12 -0
  125. package/dist/libs/litepicker/dist/nocss/litepicker.umd.js +12 -0
  126. package/dist/libs/litepicker/dist/nocss/plugins/keyboardnav.js +11 -0
  127. package/dist/libs/litepicker/dist/nocss/plugins/mobilefriendly.js +11 -0
  128. package/dist/libs/litepicker/dist/nocss/plugins/multiselect.js +11 -0
  129. package/dist/libs/litepicker/dist/nocss/plugins/ranges.js +11 -0
  130. package/dist/libs/litepicker/dist/plugins/keyboardnav.js +11 -0
  131. package/dist/libs/litepicker/dist/plugins/mobilefriendly.js +11 -0
  132. package/dist/libs/litepicker/dist/plugins/multiselect.js +11 -0
  133. package/dist/libs/litepicker/dist/plugins/ranges.js +11 -0
  134. package/dist/libs/litepicker/dist/types/calendar.d.ts +14 -0
  135. package/dist/libs/litepicker/dist/types/core.d.ts +23 -0
  136. package/dist/libs/litepicker/dist/types/datetime.d.ts +41 -0
  137. package/dist/libs/litepicker/dist/types/index.d.ts +4 -0
  138. package/dist/libs/litepicker/dist/types/interfaces.d.ts +80 -0
  139. package/dist/libs/litepicker/dist/types/litepicker.d.ts +25 -0
  140. package/dist/libs/litepicker/dist/types/methods.d.ts +20 -0
  141. package/dist/libs/litepicker/dist/types/utils.d.ts +4 -0
  142. package/dist/libs/litepicker/dist/types/window.d.ts +6 -0
  143. package/dist/libs/nouislider/dist/nouislider.css +304 -0
  144. package/dist/libs/nouislider/dist/nouislider.d.ts +198 -0
  145. package/dist/libs/nouislider/dist/nouislider.js +2254 -0
  146. package/dist/libs/nouislider/dist/nouislider.min.css +1 -0
  147. package/dist/libs/nouislider/dist/nouislider.min.js +1 -1
  148. package/dist/libs/nouislider/dist/nouislider.min.mjs +1 -0
  149. package/dist/libs/nouislider/dist/nouislider.mjs +2243 -0
  150. package/dist/libs/plyr/dist/plyr.css +1 -0
  151. package/dist/libs/plyr/dist/plyr.js +8764 -0
  152. package/dist/libs/plyr/dist/plyr.min.js +2 -0
  153. package/dist/libs/plyr/dist/plyr.min.js.map +1 -0
  154. package/dist/libs/plyr/dist/plyr.min.mjs +1 -0
  155. package/dist/libs/plyr/dist/plyr.min.mjs.map +1 -0
  156. package/dist/libs/plyr/dist/plyr.mjs +8756 -0
  157. package/dist/libs/plyr/dist/plyr.polyfilled.js +9301 -0
  158. package/dist/libs/plyr/dist/plyr.polyfilled.min.js +2 -0
  159. package/dist/libs/plyr/dist/plyr.polyfilled.min.js.map +1 -0
  160. package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs +1 -0
  161. package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs.map +1 -0
  162. package/dist/libs/plyr/dist/plyr.polyfilled.mjs +9293 -0
  163. package/dist/libs/plyr/dist/plyr.svg +1 -0
  164. package/dist/libs/tinymce/CHANGELOG.md +2957 -0
  165. package/dist/libs/tinymce/README.md +71 -0
  166. package/dist/libs/tinymce/bower.json +27 -0
  167. package/dist/libs/tinymce/composer.json +52 -0
  168. package/dist/libs/tinymce/icons/default/icons.js +182 -0
  169. package/dist/libs/tinymce/icons/default/icons.min.js +1 -0
  170. package/dist/libs/tinymce/icons/default/index.js +7 -0
  171. package/dist/libs/tinymce/license.txt +21 -0
  172. package/dist/libs/tinymce/models/dom/index.js +7 -0
  173. package/dist/libs/tinymce/models/dom/model.js +7975 -0
  174. package/dist/libs/tinymce/models/dom/model.min.js +4 -0
  175. package/dist/libs/tinymce/package.json +32 -0
  176. package/dist/libs/tinymce/plugins/advlist/index.js +7 -0
  177. package/dist/libs/tinymce/plugins/advlist/plugin.js +246 -0
  178. package/dist/libs/tinymce/plugins/advlist/plugin.min.js +4 -0
  179. package/dist/libs/tinymce/plugins/anchor/index.js +7 -0
  180. package/dist/libs/tinymce/plugins/anchor/plugin.js +195 -0
  181. package/dist/libs/tinymce/plugins/anchor/plugin.min.js +4 -0
  182. package/dist/libs/tinymce/plugins/autolink/index.js +7 -0
  183. package/dist/libs/tinymce/plugins/autolink/plugin.js +232 -0
  184. package/dist/libs/tinymce/plugins/autolink/plugin.min.js +4 -0
  185. package/dist/libs/tinymce/plugins/autoresize/index.js +7 -0
  186. package/dist/libs/tinymce/plugins/autoresize/plugin.js +156 -0
  187. package/dist/libs/tinymce/plugins/autoresize/plugin.min.js +4 -0
  188. package/dist/libs/tinymce/plugins/autosave/index.js +7 -0
  189. package/dist/libs/tinymce/plugins/autosave/plugin.js +232 -0
  190. package/dist/libs/tinymce/plugins/autosave/plugin.min.js +4 -0
  191. package/dist/libs/tinymce/plugins/charmap/index.js +7 -0
  192. package/dist/libs/tinymce/plugins/charmap/plugin.js +1636 -0
  193. package/dist/libs/tinymce/plugins/charmap/plugin.min.js +4 -0
  194. package/dist/libs/tinymce/plugins/code/index.js +7 -0
  195. package/dist/libs/tinymce/plugins/code/plugin.js +85 -0
  196. package/dist/libs/tinymce/plugins/code/plugin.min.js +4 -0
  197. package/dist/libs/tinymce/plugins/codesample/index.js +7 -0
  198. package/dist/libs/tinymce/plugins/codesample/plugin.js +2451 -0
  199. package/dist/libs/tinymce/plugins/codesample/plugin.min.js +4 -0
  200. package/dist/libs/tinymce/plugins/directionality/index.js +7 -0
  201. package/dist/libs/tinymce/plugins/directionality/plugin.js +384 -0
  202. package/dist/libs/tinymce/plugins/directionality/plugin.min.js +4 -0
  203. package/dist/libs/tinymce/plugins/emoticons/index.js +7 -0
  204. package/dist/libs/tinymce/plugins/emoticons/js/emojiimages.js +1 -0
  205. package/dist/libs/tinymce/plugins/emoticons/js/emojiimages.min.js +3 -0
  206. package/dist/libs/tinymce/plugins/emoticons/js/emojis.js +1 -0
  207. package/dist/libs/tinymce/plugins/emoticons/js/emojis.min.js +2 -0
  208. package/dist/libs/tinymce/plugins/emoticons/plugin.js +577 -0
  209. package/dist/libs/tinymce/plugins/emoticons/plugin.min.js +4 -0
  210. package/dist/libs/tinymce/plugins/fullscreen/index.js +7 -0
  211. package/dist/libs/tinymce/plugins/fullscreen/plugin.js +1190 -0
  212. package/dist/libs/tinymce/plugins/fullscreen/plugin.min.js +4 -0
  213. package/dist/libs/tinymce/plugins/help/index.js +7 -0
  214. package/dist/libs/tinymce/plugins/help/plugin.js +848 -0
  215. package/dist/libs/tinymce/plugins/help/plugin.min.js +4 -0
  216. package/dist/libs/tinymce/plugins/image/index.js +7 -0
  217. package/dist/libs/tinymce/plugins/image/plugin.js +1475 -0
  218. package/dist/libs/tinymce/plugins/image/plugin.min.js +4 -0
  219. package/dist/libs/tinymce/plugins/importcss/index.js +7 -0
  220. package/dist/libs/tinymce/plugins/importcss/plugin.js +342 -0
  221. package/dist/libs/tinymce/plugins/importcss/plugin.min.js +4 -0
  222. package/dist/libs/tinymce/plugins/insertdatetime/index.js +7 -0
  223. package/dist/libs/tinymce/plugins/insertdatetime/plugin.js +176 -0
  224. package/dist/libs/tinymce/plugins/insertdatetime/plugin.min.js +4 -0
  225. package/dist/libs/tinymce/plugins/link/index.js +7 -0
  226. package/dist/libs/tinymce/plugins/link/plugin.js +1190 -0
  227. package/dist/libs/tinymce/plugins/link/plugin.min.js +4 -0
  228. package/dist/libs/tinymce/plugins/lists/index.js +7 -0
  229. package/dist/libs/tinymce/plugins/lists/plugin.js +1820 -0
  230. package/dist/libs/tinymce/plugins/lists/plugin.min.js +4 -0
  231. package/dist/libs/tinymce/plugins/media/index.js +7 -0
  232. package/dist/libs/tinymce/plugins/media/plugin.js +1157 -0
  233. package/dist/libs/tinymce/plugins/media/plugin.min.js +4 -0
  234. package/dist/libs/tinymce/plugins/nonbreaking/index.js +7 -0
  235. package/dist/libs/tinymce/plugins/nonbreaking/plugin.js +111 -0
  236. package/dist/libs/tinymce/plugins/nonbreaking/plugin.min.js +4 -0
  237. package/dist/libs/tinymce/plugins/pagebreak/index.js +7 -0
  238. package/dist/libs/tinymce/plugins/pagebreak/plugin.js +105 -0
  239. package/dist/libs/tinymce/plugins/pagebreak/plugin.min.js +4 -0
  240. package/dist/libs/tinymce/plugins/preview/index.js +7 -0
  241. package/dist/libs/tinymce/plugins/preview/plugin.js +97 -0
  242. package/dist/libs/tinymce/plugins/preview/plugin.min.js +4 -0
  243. package/dist/libs/tinymce/plugins/quickbars/index.js +7 -0
  244. package/dist/libs/tinymce/plugins/quickbars/plugin.js +421 -0
  245. package/dist/libs/tinymce/plugins/quickbars/plugin.min.js +4 -0
  246. package/dist/libs/tinymce/plugins/save/index.js +7 -0
  247. package/dist/libs/tinymce/plugins/save/plugin.js +118 -0
  248. package/dist/libs/tinymce/plugins/save/plugin.min.js +4 -0
  249. package/dist/libs/tinymce/plugins/searchreplace/index.js +7 -0
  250. package/dist/libs/tinymce/plugins/searchreplace/plugin.js +1079 -0
  251. package/dist/libs/tinymce/plugins/searchreplace/plugin.min.js +4 -0
  252. package/dist/libs/tinymce/plugins/table/index.js +7 -0
  253. package/dist/libs/tinymce/plugins/table/plugin.js +3393 -0
  254. package/dist/libs/tinymce/plugins/table/plugin.min.js +4 -0
  255. package/dist/libs/tinymce/plugins/template/index.js +7 -0
  256. package/dist/libs/tinymce/plugins/template/plugin.js +548 -0
  257. package/dist/libs/tinymce/plugins/template/plugin.min.js +4 -0
  258. package/dist/libs/tinymce/plugins/visualblocks/index.js +7 -0
  259. package/dist/libs/tinymce/plugins/visualblocks/plugin.js +98 -0
  260. package/dist/libs/tinymce/plugins/visualblocks/plugin.min.js +4 -0
  261. package/dist/libs/tinymce/plugins/visualchars/index.js +7 -0
  262. package/dist/libs/tinymce/plugins/visualchars/plugin.js +506 -0
  263. package/dist/libs/tinymce/plugins/visualchars/plugin.min.js +4 -0
  264. package/dist/libs/tinymce/plugins/wordcount/index.js +7 -0
  265. package/dist/libs/tinymce/plugins/wordcount/plugin.js +404 -0
  266. package/dist/libs/tinymce/plugins/wordcount/plugin.min.js +4 -0
  267. package/dist/libs/tinymce/skins/content/dark/content.css +66 -0
  268. package/dist/libs/tinymce/skins/content/dark/content.min.css +1 -0
  269. package/dist/libs/tinymce/skins/content/default/content.css +61 -0
  270. package/dist/libs/tinymce/skins/content/default/content.min.css +1 -0
  271. package/dist/libs/tinymce/skins/content/document/content.css +66 -0
  272. package/dist/libs/tinymce/skins/content/document/content.min.css +1 -0
  273. package/dist/libs/tinymce/skins/content/tinymce-5/content.css +61 -0
  274. package/dist/libs/tinymce/skins/content/tinymce-5/content.min.css +1 -0
  275. package/dist/libs/tinymce/skins/content/tinymce-5-dark/content.css +66 -0
  276. package/dist/libs/tinymce/skins/content/tinymce-5-dark/content.min.css +1 -0
  277. package/dist/libs/tinymce/skins/content/writer/content.css +62 -0
  278. package/dist/libs/tinymce/skins/content/writer/content.min.css +1 -0
  279. package/dist/libs/tinymce/skins/ui/oxide/content.css +747 -0
  280. package/dist/libs/tinymce/skins/ui/oxide/content.inline.css +741 -0
  281. package/dist/libs/tinymce/skins/ui/oxide/content.inline.min.css +1 -0
  282. package/dist/libs/tinymce/skins/ui/oxide/content.min.css +1 -0
  283. package/dist/libs/tinymce/skins/ui/oxide/skin.css +3074 -0
  284. package/dist/libs/tinymce/skins/ui/oxide/skin.min.css +1 -0
  285. package/dist/libs/tinymce/skins/ui/oxide/skin.shadowdom.css +30 -0
  286. package/dist/libs/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
  287. package/dist/libs/tinymce/skins/ui/oxide-dark/content.css +728 -0
  288. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.css +741 -0
  289. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -0
  290. package/dist/libs/tinymce/skins/ui/oxide-dark/content.min.css +1 -0
  291. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.css +3077 -0
  292. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
  293. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +30 -0
  294. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
  295. package/dist/libs/tinymce/skins/ui/tinymce-5/content.css +747 -0
  296. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.css +741 -0
  297. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -0
  298. package/dist/libs/tinymce/skins/ui/tinymce-5/content.min.css +1 -0
  299. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.css +3158 -0
  300. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
  301. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.shadowdom.css +30 -0
  302. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
  303. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.css +728 -0
  304. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.css +741 -0
  305. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
  306. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -0
  307. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.css +3158 -0
  308. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
  309. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css +30 -0
  310. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
  311. package/dist/libs/tinymce/themes/silver/index.js +7 -0
  312. package/dist/libs/tinymce/themes/silver/theme.js +26184 -0
  313. package/dist/libs/tinymce/themes/silver/theme.min.js +4 -0
  314. package/dist/libs/tinymce/tinymce.d.ts +2895 -0
  315. package/dist/libs/tinymce/tinymce.js +29400 -0
  316. package/dist/libs/tinymce/tinymce.min.js +4 -0
  317. package/dist/libs/tom-select/dist/js/plugins/caret_position.js +170 -0
  318. package/dist/libs/tom-select/dist/js/plugins/caret_position.js.map +1 -0
  319. package/dist/libs/tom-select/dist/js/plugins/change_listener.js +58 -0
  320. package/dist/libs/tom-select/dist/js/plugins/change_listener.js.map +1 -0
  321. package/dist/libs/tom-select/dist/js/plugins/checkbox_options.js +182 -0
  322. package/dist/libs/tom-select/dist/js/plugins/checkbox_options.js.map +1 -0
  323. package/dist/libs/tom-select/dist/js/plugins/clear_button.js +99 -0
  324. package/dist/libs/tom-select/dist/js/plugins/clear_button.js.map +1 -0
  325. package/dist/libs/tom-select/dist/js/plugins/drag_drop.js +70 -0
  326. package/dist/libs/tom-select/dist/js/plugins/drag_drop.js.map +1 -0
  327. package/dist/libs/tom-select/dist/js/plugins/dropdown_header.js +126 -0
  328. package/dist/libs/tom-select/dist/js/plugins/dropdown_header.js.map +1 -0
  329. package/dist/libs/tom-select/dist/js/plugins/dropdown_input.js +240 -0
  330. package/dist/libs/tom-select/dist/js/plugins/dropdown_input.js.map +1 -0
  331. package/dist/libs/tom-select/dist/js/plugins/input_autogrow.js +84 -0
  332. package/dist/libs/tom-select/dist/js/plugins/input_autogrow.js.map +1 -0
  333. package/dist/libs/tom-select/dist/js/plugins/no_active_items.js +33 -0
  334. package/dist/libs/tom-select/dist/js/plugins/no_active_items.js.map +1 -0
  335. package/dist/libs/tom-select/dist/js/plugins/no_backspace_delete.js +40 -0
  336. package/dist/libs/tom-select/dist/js/plugins/no_backspace_delete.js.map +1 -0
  337. package/dist/libs/tom-select/dist/js/plugins/optgroup_columns.js +117 -0
  338. package/dist/libs/tom-select/dist/js/plugins/optgroup_columns.js.map +1 -0
  339. package/dist/libs/tom-select/dist/js/plugins/remove_button.js +154 -0
  340. package/dist/libs/tom-select/dist/js/plugins/remove_button.js.map +1 -0
  341. package/dist/libs/tom-select/dist/js/plugins/restore_on_backspace.js +51 -0
  342. package/dist/libs/tom-select/dist/js/plugins/restore_on_backspace.js.map +1 -0
  343. package/dist/libs/tom-select/dist/js/plugins/virtual_scroll.js +279 -0
  344. package/dist/libs/tom-select/dist/js/plugins/virtual_scroll.js.map +1 -0
  345. package/dist/libs/tom-select/dist/js/tom-select.base.js +4165 -0
  346. package/dist/libs/tom-select/dist/js/tom-select.base.js.map +1 -0
  347. package/dist/libs/tom-select/dist/js/tom-select.base.min.js +144 -144
  348. package/dist/libs/tom-select/dist/js/tom-select.base.min.js.map +1 -0
  349. package/dist/libs/tom-select/dist/js/tom-select.complete.js +4978 -0
  350. package/dist/libs/tom-select/dist/js/tom-select.complete.js.map +1 -0
  351. package/dist/libs/tom-select/dist/js/tom-select.complete.min.js +363 -0
  352. package/dist/libs/tom-select/dist/js/tom-select.complete.min.js.map +1 -0
  353. package/dist/libs/tom-select/dist/js/tom-select.popular.js +4419 -0
  354. package/dist/libs/tom-select/dist/js/tom-select.popular.js.map +1 -0
  355. package/dist/libs/tom-select/dist/js/tom-select.popular.min.js +323 -0
  356. package/dist/libs/tom-select/dist/js/tom-select.popular.min.js.map +1 -0
  357. package/package.json +50 -29
  358. package/src/scss/_bootstrap-components.scss +1 -1
  359. package/src/scss/_bootstrap-config.scss +1 -0
  360. package/src/scss/_core.scss +1 -0
  361. package/src/scss/_mixins-override.scss +26 -26
  362. package/src/scss/_variables.scss +17 -9
  363. package/src/scss/demo.scss +4 -4
  364. package/src/scss/layout/_core.scss +23 -15
  365. package/src/scss/layout/_dark.scss +17 -13
  366. package/src/scss/layout/_navbar.scss +11 -10
  367. package/src/scss/mixins/_functions.scss +0 -14
  368. package/src/scss/mixins/_mixins.scss +29 -3
  369. package/src/scss/tabler-vendors.scss +4 -0
  370. package/src/scss/ui/_accordion.scss +4 -0
  371. package/src/scss/ui/_alerts.scss +7 -7
  372. package/src/scss/ui/_avatars.scss +11 -11
  373. package/src/scss/ui/_breadcrumbs.scss +1 -1
  374. package/src/scss/ui/_buttons.scss +89 -105
  375. package/src/scss/ui/_cards.scss +25 -28
  376. package/src/scss/ui/_carousel.scss +1 -1
  377. package/src/scss/ui/_datagrid.scss +17 -0
  378. package/src/scss/ui/_flags.scss +1 -1
  379. package/src/scss/ui/_forms.scss +7 -6
  380. package/src/scss/ui/_grid.scss +5 -5
  381. package/src/scss/ui/_legend.scss +1 -1
  382. package/src/scss/ui/_lists.scss +4 -4
  383. package/src/scss/ui/_modals.scss +1 -1
  384. package/src/scss/ui/_nav.scss +1 -1
  385. package/src/scss/ui/_offcanvas.scss +1 -1
  386. package/src/scss/ui/_progress.scss +2 -2
  387. package/src/scss/ui/_status.scss +27 -26
  388. package/src/scss/ui/_toasts.scss +2 -2
  389. package/src/scss/ui/forms/_form-custom.scss +2 -2
  390. package/src/scss/ui/forms/_form-imagecheck.scss +1 -1
  391. package/src/scss/ui/forms/_validation.scss +1 -1
  392. package/src/scss/utils/_colors.scss +9 -7
  393. package/src/scss/vendor/_dropzone.scss +27 -0
  394. package/src/scss/vendor/_fslightbox.scss +13 -0
  395. package/src/scss/vendor/_jsvectormap.scss +5 -5
  396. package/src/scss/vendor/_litepicker.scss +4 -4
  397. package/src/scss/vendor/_plyr.scss +3 -0
  398. package/src/scss/vendor/_tinymce.scss +25 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Tabler v1.0.0-beta10 (https://tabler.io)
3
- * @version 1.0.0-beta10
2
+ * Tabler v1.0.0-beta11 (https://tabler.io)
3
+ * @version 1.0.0-beta11
4
4
  * @link https://tabler.io
5
5
  * Copyright 2018-2022 The Tabler Authors
6
6
  * Copyright 2018-2022 codecalm.net Paweł Kuna
@@ -4632,18 +4632,18 @@ var Popper = /*#__PURE__*/Object.freeze({
4632
4632
  });
4633
4633
 
4634
4634
  /*!
4635
- * Bootstrap v5.1.3 (https://getbootstrap.com/)
4636
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4635
+ * Bootstrap v5.2.0 (https://getbootstrap.com/)
4636
+ * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4637
4637
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4638
4638
  */
4639
4639
  const MAX_UID = 1000000;
4640
4640
  const MILLISECONDS_MULTIPLIER = 1000;
4641
4641
  const TRANSITION_END = 'transitionend';
4642
- const toType = obj => {
4643
- if (obj === null || obj === undefined) {
4644
- return `${obj}`;
4642
+ const toType = object => {
4643
+ if (object === null || object === undefined) {
4644
+ return `${object}`;
4645
4645
  }
4646
- return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
4646
+ return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
4647
4647
  };
4648
4648
  const getUID = prefix => {
4649
4649
  do {
@@ -4654,14 +4654,14 @@ const getUID = prefix => {
4654
4654
  const getSelector = element => {
4655
4655
  let selector = element.getAttribute('data-bs-target');
4656
4656
  if (!selector || selector === '#') {
4657
- let hrefAttr = element.getAttribute('href');
4658
- if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
4657
+ let hrefAttribute = element.getAttribute('href');
4658
+ if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) {
4659
4659
  return null;
4660
4660
  }
4661
- if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
4662
- hrefAttr = `#${hrefAttr.split('#')[1]}`;
4661
+ if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
4662
+ hrefAttribute = `#${hrefAttribute.split('#')[1]}`;
4663
4663
  }
4664
- selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
4664
+ selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null;
4665
4665
  }
4666
4666
  return selector;
4667
4667
  };
@@ -4696,39 +4696,43 @@ const getTransitionDurationFromElement = element => {
4696
4696
  const triggerTransitionEnd = element => {
4697
4697
  element.dispatchEvent(new Event(TRANSITION_END));
4698
4698
  };
4699
- const isElement = obj => {
4700
- if (!obj || typeof obj !== 'object') {
4699
+ const isElement = object => {
4700
+ if (!object || typeof object !== 'object') {
4701
4701
  return false;
4702
4702
  }
4703
- if (typeof obj.jquery !== 'undefined') {
4704
- obj = obj[0];
4703
+ if (typeof object.jquery !== 'undefined') {
4704
+ object = object[0];
4705
4705
  }
4706
- return typeof obj.nodeType !== 'undefined';
4706
+ return typeof object.nodeType !== 'undefined';
4707
4707
  };
4708
- const getElement = obj => {
4709
- if (isElement(obj)) {
4710
- return obj.jquery ? obj[0] : obj;
4708
+ const getElement = object => {
4709
+ if (isElement(object)) {
4710
+ return object.jquery ? object[0] : object;
4711
4711
  }
4712
- if (typeof obj === 'string' && obj.length > 0) {
4713
- return document.querySelector(obj);
4712
+ if (typeof object === 'string' && object.length > 0) {
4713
+ return document.querySelector(object);
4714
4714
  }
4715
4715
  return null;
4716
4716
  };
4717
- const typeCheckConfig = (componentName, config, configTypes) => {
4718
- Object.keys(configTypes).forEach(property => {
4719
- const expectedTypes = configTypes[property];
4720
- const value = config[property];
4721
- const valueType = value && isElement(value) ? 'element' : toType(value);
4722
- if (!new RegExp(expectedTypes).test(valueType)) {
4723
- throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
4724
- }
4725
- });
4726
- };
4727
4717
  const isVisible = element => {
4728
4718
  if (!isElement(element) || element.getClientRects().length === 0) {
4729
4719
  return false;
4730
4720
  }
4731
- return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
4721
+ const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible';
4722
+ const closedDetails = element.closest('details:not([open])');
4723
+ if (!closedDetails) {
4724
+ return elementIsVisible;
4725
+ }
4726
+ if (closedDetails !== element) {
4727
+ const summary = element.closest('summary');
4728
+ if (summary && summary.parentNode !== closedDetails) {
4729
+ return false;
4730
+ }
4731
+ if (summary === null) {
4732
+ return false;
4733
+ }
4734
+ }
4735
+ return elementIsVisible;
4732
4736
  };
4733
4737
  const isDisabled = element => {
4734
4738
  if (!element || element.nodeType !== Node.ELEMENT_NODE) {
@@ -4763,11 +4767,8 @@ const reflow = element => {
4763
4767
  element.offsetHeight;
4764
4768
  };
4765
4769
  const getjQuery = () => {
4766
- const {
4767
- jQuery
4768
- } = window;
4769
- if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
4770
- return jQuery;
4770
+ if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
4771
+ return window.jQuery;
4771
4772
  }
4772
4773
  return null;
4773
4774
  };
@@ -4776,7 +4777,9 @@ const onDOMContentLoaded = callback => {
4776
4777
  if (document.readyState === 'loading') {
4777
4778
  if (!DOMContentLoadedCallbacks.length) {
4778
4779
  document.addEventListener('DOMContentLoaded', () => {
4779
- DOMContentLoadedCallbacks.forEach(callback => callback());
4780
+ for (const callback of DOMContentLoadedCallbacks) {
4781
+ callback();
4782
+ }
4780
4783
  });
4781
4784
  }
4782
4785
  DOMContentLoadedCallbacks.push(callback);
@@ -4831,11 +4834,11 @@ const executeAfterTransition = (callback, transitionElement, waitForTransition =
4831
4834
  }, emulatedDuration);
4832
4835
  };
4833
4836
  const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
4837
+ const listLength = list.length;
4834
4838
  let index = list.indexOf(activeElement);
4835
4839
  if (index === -1) {
4836
- return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
4840
+ return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
4837
4841
  }
4838
- const listLength = list.length;
4839
4842
  index += shouldGetNext ? 1 : -1;
4840
4843
  if (isCycleAllowed) {
4841
4844
  index = (index + listLength) % listLength;
@@ -4851,20 +4854,21 @@ const customEvents = {
4851
4854
  mouseenter: 'mouseover',
4852
4855
  mouseleave: 'mouseout'
4853
4856
  };
4854
- const customEventsRegex = /^(mouseenter|mouseleave)/i;
4855
4857
  const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
4856
- function getUidEvent(element, uid) {
4858
+ function makeEventUid(element, uid) {
4857
4859
  return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
4858
4860
  }
4859
- function getEvent(element) {
4860
- const uid = getUidEvent(element);
4861
+ function getElementEvents(element) {
4862
+ const uid = makeEventUid(element);
4861
4863
  element.uidEvent = uid;
4862
4864
  eventRegistry[uid] = eventRegistry[uid] || {};
4863
4865
  return eventRegistry[uid];
4864
4866
  }
4865
4867
  function bootstrapHandler(element, fn) {
4866
4868
  return function handler(event) {
4867
- event.delegateTarget = element;
4869
+ hydrateObj(event, {
4870
+ delegateTarget: element
4871
+ });
4868
4872
  if (handler.oneOff) {
4869
4873
  EventHandler.off(element, event.type, fn);
4870
4874
  }
@@ -4877,77 +4881,63 @@ function bootstrapDelegationHandler(element, selector, fn) {
4877
4881
  for (let {
4878
4882
  target
4879
4883
  } = event; target && target !== this; target = target.parentNode) {
4880
- for (let i = domElements.length; i--;) {
4881
- if (domElements[i] === target) {
4882
- event.delegateTarget = target;
4883
- if (handler.oneOff) {
4884
- EventHandler.off(element, event.type, selector, fn);
4885
- }
4886
- return fn.apply(target, [event]);
4884
+ for (const domElement of domElements) {
4885
+ if (domElement !== target) {
4886
+ continue;
4887
+ }
4888
+ hydrateObj(event, {
4889
+ delegateTarget: target
4890
+ });
4891
+ if (handler.oneOff) {
4892
+ EventHandler.off(element, event.type, selector, fn);
4887
4893
  }
4894
+ return fn.apply(target, [event]);
4888
4895
  }
4889
4896
  }
4890
- return null;
4891
4897
  };
4892
4898
  }
4893
- function findHandler(events, handler, delegationSelector = null) {
4894
- const uidEventList = Object.keys(events);
4895
- for (let i = 0, len = uidEventList.length; i < len; i++) {
4896
- const event = events[uidEventList[i]];
4897
- if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
4898
- return event;
4899
- }
4900
- }
4901
- return null;
4899
+ function findHandler(events, callable, delegationSelector = null) {
4900
+ return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector);
4902
4901
  }
4903
- function normalizeParams(originalTypeEvent, handler, delegationFn) {
4904
- const delegation = typeof handler === 'string';
4905
- const originalHandler = delegation ? delegationFn : handler;
4902
+ function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
4903
+ const isDelegated = typeof handler === 'string';
4904
+ const callable = isDelegated ? delegationFunction : handler || delegationFunction;
4906
4905
  let typeEvent = getTypeEvent(originalTypeEvent);
4907
- const isNative = nativeEvents.has(typeEvent);
4908
- if (!isNative) {
4906
+ if (!nativeEvents.has(typeEvent)) {
4909
4907
  typeEvent = originalTypeEvent;
4910
4908
  }
4911
- return [delegation, originalHandler, typeEvent];
4909
+ return [isDelegated, callable, typeEvent];
4912
4910
  }
4913
- function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
4911
+ function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
4914
4912
  if (typeof originalTypeEvent !== 'string' || !element) {
4915
4913
  return;
4916
4914
  }
4917
- if (!handler) {
4918
- handler = delegationFn;
4919
- delegationFn = null;
4920
- }
4921
- if (customEventsRegex.test(originalTypeEvent)) {
4922
- const wrapFn = fn => {
4915
+ let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
4916
+ if (originalTypeEvent in customEvents) {
4917
+ const wrapFunction = fn => {
4923
4918
  return function (event) {
4924
4919
  if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
4925
4920
  return fn.call(this, event);
4926
4921
  }
4927
4922
  };
4928
4923
  };
4929
- if (delegationFn) {
4930
- delegationFn = wrapFn(delegationFn);
4931
- } else {
4932
- handler = wrapFn(handler);
4933
- }
4924
+ callable = wrapFunction(callable);
4934
4925
  }
4935
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
4936
- const events = getEvent(element);
4926
+ const events = getElementEvents(element);
4937
4927
  const handlers = events[typeEvent] || (events[typeEvent] = {});
4938
- const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
4939
- if (previousFn) {
4940
- previousFn.oneOff = previousFn.oneOff && oneOff;
4928
+ const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
4929
+ if (previousFunction) {
4930
+ previousFunction.oneOff = previousFunction.oneOff && oneOff;
4941
4931
  return;
4942
4932
  }
4943
- const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
4944
- const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
4945
- fn.delegationSelector = delegation ? handler : null;
4946
- fn.originalHandler = originalHandler;
4933
+ const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
4934
+ const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
4935
+ fn.delegationSelector = isDelegated ? handler : null;
4936
+ fn.callable = callable;
4947
4937
  fn.oneOff = oneOff;
4948
4938
  fn.uidEvent = uid;
4949
4939
  handlers[uid] = fn;
4950
- element.addEventListener(typeEvent, fn, delegation);
4940
+ element.addEventListener(typeEvent, fn, isDelegated);
4951
4941
  }
4952
4942
  function removeHandler(element, events, typeEvent, handler, delegationSelector) {
4953
4943
  const fn = findHandler(events[typeEvent], handler, delegationSelector);
@@ -4959,52 +4949,52 @@ function removeHandler(element, events, typeEvent, handler, delegationSelector)
4959
4949
  }
4960
4950
  function removeNamespacedHandlers(element, events, typeEvent, namespace) {
4961
4951
  const storeElementEvent = events[typeEvent] || {};
4962
- Object.keys(storeElementEvent).forEach(handlerKey => {
4952
+ for (const handlerKey of Object.keys(storeElementEvent)) {
4963
4953
  if (handlerKey.includes(namespace)) {
4964
4954
  const event = storeElementEvent[handlerKey];
4965
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
4955
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
4966
4956
  }
4967
- });
4957
+ }
4968
4958
  }
4969
4959
  function getTypeEvent(event) {
4970
4960
  event = event.replace(stripNameRegex, '');
4971
4961
  return customEvents[event] || event;
4972
4962
  }
4973
4963
  const EventHandler = {
4974
- on(element, event, handler, delegationFn) {
4975
- addHandler(element, event, handler, delegationFn, false);
4964
+ on(element, event, handler, delegationFunction) {
4965
+ addHandler(element, event, handler, delegationFunction, false);
4976
4966
  },
4977
- one(element, event, handler, delegationFn) {
4978
- addHandler(element, event, handler, delegationFn, true);
4967
+ one(element, event, handler, delegationFunction) {
4968
+ addHandler(element, event, handler, delegationFunction, true);
4979
4969
  },
4980
- off(element, originalTypeEvent, handler, delegationFn) {
4970
+ off(element, originalTypeEvent, handler, delegationFunction) {
4981
4971
  if (typeof originalTypeEvent !== 'string' || !element) {
4982
4972
  return;
4983
4973
  }
4984
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
4974
+ const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
4985
4975
  const inNamespace = typeEvent !== originalTypeEvent;
4986
- const events = getEvent(element);
4976
+ const events = getElementEvents(element);
4977
+ const storeElementEvent = events[typeEvent] || {};
4987
4978
  const isNamespace = originalTypeEvent.startsWith('.');
4988
- if (typeof originalHandler !== 'undefined') {
4989
- if (!events || !events[typeEvent]) {
4979
+ if (typeof callable !== 'undefined') {
4980
+ if (!Object.keys(storeElementEvent).length) {
4990
4981
  return;
4991
4982
  }
4992
- removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
4983
+ removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
4993
4984
  return;
4994
4985
  }
4995
4986
  if (isNamespace) {
4996
- Object.keys(events).forEach(elementEvent => {
4987
+ for (const elementEvent of Object.keys(events)) {
4997
4988
  removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
4998
- });
4989
+ }
4999
4990
  }
5000
- const storeElementEvent = events[typeEvent] || {};
5001
- Object.keys(storeElementEvent).forEach(keyHandlers => {
4991
+ for (const keyHandlers of Object.keys(storeElementEvent)) {
5002
4992
  const handlerKey = keyHandlers.replace(stripUidRegex, '');
5003
4993
  if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
5004
4994
  const event = storeElementEvent[keyHandlers];
5005
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
4995
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
5006
4996
  }
5007
- });
4997
+ }
5008
4998
  },
5009
4999
  trigger(element, event, args) {
5010
5000
  if (typeof event !== 'string' || !element) {
@@ -5013,12 +5003,10 @@ const EventHandler = {
5013
5003
  const $ = getjQuery();
5014
5004
  const typeEvent = getTypeEvent(event);
5015
5005
  const inNamespace = event !== typeEvent;
5016
- const isNative = nativeEvents.has(typeEvent);
5017
- let jQueryEvent;
5006
+ let jQueryEvent = null;
5018
5007
  let bubbles = true;
5019
5008
  let nativeDispatch = true;
5020
5009
  let defaultPrevented = false;
5021
- let evt = null;
5022
5010
  if (inNamespace && $) {
5023
5011
  jQueryEvent = $.Event(event, args);
5024
5012
  $(element).trigger(jQueryEvent);
@@ -5026,36 +5014,38 @@ const EventHandler = {
5026
5014
  nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
5027
5015
  defaultPrevented = jQueryEvent.isDefaultPrevented();
5028
5016
  }
5029
- if (isNative) {
5030
- evt = document.createEvent('HTMLEvents');
5031
- evt.initEvent(typeEvent, bubbles, true);
5032
- } else {
5033
- evt = new CustomEvent(event, {
5034
- bubbles,
5035
- cancelable: true
5036
- });
5037
- }
5038
- if (typeof args !== 'undefined') {
5039
- Object.keys(args).forEach(key => {
5040
- Object.defineProperty(evt, key, {
5041
- get() {
5042
- return args[key];
5043
- }
5044
- });
5045
- });
5046
- }
5017
+ let evt = new Event(event, {
5018
+ bubbles,
5019
+ cancelable: true
5020
+ });
5021
+ evt = hydrateObj(evt, args);
5047
5022
  if (defaultPrevented) {
5048
5023
  evt.preventDefault();
5049
5024
  }
5050
5025
  if (nativeDispatch) {
5051
5026
  element.dispatchEvent(evt);
5052
5027
  }
5053
- if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
5028
+ if (evt.defaultPrevented && jQueryEvent) {
5054
5029
  jQueryEvent.preventDefault();
5055
5030
  }
5056
5031
  return evt;
5057
5032
  }
5058
5033
  };
5034
+ function hydrateObj(obj, meta) {
5035
+ for (const [key, value] of Object.entries(meta || {})) {
5036
+ try {
5037
+ obj[key] = value;
5038
+ } catch (_unused) {
5039
+ Object.defineProperty(obj, key, {
5040
+ configurable: true,
5041
+ get() {
5042
+ return value;
5043
+ }
5044
+ });
5045
+ }
5046
+ }
5047
+ return obj;
5048
+ }
5059
5049
  const elementMap = new Map();
5060
5050
  const Data = {
5061
5051
  set(element, key, instance) {
@@ -5086,26 +5076,121 @@ const Data = {
5086
5076
  }
5087
5077
  }
5088
5078
  };
5089
- const VERSION = '5.1.3';
5090
- class BaseComponent {
5091
- constructor(element) {
5079
+ function normalizeData(value) {
5080
+ if (value === 'true') {
5081
+ return true;
5082
+ }
5083
+ if (value === 'false') {
5084
+ return false;
5085
+ }
5086
+ if (value === Number(value).toString()) {
5087
+ return Number(value);
5088
+ }
5089
+ if (value === '' || value === 'null') {
5090
+ return null;
5091
+ }
5092
+ if (typeof value !== 'string') {
5093
+ return value;
5094
+ }
5095
+ try {
5096
+ return JSON.parse(decodeURIComponent(value));
5097
+ } catch (_unused) {
5098
+ return value;
5099
+ }
5100
+ }
5101
+ function normalizeDataKey(key) {
5102
+ return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
5103
+ }
5104
+ const Manipulator = {
5105
+ setDataAttribute(element, key, value) {
5106
+ element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
5107
+ },
5108
+ removeDataAttribute(element, key) {
5109
+ element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
5110
+ },
5111
+ getDataAttributes(element) {
5112
+ if (!element) {
5113
+ return {};
5114
+ }
5115
+ const attributes = {};
5116
+ const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'));
5117
+ for (const key of bsKeys) {
5118
+ let pureKey = key.replace(/^bs/, '');
5119
+ pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
5120
+ attributes[pureKey] = normalizeData(element.dataset[key]);
5121
+ }
5122
+ return attributes;
5123
+ },
5124
+ getDataAttribute(element, key) {
5125
+ return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
5126
+ }
5127
+ };
5128
+ class Config {
5129
+ static get Default() {
5130
+ return {};
5131
+ }
5132
+ static get DefaultType() {
5133
+ return {};
5134
+ }
5135
+ static get NAME() {
5136
+ throw new Error('You have to implement the static method "NAME", for each component!');
5137
+ }
5138
+ _getConfig(config) {
5139
+ config = this._mergeConfigObj(config);
5140
+ config = this._configAfterMerge(config);
5141
+ this._typeCheckConfig(config);
5142
+ return config;
5143
+ }
5144
+ _configAfterMerge(config) {
5145
+ return config;
5146
+ }
5147
+ _mergeConfigObj(config, element) {
5148
+ const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {};
5149
+ return { ...this.constructor.Default,
5150
+ ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
5151
+ ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),
5152
+ ...(typeof config === 'object' ? config : {})
5153
+ };
5154
+ }
5155
+ _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
5156
+ for (const property of Object.keys(configTypes)) {
5157
+ const expectedTypes = configTypes[property];
5158
+ const value = config[property];
5159
+ const valueType = isElement(value) ? 'element' : toType(value);
5160
+ if (!new RegExp(expectedTypes).test(valueType)) {
5161
+ throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
5162
+ }
5163
+ }
5164
+ }
5165
+ }
5166
+ const VERSION = '5.2.0';
5167
+ class BaseComponent extends Config {
5168
+ constructor(element, config) {
5169
+ super();
5092
5170
  element = getElement(element);
5093
5171
  if (!element) {
5094
5172
  return;
5095
5173
  }
5096
5174
  this._element = element;
5175
+ this._config = this._getConfig(config);
5097
5176
  Data.set(this._element, this.constructor.DATA_KEY, this);
5098
5177
  }
5099
5178
  dispose() {
5100
5179
  Data.remove(this._element, this.constructor.DATA_KEY);
5101
5180
  EventHandler.off(this._element, this.constructor.EVENT_KEY);
5102
- Object.getOwnPropertyNames(this).forEach(propertyName => {
5181
+ for (const propertyName of Object.getOwnPropertyNames(this)) {
5103
5182
  this[propertyName] = null;
5104
- });
5183
+ }
5105
5184
  }
5106
5185
  _queueCallback(callback, element, isAnimated = true) {
5107
5186
  executeAfterTransition(callback, element, isAnimated);
5108
5187
  }
5188
+ _getConfig(config) {
5189
+ config = this._mergeConfigObj(config, this._element);
5190
+ config = this._configAfterMerge(config);
5191
+ this._typeCheckConfig(config);
5192
+ return config;
5193
+ }
5109
5194
  static getInstance(element) {
5110
5195
  return Data.get(getElement(element), this.DATA_KEY);
5111
5196
  }
@@ -5115,15 +5200,15 @@ class BaseComponent {
5115
5200
  static get VERSION() {
5116
5201
  return VERSION;
5117
5202
  }
5118
- static get NAME() {
5119
- throw new Error('You have to implement the static method "NAME", for each component!');
5120
- }
5121
5203
  static get DATA_KEY() {
5122
5204
  return `bs.${this.NAME}`;
5123
5205
  }
5124
5206
  static get EVENT_KEY() {
5125
5207
  return `.${this.DATA_KEY}`;
5126
5208
  }
5209
+ static eventName(name) {
5210
+ return `${name}${this.EVENT_KEY}`;
5211
+ }
5127
5212
  }
5128
5213
  const enableDismissTrigger = (component, method = 'hide') => {
5129
5214
  const clickEvent = `click.dismiss${component.EVENT_KEY}`;
@@ -5140,16 +5225,16 @@ const enableDismissTrigger = (component, method = 'hide') => {
5140
5225
  instance[method]();
5141
5226
  });
5142
5227
  };
5143
- const NAME$d = 'alert';
5144
- const DATA_KEY$c = 'bs.alert';
5145
- const EVENT_KEY$c = `.${DATA_KEY$c}`;
5146
- const EVENT_CLOSE = `close${EVENT_KEY$c}`;
5147
- const EVENT_CLOSED = `closed${EVENT_KEY$c}`;
5228
+ const NAME$f = 'alert';
5229
+ const DATA_KEY$a = 'bs.alert';
5230
+ const EVENT_KEY$b = `.${DATA_KEY$a}`;
5231
+ const EVENT_CLOSE = `close${EVENT_KEY$b}`;
5232
+ const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
5148
5233
  const CLASS_NAME_FADE$5 = 'fade';
5149
5234
  const CLASS_NAME_SHOW$8 = 'show';
5150
5235
  class Alert extends BaseComponent {
5151
5236
  static get NAME() {
5152
- return NAME$d;
5237
+ return NAME$f;
5153
5238
  }
5154
5239
  close() {
5155
5240
  const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
@@ -5180,16 +5265,16 @@ class Alert extends BaseComponent {
5180
5265
  }
5181
5266
  enableDismissTrigger(Alert, 'close');
5182
5267
  defineJQueryPlugin(Alert);
5183
- const NAME$c = 'button';
5184
- const DATA_KEY$b = 'bs.button';
5185
- const EVENT_KEY$b = `.${DATA_KEY$b}`;
5186
- const DATA_API_KEY$7 = '.data-api';
5268
+ const NAME$e = 'button';
5269
+ const DATA_KEY$9 = 'bs.button';
5270
+ const EVENT_KEY$a = `.${DATA_KEY$9}`;
5271
+ const DATA_API_KEY$6 = '.data-api';
5187
5272
  const CLASS_NAME_ACTIVE$3 = 'active';
5188
5273
  const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
5189
- const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
5274
+ const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
5190
5275
  class Button extends BaseComponent {
5191
5276
  static get NAME() {
5192
- return NAME$c;
5277
+ return NAME$e;
5193
5278
  }
5194
5279
  toggle() {
5195
5280
  this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3));
@@ -5210,61 +5295,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event
5210
5295
  data.toggle();
5211
5296
  });
5212
5297
  defineJQueryPlugin(Button);
5213
- function normalizeData(val) {
5214
- if (val === 'true') {
5215
- return true;
5216
- }
5217
- if (val === 'false') {
5218
- return false;
5219
- }
5220
- if (val === Number(val).toString()) {
5221
- return Number(val);
5222
- }
5223
- if (val === '' || val === 'null') {
5224
- return null;
5225
- }
5226
- return val;
5227
- }
5228
- function normalizeDataKey(key) {
5229
- return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
5230
- }
5231
- const Manipulator = {
5232
- setDataAttribute(element, key, value) {
5233
- element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
5234
- },
5235
- removeDataAttribute(element, key) {
5236
- element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
5237
- },
5238
- getDataAttributes(element) {
5239
- if (!element) {
5240
- return {};
5241
- }
5242
- const attributes = {};
5243
- Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => {
5244
- let pureKey = key.replace(/^bs/, '');
5245
- pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
5246
- attributes[pureKey] = normalizeData(element.dataset[key]);
5247
- });
5248
- return attributes;
5249
- },
5250
- getDataAttribute(element, key) {
5251
- return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
5252
- },
5253
- offset(element) {
5254
- const rect = element.getBoundingClientRect();
5255
- return {
5256
- top: rect.top + window.pageYOffset,
5257
- left: rect.left + window.pageXOffset
5258
- };
5259
- },
5260
- position(element) {
5261
- return {
5262
- top: element.offsetTop,
5263
- left: element.offsetLeft
5264
- };
5265
- }
5266
- };
5267
- const NODE_TEXT = 3;
5268
5298
  const SelectorEngine = {
5269
5299
  find(selector, element = document.documentElement) {
5270
5300
  return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
@@ -5277,12 +5307,10 @@ const SelectorEngine = {
5277
5307
  },
5278
5308
  parents(element, selector) {
5279
5309
  const parents = [];
5280
- let ancestor = element.parentNode;
5281
- while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
5282
- if (ancestor.matches(selector)) {
5283
- parents.push(ancestor);
5284
- }
5285
- ancestor = ancestor.parentNode;
5310
+ let ancestor = element.parentNode.closest(selector);
5311
+ while (ancestor) {
5312
+ parents.push(ancestor);
5313
+ ancestor = ancestor.parentNode.closest(selector);
5286
5314
  }
5287
5315
  return parents;
5288
5316
  },
@@ -5307,55 +5335,123 @@ const SelectorEngine = {
5307
5335
  return [];
5308
5336
  },
5309
5337
  focusableChildren(element) {
5310
- const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
5338
+ const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(',');
5311
5339
  return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
5312
5340
  }
5313
5341
  };
5314
- const NAME$b = 'carousel';
5315
- const DATA_KEY$a = 'bs.carousel';
5316
- const EVENT_KEY$a = `.${DATA_KEY$a}`;
5317
- const DATA_API_KEY$6 = '.data-api';
5318
- const ARROW_LEFT_KEY = 'ArrowLeft';
5319
- const ARROW_RIGHT_KEY = 'ArrowRight';
5320
- const TOUCHEVENT_COMPAT_WAIT = 500;
5342
+ const NAME$d = 'swipe';
5343
+ const EVENT_KEY$9 = '.bs.swipe';
5344
+ const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
5345
+ const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
5346
+ const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
5347
+ const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
5348
+ const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
5349
+ const POINTER_TYPE_TOUCH = 'touch';
5350
+ const POINTER_TYPE_PEN = 'pen';
5351
+ const CLASS_NAME_POINTER_EVENT = 'pointer-event';
5321
5352
  const SWIPE_THRESHOLD = 40;
5322
- const Default$a = {
5323
- interval: 5000,
5324
- keyboard: true,
5325
- slide: false,
5326
- pause: 'hover',
5327
- wrap: true,
5328
- touch: true
5353
+ const Default$c = {
5354
+ endCallback: null,
5355
+ leftCallback: null,
5356
+ rightCallback: null
5329
5357
  };
5330
- const DefaultType$a = {
5331
- interval: '(number|boolean)',
5332
- keyboard: 'boolean',
5333
- slide: '(boolean|string)',
5334
- pause: '(string|boolean)',
5335
- wrap: 'boolean',
5336
- touch: 'boolean'
5358
+ const DefaultType$c = {
5359
+ endCallback: '(function|null)',
5360
+ leftCallback: '(function|null)',
5361
+ rightCallback: '(function|null)'
5337
5362
  };
5363
+ class Swipe extends Config {
5364
+ constructor(element, config) {
5365
+ super();
5366
+ this._element = element;
5367
+ if (!element || !Swipe.isSupported()) {
5368
+ return;
5369
+ }
5370
+ this._config = this._getConfig(config);
5371
+ this._deltaX = 0;
5372
+ this._supportPointerEvents = Boolean(window.PointerEvent);
5373
+ this._initEvents();
5374
+ }
5375
+ static get Default() {
5376
+ return Default$c;
5377
+ }
5378
+ static get DefaultType() {
5379
+ return DefaultType$c;
5380
+ }
5381
+ static get NAME() {
5382
+ return NAME$d;
5383
+ }
5384
+ dispose() {
5385
+ EventHandler.off(this._element, EVENT_KEY$9);
5386
+ }
5387
+ _start(event) {
5388
+ if (!this._supportPointerEvents) {
5389
+ this._deltaX = event.touches[0].clientX;
5390
+ return;
5391
+ }
5392
+ if (this._eventIsPointerPenTouch(event)) {
5393
+ this._deltaX = event.clientX;
5394
+ }
5395
+ }
5396
+ _end(event) {
5397
+ if (this._eventIsPointerPenTouch(event)) {
5398
+ this._deltaX = event.clientX - this._deltaX;
5399
+ }
5400
+ this._handleSwipe();
5401
+ execute(this._config.endCallback);
5402
+ }
5403
+ _move(event) {
5404
+ this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX;
5405
+ }
5406
+ _handleSwipe() {
5407
+ const absDeltaX = Math.abs(this._deltaX);
5408
+ if (absDeltaX <= SWIPE_THRESHOLD) {
5409
+ return;
5410
+ }
5411
+ const direction = absDeltaX / this._deltaX;
5412
+ this._deltaX = 0;
5413
+ if (!direction) {
5414
+ return;
5415
+ }
5416
+ execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback);
5417
+ }
5418
+ _initEvents() {
5419
+ if (this._supportPointerEvents) {
5420
+ EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event));
5421
+ EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event));
5422
+ this._element.classList.add(CLASS_NAME_POINTER_EVENT);
5423
+ } else {
5424
+ EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event));
5425
+ EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event));
5426
+ EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event));
5427
+ }
5428
+ }
5429
+ _eventIsPointerPenTouch(event) {
5430
+ return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
5431
+ }
5432
+ static isSupported() {
5433
+ return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
5434
+ }
5435
+ }
5436
+ const NAME$c = 'carousel';
5437
+ const DATA_KEY$8 = 'bs.carousel';
5438
+ const EVENT_KEY$8 = `.${DATA_KEY$8}`;
5439
+ const DATA_API_KEY$5 = '.data-api';
5440
+ const ARROW_LEFT_KEY$1 = 'ArrowLeft';
5441
+ const ARROW_RIGHT_KEY$1 = 'ArrowRight';
5442
+ const TOUCHEVENT_COMPAT_WAIT = 500;
5338
5443
  const ORDER_NEXT = 'next';
5339
5444
  const ORDER_PREV = 'prev';
5340
5445
  const DIRECTION_LEFT = 'left';
5341
5446
  const DIRECTION_RIGHT = 'right';
5342
- const KEY_TO_DIRECTION = {
5343
- [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
5344
- [ARROW_RIGHT_KEY]: DIRECTION_LEFT
5345
- };
5346
- const EVENT_SLIDE = `slide${EVENT_KEY$a}`;
5347
- const EVENT_SLID = `slid${EVENT_KEY$a}`;
5348
- const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`;
5349
- const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`;
5350
- const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`;
5351
- const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`;
5352
- const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`;
5353
- const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`;
5354
- const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`;
5355
- const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`;
5356
- const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`;
5357
- const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`;
5358
- const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
5447
+ const EVENT_SLIDE = `slide${EVENT_KEY$8}`;
5448
+ const EVENT_SLID = `slid${EVENT_KEY$8}`;
5449
+ const EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`;
5450
+ const EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`;
5451
+ const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`;
5452
+ const EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`;
5453
+ const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`;
5454
+ const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
5359
5455
  const CLASS_NAME_CAROUSEL = 'carousel';
5360
5456
  const CLASS_NAME_ACTIVE$2 = 'active';
5361
5457
  const CLASS_NAME_SLIDE = 'slide';
@@ -5363,40 +5459,55 @@ const CLASS_NAME_END = 'carousel-item-end';
5363
5459
  const CLASS_NAME_START = 'carousel-item-start';
5364
5460
  const CLASS_NAME_NEXT = 'carousel-item-next';
5365
5461
  const CLASS_NAME_PREV = 'carousel-item-prev';
5366
- const CLASS_NAME_POINTER_EVENT = 'pointer-event';
5367
- const SELECTOR_ACTIVE$1 = '.active';
5368
- const SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
5462
+ const SELECTOR_ACTIVE = '.active';
5369
5463
  const SELECTOR_ITEM = '.carousel-item';
5464
+ const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
5370
5465
  const SELECTOR_ITEM_IMG = '.carousel-item img';
5371
- const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
5372
5466
  const SELECTOR_INDICATORS = '.carousel-indicators';
5373
- const SELECTOR_INDICATOR = '[data-bs-target]';
5374
5467
  const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
5375
5468
  const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
5376
- const POINTER_TYPE_TOUCH = 'touch';
5377
- const POINTER_TYPE_PEN = 'pen';
5469
+ const KEY_TO_DIRECTION = {
5470
+ [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT,
5471
+ [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT
5472
+ };
5473
+ const Default$b = {
5474
+ interval: 5000,
5475
+ keyboard: true,
5476
+ pause: 'hover',
5477
+ ride: false,
5478
+ touch: true,
5479
+ wrap: true
5480
+ };
5481
+ const DefaultType$b = {
5482
+ interval: '(number|boolean)',
5483
+ keyboard: 'boolean',
5484
+ pause: '(string|boolean)',
5485
+ ride: '(boolean|string)',
5486
+ touch: 'boolean',
5487
+ wrap: 'boolean'
5488
+ };
5378
5489
  class Carousel extends BaseComponent {
5379
5490
  constructor(element, config) {
5380
- super(element);
5381
- this._items = null;
5491
+ super(element, config);
5382
5492
  this._interval = null;
5383
5493
  this._activeElement = null;
5384
- this._isPaused = false;
5385
5494
  this._isSliding = false;
5386
5495
  this.touchTimeout = null;
5387
- this.touchStartX = 0;
5388
- this.touchDeltaX = 0;
5389
- this._config = this._getConfig(config);
5496
+ this._swipeHelper = null;
5390
5497
  this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
5391
- this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
5392
- this._pointerEvent = Boolean(window.PointerEvent);
5393
5498
  this._addEventListeners();
5499
+ if (this._config.ride === CLASS_NAME_CAROUSEL) {
5500
+ this.cycle();
5501
+ }
5394
5502
  }
5395
5503
  static get Default() {
5396
- return Default$a;
5504
+ return Default$b;
5505
+ }
5506
+ static get DefaultType() {
5507
+ return DefaultType$b;
5397
5508
  }
5398
5509
  static get NAME() {
5399
- return NAME$b;
5510
+ return NAME$c;
5400
5511
  }
5401
5512
  next() {
5402
5513
  this._slide(ORDER_NEXT);
@@ -5409,119 +5520,85 @@ class Carousel extends BaseComponent {
5409
5520
  prev() {
5410
5521
  this._slide(ORDER_PREV);
5411
5522
  }
5412
- pause(event) {
5413
- if (!event) {
5414
- this._isPaused = true;
5415
- }
5416
- if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
5523
+ pause() {
5524
+ if (this._isSliding) {
5417
5525
  triggerTransitionEnd(this._element);
5418
- this.cycle(true);
5419
5526
  }
5420
- clearInterval(this._interval);
5421
- this._interval = null;
5527
+ this._clearInterval();
5422
5528
  }
5423
- cycle(event) {
5424
- if (!event) {
5425
- this._isPaused = false;
5426
- }
5427
- if (this._interval) {
5428
- clearInterval(this._interval);
5429
- this._interval = null;
5529
+ cycle() {
5530
+ this._clearInterval();
5531
+ this._updateInterval();
5532
+ this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
5533
+ }
5534
+ _maybeEnableCycle() {
5535
+ if (!this._config.ride) {
5536
+ return;
5430
5537
  }
5431
- if (this._config && this._config.interval && !this._isPaused) {
5432
- this._updateInterval();
5433
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
5538
+ if (this._isSliding) {
5539
+ EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
5540
+ return;
5434
5541
  }
5542
+ this.cycle();
5435
5543
  }
5436
5544
  to(index) {
5437
- this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
5438
- const activeIndex = this._getItemIndex(this._activeElement);
5439
- if (index > this._items.length - 1 || index < 0) {
5545
+ const items = this._getItems();
5546
+ if (index > items.length - 1 || index < 0) {
5440
5547
  return;
5441
5548
  }
5442
5549
  if (this._isSliding) {
5443
5550
  EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
5444
5551
  return;
5445
5552
  }
5553
+ const activeIndex = this._getItemIndex(this._getActive());
5446
5554
  if (activeIndex === index) {
5447
- this.pause();
5448
- this.cycle();
5449
5555
  return;
5450
5556
  }
5451
5557
  const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
5452
- this._slide(order, this._items[index]);
5558
+ this._slide(order, items[index]);
5453
5559
  }
5454
- _getConfig(config) {
5455
- config = { ...Default$a,
5456
- ...Manipulator.getDataAttributes(this._element),
5457
- ...(typeof config === 'object' ? config : {})
5458
- };
5459
- typeCheckConfig(NAME$b, config, DefaultType$a);
5560
+ dispose() {
5561
+ if (this._swipeHelper) {
5562
+ this._swipeHelper.dispose();
5563
+ }
5564
+ super.dispose();
5565
+ }
5566
+ _configAfterMerge(config) {
5567
+ config.defaultInterval = config.interval;
5460
5568
  return config;
5461
5569
  }
5462
- _handleSwipe() {
5463
- const absDeltax = Math.abs(this.touchDeltaX);
5464
- if (absDeltax <= SWIPE_THRESHOLD) {
5465
- return;
5466
- }
5467
- const direction = absDeltax / this.touchDeltaX;
5468
- this.touchDeltaX = 0;
5469
- if (!direction) {
5470
- return;
5471
- }
5472
- this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
5473
- }
5474
5570
  _addEventListeners() {
5475
5571
  if (this._config.keyboard) {
5476
- EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
5572
+ EventHandler.on(this._element, EVENT_KEYDOWN$1, event => this._keydown(event));
5477
5573
  }
5478
5574
  if (this._config.pause === 'hover') {
5479
- EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event));
5480
- EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event));
5575
+ EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause());
5576
+ EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle());
5481
5577
  }
5482
- if (this._config.touch && this._touchSupported) {
5578
+ if (this._config.touch && Swipe.isSupported()) {
5483
5579
  this._addTouchEventListeners();
5484
5580
  }
5485
5581
  }
5486
5582
  _addTouchEventListeners() {
5487
- const hasPointerPenTouch = event => {
5488
- return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
5489
- };
5490
- const start = event => {
5491
- if (hasPointerPenTouch(event)) {
5492
- this.touchStartX = event.clientX;
5493
- } else if (!this._pointerEvent) {
5494
- this.touchStartX = event.touches[0].clientX;
5583
+ for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {
5584
+ EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault());
5585
+ }
5586
+ const endCallBack = () => {
5587
+ if (this._config.pause !== 'hover') {
5588
+ return;
5495
5589
  }
5496
- };
5497
- const move = event => {
5498
- this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
5499
- };
5500
- const end = event => {
5501
- if (hasPointerPenTouch(event)) {
5502
- this.touchDeltaX = event.clientX - this.touchStartX;
5503
- }
5504
- this._handleSwipe();
5505
- if (this._config.pause === 'hover') {
5506
- this.pause();
5507
- if (this.touchTimeout) {
5508
- clearTimeout(this.touchTimeout);
5509
- }
5510
- this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
5590
+ this.pause();
5591
+ if (this.touchTimeout) {
5592
+ clearTimeout(this.touchTimeout);
5511
5593
  }
5594
+ this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
5512
5595
  };
5513
- SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
5514
- EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault());
5515
- });
5516
- if (this._pointerEvent) {
5517
- EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event));
5518
- EventHandler.on(this._element, EVENT_POINTERUP, event => end(event));
5519
- this._element.classList.add(CLASS_NAME_POINTER_EVENT);
5520
- } else {
5521
- EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event));
5522
- EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event));
5523
- EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event));
5524
- }
5596
+ const swipeConfig = {
5597
+ leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
5598
+ rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
5599
+ endCallback: endCallBack
5600
+ };
5601
+ this._swipeHelper = new Swipe(this._element, swipeConfig);
5525
5602
  }
5526
5603
  _keydown(event) {
5527
5604
  if (/input|textarea/i.test(event.target.tagName)) {
@@ -5530,207 +5607,162 @@ class Carousel extends BaseComponent {
5530
5607
  const direction = KEY_TO_DIRECTION[event.key];
5531
5608
  if (direction) {
5532
5609
  event.preventDefault();
5533
- this._slide(direction);
5610
+ this._slide(this._directionToOrder(direction));
5534
5611
  }
5535
5612
  }
5536
5613
  _getItemIndex(element) {
5537
- this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
5538
- return this._items.indexOf(element);
5539
- }
5540
- _getItemByOrder(order, activeElement) {
5541
- const isNext = order === ORDER_NEXT;
5542
- return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
5543
- }
5544
- _triggerSlideEvent(relatedTarget, eventDirectionName) {
5545
- const targetIndex = this._getItemIndex(relatedTarget);
5546
- const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
5547
- return EventHandler.trigger(this._element, EVENT_SLIDE, {
5548
- relatedTarget,
5549
- direction: eventDirectionName,
5550
- from: fromIndex,
5551
- to: targetIndex
5552
- });
5614
+ return this._getItems().indexOf(element);
5553
5615
  }
5554
- _setActiveIndicatorElement(element) {
5555
- if (this._indicatorsElement) {
5556
- const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
5557
- activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
5558
- activeIndicator.removeAttribute('aria-current');
5559
- const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
5560
- for (let i = 0; i < indicators.length; i++) {
5561
- if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {
5562
- indicators[i].classList.add(CLASS_NAME_ACTIVE$2);
5563
- indicators[i].setAttribute('aria-current', 'true');
5564
- break;
5565
- }
5566
- }
5616
+ _setActiveIndicatorElement(index) {
5617
+ if (!this._indicatorsElement) {
5618
+ return;
5619
+ }
5620
+ const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
5621
+ activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
5622
+ activeIndicator.removeAttribute('aria-current');
5623
+ const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement);
5624
+ if (newActiveIndicator) {
5625
+ newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2);
5626
+ newActiveIndicator.setAttribute('aria-current', 'true');
5567
5627
  }
5568
5628
  }
5569
5629
  _updateInterval() {
5570
- const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
5630
+ const element = this._activeElement || this._getActive();
5571
5631
  if (!element) {
5572
5632
  return;
5573
5633
  }
5574
5634
  const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
5575
- if (elementInterval) {
5576
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
5577
- this._config.interval = elementInterval;
5578
- } else {
5579
- this._config.interval = this._config.defaultInterval || this._config.interval;
5580
- }
5635
+ this._config.interval = elementInterval || this._config.defaultInterval;
5581
5636
  }
5582
- _slide(directionOrOrder, element) {
5583
- const order = this._directionToOrder(directionOrOrder);
5584
- const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
5585
- const activeElementIndex = this._getItemIndex(activeElement);
5586
- const nextElement = element || this._getItemByOrder(order, activeElement);
5587
- const nextElementIndex = this._getItemIndex(nextElement);
5588
- const isCycling = Boolean(this._interval);
5589
- const isNext = order === ORDER_NEXT;
5590
- const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
5591
- const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
5592
- const eventDirectionName = this._orderToDirection(order);
5593
- if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) {
5594
- this._isSliding = false;
5637
+ _slide(order, element = null) {
5638
+ if (this._isSliding) {
5595
5639
  return;
5596
5640
  }
5597
- if (this._isSliding) {
5641
+ const activeElement = this._getActive();
5642
+ const isNext = order === ORDER_NEXT;
5643
+ const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
5644
+ if (nextElement === activeElement) {
5598
5645
  return;
5599
5646
  }
5600
- const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
5647
+ const nextElementIndex = this._getItemIndex(nextElement);
5648
+ const triggerEvent = eventName => {
5649
+ return EventHandler.trigger(this._element, eventName, {
5650
+ relatedTarget: nextElement,
5651
+ direction: this._orderToDirection(order),
5652
+ from: this._getItemIndex(activeElement),
5653
+ to: nextElementIndex
5654
+ });
5655
+ };
5656
+ const slideEvent = triggerEvent(EVENT_SLIDE);
5601
5657
  if (slideEvent.defaultPrevented) {
5602
5658
  return;
5603
5659
  }
5604
5660
  if (!activeElement || !nextElement) {
5605
5661
  return;
5606
5662
  }
5663
+ const isCycling = Boolean(this._interval);
5664
+ this.pause();
5607
5665
  this._isSliding = true;
5608
- if (isCycling) {
5609
- this.pause();
5610
- }
5611
- this._setActiveIndicatorElement(nextElement);
5666
+ this._setActiveIndicatorElement(nextElementIndex);
5612
5667
  this._activeElement = nextElement;
5613
- const triggerSlidEvent = () => {
5614
- EventHandler.trigger(this._element, EVENT_SLID, {
5615
- relatedTarget: nextElement,
5616
- direction: eventDirectionName,
5617
- from: activeElementIndex,
5618
- to: nextElementIndex
5619
- });
5620
- };
5621
- if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
5622
- nextElement.classList.add(orderClassName);
5623
- reflow(nextElement);
5624
- activeElement.classList.add(directionalClassName);
5625
- nextElement.classList.add(directionalClassName);
5626
- const completeCallBack = () => {
5627
- nextElement.classList.remove(directionalClassName, orderClassName);
5628
- nextElement.classList.add(CLASS_NAME_ACTIVE$2);
5629
- activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
5630
- this._isSliding = false;
5631
- setTimeout(triggerSlidEvent, 0);
5632
- };
5633
- this._queueCallback(completeCallBack, activeElement, true);
5634
- } else {
5635
- activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
5668
+ const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
5669
+ const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
5670
+ nextElement.classList.add(orderClassName);
5671
+ reflow(nextElement);
5672
+ activeElement.classList.add(directionalClassName);
5673
+ nextElement.classList.add(directionalClassName);
5674
+ const completeCallBack = () => {
5675
+ nextElement.classList.remove(directionalClassName, orderClassName);
5636
5676
  nextElement.classList.add(CLASS_NAME_ACTIVE$2);
5677
+ activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
5637
5678
  this._isSliding = false;
5638
- triggerSlidEvent();
5639
- }
5679
+ triggerEvent(EVENT_SLID);
5680
+ };
5681
+ this._queueCallback(completeCallBack, activeElement, this._isAnimated());
5640
5682
  if (isCycling) {
5641
5683
  this.cycle();
5642
5684
  }
5643
5685
  }
5644
- _directionToOrder(direction) {
5645
- if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
5646
- return direction;
5686
+ _isAnimated() {
5687
+ return this._element.classList.contains(CLASS_NAME_SLIDE);
5688
+ }
5689
+ _getActive() {
5690
+ return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
5691
+ }
5692
+ _getItems() {
5693
+ return SelectorEngine.find(SELECTOR_ITEM, this._element);
5694
+ }
5695
+ _clearInterval() {
5696
+ if (this._interval) {
5697
+ clearInterval(this._interval);
5698
+ this._interval = null;
5647
5699
  }
5700
+ }
5701
+ _directionToOrder(direction) {
5648
5702
  if (isRTL()) {
5649
5703
  return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
5650
5704
  }
5651
5705
  return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
5652
5706
  }
5653
5707
  _orderToDirection(order) {
5654
- if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
5655
- return order;
5656
- }
5657
5708
  if (isRTL()) {
5658
5709
  return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
5659
5710
  }
5660
5711
  return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
5661
5712
  }
5662
- static carouselInterface(element, config) {
5663
- const data = Carousel.getOrCreateInstance(element, config);
5664
- let {
5665
- _config
5666
- } = data;
5667
- if (typeof config === 'object') {
5668
- _config = { ..._config,
5669
- ...config
5670
- };
5671
- }
5672
- const action = typeof config === 'string' ? config : _config.slide;
5673
- if (typeof config === 'number') {
5674
- data.to(config);
5675
- } else if (typeof action === 'string') {
5676
- if (typeof data[action] === 'undefined') {
5677
- throw new TypeError(`No method named "${action}"`);
5678
- }
5679
- data[action]();
5680
- } else if (_config.interval && _config.ride) {
5681
- data.pause();
5682
- data.cycle();
5683
- }
5684
- }
5685
5713
  static jQueryInterface(config) {
5686
5714
  return this.each(function () {
5687
- Carousel.carouselInterface(this, config);
5715
+ const data = Carousel.getOrCreateInstance(this, config);
5716
+ if (typeof config === 'number') {
5717
+ data.to(config);
5718
+ return;
5719
+ }
5720
+ if (typeof config === 'string') {
5721
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
5722
+ throw new TypeError(`No method named "${config}"`);
5723
+ }
5724
+ data[config]();
5725
+ }
5688
5726
  });
5689
5727
  }
5690
- static dataApiClickHandler(event) {
5691
- const target = getElementFromSelector(this);
5692
- if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
5693
- return;
5694
- }
5695
- const config = { ...Manipulator.getDataAttributes(target),
5696
- ...Manipulator.getDataAttributes(this)
5697
- };
5698
- const slideIndex = this.getAttribute('data-bs-slide-to');
5699
- if (slideIndex) {
5700
- config.interval = false;
5701
- }
5702
- Carousel.carouselInterface(target, config);
5703
- if (slideIndex) {
5704
- Carousel.getInstance(target).to(slideIndex);
5705
- }
5706
- event.preventDefault();
5707
- }
5708
5728
  }
5709
- EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
5710
- EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
5729
+ EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function (event) {
5730
+ const target = getElementFromSelector(this);
5731
+ if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
5732
+ return;
5733
+ }
5734
+ event.preventDefault();
5735
+ const carousel = Carousel.getOrCreateInstance(target);
5736
+ const slideIndex = this.getAttribute('data-bs-slide-to');
5737
+ if (slideIndex) {
5738
+ carousel.to(slideIndex);
5739
+ carousel._maybeEnableCycle();
5740
+ return;
5741
+ }
5742
+ if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
5743
+ carousel.next();
5744
+ carousel._maybeEnableCycle();
5745
+ return;
5746
+ }
5747
+ carousel.prev();
5748
+ carousel._maybeEnableCycle();
5749
+ });
5750
+ EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => {
5711
5751
  const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
5712
- for (let i = 0, len = carousels.length; i < len; i++) {
5713
- Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
5752
+ for (const carousel of carousels) {
5753
+ Carousel.getOrCreateInstance(carousel);
5714
5754
  }
5715
5755
  });
5716
5756
  defineJQueryPlugin(Carousel);
5717
- const NAME$a = 'collapse';
5718
- const DATA_KEY$9 = 'bs.collapse';
5719
- const EVENT_KEY$9 = `.${DATA_KEY$9}`;
5720
- const DATA_API_KEY$5 = '.data-api';
5721
- const Default$9 = {
5722
- toggle: true,
5723
- parent: null
5724
- };
5725
- const DefaultType$9 = {
5726
- toggle: 'boolean',
5727
- parent: '(null|element)'
5728
- };
5729
- const EVENT_SHOW$5 = `show${EVENT_KEY$9}`;
5730
- const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`;
5731
- const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`;
5732
- const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`;
5733
- const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`;
5757
+ const NAME$b = 'collapse';
5758
+ const DATA_KEY$7 = 'bs.collapse';
5759
+ const EVENT_KEY$7 = `.${DATA_KEY$7}`;
5760
+ const DATA_API_KEY$4 = '.data-api';
5761
+ const EVENT_SHOW$6 = `show${EVENT_KEY$7}`;
5762
+ const EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`;
5763
+ const EVENT_HIDE$6 = `hide${EVENT_KEY$7}`;
5764
+ const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`;
5765
+ const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
5734
5766
  const CLASS_NAME_SHOW$7 = 'show';
5735
5767
  const CLASS_NAME_COLLAPSE = 'collapse';
5736
5768
  const CLASS_NAME_COLLAPSING = 'collapsing';
@@ -5741,19 +5773,24 @@ const WIDTH = 'width';
5741
5773
  const HEIGHT = 'height';
5742
5774
  const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
5743
5775
  const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
5776
+ const Default$a = {
5777
+ parent: null,
5778
+ toggle: true
5779
+ };
5780
+ const DefaultType$a = {
5781
+ parent: '(null|element)',
5782
+ toggle: 'boolean'
5783
+ };
5744
5784
  class Collapse extends BaseComponent {
5745
5785
  constructor(element, config) {
5746
- super(element);
5786
+ super(element, config);
5747
5787
  this._isTransitioning = false;
5748
- this._config = this._getConfig(config);
5749
5788
  this._triggerArray = [];
5750
5789
  const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
5751
- for (let i = 0, len = toggleList.length; i < len; i++) {
5752
- const elem = toggleList[i];
5790
+ for (const elem of toggleList) {
5753
5791
  const selector = getSelectorFromElement(elem);
5754
- const filterElement = SelectorEngine.find(selector).filter(foundElem => foundElem === this._element);
5792
+ const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element);
5755
5793
  if (selector !== null && filterElement.length) {
5756
- this._selector = selector;
5757
5794
  this._triggerArray.push(elem);
5758
5795
  }
5759
5796
  }
@@ -5766,10 +5803,13 @@ class Collapse extends BaseComponent {
5766
5803
  }
5767
5804
  }
5768
5805
  static get Default() {
5769
- return Default$9;
5806
+ return Default$a;
5807
+ }
5808
+ static get DefaultType() {
5809
+ return DefaultType$a;
5770
5810
  }
5771
5811
  static get NAME() {
5772
- return NAME$a;
5812
+ return NAME$b;
5773
5813
  }
5774
5814
  toggle() {
5775
5815
  if (this._isShown()) {
@@ -5782,34 +5822,22 @@ class Collapse extends BaseComponent {
5782
5822
  if (this._isTransitioning || this._isShown()) {
5783
5823
  return;
5784
5824
  }
5785
- let actives = [];
5786
- let activesData;
5825
+ let activeChildren = [];
5787
5826
  if (this._config.parent) {
5788
- const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
5789
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem));
5790
- }
5791
- const container = SelectorEngine.findOne(this._selector);
5792
- if (actives.length) {
5793
- const tempActiveData = actives.find(elem => container !== elem);
5794
- activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
5795
- if (activesData && activesData._isTransitioning) {
5796
- return;
5797
- }
5827
+ activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, {
5828
+ toggle: false
5829
+ }));
5830
+ }
5831
+ if (activeChildren.length && activeChildren[0]._isTransitioning) {
5832
+ return;
5798
5833
  }
5799
- const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5);
5834
+ const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6);
5800
5835
  if (startEvent.defaultPrevented) {
5801
5836
  return;
5802
5837
  }
5803
- actives.forEach(elemActive => {
5804
- if (container !== elemActive) {
5805
- Collapse.getOrCreateInstance(elemActive, {
5806
- toggle: false
5807
- }).hide();
5808
- }
5809
- if (!activesData) {
5810
- Data.set(elemActive, DATA_KEY$9, null);
5811
- }
5812
- });
5838
+ for (const activeInstance of activeChildren) {
5839
+ activeInstance.hide();
5840
+ }
5813
5841
  const dimension = this._getDimension();
5814
5842
  this._element.classList.remove(CLASS_NAME_COLLAPSE);
5815
5843
  this._element.classList.add(CLASS_NAME_COLLAPSING);
@@ -5821,7 +5849,7 @@ class Collapse extends BaseComponent {
5821
5849
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
5822
5850
  this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
5823
5851
  this._element.style[dimension] = '';
5824
- EventHandler.trigger(this._element, EVENT_SHOWN$5);
5852
+ EventHandler.trigger(this._element, EVENT_SHOWN$6);
5825
5853
  };
5826
5854
  const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
5827
5855
  const scrollSize = `scroll${capitalizedDimension}`;
@@ -5832,7 +5860,7 @@ class Collapse extends BaseComponent {
5832
5860
  if (this._isTransitioning || !this._isShown()) {
5833
5861
  return;
5834
5862
  }
5835
- const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5);
5863
+ const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6);
5836
5864
  if (startEvent.defaultPrevented) {
5837
5865
  return;
5838
5866
  }
@@ -5841,11 +5869,9 @@ class Collapse extends BaseComponent {
5841
5869
  reflow(this._element);
5842
5870
  this._element.classList.add(CLASS_NAME_COLLAPSING);
5843
5871
  this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
5844
- const triggerArrayLength = this._triggerArray.length;
5845
- for (let i = 0; i < triggerArrayLength; i++) {
5846
- const trigger = this._triggerArray[i];
5847
- const elem = getElementFromSelector(trigger);
5848
- if (elem && !this._isShown(elem)) {
5872
+ for (const trigger of this._triggerArray) {
5873
+ const element = getElementFromSelector(trigger);
5874
+ if (element && !this._isShown(element)) {
5849
5875
  this._addAriaAndCollapsedClass([trigger], false);
5850
5876
  }
5851
5877
  }
@@ -5854,7 +5880,7 @@ class Collapse extends BaseComponent {
5854
5880
  this._isTransitioning = false;
5855
5881
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
5856
5882
  this._element.classList.add(CLASS_NAME_COLLAPSE);
5857
- EventHandler.trigger(this._element, EVENT_HIDDEN$5);
5883
+ EventHandler.trigger(this._element, EVENT_HIDDEN$6);
5858
5884
  };
5859
5885
  this._element.style[dimension] = '';
5860
5886
  this._queueCallback(complete, this._element, true);
@@ -5862,14 +5888,9 @@ class Collapse extends BaseComponent {
5862
5888
  _isShown(element = this._element) {
5863
5889
  return element.classList.contains(CLASS_NAME_SHOW$7);
5864
5890
  }
5865
- _getConfig(config) {
5866
- config = { ...Default$9,
5867
- ...Manipulator.getDataAttributes(this._element),
5868
- ...config
5869
- };
5891
+ _configAfterMerge(config) {
5870
5892
  config.toggle = Boolean(config.toggle);
5871
5893
  config.parent = getElement(config.parent);
5872
- typeCheckConfig(NAME$a, config, DefaultType$9);
5873
5894
  return config;
5874
5895
  }
5875
5896
  _getDimension() {
@@ -5879,33 +5900,33 @@ class Collapse extends BaseComponent {
5879
5900
  if (!this._config.parent) {
5880
5901
  return;
5881
5902
  }
5882
- const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
5883
- SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
5903
+ const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4);
5904
+ for (const element of children) {
5884
5905
  const selected = getElementFromSelector(element);
5885
5906
  if (selected) {
5886
5907
  this._addAriaAndCollapsedClass([element], this._isShown(selected));
5887
5908
  }
5888
- });
5909
+ }
5910
+ }
5911
+ _getFirstLevelChildren(selector) {
5912
+ const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
5913
+ return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element));
5889
5914
  }
5890
5915
  _addAriaAndCollapsedClass(triggerArray, isOpen) {
5891
5916
  if (!triggerArray.length) {
5892
5917
  return;
5893
5918
  }
5894
- triggerArray.forEach(elem => {
5895
- if (isOpen) {
5896
- elem.classList.remove(CLASS_NAME_COLLAPSED);
5897
- } else {
5898
- elem.classList.add(CLASS_NAME_COLLAPSED);
5899
- }
5900
- elem.setAttribute('aria-expanded', isOpen);
5901
- });
5919
+ for (const element of triggerArray) {
5920
+ element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
5921
+ element.setAttribute('aria-expanded', isOpen);
5922
+ }
5902
5923
  }
5903
5924
  static jQueryInterface(config) {
5925
+ const _config = {};
5926
+ if (typeof config === 'string' && /show|hide/.test(config)) {
5927
+ _config.toggle = false;
5928
+ }
5904
5929
  return this.each(function () {
5905
- const _config = {};
5906
- if (typeof config === 'string' && /show|hide/.test(config)) {
5907
- _config.toggle = false;
5908
- }
5909
5930
  const data = Collapse.getOrCreateInstance(this, _config);
5910
5931
  if (typeof config === 'string') {
5911
5932
  if (typeof data[config] === 'undefined') {
@@ -5922,38 +5943,39 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, functi
5922
5943
  }
5923
5944
  const selector = getSelectorFromElement(this);
5924
5945
  const selectorElements = SelectorEngine.find(selector);
5925
- selectorElements.forEach(element => {
5946
+ for (const element of selectorElements) {
5926
5947
  Collapse.getOrCreateInstance(element, {
5927
5948
  toggle: false
5928
5949
  }).toggle();
5929
- });
5950
+ }
5930
5951
  });
5931
5952
  defineJQueryPlugin(Collapse);
5932
- const NAME$9 = 'dropdown';
5933
- const DATA_KEY$8 = 'bs.dropdown';
5934
- const EVENT_KEY$8 = `.${DATA_KEY$8}`;
5935
- const DATA_API_KEY$4 = '.data-api';
5953
+ const NAME$a = 'dropdown';
5954
+ const DATA_KEY$6 = 'bs.dropdown';
5955
+ const EVENT_KEY$6 = `.${DATA_KEY$6}`;
5956
+ const DATA_API_KEY$3 = '.data-api';
5936
5957
  const ESCAPE_KEY$2 = 'Escape';
5937
- const SPACE_KEY = 'Space';
5938
5958
  const TAB_KEY$1 = 'Tab';
5939
- const ARROW_UP_KEY = 'ArrowUp';
5940
- const ARROW_DOWN_KEY = 'ArrowDown';
5959
+ const ARROW_UP_KEY$1 = 'ArrowUp';
5960
+ const ARROW_DOWN_KEY$1 = 'ArrowDown';
5941
5961
  const RIGHT_MOUSE_BUTTON = 2;
5942
- const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
5943
- const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`;
5944
- const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
5945
- const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
5946
- const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
5947
- const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`;
5948
- const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`;
5949
- const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`;
5962
+ const EVENT_HIDE$5 = `hide${EVENT_KEY$6}`;
5963
+ const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`;
5964
+ const EVENT_SHOW$5 = `show${EVENT_KEY$6}`;
5965
+ const EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`;
5966
+ const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
5967
+ const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`;
5968
+ const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`;
5950
5969
  const CLASS_NAME_SHOW$6 = 'show';
5951
5970
  const CLASS_NAME_DROPUP = 'dropup';
5952
5971
  const CLASS_NAME_DROPEND = 'dropend';
5953
5972
  const CLASS_NAME_DROPSTART = 'dropstart';
5954
- const CLASS_NAME_NAVBAR = 'navbar';
5955
- const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]';
5973
+ const CLASS_NAME_DROPUP_CENTER = 'dropup-center';
5974
+ const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center';
5975
+ const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';
5976
+ const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`;
5956
5977
  const SELECTOR_MENU = '.dropdown-menu';
5978
+ const SELECTOR_NAVBAR = '.navbar';
5957
5979
  const SELECTOR_NAVBAR_NAV = '.navbar-nav';
5958
5980
  const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
5959
5981
  const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
@@ -5962,70 +5984,69 @@ const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
5962
5984
  const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
5963
5985
  const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
5964
5986
  const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
5965
- const Default$8 = {
5966
- offset: [0, 2],
5987
+ const PLACEMENT_TOPCENTER = 'top';
5988
+ const PLACEMENT_BOTTOMCENTER = 'bottom';
5989
+ const Default$9 = {
5990
+ autoClose: true,
5967
5991
  boundary: 'clippingParents',
5968
- reference: 'toggle',
5969
5992
  display: 'dynamic',
5993
+ offset: [0, 2],
5970
5994
  popperConfig: null,
5971
- autoClose: true
5995
+ reference: 'toggle'
5972
5996
  };
5973
- const DefaultType$8 = {
5974
- offset: '(array|string|function)',
5997
+ const DefaultType$9 = {
5998
+ autoClose: '(boolean|string)',
5975
5999
  boundary: '(string|element)',
5976
- reference: '(string|element|object)',
5977
6000
  display: 'string',
6001
+ offset: '(array|string|function)',
5978
6002
  popperConfig: '(null|object|function)',
5979
- autoClose: '(boolean|string)'
6003
+ reference: '(string|element|object)'
5980
6004
  };
5981
6005
  class Dropdown extends BaseComponent {
5982
6006
  constructor(element, config) {
5983
- super(element);
6007
+ super(element, config);
5984
6008
  this._popper = null;
5985
- this._config = this._getConfig(config);
5986
- this._menu = this._getMenuElement();
6009
+ this._parent = this._element.parentNode;
6010
+ this._menu = SelectorEngine.findOne(SELECTOR_MENU, this._parent);
5987
6011
  this._inNavbar = this._detectNavbar();
5988
6012
  }
5989
6013
  static get Default() {
5990
- return Default$8;
6014
+ return Default$9;
5991
6015
  }
5992
6016
  static get DefaultType() {
5993
- return DefaultType$8;
6017
+ return DefaultType$9;
5994
6018
  }
5995
6019
  static get NAME() {
5996
- return NAME$9;
6020
+ return NAME$a;
5997
6021
  }
5998
6022
  toggle() {
5999
6023
  return this._isShown() ? this.hide() : this.show();
6000
6024
  }
6001
6025
  show() {
6002
- if (isDisabled(this._element) || this._isShown(this._menu)) {
6026
+ if (isDisabled(this._element) || this._isShown()) {
6003
6027
  return;
6004
6028
  }
6005
6029
  const relatedTarget = {
6006
6030
  relatedTarget: this._element
6007
6031
  };
6008
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget);
6032
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget);
6009
6033
  if (showEvent.defaultPrevented) {
6010
6034
  return;
6011
6035
  }
6012
- const parent = Dropdown.getParentFromElement(this._element);
6013
- if (this._inNavbar) {
6014
- Manipulator.setDataAttribute(this._menu, 'popper', 'none');
6015
- } else {
6016
- this._createPopper(parent);
6017
- }
6018
- if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
6019
- [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
6036
+ this._createPopper();
6037
+ if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
6038
+ for (const element of [].concat(...document.body.children)) {
6039
+ EventHandler.on(element, 'mouseover', noop);
6040
+ }
6020
6041
  }
6021
6042
  this._element.focus();
6022
6043
  this._element.setAttribute('aria-expanded', true);
6023
6044
  this._menu.classList.add(CLASS_NAME_SHOW$6);
6024
6045
  this._element.classList.add(CLASS_NAME_SHOW$6);
6025
- EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
6046
+ EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget);
6026
6047
  }
6027
6048
  hide() {
6028
- if (isDisabled(this._element) || !this._isShown(this._menu)) {
6049
+ if (isDisabled(this._element) || !this._isShown()) {
6029
6050
  return;
6030
6051
  }
6031
6052
  const relatedTarget = {
@@ -6046,12 +6067,14 @@ class Dropdown extends BaseComponent {
6046
6067
  }
6047
6068
  }
6048
6069
  _completeHide(relatedTarget) {
6049
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
6070
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
6050
6071
  if (hideEvent.defaultPrevented) {
6051
6072
  return;
6052
6073
  }
6053
6074
  if ('ontouchstart' in document.documentElement) {
6054
- [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
6075
+ for (const element of [].concat(...document.body.children)) {
6076
+ EventHandler.off(element, 'mouseover', noop);
6077
+ }
6055
6078
  }
6056
6079
  if (this._popper) {
6057
6080
  this._popper.destroy();
@@ -6060,52 +6083,47 @@ class Dropdown extends BaseComponent {
6060
6083
  this._element.classList.remove(CLASS_NAME_SHOW$6);
6061
6084
  this._element.setAttribute('aria-expanded', 'false');
6062
6085
  Manipulator.removeDataAttribute(this._menu, 'popper');
6063
- EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
6086
+ EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget);
6064
6087
  }
6065
6088
  _getConfig(config) {
6066
- config = { ...this.constructor.Default,
6067
- ...Manipulator.getDataAttributes(this._element),
6068
- ...config
6069
- };
6070
- typeCheckConfig(NAME$9, config, this.constructor.DefaultType);
6089
+ config = super._getConfig(config);
6071
6090
  if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
6072
- throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
6091
+ throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
6073
6092
  }
6074
6093
  return config;
6075
6094
  }
6076
- _createPopper(parent) {
6095
+ _createPopper() {
6077
6096
  if (typeof Popper === 'undefined') {
6078
6097
  throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
6079
6098
  }
6080
6099
  let referenceElement = this._element;
6081
6100
  if (this._config.reference === 'parent') {
6082
- referenceElement = parent;
6101
+ referenceElement = this._parent;
6083
6102
  } else if (isElement(this._config.reference)) {
6084
6103
  referenceElement = getElement(this._config.reference);
6085
6104
  } else if (typeof this._config.reference === 'object') {
6086
6105
  referenceElement = this._config.reference;
6087
6106
  }
6088
6107
  const popperConfig = this._getPopperConfig();
6089
- const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
6090
6108
  this._popper = createPopper(referenceElement, this._menu, popperConfig);
6091
- if (isDisplayStatic) {
6092
- Manipulator.setDataAttribute(this._menu, 'popper', 'static');
6093
- }
6094
- }
6095
- _isShown(element = this._element) {
6096
- return element.classList.contains(CLASS_NAME_SHOW$6);
6097
6109
  }
6098
- _getMenuElement() {
6099
- return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
6110
+ _isShown() {
6111
+ return this._menu.classList.contains(CLASS_NAME_SHOW$6);
6100
6112
  }
6101
6113
  _getPlacement() {
6102
- const parentDropdown = this._element.parentNode;
6114
+ const parentDropdown = this._parent;
6103
6115
  if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
6104
6116
  return PLACEMENT_RIGHT;
6105
6117
  }
6106
6118
  if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
6107
6119
  return PLACEMENT_LEFT;
6108
6120
  }
6121
+ if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {
6122
+ return PLACEMENT_TOPCENTER;
6123
+ }
6124
+ if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {
6125
+ return PLACEMENT_BOTTOMCENTER;
6126
+ }
6109
6127
  const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
6110
6128
  if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
6111
6129
  return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
@@ -6113,14 +6131,14 @@ class Dropdown extends BaseComponent {
6113
6131
  return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
6114
6132
  }
6115
6133
  _detectNavbar() {
6116
- return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
6134
+ return this._element.closest(SELECTOR_NAVBAR) !== null;
6117
6135
  }
6118
6136
  _getOffset() {
6119
6137
  const {
6120
6138
  offset
6121
6139
  } = this._config;
6122
6140
  if (typeof offset === 'string') {
6123
- return offset.split(',').map(val => Number.parseInt(val, 10));
6141
+ return offset.split(',').map(value => Number.parseInt(value, 10));
6124
6142
  }
6125
6143
  if (typeof offset === 'function') {
6126
6144
  return popperData => offset(popperData, this._element);
@@ -6142,7 +6160,8 @@ class Dropdown extends BaseComponent {
6142
6160
  }
6143
6161
  }]
6144
6162
  };
6145
- if (this._config.display === 'static') {
6163
+ if (this._inNavbar || this._config.display === 'static') {
6164
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static');
6146
6165
  defaultBsPopperConfig.modifiers = [{
6147
6166
  name: 'applyStyles',
6148
6167
  enabled: false
@@ -6156,11 +6175,11 @@ class Dropdown extends BaseComponent {
6156
6175
  key,
6157
6176
  target
6158
6177
  }) {
6159
- const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
6178
+ const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element));
6160
6179
  if (!items.length) {
6161
6180
  return;
6162
6181
  }
6163
- getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
6182
+ getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus();
6164
6183
  }
6165
6184
  static jQueryInterface(config) {
6166
6185
  return this.each(function () {
@@ -6175,68 +6194,55 @@ class Dropdown extends BaseComponent {
6175
6194
  });
6176
6195
  }
6177
6196
  static clearMenus(event) {
6178
- if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
6197
+ if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1) {
6179
6198
  return;
6180
6199
  }
6181
- const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
6182
- for (let i = 0, len = toggles.length; i < len; i++) {
6183
- const context = Dropdown.getInstance(toggles[i]);
6200
+ const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN);
6201
+ for (const toggle of openToggles) {
6202
+ const context = Dropdown.getInstance(toggle);
6184
6203
  if (!context || context._config.autoClose === false) {
6185
6204
  continue;
6186
6205
  }
6187
- if (!context._isShown()) {
6206
+ const composedPath = event.composedPath();
6207
+ const isMenuTarget = composedPath.includes(context._menu);
6208
+ if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
6209
+ continue;
6210
+ }
6211
+ if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
6188
6212
  continue;
6189
6213
  }
6190
6214
  const relatedTarget = {
6191
6215
  relatedTarget: context._element
6192
6216
  };
6193
- if (event) {
6194
- const composedPath = event.composedPath();
6195
- const isMenuTarget = composedPath.includes(context._menu);
6196
- if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
6197
- continue;
6198
- }
6199
- if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
6200
- continue;
6201
- }
6202
- if (event.type === 'click') {
6203
- relatedTarget.clickEvent = event;
6204
- }
6217
+ if (event.type === 'click') {
6218
+ relatedTarget.clickEvent = event;
6205
6219
  }
6206
6220
  context._completeHide(relatedTarget);
6207
6221
  }
6208
6222
  }
6209
- static getParentFromElement(element) {
6210
- return getElementFromSelector(element) || element.parentNode;
6211
- }
6212
6223
  static dataApiKeydownHandler(event) {
6213
- if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
6224
+ const isInput = /input|textarea/i.test(event.target.tagName);
6225
+ const isEscapeEvent = event.key === ESCAPE_KEY$2;
6226
+ const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key);
6227
+ if (!isUpOrDownEvent && !isEscapeEvent) {
6214
6228
  return;
6215
6229
  }
6216
- const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
6217
- if (!isActive && event.key === ESCAPE_KEY$2) {
6230
+ if (isInput && !isEscapeEvent) {
6218
6231
  return;
6219
6232
  }
6220
6233
  event.preventDefault();
6221
- event.stopPropagation();
6222
- if (isDisabled(this)) {
6223
- return;
6224
- }
6225
- const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
6234
+ const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode);
6226
6235
  const instance = Dropdown.getOrCreateInstance(getToggleButton);
6227
- if (event.key === ESCAPE_KEY$2) {
6228
- instance.hide();
6229
- return;
6230
- }
6231
- if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
6232
- if (!isActive) {
6233
- instance.show();
6234
- }
6236
+ if (isUpOrDownEvent) {
6237
+ event.stopPropagation();
6238
+ instance.show();
6235
6239
  instance._selectMenuItem(event);
6236
6240
  return;
6237
6241
  }
6238
- if (!isActive || event.key === SPACE_KEY) {
6239
- Dropdown.clearMenus();
6242
+ if (instance._isShown()) {
6243
+ event.stopPropagation();
6244
+ instance.hide();
6245
+ getToggleButton.focus();
6240
6246
  }
6241
6247
  }
6242
6248
  }
@@ -6251,6 +6257,8 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, functi
6251
6257
  defineJQueryPlugin(Dropdown);
6252
6258
  const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
6253
6259
  const SELECTOR_STICKY_CONTENT = '.sticky-top';
6260
+ const PROPERTY_PADDING = 'padding-right';
6261
+ const PROPERTY_MARGIN = 'margin-right';
6254
6262
  class ScrollBarHelper {
6255
6263
  constructor() {
6256
6264
  this._element = document.body;
@@ -6262,95 +6270,108 @@ class ScrollBarHelper {
6262
6270
  hide() {
6263
6271
  const width = this.getWidth();
6264
6272
  this._disableOverFlow();
6265
- this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width);
6266
- this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
6267
- this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
6273
+ this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
6274
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
6275
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
6276
+ }
6277
+ reset() {
6278
+ this._resetElementAttributes(this._element, 'overflow');
6279
+ this._resetElementAttributes(this._element, PROPERTY_PADDING);
6280
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
6281
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
6282
+ }
6283
+ isOverflowing() {
6284
+ return this.getWidth() > 0;
6268
6285
  }
6269
6286
  _disableOverFlow() {
6270
6287
  this._saveInitialAttribute(this._element, 'overflow');
6271
6288
  this._element.style.overflow = 'hidden';
6272
6289
  }
6273
- _setElementAttributes(selector, styleProp, callback) {
6290
+ _setElementAttributes(selector, styleProperty, callback) {
6274
6291
  const scrollbarWidth = this.getWidth();
6275
6292
  const manipulationCallBack = element => {
6276
6293
  if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
6277
6294
  return;
6278
6295
  }
6279
- this._saveInitialAttribute(element, styleProp);
6280
- const calculatedValue = window.getComputedStyle(element)[styleProp];
6281
- element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
6296
+ this._saveInitialAttribute(element, styleProperty);
6297
+ const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
6298
+ element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
6282
6299
  };
6283
6300
  this._applyManipulationCallback(selector, manipulationCallBack);
6284
6301
  }
6285
- reset() {
6286
- this._resetElementAttributes(this._element, 'overflow');
6287
- this._resetElementAttributes(this._element, 'paddingRight');
6288
- this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
6289
- this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
6290
- }
6291
- _saveInitialAttribute(element, styleProp) {
6292
- const actualValue = element.style[styleProp];
6302
+ _saveInitialAttribute(element, styleProperty) {
6303
+ const actualValue = element.style.getPropertyValue(styleProperty);
6293
6304
  if (actualValue) {
6294
- Manipulator.setDataAttribute(element, styleProp, actualValue);
6305
+ Manipulator.setDataAttribute(element, styleProperty, actualValue);
6295
6306
  }
6296
6307
  }
6297
- _resetElementAttributes(selector, styleProp) {
6308
+ _resetElementAttributes(selector, styleProperty) {
6298
6309
  const manipulationCallBack = element => {
6299
- const value = Manipulator.getDataAttribute(element, styleProp);
6300
- if (typeof value === 'undefined') {
6301
- element.style.removeProperty(styleProp);
6302
- } else {
6303
- Manipulator.removeDataAttribute(element, styleProp);
6304
- element.style[styleProp] = value;
6310
+ const value = Manipulator.getDataAttribute(element, styleProperty);
6311
+ if (value === null) {
6312
+ element.style.removeProperty(styleProperty);
6313
+ return;
6305
6314
  }
6315
+ Manipulator.removeDataAttribute(element, styleProperty);
6316
+ element.style.setProperty(styleProperty, value);
6306
6317
  };
6307
6318
  this._applyManipulationCallback(selector, manipulationCallBack);
6308
6319
  }
6309
6320
  _applyManipulationCallback(selector, callBack) {
6310
6321
  if (isElement(selector)) {
6311
6322
  callBack(selector);
6312
- } else {
6313
- SelectorEngine.find(selector, this._element).forEach(callBack);
6323
+ return;
6324
+ }
6325
+ for (const sel of SelectorEngine.find(selector, this._element)) {
6326
+ callBack(sel);
6314
6327
  }
6315
- }
6316
- isOverflowing() {
6317
- return this.getWidth() > 0;
6318
6328
  }
6319
6329
  }
6320
- const Default$7 = {
6330
+ const NAME$9 = 'backdrop';
6331
+ const CLASS_NAME_FADE$4 = 'fade';
6332
+ const CLASS_NAME_SHOW$5 = 'show';
6333
+ const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
6334
+ const Default$8 = {
6321
6335
  className: 'modal-backdrop',
6322
- isVisible: true,
6336
+ clickCallback: null,
6323
6337
  isAnimated: false,
6324
- rootElement: 'body',
6325
- clickCallback: null
6338
+ isVisible: true,
6339
+ rootElement: 'body'
6326
6340
  };
6327
- const DefaultType$7 = {
6341
+ const DefaultType$8 = {
6328
6342
  className: 'string',
6329
- isVisible: 'boolean',
6343
+ clickCallback: '(function|null)',
6330
6344
  isAnimated: 'boolean',
6331
- rootElement: '(element|string)',
6332
- clickCallback: '(function|null)'
6345
+ isVisible: 'boolean',
6346
+ rootElement: '(element|string)'
6333
6347
  };
6334
- const NAME$8 = 'backdrop';
6335
- const CLASS_NAME_FADE$4 = 'fade';
6336
- const CLASS_NAME_SHOW$5 = 'show';
6337
- const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`;
6338
- class Backdrop {
6348
+ class Backdrop extends Config {
6339
6349
  constructor(config) {
6350
+ super();
6340
6351
  this._config = this._getConfig(config);
6341
6352
  this._isAppended = false;
6342
6353
  this._element = null;
6343
6354
  }
6355
+ static get Default() {
6356
+ return Default$8;
6357
+ }
6358
+ static get DefaultType() {
6359
+ return DefaultType$8;
6360
+ }
6361
+ static get NAME() {
6362
+ return NAME$9;
6363
+ }
6344
6364
  show(callback) {
6345
6365
  if (!this._config.isVisible) {
6346
6366
  execute(callback);
6347
6367
  return;
6348
6368
  }
6349
6369
  this._append();
6370
+ const element = this._getElement();
6350
6371
  if (this._config.isAnimated) {
6351
- reflow(this._getElement());
6372
+ reflow(element);
6352
6373
  }
6353
- this._getElement().classList.add(CLASS_NAME_SHOW$5);
6374
+ element.classList.add(CLASS_NAME_SHOW$5);
6354
6375
  this._emulateAnimation(() => {
6355
6376
  execute(callback);
6356
6377
  });
@@ -6366,6 +6387,14 @@ class Backdrop {
6366
6387
  execute(callback);
6367
6388
  });
6368
6389
  }
6390
+ dispose() {
6391
+ if (!this._isAppended) {
6392
+ return;
6393
+ }
6394
+ EventHandler.off(this._element, EVENT_MOUSEDOWN);
6395
+ this._element.remove();
6396
+ this._isAppended = false;
6397
+ }
6369
6398
  _getElement() {
6370
6399
  if (!this._element) {
6371
6400
  const backdrop = document.createElement('div');
@@ -6377,71 +6406,66 @@ class Backdrop {
6377
6406
  }
6378
6407
  return this._element;
6379
6408
  }
6380
- _getConfig(config) {
6381
- config = { ...Default$7,
6382
- ...(typeof config === 'object' ? config : {})
6383
- };
6409
+ _configAfterMerge(config) {
6384
6410
  config.rootElement = getElement(config.rootElement);
6385
- typeCheckConfig(NAME$8, config, DefaultType$7);
6386
6411
  return config;
6387
6412
  }
6388
6413
  _append() {
6389
6414
  if (this._isAppended) {
6390
6415
  return;
6391
6416
  }
6392
- this._config.rootElement.append(this._getElement());
6393
- EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
6417
+ const element = this._getElement();
6418
+ this._config.rootElement.append(element);
6419
+ EventHandler.on(element, EVENT_MOUSEDOWN, () => {
6394
6420
  execute(this._config.clickCallback);
6395
6421
  });
6396
6422
  this._isAppended = true;
6397
6423
  }
6398
- dispose() {
6399
- if (!this._isAppended) {
6400
- return;
6401
- }
6402
- EventHandler.off(this._element, EVENT_MOUSEDOWN);
6403
- this._element.remove();
6404
- this._isAppended = false;
6405
- }
6406
6424
  _emulateAnimation(callback) {
6407
6425
  executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
6408
6426
  }
6409
6427
  }
6410
- const Default$6 = {
6411
- trapElement: null,
6412
- autofocus: true
6413
- };
6414
- const DefaultType$6 = {
6415
- trapElement: 'element',
6416
- autofocus: 'boolean'
6417
- };
6418
- const NAME$7 = 'focustrap';
6419
- const DATA_KEY$7 = 'bs.focustrap';
6420
- const EVENT_KEY$7 = `.${DATA_KEY$7}`;
6421
- const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`;
6422
- const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`;
6428
+ const NAME$8 = 'focustrap';
6429
+ const DATA_KEY$5 = 'bs.focustrap';
6430
+ const EVENT_KEY$5 = `.${DATA_KEY$5}`;
6431
+ const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
6432
+ const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
6423
6433
  const TAB_KEY = 'Tab';
6424
6434
  const TAB_NAV_FORWARD = 'forward';
6425
6435
  const TAB_NAV_BACKWARD = 'backward';
6426
- class FocusTrap {
6427
- constructor(config) {
6428
- this._config = this._getConfig(config);
6436
+ const Default$7 = {
6437
+ autofocus: true,
6438
+ trapElement: null
6439
+ };
6440
+ const DefaultType$7 = {
6441
+ autofocus: 'boolean',
6442
+ trapElement: 'element'
6443
+ };
6444
+ class FocusTrap extends Config {
6445
+ constructor(config) {
6446
+ super();
6447
+ this._config = this._getConfig(config);
6429
6448
  this._isActive = false;
6430
6449
  this._lastTabNavDirection = null;
6431
6450
  }
6451
+ static get Default() {
6452
+ return Default$7;
6453
+ }
6454
+ static get DefaultType() {
6455
+ return DefaultType$7;
6456
+ }
6457
+ static get NAME() {
6458
+ return NAME$8;
6459
+ }
6432
6460
  activate() {
6433
- const {
6434
- trapElement,
6435
- autofocus
6436
- } = this._config;
6437
6461
  if (this._isActive) {
6438
6462
  return;
6439
6463
  }
6440
- if (autofocus) {
6441
- trapElement.focus();
6464
+ if (this._config.autofocus) {
6465
+ this._config.trapElement.focus();
6442
6466
  }
6443
- EventHandler.off(document, EVENT_KEY$7);
6444
- EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
6467
+ EventHandler.off(document, EVENT_KEY$5);
6468
+ EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event));
6445
6469
  EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
6446
6470
  this._isActive = true;
6447
6471
  }
@@ -6450,16 +6474,13 @@ class FocusTrap {
6450
6474
  return;
6451
6475
  }
6452
6476
  this._isActive = false;
6453
- EventHandler.off(document, EVENT_KEY$7);
6477
+ EventHandler.off(document, EVENT_KEY$5);
6454
6478
  }
6455
6479
  _handleFocusin(event) {
6456
- const {
6457
- target
6458
- } = event;
6459
6480
  const {
6460
6481
  trapElement
6461
6482
  } = this._config;
6462
- if (target === document || target === trapElement || trapElement.contains(target)) {
6483
+ if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
6463
6484
  return;
6464
6485
  }
6465
6486
  const elements = SelectorEngine.focusableChildren(trapElement);
@@ -6477,40 +6498,21 @@ class FocusTrap {
6477
6498
  }
6478
6499
  this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
6479
6500
  }
6480
- _getConfig(config) {
6481
- config = { ...Default$6,
6482
- ...(typeof config === 'object' ? config : {})
6483
- };
6484
- typeCheckConfig(NAME$7, config, DefaultType$6);
6485
- return config;
6486
- }
6487
6501
  }
6488
- const NAME$6 = 'modal';
6489
- const DATA_KEY$6 = 'bs.modal';
6490
- const EVENT_KEY$6 = `.${DATA_KEY$6}`;
6491
- const DATA_API_KEY$3 = '.data-api';
6502
+ const NAME$7 = 'modal';
6503
+ const DATA_KEY$4 = 'bs.modal';
6504
+ const EVENT_KEY$4 = `.${DATA_KEY$4}`;
6505
+ const DATA_API_KEY$2 = '.data-api';
6492
6506
  const ESCAPE_KEY$1 = 'Escape';
6493
- const Default$5 = {
6494
- backdrop: true,
6495
- keyboard: true,
6496
- focus: true
6497
- };
6498
- const DefaultType$5 = {
6499
- backdrop: '(boolean|string)',
6500
- keyboard: 'boolean',
6501
- focus: 'boolean'
6502
- };
6503
- const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
6504
- const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`;
6505
- const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
6506
- const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
6507
- const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
6508
- const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
6509
- const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`;
6510
- const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
6511
- const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
6512
- const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
6513
- const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
6507
+ const EVENT_HIDE$4 = `hide${EVENT_KEY$4}`;
6508
+ const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
6509
+ const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
6510
+ const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
6511
+ const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
6512
+ const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
6513
+ const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
6514
+ const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
6515
+ const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
6514
6516
  const CLASS_NAME_OPEN = 'modal-open';
6515
6517
  const CLASS_NAME_FADE$3 = 'fade';
6516
6518
  const CLASS_NAME_SHOW$4 = 'show';
@@ -6519,23 +6521,35 @@ const OPEN_SELECTOR$1 = '.modal.show';
6519
6521
  const SELECTOR_DIALOG = '.modal-dialog';
6520
6522
  const SELECTOR_MODAL_BODY = '.modal-body';
6521
6523
  const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
6524
+ const Default$6 = {
6525
+ backdrop: true,
6526
+ focus: true,
6527
+ keyboard: true
6528
+ };
6529
+ const DefaultType$6 = {
6530
+ backdrop: '(boolean|string)',
6531
+ focus: 'boolean',
6532
+ keyboard: 'boolean'
6533
+ };
6522
6534
  class Modal extends BaseComponent {
6523
6535
  constructor(element, config) {
6524
- super(element);
6525
- this._config = this._getConfig(config);
6536
+ super(element, config);
6526
6537
  this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
6527
6538
  this._backdrop = this._initializeBackDrop();
6528
6539
  this._focustrap = this._initializeFocusTrap();
6529
6540
  this._isShown = false;
6530
- this._ignoreBackdropClick = false;
6531
6541
  this._isTransitioning = false;
6532
6542
  this._scrollBar = new ScrollBarHelper();
6543
+ this._addEventListeners();
6533
6544
  }
6534
6545
  static get Default() {
6535
- return Default$5;
6546
+ return Default$6;
6547
+ }
6548
+ static get DefaultType() {
6549
+ return DefaultType$6;
6536
6550
  }
6537
6551
  static get NAME() {
6538
- return NAME$6;
6552
+ return NAME$7;
6539
6553
  }
6540
6554
  toggle(relatedTarget) {
6541
6555
  return this._isShown ? this.hide() : this.show(relatedTarget);
@@ -6544,53 +6558,37 @@ class Modal extends BaseComponent {
6544
6558
  if (this._isShown || this._isTransitioning) {
6545
6559
  return;
6546
6560
  }
6547
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
6561
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, {
6548
6562
  relatedTarget
6549
6563
  });
6550
6564
  if (showEvent.defaultPrevented) {
6551
6565
  return;
6552
6566
  }
6553
6567
  this._isShown = true;
6554
- if (this._isAnimated()) {
6555
- this._isTransitioning = true;
6556
- }
6568
+ this._isTransitioning = true;
6557
6569
  this._scrollBar.hide();
6558
6570
  document.body.classList.add(CLASS_NAME_OPEN);
6559
6571
  this._adjustDialog();
6560
- this._setEscapeEvent();
6561
- this._setResizeEvent();
6562
- EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
6563
- EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
6564
- if (event.target === this._element) {
6565
- this._ignoreBackdropClick = true;
6566
- }
6567
- });
6568
- });
6569
- this._showBackdrop(() => this._showElement(relatedTarget));
6572
+ this._backdrop.show(() => this._showElement(relatedTarget));
6570
6573
  }
6571
6574
  hide() {
6572
6575
  if (!this._isShown || this._isTransitioning) {
6573
6576
  return;
6574
6577
  }
6575
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
6578
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
6576
6579
  if (hideEvent.defaultPrevented) {
6577
6580
  return;
6578
6581
  }
6579
6582
  this._isShown = false;
6580
- const isAnimated = this._isAnimated();
6581
- if (isAnimated) {
6582
- this._isTransitioning = true;
6583
- }
6584
- this._setEscapeEvent();
6585
- this._setResizeEvent();
6583
+ this._isTransitioning = true;
6586
6584
  this._focustrap.deactivate();
6587
6585
  this._element.classList.remove(CLASS_NAME_SHOW$4);
6588
- EventHandler.off(this._element, EVENT_CLICK_DISMISS);
6589
- EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
6590
- this._queueCallback(() => this._hideModal(), this._element, isAnimated);
6586
+ this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
6591
6587
  }
6592
6588
  dispose() {
6593
- [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
6589
+ for (const htmlElement of [window, this._dialog]) {
6590
+ EventHandler.off(htmlElement, EVENT_KEY$4);
6591
+ }
6594
6592
  this._backdrop.dispose();
6595
6593
  this._focustrap.deactivate();
6596
6594
  super.dispose();
@@ -6609,18 +6607,8 @@ class Modal extends BaseComponent {
6609
6607
  trapElement: this._element
6610
6608
  });
6611
6609
  }
6612
- _getConfig(config) {
6613
- config = { ...Default$5,
6614
- ...Manipulator.getDataAttributes(this._element),
6615
- ...(typeof config === 'object' ? config : {})
6616
- };
6617
- typeCheckConfig(NAME$6, config, DefaultType$5);
6618
- return config;
6619
- }
6620
6610
  _showElement(relatedTarget) {
6621
- const isAnimated = this._isAnimated();
6622
- const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
6623
- if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
6611
+ if (!document.body.contains(this._element)) {
6624
6612
  document.body.append(this._element);
6625
6613
  }
6626
6614
  this._element.style.display = 'block';
@@ -6628,44 +6616,52 @@ class Modal extends BaseComponent {
6628
6616
  this._element.setAttribute('aria-modal', true);
6629
6617
  this._element.setAttribute('role', 'dialog');
6630
6618
  this._element.scrollTop = 0;
6619
+ const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
6631
6620
  if (modalBody) {
6632
6621
  modalBody.scrollTop = 0;
6633
6622
  }
6634
- if (isAnimated) {
6635
- reflow(this._element);
6636
- }
6623
+ reflow(this._element);
6637
6624
  this._element.classList.add(CLASS_NAME_SHOW$4);
6638
6625
  const transitionComplete = () => {
6639
6626
  if (this._config.focus) {
6640
6627
  this._focustrap.activate();
6641
6628
  }
6642
6629
  this._isTransitioning = false;
6643
- EventHandler.trigger(this._element, EVENT_SHOWN$3, {
6630
+ EventHandler.trigger(this._element, EVENT_SHOWN$4, {
6644
6631
  relatedTarget
6645
6632
  });
6646
6633
  };
6647
- this._queueCallback(transitionComplete, this._dialog, isAnimated);
6648
- }
6649
- _setEscapeEvent() {
6650
- if (this._isShown) {
6651
- EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
6652
- if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
6653
- event.preventDefault();
6654
- this.hide();
6655
- } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) {
6656
- this._triggerBackdropTransition();
6657
- }
6658
- });
6659
- } else {
6660
- EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
6661
- }
6634
+ this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
6662
6635
  }
6663
- _setResizeEvent() {
6664
- if (this._isShown) {
6665
- EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog());
6666
- } else {
6667
- EventHandler.off(window, EVENT_RESIZE);
6668
- }
6636
+ _addEventListeners() {
6637
+ EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
6638
+ if (event.key !== ESCAPE_KEY$1) {
6639
+ return;
6640
+ }
6641
+ if (this._config.keyboard) {
6642
+ event.preventDefault();
6643
+ this.hide();
6644
+ return;
6645
+ }
6646
+ this._triggerBackdropTransition();
6647
+ });
6648
+ EventHandler.on(window, EVENT_RESIZE$1, () => {
6649
+ if (this._isShown && !this._isTransitioning) {
6650
+ this._adjustDialog();
6651
+ }
6652
+ });
6653
+ EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
6654
+ if (event.target !== event.currentTarget) {
6655
+ return;
6656
+ }
6657
+ if (this._config.backdrop === 'static') {
6658
+ this._triggerBackdropTransition();
6659
+ return;
6660
+ }
6661
+ if (this._config.backdrop) {
6662
+ this.hide();
6663
+ }
6664
+ });
6669
6665
  }
6670
6666
  _hideModal() {
6671
6667
  this._element.style.display = 'none';
@@ -6677,54 +6673,31 @@ class Modal extends BaseComponent {
6677
6673
  document.body.classList.remove(CLASS_NAME_OPEN);
6678
6674
  this._resetAdjustments();
6679
6675
  this._scrollBar.reset();
6680
- EventHandler.trigger(this._element, EVENT_HIDDEN$3);
6676
+ EventHandler.trigger(this._element, EVENT_HIDDEN$4);
6681
6677
  });
6682
6678
  }
6683
- _showBackdrop(callback) {
6684
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
6685
- if (this._ignoreBackdropClick) {
6686
- this._ignoreBackdropClick = false;
6687
- return;
6688
- }
6689
- if (event.target !== event.currentTarget) {
6690
- return;
6691
- }
6692
- if (this._config.backdrop === true) {
6693
- this.hide();
6694
- } else if (this._config.backdrop === 'static') {
6695
- this._triggerBackdropTransition();
6696
- }
6697
- });
6698
- this._backdrop.show(callback);
6699
- }
6700
6679
  _isAnimated() {
6701
6680
  return this._element.classList.contains(CLASS_NAME_FADE$3);
6702
6681
  }
6703
6682
  _triggerBackdropTransition() {
6704
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
6683
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
6705
6684
  if (hideEvent.defaultPrevented) {
6706
6685
  return;
6707
6686
  }
6708
- const {
6709
- classList,
6710
- scrollHeight,
6711
- style
6712
- } = this._element;
6713
- const isModalOverflowing = scrollHeight > document.documentElement.clientHeight;
6714
- if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
6687
+ const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
6688
+ const initialOverflowY = this._element.style.overflowY;
6689
+ if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {
6715
6690
  return;
6716
6691
  }
6717
6692
  if (!isModalOverflowing) {
6718
- style.overflowY = 'hidden';
6693
+ this._element.style.overflowY = 'hidden';
6719
6694
  }
6720
- classList.add(CLASS_NAME_STATIC);
6695
+ this._element.classList.add(CLASS_NAME_STATIC);
6721
6696
  this._queueCallback(() => {
6722
- classList.remove(CLASS_NAME_STATIC);
6723
- if (!isModalOverflowing) {
6724
- this._queueCallback(() => {
6725
- style.overflowY = '';
6726
- }, this._dialog);
6727
- }
6697
+ this._element.classList.remove(CLASS_NAME_STATIC);
6698
+ this._queueCallback(() => {
6699
+ this._element.style.overflowY = initialOverflowY;
6700
+ }, this._dialog);
6728
6701
  }, this._dialog);
6729
6702
  this._element.focus();
6730
6703
  }
@@ -6732,11 +6705,13 @@ class Modal extends BaseComponent {
6732
6705
  const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
6733
6706
  const scrollbarWidth = this._scrollBar.getWidth();
6734
6707
  const isBodyOverflowing = scrollbarWidth > 0;
6735
- if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
6736
- this._element.style.paddingLeft = `${scrollbarWidth}px`;
6708
+ if (isBodyOverflowing && !isModalOverflowing) {
6709
+ const property = isRTL() ? 'paddingLeft' : 'paddingRight';
6710
+ this._element.style[property] = `${scrollbarWidth}px`;
6737
6711
  }
6738
- if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
6739
- this._element.style.paddingRight = `${scrollbarWidth}px`;
6712
+ if (!isBodyOverflowing && isModalOverflowing) {
6713
+ const property = isRTL() ? 'paddingRight' : 'paddingLeft';
6714
+ this._element.style[property] = `${scrollbarWidth}px`;
6740
6715
  }
6741
6716
  }
6742
6717
  _resetAdjustments() {
@@ -6761,65 +6736,71 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, functi
6761
6736
  if (['A', 'AREA'].includes(this.tagName)) {
6762
6737
  event.preventDefault();
6763
6738
  }
6764
- EventHandler.one(target, EVENT_SHOW$3, showEvent => {
6739
+ EventHandler.one(target, EVENT_SHOW$4, showEvent => {
6765
6740
  if (showEvent.defaultPrevented) {
6766
6741
  return;
6767
6742
  }
6768
- EventHandler.one(target, EVENT_HIDDEN$3, () => {
6743
+ EventHandler.one(target, EVENT_HIDDEN$4, () => {
6769
6744
  if (isVisible(this)) {
6770
6745
  this.focus();
6771
6746
  }
6772
6747
  });
6773
6748
  });
6774
- const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
6775
- if (allReadyOpen) {
6776
- Modal.getInstance(allReadyOpen).hide();
6749
+ const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
6750
+ if (alreadyOpen) {
6751
+ Modal.getInstance(alreadyOpen).hide();
6777
6752
  }
6778
6753
  const data = Modal.getOrCreateInstance(target);
6779
6754
  data.toggle(this);
6780
6755
  });
6781
6756
  enableDismissTrigger(Modal);
6782
6757
  defineJQueryPlugin(Modal);
6783
- const NAME$5 = 'offcanvas';
6784
- const DATA_KEY$5 = 'bs.offcanvas';
6785
- const EVENT_KEY$5 = `.${DATA_KEY$5}`;
6786
- const DATA_API_KEY$2 = '.data-api';
6787
- const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`;
6758
+ const NAME$6 = 'offcanvas';
6759
+ const DATA_KEY$3 = 'bs.offcanvas';
6760
+ const EVENT_KEY$3 = `.${DATA_KEY$3}`;
6761
+ const DATA_API_KEY$1 = '.data-api';
6762
+ const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
6788
6763
  const ESCAPE_KEY = 'Escape';
6789
- const Default$4 = {
6764
+ const CLASS_NAME_SHOW$3 = 'show';
6765
+ const CLASS_NAME_SHOWING$1 = 'showing';
6766
+ const CLASS_NAME_HIDING = 'hiding';
6767
+ const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
6768
+ const OPEN_SELECTOR = '.offcanvas.show';
6769
+ const EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
6770
+ const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
6771
+ const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
6772
+ const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
6773
+ const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
6774
+ const EVENT_RESIZE = `resize${EVENT_KEY$3}`;
6775
+ const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
6776
+ const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
6777
+ const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
6778
+ const Default$5 = {
6790
6779
  backdrop: true,
6791
6780
  keyboard: true,
6792
6781
  scroll: false
6793
6782
  };
6794
- const DefaultType$4 = {
6795
- backdrop: 'boolean',
6783
+ const DefaultType$5 = {
6784
+ backdrop: '(boolean|string)',
6796
6785
  keyboard: 'boolean',
6797
6786
  scroll: 'boolean'
6798
6787
  };
6799
- const CLASS_NAME_SHOW$3 = 'show';
6800
- const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
6801
- const OPEN_SELECTOR = '.offcanvas.show';
6802
- const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
6803
- const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
6804
- const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
6805
- const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
6806
- const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
6807
- const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
6808
- const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
6809
6788
  class Offcanvas extends BaseComponent {
6810
6789
  constructor(element, config) {
6811
- super(element);
6812
- this._config = this._getConfig(config);
6790
+ super(element, config);
6813
6791
  this._isShown = false;
6814
6792
  this._backdrop = this._initializeBackDrop();
6815
6793
  this._focustrap = this._initializeFocusTrap();
6816
6794
  this._addEventListeners();
6817
6795
  }
6818
- static get NAME() {
6819
- return NAME$5;
6820
- }
6821
6796
  static get Default() {
6822
- return Default$4;
6797
+ return Default$5;
6798
+ }
6799
+ static get DefaultType() {
6800
+ return DefaultType$5;
6801
+ }
6802
+ static get NAME() {
6803
+ return NAME$6;
6823
6804
  }
6824
6805
  toggle(relatedTarget) {
6825
6806
  return this._isShown ? this.hide() : this.show(relatedTarget);
@@ -6828,27 +6809,27 @@ class Offcanvas extends BaseComponent {
6828
6809
  if (this._isShown) {
6829
6810
  return;
6830
6811
  }
6831
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
6812
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
6832
6813
  relatedTarget
6833
6814
  });
6834
6815
  if (showEvent.defaultPrevented) {
6835
6816
  return;
6836
6817
  }
6837
6818
  this._isShown = true;
6838
- this._element.style.visibility = 'visible';
6839
6819
  this._backdrop.show();
6840
6820
  if (!this._config.scroll) {
6841
6821
  new ScrollBarHelper().hide();
6842
6822
  }
6843
- this._element.removeAttribute('aria-hidden');
6844
6823
  this._element.setAttribute('aria-modal', true);
6845
6824
  this._element.setAttribute('role', 'dialog');
6846
- this._element.classList.add(CLASS_NAME_SHOW$3);
6825
+ this._element.classList.add(CLASS_NAME_SHOWING$1);
6847
6826
  const completeCallBack = () => {
6848
- if (!this._config.scroll) {
6827
+ if (!this._config.scroll || this._config.backdrop) {
6849
6828
  this._focustrap.activate();
6850
6829
  }
6851
- EventHandler.trigger(this._element, EVENT_SHOWN$2, {
6830
+ this._element.classList.add(CLASS_NAME_SHOW$3);
6831
+ this._element.classList.remove(CLASS_NAME_SHOWING$1);
6832
+ EventHandler.trigger(this._element, EVENT_SHOWN$3, {
6852
6833
  relatedTarget
6853
6834
  });
6854
6835
  };
@@ -6858,24 +6839,23 @@ class Offcanvas extends BaseComponent {
6858
6839
  if (!this._isShown) {
6859
6840
  return;
6860
6841
  }
6861
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
6842
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
6862
6843
  if (hideEvent.defaultPrevented) {
6863
6844
  return;
6864
6845
  }
6865
6846
  this._focustrap.deactivate();
6866
6847
  this._element.blur();
6867
6848
  this._isShown = false;
6868
- this._element.classList.remove(CLASS_NAME_SHOW$3);
6849
+ this._element.classList.add(CLASS_NAME_HIDING);
6869
6850
  this._backdrop.hide();
6870
6851
  const completeCallback = () => {
6871
- this._element.setAttribute('aria-hidden', true);
6852
+ this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
6872
6853
  this._element.removeAttribute('aria-modal');
6873
6854
  this._element.removeAttribute('role');
6874
- this._element.style.visibility = 'hidden';
6875
6855
  if (!this._config.scroll) {
6876
6856
  new ScrollBarHelper().reset();
6877
6857
  }
6878
- EventHandler.trigger(this._element, EVENT_HIDDEN$2);
6858
+ EventHandler.trigger(this._element, EVENT_HIDDEN$3);
6879
6859
  };
6880
6860
  this._queueCallback(completeCallback, this._element, true);
6881
6861
  }
@@ -6884,21 +6864,21 @@ class Offcanvas extends BaseComponent {
6884
6864
  this._focustrap.deactivate();
6885
6865
  super.dispose();
6886
6866
  }
6887
- _getConfig(config) {
6888
- config = { ...Default$4,
6889
- ...Manipulator.getDataAttributes(this._element),
6890
- ...(typeof config === 'object' ? config : {})
6891
- };
6892
- typeCheckConfig(NAME$5, config, DefaultType$4);
6893
- return config;
6894
- }
6895
6867
  _initializeBackDrop() {
6868
+ const clickCallback = () => {
6869
+ if (this._config.backdrop === 'static') {
6870
+ EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
6871
+ return;
6872
+ }
6873
+ this.hide();
6874
+ };
6875
+ const isVisible = Boolean(this._config.backdrop);
6896
6876
  return new Backdrop({
6897
6877
  className: CLASS_NAME_BACKDROP,
6898
- isVisible: this._config.backdrop,
6878
+ isVisible,
6899
6879
  isAnimated: true,
6900
6880
  rootElement: this._element.parentNode,
6901
- clickCallback: () => this.hide()
6881
+ clickCallback: isVisible ? clickCallback : null
6902
6882
  });
6903
6883
  }
6904
6884
  _initializeFocusTrap() {
@@ -6908,9 +6888,14 @@ class Offcanvas extends BaseComponent {
6908
6888
  }
6909
6889
  _addEventListeners() {
6910
6890
  EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
6911
- if (this._config.keyboard && event.key === ESCAPE_KEY) {
6912
- this.hide();
6891
+ if (event.key !== ESCAPE_KEY) {
6892
+ return;
6893
+ }
6894
+ if (!this._config.keyboard) {
6895
+ EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
6896
+ return;
6913
6897
  }
6898
+ this.hide();
6914
6899
  });
6915
6900
  }
6916
6901
  static jQueryInterface(config) {
@@ -6934,19 +6919,30 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, functi
6934
6919
  if (isDisabled(this)) {
6935
6920
  return;
6936
6921
  }
6937
- EventHandler.one(target, EVENT_HIDDEN$2, () => {
6922
+ EventHandler.one(target, EVENT_HIDDEN$3, () => {
6938
6923
  if (isVisible(this)) {
6939
6924
  this.focus();
6940
6925
  }
6941
6926
  });
6942
- const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
6943
- if (allReadyOpen && allReadyOpen !== target) {
6944
- Offcanvas.getInstance(allReadyOpen).hide();
6927
+ const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
6928
+ if (alreadyOpen && alreadyOpen !== target) {
6929
+ Offcanvas.getInstance(alreadyOpen).hide();
6945
6930
  }
6946
6931
  const data = Offcanvas.getOrCreateInstance(target);
6947
6932
  data.toggle(this);
6948
6933
  });
6949
- EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
6934
+ EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
6935
+ for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
6936
+ Offcanvas.getOrCreateInstance(selector).show();
6937
+ }
6938
+ });
6939
+ EventHandler.on(window, EVENT_RESIZE, () => {
6940
+ for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {
6941
+ if (getComputedStyle(element).position !== 'fixed') {
6942
+ Offcanvas.getOrCreateInstance(element).hide();
6943
+ }
6944
+ }
6945
+ });
6950
6946
  enableDismissTrigger(Offcanvas);
6951
6947
  defineJQueryPlugin(Offcanvas);
6952
6948
  const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
@@ -6961,13 +6957,7 @@ const allowedAttribute = (attribute, allowedAttributeList) => {
6961
6957
  }
6962
6958
  return true;
6963
6959
  }
6964
- const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp);
6965
- for (let i = 0, len = regExp.length; i < len; i++) {
6966
- if (regExp[i].test(attributeName)) {
6967
- return true;
6968
- }
6969
- }
6970
- return false;
6960
+ return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
6971
6961
  };
6972
6962
  const DefaultAllowlist = {
6973
6963
  '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
@@ -7001,18 +6991,17 @@ const DefaultAllowlist = {
7001
6991
  u: [],
7002
6992
  ul: []
7003
6993
  };
7004
- function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
6994
+ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
7005
6995
  if (!unsafeHtml.length) {
7006
6996
  return unsafeHtml;
7007
6997
  }
7008
- if (sanitizeFn && typeof sanitizeFn === 'function') {
7009
- return sanitizeFn(unsafeHtml);
6998
+ if (sanitizeFunction && typeof sanitizeFunction === 'function') {
6999
+ return sanitizeFunction(unsafeHtml);
7010
7000
  }
7011
7001
  const domParser = new window.DOMParser();
7012
7002
  const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
7013
7003
  const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
7014
- for (let i = 0, len = elements.length; i < len; i++) {
7015
- const element = elements[i];
7004
+ for (const element of elements) {
7016
7005
  const elementName = element.nodeName.toLowerCase();
7017
7006
  if (!Object.keys(allowList).includes(elementName)) {
7018
7007
  element.remove();
@@ -7020,120 +7009,221 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
7020
7009
  }
7021
7010
  const attributeList = [].concat(...element.attributes);
7022
7011
  const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
7023
- attributeList.forEach(attribute => {
7012
+ for (const attribute of attributeList) {
7024
7013
  if (!allowedAttribute(attribute, allowedAttributes)) {
7025
7014
  element.removeAttribute(attribute.nodeName);
7026
7015
  }
7027
- });
7016
+ }
7028
7017
  }
7029
7018
  return createdDocument.body.innerHTML;
7030
7019
  }
7031
- const NAME$4 = 'tooltip';
7032
- const DATA_KEY$4 = 'bs.tooltip';
7033
- const EVENT_KEY$4 = `.${DATA_KEY$4}`;
7034
- const CLASS_PREFIX$1 = 'bs-tooltip';
7035
- const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
7036
- const DefaultType$3 = {
7037
- animation: 'boolean',
7038
- template: 'string',
7039
- title: '(string|element|function)',
7040
- trigger: 'string',
7041
- delay: '(number|object)',
7042
- html: 'boolean',
7043
- selector: '(string|boolean)',
7044
- placement: '(string|function)',
7045
- offset: '(array|string|function)',
7046
- container: '(string|element|boolean)',
7047
- fallbackPlacements: 'array',
7048
- boundary: '(string|element)',
7049
- customClass: '(string|function)',
7050
- sanitize: 'boolean',
7051
- sanitizeFn: '(null|function)',
7052
- allowList: 'object',
7053
- popperConfig: '(null|object|function)'
7054
- };
7055
- const AttachmentMap = {
7056
- AUTO: 'auto',
7057
- TOP: 'top',
7058
- RIGHT: isRTL() ? 'left' : 'right',
7059
- BOTTOM: 'bottom',
7060
- LEFT: isRTL() ? 'right' : 'left'
7061
- };
7062
- const Default$3 = {
7063
- animation: true,
7064
- template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
7065
- trigger: 'hover focus',
7066
- title: '',
7067
- delay: 0,
7020
+ const NAME$5 = 'TemplateFactory';
7021
+ const Default$4 = {
7022
+ allowList: DefaultAllowlist,
7023
+ content: {},
7024
+ extraClass: '',
7068
7025
  html: false,
7069
- selector: false,
7070
- placement: 'top',
7071
- offset: [0, 0],
7072
- container: false,
7073
- fallbackPlacements: ['top', 'right', 'bottom', 'left'],
7074
- boundary: 'clippingParents',
7075
- customClass: '',
7076
7026
  sanitize: true,
7077
7027
  sanitizeFn: null,
7078
- allowList: DefaultAllowlist,
7079
- popperConfig: null
7028
+ template: '<div></div>'
7080
7029
  };
7081
- const Event$2 = {
7082
- HIDE: `hide${EVENT_KEY$4}`,
7083
- HIDDEN: `hidden${EVENT_KEY$4}`,
7084
- SHOW: `show${EVENT_KEY$4}`,
7085
- SHOWN: `shown${EVENT_KEY$4}`,
7086
- INSERTED: `inserted${EVENT_KEY$4}`,
7087
- CLICK: `click${EVENT_KEY$4}`,
7088
- FOCUSIN: `focusin${EVENT_KEY$4}`,
7089
- FOCUSOUT: `focusout${EVENT_KEY$4}`,
7090
- MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
7091
- MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
7030
+ const DefaultType$4 = {
7031
+ allowList: 'object',
7032
+ content: 'object',
7033
+ extraClass: '(string|function)',
7034
+ html: 'boolean',
7035
+ sanitize: 'boolean',
7036
+ sanitizeFn: '(null|function)',
7037
+ template: 'string'
7092
7038
  };
7093
- const CLASS_NAME_FADE$2 = 'fade';
7094
- const CLASS_NAME_MODAL = 'modal';
7095
- const CLASS_NAME_SHOW$2 = 'show';
7096
- const HOVER_STATE_SHOW = 'show';
7097
- const HOVER_STATE_OUT = 'out';
7098
- const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
7099
- const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
7100
- const EVENT_MODAL_HIDE = 'hide.bs.modal';
7101
- const TRIGGER_HOVER = 'hover';
7102
- const TRIGGER_FOCUS = 'focus';
7103
- const TRIGGER_CLICK = 'click';
7104
- const TRIGGER_MANUAL = 'manual';
7105
- class Tooltip extends BaseComponent {
7106
- constructor(element, config) {
7107
- if (typeof Popper === 'undefined') {
7108
- throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
7109
- }
7110
- super(element);
7111
- this._isEnabled = true;
7112
- this._timeout = 0;
7113
- this._hoverState = '';
7114
- this._activeTrigger = {};
7115
- this._popper = null;
7039
+ const DefaultContentType = {
7040
+ entry: '(string|element|function|null)',
7041
+ selector: '(string|element)'
7042
+ };
7043
+ class TemplateFactory extends Config {
7044
+ constructor(config) {
7045
+ super();
7116
7046
  this._config = this._getConfig(config);
7117
- this.tip = null;
7118
- this._setListeners();
7119
7047
  }
7120
7048
  static get Default() {
7121
- return Default$3;
7049
+ return Default$4;
7050
+ }
7051
+ static get DefaultType() {
7052
+ return DefaultType$4;
7122
7053
  }
7123
7054
  static get NAME() {
7124
- return NAME$4;
7055
+ return NAME$5;
7125
7056
  }
7126
- static get Event() {
7127
- return Event$2;
7057
+ getContent() {
7058
+ return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean);
7128
7059
  }
7129
- static get DefaultType() {
7130
- return DefaultType$3;
7060
+ hasContent() {
7061
+ return this.getContent().length > 0;
7131
7062
  }
7132
- enable() {
7133
- this._isEnabled = true;
7063
+ changeContent(content) {
7064
+ this._checkContent(content);
7065
+ this._config.content = { ...this._config.content,
7066
+ ...content
7067
+ };
7068
+ return this;
7134
7069
  }
7135
- disable() {
7136
- this._isEnabled = false;
7070
+ toHtml() {
7071
+ const templateWrapper = document.createElement('div');
7072
+ templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
7073
+ for (const [selector, text] of Object.entries(this._config.content)) {
7074
+ this._setContent(templateWrapper, text, selector);
7075
+ }
7076
+ const template = templateWrapper.children[0];
7077
+ const extraClass = this._resolvePossibleFunction(this._config.extraClass);
7078
+ if (extraClass) {
7079
+ template.classList.add(...extraClass.split(' '));
7080
+ }
7081
+ return template;
7082
+ }
7083
+ _typeCheckConfig(config) {
7084
+ super._typeCheckConfig(config);
7085
+ this._checkContent(config.content);
7086
+ }
7087
+ _checkContent(arg) {
7088
+ for (const [selector, content] of Object.entries(arg)) {
7089
+ super._typeCheckConfig({
7090
+ selector,
7091
+ entry: content
7092
+ }, DefaultContentType);
7093
+ }
7094
+ }
7095
+ _setContent(template, content, selector) {
7096
+ const templateElement = SelectorEngine.findOne(selector, template);
7097
+ if (!templateElement) {
7098
+ return;
7099
+ }
7100
+ content = this._resolvePossibleFunction(content);
7101
+ if (!content) {
7102
+ templateElement.remove();
7103
+ return;
7104
+ }
7105
+ if (isElement(content)) {
7106
+ this._putElementInTemplate(getElement(content), templateElement);
7107
+ return;
7108
+ }
7109
+ if (this._config.html) {
7110
+ templateElement.innerHTML = this._maybeSanitize(content);
7111
+ return;
7112
+ }
7113
+ templateElement.textContent = content;
7114
+ }
7115
+ _maybeSanitize(arg) {
7116
+ return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
7117
+ }
7118
+ _resolvePossibleFunction(arg) {
7119
+ return typeof arg === 'function' ? arg(this) : arg;
7120
+ }
7121
+ _putElementInTemplate(element, templateElement) {
7122
+ if (this._config.html) {
7123
+ templateElement.innerHTML = '';
7124
+ templateElement.append(element);
7125
+ return;
7126
+ }
7127
+ templateElement.textContent = element.textContent;
7128
+ }
7129
+ }
7130
+ const NAME$4 = 'tooltip';
7131
+ const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
7132
+ const CLASS_NAME_FADE$2 = 'fade';
7133
+ const CLASS_NAME_MODAL = 'modal';
7134
+ const CLASS_NAME_SHOW$2 = 'show';
7135
+ const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
7136
+ const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
7137
+ const EVENT_MODAL_HIDE = 'hide.bs.modal';
7138
+ const TRIGGER_HOVER = 'hover';
7139
+ const TRIGGER_FOCUS = 'focus';
7140
+ const TRIGGER_CLICK = 'click';
7141
+ const TRIGGER_MANUAL = 'manual';
7142
+ const EVENT_HIDE$2 = 'hide';
7143
+ const EVENT_HIDDEN$2 = 'hidden';
7144
+ const EVENT_SHOW$2 = 'show';
7145
+ const EVENT_SHOWN$2 = 'shown';
7146
+ const EVENT_INSERTED = 'inserted';
7147
+ const EVENT_CLICK$1 = 'click';
7148
+ const EVENT_FOCUSIN$1 = 'focusin';
7149
+ const EVENT_FOCUSOUT$1 = 'focusout';
7150
+ const EVENT_MOUSEENTER = 'mouseenter';
7151
+ const EVENT_MOUSELEAVE = 'mouseleave';
7152
+ const AttachmentMap = {
7153
+ AUTO: 'auto',
7154
+ TOP: 'top',
7155
+ RIGHT: isRTL() ? 'left' : 'right',
7156
+ BOTTOM: 'bottom',
7157
+ LEFT: isRTL() ? 'right' : 'left'
7158
+ };
7159
+ const Default$3 = {
7160
+ allowList: DefaultAllowlist,
7161
+ animation: true,
7162
+ boundary: 'clippingParents',
7163
+ container: false,
7164
+ customClass: '',
7165
+ delay: 0,
7166
+ fallbackPlacements: ['top', 'right', 'bottom', 'left'],
7167
+ html: false,
7168
+ offset: [0, 0],
7169
+ placement: 'top',
7170
+ popperConfig: null,
7171
+ sanitize: true,
7172
+ sanitizeFn: null,
7173
+ selector: false,
7174
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
7175
+ title: '',
7176
+ trigger: 'hover focus'
7177
+ };
7178
+ const DefaultType$3 = {
7179
+ allowList: 'object',
7180
+ animation: 'boolean',
7181
+ boundary: '(string|element)',
7182
+ container: '(string|element|boolean)',
7183
+ customClass: '(string|function)',
7184
+ delay: '(number|object)',
7185
+ fallbackPlacements: 'array',
7186
+ html: 'boolean',
7187
+ offset: '(array|string|function)',
7188
+ placement: '(string|function)',
7189
+ popperConfig: '(null|object|function)',
7190
+ sanitize: 'boolean',
7191
+ sanitizeFn: '(null|function)',
7192
+ selector: '(string|boolean)',
7193
+ template: 'string',
7194
+ title: '(string|element|function)',
7195
+ trigger: 'string'
7196
+ };
7197
+ class Tooltip extends BaseComponent {
7198
+ constructor(element, config) {
7199
+ if (typeof Popper === 'undefined') {
7200
+ throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
7201
+ }
7202
+ super(element, config);
7203
+ this._isEnabled = true;
7204
+ this._timeout = 0;
7205
+ this._isHovered = false;
7206
+ this._activeTrigger = {};
7207
+ this._popper = null;
7208
+ this._templateFactory = null;
7209
+ this._newContent = null;
7210
+ this.tip = null;
7211
+ this._setListeners();
7212
+ }
7213
+ static get Default() {
7214
+ return Default$3;
7215
+ }
7216
+ static get DefaultType() {
7217
+ return DefaultType$3;
7218
+ }
7219
+ static get NAME() {
7220
+ return NAME$4;
7221
+ }
7222
+ enable() {
7223
+ this._isEnabled = true;
7224
+ }
7225
+ disable() {
7226
+ this._isEnabled = false;
7137
7227
  }
7138
7228
  toggleEnabled() {
7139
7229
  this._isEnabled = !this._isEnabled;
@@ -7146,17 +7236,17 @@ class Tooltip extends BaseComponent {
7146
7236
  const context = this._initializeOnDelegatedTarget(event);
7147
7237
  context._activeTrigger.click = !context._activeTrigger.click;
7148
7238
  if (context._isWithActiveTrigger()) {
7149
- context._enter(null, context);
7239
+ context._enter();
7150
7240
  } else {
7151
- context._leave(null, context);
7241
+ context._leave();
7152
7242
  }
7153
- } else {
7154
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) {
7155
- this._leave(null, this);
7156
- return;
7157
- }
7158
- this._enter(null, this);
7243
+ return;
7159
7244
  }
7245
+ if (this._isShown()) {
7246
+ this._leave();
7247
+ return;
7248
+ }
7249
+ this._enter();
7160
7250
  }
7161
7251
  dispose() {
7162
7252
  clearTimeout(this._timeout);
@@ -7171,182 +7261,163 @@ class Tooltip extends BaseComponent {
7171
7261
  if (this._element.style.display === 'none') {
7172
7262
  throw new Error('Please use show on visible elements');
7173
7263
  }
7174
- if (!(this.isWithContent() && this._isEnabled)) {
7264
+ if (!(this._isWithContent() && this._isEnabled)) {
7175
7265
  return;
7176
7266
  }
7177
- const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
7267
+ const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
7178
7268
  const shadowRoot = findShadowRoot(this._element);
7179
- const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
7269
+ const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
7180
7270
  if (showEvent.defaultPrevented || !isInTheDom) {
7181
7271
  return;
7182
7272
  }
7183
- if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
7184
- this._disposePopper();
7273
+ if (this.tip) {
7185
7274
  this.tip.remove();
7186
7275
  this.tip = null;
7187
7276
  }
7188
- const tip = this.getTipElement();
7189
- const tipId = getUID(this.constructor.NAME);
7190
- tip.setAttribute('id', tipId);
7191
- this._element.setAttribute('aria-describedby', tipId);
7192
- if (this._config.animation) {
7193
- tip.classList.add(CLASS_NAME_FADE$2);
7194
- }
7195
- const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
7196
- const attachment = this._getAttachment(placement);
7197
- this._addAttachmentClass(attachment);
7277
+ const tip = this._getTipElement();
7278
+ this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
7198
7279
  const {
7199
7280
  container
7200
7281
  } = this._config;
7201
- Data.set(tip, this.constructor.DATA_KEY, this);
7202
7282
  if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
7203
7283
  container.append(tip);
7204
- EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
7284
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
7205
7285
  }
7206
7286
  if (this._popper) {
7207
7287
  this._popper.update();
7208
7288
  } else {
7209
- this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment));
7289
+ this._popper = this._createPopper(tip);
7210
7290
  }
7211
7291
  tip.classList.add(CLASS_NAME_SHOW$2);
7212
- const customClass = this._resolvePossibleFunction(this._config.customClass);
7213
- if (customClass) {
7214
- tip.classList.add(...customClass.split(' '));
7215
- }
7216
7292
  if ('ontouchstart' in document.documentElement) {
7217
- [].concat(...document.body.children).forEach(element => {
7293
+ for (const element of [].concat(...document.body.children)) {
7218
7294
  EventHandler.on(element, 'mouseover', noop);
7219
- });
7295
+ }
7220
7296
  }
7221
7297
  const complete = () => {
7222
- const prevHoverState = this._hoverState;
7223
- this._hoverState = null;
7224
- EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
7225
- if (prevHoverState === HOVER_STATE_OUT) {
7226
- this._leave(null, this);
7298
+ const previousHoverState = this._isHovered;
7299
+ this._isHovered = false;
7300
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
7301
+ if (previousHoverState) {
7302
+ this._leave();
7227
7303
  }
7228
7304
  };
7229
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
7230
- this._queueCallback(complete, this.tip, isAnimated);
7305
+ this._queueCallback(complete, this.tip, this._isAnimated());
7231
7306
  }
7232
7307
  hide() {
7233
- if (!this._popper) {
7308
+ if (!this._isShown()) {
7234
7309
  return;
7235
7310
  }
7236
- const tip = this.getTipElement();
7237
- const complete = () => {
7238
- if (this._isWithActiveTrigger()) {
7239
- return;
7240
- }
7241
- if (this._hoverState !== HOVER_STATE_SHOW) {
7242
- tip.remove();
7243
- }
7244
- this._cleanTipClass();
7245
- this._element.removeAttribute('aria-describedby');
7246
- EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
7247
- this._disposePopper();
7248
- };
7249
- const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
7311
+ const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
7250
7312
  if (hideEvent.defaultPrevented) {
7251
7313
  return;
7252
7314
  }
7315
+ const tip = this._getTipElement();
7253
7316
  tip.classList.remove(CLASS_NAME_SHOW$2);
7254
7317
  if ('ontouchstart' in document.documentElement) {
7255
- [].concat(...document.body.children).forEach(element => EventHandler.off(element, 'mouseover', noop));
7318
+ for (const element of [].concat(...document.body.children)) {
7319
+ EventHandler.off(element, 'mouseover', noop);
7320
+ }
7256
7321
  }
7257
7322
  this._activeTrigger[TRIGGER_CLICK] = false;
7258
7323
  this._activeTrigger[TRIGGER_FOCUS] = false;
7259
7324
  this._activeTrigger[TRIGGER_HOVER] = false;
7260
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
7261
- this._queueCallback(complete, this.tip, isAnimated);
7262
- this._hoverState = '';
7325
+ this._isHovered = false;
7326
+ const complete = () => {
7327
+ if (this._isWithActiveTrigger()) {
7328
+ return;
7329
+ }
7330
+ if (!this._isHovered) {
7331
+ tip.remove();
7332
+ }
7333
+ this._element.removeAttribute('aria-describedby');
7334
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2));
7335
+ this._disposePopper();
7336
+ };
7337
+ this._queueCallback(complete, this.tip, this._isAnimated());
7263
7338
  }
7264
7339
  update() {
7265
- if (this._popper !== null) {
7340
+ if (this._popper) {
7266
7341
  this._popper.update();
7267
7342
  }
7268
7343
  }
7269
- isWithContent() {
7270
- return Boolean(this.getTitle());
7344
+ _isWithContent() {
7345
+ return Boolean(this._getTitle());
7271
7346
  }
7272
- getTipElement() {
7273
- if (this.tip) {
7274
- return this.tip;
7347
+ _getTipElement() {
7348
+ if (!this.tip) {
7349
+ this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
7275
7350
  }
7276
- const element = document.createElement('div');
7277
- element.innerHTML = this._config.template;
7278
- const tip = element.children[0];
7279
- this.setContent(tip);
7280
- tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
7281
- this.tip = tip;
7282
7351
  return this.tip;
7283
7352
  }
7284
- setContent(tip) {
7285
- this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
7286
- }
7287
- _sanitizeAndSetContent(template, content, selector) {
7288
- const templateElement = SelectorEngine.findOne(selector, template);
7289
- if (!content && templateElement) {
7290
- templateElement.remove();
7291
- return;
7353
+ _createTipElement(content) {
7354
+ const tip = this._getTemplateFactory(content).toHtml();
7355
+ if (!tip) {
7356
+ return null;
7292
7357
  }
7293
- this.setElementContent(templateElement, content);
7294
- }
7295
- setElementContent(element, content) {
7296
- if (element === null) {
7297
- return;
7358
+ tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
7359
+ tip.classList.add(`bs-${this.constructor.NAME}-auto`);
7360
+ const tipId = getUID(this.constructor.NAME).toString();
7361
+ tip.setAttribute('id', tipId);
7362
+ if (this._isAnimated()) {
7363
+ tip.classList.add(CLASS_NAME_FADE$2);
7298
7364
  }
7299
- if (isElement(content)) {
7300
- content = getElement(content);
7301
- if (this._config.html) {
7302
- if (content.parentNode !== element) {
7303
- element.innerHTML = '';
7304
- element.append(content);
7305
- }
7306
- } else {
7307
- element.textContent = content.textContent;
7308
- }
7309
- return;
7365
+ return tip;
7366
+ }
7367
+ setContent(content) {
7368
+ this._newContent = content;
7369
+ if (this._isShown()) {
7370
+ this._disposePopper();
7371
+ this.show();
7310
7372
  }
7311
- if (this._config.html) {
7312
- if (this._config.sanitize) {
7313
- content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
7314
- }
7315
- element.innerHTML = content;
7373
+ }
7374
+ _getTemplateFactory(content) {
7375
+ if (this._templateFactory) {
7376
+ this._templateFactory.changeContent(content);
7316
7377
  } else {
7317
- element.textContent = content;
7378
+ this._templateFactory = new TemplateFactory({ ...this._config,
7379
+ content,
7380
+ extraClass: this._resolvePossibleFunction(this._config.customClass)
7381
+ });
7318
7382
  }
7383
+ return this._templateFactory;
7319
7384
  }
7320
- getTitle() {
7321
- const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
7322
- return this._resolvePossibleFunction(title);
7385
+ _getContentForTemplate() {
7386
+ return {
7387
+ [SELECTOR_TOOLTIP_INNER]: this._getTitle()
7388
+ };
7323
7389
  }
7324
- updateAttachment(attachment) {
7325
- if (attachment === 'right') {
7326
- return 'end';
7327
- }
7328
- if (attachment === 'left') {
7329
- return 'start';
7330
- }
7331
- return attachment;
7390
+ _getTitle() {
7391
+ return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle;
7392
+ }
7393
+ _initializeOnDelegatedTarget(event) {
7394
+ return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
7332
7395
  }
7333
- _initializeOnDelegatedTarget(event, context) {
7334
- return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
7396
+ _isAnimated() {
7397
+ return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2);
7398
+ }
7399
+ _isShown() {
7400
+ return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2);
7401
+ }
7402
+ _createPopper(tip) {
7403
+ const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
7404
+ const attachment = AttachmentMap[placement.toUpperCase()];
7405
+ return createPopper(this._element, tip, this._getPopperConfig(attachment));
7335
7406
  }
7336
7407
  _getOffset() {
7337
7408
  const {
7338
7409
  offset
7339
7410
  } = this._config;
7340
7411
  if (typeof offset === 'string') {
7341
- return offset.split(',').map(val => Number.parseInt(val, 10));
7412
+ return offset.split(',').map(value => Number.parseInt(value, 10));
7342
7413
  }
7343
7414
  if (typeof offset === 'function') {
7344
7415
  return popperData => offset(popperData, this._element);
7345
7416
  }
7346
7417
  return offset;
7347
7418
  }
7348
- _resolvePossibleFunction(content) {
7349
- return typeof content === 'function' ? content.call(this._element) : content;
7419
+ _resolvePossibleFunction(arg) {
7420
+ return typeof arg === 'function' ? arg.call(this._element) : arg;
7350
7421
  }
7351
7422
  _getPopperConfig(attachment) {
7352
7423
  const defaultBsPopperConfig = {
@@ -7372,39 +7443,38 @@ class Tooltip extends BaseComponent {
7372
7443
  element: `.${this.constructor.NAME}-arrow`
7373
7444
  }
7374
7445
  }, {
7375
- name: 'onChange',
7446
+ name: 'preSetPlacement',
7376
7447
  enabled: true,
7377
- phase: 'afterWrite',
7378
- fn: data => this._handlePopperPlacementChange(data)
7379
- }],
7380
- onFirstUpdate: data => {
7381
- if (data.options.placement !== data.placement) {
7382
- this._handlePopperPlacementChange(data);
7448
+ phase: 'beforeMain',
7449
+ fn: data => {
7450
+ this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
7383
7451
  }
7384
- }
7452
+ }]
7385
7453
  };
7386
7454
  return { ...defaultBsPopperConfig,
7387
7455
  ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
7388
7456
  };
7389
7457
  }
7390
- _addAttachmentClass(attachment) {
7391
- this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
7392
- }
7393
- _getAttachment(placement) {
7394
- return AttachmentMap[placement.toUpperCase()];
7395
- }
7396
7458
  _setListeners() {
7397
7459
  const triggers = this._config.trigger.split(' ');
7398
- triggers.forEach(trigger => {
7460
+ for (const trigger of triggers) {
7399
7461
  if (trigger === 'click') {
7400
- EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
7462
+ EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => this.toggle(event));
7401
7463
  } else if (trigger !== TRIGGER_MANUAL) {
7402
- const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
7403
- const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
7404
- EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event));
7405
- EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event));
7464
+ const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1);
7465
+ const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1);
7466
+ EventHandler.on(this._element, eventIn, this._config.selector, event => {
7467
+ const context = this._initializeOnDelegatedTarget(event);
7468
+ context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
7469
+ context._enter();
7470
+ });
7471
+ EventHandler.on(this._element, eventOut, this._config.selector, event => {
7472
+ const context = this._initializeOnDelegatedTarget(event);
7473
+ context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
7474
+ context._leave();
7475
+ });
7406
7476
  }
7407
- });
7477
+ }
7408
7478
  this._hideModalHandler = () => {
7409
7479
  if (this._element) {
7410
7480
  this.hide();
@@ -7421,76 +7491,61 @@ class Tooltip extends BaseComponent {
7421
7491
  }
7422
7492
  }
7423
7493
  _fixTitle() {
7424
- const title = this._element.getAttribute('title');
7425
- const originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
7426
- if (title || originalTitleType !== 'string') {
7427
- this._element.setAttribute('data-bs-original-title', title || '');
7428
- if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
7429
- this._element.setAttribute('aria-label', title);
7430
- }
7431
- this._element.setAttribute('title', '');
7432
- }
7433
- }
7434
- _enter(event, context) {
7435
- context = this._initializeOnDelegatedTarget(event, context);
7436
- if (event) {
7437
- context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
7438
- }
7439
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) {
7440
- context._hoverState = HOVER_STATE_SHOW;
7494
+ const title = this._config.originalTitle;
7495
+ if (!title) {
7441
7496
  return;
7442
7497
  }
7443
- clearTimeout(context._timeout);
7444
- context._hoverState = HOVER_STATE_SHOW;
7445
- if (!context._config.delay || !context._config.delay.show) {
7446
- context.show();
7447
- return;
7498
+ if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
7499
+ this._element.setAttribute('aria-label', title);
7448
7500
  }
7449
- context._timeout = setTimeout(() => {
7450
- if (context._hoverState === HOVER_STATE_SHOW) {
7451
- context.show();
7452
- }
7453
- }, context._config.delay.show);
7501
+ this._element.removeAttribute('title');
7454
7502
  }
7455
- _leave(event, context) {
7456
- context = this._initializeOnDelegatedTarget(event, context);
7457
- if (event) {
7458
- context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
7459
- }
7460
- if (context._isWithActiveTrigger()) {
7503
+ _enter() {
7504
+ if (this._isShown() || this._isHovered) {
7505
+ this._isHovered = true;
7461
7506
  return;
7462
7507
  }
7463
- clearTimeout(context._timeout);
7464
- context._hoverState = HOVER_STATE_OUT;
7465
- if (!context._config.delay || !context._config.delay.hide) {
7466
- context.hide();
7508
+ this._isHovered = true;
7509
+ this._setTimeout(() => {
7510
+ if (this._isHovered) {
7511
+ this.show();
7512
+ }
7513
+ }, this._config.delay.show);
7514
+ }
7515
+ _leave() {
7516
+ if (this._isWithActiveTrigger()) {
7467
7517
  return;
7468
7518
  }
7469
- context._timeout = setTimeout(() => {
7470
- if (context._hoverState === HOVER_STATE_OUT) {
7471
- context.hide();
7519
+ this._isHovered = false;
7520
+ this._setTimeout(() => {
7521
+ if (!this._isHovered) {
7522
+ this.hide();
7472
7523
  }
7473
- }, context._config.delay.hide);
7524
+ }, this._config.delay.hide);
7525
+ }
7526
+ _setTimeout(handler, timeout) {
7527
+ clearTimeout(this._timeout);
7528
+ this._timeout = setTimeout(handler, timeout);
7474
7529
  }
7475
7530
  _isWithActiveTrigger() {
7476
- for (const trigger in this._activeTrigger) {
7477
- if (this._activeTrigger[trigger]) {
7478
- return true;
7479
- }
7480
- }
7481
- return false;
7531
+ return Object.values(this._activeTrigger).includes(true);
7482
7532
  }
7483
7533
  _getConfig(config) {
7484
7534
  const dataAttributes = Manipulator.getDataAttributes(this._element);
7485
- Object.keys(dataAttributes).forEach(dataAttr => {
7486
- if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
7487
- delete dataAttributes[dataAttr];
7535
+ for (const dataAttribute of Object.keys(dataAttributes)) {
7536
+ if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
7537
+ delete dataAttributes[dataAttribute];
7488
7538
  }
7489
- });
7490
- config = { ...this.constructor.Default,
7491
- ...dataAttributes,
7539
+ }
7540
+ config = { ...dataAttributes,
7492
7541
  ...(typeof config === 'object' && config ? config : {})
7493
7542
  };
7543
+ config = this._mergeConfigObj(config);
7544
+ config = this._configAfterMerge(config);
7545
+ this._typeCheckConfig(config);
7546
+ return config;
7547
+ }
7548
+ _configAfterMerge(config) {
7494
7549
  config.container = config.container === false ? document.body : getElement(config.container);
7495
7550
  if (typeof config.delay === 'number') {
7496
7551
  config.delay = {
@@ -7498,16 +7553,13 @@ class Tooltip extends BaseComponent {
7498
7553
  hide: config.delay
7499
7554
  };
7500
7555
  }
7556
+ config.originalTitle = this._element.getAttribute('title') || '';
7501
7557
  if (typeof config.title === 'number') {
7502
7558
  config.title = config.title.toString();
7503
7559
  }
7504
7560
  if (typeof config.content === 'number') {
7505
7561
  config.content = config.content.toString();
7506
7562
  }
7507
- typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
7508
- if (config.sanitize) {
7509
- config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
7510
- }
7511
7563
  return config;
7512
7564
  }
7513
7565
  _getDelegateConfig() {
@@ -7519,28 +7571,6 @@ class Tooltip extends BaseComponent {
7519
7571
  }
7520
7572
  return config;
7521
7573
  }
7522
- _cleanTipClass() {
7523
- const tip = this.getTipElement();
7524
- const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
7525
- const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
7526
- if (tabClass !== null && tabClass.length > 0) {
7527
- tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
7528
- }
7529
- }
7530
- _getBasicClassPrefix() {
7531
- return CLASS_PREFIX$1;
7532
- }
7533
- _handlePopperPlacementChange(popperData) {
7534
- const {
7535
- state
7536
- } = popperData;
7537
- if (!state) {
7538
- return;
7539
- }
7540
- this.tip = state.elements.popper;
7541
- this._cleanTipClass();
7542
- this._addAttachmentClass(this._getAttachment(state.placement));
7543
- }
7544
7574
  _disposePopper() {
7545
7575
  if (this._popper) {
7546
7576
  this._popper.destroy();
@@ -7550,79 +7580,62 @@ class Tooltip extends BaseComponent {
7550
7580
  static jQueryInterface(config) {
7551
7581
  return this.each(function () {
7552
7582
  const data = Tooltip.getOrCreateInstance(this, config);
7553
- if (typeof config === 'string') {
7554
- if (typeof data[config] === 'undefined') {
7555
- throw new TypeError(`No method named "${config}"`);
7556
- }
7557
- data[config]();
7583
+ if (typeof config !== 'string') {
7584
+ return;
7585
+ }
7586
+ if (typeof data[config] === 'undefined') {
7587
+ throw new TypeError(`No method named "${config}"`);
7558
7588
  }
7589
+ data[config]();
7559
7590
  });
7560
7591
  }
7561
7592
  }
7562
7593
  defineJQueryPlugin(Tooltip);
7563
7594
  const NAME$3 = 'popover';
7564
- const DATA_KEY$3 = 'bs.popover';
7565
- const EVENT_KEY$3 = `.${DATA_KEY$3}`;
7566
- const CLASS_PREFIX = 'bs-popover';
7595
+ const SELECTOR_TITLE = '.popover-header';
7596
+ const SELECTOR_CONTENT = '.popover-body';
7567
7597
  const Default$2 = { ...Tooltip.Default,
7568
- placement: 'right',
7569
- offset: [0, 8],
7570
- trigger: 'click',
7571
7598
  content: '',
7572
- template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>'
7599
+ offset: [0, 8],
7600
+ placement: 'right',
7601
+ template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
7602
+ trigger: 'click'
7573
7603
  };
7574
7604
  const DefaultType$2 = { ...Tooltip.DefaultType,
7575
- content: '(string|element|function)'
7605
+ content: '(null|string|element|function)'
7576
7606
  };
7577
- const Event$1 = {
7578
- HIDE: `hide${EVENT_KEY$3}`,
7579
- HIDDEN: `hidden${EVENT_KEY$3}`,
7580
- SHOW: `show${EVENT_KEY$3}`,
7581
- SHOWN: `shown${EVENT_KEY$3}`,
7582
- INSERTED: `inserted${EVENT_KEY$3}`,
7583
- CLICK: `click${EVENT_KEY$3}`,
7584
- FOCUSIN: `focusin${EVENT_KEY$3}`,
7585
- FOCUSOUT: `focusout${EVENT_KEY$3}`,
7586
- MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
7587
- MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
7588
- };
7589
- const SELECTOR_TITLE = '.popover-header';
7590
- const SELECTOR_CONTENT = '.popover-body';
7591
7607
  class Popover extends Tooltip {
7592
7608
  static get Default() {
7593
7609
  return Default$2;
7594
7610
  }
7595
- static get NAME() {
7596
- return NAME$3;
7597
- }
7598
- static get Event() {
7599
- return Event$1;
7600
- }
7601
7611
  static get DefaultType() {
7602
7612
  return DefaultType$2;
7603
7613
  }
7604
- isWithContent() {
7605
- return this.getTitle() || this._getContent();
7614
+ static get NAME() {
7615
+ return NAME$3;
7606
7616
  }
7607
- setContent(tip) {
7608
- this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
7609
- this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
7617
+ _isWithContent() {
7618
+ return this._getTitle() || this._getContent();
7619
+ }
7620
+ _getContentForTemplate() {
7621
+ return {
7622
+ [SELECTOR_TITLE]: this._getTitle(),
7623
+ [SELECTOR_CONTENT]: this._getContent()
7624
+ };
7610
7625
  }
7611
7626
  _getContent() {
7612
7627
  return this._resolvePossibleFunction(this._config.content);
7613
7628
  }
7614
- _getBasicClassPrefix() {
7615
- return CLASS_PREFIX;
7616
- }
7617
7629
  static jQueryInterface(config) {
7618
7630
  return this.each(function () {
7619
7631
  const data = Popover.getOrCreateInstance(this, config);
7620
- if (typeof config === 'string') {
7621
- if (typeof data[config] === 'undefined') {
7622
- throw new TypeError(`No method named "${config}"`);
7623
- }
7624
- data[config]();
7632
+ if (typeof config !== 'string') {
7633
+ return;
7634
+ }
7635
+ if (typeof data[config] === 'undefined') {
7636
+ throw new TypeError(`No method named "${config}"`);
7625
7637
  }
7638
+ data[config]();
7626
7639
  });
7627
7640
  }
7628
7641
  }
@@ -7630,144 +7643,181 @@ defineJQueryPlugin(Popover);
7630
7643
  const NAME$2 = 'scrollspy';
7631
7644
  const DATA_KEY$2 = 'bs.scrollspy';
7632
7645
  const EVENT_KEY$2 = `.${DATA_KEY$2}`;
7633
- const DATA_API_KEY$1 = '.data-api';
7634
- const Default$1 = {
7635
- offset: 10,
7636
- method: 'auto',
7637
- target: ''
7638
- };
7639
- const DefaultType$1 = {
7640
- offset: 'number',
7641
- method: 'string',
7642
- target: '(string|element)'
7643
- };
7646
+ const DATA_API_KEY = '.data-api';
7644
7647
  const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
7645
- const EVENT_SCROLL = `scroll${EVENT_KEY$2}`;
7646
- const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`;
7648
+ const EVENT_CLICK = `click${EVENT_KEY$2}`;
7649
+ const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
7647
7650
  const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
7648
7651
  const CLASS_NAME_ACTIVE$1 = 'active';
7649
7652
  const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
7650
- const SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
7653
+ const SELECTOR_TARGET_LINKS = '[href]';
7654
+ const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
7651
7655
  const SELECTOR_NAV_LINKS = '.nav-link';
7652
7656
  const SELECTOR_NAV_ITEMS = '.nav-item';
7653
7657
  const SELECTOR_LIST_ITEMS = '.list-group-item';
7654
- const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`;
7655
- const SELECTOR_DROPDOWN$1 = '.dropdown';
7658
+ const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
7659
+ const SELECTOR_DROPDOWN = '.dropdown';
7656
7660
  const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
7657
- const METHOD_OFFSET = 'offset';
7658
- const METHOD_POSITION = 'position';
7661
+ const Default$1 = {
7662
+ offset: null,
7663
+ rootMargin: '0px 0px -25%',
7664
+ smoothScroll: false,
7665
+ target: null
7666
+ };
7667
+ const DefaultType$1 = {
7668
+ offset: '(number|null)',
7669
+ rootMargin: 'string',
7670
+ smoothScroll: 'boolean',
7671
+ target: 'element'
7672
+ };
7659
7673
  class ScrollSpy extends BaseComponent {
7660
7674
  constructor(element, config) {
7661
- super(element);
7662
- this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
7663
- this._config = this._getConfig(config);
7664
- this._offsets = [];
7665
- this._targets = [];
7675
+ super(element, config);
7676
+ this._targetLinks = new Map();
7677
+ this._observableSections = new Map();
7678
+ this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
7666
7679
  this._activeTarget = null;
7667
- this._scrollHeight = 0;
7668
- EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
7680
+ this._observer = null;
7681
+ this._previousScrollData = {
7682
+ visibleEntryTop: 0,
7683
+ parentScrollTop: 0
7684
+ };
7669
7685
  this.refresh();
7670
- this._process();
7671
7686
  }
7672
7687
  static get Default() {
7673
7688
  return Default$1;
7674
7689
  }
7690
+ static get DefaultType() {
7691
+ return DefaultType$1;
7692
+ }
7675
7693
  static get NAME() {
7676
7694
  return NAME$2;
7677
7695
  }
7678
7696
  refresh() {
7679
- const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
7680
- const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
7681
- const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
7682
- this._offsets = [];
7683
- this._targets = [];
7684
- this._scrollHeight = this._getScrollHeight();
7685
- const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target);
7686
- targets.map(element => {
7687
- const targetSelector = getSelectorFromElement(element);
7688
- const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
7689
- if (target) {
7690
- const targetBCR = target.getBoundingClientRect();
7691
- if (targetBCR.width || targetBCR.height) {
7692
- return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
7693
- }
7694
- }
7695
- return null;
7696
- }).filter(item => item).sort((a, b) => a[0] - b[0]).forEach(item => {
7697
- this._offsets.push(item[0]);
7698
- this._targets.push(item[1]);
7699
- });
7697
+ this._initializeTargetsAndObservables();
7698
+ this._maybeEnableSmoothScroll();
7699
+ if (this._observer) {
7700
+ this._observer.disconnect();
7701
+ } else {
7702
+ this._observer = this._getNewObserver();
7703
+ }
7704
+ for (const section of this._observableSections.values()) {
7705
+ this._observer.observe(section);
7706
+ }
7700
7707
  }
7701
7708
  dispose() {
7702
- EventHandler.off(this._scrollElement, EVENT_KEY$2);
7709
+ this._observer.disconnect();
7703
7710
  super.dispose();
7704
7711
  }
7705
- _getConfig(config) {
7706
- config = { ...Default$1,
7707
- ...Manipulator.getDataAttributes(this._element),
7708
- ...(typeof config === 'object' && config ? config : {})
7709
- };
7710
- config.target = getElement(config.target) || document.documentElement;
7711
- typeCheckConfig(NAME$2, config, DefaultType$1);
7712
+ _configAfterMerge(config) {
7713
+ config.target = getElement(config.target) || document.body;
7712
7714
  return config;
7713
7715
  }
7714
- _getScrollTop() {
7715
- return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
7716
- }
7717
- _getScrollHeight() {
7718
- return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
7716
+ _maybeEnableSmoothScroll() {
7717
+ if (!this._config.smoothScroll) {
7718
+ return;
7719
+ }
7720
+ EventHandler.off(this._config.target, EVENT_CLICK);
7721
+ EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
7722
+ const observableSection = this._observableSections.get(event.target.hash);
7723
+ if (observableSection) {
7724
+ event.preventDefault();
7725
+ const root = this._rootElement || window;
7726
+ const height = observableSection.offsetTop - this._element.offsetTop;
7727
+ if (root.scrollTo) {
7728
+ root.scrollTo({
7729
+ top: height,
7730
+ behavior: 'smooth'
7731
+ });
7732
+ return;
7733
+ }
7734
+ root.scrollTop = height;
7735
+ }
7736
+ });
7719
7737
  }
7720
- _getOffsetHeight() {
7721
- return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
7738
+ _getNewObserver() {
7739
+ const options = {
7740
+ root: this._rootElement,
7741
+ threshold: [0.1, 0.5, 1],
7742
+ rootMargin: this._getRootMargin()
7743
+ };
7744
+ return new IntersectionObserver(entries => this._observerCallback(entries), options);
7722
7745
  }
7723
- _process() {
7724
- const scrollTop = this._getScrollTop() + this._config.offset;
7725
- const scrollHeight = this._getScrollHeight();
7726
- const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
7727
- if (this._scrollHeight !== scrollHeight) {
7728
- this.refresh();
7746
+ _observerCallback(entries) {
7747
+ const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
7748
+ const activate = entry => {
7749
+ this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
7750
+ this._process(targetElement(entry));
7751
+ };
7752
+ const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
7753
+ const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
7754
+ this._previousScrollData.parentScrollTop = parentScrollTop;
7755
+ for (const entry of entries) {
7756
+ if (!entry.isIntersecting) {
7757
+ this._activeTarget = null;
7758
+ this._clearActiveClass(targetElement(entry));
7759
+ continue;
7760
+ }
7761
+ const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
7762
+ if (userScrollsDown && entryIsLowerThanPrevious) {
7763
+ activate(entry);
7764
+ if (!parentScrollTop) {
7765
+ return;
7766
+ }
7767
+ continue;
7768
+ }
7769
+ if (!userScrollsDown && !entryIsLowerThanPrevious) {
7770
+ activate(entry);
7771
+ }
7729
7772
  }
7730
- if (scrollTop >= maxScroll) {
7731
- const target = this._targets[this._targets.length - 1];
7732
- if (this._activeTarget !== target) {
7733
- this._activate(target);
7773
+ }
7774
+ _getRootMargin() {
7775
+ return this._config.offset ? `${this._config.offset}px 0px -30%` : this._config.rootMargin;
7776
+ }
7777
+ _initializeTargetsAndObservables() {
7778
+ this._targetLinks = new Map();
7779
+ this._observableSections = new Map();
7780
+ const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
7781
+ for (const anchor of targetLinks) {
7782
+ if (!anchor.hash || isDisabled(anchor)) {
7783
+ continue;
7734
7784
  }
7785
+ const observableSection = SelectorEngine.findOne(anchor.hash, this._element);
7786
+ if (isVisible(observableSection)) {
7787
+ this._targetLinks.set(anchor.hash, anchor);
7788
+ this._observableSections.set(anchor.hash, observableSection);
7789
+ }
7790
+ }
7791
+ }
7792
+ _process(target) {
7793
+ if (this._activeTarget === target) {
7735
7794
  return;
7736
7795
  }
7737
- if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
7738
- this._activeTarget = null;
7739
- this._clear();
7796
+ this._clearActiveClass(this._config.target);
7797
+ this._activeTarget = target;
7798
+ target.classList.add(CLASS_NAME_ACTIVE$1);
7799
+ this._activateParents(target);
7800
+ EventHandler.trigger(this._element, EVENT_ACTIVATE, {
7801
+ relatedTarget: target
7802
+ });
7803
+ }
7804
+ _activateParents(target) {
7805
+ if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
7806
+ SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
7740
7807
  return;
7741
7808
  }
7742
- for (let i = this._offsets.length; i--;) {
7743
- const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
7744
- if (isActiveTarget) {
7745
- this._activate(this._targets[i]);
7809
+ for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
7810
+ for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
7811
+ item.classList.add(CLASS_NAME_ACTIVE$1);
7746
7812
  }
7747
7813
  }
7748
7814
  }
7749
- _activate(target) {
7750
- this._activeTarget = target;
7751
- this._clear();
7752
- const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
7753
- const link = SelectorEngine.findOne(queries.join(','), this._config.target);
7754
- link.classList.add(CLASS_NAME_ACTIVE$1);
7755
- if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
7756
- SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
7757
- } else {
7758
- SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => {
7759
- SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1));
7760
- SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(navItem => {
7761
- SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1));
7762
- });
7763
- });
7815
+ _clearActiveClass(parent) {
7816
+ parent.classList.remove(CLASS_NAME_ACTIVE$1);
7817
+ const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent);
7818
+ for (const node of activeNodes) {
7819
+ node.classList.remove(CLASS_NAME_ACTIVE$1);
7764
7820
  }
7765
- EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
7766
- relatedTarget: target
7767
- });
7768
- }
7769
- _clear() {
7770
- SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
7771
7821
  }
7772
7822
  static jQueryInterface(config) {
7773
7823
  return this.each(function () {
@@ -7775,132 +7825,208 @@ class ScrollSpy extends BaseComponent {
7775
7825
  if (typeof config !== 'string') {
7776
7826
  return;
7777
7827
  }
7778
- if (typeof data[config] === 'undefined') {
7828
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
7779
7829
  throw new TypeError(`No method named "${config}"`);
7780
7830
  }
7781
7831
  data[config]();
7782
7832
  });
7783
7833
  }
7784
7834
  }
7785
- EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
7786
- SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
7835
+ EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
7836
+ for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
7837
+ ScrollSpy.getOrCreateInstance(spy);
7838
+ }
7787
7839
  });
7788
7840
  defineJQueryPlugin(ScrollSpy);
7789
7841
  const NAME$1 = 'tab';
7790
7842
  const DATA_KEY$1 = 'bs.tab';
7791
7843
  const EVENT_KEY$1 = `.${DATA_KEY$1}`;
7792
- const DATA_API_KEY = '.data-api';
7793
7844
  const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
7794
7845
  const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
7795
7846
  const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
7796
7847
  const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
7797
- const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`;
7798
- const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
7848
+ const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
7849
+ const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
7850
+ const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
7851
+ const ARROW_LEFT_KEY = 'ArrowLeft';
7852
+ const ARROW_RIGHT_KEY = 'ArrowRight';
7853
+ const ARROW_UP_KEY = 'ArrowUp';
7854
+ const ARROW_DOWN_KEY = 'ArrowDown';
7799
7855
  const CLASS_NAME_ACTIVE = 'active';
7800
7856
  const CLASS_NAME_FADE$1 = 'fade';
7801
7857
  const CLASS_NAME_SHOW$1 = 'show';
7802
- const SELECTOR_DROPDOWN = '.dropdown';
7803
- const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
7804
- const SELECTOR_ACTIVE = '.active';
7805
- const SELECTOR_ACTIVE_UL = ':scope > li > .active';
7806
- const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
7858
+ const CLASS_DROPDOWN = 'dropdown';
7807
7859
  const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
7808
- const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
7860
+ const SELECTOR_DROPDOWN_MENU = '.dropdown-menu';
7861
+ const SELECTOR_DROPDOWN_ITEM = '.dropdown-item';
7862
+ const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)';
7863
+ const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
7864
+ const SELECTOR_OUTER = '.nav-item, .list-group-item';
7865
+ const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
7866
+ const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
7867
+ const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
7868
+ const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;
7809
7869
  class Tab extends BaseComponent {
7870
+ constructor(element) {
7871
+ super(element);
7872
+ this._parent = this._element.closest(SELECTOR_TAB_PANEL);
7873
+ if (!this._parent) {
7874
+ return;
7875
+ }
7876
+ this._setInitialAttributes(this._parent, this._getChildren());
7877
+ EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
7878
+ }
7810
7879
  static get NAME() {
7811
7880
  return NAME$1;
7812
7881
  }
7813
7882
  show() {
7814
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
7883
+ const innerElem = this._element;
7884
+ if (this._elemIsActive(innerElem)) {
7815
7885
  return;
7816
7886
  }
7817
- let previous;
7818
- const target = getElementFromSelector(this._element);
7819
- const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
7820
- if (listElement) {
7821
- const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
7822
- previous = SelectorEngine.find(itemSelector, listElement);
7823
- previous = previous[previous.length - 1];
7824
- }
7825
- const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, {
7826
- relatedTarget: this._element
7887
+ const active = this._getActiveElem();
7888
+ const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
7889
+ relatedTarget: innerElem
7827
7890
  }) : null;
7828
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, {
7829
- relatedTarget: previous
7891
+ const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
7892
+ relatedTarget: active
7830
7893
  });
7831
- if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
7894
+ if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
7832
7895
  return;
7833
7896
  }
7834
- this._activate(this._element, listElement);
7897
+ this._deactivate(active, innerElem);
7898
+ this._activate(innerElem, active);
7899
+ }
7900
+ _activate(element, relatedElem) {
7901
+ if (!element) {
7902
+ return;
7903
+ }
7904
+ element.classList.add(CLASS_NAME_ACTIVE);
7905
+ this._activate(getElementFromSelector(element));
7835
7906
  const complete = () => {
7836
- EventHandler.trigger(previous, EVENT_HIDDEN$1, {
7837
- relatedTarget: this._element
7907
+ if (element.getAttribute('role') !== 'tab') {
7908
+ element.classList.add(CLASS_NAME_SHOW$1);
7909
+ return;
7910
+ }
7911
+ element.focus();
7912
+ element.removeAttribute('tabindex');
7913
+ element.setAttribute('aria-selected', true);
7914
+ this._toggleDropDown(element, true);
7915
+ EventHandler.trigger(element, EVENT_SHOWN$1, {
7916
+ relatedTarget: relatedElem
7838
7917
  });
7839
- EventHandler.trigger(this._element, EVENT_SHOWN$1, {
7840
- relatedTarget: previous
7918
+ };
7919
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
7920
+ }
7921
+ _deactivate(element, relatedElem) {
7922
+ if (!element) {
7923
+ return;
7924
+ }
7925
+ element.classList.remove(CLASS_NAME_ACTIVE);
7926
+ element.blur();
7927
+ this._deactivate(getElementFromSelector(element));
7928
+ const complete = () => {
7929
+ if (element.getAttribute('role') !== 'tab') {
7930
+ element.classList.remove(CLASS_NAME_SHOW$1);
7931
+ return;
7932
+ }
7933
+ element.setAttribute('aria-selected', false);
7934
+ element.setAttribute('tabindex', '-1');
7935
+ this._toggleDropDown(element, false);
7936
+ EventHandler.trigger(element, EVENT_HIDDEN$1, {
7937
+ relatedTarget: relatedElem
7841
7938
  });
7842
7939
  };
7843
- if (target) {
7844
- this._activate(target, target.parentNode, complete);
7845
- } else {
7846
- complete();
7940
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
7941
+ }
7942
+ _keydown(event) {
7943
+ if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) {
7944
+ return;
7945
+ }
7946
+ event.stopPropagation();
7947
+ event.preventDefault();
7948
+ const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
7949
+ const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true);
7950
+ if (nextActiveElement) {
7951
+ Tab.getOrCreateInstance(nextActiveElement).show();
7847
7952
  }
7848
7953
  }
7849
- _activate(element, container, callback) {
7850
- const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE);
7851
- const active = activeElements[0];
7852
- const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1);
7853
- const complete = () => this._transitionComplete(element, active, callback);
7854
- if (active && isTransitioning) {
7855
- active.classList.remove(CLASS_NAME_SHOW$1);
7856
- this._queueCallback(complete, element, true);
7857
- } else {
7858
- complete();
7954
+ _getChildren() {
7955
+ return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
7956
+ }
7957
+ _getActiveElem() {
7958
+ return this._getChildren().find(child => this._elemIsActive(child)) || null;
7959
+ }
7960
+ _setInitialAttributes(parent, children) {
7961
+ this._setAttributeIfNotExists(parent, 'role', 'tablist');
7962
+ for (const child of children) {
7963
+ this._setInitialAttributesOnChild(child);
7859
7964
  }
7860
7965
  }
7861
- _transitionComplete(element, active, callback) {
7862
- if (active) {
7863
- active.classList.remove(CLASS_NAME_ACTIVE);
7864
- const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
7865
- if (dropdownChild) {
7866
- dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
7867
- }
7868
- if (active.getAttribute('role') === 'tab') {
7869
- active.setAttribute('aria-selected', false);
7870
- }
7966
+ _setInitialAttributesOnChild(child) {
7967
+ child = this._getInnerElement(child);
7968
+ const isActive = this._elemIsActive(child);
7969
+ const outerElem = this._getOuterElement(child);
7970
+ child.setAttribute('aria-selected', isActive);
7971
+ if (outerElem !== child) {
7972
+ this._setAttributeIfNotExists(outerElem, 'role', 'presentation');
7871
7973
  }
7872
- element.classList.add(CLASS_NAME_ACTIVE);
7873
- if (element.getAttribute('role') === 'tab') {
7874
- element.setAttribute('aria-selected', true);
7974
+ if (!isActive) {
7975
+ child.setAttribute('tabindex', '-1');
7976
+ }
7977
+ this._setAttributeIfNotExists(child, 'role', 'tab');
7978
+ this._setInitialAttributesOnTargetPanel(child);
7979
+ }
7980
+ _setInitialAttributesOnTargetPanel(child) {
7981
+ const target = getElementFromSelector(child);
7982
+ if (!target) {
7983
+ return;
7875
7984
  }
7876
- reflow(element);
7877
- if (element.classList.contains(CLASS_NAME_FADE$1)) {
7878
- element.classList.add(CLASS_NAME_SHOW$1);
7985
+ this._setAttributeIfNotExists(target, 'role', 'tabpanel');
7986
+ if (child.id) {
7987
+ this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`);
7879
7988
  }
7880
- let parent = element.parentNode;
7881
- if (parent && parent.nodeName === 'LI') {
7882
- parent = parent.parentNode;
7989
+ }
7990
+ _toggleDropDown(element, open) {
7991
+ const outerElem = this._getOuterElement(element);
7992
+ if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
7993
+ return;
7883
7994
  }
7884
- if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
7885
- const dropdownElement = element.closest(SELECTOR_DROPDOWN);
7886
- if (dropdownElement) {
7887
- SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
7995
+ const toggle = (selector, className) => {
7996
+ const element = SelectorEngine.findOne(selector, outerElem);
7997
+ if (element) {
7998
+ element.classList.toggle(className, open);
7888
7999
  }
7889
- element.setAttribute('aria-expanded', true);
7890
- }
7891
- if (callback) {
7892
- callback();
8000
+ };
8001
+ toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
8002
+ toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
8003
+ toggle(SELECTOR_DROPDOWN_ITEM, CLASS_NAME_ACTIVE);
8004
+ outerElem.setAttribute('aria-expanded', open);
8005
+ }
8006
+ _setAttributeIfNotExists(element, attribute, value) {
8007
+ if (!element.hasAttribute(attribute)) {
8008
+ element.setAttribute(attribute, value);
7893
8009
  }
7894
8010
  }
8011
+ _elemIsActive(elem) {
8012
+ return elem.classList.contains(CLASS_NAME_ACTIVE);
8013
+ }
8014
+ _getInnerElement(elem) {
8015
+ return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
8016
+ }
8017
+ _getOuterElement(elem) {
8018
+ return elem.closest(SELECTOR_OUTER) || elem;
8019
+ }
7895
8020
  static jQueryInterface(config) {
7896
8021
  return this.each(function () {
7897
8022
  const data = Tab.getOrCreateInstance(this);
7898
- if (typeof config === 'string') {
7899
- if (typeof data[config] === 'undefined') {
7900
- throw new TypeError(`No method named "${config}"`);
7901
- }
7902
- data[config]();
8023
+ if (typeof config !== 'string') {
8024
+ return;
7903
8025
  }
8026
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
8027
+ throw new TypeError(`No method named "${config}"`);
8028
+ }
8029
+ data[config]();
7904
8030
  });
7905
8031
  }
7906
8032
  }
@@ -7911,8 +8037,12 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
7911
8037
  if (isDisabled(this)) {
7912
8038
  return;
7913
8039
  }
7914
- const data = Tab.getOrCreateInstance(this);
7915
- data.show();
8040
+ Tab.getOrCreateInstance(this).show();
8041
+ });
8042
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
8043
+ for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
8044
+ Tab.getOrCreateInstance(element);
8045
+ }
7916
8046
  });
7917
8047
  defineJQueryPlugin(Tab);
7918
8048
  const NAME = 'toast';
@@ -7942,19 +8072,18 @@ const Default = {
7942
8072
  };
7943
8073
  class Toast extends BaseComponent {
7944
8074
  constructor(element, config) {
7945
- super(element);
7946
- this._config = this._getConfig(config);
8075
+ super(element, config);
7947
8076
  this._timeout = null;
7948
8077
  this._hasMouseInteraction = false;
7949
8078
  this._hasKeyboardInteraction = false;
7950
8079
  this._setListeners();
7951
8080
  }
7952
- static get DefaultType() {
7953
- return DefaultType;
7954
- }
7955
8081
  static get Default() {
7956
8082
  return Default;
7957
8083
  }
8084
+ static get DefaultType() {
8085
+ return DefaultType;
8086
+ }
7958
8087
  static get NAME() {
7959
8088
  return NAME;
7960
8089
  }
@@ -7974,12 +8103,11 @@ class Toast extends BaseComponent {
7974
8103
  };
7975
8104
  this._element.classList.remove(CLASS_NAME_HIDE);
7976
8105
  reflow(this._element);
7977
- this._element.classList.add(CLASS_NAME_SHOW);
7978
- this._element.classList.add(CLASS_NAME_SHOWING);
8106
+ this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
7979
8107
  this._queueCallback(complete, this._element, this._config.animation);
7980
8108
  }
7981
8109
  hide() {
7982
- if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
8110
+ if (!this.isShown()) {
7983
8111
  return;
7984
8112
  }
7985
8113
  const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
@@ -7988,8 +8116,7 @@ class Toast extends BaseComponent {
7988
8116
  }
7989
8117
  const complete = () => {
7990
8118
  this._element.classList.add(CLASS_NAME_HIDE);
7991
- this._element.classList.remove(CLASS_NAME_SHOWING);
7992
- this._element.classList.remove(CLASS_NAME_SHOW);
8119
+ this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
7993
8120
  EventHandler.trigger(this._element, EVENT_HIDDEN);
7994
8121
  };
7995
8122
  this._element.classList.add(CLASS_NAME_SHOWING);
@@ -7997,18 +8124,13 @@ class Toast extends BaseComponent {
7997
8124
  }
7998
8125
  dispose() {
7999
8126
  this._clearTimeout();
8000
- if (this._element.classList.contains(CLASS_NAME_SHOW)) {
8127
+ if (this.isShown()) {
8001
8128
  this._element.classList.remove(CLASS_NAME_SHOW);
8002
8129
  }
8003
8130
  super.dispose();
8004
8131
  }
8005
- _getConfig(config) {
8006
- config = { ...Default,
8007
- ...Manipulator.getDataAttributes(this._element),
8008
- ...(typeof config === 'object' && config ? config : {})
8009
- };
8010
- typeCheckConfig(NAME, config, this.constructor.DefaultType);
8011
- return config;
8132
+ isShown() {
8133
+ return this._element.classList.contains(CLASS_NAME_SHOW);
8012
8134
  }
8013
8135
  _maybeScheduleHide() {
8014
8136
  if (!this._config.autohide) {