@keenthemes/ktui 1.2.1 → 1.2.3

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 (304) hide show
  1. package/dist/ktui.js +2216 -845
  2. package/dist/ktui.min.js +1 -1
  3. package/dist/ktui.min.js.map +1 -1
  4. package/dist/styles.css +24 -197
  5. package/lib/cjs/components/carousel/carousel.d.ts +102 -0
  6. package/lib/cjs/components/carousel/carousel.d.ts.map +1 -0
  7. package/lib/cjs/components/carousel/carousel.js +769 -0
  8. package/lib/cjs/components/carousel/carousel.js.map +1 -0
  9. package/lib/cjs/components/carousel/index.d.ts +7 -0
  10. package/lib/cjs/components/carousel/index.d.ts.map +1 -0
  11. package/lib/cjs/components/carousel/index.js +10 -0
  12. package/lib/cjs/components/carousel/index.js.map +1 -0
  13. package/lib/cjs/components/carousel/types.d.ts +36 -0
  14. package/lib/cjs/components/carousel/types.d.ts.map +1 -0
  15. package/lib/cjs/components/carousel/types.js +7 -0
  16. package/lib/cjs/components/carousel/types.js.map +1 -0
  17. package/lib/cjs/components/component.d.ts +3 -3
  18. package/lib/cjs/components/component.d.ts.map +1 -1
  19. package/lib/cjs/components/component.js +9 -1
  20. package/lib/cjs/components/component.js.map +1 -1
  21. package/lib/cjs/components/datatable/datatable-checkbox.d.ts +1 -1
  22. package/lib/cjs/components/datatable/datatable-checkbox.d.ts.map +1 -1
  23. package/lib/cjs/components/datatable/datatable-checkbox.js +1 -1
  24. package/lib/cjs/components/datatable/datatable-checkbox.js.map +1 -1
  25. package/lib/cjs/components/datatable/datatable-sort.d.ts +1 -1
  26. package/lib/cjs/components/datatable/datatable-sort.d.ts.map +1 -1
  27. package/lib/cjs/components/datatable/datatable-sort.js.map +1 -1
  28. package/lib/cjs/components/datatable/datatable.d.ts +2 -0
  29. package/lib/cjs/components/datatable/datatable.d.ts.map +1 -1
  30. package/lib/cjs/components/datatable/datatable.js +30 -17
  31. package/lib/cjs/components/datatable/datatable.js.map +1 -1
  32. package/lib/cjs/components/datatable/types.d.ts +2 -1
  33. package/lib/cjs/components/datatable/types.d.ts.map +1 -1
  34. package/lib/cjs/components/drawer/drawer.d.ts.map +1 -1
  35. package/lib/cjs/components/drawer/drawer.js +3 -16
  36. package/lib/cjs/components/drawer/drawer.js.map +1 -1
  37. package/lib/cjs/components/dropdown/dropdown.d.ts +1 -1
  38. package/lib/cjs/components/dropdown/dropdown.d.ts.map +1 -1
  39. package/lib/cjs/components/dropdown/dropdown.js +2 -3
  40. package/lib/cjs/components/dropdown/dropdown.js.map +1 -1
  41. package/lib/cjs/components/modal/modal.d.ts.map +1 -1
  42. package/lib/cjs/components/modal/modal.js +19 -13
  43. package/lib/cjs/components/modal/modal.js.map +1 -1
  44. package/lib/cjs/components/pin-input/index.d.ts +3 -0
  45. package/lib/cjs/components/pin-input/index.d.ts.map +1 -0
  46. package/lib/cjs/components/pin-input/index.js +6 -0
  47. package/lib/cjs/components/pin-input/index.js.map +1 -0
  48. package/lib/cjs/components/pin-input/pin-input.d.ts +56 -0
  49. package/lib/cjs/components/pin-input/pin-input.d.ts.map +1 -0
  50. package/lib/cjs/components/pin-input/pin-input.js +455 -0
  51. package/lib/cjs/components/pin-input/pin-input.js.map +1 -0
  52. package/lib/cjs/components/pin-input/types.d.ts +41 -0
  53. package/lib/cjs/components/pin-input/types.d.ts.map +1 -0
  54. package/lib/cjs/components/pin-input/types.js +6 -0
  55. package/lib/cjs/components/pin-input/types.js.map +1 -0
  56. package/lib/cjs/components/rating/rating.d.ts.map +1 -1
  57. package/lib/cjs/components/rating/rating.js.map +1 -1
  58. package/lib/cjs/components/select/combobox.d.ts.map +1 -1
  59. package/lib/cjs/components/select/combobox.js +25 -15
  60. package/lib/cjs/components/select/combobox.js.map +1 -1
  61. package/lib/cjs/components/select/config.d.ts +2 -2
  62. package/lib/cjs/components/select/config.d.ts.map +1 -1
  63. package/lib/cjs/components/select/config.js +10 -9
  64. package/lib/cjs/components/select/config.js.map +1 -1
  65. package/lib/cjs/components/select/dropdown.js.map +1 -1
  66. package/lib/cjs/components/select/option.d.ts +2 -1
  67. package/lib/cjs/components/select/option.d.ts.map +1 -1
  68. package/lib/cjs/components/select/option.js +9 -3
  69. package/lib/cjs/components/select/option.js.map +1 -1
  70. package/lib/cjs/components/select/remote.d.ts +1 -0
  71. package/lib/cjs/components/select/remote.d.ts.map +1 -1
  72. package/lib/cjs/components/select/remote.js +21 -14
  73. package/lib/cjs/components/select/remote.js.map +1 -1
  74. package/lib/cjs/components/select/search.d.ts +1 -1
  75. package/lib/cjs/components/select/search.d.ts.map +1 -1
  76. package/lib/cjs/components/select/search.js +34 -25
  77. package/lib/cjs/components/select/search.js.map +1 -1
  78. package/lib/cjs/components/select/select.d.ts +5 -3
  79. package/lib/cjs/components/select/select.d.ts.map +1 -1
  80. package/lib/cjs/components/select/select.js +31 -31
  81. package/lib/cjs/components/select/select.js.map +1 -1
  82. package/lib/cjs/components/select/tags.d.ts.map +1 -1
  83. package/lib/cjs/components/select/tags.js +22 -13
  84. package/lib/cjs/components/select/tags.js.map +1 -1
  85. package/lib/cjs/components/select/templates.d.ts.map +1 -1
  86. package/lib/cjs/components/select/templates.js +4 -4
  87. package/lib/cjs/components/select/templates.js.map +1 -1
  88. package/lib/cjs/components/select/types.d.ts +1 -1
  89. package/lib/cjs/components/select/types.d.ts.map +1 -1
  90. package/lib/cjs/components/select/utils.d.ts +4 -4
  91. package/lib/cjs/components/select/utils.d.ts.map +1 -1
  92. package/lib/cjs/components/select/utils.js +2 -3
  93. package/lib/cjs/components/select/utils.js.map +1 -1
  94. package/lib/cjs/components/sticky/sticky.d.ts +1 -1
  95. package/lib/cjs/components/sticky/sticky.d.ts.map +1 -1
  96. package/lib/cjs/components/sticky/sticky.js +13 -13
  97. package/lib/cjs/components/sticky/sticky.js.map +1 -1
  98. package/lib/cjs/components/theme-switch/theme-switch.d.ts +3 -0
  99. package/lib/cjs/components/theme-switch/theme-switch.d.ts.map +1 -1
  100. package/lib/cjs/components/theme-switch/theme-switch.js +17 -4
  101. package/lib/cjs/components/theme-switch/theme-switch.js.map +1 -1
  102. package/lib/cjs/components/toast/toast.d.ts.map +1 -1
  103. package/lib/cjs/components/toast/toast.js +17 -9
  104. package/lib/cjs/components/toast/toast.js.map +1 -1
  105. package/lib/cjs/components/toast/types.d.ts +3 -0
  106. package/lib/cjs/components/toast/types.d.ts.map +1 -1
  107. package/lib/cjs/components/toggle/toggle.d.ts +2 -0
  108. package/lib/cjs/components/toggle/toggle.d.ts.map +1 -1
  109. package/lib/cjs/components/toggle/toggle.js +11 -2
  110. package/lib/cjs/components/toggle/toggle.js.map +1 -1
  111. package/lib/cjs/components/toggle-password/toggle-password.d.ts.map +1 -1
  112. package/lib/cjs/components/toggle-password/toggle-password.js.map +1 -1
  113. package/lib/cjs/helpers/dom.d.ts +4 -4
  114. package/lib/cjs/helpers/dom.d.ts.map +1 -1
  115. package/lib/cjs/helpers/dom.js +8 -10
  116. package/lib/cjs/helpers/dom.js.map +1 -1
  117. package/lib/cjs/helpers/event-handler.d.ts +1 -1
  118. package/lib/cjs/helpers/event-handler.d.ts.map +1 -1
  119. package/lib/cjs/helpers/event-handler.js +3 -1
  120. package/lib/cjs/helpers/event-handler.js.map +1 -1
  121. package/lib/cjs/helpers/utils.d.ts +1 -1
  122. package/lib/cjs/helpers/utils.d.ts.map +1 -1
  123. package/lib/cjs/helpers/utils.js +4 -1
  124. package/lib/cjs/helpers/utils.js.map +1 -1
  125. package/lib/cjs/index.d.ts +8 -0
  126. package/lib/cjs/index.d.ts.map +1 -1
  127. package/lib/cjs/index.js +9 -1
  128. package/lib/cjs/index.js.map +1 -1
  129. package/lib/cjs/types.d.ts +1 -1
  130. package/lib/cjs/types.d.ts.map +1 -1
  131. package/lib/esm/components/carousel/carousel.d.ts +102 -0
  132. package/lib/esm/components/carousel/carousel.d.ts.map +1 -0
  133. package/lib/esm/components/carousel/carousel.js +766 -0
  134. package/lib/esm/components/carousel/carousel.js.map +1 -0
  135. package/lib/esm/components/carousel/index.d.ts +7 -0
  136. package/lib/esm/components/carousel/index.d.ts.map +1 -0
  137. package/lib/esm/components/carousel/index.js +6 -0
  138. package/lib/esm/components/carousel/index.js.map +1 -0
  139. package/lib/esm/components/carousel/types.d.ts +36 -0
  140. package/lib/esm/components/carousel/types.d.ts.map +1 -0
  141. package/lib/esm/components/carousel/types.js +6 -0
  142. package/lib/esm/components/carousel/types.js.map +1 -0
  143. package/lib/esm/components/component.d.ts +3 -3
  144. package/lib/esm/components/component.d.ts.map +1 -1
  145. package/lib/esm/components/component.js +9 -1
  146. package/lib/esm/components/component.js.map +1 -1
  147. package/lib/esm/components/datatable/datatable-checkbox.d.ts +1 -1
  148. package/lib/esm/components/datatable/datatable-checkbox.d.ts.map +1 -1
  149. package/lib/esm/components/datatable/datatable-checkbox.js +1 -1
  150. package/lib/esm/components/datatable/datatable-checkbox.js.map +1 -1
  151. package/lib/esm/components/datatable/datatable-sort.d.ts +1 -1
  152. package/lib/esm/components/datatable/datatable-sort.d.ts.map +1 -1
  153. package/lib/esm/components/datatable/datatable-sort.js.map +1 -1
  154. package/lib/esm/components/datatable/datatable.d.ts +2 -0
  155. package/lib/esm/components/datatable/datatable.d.ts.map +1 -1
  156. package/lib/esm/components/datatable/datatable.js +30 -17
  157. package/lib/esm/components/datatable/datatable.js.map +1 -1
  158. package/lib/esm/components/datatable/types.d.ts +2 -1
  159. package/lib/esm/components/datatable/types.d.ts.map +1 -1
  160. package/lib/esm/components/drawer/drawer.d.ts.map +1 -1
  161. package/lib/esm/components/drawer/drawer.js +3 -16
  162. package/lib/esm/components/drawer/drawer.js.map +1 -1
  163. package/lib/esm/components/dropdown/dropdown.d.ts +1 -1
  164. package/lib/esm/components/dropdown/dropdown.d.ts.map +1 -1
  165. package/lib/esm/components/dropdown/dropdown.js +2 -3
  166. package/lib/esm/components/dropdown/dropdown.js.map +1 -1
  167. package/lib/esm/components/modal/modal.d.ts.map +1 -1
  168. package/lib/esm/components/modal/modal.js +19 -13
  169. package/lib/esm/components/modal/modal.js.map +1 -1
  170. package/lib/esm/components/pin-input/index.d.ts +3 -0
  171. package/lib/esm/components/pin-input/index.d.ts.map +1 -0
  172. package/lib/esm/components/pin-input/index.js +2 -0
  173. package/lib/esm/components/pin-input/index.js.map +1 -0
  174. package/lib/esm/components/pin-input/pin-input.d.ts +56 -0
  175. package/lib/esm/components/pin-input/pin-input.d.ts.map +1 -0
  176. package/lib/esm/components/pin-input/pin-input.js +452 -0
  177. package/lib/esm/components/pin-input/pin-input.js.map +1 -0
  178. package/lib/esm/components/pin-input/types.d.ts +41 -0
  179. package/lib/esm/components/pin-input/types.d.ts.map +1 -0
  180. package/lib/esm/components/pin-input/types.js +5 -0
  181. package/lib/esm/components/pin-input/types.js.map +1 -0
  182. package/lib/esm/components/rating/rating.d.ts.map +1 -1
  183. package/lib/esm/components/rating/rating.js.map +1 -1
  184. package/lib/esm/components/select/combobox.d.ts.map +1 -1
  185. package/lib/esm/components/select/combobox.js +25 -15
  186. package/lib/esm/components/select/combobox.js.map +1 -1
  187. package/lib/esm/components/select/config.d.ts +2 -2
  188. package/lib/esm/components/select/config.d.ts.map +1 -1
  189. package/lib/esm/components/select/config.js +10 -9
  190. package/lib/esm/components/select/config.js.map +1 -1
  191. package/lib/esm/components/select/dropdown.js.map +1 -1
  192. package/lib/esm/components/select/option.d.ts +2 -1
  193. package/lib/esm/components/select/option.d.ts.map +1 -1
  194. package/lib/esm/components/select/option.js +9 -3
  195. package/lib/esm/components/select/option.js.map +1 -1
  196. package/lib/esm/components/select/remote.d.ts +1 -0
  197. package/lib/esm/components/select/remote.d.ts.map +1 -1
  198. package/lib/esm/components/select/remote.js +21 -14
  199. package/lib/esm/components/select/remote.js.map +1 -1
  200. package/lib/esm/components/select/search.d.ts +1 -1
  201. package/lib/esm/components/select/search.d.ts.map +1 -1
  202. package/lib/esm/components/select/search.js +34 -25
  203. package/lib/esm/components/select/search.js.map +1 -1
  204. package/lib/esm/components/select/select.d.ts +5 -3
  205. package/lib/esm/components/select/select.d.ts.map +1 -1
  206. package/lib/esm/components/select/select.js +31 -31
  207. package/lib/esm/components/select/select.js.map +1 -1
  208. package/lib/esm/components/select/tags.d.ts.map +1 -1
  209. package/lib/esm/components/select/tags.js +22 -13
  210. package/lib/esm/components/select/tags.js.map +1 -1
  211. package/lib/esm/components/select/templates.d.ts.map +1 -1
  212. package/lib/esm/components/select/templates.js +4 -4
  213. package/lib/esm/components/select/templates.js.map +1 -1
  214. package/lib/esm/components/select/types.d.ts +1 -1
  215. package/lib/esm/components/select/types.d.ts.map +1 -1
  216. package/lib/esm/components/select/utils.d.ts +4 -4
  217. package/lib/esm/components/select/utils.d.ts.map +1 -1
  218. package/lib/esm/components/select/utils.js +2 -3
  219. package/lib/esm/components/select/utils.js.map +1 -1
  220. package/lib/esm/components/sticky/sticky.d.ts +1 -1
  221. package/lib/esm/components/sticky/sticky.d.ts.map +1 -1
  222. package/lib/esm/components/sticky/sticky.js +13 -13
  223. package/lib/esm/components/sticky/sticky.js.map +1 -1
  224. package/lib/esm/components/theme-switch/theme-switch.d.ts +3 -0
  225. package/lib/esm/components/theme-switch/theme-switch.d.ts.map +1 -1
  226. package/lib/esm/components/theme-switch/theme-switch.js +17 -4
  227. package/lib/esm/components/theme-switch/theme-switch.js.map +1 -1
  228. package/lib/esm/components/toast/toast.d.ts.map +1 -1
  229. package/lib/esm/components/toast/toast.js +17 -9
  230. package/lib/esm/components/toast/toast.js.map +1 -1
  231. package/lib/esm/components/toast/types.d.ts +3 -0
  232. package/lib/esm/components/toast/types.d.ts.map +1 -1
  233. package/lib/esm/components/toggle/toggle.d.ts +2 -0
  234. package/lib/esm/components/toggle/toggle.d.ts.map +1 -1
  235. package/lib/esm/components/toggle/toggle.js +11 -2
  236. package/lib/esm/components/toggle/toggle.js.map +1 -1
  237. package/lib/esm/components/toggle-password/toggle-password.d.ts.map +1 -1
  238. package/lib/esm/components/toggle-password/toggle-password.js.map +1 -1
  239. package/lib/esm/helpers/dom.d.ts +4 -4
  240. package/lib/esm/helpers/dom.d.ts.map +1 -1
  241. package/lib/esm/helpers/dom.js +8 -10
  242. package/lib/esm/helpers/dom.js.map +1 -1
  243. package/lib/esm/helpers/event-handler.d.ts +1 -1
  244. package/lib/esm/helpers/event-handler.d.ts.map +1 -1
  245. package/lib/esm/helpers/event-handler.js +3 -1
  246. package/lib/esm/helpers/event-handler.js.map +1 -1
  247. package/lib/esm/helpers/utils.d.ts +1 -1
  248. package/lib/esm/helpers/utils.d.ts.map +1 -1
  249. package/lib/esm/helpers/utils.js +4 -1
  250. package/lib/esm/helpers/utils.js.map +1 -1
  251. package/lib/esm/index.d.ts +8 -0
  252. package/lib/esm/index.d.ts.map +1 -1
  253. package/lib/esm/index.js +6 -0
  254. package/lib/esm/index.js.map +1 -1
  255. package/lib/esm/types.d.ts +1 -1
  256. package/lib/esm/types.d.ts.map +1 -1
  257. package/package.json +5 -2
  258. package/src/components/carousel/__tests__/carousel.test.ts +326 -0
  259. package/src/components/carousel/carousel.css +42 -0
  260. package/src/components/carousel/carousel.ts +847 -0
  261. package/src/components/carousel/index.ts +11 -0
  262. package/src/components/carousel/types.ts +38 -0
  263. package/src/components/clipboard/__tests__/clipboard.test.ts +4 -4
  264. package/src/components/component.ts +15 -5
  265. package/src/components/datatable/__tests__/currency-sort.test.ts +4 -3
  266. package/src/components/datatable/__tests__/pagination-reset.test.ts +7 -4
  267. package/src/components/datatable/__tests__/setup.ts +1 -1
  268. package/src/components/datatable/datatable-checkbox.ts +6 -4
  269. package/src/components/datatable/datatable-sort.ts +27 -7
  270. package/src/components/datatable/datatable.ts +64 -37
  271. package/src/components/datatable/types.ts +3 -1
  272. package/src/components/drawer/drawer.ts +3 -18
  273. package/src/components/dropdown/dropdown.ts +2 -3
  274. package/src/components/modal/modal.ts +22 -14
  275. package/src/components/pin-input/__tests__/pin-input.test.ts +928 -0
  276. package/src/components/pin-input/index.ts +6 -0
  277. package/src/components/pin-input/pin-input.ts +499 -0
  278. package/src/components/pin-input/types.ts +45 -0
  279. package/src/components/rating/rating.ts +0 -1
  280. package/src/components/repeater/__tests__/repeater.test.ts +5 -5
  281. package/src/components/select/__tests__/ux-behaviors.test.ts +4 -3
  282. package/src/components/select/combobox.ts +23 -16
  283. package/src/components/select/config.ts +15 -14
  284. package/src/components/select/dropdown.ts +1 -1
  285. package/src/components/select/option.ts +14 -4
  286. package/src/components/select/remote.ts +68 -56
  287. package/src/components/select/search.ts +30 -27
  288. package/src/components/select/select.ts +41 -37
  289. package/src/components/select/tags.ts +14 -8
  290. package/src/components/select/templates.ts +11 -6
  291. package/src/components/select/types.ts +1 -1
  292. package/src/components/select/utils.ts +7 -9
  293. package/src/components/sticky/sticky.ts +2 -2
  294. package/src/components/theme-switch/theme-switch.ts +22 -4
  295. package/src/components/toast/toast.ts +34 -21
  296. package/src/components/toast/types.ts +5 -1
  297. package/src/components/toggle/toggle.ts +12 -2
  298. package/src/components/toggle-password/toggle-password.ts +0 -1
  299. package/src/helpers/dom.ts +14 -17
  300. package/src/helpers/event-handler.ts +5 -6
  301. package/src/helpers/utils.ts +5 -2
  302. package/src/index.ts +18 -0
  303. package/src/types.ts +1 -1
  304. package/styles.css +1 -0
package/dist/ktui.js CHANGED
@@ -3147,10 +3147,10 @@ Object.defineProperty(exports, "KTAccordion", ({ enumerable: true, get: function
3147
3147
 
3148
3148
  /***/ }),
3149
3149
 
3150
- /***/ "./src/components/clipboard/clipboard.ts":
3151
- /*!***********************************************!*\
3152
- !*** ./src/components/clipboard/clipboard.ts ***!
3153
- \***********************************************/
3150
+ /***/ "./src/components/carousel/carousel.ts":
3151
+ /*!*********************************************!*\
3152
+ !*** ./src/components/carousel/carousel.ts ***!
3153
+ \*********************************************/
3154
3154
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3155
3155
 
3156
3156
 
@@ -3173,184 +3173,981 @@ var __extends = (this && this.__extends) || (function () {
3173
3173
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3174
3174
  };
3175
3175
  })();
3176
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3177
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3178
- return new (P || (P = Promise))(function (resolve, reject) {
3179
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
3180
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
3181
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
3182
- step((generator = generator.apply(thisArg, _arguments || [])).next());
3183
- });
3184
- };
3185
- var __generator = (this && this.__generator) || function (thisArg, body) {
3186
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
3187
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
3188
- function verb(n) { return function (v) { return step([n, v]); }; }
3189
- function step(op) {
3190
- if (f) throw new TypeError("Generator is already executing.");
3191
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
3192
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
3193
- if (y = 0, t) op = [op[0] & 2, t.value];
3194
- switch (op[0]) {
3195
- case 0: case 1: t = op; break;
3196
- case 4: _.label++; return { value: op[1], done: false };
3197
- case 5: _.label++; y = op[1]; op = [0]; continue;
3198
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
3199
- default:
3200
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
3201
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
3202
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
3203
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
3204
- if (t[2]) _.ops.pop();
3205
- _.trys.pop(); continue;
3206
- }
3207
- op = body.call(thisArg, _);
3208
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
3209
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
3210
- }
3211
- };
3212
3176
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3213
- exports.KTClipboard = void 0;
3214
- var component_1 = __webpack_require__(/*! ../component */ "./src/components/component.ts");
3177
+ exports.KTCarousel = void 0;
3215
3178
  var data_1 = __webpack_require__(/*! ../../helpers/data */ "./src/helpers/data.ts");
