@tabler/core 1.0.0-beta10 → 1.0.0-beta12

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