3216
- var dom_1 = __webpack_require__(/*! ../../helpers/dom */ "./src/helpers/dom.ts");
3217
- var KTClipboard = /** @class */ (function (_super) {
3218
- __extends(KTClipboard, _super);
3219
- function KTClipboard(element, config) {
3179
+ var component_1 = __webpack_require__(/*! ../component */ "./src/components/component.ts");
3180
+ var SELECTOR_VIEWPORT = '[data-kt-carousel-viewport]';
3181
+ var SELECTOR_ITEM = '[data-kt-carousel-item]';
3182
+ var SELECTOR_PREV = '[data-kt-carousel-prev]';
3183
+ var SELECTOR_NEXT = '[data-kt-carousel-next]';
3184
+ var SELECTOR_PAGINATION = '[data-kt-carousel-pagination]';
3185
+ var SELECTOR_PAGINATION_ITEM = '[data-kt-carousel-pagination-item]';
3186
+ var SELECTOR_THUMBS = '[data-kt-carousel-thumbnails]';
3187
+ var SELECTOR_THUMB = '[data-kt-carousel-thumbnail]';
3188
+ var SELECTOR_CURRENT = '[data-kt-carousel-current]';
3189
+ var SELECTOR_TOTAL = '[data-kt-carousel-total]';
3190
+ var KTCarousel = /** @class */ (function (_super) {
3191
+ __extends(KTCarousel, _super);
3192
+ function KTCarousel(element, config) {
3220
3193
  if (config === void 0) { config = null; }
3221
3194
  var _this = _super.call(this) || this;
3222
- _this._name = 'clipboard';
3195
+ _this._name = 'carousel';
3223
3196
  _this._defaultConfig = {
3224
- target: '',
3225
- text: '',
3226
- action: 'copy',
3227
- copiedClass: '',
3228
- successEvent: 'kt.clipboard.success',
3229
- errorEvent: 'kt.clipboard.error',
3197
+ autoplay: false,
3198
+ autoplayInterval: 4000,
3199
+ infiniteLoop: false,
3200
+ rtl: false,
3201
+ perView: 1,
3202
+ centered: false,
3203
+ draggable: false,
3204
+ snap: false,
3205
+ autoHeight: false,
3206
+ showScrollbar: false,
3207
+ lazy: false,
3208
+ pauseOnHover: true,
3209
+ changeEvent: 'kt.carousel.change',
3230
3210
  };
3231
3211
  _this._config = _this
3232
3212
  ._defaultConfig;
3233
- _this._activateHandler = null;
3234
- // Ensure we don't double bind handlers on the same trigger.
3213
+ _this._viewport = null;
3214
+ _this._slides = [];
3215
+ _this._index = 0;
3216
+ _this._autoplayTimer = null;
3217
+ _this._programmaticScroll = false;
3218
+ _this._resizeObserver = null;
3219
+ _this._prefersReducedMotion = false;
3220
+ _this._onPrevClick = null;
3221
+ _this._onNextClick = null;
3222
+ _this._onScroll = null;
3223
+ _this._onScrollEnd = null;
3224
+ _this._onKeyDown = null;
3225
+ _this._onPointerDown = null;
3226
+ _this._onPointerMove = null;
3227
+ _this._onPointerUp = null;
3228
+ _this._paginationHandlers = [];
3229
+ _this._thumbHandlers = [];
3230
+ _this._programmaticScrollPrevIndex = null;
3231
+ _this._programmaticScrollTargetIndex = null;
3232
+ _this._programmaticScrollUserInitiated = false;
3233
+ _this._programmaticScrollFallbackTimer = null;
3234
+ _this._scrollSyncRaf = 0;
3235
+ _this._pauseAutoplay = null;
3236
+ _this._resumeAutoplay = null;
3237
+ _this._dragStartX = 0;
3238
+ _this._dragStartScroll = 0;
3239
+ _this._dragging = false;
3240
+ _this._dragMoved = false;
3241
+ _this._pointerId = null;
3242
+ _this._prevButtons = [];
3243
+ _this._nextButtons = [];
3244
+ _this._currentLabels = [];
3245
+ _this._totalLabels = [];
3235
3246
  if (_this._shouldSkipInit(element)) {
3236
3247
  return _this;
3237
3248
  }
3249
+ var viewport = KTCarousel._resolveViewportStatic(element);
3250
+ var slides = KTCarousel._collectSlidesStatic(viewport);
3251
+ if (!viewport || slides.length === 0) {
3252
+ return _this;
3253
+ }
3238
3254
  _this._init(element);
3239
3255
  _this._buildConfig(config);
3240
- if (!_this._element)
3241
- return _this;
3242
- _this._activateHandler = _this._handleActivate.bind(_this);
3243
- _this._element.addEventListener('click', _this._activateHandler);
3256
+ _this._syncShowScrollbarAttribute();
3257
+ _this._viewport = viewport;
3258
+ _this._slides = slides;
3259
+ _this._prefersReducedMotion = _this._readPrefersReducedMotion();
3260
+ _this._bindControls();
3261
+ _this._bindScrollSync();
3262
+ _this._bindKeyboard();
3263
+ _this._bindAutoplayHoverPause();
3264
+ _this._bindDraggable();
3265
+ _this._bindAutoHeight();
3266
+ _this._syncIndexFromScroll();
3267
+ _this._updateInfo();
3268
+ _this._updatePaginationState();
3269
+ _this._updateThumbState(false);
3270
+ _this._startAutoplay();
3244
3271
  return _this;
3245
3272
  }
3246
- KTClipboard.prototype._getSuccessEventName = function () {
3247
- var eventName = this._getOption('successEvent');
3248
- return typeof eventName === 'string' && eventName.length > 0
3249
- ? eventName
3250
- : 'kt.clipboard.success';
3273
+ KTCarousel.prototype._readPrefersReducedMotion = function () {
3274
+ if (typeof window === 'undefined' || !window.matchMedia) {
3275
+ return false;
3276
+ }
3277
+ return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
3251
3278
  };
3252
- KTClipboard.prototype._getErrorEventName = function () {
3253
- var eventName = this._getOption('errorEvent');
3254
- return typeof eventName === 'string' && eventName.length > 0
3255
- ? eventName
3256
- : 'kt.clipboard.error';
3279
+ KTCarousel.prototype._syncShowScrollbarAttribute = function () {
3280
+ if (!this._element)
3281
+ return;
3282
+ var show = this._getOption('showScrollbar') === true;
3283
+ if (show) {
3284
+ this._element.setAttribute('data-kt-carousel-show-scrollbar', 'true');
3285
+ }
3286
+ else {
3287
+ this._element.removeAttribute('data-kt-carousel-show-scrollbar');
3288
+ }
3257
3289
  };
3258
- KTClipboard.prototype._getAction = function () {
3259
- var action = this._getOption('action');
3260
- return action === 'cut' ? 'cut' : 'copy';
3290
+ KTCarousel._resolveViewportStatic = function (root) {
3291
+ var explicit = root.querySelector(SELECTOR_VIEWPORT);
3292
+ if (explicit)
3293
+ return explicit;
3294
+ return root;
3261
3295
  };
3262
- KTClipboard.prototype._getTrimmedString = function (optionValue) {
3263
- return typeof optionValue === 'string' ? optionValue.trim() : '';
3296
+ KTCarousel._collectSlidesStatic = function (viewport) {
3297
+ if (!viewport)
3298
+ return [];
3299
+ return Array.from(viewport.querySelectorAll(SELECTOR_ITEM));
3264
3300
  };
3265
- KTClipboard.prototype._getPredefinedText = function () {
3266
- var text = this._getOption('text');
3267
- return this._getTrimmedString(text);
3301
+ KTCarousel.prototype._isRtl = function () {
3302
+ var _a;
3303
+ if (this._getOption('rtl') === true)
3304
+ return true;
3305
+ if (((_a = this._element) === null || _a === void 0 ? void 0 : _a.getAttribute('dir')) === 'rtl')
3306
+ return true;
3307
+ if (this._viewport &&
3308
+ getComputedStyle(this._viewport).direction === 'rtl') {
3309
+ return true;
3310
+ }
3311
+ return false;
3268
3312
  };
3269
- KTClipboard.prototype._getTargetSelector = function () {
3270
- var target = this._getOption('target');
3271
- return this._getTrimmedString(target);
3313
+ KTCarousel.prototype._scrollBehavior = function () {
3314
+ return this._prefersReducedMotion ? 'auto' : 'smooth';
3272
3315
  };
3273
- KTClipboard.prototype._getCopiedClass = function () {
3274
- var copiedClass = this._getOption('copiedClass');
3275
- return this._getTrimmedString(copiedClass);
3316
+ KTCarousel.prototype._effectiveDraggable = function () {
3317
+ if (this._getOption('snap') === true)
3318
+ return false;
3319
+ return this._getOption('draggable') === true;
3276
3320
  };
3277
- KTClipboard.prototype._setCopiedClass = function (shouldSet) {
3278
- var copiedClass = this._getCopiedClass();
3279
- if (!copiedClass || !this._element)
3321
+ KTCarousel.prototype._bindControls = function () {
3322
+ var _this = this;
3323
+ if (!this._element)
3280
3324
  return;
3281
- // Keep deterministic behavior: remove any previous state before toggling.
3282
- dom_1.default.removeClass(this._element, copiedClass);
3283
- if (shouldSet) {
3284
- dom_1.default.addClass(this._element, copiedClass);
3325
+ var root = this._element;
3326
+ this._prevButtons = Array.from(root.querySelectorAll(SELECTOR_PREV));
3327
+ this._nextButtons = Array.from(root.querySelectorAll(SELECTOR_NEXT));
3328
+ this._currentLabels = Array.from(root.querySelectorAll(SELECTOR_CURRENT));
3329
+ this._totalLabels = Array.from(root.querySelectorAll(SELECTOR_TOTAL));
3330
+ this._onPrevClick = function (e) {
3331
+ e.preventDefault();
3332
+ _this.prev(true);
3333
+ };
3334
+ this._onNextClick = function (e) {
3335
+ e.preventDefault();
3336
+ _this.next(true);
3337
+ };
3338
+ this._prevButtons.forEach(function (btn) {
3339
+ btn.addEventListener('click', _this._onPrevClick);
3340
+ });
3341
+ this._nextButtons.forEach(function (btn) {
3342
+ btn.addEventListener('click', _this._onNextClick);
3343
+ });
3344
+ this._bindIndexedClickStrips(SELECTOR_PAGINATION, SELECTOR_PAGINATION_ITEM, this._paginationHandlers);
3345
+ this._bindIndexedClickStrips(SELECTOR_THUMBS, SELECTOR_THUMB, this._thumbHandlers);
3346
+ };
3347
+ KTCarousel.prototype._bindIndexedClickStrips = function (stripSelector, itemSelector, handlers) {
3348
+ var _this = this;
3349
+ if (!this._element)
3350
+ return;
3351
+ this._element
3352
+ .querySelectorAll(stripSelector)
3353
+ .forEach(function (strip) {
3354
+ strip.querySelectorAll(itemSelector).forEach(function (item, i) {
3355
+ var fn = function (e) {
3356
+ e.preventDefault();
3357
+ _this.goTo(i, true);
3358
+ };
3359
+ item.addEventListener('click', fn);
3360
+ handlers.push({ el: item, fn: fn });
3361
+ });
3362
+ });
3363
+ };
3364
+ KTCarousel.prototype._bindScrollSync = function () {
3365
+ var _this = this;
3366
+ if (!this._viewport)
3367
+ return;
3368
+ this._onScroll = function () {
3369
+ if (_this._scrollSyncRaf)
3370
+ cancelAnimationFrame(_this._scrollSyncRaf);
3371
+ _this._scrollSyncRaf = requestAnimationFrame(function () {
3372
+ _this._scrollSyncRaf = 0;
3373
+ var prev = _this._index;
3374
+ _this._applyScrollDerivedIndexChange(prev, {
3375
+ dispatch: !_this._programmaticScroll,
3376
+ userInitiated: true,
3377
+ });
3378
+ });
3379
+ };
3380
+ this._viewport.addEventListener('scroll', this._onScroll, {
3381
+ passive: true,
3382
+ });
3383
+ this._onScrollEnd = function () {
3384
+ if (_this._programmaticScroll) {
3385
+ var t = _this._programmaticScrollTargetIndex;
3386
+ if (t !== null && _this._nearestIndex() === t) {
3387
+ queueMicrotask(function () { return _this._completeProgrammaticScroll(); });
3388
+ }
3389
+ return;
3390
+ }
3391
+ var prev = _this._index;
3392
+ _this._applyScrollDerivedIndexChange(prev, {
3393
+ dispatch: true,
3394
+ userInitiated: true,
3395
+ });
3396
+ };
3397
+ this._viewport.addEventListener('scrollend', this._onScrollEnd);
3398
+ };
3399
+ KTCarousel.prototype._bindKeyboard = function () {
3400
+ var _this = this;
3401
+ if (!this._element)
3402
+ return;
3403
+ this._onKeyDown = function (e) {
3404
+ var _a;
3405
+ if (!((_a = _this._element) === null || _a === void 0 ? void 0 : _a.contains(e.target)))
3406
+ return;
3407
+ var t = e.target;
3408
+ if (t &&
3409
+ (t.tagName === 'INPUT' ||
3410
+ t.tagName === 'TEXTAREA' ||
3411
+ t.isContentEditable)) {
3412
+ return;
3413
+ }
3414
+ if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight')
3415
+ return;
3416
+ var rtl = _this._isRtl();
3417
+ var nextKey = rtl ? 'ArrowLeft' : 'ArrowRight';
3418
+ var prevKey = rtl ? 'ArrowRight' : 'ArrowLeft';
3419
+ if (e.key === nextKey) {
3420
+ e.preventDefault();
3421
+ _this.next(true);
3422
+ }
3423
+ else if (e.key === prevKey) {
3424
+ e.preventDefault();
3425
+ _this.prev(true);
3426
+ }
3427
+ };
3428
+ this._element.addEventListener('keydown', this._onKeyDown);
3429
+ };
3430
+ KTCarousel.prototype._bindAutoplayHoverPause = function () {
3431
+ var _this = this;
3432
+ if (!this._element || !this._viewport)
3433
+ return;
3434
+ if (this._getOption('pauseOnHover') !== true)
3435
+ return;
3436
+ this._pauseAutoplay = function () { return _this._stopAutoplay(); };
3437
+ this._resumeAutoplay = function () { return _this._startAutoplay(); };
3438
+ this._element.addEventListener('mouseenter', this._pauseAutoplay);
3439
+ this._element.addEventListener('mouseleave', this._resumeAutoplay);
3440
+ this._element.addEventListener('focusin', this._pauseAutoplay);
3441
+ this._element.addEventListener('focusout', this._resumeAutoplay);
3442
+ };
3443
+ KTCarousel.prototype._bindDraggable = function () {
3444
+ var _this = this;
3445
+ if (!this._viewport || !this._effectiveDraggable())
3446
+ return;
3447
+ this._onPointerDown = function (e) {
3448
+ if (e.pointerType === 'mouse' && e.button !== 0)
3449
+ return;
3450
+ var t = e.target;
3451
+ if (t && t.closest('button,a,input,textarea,select'))
3452
+ return;
3453
+ _this._pointerId = e.pointerId;
3454
+ _this._dragStartX = e.clientX;
3455
+ _this._dragStartScroll = _this._viewport.scrollLeft;
3456
+ _this._dragging = true;
3457
+ _this._dragMoved = false;
3458
+ _this._viewport.setPointerCapture(e.pointerId);
3459
+ };
3460
+ this._onPointerMove = function (e) {
3461
+ if (!_this._dragging || e.pointerId !== _this._pointerId)
3462
+ return;
3463
+ var dx = e.clientX - _this._dragStartX;
3464
+ if (Math.abs(dx) > 5)
3465
+ _this._dragMoved = true;
3466
+ _this._viewport.scrollLeft = _this._dragStartScroll - dx;
3467
+ };
3468
+ this._onPointerUp = function (e) {
3469
+ if (e.pointerId !== _this._pointerId)
3470
+ return;
3471
+ _this._dragging = false;
3472
+ _this._pointerId = null;
3473
+ try {
3474
+ _this._viewport.releasePointerCapture(e.pointerId);
3475
+ }
3476
+ catch (_a) {
3477
+ /* ignore */
3478
+ }
3479
+ };
3480
+ this._viewport.addEventListener('pointerdown', this._onPointerDown);
3481
+ this._viewport.addEventListener('pointermove', this._onPointerMove);
3482
+ this._viewport.addEventListener('pointerup', this._onPointerUp);
3483
+ this._viewport.addEventListener('pointercancel', this._onPointerUp);
3484
+ };
3485
+ KTCarousel.prototype._bindAutoHeight = function () {
3486
+ if (!this._viewport || this._getOption('autoHeight') !== true)
3487
+ return;
3488
+ this._applyAutoHeight();
3489
+ this._observeActiveSlideForHeight();
3490
+ };
3491
+ KTCarousel.prototype._observeActiveSlideForHeight = function () {
3492
+ var _this = this;
3493
+ if (this._getOption('autoHeight') !== true)
3494
+ return;
3495
+ var active = this._slides[this._index];
3496
+ if (!active || typeof ResizeObserver === 'undefined')
3497
+ return;
3498
+ if (!this._resizeObserver) {
3499
+ this._resizeObserver = new ResizeObserver(function () {
3500
+ _this._applyAutoHeight();
3501
+ });
3502
+ }
3503
+ else {
3504
+ this._resizeObserver.disconnect();
3285
3505
  }
3506
+ this._resizeObserver.observe(active);
3286
3507
  };
3287
- KTClipboard.prototype._isInputLike = function (element) {
3288
- return element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';
3508
+ KTCarousel.prototype._applyAutoHeight = function () {
3509
+ if (!this._viewport || this._getOption('autoHeight') !== true)
3510
+ return;
3511
+ var slide = this._slides[this._index];
3512
+ if (!slide)
3513
+ return;
3514
+ var h = slide.offsetHeight;
3515
+ if (h > 0) {
3516
+ this._viewport.style.height = "".concat(h, "px");
3517
+ }
3289
3518
  };
3290
- KTClipboard.prototype._readTargetValue = function (target) {
3291
- var _a, _b;
3292
- if (this._isInputLike(target)) {
3293
- return (_a = target.value) !== null && _a !== void 0 ? _a : '';
3519
+ KTCarousel.prototype._nearestIndex = function () {
3520
+ if (!this._viewport || this._slides.length === 0)
3521
+ return 0;
3522
+ var vp = this._viewport;
3523
+ var origin = vp.scrollLeft;
3524
+ var best = 0;
3525
+ var bestDist = Infinity;
3526
+ for (var i = 0; i < this._slides.length; i++) {
3527
+ var slide = this._slides[i];
3528
+ var dist = Math.abs(slide.offsetLeft - origin);
3529
+ if (dist < bestDist) {
3530
+ bestDist = dist;
3531
+ best = i;
3532
+ }
3294
3533
  }
3295
- return (_b = target.textContent) !== null && _b !== void 0 ? _b : '';
3534
+ return best;
3296
3535
  };
3297
- KTClipboard.prototype._execCommandCopy = function (text) {
3298
- var textarea = document.createElement('textarea');
3299
- textarea.value = text;
3300
- // Avoid scrolling to bottom on iOS/Safari and keep it out of layout.
3301
- textarea.style.position = 'fixed';
3302
- textarea.style.top = '0';
3303
- textarea.style.left = '0';
3304
- textarea.style.opacity = '0';
3305
- textarea.style.pointerEvents = 'none';
3306
- document.body.appendChild(textarea);
3307
- textarea.focus();
3308
- textarea.select();
3309
- // Some browsers require explicit range selection.
3310
- textarea.setSelectionRange(0, textarea.value.length);
3536
+ KTCarousel.prototype._syncIndexFromScroll = function () {
3537
+ if (this._slides.length === 0)
3538
+ return;
3539
+ this._index = this._nearestIndex();
3540
+ };
3541
+ KTCarousel.prototype._applyScrollDerivedIndexChange = function (prevIndex, options) {
3542
+ this._syncIndexFromScroll();
3543
+ if (prevIndex === this._index)
3544
+ return;
3545
+ this._updateInfo();
3546
+ this._updatePaginationState();
3547
+ this._updateThumbState(false);
3548
+ this._applyAutoHeight();
3549
+ this._observeActiveSlideForHeight();
3550
+ if (options.dispatch) {
3551
+ this._dispatchChange(this._index, prevIndex, options.userInitiated);
3552
+ }
3553
+ };
3554
+ KTCarousel.prototype._setStripItemsActiveState = function (handlers, activeDataAttr) {
3555
+ var _this = this;
3556
+ handlers.forEach(function (_a, i) {
3557
+ var el = _a.el;
3558
+ var active = i === _this._index;
3559
+ if (active) {
3560
+ el.setAttribute('aria-current', 'true');
3561
+ }
3562
+ else {
3563
+ el.removeAttribute('aria-current');
3564
+ }
3565
+ el.toggleAttribute(activeDataAttr, active);
3566
+ });
3567
+ };
3568
+ /**
3569
+ * Scroll the viewport only. Avoid `Element.scrollIntoView`, which walks
3570
+ * ancestor scroll containers and can pull the whole docs page to an embedded
3571
+ * carousel (e.g. autoplay ticking on `/docs/carousel`).
3572
+ */
3573
+ KTCarousel.prototype._scrollToIndex = function (index, behavior) {
3574
+ var _this = this;
3575
+ if (!this._viewport)
3576
+ return;
3577
+ var slide = this._slides[index];
3578
+ if (!slide)
3579
+ return;
3580
+ this._programmaticScroll = true;
3581
+ var vp = this._viewport;
3582
+ var centered = this._getOption('centered') === true;
3583
+ var slideRect = slide.getBoundingClientRect();
3584
+ var vpRect = vp.getBoundingClientRect();
3585
+ var left = vp.scrollLeft + slideRect.left - vpRect.left;
3586
+ if (centered) {
3587
+ left -= (vp.clientWidth - slideRect.width) / 2;
3588
+ }
3589
+ var maxScroll = Math.max(0, vp.scrollWidth - vp.clientWidth);
3590
+ left = Math.max(0, Math.min(left, maxScroll));
3311
3591
  try {
3312
- return document.execCommand('copy');
3592
+ vp.scrollTo({ left: left, top: vp.scrollTop, behavior: behavior });
3313
3593
  }
3314
3594
  catch (_a) {
3315
- return false;
3595
+ vp.scrollLeft = left;
3316
3596
  }
3317
- finally {
3318
- textarea.remove();
3319
- }
3320
- };
3321
- KTClipboard.prototype._writeText = function (text) {
3322
- return __awaiter(this, void 0, void 0, function () {
3323
- var clipboard, writeText, ok;
3324
- return __generator(this, function (_a) {
3325
- switch (_a.label) {
3326
- case 0:
3327
- clipboard = typeof navigator !== 'undefined' ? navigator.clipboard : null;
3328
- writeText = clipboard && typeof clipboard.writeText === 'function'
3329
- ? clipboard.writeText.bind(clipboard)
3330
- : null;
3331
- if (!writeText) return [3 /*break*/, 2];
3332
- return [4 /*yield*/, writeText(text)];
3333
- case 1:
3334
- _a.sent();
3335
- return [2 /*return*/, true];
3336
- case 2:
3337
- ok = this._execCommandCopy(text);
3338
- if (!ok) {
3339
- throw new Error('Clipboard copy failed.');
3340
- }
3341
- return [2 /*return*/, true];
3342
- }
3343
- });
3597
+ queueMicrotask(function () {
3598
+ if (_this._programmaticScroll &&
3599
+ _this._programmaticScrollTargetIndex !== null &&
3600
+ _this._nearestIndex() === _this._programmaticScrollTargetIndex) {
3601
+ _this._completeProgrammaticScroll();
3602
+ }
3344
3603
  });
3604
+ this._clearProgrammaticScrollFallbackTimer();
3605
+ var fallbackMs = behavior === 'smooth' ? 550 : 50;
3606
+ this._programmaticScrollFallbackTimer = setTimeout(function () {
3607
+ _this._programmaticScrollFallbackTimer = null;
3608
+ _this._completeProgrammaticScroll();
3609
+ }, fallbackMs);
3345
3610
  };
3346
- KTClipboard.prototype._handleActivate = function (event) {
3347
- return __awaiter(this, void 0, void 0, function () {
3348
- var action, successEventName, errorEventName, textFromConfig, targetSelector, hasPredefinedText, targetElForCut, payload, payload, payload, payload, error_1, payload, payload, targetEl, payload, value, payload, payload, payload, error_2, payload;
3349
- var _a;
3350
- return __generator(this, function (_b) {
3351
- switch (_b.label) {
3352
- case 0:
3353
- event.preventDefault();
3611
+ KTCarousel.prototype._clearProgrammaticScrollFallbackTimer = function () {
3612
+ if (this._programmaticScrollFallbackTimer !== null) {
3613
+ clearTimeout(this._programmaticScrollFallbackTimer);
3614
+ this._programmaticScrollFallbackTimer = null;
3615
+ }
3616
+ };
3617
+ KTCarousel.prototype._completeProgrammaticScroll = function () {
3618
+ if (!this._programmaticScroll)
3619
+ return;
3620
+ var prev = this._programmaticScrollPrevIndex;
3621
+ var targetIdx = this._programmaticScrollTargetIndex;
3622
+ var userInitiated = this._programmaticScrollUserInitiated;
3623
+ if (prev === null || targetIdx === null) {
3624
+ this._programmaticScroll = false;
3625
+ this._programmaticScrollPrevIndex = null;
3626
+ this._programmaticScrollTargetIndex = null;
3627
+ return;
3628
+ }
3629
+ if (this._scrollSyncRaf) {
3630
+ cancelAnimationFrame(this._scrollSyncRaf);
3631
+ this._scrollSyncRaf = 0;
3632
+ }
3633
+ this._clearProgrammaticScrollFallbackTimer();
3634
+ this._programmaticScroll = false;
3635
+ this._programmaticScrollPrevIndex = null;
3636
+ this._programmaticScrollTargetIndex = null;
3637
+ this._programmaticScrollUserInitiated = false;
3638
+ this._index = targetIdx;
3639
+ this._updateInfo();
3640
+ this._updatePaginationState();
3641
+ this._updateThumbState(true);
3642
+ this._applyAutoHeight();
3643
+ this._observeActiveSlideForHeight();
3644
+ this._dispatchChange(targetIdx, prev, userInitiated);
3645
+ };
3646
+ KTCarousel.prototype.goTo = function (index, userInitiated) {
3647
+ if (userInitiated === void 0) { userInitiated = false; }
3648
+ if (this._slides.length === 0)
3649
+ return;
3650
+ var n = this._slides.length;
3651
+ var target = index;
3652
+ if (target < 0)
3653
+ target = 0;
3654
+ if (target >= n)
3655
+ target = n - 1;
3656
+ var prev = this._index;
3657
+ if (target === prev)
3658
+ return;
3659
+ this._clearProgrammaticScrollFallbackTimer();
3660
+ this._programmaticScrollPrevIndex = prev;
3661
+ this._programmaticScrollTargetIndex = target;
3662
+ this._programmaticScrollUserInitiated = userInitiated;
3663
+ this._scrollToIndex(target, this._scrollBehavior());
3664
+ };
3665
+ KTCarousel.prototype.next = function (userInitiated) {
3666
+ if (userInitiated === void 0) { userInitiated = false; }
3667
+ if (this._slides.length === 0)
3668
+ return;
3669
+ var n = this._slides.length;
3670
+ var last = n - 1;
3671
+ var infinite = this._getOption('infiniteLoop') === true;
3672
+ if (this._index >= last) {
3673
+ if (infinite) {
3674
+ this.goTo(0, userInitiated);
3675
+ return;
3676
+ }
3677
+ return;
3678
+ }
3679
+ this.goTo(this._index + 1, userInitiated);
3680
+ };
3681
+ KTCarousel.prototype.prev = function (userInitiated) {
3682
+ if (userInitiated === void 0) { userInitiated = false; }
3683
+ if (this._slides.length === 0)
3684
+ return;
3685
+ var infinite = this._getOption('infiniteLoop') === true;
3686
+ if (this._index <= 0) {
3687
+ if (infinite) {
3688
+ this.goTo(this._slides.length - 1, userInitiated);
3689
+ return;
3690
+ }
3691
+ return;
3692
+ }
3693
+ this.goTo(this._index - 1, userInitiated);
3694
+ };
3695
+ KTCarousel.prototype.getIndex = function () {
3696
+ return this._index;
3697
+ };
3698
+ KTCarousel.prototype.getSlideCount = function () {
3699
+ return this._slides.length;
3700
+ };
3701
+ KTCarousel.prototype._getChangeEventName = function () {
3702
+ var name = this._getOption('changeEvent');
3703
+ return typeof name === 'string' && name.length > 0
3704
+ ? name
3705
+ : 'kt.carousel.change';
3706
+ };
3707
+ KTCarousel.prototype._dispatchChange = function (index, prevIndex, userInitiated) {
3708
+ if (!this._element)
3709
+ return;
3710
+ var payload = {
3711
+ index: index,
3712
+ prevIndex: prevIndex,
3713
+ userInitiated: userInitiated,
3714
+ };
3715
+ var eventName = this._getChangeEventName();
3716
+ this._fireEvent(eventName, payload);
3717
+ this._dispatchEvent(eventName, payload);
3718
+ };
3719
+ KTCarousel.prototype._updateInfo = function () {
3720
+ if (!this._element)
3721
+ return;
3722
+ var total = this._slides.length;
3723
+ var cur = total === 0 ? 0 : this._index + 1;
3724
+ var curStr = String(cur);
3725
+ var totalStr = String(total);
3726
+ this._currentLabels.forEach(function (label) {
3727
+ label.textContent = curStr;
3728
+ });
3729
+ this._totalLabels.forEach(function (label) {
3730
+ label.textContent = totalStr;
3731
+ });
3732
+ };
3733
+ KTCarousel.prototype._updatePaginationState = function () {
3734
+ this._setStripItemsActiveState(this._paginationHandlers, 'data-kt-carousel-pagination-active');
3735
+ };
3736
+ KTCarousel.prototype._updateThumbState = function (alignStripSmooth) {
3737
+ this._setStripItemsActiveState(this._thumbHandlers, 'data-kt-carousel-thumbnail-active');
3738
+ this._scrollActiveThumbnailsIntoView(alignStripSmooth ? this._scrollBehavior() : 'auto');
3739
+ };
3740
+ /**
3741
+ * Keep the active thumb visible inside each thumbnail strip by scrolling
3742
+ * that container only (no `scrollIntoView`, which can scroll ancestor pages).
3743
+ */
3744
+ KTCarousel.prototype._scrollActiveThumbnailsIntoView = function (behavior) {
3745
+ var _this = this;
3746
+ if (!this._element)
3747
+ return;
3748
+ var pad = 6;
3749
+ this._element
3750
+ .querySelectorAll(SELECTOR_THUMBS)
3751
+ .forEach(function (strip) {
3752
+ var items = strip.querySelectorAll(SELECTOR_THUMB);
3753
+ var thumb = items[_this._index];
3754
+ if (!thumb)
3755
+ return;
3756
+ _this._alignElementInScrollContainer(thumb, strip, pad, behavior);
3757
+ });
3758
+ };
3759
+ KTCarousel.prototype._alignElementInScrollContainer = function (el, container, pad, behavior) {
3760
+ var c = container.getBoundingClientRect();
3761
+ var r = el.getBoundingClientRect();
3762
+ var left = container.scrollLeft;
3763
+ var top = container.scrollTop;
3764
+ if (container.scrollWidth > container.clientWidth + 1) {
3765
+ if (r.left < c.left + pad) {
3766
+ left += r.left - c.left - pad;
3767
+ }
3768
+ else if (r.right > c.right - pad) {
3769
+ left += r.right - c.right + pad;
3770
+ }
3771
+ var maxL = Math.max(0, container.scrollWidth - container.clientWidth);
3772
+ left = Math.max(0, Math.min(left, maxL));
3773
+ }
3774
+ if (container.scrollHeight > container.clientHeight + 1) {
3775
+ if (r.top < c.top + pad) {
3776
+ top += r.top - c.top - pad;
3777
+ }
3778
+ else if (r.bottom > c.bottom - pad) {
3779
+ top += r.bottom - c.bottom + pad;
3780
+ }
3781
+ var maxT = Math.max(0, container.scrollHeight - container.clientHeight);
3782
+ top = Math.max(0, Math.min(top, maxT));
3783
+ }
3784
+ try {
3785
+ container.scrollTo({ left: left, top: top, behavior: behavior });
3786
+ }
3787
+ catch (_a) {
3788
+ container.scrollLeft = left;
3789
+ container.scrollTop = top;
3790
+ }
3791
+ };
3792
+ KTCarousel.prototype._startAutoplay = function () {
3793
+ var _this = this;
3794
+ this._stopAutoplay();
3795
+ if (this._getOption('autoplay') !== true)
3796
+ return;
3797
+ if (this._prefersReducedMotion)
3798
+ return;
3799
+ if (this._slides.length <= 1)
3800
+ return;
3801
+ var raw = this._getOption('autoplayInterval');
3802
+ var interval = typeof raw === 'number' && raw >= 200 ? raw : 4000;
3803
+ this._autoplayTimer = setInterval(function () {
3804
+ _this.next(false);
3805
+ }, interval);
3806
+ };
3807
+ KTCarousel.prototype._stopAutoplay = function () {
3808
+ if (this._autoplayTimer !== null) {
3809
+ clearInterval(this._autoplayTimer);
3810
+ this._autoplayTimer = null;
3811
+ }
3812
+ };
3813
+ KTCarousel.prototype.dispose = function () {
3814
+ var _this = this;
3815
+ this._stopAutoplay();
3816
+ this._clearProgrammaticScrollFallbackTimer();
3817
+ if (this._scrollSyncRaf) {
3818
+ cancelAnimationFrame(this._scrollSyncRaf);
3819
+ this._scrollSyncRaf = 0;
3820
+ }
3821
+ this._programmaticScroll = false;
3822
+ this._programmaticScrollPrevIndex = null;
3823
+ this._programmaticScrollTargetIndex = null;
3824
+ if (this._resizeObserver) {
3825
+ this._resizeObserver.disconnect();
3826
+ this._resizeObserver = null;
3827
+ }
3828
+ if (this._element) {
3829
+ if (this._onPrevClick) {
3830
+ this._prevButtons.forEach(function (btn) {
3831
+ return btn.removeEventListener('click', _this._onPrevClick);
3832
+ });
3833
+ }
3834
+ if (this._onNextClick) {
3835
+ this._nextButtons.forEach(function (btn) {
3836
+ return btn.removeEventListener('click', _this._onNextClick);
3837
+ });
3838
+ }
3839
+ this._paginationHandlers.forEach(function (_a) {
3840
+ var el = _a.el, fn = _a.fn;
3841
+ el.removeEventListener('click', fn);
3842
+ });
3843
+ this._paginationHandlers = [];
3844
+ this._thumbHandlers.forEach(function (_a) {
3845
+ var el = _a.el, fn = _a.fn;
3846
+ el.removeEventListener('click', fn);
3847
+ });
3848
+ this._thumbHandlers = [];
3849
+ if (this._onKeyDown) {
3850
+ this._element.removeEventListener('keydown', this._onKeyDown);
3851
+ }
3852
+ if (this._pauseAutoplay && this._resumeAutoplay) {
3853
+ this._element.removeEventListener('mouseenter', this._pauseAutoplay);
3854
+ this._element.removeEventListener('mouseleave', this._resumeAutoplay);
3855
+ this._element.removeEventListener('focusin', this._pauseAutoplay);
3856
+ this._element.removeEventListener('focusout', this._resumeAutoplay);
3857
+ }
3858
+ this._pauseAutoplay = null;
3859
+ this._resumeAutoplay = null;
3860
+ }
3861
+ if (this._viewport && this._onScroll) {
3862
+ this._viewport.removeEventListener('scroll', this._onScroll);
3863
+ }
3864
+ if (this._viewport && this._onScrollEnd) {
3865
+ this._viewport.removeEventListener('scrollend', this._onScrollEnd);
3866
+ }
3867
+ if (this._viewport && this._onPointerDown) {
3868
+ this._viewport.removeEventListener('pointerdown', this._onPointerDown);
3869
+ this._viewport.removeEventListener('pointermove', this._onPointerMove);
3870
+ this._viewport.removeEventListener('pointerup', this._onPointerUp);
3871
+ this._viewport.removeEventListener('pointercancel', this._onPointerUp);
3872
+ }
3873
+ if (this._viewport && this._getOption('autoHeight') === true) {
3874
+ this._viewport.style.height = '';
3875
+ }
3876
+ this._onPrevClick = null;
3877
+ this._onNextClick = null;
3878
+ this._onScroll = null;
3879
+ this._onScrollEnd = null;
3880
+ this._onKeyDown = null;
3881
+ this._onPointerDown = null;
3882
+ this._onPointerMove = null;
3883
+ this._onPointerUp = null;
3884
+ this._prevButtons = [];
3885
+ this._nextButtons = [];
3886
+ this._currentLabels = [];
3887
+ this._totalLabels = [];
3888
+ _super.prototype.dispose.call(this);
3889
+ };
3890
+ KTCarousel.getInstance = function (element) {
3891
+ if (!element)
3892
+ return null;
3893
+ if (data_1.default.has(element, 'carousel')) {
3894
+ return data_1.default.get(element, 'carousel');
3895
+ }
3896
+ return null;
3897
+ };
3898
+ KTCarousel.getOrCreateInstance = function (element, config) {
3899
+ var existing = this.getInstance(element);
3900
+ if (existing)
3901
+ return existing;
3902
+ new KTCarousel(element, config !== null && config !== void 0 ? config : undefined);
3903
+ return this.getInstance(element);
3904
+ };
3905
+ KTCarousel.createInstances = function () {
3906
+ document
3907
+ .querySelectorAll('[data-kt-carousel]')
3908
+ .forEach(function (el) {
3909
+ if (el.getAttribute('data-kt-carousel-lazy') === 'true') {
3910
+ return;
3911
+ }
3912
+ new KTCarousel(el);
3913
+ });
3914
+ };
3915
+ KTCarousel.init = function () {
3916
+ KTCarousel.createInstances();
3917
+ };
3918
+ return KTCarousel;
3919
+ }(component_1.default));
3920
+ exports.KTCarousel = KTCarousel;
3921
+ if (typeof window !== 'undefined') {
3922
+ window.KTCarousel = KTCarousel;
3923
+ }
3924
+
3925
+
3926
+ /***/ }),
3927
+
3928
+ /***/ "./src/components/carousel/index.ts":
3929
+ /*!******************************************!*\
3930
+ !*** ./src/components/carousel/index.ts ***!
3931
+ \******************************************/
3932
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3933
+
3934
+
3935
+ /**
3936
+ * KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
3937
+ * Copyright 2025 by Keenthemes Inc
3938
+ */
3939
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3940
+ exports.KTCarousel = void 0;
3941
+ var carousel_1 = __webpack_require__(/*! ./carousel */ "./src/components/carousel/carousel.ts");
3942
+ Object.defineProperty(exports, "KTCarousel", ({ enumerable: true, get: function () { return carousel_1.KTCarousel; } }));
3943
+
3944
+
3945
+ /***/ }),
3946
+
3947
+ /***/ "./src/components/clipboard/clipboard.ts":
3948
+ /*!***********************************************!*\
3949
+ !*** ./src/components/clipboard/clipboard.ts ***!
3950
+ \***********************************************/
3951
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3952
+
3953
+
3954
+ /**
3955
+ * KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
3956
+ * Copyright 2025 by Keenthemes Inc
3957
+ */
3958
+ var __extends = (this && this.__extends) || (function () {
3959
+ var extendStatics = function (d, b) {
3960
+ extendStatics = Object.setPrototypeOf ||
3961
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3962
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
3963
+ return extendStatics(d, b);
3964
+ };
3965
+ return function (d, b) {
3966
+ if (typeof b !== "function" && b !== null)
3967
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
3968
+ extendStatics(d, b);
3969
+ function __() { this.constructor = d; }
3970
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3971
+ };
3972
+ })();
3973
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3974
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3975
+ return new (P || (P = Promise))(function (resolve, reject) {
3976
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
3977
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
3978
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
3979
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
3980
+ });
3981
+ };
3982
+ var __generator = (this && this.__generator) || function (thisArg, body) {
3983
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
3984
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
3985
+ function verb(n) { return function (v) { return step([n, v]); }; }
3986
+ function step(op) {
3987
+ if (f) throw new TypeError("Generator is already executing.");
3988
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
3989
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
3990
+ if (y = 0, t) op = [op[0] & 2, t.value];
3991
+ switch (op[0]) {
3992
+ case 0: case 1: t = op; break;
3993
+ case 4: _.label++; return { value: op[1], done: false };
3994
+ case 5: _.label++; y = op[1]; op = [0]; continue;
3995
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
3996
+ default:
3997
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
3998
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
3999
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
4000
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
4001
+ if (t[2]) _.ops.pop();
4002
+ _.trys.pop(); continue;
4003
+ }
4004
+ op = body.call(thisArg, _);
4005
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
4006
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4007
+ }
4008
+ };
4009
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4010
+ exports.KTClipboard = void 0;
4011
+ var component_1 = __webpack_require__(/*! ../component */ "./src/components/component.ts");
4012
+ var data_1 = __webpack_require__(/*! ../../helpers/data */ "./src/helpers/data.ts");
4013
+ var dom_1 = __webpack_require__(/*! ../../helpers/dom */ "./src/helpers/dom.ts");
4014
+ var KTClipboard = /** @class */ (function (_super) {
4015
+ __extends(KTClipboard, _super);
4016
+ function KTClipboard(element, config) {
4017
+ if (config === void 0) { config = null; }
4018
+ var _this = _super.call(this) || this;
4019
+ _this._name = 'clipboard';
4020
+ _this._defaultConfig = {
4021
+ target: '',
4022
+ text: '',
4023
+ action: 'copy',
4024
+ copiedClass: '',
4025
+ successEvent: 'kt.clipboard.success',
4026
+ errorEvent: 'kt.clipboard.error',
4027
+ };
4028
+ _this._config = _this
4029
+ ._defaultConfig;
4030
+ _this._activateHandler = null;
4031
+ // Ensure we don't double bind handlers on the same trigger.
4032
+ if (_this._shouldSkipInit(element)) {
4033
+ return _this;
4034
+ }
4035
+ _this._init(element);
4036
+ _this._buildConfig(config);
4037
+ if (!_this._element)
4038
+ return _this;
4039
+ _this._activateHandler = _this._handleActivate.bind(_this);
4040
+ _this._element.addEventListener('click', _this._activateHandler);
4041
+ return _this;
4042
+ }
4043
+ KTClipboard.prototype._getSuccessEventName = function () {
4044
+ var eventName = this._getOption('successEvent');
4045
+ return typeof eventName === 'string' && eventName.length > 0
4046
+ ? eventName
4047
+ : 'kt.clipboard.success';
4048
+ };
4049
+ KTClipboard.prototype._getErrorEventName = function () {
4050
+ var eventName = this._getOption('errorEvent');
4051
+ return typeof eventName === 'string' && eventName.length > 0
4052
+ ? eventName
4053
+ : 'kt.clipboard.error';
4054
+ };
4055
+ KTClipboard.prototype._getAction = function () {
4056
+ var action = this._getOption('action');
4057
+ return action === 'cut' ? 'cut' : 'copy';
4058
+ };
4059
+ KTClipboard.prototype._getTrimmedString = function (optionValue) {
4060
+ return typeof optionValue === 'string' ? optionValue.trim() : '';
4061
+ };
4062
+ KTClipboard.prototype._getPredefinedText = function () {
4063
+ var text = this._getOption('text');
4064
+ return this._getTrimmedString(text);
4065
+ };
4066
+ KTClipboard.prototype._getTargetSelector = function () {
4067
+ var target = this._getOption('target');
4068
+ return this._getTrimmedString(target);
4069
+ };
4070
+ KTClipboard.prototype._getCopiedClass = function () {
4071
+ var copiedClass = this._getOption('copiedClass');
4072
+ return this._getTrimmedString(copiedClass);
4073
+ };
4074
+ KTClipboard.prototype._setCopiedClass = function (shouldSet) {
4075
+ var copiedClass = this._getCopiedClass();
4076
+ if (!copiedClass || !this._element)
4077
+ return;
4078
+ // Keep deterministic behavior: remove any previous state before toggling.
4079
+ dom_1.default.removeClass(this._element, copiedClass);
4080
+ if (shouldSet) {
4081
+ dom_1.default.addClass(this._element, copiedClass);
4082
+ }
4083
+ };
4084
+ KTClipboard.prototype._isInputLike = function (element) {
4085
+ return element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';
4086
+ };
4087
+ KTClipboard.prototype._readTargetValue = function (target) {
4088
+ var _a, _b;
4089
+ if (this._isInputLike(target)) {
4090
+ return (_a = target.value) !== null && _a !== void 0 ? _a : '';
4091
+ }
4092
+ return (_b = target.textContent) !== null && _b !== void 0 ? _b : '';
4093
+ };
4094
+ KTClipboard.prototype._execCommandCopy = function (text) {
4095
+ var textarea = document.createElement('textarea');
4096
+ textarea.value = text;
4097
+ // Avoid scrolling to bottom on iOS/Safari and keep it out of layout.
4098
+ textarea.style.position = 'fixed';
4099
+ textarea.style.top = '0';
4100
+ textarea.style.left = '0';
4101
+ textarea.style.opacity = '0';
4102
+ textarea.style.pointerEvents = 'none';
4103
+ document.body.appendChild(textarea);
4104
+ textarea.focus();
4105
+ textarea.select();
4106
+ // Some browsers require explicit range selection.
4107
+ textarea.setSelectionRange(0, textarea.value.length);
4108
+ try {
4109
+ return document.execCommand('copy');
4110
+ }
4111
+ catch (_a) {
4112
+ return false;
4113
+ }
4114
+ finally {
4115
+ textarea.remove();
4116
+ }
4117
+ };
4118
+ KTClipboard.prototype._writeText = function (text) {
4119
+ return __awaiter(this, void 0, void 0, function () {
4120
+ var clipboard, writeText, ok;
4121
+ return __generator(this, function (_a) {
4122
+ switch (_a.label) {
4123
+ case 0:
4124
+ clipboard = typeof navigator !== 'undefined' ? navigator.clipboard : null;
4125
+ writeText = clipboard && typeof clipboard.writeText === 'function'
4126
+ ? clipboard.writeText.bind(clipboard)
4127
+ : null;
4128
+ if (!writeText) return [3 /*break*/, 2];
4129
+ return [4 /*yield*/, writeText(text)];
4130
+ case 1:
4131
+ _a.sent();
4132
+ return [2 /*return*/, true];
4133
+ case 2:
4134
+ ok = this._execCommandCopy(text);
4135
+ if (!ok) {
4136
+ throw new Error('Clipboard copy failed.');
4137
+ }
4138
+ return [2 /*return*/, true];
4139
+ }
4140
+ });
4141
+ });
4142
+ };
4143
+ KTClipboard.prototype._handleActivate = function (event) {
4144
+ return __awaiter(this, void 0, void 0, function () {
4145
+ var action, successEventName, errorEventName, textFromConfig, targetSelector, hasPredefinedText, targetElForCut, payload, payload, payload, payload, error_1, payload, payload, targetEl, payload, value, payload, payload, payload, error_2, payload;
4146
+ var _a;
4147
+ return __generator(this, function (_b) {
4148
+ switch (_b.label) {
4149
+ case 0:
4150
+ event.preventDefault();
3354
4151
  action = this._getAction();
3355
4152
  successEventName = this._getSuccessEventName();
3356
4153
  errorEventName = this._getErrorEventName();
@@ -3839,6 +4636,7 @@ var utils_1 = __webpack_require__(/*! ../helpers/utils */ "./src/helpers/utils.t
3839
4636
  var KTComponent = /** @class */ (function () {
3840
4637
  function KTComponent() {
3841
4638
  this._dataOptionPrefix = 'kt-';
4639
+ this._events = new Map();
3842
4640
  this._uid = null;
3843
4641
  this._element = null;
3844
4642
  }
@@ -3914,6 +4712,9 @@ var KTComponent = /** @class */ (function () {
3914
4712
  };
3915
4713
  KTComponent.prototype._getOption = function (name) {
3916
4714
  var value = this._config[name];
4715
+ if (!this._element) {
4716
+ return value;
4717
+ }
3917
4718
  var reponsiveValue = dom_1.default.getCssProp(this._element, "--kt-".concat(this._name, "-").concat(utils_1.default.camelReverseCase(name)));
3918
4719
  return reponsiveValue || value;
3919
4720
  };
@@ -3954,7 +4755,11 @@ var KTComponent = /** @class */ (function () {
3954
4755
  if (!this._events.get(eventType)) {
3955
4756
  this._events.set(eventType, new Map());
3956
4757
  }
3957
- this._events.get(eventType).set(eventId, callback);
4758
+ var eventMap = this._events.get(eventType);
4759
+ if (!eventMap) {
4760
+ return eventId;
4761
+ }
4762
+ eventMap.set(eventId, callback);
3958
4763
  return eventId;
3959
4764
  };
3960
4765
  KTComponent.prototype.off = function (eventType, eventId) {
@@ -4081,7 +4886,7 @@ function createCheckboxHandler(element, config, fireEvent) {
4081
4886
  fireEvent('changed');
4082
4887
  }
4083
4888
  // When the header checkbox is toggled
4084
- function checkboxToggle(event) {
4889
+ function checkboxToggle(_event) {
4085
4890
  var checked = !isChecked();
4086
4891
  // Update state first, then fire events
4087
4892
  change(checked);
@@ -4533,7 +5338,7 @@ var KTDataTable = /** @class */ (function (_super) {
4533
5338
  _this._init(element);
4534
5339
  _this._buildConfig();
4535
5340
  // Store the instance directly on the element
4536
- element.instance = _this;
5341
+ KTDataTable.asElementWithInstance(element).instance = _this;
4537
5342
  _this._initElements();
4538
5343
  // Initialize checkbox handler
4539
5344
  _this._checkbox = (0, datatable_checkbox_1.createCheckboxHandler)(_this._element, _this._config, function (eventName, eventData) {
@@ -4560,6 +5365,12 @@ var KTDataTable = /** @class */ (function (_super) {
4560
5365
  _this._dispatchEvent('init');
4561
5366
  return _this;
4562
5367
  }
5368
+ KTDataTable.asElementWithInstance = function (element) {
5369
+ return element;
5370
+ };
5371
+ KTDataTable.asSearchElementWithDebounce = function (element) {
5372
+ return element;
5373
+ };
4563
5374
  /**
4564
5375
  * Initialize default configuration for the datatable
4565
5376
  * @param config User-provided configuration options
@@ -4700,7 +5511,7 @@ var KTDataTable = /** @class */ (function (_super) {
4700
5511
  return false;
4701
5512
  }
4702
5513
  var valueText = String(value)
4703
- .replace(/<[^>]*>|&nbsp;/g, '')
5514
+ .replace(/<|>|&nbsp;/g, '')
4704
5515
  .toLowerCase();
4705
5516
  return valueText.includes(search.toLowerCase());
4706
5517
  });
@@ -4906,16 +5717,17 @@ var KTDataTable = /** @class */ (function (_super) {
4906
5717
  }
4907
5718
  if (searchElement) {
4908
5719
  // Check if a debounced search function already exists
4909
- if (searchElement._debouncedSearch) {
5720
+ var searchWithDebounce = KTDataTable.asSearchElementWithDebounce(searchElement);
5721
+ if (searchWithDebounce._debouncedSearch) {
4910
5722
  // Remove the existing debounced event listener
4911
- searchElement.removeEventListener('keyup', searchElement._debouncedSearch);
5723
+ searchElement.removeEventListener('keyup', searchWithDebounce._debouncedSearch);
4912
5724
  }
4913
5725
  // Create a new debounced search function
4914
5726
  var debouncedSearch = this._debounce(function () {
4915
5727
  _this.search(searchElement.value);
4916
5728
  }, this._config.search.delay);
4917
5729
  // Store the new debounced function as a property of the element
4918
- searchElement._debouncedSearch = debouncedSearch;
5730
+ searchWithDebounce._debouncedSearch = debouncedSearch;
4919
5731
  // Add the new debounced event listener
4920
5732
  searchElement.addEventListener('keyup', debouncedSearch);
4921
5733
  }
@@ -4927,7 +5739,7 @@ var KTDataTable = /** @class */ (function (_super) {
4927
5739
  */
4928
5740
  KTDataTable.prototype._fetchDataFromLocal = function () {
4929
5741
  return __awaiter(this, void 0, void 0, function () {
4930
- var _a, sortField, sortOrder, page, pageSize, search, originalData, _b, originalData_1, originalDataAttributes, _temp, startIndex, endIndex;
5742
+ var _a, sortField, sortOrder, page, pageSize, search, originalData, _b, originalData_1, originalDataAttributes, _temp, searchTerm, startIndex, endIndex;
4931
5743
  var _c;
4932
5744
  return __generator(this, function (_d) {
4933
5745
  switch (_d.label) {
@@ -4951,7 +5763,8 @@ var KTDataTable = /** @class */ (function (_super) {
4951
5763
  originalData = this.getState().originalData;
4952
5764
  _temp = (this._data = __spreadArray([], originalData, true));
4953
5765
  if (search) {
4954
- _temp = this._data = this._config.search.callback.call(this, this._data, search);
5766
+ searchTerm = typeof search === 'string' ? search : '';
5767
+ _temp = this._data = this._config.search.callback.call(this, this._data, searchTerm);
4955
5768
  }
4956
5769
  // If sorting is defined, sort the data
4957
5770
  if (sortField !== undefined &&
@@ -4998,7 +5811,7 @@ var KTDataTable = /** @class */ (function (_super) {
4998
5811
  };
4999
5812
  KTDataTable.prototype._tableConfigInvalidate = function () {
5000
5813
  // Remove _data and _state from config
5001
- var _a = this._config, _data = _a._data, _state = _a._state, restConfig = __rest(_a, ["_data", "_state"]);
5814
+ var _a = this._config, _state = _a._state, restConfig = __rest(_a, ["_state"]);
5002
5815
  var checksum = utils_1.default.checksum(JSON.stringify(restConfig));
5003
5816
  if (_state._configChecksum !== checksum) {
5004
5817
  this._config._state._configChecksum = checksum;
@@ -5719,9 +6532,13 @@ var KTDataTable = /** @class */ (function (_super) {
5719
6532
  // --- 1. Remove search input event listener (debounced) ---
5720
6533
  var tableId = this._tableId();
5721
6534
  var searchElement = document.querySelector("[data-kt-datatable-search=\"#".concat(tableId, "\"]"));
5722
- if (searchElement && searchElement._debouncedSearch) {
5723
- searchElement.removeEventListener('keyup', searchElement._debouncedSearch);
5724
- delete searchElement._debouncedSearch;
6535
+ if (searchElement) {
6536
+ var searchWithDebounce = KTDataTable.asSearchElementWithDebounce(searchElement);
6537
+ if (!searchWithDebounce._debouncedSearch) {
6538
+ return;
6539
+ }
6540
+ searchElement.removeEventListener('keyup', searchWithDebounce._debouncedSearch);
6541
+ delete searchWithDebounce._debouncedSearch;
5725
6542
  }
5726
6543
  // --- 2. Remove page size dropdown event listener ---
5727
6544
  if (this._sizeElement && this._sizeElement.onchange) {
@@ -5736,9 +6553,9 @@ var KTDataTable = /** @class */ (function (_super) {
5736
6553
  }
5737
6554
  // --- 4. Dispose of handler objects (checkbox, sort) ---
5738
6555
  // KTDataTableCheckboxAPI does not have a dispose method, but we can remove header checkbox listener
5739
- if (this._checkbox &&
5740
- typeof this._checkbox.dispose === 'function') {
5741
- this._checkbox.dispose();
6556
+ var checkboxWithDispose = this._checkbox;
6557
+ if (this._checkbox && typeof checkboxWithDispose.dispose === 'function') {
6558
+ checkboxWithDispose.dispose();
5742
6559
  }
5743
6560
  else {
5744
6561
  // Remove header checkbox event listener if possible
@@ -5761,8 +6578,9 @@ var KTDataTable = /** @class */ (function (_super) {
5761
6578
  }
5762
6579
  this._element.classList.remove(this._config.loadingClass);
5763
6580
  // --- 6. Remove instance reference from the DOM element ---
5764
- if (this._element.instance) {
5765
- delete this._element.instance;
6581
+ var elementWithInstance = KTDataTable.asElementWithInstance(this._element);
6582
+ if (elementWithInstance.instance) {
6583
+ delete elementWithInstance.instance;
5766
6584
  }
5767
6585
  // --- 7. (Optional) Clear localStorage state ---
5768
6586
  // Uncomment the following line if you want to clear state on dispose:
@@ -5936,7 +6754,7 @@ var KTDataTable = /** @class */ (function (_super) {
5936
6754
  return instanceFromMap;
5937
6755
  }
5938
6756
  // Fallback to element's instance property (for manually created instances)
5939
- return element.instance;
6757
+ return KTDataTable.asElementWithInstance(element).instance;
5940
6758
  };
5941
6759
  /**
5942
6760
  * Initializes all KTDataTable instances on the page.
@@ -6648,8 +7466,6 @@ var KTDrawer = /** @class */ (function (_super) {
6648
7466
  if (!drawerElement) {
6649
7467
  // If element is a toggle button and drawer element wasn't found, return null
6650
7468
  // The handleToggle() will handle waiting for the element to appear
6651
- if (element.hasAttribute('data-kt-drawer-toggle')) {
6652
- }
6653
7469
  return null;
6654
7470
  }
6655
7471
  if (data_1.default.has(drawerElement, 'drawer')) {
@@ -6674,8 +7490,7 @@ var KTDrawer = /** @class */ (function (_super) {
6674
7490
  };
6675
7491
  KTDrawer.handleResize = function () {
6676
7492
  window.addEventListener('resize', function () {
6677
- var timer;
6678
- utils_1.default.throttle(timer, function () {
7493
+ utils_1.default.throttle(undefined, function () {
6679
7494
  document
6680
7495
  .querySelectorAll('[data-kt-drawer-initialized]')
6681
7496
  .forEach(function (element) {
@@ -6692,11 +7507,9 @@ var KTDrawer = /** @class */ (function (_super) {
6692
7507
  // Add raw click listener to document.body to track all clicks
6693
7508
  document.body.addEventListener('click', function (rawEvent) {
6694
7509
  var target = rawEvent.target;
6695
- if (target && target.hasAttribute('data-kt-drawer-toggle')) {
6696
- }
7510
+ void (target && target.hasAttribute('data-kt-drawer-toggle'));
6697
7511
  }, true); // Use capture phase to catch before any stopPropagation
6698
7512
  event_handler_1.default.on(document.body, '[data-kt-drawer-toggle]', 'click', function (event, target) {
6699
- var _a;
6700
7513
  event.stopPropagation();
6701
7514
  var selector = target.getAttribute('data-kt-drawer-toggle');
6702
7515
  if (!selector)
@@ -6707,13 +7520,6 @@ var KTDrawer = /** @class */ (function (_super) {
6707
7520
  drawer.toggle(target);
6708
7521
  }
6709
7522
  else {
6710
- // Drawer element not found - wait for it to appear (handles persisted Livewire components)
6711
- // Check if drawer exists in persisted components (might be in header that's persisted)
6712
- var persistedHeader = ((_a = document.querySelector('[wire\\:id]')) === null || _a === void 0 ? void 0 : _a.closest('[wire\\:id]')) ||
6713
- document.querySelector('header#header');
6714
- var drawerInPersisted = persistedHeader
6715
- ? persistedHeader.querySelector(selector)
6716
- : null;
6717
7523
  // Wait longer for persisted components that may take time to render
6718
7524
  // Also check if drawer exists in persisted header component
6719
7525
  KTDrawer.waitForElement(selector, 5000).then(function (drawerElement) {
@@ -6842,12 +7648,11 @@ var KTDrawer = /** @class */ (function (_super) {
6842
7648
  instance.hide(); // This will clean up backdrop and state
6843
7649
  }
6844
7650
  // Clear KTData entries
6845
- var hadDrawer = data_1.default.has(element, 'drawer');
6846
7651
  data_1.default.remove(element, 'drawer');
6847
7652
  // Remove initialization attribute to allow fresh initialization
6848
7653
  element.removeAttribute('data-kt-drawer-initialized');
6849
7654
  }
6850
- catch (e) {
7655
+ catch (_a) {
6851
7656
  // Ignore errors for individual elements
6852
7657
  }
6853
7658
  });
@@ -7002,7 +7807,7 @@ var KTDropdown = /** @class */ (function (_super) {
7002
7807
  }
7003
7808
  this._toggle();
7004
7809
  };
7005
- KTDropdown.prototype._mouseover = function (event) {
7810
+ KTDropdown.prototype._mouseover = function (_event) {
7006
7811
  if (this._disabled)
7007
7812
  return;
7008
7813
  if (this._getOption('trigger') !== 'hover')
@@ -7106,7 +7911,6 @@ var KTDropdown = /** @class */ (function (_super) {
7106
7911
  });
7107
7912
  };
7108
7913
  KTDropdown.prototype._initPopper = function () {
7109
- var isRtl = dom_1.default.isRTL();
7110
7914
  var reference;
7111
7915
  var attach = this._getOption('attach');
7112
7916
  if (attach) {
@@ -7301,108 +8105,337 @@ var KTDropdown = /** @class */ (function (_super) {
7301
8105
  !(event.ctrlKey || event.altKey || event.shiftKey)) {
7302
8106
  dropdown.hide();
7303
8107
  }
7304
- });
7305
- };
7306
- KTDropdown.handleMouseover = function () {
7307
- event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle], [data-kt-dropdown-menu]', 'mouseover', function (event, target) {
7308
- var dropdown = KTDropdown.getInstance(target);
7309
- if (dropdown && dropdown._getOption('trigger') === 'hover') {
7310
- dropdown.mouseover(event);
8108
+ });
8109
+ };
8110
+ KTDropdown.handleMouseover = function () {
8111
+ event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle], [data-kt-dropdown-menu]', 'mouseover', function (event, target) {
8112
+ var dropdown = KTDropdown.getInstance(target);
8113
+ if (dropdown && dropdown._getOption('trigger') === 'hover') {
8114
+ dropdown.mouseover(event);
8115
+ }
8116
+ });
8117
+ };
8118
+ KTDropdown.handleMouseout = function () {
8119
+ event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle], [data-kt-dropdown-menu]', 'mouseout', function (event, target) {
8120
+ var dropdown = KTDropdown.getInstance(target);
8121
+ if (dropdown && dropdown._getOption('trigger') === 'hover') {
8122
+ dropdown.mouseout(event);
8123
+ }
8124
+ });
8125
+ };
8126
+ KTDropdown.handleClick = function () {
8127
+ event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle]', 'click', function (event, target) {
8128
+ var dropdown = KTDropdown.getInstance(target);
8129
+ if (dropdown) {
8130
+ dropdown.click(event);
8131
+ }
8132
+ });
8133
+ };
8134
+ KTDropdown.handleDismiss = function () {
8135
+ event_handler_1.default.on(document.body, '[data-kt-dropdown-dismiss]', 'click', function (event, target) {
8136
+ var dropdown = KTDropdown.getInstance(target);
8137
+ if (dropdown) {
8138
+ dropdown.hide();
8139
+ }
8140
+ });
8141
+ };
8142
+ KTDropdown.initHandlers = function () {
8143
+ this.handleClickAway();
8144
+ this.handleKeyboard();
8145
+ this.handleMouseover();
8146
+ this.handleMouseout();
8147
+ this.handleClick();
8148
+ this.handleDismiss();
8149
+ };
8150
+ KTDropdown.createInstances = function () {
8151
+ var elements = document.querySelectorAll('[data-kt-dropdown]');
8152
+ elements.forEach(function (element) {
8153
+ new KTDropdown(element);
8154
+ });
8155
+ };
8156
+ KTDropdown.init = function () {
8157
+ KTDropdown.createInstances();
8158
+ if (window.KT_DROPDOWN_INITIALIZED !== true) {
8159
+ KTDropdown.initHandlers();
8160
+ window.KT_DROPDOWN_INITIALIZED = true;
8161
+ }
8162
+ };
8163
+ /**
8164
+ * Force reinitialization of dropdowns by clearing KTData entries.
8165
+ * Useful for Livewire wire:navigate where persisted elements need reinitialization.
8166
+ */
8167
+ KTDropdown.reinit = function () {
8168
+ var elements = document.querySelectorAll('[data-kt-dropdown]');
8169
+ elements.forEach(function (element) {
8170
+ try {
8171
+ // Get existing instance to clean up Popper
8172
+ var instance = KTDropdown.getInstance(element);
8173
+ if (instance && typeof instance.hide === 'function') {
8174
+ instance.hide(); // This will destroy Popper
8175
+ }
8176
+ // Clear KTData entries
8177
+ data_1.default.remove(element, 'dropdown');
8178
+ data_1.default.remove(element, 'popper');
8179
+ // Remove initialization attribute to allow fresh initialization
8180
+ element.removeAttribute('data-kt-dropdown-initialized');
8181
+ var menu = element.querySelector('[data-kt-dropdown-menu]');
8182
+ if (menu) {
8183
+ data_1.default.remove(menu, 'dropdownElement');
8184
+ }
8185
+ }
8186
+ catch (_a) {
8187
+ // Ignore errors for individual elements
8188
+ }
8189
+ });
8190
+ // Now create fresh instances
8191
+ KTDropdown.createInstances();
8192
+ // Always ensure handlers are set up (similar to KTMenu.init() behavior)
8193
+ // Event handlers use delegation so they persist, but we ensure they're attached
8194
+ KTDropdown.initHandlers();
8195
+ };
8196
+ return KTDropdown;
8197
+ }(component_1.default));
8198
+ exports.KTDropdown = KTDropdown;
8199
+ if (typeof window !== 'undefined') {
8200
+ window.KTDropdown = KTDropdown;
8201
+ }
8202
+
8203
+
8204
+ /***/ }),
8205
+
8206
+ /***/ "./src/components/dropdown/index.ts":
8207
+ /*!******************************************!*\
8208
+ !*** ./src/components/dropdown/index.ts ***!
8209
+ \******************************************/
8210
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
8211
+
8212
+
8213
+ /**
8214
+ * KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
8215
+ * Copyright 2025 by Keenthemes Inc
8216
+ */
8217
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
8218
+ exports.KTDropdown = void 0;
8219
+ var dropdown_1 = __webpack_require__(/*! ./dropdown */ "./src/components/dropdown/dropdown.ts");
8220
+ Object.defineProperty(exports, "KTDropdown", ({ enumerable: true, get: function () { return dropdown_1.KTDropdown; } }));
8221
+
8222
+
8223
+ /***/ }),
8224
+
8225
+ /***/ "./src/components/image-input/image-input.ts":
8226
+ /*!***************************************************!*\
8227
+ !*** ./src/components/image-input/image-input.ts ***!
8228
+ \***************************************************/
8229
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
8230
+
8231
+
8232
+ /**
8233
+ * KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
8234
+ * Copyright 2025 by Keenthemes Inc
8235
+ */
8236
+ var __extends = (this && this.__extends) || (function () {
8237
+ var extendStatics = function (d, b) {
8238
+ extendStatics = Object.setPrototypeOf ||
8239
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8240
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8241
+ return extendStatics(d, b);
8242
+ };
8243
+ return function (d, b) {
8244
+ if (typeof b !== "function" && b !== null)
8245
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
8246
+ extendStatics(d, b);
8247
+ function __() { this.constructor = d; }
8248
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8249
+ };
8250
+ })();
8251
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
8252
+ exports.KTImageInput = void 0;
8253
+ var data_1 = __webpack_require__(/*! ../../helpers/data */ "./src/helpers/data.ts");
8254
+ var event_handler_1 = __webpack_require__(/*! ../../helpers/event-handler */ "./src/helpers/event-handler.ts");
8255
+ var component_1 = __webpack_require__(/*! ../component */ "./src/components/component.ts");
8256
+ var KTImageInput = /** @class */ (function (_super) {
8257
+ __extends(KTImageInput, _super);
8258
+ function KTImageInput(element, config) {
8259
+ var _this = _super.call(this) || this;
8260
+ _this._name = 'image-input';
8261
+ _this._defaultConfig = {
8262
+ hiddenClass: 'hidden',
8263
+ };
8264
+ _this._previewUrl = '';
8265
+ _this._selectedFile = null;
8266
+ if (data_1.default.has(element, _this._name))
8267
+ return _this;
8268
+ _this._init(element);
8269
+ _this._buildConfig(config);
8270
+ _this._inputElement = _this._element.querySelector('input[type="file"]');
8271
+ _this._hiddenElement = _this._element.querySelector('input[type="hidden"]');
8272
+ _this._removeElement = _this._element.querySelector('[data-kt-image-input-remove]');
8273
+ _this._previewElement = _this._element.querySelector('[data-kt-image-input-preview]');
8274
+ _this._update();
8275
+ _this._handlers();
8276
+ return _this;
8277
+ }
8278
+ KTImageInput.prototype._handlers = function () {
8279
+ var _this = this;
8280
+ event_handler_1.default.on(this._element, '[data-kt-image-input-placeholder]', 'click', function (event) {
8281
+ event.preventDefault();
8282
+ _this._inputElement.click();
8283
+ });
8284
+ this._inputElement.addEventListener('change', function () {
8285
+ _this._change();
8286
+ });
8287
+ this._removeElement.addEventListener('click', function () {
8288
+ _this._remove();
8289
+ });
8290
+ };
8291
+ KTImageInput.prototype._change = function () {
8292
+ var _this = this;
8293
+ var payload = { cancel: false };
8294
+ this._fireEvent('change', payload);
8295
+ this._dispatchEvent('change', payload);
8296
+ if (payload.cancel === true) {
8297
+ return;
8298
+ }
8299
+ var reader = new FileReader();
8300
+ reader.onload = function () {
8301
+ _this._previewElement.style.backgroundImage = "url(".concat(reader.result, ")");
8302
+ };
8303
+ reader.readAsDataURL(this._inputElement.files[0]);
8304
+ this._selectedFile = this._inputElement.files[0];
8305
+ this._lastMode = 'new';
8306
+ this._element.classList.add('changed');
8307
+ this._removeElement.classList.remove('hidden');
8308
+ this._element.classList.remove('empty');
8309
+ this._fireEvent('changed');
8310
+ this._dispatchEvent('changed');
8311
+ };
8312
+ KTImageInput.prototype._remove = function () {
8313
+ var payload = { cancel: false };
8314
+ this._fireEvent('remove', payload);
8315
+ this._dispatchEvent('remove', payload);
8316
+ if (payload.cancel === true) {
8317
+ return;
8318
+ }
8319
+ this._element.classList.remove('empty');
8320
+ this._element.classList.remove('changed');
8321
+ if (this._lastMode == 'new') {
8322
+ if (this._previewUrl == '')
8323
+ this._removeElement.classList.add(this._getOption('hiddenClass'));
8324
+ if (this._previewUrl) {
8325
+ this._previewElement.style.backgroundImage = "url(".concat(this._previewUrl, ")");
8326
+ }
8327
+ else {
8328
+ this._previewElement.style.backgroundImage = 'none';
8329
+ this._element.classList.add('empty');
8330
+ }
8331
+ this._inputElement.value = '';
8332
+ this._hiddenElement.value = '';
8333
+ this._selectedFile = null;
8334
+ this._lastMode = 'saved';
8335
+ }
8336
+ else if (this._lastMode == 'saved') {
8337
+ if (this._previewUrl == '')
8338
+ this._removeElement.classList.add(this._getOption('hiddenClass'));
8339
+ this._previewElement.style.backgroundImage = 'none';
8340
+ this._element.classList.add('empty');
8341
+ this._hiddenElement.value = '1';
8342
+ this._inputElement.value = '';
8343
+ this._selectedFile = null;
8344
+ this._lastMode = 'placeholder';
8345
+ }
8346
+ else if (this._lastMode == 'placeholder') {
8347
+ if (this._previewUrl == '')
8348
+ this._removeElement.classList.add(this._getOption('hiddenClass'));
8349
+ if (this._previewUrl) {
8350
+ this._previewElement.style.backgroundImage = "url(".concat(this._previewUrl, ")");
8351
+ }
8352
+ else {
8353
+ this._element.classList.add('empty');
7311
8354
  }
7312
- });
8355
+ this._inputElement.value = '';
8356
+ this._hiddenElement.value = '';
8357
+ this._selectedFile = null;
8358
+ this._lastMode = 'saved';
8359
+ }
8360
+ this._fireEvent('remove');
8361
+ this._dispatchEvent('remove');
7313
8362
  };
7314
- KTDropdown.handleMouseout = function () {
7315
- event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle], [data-kt-dropdown-menu]', 'mouseout', function (event, target) {
7316
- var dropdown = KTDropdown.getInstance(target);
7317
- if (dropdown && dropdown._getOption('trigger') === 'hover') {
7318
- dropdown.mouseout(event);
7319
- }
7320
- });
8363
+ KTImageInput.prototype._update = function () {
8364
+ if (this._previewElement.style.backgroundImage) {
8365
+ this._setPreviewUrl(this._previewElement.style.backgroundImage);
8366
+ this._removeElement.classList.remove(this._getOption('hiddenClass'));
8367
+ this._lastMode = 'saved';
8368
+ }
8369
+ else {
8370
+ this._removeElement.classList.add(this._getOption('hiddenClass'));
8371
+ this._element.classList.add('empty');
8372
+ this._lastMode = 'placeholder';
8373
+ }
7321
8374
  };
7322
- KTDropdown.handleClick = function () {
7323
- event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle]', 'click', function (event, target) {
7324
- var dropdown = KTDropdown.getInstance(target);
7325
- if (dropdown) {
7326
- dropdown.click(event);
7327
- }
7328
- });
8375
+ KTImageInput.prototype._getPreviewUrl = function () {
8376
+ return this._previewUrl;
7329
8377
  };
7330
- KTDropdown.handleDismiss = function () {
7331
- event_handler_1.default.on(document.body, '[data-kt-dropdown-dismiss]', 'click', function (event, target) {
7332
- var dropdown = KTDropdown.getInstance(target);
7333
- if (dropdown) {
7334
- dropdown.hide();
7335
- }
7336
- });
8378
+ KTImageInput.prototype._setPreviewUrl = function (url) {
8379
+ this._previewUrl = url.replace(/(url\(|\)|")/g, '');
7337
8380
  };
7338
- KTDropdown.initHandlers = function () {
7339
- this.handleClickAway();
7340
- this.handleKeyboard();
7341
- this.handleMouseover();
7342
- this.handleMouseout();
7343
- this.handleClick();
7344
- this.handleDismiss();
8381
+ KTImageInput.prototype.isEmpty = function () {
8382
+ return this._selectedFile === null;
7345
8383
  };
7346
- KTDropdown.createInstances = function () {
7347
- var elements = document.querySelectorAll('[data-kt-dropdown]');
7348
- elements.forEach(function (element) {
7349
- new KTDropdown(element);
7350
- });
8384
+ KTImageInput.prototype.isChanged = function () {
8385
+ return this._selectedFile !== null;
7351
8386
  };
7352
- KTDropdown.init = function () {
7353
- KTDropdown.createInstances();
7354
- if (window.KT_DROPDOWN_INITIALIZED !== true) {
7355
- KTDropdown.initHandlers();
7356
- window.KT_DROPDOWN_INITIALIZED = true;
8387
+ KTImageInput.prototype.remove = function () {
8388
+ this._remove();
8389
+ };
8390
+ KTImageInput.prototype.update = function () {
8391
+ this._update();
8392
+ };
8393
+ KTImageInput.prototype.setPreviewUrl = function (url) {
8394
+ this._setPreviewUrl(url);
8395
+ };
8396
+ KTImageInput.prototype.getPreviewUrl = function () {
8397
+ return this._getPreviewUrl();
8398
+ };
8399
+ KTImageInput.prototype.getSelectedFile = function () {
8400
+ return this._selectedFile;
8401
+ };
8402
+ KTImageInput.getInstance = function (element) {
8403
+ if (!element)
8404
+ return null;
8405
+ if (data_1.default.has(element, 'image-input')) {
8406
+ return data_1.default.get(element, 'image-input');
8407
+ }
8408
+ if (element.getAttribute('data-kt-image-input')) {
8409
+ return new KTImageInput(element);
7357
8410
  }
8411
+ return null;
7358
8412
  };
7359
- /**
7360
- * Force reinitialization of dropdowns by clearing KTData entries.
7361
- * Useful for Livewire wire:navigate where persisted elements need reinitialization.
7362
- */
7363
- KTDropdown.reinit = function () {
7364
- var elements = document.querySelectorAll('[data-kt-dropdown]');
8413
+ KTImageInput.getOrCreateInstance = function (element, config) {
8414
+ return this.getInstance(element) || new KTImageInput(element, config);
8415
+ };
8416
+ KTImageInput.createInstances = function () {
8417
+ var elements = document.querySelectorAll('[data-kt-image-input]');
7365
8418
  elements.forEach(function (element) {
7366
- try {
7367
- // Get existing instance to clean up Popper
7368
- var instance = KTDropdown.getInstance(element);
7369
- if (instance && typeof instance.hide === 'function') {
7370
- instance.hide(); // This will destroy Popper
7371
- }
7372
- // Clear KTData entries
7373
- data_1.default.remove(element, 'dropdown');
7374
- data_1.default.remove(element, 'popper');
7375
- // Remove initialization attribute to allow fresh initialization
7376
- element.removeAttribute('data-kt-dropdown-initialized');
7377
- var menu = element.querySelector('[data-kt-dropdown-menu]');
7378
- if (menu) {
7379
- data_1.default.remove(menu, 'dropdownElement');
7380
- }
7381
- }
7382
- catch (e) {
7383
- // Ignore errors for individual elements
7384
- }
8419
+ new KTImageInput(element);
7385
8420
  });
7386
- // Now create fresh instances
7387
- KTDropdown.createInstances();
7388
- // Always ensure handlers are set up (similar to KTMenu.init() behavior)
7389
- // Event handlers use delegation so they persist, but we ensure they're attached
7390
- KTDropdown.initHandlers();
7391
8421
  };
7392
- return KTDropdown;
8422
+ KTImageInput.init = function () {
8423
+ KTImageInput.createInstances();
8424
+ };
8425
+ return KTImageInput;
7393
8426
  }(component_1.default));
7394
- exports.KTDropdown = KTDropdown;
8427
+ exports.KTImageInput = KTImageInput;
7395
8428
  if (typeof window !== 'undefined') {
7396
- window.KTDropdown = KTDropdown;
8429
+ window.KTImageInput = KTImageInput;
7397
8430
  }
7398
8431
 
7399
8432
 
7400
8433
  /***/ }),
7401
8434
 
7402
- /***/ "./src/components/dropdown/index.ts":
7403
- /*!******************************************!*\
7404
- !*** ./src/components/dropdown/index.ts ***!
7405
- \******************************************/
8435
+ /***/ "./src/components/image-input/index.ts":
8436
+ /*!*********************************************!*\
8437
+ !*** ./src/components/image-input/index.ts ***!
8438
+ \*********************************************/
7406
8439
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7407
8440
 
7408
8441
 
@@ -7411,17 +8444,36 @@ if (typeof window !== 'undefined') {
7411
8444
  * Copyright 2025 by Keenthemes Inc
7412
8445
  */
7413
8446
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7414
- exports.KTDropdown = void 0;
7415
- var dropdown_1 = __webpack_require__(/*! ./dropdown */ "./src/components/dropdown/dropdown.ts");
7416
- Object.defineProperty(exports, "KTDropdown", ({ enumerable: true, get: function () { return dropdown_1.KTDropdown; } }));
8447
+ exports.KTImageInput = void 0;
8448
+ var image_input_1 = __webpack_require__(/*! ./image-input */ "./src/components/image-input/image-input.ts");
8449
+ Object.defineProperty(exports, "KTImageInput", ({ enumerable: true, get: function () { return image_input_1.KTImageInput; } }));
7417
8450
 
7418
8451
 
7419
8452
  /***/ }),
7420
8453
 
7421
- /***/ "./src/components/image-input/image-input.ts":
7422
- /*!***************************************************!*\
7423
- !*** ./src/components/image-input/image-input.ts ***!
7424
- \***************************************************/
8454
+ /***/ "./src/components/modal/index.ts":
8455
+ /*!***************************************!*\
8456
+ !*** ./src/components/modal/index.ts ***!
8457
+ \***************************************/
8458
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
8459
+
8460
+
8461
+ /**
8462
+ * KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
8463
+ * Copyright 2025 by Keenthemes Inc
8464
+ */
8465
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
8466
+ exports.KTModal = void 0;
8467
+ var modal_1 = __webpack_require__(/*! ./modal */ "./src/components/modal/modal.ts");
8468
+ Object.defineProperty(exports, "KTModal", ({ enumerable: true, get: function () { return modal_1.KTModal; } }));
8469
+
8470
+
8471
+ /***/ }),
8472
+
8473
+ /***/ "./src/components/modal/modal.ts":
8474
+ /*!***************************************!*\
8475
+ !*** ./src/components/modal/modal.ts ***!
8476
+ \***************************************/
7425
8477
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7426
8478
 
7427
8479
 
@@ -7445,236 +8497,351 @@ var __extends = (this && this.__extends) || (function () {
7445
8497
  };
7446
8498
  })();
7447
8499
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7448
- exports.KTImageInput = void 0;
8500
+ exports.KTModal = void 0;
7449
8501
  var data_1 = __webpack_require__(/*! ../../helpers/data */ "./src/helpers/data.ts");
8502
+ var dom_1 = __webpack_require__(/*! ../../helpers/dom */ "./src/helpers/dom.ts");
7450
8503
  var event_handler_1 = __webpack_require__(/*! ../../helpers/event-handler */ "./src/helpers/event-handler.ts");
8504
+ var utils_1 = __webpack_require__(/*! ../../helpers/utils */ "./src/helpers/utils.ts");
7451
8505
  var component_1 = __webpack_require__(/*! ../component */ "./src/components/component.ts");
7452
- var KTImageInput = /** @class */ (function (_super) {
7453
- __extends(KTImageInput, _super);
7454
- function KTImageInput(element, config) {
8506
+ var KTModal = /** @class */ (function (_super) {
8507
+ __extends(KTModal, _super);
8508
+ function KTModal(element, config) {
7455
8509
  var _this = _super.call(this) || this;
7456
- _this._name = 'image-input';
8510
+ _this._name = 'modal';
7457
8511
  _this._defaultConfig = {
8512
+ zindex: '90',
8513
+ backdrop: true,
8514
+ backdropClass: 'kt-modal-backdrop',
8515
+ backdropStatic: false,
8516
+ keyboard: true,
8517
+ disableScroll: true,
8518
+ persistent: false,
8519
+ focus: true,
7458
8520
  hiddenClass: 'hidden',
7459
8521
  };
7460
- _this._previewUrl = '';
7461
- _this._selectedFile = null;
8522
+ _this._config = _this._defaultConfig;
8523
+ _this._isOpen = false;
8524
+ _this._isTransitioning = false;
8525
+ _this._backdropElement = null;
8526
+ _this._targetElement = null;
7462
8527
  if (data_1.default.has(element, _this._name))
7463
8528
  return _this;
7464
8529
  _this._init(element);
7465
8530
  _this._buildConfig(config);
7466
- _this._inputElement = _this._element.querySelector('input[type="file"]');
7467
- _this._hiddenElement = _this._element.querySelector('input[type="hidden"]');
7468
- _this._removeElement = _this._element.querySelector('[data-kt-image-input-remove]');
7469
- _this._previewElement = _this._element.querySelector('[data-kt-image-input-preview]');
7470
- _this._update();
7471
8531
  _this._handlers();
7472
8532
  return _this;
7473
8533
  }
7474
- KTImageInput.prototype._handlers = function () {
8534
+ KTModal.prototype._handlers = function () {
7475
8535
  var _this = this;
7476
- event_handler_1.default.on(this._element, '[data-kt-image-input-placeholder]', 'click', function (event) {
7477
- event.preventDefault();
7478
- _this._inputElement.click();
7479
- });
7480
- this._inputElement.addEventListener('change', function () {
7481
- _this._change();
7482
- });
7483
- this._removeElement.addEventListener('click', function () {
7484
- _this._remove();
8536
+ this._element.addEventListener('click', function (event) {
8537
+ var target = event.target;
8538
+ var modalContent = _this._element.querySelector('.kt-modal-content');
8539
+ // Stop propagation for clicks inside dropdowns rendered within modal content.
8540
+ var dropdownElement = target.closest('[data-kt-select-dropdown]');
8541
+ if (dropdownElement) {
8542
+ event.stopPropagation();
8543
+ return;
8544
+ }
8545
+ // Dismiss when clicking anywhere outside modal content.
8546
+ if (modalContent && modalContent.contains(target)) {
8547
+ return;
8548
+ }
8549
+ // Only hide if both backdropStatic is false AND persistent is false
8550
+ if (_this._getOption('backdropStatic') === false &&
8551
+ utils_1.default.stringToBoolean(_this._getOption('persistent')) === false) {
8552
+ _this._hide();
8553
+ }
7485
8554
  });
7486
8555
  };
7487
- KTImageInput.prototype._change = function () {
8556
+ KTModal.prototype._toggle = function (targetElement) {
8557
+ var payload = { cancel: false };
8558
+ this._fireEvent('toggle', payload);
8559
+ this._dispatchEvent('toggle', payload);
8560
+ if (payload.cancel === true) {
8561
+ return;
8562
+ }
8563
+ if (this._isOpen === true) {
8564
+ this._hide();
8565
+ }
8566
+ else {
8567
+ this._show(targetElement);
8568
+ }
8569
+ };
8570
+ KTModal.prototype._show = function (targetElement) {
7488
8571
  var _this = this;
8572
+ if (this._isOpen || this._isTransitioning) {
8573
+ return;
8574
+ }
8575
+ if (targetElement)
8576
+ this._targetElement = targetElement;
7489
8577
  var payload = { cancel: false };
7490
- this._fireEvent('change', payload);
7491
- this._dispatchEvent('change', payload);
8578
+ this._fireEvent('show', payload);
8579
+ this._dispatchEvent('show', payload);
7492
8580
  if (payload.cancel === true) {
7493
8581
  return;
7494
8582
  }
7495
- var reader = new FileReader();
7496
- reader.onload = function () {
7497
- _this._previewElement.style.backgroundImage = "url(".concat(reader.result, ")");
7498
- };
7499
- reader.readAsDataURL(this._inputElement.files[0]);
7500
- this._selectedFile = this._inputElement.files[0];
7501
- this._lastMode = 'new';
7502
- this._element.classList.add('changed');
7503
- this._removeElement.classList.remove('hidden');
7504
- this._element.classList.remove('empty');
7505
- this._fireEvent('changed');
7506
- this._dispatchEvent('changed');
8583
+ KTModal.hide();
8584
+ if (!this._element)
8585
+ return;
8586
+ this._isTransitioning = true;
8587
+ this._element.setAttribute('role', 'dialog');
8588
+ this._element.setAttribute('aria-modal', 'true');
8589
+ this._element.setAttribute('tabindex', '-1');
8590
+ this._setZindex();
8591
+ if (this._getOption('backdrop') === true)
8592
+ this._createBackdrop();
8593
+ if (this._getOption('disableScroll')) {
8594
+ document.body.style.overflow = 'hidden';
8595
+ }
8596
+ this._element.style.display = 'block';
8597
+ dom_1.default.reflow(this._element);
8598
+ this._element.classList.add('open');
8599
+ this._element.classList.remove(this._getOption('hiddenClass'));
8600
+ dom_1.default.transitionEnd(this._element, function () {
8601
+ _this._isTransitioning = false;
8602
+ _this._isOpen = true;
8603
+ if (_this._getOption('focus') === true) {
8604
+ _this._autoFocus();
8605
+ }
8606
+ _this._fireEvent('shown');
8607
+ _this._dispatchEvent('shown');
8608
+ });
7507
8609
  };
7508
- KTImageInput.prototype._remove = function () {
8610
+ KTModal.prototype._hide = function () {
8611
+ var _this = this;
8612
+ if (!this._element)
8613
+ return;
8614
+ if (this._isOpen === false || this._isTransitioning) {
8615
+ return;
8616
+ }
7509
8617
  var payload = { cancel: false };
7510
- this._fireEvent('remove', payload);
7511
- this._dispatchEvent('remove', payload);
8618
+ this._fireEvent('hide', payload);
8619
+ this._dispatchEvent('hide', payload);
7512
8620
  if (payload.cancel === true) {
7513
8621
  return;
7514
8622
  }
7515
- this._element.classList.remove('empty');
7516
- this._element.classList.remove('changed');
7517
- if (this._lastMode == 'new') {
7518
- if (this._previewUrl == '')
7519
- this._removeElement.classList.add(this._getOption('hiddenClass'));
7520
- if (this._previewUrl) {
7521
- this._previewElement.style.backgroundImage = "url(".concat(this._previewUrl, ")");
7522
- }
7523
- else {
7524
- this._previewElement.style.backgroundImage = 'none';
7525
- this._element.classList.add('empty');
7526
- }
7527
- this._inputElement.value = '';
7528
- this._hiddenElement.value = '';
7529
- this._selectedFile = null;
7530
- this._lastMode = 'saved';
7531
- }
7532
- else if (this._lastMode == 'saved') {
7533
- if (this._previewUrl == '')
7534
- this._removeElement.classList.add(this._getOption('hiddenClass'));
7535
- this._previewElement.style.backgroundImage = 'none';
7536
- this._element.classList.add('empty');
7537
- this._hiddenElement.value = '1';
7538
- this._inputElement.value = '';
7539
- this._selectedFile = null;
7540
- this._lastMode = 'placeholder';
8623
+ this._isTransitioning = true;
8624
+ this._element.removeAttribute('role');
8625
+ this._element.removeAttribute('aria-modal');
8626
+ this._element.removeAttribute('tabindex');
8627
+ if (this._getOption('disableScroll')) {
8628
+ document.body.style.overflow = '';
7541
8629
  }
7542
- else if (this._lastMode == 'placeholder') {
7543
- if (this._previewUrl == '')
7544
- this._removeElement.classList.add(this._getOption('hiddenClass'));
7545
- if (this._previewUrl) {
7546
- this._previewElement.style.backgroundImage = "url(".concat(this._previewUrl, ")");
7547
- }
7548
- else {
7549
- this._element.classList.add('empty');
7550
- }
7551
- this._inputElement.value = '';
7552
- this._hiddenElement.value = '';
7553
- this._selectedFile = null;
7554
- this._lastMode = 'saved';
8630
+ dom_1.default.reflow(this._element);
8631
+ this._element.classList.remove('open');
8632
+ if (this._getOption('backdrop') === true) {
8633
+ this._deleteBackdrop();
7555
8634
  }
7556
- this._fireEvent('remove');
7557
- this._dispatchEvent('remove');
8635
+ dom_1.default.transitionEnd(this._element, function () {
8636
+ if (!_this._element)
8637
+ return;
8638
+ _this._isTransitioning = false;
8639
+ _this._isOpen = false;
8640
+ _this._element.style.display = '';
8641
+ _this._element.classList.add(_this._getOption('hiddenClass'));
8642
+ _this._fireEvent('hidden');
8643
+ _this._dispatchEvent('hidden');
8644
+ });
7558
8645
  };
7559
- KTImageInput.prototype._update = function () {
7560
- if (this._previewElement.style.backgroundImage) {
7561
- this._setPreviewUrl(this._previewElement.style.backgroundImage);
7562
- this._removeElement.classList.remove(this._getOption('hiddenClass'));
7563
- this._lastMode = 'saved';
8646
+ KTModal.prototype._setZindex = function () {
8647
+ var zindex = parseInt(this._getOption('zindex'));
8648
+ if (parseInt(dom_1.default.getCssProp(this._element, 'z-index')) > zindex) {
8649
+ zindex = parseInt(dom_1.default.getCssProp(this._element, 'z-index'));
7564
8650
  }
7565
- else {
7566
- this._removeElement.classList.add(this._getOption('hiddenClass'));
7567
- this._element.classList.add('empty');
7568
- this._lastMode = 'placeholder';
8651
+ if (dom_1.default.getHighestZindex(this._element) > zindex) {
8652
+ zindex = dom_1.default.getHighestZindex(this._element) + 1;
7569
8653
  }
8654
+ this._element.style.zIndex = String(zindex);
7570
8655
  };
7571
- KTImageInput.prototype._getPreviewUrl = function () {
7572
- return this._previewUrl;
7573
- };
7574
- KTImageInput.prototype._setPreviewUrl = function (url) {
7575
- this._previewUrl = url.replace(/(url\(|\)|")/g, '');
8656
+ KTModal.prototype._autoFocus = function () {
8657
+ if (!this._element)
8658
+ return;
8659
+ var input = this._element.querySelector('[data-kt-modal-input-focus]');
8660
+ if (!input)
8661
+ return;
8662
+ else
8663
+ input.focus();
7576
8664
  };
7577
- KTImageInput.prototype.isEmpty = function () {
7578
- return this._selectedFile === null;
8665
+ KTModal.prototype._createBackdrop = function () {
8666
+ var _this = this;
8667
+ if (!this._element)
8668
+ return;
8669
+ var zindex = parseInt(dom_1.default.getCssProp(this._element, 'z-index'));
8670
+ this._backdropElement = document.createElement('DIV');
8671
+ this._backdropElement.setAttribute('data-kt-modal-backdrop', 'true');
8672
+ this._backdropElement.addEventListener('click', function () {
8673
+ if (_this._getOption('backdropStatic') === false &&
8674
+ utils_1.default.stringToBoolean(_this._getOption('persistent')) === false) {
8675
+ _this._hide();
8676
+ }
8677
+ });
8678
+ this._backdropElement.style.zIndex = (zindex - 1).toString();
8679
+ document.body.append(this._backdropElement);
8680
+ dom_1.default.reflow(this._backdropElement);
8681
+ dom_1.default.addClass(this._backdropElement, this._getOption('backdropClass'));
7579
8682
  };
7580
- KTImageInput.prototype.isChanged = function () {
7581
- return this._selectedFile !== null;
8683
+ KTModal.prototype._deleteBackdrop = function () {
8684
+ var _this = this;
8685
+ if (!this._backdropElement)
8686
+ return;
8687
+ dom_1.default.reflow(this._backdropElement);
8688
+ this._backdropElement.style.opacity = '0';
8689
+ dom_1.default.transitionEnd(this._backdropElement, function () {
8690
+ if (!_this._backdropElement)
8691
+ return;
8692
+ dom_1.default.remove(_this._backdropElement);
8693
+ });
7582
8694
  };
7583
- KTImageInput.prototype.remove = function () {
7584
- this._remove();
8695
+ KTModal.prototype.toggle = function (targetElement) {
8696
+ return this._toggle(targetElement);
7585
8697
  };
7586
- KTImageInput.prototype.update = function () {
7587
- this._update();
8698
+ KTModal.prototype.show = function (targetElement) {
8699
+ return this._show(targetElement);
7588
8700
  };
7589
- KTImageInput.prototype.setPreviewUrl = function (url) {
7590
- this._setPreviewUrl(url);
8701
+ KTModal.prototype.hide = function () {
8702
+ return this._hide();
7591
8703
  };
7592
- KTImageInput.prototype.getPreviewUrl = function () {
7593
- return this._getPreviewUrl();
8704
+ KTModal.prototype.getTargetElement = function () {
8705
+ return this._targetElement;
7594
8706
  };
7595
- KTImageInput.prototype.getSelectedFile = function () {
7596
- return this._selectedFile;
8707
+ KTModal.prototype.isOpen = function () {
8708
+ return this._isOpen;
7597
8709
  };
7598
- KTImageInput.getInstance = function (element) {
8710
+ KTModal.getInstance = function (element) {
7599
8711
  if (!element)
7600
8712
  return null;
7601
- if (data_1.default.has(element, 'image-input')) {
7602
- return data_1.default.get(element, 'image-input');
8713
+ if (data_1.default.has(element, 'modal')) {
8714
+ return data_1.default.get(element, 'modal');
7603
8715
  }
7604
- if (element.getAttribute('data-kt-image-input')) {
7605
- return new KTImageInput(element);
8716
+ if (element.getAttribute('data-kt-modal')) {
8717
+ return new KTModal(element);
7606
8718
  }
7607
8719
  return null;
7608
8720
  };
7609
- KTImageInput.getOrCreateInstance = function (element, config) {
7610
- return this.getInstance(element) || new KTImageInput(element, config);
8721
+ KTModal.getOrCreateInstance = function (element, config) {
8722
+ return this.getInstance(element) || new KTModal(element, config);
8723
+ };
8724
+ KTModal.hide = function () {
8725
+ var elements = document.querySelectorAll('[data-kt-modal-initialized]');
8726
+ elements.forEach(function (element) {
8727
+ var modal = KTModal.getInstance(element);
8728
+ if (modal && modal.isOpen()) {
8729
+ modal.hide();
8730
+ }
8731
+ });
8732
+ };
8733
+ KTModal.handleToggle = function () {
8734
+ // wire:navigate / morph can replace document.body; <html> stays stable.
8735
+ event_handler_1.default.on(document.documentElement, '[data-kt-modal-toggle]', 'click', function (event, target) {
8736
+ event.stopPropagation();
8737
+ var selector = target.getAttribute('data-kt-modal-toggle');
8738
+ if (!selector)
8739
+ return;
8740
+ var modalElement = document.querySelector(selector);
8741
+ var modal = KTModal.getInstance(modalElement);
8742
+ if (modal) {
8743
+ modal.toggle(target);
8744
+ }
8745
+ });
8746
+ };
8747
+ KTModal.handleDismiss = function () {
8748
+ event_handler_1.default.on(document.documentElement, '[data-kt-modal-dismiss]', 'click', function (event, target) {
8749
+ event.stopPropagation();
8750
+ var modalElement = target.closest('[data-kt-modal-initialized]');
8751
+ if (modalElement) {
8752
+ var modal = KTModal.getInstance(modalElement);
8753
+ if (modal) {
8754
+ modal.hide();
8755
+ }
8756
+ }
8757
+ });
8758
+ };
8759
+ KTModal.handleClickAway = function () {
8760
+ document.addEventListener('click', function (event) {
8761
+ var modalElement = document.querySelector('.open[data-kt-modal-initialized]');
8762
+ if (!modalElement)
8763
+ return;
8764
+ var modal = KTModal.getInstance(modalElement);
8765
+ if (!modal)
8766
+ return;
8767
+ if (utils_1.default.stringToBoolean(modal.getOption('persistent')) === true)
8768
+ return;
8769
+ if (utils_1.default.stringToBoolean(modal.getOption('backdrop')) === true)
8770
+ return;
8771
+ if (modalElement !== event.target &&
8772
+ modal.getTargetElement() !== event.target &&
8773
+ modalElement.contains(event.target) === false) {
8774
+ modal.hide();
8775
+ }
8776
+ });
8777
+ };
8778
+ KTModal.handleKeyword = function () {
8779
+ document.addEventListener('keydown', function (event) {
8780
+ var modalElement = document.querySelector('.open[data-kt-modal-initialized]');
8781
+ var modal = KTModal.getInstance(modalElement);
8782
+ if (!modal) {
8783
+ return;
8784
+ }
8785
+ // if esc key was not pressed in combination with ctrl or alt or shift
8786
+ if (event.key === 'Escape' &&
8787
+ !(event.ctrlKey || event.altKey || event.shiftKey)) {
8788
+ modal.hide();
8789
+ }
8790
+ if (event.code === 'Tab' && !event.metaKey) {
8791
+ return;
8792
+ }
8793
+ });
7611
8794
  };
7612
- KTImageInput.createInstances = function () {
7613
- var elements = document.querySelectorAll('[data-kt-image-input]');
8795
+ KTModal.createInstances = function () {
8796
+ var elements = document.querySelectorAll('[data-kt-modal]');
7614
8797
  elements.forEach(function (element) {
7615
- new KTImageInput(element);
8798
+ new KTModal(element);
7616
8799
  });
7617
8800
  };
7618
- KTImageInput.init = function () {
7619
- KTImageInput.createInstances();
8801
+ KTModal.init = function () {
8802
+ KTModal.createInstances();
8803
+ if (window.KT_MODAL_INITIALIZED !== true) {
8804
+ KTModal.handleToggle();
8805
+ KTModal.handleDismiss();
8806
+ KTModal.handleClickAway();
8807
+ KTModal.handleKeyword();
8808
+ window.KT_MODAL_INITIALIZED = true;
8809
+ }
7620
8810
  };
7621
- return KTImageInput;
8811
+ return KTModal;
7622
8812
  }(component_1.default));
7623
- exports.KTImageInput = KTImageInput;
8813
+ exports.KTModal = KTModal;
7624
8814
  if (typeof window !== 'undefined') {
7625
- window.KTImageInput = KTImageInput;
8815
+ window.KTModal = KTModal;
7626
8816
  }
7627
8817
 
7628
8818
 
7629
8819
  /***/ }),
7630
8820
 
7631
- /***/ "./src/components/image-input/index.ts":
7632
- /*!*********************************************!*\
7633
- !*** ./src/components/image-input/index.ts ***!
7634
- \*********************************************/
7635
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7636
-
7637
-
7638
- /**
7639
- * KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
7640
- * Copyright 2025 by Keenthemes Inc
7641
- */
7642
- Object.defineProperty(exports, "__esModule", ({ value: true }));
7643
- exports.KTImageInput = void 0;
7644
- var image_input_1 = __webpack_require__(/*! ./image-input */ "./src/components/image-input/image-input.ts");
7645
- Object.defineProperty(exports, "KTImageInput", ({ enumerable: true, get: function () { return image_input_1.KTImageInput; } }));
7646
-
7647
-
7648
- /***/ }),
7649
-
7650
- /***/ "./src/components/modal/index.ts":
7651
- /*!***************************************!*\
7652
- !*** ./src/components/modal/index.ts ***!
7653
- \***************************************/
8821
+ /***/ "./src/components/pin-input/index.ts":
8822
+ /*!*******************************************!*\
8823
+ !*** ./src/components/pin-input/index.ts ***!
8824
+ \*******************************************/
7654
8825
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7655
8826
 
7656
8827
 
7657
- /**
7658
- * KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
7659
- * Copyright 2025 by Keenthemes Inc
7660
- */
7661
8828
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7662
- exports.KTModal = void 0;
7663
- var modal_1 = __webpack_require__(/*! ./modal */ "./src/components/modal/modal.ts");
7664
- Object.defineProperty(exports, "KTModal", ({ enumerable: true, get: function () { return modal_1.KTModal; } }));
8829
+ exports.KTPinInput = void 0;
8830
+ var pin_input_1 = __webpack_require__(/*! ./pin-input */ "./src/components/pin-input/pin-input.ts");
8831
+ Object.defineProperty(exports, "KTPinInput", ({ enumerable: true, get: function () { return pin_input_1.KTPinInput; } }));
7665
8832
 
7666
8833
 
7667
8834
  /***/ }),
7668
8835
 
7669
- /***/ "./src/components/modal/modal.ts":
7670
- /*!***************************************!*\
7671
- !*** ./src/components/modal/modal.ts ***!
7672
- \***************************************/
8836
+ /***/ "./src/components/pin-input/pin-input.ts":
8837
+ /*!***********************************************!*\
8838
+ !*** ./src/components/pin-input/pin-input.ts ***!
8839
+ \***********************************************/
7673
8840
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7674
8841
 
7675
8842
 
7676
8843
  /**
7677
- * KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
8844
+ * KTUI - PIN / OTP multi-field input
7678
8845
  * Copyright 2025 by Keenthemes Inc
7679
8846
  */
7680
8847
  var __extends = (this && this.__extends) || (function () {
@@ -7692,317 +8859,439 @@ var __extends = (this && this.__extends) || (function () {
7692
8859
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7693
8860
  };
7694
8861
  })();
8862
+ var __assign = (this && this.__assign) || function () {
8863
+ __assign = Object.assign || function(t) {
8864
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8865
+ s = arguments[i];
8866
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8867
+ t[p] = s[p];
8868
+ }
8869
+ return t;
8870
+ };
8871
+ return __assign.apply(this, arguments);
8872
+ };
7695
8873
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7696
- exports.KTModal = void 0;
8874
+ exports.KTPinInput = void 0;
7697
8875
  var data_1 = __webpack_require__(/*! ../../helpers/data */ "./src/helpers/data.ts");
7698
- var dom_1 = __webpack_require__(/*! ../../helpers/dom */ "./src/helpers/dom.ts");
7699
- var event_handler_1 = __webpack_require__(/*! ../../helpers/event-handler */ "./src/helpers/event-handler.ts");
7700
- var utils_1 = __webpack_require__(/*! ../../helpers/utils */ "./src/helpers/utils.ts");
7701
8876
  var component_1 = __webpack_require__(/*! ../component */ "./src/components/component.ts");
7702
- var KTModal = /** @class */ (function (_super) {
7703
- __extends(KTModal, _super);
7704
- function KTModal(element, config) {
8877
+ var ITEM_SELECTOR = '[data-kt-pin-input-item]';
8878
+ var KTPinInput = /** @class */ (function (_super) {
8879
+ __extends(KTPinInput, _super);
8880
+ function KTPinInput(element, config) {
8881
+ if (config === void 0) { config = null; }
7705
8882
  var _this = _super.call(this) || this;
7706
- _this._name = 'modal';
8883
+ _this._name = 'pin-input';
7707
8884
  _this._defaultConfig = {
7708
- zindex: '90',
7709
- backdrop: true,
7710
- backdropClass: 'kt-modal-backdrop',
7711
- backdropStatic: false,
7712
- keyboard: true,
7713
- disableScroll: true,
7714
- persistent: false,
7715
- focus: true,
7716
- hiddenClass: 'hidden',
8885
+ lazy: false,
8886
+ availableChars: '[0-9]',
8887
+ name: '',
7717
8888
  };
7718
- _this._config = _this._defaultConfig;
7719
- _this._isOpen = false;
7720
- _this._isTransitioning = false;
7721
- _this._backdropElement = null;
7722
- _this._targetElement = null;
7723
- if (data_1.default.has(element, _this._name))
8889
+ _this._config = _this
8890
+ ._defaultConfig;
8891
+ _this._cells = [];
8892
+ _this._hiddenInput = null;
8893
+ _this._charRegex = null;
8894
+ _this._wasComplete = false;
8895
+ _this._onKeydownBound = function (e) { return _this._onKeydown(e); };
8896
+ _this._onBeforeInputBound = function (e) { return _this._onBeforeInput(e); };
8897
+ _this._onInputBound = function (e) { return _this._onInput(e); };
8898
+ _this._onPasteBound = function (e) { return _this._onPaste(e); };
8899
+ var cells = KTPinInput.collectItems(element);
8900
+ if (cells.length === 0) {
8901
+ return _this;
8902
+ }
8903
+ if (_this._shouldSkipInit(element)) {
7724
8904
  return _this;
8905
+ }
8906
+ _this._cells = cells;
7725
8907
  _this._init(element);
7726
8908
  _this._buildConfig(config);
7727
- _this._handlers();
8909
+ _this._compileRegex();
8910
+ _this._ensureHiddenInput();
8911
+ _this._prepareCells();
8912
+ var el = _this._element;
8913
+ if (el) {
8914
+ el.addEventListener('keydown', _this._onKeydownBound, true);
8915
+ el.addEventListener('beforeinput', _this._onBeforeInputBound, true);
8916
+ el.addEventListener('input', _this._onInputBound, true);
8917
+ el.addEventListener('paste', _this._onPasteBound, true);
8918
+ }
8919
+ _this._syncFromDom(undefined, { silent: true });
7728
8920
  return _this;
7729
8921
  }
7730
- KTModal.prototype._handlers = function () {
7731
- var _this = this;
7732
- this._element.addEventListener('click', function (event) {
7733
- var target = event.target;
7734
- var currentTarget = event.currentTarget;
7735
- // Only proceed if clicking directly on the backdrop (modal element itself)
7736
- // This prevents closing when clicking inside modal content or any child elements
7737
- // (including dropdowns rendered via dropdownContainer pointing to modal)
7738
- if (target !== currentTarget) {
7739
- // Stop propagation for clicks inside dropdowns to prevent dropdown from closing
7740
- // Check if click is inside a dropdown element (KT Select dropdown)
7741
- var dropdownElement = target.closest('[data-kt-select-dropdown]');
7742
- if (dropdownElement) {
7743
- event.stopPropagation();
7744
- }
7745
- return;
7746
- }
7747
- // Only hide if both backdropStatic is false AND persistent is false
7748
- if (_this._getOption('backdropStatic') === false &&
7749
- utils_1.default.stringToBoolean(_this._getOption('persistent')) === false) {
7750
- _this._hide();
8922
+ KTPinInput.collectItems = function (root) {
8923
+ return Array.from(root.querySelectorAll(ITEM_SELECTOR)).filter(function (el) { return root.contains(el); });
8924
+ };
8925
+ KTPinInput.prototype._compileRegex = function () {
8926
+ var raw = this._getOption('availableChars');
8927
+ var pattern = typeof raw === 'string' && raw.trim() !== '' ? raw.trim() : '[0-9]';
8928
+ try {
8929
+ this._charRegex = new RegExp(pattern);
8930
+ }
8931
+ catch (_a) {
8932
+ this._charRegex = /[0-9]/;
8933
+ }
8934
+ };
8935
+ KTPinInput.prototype._isValidChar = function (char) {
8936
+ var _a;
8937
+ return Boolean(char && ((_a = this._charRegex) === null || _a === void 0 ? void 0 : _a.test(char)));
8938
+ };
8939
+ KTPinInput.prototype._enabledCells = function () {
8940
+ return this._cells.filter(function (c) { return !c.disabled; });
8941
+ };
8942
+ KTPinInput.prototype._prepareCells = function () {
8943
+ for (var _i = 0, _a = this._cells; _i < _a.length; _i++) {
8944
+ var cell = _a[_i];
8945
+ cell.maxLength = 1;
8946
+ cell.setAttribute('maxlength', '1');
8947
+ }
8948
+ };
8949
+ KTPinInput.prototype._activeCell = function (target) {
8950
+ if (!(target instanceof HTMLInputElement)) {
8951
+ return null;
8952
+ }
8953
+ if (!this._cells.includes(target) || target.disabled) {
8954
+ return null;
8955
+ }
8956
+ return target;
8957
+ };
8958
+ KTPinInput.prototype._cellIndex = function (cell) {
8959
+ return this._cells.indexOf(cell);
8960
+ };
8961
+ KTPinInput.prototype._focusNextEnabled = function (afterCell) {
8962
+ var enabled = this._enabledCells();
8963
+ var idx = enabled.indexOf(afterCell);
8964
+ if (idx < 0 || idx >= enabled.length - 1) {
8965
+ return;
8966
+ }
8967
+ var next = enabled[idx + 1];
8968
+ next.focus();
8969
+ next.select();
8970
+ };
8971
+ KTPinInput.prototype._fillCellAndAdvance = function (cell, char) {
8972
+ cell.value = char;
8973
+ this._syncFromDom(this._cellIndex(cell));
8974
+ this._focusNextEnabled(cell);
8975
+ };
8976
+ KTPinInput.prototype._routeCharFromCell = function (target, char) {
8977
+ var _a, _b;
8978
+ var start = (_a = target.selectionStart) !== null && _a !== void 0 ? _a : 0;
8979
+ var end = (_b = target.selectionEnd) !== null && _b !== void 0 ? _b : 0;
8980
+ var v = target.value;
8981
+ var replacing = end > start;
8982
+ var atEnd = start === end && start === v.length;
8983
+ if (v.length >= 1 && !replacing && atEnd) {
8984
+ var enabled = this._enabledCells();
8985
+ var idx = enabled.indexOf(target);
8986
+ if (idx >= 0 && idx < enabled.length - 1) {
8987
+ this._fillCellAndAdvance(enabled[idx + 1], char);
7751
8988
  }
7752
- });
8989
+ return;
8990
+ }
8991
+ this._fillCellAndAdvance(target, char);
7753
8992
  };
7754
- KTModal.prototype._toggle = function (targetElement) {
7755
- var payload = { cancel: false };
7756
- this._fireEvent('toggle', payload);
7757
- this._dispatchEvent('toggle', payload);
7758
- if (payload.cancel === true) {
8993
+ KTPinInput.prototype._ensureHiddenInput = function () {
8994
+ var raw = this._getOption('name');
8995
+ var name = typeof raw === 'string' ? raw.trim() : '';
8996
+ if (!name || !this._element) {
8997
+ this._hiddenInput = null;
7759
8998
  return;
7760
8999
  }
7761
- if (this._isOpen === true) {
7762
- this._hide();
9000
+ var h = this._element.querySelector('input[type="hidden"][data-kt-pin-input-hidden]');
9001
+ if (!h) {
9002
+ h = document.createElement('input');
9003
+ h.type = 'hidden';
9004
+ h.name = name;
9005
+ h.setAttribute('data-kt-pin-input-hidden', 'true');
9006
+ this._element.appendChild(h);
9007
+ }
9008
+ this._hiddenInput = h;
9009
+ };
9010
+ KTPinInput.prototype._focusCell = function (index, select) {
9011
+ if (select === void 0) { select = true; }
9012
+ var enabled = this._enabledCells();
9013
+ var target = enabled[index];
9014
+ if (!target) {
9015
+ return;
7763
9016
  }
7764
- else {
7765
- this._show(targetElement);
9017
+ target.focus();
9018
+ if (select) {
9019
+ target.select();
7766
9020
  }
7767
9021
  };
7768
- KTModal.prototype._show = function (targetElement) {
7769
- var _this = this;
7770
- if (this._isOpen || this._isTransitioning) {
9022
+ KTPinInput.prototype._focusRelative = function (cell, delta) {
9023
+ var enabled = this._enabledCells();
9024
+ var idx = enabled.indexOf(cell);
9025
+ if (idx < 0) {
7771
9026
  return;
7772
9027
  }
7773
- if (targetElement)
7774
- this._targetElement = targetElement;
7775
- var payload = { cancel: false };
7776
- this._fireEvent('show', payload);
7777
- this._dispatchEvent('show', payload);
7778
- if (payload.cancel === true) {
9028
+ var next = idx + delta;
9029
+ if (next >= 0 && next < enabled.length) {
9030
+ enabled[next].focus();
9031
+ enabled[next].select();
9032
+ }
9033
+ };
9034
+ KTPinInput.prototype._filterString = function (str) {
9035
+ var out = '';
9036
+ for (var i = 0; i < str.length; i++) {
9037
+ var ch = str[i];
9038
+ if (this._isValidChar(ch)) {
9039
+ out += ch;
9040
+ }
9041
+ }
9042
+ return out;
9043
+ };
9044
+ KTPinInput.prototype._buildPayload = function (cellIndex) {
9045
+ var value = this.getValue();
9046
+ var enabled = this._enabledCells();
9047
+ var filled = enabled.filter(function (c) { return Boolean(c.value); }).length;
9048
+ var complete = enabled.length > 0 && filled === enabled.length;
9049
+ return __assign({ value: value, complete: complete, cellCount: enabled.length, filledCount: filled }, (cellIndex !== undefined ? { cellIndex: cellIndex } : {}));
9050
+ };
9051
+ KTPinInput.prototype._emit = function (payload) {
9052
+ this._fireEvent('input', payload);
9053
+ this._dispatchEvent('kt.pin-input.input', payload);
9054
+ this._dispatchEvent('kt.pin-input.change', payload);
9055
+ if (payload.complete && !this._wasComplete) {
9056
+ this._dispatchEvent('kt.pin-input.complete', payload);
9057
+ }
9058
+ this._wasComplete = payload.complete;
9059
+ };
9060
+ KTPinInput.prototype._syncHidden = function (value) {
9061
+ if (this._hiddenInput) {
9062
+ this._hiddenInput.value = value;
9063
+ }
9064
+ };
9065
+ KTPinInput.prototype._syncFromDom = function (cellIndex, opts) {
9066
+ var payload = this._buildPayload(cellIndex);
9067
+ this._syncHidden(payload.value);
9068
+ if (opts === null || opts === void 0 ? void 0 : opts.silent) {
9069
+ this._wasComplete = payload.complete;
7779
9070
  return;
7780
9071
  }
7781
- KTModal.hide();
7782
- if (!this._element)
9072
+ this._emit(payload);
9073
+ };
9074
+ KTPinInput.prototype._onKeydown = function (e) {
9075
+ var target = this._activeCell(e.target);
9076
+ if (!target) {
7783
9077
  return;
7784
- this._isTransitioning = true;
7785
- this._element.setAttribute('role', 'dialog');
7786
- this._element.setAttribute('aria-modal', 'true');
7787
- this._element.setAttribute('tabindex', '-1');
7788
- this._setZindex();
7789
- if (this._getOption('backdrop') === true)
7790
- this._createBackdrop();
7791
- if (this._getOption('disableScroll')) {
7792
- document.body.style.overflow = 'hidden';
7793
9078
  }
7794
- this._element.style.display = 'block';
7795
- dom_1.default.reflow(this._element);
7796
- this._element.classList.add('open');
7797
- this._element.classList.remove(this._getOption('hiddenClass'));
7798
- dom_1.default.transitionEnd(this._element, function () {
7799
- _this._isTransitioning = false;
7800
- _this._isOpen = true;
7801
- if (_this._getOption('focus') === true) {
7802
- _this._autoFocus();
9079
+ if (e.key === 'Backspace') {
9080
+ e.preventDefault();
9081
+ if (target.value) {
9082
+ target.value = '';
9083
+ this._syncFromDom(this._cellIndex(target));
7803
9084
  }
7804
- _this._fireEvent('shown');
7805
- _this._dispatchEvent('shown');
7806
- });
9085
+ else {
9086
+ this._focusRelative(target, -1);
9087
+ }
9088
+ return;
9089
+ }
9090
+ if (e.key === 'ArrowLeft') {
9091
+ e.preventDefault();
9092
+ this._focusRelative(target, -1);
9093
+ return;
9094
+ }
9095
+ if (e.key === 'ArrowRight') {
9096
+ e.preventDefault();
9097
+ this._focusRelative(target, 1);
9098
+ return;
9099
+ }
9100
+ if (e.key === 'Home') {
9101
+ e.preventDefault();
9102
+ this._focusCell(0);
9103
+ return;
9104
+ }
9105
+ if (e.key === 'End') {
9106
+ e.preventDefault();
9107
+ this._focusCell(this._enabledCells().length - 1);
9108
+ return;
9109
+ }
9110
+ if (e.ctrlKey || e.metaKey || e.altKey) {
9111
+ return;
9112
+ }
9113
+ if (e.key.length === 1) {
9114
+ if (!this._isValidChar(e.key)) {
9115
+ e.preventDefault();
9116
+ return;
9117
+ }
9118
+ e.preventDefault();
9119
+ this._routeCharFromCell(target, e.key);
9120
+ }
7807
9121
  };
7808
- KTModal.prototype._hide = function () {
7809
- var _this = this;
7810
- if (!this._element)
9122
+ KTPinInput.prototype._onBeforeInput = function (e) {
9123
+ var _a, _b;
9124
+ if (!('inputType' in e)) {
7811
9125
  return;
7812
- if (this._isOpen === false || this._isTransitioning) {
9126
+ }
9127
+ var ie = e;
9128
+ if (ie.isComposing) {
7813
9129
  return;
7814
9130
  }
7815
- var payload = { cancel: false };
7816
- this._fireEvent('hide', payload);
7817
- this._dispatchEvent('hide', payload);
7818
- if (payload.cancel === true) {
9131
+ var target = this._activeCell(ie.target);
9132
+ if (!target) {
7819
9133
  return;
7820
9134
  }
7821
- this._isTransitioning = true;
7822
- this._element.removeAttribute('role');
7823
- this._element.removeAttribute('aria-modal');
7824
- this._element.removeAttribute('tabindex');
7825
- if (this._getOption('disableScroll')) {
7826
- document.body.style.overflow = '';
9135
+ if (ie.inputType === 'insertFromPaste' ||
9136
+ ie.inputType === 'insertFromYank') {
9137
+ e.preventDefault();
9138
+ return;
9139
+ }
9140
+ if (ie.inputType !== 'insertText' || ie.data == null) {
9141
+ return;
7827
9142
  }
7828
- dom_1.default.reflow(this._element);
7829
- this._element.classList.remove('open');
7830
- if (this._getOption('backdrop') === true) {
7831
- this._deleteBackdrop();
9143
+ var data = ie.data;
9144
+ if (data.length > 1) {
9145
+ e.preventDefault();
9146
+ var filtered = this._filterString(data);
9147
+ if (filtered.length) {
9148
+ this._distributeFromIndex(this._cellIndex(target), filtered);
9149
+ }
9150
+ return;
7832
9151
  }
7833
- dom_1.default.transitionEnd(this._element, function () {
7834
- if (!_this._element)
7835
- return;
7836
- _this._isTransitioning = false;
7837
- _this._isOpen = false;
7838
- _this._element.style.display = '';
7839
- _this._element.classList.add(_this._getOption('hiddenClass'));
7840
- _this._fireEvent('hidden');
7841
- _this._dispatchEvent('hidden');
7842
- });
7843
- };
7844
- KTModal.prototype._setZindex = function () {
7845
- var zindex = parseInt(this._getOption('zindex'));
7846
- if (parseInt(dom_1.default.getCssProp(this._element, 'z-index')) > zindex) {
7847
- zindex = parseInt(dom_1.default.getCssProp(this._element, 'z-index'));
9152
+ if (data.length !== 1) {
9153
+ return;
7848
9154
  }
7849
- if (dom_1.default.getHighestZindex(this._element) > zindex) {
7850
- zindex = dom_1.default.getHighestZindex(this._element) + 1;
9155
+ if (!this._isValidChar(data)) {
9156
+ e.preventDefault();
9157
+ return;
9158
+ }
9159
+ var start = (_a = target.selectionStart) !== null && _a !== void 0 ? _a : 0;
9160
+ var end = (_b = target.selectionEnd) !== null && _b !== void 0 ? _b : 0;
9161
+ var v = target.value;
9162
+ var replacing = end > start;
9163
+ var nextLen = replacing ? v.length - (end - start) + 1 : v.length + 1;
9164
+ if (nextLen > 1 && !replacing) {
9165
+ e.preventDefault();
9166
+ this._routeCharFromCell(target, data);
7851
9167
  }
7852
- this._element.style.zIndex = String(zindex);
7853
9168
  };
7854
- KTModal.prototype._autoFocus = function () {
7855
- if (!this._element)
9169
+ KTPinInput.prototype._onInput = function (e) {
9170
+ var target = this._activeCell(e.target);
9171
+ if (!target) {
7856
9172
  return;
7857
- var input = this._element.querySelector('[data-kt-modal-input-focus]');
7858
- if (!input)
9173
+ }
9174
+ var v = target.value;
9175
+ if (v.length > 1) {
9176
+ var filtered = this._filterString(v);
9177
+ target.value = '';
9178
+ if (filtered.length) {
9179
+ this._distributeFromIndex(this._cellIndex(target), filtered);
9180
+ }
9181
+ else {
9182
+ this._syncFromDom(this._cellIndex(target));
9183
+ }
7859
9184
  return;
7860
- else
7861
- input.focus();
7862
- };
7863
- KTModal.prototype._createBackdrop = function () {
7864
- if (!this._element)
9185
+ }
9186
+ if (v.length === 1 && !this._isValidChar(v)) {
9187
+ target.value = '';
9188
+ this._syncFromDom(this._cellIndex(target));
7865
9189
  return;
7866
- var zindex = parseInt(dom_1.default.getCssProp(this._element, 'z-index'));
7867
- this._backdropElement = document.createElement('DIV');
7868
- this._backdropElement.setAttribute('data-kt-modal-backdrop', 'true');
7869
- this._backdropElement.style.zIndex = (zindex - 1).toString();
7870
- document.body.append(this._backdropElement);
7871
- dom_1.default.reflow(this._backdropElement);
7872
- dom_1.default.addClass(this._backdropElement, this._getOption('backdropClass'));
9190
+ }
9191
+ this._syncFromDom(this._cellIndex(target));
9192
+ if (v.length === 1) {
9193
+ this._focusNextEnabled(target);
9194
+ }
7873
9195
  };
7874
- KTModal.prototype._deleteBackdrop = function () {
7875
- var _this = this;
7876
- if (!this._backdropElement)
9196
+ KTPinInput.prototype._onPaste = function (e) {
9197
+ var _a;
9198
+ var target = this._activeCell(e.target);
9199
+ if (!target) {
7877
9200
  return;
7878
- dom_1.default.reflow(this._backdropElement);
7879
- this._backdropElement.style.opacity = '0';
7880
- dom_1.default.transitionEnd(this._backdropElement, function () {
7881
- if (!_this._backdropElement)
7882
- return;
7883
- dom_1.default.remove(_this._backdropElement);
7884
- });
7885
- };
7886
- KTModal.prototype.toggle = function (targetElement) {
7887
- return this._toggle(targetElement);
7888
- };
7889
- KTModal.prototype.show = function (targetElement) {
7890
- return this._show(targetElement);
9201
+ }
9202
+ e.preventDefault();
9203
+ var text = ((_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text')) || '';
9204
+ var filtered = this._filterString(text);
9205
+ this._distributeFromIndex(this._cellIndex(target), filtered);
7891
9206
  };
7892
- KTModal.prototype.hide = function () {
7893
- return this._hide();
9207
+ KTPinInput.prototype._distributeFromIndex = function (startCellIndex, chars) {
9208
+ if (chars.length === 0) {
9209
+ return;
9210
+ }
9211
+ var startCell = this._cells[startCellIndex];
9212
+ if (!startCell || startCell.disabled) {
9213
+ return;
9214
+ }
9215
+ var enabled = this._enabledCells();
9216
+ var startIdx = enabled.indexOf(startCell);
9217
+ if (startIdx < 0) {
9218
+ return;
9219
+ }
9220
+ var charPos = 0;
9221
+ for (var i = startIdx; i < enabled.length && charPos < chars.length; i++) {
9222
+ enabled[i].value = chars[charPos];
9223
+ charPos++;
9224
+ }
9225
+ if (charPos > 0) {
9226
+ var lastIdx = Math.min(startIdx + charPos - 1, enabled.length - 1);
9227
+ enabled[lastIdx].focus();
9228
+ enabled[lastIdx].select();
9229
+ }
9230
+ this._syncFromDom(startCellIndex);
7894
9231
  };
7895
- KTModal.prototype.getTargetElement = function () {
7896
- return this._targetElement;
9232
+ KTPinInput.prototype.getValue = function () {
9233
+ return this._cells.map(function (c) { return (c.disabled ? '' : c.value || ''); }).join('');
7897
9234
  };
7898
- KTModal.prototype.isOpen = function () {
7899
- return this._isOpen;
9235
+ KTPinInput.prototype.setValue = function (value) {
9236
+ var _a;
9237
+ var enabled = this._enabledCells();
9238
+ var filtered = this._filterString(typeof value === 'string' ? value : '');
9239
+ for (var i = 0; i < enabled.length; i++) {
9240
+ enabled[i].value = (_a = filtered[i]) !== null && _a !== void 0 ? _a : '';
9241
+ }
9242
+ this._syncFromDom(0);
9243
+ };
9244
+ KTPinInput.prototype.dispose = function () {
9245
+ var el = this._element;
9246
+ if (el) {
9247
+ el.removeEventListener('keydown', this._onKeydownBound, true);
9248
+ el.removeEventListener('beforeinput', this._onBeforeInputBound, true);
9249
+ el.removeEventListener('input', this._onInputBound, true);
9250
+ el.removeEventListener('paste', this._onPasteBound, true);
9251
+ }
9252
+ this._cells = [];
9253
+ this._hiddenInput = null;
9254
+ this._charRegex = null;
9255
+ _super.prototype.dispose.call(this);
7900
9256
  };
7901
- KTModal.getInstance = function (element) {
7902
- if (!element)
9257
+ KTPinInput.getInstance = function (element) {
9258
+ if (!element) {
7903
9259
  return null;
7904
- if (data_1.default.has(element, 'modal')) {
7905
- return data_1.default.get(element, 'modal');
7906
9260
  }
7907
- if (element.getAttribute('data-kt-modal')) {
7908
- return new KTModal(element);
9261
+ if (data_1.default.has(element, 'pin-input')) {
9262
+ return data_1.default.get(element, 'pin-input');
7909
9263
  }
7910
9264
  return null;
7911
9265
  };
7912
- KTModal.getOrCreateInstance = function (element, config) {
7913
- return this.getInstance(element) || new KTModal(element, config);
7914
- };
7915
- KTModal.hide = function () {
7916
- var elements = document.querySelectorAll('[data-kt-modal-initialized]');
7917
- elements.forEach(function (element) {
7918
- var modal = KTModal.getInstance(element);
7919
- if (modal && modal.isOpen()) {
7920
- modal.hide();
7921
- }
7922
- });
7923
- };
7924
- KTModal.handleToggle = function () {
7925
- event_handler_1.default.on(document.body, '[data-kt-modal-toggle]', 'click', function (event, target) {
7926
- event.stopPropagation();
7927
- var selector = target.getAttribute('data-kt-modal-toggle');
7928
- if (!selector)
7929
- return;
7930
- var modalElement = document.querySelector(selector);
7931
- var modal = KTModal.getInstance(modalElement);
7932
- if (modal) {
7933
- modal.toggle(target);
7934
- }
7935
- });
7936
- };
7937
- KTModal.handleDismiss = function () {
7938
- event_handler_1.default.on(document.body, '[data-kt-modal-dismiss]', 'click', function (event, target) {
7939
- event.stopPropagation();
7940
- var modalElement = target.closest('[data-kt-modal-initialized]');
7941
- if (modalElement) {
7942
- var modal = KTModal.getInstance(modalElement);
7943
- if (modal) {
7944
- modal.hide();
7945
- }
7946
- }
7947
- });
7948
- };
7949
- KTModal.handleClickAway = function () {
7950
- document.addEventListener('click', function (event) {
7951
- var modalElement = document.querySelector('.open[data-kt-modal-initialized]');
7952
- if (!modalElement)
7953
- return;
7954
- var modal = KTModal.getInstance(modalElement);
7955
- if (!modal)
7956
- return;
7957
- if (utils_1.default.stringToBoolean(modal.getOption('persistent')) === true)
7958
- return;
7959
- if (utils_1.default.stringToBoolean(modal.getOption('backdrop')) === true)
7960
- return;
7961
- if (modalElement !== event.target &&
7962
- modal.getTargetElement() !== event.target &&
7963
- modalElement.contains(event.target) === false) {
7964
- modal.hide();
7965
- }
7966
- });
9266
+ KTPinInput.getOrCreateInstance = function (element, config) {
9267
+ var existing = this.getInstance(element);
9268
+ if (existing) {
9269
+ return existing;
9270
+ }
9271
+ if (this.collectItems(element).length === 0) {
9272
+ return null;
9273
+ }
9274
+ new KTPinInput(element, config !== null && config !== void 0 ? config : undefined);
9275
+ return this.getInstance(element);
7967
9276
  };
7968
- KTModal.handleKeyword = function () {
7969
- document.addEventListener('keydown', function (event) {
7970
- var modalElement = document.querySelector('.open[data-kt-modal-initialized]');
7971
- var modal = KTModal.getInstance(modalElement);
7972
- if (!modal) {
7973
- return;
7974
- }
7975
- // if esc key was not pressed in combination with ctrl or alt or shift
7976
- if (event.key === 'Escape' &&
7977
- !(event.ctrlKey || event.altKey || event.shiftKey)) {
7978
- modal.hide();
7979
- }
7980
- if (event.code === 'Tab' && !event.metaKey) {
9277
+ KTPinInput.createInstances = function () {
9278
+ document
9279
+ .querySelectorAll('[data-kt-pin-input]')
9280
+ .forEach(function (el) {
9281
+ if (el.getAttribute('data-kt-pin-input-lazy') === 'true') {
7981
9282
  return;
7982
9283
  }
9284
+ new KTPinInput(el);
7983
9285
  });
7984
9286
  };
7985
- KTModal.createInstances = function () {
7986
- var elements = document.querySelectorAll('[data-kt-modal]');
7987
- elements.forEach(function (element) {
7988
- new KTModal(element);
7989
- });
7990
- };
7991
- KTModal.init = function () {
7992
- KTModal.createInstances();
7993
- if (window.KT_MODAL_INITIALIZED !== true) {
7994
- KTModal.handleToggle();
7995
- KTModal.handleDismiss();
7996
- KTModal.handleClickAway();
7997
- KTModal.handleKeyword();
7998
- window.KT_MODAL_INITIALIZED = true;
7999
- }
9287
+ KTPinInput.init = function () {
9288
+ KTPinInput.createInstances();
8000
9289
  };
8001
- return KTModal;
9290
+ return KTPinInput;
8002
9291
  }(component_1.default));
8003
- exports.KTModal = KTModal;
9292
+ exports.KTPinInput = KTPinInput;
8004
9293
  if (typeof window !== 'undefined') {
8005
- window.KTModal = KTModal;
9294
+ window.KTPinInput = KTPinInput;
8006
9295
  }
8007
9296
 
8008
9297
 
@@ -9556,6 +10845,7 @@ var templates_1 = __webpack_require__(/*! ./templates */ "./src/components/selec
9556
10845
  var KTSelectCombobox = /** @class */ (function () {
9557
10846
  function KTSelectCombobox(select) {
9558
10847
  var _this = this;
10848
+ var _a;
9559
10849
  this._select = select;
9560
10850
  this._config = select.getConfig();
9561
10851
  var displayElement = select.getDisplayElement(); // KTSelect's main display element for combobox
@@ -9565,7 +10855,8 @@ var KTSelectCombobox = /** @class */ (function () {
9565
10855
  this._boundInputHandler = this._handleComboboxInput.bind(this);
9566
10856
  this._boundClearHandler = this._handleClearButtonClick.bind(this);
9567
10857
  this._attachEventListeners();
9568
- this._select.getElement().addEventListener('dropdown.close', function () {
10858
+ (_a = this._select.getElement()) === null || _a === void 0 ? void 0 : _a.addEventListener('dropdown.close', function () {
10859
+ var _a, _b;
9569
10860
  // When dropdown closes, if not multi-select and not using displayTemplate,
9570
10861
  // ensure input shows the selected value or placeholder.
9571
10862
  if (!_this._config.multiple && !_this._config.displayTemplate) {
@@ -9573,9 +10864,11 @@ var KTSelectCombobox = /** @class */ (function () {
9573
10864
  }
9574
10865
  else {
9575
10866
  // For tags or displayTemplate, the input should be clear for typing.
9576
- _this._searchInputElement.value = '';
10867
+ if (_this._searchInputElement) {
10868
+ _this._searchInputElement.value = '';
10869
+ }
9577
10870
  }
9578
- _this._toggleClearButtonVisibility(_this._searchInputElement.value);
10871
+ _this._toggleClearButtonVisibility((_b = (_a = _this._searchInputElement) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '');
9579
10872
  // this._select.showAllOptions(); // showAllOptions might be too broad, filtering is managed by typing.
9580
10873
  });
9581
10874
  }
@@ -9630,8 +10923,11 @@ var KTSelectCombobox = /** @class */ (function () {
9630
10923
  * Handle clear button click
9631
10924
  */
9632
10925
  KTSelectCombobox.prototype._handleClearButtonClick = function (event) {
10926
+ var _a;
9633
10927
  event.preventDefault();
9634
10928
  event.stopPropagation();
10929
+ if (!this._searchInputElement)
10930
+ return;
9635
10931
  this._searchInputElement.value = '';
9636
10932
  this._toggleClearButtonVisibility('');
9637
10933
  if (this._valuesContainerElement) {
@@ -9640,7 +10936,7 @@ var KTSelectCombobox = /** @class */ (function () {
9640
10936
  this._select.clearSelection(); // This will also trigger updateSelectedOptionDisplay
9641
10937
  this._select.showAllOptions(); // Show all options after clearing
9642
10938
  this._select.openDropdown();
9643
- this._searchInputElement.focus();
10939
+ (_a = this._searchInputElement) === null || _a === void 0 ? void 0 : _a.focus();
9644
10940
  };
9645
10941
  /**
9646
10942
  * Toggle clear button visibility based on input value and selection state.
@@ -9671,13 +10967,15 @@ var KTSelectCombobox = /** @class */ (function () {
9671
10967
  // or the main FocusManager should adjust focus if needed.
9672
10968
  // For combobox, this filtering is the primary search mechanism.
9673
10969
  // We might need to tell select's focus manager to focus first option.
9674
- this._select._focusManager.focusFirst(); // Consider if this is always right
10970
+ var focusManager = this._select._focusManager;
10971
+ focusManager === null || focusManager === void 0 ? void 0 : focusManager.focusFirst();
9675
10972
  };
9676
10973
  /**
9677
10974
  * Updates the combobox display (input field or values container) based on selection.
9678
10975
  */
9679
10976
  KTSelectCombobox.prototype.updateDisplay = function (selectedOptions) {
9680
10977
  var _this = this;
10978
+ var _a;
9681
10979
  if (!this._searchInputElement)
9682
10980
  return;
9683
10981
  // Always clear the values container first if it exists
@@ -9685,15 +10983,17 @@ var KTSelectCombobox = /** @class */ (function () {
9685
10983
  this._valuesContainerElement.innerHTML = '';
9686
10984
  }
9687
10985
  if (this._config.tags && this._valuesContainerElement) {
10986
+ var valuesContainer_1 = this._valuesContainerElement;
10987
+ var selectElement_1 = this._select.getElement();
10988
+ if (!selectElement_1)
10989
+ return;
9688
10990
  // Combobox + Tags
9689
10991
  selectedOptions.forEach(function (value) {
9690
10992
  // Ensure value is properly escaped for querySelector
9691
- var optionElement = _this._select
9692
- .getElement()
9693
- .querySelector("option[value=\"".concat(CSS.escape(value), "\"]"));
10993
+ var optionElement = selectElement_1.querySelector("option[value=\"".concat(CSS.escape(value), "\"]"));
9694
10994
  if (optionElement) {
9695
10995
  var tagElement = templates_1.defaultTemplates.tag(optionElement, _this._config);
9696
- _this._valuesContainerElement.appendChild(tagElement);
10996
+ valuesContainer_1.appendChild(tagElement);
9697
10997
  }
9698
10998
  });
9699
10999
  this._searchInputElement.value = ''; // Input field is for typing new searches
@@ -9717,9 +11017,9 @@ var KTSelectCombobox = /** @class */ (function () {
9717
11017
  // For simplicity, join text. A proper tag implementation would be more complex here.
9718
11018
  this._valuesContainerElement.innerHTML = selectedOptions
9719
11019
  .map(function (value) {
9720
- var optionEl = _this._select
9721
- .getElement()
9722
- .querySelector("option[value=\"".concat(CSS.escape(value), "\"]"));
11020
+ var _a;
11021
+ var optionEl = (_a = _this._select
11022
+ .getElement()) === null || _a === void 0 ? void 0 : _a.querySelector("option[value=\"".concat(CSS.escape(value), "\"]"));
9723
11023
  return optionEl ? optionEl.textContent : '';
9724
11024
  })
9725
11025
  .join(', '); // Basic comma separation
@@ -9732,9 +11032,8 @@ var KTSelectCombobox = /** @class */ (function () {
9732
11032
  else if (!this._config.multiple && selectedOptions.length > 0) {
9733
11033
  // Single select combobox: display selected option's text in the input
9734
11034
  var selectedValue = selectedOptions[0];
9735
- var optionElement = this._select
9736
- .getElement()
9737
- .querySelector("option[value=\"".concat(CSS.escape(selectedValue), "\"]"));
11035
+ var optionElement = (_a = this._select
11036
+ .getElement()) === null || _a === void 0 ? void 0 : _a.querySelector("option[value=\"".concat(CSS.escape(selectedValue), "\"]"));
9738
11037
  this._searchInputElement.value = optionElement
9739
11038
  ? optionElement.textContent || ''
9740
11039
  : '';
@@ -9804,15 +11103,15 @@ exports.DefaultConfig = {
9804
11103
  // Data Handling
9805
11104
  items: [], // Static list of options
9806
11105
  isLoading: false, // Indicates if options are being loaded asynchronously
9807
- onFetch: null, // Callback function to fetch options asynchronously
11106
+ onFetch: undefined, // Callback function to fetch options asynchronously
9808
11107
  // Remote Data Configuration
9809
11108
  remote: false, // Enable/disable remote data fetching
9810
- dataUrl: null, // URL to fetch options from
9811
- apiDataProperty: null, // Property in the response object that contains the options
11109
+ dataUrl: undefined, // URL to fetch options from
11110
+ apiDataProperty: undefined, // Property in the response object that contains the options
9812
11111
  remoteErrorMessage: 'Failed to load data', // Error message to display if remote data fetch fails
9813
11112
  // Field Mapping
9814
- dataValueField: null, // Property in the option object that contains the value (default: 'id')
9815
- dataFieldText: null, // Property in the option object that contains the text (default: 'title')
11113
+ dataValueField: undefined, // Property in the option object that contains the value (default: 'id')
11114
+ dataFieldText: undefined, // Property in the option object that contains the text (default: 'title')
9816
11115
  // Search Configuration
9817
11116
  searchParam: '', // Query parameter for API search requests
9818
11117
  searchDebounce: 300, // Debounce delay for search (in ms)
@@ -9842,17 +11141,17 @@ exports.DefaultConfig = {
9842
11141
  clearAllText: 'Clear all', // Text for the "Clear All" option (if implemented)
9843
11142
  enableSelectAll: false, // Enable/disable "Select All" button for multi-select
9844
11143
  showSelectedCount: true, // Show the number of selected options in multi-select mode
9845
- renderSelected: null, // Custom function to render the selected value(s) in the display area
11144
+ renderSelected: undefined, // Custom function to render the selected value(s) in the display area
9846
11145
  // Accessibility & Usability
9847
11146
  label: 'Select an option', // Label for the select component (for screen readers)
9848
11147
  height: 250, // Maximum height of the dropdown menu in pixels (if exceeded, a scrollbar will appear)
9849
11148
  // Dropdown Configuration
9850
11149
  dropdownZindex: 105, // Initial z-index value for the dropdown
9851
11150
  dropdownContainer: null, // Container element for the dropdown
9852
- dropdownPlacement: null,
11151
+ dropdownPlacement: undefined,
9853
11152
  dropdownFlip: false,
9854
11153
  dropdownPreventOverflow: false,
9855
- dropdownStrategy: null,
11154
+ dropdownStrategy: undefined,
9856
11155
  dropdownWidth: null, // Custom width for dropdown (e.g., '300px'), null to match toggle element width
9857
11156
  closeOnOtherOpen: true, // Close other open dropdowns when this one opens
9858
11157
  dispatchGlobalEvents: true, // Dispatch events on document for global listeners (jQuery compatibility)
@@ -9865,7 +11164,8 @@ var KTSelectState = /** @class */ (function () {
9865
11164
  this._config = this._initDefaultConfig(config);
9866
11165
  }
9867
11166
  KTSelectState.prototype._initDefaultConfig = function (config) {
9868
- return __assign(__assign(__assign({}, exports.DefaultConfig), config), config.config);
11167
+ var resolvedConfig = config !== null && config !== void 0 ? config : {};
11168
+ return __assign(__assign(__assign({}, exports.DefaultConfig), resolvedConfig), resolvedConfig.config);
9869
11169
  };
9870
11170
  KTSelectState.prototype.setItems = function (items, query) {
9871
11171
  var _this = this;
@@ -10482,10 +11782,13 @@ var KTSelectOption = /** @class */ (function (_super) {
10482
11782
  _this._dataOptionPrefix = 'kt-'; // Use 'kt-' prefix to support data-kt-select-option attributes
10483
11783
  // Always initialize a new option instance
10484
11784
  _this._init(element);
10485
- _this._globalConfig = config;
11785
+ _this._globalConfig = (config !== null && config !== void 0 ? config : {});
10486
11786
  _this._buildConfig();
10487
11787
  // Clean the config
10488
- _this._config = _this._config[''] || {};
11788
+ var configRecord = _this._config;
11789
+ _this._config =
11790
+ configRecord[''] ||
11791
+ {};
10489
11792
  // Add the option config to the global config
10490
11793
  // Ensure optionsConfig is initialized
10491
11794
  if (_this._globalConfig) {
@@ -10502,9 +11805,12 @@ var KTSelectOption = /** @class */ (function (_super) {
10502
11805
  }
10503
11806
  // Don't store in KTData to avoid Singleton pattern issues
10504
11807
  // Each option should be a unique instance
10505
- element.instance = _this;
11808
+ _this._elementWithInstance().instance = _this;
10506
11809
  return _this;
10507
11810
  }
11811
+ KTSelectOption.prototype._elementWithInstance = function () {
11812
+ return this._element;
11813
+ };
10508
11814
  Object.defineProperty(KTSelectOption.prototype, "id", {
10509
11815
  get: function () {
10510
11816
  return this.getHTMLOptionElement().value;
@@ -10582,6 +11888,9 @@ var KTSelectRemote = /** @class */ (function () {
10582
11888
  this._config = config;
10583
11889
  this._element = element || null;
10584
11890
  }
11891
+ KTSelectRemote.prototype._isRecord = function (value) {
11892
+ return typeof value === 'object' && value !== null;
11893
+ };
10585
11894
  /**
10586
11895
  * Fetch data from remote URL
10587
11896
  * @param query Optional search query
@@ -10684,18 +11993,21 @@ var KTSelectRemote = /** @class */ (function () {
10684
11993
  var _this = this;
10685
11994
  try {
10686
11995
  var processedData = data;
11996
+ var dataRecord = this._isRecord(data) ? data : null;
10687
11997
  // Extract data from the API property if specified
10688
- if (this._config.apiDataProperty && data[this._config.apiDataProperty]) {
11998
+ if (this._config.apiDataProperty &&
11999
+ dataRecord &&
12000
+ this._config.apiDataProperty in dataRecord) {
10689
12001
  // If pagination metadata is available, extract it
10690
12002
  if (this._config.pagination) {
10691
- if (data.total_pages) {
10692
- this._totalPages = data.total_pages;
12003
+ if (typeof dataRecord.total_pages === 'number') {
12004
+ this._totalPages = dataRecord.total_pages;
10693
12005
  }
10694
- if (data.total) {
10695
- this._totalPages = Math.ceil(data.total / (this._config.paginationLimit || 10));
12006
+ if (typeof dataRecord.total === 'number') {
12007
+ this._totalPages = Math.ceil(dataRecord.total / (this._config.paginationLimit || 10));
10696
12008
  }
10697
12009
  }
10698
- processedData = data[this._config.apiDataProperty];
12010
+ processedData = dataRecord[this._config.apiDataProperty];
10699
12011
  }
10700
12012
  // Ensure data is an array
10701
12013
  if (!Array.isArray(processedData)) {
@@ -10778,13 +12090,14 @@ var KTSelectRemote = /** @class */ (function () {
10778
12090
  };
10779
12091
  // Get ID and ensure it's a string
10780
12092
  var id = getValue(item, valueField);
12093
+ var itemRecord = this._isRecord(item) ? item : {};
10781
12094
  if (id === null || id === undefined) {
10782
12095
  // Try common fallback fields for ID
10783
12096
  var fallbackFields = ['id', 'value', 'key', 'pk'];
10784
12097
  for (var _i = 0, fallbackFields_1 = fallbackFields; _i < fallbackFields_1.length; _i++) {
10785
12098
  var field = fallbackFields_1[_i];
10786
- if (item[field] !== null && item[field] !== undefined) {
10787
- id = String(item[field]);
12099
+ if (itemRecord[field] !== null && itemRecord[field] !== undefined) {
12100
+ id = String(itemRecord[field]);
10788
12101
  break;
10789
12102
  }
10790
12103
  }
@@ -10810,8 +12123,8 @@ var KTSelectRemote = /** @class */ (function () {
10810
12123
  ];
10811
12124
  for (var _a = 0, fallbackFields_2 = fallbackFields; _a < fallbackFields_2.length; _a++) {
10812
12125
  var field = fallbackFields_2[_a];
10813
- if (item[field] !== null && item[field] !== undefined) {
10814
- title = String(item[field]);
12126
+ if (itemRecord[field] !== null && itemRecord[field] !== undefined) {
12127
+ title = String(itemRecord[field]);
10815
12128
  break;
10816
12129
  }
10817
12130
  }
@@ -10825,10 +12138,10 @@ var KTSelectRemote = /** @class */ (function () {
10825
12138
  }
10826
12139
  // Create the option object with consistent structure
10827
12140
  var result = {
10828
- id: id,
10829
- title: title,
10830
- selected: Boolean(item.selected),
10831
- disabled: Boolean(item.disabled),
12141
+ id: String(id),
12142
+ title: String(title),
12143
+ selected: Boolean(itemRecord.selected),
12144
+ disabled: Boolean(itemRecord.disabled),
10832
12145
  };
10833
12146
  return result;
10834
12147
  };
@@ -10924,6 +12237,7 @@ var KTSelectSearch = /** @class */ (function () {
10924
12237
  }
10925
12238
  KTSelectSearch.prototype.init = function () {
10926
12239
  var _this = this;
12240
+ var _a, _b, _c, _d, _e;
10927
12241
  if (this._select.getConfig().enableSearch) {
10928
12242
  this._searchInput = this._select.getSearchInput();
10929
12243
  if (this._searchInput) {
@@ -10937,7 +12251,8 @@ var KTSelectSearch = /** @class */ (function () {
10937
12251
  this._eventManager.addListener(this._searchInput, 'blur', function () {
10938
12252
  // Small delay to prevent race conditions with selection
10939
12253
  setTimeout(function () {
10940
- if (!_this._searchInput.value) {
12254
+ var _a;
12255
+ if (!((_a = _this._searchInput) === null || _a === void 0 ? void 0 : _a.value)) {
10941
12256
  _this._resetAllOptions();
10942
12257
  _this.clearSearch();
10943
12258
  }
@@ -10946,21 +12261,19 @@ var KTSelectSearch = /** @class */ (function () {
10946
12261
  // Listen for remote search events to coordinate with remote search functionality
10947
12262
  if (this._select.getConfig().remote &&
10948
12263
  this._select.getConfig().searchParam) {
10949
- this._select
10950
- .getElement()
10951
- .addEventListener('remoteSearchStart', function () {
12264
+ (_a = this._select
12265
+ .getElement()) === null || _a === void 0 ? void 0 : _a.addEventListener('remoteSearchStart', function () {
10952
12266
  // Reset focused option when remote search starts
10953
12267
  _this._focusManager.resetFocus();
10954
12268
  });
10955
- this._select.getElement().addEventListener('remoteSearchEnd', function () {
12269
+ (_b = this._select.getElement()) === null || _b === void 0 ? void 0 : _b.addEventListener('remoteSearchEnd', function () {
10956
12270
  // After remote search completes, refresh our option cache
10957
12271
  _this.refreshOptionCache();
10958
12272
  });
10959
12273
  }
10960
12274
  // Listen for dropdown close to reset options - ATTACH TO WRAPPER
10961
- this._select
10962
- .getWrapperElement()
10963
- .addEventListener('dropdown.close', function () {
12275
+ (_c = this._select
12276
+ .getWrapperElement()) === null || _c === void 0 ? void 0 : _c.addEventListener('dropdown.close', function () {
10964
12277
  _this._focusManager.resetFocus();
10965
12278
  var config = _this._select.getConfig();
10966
12279
  // Clear highlights from current options (always do this)
@@ -10968,7 +12281,9 @@ var KTSelectSearch = /** @class */ (function () {
10968
12281
  // Respect clearSearchOnClose config option
10969
12282
  if (config.clearSearchOnClose) {
10970
12283
  // Clear the search input field
10971
- _this._searchInput.value = '';
12284
+ if (_this._searchInput) {
12285
+ _this._searchInput.value = '';
12286
+ }
10972
12287
  // Reset all options to their original state
10973
12288
  _this._resetAllOptions();
10974
12289
  // Clear any "no results" message
@@ -10986,7 +12301,7 @@ var KTSelectSearch = /** @class */ (function () {
10986
12301
  }
10987
12302
  });
10988
12303
  // Clear highlights when an option is selected - ATTACH TO ORIGINAL SELECT (standard 'change' event)
10989
- this._select.getElement().addEventListener('change', function () {
12304
+ (_d = this._select.getElement()) === null || _d === void 0 ? void 0 : _d.addEventListener('change', function () {
10990
12305
  _this.clearSearch();
10991
12306
  // Close dropdown only for single select mode, and only if closeOnEnter is not false
10992
12307
  // Keep dropdown open for multiple select mode to allow additional selections
@@ -10997,9 +12312,8 @@ var KTSelectSearch = /** @class */ (function () {
10997
12312
  }
10998
12313
  });
10999
12314
  // Consolidated 'dropdown.show' event listener - ATTACH TO WRAPPER
11000
- this._select
11001
- .getWrapperElement()
11002
- .addEventListener('dropdown.show', function () {
12315
+ (_e = this._select
12316
+ .getWrapperElement()) === null || _e === void 0 ? void 0 : _e.addEventListener('dropdown.show', function () {
11003
12317
  var _a;
11004
12318
  _this._focusManager.resetFocus(); // Always clear previous focus state
11005
12319
  if ((_a = _this._searchInput) === null || _a === void 0 ? void 0 : _a.value) {
@@ -11067,7 +12381,7 @@ var KTSelectSearch = /** @class */ (function () {
11067
12381
  _this._focusSearchInputWithRetry(attempt + 1);
11068
12382
  }
11069
12383
  }
11070
- catch (error) {
12384
+ catch (_b) {
11071
12385
  // Focus failed with error, retry if we haven't exceeded max attempts
11072
12386
  if (attempt < maxAttempts) {
11073
12387
  _this._focusSearchInputWithRetry(attempt + 1);
@@ -11087,23 +12401,24 @@ var KTSelectSearch = /** @class */ (function () {
11087
12401
  KTSelectSearch.prototype._handleSearchKeyDown = function (event) {
11088
12402
  var _this = this;
11089
12403
  var _a;
11090
- var key = event.key;
12404
+ var keyEvent = event;
12405
+ var key = keyEvent.key;
11091
12406
  switch (key) {
11092
12407
  case ' ': // Spacebar
11093
12408
  // Do nothing, allow space to be typed into the input
11094
12409
  // Stop propagation to prevent parent handlers from processing this event
11095
- event.stopPropagation();
12410
+ keyEvent.stopPropagation();
11096
12411
  break;
11097
12412
  case 'ArrowDown':
11098
- event.preventDefault();
12413
+ keyEvent.preventDefault();
11099
12414
  this._focusManager.focusNext();
11100
12415
  break;
11101
12416
  case 'ArrowUp':
11102
- event.preventDefault();
12417
+ keyEvent.preventDefault();
11103
12418
  this._focusManager.focusPrevious();
11104
12419
  break;
11105
- case 'Enter':
11106
- event.preventDefault();
12420
+ case 'Enter': {
12421
+ keyEvent.preventDefault();
11107
12422
  // Use currently focused option (from arrow keys); only fall back to first if none focused
11108
12423
  var optionToSelect = (_a = this._focusManager.getFocusedOption()) !== null && _a !== void 0 ? _a : this._focusManager.focusFirst();
11109
12424
  if (optionToSelect) {
@@ -11129,9 +12444,12 @@ var KTSelectSearch = /** @class */ (function () {
11129
12444
  }
11130
12445
  }
11131
12446
  break;
12447
+ }
11132
12448
  case 'Escape':
11133
- event.preventDefault();
11134
- this._searchInput.value = '';
12449
+ keyEvent.preventDefault();
12450
+ if (this._searchInput) {
12451
+ this._searchInput.value = '';
12452
+ }
11135
12453
  this.clearSearch();
11136
12454
  this._resetAllOptions();
11137
12455
  this._clearNoResultsMessage();
@@ -11179,6 +12497,7 @@ var KTSelectSearch = /** @class */ (function () {
11179
12497
  });
11180
12498
  };
11181
12499
  KTSelectSearch.prototype._handleSearchInput = function (event) {
12500
+ var _a;
11182
12501
  var query = event.target.value;
11183
12502
  var config = this._select.getConfig();
11184
12503
  // Reset focused option when search changes
@@ -11192,8 +12511,9 @@ var KTSelectSearch = /** @class */ (function () {
11192
12511
  }
11193
12512
  // For remote search, KTSelect component handles it.
11194
12513
  // KTSelect will call refreshAfterSearch on this module when remote data is updated.
12514
+ var minLength = (_a = config.searchMinLength) !== null && _a !== void 0 ? _a : 0;
11195
12515
  if (config.remote && config.searchParam) {
11196
- if (query.length < config.searchMinLength) {
12516
+ if (query.length < minLength) {
11197
12517
  this._resetAllOptions();
11198
12518
  this._clearNoResultsMessage();
11199
12519
  this._focusManager.focusFirst(); // Focus first if query too short
@@ -11201,7 +12521,7 @@ var KTSelectSearch = /** @class */ (function () {
11201
12521
  return;
11202
12522
  }
11203
12523
  // For local search
11204
- if (query.length >= config.searchMinLength) {
12524
+ if (query.length >= minLength) {
11205
12525
  this._filterOptions(query);
11206
12526
  this._focusManager.focusFirst(); // Focus first visible option after local filtering
11207
12527
  }
@@ -11222,7 +12542,9 @@ var KTSelectSearch = /** @class */ (function () {
11222
12542
  }
11223
12543
  // Restore original content before filtering, so highlighting is applied fresh.
11224
12544
  this._restoreOptionContentsBeforeFilter();
11225
- var visibleCount = (0, utils_1.filterOptions)(options, query, config, dropdownElement, function (count) { return _this._handleNoResults(count); });
12545
+ (0, utils_1.filterOptions)(options, query, config, dropdownElement, function (count) {
12546
+ return _this._handleNoResults(count);
12547
+ });
11226
12548
  this._select.updateSelectAllButtonState();
11227
12549
  };
11228
12550
  /**
@@ -11444,7 +12766,7 @@ var KTSelect = /** @class */ (function (_super) {
11444
12766
  _this._buildConfig(config);
11445
12767
  _this._state = new config_1.KTSelectState(_this._config);
11446
12768
  _this._config = _this._state.getConfig();
11447
- element.instance = _this;
12769
+ _this._element.instance = _this;
11448
12770
  // Initialize event manager
11449
12771
  _this._eventManager = new utils_1.EventManager();
11450
12772
  // Initialize remote module if remote data is enabled
@@ -11487,7 +12809,6 @@ var KTSelect = /** @class */ (function (_super) {
11487
12809
  if (config === void 0) { config = {}; }
11488
12810
  if (!this._element)
11489
12811
  return;
11490
- // Cast to writable to allow assignment (config is readonly but needs initialization)
11491
12812
  this._config = __assign(__assign(__assign(__assign(__assign({}, this._defaultConfig), KTSelect.globalConfig), this._getGlobalConfig()), dom_1.default.getDataAttributes(this._element, this._dataOptionPrefix + this._name)), config);
11492
12813
  };
11493
12814
  /**
@@ -11525,6 +12846,9 @@ var KTSelect = /** @class */ (function (_super) {
11525
12846
  document.dispatchEvent(namespacedEvent);
11526
12847
  }
11527
12848
  };
12849
+ KTSelect.prototype.getElement = function () {
12850
+ return this._element;
12851
+ };
11528
12852
  /**
11529
12853
  * Initialize remote data fetching
11530
12854
  */
@@ -11723,6 +13047,7 @@ var KTSelect = /** @class */ (function (_super) {
11723
13047
  * Helper to show a dropdown message (error, loading, noResults)
11724
13048
  */
11725
13049
  KTSelect.prototype._showDropdownMessage = function (type, message) {
13050
+ var _a;
11726
13051
  if (!this._dropdownContentElement)
11727
13052
  return;
11728
13053
  var optionsContainer = this._dropdownContentElement.querySelector('[data-kt-select-options]');
@@ -11732,7 +13057,7 @@ var KTSelect = /** @class */ (function (_super) {
11732
13057
  optionsContainer.innerHTML = '';
11733
13058
  switch (type) {
11734
13059
  case 'error':
11735
- optionsContainer.appendChild(templates_1.defaultTemplates.error(__assign(__assign({}, this._config), { errorMessage: message })));
13060
+ optionsContainer.appendChild(templates_1.defaultTemplates.error(__assign(__assign({}, this._config), { errorMessage: (_a = message !== null && message !== void 0 ? message : this._config.remoteErrorMessage) !== null && _a !== void 0 ? _a : 'Failed to load data' })));
11736
13061
  break;
11737
13062
  case 'loading':
11738
13063
  optionsContainer.appendChild(templates_1.defaultTemplates.loading(this._config, message || 'Loading...'));
@@ -11927,6 +13252,7 @@ var KTSelect = /** @class */ (function (_super) {
11927
13252
  KTSelect.prototype._createHtmlStructure = function () {
11928
13253
  var _a, _b;
11929
13254
  var _this = this;
13255
+ var _c;
11930
13256
  var options = Array.from(this._element.querySelectorAll('option'));
11931
13257
  // Create wrapper and display elements
11932
13258
  var wrapperElement = templates_1.defaultTemplates.wrapper(this._config);
@@ -11955,7 +13281,7 @@ var KTSelect = /** @class */ (function (_super) {
11955
13281
  this._element.className = ''; // Clear classes from original select element
11956
13282
  }
11957
13283
  // Create an empty dropdown first (without options) using template
11958
- var dropdownElement = templates_1.defaultTemplates.dropdown(__assign(__assign({}, this._config), { zindex: this._config.dropdownZindex }));
13284
+ var dropdownElement = templates_1.defaultTemplates.dropdown(__assign(__assign({}, this._config), { zindex: (_c = this._config.dropdownZindex) !== null && _c !== void 0 ? _c : undefined }));
11959
13285
  // Add search input if needed
11960
13286
  if (this._config.enableSearch) {
11961
13287
  var searchElement = templates_1.defaultTemplates.search(this._config);
@@ -12130,9 +13456,14 @@ var KTSelect = /** @class */ (function (_super) {
12130
13456
  if (!key || !obj)
12131
13457
  return null;
12132
13458
  // Use reduce to walk through the object by splitting the key on dots
12133
- var result = key
12134
- .split('.')
12135
- .reduce(function (o, k) { return (o && o[k] !== undefined ? o[k] : null); }, obj);
13459
+ var result = key.split('.').reduce(function (o, k) {
13460
+ if (o &&
13461
+ typeof o === 'object' &&
13462
+ o[k] !== undefined) {
13463
+ return o[k];
13464
+ }
13465
+ return null;
13466
+ }, obj);
12136
13467
  return result;
12137
13468
  };
12138
13469
  /**
@@ -12375,7 +13706,7 @@ var KTSelect = /** @class */ (function (_super) {
12375
13706
  var valueDisplayEl = this.getValueDisplayElement();
12376
13707
  // Sync native select value for FormData support
12377
13708
  this._syncNativeSelectValue();
12378
- if (tagsEnabled) {
13709
+ if (this._config.tags && this._tagsModule) {
12379
13710
  // Tags module will render tags if selectedOptions > 0, or clear them if selectedOptions === 0.
12380
13711
  this._tagsModule.updateTagsDisplay(selectedOptions);
12381
13712
  }
@@ -12551,21 +13882,9 @@ var KTSelect = /** @class */ (function (_super) {
12551
13882
  * Select the currently focused option
12552
13883
  */
12553
13884
  KTSelect.prototype.selectFocusedOption = function () {
12554
- var _a, _b;
12555
13885
  var focusedOption = this._focusManager.getFocusedOption();
12556
13886
  if (focusedOption) {
12557
13887
  var selectedValue = focusedOption.dataset.value;
12558
- // Extract just the title text, not including description
12559
- var selectedText = '';
12560
- var titleElement = focusedOption.querySelector('[data-kt-option-title]');
12561
- if (titleElement) {
12562
- // If it has a structured content with title element
12563
- selectedText = ((_a = titleElement.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '';
12564
- }
12565
- else {
12566
- // Fallback to the whole text content
12567
- selectedText = ((_b = focusedOption.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '';
12568
- }
12569
13888
  // First trigger the selection to ensure state is updated properly
12570
13889
  if (selectedValue) {
12571
13890
  this._selectOption(selectedValue);
@@ -12691,13 +14010,12 @@ var KTSelect = /** @class */ (function (_super) {
12691
14010
  var options = Array.from(this._dropdownContentElement.querySelectorAll("[data-kt-select-option]"));
12692
14011
  // Show all options by removing the hidden class and any inline styles
12693
14012
  options.forEach(function (option) {
12694
- var _a;
12695
14013
  // Remove hidden class
12696
14014
  option.classList.remove('hidden');
12697
14015
  // Clean up any existing inline styles for backward compatibility
12698
14016
  if (option.hasAttribute('style')) {
12699
14017
  var styleAttr = option.getAttribute('style');
12700
- if (styleAttr.includes('display:')) {
14018
+ if (styleAttr && styleAttr.includes('display:')) {
12701
14019
  // If style only contains display property, remove the entire attribute
12702
14020
  if (styleAttr.trim() === 'display: none;' ||
12703
14021
  styleAttr.trim() === 'display: block;') {
@@ -12705,7 +14023,7 @@ var KTSelect = /** @class */ (function (_super) {
12705
14023
  }
12706
14024
  else {
12707
14025
  // Otherwise, remove just the display property
12708
- option.setAttribute('style', (_a = styleAttr === null || styleAttr === void 0 ? void 0 : styleAttr.replace(/display:\s*[^;]+;?/gi, '')) === null || _a === void 0 ? void 0 : _a.trim());
14026
+ option.setAttribute('style', styleAttr.replace(/display:\s*[^;]+;?/gi, '').trim());
12709
14027
  }
12710
14028
  }
12711
14029
  }
@@ -12810,7 +14128,7 @@ var KTSelect = /** @class */ (function (_super) {
12810
14128
  */
12811
14129
  KTSelect.prototype.dispose = function () {
12812
14130
  // Clean up event listeners
12813
- this._eventManager.removeAllListeners(null);
14131
+ this._eventManager.removeAllListeners(this._wrapperElement);
12814
14132
  // Dispose modules
12815
14133
  if (this._dropdownModule) {
12816
14134
  this._dropdownModule.dispose();
@@ -13344,7 +14662,6 @@ var KTSelect = /** @class */ (function (_super) {
13344
14662
  return;
13345
14663
  }
13346
14664
  var isOpen = this._dropdownIsOpen;
13347
- var config = this._config;
13348
14665
  var focusManager = this._focusManager;
13349
14666
  var buffer = this._typeToSearchBuffer;
13350
14667
  // If the event target is the search input, let it handle most typing keys naturally.
@@ -13470,7 +14787,7 @@ var KTSelect = /** @class */ (function (_super) {
13470
14787
  var option = Array.from(_this._options).find(function (opt) { return opt.getAttribute('data-value') === value; });
13471
14788
  if (!option)
13472
14789
  return '';
13473
- var displayTemplate = _this._config.displayTemplate;
14790
+ var displayTemplate = _this._config.displayTemplate || '{{text}}';
13474
14791
  var text = option.getAttribute('data-text') || '';
13475
14792
  // Replace all {{varname}} in option.innerHTML with values from _config
13476
14793
  Object.entries(optionsConfig[value] || {}).forEach(function (_a) {
@@ -13589,6 +14906,7 @@ var KTSelect = /** @class */ (function (_super) {
13589
14906
  this._fireEvent('change');
13590
14907
  };
13591
14908
  KTSelect.prototype.updateSelectAllButtonState = function () {
14909
+ var _a, _b;
13592
14910
  if (!this._config.multiple ||
13593
14911
  !this._config.enableSelectAll ||
13594
14912
  !this._selectAllButtonToggle) {
@@ -13597,18 +14915,22 @@ var KTSelect = /** @class */ (function (_super) {
13597
14915
  var visibleOptions = this._focusManager
13598
14916
  .getVisibleOptions()
13599
14917
  .filter(function (opt) { return opt.getAttribute('aria-disabled') !== 'true'; });
14918
+ var selectAllButton = this._selectAllButton;
14919
+ var selectAllButtonToggle = this._selectAllButtonToggle;
14920
+ if (!selectAllButton || !selectAllButtonToggle)
14921
+ return;
13600
14922
  if (visibleOptions.length === 0) {
13601
- this._selectAllButton.style.display = 'none';
14923
+ selectAllButton.style.display = 'none';
13602
14924
  return;
13603
14925
  }
13604
- this._selectAllButton.style.display = '';
14926
+ selectAllButton.style.display = '';
13605
14927
  var selectedValues = new Set(this.getSelectedOptions());
13606
14928
  var isAllSelected = visibleOptions.every(function (opt) {
13607
14929
  return selectedValues.has(opt.dataset.value);
13608
14930
  });
13609
- this._selectAllButtonToggle.textContent = isAllSelected
13610
- ? this._config.clearAllText
13611
- : this._config.selectAllText;
14931
+ selectAllButtonToggle.textContent = isAllSelected
14932
+ ? ((_a = this._config.clearAllText) !== null && _a !== void 0 ? _a : 'Clear all')
14933
+ : ((_b = this._config.selectAllText) !== null && _b !== void 0 ? _b : 'Select all');
13612
14934
  };
13613
14935
  /**
13614
14936
  * Destroy the component and clean up resources
@@ -13671,44 +14993,51 @@ var KTSelectTags = /** @class */ (function () {
13671
14993
  */
13672
14994
  KTSelectTags.prototype.updateTagsDisplay = function (selectedOptions) {
13673
14995
  var _this = this;
14996
+ if (!this._valueDisplayElement)
14997
+ return;
14998
+ var valueDisplayElement = this._valueDisplayElement;
13674
14999
  // Remove any existing tag elements
13675
- var wrapper = this._valueDisplayElement.parentElement;
15000
+ var wrapper = valueDisplayElement.parentElement;
13676
15001
  if (!wrapper)
13677
15002
  return;
13678
15003
  // If no options selected, ensure placeholder is shown
13679
15004
  if (selectedOptions.length === 0) {
13680
15005
  // Clear any existing content and show placeholder
13681
- this._valueDisplayElement.innerHTML = '';
15006
+ valueDisplayElement.innerHTML = '';
13682
15007
  var placeholderEl = templates_1.defaultTemplates.placeholder(this._config);
13683
- this._valueDisplayElement.appendChild(placeholderEl);
15008
+ valueDisplayElement.appendChild(placeholderEl);
13684
15009
  return;
13685
15010
  }
13686
15011
  // Clear all existing content before adding tags
13687
- this._valueDisplayElement.innerHTML = '';
15012
+ valueDisplayElement.innerHTML = '';
13688
15013
  // Insert each tag before the display element
13689
15014
  selectedOptions.forEach(function (optionValue) {
15015
+ var _a;
13690
15016
  // Find the original option element (in dropdown or select)
13691
15017
  var optionElement = null;
13692
15018
  var optionElements = _this._select.getOptionsElement();
13693
- for (var _i = 0, _a = Array.from(optionElements); _i < _a.length; _i++) {
13694
- var opt = _a[_i];
15019
+ for (var _i = 0, _b = Array.from(optionElements); _i < _b.length; _i++) {
15020
+ var opt = _b[_i];
13695
15021
  if (opt.dataset.value === optionValue) {
13696
15022
  optionElement = opt;
13697
15023
  break;
13698
15024
  }
13699
15025
  }
13700
15026
  if (!optionElement) {
13701
- var originalOptions = _this._select
13702
- .getElement()
13703
- .querySelectorAll('option');
13704
- for (var _b = 0, _c = Array.from(originalOptions); _b < _c.length; _b++) {
13705
- var opt = _c[_b];
15027
+ var originalOptions = (_a = _this._select
15028
+ .getElement()) === null || _a === void 0 ? void 0 : _a.querySelectorAll('option');
15029
+ if (!originalOptions)
15030
+ return;
15031
+ for (var _c = 0, _d = Array.from(originalOptions); _c < _d.length; _c++) {
15032
+ var opt = _d[_c];
13706
15033
  if (opt.value === optionValue) {
13707
15034
  optionElement = opt;
13708
15035
  break;
13709
15036
  }
13710
15037
  }
13711
15038
  }
15039
+ if (!optionElement)
15040
+ return;
13712
15041
  var tag = templates_1.defaultTemplates.tag(optionElement, _this._config);
13713
15042
  // Add event listener to the close button
13714
15043
  var closeButton = tag.querySelector('[data-kt-select-remove-button]');
@@ -13719,7 +15048,7 @@ var KTSelectTags = /** @class */ (function () {
13719
15048
  });
13720
15049
  }
13721
15050
  // Insert tag inside the display element
13722
- _this._valueDisplayElement.appendChild(tag);
15051
+ valueDisplayElement.appendChild(tag);
13723
15052
  });
13724
15053
  };
13725
15054
  /**
@@ -13733,7 +15062,9 @@ var KTSelectTags = /** @class */ (function () {
13733
15062
  * Clean up resources used by this module
13734
15063
  */
13735
15064
  KTSelectTags.prototype.destroy = function () {
13736
- this._eventManager.removeAllListeners(null);
15065
+ if (this._valueDisplayElement) {
15066
+ this._eventManager.removeAllListeners(this._valueDisplayElement);
15067
+ }
13737
15068
  };
13738
15069
  return KTSelectTags;
13739
15070
  }());
@@ -13919,7 +15250,7 @@ exports.defaultTemplates = {
13919
15250
  * Renders a single option
13920
15251
  */
13921
15252
  option: function (option, config) {
13922
- var _a, _b, _c;
15253
+ var _a;
13923
15254
  var isHtmlOption = option instanceof HTMLOptionElement;
13924
15255
  var optionData;
13925
15256
  if (isHtmlOption) {
@@ -13934,14 +15265,14 @@ exports.defaultTemplates = {
13934
15265
  // which should have the getOptionDataForTemplate method.
13935
15266
  optionData = option.getOptionDataForTemplate();
13936
15267
  }
13937
- var content = (_b = optionData === null || optionData === void 0 ? void 0 : optionData.text) === null || _b === void 0 ? void 0 : _b.trim(); // Default content to option's text
15268
+ var content = String((optionData === null || optionData === void 0 ? void 0 : optionData.text) || '').trim(); // Default content to option's text
13938
15269
  if (config.optionTemplate) {
13939
15270
  // Use the user-provided template string, rendering with the full optionData.
13940
15271
  // renderTemplateString will replace {{key}} with values from optionData.
13941
15272
  content = (0, utils_1.renderTemplateString)(config.optionTemplate, optionData);
13942
15273
  }
13943
15274
  else {
13944
- content = optionData.text || optionData.content; // Prefer explicit text, fallback to content
15275
+ content = String(optionData.text || optionData.content || '');
13945
15276
  }
13946
15277
  // Use the core option template string as the base structure.
13947
15278
  var baseTemplate = getTemplateStrings(config).option;
@@ -13960,7 +15291,7 @@ exports.defaultTemplates = {
13960
15291
  element.innerHTML = content;
13961
15292
  }
13962
15293
  // Ensure data-text attribute is set to the original, clean text for searching/filtering
13963
- element.setAttribute('data-text', ((_c = optionData === null || optionData === void 0 ? void 0 : optionData.text) === null || _c === void 0 ? void 0 : _c.trim()) || '');
15294
+ element.setAttribute('data-text', String((optionData === null || optionData === void 0 ? void 0 : optionData.text) || '').trim());
13964
15295
  return element;
13965
15296
  },
13966
15297
  /**
@@ -14153,7 +15484,7 @@ function filterOptions(options, query, config, dropdownElement, onVisibleCount)
14153
15484
  * Consolidates redundant focus management logic into shared functions
14154
15485
  */
14155
15486
  var FocusManager = /** @class */ (function () {
14156
- function FocusManager(element, optionsSelector, config) {
15487
+ function FocusManager(element, optionsSelector, _config) {
14157
15488
  if (optionsSelector === void 0) { optionsSelector = '[data-kt-select-option]'; }
14158
15489
  this._focusedOptionIndex = null;
14159
15490
  this._onFocusChange = null;
@@ -14174,8 +15505,7 @@ var FocusManager = /** @class */ (function () {
14174
15505
  this._eventManager.addListener(this._element, 'click', function (e) {
14175
15506
  var target = e.target;
14176
15507
  var optionElement = target.closest(_this._optionsSelector);
14177
- if (optionElement) {
14178
- }
15508
+ void optionElement;
14179
15509
  });
14180
15510
  };
14181
15511
  /**
@@ -14982,19 +16312,6 @@ var KTSticky = /** @class */ (function (_super) {
14982
16312
  _this._scrollTimeout = null;
14983
16313
  _this._resizeHandler = null;
14984
16314
  _this._scrollHandler = null;
14985
- _this._resetStyles = function () {
14986
- this._element.style.top = '';
14987
- this._element.style.bottom = '';
14988
- this._element.style.insetInlineStart = '';
14989
- this._element.style.insetInlineEnd = '';
14990
- this._element.style.insetBlockStart = '';
14991
- this._element.style.insetBlockEnd = '';
14992
- this._element.style.width = '';
14993
- this._element.style.left = '';
14994
- this._element.style.right = '';
14995
- this._element.style.zIndex = '';
14996
- this._element.style.position = '';
14997
- };
14998
16315
  // Check if element already has an instance and is still connected
14999
16316
  if (_this._shouldSkipInit(element)) {
15000
16317
  return _this;
@@ -15305,6 +16622,19 @@ var KTSticky = /** @class */ (function (_super) {
15305
16622
  this._timeoutState = null;
15306
16623
  }
15307
16624
  };
16625
+ KTSticky.prototype._resetStyles = function () {
16626
+ this._element.style.top = '';
16627
+ this._element.style.bottom = '';
16628
+ this._element.style.insetInlineStart = '';
16629
+ this._element.style.insetInlineEnd = '';
16630
+ this._element.style.insetBlockStart = '';
16631
+ this._element.style.insetBlockEnd = '';
16632
+ this._element.style.width = '';
16633
+ this._element.style.left = '';
16634
+ this._element.style.right = '';
16635
+ this._element.style.zIndex = '';
16636
+ this._element.style.position = '';
16637
+ };
15308
16638
  KTSticky.prototype._update = function () {
15309
16639
  this._timeoutState = null;
15310
16640
  this._eventTriggerState = true;
@@ -15644,12 +16974,14 @@ var KTThemeSwitch = /** @class */ (function (_super) {
15644
16974
  function KTThemeSwitch(element, config) {
15645
16975
  if (config === void 0) { config = null; }
15646
16976
  var _this = _super.call(this) || this;
15647
- _this._name = 'theme-swtich';
16977
+ _this._name = 'theme-switch';
15648
16978
  _this._defaultConfig = {
15649
16979
  mode: 'light',
15650
16980
  };
15651
16981
  _this._mode = null;
15652
16982
  _this._currentMode = null;
16983
+ _this._themeSwitchToggleEventId = '';
16984
+ _this._themeSwitchSetEventId = '';
15653
16985
  if (data_1.default.has(element, _this._name))
15654
16986
  return _this;
15655
16987
  _this._init(element);
@@ -15663,10 +16995,10 @@ var KTThemeSwitch = /** @class */ (function (_super) {
15663
16995
  var _this = this;
15664
16996
  if (!this._element)
15665
16997
  return;
15666
- event_handler_1.default.on(document.body, '[data-kt-theme-switch-toggle]', 'click', function () {
16998
+ this._themeSwitchToggleEventId = event_handler_1.default.on(document.body, '[data-kt-theme-switch-toggle]', 'click', function () {
15667
16999
  _this._toggle();
15668
17000
  });
15669
- event_handler_1.default.on(document.body, '[data-kt-theme-switch-set]', 'click', function (event, target) {
17001
+ this._themeSwitchSetEventId = event_handler_1.default.on(document.body, '[data-kt-theme-switch-set]', 'click', function (event, target) {
15670
17002
  event.preventDefault();
15671
17003
  var mode = target.getAttribute('data-kt-theme-switch-set');
15672
17004
  _this._setMode(mode);
@@ -15728,7 +17060,18 @@ var KTThemeSwitch = /** @class */ (function (_super) {
15728
17060
  return this._getMode();
15729
17061
  };
15730
17062
  KTThemeSwitch.prototype.setMode = function (mode) {
15731
- this.setMode(mode);
17063
+ this._setMode(mode);
17064
+ };
17065
+ KTThemeSwitch.prototype.dispose = function () {
17066
+ if (this._themeSwitchToggleEventId) {
17067
+ event_handler_1.default.off(document.body, 'click', this._themeSwitchToggleEventId);
17068
+ this._themeSwitchToggleEventId = '';
17069
+ }
17070
+ if (this._themeSwitchSetEventId) {
17071
+ event_handler_1.default.off(document.body, 'click', this._themeSwitchSetEventId);
17072
+ this._themeSwitchSetEventId = '';
17073
+ }
17074
+ _super.prototype.dispose.call(this);
15732
17075
  };
15733
17076
  KTThemeSwitch.getInstance = function () {
15734
17077
  var root = document.documentElement;
@@ -16003,7 +17346,7 @@ var KTToast = /** @class */ (function (_super) {
16003
17346
  * @returns Toast instance with dismiss method, or undefined if invalid input.
16004
17347
  */
16005
17348
  KTToast.show = function (inputOptions) {
16006
- var _a, _b, _c, _d;
17349
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16007
17350
  var options = __assign(__assign({}, DEFAULT_TOAST_OPTIONS), inputOptions);
16008
17351
  if (!options || (!options.message && !options.content)) {
16009
17352
  return undefined;
@@ -16024,7 +17367,7 @@ var KTToast = /** @class */ (function (_super) {
16024
17367
  }
16025
17368
  // Enforce maxToasts
16026
17369
  if (container.children.length >=
16027
- (this.globalConfig.maxToasts || DEFAULT_CONFIG.maxToasts)) {
17370
+ ((_b = (_a = this.globalConfig.maxToasts) !== null && _a !== void 0 ? _a : DEFAULT_CONFIG.maxToasts) !== null && _b !== void 0 ? _b : 5)) {
16028
17371
  var firstToast_1 = container.firstElementChild;
16029
17372
  if (firstToast_1) {
16030
17373
  firstToast_1.classList.add('kt-toast-closing');
@@ -16055,7 +17398,10 @@ var KTToast = /** @class */ (function (_super) {
16055
17398
  lg: 'kt-alert-lg',
16056
17399
  };
16057
17400
  var toast = document.createElement('div');
16058
- toast.className = "kt-toast kt-alert ".concat(variantMap[options.variant] || '', " ").concat(appearanceMap[options.appearance] || '', " ").concat(sizeMap[options.size] || '', " ").concat(options.className || '', " ").concat(classNames.toast || '');
17401
+ var variantClass = variantMap[(_c = options.variant) !== null && _c !== void 0 ? _c : 'info'] || '';
17402
+ var appearanceClass = appearanceMap[(_d = options.appearance) !== null && _d !== void 0 ? _d : 'solid'] || '';
17403
+ var sizeClass = sizeMap[(_e = options.size) !== null && _e !== void 0 ? _e : 'md'] || '';
17404
+ toast.className = "kt-toast kt-alert ".concat(variantClass, " ").concat(appearanceClass, " ").concat(sizeClass, " ").concat(options.className || '', " ").concat(classNames.toast || '');
16059
17405
  // ARIA support
16060
17406
  toast.setAttribute('role', options.role || 'status');
16061
17407
  toast.setAttribute('aria-live', 'polite');
@@ -16106,7 +17452,7 @@ var KTToast = /** @class */ (function (_super) {
16106
17452
  // Progress line
16107
17453
  var duration = options.important
16108
17454
  ? null
16109
- : ((_b = (_a = options.duration) !== null && _a !== void 0 ? _a : this.globalConfig.duration) !== null && _b !== void 0 ? _b : DEFAULT_CONFIG.duration);
17455
+ : ((_g = (_f = options.duration) !== null && _f !== void 0 ? _f : this.globalConfig.duration) !== null && _g !== void 0 ? _g : DEFAULT_CONFIG.duration);
16110
17456
  if (duration && options.progress) {
16111
17457
  var progress = document.createElement('div');
16112
17458
  progress.className = 'kt-toast-progress ' + (classNames.progress || '');
@@ -16129,7 +17475,7 @@ var KTToast = /** @class */ (function (_super) {
16129
17475
  var dirClass = directionClassMap[position] || 'kt-toast-top-end';
16130
17476
  toast.classList.add(dirClass);
16131
17477
  // Enforce maxToasts: remove oldest if needed
16132
- var maxToasts = (_d = (_c = options.maxToasts) !== null && _c !== void 0 ? _c : this.globalConfig.maxToasts) !== null && _d !== void 0 ? _d : DEFAULT_CONFIG.maxToasts;
17478
+ var maxToasts = (_k = (_j = (_h = options.maxToasts) !== null && _h !== void 0 ? _h : this.globalConfig.maxToasts) !== null && _j !== void 0 ? _j : DEFAULT_CONFIG.maxToasts) !== null && _k !== void 0 ? _k : 5;
16133
17479
  var currentToasts = Array.from(container.children);
16134
17480
  if (currentToasts.length >= maxToasts && currentToasts.length > 0) {
16135
17481
  var oldestToast = currentToasts[currentToasts.length - 1];
@@ -16148,7 +17494,12 @@ var KTToast = /** @class */ (function (_super) {
16148
17494
  if (options.beep) {
16149
17495
  try {
16150
17496
  // Use Web Audio API for a short beep
16151
- var ctx_1 = new (window.AudioContext || window.webkitAudioContext)();
17497
+ var Ctx = window.AudioContext ||
17498
+ window.webkitAudioContext;
17499
+ if (!Ctx) {
17500
+ throw new Error('Web Audio API unavailable');
17501
+ }
17502
+ var ctx_1 = new Ctx();
16152
17503
  var o_1 = ctx_1.createOscillator();
16153
17504
  var g = ctx_1.createGain();
16154
17505
  o_1.type = 'sine';
@@ -16162,7 +17513,7 @@ var KTToast = /** @class */ (function (_super) {
16162
17513
  ctx_1.close();
16163
17514
  }, 120);
16164
17515
  }
16165
- catch (e) {
17516
+ catch (_l) {
16166
17517
  /* ignore */
16167
17518
  }
16168
17519
  }
@@ -16172,7 +17523,7 @@ var KTToast = /** @class */ (function (_super) {
16172
17523
  KTToast.toasts.set(id, instance);
16173
17524
  // Auto-dismiss
16174
17525
  var timeoutId = undefined;
16175
- var remaining = duration;
17526
+ var remaining = duration !== null && duration !== void 0 ? duration : 0;
16176
17527
  var startTime;
16177
17528
  var paused = false;
16178
17529
  var progressEl = null;
@@ -16223,7 +17574,7 @@ var KTToast = /** @class */ (function (_super) {
16223
17574
  if (progressEl) {
16224
17575
  progressEl.style.transition = 'transform 0ms';
16225
17576
  progressEl.style.transform = "scaleX(".concat(progressPausedAt_1, ")");
16226
- progressEl.offsetHeight; // force reflow
17577
+ void progressEl.offsetHeight; // force reflow
16227
17578
  progressEl.style.transition = "transform ".concat(remaining, "ms linear");
16228
17579
  progressEl.style.transform = 'scaleX(0)';
16229
17580
  }
@@ -16566,6 +17917,7 @@ var KTToggle = /** @class */ (function (_super) {
16566
17917
  attribute: '',
16567
17918
  };
16568
17919
  _this._config = _this._defaultConfig;
17920
+ _this._clickHandler = null;
16569
17921
  if (data_1.default.has(element, _this._name))
16570
17922
  return _this;
16571
17923
  _this._init(element);
@@ -16581,9 +17933,17 @@ var KTToggle = /** @class */ (function (_super) {
16581
17933
  var _this = this;
16582
17934
  if (!this._element)
16583
17935
  return;
16584
- this._element.addEventListener('click', function () {
17936
+ this._clickHandler = function () {
16585
17937
  _this._toggle();
16586
- });
17938
+ };
17939
+ this._element.addEventListener('click', this._clickHandler);
17940
+ };
17941
+ KTToggle.prototype.dispose = function () {
17942
+ if (this._element && this._clickHandler) {
17943
+ this._element.removeEventListener('click', this._clickHandler);
17944
+ this._clickHandler = null;
17945
+ }
17946
+ _super.prototype.dispose.call(this);
16587
17947
  };
16588
17948
  KTToggle.prototype._getTargetElement = function () {
16589
17949
  return (dom_1.default.getElement(this._element.getAttribute('data-kt-toggle')) || dom_1.default.getElement(this._getOption('target')));
@@ -17077,18 +18437,13 @@ var KTDom = {
17077
18437
  return dir === 'rtl';
17078
18438
  },
17079
18439
  isElement: function (element) {
17080
- if (element && element instanceof HTMLElement) {
17081
- return true;
17082
- }
17083
- else {
17084
- return false;
17085
- }
18440
+ return element instanceof HTMLElement;
17086
18441
  },
17087
18442
  getElement: function (element) {
17088
18443
  if (this.isElement(element)) {
17089
18444
  return element;
17090
18445
  }
17091
- if (element && element.length > 0) {
18446
+ if (typeof element === 'string' && element.length > 0) {
17092
18447
  return document.querySelector(utils_1.default.parseSelector(element));
17093
18448
  }
17094
18449
  return null;
@@ -17188,7 +18543,7 @@ var KTDom = {
17188
18543
  },
17189
18544
  children: function (element, selector) {
17190
18545
  if (!element || !element.childNodes) {
17191
- return null;
18546
+ return [];
17192
18547
  }
17193
18548
  var result = [];
17194
18549
  var l = element.childNodes.length;
@@ -17243,7 +18598,7 @@ var KTDom = {
17243
18598
  return (parseFloat(window.getComputedStyle(element).animationDuration) * 1000);
17244
18599
  },
17245
18600
  reflow: function (element) {
17246
- element.offsetHeight;
18601
+ void element.offsetHeight;
17247
18602
  },
17248
18603
  insertAfter: function (element, referenceNode) {
17249
18604
  var parentNode = referenceNode.parentNode;
@@ -17345,7 +18700,10 @@ var KTDom = {
17345
18700
  var key = keys_1[_i];
17346
18701
  var normalizedKey = key.replace(prefix, '');
17347
18702
  normalizedKey = utils_1.default.uncapitalize(normalizedKey);
17348
- attributes[normalizedKey] = utils_1.default.parseDataAttribute(element.dataset[key]);
18703
+ var datasetValue = element.dataset[key];
18704
+ if (typeof datasetValue === 'string') {
18705
+ attributes[normalizedKey] = utils_1.default.parseDataAttribute(datasetValue);
18706
+ }
17349
18707
  }
17350
18708
  return attributes;
17351
18709
  },
@@ -17383,10 +18741,12 @@ var KTEventHandler = {
17383
18741
  on: function (element, selector, eventName, handler) {
17384
18742
  var _this = this;
17385
18743
  if (element === null) {
17386
- return null;
18744
+ return '';
17387
18745
  }
17388
18746
  var eventId = utils_1.default.geUID('event');
17389
18747
  KTDelegatedEventHandlers[eventId] = function (event) {
18748
+ if (!event)
18749
+ return;
17390
18750
  // Fix: Check selector dynamically instead of pre-computing targets
17391
18751
  // This allows event delegation to work with dynamically added elements
17392
18752
  var target = event.target;
@@ -17525,6 +18885,9 @@ var KTUtils = {
17525
18885
  return null;
17526
18886
  },
17527
18887
  stringToObject: function (value) {
18888
+ if (value === null) {
18889
+ return null;
18890
+ }
17528
18891
  try {
17529
18892
  var parsed = JSON.parse(value.toString());
17530
18893
  if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
@@ -17532,7 +18895,7 @@ var KTUtils = {
17532
18895
  }
17533
18896
  return null;
17534
18897
  }
17535
- catch (error) {
18898
+ catch (_a) {
17536
18899
  return null;
17537
18900
  }
17538
18901
  },
@@ -17584,7 +18947,7 @@ exports["default"] = KTUtils;
17584
18947
  * Copyright 2025 by Keenthemes Inc
17585
18948
  */
17586
18949
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17587
- exports.KTRangeSlider = exports.KTClipboard = exports.KTRepeater = exports.KTRating = exports.KTToast = exports.KTSelect = exports.KTDataTable = exports.KTTogglePassword = exports.KTImageInput = exports.KTThemeSwitch = exports.KTStepper = exports.KTTooltip = exports.KTToggle = exports.KTReparent = exports.KTSticky = exports.KTScrollto = exports.KTScrollable = exports.KTScrollspy = exports.KTAccordion = exports.KTTabs = exports.KTDismiss = exports.KTCollapse = exports.KTDrawer = exports.KTModal = exports.KTDropdown = void 0;
18950
+ exports.KTCarousel = exports.KTPinInput = exports.KTRangeSlider = exports.KTClipboard = exports.KTRepeater = exports.KTRating = exports.KTToast = exports.KTSelect = exports.KTDataTable = exports.KTTogglePassword = exports.KTImageInput = exports.KTThemeSwitch = exports.KTStepper = exports.KTTooltip = exports.KTToggle = exports.KTReparent = exports.KTSticky = exports.KTScrollto = exports.KTScrollable = exports.KTScrollspy = exports.KTAccordion = exports.KTTabs = exports.KTDismiss = exports.KTCollapse = exports.KTDrawer = exports.KTModal = exports.KTDropdown = void 0;
17588
18951
  var dom_1 = __webpack_require__(/*! ./helpers/dom */ "./src/helpers/dom.ts");
17589
18952
  var dropdown_1 = __webpack_require__(/*! ./components/dropdown */ "./src/components/dropdown/index.ts");
17590
18953
  var modal_1 = __webpack_require__(/*! ./components/modal */ "./src/components/modal/index.ts");
@@ -17611,6 +18974,8 @@ var rating_1 = __webpack_require__(/*! ./components/rating */ "./src/components/
17611
18974
  var repeater_1 = __webpack_require__(/*! ./components/repeater */ "./src/components/repeater/index.ts");
17612
18975
  var clipboard_1 = __webpack_require__(/*! ./components/clipboard */ "./src/components/clipboard/index.ts");
17613
18976
  var range_slider_1 = __webpack_require__(/*! ./components/range-slider */ "./src/components/range-slider/index.ts");
18977
+ var pin_input_1 = __webpack_require__(/*! ./components/pin-input */ "./src/components/pin-input/index.ts");
18978
+ var carousel_1 = __webpack_require__(/*! ./components/carousel */ "./src/components/carousel/index.ts");
17614
18979
  var dropdown_2 = __webpack_require__(/*! ./components/dropdown */ "./src/components/dropdown/index.ts");
17615
18980
  Object.defineProperty(exports, "KTDropdown", ({ enumerable: true, get: function () { return dropdown_2.KTDropdown; } }));
17616
18981
  var modal_2 = __webpack_require__(/*! ./components/modal */ "./src/components/modal/index.ts");
@@ -17661,6 +19026,10 @@ var clipboard_2 = __webpack_require__(/*! ./components/clipboard */ "./src/compo
17661
19026
  Object.defineProperty(exports, "KTClipboard", ({ enumerable: true, get: function () { return clipboard_2.KTClipboard; } }));
17662
19027
  var range_slider_2 = __webpack_require__(/*! ./components/range-slider */ "./src/components/range-slider/index.ts");
17663
19028
  Object.defineProperty(exports, "KTRangeSlider", ({ enumerable: true, get: function () { return range_slider_2.KTRangeSlider; } }));
19029
+ var pin_input_2 = __webpack_require__(/*! ./components/pin-input */ "./src/components/pin-input/index.ts");
19030
+ Object.defineProperty(exports, "KTPinInput", ({ enumerable: true, get: function () { return pin_input_2.KTPinInput; } }));
19031
+ var carousel_2 = __webpack_require__(/*! ./components/carousel */ "./src/components/carousel/index.ts");
19032
+ Object.defineProperty(exports, "KTCarousel", ({ enumerable: true, get: function () { return carousel_2.KTCarousel; } }));
17664
19033
  var KTComponents = {
17665
19034
  init: function () {
17666
19035
  dropdown_1.KTDropdown.init();
@@ -17688,6 +19057,8 @@ var KTComponents = {
17688
19057
  repeater_1.KTRepeater.init();
17689
19058
  clipboard_1.KTClipboard.init();
17690
19059
  range_slider_1.KTRangeSlider.init();
19060
+ pin_input_1.KTPinInput.init();
19061
+ carousel_1.KTCarousel.init();
17691
19062
  },
17692
19063
  };
17693
19064
  exports["default"] = KTComponents;