smart-webcomponents-react 17.0.0 → 17.1.0

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 (551) hide show
  1. package/accordion/accordion.d.ts +0 -1
  2. package/accordion/accordion.esm.js +19 -10
  3. package/accordion/accordion.umd.js +8 -3
  4. package/accordion/accordionitem.d.ts +0 -1
  5. package/alertwindow/alertwindow.d.ts +0 -1
  6. package/alertwindow/alertwindow.esm.js +15 -9
  7. package/alertwindow/alertwindow.umd.js +4 -2
  8. package/array/array.d.ts +0 -1
  9. package/array/array.esm.js +15 -9
  10. package/array/array.umd.js +4 -2
  11. package/barcode/barcode.d.ts +0 -1
  12. package/barcode/barcode.esm.js +15 -9
  13. package/barcode/barcode.umd.js +4 -2
  14. package/breadcrumb/breadcrumb.d.ts +0 -1
  15. package/breadcrumb/breadcrumb.esm.js +15 -9
  16. package/breadcrumb/breadcrumb.umd.js +4 -2
  17. package/button/button.d.ts +0 -1
  18. package/button/button.esm.js +27 -12
  19. package/button/button.umd.js +16 -5
  20. package/button/buttongroup.d.ts +0 -1
  21. package/button/dropdownbutton.d.ts +0 -1
  22. package/button/multisplitbutton.d.ts +0 -1
  23. package/button/powerbutton.d.ts +0 -1
  24. package/button/radiobutton.d.ts +0 -1
  25. package/button/repeatbutton.d.ts +0 -1
  26. package/button/switchbutton.d.ts +0 -1
  27. package/button/togglebutton.d.ts +0 -1
  28. package/buttongroup/buttongroup.d.ts +0 -1
  29. package/buttongroup/buttongroup.esm.js +15 -9
  30. package/buttongroup/buttongroup.umd.js +4 -2
  31. package/calendar/calendar.d.ts +0 -1
  32. package/calendar/calendar.esm.js +15 -9
  33. package/calendar/calendar.umd.js +4 -2
  34. package/card/card.d.ts +0 -1
  35. package/card/card.esm.js +15 -9
  36. package/card/card.umd.js +4 -2
  37. package/card/cardview.d.ts +0 -1
  38. package/cardview/cardview.d.ts +0 -1
  39. package/cardview/cardview.esm.js +15 -9
  40. package/cardview/cardview.umd.js +4 -2
  41. package/carousel/carousel.d.ts +0 -1
  42. package/carousel/carousel.esm.js +15 -9
  43. package/carousel/carousel.umd.js +4 -2
  44. package/chart/chart.d.ts +0 -1
  45. package/chart/chart.esm.js +15 -9
  46. package/chart/chart.umd.js +4 -2
  47. package/chart/ganttchart.d.ts +0 -11
  48. package/chart/threedchart.d.ts +0 -1
  49. package/checkbox/checkbox.d.ts +0 -1
  50. package/checkbox/checkbox.esm.js +15 -9
  51. package/checkbox/checkbox.umd.js +4 -2
  52. package/checkinput/checkinput.d.ts +0 -1
  53. package/checkinput/checkinput.esm.js +15 -9
  54. package/checkinput/checkinput.umd.js +4 -2
  55. package/chip/chip.d.ts +0 -1
  56. package/chip/chip.esm.js +15 -9
  57. package/chip/chip.umd.js +4 -2
  58. package/colorinput/colorinput.d.ts +0 -1
  59. package/colorinput/colorinput.esm.js +15 -9
  60. package/colorinput/colorinput.umd.js +4 -2
  61. package/colorpanel/colorpanel.d.ts +0 -1
  62. package/colorpanel/colorpanel.esm.js +15 -9
  63. package/colorpanel/colorpanel.umd.js +4 -2
  64. package/colorpicker/colorpicker.d.ts +0 -1
  65. package/colorpicker/colorpicker.esm.js +15 -9
  66. package/colorpicker/colorpicker.umd.js +4 -2
  67. package/columnpanel/columnpanel.d.ts +0 -1
  68. package/columnpanel/columnpanel.esm.js +15 -9
  69. package/columnpanel/columnpanel.umd.js +4 -2
  70. package/combobox/combobox.d.ts +0 -1
  71. package/combobox/combobox.esm.js +23 -11
  72. package/combobox/combobox.umd.js +12 -4
  73. package/countryinput/countryinput.d.ts +0 -1
  74. package/countryinput/countryinput.esm.js +15 -9
  75. package/countryinput/countryinput.umd.js +4 -2
  76. package/customizationdialog/customizationdialog.d.ts +0 -1
  77. package/customizationdialog/customizationdialog.esm.js +15 -9
  78. package/customizationdialog/customizationdialog.umd.js +4 -2
  79. package/dateinput/dateinput.d.ts +0 -1
  80. package/dateinput/dateinput.esm.js +15 -9
  81. package/dateinput/dateinput.umd.js +4 -2
  82. package/daterangeinput/daterangeinput.d.ts +0 -1
  83. package/daterangeinput/daterangeinput.esm.js +15 -9
  84. package/daterangeinput/daterangeinput.umd.js +4 -2
  85. package/datetimepicker/datetimepicker.d.ts +0 -1
  86. package/datetimepicker/datetimepicker.esm.js +15 -9
  87. package/datetimepicker/datetimepicker.umd.js +4 -2
  88. package/dialogwindow/dialogwindow.d.ts +0 -1
  89. package/dialogwindow/dialogwindow.esm.js +15 -9
  90. package/dialogwindow/dialogwindow.umd.js +4 -2
  91. package/dockinglayout/dockinglayout.d.ts +0 -1
  92. package/dockinglayout/dockinglayout.esm.js +15 -9
  93. package/dockinglayout/dockinglayout.umd.js +4 -2
  94. package/dropdownbutton/dropdownbutton.d.ts +0 -1
  95. package/dropdownbutton/dropdownbutton.esm.js +15 -9
  96. package/dropdownbutton/dropdownbutton.umd.js +4 -2
  97. package/dropdownlist/dropdownlist.d.ts +0 -1
  98. package/dropdownlist/dropdownlist.esm.js +23 -11
  99. package/dropdownlist/dropdownlist.umd.js +12 -4
  100. package/editor/editor.d.ts +0 -1
  101. package/editor/editor.esm.js +15 -9
  102. package/editor/editor.umd.js +4 -2
  103. package/element/element.d.ts +0 -1
  104. package/element/element.esm.js +15 -9
  105. package/element/element.umd.js +4 -2
  106. package/fileupload/fileupload.d.ts +0 -1
  107. package/fileupload/fileupload.esm.js +15 -9
  108. package/fileupload/fileupload.umd.js +4 -2
  109. package/filterbuilder/filterbuilder.d.ts +0 -1
  110. package/filterbuilder/filterbuilder.esm.js +15 -9
  111. package/filterbuilder/filterbuilder.umd.js +4 -2
  112. package/filterpanel/filterpanel.d.ts +0 -1
  113. package/filterpanel/filterpanel.esm.js +15 -9
  114. package/filterpanel/filterpanel.umd.js +4 -2
  115. package/filterpanel/multicolumnfilterpanel.d.ts +0 -1
  116. package/form/form.d.ts +0 -1
  117. package/form/form.esm.js +23 -11
  118. package/form/form.umd.js +12 -4
  119. package/form/formcontrol.d.ts +0 -1
  120. package/form/formgroup.d.ts +0 -1
  121. package/ganttchart/ganttchart.d.ts +0 -11
  122. package/ganttchart/ganttchart.esm.js +16 -32
  123. package/ganttchart/ganttchart.umd.js +5 -25
  124. package/gauge/gauge.d.ts +0 -1
  125. package/gauge/gauge.esm.js +15 -9
  126. package/gauge/gauge.umd.js +4 -2
  127. package/grid/grid.d.ts +0 -1
  128. package/grid/grid.esm.js +15 -9
  129. package/grid/grid.umd.js +4 -2
  130. package/grouppanel/grouppanel.d.ts +0 -1
  131. package/grouppanel/grouppanel.esm.js +15 -9
  132. package/grouppanel/grouppanel.umd.js +4 -2
  133. package/index.d.ts +1 -11
  134. package/input/checkinput.d.ts +0 -1
  135. package/input/colorinput.d.ts +0 -1
  136. package/input/countryinput.d.ts +0 -1
  137. package/input/dateinput.d.ts +0 -1
  138. package/input/daterangeinput.d.ts +0 -1
  139. package/input/input.d.ts +0 -1
  140. package/input/input.esm.js +15 -9
  141. package/input/input.umd.js +4 -2
  142. package/input/multicomboinput.d.ts +0 -1
  143. package/input/multiinput.d.ts +0 -1
  144. package/input/numberinput.d.ts +0 -1
  145. package/input/passwordinput.d.ts +0 -1
  146. package/input/phoneinput.d.ts +0 -1
  147. package/input/timeinput.d.ts +0 -1
  148. package/kanban/kanban.d.ts +0 -1
  149. package/kanban/kanban.esm.js +15 -9
  150. package/kanban/kanban.umd.js +4 -2
  151. package/layout/dockinglayout.d.ts +0 -1
  152. package/layout/layout.d.ts +0 -1
  153. package/layout/layout.esm.js +31 -13
  154. package/layout/layout.umd.js +20 -6
  155. package/layout/layoutgroup.d.ts +0 -1
  156. package/layout/layoutitem.d.ts +0 -1
  157. package/layout/tablayoutgroup.d.ts +0 -1
  158. package/layout/tablayoutitem.d.ts +0 -1
  159. package/led/led.d.ts +0 -1
  160. package/led/led.esm.js +15 -9
  161. package/led/led.umd.js +4 -2
  162. package/listbox/listbox.d.ts +0 -1
  163. package/listbox/listbox.esm.js +23 -11
  164. package/listbox/listbox.umd.js +12 -4
  165. package/listmenu/listmenu.d.ts +0 -1
  166. package/listmenu/listmenu.esm.js +23 -11
  167. package/listmenu/listmenu.umd.js +12 -4
  168. package/map/map.d.ts +0 -1
  169. package/map/map.esm.js +15 -9
  170. package/map/map.umd.js +4 -2
  171. package/maskedtextbox/maskedtextbox.d.ts +0 -1
  172. package/maskedtextbox/maskedtextbox.esm.js +15 -9
  173. package/maskedtextbox/maskedtextbox.umd.js +4 -2
  174. package/menu/listmenu.d.ts +0 -1
  175. package/menu/menu.d.ts +0 -1
  176. package/menu/menu.esm.js +23 -11
  177. package/menu/menu.umd.js +12 -4
  178. package/menu/menuitem.d.ts +0 -1
  179. package/menu/menuitemsgroup.d.ts +0 -1
  180. package/multicolumnfilterpanel/multicolumnfilterpanel.d.ts +0 -1
  181. package/multicolumnfilterpanel/multicolumnfilterpanel.esm.js +15 -9
  182. package/multicolumnfilterpanel/multicolumnfilterpanel.umd.js +4 -2
  183. package/multicomboinput/multicomboinput.d.ts +0 -1
  184. package/multicomboinput/multicomboinput.esm.js +15 -9
  185. package/multicomboinput/multicomboinput.umd.js +4 -2
  186. package/multiinput/multiinput.d.ts +0 -1
  187. package/multiinput/multiinput.esm.js +15 -9
  188. package/multiinput/multiinput.umd.js +4 -2
  189. package/multilinetextbox/multilinetextbox.d.ts +0 -1
  190. package/multilinetextbox/multilinetextbox.esm.js +23 -11
  191. package/multilinetextbox/multilinetextbox.umd.js +12 -4
  192. package/multilinewindow/multilinewindow.d.ts +0 -1
  193. package/multilinewindow/multilinewindow.esm.js +15 -9
  194. package/multilinewindow/multilinewindow.umd.js +4 -2
  195. package/multisplitbutton/multisplitbutton.d.ts +0 -1
  196. package/multisplitbutton/multisplitbutton.esm.js +23 -11
  197. package/multisplitbutton/multisplitbutton.umd.js +12 -4
  198. package/numberinput/numberinput.d.ts +0 -1
  199. package/numberinput/numberinput.esm.js +15 -9
  200. package/numberinput/numberinput.umd.js +4 -2
  201. package/numerictextbox/numerictextbox.d.ts +0 -1
  202. package/numerictextbox/numerictextbox.esm.js +15 -9
  203. package/numerictextbox/numerictextbox.umd.js +4 -2
  204. package/package.json +2 -1
  205. package/pager/pager.d.ts +0 -1
  206. package/pager/pager.esm.js +15 -9
  207. package/pager/pager.umd.js +4 -2
  208. package/passwordinput/passwordinput.d.ts +0 -1
  209. package/passwordinput/passwordinput.esm.js +15 -9
  210. package/passwordinput/passwordinput.umd.js +4 -2
  211. package/passwordtextbox/passwordtextbox.d.ts +0 -1
  212. package/passwordtextbox/passwordtextbox.esm.js +15 -9
  213. package/passwordtextbox/passwordtextbox.umd.js +4 -2
  214. package/path/path.d.ts +0 -1
  215. package/path/path.esm.js +15 -9
  216. package/path/path.umd.js +4 -2
  217. package/phoneinput/phoneinput.d.ts +0 -1
  218. package/phoneinput/phoneinput.esm.js +15 -9
  219. package/phoneinput/phoneinput.umd.js +4 -2
  220. package/pivottable/pivottable.d.ts +0 -1
  221. package/pivottable/pivottable.esm.js +15 -9
  222. package/pivottable/pivottable.umd.js +4 -2
  223. package/progressbar/circularprogressbar.d.ts +0 -1
  224. package/progressbar/progressbar.d.ts +0 -1
  225. package/progressbar/progressbar.esm.js +19 -10
  226. package/progressbar/progressbar.umd.js +8 -3
  227. package/progresswindow/progresswindow.d.ts +0 -1
  228. package/progresswindow/progresswindow.esm.js +15 -9
  229. package/progresswindow/progresswindow.umd.js +4 -2
  230. package/promptwindow/promptwindow.d.ts +0 -1
  231. package/promptwindow/promptwindow.esm.js +15 -9
  232. package/promptwindow/promptwindow.umd.js +4 -2
  233. package/qrcode/qrcode.d.ts +0 -1
  234. package/qrcode/qrcode.esm.js +15 -9
  235. package/qrcode/qrcode.umd.js +4 -2
  236. package/querybuilder/querybuilder.d.ts +0 -1
  237. package/querybuilder/querybuilder.esm.js +15 -9
  238. package/querybuilder/querybuilder.umd.js +4 -2
  239. package/radiobutton/radiobutton.d.ts +0 -1
  240. package/radiobutton/radiobutton.esm.js +15 -9
  241. package/radiobutton/radiobutton.umd.js +4 -2
  242. package/rating/rating.d.ts +0 -1
  243. package/rating/rating.esm.js +15 -9
  244. package/rating/rating.umd.js +4 -2
  245. package/ribbon/ribbon.d.ts +0 -1
  246. package/ribbon/ribbon.esm.js +27 -12
  247. package/ribbon/ribbon.umd.js +16 -5
  248. package/ribbon/ribbongroup.d.ts +0 -1
  249. package/ribbon/ribbonitem.d.ts +0 -1
  250. package/ribbon/ribbontab.d.ts +0 -1
  251. package/scheduler/scheduler.d.ts +0 -1
  252. package/scheduler/scheduler.esm.js +15 -9
  253. package/scheduler/scheduler.umd.js +4 -2
  254. package/scrollbar/scrollbar.d.ts +0 -1
  255. package/scrollbar/scrollbar.esm.js +15 -9
  256. package/scrollbar/scrollbar.umd.js +4 -2
  257. package/slider/slider.d.ts +0 -1
  258. package/slider/slider.esm.js +15 -9
  259. package/slider/slider.umd.js +4 -2
  260. package/sortable/sortable.d.ts +0 -1
  261. package/sortable/sortable.esm.js +15 -9
  262. package/sortable/sortable.umd.js +4 -2
  263. package/sortpanel/sortpanel.d.ts +0 -1
  264. package/sortpanel/sortpanel.esm.js +15 -9
  265. package/sortpanel/sortpanel.umd.js +4 -2
  266. package/source/modules/smart.3dchart.js +2 -2
  267. package/source/modules/smart.accordion.js +1 -1
  268. package/source/modules/smart.array.js +2 -2
  269. package/source/modules/smart.barcode.js +1 -1
  270. package/source/modules/smart.breadcrumb.js +1 -1
  271. package/source/modules/smart.button.js +1 -1
  272. package/source/modules/smart.buttongroup.js +1 -1
  273. package/source/modules/smart.calendar.js +2 -2
  274. package/source/modules/smart.card.js +1 -1
  275. package/source/modules/smart.cardview.js +5 -5
  276. package/source/modules/smart.carousel.js +1 -1
  277. package/source/modules/smart.chart.js +2 -2
  278. package/source/modules/smart.checkbox.js +1 -1
  279. package/source/modules/smart.checkinput.js +1 -1
  280. package/source/modules/smart.chip.js +1 -1
  281. package/source/modules/smart.colorinput.js +1 -1
  282. package/source/modules/smart.colorpanel.js +2 -2
  283. package/source/modules/smart.colorpicker.js +2 -2
  284. package/source/modules/smart.combobox.js +2 -2
  285. package/source/modules/smart.common.js +3 -3
  286. package/source/modules/smart.countryinput.js +1 -1
  287. package/source/modules/smart.dateinput.js +2 -2
  288. package/source/modules/smart.daterangeinput.js +3 -3
  289. package/source/modules/smart.datetimepicker.js +4 -4
  290. package/source/modules/smart.dockinglayout.js +1 -1
  291. package/source/modules/smart.dropdownbutton.js +1 -1
  292. package/source/modules/smart.dropdownlist.js +2 -2
  293. package/source/modules/smart.editor.js +2 -2
  294. package/source/modules/smart.element.js +1 -1
  295. package/source/modules/smart.fileupload.js +2 -2
  296. package/source/modules/smart.form.js +1 -1
  297. package/source/modules/smart.formulaparser.js +1 -1
  298. package/source/modules/smart.ganttchart.js +5 -5
  299. package/source/modules/smart.gauge.js +2 -2
  300. package/source/modules/smart.grid.js +15 -15
  301. package/source/modules/smart.gridpanel.js +5 -5
  302. package/source/modules/smart.input.js +1 -1
  303. package/source/modules/smart.kanban.js +6 -6
  304. package/source/modules/smart.layout.js +1 -1
  305. package/source/modules/smart.led.js +1 -1
  306. package/source/modules/smart.listbox.js +1 -1
  307. package/source/modules/smart.listmenu.js +1 -1
  308. package/source/modules/smart.map.js +1 -1
  309. package/source/modules/smart.maskedtextbox.js +1 -1
  310. package/source/modules/smart.menu.js +1 -1
  311. package/source/modules/smart.multicomboinput.js +1 -1
  312. package/source/modules/smart.multiinput.js +1 -1
  313. package/source/modules/smart.multilinetextbox.js +2 -2
  314. package/source/modules/smart.multisplitbutton.js +2 -2
  315. package/source/modules/smart.numberinput.js +1 -1
  316. package/source/modules/smart.numerictextbox.js +2 -2
  317. package/source/modules/smart.pager.js +1 -1
  318. package/source/modules/smart.passwordinput.js +1 -1
  319. package/source/modules/smart.passwordtextbox.js +1 -1
  320. package/source/modules/smart.path.js +1 -1
  321. package/source/modules/smart.phoneinput.js +1 -1
  322. package/source/modules/smart.pivottable.js +4 -4
  323. package/source/modules/smart.progressbar.js +1 -1
  324. package/source/modules/smart.qrcode.js +1 -1
  325. package/source/modules/smart.querybuilder.js +4 -4
  326. package/source/modules/smart.radiobutton.js +1 -1
  327. package/source/modules/smart.rating.js +1 -1
  328. package/source/modules/smart.ribbon.js +2 -2
  329. package/source/modules/smart.router.js +2 -2
  330. package/source/modules/smart.scheduler.js +6 -6
  331. package/source/modules/smart.scrollbar.js +1 -1
  332. package/source/modules/smart.slider.js +2 -2
  333. package/source/modules/smart.sortable.js +1 -1
  334. package/source/modules/smart.splitter.js +1 -1
  335. package/source/modules/smart.switchbutton.js +1 -1
  336. package/source/modules/smart.table.js +4 -4
  337. package/source/modules/smart.tabs.js +1 -1
  338. package/source/modules/smart.tank.js +2 -2
  339. package/source/modules/smart.textarea.js +1 -1
  340. package/source/modules/smart.textbox.js +2 -2
  341. package/source/modules/smart.timeinput.js +1 -1
  342. package/source/modules/smart.timepicker.js +1 -1
  343. package/source/modules/smart.toast.js +1 -1
  344. package/source/modules/smart.tooltip.js +1 -1
  345. package/source/modules/smart.tree.js +1 -1
  346. package/source/modules/smart.validator.js +1 -1
  347. package/source/modules/smart.window.js +2 -2
  348. package/source/smart.3dchart.js +1 -1
  349. package/source/smart.accordion.js +1 -1
  350. package/source/smart.ajax.js +1 -1
  351. package/source/smart.array.js +1 -1
  352. package/source/smart.barcode.js +1 -1
  353. package/source/smart.bootstrap.js +1 -1
  354. package/source/smart.breadcrumb.js +1 -1
  355. package/source/smart.button.js +1 -1
  356. package/source/smart.buttongroup.js +1 -1
  357. package/source/smart.calendar.js +1 -1
  358. package/source/smart.card.js +1 -1
  359. package/source/smart.cardview.js +1 -1
  360. package/source/smart.carousel.js +1 -1
  361. package/source/smart.chart.annotations.js +1 -1
  362. package/source/smart.chart.api.js +1 -1
  363. package/source/smart.chart.core.js +1 -1
  364. package/source/smart.chart.js +1 -1
  365. package/source/smart.chart.rangeselector.js +1 -1
  366. package/source/smart.chart.waterfall.js +1 -1
  367. package/source/smart.checkbox.js +1 -1
  368. package/source/smart.checkinput.js +1 -1
  369. package/source/smart.chip.js +1 -1
  370. package/source/smart.colorinput.js +1 -1
  371. package/source/smart.colorpanel.js +1 -1
  372. package/source/smart.colorpicker.js +1 -1
  373. package/source/smart.combobox.js +1 -1
  374. package/source/smart.complex.js +1 -1
  375. package/source/smart.core.js +1 -1
  376. package/source/smart.countryinput.js +1 -1
  377. package/source/smart.data.js +2 -2
  378. package/source/smart.date.js +2 -2
  379. package/source/smart.dateformatpanel.js +1 -1
  380. package/source/smart.dateinput.js +1 -1
  381. package/source/smart.daterangeinput.js +1 -1
  382. package/source/smart.datetimepicker.js +2 -2
  383. package/source/smart.dockinglayout.js +1 -1
  384. package/source/smart.draw.js +1 -1
  385. package/source/smart.dropdownbutton.js +1 -1
  386. package/source/smart.dropdownlist.js +2 -2
  387. package/source/smart.editor.js +2 -2
  388. package/source/smart.element.js +1 -1
  389. package/source/smart.elements.js +17 -17
  390. package/source/smart.export.js +1 -1
  391. package/source/smart.fileupload.js +1 -1
  392. package/source/smart.filter.js +1 -1
  393. package/source/smart.filterbuilder.js +1 -1
  394. package/source/smart.filterpanel.js +1 -1
  395. package/source/smart.form.js +1 -1
  396. package/source/smart.format.js +1 -1
  397. package/source/smart.formulaparser.js +1 -1
  398. package/source/smart.ganttchart.js +1 -1
  399. package/source/smart.gauge.js +1 -1
  400. package/source/smart.grid.cell.js +2 -2
  401. package/source/smart.grid.chart.js +1 -1
  402. package/source/smart.grid.column.js +1 -1
  403. package/source/smart.grid.core.js +2 -2
  404. package/source/smart.grid.dialog.js +2 -2
  405. package/source/smart.grid.edit.js +2 -2
  406. package/source/smart.grid.export.js +1 -1
  407. package/source/smart.grid.filter.js +1 -1
  408. package/source/smart.grid.group.js +2 -2
  409. package/source/smart.grid.js +1 -1
  410. package/source/smart.grid.menu.js +1 -1
  411. package/source/smart.grid.pager.js +1 -1
  412. package/source/smart.grid.reorder.js +2 -2
  413. package/source/smart.grid.resize.js +1 -1
  414. package/source/smart.grid.row.js +1 -1
  415. package/source/smart.grid.select.js +2 -2
  416. package/source/smart.grid.sort.js +2 -2
  417. package/source/smart.grid.toolbar.js +2 -2
  418. package/source/smart.grid.tree.js +1 -1
  419. package/source/smart.grid.view.js +2 -2
  420. package/source/smart.gridpanel.js +1 -1
  421. package/source/smart.input.js +1 -1
  422. package/source/smart.kanban.js +2 -2
  423. package/source/smart.layout.js +1 -1
  424. package/source/smart.led.js +1 -1
  425. package/source/smart.listbox.js +1 -1
  426. package/source/smart.listmenu.js +1 -1
  427. package/source/smart.map.js +1 -1
  428. package/source/smart.maskedtextbox.js +1 -1
  429. package/source/smart.math.js +1 -1
  430. package/source/smart.menu.js +1 -1
  431. package/source/smart.multicomboinput.js +1 -1
  432. package/source/smart.multiinput.js +1 -1
  433. package/source/smart.multilinetextbox.js +1 -1
  434. package/source/smart.multisplitbutton.js +1 -1
  435. package/source/smart.numberformatpanel.js +1 -1
  436. package/source/smart.numberinput.js +1 -1
  437. package/source/smart.numeric.js +1 -1
  438. package/source/smart.numerictextbox.js +1 -1
  439. package/source/smart.pager.js +1 -1
  440. package/source/smart.passwordinput.js +1 -1
  441. package/source/smart.passwordtextbox.js +1 -1
  442. package/source/smart.path.js +1 -1
  443. package/source/smart.phoneinput.js +1 -1
  444. package/source/smart.pivottable.js +1 -1
  445. package/source/smart.powerbutton.js +1 -1
  446. package/source/smart.progressbar.js +1 -1
  447. package/source/smart.qrcode.js +1 -1
  448. package/source/smart.radiobutton.js +1 -1
  449. package/source/smart.rating.js +1 -1
  450. package/source/smart.ribbon.js +1 -1
  451. package/source/smart.router.js +1 -1
  452. package/source/smart.scheduler.js +2 -2
  453. package/source/smart.scrollbar.js +1 -1
  454. package/source/smart.slider.js +1 -1
  455. package/source/smart.sortable.js +1 -1
  456. package/source/smart.splitter.js +1 -1
  457. package/source/smart.switchbutton.js +1 -1
  458. package/source/smart.table.js +1 -1
  459. package/source/smart.tabs.js +1 -1
  460. package/source/smart.tank.js +1 -1
  461. package/source/smart.textarea.js +1 -1
  462. package/source/smart.textbox.js +1 -1
  463. package/source/smart.tickintervalhandler.js +1 -1
  464. package/source/smart.timeinput.js +1 -1
  465. package/source/smart.timepicker.js +1 -1
  466. package/source/smart.toast.js +1 -1
  467. package/source/smart.tooltip.js +1 -1
  468. package/source/smart.tree.js +1 -1
  469. package/source/smart.validationpanel.js +1 -1
  470. package/source/smart.validator.js +1 -1
  471. package/source/smart.window.js +1 -1
  472. package/source/styles/components/smart.grid.css +1 -1
  473. package/source/styles/components/smart.kanban.css +1 -1
  474. package/source/styles/default/scss/smart.grid.scss +14 -3
  475. package/source/styles/default/scss/smart.kanban.scss +13 -2
  476. package/source/styles/default/smart.grid.css +15 -3
  477. package/source/styles/default/smart.kanban.css +1607 -1599
  478. package/source/styles/smart.default.css +2 -2
  479. package/source/typescript/smart.elements.d.ts +1 -11
  480. package/source/typescript/smart.ganttchart.d.ts +0 -10
  481. package/source/typescript/smart.ribbon.d.ts +1 -1
  482. package/splitter/splitter.d.ts +0 -1
  483. package/splitter/splitter.esm.js +23 -11
  484. package/splitter/splitter.umd.js +12 -4
  485. package/splitter/splitterbar.d.ts +0 -1
  486. package/splitter/splitteritem.d.ts +0 -1
  487. package/switchbutton/switchbutton.d.ts +0 -1
  488. package/switchbutton/switchbutton.esm.js +15 -9
  489. package/switchbutton/switchbutton.umd.js +4 -2
  490. package/table/pivottable.d.ts +0 -1
  491. package/table/sortable.d.ts +0 -1
  492. package/table/table.d.ts +0 -1
  493. package/table/table.esm.js +15 -9
  494. package/table/table.umd.js +4 -2
  495. package/tabs/tabs.d.ts +0 -1
  496. package/tabs/tabs.esm.js +23 -11
  497. package/tabs/tabs.umd.js +12 -4
  498. package/tabs/tabswindow.d.ts +0 -1
  499. package/tabswindow/tabswindow.d.ts +0 -1
  500. package/tabswindow/tabswindow.esm.js +15 -9
  501. package/tabswindow/tabswindow.umd.js +4 -2
  502. package/tank/tank.d.ts +0 -1
  503. package/tank/tank.esm.js +15 -9
  504. package/tank/tank.umd.js +4 -2
  505. package/textarea/textarea.d.ts +0 -1
  506. package/textarea/textarea.esm.js +15 -9
  507. package/textarea/textarea.umd.js +4 -2
  508. package/textbox/maskedtextbox.d.ts +0 -1
  509. package/textbox/multilinetextbox.d.ts +0 -1
  510. package/textbox/numerictextbox.d.ts +0 -1
  511. package/textbox/passwordtextbox.d.ts +0 -1
  512. package/textbox/textbox.d.ts +0 -1
  513. package/textbox/textbox.esm.js +23 -11
  514. package/textbox/textbox.umd.js +12 -4
  515. package/threedchart/threedchart.d.ts +0 -1
  516. package/threedchart/threedchart.esm.js +15 -9
  517. package/threedchart/threedchart.umd.js +4 -2
  518. package/timeinput/timeinput.d.ts +0 -1
  519. package/timeinput/timeinput.esm.js +15 -9
  520. package/timeinput/timeinput.umd.js +4 -2
  521. package/timepicker/datetimepicker.d.ts +0 -1
  522. package/timepicker/timepicker.d.ts +0 -1
  523. package/timepicker/timepicker.esm.js +15 -9
  524. package/timepicker/timepicker.umd.js +4 -2
  525. package/toast/toast.d.ts +0 -1
  526. package/toast/toast.esm.js +15 -9
  527. package/toast/toast.umd.js +4 -2
  528. package/tooltip/tooltip.d.ts +0 -1
  529. package/tooltip/tooltip.esm.js +15 -9
  530. package/tooltip/tooltip.umd.js +4 -2
  531. package/tree/tree.d.ts +0 -1
  532. package/tree/tree.esm.js +23 -11
  533. package/tree/tree.umd.js +12 -4
  534. package/tree/treeitem.d.ts +0 -1
  535. package/tree/treeitemsgroup.d.ts +0 -1
  536. package/validator/validator.d.ts +0 -1
  537. package/validator/validator.esm.js +15 -9
  538. package/validator/validator.umd.js +4 -2
  539. package/waitwindow/waitwindow.d.ts +0 -1
  540. package/waitwindow/waitwindow.esm.js +15 -9
  541. package/waitwindow/waitwindow.umd.js +4 -2
  542. package/window/alertwindow.d.ts +0 -1
  543. package/window/dialogwindow.d.ts +0 -1
  544. package/window/multilinewindow.d.ts +0 -1
  545. package/window/progresswindow.d.ts +0 -1
  546. package/window/promptwindow.d.ts +0 -1
  547. package/window/tabswindow.d.ts +0 -1
  548. package/window/waitwindow.d.ts +0 -1
  549. package/window/window.d.ts +0 -1
  550. package/window/window.esm.js +15 -9
  551. package/window/window.umd.js +4 -2
@@ -52,21 +52,21 @@ Smart.Utilities.Assign("Complex",class{constructor(r,a){if("string"==typeof r)th
52
52
  /***/ 6057:
53
53
  /***/ (() => {
54
54
 
55
- (()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{if("parent"===e[t])e[t]="$"+e[t]})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let f=new Array;for(let t=0;t<e.length;t++)f[t]=u();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const h=new Array,p=new Array;let g=0;const S=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let y=!1;for(let n=0;n<d.length;n++){let m=Object.assign({},S(d[n]));m[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=m[a];null!=n?((""===n||void 0===n&&0===t)&&(y=!0),T[b++]={value:n,group:a,hash:f[t]}):(T[b++]={value:null,group:a,hash:f[t]},0===t&&(y=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===p[v]||null===p[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=m,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==m[c.expanded]?x[c.expanded]=m[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=m[i]),x[t]=new Array;let e=h.length+l;this.id&&"number"!=typeof m.$.id&&!isFinite(m.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),h[g++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=m,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==m[c.expanded]?e[c.expanded]=m[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=m[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}p[v]=x}else x=p[v]}m&&(m[c.leaf]=!0),null!==x?(null===this.id?void 0===m.$.id&&(m.$.id=x.$.id+"_"+x[t].length):void 0===m.$.id&&-1===m.$.id.toString().indexOf(x.$.id)&&(m.$.id=x.$.id+"_"+m.$.id),m[o]=x,m[c.level]=x[c.level]+1,x[t][x[t].length]=m):void 0===m.$.id&&(m.$.id=u())}if(y){let e=null,t=!1;for(let a=0;a<h.length;a++){const n=h[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),h.splice(a,1);break}}if(e&&(h.push(e),t))for(let e=0;e<h.length;e++){const t=h[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return h}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){const e=function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0};return e}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
55
+ (()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{if("parent"===e[t])e[t]="$"+e[t]})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=s.boundSource.canNotify;s.boundSource.canNotify=!1;const f=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let h=new Array;for(let t=0;t<e.length;t++)h[t]=f();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const p=new Array,g=new Array;let S=0;const y=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let m=!1;for(let n=0;n<d.length;n++){let u=y(d[n]);u[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=u[a];null!=n?((""===n||void 0===n&&0===t)&&(m=!0),T[b++]={value:n,group:a,hash:h[t]}):(T[b++]={value:null,group:a,hash:h[t]},0===t&&(m=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===g[v]||null===g[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=u,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==u[c.expanded]?x[c.expanded]=u[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=u[i]),x[t]=new Array;let e=p.length+l;this.id&&"number"!=typeof u.$.id&&!isFinite(u.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),p[S++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=u,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==u[c.expanded]?e[c.expanded]=u[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=u[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}g[v]=x}else x=g[v]}u&&(u[c.leaf]=!0),null!==x?(null===this.id?void 0===u.$.id&&(u.$.id=x.$.id+"_"+x[t].length):void 0===u.$.id&&-1===u.$.id.toString().indexOf(x.$.id)&&(u.$.id=x.$.id+"_"+u.$.id),u[o]=x,u[c.level]=x[c.level]+1,x[t][x[t].length]=u):void 0===u.$.id&&(u.$.id=f())}if(m){let e=null,t=!1;for(let a=0;a<p.length;a++){const n=p[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),p.splice(a,1);break}}if(e&&(p.push(e),t))for(let e=0;e<p.length;e++){const t=p[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return s.boundSource.canNotify=u,p}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){const e=function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0};return e}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
56
56
 
57
57
  /***/ }),
58
58
 
59
59
  /***/ 2052:
60
60
  /***/ (() => {
61
61
 
62
- (()=>{const e=-1*(new Date).getTimezoneOffset(),t=[{id:"Local",offset:e,offsetHours:e/60,displayName:"",supportsDaylightSavingTime:!1},{id:"Dateline Standard Time",offset:-720,offsetHours:-12,displayName:"(UTC-12:00) International Date Line West",supportsDaylightSavingTime:!1},{id:"UTC-11",offset:-660,offsetHours:-11,displayName:"(UTC-11:00) Coordinated Universal Time-11",supportsDaylightSavingTime:!1},{id:"Hawaiteratoran Standard Time",offset:-600,offsetHours:-10,displayName:"(UTC-10:00) Hawaiterator",supportsDaylightSavingTime:!1},{id:"Alaskan Standard Time",offset:-540,offsetHours:-9,displayName:"(UTC-09:00) Alaska",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time (Mexico)",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Baja California",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Pacific Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Arizona",supportsDaylightSavingTime:!1},{id:"Mountain Standard Time (Mexico)",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",supportsDaylightSavingTime:!0},{id:"Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Mountain Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central America Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central America",supportsDaylightSavingTime:!1},{id:"Canada Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Saskatchewan",supportsDaylightSavingTime:!1},{id:"Central Standard Time (Mexico)",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",supportsDaylightSavingTime:!0},{id:"SA Pacific Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco",supportsDaylightSavingTime:!1},{id:"Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Eastern Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Indiana (East)",supportsDaylightSavingTime:!0},{id:"Venezuela Standard Time",offset:-270,offsetHours:-4.5,displayName:"(UTC-04:30) Caracas",supportsDaylightSavingTime:!1},{id:"Atlantic Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Atlantic Time (Canada)",supportsDaylightSavingTime:!0},{id:"Paraguay Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Asuncion",supportsDaylightSavingTime:!0},{id:"Central Brazilian Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Cuiaba",supportsDaylightSavingTime:!0},{id:"Pacific SA Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Santiago",supportsDaylightSavingTime:!0},{id:"SA Western Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",supportsDaylightSavingTime:!1},{id:"Newfoundland Standard Time",offset:-210,offsetHours:-3.5,displayName:"(UTC-03:30) Newfoundland",supportsDaylightSavingTime:!0},{id:"SA Eastern Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Cayenne, Fortaleza",supportsDaylightSavingTime:!1},{id:"Argentina Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Buenos Aires",supportsDaylightSavingTime:!0},{id:"E. South America Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Brasilia",supportsDaylightSavingTime:!0},{id:"Bahia Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Salvador",supportsDaylightSavingTime:!0},{id:"Montevideo Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Montevideo",supportsDaylightSavingTime:!0},{id:"Greenland Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Greenland",supportsDaylightSavingTime:!0},{id:"UTC-02",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Coordinated Universal Time-02",supportsDaylightSavingTime:!1},{id:"Mid-Atlantic Standard Time",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Mid-Atlantic - Old",supportsDaylightSavingTime:!0},{id:"Azores Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Azores",supportsDaylightSavingTime:!0},{id:"Cape Verde Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Cape Verde Is.",supportsDaylightSavingTime:!1},{id:"Morocco Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Casablanca",supportsDaylightSavingTime:!0},{id:"UTC",offset:0,offsetHours:0,displayName:"(UTC) Coordinated Universal Time",supportsDaylightSavingTime:!1},{id:"GMT Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Dublin, Edinburgh, Lisbon, London",supportsDaylightSavingTime:!0},{id:"Greenwich Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Monrovia, Reykjavik",supportsDaylightSavingTime:!1},{id:"Central European Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",supportsDaylightSavingTime:!0},{id:"Namibia Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Windhoek",supportsDaylightSavingTime:!0},{id:"W. Central Africa Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) West Central Africa",supportsDaylightSavingTime:!1},{id:"W. Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",supportsDaylightSavingTime:!0},{id:"Central Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",supportsDaylightSavingTime:!0},{id:"Romance Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",supportsDaylightSavingTime:!0},{id:"FLE Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",supportsDaylightSavingTime:!0},{id:"South Africa Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Harare, Pretoria",supportsDaylightSavingTime:!1},{id:"Turkey Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Istanbul",supportsDaylightSavingTime:!0},{id:"GTB Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Athens, Bucharest",supportsDaylightSavingTime:!0},{id:"Libya Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Tripoli",supportsDaylightSavingTime:!0},{id:"E. Europe Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) E. Europe",supportsDaylightSavingTime:!0},{id:"Jordan Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Amman",supportsDaylightSavingTime:!0},{id:"Middle East Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Beirut",supportsDaylightSavingTime:!0},{id:"Egypt Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Cairo",supportsDaylightSavingTime:!0},{id:"Syria Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Damascus",supportsDaylightSavingTime:!0},{id:"Israel Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Jerusalem",supportsDaylightSavingTime:!0},{id:"Arab Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kuwait, Riyadh",supportsDaylightSavingTime:!1},{id:"E. Africa Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Nairobi",supportsDaylightSavingTime:!1},{id:"Arabic Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Baghdad",supportsDaylightSavingTime:!0},{id:"Kaliningrad Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kaliningrad, Minsk",supportsDaylightSavingTime:!0},{id:"Iran Standard Time",offset:210,offsetHours:3.5,displayName:"(UTC+03:30) Tehran",supportsDaylightSavingTime:!0},{id:"Mauritius Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Port Louis",supportsDaylightSavingTime:!0},{id:"Georgian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Tbilisi",supportsDaylightSavingTime:!1},{id:"Caucasus Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Yerevan",supportsDaylightSavingTime:!0},{id:"Arabian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Abu Dhabi, Muscat",supportsDaylightSavingTime:!1},{id:"Azerbaijan Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Baku",supportsDaylightSavingTime:!0},{id:"Russian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Moscow, St. Petersburg, Volgograd",supportsDaylightSavingTime:!0},{id:"Afghanistan Standard Time",offset:270,offsetHours:4.5,displayName:"(UTC+04:30) Kabul",supportsDaylightSavingTime:!1},{id:"Pakistan Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Islamabad, Karachi",supportsDaylightSavingTime:!0},{id:"West Asia Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Ashgabat, Tashkent",supportsDaylightSavingTime:!1},{id:"India Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",supportsDaylightSavingTime:!1},{id:"Sri Lanka Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Sri Jayawardenepura",supportsDaylightSavingTime:!1},{id:"Nepal Standard Time",offset:345,offsetHours:5.75,displayName:"(UTC+05:45) Kathmandu",supportsDaylightSavingTime:!1},{id:"Central Asia Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Astana",supportsDaylightSavingTime:!1},{id:"Bangladesh Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Dhaka",supportsDaylightSavingTime:!0},{id:"Ekaterinburg Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Ekaterinburg",supportsDaylightSavingTime:!0},{id:"Myanmar Standard Time",offset:390,offsetHours:6.5,displayName:"(UTC+06:30) Yangon (Rangoon)",supportsDaylightSavingTime:!1},{id:"SE Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Bangkok, Hanoi, Jakarta",supportsDaylightSavingTime:!1},{id:"N. Central Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Novosibirsk",supportsDaylightSavingTime:!0},{id:"Ulaanbaatar Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Ulaanbaatar",supportsDaylightSavingTime:!1},{id:"China Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",supportsDaylightSavingTime:!1},{id:"Singapore Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Kuala Lumpur, Singapore",supportsDaylightSavingTime:!1},{id:"North Asia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Krasnoyarsk",supportsDaylightSavingTime:!0},{id:"Taipei Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Taipei",supportsDaylightSavingTime:!1},{id:"W. Australia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Perth",supportsDaylightSavingTime:!0},{id:"Korea Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Seoul",supportsDaylightSavingTime:!1},{id:"North Asia East Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Irkutsk",supportsDaylightSavingTime:!0},{id:"Tokyo Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Osaka, Sapporo, Tokyo",supportsDaylightSavingTime:!1},{id:"AUS Central Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Darwin",supportsDaylightSavingTime:!1},{id:"Cen. Australia Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Adelaide",supportsDaylightSavingTime:!0},{id:"West Pacific Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Guam, Port Moresby",supportsDaylightSavingTime:!1},{id:"Tasmania Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Hobart",supportsDaylightSavingTime:!0},{id:"E. Australia Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Brisbane",supportsDaylightSavingTime:!1},{id:"AUS Eastern Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Canberra, Melbourne, Sydney",supportsDaylightSavingTime:!0},{id:"Yakutsk Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Yakutsk",supportsDaylightSavingTime:!0},{id:"Vladivostok Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Vladivostok",supportsDaylightSavingTime:!0},{id:"Central Pacific Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Solomon Is., New Caledonia",supportsDaylightSavingTime:!1},{id:"Magadan Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Magadan",supportsDaylightSavingTime:!0},{id:"Kamchatka Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",supportsDaylightSavingTime:!0},{id:"Fiji Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Fiji",supportsDaylightSavingTime:!0},{id:"New Zealand Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Auckland, Wellington",supportsDaylightSavingTime:!0},{id:"UTC+12",offset:720,offsetHours:12,displayName:"(UTC+12:00) Coordinated Universal Time+12",supportsDaylightSavingTime:!1},{id:"Tonga Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Nuku'alofa",supportsDaylightSavingTime:!1},{id:"Samoa Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Samoa",supportsDaylightSavingTime:!0}],a=[0,31,59,90,120,151,181,212,243,273,304,334,365],s=[0,31,60,91,121,152,182,213,244,274,305,335,366];Smart.Utilities.Assign("TimeSpan",class{constructor(){const e=this;if(e.ticksPerMillisecond=1e4,e.millisecondsPerTick=1e-4,e.ticksPerSecond=1e7,e.secondsPerTick=1e-7,e.ticksPerMinute=6e8,e.minutesPerTick=1/6e8,e.ticksPerHour=36e9,e.hoursPerTick=1/36e9,e.ticksPerDay=864e9,e.daysPerTick=1/864e9,e.millisPerSecond=1e3,e.millisPerMinute=6e4,e.millisPerHour=36e5,e.millisPerDay=864e5,e._ticks=0,1===arguments.length){if(isNaN(arguments[0]))throw new Error("Argument must be a number.");e._ticks=arguments[0]}else if(3===arguments.length)e._ticks=e.timeToMS(arguments[0],arguments[1],arguments[2],0);else if(4===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+0;e._ticks=t*e.ticksPerMillisecond}else if(5===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+arguments[4];e._ticks=t*e.ticksPerMillisecond}}ticks(){return this._ticks}days(){return parseInt(this._ticks/this.ticksPerDay)}timeToMS(e,t,a,s){return parseInt((3600*e+60*t+a+s/1e3)*this.ticksPerSecond)}hours(){return parseInt(this._ticks/this.ticksPerHour)%24}milliseconds(){return parseInt(this._ticks/this.ticksPerMillisecond)%1e3}minutes(){return parseInt(this._ticks/this.ticksPerMinute)%60}seconds(){return parseInt(this._ticks/this.ticksPerSecond)%60}totalDays(){return parseInt(this._ticks*this.daysPerTick)}totalHours(){return parseInt(this._ticks*this.hoursPerTick)}totalMilliseconds(){const e=this._ticks*this.millisecondsPerTick;return parseInt(e)}totalMinutes(){return parseInt(this._ticks*this.minutesPerTick)}totalSeconds(){return parseInt(this._ticks*this.secondsPerTick)}add(e){const t=this._ticks+e._ticks;return new Smart.Utilities.TimeSpan(t)}subtract(e){const t=this._ticks-e._ticks;return new Smart.Utilities.TimeSpan(t)}duration(){const e=this;return e._ticks>=0?new Smart.Utilities.TimeSpan(e._ticks):new Smart.Utilities.TimeSpan(-e._ticks)}equals(e){return this._ticks===e._ticks}valueOf(){return this._ticks}compare(e,t){return e._ticks>t._ticks?1:e._ticks<t._ticks?-1:0}interval(e,t){const a=e*t+(e>=0?.5:-.5);return new Smart.Utilities.TimeSpan(a*this.ticksPerMillisecond)}fromDays(e){return this.interval(e,this.millisPerDay)}fromHours(e){return this.interval(e,this.millisPerHour)}fromMilliseconds(e){return this.interval(e,1)}fromMinutes(e){return this.interval(e,this.millisPerMinute)}fromSeconds(e){return this.interval(e,this.millisPerSecond)}fromTicks(e){return new Smart.Utilities.TimeSpan(e)}toString(){return this.totalMilliseconds().toString()}negate(){return new Smart.Utilities.TimeSpan(-this._ticks)}}),Smart.Utilities.Assign("DateTime",class{constructor(){function e(e){const t=i.regexISOString.exec(e);r=new Smart.Utilities.DateTime(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]),parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]),parseFloat(t[7]),0,0,0,0,0,0,0,"UTC")}const i=this;let r;if(i.ticksPerMillisecond=1e4,i.millisecondsPerTick=1e-4,i.ticksPerSecond=1e7,i.secondsPerTick=1e-7,i.ticksPerMinute=6e8,i.minutesPerTick=1/6e8,i.ticksPerHour=36e9,i.hoursPerTick=1/36e9,i.ticksPerDay=864e9,i.daysPerTick=1/864e9,i.millisPerSecond=1e3,i.millisPerMinute=6e4,i.millisPerHour=36e5,i.millisPerDay=864e5,i.daysPerYear=365,i.daysPer4Years=1461,i.daysPer100Years=36524,i.daysPer400Years=146097,i.daysTo1601=584388,i.daysTo1899=693593,i.daysTo10000=3652059,i.minTicks=0,i.maxTicks=3155378976e9,i.maxMillis=3155378976e5,i.datePartYear=0,i.datePartDayOfYear=1,i.datePartMonth=2,i.datePartDay=3,i.daysToMonth365=a,i.daysToMonth366=s,i.minValue=new Date(0),i.maxValue=new Date(3155378976e9),i.ticksMask=0x4000000000000000,i.flagsMask=0xc000000000000000,i.localMask=0x8000000000000000,i.ticksCeiling=0x4000000000000000,i.kindUnspecified=0,i.kindUtc=0x4000000000000000,i.kindLocal=0x8000000000000000,i.kindLocalAmbiguousDst=0xc000000000000000,i.kindShift=62,i.regexTrim=/^\s+|\s+$/g,i.regexInfinity=/^[+-]?infinity$/i,i.regexHex=/^0x[a-f0-9]+$/i,i.regexParseFloat=/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/,i.regexISOString=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})Z$/,i.calendar={"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",FP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",FPA:"yyyy/MM/dd HH:mm:ss:fffuunnppeeaaxxoo",FPA2:"yyyy-MM-dd HH:mm:ss:fffuunnppeeaaxxoo",FT:"HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",PP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp",PT:"HH:mm:ss:fff:uu:nn:pp"},percentsymbol:"%",currencysymbol:"$",currencysymbolposition:"before",decimalseparator:".",thousandsseparator:","},i.dateData=0,i.timeZone=null,i.timeZones=t,i._codeToUnit={u:"_microsecond",uu:"_microsecond",n:"_nanosecond",nn:"_nanosecond",p:"_picosecond",pp:"_picosecond",e:"_femtosecond",ee:"_femtosecond",a:"_attosecond",aa:"_attosecond",x:"_zeptosecond",xx:"_zeptosecond",o:"_yoctosecond",oo:"_yoctosecond"},i._smallUnits=["_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"],i._microsecond=0,i._nanosecond=0,i._picosecond=0,i._femtosecond=0,i._attosecond=0,i._zeptosecond=0,i._yoctosecond=0,0===arguments.length){const e=new Date;i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else if(1===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}}else if(2===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}i.validateTimeZone(arguments[1])}else if(arguments.length>2)if("string"==typeof arguments[0]){const e=i.tryparseDate(arguments[0],arguments[2],arguments[1]);i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else{const e=arguments[0],t=arguments[7]||0,a=arguments[8]||0,s=arguments[9]||0,r=arguments[10]||0,n=arguments[11]||0,o=arguments[12]||0,d=arguments[13]||0,l=new Date(e,arguments[1]-1,arguments[2],arguments[3]||0,arguments[4]||0,arguments[5]||0,arguments[6]||0);e<1970&&l.setFullYear(e),i.dateData=i.dateToMS(l.getFullYear(),l.getMonth()+1,l.getDate())+i.timeToMS(l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds()),i._microsecond=t,i._nanosecond=a,i._picosecond=s,i._femtosecond=r,i._attosecond=n,i._zeptosecond=o,i._yoctosecond=d,arguments[14]&&i.validateTimeZone(arguments[14])}if(i.timeZone||i.validateTimeZone("Local"),r){const e=r.toTimeZone(i.timeZone);i.dateData=e.dateData}}static isValidDate(e){const t=this.validateDate(e);return!(!t||t&&!t.dateData)}static validateDate(e,t,a){if(e instanceof Smart.Utilities.DateTime)return e;if(e instanceof Date)return new Smart.Utilities.DateTime(e);try{if("string"==typeof e&&a)return this.parseDateString(e,t,a);if(new RegExp(/^\d{1,2}\/\d{1,2}\/\d{4}(, \d{1,2}:\d{2}:\d{1,2} [A|P]M)?$/).test(e)){const t=new Date(e);if(!isNaN(t.getTime()))return new Smart.Utilities.DateTime(t)}if("string"==typeof e)return this.parseDateString(e,t,a);if("number"==typeof e)return new Smart.Utilities.DateTime(new Date(e))}catch(e){}return t}static parseDateString(e,t,a){const s=new Date(e);if(!isNaN(s.getTime()))return e&&"string"==typeof e&&a?new Smart.Utilities.DateTime(e,a,null):new Smart.Utilities.DateTime(s);const i=e.indexOf("Date("),r=e.indexOf("DateTime("),n=e.lastIndexOf(")");let o=e;if(-1===i&&-1===r||-1===n){const t=new Smart.Utilities.DateTime,s=t.parseDate(e,a);if(s)return o=new Smart.Utilities.DateTime(s),t.copySmallTimePartValues(o),o}else{if(o=-1!==i?e.slice(i+5,n):e.slice(r+9,n),o=o.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),""===o.trim())return new Smart.Utilities.DateTime;if(new RegExp(/(^(\d+)(\s*,\s*\d+)+(\s*,\s*[a-zA-Z ]+)?$)/g).test(o))return o=o.split(","),o.map((function(e,t){isNaN(o[t])?o[t]=e.trim():o[t]=parseInt(e)})),-1!==i&&o[1]++,o.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,o)),o}if(""===o.trim())return t;if(!isNaN(o))return o=new Date(parseInt(o,10)),new Smart.Utilities.DateTime(o);try{const e=o.split(",");2===e.length?(e[1]=e[1].trim(),e.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,e))):o=new Smart.Utilities.DateTime(o)}catch(e){o=t}return o}static fromFullTimeStamp(e){e=e.toString();const t=new Smart.Utilities.DateTime(parseFloat(e.slice(0,e.length-21)));let a=e.slice(e.length-21),s=0;for(;a.length>0;)t[t._smallUnits[s]]=parseInt(a.slice(0,3),10),a=a.slice(3),s++;return t}static getConstructorParameters(e){return[e.year(),e.month(),e.day(),e.hour(),e.minute(),e.second(),e.millisecond(),e._microsecond,e._nanosecond,e._picosecond,e._femtosecond,e._attosecond,e._zeptosecond,e._yoctosecond,e.timeZone]}static detectDisplayMode(e,t,a){if(e.calendar.patterns[t])return-1!==["d","D","M","Y","d1","d2"].indexOf(t)?"calendar":-1!==["t","T","FT","PT"].indexOf(t)?"timePicker":"default";const s=["d","M","y"],i=["h","H","m","s","t","f","u","n","p","e","a","x","o"],r=a.groups;let n=!1,o=!1;for(let e=0;e<r.length;e++){const t=r[e].charAt(0);if(-1!==s.indexOf(t)?n=!0:-1!==i.indexOf(t)&&(o=!0),n&&o)break}return n===o?"default":n?"calendar":"timePicker"}static getLocalizedNames(e){const t={names:[],namesAbbr:[],namesShort:[]},a={names:[],namesAbbr:[]};if(this[e])return this[e];for(let a=23;a<30;a++){const s=new Date(2017,6,a),i=s.toLocaleString(e,{weekday:"long"});t.names.push(i),t.namesAbbr.push(s.toLocaleString(e,{weekday:"short"})),t.namesShort.push(i.substring(0,2))}for(let t=0;t<12;t++){const s=new Date(2017,t,1).toLocaleString(e,{month:"long"});a.names.push(s),a.namesAbbr.push(s.substring(0,3))}return a.names.push(""),a.namesAbbr.push(""),this[e]={days:t,months:a},this[e]}internalMS(){return this.dateData}getDatePart(e){const t=this,a=t.internalMS();let s=parseInt(a/t.millisPerDay);const i=parseInt(s/t.daysPer400Years);s-=i*t.daysPer400Years;let r=parseInt(s/t.daysPer100Years);4===r&&(r=3),s-=r*t.daysPer100Years;const n=parseInt(s/t.daysPer4Years);s-=n*t.daysPer4Years;let o=parseInt(s/t.daysPerYear);if(4===o&&(o=3),e===t.datePartYear)return parseInt(400*i+100*r+4*n+o+1);if(s-=o*t.daysPerYear,e===t.datePartDayOfYear)return parseInt(s+1);const d=3===o&&(24!==n||3===r)?t.daysToMonth366:t.daysToMonth365;let l=s>>6;for(;s>=d[l];)l++;return e===t.datePartMonth?parseInt(l):parseInt(s-d[l-1]+1)}dayOfWeek(){const e=this.dateData;return parseInt(e/this.millisPerDay+1)%7}dayOfYear(){return this.getDatePart(this.datePartDayOfYear)}weekOfYear(e){const t=this.toDate(),a=e||this.calendar.firstDay,s=new Date(t.getFullYear(),0,1),i=Math.floor((t.getTime()-s.getTime()-6e4*(t.getTimezoneOffset()-s.getTimezoneOffset()))/864e5)+1;let r,n=s.getDay()-a;if(n=n>=0?n:n+7,n<4){if(r=Math.floor((i+n-1)/7)+1,r>52){let e=new Date(t.getFullYear()+1,0,1).getDay()-a;e=e>=0?e:e+7,r=e<4?1:53}}else r=Math.floor((i+n-1)/7);return r}subtract(e){const t=this;return new Smart.Utilities.TimeSpan(t.dateData*t.ticksPerMillisecond-e.dateData*t.ticksPerMillisecond)}dateToMS(e,t,a){const s=this;if(e>=1&&e<=9999&&t>=1&&t<=12){e=parseInt(e);const i=s.isLeapYear(e)?s.daysToMonth366:s.daysToMonth365;if(a>=1&&a<=i[t]-i[t-1]){const r=e-1;return(365*r+parseInt(r/4)-parseInt(r/100)+parseInt(r/400)+i[t-1]+a-1)*s.millisPerDay}}}isLeapYear(e){if(e<1||e>9999)throw new Error("Year out of Range");return e%4==0&&(e%100!=0||e%400==0)}timeToMS(e,t,a,s){const i=this;if(e>=0&&e<24&&t>=0&&t<60&&a>=0&&a<60){const r=parseInt(3600*e+60*t+a);return s>0&&s<1e3?r*i.millisPerSecond+s:r*i.millisPerSecond}}daysInMonth(e,t){if(t<1||t>12)throw new Error("Month out of Range");const a=this,s=a.isLeapYear(e)?a.daysToMonth366:a.daysToMonth365;return s[t]-s[t-1]}arrayIndexOf(e,t){return e.indexOf(t)}startsWith(e,t){return 0===e.indexOf(t)}endsWith(e,t){return e.substr(e.length-t.length)===t}trim(e){return(e+"").replace(this.regexTrim,"")}expandFormat(e,t){t=t||"F";let a,s=e.patterns,i=t.length;if(s[t])return s[t];if(1===i){if(a=s[t],!a)throw"Invalid date format string '"+t+"'.";t=a}else 2===i&&"%"===t.charAt(0)&&(t=t.charAt(1));return t}getEra(e,t){if(!t)return 0;if("string"==typeof e)return 0;let a,s=e.getTime();for(let e=0,i=t.length;e<i;e++)if(a=t[e].start,null===a||s>=a)return e;return 0}toUpper(e){return e.split(" ").join(" ").toUpperCase()}toUpperArray(e){const t=[];for(let a=0,s=e.length;a<s;a++)t[a]=this.toUpper(e[a]);return t}getEraYear(e,t,a,s){let i=e.getFullYear();return!s&&t.eras&&(i-="number"==typeof a?a:t.eras[a].offset),i}getDayIndex(e,t,a){const s=this,i=e.days;let r,n=e._upperDays;return n||(e._upperDays=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr),s.toUpperArray(i.namesShort)]),t=t.toUpperCase(),a?(r=s.arrayIndexOf(n[1],t),-1===r&&(r=s.arrayIndexOf(n[2],t))):r=s.arrayIndexOf(n[0],t),r}getMonthIndex(e,t,a){const s=this;let i=e.months,r=e.monthsGenitive||e.months,n=e._upperMonths,o=e._upperMonthsGen;n||(e._upperMonths=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr)],e._upperMonthsGen=o=[s.toUpperArray(r.names),s.toUpperArray(r.namesAbbr)]),t=s.toUpper(t);let d=s.arrayIndexOf(a?n[1]:n[0],t);return d<0&&(d=s.arrayIndexOf(a?o[1]:o[0],t)),d}appendPreOrPostMatch(e,t){let a=0,s=!1;for(let i=0,r=e.length;i<r;i++){const r=e.charAt(i);switch(r){case"'":s?t.push("'"):a++,s=!1;break;case"\\":s&&t.push("\\"),s=!s;break;default:t.push(r),s=!1}}return a}getTokenRegExp(){return/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyyy|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|uu|u|nn|n|pp|p|ee|e|aa|a|xx|x|oo|o|i{1,24}|zzz|zz|z|gg|g/g}static ParseDate(e,t){return(new Smart.Utilities.DateTime).tryparseDate(e,null,t)}tryparseDate(e,t,a){const s=this;if(null==t&&(t=s.calendar),void 0!==a){if(Array.isArray(a))for(let i=0;i<a.length;i++){const r=s.parseDate(e,a[i],t);if(r)return r}const i=s.parseDate(e,a,t);if(i)return i}if(""===e)return null;if(null==e||e.substring||(e=e.toString()),null!=e&&"/Date("===e.substring(0,6)){const t=/^\/Date\((-?\d+)(\+|-)?(\d+)?\)\/$/;let a=new Date(+e.replace(/\/Date\((\d+)\)\//,"$1"));if("Invalid Date"===a){const t=e.match(/^\/Date\((\d+)([-+]\d\d)(\d\d)\)\/$/);a=null,t&&(a=new Date(1*t[1]+36e5*t[2]+6e4*t[3]))}if(null==a||"Invalid Date"===a||isNaN(a)){const a=t.exec(e);if(a){const e=new Date(parseInt(a[1]));if(a[2]){let t=parseInt(a[3]);"-"===a[2]&&(t=-t);const s=e.getUTCMinutes();e.setUTCMinutes(s-t)}if(!isNaN(e.valueOf()))return e}}return a}const i={smartdate:"yyyy-MM-dd HH:mm:ss",d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",d3:"MM-dd-yyyy",d4:"MM.dd.yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",custom3:"yyyy-MM-ddTHH:mm:ss.fff+HH:mm",custom4:"yyyy-MM-ddTHH:mm:ss.fff-HH:mm",custom5:"yyyy-MM-ddTHH:mm:ss.ffffff+HH:mm",custom6:"yyyy-MM-ddTHH:mm:ss.ffffff-HH:mm",iso:"yyyy-MM-ddTHH:mm:ssZ",iso2:"yyyy-MM-ddTHH:mm.fffZ",iso_date1:"yyyy-MM-dd",iso_date2:"yyyy-MM-dd",iso_date3:"yyyy-ddd",iso_date4:"yyyy-MM-dd HH:mm",iso_date5:"yyyy-MM-dd HH:mm Z",iso_date6:"yyyy-MMM-dd",iso_date7:"yyyy-MM",iso_date8:"yyyy-MMM",iso_date9:"yyyy-MMMM",iso_date10:"yyyy-MMMM-dd",iso_time1:"HH:mm:ss.tttt",iso_time2:"HH:mm:ss",iso_time3:"HH:mm",iso_time4:"HH",iso_time5:"yyyyyy-MM-dd",iso_time6:"yyyyyy-MM-dd",iso_time7:"dd/MM/yyyy HH:mm",iso_time8:"dd.MM.yyyy HH:mm",iso_time9:"dd-MM-yyyy HH:mm",iso_time10:"MM.dd.yyyy HH:mm",iso_time11:"MM-dd-yyyy HH:mm",iso_time12:"dd/MM/yyyy",iso_time13:"MM.dd.yyyy h:mm tt",iso_time14:"MM-dd-yyyy h:mm tt",iso_time15:"MM/dd/yyyy h:mm tt"};for(let a in i){const r=s.parseDate(e,i[a],t);if(r)return r}const r=t.patterns;for(let a in r){const i=s.parseDate(e,r[a],t);if(i){if("ISO"===a){const a=s.parseDate(e,r.ISO2,t);if(a)return a}return i}}let n;if("string"==typeof e){const a=[":","/","-"," ",","];let i="",r=e=function(e,t,a){return a.replace(new RegExp(e,"g"),t)}(", ",",",e=s.trim(e));e.indexOf(":")>=0?(i=e.substring(e.indexOf(":")-2),i=s.trim(i),r=e.substring(0,e.indexOf(":")-2)):e.toUpperCase().indexOf("AM")>=0?(i=e.substring(e.toUpperCase().indexOf("AM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("AM")-2)):e.toUpperCase().indexOf("PM")>=0&&(i=e.substring(e.toUpperCase().indexOf("PM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("PM")-2));let o=new Date,d=!1;if(r){for(let e=0;e<a.length;e++)if(r.indexOf(a[e])>=0){n=r.split(a[e]);break}if(!n)return null;let e=new Array,i=new Array,l=new Array,f=null,m=null;for(let a=0;a<n.length;a++){const i=n[a],r=s.parseDate(i,"d",t)||s.parseDate(i,"dd",t)||s.parseDate(i,"ddd",t)||s.parseDate(i,"dddd",t);if(r&&(e.push(r.getDate()),i.length>2)){f=a;break}}for(let e=0;e<n.length;e++){const a=n[e],r=s.parseDate(a,"M",t)||s.parseDate(a,"MM",t)||s.parseDate(a,"MMM",t)||s.parseDate(a,"MMMM",t);if(r){if(null!=f&&f===e)continue;if(i.push(r.getMonth()),a.length>2){m=e;break}}}for(let e=0;e<n.length;e++){const a=n[e],i=s.parseDate(a,"yyyy",t);if(i){if(null!=f&&f===e)continue;if(null!=m&&m===e)continue;l.push(i.getFullYear())}}const c=new Array;for(let t=e.length-1;t>=0;t--)for(let a=0;a<i.length;a++)for(let s=0;s<l.length;s++){const r=new Date(l[s],i[a],e[t]);l[s]<1970&&r.setFullYear(l[s]),isNaN(r.getTime())||c.push(r)}c.length>0&&(o=c[0],d=!0)}if(i){const e=i.indexOf(":")>=0?i.split(":"):i,a=s.parseDate(i,"h:mm tt",t)||s.parseDate(i,"HH:mm:ss.fff",t)||s.parseDate(i,"HH:mm:ss.ff",t)||s.parseDate(i,"h:mm:ss tt",t)||s.parseDate(i,"HH:mm:ss.tttt",t)||s.parseDate(i,"HH:mm:ss",t)||s.parseDate(i,"HH:mm",t)||s.parseDate(i,"HH",t);let r=0,n=0,l=0,f=0;a&&!isNaN(a.getTime())?(r=a.getHours(),n=a.getMinutes(),l=a.getSeconds(),f=a.getMilliseconds()):(1===e.length&&(r=parseInt(e[0])),2===e.length&&(r=parseInt(e[0]),n=parseInt(e[1])),3===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),e[2].indexOf(".")>=0?(l=parseInt(e[2].toString().split(".")[0]),f=parseInt(e[2].toString().split(".")[1])):l=parseInt(e[2])),4===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),l=parseInt(e[2]),f=parseInt(e[3]))),!o||isNaN(r)||isNaN(n)||isNaN(l)||isNaN(f)||(o.setHours(r,n,l,f),d=!0)}if(d)return o}if(null!=e){n=[":","/","-"];let t=!0;for(let a=0;a<n.length;a++)-1!==e.indexOf(n[a])&&(t=!1);if(t){const t=new Number(e);if(!isNaN(t))return new Date(t)}}return null}getParseRegExp(e,t){const a=this;let s=e._parseRegExp;if(s){const e=s[t];if(e)return e}else e._parseRegExp=s={};let i,r=a.expandFormat(e,t).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),n=["^"],o=[],d=0,l=0,f=a.getTokenRegExp();for(;null!==(i=f.exec(r));){const e=r.slice(d,i.index);if(d=f.lastIndex,l+=a.appendPreOrPostMatch(e,n),l%2){n.push(i[0]);continue}let t,s=i[0],m=s.length;switch(s){case"dddd":case"ddd":case"MMMM":case"MMM":case"gg":case"g":t="(\\D+)";break;case"tt":case"t":t="(\\D*)";break;case"yyyyy":t="(\\d{1,4})";break;case"yyyy":t="(\\d{"+m+"})";break;case"fff":case"ff":case"f":t="(\\d{1,"+m+"})";break;case"dd":case"d":case"MM":case"M":case"yy":case"y":case"HH":case"H":case"hh":case"h":case"mm":case"m":case"ss":case"s":t="(\\d\\d?)";break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":t="(\\d{1,3})";break;case"zzz":t="([+-]?\\d\\d?:\\d{2})";break;case"zz":case"z":t="([+-]?\\d\\d?)";break;case"/":t="/";break;default:if(!/i{1,24}/.test(s))throw"Invalid date format pattern '"+s+"'.";t="(\\d{"+s.length+"})"}t&&n.push(t),"/"!==s&&o.push(i[0])}a.appendPreOrPostMatch(r.slice(d),n),n.push("$");const m={regExp:n.join("").replace(/\s+/g,"\\s+"),groups:o};return s[t]=m}outOfRange(e,t,a){return e<t||e>a}expandYear(e,t){const a=this,s=new Date,i=a.getEra(s);if(t<100){let r=e.twoDigitYearMax;r="string"==typeof r?(new Date).getFullYear()%100+parseInt(r,10):r;const n=a.getEraYear(s,e,i);(t+=n-n%100)>r&&(t-=100)}return t}padZeros(e,t){let a,s=e+"";return t>1&&s.length<t?(a=["0","00","000"][t-2]+s,a.substr(a.length-t,t)):(a=s,a)}parseDate(e,t,a){const s=this;null==a&&(a=s.calendar),e=s.trim(e);const i=a,r=s.getParseRegExp(i,t),n=new RegExp(r.regExp).exec(e);if(null===n)return null;let o,d=r.groups,l=null,f=null,m=null,c=null,u=null,p=0,y=0,g=0,h=0,T=null,M=!1;for(let e=0,t=d.length;e<t;e++){const t=n[e+1];if(t){const a=d[e],r=a.length,n=parseInt(t,10);switch(a){case"dd":case"d":if(c=n,s.outOfRange(c,1,31))return null;break;case"MMM":case"MMMM":case"MMMMM":case"MMMMMM":case"MMMMMMM":case"MMMMMMMM":if(m=s.getMonthIndex(i,t,3===r),s.outOfRange(m,0,11))return null;break;case"M":case"MM":if(m=n-1,s.outOfRange(m,0,11))return null;break;case"y":case"yy":case"yyyy":if(f=r<4?s.expandYear(i,n):n,s.outOfRange(f,0,9999))return null;break;case"h":case"hh":if(p=n,12===p&&(p=0),s.outOfRange(p,0,11))return null;break;case"H":case"HH":if(p=n,s.outOfRange(p,0,23))return null;break;case"m":case"mm":if(y=n,s.outOfRange(y,0,59))return null;break;case"s":case"ss":if(g=n,s.outOfRange(g,0,59))return null;break;case"tt":case"t":if(M=i.PM&&(t===i.PM[0]||t===i.PM[1]||t===i.PM[2]),!M&&(!i.AM||t!==i.AM[0]&&t!==i.AM[1]&&t!==i.AM[2]))return null;break;case"f":case"ff":case"fff":if(h=n*Math.pow(10,3-r),s.outOfRange(h,0,999))return null;break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":if(s.outOfRange(n,0,1e3))return null;s[s._codeToUnit[a]]=n;break;case"ddd":case"dddd":if(u=s.getDayIndex(i,t,3===r),s.outOfRange(u,0,6))return null;break;case"zzz":{const e=t.split(/:/);if(2!==e.length)return null;if(o=parseInt(e[0],10),s.outOfRange(o,-12,13))return null;const a=parseInt(e[1],10);if(s.outOfRange(a,0,59))return null;T=60*o+(s.startsWith(t,"-")?-a:a);break}case"z":case"zz":if(o=n,s.outOfRange(o,-12,13))return null;T=60*o;break;case"g":case"gg":{let e=t;if(!e||!i.eras)return null;e=this.trim(e.toLowerCase());for(let t=0,a=i.eras.length;t<a;t++)if(e===i.eras[t].nathat.toLowerCase()){l=t;break}if(null===l)return null;break}default:{let e=t;e.length%3==1?e+="00":e.length%3==2&&(e+="0"),h=parseInt(e.slice(0,3),10),e=e.slice(3);let a=0;for(;e.length>0;)s[s._smallUnits[a]]=parseInt(e.slice(0,3),10),e=e.slice(3),a++}}}}let S,D=new Date,H=i.convert;if(S=D.getFullYear(),null===f?f=S:i.eras&&(f+=i.eras[l||0].offset),null===m&&(m=0),null===c&&(c=1),H){if(D=H.toGregorian(f,m,c),null===D)return null}else{if(D.setFullYear(f,m,c),D.getDate()!==c)return null;if(null!==u&&D.getDay()!==u)return null}if(M&&p<12&&(p+=12),D.setHours(p,y,g,h),null!==T){const e=D.getMinutes()-(T+D.getTimezoneOffset());D.setHours(D.getHours()+parseInt(e/60,10),e%60)}return D}toString(e,t){const a=this;void 0===e&&(e="yyyy-MM-dd HH:mm:ss");const s=a.dateData.toString()+a.getFractionsOfSecondStamp()+e+(a.timeZone||"");if(Smart.Utilities.DateTime.cache&&Smart.Utilities.DateTime.cache[s]&&!1!==a.showTodayDateAsString)return Smart.Utilities.DateTime.cache[s];const i=a.toDate();if(null==t&&(t=a.calendar),"string"==typeof i)return i;if(!e||!e.length||"i"===e){let e;return e=a.formatDate(i,t.patterns.F,t),e}const r=t.eras,n="s"===e;e=a.expandFormat(t,e);const o=[];let d,l=0,f=a.getTokenRegExp();function m(e,t){if(void 0!==e.getMonth)switch(t){case 0:return e.getFullYear();case 1:return e.getMonth();case 2:return e.getDate()}}for(;;){const s=f.lastIndex,c=f.exec(e),u=e.slice(s,c?c.index:e.length);if(l+=a.appendPreOrPostMatch(u,o),!c)break;if(l%2){o.push(c[0]);continue}const p=c[0],y=p.length;let g;if(/i{1,24}/.test(p))o.push(a.getFirstNDigitsOfPrecision(p.length));else switch(p){case"ddd":case"dddd":{const e=3===y?t.days.namesAbbr:t.days.names;o.push(e[i.getDay()]);break}case"d":case"dd":o.push(a.padZeros(m(i,2),y));break;case"MMM":case"MMMM":g=m(i,1),o.push(t.months[3===y?"namesAbbr":"names"][g]);break;case"M":case"MM":o.push(a.padZeros(m(i,1)+1,y));break;case"y":case"yy":case"yyyy":g=a.getEraYear(i,t,a.getEra(i,r),n),y<4&&(g%=100),o.push(a.padZeros(g,y));break;case"h":case"hh":d=i.getHours()%12,0===d&&(d=12),o.push(a.padZeros(d,y));break;case"H":case"HH":o.push(a.padZeros(i.getHours(),y));break;case"m":case"mm":o.push(a.padZeros(i.getMinutes(),y));break;case"s":case"ss":o.push(a.padZeros(i.getSeconds(),y));break;case"t":case"tt":g=i.getHours()<12?t.AM?t.AM[0]:" ":t.PM?t.PM[0]:" ",o.push(1===y?g.charAt(0):g);break;case"f":case"ff":case"fff":o.push(a.padZeros(i.getMilliseconds(),3).substr(0,y));break;case"u":case"n":case"p":case"e":case"a":case"x":case"o":o.push(a[a._codeToUnit[p]]);break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":o.push(a.padZeros(a[a._codeToUnit[p]],3));break;case"z":case"zz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),y));break;case"zzz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),2)+":"+a.padZeros(60*Math.abs(a.timeZoneOffsetHours%1),2));break;case"g":case"gg":t.eras&&o.push(t.eras[a.getEra(i,r)].name);break;case"/":o.push(t["/"]);break;default:throw"Invalid date format pattern '"+p+"'."}}let c=o.join("");if(Smart.Utilities.DateTime.cache||(Smart.Utilities.DateTime.cache=new Array),a._today||(a._today=new Date),a.calendar&&a.calendar.today&&-1===e.indexOf(":")&&i.getFullYear()===a._today.getFullYear()&&i.getDate()===a._today.getDate()&&i.getMonth()===a._today.getMonth()){if(!1===a.showTodayDateAsString)return Smart.Utilities.DateTime.cache[s]=c,c;c=a.calendar.today}return Smart.Utilities.DateTime.cache[s]=c,c}getFractionsOfSecondStamp(){const e=this;return e._microsecond.toString()+e._nanosecond+e._picosecond+e._femtosecond+e._attosecond+e._zeptosecond+e._yoctosecond}getFirstNDigitsOfPrecision(e,t){const a=this;return(""+(!0!==t?a.padZeros(a.millisecond(),3):"")+a.padZeros(a._microsecond,3)+a.padZeros(a._nanosecond,3)+a.padZeros(a._picosecond,3)+a.padZeros(a._femtosecond,3)+a.padZeros(a._attosecond,3)+a.padZeros(a._zeptosecond,3)+a.padZeros(a._yoctosecond,3)).slice(0,e)}copySmallTimePartValues(e){const t=this;e._microsecond=t._microsecond,e._nanosecond=t._nanosecond,e._picosecond=t._picosecond,e._femtosecond=t._femtosecond,e._attosecond=t._attosecond,e._zeptosecond=t._zeptosecond,e._yoctosecond=t._yoctosecond}add(e,t,a){const s=this,i=s.internalMS();if(void 0===t){if(!1===a)return s.dateData=i+parseInt(e._ticks/s.ticksPerMillisecond),s;const t=new Smart.Utilities.DateTime(i+parseInt(e._ticks/s.ticksPerMillisecond));return s.copyTimeZone(t),s.copySmallTimePartValues(t),t}const r=e*t;if(r<=-s.maxMillis||r>=s.maxMillis)throw new Error("Out of Range");if(!1===a)return s.dateData=i+r,s;const n=new Smart.Utilities.DateTime(i+r);return s.copyTimeZone(n),s.copySmallTimePartValues(n),n}addDays(e,t){return this.add(e,this.millisPerDay,t)}clone(){const e=this,t=new Smart.Utilities.DateTime(e.dateData);return e.copyTimeZone(t),e.copySmallTimePartValues(t),t}clearTime(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s,0,0,0,0);return e.copyTimeZone(i),i}addHours(e,t){return this.add(e,this.millisPerHour,t)}addDeciseconds(e,t){return this.add(100*e,1,t)}addCentiseconds(e,t){return this.add(10*e,1,t)}addMilliseconds(e,t){return this.add(e,1,t)}addMinutes(e,t){return this.add(e,this.millisPerMinute,t)}addMonths(e,t){const a=this;if(e<-12e4||e>12e4)throw new Error("Invalid Months Value");let s=parseInt(a.getDatePart(a.datePartYear)),i=parseInt(a.getDatePart(a.datePartMonth)),r=parseInt(a.getDatePart(a.datePartDay));if(e%12==0)s+=e/12;else{const t=i-1+e;t>=0?(i=t%12+1,s+=t/12):(i=12+(t+1)%12,s+=(t-11)/12),s=parseInt(s)}if(s<1||s>9999)throw new Error("Year out of range");const n=a.daysInMonth(s,i);if(r>n&&(r=n),!1===t)return a.dateData=a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay,a;const o=new Smart.Utilities.DateTime(a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay);return a.copyTimeZone(o),a.copySmallTimePartValues(o),o}addSeconds(e,t){return this.add(e,this.millisPerSecond,t)}addYears(e,t){return this.addMonths(12*e,t)}addMicroseconds(e,t){if(0===e)return;const a=this;let s,i;e<0&&0===a.hour()&&0===a.minute()&&0===a.second()&&0===a.millisecond()&&0===a._microsecond&&(s=parseInt(e/1e3,10)-1,i=1e3+e%1e3);const r=1e3*a.timeToMS(a.hour(),a.minute(),a.second(),a.millisecond())+a._microsecond,n=r+e;let o;if(void 0===s&&(s=parseInt(n/1e3,10)-parseInt(r/1e3,10)),void 0===i&&(i=parseInt(n%1e3,10)),0!==s&&(o=a.addMilliseconds(s,t)),!1!==t)return o||(o=a.clone()),o._microsecond=i,o;a._microsecond=i}addFractionsOfSecond(e,t,a,s,i){if(0===e)return;const r=this,n=1e3*r[s]+r[a],o=e+n;let d,l=parseInt(o/1e3,10)-parseInt(n/1e3,10),f=parseInt(o%1e3,10);if(e<0&&o<0&&f<0&&(l--,f=1e3+f),0!==l&&(d=r[i](l,t)),!1!==t)return d||(d=r.clone()),d[a]=f,d;r[a]=f}addNanoseconds(e,t){return this.addFractionsOfSecond(e,t,"_nanosecond","_microsecond","addMicroseconds")}addPicoseconds(e,t){return this.addFractionsOfSecond(e,t,"_picosecond","_nanosecond","addNanoseconds")}addFemtoseconds(e,t){return this.addFractionsOfSecond(e,t,"_femtosecond","_picosecond","addPicoseconds")}addAttoseconds(e,t){return this.addFractionsOfSecond(e,t,"_attosecond","_femtosecond","addFemtoseconds")}addZeptoseconds(e,t){return this.addFractionsOfSecond(e,t,"_zeptosecond","_attosecond","addAttoseconds")}addYoctoseconds(e,t){return this.addFractionsOfSecond(e,t,"_yoctosecond","_zeptosecond","addZeptoseconds")}getTimeZoneOffset(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1),s=e.getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset());return{offset:-e.getTimezoneOffset()/60,dst:+s}}isInDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return this.date().getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset())}supportsDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return t.getTimezoneOffset()!==a.getTimezoneOffset()}date(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s);return e.copyTimeZone(i),i}isWeekend(){return 0===this.dayOfWeek()||6===this.dayOfWeek()}toDate(e){const t=this,a=t.month(),s=t.year(),i=t.day(),r=t.hour(),n=t.minute(),o=t.second(),d=t.millisecond();let l=new Date(s,a-1,i);if(s<1970&&l.setFullYear(s),l.setHours(r,n,o,d),e){const a=t.timeZones.filter((function(t){return t.id===e}));if(a.length){let e=a[0].offset;const s=l.getTime();let i=60*l.getTimezoneOffset()*1e3;if(t.timeZone){const e=t.timeZones.filter((function(e){return e.id===t.timeZone}));e.length&&(i=60*-e[0].offset*1e3)}l=new Date(s+i+6e4*e)}}return l}toTimeZone(e){const t=this;let a=e;if(null==a&&(a="Local"),t.timeZone===a)return t.clone();const s=t.timeZones.filter((function(e){return e.id===a}));if(0===s.length)return t.clone();const i=this.toDate(a),r=new Smart.Utilities.DateTime(i);return r.timeZone=a,r.timeZoneOffset=s[0].offset,r.timeZoneOffsetHours=s[0].offsetHours,t.copySmallTimePartValues(r),r}day(){return this.getDatePart(this.datePartDay)}month(){return this.getDatePart(this.datePartMonth)}year(){return this.getDatePart(this.datePartYear)}millisecond(){return parseInt(this.internalMS()%1e3)}hour(){return parseInt(Math.floor(this.internalMS()/this.millisPerHour)%24)}minute(){return parseInt(this.internalMS()/this.millisPerMinute%60)}second(){return parseInt(this.internalMS()/this.millisPerSecond%60)}microsecond(){return this._microsecond}nanosecond(){return this._nanosecond}picosecond(){return this._picosecond}femtosecond(){return this._femtosecond}attosecond(){return this._attosecond}zeptosecond(){return this._zeptosecond}yoctosecond(){return this._yoctosecond}valueOf(){return this.dateData}equals(e){const t=this;return t.dateData===e.dateData&&t._microsecond===e._microsecond&&t._nanosecond===e._nanosecond&&t._picosecond===e._picosecond&&t._femtosecond===e._femtosecond&&t._attosecond===e._attosecond&&t._zeptosecond===e._zeptosecond&&t._yoctosecond===e._yoctosecond}equalDateParts(e){const t=this;return t.year()===e.year()&&t.month()===e.month()&&t.day()===e.day()}compare(e){const t=this;if(t.equals(e))return 0;const a=["dateData","_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"];for(let s=0;s<a.length;s++){const i=a[s];if(t[i]>e[i])return 1;if(t[i]<e[i])return-1}return 0}toDateString(){return this.toDate().toDateString()}toLocaleDateString(){return this.toDate().toLocaleDateString(this.calendar.locale)}toLocaleString(){return this.toDate().toLocaleString(this.calendar.locale)}toLocaleTimeString(){return this.toDate().toLocaleTimeString(this.calendar.locale)}validateTimeZone(e){const t=this;if("string"!=typeof e)return;const a=t.timeZones.filter((function(t){return t.id===e}));0!==a.length&&(t.timeZone=e,t.timeZoneOffset=a[0].offset,t.timeZoneOffsetHours=a[0].offsetHours)}copyTimeZone(e){const t=this;e.timeZone=t.timeZone,e.timeZoneOffset=t.timeZoneOffset,e.timeZoneOffsetHours=t.timeZoneOffsetHours}getTimeStamp(){return new Smart.Utilities.BigNumber(this.dateData.toString()+this.getFirstNDigitsOfPrecision(void 0,!0))}})})();
62
+ (()=>{const e=-1*(new Date).getTimezoneOffset(),t=[{id:"Local",offset:e,offsetHours:e/60,displayName:"",supportsDaylightSavingTime:!1},{id:"Dateline Standard Time",offset:-720,offsetHours:-12,displayName:"(UTC-12:00) International Date Line West",supportsDaylightSavingTime:!1},{id:"UTC-11",offset:-660,offsetHours:-11,displayName:"(UTC-11:00) Coordinated Universal Time-11",supportsDaylightSavingTime:!1},{id:"Hawaiteratoran Standard Time",offset:-600,offsetHours:-10,displayName:"(UTC-10:00) Hawaiterator",supportsDaylightSavingTime:!1},{id:"Alaskan Standard Time",offset:-540,offsetHours:-9,displayName:"(UTC-09:00) Alaska",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time (Mexico)",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Baja California",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Pacific Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Arizona",supportsDaylightSavingTime:!1},{id:"Mountain Standard Time (Mexico)",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",supportsDaylightSavingTime:!0},{id:"Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Mountain Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central America Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central America",supportsDaylightSavingTime:!1},{id:"Canada Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Saskatchewan",supportsDaylightSavingTime:!1},{id:"Central Standard Time (Mexico)",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",supportsDaylightSavingTime:!0},{id:"SA Pacific Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco",supportsDaylightSavingTime:!1},{id:"Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Eastern Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Indiana (East)",supportsDaylightSavingTime:!0},{id:"Venezuela Standard Time",offset:-270,offsetHours:-4.5,displayName:"(UTC-04:30) Caracas",supportsDaylightSavingTime:!1},{id:"Atlantic Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Atlantic Time (Canada)",supportsDaylightSavingTime:!0},{id:"Paraguay Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Asuncion",supportsDaylightSavingTime:!0},{id:"Central Brazilian Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Cuiaba",supportsDaylightSavingTime:!0},{id:"Pacific SA Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Santiago",supportsDaylightSavingTime:!0},{id:"SA Western Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",supportsDaylightSavingTime:!1},{id:"Newfoundland Standard Time",offset:-210,offsetHours:-3.5,displayName:"(UTC-03:30) Newfoundland",supportsDaylightSavingTime:!0},{id:"SA Eastern Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Cayenne, Fortaleza",supportsDaylightSavingTime:!1},{id:"Argentina Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Buenos Aires",supportsDaylightSavingTime:!0},{id:"E. South America Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Brasilia",supportsDaylightSavingTime:!0},{id:"Bahia Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Salvador",supportsDaylightSavingTime:!0},{id:"Montevideo Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Montevideo",supportsDaylightSavingTime:!0},{id:"Greenland Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Greenland",supportsDaylightSavingTime:!0},{id:"UTC-02",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Coordinated Universal Time-02",supportsDaylightSavingTime:!1},{id:"Mid-Atlantic Standard Time",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Mid-Atlantic - Old",supportsDaylightSavingTime:!0},{id:"Azores Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Azores",supportsDaylightSavingTime:!0},{id:"Cape Verde Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Cape Verde Is.",supportsDaylightSavingTime:!1},{id:"Morocco Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Casablanca",supportsDaylightSavingTime:!0},{id:"UTC",offset:0,offsetHours:0,displayName:"(UTC) Coordinated Universal Time",supportsDaylightSavingTime:!1},{id:"GMT Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Dublin, Edinburgh, Lisbon, London",supportsDaylightSavingTime:!0},{id:"Greenwich Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Monrovia, Reykjavik",supportsDaylightSavingTime:!1},{id:"Central European Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",supportsDaylightSavingTime:!0},{id:"Namibia Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Windhoek",supportsDaylightSavingTime:!0},{id:"W. Central Africa Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) West Central Africa",supportsDaylightSavingTime:!1},{id:"W. Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",supportsDaylightSavingTime:!0},{id:"Central Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",supportsDaylightSavingTime:!0},{id:"Romance Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",supportsDaylightSavingTime:!0},{id:"FLE Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",supportsDaylightSavingTime:!0},{id:"South Africa Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Harare, Pretoria",supportsDaylightSavingTime:!1},{id:"Turkey Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Istanbul",supportsDaylightSavingTime:!0},{id:"GTB Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Athens, Bucharest",supportsDaylightSavingTime:!0},{id:"Libya Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Tripoli",supportsDaylightSavingTime:!0},{id:"E. Europe Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) E. Europe",supportsDaylightSavingTime:!0},{id:"Jordan Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Amman",supportsDaylightSavingTime:!0},{id:"Middle East Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Beirut",supportsDaylightSavingTime:!0},{id:"Egypt Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Cairo",supportsDaylightSavingTime:!0},{id:"Syria Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Damascus",supportsDaylightSavingTime:!0},{id:"Israel Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Jerusalem",supportsDaylightSavingTime:!0},{id:"Arab Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kuwait, Riyadh",supportsDaylightSavingTime:!1},{id:"E. Africa Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Nairobi",supportsDaylightSavingTime:!1},{id:"Arabic Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Baghdad",supportsDaylightSavingTime:!0},{id:"Kaliningrad Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kaliningrad, Minsk",supportsDaylightSavingTime:!0},{id:"Iran Standard Time",offset:210,offsetHours:3.5,displayName:"(UTC+03:30) Tehran",supportsDaylightSavingTime:!0},{id:"Mauritius Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Port Louis",supportsDaylightSavingTime:!0},{id:"Georgian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Tbilisi",supportsDaylightSavingTime:!1},{id:"Caucasus Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Yerevan",supportsDaylightSavingTime:!0},{id:"Arabian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Abu Dhabi, Muscat",supportsDaylightSavingTime:!1},{id:"Azerbaijan Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Baku",supportsDaylightSavingTime:!0},{id:"Russian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Moscow, St. Petersburg, Volgograd",supportsDaylightSavingTime:!0},{id:"Afghanistan Standard Time",offset:270,offsetHours:4.5,displayName:"(UTC+04:30) Kabul",supportsDaylightSavingTime:!1},{id:"Pakistan Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Islamabad, Karachi",supportsDaylightSavingTime:!0},{id:"West Asia Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Ashgabat, Tashkent",supportsDaylightSavingTime:!1},{id:"India Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",supportsDaylightSavingTime:!1},{id:"Sri Lanka Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Sri Jayawardenepura",supportsDaylightSavingTime:!1},{id:"Nepal Standard Time",offset:345,offsetHours:5.75,displayName:"(UTC+05:45) Kathmandu",supportsDaylightSavingTime:!1},{id:"Central Asia Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Astana",supportsDaylightSavingTime:!1},{id:"Bangladesh Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Dhaka",supportsDaylightSavingTime:!0},{id:"Ekaterinburg Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Ekaterinburg",supportsDaylightSavingTime:!0},{id:"Myanmar Standard Time",offset:390,offsetHours:6.5,displayName:"(UTC+06:30) Yangon (Rangoon)",supportsDaylightSavingTime:!1},{id:"SE Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Bangkok, Hanoi, Jakarta",supportsDaylightSavingTime:!1},{id:"N. Central Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Novosibirsk",supportsDaylightSavingTime:!0},{id:"Ulaanbaatar Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Ulaanbaatar",supportsDaylightSavingTime:!1},{id:"China Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",supportsDaylightSavingTime:!1},{id:"Singapore Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Kuala Lumpur, Singapore",supportsDaylightSavingTime:!1},{id:"North Asia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Krasnoyarsk",supportsDaylightSavingTime:!0},{id:"Taipei Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Taipei",supportsDaylightSavingTime:!1},{id:"W. Australia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Perth",supportsDaylightSavingTime:!0},{id:"Korea Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Seoul",supportsDaylightSavingTime:!1},{id:"North Asia East Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Irkutsk",supportsDaylightSavingTime:!0},{id:"Tokyo Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Osaka, Sapporo, Tokyo",supportsDaylightSavingTime:!1},{id:"AUS Central Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Darwin",supportsDaylightSavingTime:!1},{id:"Cen. Australia Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Adelaide",supportsDaylightSavingTime:!0},{id:"West Pacific Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Guam, Port Moresby",supportsDaylightSavingTime:!1},{id:"Tasmania Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Hobart",supportsDaylightSavingTime:!0},{id:"E. Australia Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Brisbane",supportsDaylightSavingTime:!1},{id:"AUS Eastern Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Canberra, Melbourne, Sydney",supportsDaylightSavingTime:!0},{id:"Yakutsk Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Yakutsk",supportsDaylightSavingTime:!0},{id:"Vladivostok Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Vladivostok",supportsDaylightSavingTime:!0},{id:"Central Pacific Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Solomon Is., New Caledonia",supportsDaylightSavingTime:!1},{id:"Magadan Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Magadan",supportsDaylightSavingTime:!0},{id:"Kamchatka Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",supportsDaylightSavingTime:!0},{id:"Fiji Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Fiji",supportsDaylightSavingTime:!0},{id:"New Zealand Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Auckland, Wellington",supportsDaylightSavingTime:!0},{id:"UTC+12",offset:720,offsetHours:12,displayName:"(UTC+12:00) Coordinated Universal Time+12",supportsDaylightSavingTime:!1},{id:"Tonga Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Nuku'alofa",supportsDaylightSavingTime:!1},{id:"Samoa Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Samoa",supportsDaylightSavingTime:!0}],a=[0,31,59,90,120,151,181,212,243,273,304,334,365],s=[0,31,60,91,121,152,182,213,244,274,305,335,366];Smart.Utilities.Assign("TimeSpan",class{constructor(){const e=this;if(e.ticksPerMillisecond=1e4,e.millisecondsPerTick=1e-4,e.ticksPerSecond=1e7,e.secondsPerTick=1e-7,e.ticksPerMinute=6e8,e.minutesPerTick=1/6e8,e.ticksPerHour=36e9,e.hoursPerTick=1/36e9,e.ticksPerDay=864e9,e.daysPerTick=1/864e9,e.millisPerSecond=1e3,e.millisPerMinute=6e4,e.millisPerHour=36e5,e.millisPerDay=864e5,e._ticks=0,1===arguments.length){if(isNaN(arguments[0]))throw new Error("Argument must be a number.");e._ticks=arguments[0]}else if(3===arguments.length)e._ticks=e.timeToMS(arguments[0],arguments[1],arguments[2],0);else if(4===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+0;e._ticks=t*e.ticksPerMillisecond}else if(5===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+arguments[4];e._ticks=t*e.ticksPerMillisecond}}ticks(){return this._ticks}days(){return parseInt(this._ticks/this.ticksPerDay)}timeToMS(e,t,a,s){return parseInt((3600*e+60*t+a+s/1e3)*this.ticksPerSecond)}hours(){return parseInt(this._ticks/this.ticksPerHour)%24}milliseconds(){return parseInt(this._ticks/this.ticksPerMillisecond)%1e3}minutes(){return parseInt(this._ticks/this.ticksPerMinute)%60}seconds(){return parseInt(this._ticks/this.ticksPerSecond)%60}totalDays(){return parseInt(this._ticks*this.daysPerTick)}totalHours(){return parseInt(this._ticks*this.hoursPerTick)}totalMilliseconds(){const e=this._ticks*this.millisecondsPerTick;return parseInt(e)}totalMinutes(){return parseInt(this._ticks*this.minutesPerTick)}totalSeconds(){return parseInt(this._ticks*this.secondsPerTick)}add(e){const t=this._ticks+e._ticks;return new Smart.Utilities.TimeSpan(t)}subtract(e){const t=this._ticks-e._ticks;return new Smart.Utilities.TimeSpan(t)}duration(){const e=this;return e._ticks>=0?new Smart.Utilities.TimeSpan(e._ticks):new Smart.Utilities.TimeSpan(-e._ticks)}equals(e){return this._ticks===e._ticks}valueOf(){return this._ticks}compare(e,t){return e._ticks>t._ticks?1:e._ticks<t._ticks?-1:0}interval(e,t){const a=e*t+(e>=0?.5:-.5);return new Smart.Utilities.TimeSpan(a*this.ticksPerMillisecond)}fromDays(e){return this.interval(e,this.millisPerDay)}fromHours(e){return this.interval(e,this.millisPerHour)}fromMilliseconds(e){return this.interval(e,1)}fromMinutes(e){return this.interval(e,this.millisPerMinute)}fromSeconds(e){return this.interval(e,this.millisPerSecond)}fromTicks(e){return new Smart.Utilities.TimeSpan(e)}toString(){return this.totalMilliseconds().toString()}negate(){return new Smart.Utilities.TimeSpan(-this._ticks)}}),Smart.Utilities.Assign("DateTime",class{constructor(){function e(e){const t=i.regexISOString.exec(e);r=new Smart.Utilities.DateTime(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]),parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]),parseFloat(t[7]),0,0,0,0,0,0,0,"UTC")}const i=this;let r;if(i.ticksPerMillisecond=1e4,i.millisecondsPerTick=1e-4,i.ticksPerSecond=1e7,i.secondsPerTick=1e-7,i.ticksPerMinute=6e8,i.minutesPerTick=1/6e8,i.ticksPerHour=36e9,i.hoursPerTick=1/36e9,i.ticksPerDay=864e9,i.daysPerTick=1/864e9,i.millisPerSecond=1e3,i.millisPerMinute=6e4,i.millisPerHour=36e5,i.millisPerDay=864e5,i.daysPerYear=365,i.daysPer4Years=1461,i.daysPer100Years=36524,i.daysPer400Years=146097,i.daysTo1601=584388,i.daysTo1899=693593,i.daysTo10000=3652059,i.minTicks=0,i.maxTicks=3155378976e9,i.maxMillis=3155378976e5,i.datePartYear=0,i.datePartDayOfYear=1,i.datePartMonth=2,i.datePartDay=3,i.daysToMonth365=a,i.daysToMonth366=s,i.minValue=new Date(0),i.maxValue=new Date(3155378976e9),i.ticksMask=0x4000000000000000,i.flagsMask=0xc000000000000000,i.localMask=0x8000000000000000,i.ticksCeiling=0x4000000000000000,i.kindUnspecified=0,i.kindUtc=0x4000000000000000,i.kindLocal=0x8000000000000000,i.kindLocalAmbiguousDst=0xc000000000000000,i.kindShift=62,i.regexTrim=/^\s+|\s+$/g,i.regexInfinity=/^[+-]?infinity$/i,i.regexHex=/^0x[a-f0-9]+$/i,i.regexParseFloat=/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/,i.regexISOString=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})Z$/,i.calendar={"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",FP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",FPA:"yyyy/MM/dd HH:mm:ss:fffuunnppeeaaxxoo",FPA2:"yyyy-MM-dd HH:mm:ss:fffuunnppeeaaxxoo",FT:"HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",PP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp",PT:"HH:mm:ss:fff:uu:nn:pp"},percentsymbol:"%",currencysymbol:"$",currencysymbolposition:"before",decimalseparator:".",thousandsseparator:","},i.dateData=0,i.timeZone=null,i.timeZones=t,i._codeToUnit={u:"_microsecond",uu:"_microsecond",n:"_nanosecond",nn:"_nanosecond",p:"_picosecond",pp:"_picosecond",e:"_femtosecond",ee:"_femtosecond",a:"_attosecond",aa:"_attosecond",x:"_zeptosecond",xx:"_zeptosecond",o:"_yoctosecond",oo:"_yoctosecond"},i._smallUnits=["_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"],i._microsecond=0,i._nanosecond=0,i._picosecond=0,i._femtosecond=0,i._attosecond=0,i._zeptosecond=0,i._yoctosecond=0,0===arguments.length){const e=new Date;i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else if(1===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}}else if(2===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}i.validateTimeZone(arguments[1])}else if(arguments.length>2)if("string"==typeof arguments[0]){const e=i.tryparseDate(arguments[0],arguments[2],arguments[1]);i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else{let e=arguments[0],t=arguments[1]-1,a=arguments[2],s=arguments[3]||0,r=arguments[4]||0,n=arguments[5]||0,o=arguments[6]||0,d=arguments[7]||0,l=arguments[8]||0,f=arguments[9]||0,m=arguments[10]||0,c=arguments[11]||0,u=arguments[12]||0,y=arguments[13]||0;e>=2100&&(e=2100),t>=12?t=11:t<0&&(t=0),a>31?a=i.daysInMonth(e,1+t):a<0&&(a=0),s>23?s=23:s<0&&(s=0),r>59?r=59:r<0&&(r=0),n>59?n=59:n<0&&(n=0);const p=new Date(e,t,a,s,r,n,o);e<1970&&p.setFullYear(e),i.dateData=i.dateToMS(p.getFullYear(),p.getMonth()+1,p.getDate())+i.timeToMS(p.getHours(),p.getMinutes(),p.getSeconds(),p.getMilliseconds()),i._microsecond=d,i._nanosecond=l,i._picosecond=f,i._femtosecond=m,i._attosecond=c,i._zeptosecond=u,i._yoctosecond=y,arguments[14]&&i.validateTimeZone(arguments[14])}if(i.timeZone||i.validateTimeZone("Local"),r){const e=r.toTimeZone(i.timeZone);i.dateData=e.dateData}}static isValidDate(e){const t=this.validateDate(e);return!(!t||t&&!t.dateData)}static validateDate(e,t,a){if(e instanceof Smart.Utilities.DateTime)return e;if(e instanceof Date)return new Smart.Utilities.DateTime(e);try{if("string"==typeof e&&a)return this.parseDateString(e,t,a);if(new RegExp(/^\d{1,2}\/\d{1,2}\/\d{4}(, \d{1,2}:\d{2}:\d{1,2} [A|P]M)?$/).test(e)){const t=new Date(e);if(!isNaN(t.getTime()))return new Smart.Utilities.DateTime(t)}if("string"==typeof e)return this.parseDateString(e,t,a);if("number"==typeof e)return new Smart.Utilities.DateTime(new Date(e))}catch(e){}return t}static parseDateString(e,t,a){const s=new Date(e);if(!isNaN(s.getTime()))return e&&"string"==typeof e&&a?new Smart.Utilities.DateTime(e,a,null):new Smart.Utilities.DateTime(s);const i=e.indexOf("Date("),r=e.indexOf("DateTime("),n=e.lastIndexOf(")");let o=e;if(-1===i&&-1===r||-1===n){const t=new Smart.Utilities.DateTime,s=t.parseDate(e,a);if(s)return o=new Smart.Utilities.DateTime(s),t.copySmallTimePartValues(o),o}else{if(o=-1!==i?e.slice(i+5,n):e.slice(r+9,n),o=o.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),""===o.trim())return new Smart.Utilities.DateTime;if(new RegExp(/(^(\d+)(\s*,\s*\d+)+(\s*,\s*[a-zA-Z ]+)?$)/g).test(o))return o=o.split(","),o.map((function(e,t){isNaN(o[t])?o[t]=e.trim():o[t]=parseInt(e)})),-1!==i&&o[1]++,o.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,o)),o}if(""===o.trim())return t;if(!isNaN(o))return o=new Date(parseInt(o,10)),new Smart.Utilities.DateTime(o);try{const e=o.split(",");2===e.length?(e[1]=e[1].trim(),e.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,e))):o=new Smart.Utilities.DateTime(o)}catch(e){o=t}return o}static fromFullTimeStamp(e){e=e.toString();const t=new Smart.Utilities.DateTime(parseFloat(e.slice(0,e.length-21)));let a=e.slice(e.length-21),s=0;for(;a.length>0;)t[t._smallUnits[s]]=parseInt(a.slice(0,3),10),a=a.slice(3),s++;return t}static getConstructorParameters(e){return[e.year(),e.month(),e.day(),e.hour(),e.minute(),e.second(),e.millisecond(),e._microsecond,e._nanosecond,e._picosecond,e._femtosecond,e._attosecond,e._zeptosecond,e._yoctosecond,e.timeZone]}static detectDisplayMode(e,t,a){if(e.calendar.patterns[t])return-1!==["d","D","M","Y","d1","d2"].indexOf(t)?"calendar":-1!==["t","T","FT","PT"].indexOf(t)?"timePicker":"default";const s=["d","M","y"],i=["h","H","m","s","t","f","u","n","p","e","a","x","o"],r=a.groups;let n=!1,o=!1;for(let e=0;e<r.length;e++){const t=r[e].charAt(0);if(-1!==s.indexOf(t)?n=!0:-1!==i.indexOf(t)&&(o=!0),n&&o)break}return n===o?"default":n?"calendar":"timePicker"}static getLocalizedNames(e){const t={names:[],namesAbbr:[],namesShort:[]},a={names:[],namesAbbr:[]};if(this[e])return this[e];for(let a=23;a<30;a++){const s=new Date(2017,6,a),i=s.toLocaleString(e,{weekday:"long"});t.names.push(i),t.namesAbbr.push(s.toLocaleString(e,{weekday:"short"})),t.namesShort.push(i.substring(0,2))}for(let t=0;t<12;t++){const s=new Date(2017,t,1).toLocaleString(e,{month:"long"});a.names.push(s),a.namesAbbr.push(s.substring(0,3))}return a.names.push(""),a.namesAbbr.push(""),this[e]={days:t,months:a},this[e]}internalMS(){return this.dateData}getDatePart(e){const t=this,a=t.internalMS();let s=parseInt(a/t.millisPerDay);const i=parseInt(s/t.daysPer400Years);s-=i*t.daysPer400Years;let r=parseInt(s/t.daysPer100Years);4===r&&(r=3),s-=r*t.daysPer100Years;const n=parseInt(s/t.daysPer4Years);s-=n*t.daysPer4Years;let o=parseInt(s/t.daysPerYear);if(4===o&&(o=3),e===t.datePartYear)return parseInt(400*i+100*r+4*n+o+1);if(s-=o*t.daysPerYear,e===t.datePartDayOfYear)return parseInt(s+1);const d=3===o&&(24!==n||3===r)?t.daysToMonth366:t.daysToMonth365;let l=s>>6;for(;s>=d[l];)l++;return e===t.datePartMonth?parseInt(l):parseInt(s-d[l-1]+1)}dayOfWeek(){const e=this.dateData;return parseInt(e/this.millisPerDay+1)%7}dayOfYear(){return this.getDatePart(this.datePartDayOfYear)}weekOfYear(e){const t=this.toDate(),a=e||this.calendar.firstDay,s=new Date(t.getFullYear(),0,1),i=Math.floor((t.getTime()-s.getTime()-6e4*(t.getTimezoneOffset()-s.getTimezoneOffset()))/864e5)+1;let r,n=s.getDay()-a;if(n=n>=0?n:n+7,n<4){if(r=Math.floor((i+n-1)/7)+1,r>52){let e=new Date(t.getFullYear()+1,0,1).getDay()-a;e=e>=0?e:e+7,r=e<4?1:53}}else r=Math.floor((i+n-1)/7);return r}subtract(e){const t=this;return new Smart.Utilities.TimeSpan(t.dateData*t.ticksPerMillisecond-e.dateData*t.ticksPerMillisecond)}dateToMS(e,t,a){const s=this;if(e>=1&&e<=9999&&t>=1&&t<=12){e=parseInt(e);const i=s.isLeapYear(e)?s.daysToMonth366:s.daysToMonth365;if(a>=1&&a<=i[t]-i[t-1]){const r=e-1;return(365*r+parseInt(r/4)-parseInt(r/100)+parseInt(r/400)+i[t-1]+a-1)*s.millisPerDay}}}isLeapYear(e){if(e<1||e>9999)throw new Error("Year out of Range");return e%4==0&&(e%100!=0||e%400==0)}timeToMS(e,t,a,s){const i=this;if(e>=0&&e<24&&t>=0&&t<60&&a>=0&&a<60){const r=parseInt(3600*e+60*t+a);return s>0&&s<1e3?r*i.millisPerSecond+s:r*i.millisPerSecond}}daysInMonth(e,t){if(t<1||t>12)throw new Error("Month out of Range");const a=this,s=a.isLeapYear(e)?a.daysToMonth366:a.daysToMonth365;return s[t]-s[t-1]}arrayIndexOf(e,t){return e.indexOf(t)}startsWith(e,t){return 0===e.indexOf(t)}endsWith(e,t){return e.substr(e.length-t.length)===t}trim(e){return(e+"").replace(this.regexTrim,"")}expandFormat(e,t){t=t||"F";let a,s=e.patterns,i=t.length;if(s[t])return s[t];if(1===i){if(a=s[t],!a)throw"Invalid date format string '"+t+"'.";t=a}else 2===i&&"%"===t.charAt(0)&&(t=t.charAt(1));return t}getEra(e,t){if(!t)return 0;if("string"==typeof e)return 0;let a,s=e.getTime();for(let e=0,i=t.length;e<i;e++)if(a=t[e].start,null===a||s>=a)return e;return 0}toUpper(e){return e.split(" ").join(" ").toUpperCase()}toUpperArray(e){const t=[];for(let a=0,s=e.length;a<s;a++)t[a]=this.toUpper(e[a]);return t}getEraYear(e,t,a,s){let i=e.getFullYear();return!s&&t.eras&&(i-="number"==typeof a?a:t.eras[a].offset),i}getDayIndex(e,t,a){const s=this,i=e.days;let r,n=e._upperDays;return n||(e._upperDays=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr),s.toUpperArray(i.namesShort)]),t=t.toUpperCase(),a?(r=s.arrayIndexOf(n[1],t),-1===r&&(r=s.arrayIndexOf(n[2],t))):r=s.arrayIndexOf(n[0],t),r}getMonthIndex(e,t,a){const s=this;let i=e.months,r=e.monthsGenitive||e.months,n=e._upperMonths,o=e._upperMonthsGen;n||(e._upperMonths=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr)],e._upperMonthsGen=o=[s.toUpperArray(r.names),s.toUpperArray(r.namesAbbr)]),t=s.toUpper(t);let d=s.arrayIndexOf(a?n[1]:n[0],t);return d<0&&(d=s.arrayIndexOf(a?o[1]:o[0],t)),d}appendPreOrPostMatch(e,t){let a=0,s=!1;for(let i=0,r=e.length;i<r;i++){const r=e.charAt(i);switch(r){case"'":s?t.push("'"):a++,s=!1;break;case"\\":s&&t.push("\\"),s=!s;break;default:t.push(r),s=!1}}return a}getTokenRegExp(){return/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyyy|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|uu|u|nn|n|pp|p|ee|e|aa|a|xx|x|oo|o|i{1,24}|zzz|zz|z|gg|g/g}static ParseDate(e,t){return(new Smart.Utilities.DateTime).tryparseDate(e,null,t)}tryparseDate(e,t,a){const s=this;if(null==t&&(t=s.calendar),void 0!==a){if(Array.isArray(a))for(let i=0;i<a.length;i++){const r=s.parseDate(e,a[i],t);if(r)return r}const i=s.parseDate(e,a,t);if(i)return i}if(""===e)return null;if(null==e||e.substring||(e=e.toString()),null!=e&&"/Date("===e.substring(0,6)){const t=/^\/Date\((-?\d+)(\+|-)?(\d+)?\)\/$/;let a=new Date(+e.replace(/\/Date\((\d+)\)\//,"$1"));if("Invalid Date"===a){const t=e.match(/^\/Date\((\d+)([-+]\d\d)(\d\d)\)\/$/);a=null,t&&(a=new Date(1*t[1]+36e5*t[2]+6e4*t[3]))}if(null==a||"Invalid Date"===a||isNaN(a)){const a=t.exec(e);if(a){const e=new Date(parseInt(a[1]));if(a[2]){let t=parseInt(a[3]);"-"===a[2]&&(t=-t);const s=e.getUTCMinutes();e.setUTCMinutes(s-t)}if(!isNaN(e.valueOf()))return e}}return a}const i={smartdate:"yyyy-MM-dd HH:mm:ss",d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",d3:"MM-dd-yyyy",d4:"MM.dd.yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",custom3:"yyyy-MM-ddTHH:mm:ss.fff+HH:mm",custom4:"yyyy-MM-ddTHH:mm:ss.fff-HH:mm",custom5:"yyyy-MM-ddTHH:mm:ss.ffffff+HH:mm",custom6:"yyyy-MM-ddTHH:mm:ss.ffffff-HH:mm",iso:"yyyy-MM-ddTHH:mm:ssZ",iso2:"yyyy-MM-ddTHH:mm.fffZ",iso_date1:"yyyy-MM-dd",iso_date2:"yyyy-MM-dd",iso_date3:"yyyy-ddd",iso_date4:"yyyy-MM-dd HH:mm",iso_date5:"yyyy-MM-dd HH:mm Z",iso_date6:"yyyy-MMM-dd",iso_date7:"yyyy-MM",iso_date8:"yyyy-MMM",iso_date9:"yyyy-MMMM",iso_date10:"yyyy-MMMM-dd",iso_time1:"HH:mm:ss.tttt",iso_time2:"HH:mm:ss",iso_time3:"HH:mm",iso_time4:"HH",iso_time5:"yyyyyy-MM-dd",iso_time6:"yyyyyy-MM-dd",iso_time7:"dd/MM/yyyy HH:mm",iso_time8:"dd.MM.yyyy HH:mm",iso_time9:"dd-MM-yyyy HH:mm",iso_time10:"MM.dd.yyyy HH:mm",iso_time11:"MM-dd-yyyy HH:mm",iso_time12:"dd/MM/yyyy",iso_time13:"MM.dd.yyyy h:mm tt",iso_time14:"MM-dd-yyyy h:mm tt",iso_time15:"MM/dd/yyyy h:mm tt"};for(let a in i){const r=s.parseDate(e,i[a],t);if(r)return r}const r=t.patterns;for(let a in r){const i=s.parseDate(e,r[a],t);if(i){if("ISO"===a){const a=s.parseDate(e,r.ISO2,t);if(a)return a}return i}}let n;if("string"==typeof e){const a=[":","/","-"," ",","];let i="",r=e=function(e,t,a){return a.replace(new RegExp(e,"g"),t)}(", ",",",e=s.trim(e));e.indexOf(":")>=0?(i=e.substring(e.indexOf(":")-2),i=s.trim(i),r=e.substring(0,e.indexOf(":")-2)):e.toUpperCase().indexOf("AM")>=0?(i=e.substring(e.toUpperCase().indexOf("AM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("AM")-2)):e.toUpperCase().indexOf("PM")>=0&&(i=e.substring(e.toUpperCase().indexOf("PM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("PM")-2));let o=new Date,d=!1;if(r){for(let e=0;e<a.length;e++)if(r.indexOf(a[e])>=0){n=r.split(a[e]);break}if(!n)return null;let e=new Array,i=new Array,l=new Array,f=null,m=null;for(let a=0;a<n.length;a++){const i=n[a],r=s.parseDate(i,"d",t)||s.parseDate(i,"dd",t)||s.parseDate(i,"ddd",t)||s.parseDate(i,"dddd",t);if(r&&(e.push(r.getDate()),i.length>2)){f=a;break}}for(let e=0;e<n.length;e++){const a=n[e],r=s.parseDate(a,"M",t)||s.parseDate(a,"MM",t)||s.parseDate(a,"MMM",t)||s.parseDate(a,"MMMM",t);if(r){if(null!=f&&f===e)continue;if(i.push(r.getMonth()),a.length>2){m=e;break}}}for(let e=0;e<n.length;e++){const a=n[e],i=s.parseDate(a,"yyyy",t);if(i){if(null!=f&&f===e)continue;if(null!=m&&m===e)continue;l.push(i.getFullYear())}}const c=new Array;for(let t=e.length-1;t>=0;t--)for(let a=0;a<i.length;a++)for(let s=0;s<l.length;s++){const r=new Date(l[s],i[a],e[t]);l[s]<1970&&r.setFullYear(l[s]),isNaN(r.getTime())||c.push(r)}c.length>0&&(o=c[0],d=!0)}if(i){const e=i.indexOf(":")>=0?i.split(":"):i,a=s.parseDate(i,"h:mm tt",t)||s.parseDate(i,"HH:mm:ss.fff",t)||s.parseDate(i,"HH:mm:ss.ff",t)||s.parseDate(i,"h:mm:ss tt",t)||s.parseDate(i,"HH:mm:ss.tttt",t)||s.parseDate(i,"HH:mm:ss",t)||s.parseDate(i,"HH:mm",t)||s.parseDate(i,"HH",t);let r=0,n=0,l=0,f=0;a&&!isNaN(a.getTime())?(r=a.getHours(),n=a.getMinutes(),l=a.getSeconds(),f=a.getMilliseconds()):(1===e.length&&(r=parseInt(e[0])),2===e.length&&(r=parseInt(e[0]),n=parseInt(e[1])),3===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),e[2].indexOf(".")>=0?(l=parseInt(e[2].toString().split(".")[0]),f=parseInt(e[2].toString().split(".")[1])):l=parseInt(e[2])),4===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),l=parseInt(e[2]),f=parseInt(e[3]))),!o||isNaN(r)||isNaN(n)||isNaN(l)||isNaN(f)||(o.setHours(r,n,l,f),d=!0)}if(d)return o}if(null!=e){n=[":","/","-"];let t=!0;for(let a=0;a<n.length;a++)-1!==e.indexOf(n[a])&&(t=!1);if(t){const t=new Number(e);if(!isNaN(t))return new Date(t)}}return null}getParseRegExp(e,t){const a=this;let s=e._parseRegExp;if(s){const e=s[t];if(e)return e}else e._parseRegExp=s={};let i,r=a.expandFormat(e,t).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),n=["^"],o=[],d=0,l=0,f=a.getTokenRegExp();for(;null!==(i=f.exec(r));){const e=r.slice(d,i.index);if(d=f.lastIndex,l+=a.appendPreOrPostMatch(e,n),l%2){n.push(i[0]);continue}let t,s=i[0],m=s.length;switch(s){case"dddd":case"ddd":case"MMMM":case"MMM":case"gg":case"g":t="(\\D+)";break;case"tt":case"t":t="(\\D*)";break;case"yyyyy":t="(\\d{1,4})";break;case"yyyy":t="(\\d{"+m+"})";break;case"fff":case"ff":case"f":t="(\\d{1,"+m+"})";break;case"dd":case"d":case"MM":case"M":case"yy":case"y":case"HH":case"H":case"hh":case"h":case"mm":case"m":case"ss":case"s":t="(\\d\\d?)";break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":t="(\\d{1,3})";break;case"zzz":t="([+-]?\\d\\d?:\\d{2})";break;case"zz":case"z":t="([+-]?\\d\\d?)";break;case"/":t="/";break;default:if(!/i{1,24}/.test(s))throw"Invalid date format pattern '"+s+"'.";t="(\\d{"+s.length+"})"}t&&n.push(t),"/"!==s&&o.push(i[0])}a.appendPreOrPostMatch(r.slice(d),n),n.push("$");const m={regExp:n.join("").replace(/\s+/g,"\\s+"),groups:o};return s[t]=m}outOfRange(e,t,a){return e<t||e>a}expandYear(e,t){const a=this,s=new Date,i=a.getEra(s);if(t<100){let r=e.twoDigitYearMax;r="string"==typeof r?(new Date).getFullYear()%100+parseInt(r,10):r;const n=a.getEraYear(s,e,i);(t+=n-n%100)>r&&(t-=100)}return t}padZeros(e,t){let a,s=e+"";return t>1&&s.length<t?(a=["0","00","000"][t-2]+s,a.substr(a.length-t,t)):(a=s,a)}parseDate(e,t,a){const s=this;null==a&&(a=s.calendar),e=s.trim(e);const i=a,r=s.getParseRegExp(i,t),n=new RegExp(r.regExp).exec(e);if(null===n)return null;let o,d=r.groups,l=null,f=null,m=null,c=null,u=null,y=0,p=0,g=0,h=0,T=null,M=!1;for(let e=0,t=d.length;e<t;e++){const t=n[e+1];if(t){const a=d[e],r=a.length,n=parseInt(t,10);switch(a){case"dd":case"d":if(c=n,s.outOfRange(c,1,31))return null;break;case"MMM":case"MMMM":case"MMMMM":case"MMMMMM":case"MMMMMMM":case"MMMMMMMM":if(m=s.getMonthIndex(i,t,3===r),s.outOfRange(m,0,11))return null;break;case"M":case"MM":if(m=n-1,s.outOfRange(m,0,11))return null;break;case"y":case"yy":case"yyyy":if(f=r<4?s.expandYear(i,n):n,s.outOfRange(f,0,9999))return null;break;case"h":case"hh":if(y=n,12===y&&(y=0),s.outOfRange(y,0,11))return null;break;case"H":case"HH":if(y=n,s.outOfRange(y,0,23))return null;break;case"m":case"mm":if(p=n,s.outOfRange(p,0,59))return null;break;case"s":case"ss":if(g=n,s.outOfRange(g,0,59))return null;break;case"tt":case"t":if(M=i.PM&&(t===i.PM[0]||t===i.PM[1]||t===i.PM[2]),!M&&(!i.AM||t!==i.AM[0]&&t!==i.AM[1]&&t!==i.AM[2]))return null;break;case"f":case"ff":case"fff":if(h=n*Math.pow(10,3-r),s.outOfRange(h,0,999))return null;break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":if(s.outOfRange(n,0,1e3))return null;s[s._codeToUnit[a]]=n;break;case"ddd":case"dddd":if(u=s.getDayIndex(i,t,3===r),s.outOfRange(u,0,6))return null;break;case"zzz":{const e=t.split(/:/);if(2!==e.length)return null;if(o=parseInt(e[0],10),s.outOfRange(o,-12,13))return null;const a=parseInt(e[1],10);if(s.outOfRange(a,0,59))return null;T=60*o+(s.startsWith(t,"-")?-a:a);break}case"z":case"zz":if(o=n,s.outOfRange(o,-12,13))return null;T=60*o;break;case"g":case"gg":{let e=t;if(!e||!i.eras)return null;e=this.trim(e.toLowerCase());for(let t=0,a=i.eras.length;t<a;t++)if(e===i.eras[t].nathat.toLowerCase()){l=t;break}if(null===l)return null;break}default:{let e=t;e.length%3==1?e+="00":e.length%3==2&&(e+="0"),h=parseInt(e.slice(0,3),10),e=e.slice(3);let a=0;for(;e.length>0;)s[s._smallUnits[a]]=parseInt(e.slice(0,3),10),e=e.slice(3),a++}}}}let S,D=new Date,H=i.convert;if(S=D.getFullYear(),null===f?f=S:i.eras&&(f+=i.eras[l||0].offset),null===m&&(m=0),null===c&&(c=1),H){if(D=H.toGregorian(f,m,c),null===D)return null}else{if(D.setFullYear(f,m,c),D.getDate()!==c)return null;if(null!==u&&D.getDay()!==u)return null}if(M&&y<12&&(y+=12),D.setHours(y,p,g,h),null!==T){const e=D.getMinutes()-(T+D.getTimezoneOffset());D.setHours(D.getHours()+parseInt(e/60,10),e%60)}return D}toString(e,t){const a=this;void 0===e&&(e="yyyy-MM-dd HH:mm:ss");const s=a.dateData.toString()+a.getFractionsOfSecondStamp()+e+(a.timeZone||"");if(Smart.Utilities.DateTime.cache&&Smart.Utilities.DateTime.cache[s]&&!1!==a.showTodayDateAsString)return Smart.Utilities.DateTime.cache[s];const i=a.toDate();if(null==t&&(t=a.calendar),"string"==typeof i)return i;if(!e||!e.length||"i"===e){let e;return e=a.formatDate(i,t.patterns.F,t),e}const r=t.eras,n="s"===e;e=a.expandFormat(t,e);const o=[];let d,l=0,f=a.getTokenRegExp();function m(e,t){if(void 0!==e.getMonth)switch(t){case 0:return e.getFullYear();case 1:return e.getMonth();case 2:return e.getDate()}}for(;;){const s=f.lastIndex,c=f.exec(e),u=e.slice(s,c?c.index:e.length);if(l+=a.appendPreOrPostMatch(u,o),!c)break;if(l%2){o.push(c[0]);continue}const y=c[0],p=y.length;let g;if(/i{1,24}/.test(y))o.push(a.getFirstNDigitsOfPrecision(y.length));else switch(y){case"ddd":case"dddd":{const e=3===p?t.days.namesAbbr:t.days.names;o.push(e[i.getDay()]);break}case"d":case"dd":o.push(a.padZeros(m(i,2),p));break;case"MMM":case"MMMM":g=m(i,1),o.push(t.months[3===p?"namesAbbr":"names"][g]);break;case"M":case"MM":o.push(a.padZeros(m(i,1)+1,p));break;case"y":case"yy":case"yyyy":g=a.getEraYear(i,t,a.getEra(i,r),n),p<4&&(g%=100),o.push(a.padZeros(g,p));break;case"h":case"hh":d=i.getHours()%12,0===d&&(d=12),o.push(a.padZeros(d,p));break;case"H":case"HH":o.push(a.padZeros(i.getHours(),p));break;case"m":case"mm":o.push(a.padZeros(i.getMinutes(),p));break;case"s":case"ss":o.push(a.padZeros(i.getSeconds(),p));break;case"t":case"tt":g=i.getHours()<12?t.AM?t.AM[0]:" ":t.PM?t.PM[0]:" ",o.push(1===p?g.charAt(0):g);break;case"f":case"ff":case"fff":o.push(a.padZeros(i.getMilliseconds(),3).substr(0,p));break;case"u":case"n":case"p":case"e":case"a":case"x":case"o":o.push(a[a._codeToUnit[y]]);break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":o.push(a.padZeros(a[a._codeToUnit[y]],3));break;case"z":case"zz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),p));break;case"zzz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),2)+":"+a.padZeros(60*Math.abs(a.timeZoneOffsetHours%1),2));break;case"g":case"gg":t.eras&&o.push(t.eras[a.getEra(i,r)].name);break;case"/":o.push(t["/"]);break;default:throw"Invalid date format pattern '"+y+"'."}}let c=o.join("");if(Smart.Utilities.DateTime.cache||(Smart.Utilities.DateTime.cache=new Array),a._today||(a._today=new Date),a.calendar&&a.calendar.today&&-1===e.indexOf(":")&&i.getFullYear()===a._today.getFullYear()&&i.getDate()===a._today.getDate()&&i.getMonth()===a._today.getMonth()){if(!1===a.showTodayDateAsString)return Smart.Utilities.DateTime.cache[s]=c,c;c=a.calendar.today}return Smart.Utilities.DateTime.cache[s]=c,c}getFractionsOfSecondStamp(){const e=this;return e._microsecond.toString()+e._nanosecond+e._picosecond+e._femtosecond+e._attosecond+e._zeptosecond+e._yoctosecond}getFirstNDigitsOfPrecision(e,t){const a=this;return(""+(!0!==t?a.padZeros(a.millisecond(),3):"")+a.padZeros(a._microsecond,3)+a.padZeros(a._nanosecond,3)+a.padZeros(a._picosecond,3)+a.padZeros(a._femtosecond,3)+a.padZeros(a._attosecond,3)+a.padZeros(a._zeptosecond,3)+a.padZeros(a._yoctosecond,3)).slice(0,e)}copySmallTimePartValues(e){const t=this;e._microsecond=t._microsecond,e._nanosecond=t._nanosecond,e._picosecond=t._picosecond,e._femtosecond=t._femtosecond,e._attosecond=t._attosecond,e._zeptosecond=t._zeptosecond,e._yoctosecond=t._yoctosecond}add(e,t,a){const s=this,i=s.internalMS();if(void 0===t){if(!1===a)return s.dateData=i+parseInt(e._ticks/s.ticksPerMillisecond),s;const t=new Smart.Utilities.DateTime(i+parseInt(e._ticks/s.ticksPerMillisecond));return s.copyTimeZone(t),s.copySmallTimePartValues(t),t}const r=e*t;if(r<=-s.maxMillis||r>=s.maxMillis)throw new Error("Out of Range");if(!1===a)return s.dateData=i+r,s;const n=new Smart.Utilities.DateTime(i+r);return s.copyTimeZone(n),s.copySmallTimePartValues(n),n}addDays(e,t){return this.add(e,this.millisPerDay,t)}clone(){const e=this,t=new Smart.Utilities.DateTime(e.dateData);return e.copyTimeZone(t),e.copySmallTimePartValues(t),t}clearTime(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s,0,0,0,0);return e.copyTimeZone(i),i}addHours(e,t){return this.add(e,this.millisPerHour,t)}addDeciseconds(e,t){return this.add(100*e,1,t)}addCentiseconds(e,t){return this.add(10*e,1,t)}addMilliseconds(e,t){return this.add(e,1,t)}addMinutes(e,t){return this.add(e,this.millisPerMinute,t)}addMonths(e,t){const a=this;if(e<-12e4||e>12e4)throw new Error("Invalid Months Value");let s=parseInt(a.getDatePart(a.datePartYear)),i=parseInt(a.getDatePart(a.datePartMonth)),r=parseInt(a.getDatePart(a.datePartDay));if(e%12==0)s+=e/12;else{const t=i-1+e;t>=0?(i=t%12+1,s+=t/12):(i=12+(t+1)%12,s+=(t-11)/12),s=parseInt(s)}if(s<1||s>9999)throw new Error("Year out of range");const n=a.daysInMonth(s,i);if(r>n&&(r=n),!1===t)return a.dateData=a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay,a;const o=new Smart.Utilities.DateTime(a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay);return a.copyTimeZone(o),a.copySmallTimePartValues(o),o}addSeconds(e,t){return this.add(e,this.millisPerSecond,t)}addYears(e,t){return this.addMonths(12*e,t)}addMicroseconds(e,t){if(0===e)return;const a=this;let s,i;e<0&&0===a.hour()&&0===a.minute()&&0===a.second()&&0===a.millisecond()&&0===a._microsecond&&(s=parseInt(e/1e3,10)-1,i=1e3+e%1e3);const r=1e3*a.timeToMS(a.hour(),a.minute(),a.second(),a.millisecond())+a._microsecond,n=r+e;let o;if(void 0===s&&(s=parseInt(n/1e3,10)-parseInt(r/1e3,10)),void 0===i&&(i=parseInt(n%1e3,10)),0!==s&&(o=a.addMilliseconds(s,t)),!1!==t)return o||(o=a.clone()),o._microsecond=i,o;a._microsecond=i}addFractionsOfSecond(e,t,a,s,i){if(0===e)return;const r=this,n=1e3*r[s]+r[a],o=e+n;let d,l=parseInt(o/1e3,10)-parseInt(n/1e3,10),f=parseInt(o%1e3,10);if(e<0&&o<0&&f<0&&(l--,f=1e3+f),0!==l&&(d=r[i](l,t)),!1!==t)return d||(d=r.clone()),d[a]=f,d;r[a]=f}addNanoseconds(e,t){return this.addFractionsOfSecond(e,t,"_nanosecond","_microsecond","addMicroseconds")}addPicoseconds(e,t){return this.addFractionsOfSecond(e,t,"_picosecond","_nanosecond","addNanoseconds")}addFemtoseconds(e,t){return this.addFractionsOfSecond(e,t,"_femtosecond","_picosecond","addPicoseconds")}addAttoseconds(e,t){return this.addFractionsOfSecond(e,t,"_attosecond","_femtosecond","addFemtoseconds")}addZeptoseconds(e,t){return this.addFractionsOfSecond(e,t,"_zeptosecond","_attosecond","addAttoseconds")}addYoctoseconds(e,t){return this.addFractionsOfSecond(e,t,"_yoctosecond","_zeptosecond","addZeptoseconds")}getTimeZoneOffset(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1),s=e.getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset());return{offset:-e.getTimezoneOffset()/60,dst:+s}}isInDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return this.date().getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset())}supportsDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return t.getTimezoneOffset()!==a.getTimezoneOffset()}date(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s);return e.copyTimeZone(i),i}isWeekend(){return 0===this.dayOfWeek()||6===this.dayOfWeek()}toDate(e){const t=this,a=t.month(),s=t.year(),i=t.day(),r=t.hour(),n=t.minute(),o=t.second(),d=t.millisecond();let l=new Date(s,a-1,i);if(s<1970&&l.setFullYear(s),l.setHours(r,n,o,d),e){const a=t.timeZones.filter((function(t){return t.id===e}));if(a.length){let e=a[0].offset;const s=l.getTime();let i=60*l.getTimezoneOffset()*1e3;if(t.timeZone){const e=t.timeZones.filter((function(e){return e.id===t.timeZone}));e.length&&(i=60*-e[0].offset*1e3)}l=new Date(s+i+6e4*e)}}return l}toTimeZone(e){const t=this;let a=e;if(null==a&&(a="Local"),t.timeZone===a)return t.clone();const s=t.timeZones.filter((function(e){return e.id===a}));if(0===s.length)return t.clone();const i=this.toDate(a),r=new Smart.Utilities.DateTime(i);return r.timeZone=a,r.timeZoneOffset=s[0].offset,r.timeZoneOffsetHours=s[0].offsetHours,t.copySmallTimePartValues(r),r}day(){return this.getDatePart(this.datePartDay)}month(){return this.getDatePart(this.datePartMonth)}year(){return this.getDatePart(this.datePartYear)}millisecond(){return parseInt(this.internalMS()%1e3)}hour(){return parseInt(Math.floor(this.internalMS()/this.millisPerHour)%24)}minute(){return parseInt(this.internalMS()/this.millisPerMinute%60)}second(){return parseInt(this.internalMS()/this.millisPerSecond%60)}microsecond(){return this._microsecond}nanosecond(){return this._nanosecond}picosecond(){return this._picosecond}femtosecond(){return this._femtosecond}attosecond(){return this._attosecond}zeptosecond(){return this._zeptosecond}yoctosecond(){return this._yoctosecond}valueOf(){return this.dateData}equals(e){const t=this;return t.dateData===e.dateData&&t._microsecond===e._microsecond&&t._nanosecond===e._nanosecond&&t._picosecond===e._picosecond&&t._femtosecond===e._femtosecond&&t._attosecond===e._attosecond&&t._zeptosecond===e._zeptosecond&&t._yoctosecond===e._yoctosecond}equalDateParts(e){const t=this;return t.year()===e.year()&&t.month()===e.month()&&t.day()===e.day()}compare(e){const t=this;if(t.equals(e))return 0;const a=["dateData","_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"];for(let s=0;s<a.length;s++){const i=a[s];if(t[i]>e[i])return 1;if(t[i]<e[i])return-1}return 0}toDateString(){return this.toDate().toDateString()}toLocaleDateString(){return this.toDate().toLocaleDateString(this.calendar.locale)}toLocaleString(){return this.toDate().toLocaleString(this.calendar.locale)}toLocaleTimeString(){return this.toDate().toLocaleTimeString(this.calendar.locale)}validateTimeZone(e){const t=this;if("string"!=typeof e)return;const a=t.timeZones.filter((function(t){return t.id===e}));0!==a.length&&(t.timeZone=e,t.timeZoneOffset=a[0].offset,t.timeZoneOffsetHours=a[0].offsetHours)}copyTimeZone(e){const t=this;e.timeZone=t.timeZone,e.timeZoneOffset=t.timeZoneOffset,e.timeZoneOffsetHours=t.timeZoneOffsetHours}getTimeStamp(){return new Smart.Utilities.BigNumber(this.dateData.toString()+this.getFirstNDigitsOfPrecision(void 0,!0))}})})();
63
63
 
64
64
  /***/ }),
65
65
 
66
66
  /***/ 7054:
67
67
  /***/ (() => {
68
68
 
69
- Smart("smart-date-time-picker",class extends Smart.BaseElement{static get properties(){return{animationSettings:{value:null,type:"object"},autoClose:{value:!1,type:"boolean"},autoCloseDelay:{value:0,type:"number"},autoSwitchToMinutes:{value:!1,type:"boolean"},calendarButton:{value:!1,type:"boolean"},calendarButtonPosition:{value:"right",allowedValues:["left","right"],type:"string"},calendarMode:{value:"default",allowedValues:["default","classic"],type:"string"},dayNameFormat:{value:"firstTwoLetters",allowedValues:["narrow","firstTwoLetters","long","short"],type:"string"},disableAutoNavigation:{value:!1,type:"boolean"},displayKind:{value:"unspecified",allowedValues:["UTC","local","unspecified"],type:"string"},displayModeView:{value:"table",allowedValues:["table","list"],type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownDisplayMode:{value:"default",allowedValues:["default","classic","calendar","timePicker","auto"],type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["auto","bottom","overlay-top","overlay-center","overlay-bottom","top","center-bottom","center-top"],type:"string"},editMode:{value:"default",allowedValues:["default","full","partial"],type:"string"},enableMouseWheelAction:{value:!1,type:"boolean"},firstDayOfWeek:{value:0,type:"number"},footerTemplate:{value:null,type:"any"},footer:{value:!1,type:"boolean"},formatString:{value:"dd-MMM-yy HH:mm:ss.fff",type:"string"},headerTemplate:{value:null,type:"any"},hideDayNames:{value:!1,type:"boolean"},hideOtherMonthDays:{value:!1,type:"boolean"},hideTooltipArrow:{value:!1,type:"boolean"},hint:{value:"",type:"string"},importantDates:{value:[],type:"array"},importantDatesTemplate:{value:null,type:"any"},interval:{value:new Smart.Utilities.TimeSpan(0,0,1),type:"any"},label:{value:"",type:"string"},max:{value:new Smart.Utilities.DateTime(3001,1,1),type:"any"},messages:{value:{en:{now:"Now",dateTabLabel:"DATE",timeTabLabel:"TIME"}},type:"object",extend:!0},min:{value:new Smart.Utilities.DateTime(1600,1,1),type:"any"},name:{value:"",type:"string"},nullable:{value:!1,type:"boolean"},opened:{value:!1,type:"boolean"},placeholder:{value:"Enter date",type:"string"},restrictedDates:{value:[],type:"array"},spinButtons:{value:!1,type:"boolean"},spinButtonsDelay:{value:75,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},spinButtonsPosition:{value:"right",allowedValues:["left","right"],type:"string"},tooltip:{value:!1,type:"boolean"},tooltipDelay:{value:100,type:"number"},tooltipPosition:{value:"top",allowedValues:["bottom","top","left","right","absolute"],type:"string"},tooltipTemplate:{value:null,type:"any"},validation:{value:"strict",allowedValues:["strict","interaction"],type:"string"},value:{defaultReflectToAttribute:!0,value:new Smart.Utilities.DateTime,type:"any"},weekNumbers:{value:!1,type:"boolean"},weeks:{value:6,type:"number"},yearCutoff:{value:1926,type:"number"}}}static get listeners(){return{"container.mouseout":"_mouseoutHandler","container.mouseover":"_mouseoverHandler","calendarButton.click":"_calendarButtonClickHandler","calendarDropDown.change":"_calendarDropDownChangeHandler","calendarDropDown.click":"_calendarDropDownClickHandler","downButton.click":"_spinButtonsClickHandler","input.blur":"_inputBlurHandler","input.change":"_inputChangeHandler","input.dragstart":"_inputDragstartHandler","input.focus":"_inputFocusHandler","input.keydown":"_inputKeydownHandler","input.down":"_inputDownHandler","input.paste":"_inputPasteHandler","input.select":"_inputSelectHandler","input.up":"_inputUpHandler","input.wheel":"_inputWheelHandler","dropDownContainer.keydown":"_dropDownKeydownHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","dropDownHeader.click":"_dropDownHeaderClickHandler","upButton.click":"_spinButtonsClickHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.Utilities.DateTime":"smart.date.js","Smart.Utilities.Draw":"smart.draw.js","Smart.Utilities.BigNumber":"smart.math.js","Smart.Utilities.NumericProcessor":"smart.numeric.js","Smart.RepeatButton":"smart.button.js","Smart.Calendar":"smart.calendar.js","Smart.TimePicker":"smart.timepicker.js"}}static get styleUrls(){return["smart.datetimepicker.css"]}template(){return'<div id="container" role="presentation">\n <span id="label" class="smart-label">[[label]]</span>\n <div id="content" class="smart-content">\n <input id="input" class="smart-input smart-date-time-input" type="text" readonly="[[readonly]]" disabled="[[disabled]]" placeholder="[[placeholder]]" name="[[name]]" aria-label="[[placeholder]]" />\n <div id="spinButtonsContainer" class="smart-spin-buttons-container" role="presentation">\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" animation="[[animation]]" delay="[[spinButtonsDelay]]" readonly="[[readonly]]" unfocusable id="upButton" right-to-left="[[rightToLeft]]" class="smart-spin-button" aria-label="Increment">\n <div class="smart-arrow smart-arrow-up" aria-hidden="true"></div>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" animation="[[animation]]" delay="[[spinButtonsDelay]]" readonly="[[readonly]]" unfocusable id="downButton" right-to-left="[[rightToLeft]]" class="smart-spin-button" aria-label="Decrement">\n <div class="smart-arrow smart-arrow-down" aria-hidden="true"></div>\n </smart-repeat-button>\n </div>\n <div id="calendarButton" class="smart-drop-down-button smart-calendar-button" role="button" aria-haspopup="dialog" aria-label="Toggle popup"></div>\n <div id="dropDownContainer" class="smart-drop-down smart-date-time-drop-down smart-drop-down-container smart-visibility-hidden" role="dialog">\n <div id="dropDownHeader" class="smart-drop-down-header smart-hidden" role="heading" aria-level="1">\n <div id="selectDate" class="smart-selected" role="button"></div>\n <div id="selectTime" role="button"></div>\n </div>\n <div id="dropDownContent" class="smart-drop-down-content" role="presentation">\n <smart-calendar id="calendarDropDown" class="smart-hidden"\n animation="[[animation]]"\n animation-settings="[[animationSettings]]"\n calendar-mode="[[calendarMode]]"\n day-name-format="[[dayNameFormat]]"\n disable-auto-navigation="[[disableAutoNavigation]]"\n display-mode-view="[[displayModeView]]"\n first-day-of-week="[[firstDayOfWeek]]"\n header-template="[[headerTemplate]]"\n hide-day-names="[[hideDayNames]]"\n hide-other-month-days="[[hideOtherMonthDays]]"\n hide-tooltip-arrow="[[hideTooltipArrow]]"\n important-dates="[[importantDates]]"\n important-dates-template="[[importantDatesTemplate]]"\n locale="[[locale]]"\n right-to-left="[[rightToLeft]]"\n selection-mode="one"\n spin-buttons-delay="[[spinButtonsDelay]]"\n spin-buttons-initial-delay="[[spinButtonsInitialDelay]]"\n theme="[[theme]]"\n tooltip="[[tooltip]]"\n tooltip-delay="[[tooltipDelay]]"\n tooltip-position="[[tooltipPosition]]"\n tooltip-template="[[tooltipTemplate]]"\n unfocusable="[[unfocusable]]"\n view-sections=\'["header", "footer"]\'\n week-numbers="[[weekNumbers]]"\n weeks="[[weeks]]"></smart-calendar>\n </div>\n </div>\n </div>\n <span id="hint" inner-h-t-m-l="[[hint]]" class="smart-hint smart-hidden"></span>\n </div>'}attached(){const e=this;super.attached(),e.isCompleted&&(e._defaultFooterTemplateApplied&&e._addCalendarFooterListeners(),e.$.timePickerDropDown&&e._addTimePickerListener(),e._positionDetection&&e._positionDetection.dropDownAttached())}detached(){const e=this;if(super.detached(),e.close(),e._defaultFooterTemplateApplied){const t=e.$.calendarDropDown.$footer;t.unlisten("change"),t.unlisten("click"),t.unlisten("wheel")}e.$.timePickerDropDown&&e.$.timePickerDropDown.$.unlisten("change"),e._positionDetection&&e._positionDetection.dropDownDetached()}ready(){super.ready();const e=this;e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._iOS=!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform),e._edgeMacFF&&e.$dropDownContainer.addClass("not-in-view"),e._defaultFooterTemplate=document.createElement("template"),e._defaultFooterTemplate.innerHTML='<div class="smart-date-time-picker-footer">\n <div class="smart-footer-component smart-footer-component-hour" role="presentation">\n <input type="text" class="smart-hour-element" aria-label="Hours" />\n <span role="presentation">\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Increment hours">\n <span class="smart-arrow smart-arrow-up" aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Decrement hours">\n <span class="smart-arrow smart-arrow-down" aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n <div class="smart-footer-component smart-footer-component-minute" role="presentation">\n <input class="smart-minute-element" aria-label="Minutes" />\n <span role="presentation">\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Increment minutes">\n <span class="smart-arrow smart-arrow-up" aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Decrement minutes">\n <span class="smart-arrow smart-arrow-down" aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n <div class="smart-footer-component smart-footer-component-ampm" role="presentation">\n <input type="text" class="smart-am-pm-element" aria-label="AM/PM" />\n </div>\n <div class="smart-footer-component smart-footer-component-today" role="presentation">\n <div tabindex="-1" class="smart-today-element" role="button" aria-label="Now"></div>\n </div>\n </div>',e._codeToMethod={y:"addYears",yy:"addYears",yyyy:"addYears",yyyyy:"addYears",M:"addMonths",MM:"addMonths",MMM:"addMonths",MMMM:"addMonths",d:"addDays",dd:"addDays",ddd:"addDays",dddd:"addDays",H:"addHours",HH:"addHours",h:"addHours",hh:"addHours",m:"addMinutes",mm:"addMinutes",s:"addSeconds",ss:"addSeconds",f:"addDeciseconds",ff:"addCentiseconds",fff:"addMilliseconds",u:"addMicroseconds",uu:"addMicroseconds",n:"addNanoseconds",nn:"addNanoseconds",p:"addPicoseconds",pp:"addPicoseconds",e:"addFemtoseconds",ee:"addFemtoseconds",a:"addAttoseconds",aa:"addAttoseconds",x:"addZeptoseconds",xx:"addZeptoseconds",o:"addYoctoseconds",oo:"addYoctoseconds"},e._codeToIndex={y:0,yy:0,yyyy:0,yyyyy:0,M:1,MM:1,MMM:1,MMMM:1,d:2,dd:2,ddd:2,dddd:2,H:3,HH:3,h:3,hh:3,m:4,mm:4,s:5,ss:5,f:6,ff:6,fff:6,u:7,uu:7,n:8,nn:8,p:9,pp:9,e:10,ee:10,a:11,aa:11,x:12,xx:12,o:13,oo:13},e._getLocalizedNames(),e.checkLicense()}render(){const e=this;e.rightToLeft&&(e.calendarButtonPosition="right"===e.calendarButtonPosition?"left":"right"),e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.content,"close"),e._positionDetection.customPositionDropDown=e._positionExternalDropDown,e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e.$.dropDownContainer.style.left=null,e._positionDetection.handleAutoPositioning(),e._setIds(),e._validateInitialPropertyValues(),e._setFocusable(),e.setAttribute("role","presentation"),e.$.input.setAttribute("aria-describedby",e.$.hint.id),e.$.input.setAttribute("aria-labelledby",e.$.label.id),e.$.calendarButton.setAttribute("aria-owns",e.$.dropDownContainer.id),e.$.dropDownContainer.setAttribute("animation",e.animation),e.$.dropDownContainer.setAttribute("drop-down-display-mode",e.dropDownDisplayMode),super.render(),e.isInitialized=!0}close(){this.opened&&this._close()}focus(){this.$.input.focus()}select(){this.$.input.select()}open(){this.opened||this._open()}_handleFooter(){const e=this;if(e.footer){e.$.dropDownContainer.setAttribute("footer","");const t=e.$.calendarDropDown;"default"===e._dropDownDisplayMode?t.viewSections=["title","header","footer"]:"classic"===e._dropDownDisplayMode?t.viewSections=["header","footer"]:"calendar"===e._dropDownDisplayMode&&(t.viewSections=["title","header","footer"])}else e.$.dropDownContainer.removeAttribute("footer")}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"animation":case"theme":n.$.timePickerDropDown&&(n.$.timePickerDropDown[e]=a),"animation"===e&&(n.$.dropDownContainer.setAttribute("animation",n.animation),n._defaultFooterTemplateApplied&&Array.from(n.$.calendarDropDown.$.footer.getElementsByTagName("smart-repeat-button")).forEach((function(e){e.animation=a})));break;case"calendarButton":n.$.dropDownContainer.style.transition="none",a||n.close();break;case"calendarButtonPosition":n.$.dropDownContainer.style.transition="none",n.close(),"left"===a?n.$.content.insertBefore(n.$.calendarButton,n.$.content.firstElementChild):null===n._dropDownParent?n.$.content.insertBefore(n.$.calendarButton,n.$.dropDownContainer):n.$.content.appendChild(n.$.calendarButton);break;case"disabled":a?(n.close(),n.$.upButton.disabled=!0,n.$.downButton.disabled=!0):n._disableSpinButtons(),n._setFocusable(),n._positionDetection.handleAutoPositioning();break;case"displayKind":{const e=n._outputTimeZone;switch(a){case"unspecified":n._outputTimeZone=n._inputTimeZone;break;case"UTC":n._outputTimeZone="UTC";break;case"local":n._outputTimeZone="Local"}if(n._outputTimeZone===e)return;null!==n._value&&(n.close(),n._toSync=!0,n._value=n._value.toTimeZone(n._outputTimeZone),n._applyFormatString()),n.min=n.min.toTimeZone(n._outputTimeZone),n.max=n.max.toTimeZone(n._outputTimeZone);for(let e=0;e<n.restrictedDates.length;e++){let t=n.restrictedDates[e];t=t.toTimeZone(n._outputTimeZone)}break}case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownDisplayMode":n._changeDropDownDisplayMode();break;case"dropDownOverlay":a||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"footer":n._handleFooter();break;case"footerTemplate":if(null!==a){n._defaultFooterTemplateApplied=!1;const e=n.$.calendarDropDown.$footer;e.unlisten("change"),e.unlisten("click"),e.unlisten("wheel"),n.$.calendarDropDown.footerTemplate=a}else{n._setDefaultFooterTemplate();const e=n._value;n._hourElement.value=e.toString("hh"),n._minuteElement.value=e.toString("mm"),n._ampmElement.value=e.toString("tt")}n._handleFooter();break;case"formatString":""===a&&(n.formatString="dd-MMM-yy HH:mm:ss.fff"),n._getFormatStringRegExp(),n._applyFormatString(),"auto"===n.dropDownDisplayMode&&n._changeDropDownDisplayMode(),n._timePickerInitialized&&(n.$.timePickerDropDown.format=n._formatStringRegExp.groups.find((e=>-1!==e.indexOf("H")))?"24-hour":"12-hour");break;case"interval":n._validateInterval(t);break;case"locale":case"messages":if(n.$.selectDate.innerHTML=n.localize("dateTabLabel"),n.$.selectTime.innerHTML=n.localize("timeTabLabel"),n._defaultFooterTemplateApplied&&(n._todayElement.title=n.localize("now")),"messages"===e)return;n._getLocalizedNames(),n.min.calendar.days=n._localizedDays,n.min.calendar.months=n._localizedMonths,n.min.calendar.locale=n.locale,n.max.calendar.days=n._localizedDays,n.max.calendar.months=n._localizedMonths,n.max.calendar.locale=n.locale,null!==n.value&&(n._value.calendar.days=n._localizedDays,n._value.calendar.months=n._localizedMonths,n._value.calendar.locale=n.locale,n.value.calendar.days=n._localizedDays,n.value.calendar.months=n._localizedMonths,n.value.calendar.locale=n.locale),Smart.Utilities.DateTime.cache=[],n._applyFormatString();break;case"max":case"min":n._validateMinMax(e,t),"strict"===n.validation?n._validateValue():n._minMaxChanged=!0;break;case"nullable":!0===t&&null===n._value&&n._validateValue(n._now(),null);break;case"opened":a?n._open():n._close();break;case"readonly":case"unfocusable":a&&n.close(),"unfocusable"===e&&n._setFocusable();break;case"restrictedDates":n._validateRestrictedDates(),n._validateValue();break;case"spinButtonsPosition":"right"===a?n.$.content.insertBefore(n.$.spinButtonsContainer,n.$.input.nextElementSibling):n.$.content.insertBefore(n.$.spinButtonsContainer,n.$.input);break;case"validation":"strict"===a&&(delete n._minMaxChanged,n._validateValue());break;case"value":{let e;null!==a?(e=Smart.Utilities.DateTime.validateDate(a,n._now(),n.formatString),e=e.toTimeZone(n._outputTimeZone)):e=null,n._validateValue(e,n._value,void 0,!0);break}}}setDate(e){const t=this;let a;null!==e?(a=Smart.Utilities.DateTime.validateDate(e,t._now(),t.formatString),a=a.toTimeZone(t._outputTimeZone)):a=null,t._validateValue(a,t._value,void 0,!0)}getDate(){return this.value&&this.value.toDate?this.value.toDate():null}_addCalendarFooterListeners(){const e=this,t=e.$.calendarDropDown.$footer;t.listen("change",e._footerChangeHandler.bind(e)),t.listen("click",e._footerClickHandler.bind(e)),t.listen("wheel",e._footerWheelHandler.bind(e))}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const a=e.dataset.property,n=e.value;a&&void 0!==t[a]&&(t[a]=n)}}}_addTimePickerListener(){const e=this;e.$.timePickerDropDown.$.listen("change",(function(t){const a=e.context,n=t.detail.value,i=Smart.Utilities.DateTime.getConstructorParameters(null!==e._value?e._value:e._now());e.context=e,i[3]=n.getHours(),i[4]=n.getMinutes(),e._timePickerInitiatedChange=!0,i.unshift(null),e._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,i))),e._timePickerInitiatedChange=!1,e.context=a}))}_applyFormatString(){const e=this;null!==e.value&&(e.$.input.value=e._value.toString(e.formatString))}_calendarButtonClickHandler(e){const t=this;t._highlightedTimePart=void 0,t.disabled||t.readonly||(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t.$.calendarButton,e.pageX,e.pageY),t.opened?t._close():t._open())}_calendarDropDownChangeHandler(e){const t=this;if(e.stopPropagation(),t._disregardCalendarChangeEvent)t._disregardCalendarChangeEvent=!1;else if(this.$.calendarDropDown.selectedDates.length>0){const a=e.detail.value[0],n=null!==t._value?t._value:t._now(),i=Smart.Utilities.DateTime.getConstructorParameters(n);if(i[0]=a.getFullYear(),i[1]=a.getMonth()+1,i[2]=a.getDate(),t._calendarInitiatedChange=!0,i.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,i))),t._defaultFooterTemplateApplied){const e=t._value;""===t._hourElement.value&&(t._hourElement.value=e.toString("hh")),""===t._ampmElement.value&&(t._ampmElement.value=e.toString("tt")),""===t._minuteElement.value&&(t._minuteElement.value=e.toString("mm"))}t._calendarInitiatedChange=!1}else t._setNullValue()}_calendarDropDownClickHandler(e){const t=this;t.autoClose&&e.target.closest(".smart-calendar-cell")&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay))}_changeDropDownDisplayMode(){function e(e,a,n,i){t.$dropDownHeader[e]("smart-hidden"),t.$calendarDropDown[a]("smart-hidden"),t._timePickerInitialized&&t.$.timePickerDropDown.$[n]("smart-hidden"),i&&(t.opened?t.$.calendarDropDown._refreshTitle():t._toSync=!0)}const t=this,a=t._dropDownDisplayMode;t._detectDisplayMode(),t._dropDownDisplayMode!==a&&("default"===t._dropDownDisplayMode?(t.calendarMode="default",t.$.calendarDropDown.viewSections=["title","header"],t.$selectDate.addClass("smart-selected"),t.$selectTime.removeClass("smart-selected"),e("removeClass","removeClass","addClass",!0)):"classic"===t._dropDownDisplayMode?(t.calendarMode="classic",t.$.calendarDropDown.viewSections=["header","footer"],e("addClass","removeClass","addClass")):"calendar"===t._dropDownDisplayMode?(t.calendarMode="default",t.$.calendarDropDown.viewSections=["title","header"],e("addClass","removeClass","addClass",!0)):(t.calendarMode="default",e("addClass","addClass","removeClass"),t._timePickerInitialized||t._initializeTimePicker()),t.$.dropDownContainer.setAttribute("drop-down-display-mode",t.dropDownDisplayMode))}_cloneValue(){const e=this;return null!==e._value?e._value.clone():null}_close(){const e=this;if(e.$.fireEvent("closing").defaultPrevented)e.opened=!0;else{e.$.calendarDropDown.disabled=!0,e.$calendarButton.removeClass("smart-calendar-button-pressed"),e.$.calendarButton.removeAttribute("active"),e.$dropDownContainer.addClass("smart-visibility-hidden");const t=e.$.calendarDropDown.$.container.querySelector(".smart-calendar-cell[hover]");t&&t.removeAttribute("hover"),e.opened=!1,e._positionDetection.removeOverlay(!0),e.$.fireEvent("close"),e._edgeMacFF&&!e.hasAnimation&&(e.$.dropDownContainer.style.top=null,e.$.dropDownContainer.style.left=null,e.$dropDownContainer.addClass("not-in-view")),e.$.input.focus()}e.$.calendarButton.setAttribute("aria-expanded",e.opened)}_detectDisplayMode(){const e=this;"auto"!==e.dropDownDisplayMode?e._dropDownDisplayMode=e.dropDownDisplayMode:e._dropDownDisplayMode=Smart.Utilities.DateTime.detectDisplayMode(e.value||e.min,e.formatString,e._formatStringRegExp),"timePicker"===e._dropDownDisplayMode?(e.$calendarButton.addClass("time"),"Enter date"===e.placeholder&&(e.placeholder="Enter time")):(e.$calendarButton.removeClass("time"),"Enter time"===e.placeholder&&(e.placeholder="Enter date")),"default"===e._dropDownDisplayMode?e.$dropDownContent.removeClass("partial"):e.$dropDownContent.addClass("partial")}_disableSpinButtons(){const e=this;if(e.disabled)return;const t=null===e._value;e.$.upButton.disabled=t,e.$.downButton.disabled=t}_documentUpHandler(e){const t=this,a=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement,n=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;Smart.Utilities.Core.isMobile||a!==t.$.input||"partial"!==t.editMode||null===t._value||n===t.$.input&&t.$.input.selectionStart!==t.$.input.selectionEnd?n===t.$.calendarButton||t.$.dropDownContainer.contains(n)||t.$.dropDownContainer.contains(t._getRootShadowHost(n))||(t.close(),a===t.$.input||t.contains(n)||(t._highlightedTimePart=void 0)):(t._highlightedTimePartEdit=!1,t._validateValue(t.$.input.value,t._cloneValue(),!1),t._highlightTimePartBasedOnCursor()),t._mouseFocus=!1}_getRootShadowHost(e){const t=this;if(!t.shadowRoot&&!t.isInShadowDOM)return;let a,n=e.getRootNode().host;for(;n&&n!==t&&n!==document;)a=n,n=n.getRootNode().host;return a}_dropDownHeaderClickHandler(e){const t=this;if(e.target===t.$.selectDate){if(t.$selectDate.hasClass("smart-selected"))return;t.$selectDate.addClass("smart-selected"),t.$selectTime.removeClass("smart-selected"),t.$.timePickerDropDown.$.addClass("smart-hidden"),t.$calendarDropDown.removeClass("smart-hidden")}else{if(t.$selectTime.hasClass("smart-selected"))return;t.$selectDate.removeClass("smart-selected"),t.$selectTime.addClass("smart-selected"),t.$calendarDropDown.addClass("smart-hidden"),t._timePickerInitialized?t.$.timePickerDropDown.$.removeClass("smart-hidden"):t._initializeTimePicker()}}_dropDownKeydownHandler(e){const t=this,a=e.key,n=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;!t.$.dropDownHeader.contains(n)||"Enter"!==a&&" "!==a?"Escape"===a||e.altKey&&"ArrowUp"===a?(e.preventDefault(),t.close(),t.$.input.focus()):"Enter"!==a&&" "!==a||!n.classList.contains("smart-footer-component-today")?"Enter"===a&&(n===t.$.calendarDropDown.$.body&&t.$.calendarDropDown.querySelectorAll(".smart-calendar-cell[selected][focus]").length>0||t._timePickerInitialized&&n===t.$.timePickerDropDown.$.picker)&&(e.preventDefault(),t.close()):(e.preventDefault(),t._validateValue(t._now()),t.close()):(e.preventDefault(),t._dropDownHeaderClickHandler({target:n}))}_dropDownTransitionendHandler(){const e=this;if(e.hasAnimation)return e.opened&&e._toFocus?(e._toFocus.focus(),delete e._toFocus,void(e._timePickerInitialized&&!e.$.timePickerDropDown.classList.contains("smart-hidden")&&requestAnimationFrame((()=>e.$.timePickerDropDown._highlightLabel())))):e._edgeMacFF&&!e.opened?(e.$.dropDownContainer.style.top=null,e.$.dropDownContainer.style.left=null,void e.$dropDownContainer.addClass("not-in-view")):void 0}_footerChangeHandler(e){const t=this,a=t.context,n=e.target,i=null!==t._value?t._value:t._now();let o,l=n.value;if(t.context=t,e.stopPropagation(),n.classList.contains("smart-hour-element")){if(l=parseInt(l,10),isNaN(l)||l<0||l>12)return void(n.value=i.toString("hh"));l>0&&l<12&&"PM"===i.toString("tt")&&(l+=12),o="hh"}else{if(!n.classList.contains("smart-minute-element")){if(null===t._value)return void(n.value="");const e=i.toString("tt");return l=l.toLowerCase(),void("PM"===e&&("a"===l||"am"===l)||"AM"===e&&("p"===l||"pm"===l)?(t._incrementDecrement(void 0,"tt"),n.value=t._value.toString("tt")):n.value=e)}if(l=parseInt(l,10),isNaN(l)||l<0||l>59)return void(n.value=i.toString("mm"));o="mm"}const r=Smart.Utilities.DateTime.getConstructorParameters(i);r[t._codeToIndex[o]]=l,r.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,r))),n.value=t._value.toString(o),t.context=a}_footerClickHandler(e){const t=this,a=t.context,n=e.target;if(t.context=t,n.classList.contains("smart-today-element"))t._validateValue(t._now()),t.autoClose&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay));else{const e=n.closest("smart-repeat-button");if(null!==e){const a=e===e.parentElement.children[1],n=e.closest(".smart-footer-component").classList.contains("smart-footer-component-hour")?"hh":"mm";t._incrementDecrement(a,n)}}t.context=a}_footerWheelHandler(e){const t=this,a=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;if(t.enableMouseWheelAction&&e.target instanceof HTMLInputElement&&a===e.target){const a=t.context,n=e.target;t.context=t,n.classList.contains("smart-hour-element")?t._incrementDecrement(e.deltaY>0,"hh"):n.classList.contains("smart-minute-element")?t._incrementDecrement(e.deltaY>0,"mm"):t._incrementDecrement(void 0,"tt"),t.context=a,e.stopPropagation()}}_getAndHighlightTimePart(e,t,a){const n=this;n._programmaticSelection=!0,n.$.input.selectionStart!==e||n.$.input.selectionEnd!==t?n.$.input.setSelectionRange(e,t):setTimeout((function(){n.$.input.setSelectionRange(e,t)}),200),n._highlightedTimePart={code:n._formatStringRegExp.groups[a],index:a,from:e,to:t}}_getFormatStringRegExp(){const e=this;e._formatStringRegExp=e.min.getParseRegExp(e.min.calendar,e.formatString.replace(/y+/g,"yyyyy")),e._formatStringRegExp.regExp=new RegExp(e._formatStringRegExp.regExp)}_getLocalizedNames(){const e=this,t=Smart.Utilities.DateTime.getLocalizedNames(e.locale);e._localizedDays=t.days,e._localizedMonths=t.months,e.$.selectDate.innerHTML=e.localize("dateTabLabel"),e.$.selectTime.innerHTML=e.localize("timeTabLabel")}_handleManualTimePartEdit(e){const t=this,a=Smart.Utilities.DateTime.getConstructorParameters(t._value);if(e=e[t._highlightedTimePart.index+1],isNaN(e)){if(1===t._codeToIndex[t._highlightedTimePart.code]){let n=-1;if(e.length>1&&t._localizedMonths.names.some((function(t,a){if(-1!==t.toLowerCase().indexOf(e.toLowerCase()))return n=a,!0})),-1===n)return void t._applyFormatString();a[1]=n+1}}else{if("f"===t._highlightedTimePart.code)e=100*parseInt(e,10);else if("ff"===t._highlightedTimePart.code)e=10*parseInt(e,10);else if(-1!==t._highlightedTimePart.code.indexOf("y")&&e.length<3){const a=t.yearCutoff.toString(),n=parseInt(a.slice(2),10);let i=parseInt(a.slice(0,2),10);(e=parseInt(e,10))<n&&i++,e=e.toString(),e=i+""+"0".repeat(2-e.length)+e}else if(-1!==t._highlightedTimePart.code.indexOf("h")){const a=t._value.hour();e=parseInt(e,10),a>11&&e<=11&&(e+=12)}a[t._codeToIndex[t._highlightedTimePart.code]]=parseInt(e,10)}try{a.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,a)))}catch(e){t._applyFormatString()}}_highlightTimePartBasedOnCursor(e){const t=this,a=t.$.input.value,n=t._formatStringRegExp.regExp.exec(a);function i(){return void 0===e?t.$.input.selectionStart:e}if(null===n)return void(t._highlightedTimePart=void 0);t._iOS||void 0!==e||(e=t.$.input.selectionStart);let o,l=n.index;for(let e=1;e<n.length;e++){const r=n[e];if(o=a.indexOf(r,l),l=o+r.length,1===e&&i()<o){t._getAndHighlightTimePart(o,l,0);break}if(i()>=o&&i()<=l){t._getAndHighlightTimePart(o,l,e-1);break}const s=n[e+1];if(!s){t._programmaticSelection=!0,t.$.input.setSelectionRange(o,l),t._highlightedTimePart={code:t._formatStringRegExp.groups[e-1],index:e-1,from:o,to:l};break}{const n=a.indexOf(s,l);if(i()>l&&i()<n){i()-l<=n-i()?t._getAndHighlightTimePart(o,l,e-1):(t._formatStringRegExp.groups[e],t._programmaticSelection=!0,t.$.input.setSelectionRange(n,n+s.length));break}}}}_highlightTimePartBasedOnIndex(e){const t=this,a=t.$.input.value,n=t._formatStringRegExp.regExp.exec(a);if(null===n)return t._validateValue(void 0,t._cloneValue(),!1),void t._highlightTimePartBasedOnIndex(e);let i,o=n.index;const l=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;if(!(e<0||e>=n.length)){t.$.input!==l&&t.$.input.focus();for(let l=1;l<n.length;l++){const r=n[l];if(i=a.indexOf(r,o),o=i+r.length,e===l-1){t._getAndHighlightTimePart(i,o,e);break}}}}_incrementDecrement(e,t){const a=this,n=a._cloneValue();if(a._minMaxChanged&&(a._value=a._rangeValidation(a._value),delete a._minMaxChanged),void 0===t&&a._highlightedTimePart&&(t=a._highlightedTimePart.code),void 0!==t){if("z"===t||"zz"===t||"zzz"===t)return void a._highlightTimePartBasedOnIndex(a._highlightedTimePart.index);a._value="t"===t||"tt"===t?a._value.addHours(a._value.hour()<12?12:-12,!0):a._value[a._codeToMethod[t]](e?-1:1,!0),a._validateValue(void 0,n,!1),a._highlightedTimePart&&a._highlightTimePartBasedOnIndex(a._highlightedTimePart.index)}else a._value=a._value.add(e?a.interval.negate():a.interval,void 0,!0),a._validateValue(void 0,n,!1);0!==n.compare(a._value)&&a.isInitialized&&(a.$.fireEvent("change",{oldValue:n.toTimeZone(a._inputTimeZone),value:a.value}),a._updateTargetValue())}_initializeTimePicker(){const e=this,t=document.createElement("smart-time-picker");t.rightToLeft=e.rightToLeft,t.animation=e.animation,t.autoSwitchToMinutes=e.autoSwitchToMinutes,t.format=e._formatStringRegExp.groups.find((e=>-1!==e.indexOf("H")))?"24-hour":"12-hour",t.theme=e.theme,t.value=null!==e._value?e._value.toDate():e._now(),e.$.timePickerDropDown=t,t.$=Smart.Utilities.Extend(t),e.$.dropDownContent.appendChild(t),e._timePickerInitialized=!0,e._addTimePickerListener()}_inputBlurHandler(){const e=this;e.removeAttribute("focus"),e._fullEdit=!1,e._highlightedTimePartEdit=!1,e.$.fireEvent("blur")}_inputChangeHandler(e){const t=this;if(e&&e.stopPropagation(),""!==t.$.input.value){if(t._fullEdit||null===t._value)t._fullEdit=!1,t._validateValue(t.$.input.value),t._highlightTimePartBasedOnCursor();else if(t._highlightedTimePartEdit){t._highlightedTimePartEdit=!1;let e=t._formatStringRegExp.regExp.exec(t.$.input.value);null!==e?t._handleManualTimePartEdit(e):t._applyFormatString()}}else t._setNullValue()}_inputDragstartHandler(e){e.preventDefault()}_inputFocusHandler(){const e=this;if(e.setAttribute("focus",""),"full"!==e.editMode){const t=Smart.Utilities.Core.isMobile?10:0;setTimeout((function(){e._iOS?e._highlightTimePartBasedOnCursor():!0!==e._mouseFocus&&(void 0===e._highlightedTimePart?e._highlightTimePartBasedOnCursor(e._iOS?void 0:0):e._highlightTimePartBasedOnIndex(e._highlightedTimePart.index))}),t)}e.$.fireEvent("focus")}_inputKeydownHandler(e){const t=this,a=t.editMode,n=e.key;if("Tab"!==n){if(e.altKey&&"ArrowDown"===n)return e.preventDefault(),void t.open();if("Escape"===n||e.altKey&&"ArrowUp"===n)return e.preventDefault(),void t.close();if("full"!==a){if("partial"===a){if("Delete"===n)return void(null!==t._value&&(t._setNullValue(),e.preventDefault()));if(null===t._value&&(t._validateValue(t._now(),null,!1),t._highlightTimePartBasedOnIndex(0)),-1!==["/",".","-",","," "].indexOf(n))return t._inputChangeHandler(),t._navigateToNextTimePart(),void e.preventDefault();if("Backspace"===n)return t._resetTimePart(),t._highlightedTimePart.index>0?t._navigateToPreviousTimePart():t._highlightTimePartBasedOnIndex(0),void e.preventDefault()}else if(t._fullEdit||t._highlightedTimePartEdit||t.readonly||-1!==["Alt","Control","Shift"].indexOf(n)||e.altKey||e.ctrlKey)return;if(-1!==["End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].indexOf(n)){if(e.preventDefault(),"partial"===a&&t._highlightedTimePartEdit&&t._inputChangeHandler(),null!==t._value)switch(n){case"End":t._highlightTimePartBasedOnIndex(t._formatStringRegExp.groups.length-1);break;case"Home":t._highlightTimePartBasedOnIndex(0);break;case"ArrowLeft":t._navigateToPreviousTimePart();break;case"ArrowUp":t._incrementDecrement();break;case"ArrowRight":t._navigateToNextTimePart();break;case"ArrowDown":t._incrementDecrement(!0)}}else if(t._highlightedTimePart){if("partial"!==a&&t._highlightedTimePart.to-t._highlightedTimePart.from!=t.$.input.selectionEnd-t.$.input.selectionStart)return void(t._fullEdit=!0);const i=t._highlightedTimePart.code;if("ddd"===i||"dddd"===i||"z"===i||"zz"===i||"zzz"===i||"t"===i||"tt"===i)return void e.preventDefault();if("partial"===a&&"MMM"!==i&&"MMMM"!==i&&!1===new RegExp(/^\d+$/).test(n))return void((n.length<2||"F"!==n.charAt(0))&&e.preventDefault());t._highlightedTimePartEdit=!0}}else t._fullEdit=!0}}_inputDownHandler(){const e=this;e._fullEdit||e._highlightedTimePartEdit||"full"===e.editMode||Smart.Utilities.Core.isMobile||setTimeout((function(){e._mouseFocus=!0,e._highlightTimePartBasedOnCursor()}),0)}_inputPasteHandler(e){"partial"===this.editMode?e.preventDefault():this._fullEdit=!0}_inputSelectHandler(){const e=this,t=e.shadowRoot?e.shadowRoot.activeElement:document.activeElement;"partial"===e.editMode&&t===e.$.input&&(!0===e._programmaticSelection?e._programmaticSelection=!1:e._highlightedTimePart?e._highlightTimePartBasedOnIndex(e._highlightedTimePart.index):e._highlightTimePartBasedOnIndex(0))}_inputUpHandler(){const e=this;Smart.Utilities.Core.isMobile&&(e._iOS?(e._mouseFocus=!0,setTimeout((function(){document.activeElement===e.$.input&&e._highlightTimePartBasedOnCursor()}),50)):setTimeout((function(){e._mouseFocus=!0,e._highlightTimePartBasedOnCursor()}),10))}_inputWheelHandler(e){const t=this;(t.shadowRoot?t.shadowRoot.activeElement:document.activeElement)!==t.$.input||!t.enableMouseWheelAction||t.disabled||t.readonly||(e.preventDefault(),t._incrementDecrement(e.deltaY>0))}_isRestricted(e){const t=this.restrictedDates;let a=!1;for(let n=0;n<t.length;n++)if(e.equalDateParts(t[n])){a=!0;break}return a}_mouseoutHandler(e){const t=this,a=e.target;t.disabled||a!==t.$.input&&a!==t.$.calendarButton||(a.removeAttribute("hover"),t.removeAttribute("hover"))}_mouseoverHandler(e){const t=this,a=e.target;t.disabled||a!==t.$.input&&a!==t.$.calendarButton||(a.setAttribute("hover",""),t.setAttribute("hover",""))}_navigateToNextTimePart(){this._highlightTimePartBasedOnIndex(this._highlightedTimePart.index+1)}_navigateToPreviousTimePart(){this._highlightTimePartBasedOnIndex(this._highlightedTimePart.index-1)}_now(){const e=this,t=new Smart.Utilities.DateTime("today","Local");return"Local"!==e._outputTimeZone?t.toTimeZone(e._outputTimeZone):t}_open(e){const t=this;if(t.disabled||t.readonly)return t.opened=!1,void t.$.calendarButton.setAttribute("aria-expanded",!1);if(t.$.fireEvent("opening").defaultPrevented)return t.opened=!1,void t.$.calendarButton.setAttribute("aria-expanded",!1);t._edgeMacFF&&t.$dropDownContainer.removeClass("not-in-view");const a=t.$.dropDownContainer;a.style.marginLeft=null,e||(a.style.transition=""),t.$.calendarDropDown.disabled=!1,t.$calendarButton.addClass("smart-calendar-button-pressed"),t.$.calendarButton.setAttribute("active",""),("default"!==t._dropDownDisplayMode&&"timePicker"!==t._dropDownDisplayMode||!t._timePickerInitialized||t._timePickerInitialized&&t.$.timePickerDropDown.$.hasClass("smart-hidden"))&&t.$calendarDropDown.removeClass("smart-hidden"),t.opened=!0,t.$.calendarButton.setAttribute("aria-expanded",!0),t._positionDetection.placeOverlay(),t._positionDetection.checkBrowserBounds("vertically"),t._positionDetection.positionDropDown(),t.$dropDownContainer.removeClass("smart-visibility-hidden");const n=1===window.devicePixelRatio?document.documentElement.clientWidth:window.innerWidth,i=a.getBoundingClientRect();if(i.left<0?a.style.marginLeft=-1*i.left+"px":i.right>n&&(a.style.marginLeft=n-i.right+"px"),t.$.fireEvent("open"),t._toSync){const e=t._value;if(null!==e)t._disregardCalendarChangeEvent=!0,t.$.calendarDropDown.selectedDates=[e.toDate()],t._defaultFooterTemplateApplied&&(t._hourElement.value=e.toString("hh"),t._minuteElement.value=e.toString("mm"),t._ampmElement.value=e.toString("tt")),t._timePickerInitialized&&(t.$.timePickerDropDown.value=e.toDate()),t._disregardCalendarChangeEvent=!1;else{const e=t.$.calendarDropDown.context;t.$.calendarDropDown.context=t.$.calendarDropDown,t.$.calendarDropDown._clearSelection(!0),t.$.calendarDropDown.context=e,t._defaultFooterTemplateApplied&&(t._hourElement.value="",t._minuteElement.value="",t._ampmElement.value="")}t._toSync=!1}let o;switch(t._dropDownDisplayMode){case"default":o=t.$selectDate.hasClass("smart-selected")?t.$.calendarDropDown:t.$.timePickerDropDown.$.picker;break;case"classic":case"calendar":o=t.$.calendarDropDown;break;case"timePicker":o=t.$.timePickerDropDown.$.picker}t.hasAnimation?(t._toFocus=o,function e(){t._toFocus&&(0===t.$.dropDownContainer.getBoundingClientRect().height?requestAnimationFrame(e):t._dropDownTransitionendHandler())}()):o.focus()}_positionExternalDropDown(e){const t=this.context,a=!t.calendarButton||"right"===t.calendarButtonPosition,n=t._dropDownListPosition,i=t.$.dropDownContainer;let o,l=a?e.right-i.offsetWidth:e.left;switch(n){case"bottom":o=e.bottom;break;case"overlay-top":o=e.bottom-i.offsetHeight;break;case"overlay-center":o=e.top+e.height/2-i.offsetHeight/2;break;case"overlay-bottom":o=e.top;break;case"top":o=e.top-i.offsetHeight;break;case"center-bottom":case"center-top":o="center-bottom"===n?e.bottom+5:e.top-5-i.offsetHeight,l=a?e.right-i.offsetWidth/2-t.$.calendarButton.offsetWidth/2:e.left-i.offsetWidth/2+t.$.calendarButton.offsetWidth/2}return{left:l,top:o}}_rangeValidation(e){const t=this;return-1===e.compare(t.min)?t.min.clone():1===e.compare(t.max)?t.max.clone():e}_resetTimePart(){const e=this,t=e._highlightedTimePart.code,a=e._codeToIndex[t],n=Smart.Utilities.DateTime.getConstructorParameters(e._value);let i;i=a>2?0:a>0?1:e.min.year(),n[a]=i,n.unshift(null),e._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,n)))}_setIds(){const e=this;e.$.label.id||(e.$.label.id=e.id+"Label"),e.$.input.id||(e.$.input.id=e.id+"Input"),e.$.calendarButton.id||(e.$.calendarButton.id=e.id+"CalendarButton"),e.$.dropDownContainer.id||(e.$.dropDownContainer.id=e.id+"DropDownContainer"),e.$.hint.id||(e.$.hint.id=e.id+"Hint")}_setDefaultFooterTemplate(e){const t=this;t.$.calendarDropDown.footerTemplate=t._defaultFooterTemplate,e&&t.$.calendarDropDown._handleLayoutTemplate(t.$.calendarDropDown.$.footer,t._defaultFooterTemplate),t._hourElement=t.$.calendarDropDown.getElementsByClassName("smart-hour-element")[0],t._minuteElement=t.$.calendarDropDown.getElementsByClassName("smart-minute-element")[0],t._ampmElement=t.$.calendarDropDown.getElementsByClassName("smart-am-pm-element")[0],t._todayElement=t.$.calendarDropDown.getElementsByClassName("smart-today-element")[0],t._todayElement.title=t.localize("now"),Array.from(t.$.calendarDropDown.$.footer.getElementsByTagName("smart-repeat-button")).forEach((function(e){e.animation=t.animation})),t._addCalendarFooterListeners(),t._defaultFooterTemplateApplied=!0}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.$.input.tabIndex=-1,e.$.selectDate.removeAttribute("tabindex"),e.$.selectTime.removeAttribute("tabindex"),void(e._defaultFooterTemplateApplied&&(e._hourElement.tabIndex=-1,e._ampmElement.tabIndex=-1,e._minuteElement.tabIndex=-1));const t=e.tabIndex>0?e.tabIndex:0;e.$.input.removeAttribute("tabindex"),e.$.selectDate.tabIndex=t,e.$.selectTime.tabIndex=t,e._defaultFooterTemplateApplied&&(e._hourElement.removeAttribute("tabindex"),e._ampmElement.removeAttribute("tabindex"),e._minuteElement.removeAttribute("tabindex"),e.$.calendarDropDown.getElementsByClassName("smart-footer-component-today")[0].tabIndex=t)}_setNullValue(e){const t=this;if(void 0===e&&(e=t._cloneValue()),t.nullable){if(t._value=null,t.value=null,t._highlightedTimePart=void 0,t.$.input.value="",null!==e){if(t.opened){if(!t._calendarInitiatedChange){const e=t.$.calendarDropDown.context;t.$.calendarDropDown.context=t.$.calendarDropDown,t.$.calendarDropDown._clearSelection(!0),t.$.calendarDropDown.context=e}t._defaultFooterTemplateApplied&&(t._hourElement.value="",t._ampmElement.value="",t._minuteElement.value=""),t._toSync=!1}else t._toSync=!0;t.isInitialized&&(t.$.fireEvent("change",{oldValue:e.toTimeZone(t._inputTimeZone),value:null}),t._updateTargetValue())}t._disableSpinButtons()}else t._validateValue(t._now(),e)}_spinButtonsClickHandler(e){const t=this;null===t._value||t.disabled||t.readonly||t._incrementDecrement(t.$.downButton.contains(e.target))}_validateInitialPropertyValues(){const e=this,t=e.$.calendarDropDown;"left"===e.calendarButtonPosition&&e.$.content.insertBefore(e.$.calendarButton,e.$.input),"left"===e.spinButtonsPosition&&e.$.content.insertBefore(e.$.spinButtonsContainer,e.$.input),e.disabled&&(e.$.upButton.disabled=!0,e.$.downButton.disabled=!0),e.opened&&(e.disabled||e.readonly?e.opened=!1:(e.$.dropDownContainer.style.transition="none",e._open(!0))),e.$.calendarButton.setAttribute("aria-expanded",e.opened),null===e.footerTemplate?e._setDefaultFooterTemplate(!0):(t.footerTemplate=e.footerTemplate,t._handleLayoutTemplate(t.$.footer,e.footerTemplate)),""===e.formatString&&(e.formatString="dd-MMM-yy HH:mm:ss.fff");const a=e.displayKind;let n;if("UTC"===a?e._outputTimeZone="UTC":"local"===a&&(e._outputTimeZone="Local"),null!==e.value?(n=Smart.Utilities.DateTime.validateDate(e.value,new Smart.Utilities.DateTime,e.formatString),e._inputTimeZone=n.timeZone,"unspecified"!==a&&e._inputTimeZone!==e._outputTimeZone?n=n.toTimeZone(e._outputTimeZone):"unspecified"===a&&(e._outputTimeZone=e._inputTimeZone)):(n=null,e._inputTimeZone="Local"),e._validateRestrictedDates(),e._validateMinMax("both"),e._validateValue(n,e._now(),!1,!0),e._validateInterval(new Smart.Utilities.TimeSpan(0,0,1)),e._getFormatStringRegExp(),e._defaultFooterTemplateApplied&&""===e._hourElement.value&&null!==e.value){const t=e.value;e._hourElement.value=t.toString("hh"),e._ampmElement.value=t.toString("tt"),e._minuteElement.value=t.toString("mm")}e._detectDisplayMode();const i=e._dropDownDisplayMode;"default"===i||"calendar"===i?(t.viewSections=["title","header"],t.$title.hasClass("smart-hidden")&&t.propertyChangedHandler("viewSections",["header","footer"],["title","header"]),"default"===i&&e.$dropDownHeader.removeClass("smart-hidden")):"timePicker"===i&&(e.$calendarDropDown.addClass("smart-hidden"),e._initializeTimePicker()),e.footer&&e._handleFooter()}_validateInterval(e){const t=this,a=t.interval;let n=a;if(a instanceof Smart.Utilities.TimeSpan)n=a;else if("string"==typeof a){const i=a.indexOf("TimeSpan("),o=a.indexOf(")");if(-1!==i&&-1!==o&&(n=a.slice(i+9,o),n=n.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),new RegExp(/(^(\d+)(,\s*\d+)*$)/g).test(n)&&(n=n.replace(/\s/g,""),n=n.split(","),n.map((function(e,t){n[t]=parseInt(e)})),n.unshift(null),n=new(Function.prototype.bind.apply(Smart.Utilities.TimeSpan,n)))),n instanceof Smart.Utilities.TimeSpan==0){if(""===n.trim())return void(t.interval=e);isNaN(n)||(n=1e4*parseInt(n,10));try{n=new Smart.Utilities.TimeSpan(n)}catch(a){return void(t.interval=e)}}}else{if("number"!=typeof a)return void(t.interval=e);n=new Smart.Utilities.TimeSpan(a)}0===n._ticks?t.interval=e:t.interval=n}_validateMinMax(e,t){const a=this;let n=!1;"max"!==e&&(a.min=Smart.Utilities.DateTime.validateDate(a.min,t||new Smart.Utilities.DateTime(1600,1,1),a.formatString),a.min=a.min.toTimeZone(a._outputTimeZone),n=!0),"min"!==e&&(a.max=Smart.Utilities.DateTime.validateDate(a.max,t||new Smart.Utilities.DateTime(3001,1,1),a.formatString),a.max=a.max.toTimeZone(a._outputTimeZone),a.max.calendar.days=a._localizedDays,a.max.calendar.months=a._localizedMonths,a.max.calendar.locale=a.locale,a.$.calendarDropDown.max=a.max.toDate()),a.min.compare(a.max)>0&&(a.min=a.max.clone(),n=!0),n&&(a.min.calendar.days=a._localizedDays,a.min.calendar.months=a._localizedMonths,a.min.calendar.locale=a.locale,a.$.calendarDropDown.min=a.min.toDate())}_validateRestrictedDates(){const e=this,t=[],a=[];for(let n=0;n<e.restrictedDates.length;n++){const i=e.restrictedDates[n];let o=Smart.Utilities.DateTime.validateDate(i,"invalid",e.formatString);"invalid"!==o&&(o=o.toTimeZone(e._outputTimeZone),t.push(o),a.push(o.toDate()))}e.restrictedDates=t,e.$.calendarDropDown.restrictedDates=a}_validateValue(e,t,a,n){const i=this,o=void 0!==t?t:i._cloneValue();if(null===e||""===e)return void i._setNullValue(o);if(e&&"string"==typeof e)if(-1===e.indexOf("-")&&-1===e.indexOf("/")&&-1===e.indexOf(".")){if(i.formatString){let t="",a=0;for(let n=0;n<i.formatString.length;n++)"-"===i.formatString[n]||"/"===i.formatString[n]||"."===i.formatString[n]?t+=i.formatString[n]:e[a]?(t+=e[a],a++):t+=i.formatString[n];if(t.indexOf("y")>=0){let e=t.substring(t.indexOf("y")-2);const a=i.yearCutoff.toString(),n=parseInt(a.slice(2),10);let o=parseInt(a.slice(0,2),10);e=parseInt(e,10),e<n&&o++,e=e.toString(),"NaN"!==e?(e=o+""+"0".repeat(2-e.length)+e,t=t.substring(0,t.indexOf("y")-2)+e):t=null}e=t}}else{let t=e.indexOf("-")>=0?"-":"";if(""===t&&(t=e.indexOf("/")>=0?"/":""),""===t&&(t=e.indexOf(".")>=0?".":""),t&&i.formatString.indexOf("yyyy")>=0){const a=e.split(t);let n=a[a.length-1];if(n.length<4){const o=i.yearCutoff.toString(),l=parseInt(o.slice(2),10);let r=parseInt(o.slice(0,2),10);n=parseInt(n,10),n<l&&r++,n=n.toString(),n=r+""+"0".repeat(2-n.length)+n,a[a.length-1]=n,e=a.join(t)}}}if(void 0!==e&&(i._value=Smart.Utilities.DateTime.validateDate(e,o,i.formatString)),null===i._value)return void i._setNullValue(o);let l=i._value;for(;!0===i._isRestricted(l);)l.addDays(1,!1);const r=i._rangeValidation(l);n&&"strict"!==i.validation?!1===l.equals(r)&&(i._minMaxChanged=!0):(i._value=r,delete i._minMaxChanged),i.value=i._value.toTimeZone(i._inputTimeZone);const s=i._value;if(s.calendar.days=i._localizedDays,s.calendar.months=i._localizedMonths,s.calendar.locale=i.locale,i._applyFormatString(),i._disableSpinButtons(),(null===o||null===s)&&o!==s||null!==o&&null!==s&&0!==o.compare(s)){if(!1!==a&&i.isInitialized&&!n&&(i.$.fireEvent("change",{oldValue:null!==o?o.toTimeZone(i._inputTimeZone):null,value:i.value}),i._updateTargetValue()),i._calendarInitiatedChange)return;i.opened?(null!==o&&0!==i.$.calendarDropDown.selectedDates.length&&o.year()===s.year()&&o.month()===s.month()&&o.day()===s.day()&&i.$.calendarDropDown._isDateInView(s.toDate())||(i._disregardCalendarChangeEvent=!0,i.$.calendarDropDown.selectedDates=[s.toDate()]),i._defaultFooterTemplateApplied&&(null!==o&&o.hour()===s.hour()||(i._hourElement.value=s.toString("hh"),i._ampmElement.value=s.toString("tt")),null!==o&&o.minute()===s.minute()||(i._minuteElement.value=s.toString("mm"))),i._timePickerInitialized&&!i._timePickerInitiatedChange&&(i.$.timePickerDropDown.value=s.toDate()),i._toSync=!1):i._toSync=!0}}});
69
+ Smart("smart-date-time-picker",class extends Smart.BaseElement{static get properties(){return{animationSettings:{value:null,type:"object"},autoClose:{value:!1,type:"boolean"},autoCloseDelay:{value:0,type:"number"},autoSwitchToMinutes:{value:!1,type:"boolean"},calendarButton:{value:!1,type:"boolean"},calendarButtonPosition:{value:"right",allowedValues:["left","right"],type:"string"},calendarMode:{value:"default",allowedValues:["default","classic"],type:"string"},dayNameFormat:{value:"firstTwoLetters",allowedValues:["narrow","firstTwoLetters","long","short"],type:"string"},disableAutoNavigation:{value:!1,type:"boolean"},displayKind:{value:"unspecified",allowedValues:["UTC","local","unspecified"],type:"string"},displayModeView:{value:"table",allowedValues:["table","list"],type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownDisplayMode:{value:"default",allowedValues:["default","classic","calendar","timePicker","auto"],type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["auto","bottom","overlay-top","overlay-center","overlay-bottom","top","center-bottom","center-top"],type:"string"},editMode:{value:"default",allowedValues:["default","full","partial"],type:"string"},enableMouseWheelAction:{value:!1,type:"boolean"},firstDayOfWeek:{value:0,type:"number"},footerTemplate:{value:null,type:"any"},footer:{value:!1,type:"boolean"},formatString:{value:"dd-MMM-yy HH:mm:ss.fff",type:"string"},headerTemplate:{value:null,type:"any"},hideDayNames:{value:!1,type:"boolean"},hideOtherMonthDays:{value:!1,type:"boolean"},hideTooltipArrow:{value:!1,type:"boolean"},hint:{value:"",type:"string"},importantDates:{value:[],type:"array"},importantDatesTemplate:{value:null,type:"any"},interval:{value:new Smart.Utilities.TimeSpan(0,0,1),type:"any"},label:{value:"",type:"string"},max:{value:new Smart.Utilities.DateTime(3001,1,1),type:"any"},messages:{value:{en:{now:"Now",dateTabLabel:"DATE",timeTabLabel:"TIME"}},type:"object",extend:!0},min:{value:new Smart.Utilities.DateTime(1600,1,1),type:"any"},name:{value:"",type:"string"},nullable:{value:!1,type:"boolean"},opened:{value:!1,type:"boolean"},placeholder:{value:"Enter date",type:"string"},restrictedDates:{value:[],type:"array"},spinButtons:{value:!1,type:"boolean"},spinButtonsDelay:{value:75,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},spinButtonsPosition:{value:"right",allowedValues:["left","right"],type:"string"},tooltip:{value:!1,type:"boolean"},tooltipDelay:{value:100,type:"number"},tooltipPosition:{value:"top",allowedValues:["bottom","top","left","right","absolute"],type:"string"},tooltipTemplate:{value:null,type:"any"},validation:{value:"strict",allowedValues:["strict","interaction"],type:"string"},value:{defaultReflectToAttribute:!0,value:new Smart.Utilities.DateTime,type:"any"},weekNumbers:{value:!1,type:"boolean"},weeks:{value:6,type:"number"},yearCutoff:{value:1926,type:"number"}}}static get listeners(){return{"container.mouseout":"_mouseoutHandler","container.mouseover":"_mouseoverHandler","calendarButton.click":"_calendarButtonClickHandler","calendarDropDown.change":"_calendarDropDownChangeHandler","calendarDropDown.click":"_calendarDropDownClickHandler","downButton.click":"_spinButtonsClickHandler","input.blur":"_inputBlurHandler","input.change":"_inputChangeHandler","input.dragstart":"_inputDragstartHandler","input.focus":"_inputFocusHandler","input.keydown":"_inputKeydownHandler","input.down":"_inputDownHandler","input.paste":"_inputPasteHandler","input.select":"_inputSelectHandler","input.up":"_inputUpHandler","input.wheel":"_inputWheelHandler","dropDownContainer.keydown":"_dropDownKeydownHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","dropDownHeader.click":"_dropDownHeaderClickHandler","upButton.click":"_spinButtonsClickHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.Utilities.DateTime":"smart.date.js","Smart.Utilities.Draw":"smart.draw.js","Smart.Utilities.BigNumber":"smart.math.js","Smart.Utilities.NumericProcessor":"smart.numeric.js","Smart.RepeatButton":"smart.button.js","Smart.Calendar":"smart.calendar.js","Smart.TimePicker":"smart.timepicker.js"}}static get styleUrls(){return["smart.datetimepicker.css"]}template(){return'<div id="container" role="presentation">\n <span id="label" class="smart-label">[[label]]</span>\n <div id="content" class="smart-content">\n <input id="input" class="smart-input smart-date-time-input" type="text" readonly="[[readonly]]" disabled="[[disabled]]" placeholder="[[placeholder]]" name="[[name]]" aria-label="[[placeholder]]" />\n <div id="spinButtonsContainer" class="smart-spin-buttons-container" role="presentation">\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" animation="[[animation]]" delay="[[spinButtonsDelay]]" readonly="[[readonly]]" unfocusable id="upButton" right-to-left="[[rightToLeft]]" class="smart-spin-button" aria-label="Increment">\n <div class="smart-arrow smart-arrow-up" aria-hidden="true"></div>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" animation="[[animation]]" delay="[[spinButtonsDelay]]" readonly="[[readonly]]" unfocusable id="downButton" right-to-left="[[rightToLeft]]" class="smart-spin-button" aria-label="Decrement">\n <div class="smart-arrow smart-arrow-down" aria-hidden="true"></div>\n </smart-repeat-button>\n </div>\n <div id="calendarButton" class="smart-drop-down-button smart-calendar-button" role="button" aria-haspopup="dialog" aria-label="Toggle popup"></div>\n <div id="dropDownContainer" class="smart-drop-down smart-date-time-drop-down smart-drop-down-container smart-visibility-hidden" role="dialog">\n <div id="dropDownHeader" class="smart-drop-down-header smart-hidden" role="heading" aria-level="1">\n <div id="selectDate" class="smart-selected" role="button"></div>\n <div id="selectTime" role="button"></div>\n </div>\n <div id="dropDownContent" class="smart-drop-down-content" role="presentation">\n <smart-calendar id="calendarDropDown" class="smart-hidden"\n animation="[[animation]]"\n animation-settings="[[animationSettings]]"\n calendar-mode="[[calendarMode]]"\n day-name-format="[[dayNameFormat]]"\n disable-auto-navigation="[[disableAutoNavigation]]"\n display-mode-view="[[displayModeView]]"\n first-day-of-week="[[firstDayOfWeek]]"\n header-template="[[headerTemplate]]"\n hide-day-names="[[hideDayNames]]"\n hide-other-month-days="[[hideOtherMonthDays]]"\n hide-tooltip-arrow="[[hideTooltipArrow]]"\n important-dates="[[importantDates]]"\n important-dates-template="[[importantDatesTemplate]]"\n locale="[[locale]]"\n right-to-left="[[rightToLeft]]"\n selection-mode="one"\n spin-buttons-delay="[[spinButtonsDelay]]"\n spin-buttons-initial-delay="[[spinButtonsInitialDelay]]"\n theme="[[theme]]"\n tooltip="[[tooltip]]"\n tooltip-delay="[[tooltipDelay]]"\n tooltip-position="[[tooltipPosition]]"\n tooltip-template="[[tooltipTemplate]]"\n unfocusable="[[unfocusable]]"\n view-sections=\'["header", "footer"]\'\n week-numbers="[[weekNumbers]]"\n weeks="[[weeks]]"></smart-calendar>\n </div>\n </div>\n </div>\n <span id="hint" inner-h-t-m-l="[[hint]]" class="smart-hint smart-hidden"></span>\n </div>'}attached(){const e=this;super.attached(),e.isCompleted&&(e._defaultFooterTemplateApplied&&e._addCalendarFooterListeners(),e.$.timePickerDropDown&&e._addTimePickerListener(),e._positionDetection&&e._positionDetection.dropDownAttached())}detached(){const e=this;if(super.detached(),e.close(),e._defaultFooterTemplateApplied){const t=e.$.calendarDropDown.$footer;t.unlisten("change"),t.unlisten("click"),t.unlisten("wheel")}e.$.timePickerDropDown&&e.$.timePickerDropDown.$.unlisten("change"),e._positionDetection&&e._positionDetection.dropDownDetached()}ready(){super.ready();const e=this;e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._iOS=!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform),e._edgeMacFF&&e.$dropDownContainer.addClass("not-in-view"),e._defaultFooterTemplate=document.createElement("template"),e._defaultFooterTemplate.innerHTML='<div class="smart-date-time-picker-footer">\n <div class="smart-footer-component smart-footer-component-hour" role="presentation">\n <input type="text" class="smart-hour-element" aria-label="Hours" />\n <span role="presentation">\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Increment hours">\n <span class="smart-arrow smart-arrow-up" aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Decrement hours">\n <span class="smart-arrow smart-arrow-down" aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n <div class="smart-footer-component smart-footer-component-minute" role="presentation">\n <input class="smart-minute-element" aria-label="Minutes" />\n <span role="presentation">\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Increment minutes">\n <span class="smart-arrow smart-arrow-up" aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Decrement minutes">\n <span class="smart-arrow smart-arrow-down" aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n <div class="smart-footer-component smart-footer-component-ampm" role="presentation">\n <input type="text" class="smart-am-pm-element" aria-label="AM/PM" />\n </div>\n <div class="smart-footer-component smart-footer-component-today" role="presentation">\n <div tabindex="-1" class="smart-today-element" role="button" aria-label="Now"></div>\n </div>\n </div>',e._codeToMethod={y:"addYears",yy:"addYears",yyyy:"addYears",yyyyy:"addYears",M:"addMonths",MM:"addMonths",MMM:"addMonths",MMMM:"addMonths",d:"addDays",dd:"addDays",ddd:"addDays",dddd:"addDays",H:"addHours",HH:"addHours",h:"addHours",hh:"addHours",m:"addMinutes",mm:"addMinutes",s:"addSeconds",ss:"addSeconds",f:"addDeciseconds",ff:"addCentiseconds",fff:"addMilliseconds",u:"addMicroseconds",uu:"addMicroseconds",n:"addNanoseconds",nn:"addNanoseconds",p:"addPicoseconds",pp:"addPicoseconds",e:"addFemtoseconds",ee:"addFemtoseconds",a:"addAttoseconds",aa:"addAttoseconds",x:"addZeptoseconds",xx:"addZeptoseconds",o:"addYoctoseconds",oo:"addYoctoseconds"},e._codeToIndex={y:0,yy:0,yyyy:0,yyyyy:0,M:1,MM:1,MMM:1,MMMM:1,d:2,dd:2,ddd:2,dddd:2,H:3,HH:3,h:3,hh:3,m:4,mm:4,s:5,ss:5,f:6,ff:6,fff:6,u:7,uu:7,n:8,nn:8,p:9,pp:9,e:10,ee:10,a:11,aa:11,x:12,xx:12,o:13,oo:13},e._getLocalizedNames(),e.checkLicense()}render(){const e=this;e.rightToLeft&&(e.calendarButtonPosition="right"===e.calendarButtonPosition?"left":"right"),e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.content,"close"),e._positionDetection.customPositionDropDown=e._positionExternalDropDown,e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e.$.dropDownContainer.style.left=null,e._positionDetection.handleAutoPositioning(),e._setIds(),e._validateInitialPropertyValues(),e._setFocusable(),e.setAttribute("role","presentation"),e.$.input.setAttribute("aria-describedby",e.$.hint.id),e.$.input.setAttribute("aria-labelledby",e.$.label.id),e.$.calendarButton.setAttribute("aria-owns",e.$.dropDownContainer.id),e.$.dropDownContainer.setAttribute("animation",e.animation),e.$.dropDownContainer.setAttribute("drop-down-display-mode",e.dropDownDisplayMode),super.render(),e.isInitialized=!0}close(){this.opened&&this._close()}focus(){this.$.input.focus()}select(){this.$.input.select()}open(){this.opened||this._open()}_handleFooter(){const e=this;if(e.footer){e.$.dropDownContainer.setAttribute("footer","");const t=e.$.calendarDropDown;"default"===e._dropDownDisplayMode?t.viewSections=["title","header","footer"]:"classic"===e._dropDownDisplayMode?t.viewSections=["header","footer"]:"calendar"===e._dropDownDisplayMode&&(t.viewSections=["title","header","footer"])}else e.$.dropDownContainer.removeAttribute("footer")}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"animation":case"theme":n.$.timePickerDropDown&&(n.$.timePickerDropDown[e]=a),"animation"===e&&(n.$.dropDownContainer.setAttribute("animation",n.animation),n._defaultFooterTemplateApplied&&Array.from(n.$.calendarDropDown.$.footer.getElementsByTagName("smart-repeat-button")).forEach((function(e){e.animation=a})));break;case"calendarButton":n.$.dropDownContainer.style.transition="none",a||n.close();break;case"calendarButtonPosition":n.$.dropDownContainer.style.transition="none",n.close(),"left"===a?n.$.content.insertBefore(n.$.calendarButton,n.$.content.firstElementChild):null===n._dropDownParent?n.$.content.insertBefore(n.$.calendarButton,n.$.dropDownContainer):n.$.content.appendChild(n.$.calendarButton);break;case"disabled":a?(n.close(),n.$.upButton.disabled=!0,n.$.downButton.disabled=!0):n._disableSpinButtons(),n._setFocusable(),n._positionDetection.handleAutoPositioning();break;case"displayKind":{const e=n._outputTimeZone;switch(a){case"unspecified":n._outputTimeZone=n._inputTimeZone;break;case"UTC":n._outputTimeZone="UTC";break;case"local":n._outputTimeZone="Local"}if(n._outputTimeZone===e)return;null!==n._value&&(n.close(),n._toSync=!0,n._value=n._value.toTimeZone(n._outputTimeZone),n._applyFormatString()),n.min=n.min.toTimeZone(n._outputTimeZone),n.max=n.max.toTimeZone(n._outputTimeZone);for(let e=0;e<n.restrictedDates.length;e++){let t=n.restrictedDates[e];t=t.toTimeZone(n._outputTimeZone)}break}case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownDisplayMode":n._changeDropDownDisplayMode();break;case"dropDownOverlay":a||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"footer":n._handleFooter();break;case"footerTemplate":if(null!==a){n._defaultFooterTemplateApplied=!1;const e=n.$.calendarDropDown.$footer;e.unlisten("change"),e.unlisten("click"),e.unlisten("wheel"),n.$.calendarDropDown.footerTemplate=a}else{n._setDefaultFooterTemplate();const e=n._value;n._hourElement.value=e.toString("hh"),n._minuteElement.value=e.toString("mm"),n._ampmElement.value=e.toString("tt")}n._handleFooter();break;case"formatString":""===a&&(n.formatString="dd-MMM-yy HH:mm:ss.fff"),n._getFormatStringRegExp(),n._applyFormatString(),"auto"===n.dropDownDisplayMode&&n._changeDropDownDisplayMode(),n._timePickerInitialized&&(n.$.timePickerDropDown.format=n._formatStringRegExp.groups.find((e=>-1!==e.indexOf("H")))?"24-hour":"12-hour");break;case"interval":n._validateInterval(t);break;case"locale":case"messages":if(n.$.selectDate.innerHTML=n.localize("dateTabLabel"),n.$.selectTime.innerHTML=n.localize("timeTabLabel"),n._defaultFooterTemplateApplied&&(n._todayElement.title=n.localize("now")),"messages"===e)return;n._getLocalizedNames(),n.min.calendar.days=n._localizedDays,n.min.calendar.months=n._localizedMonths,n.min.calendar.locale=n.locale,n.max.calendar.days=n._localizedDays,n.max.calendar.months=n._localizedMonths,n.max.calendar.locale=n.locale,null!==n.value&&(n._value.calendar.days=n._localizedDays,n._value.calendar.months=n._localizedMonths,n._value.calendar.locale=n.locale,n.value.calendar.days=n._localizedDays,n.value.calendar.months=n._localizedMonths,n.value.calendar.locale=n.locale),Smart.Utilities.DateTime.cache=[],n._applyFormatString();break;case"max":case"min":n._validateMinMax(e,t),"strict"===n.validation?n._validateValue():n._minMaxChanged=!0;break;case"nullable":!0===t&&null===n._value&&n._validateValue(n._now(),null);break;case"opened":a?n._open():n._close();break;case"readonly":case"unfocusable":a&&n.close(),"unfocusable"===e&&n._setFocusable();break;case"restrictedDates":n._validateRestrictedDates(),n._validateValue();break;case"spinButtonsPosition":"right"===a?n.$.content.insertBefore(n.$.spinButtonsContainer,n.$.input.nextElementSibling):n.$.content.insertBefore(n.$.spinButtonsContainer,n.$.input);break;case"validation":"strict"===a&&(delete n._minMaxChanged,n._validateValue());break;case"value":{let e;null!==a?(e=Smart.Utilities.DateTime.validateDate(a,n._now(),n.formatString),e=e.toTimeZone(n._outputTimeZone)):e=null,n._validateValue(e,n._value,void 0,!0);break}}}setDate(e){const t=this;let a;null!==e?(a=Smart.Utilities.DateTime.validateDate(e,t._now(),t.formatString),a=a.toTimeZone(t._outputTimeZone)):a=null,t._validateValue(a,t._value,void 0,!0)}getDate(){return this.value&&this.value.toDate?this.value.toDate():null}_addCalendarFooterListeners(){const e=this,t=e.$.calendarDropDown.$footer;t.listen("change",e._footerChangeHandler.bind(e)),t.listen("click",e._footerClickHandler.bind(e)),t.listen("wheel",e._footerWheelHandler.bind(e))}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const a=e.dataset.property,n=e.value;a&&void 0!==t[a]&&(t[a]=n)}}}_addTimePickerListener(){const e=this;e.$.timePickerDropDown.$.listen("change",(function(t){const a=e.context,n=t.detail.value,i=Smart.Utilities.DateTime.getConstructorParameters(null!==e._value?e._value:e._now());e.context=e,i[3]=n.getHours(),i[4]=n.getMinutes(),e._timePickerInitiatedChange=!0,i.unshift(null),e._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,i))),e._timePickerInitiatedChange=!1,e.context=a}))}_applyFormatString(){const e=this;null!==e.value&&(e.$.input.value=e._value.toString(e.formatString))}_calendarButtonClickHandler(e){const t=this;t._highlightedTimePart=void 0,t.disabled||t.readonly||(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t.$.calendarButton,e.pageX,e.pageY),t.opened?t._close():t._open())}_calendarDropDownChangeHandler(e){const t=this;if(e.stopPropagation(),t._disregardCalendarChangeEvent)t._disregardCalendarChangeEvent=!1;else if(this.$.calendarDropDown.selectedDates.length>0){const a=e.detail.value[0],n=null!==t._value?t._value:t._now(),i=Smart.Utilities.DateTime.getConstructorParameters(n);if(i[0]=a.getFullYear(),i[1]=a.getMonth()+1,i[2]=a.getDate(),t._calendarInitiatedChange=!0,i.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,i))),t._defaultFooterTemplateApplied){const e=t._value;""===t._hourElement.value&&(t._hourElement.value=e.toString("hh")),""===t._ampmElement.value&&(t._ampmElement.value=e.toString("tt")),""===t._minuteElement.value&&(t._minuteElement.value=e.toString("mm"))}t._calendarInitiatedChange=!1}else t._setNullValue()}_calendarDropDownClickHandler(e){const t=this;t.autoClose&&e.target.closest(".smart-calendar-cell")&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay))}_changeDropDownDisplayMode(){function e(e,a,n,i){t.$dropDownHeader[e]("smart-hidden"),t.$calendarDropDown[a]("smart-hidden"),t._timePickerInitialized&&t.$.timePickerDropDown.$[n]("smart-hidden"),i&&(t.opened?t.$.calendarDropDown._refreshTitle():t._toSync=!0)}const t=this,a=t._dropDownDisplayMode;t._detectDisplayMode(),t._dropDownDisplayMode!==a&&("default"===t._dropDownDisplayMode?(t.calendarMode="default",t.$.calendarDropDown.viewSections=["title","header"],t.$selectDate.addClass("smart-selected"),t.$selectTime.removeClass("smart-selected"),e("removeClass","removeClass","addClass",!0)):"classic"===t._dropDownDisplayMode?(t.calendarMode="classic",t.$.calendarDropDown.viewSections=["header","footer"],e("addClass","removeClass","addClass")):"calendar"===t._dropDownDisplayMode?(t.calendarMode="default",t.$.calendarDropDown.viewSections=["title","header"],e("addClass","removeClass","addClass",!0)):(t.calendarMode="default",e("addClass","addClass","removeClass"),t._timePickerInitialized||t._initializeTimePicker()),t.$.dropDownContainer.setAttribute("drop-down-display-mode",t.dropDownDisplayMode))}_cloneValue(){const e=this;return null!==e._value?e._value.clone():null}_close(){const e=this;if(e.$.fireEvent("closing").defaultPrevented)e.opened=!0;else{e.$.calendarDropDown.disabled=!0,e.$calendarButton.removeClass("smart-calendar-button-pressed"),e.$.calendarButton.removeAttribute("active"),e.$dropDownContainer.addClass("smart-visibility-hidden");const t=e.$.calendarDropDown.$.container.querySelector(".smart-calendar-cell[hover]");t&&t.removeAttribute("hover"),e.opened=!1,e._positionDetection.removeOverlay(!0),e.$.fireEvent("close"),e._edgeMacFF&&!e.hasAnimation&&(e.$.dropDownContainer.style.top=null,e.$.dropDownContainer.style.left=null,e.$dropDownContainer.addClass("not-in-view")),e.$.input.focus()}e.$.calendarButton.setAttribute("aria-expanded",e.opened)}_detectDisplayMode(){const e=this;"auto"!==e.dropDownDisplayMode?e._dropDownDisplayMode=e.dropDownDisplayMode:e._dropDownDisplayMode=Smart.Utilities.DateTime.detectDisplayMode(e.value||e.min,e.formatString,e._formatStringRegExp),"timePicker"===e._dropDownDisplayMode?(e.$calendarButton.addClass("time"),"Enter date"===e.placeholder&&(e.placeholder="Enter time")):(e.$calendarButton.removeClass("time"),"Enter time"===e.placeholder&&(e.placeholder="Enter date")),"default"===e._dropDownDisplayMode?e.$dropDownContent.removeClass("partial"):e.$dropDownContent.addClass("partial")}_disableSpinButtons(){const e=this;if(e.disabled)return;const t=null===e._value;e.$.upButton.disabled=t,e.$.downButton.disabled=t}_documentUpHandler(e){const t=this,a=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement,n=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;Smart.Utilities.Core.isMobile||a!==t.$.input||"partial"!==t.editMode||null===t._value||n===t.$.input&&t.$.input.selectionStart!==t.$.input.selectionEnd?n===t.$.calendarButton||t.$.dropDownContainer.contains(n)||t.$.dropDownContainer.contains(t._getRootShadowHost(n))||(t.close(),a===t.$.input||t.contains(n)||(t._highlightedTimePart=void 0)):(t._highlightedTimePartEdit=!1,t._validateValue(t.$.input.value,t._cloneValue(),!1),t._highlightTimePartBasedOnCursor()),t._mouseFocus=!1}_getRootShadowHost(e){const t=this;if(!t.shadowRoot&&!t.isInShadowDOM)return;let a,n=e.getRootNode().host;for(;n&&n!==t&&n!==document;)a=n,n=n.getRootNode().host;return a}_dropDownHeaderClickHandler(e){const t=this;if(e.target===t.$.selectDate){if(t.$selectDate.hasClass("smart-selected"))return;t.$selectDate.addClass("smart-selected"),t.$selectTime.removeClass("smart-selected"),t.$.timePickerDropDown.$.addClass("smart-hidden"),t.$calendarDropDown.removeClass("smart-hidden")}else{if(t.$selectTime.hasClass("smart-selected"))return;t.$selectDate.removeClass("smart-selected"),t.$selectTime.addClass("smart-selected"),t.$calendarDropDown.addClass("smart-hidden"),t._timePickerInitialized?t.$.timePickerDropDown.$.removeClass("smart-hidden"):t._initializeTimePicker()}}_dropDownKeydownHandler(e){const t=this,a=e.key,n=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;!t.$.dropDownHeader.contains(n)||"Enter"!==a&&" "!==a?"Escape"===a||e.altKey&&"ArrowUp"===a?(e.preventDefault(),t.close(),t.$.input.focus()):"Enter"!==a&&" "!==a||!n.classList.contains("smart-footer-component-today")?"Enter"===a&&(n===t.$.calendarDropDown.$.body&&t.$.calendarDropDown.querySelectorAll(".smart-calendar-cell[selected][focus]").length>0||t._timePickerInitialized&&n===t.$.timePickerDropDown.$.picker)&&(e.preventDefault(),t.close()):(e.preventDefault(),t._validateValue(t._now()),t.close()):(e.preventDefault(),t._dropDownHeaderClickHandler({target:n}))}_dropDownTransitionendHandler(){const e=this;if(e.hasAnimation)return e.opened&&e._toFocus?(e._toFocus.focus(),delete e._toFocus,void(e._timePickerInitialized&&!e.$.timePickerDropDown.classList.contains("smart-hidden")&&requestAnimationFrame((()=>e.$.timePickerDropDown._highlightLabel())))):e._edgeMacFF&&!e.opened?(e.$.dropDownContainer.style.top=null,e.$.dropDownContainer.style.left=null,void e.$dropDownContainer.addClass("not-in-view")):void 0}_footerChangeHandler(e){const t=this,a=t.context,n=e.target,i=null!==t._value?t._value:t._now();let o,l=n.value;if(t.context=t,e.stopPropagation(),n.classList.contains("smart-hour-element")){if(l=parseInt(l,10),isNaN(l)||l<0||l>12)return void(n.value=i.toString("hh"));l>0&&l<12&&"PM"===i.toString("tt")&&(l+=12),o="hh"}else{if(!n.classList.contains("smart-minute-element")){if(null===t._value)return void(n.value="");const e=i.toString("tt");return l=l.toLowerCase(),void("PM"===e&&("a"===l||"am"===l)||"AM"===e&&("p"===l||"pm"===l)?(t._incrementDecrement(void 0,"tt"),n.value=t._value.toString("tt")):n.value=e)}if(l=parseInt(l,10),isNaN(l)||l<0||l>59)return void(n.value=i.toString("mm"));o="mm"}const r=Smart.Utilities.DateTime.getConstructorParameters(i);r[t._codeToIndex[o]]=l,r.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,r))),n.value=t._value.toString(o),t.context=a}_footerClickHandler(e){const t=this,a=t.context,n=e.target;if(t.context=t,n.classList.contains("smart-today-element"))t._validateValue(t._now()),t.autoClose&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay));else{const e=n.closest("smart-repeat-button");if(null!==e){const a=e===e.parentElement.children[1],n=e.closest(".smart-footer-component").classList.contains("smart-footer-component-hour")?"hh":"mm";t._incrementDecrement(a,n)}}t.context=a}_footerWheelHandler(e){const t=this,a=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;if(t.enableMouseWheelAction&&e.target instanceof HTMLInputElement&&a===e.target){const a=t.context,n=e.target;t.context=t,n.classList.contains("smart-hour-element")?t._incrementDecrement(e.deltaY>0,"hh"):n.classList.contains("smart-minute-element")?t._incrementDecrement(e.deltaY>0,"mm"):t._incrementDecrement(void 0,"tt"),t.context=a,e.stopPropagation()}}_getAndHighlightTimePart(e,t,a){const n=this;n._programmaticSelection=!0,n.$.input.selectionStart!==e||n.$.input.selectionEnd!==t?n.$.input.setSelectionRange(e,t):setTimeout((function(){n.$.input.setSelectionRange(e,t)}),200),n._highlightedTimePart={code:n._formatStringRegExp.groups[a],index:a,from:e,to:t}}_getFormatStringRegExp(){const e=this;e._formatStringRegExp=e.min.getParseRegExp(e.min.calendar,e.formatString.replace(/y+/g,"yyyyy")),e._formatStringRegExp.regExp=new RegExp(e._formatStringRegExp.regExp)}_getLocalizedNames(){const e=this,t=Smart.Utilities.DateTime.getLocalizedNames(e.locale);e._localizedDays=t.days,e._localizedMonths=t.months,e.$.selectDate.innerHTML=e.localize("dateTabLabel"),e.$.selectTime.innerHTML=e.localize("timeTabLabel")}_handleManualTimePartEdit(e){const t=this,a=Smart.Utilities.DateTime.getConstructorParameters(t._value);if(e=e[t._highlightedTimePart.index+1],isNaN(e)){if(1===t._codeToIndex[t._highlightedTimePart.code]){let n=-1;if(e.length>1&&t._localizedMonths.names.some((function(t,a){if(-1!==t.toLowerCase().indexOf(e.toLowerCase()))return n=a,!0})),-1===n)return void t._applyFormatString();a[1]=n+1}}else{if("f"===t._highlightedTimePart.code)e=100*parseInt(e,10);else if("ff"===t._highlightedTimePart.code)e=10*parseInt(e,10);else if(-1!==t._highlightedTimePart.code.indexOf("y")&&e.length<3){const a=t.yearCutoff.toString(),n=parseInt(a.slice(2),10);let i=parseInt(a.slice(0,2),10);(e=parseInt(e,10))<n&&i++,e=e.toString(),e=i+""+"0".repeat(2-e.length)+e}else if(-1!==t._highlightedTimePart.code.indexOf("h")){const a=t._value.hour();e=parseInt(e,10),a>11&&e<=11&&(e+=12)}a[t._codeToIndex[t._highlightedTimePart.code]]=parseInt(e,10)}try{a.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,a)))}catch(e){t._applyFormatString()}}_highlightTimePartBasedOnCursor(e){const t=this,a=t.$.input.value,n=t._formatStringRegExp.regExp.exec(a);function i(){return void 0===e?t.$.input.selectionStart:e}if(null===n)return void(t._highlightedTimePart=void 0);t._iOS||void 0!==e||(e=t.$.input.selectionStart);let o,l=n.index;for(let e=1;e<n.length;e++){const r=n[e];if(o=a.indexOf(r,l),l=o+r.length,1===e&&i()<o){t._getAndHighlightTimePart(o,l,0);break}if(i()>=o&&i()<=l){t._getAndHighlightTimePart(o,l,e-1);break}const s=n[e+1];if(!s){t._programmaticSelection=!0,t.$.input.setSelectionRange(o,l),t._highlightedTimePart={code:t._formatStringRegExp.groups[e-1],index:e-1,from:o,to:l};break}{const n=a.indexOf(s,l);if(i()>l&&i()<n){i()-l<=n-i()?t._getAndHighlightTimePart(o,l,e-1):(t._formatStringRegExp.groups[e],t._programmaticSelection=!0,t.$.input.setSelectionRange(n,n+s.length));break}}}}_highlightTimePartBasedOnIndex(e){const t=this,a=t.$.input.value,n=t._formatStringRegExp.regExp.exec(a);if(null===n)return t._validateValue(void 0,t._cloneValue(),!1),void t._highlightTimePartBasedOnIndex(e);let i,o=n.index;const l=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;if(!(e<0||e>=n.length)){t.$.input!==l&&t.$.input.focus();for(let l=1;l<n.length;l++){const r=n[l];if(i=a.indexOf(r,o),o=i+r.length,e===l-1){t._getAndHighlightTimePart(i,o,e);break}}}}_incrementDecrement(e,t){const a=this,n=a._cloneValue();if(a._minMaxChanged&&(a._value=a._rangeValidation(a._value),delete a._minMaxChanged),void 0===t&&a._highlightedTimePart&&(t=a._highlightedTimePart.code),void 0!==t){if("z"===t||"zz"===t||"zzz"===t)return void a._highlightTimePartBasedOnIndex(a._highlightedTimePart.index);a._value="t"===t||"tt"===t?a._value.addHours(a._value.hour()<12?12:-12,!0):a._value[a._codeToMethod[t]](e?-1:1,!0),a._validateValue(void 0,n,!1),a._highlightedTimePart&&a._highlightTimePartBasedOnIndex(a._highlightedTimePart.index)}else a._value=a._value.add(e?a.interval.negate():a.interval,void 0,!0),a._validateValue(void 0,n,!1);0!==n.compare(a._value)&&a.isInitialized&&(a.$.fireEvent("change",{oldValue:n.toTimeZone(a._inputTimeZone),value:a.value}),a._updateTargetValue())}_initializeTimePicker(){const e=this,t=document.createElement("smart-time-picker");t.rightToLeft=e.rightToLeft,t.animation=e.animation,t.autoSwitchToMinutes=e.autoSwitchToMinutes,t.format=e._formatStringRegExp.groups.find((e=>-1!==e.indexOf("H")))?"24-hour":"12-hour",t.theme=e.theme,t.value=null!==e._value?e._value.toDate():e._now(),e.$.timePickerDropDown=t,t.$=Smart.Utilities.Extend(t),e.$.dropDownContent.appendChild(t),e._timePickerInitialized=!0,e._addTimePickerListener()}_inputBlurHandler(){const e=this;e.removeAttribute("focus"),e._fullEdit=!1,e._highlightedTimePartEdit=!1,e.$.fireEvent("blur")}_inputChangeHandler(e){const t=this;if(e&&e.stopPropagation(),""!==t.$.input.value){if(t._fullEdit||null===t._value)t._fullEdit=!1,t._validateValue(t.$.input.value),t._highlightTimePartBasedOnCursor();else if(t._highlightedTimePartEdit){t._highlightedTimePartEdit=!1;let e=t._formatStringRegExp.regExp.exec(t.$.input.value);null!==e?t._handleManualTimePartEdit(e):t._applyFormatString()}}else t._setNullValue()}_inputDragstartHandler(e){e.preventDefault()}_inputFocusHandler(){const e=this;if(e.setAttribute("focus",""),"full"!==e.editMode){const t=Smart.Utilities.Core.isMobile?10:0;setTimeout((function(){e._iOS?e._highlightTimePartBasedOnCursor():!0!==e._mouseFocus&&(void 0===e._highlightedTimePart?e._highlightTimePartBasedOnCursor(e._iOS?void 0:0):e._highlightTimePartBasedOnIndex(e._highlightedTimePart.index))}),t)}e.$.fireEvent("focus")}_inputKeydownHandler(e){const t=this,a=t.editMode,n=e.key;if("Tab"!==n){if(e.altKey&&"ArrowDown"===n)return e.preventDefault(),void t.open();if("Escape"===n||e.altKey&&"ArrowUp"===n)return e.preventDefault(),void t.close();if("full"!==a){if("partial"===a){if("Delete"===n)return void(null!==t._value&&(t._setNullValue(),e.preventDefault()));if(null===t._value&&(t._validateValue(t._now(),null,!1),t._highlightTimePartBasedOnIndex(0)),-1!==["/",".","-",","," "].indexOf(n))return t._inputChangeHandler(),t._navigateToNextTimePart(),void e.preventDefault();if("Backspace"===n)return t._resetTimePart(),t._highlightedTimePart.index>0?t._navigateToPreviousTimePart():t._highlightTimePartBasedOnIndex(0),void e.preventDefault()}else if(t._fullEdit||t._highlightedTimePartEdit||t.readonly||-1!==["Alt","Control","Shift"].indexOf(n)||e.altKey||e.ctrlKey)return void(-1!==["End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].indexOf(n)&&t._highlightedTimePartEdit&&t._inputChangeHandler());if(-1!==["End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].indexOf(n)){if(e.preventDefault(),"partial"===a&&t._highlightedTimePartEdit&&t._inputChangeHandler(),null!==t._value)switch(n){case"End":t._highlightTimePartBasedOnIndex(t._formatStringRegExp.groups.length-1);break;case"Home":t._highlightTimePartBasedOnIndex(0);break;case"ArrowLeft":t._navigateToPreviousTimePart();break;case"ArrowUp":t._incrementDecrement();break;case"ArrowRight":t._navigateToNextTimePart();break;case"ArrowDown":t._incrementDecrement(!0)}}else if(t._highlightedTimePart){if("partial"!==a&&t._highlightedTimePart.to-t._highlightedTimePart.from!=t.$.input.selectionEnd-t.$.input.selectionStart)return void(t._fullEdit=!0);const i=t._highlightedTimePart.code;if("ddd"===i||"dddd"===i||"z"===i||"zz"===i||"zzz"===i||"t"===i||"tt"===i)return void e.preventDefault();if("partial"===a&&"MMM"!==i&&"MMMM"!==i&&!1===new RegExp(/^\d+$/).test(n))return void((n.length<2||"F"!==n.charAt(0))&&e.preventDefault());t._highlightedTimePartEdit=!0}}else t._fullEdit=!0}}_inputDownHandler(){const e=this;e._fullEdit||e._highlightedTimePartEdit||"full"===e.editMode||Smart.Utilities.Core.isMobile||setTimeout((function(){e._mouseFocus=!0,e._highlightTimePartBasedOnCursor()}),0)}_inputPasteHandler(e){"partial"===this.editMode?e.preventDefault():this._fullEdit=!0}_inputSelectHandler(){const e=this,t=e.shadowRoot?e.shadowRoot.activeElement:document.activeElement;"partial"===e.editMode&&t===e.$.input&&(!0===e._programmaticSelection?e._programmaticSelection=!1:e._highlightedTimePart?e._highlightTimePartBasedOnIndex(e._highlightedTimePart.index):e._highlightTimePartBasedOnIndex(0))}_inputUpHandler(){const e=this;Smart.Utilities.Core.isMobile&&(e._iOS?(e._mouseFocus=!0,setTimeout((function(){document.activeElement===e.$.input&&e._highlightTimePartBasedOnCursor()}),50)):setTimeout((function(){e._mouseFocus=!0,e._highlightTimePartBasedOnCursor()}),10))}_inputWheelHandler(e){const t=this;(t.shadowRoot?t.shadowRoot.activeElement:document.activeElement)!==t.$.input||!t.enableMouseWheelAction||t.disabled||t.readonly||(e.preventDefault(),t._incrementDecrement(e.deltaY>0))}_isRestricted(e){const t=this.restrictedDates;let a=!1;for(let n=0;n<t.length;n++)if(e.equalDateParts(t[n])){a=!0;break}return a}_mouseoutHandler(e){const t=this,a=e.target;t.disabled||a!==t.$.input&&a!==t.$.calendarButton||(a.removeAttribute("hover"),t.removeAttribute("hover"))}_mouseoverHandler(e){const t=this,a=e.target;t.disabled||a!==t.$.input&&a!==t.$.calendarButton||(a.setAttribute("hover",""),t.setAttribute("hover",""))}_navigateToNextTimePart(){this._highlightTimePartBasedOnIndex(this._highlightedTimePart.index+1)}_navigateToPreviousTimePart(){this._highlightTimePartBasedOnIndex(this._highlightedTimePart.index-1)}_now(){const e=this,t=new Smart.Utilities.DateTime("today","Local");return"Local"!==e._outputTimeZone?t.toTimeZone(e._outputTimeZone):t}_open(e){const t=this;if(t.disabled||t.readonly)return t.opened=!1,void t.$.calendarButton.setAttribute("aria-expanded",!1);if(t.$.fireEvent("opening").defaultPrevented)return t.opened=!1,void t.$.calendarButton.setAttribute("aria-expanded",!1);t._edgeMacFF&&t.$dropDownContainer.removeClass("not-in-view");const a=t.$.dropDownContainer;a.style.marginLeft=null,e||(a.style.transition=""),t.$.calendarDropDown.disabled=!1,t.$calendarButton.addClass("smart-calendar-button-pressed"),t.$.calendarButton.setAttribute("active",""),("default"!==t._dropDownDisplayMode&&"timePicker"!==t._dropDownDisplayMode||!t._timePickerInitialized||t._timePickerInitialized&&t.$.timePickerDropDown.$.hasClass("smart-hidden"))&&t.$calendarDropDown.removeClass("smart-hidden"),t.opened=!0,t.$.calendarButton.setAttribute("aria-expanded",!0),t._positionDetection.placeOverlay(),t._positionDetection.checkBrowserBounds("vertically"),t._positionDetection.positionDropDown(),t.$dropDownContainer.removeClass("smart-visibility-hidden");const n=1===window.devicePixelRatio?document.documentElement.clientWidth:window.innerWidth,i=a.getBoundingClientRect();if(i.left<0?a.style.marginLeft=-1*i.left+"px":i.right>n&&(a.style.marginLeft=n-i.right+"px"),t.$.fireEvent("open"),t._toSync){const e=t._value;if(null!==e)t._disregardCalendarChangeEvent=!0,t.$.calendarDropDown.selectedDates=[e.toDate()],t._defaultFooterTemplateApplied&&(t._hourElement.value=e.toString("hh"),t._minuteElement.value=e.toString("mm"),t._ampmElement.value=e.toString("tt")),t._timePickerInitialized&&(t.$.timePickerDropDown.value=e.toDate()),t._disregardCalendarChangeEvent=!1;else{const e=t.$.calendarDropDown.context;t.$.calendarDropDown.context=t.$.calendarDropDown,t.$.calendarDropDown._clearSelection(!0),t.$.calendarDropDown.context=e,t._defaultFooterTemplateApplied&&(t._hourElement.value="",t._minuteElement.value="",t._ampmElement.value="")}t._toSync=!1}let o;switch(t._dropDownDisplayMode){case"default":o=t.$selectDate.hasClass("smart-selected")?t.$.calendarDropDown:t.$.timePickerDropDown.$.picker;break;case"classic":case"calendar":o=t.$.calendarDropDown;break;case"timePicker":o=t.$.timePickerDropDown.$.picker}t.hasAnimation?(t._toFocus=o,function e(){t._toFocus&&(0===t.$.dropDownContainer.getBoundingClientRect().height?requestAnimationFrame(e):t._dropDownTransitionendHandler())}()):o.focus()}_positionExternalDropDown(e){const t=this.context,a=!t.calendarButton||"right"===t.calendarButtonPosition,n=t._dropDownListPosition,i=t.$.dropDownContainer;let o,l=a?e.right-i.offsetWidth:e.left;switch(n){case"bottom":o=e.bottom;break;case"overlay-top":o=e.bottom-i.offsetHeight;break;case"overlay-center":o=e.top+e.height/2-i.offsetHeight/2;break;case"overlay-bottom":o=e.top;break;case"top":o=e.top-i.offsetHeight;break;case"center-bottom":case"center-top":o="center-bottom"===n?e.bottom+5:e.top-5-i.offsetHeight,l=a?e.right-i.offsetWidth/2-t.$.calendarButton.offsetWidth/2:e.left-i.offsetWidth/2+t.$.calendarButton.offsetWidth/2}return{left:l,top:o}}_rangeValidation(e){const t=this;return-1===e.compare(t.min)?t.min.clone():1===e.compare(t.max)?t.max.clone():e}_resetTimePart(){const e=this,t=e._highlightedTimePart.code,a=e._codeToIndex[t],n=Smart.Utilities.DateTime.getConstructorParameters(e._value);let i;i=a>2?0:a>0?1:e.min.year(),n[a]=i,n.unshift(null),e._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,n)))}_setIds(){const e=this;e.$.label.id||(e.$.label.id=e.id+"Label"),e.$.input.id||(e.$.input.id=e.id+"Input"),e.$.calendarButton.id||(e.$.calendarButton.id=e.id+"CalendarButton"),e.$.dropDownContainer.id||(e.$.dropDownContainer.id=e.id+"DropDownContainer"),e.$.hint.id||(e.$.hint.id=e.id+"Hint")}_setDefaultFooterTemplate(e){const t=this;t.$.calendarDropDown.footerTemplate=t._defaultFooterTemplate,e&&t.$.calendarDropDown._handleLayoutTemplate(t.$.calendarDropDown.$.footer,t._defaultFooterTemplate),t._hourElement=t.$.calendarDropDown.getElementsByClassName("smart-hour-element")[0],t._minuteElement=t.$.calendarDropDown.getElementsByClassName("smart-minute-element")[0],t._ampmElement=t.$.calendarDropDown.getElementsByClassName("smart-am-pm-element")[0],t._todayElement=t.$.calendarDropDown.getElementsByClassName("smart-today-element")[0],t._todayElement.title=t.localize("now"),Array.from(t.$.calendarDropDown.$.footer.getElementsByTagName("smart-repeat-button")).forEach((function(e){e.animation=t.animation})),t._addCalendarFooterListeners(),t._defaultFooterTemplateApplied=!0}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.$.input.tabIndex=-1,e.$.selectDate.removeAttribute("tabindex"),e.$.selectTime.removeAttribute("tabindex"),void(e._defaultFooterTemplateApplied&&(e._hourElement.tabIndex=-1,e._ampmElement.tabIndex=-1,e._minuteElement.tabIndex=-1));const t=e.tabIndex>0?e.tabIndex:0;e.$.input.removeAttribute("tabindex"),e.$.selectDate.tabIndex=t,e.$.selectTime.tabIndex=t,e._defaultFooterTemplateApplied&&(e._hourElement.removeAttribute("tabindex"),e._ampmElement.removeAttribute("tabindex"),e._minuteElement.removeAttribute("tabindex"),e.$.calendarDropDown.getElementsByClassName("smart-footer-component-today")[0].tabIndex=t)}_setNullValue(e){const t=this;if(void 0===e&&(e=t._cloneValue()),t.nullable){if(t._value=null,t.value=null,t._highlightedTimePart=void 0,t.$.input.value="",null!==e){if(t.opened){if(!t._calendarInitiatedChange){const e=t.$.calendarDropDown.context;t.$.calendarDropDown.context=t.$.calendarDropDown,t.$.calendarDropDown._clearSelection(!0),t.$.calendarDropDown.context=e}t._defaultFooterTemplateApplied&&(t._hourElement.value="",t._ampmElement.value="",t._minuteElement.value=""),t._toSync=!1}else t._toSync=!0;t.isInitialized&&(t.$.fireEvent("change",{oldValue:e.toTimeZone(t._inputTimeZone),value:null}),t._updateTargetValue())}t._disableSpinButtons()}else t._validateValue(t._now(),e)}_spinButtonsClickHandler(e){const t=this;null===t._value||t.disabled||t.readonly||t._incrementDecrement(t.$.downButton.contains(e.target))}_validateInitialPropertyValues(){const e=this,t=e.$.calendarDropDown;"left"===e.calendarButtonPosition&&e.$.content.insertBefore(e.$.calendarButton,e.$.input),"left"===e.spinButtonsPosition&&e.$.content.insertBefore(e.$.spinButtonsContainer,e.$.input),e.disabled&&(e.$.upButton.disabled=!0,e.$.downButton.disabled=!0),e.opened&&(e.disabled||e.readonly?e.opened=!1:(e.$.dropDownContainer.style.transition="none",e._open(!0))),e.$.calendarButton.setAttribute("aria-expanded",e.opened),null===e.footerTemplate?e._setDefaultFooterTemplate(!0):(t.footerTemplate=e.footerTemplate,t._handleLayoutTemplate(t.$.footer,e.footerTemplate)),""===e.formatString&&(e.formatString="dd-MMM-yy HH:mm:ss.fff");const a=e.displayKind;let n;if("UTC"===a?e._outputTimeZone="UTC":"local"===a&&(e._outputTimeZone="Local"),null!==e.value?(n=Smart.Utilities.DateTime.validateDate(e.value,new Smart.Utilities.DateTime,e.formatString),e._inputTimeZone=n.timeZone,"unspecified"!==a&&e._inputTimeZone!==e._outputTimeZone?n=n.toTimeZone(e._outputTimeZone):"unspecified"===a&&(e._outputTimeZone=e._inputTimeZone)):(n=null,e._inputTimeZone="Local"),e._validateRestrictedDates(),e._validateMinMax("both"),e._validateValue(n,e._now(),!1,!0),e._validateInterval(new Smart.Utilities.TimeSpan(0,0,1)),e._getFormatStringRegExp(),e._defaultFooterTemplateApplied&&""===e._hourElement.value&&null!==e.value){const t=e.value;e._hourElement.value=t.toString("hh"),e._ampmElement.value=t.toString("tt"),e._minuteElement.value=t.toString("mm")}e._detectDisplayMode();const i=e._dropDownDisplayMode;"default"===i||"calendar"===i?(t.viewSections=["title","header"],t.$title.hasClass("smart-hidden")&&t.propertyChangedHandler("viewSections",["header","footer"],["title","header"]),"default"===i&&e.$dropDownHeader.removeClass("smart-hidden")):"timePicker"===i&&(e.$calendarDropDown.addClass("smart-hidden"),e._initializeTimePicker()),e.footer&&e._handleFooter()}_validateInterval(e){const t=this,a=t.interval;let n=a;if(a instanceof Smart.Utilities.TimeSpan)n=a;else if("string"==typeof a){const i=a.indexOf("TimeSpan("),o=a.indexOf(")");if(-1!==i&&-1!==o&&(n=a.slice(i+9,o),n=n.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),new RegExp(/(^(\d+)(,\s*\d+)*$)/g).test(n)&&(n=n.replace(/\s/g,""),n=n.split(","),n.map((function(e,t){n[t]=parseInt(e)})),n.unshift(null),n=new(Function.prototype.bind.apply(Smart.Utilities.TimeSpan,n)))),n instanceof Smart.Utilities.TimeSpan==0){if(""===n.trim())return void(t.interval=e);isNaN(n)||(n=1e4*parseInt(n,10));try{n=new Smart.Utilities.TimeSpan(n)}catch(a){return void(t.interval=e)}}}else{if("number"!=typeof a)return void(t.interval=e);n=new Smart.Utilities.TimeSpan(a)}0===n._ticks?t.interval=e:t.interval=n}_validateMinMax(e,t){const a=this;let n=!1;"max"!==e&&(a.min=Smart.Utilities.DateTime.validateDate(a.min,t||new Smart.Utilities.DateTime(1600,1,1),a.formatString),a.min=a.min.toTimeZone(a._outputTimeZone),n=!0),"min"!==e&&(a.max=Smart.Utilities.DateTime.validateDate(a.max,t||new Smart.Utilities.DateTime(3001,1,1),a.formatString),a.max=a.max.toTimeZone(a._outputTimeZone),a.max.calendar.days=a._localizedDays,a.max.calendar.months=a._localizedMonths,a.max.calendar.locale=a.locale,a.$.calendarDropDown.max=a.max.toDate()),a.min.compare(a.max)>0&&(a.min=a.max.clone(),n=!0),n&&(a.min.calendar.days=a._localizedDays,a.min.calendar.months=a._localizedMonths,a.min.calendar.locale=a.locale,a.$.calendarDropDown.min=a.min.toDate())}_validateRestrictedDates(){const e=this,t=[],a=[];for(let n=0;n<e.restrictedDates.length;n++){const i=e.restrictedDates[n];let o=Smart.Utilities.DateTime.validateDate(i,"invalid",e.formatString);"invalid"!==o&&(o=o.toTimeZone(e._outputTimeZone),t.push(o),a.push(o.toDate()))}e.restrictedDates=t,e.$.calendarDropDown.restrictedDates=a}_validateValue(e,t,a,n){const i=this,o=void 0!==t?t:i._cloneValue();if(null===e||""===e)return void i._setNullValue(o);if(e&&"string"==typeof e)if(-1===e.indexOf("-")&&-1===e.indexOf("/")&&-1===e.indexOf(".")){if(i.formatString){let t="",a=0;for(let n=0;n<i.formatString.length;n++)"-"===i.formatString[n]||"/"===i.formatString[n]||"."===i.formatString[n]?t+=i.formatString[n]:e[a]?(t+=e[a],a++):t+=i.formatString[n];if(t.indexOf("y")>=0){let e=t.substring(t.indexOf("y")-2);const a=i.yearCutoff.toString(),n=parseInt(a.slice(2),10);let o=parseInt(a.slice(0,2),10);e=parseInt(e,10),e<n&&o++,e=e.toString(),"NaN"!==e?(e=o+""+"0".repeat(2-e.length)+e,t=t.substring(0,t.indexOf("y")-2)+e):t=null}e=t}}else{let t=e.indexOf("-")>=0?"-":"";if(""===t&&(t=e.indexOf("/")>=0?"/":""),""===t&&(t=e.indexOf(".")>=0?".":""),t&&i.formatString.indexOf("yyyy")>=0){const a=e.split(t);let n=a[a.length-1];if(n.length<4){const o=i.yearCutoff.toString(),l=parseInt(o.slice(2),10);let r=parseInt(o.slice(0,2),10);n=parseInt(n,10),n<l&&r++,n=n.toString(),n=r+""+"0".repeat(2-n.length)+n,a[a.length-1]=n,e=a.join(t)}}}if(void 0!==e&&(i._value=Smart.Utilities.DateTime.validateDate(e,o,i.formatString)),null===i._value)return void i._setNullValue(o);let l=i._value;for(;!0===i._isRestricted(l);)l.addDays(1,!1);const r=i._rangeValidation(l);n&&"strict"!==i.validation?!1===l.equals(r)&&(i._minMaxChanged=!0):(i._value=r,delete i._minMaxChanged),i.value=i._value.toTimeZone(i._inputTimeZone);const s=i._value;if(s.calendar.days=i._localizedDays,s.calendar.months=i._localizedMonths,s.calendar.locale=i.locale,i._applyFormatString(),i._disableSpinButtons(),(null===o||null===s)&&o!==s||null!==o&&null!==s&&0!==o.compare(s)){if(!1!==a&&i.isInitialized&&!n&&(i.$.fireEvent("change",{oldValue:null!==o?o.toTimeZone(i._inputTimeZone):null,value:i.value}),i._updateTargetValue()),i._calendarInitiatedChange)return;i.opened?(null!==o&&0!==i.$.calendarDropDown.selectedDates.length&&o.year()===s.year()&&o.month()===s.month()&&o.day()===s.day()&&i.$.calendarDropDown._isDateInView(s.toDate())||(i._disregardCalendarChangeEvent=!0,i.$.calendarDropDown.selectedDates=[s.toDate()]),i._defaultFooterTemplateApplied&&(null!==o&&o.hour()===s.hour()||(i._hourElement.value=s.toString("hh"),i._ampmElement.value=s.toString("tt")),null!==o&&o.minute()===s.minute()||(i._minuteElement.value=s.toString("mm"))),i._timePickerInitialized&&!i._timePickerInitiatedChange&&(i.$.timePickerDropDown.value=s.toDate()),i._toSync=!1):i._toSync=!0}}});
70
70
 
71
71
  /***/ }),
72
72
 
@@ -80,7 +80,7 @@ Smart.Utilities.Assign("Draw",class{constructor(t,e){const i=this;i.host=t,i.ren
80
80
  /***/ 7650:
81
81
  /***/ (() => {
82
82
 
83
- Smart("smart-drop-down-list",class extends Smart.ContentElement{static get properties(){return{autoCloseDelay:{value:100,type:"number"},dataSource:{value:null,type:"any",reflectToAttribute:!1},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownButtonPosition:{allowedValues:["none","left","right","top","bottom"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownMinHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownOpenMode:{allowedValues:["none","default","dropDownButton","auto"],value:"default",type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPlaceholder:{value:"No Items",type:"string"},dropDownPosition:{allowedValues:["auto","top","bottom","overlay-top","overlay-center","overlay-bottom","center-bottom","center-top"],value:"auto",type:"string"},dropDownMinWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxWidth:{value:"",type:"any",validator:"_propertyValidator"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterCallback:{value:null,type:"function?"},filterMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},hint:{value:"",type:"string"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},inputMember:{value:"label",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},label:{value:"",type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{invalidNode:'{{elementType}}: Invalid parameter "{{node}}" when calling {{method}}.'}},type:"object"},name:{value:"",type:"string"},opened:{value:!1,type:"boolean"},placeholder:{value:"",type:"string"},resizeMode:{value:"none",allowedValues:["none","horizontal","vertical","both"],type:"string"},resizeIndicator:{value:!1,type:"boolean"},selectionDisplayMode:{value:"plain",allowedValues:["plain","placeholder","tokens"],type:"string"},selectionMode:{value:"zeroAndOne",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},tokenTemplate:{value:null,type:"any"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]}}}static get listeners(){return{"actionButton.down":"_buttonsDownHandler","actionButton.mouseenter":"_buttonsMouseEventsHandler","actionButton.mouseleave":"_buttonsMouseEventsHandler","actionButton.focus":"_buttonsFocusHandler","actionButton.blur":"_buttonsFocusHandler","document.selectstart":"_selectStartHandler","document.dragstart":"_dragStartHandler","document.down":"_documentDownHandler","document.up":"_documentUpHandler","document.move":"_documentMoveHandler","dropDownButton.down":"_buttonsDownHandler","dropDownButton.mouseenter":"_buttonsMouseEventsHandler","dropDownButton.mouseleave":"_buttonsMouseEventsHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",focus:"_focusEventHandler",blur:"_blurEventHandler","dropDownButton.focus":"_buttonsFocusHandler","dropDownButton.blur":"_buttonsFocusHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","listBox.change":"_listBoxChangeHandler","listBox.itemClick":"_listBoxItemClickHandler","listBox.keydown":"_listBoxKeyDownHandler","listBox.bindingComplete":"_bindingCompleteHandler",mouseenter:"_mouseEnterHandler",mouseleave:"_mouseLeaveHandler",resize:"_resizeHandler","resizeBar.move":"_resizeBarMoveHandler",styleChanged:"_styleChangedHandler",wheel:"_mouseWheelHandler"}}template(){return'<div id="container" role="presentation">\n <span class="smart-label" id="label">[[label]]</span>\n <div id="content" class="smart-content" role="presentation">\n <div class="smart-buttons-container" id="buttonsContainer" role="presentation">\n <span id="actionButton" class ="smart-action-button" role="presentation">[[placeholder]]</span>\n <span id="dropDownButton" class="smart-drop-down-button">\n <span class ="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n <div id="dropDownContainer" class="smart-drop-down smart-drop-down-container smart-visibility-hidden" role="presentation">\n <smart-list-box id="listBox" unfocusable\n animation="[[animation]]"\n data-source="[[dataSource]]"\n disabled="[[disabled]]"\n display-loading-indicator="[[displayLoadingIndicator]]"\n display-member="[[displayMember]]"\n filterable="[[filterable]]"\n filter-callback="[[filterCallback]]"\n filter-mode="[[filterMode]]"\n filter-input-placeholder="[[filterInputPlaceholder]]"\n grouped="[[grouped]]"\n group-member="[[groupMember]]"\n item-height="[[itemHeight]]"\n item-measure-mode="[[itemMeasureMode]]"\n item-template="[[itemTemplate]]"\n incremental-search-delay="[[incrementalSearchDelay]]"\n incremental-search-mode="[[incrementalSearchMode]]"\n loading-indicator-placeholder="[[loadingIndicatorPlaceholder]]"\n loading-indicator-position="[[loadingIndicatorPosition]]"\n name="[[name]]"\n placeholder="[[dropDownPlaceholder]]"\n right-to-left="[[rightToLeft]]"\n readonly="[[readonly]]"\n selected-indexes="{{selectedIndexes}}"\n selection-mode="[[selectionMode]]"\n selected-values="{{selectedValues}}"\n sorted="[[sorted]]"\n sort-direction="[[sortDirection]]"\n theme="[[theme]]"\n value-member="[[valueMember]]"\n horizontal-scroll-bar-visibility="[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility="[[verticalScrollBarVisibility]]"\n virtualized="[[virtualized]]">\n <content></content>\n </smart-list-box>\n <div id="resizeBar" class="smart-drop-down-resize-bar" aria-label="Resize">\n <div></div>\n </div>\n </div>\n </div>\n <span class="smart-hint smart-hidden" id="hint">[[hint]]</span>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>'}static get styleUrls(){return["smart.dropdownlist.css","smart.dropdown.css"]}propertyChangedHandler(e,t,o){super.propertyChangedHandler(e,t,o);const n=this;switch(e){case"animation":n.$.dropDownContainer.setAttribute("animation",n.animation);break;case"disabled":n._setFocusable(),n.close(),n._positionDetection.handleAutoPositioning();break;case"dataSource":case"displayMember":case"inputMember":n.$.actionButton&&(n.$.actionButton.innerHTML=n.placeholder),n._setDropDownSize(),n._positionDetection.checkBrowserBounds("vertically"),n._positionDetection.positionDropDown(),n._positionDetection.checkBrowserBounds("horizontally");break;case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownOpenMode":n._setFocusable(),n.$dropDownContainer.addClass("smart-visibility-hidden"),n.$.dropDownContainer.setAttribute("drop-down-open-mode",o),n.$.dropDownButton.removeAttribute("selected"),n.removeAttribute("drop-down-button-focus"),n.removeAttribute("action-button-focus"),n.opened=!1,n._ariaButton&&n._ariaButton.setAttribute("aria-expanded",!1),n._setAriaRelations();break;case"dropDownOverlay":o||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"dropDownMinWidth":case"dropDownWidth":case"dropDownMaxWidth":case"dropDownHeight":case"dropDownMinHeight":case"dropDownMaxHeight":n._setDropDownSize();break;case"filterable":n.$.listBox.filterable=o,n._dropDownSize&&"auto"===n._dropDownSize.height&&n._setDropDownSize();break;case"label":if(!n._ariaButton)return;o?n._ariaButton.setAttribute("aria-labelledby",n.$.label.id):"DropDownList"===n.elementName&&n._ariaButton.setAttribute("aria-labelledby",n.$.actionButton.id);break;case"opened":if(n.disabled||n.readonly)return;o?n.open():n.close();break;case"placeholder":case"selectionDisplayMode":n._applySelection();break;case"readonly":n.close();break;case"resizeIndicator":o?n.$.dropDownContainer.setAttribute("resize-indicator",""):n.$.dropDownContainer.removeAttribute("resize-indicator");break;case"resizeMode":n.$.dropDownContainer.setAttribute("resize-mode",n.resizeMode);break;case"selectedValues":case"selectedIndexes":0===o.length?n.$.actionButton.innerHTML=n.placeholder:n._applySelection(),n.$.hiddenInput.value=n.selectedValues.toString();break;case"selectionMode":n.$.listBox&&(n.$.listBox[e]=o,"checkBox"!==o&&"radioButton"!==o&&"checkBox"!==t&&"radioButton"!==t||n._setDropDownSize());break;case"tokenTemplate":n._tokenTemplate=n._validateTemplate(n.tokenTemplate),n._applySelection();break;case"unfocusable":n._setFocusable()}}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const o=e.dataset.property,n=e.value;o&&void 0!==t[o]&&(t[o]=n)}}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(t.$.listBox.appendChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}attached(){const e=this;super.attached(),e.isCompleted&&e.$.dropDownContainer&&(e._positionDetection.dropDownAttached("_setDropDownSize"),e._positionDetection.checkBrowserBounds(),e.selectedIndexes&&e._applySelection())}detached(){const e=this;super.detached(),e.$.dropDownContainer&&(e.close(),e._positionDetection&&e._positionDetection.dropDownDetached())}clearItems(){const e=this;e.$.listBox&&(e.$.listBox.clearItems(),e.$.actionButton.innerHTML=e.placeholder)}clearSelection(){const e=this;e.$.listBox&&(e.$.listBox.clearSelection(),e.$.actionButton.innerHTML=e.placeholder)}close(){const e=this;e.$dropDownContainer.hasClass("smart-visibility-hidden")||e.$.fireEvent("closing").defaultPrevented||(e.$dropDownContainer.addClass("smart-visibility-hidden"),e.$.fireEvent("close"),e.$.dropDownButton&&e.$.dropDownButton.removeAttribute("selected"),e.opened=!1,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!1),e._preventDropDownClose=!1,e._positionDetection.removeOverlay(!0),e.$.listBox.removeAttribute("focus"),e._edgeMacFF&&!e.hasAnimation&&e.$.dropDownContainer&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view")))}cloneNode(){const e=this;if(!e.$.listBox)return;let t=HTMLElement.prototype.cloneNode.apply(e,Array.prototype.slice.call(arguments,0,1));return t.dataSource=e.dataSource,t}ensureVisible(e){this.$.listBox&&this.$.listBox.ensureVisible(e)}getItem(e){if(this.$.listBox)return this.$.listBox.getItem(e)}get items(){const e=this;return e.$&&e.$.listBox?e.$.listBox.items:[]}get _focusedItem(){const e=this;return e.$&&e.$.listBox?e.$.listBox._focusedItem:null}insert(e,t){const o=this;o.$.listBox&&(o.$.listBox.insert(e,t),o._applySelection(),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize())}insertBefore(e,t){const o=this;if(!o.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(o,e.concat(Array.prototype.slice.call(arguments)))}e&&t?o.$.listBox&&(o.$.listBox.insertBefore(e,t),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize()):o.error(o.localize("invalidNode",{elementType:o.nodeName.toLowerCase(),method:"insertBefore",node:"newNode/referenceNode"}))}toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this,t=function(){for(let t=0;t<e.items.length;t++)if(!e.items[t].disabled)return e.items[t]};if(!e.disabled&&e.offsetHeight&&e.$dropDownContainer.hasClass("smart-visibility-hidden")){if(e.$dropDownContainer.hasClass("not-in-view")&&e.$dropDownContainer.removeClass("not-in-view"),e.$.dropDownContainer.style.transition=null,e.dropDownAppendTo){const t=e.getBoundingClientRect();if(e.$.container.contains(e.$.dropDownContainer)){let t=0;const o=setInterval((function(){const n=e.getBoundingClientRect();t++,n.top===e._positionTop&&t<10||(e.open(),clearInterval(o),e._positionTop=n.top)}),100);return}t.top!==e._positionTop&&(e._positionTop=t.top)}e.$.fireEvent("opening").defaultPrevented||(e._shadowDOMStylesDelay&&(e._setDropDownSize(),delete e._shadowDOMStylesDelay),e.opened=!0,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!0),e.$.listBox.setAttribute("focus",""),e._positionDetection.placeOverlay(),e._positionDetection.checkBrowserBounds("vertically"),e._positionDetection.positionDropDown(),e._positionDetection.checkBrowserBounds("horizontally"),e.$dropDownContainer.removeClass("smart-visibility-hidden"),e.$.fireEvent("open"),e.$.dropDownButton&&("dropDownButton"===e.dropDownOpenMode?e.$.dropDownButton.setAttribute("selected",""):e.$.dropDownButton.removeAttribute("selected")),(e.$.listBox&&!e._focusedItem||e._focusedItem&&!e._focusedItem._focused)&&(e.selectedIndexes.length>0?e._focus(e.items[e.selectedIndexes[0]]):e._focus(t)),e.$.input&&!Smart.Utilities.Core.isMobile&&e.$.input.focus())}}ready(){super.ready()}render(){const e=this;e.rightToLeft&&(e.dropDownButtonPosition="right"===e.dropDownButtonPosition?"left":"right"),e.classList.add("smart-drop-down-box"),e.$.dropDownContainer&&(e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.container,"close"),e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e._calculateDropDownSize(),e.$.dropDownContainer.setAttribute("resize-mode",e.resizeMode),e.$.dropDownContainer.setAttribute("drop-down-open-mode",e.dropDownOpenMode),e.resizeIndicator&&e.$.dropDownContainer.setAttribute("resize-indicator",""),e._positionDetection.handleAutoPositioning()),e.opened&&e.open(),e._positionTop=e.getBoundingClientRect().top,e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._edgeMacFF&&e.hasAnimation&&e.$.dropDownContainer&&e.$dropDownContainer.addClass("not-in-view"),e.$.label&&!e.$.label.id&&(e.$.label.id=e.id+"Label"),e.$.actionButton&&!e.$.actionButton.id&&(e.$.actionButton.id=e.id+"ActionButton"),e.$.hint&&!e.$.hint.id&&(e.$.hint.id=e.id+"Hint"),e._createElement(),super.render()}removeAt(e){const t=this;t.$.listBox&&(t.$.listBox.removeAt(e),t._applySelection(),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize())}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e&&e instanceof Smart.ListItem?(t.$.listBox.removeChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}get value(){const e=this;return e.isRendered&&e.$.listBox?e.$.listBox.value:null}set value(e){const t=this;return t.isRendered&&t.$.listBox?void(t.$.listBox.value=e):null}select(e){this.$.listBox&&this.$.listBox.select(e)}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.removeAttribute("tabindex"),e.$.actionButton.removeAttribute("tabindex"),void e.$.dropDownButton.removeAttribute("tabindex");let t=e.tabIndex>0?e.tabIndex:0;e.tabIndex=t,"dropDownButton"===e.dropDownOpenMode?(e.removeAttribute("tabindex"),e.$.actionButton.setAttribute("tabindex",t),e.$.dropDownButton.setAttribute("tabindex",t)):(e.$.actionButton.removeAttribute("tabindex"),e.$.dropDownButton.removeAttribute("tabindex"))}static get requires(){return{"Smart.ListBox":"smart.listbox.js"}}unselect(e){this.$.listBox&&this.$.listBox.unselect(e)}update(e,t){const o=this;o.$.listBox&&(o.$.listBox.update(e,t),o._applySelection())}_resizeBarMoveHandler(e){"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_createToken(){const e=this;let t,o=!1;const n=document.createDocumentFragment(),i=e.selectedIndexes[e.selectedIndexes.length-1];"plain"!==e.selectionDisplayMode||"one"!==e.selectionMode&&"zeroAndOne"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode&&"radioButton"!==e.selectionMode?"tokens"===e.selectionDisplayMode?1===e.selectedIndexes.length&&["oneOrManyExtended","oneOrMany","zeroAndOne","one","radioButton"].indexOf(e.selectionMode)>-1?t="":(t="&#10006",o=!0):t=1===e.selectedIndexes.length?"":",":t="";const r=e.selectedIndexes,a=e.$.listBox._items;for(let s=0;s<r.length;s++){const l=r[s];a[l]&&n.appendChild(e._applyTokenTemplate(a[l][e.inputMember],"tokens"!==e.selectionDisplayMode&&l===i?"":t,o))}return n}_applySelection(){const e=this;if("placeholder"!==e.selectionDisplayMode&&0!==e.selectedIndexes.length){if(e.$.listBox._items&&0!==e.$.listBox._items.length){if("plain"===e.selectionDisplayMode){const t=e.$.listBox.selectedIndexes,o=e.$.listBox._items;let n=[];for(let i=0;i<t.length;i++){const r=t[i];o[r]&&n.push(o[r][e.inputMember])}return e.$.actionButton.innerHTML=n.length?`<span class="smart-token">${n.join(", ").trim()}</span>`:"",void(e.$.hiddenInput.value=e.selectedValues.toString())}e.$.actionButton.innerHTML="",e.$.actionButton.appendChild(e._createToken()),e.$.hiddenInput.value=e.selectedValues.toString()}}else e.$.actionButton.innerHTML=e.placeholder}_applyTokenTemplate(e,t,o){const n=this,i=document.createElement("span"),r=function(){return"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+e+`</span><span class='smart-drop-down-list-unselect-button' role="button"${o?' aria-label="Unselect"':""}>${t}</span>`};if(i.classList.add("smart-token"),n._tokenTemplate){let e=document.importNode(n._tokenTemplate.content,!0);const t=e.childNodes.length,o=/{{\w+}}/g;let a;for(let n=0;n<t;n++)a=o.exec(e.childNodes[n].innerHTML),a&&(e.childNodes[n].innerHTML=e.childNodes[n].innerHTML.replace(a[0],r())),e.childNodes[n].outerHTML&&(i.innerHTML+=e.childNodes[n].outerHTML)}else"function"==typeof n.tokenTemplate?n.tokenTemplate(i,{label:e,iconSeparator:t}):i.innerHTML=r();return i}_bindingCompleteHandler(){const e=this;e.$.listBox&&requestAnimationFrame((()=>{e._setDropDownSize(),e._positionDetection.checkBrowserBounds()}))}_buttonsDownHandler(e){const t=this;if(!t.disabled){if(t.hasRippleAnimation)if(t.$.buttonsContainer&&"dropDownButton"!==t.dropDownOpenMode){const o=t.$.buttonsContainer;o.firstElementChild.noRipple=!0,Smart.Utilities.Animation.Ripple.animate(o,e.pageX,e.pageY),o.firstElementChild.noRipple=!1}else Smart.Utilities.Animation.Ripple.animate(e.target,e.pageX,e.pageY);t._preventsSelectStart=!0,t.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.actionButton&&t.$.actionButton.setAttribute("active",""),t.opened&&(t._preventDropDownClose=!0)}}_buttonsMouseEventsHandler(e){const t=this;t.disabled||("mouseenter"===e.type?(t.setAttribute("hover",""),e.target.setAttribute("hover",""),"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.dropDownButton&&t.setAttribute("drop-down-button-hover","")):(t.removeAttribute("hover"),t.removeAttribute("drop-down-button-hover"),e.target.removeAttribute("hover")))}_calculateDropDownSize(){const e=this;e._dropDownSize={};const t=window.getComputedStyle(e.$.dropDownContainer),o=parseFloat(t.getPropertyValue("border-top-width").trim()),n=parseFloat(t.getPropertyValue("border-bottom-width").trim()),i=parseFloat(t.getPropertyValue("margin-top").trim()),r=parseFloat(t.getPropertyValue("margin-bottom").trim()),a=parseFloat(t.getPropertyValue("padding-top").trim()),s=parseFloat(t.getPropertyValue("padding-bottom").trim());Smart.Utilities.Core.CSSVariablesSupport()&&(e._dropDownSize.width=t.getPropertyValue("--smart-drop-down-list-drop-down-width").trim(),e._dropDownSize.height=t.getPropertyValue("--smart-drop-down-list-drop-down-height").trim()),(!e._dropDownSize.width||e._dropDownSize.width.indexOf("initial")>-1)&&(e._dropDownSize.width=e.offsetWidth),e._dropDownSize.height||(e._dropDownSize.height="auto"),e._dropDownSize.minHeight=parseFloat(t.getPropertyValue("min-height").trim()),e._dropDownSize.maxHeight=parseFloat(t.getPropertyValue("max-height").trim()),e._dropDownSize.borderWidth=(isNaN(o)?0:o)+(isNaN(n)?0:n),e._dropDownSize.paddingWidth=(isNaN(a)?0:a)+(isNaN(s)?0:s),e._dropDownSize.marginWidth=(isNaN(i)?0:i)+(isNaN(r)?0:r)}_createElement(){const e=this;e._tokenTemplate=e._validateTemplate(e.tokenTemplate),e._applySelection(),e._setDropDownSize(),e._setFocusable(),e.$.arrow.noRipple=!0,e._shadowDOMStylesDelay=e.shadowRoot,e._setAriaRelations(!0)}_documentDownHandler(e){const t=this;if(t.disabled||t.readonly)return;let o=e.originalEvent.target;if(o===t._overlay&&(t._overlayDown=!0),t.shadowRoot){o=e.originalEvent.composedPath()[0];let n=o.getRootNode().host;for(;n;)n.closest(".smart-drop-down-container")===t.$.dropDownContainer&&(t._isDropDownClicked=!0),n=n.getRootNode().host}else t.isInShadowDOM&&(o=e.originalEvent.composedPath()[0]),t._isDropDownClicked=o.closest(".smart-drop-down-container")===t.$.dropDownContainer;if(t._buttonClicked=o.closest(".smart-action-button")||o.closest(".smart-drop-down-button"),t.$.listBox){let n=o.closest("smart-list-item");t.$.listBox.contains(n)||(n=void 0),t.hasRippleAnimation&&n&&Smart.Utilities.Animation.Ripple.animate(n,e.pageX,e.pageY),(n||o===t.$.listBox.$.filterInput||o.closest(".smart-token"))&&(t._preventDropDownClose=!0)}if(t._isDropDownClicked&&(t._preventDropDownClose=!0),o!==t.$.resizeBar||"none"===t.resizeMode)return;t._resizeDetails||(t._resizeDetails={});const n=t.$.dropDownContainer.getBoundingClientRect();t._resizeDetails.started=!0,t._resizeDetails.x=e.pageX,t._resizeDetails.y=e.pageY,t._resizeDetails.width=t.$.dropDownContainer.offsetWidth,t._resizeDetails.height=t.$.dropDownContainer.offsetHeight,t._resizeDetails.offsetXL=e.clientX-n.left,t._resizeDetails.offsetXR=n.left+t.$.dropDownContainer.offsetWidth-e.clientX,t._resizeDetails.offsetY=n.top+t.$.dropDownContainer.offsetHeight-e.clientY,t._resizeDetails.offsetYtop=e.clientY-n.top,t._preventDropDownClose=!0}_documentMoveHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if("auto"===t.dropDownOpenMode&&null!==t.dropDownAppendTo&&(t.contains(o)||t.$.dropDownContainer.contains(o)?t._isElementHovered=!0:(t._isElementHovered=!1,t._autoClose())),!t._resizeDetails||t._resizeDetails&&!t._resizeDetails.started)return;t.setAttribute("resizing",""),t._resizeDetails.resizeEventFired||(t.$.fireEvent("resizeStart",{position:{left:e.pageX,top:e.pageY}}),t._resizeDetails.resizeEventFired=!0);const n=document.documentElement,i=t.$.dropDownContainer.getBoundingClientRect(),r=t.getBoundingClientRect(),a=t.$.dropDownContainer.hasAttribute("top")?"top":"bottom";let s;function l(){if(s=e.pageY-t._resizeDetails.y,"bottom"===a)t._resizeDetails.height=Math.min(n.clientHeight-i.top-6,Math.max(0,t._resizeDetails.height+s)),t._resizeDetails.y=Math.max(i.top+n.scrollTop-t._resizeDetails.offsetY,Math.min(n.clientHeight+n.scrollTop-1.5*t._resizeDetails.offsetY,e.pageY));else{if(t._resizeDetails.height=Math.min(t._dropDownSize.maxHeight,Math.max(0,Math.min(r.top,t._resizeDetails.height-s))),s=Math.max(0,i.top+(i.height-Math.max(t._dropDownSize.minHeight,t._resizeDetails.height))),t.dropDownAppendTo){const e=Math.abs(parseFloat(getComputedStyle(t.$.dropDownContainer).getPropertyValue("margin-bottom")))||0;t.$.dropDownContainer.style.top=t.dropDownAppendTo?e+s+"px":""}const o=r.top+n.scrollTop+t._resizeDetails.offsetYtop;t._resizeDetails.y=Math.max(t._resizeDetails.offsetYtop,Math.min(o,Math.max(o-t._dropDownSize.maxHeight,e.pageY)))}t.$.dropDownContainer.style.height=t._resizeDetails.height+"px"}function d(){s=e.pageX-t._resizeDetails.x,t._resizeDetails.width=Math.min(n.clientWidth-i.left-6,Math.max(0,t._resizeDetails.width+s)),t.$.dropDownContainer.style.width=t._resizeDetails.width+"px",t._resizeDetails.x=Math.max(i.left+n.scrollLeft-t._resizeDetails.offsetXR,Math.min(n.clientWidth+n.scrollLeft-1.5*t._resizeDetails.offsetXR,e.pageX))}switch(t.resizeMode){case"vertical":l();break;case"horizontal":d();break;case"both":d(),l()}}_documentUpHandler(e){const t=this;if(t.$.actionButton.removeAttribute("active"),t._resizeDetails&&t._resizeDetails.started)return t._resizeDetails.started=t._resizeDetails.resizeEventFired=!1,t.removeAttribute("resizing"),t._preventDropDownClose=!1,t.focus(),void t.$.fireEvent("resizeEnd",{position:{left:e.pageX,top:e.pageY}});if(t.disabled||t._isDropDownClicked||t.readonly)return void delete t._isDropDownClicked;if(t._overlayDown)return t.close(),void delete t._overlayDown;let o=e.originalEvent.target,n=o.closest?o.closest("smart-drop-down-list"):void 0;if((t.enableShadowDOM||t.isInShadowDOM)&&(o=e.originalEvent.composedPath()[0],n=o.getRootNode().host),t._preventsSelectStart=!1,void 0===o||o===t.$.resizeBar)return;if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-selection-label")&&n===t){"none"!==t.dropDownOpenMode&&t.open();let e=t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.textContent))[0];return t.$.listBox._scrollView.scrollTop=e.offsetTop,void t._focus(e)}if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-unselect-button")&&n===t){if(1===t.selectedIndexes.length&&["zeroOrMany","zeroOrOne","checkBox"].indexOf(t.selectionMode)<0)return;return void t.unselect(t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.previousElementSibling.textContent))[0])}const i=!(!o||!o.closest)&&o.closest(".smart-action-button");let r;if(t._buttonClicked&&("dropDownButton"===t.dropDownOpenMode&&i&&t._buttonClicked===t.$.actionButton?t.$.fireEvent("actionButtonClick"):o.closest(".smart-drop-down-button")!==t._buttonClicked&&i!==t._buttonClicked||(r=!0,t.$.fireEvent("dropDownButtonClick"))),t._buttonClicked=void 0,i===t.$.actionButton||o&&o.closest&&o.closest(".smart-drop-down-button")===t.$.dropDownButton)return"dropDownButton"===t.dropDownOpenMode&&i===t.$.actionButton?void t.close():void(t.$dropDownContainer.hasClass("smart-visibility-hidden")&&"none"!==t.dropDownOpenMode&&r&&"pointercancel"!==e.originalEvent.type?t.open():t.close());o=t._getUpEventTarget(o),void 0!==o&&("dropDownContainer"!==o&&"item"!==o||"item"===o&&"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0)&&t.close()}_dragStartHandler(e){this._resizeDetails&&this._resizeDetails.started&&e.preventDefault()}_dropDownTransitionendHandler(){const e=this;e._edgeMacFF&&!e.opened&&e.hasAnimation&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view"))}_focus(e){this.$.listBox._focus(e)}_blurEventHandler(){const e=this;e.$.dropDownButton&&(e.removeAttribute("focus"),e.$.dropDownButton.removeAttribute("focus")),e.$.actionButton&&(e.removeAttribute("focus"),e.$.actionButton.removeAttribute("focus")),e.nodeName&&"smart-drop-down-list"===e.nodeName.toLowerCase()&&!e._preventDropDownClose&&e.close()}_focusEventHandler(){const e=this;e.$.dropDownButton&&(e.setAttribute("focus",""),e.$.dropDownButton.setAttribute("focus","")),e.$.actionButton&&(e.setAttribute("focus",""),e.$.actionButton.setAttribute("focus","")),e.removeAttribute("drop-down-button-focus"),e.removeAttribute("action-button-focus")}_buttonsFocusHandler(e){const t=this;e.target===t.$.dropDownButton?"focus"===e.type?t.setAttribute("drop-down-button-focus",""):(t.removeAttribute("drop-down-button-focus"),t.nodeName&&"smart-drop-down-list"===t.nodeName.toLowerCase()&&!t._preventDropDownClose&&t.close()):"focus"===e.type?t.setAttribute("action-button-focus",""):t.removeAttribute("action-button-focus")}_getUpEventTarget(e){const t=this;let o=e;for(o=void 0===o.parentElement?o.getRootNode().host:o.parentElement;o;){if(o===t.$.dropDownContainer){o="dropDownContainer";break}o=void 0===o.parentElement?o.getRootNode().host:o.parentElement}return o}_keyDownHandler(e){const t=this,o=t.enableShadowDOM&&t.shadowRoot.activeElement||document.activeElement,n=t.enableShadowDOM?e.composedPath()[0]:e.target;if(!(t.$.listBox&&n===t.$.listBox.$.filterInput||o!==t&&o!==t.$.dropDownButton&&o!==t.$.actionButton)||"Tab"===e.key)switch(e.key){case"Tab":if(t.filterable&&t.opened){const o=function(){for(let e=0;e<t.items.length;e++)if(!t.items[e].disabled)return t.items[e]};t.$.listBox.$.filterInput&&!Smart.Utilities.Core.isMobile&&document.activeElement!==t.$.listBox.$.filterInput?(t.$.listBox.$.filterInput.focus(),t._preventDropDownClose=!0):t.$.listBox&&(t.focus(),t.selectedIndexes.length>0?t._focus(t.items[t.selectedIndexes[0]]):t._focus(o),t._preventDropDownClose=!0),e.preventDefault()}break;case"Enter":case" ":e.preventDefault(),n!==t.$.actionButton&&(t._keyPressed=!0,t.opened?(t._focusedItem&&t.select(t._focusedItem),("Enter"===e.key&&["none"].indexOf(t.selectionMode)<0||" "===e.key&&["none","zeroAndOne","one","radioButton"].indexOf(t.selectionMode)>-1)&&t.close()):t.opened||t.readonly||"none"===t.dropDownOpenMode||t.open()),"dropDownButton"===t.dropDownOpenMode&&n.setAttribute("active","");break;case"End":case"Home":case"PageUp":case"PageDown":case"ArrowUp":case"ArrowDown":if(t.readonly)return;if(e.altKey)return t._keyPressed=!1,void(t.$dropDownContainer.hasClass("smart-visibility-hidden")?t.open():t.close());e.preventDefault(),t.$.listBox._handleKeyStrokes(e.key);break;case"Escape":e.preventDefault(),t.close();break;default:if(t.readonly)return;"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!0),t.$.listBox._applyIncrementalSearch(e.key)}}_keyUpHandler(e){const t=this,o=t.enableShadowDOM?e.composedPath()[0]:e.target;t.$.listBox&&o===t.$.listBox.$.filterInput||("Enter"!==e.key&&" "!==e.key||(o.removeAttribute("active"),t.$dropDownContainer.hasClass("smart-visibility-hidden")||(t._keyPressed=!1)),t.$.listBox&&"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!1))}_listBoxChangeHandler(e){const t=this;if(e.target===t.$.listBox){if((t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent("change",e.detail),"list"===t.autoComplete&&e.detail){const o=t.$.listBox._items[e.detail.index];t._lastSelectedItem=o&&o.selected?o:void 0}t._applySelection(t.selectionMode,e.detail),t._updateTargetValue()}else e.stopPropagation()}_listBoxItemClickHandler(e){const t=this;(t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent(e.type,e.detail),"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0&&t.close(),Smart.Utilities.Core.isMobile||t.focus(),delete t._isDropDownClicked}_listBoxKeyDownHandler(e){const t=this;if("Enter"===e.key)return t.close(),"dropDownButton"===t.dropDownOpenMode?t.$.dropDownButton.focus():t.focus(),void e.stopPropagation();"Escape"!==e.key||t.close()}_mouseEnterHandler(){const e=this;e._isElementHovered=!0,e.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"auto"===e.dropDownOpenMode&&!e.disabled&&!e.readonly&&e.open()}_mouseLeaveHandler(){const e=this;e.removeAttribute("hover"),e._isElementHovered=!1,"auto"!==e.dropDownOpenMode||e.disabled||e.readonly||e._autoClose()}_mouseWheelHandler(e){const t=this;t.disabled||t.readonly||t.items&&0===t.items.length||t.$dropDownContainer&&!t.$dropDownContainer.hasClass("smart-visibility-hidden")||t.$.listBox&&(e.preventDefault(),t.$.listBox._handleKeyStrokes(e.deltaY>0?"ArrowDown":"ArrowUp"))}_autoClose(){const e=this;e._autoCloseTimeout=setTimeout(function(){e._isElementHovered||e.close(),clearTimeout(e._autoCloseTimeout)}.bind(e),e.autoCloseDelay)}_propertyValidator(e,t){return"number"!=typeof t&&"string"!=typeof t?e:t}_resizeHandler(){this.refresh()}refresh(){const e=this;"none"===e.resizeMode&&(e._calculateDropDownSize(),e._setDropDownSize())}_selectStartHandler(e){this._preventsSelectStart&&e.preventDefault()}_setAriaRelations(e){const t=this;let o,n;"dropDownButton"!==t.dropDownOpenMode?(o=t.$.dropDownButton,o.setAttribute("aria-hidden",!0),n=t,t.$.actionButton.removeAttribute("role")):(o=t,n=t.$.dropDownButton,n.removeAttribute("aria-hidden"),t.$.actionButton.setAttribute("role","button")),t._ariaButton=n,n.setAttribute("role","button"),n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-owns",t.$.listBox.id),n.setAttribute("aria-describedby",t.$.hint.id),t.label?n.setAttribute("aria-labelledby",t.$.label.id):"DropDownList"===t.elementName&&n.setAttribute("aria-labelledby",t.$.actionButton.id),o.setAttribute("role","presentation"),o.removeAttribute("aria-owns"),e?n.setAttribute("aria-expanded",t.opened):(o.removeAttribute("aria-describedby"),o.removeAttribute("aria-expanded"),o.removeAttribute("aria-haspopup"),o.removeAttribute("aria-labelledby"))}_setDropDownSize(){const e=this,t=e.$.listBox;let o;if(e._dropDownSize||e._calculateDropDownSize(),["dropDownMinWidth","dropDownMaxWidth"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]="initial"===e[t]?e.offsetWidth+"px":e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),["dropDownMinHeight","dropDownMaxHeight"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]=e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),e.dropDownWidth?"auto"!==e.dropDownWidth?e.$.dropDownContainer.style.width=("initial"===e.dropDownWidth?e.offsetWidth:parseFloat(e.dropDownWidth))+"px":e.$.dropDownContainer.style.width="auto":e.$.dropDownContainer.style.width="auto"===e._dropDownSize.width?"auto":(parseFloat(e._dropDownSize.width)||0)+"px",e.dropDownHeight&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=parseFloat(e.dropDownHeight)+((e.dropDownHeight+"").indexOf("%")>-1?"%":"px");else if(!e.$.listBox||"auto"!==e._dropDownSize.height&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=e._dropDownSize.height;else{e.$.dropDownContainer.style.height="";let n=0;if(t.$.itemsContainer&&(n=2*parseInt(window.getComputedStyle(t.$.itemsContainer).getPropertyValue("--smart-list-item-vertical-offset"))),isNaN(n)&&(n=6),o=n,t.items&&t.items.length>0?t.items.map((e=>o+=e.height||e.offsetHeight)):o=t.$.placeholder?t.$.placeholder.offsetHeight:200,e.filterable){const e=t.$.filterInputContainer;o+=e.offsetHeight+e.offsetTop}o=o+e._dropDownSize.paddingWidth+e._dropDownSize.borderWidth,e.$.dropDownContainer.style.height=o+"px"}if(t){if(void 0===o||!t.$)return void t._refreshLayout();const n=t.$.horizontalScrollBar?t.$.horizontalScrollBar.offsetHeight:0,i=Math.max(0,e._dropDownSize.minHeight-(o-n));i&&(e.$.dropDownContainer.style.height=o+i+"px"),!e.opened&&e.virtualized&&t.refresh()}}_styleChangedHandler(e){const t=this;if(t.dropDownAppendTo){const o=e.detail.styleProperties,n=["font-size","font-family","font-style","font-weight"];for(let e=0;e<n.length;e++)o[n[e]]&&(t.$.dropDownContainer.style[n[e]]=o[n[e]].value)}"auto"===t._dropDownSize.height&&t._setDropDownSize()}_validateTemplate(e){const t=this;if(e&&"function"!=typeof e)if("content"in document.createElement("template")){if(e instanceof HTMLTemplateElement||(e=document.getElementById(e)),null!==e&&"content"in e)return e;t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"tokenTemplate"}))}else t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()}))}});
83
+ Smart("smart-drop-down-list",class extends Smart.ContentElement{static get properties(){return{autoCloseDelay:{value:100,type:"number"},dataSource:{value:null,type:"any",reflectToAttribute:!1},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownButtonPosition:{allowedValues:["none","left","right","top","bottom"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownMinHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownOpenMode:{allowedValues:["none","default","dropDownButton","auto"],value:"default",type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPlaceholder:{value:"No Items",type:"string"},dropDownPosition:{allowedValues:["auto","top","bottom","overlay-top","overlay-center","overlay-bottom","center-bottom","center-top"],value:"auto",type:"string"},dropDownMinWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxWidth:{value:"",type:"any",validator:"_propertyValidator"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterCallback:{value:null,type:"function?"},filterMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},hint:{value:"",type:"string"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},inputMember:{value:"label",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},label:{value:"",type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{invalidNode:'{{elementType}}: Invalid parameter "{{node}}" when calling {{method}}.'}},type:"object"},name:{value:"",type:"string"},opened:{value:!1,type:"boolean"},placeholder:{value:"",type:"string"},resizeMode:{value:"none",allowedValues:["none","horizontal","vertical","both"],type:"string"},resizeIndicator:{value:!1,type:"boolean"},selectionDisplayMode:{value:"plain",allowedValues:["plain","placeholder","tokens"],type:"string"},selectionMode:{value:"zeroAndOne",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},tokenTemplate:{value:null,type:"any"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]}}}static get listeners(){return{"actionButton.down":"_buttonsDownHandler","actionButton.mouseenter":"_buttonsMouseEventsHandler","actionButton.mouseleave":"_buttonsMouseEventsHandler","actionButton.focus":"_buttonsFocusHandler","actionButton.blur":"_buttonsFocusHandler","document.selectstart":"_selectStartHandler","document.dragstart":"_dragStartHandler","document.down":"_documentDownHandler","document.up":"_documentUpHandler","document.move":"_documentMoveHandler","dropDownButton.down":"_buttonsDownHandler","dropDownButton.mouseenter":"_buttonsMouseEventsHandler","dropDownButton.mouseleave":"_buttonsMouseEventsHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",focus:"_focusEventHandler",blur:"_blurEventHandler","dropDownButton.focus":"_buttonsFocusHandler","dropDownButton.blur":"_buttonsFocusHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","listBox.change":"_listBoxChangeHandler","listBox.itemClick":"_listBoxItemClickHandler","listBox.keydown":"_listBoxKeyDownHandler","listBox.bindingComplete":"_bindingCompleteHandler","listBox.scrollBottomReached":"_scrollBottomReachedHandler","listBox.scrollTopReached":"_scrollTopReachedHandler",mouseenter:"_mouseEnterHandler",mouseleave:"_mouseLeaveHandler",resize:"_resizeHandler","resizeBar.move":"_resizeBarMoveHandler",styleChanged:"_styleChangedHandler",wheel:"_mouseWheelHandler"}}template(){return'<div id="container" role="presentation">\n <span class="smart-label" id="label">[[label]]</span>\n <div id="content" class="smart-content" role="presentation">\n <div class="smart-buttons-container" id="buttonsContainer" role="presentation">\n <span id="actionButton" class ="smart-action-button" role="presentation">[[placeholder]]</span>\n <span id="dropDownButton" class="smart-drop-down-button">\n <span class ="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n <div id="dropDownContainer" class="smart-drop-down smart-drop-down-container smart-visibility-hidden" role="presentation">\n <smart-list-box id="listBox" unfocusable\n animation="[[animation]]"\n data-source="[[dataSource]]"\n disabled="[[disabled]]"\n display-loading-indicator="[[displayLoadingIndicator]]"\n display-member="[[displayMember]]"\n filterable="[[filterable]]"\n filter-callback="[[filterCallback]]"\n filter-mode="[[filterMode]]"\n filter-input-placeholder="[[filterInputPlaceholder]]"\n grouped="[[grouped]]"\n group-member="[[groupMember]]"\n item-height="[[itemHeight]]"\n item-measure-mode="[[itemMeasureMode]]"\n item-template="[[itemTemplate]]"\n incremental-search-delay="[[incrementalSearchDelay]]"\n incremental-search-mode="[[incrementalSearchMode]]"\n loading-indicator-placeholder="[[loadingIndicatorPlaceholder]]"\n loading-indicator-position="[[loadingIndicatorPosition]]"\n name="[[name]]"\n placeholder="[[dropDownPlaceholder]]"\n right-to-left="[[rightToLeft]]"\n readonly="[[readonly]]"\n selected-indexes="{{selectedIndexes}}"\n selection-mode="[[selectionMode]]"\n selected-values="{{selectedValues}}"\n sorted="[[sorted]]"\n sort-direction="[[sortDirection]]"\n theme="[[theme]]"\n value-member="[[valueMember]]"\n horizontal-scroll-bar-visibility="[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility="[[verticalScrollBarVisibility]]"\n virtualized="[[virtualized]]">\n <content></content>\n </smart-list-box>\n <div id="resizeBar" class="smart-drop-down-resize-bar" aria-label="Resize">\n <div></div>\n </div>\n </div>\n </div>\n <span class="smart-hint smart-hidden" id="hint">[[hint]]</span>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>'}static get styleUrls(){return["smart.dropdownlist.css","smart.dropdown.css"]}propertyChangedHandler(e,t,o){super.propertyChangedHandler(e,t,o);const n=this;switch(e){case"animation":n.$.dropDownContainer.setAttribute("animation",n.animation);break;case"disabled":n._setFocusable(),n.close(),n._positionDetection.handleAutoPositioning();break;case"dataSource":case"displayMember":case"inputMember":n.$.actionButton&&(n.$.actionButton.innerHTML=n.placeholder),n._setDropDownSize(),n._positionDetection.checkBrowserBounds("vertically"),n._positionDetection.positionDropDown(),n._positionDetection.checkBrowserBounds("horizontally");break;case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownOpenMode":n._setFocusable(),n.$dropDownContainer.addClass("smart-visibility-hidden"),n.$.dropDownContainer.setAttribute("drop-down-open-mode",o),n.$.dropDownButton.removeAttribute("selected"),n.removeAttribute("drop-down-button-focus"),n.removeAttribute("action-button-focus"),n.opened=!1,n._ariaButton&&n._ariaButton.setAttribute("aria-expanded",!1),n._setAriaRelations();break;case"dropDownOverlay":o||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"dropDownMinWidth":case"dropDownWidth":case"dropDownMaxWidth":case"dropDownHeight":case"dropDownMinHeight":case"dropDownMaxHeight":n._setDropDownSize();break;case"filterable":n.$.listBox.filterable=o,n._dropDownSize&&"auto"===n._dropDownSize.height&&n._setDropDownSize();break;case"label":if(!n._ariaButton)return;o?n._ariaButton.setAttribute("aria-labelledby",n.$.label.id):"DropDownList"===n.elementName&&n._ariaButton.setAttribute("aria-labelledby",n.$.actionButton.id);break;case"opened":if(n.disabled||n.readonly)return;o?n.open():n.close();break;case"placeholder":case"selectionDisplayMode":n._applySelection();break;case"readonly":n.close();break;case"resizeIndicator":o?n.$.dropDownContainer.setAttribute("resize-indicator",""):n.$.dropDownContainer.removeAttribute("resize-indicator");break;case"resizeMode":n.$.dropDownContainer.setAttribute("resize-mode",n.resizeMode);break;case"selectedValues":case"selectedIndexes":0===o.length?n.$.actionButton.innerHTML=n.placeholder:n._applySelection(),n.$.hiddenInput.value=n.selectedValues.toString();break;case"selectionMode":n.$.listBox&&(n.$.listBox[e]=o,"checkBox"!==o&&"radioButton"!==o&&"checkBox"!==t&&"radioButton"!==t||n._setDropDownSize());break;case"tokenTemplate":n._tokenTemplate=n._validateTemplate(n.tokenTemplate),n._applySelection();break;case"unfocusable":n._setFocusable()}}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const o=e.dataset.property,n=e.value;o&&void 0!==t[o]&&(t[o]=n)}}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(t.$.listBox.appendChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}attached(){const e=this;super.attached(),e.isCompleted&&e.$.dropDownContainer&&(e._positionDetection.dropDownAttached("_setDropDownSize"),e._positionDetection.checkBrowserBounds(),e.selectedIndexes&&e._applySelection())}detached(){const e=this;super.detached(),e.$.dropDownContainer&&(e.close(),e._positionDetection&&e._positionDetection.dropDownDetached())}clearItems(){const e=this;e.$.listBox&&(e.$.listBox.clearItems(),e.$.actionButton.innerHTML=e.placeholder)}clearSelection(){const e=this;e.$.listBox&&(e.$.listBox.clearSelection(),e.$.actionButton.innerHTML=e.placeholder)}close(){const e=this;e.$dropDownContainer.hasClass("smart-visibility-hidden")||e.$.fireEvent("closing").defaultPrevented||(e.$dropDownContainer.addClass("smart-visibility-hidden"),e.$.fireEvent("close"),e.$.dropDownButton&&e.$.dropDownButton.removeAttribute("selected"),e.opened=!1,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!1),e._preventDropDownClose=!1,e._positionDetection.removeOverlay(!0),e.$.listBox.removeAttribute("focus"),e._edgeMacFF&&!e.hasAnimation&&e.$.dropDownContainer&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view")))}cloneNode(){const e=this;if(!e.$.listBox)return;let t=HTMLElement.prototype.cloneNode.apply(e,Array.prototype.slice.call(arguments,0,1));return t.dataSource=e.dataSource,t}ensureVisible(e){this.$.listBox&&this.$.listBox.ensureVisible(e)}getItem(e){if(this.$.listBox)return this.$.listBox.getItem(e)}get items(){const e=this;return e.$&&e.$.listBox?e.$.listBox.items:[]}get _focusedItem(){const e=this;return e.$&&e.$.listBox?e.$.listBox._focusedItem:null}insert(e,t){const o=this;o.$.listBox&&(o.$.listBox.insert(e,t),o._applySelection(),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize())}insertBefore(e,t){const o=this;if(!o.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(o,e.concat(Array.prototype.slice.call(arguments)))}e&&t?o.$.listBox&&(o.$.listBox.insertBefore(e,t),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize()):o.error(o.localize("invalidNode",{elementType:o.nodeName.toLowerCase(),method:"insertBefore",node:"newNode/referenceNode"}))}toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this,t=function(){for(let t=0;t<e.items.length;t++)if(!e.items[t].disabled)return e.items[t]};if(!e.disabled&&e.offsetHeight&&e.$dropDownContainer.hasClass("smart-visibility-hidden")){if(e.$dropDownContainer.hasClass("not-in-view")&&e.$dropDownContainer.removeClass("not-in-view"),e.$.dropDownContainer.style.transition=null,e.dropDownAppendTo){const t=e.getBoundingClientRect();if(e.$.container.contains(e.$.dropDownContainer)){let t=0;const o=setInterval((function(){const n=e.getBoundingClientRect();t++,n.top===e._positionTop&&t<10||(e.open(),clearInterval(o),e._positionTop=n.top)}),100);return}t.top!==e._positionTop&&(e._positionTop=t.top)}e.$.fireEvent("opening").defaultPrevented||(e._shadowDOMStylesDelay&&(e._setDropDownSize(),delete e._shadowDOMStylesDelay),e.opened=!0,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!0),e.$.listBox.setAttribute("focus",""),e._positionDetection.placeOverlay(),e._positionDetection.checkBrowserBounds("vertically"),e._positionDetection.positionDropDown(),e._positionDetection.checkBrowserBounds("horizontally"),e.$dropDownContainer.removeClass("smart-visibility-hidden"),e.$.fireEvent("open"),e.$.dropDownButton&&("dropDownButton"===e.dropDownOpenMode?e.$.dropDownButton.setAttribute("selected",""):e.$.dropDownButton.removeAttribute("selected")),(e.$.listBox&&!e._focusedItem||e._focusedItem&&!e._focusedItem._focused)&&(e.selectedIndexes.length>0?e._focus(e.items[e.selectedIndexes[0]]):e._focus(t)),e.$.input&&!Smart.Utilities.Core.isMobile&&e.$.input.focus())}}ready(){super.ready()}render(){const e=this;e.rightToLeft&&(e.dropDownButtonPosition="right"===e.dropDownButtonPosition?"left":"right"),e.classList.add("smart-drop-down-box"),e.$.dropDownContainer&&(e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.container,"close"),e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e._calculateDropDownSize(),e.$.dropDownContainer.setAttribute("resize-mode",e.resizeMode),e.$.dropDownContainer.setAttribute("drop-down-open-mode",e.dropDownOpenMode),e.resizeIndicator&&e.$.dropDownContainer.setAttribute("resize-indicator",""),e._positionDetection.handleAutoPositioning()),e.opened&&e.open(),e._positionTop=e.getBoundingClientRect().top,e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._edgeMacFF&&e.hasAnimation&&e.$.dropDownContainer&&e.$dropDownContainer.addClass("not-in-view"),e.$.label&&!e.$.label.id&&(e.$.label.id=e.id+"Label"),e.$.actionButton&&!e.$.actionButton.id&&(e.$.actionButton.id=e.id+"ActionButton"),e.$.hint&&!e.$.hint.id&&(e.$.hint.id=e.id+"Hint"),e._createElement(),super.render()}removeAt(e){const t=this;t.$.listBox&&(t.$.listBox.removeAt(e),t._applySelection(),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize())}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e&&e instanceof Smart.ListItem?(t.$.listBox.removeChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}get value(){const e=this;return e.isRendered&&e.$.listBox?e.$.listBox.value:null}set value(e){const t=this;return t.isRendered&&t.$.listBox?void(t.$.listBox.value=e):null}select(e){this.$.listBox&&this.$.listBox.select(e)}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.removeAttribute("tabindex"),e.$.actionButton.removeAttribute("tabindex"),void e.$.dropDownButton.removeAttribute("tabindex");let t=e.tabIndex>0?e.tabIndex:0;e.tabIndex=t,"dropDownButton"===e.dropDownOpenMode?(e.removeAttribute("tabindex"),e.$.actionButton.setAttribute("tabindex",t),e.$.dropDownButton.setAttribute("tabindex",t)):(e.$.actionButton.removeAttribute("tabindex"),e.$.dropDownButton.removeAttribute("tabindex"))}static get requires(){return{"Smart.ListBox":"smart.listbox.js"}}unselect(e){this.$.listBox&&this.$.listBox.unselect(e)}update(e,t){const o=this;o.$.listBox&&(o.$.listBox.update(e,t),o._applySelection())}_resizeBarMoveHandler(e){"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_createToken(){const e=this;let t,o=!1;const n=document.createDocumentFragment(),i=e.selectedIndexes[e.selectedIndexes.length-1];"plain"!==e.selectionDisplayMode||"one"!==e.selectionMode&&"zeroAndOne"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode&&"radioButton"!==e.selectionMode?"tokens"===e.selectionDisplayMode?1===e.selectedIndexes.length&&["oneOrManyExtended","oneOrMany","zeroAndOne","one","radioButton"].indexOf(e.selectionMode)>-1?t="":(t="&#10006",o=!0):t=1===e.selectedIndexes.length?"":",":t="";const r=e.selectedIndexes,a=e.$.listBox._items;for(let s=0;s<r.length;s++){const l=r[s];a[l]&&n.appendChild(e._applyTokenTemplate(a[l][e.inputMember],"tokens"!==e.selectionDisplayMode&&l===i?"":t,o))}return n}_applySelection(){const e=this;if("placeholder"!==e.selectionDisplayMode&&0!==e.selectedIndexes.length){if(e.$.listBox._items&&0!==e.$.listBox._items.length){if("plain"===e.selectionDisplayMode){const t=e.$.listBox.selectedIndexes,o=e.$.listBox._items;let n=[];for(let i=0;i<t.length;i++){const r=t[i];o[r]&&n.push(o[r][e.inputMember])}return e.$.actionButton.innerHTML=n.length?`<span class="smart-token">${n.join(", ").trim()}</span>`:"",void(e.$.hiddenInput.value=e.selectedValues.toString())}e.$.actionButton.innerHTML="",e.$.actionButton.appendChild(e._createToken()),e.$.hiddenInput.value=e.selectedValues.toString()}}else e.$.actionButton.innerHTML=e.placeholder}_applyTokenTemplate(e,t,o){const n=this,i=document.createElement("span"),r=function(){return"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+e+`</span><span class='smart-drop-down-list-unselect-button' role="button"${o?' aria-label="Unselect"':""}>${t}</span>`};if(i.classList.add("smart-token"),n._tokenTemplate){let e=document.importNode(n._tokenTemplate.content,!0);const t=e.childNodes.length,o=/{{\w+}}/g;let a;for(let n=0;n<t;n++)a=o.exec(e.childNodes[n].innerHTML),a&&(e.childNodes[n].innerHTML=e.childNodes[n].innerHTML.replace(a[0],r())),e.childNodes[n].outerHTML&&(i.innerHTML+=e.childNodes[n].outerHTML)}else"function"==typeof n.tokenTemplate?n.tokenTemplate(i,{label:e,iconSeparator:t}):i.innerHTML=r();return i}_bindingCompleteHandler(){const e=this;e.$.listBox&&requestAnimationFrame((()=>{e._setDropDownSize(),e._positionDetection.checkBrowserBounds()}))}_buttonsDownHandler(e){const t=this;if(!t.disabled){if(t.hasRippleAnimation)if(t.$.buttonsContainer&&"dropDownButton"!==t.dropDownOpenMode){const o=t.$.buttonsContainer;o.firstElementChild.noRipple=!0,Smart.Utilities.Animation.Ripple.animate(o,e.pageX,e.pageY),o.firstElementChild.noRipple=!1}else Smart.Utilities.Animation.Ripple.animate(e.target,e.pageX,e.pageY);t._preventsSelectStart=!0,t.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.actionButton&&t.$.actionButton.setAttribute("active",""),t.opened&&(t._preventDropDownClose=!0)}}_buttonsMouseEventsHandler(e){const t=this;t.disabled||("mouseenter"===e.type?(t.setAttribute("hover",""),e.target.setAttribute("hover",""),"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.dropDownButton&&t.setAttribute("drop-down-button-hover","")):(t.removeAttribute("hover"),t.removeAttribute("drop-down-button-hover"),e.target.removeAttribute("hover")))}_calculateDropDownSize(){const e=this;e._dropDownSize={};const t=window.getComputedStyle(e.$.dropDownContainer),o=parseFloat(t.getPropertyValue("border-top-width").trim()),n=parseFloat(t.getPropertyValue("border-bottom-width").trim()),i=parseFloat(t.getPropertyValue("margin-top").trim()),r=parseFloat(t.getPropertyValue("margin-bottom").trim()),a=parseFloat(t.getPropertyValue("padding-top").trim()),s=parseFloat(t.getPropertyValue("padding-bottom").trim());Smart.Utilities.Core.CSSVariablesSupport()&&(e._dropDownSize.width=t.getPropertyValue("--smart-drop-down-list-drop-down-width").trim(),e._dropDownSize.height=t.getPropertyValue("--smart-drop-down-list-drop-down-height").trim()),(!e._dropDownSize.width||e._dropDownSize.width.indexOf("initial")>-1)&&(e._dropDownSize.width=e.offsetWidth),e._dropDownSize.height||(e._dropDownSize.height="auto"),e._dropDownSize.minHeight=parseFloat(t.getPropertyValue("min-height").trim()),e._dropDownSize.maxHeight=parseFloat(t.getPropertyValue("max-height").trim()),e._dropDownSize.borderWidth=(isNaN(o)?0:o)+(isNaN(n)?0:n),e._dropDownSize.paddingWidth=(isNaN(a)?0:a)+(isNaN(s)?0:s),e._dropDownSize.marginWidth=(isNaN(i)?0:i)+(isNaN(r)?0:r)}_createElement(){const e=this;e._tokenTemplate=e._validateTemplate(e.tokenTemplate),e._applySelection(),e._setDropDownSize(),e._setFocusable(),e.$.arrow.noRipple=!0,e._shadowDOMStylesDelay=e.shadowRoot,e._setAriaRelations(!0)}_documentDownHandler(e){const t=this;if(t.disabled||t.readonly)return;let o=e.originalEvent.target;if(o===t._overlay&&(t._overlayDown=!0),t.shadowRoot){o=e.originalEvent.composedPath()[0];let n=o.getRootNode().host;for(;n;)n.closest(".smart-drop-down-container")===t.$.dropDownContainer&&(t._isDropDownClicked=!0),n=n.getRootNode().host}else t.isInShadowDOM&&(o=e.originalEvent.composedPath()[0]),t._isDropDownClicked=o.closest(".smart-drop-down-container")===t.$.dropDownContainer;if(t._buttonClicked=o.closest(".smart-action-button")||o.closest(".smart-drop-down-button"),t.$.listBox){let n=o.closest("smart-list-item");t.$.listBox.contains(n)||(n=void 0),t.hasRippleAnimation&&n&&Smart.Utilities.Animation.Ripple.animate(n,e.pageX,e.pageY),(n||o===t.$.listBox.$.filterInput||o.closest(".smart-token"))&&(t._preventDropDownClose=!0)}if(t._isDropDownClicked&&(t._preventDropDownClose=!0),o!==t.$.resizeBar||"none"===t.resizeMode)return;t._resizeDetails||(t._resizeDetails={});const n=t.$.dropDownContainer.getBoundingClientRect();t._resizeDetails.started=!0,t._resizeDetails.x=e.pageX,t._resizeDetails.y=e.pageY,t._resizeDetails.width=t.$.dropDownContainer.offsetWidth,t._resizeDetails.height=t.$.dropDownContainer.offsetHeight,t._resizeDetails.offsetXL=e.clientX-n.left,t._resizeDetails.offsetXR=n.left+t.$.dropDownContainer.offsetWidth-e.clientX,t._resizeDetails.offsetY=n.top+t.$.dropDownContainer.offsetHeight-e.clientY,t._resizeDetails.offsetYtop=e.clientY-n.top,t._preventDropDownClose=!0}_documentMoveHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if("auto"===t.dropDownOpenMode&&null!==t.dropDownAppendTo&&(t.contains(o)||t.$.dropDownContainer.contains(o)?t._isElementHovered=!0:(t._isElementHovered=!1,t._autoClose())),!t._resizeDetails||t._resizeDetails&&!t._resizeDetails.started)return;t.setAttribute("resizing",""),t._resizeDetails.resizeEventFired||(t.$.fireEvent("resizeStart",{position:{left:e.pageX,top:e.pageY}}),t._resizeDetails.resizeEventFired=!0);const n=document.documentElement,i=t.$.dropDownContainer.getBoundingClientRect(),r=t.getBoundingClientRect(),a=t.$.dropDownContainer.hasAttribute("top")?"top":"bottom";let s;function l(){if(s=e.pageY-t._resizeDetails.y,"bottom"===a)t._resizeDetails.height=Math.min(n.clientHeight-i.top-6,Math.max(0,t._resizeDetails.height+s)),t._resizeDetails.y=Math.max(i.top+n.scrollTop-t._resizeDetails.offsetY,Math.min(n.clientHeight+n.scrollTop-1.5*t._resizeDetails.offsetY,e.pageY));else{if(t._resizeDetails.height=Math.min(t._dropDownSize.maxHeight,Math.max(0,Math.min(r.top,t._resizeDetails.height-s))),s=Math.max(0,i.top+(i.height-Math.max(t._dropDownSize.minHeight,t._resizeDetails.height))),t.dropDownAppendTo){const e=Math.abs(parseFloat(getComputedStyle(t.$.dropDownContainer).getPropertyValue("margin-bottom")))||0;t.$.dropDownContainer.style.top=t.dropDownAppendTo?e+s+"px":""}const o=r.top+n.scrollTop+t._resizeDetails.offsetYtop;t._resizeDetails.y=Math.max(t._resizeDetails.offsetYtop,Math.min(o,Math.max(o-t._dropDownSize.maxHeight,e.pageY)))}t.$.dropDownContainer.style.height=t._resizeDetails.height+"px"}function d(){s=e.pageX-t._resizeDetails.x,t._resizeDetails.width=Math.min(n.clientWidth-i.left-6,Math.max(0,t._resizeDetails.width+s)),t.$.dropDownContainer.style.width=t._resizeDetails.width+"px",t._resizeDetails.x=Math.max(i.left+n.scrollLeft-t._resizeDetails.offsetXR,Math.min(n.clientWidth+n.scrollLeft-1.5*t._resizeDetails.offsetXR,e.pageX))}switch(t.resizeMode){case"vertical":l();break;case"horizontal":d();break;case"both":d(),l()}}_documentUpHandler(e){const t=this;if(t.$.actionButton.removeAttribute("active"),t._resizeDetails&&t._resizeDetails.started)return t._resizeDetails.started=t._resizeDetails.resizeEventFired=!1,t.removeAttribute("resizing"),t._preventDropDownClose=!1,t.focus(),void t.$.fireEvent("resizeEnd",{position:{left:e.pageX,top:e.pageY}});if(t.disabled||t._isDropDownClicked||t.readonly)return void delete t._isDropDownClicked;if(t._overlayDown)return t.close(),void delete t._overlayDown;let o=e.originalEvent.target,n=o.closest?o.closest("smart-drop-down-list"):void 0;if((t.enableShadowDOM||t.isInShadowDOM)&&(o=e.originalEvent.composedPath()[0],n=o.getRootNode().host),t._preventsSelectStart=!1,void 0===o||o===t.$.resizeBar)return;if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-selection-label")&&n===t){"none"!==t.dropDownOpenMode&&t.open();let e=t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.textContent))[0];return t.$.listBox._scrollView.scrollTop=e.offsetTop,void t._focus(e)}if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-unselect-button")&&n===t){if(1===t.selectedIndexes.length&&["zeroOrMany","zeroOrOne","checkBox"].indexOf(t.selectionMode)<0)return;return void t.unselect(t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.previousElementSibling.textContent))[0])}const i=!(!o||!o.closest)&&o.closest(".smart-action-button");let r;if(t._buttonClicked&&("dropDownButton"===t.dropDownOpenMode&&i&&t._buttonClicked===t.$.actionButton?t.$.fireEvent("actionButtonClick"):o.closest(".smart-drop-down-button")!==t._buttonClicked&&i!==t._buttonClicked||(r=!0,t.$.fireEvent("dropDownButtonClick"))),t._buttonClicked=void 0,i===t.$.actionButton||o&&o.closest&&o.closest(".smart-drop-down-button")===t.$.dropDownButton)return"dropDownButton"===t.dropDownOpenMode&&i===t.$.actionButton?void t.close():void(t.$dropDownContainer.hasClass("smart-visibility-hidden")&&"none"!==t.dropDownOpenMode&&r&&"pointercancel"!==e.originalEvent.type?t.open():t.close());o=t._getUpEventTarget(o),void 0!==o&&("dropDownContainer"!==o&&"item"!==o||"item"===o&&"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0)&&t.close()}_dragStartHandler(e){this._resizeDetails&&this._resizeDetails.started&&e.preventDefault()}_dropDownTransitionendHandler(){const e=this;e._edgeMacFF&&!e.opened&&e.hasAnimation&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view"))}_focus(e){this.$.listBox._focus(e)}_blurEventHandler(){const e=this;e.$.dropDownButton&&(e.removeAttribute("focus"),e.$.dropDownButton.removeAttribute("focus")),e.$.actionButton&&(e.removeAttribute("focus"),e.$.actionButton.removeAttribute("focus")),e.nodeName&&"smart-drop-down-list"===e.nodeName.toLowerCase()&&!e._preventDropDownClose&&e.close()}_focusEventHandler(){const e=this;e.$.dropDownButton&&(e.setAttribute("focus",""),e.$.dropDownButton.setAttribute("focus","")),e.$.actionButton&&(e.setAttribute("focus",""),e.$.actionButton.setAttribute("focus","")),e.removeAttribute("drop-down-button-focus"),e.removeAttribute("action-button-focus")}_buttonsFocusHandler(e){const t=this;e.target===t.$.dropDownButton?"focus"===e.type?t.setAttribute("drop-down-button-focus",""):(t.removeAttribute("drop-down-button-focus"),t.nodeName&&"smart-drop-down-list"===t.nodeName.toLowerCase()&&!t._preventDropDownClose&&t.close()):"focus"===e.type?t.setAttribute("action-button-focus",""):t.removeAttribute("action-button-focus")}_getUpEventTarget(e){const t=this;let o=e;for(o=void 0===o.parentElement?o.getRootNode().host:o.parentElement;o;){if(o===t.$.dropDownContainer){o="dropDownContainer";break}o=void 0===o.parentElement?o.getRootNode().host:o.parentElement}return o}_keyDownHandler(e){const t=this,o=t.enableShadowDOM&&t.shadowRoot.activeElement||document.activeElement,n=t.enableShadowDOM?e.composedPath()[0]:e.target;if(!(t.$.listBox&&n===t.$.listBox.$.filterInput||o!==t&&o!==t.$.dropDownButton&&o!==t.$.actionButton)||"Tab"===e.key)switch(e.key){case"Tab":if(t.filterable&&t.opened){const o=function(){for(let e=0;e<t.items.length;e++)if(!t.items[e].disabled)return t.items[e]};t.$.listBox.$.filterInput&&!Smart.Utilities.Core.isMobile&&document.activeElement!==t.$.listBox.$.filterInput?(t.$.listBox.$.filterInput.focus(),t._preventDropDownClose=!0):t.$.listBox&&(t.focus(),t.selectedIndexes.length>0?t._focus(t.items[t.selectedIndexes[0]]):t._focus(o),t._preventDropDownClose=!0),e.preventDefault()}break;case"Enter":case" ":e.preventDefault(),n!==t.$.actionButton&&(t._keyPressed=!0,t.opened?(t._focusedItem&&t.select(t._focusedItem),("Enter"===e.key&&["none"].indexOf(t.selectionMode)<0||" "===e.key&&["none","zeroAndOne","one","radioButton"].indexOf(t.selectionMode)>-1)&&t.close()):t.opened||t.readonly||"none"===t.dropDownOpenMode||t.open()),"dropDownButton"===t.dropDownOpenMode&&n.setAttribute("active","");break;case"End":case"Home":case"PageUp":case"PageDown":case"ArrowUp":case"ArrowDown":if(t.readonly)return;if(e.altKey)return t._keyPressed=!1,void(t.$dropDownContainer.hasClass("smart-visibility-hidden")?t.open():t.close());e.preventDefault(),t.$.listBox._handleKeyStrokes(e.key);break;case"Escape":e.preventDefault(),t.close();break;default:if(t.readonly)return;"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!0),t.$.listBox._applyIncrementalSearch(e.key)}}_keyUpHandler(e){const t=this,o=t.enableShadowDOM?e.composedPath()[0]:e.target;t.$.listBox&&o===t.$.listBox.$.filterInput||("Enter"!==e.key&&" "!==e.key||(o.removeAttribute("active"),t.$dropDownContainer.hasClass("smart-visibility-hidden")||(t._keyPressed=!1)),t.$.listBox&&"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!1))}_listBoxChangeHandler(e){const t=this;if(e.target===t.$.listBox){if((t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent("change",e.detail),"list"===t.autoComplete&&e.detail){const o=t.$.listBox._items[e.detail.index];t._lastSelectedItem=o&&o.selected?o:void 0}t._applySelection(t.selectionMode,e.detail),t._updateTargetValue()}else e.stopPropagation()}_listBoxItemClickHandler(e){const t=this;(t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent(e.type,e.detail),"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0&&t.close(),Smart.Utilities.Core.isMobile||t.focus(),delete t._isDropDownClicked}_listBoxKeyDownHandler(e){const t=this;if("Enter"===e.key)return t.close(),"dropDownButton"===t.dropDownOpenMode?t.$.dropDownButton.focus():t.focus(),void e.stopPropagation();"Escape"!==e.key||t.close()}_scrollBottomReachedHandler(e){const t=this,o="onScrollBottomReached";t[o]?t[o(e)]:t[o.toLowerCase()]?t[o.toLowerCase()](e):t.dropDownAppendTo&&t.$.fireEvent(o)}_scrollTopReachedHandler(e){const t=this,o="onScrollTopReached";t[o]?t[o(e)]:t[o.toLowerCase()]?t[o.toLowerCase()](e):t.dropDownAppendTo&&t.$.fireEvent(o)}_mouseEnterHandler(){const e=this;e._isElementHovered=!0,e.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"auto"===e.dropDownOpenMode&&!e.disabled&&!e.readonly&&e.open()}_mouseLeaveHandler(){const e=this;e.removeAttribute("hover"),e._isElementHovered=!1,"auto"!==e.dropDownOpenMode||e.disabled||e.readonly||e._autoClose()}_mouseWheelHandler(e){const t=this;t.disabled||t.readonly||t.items&&0===t.items.length||t.$dropDownContainer&&!t.$dropDownContainer.hasClass("smart-visibility-hidden")||t.$.listBox&&(e.preventDefault(),t.$.listBox._handleKeyStrokes(e.deltaY>0?"ArrowDown":"ArrowUp"))}_autoClose(){const e=this;e._autoCloseTimeout=setTimeout(function(){e._isElementHovered||e.close(),clearTimeout(e._autoCloseTimeout)}.bind(e),e.autoCloseDelay)}_propertyValidator(e,t){return"number"!=typeof t&&"string"!=typeof t?e:t}_resizeHandler(){this.refresh()}refresh(){const e=this;"none"===e.resizeMode&&(e._calculateDropDownSize(),e._setDropDownSize())}_selectStartHandler(e){this._preventsSelectStart&&e.preventDefault()}_setAriaRelations(e){const t=this;let o,n;"dropDownButton"!==t.dropDownOpenMode?(o=t.$.dropDownButton,o.setAttribute("aria-hidden",!0),n=t,t.$.actionButton.removeAttribute("role")):(o=t,n=t.$.dropDownButton,n.removeAttribute("aria-hidden"),t.$.actionButton.setAttribute("role","button")),t._ariaButton=n,n.setAttribute("role","button"),n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-owns",t.$.listBox.id),n.setAttribute("aria-describedby",t.$.hint.id),t.label?n.setAttribute("aria-labelledby",t.$.label.id):"DropDownList"===t.elementName&&n.setAttribute("aria-labelledby",t.$.actionButton.id),o.setAttribute("role","presentation"),o.removeAttribute("aria-owns"),e?n.setAttribute("aria-expanded",t.opened):(o.removeAttribute("aria-describedby"),o.removeAttribute("aria-expanded"),o.removeAttribute("aria-haspopup"),o.removeAttribute("aria-labelledby"))}_setDropDownSize(){const e=this,t=e.$.listBox;let o;if(e._dropDownSize||e._calculateDropDownSize(),["dropDownMinWidth","dropDownMaxWidth"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]="initial"===e[t]?e.offsetWidth+"px":e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),["dropDownMinHeight","dropDownMaxHeight"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]=e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),e.dropDownWidth?"auto"!==e.dropDownWidth?e.$.dropDownContainer.style.width=("initial"===e.dropDownWidth?e.offsetWidth:parseFloat(e.dropDownWidth))+"px":e.$.dropDownContainer.style.width="auto":e.$.dropDownContainer.style.width="auto"===e._dropDownSize.width?"auto":(parseFloat(e._dropDownSize.width)||0)+"px",e.dropDownHeight&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=parseFloat(e.dropDownHeight)+((e.dropDownHeight+"").indexOf("%")>-1?"%":"px");else if(!e.$.listBox||"auto"!==e._dropDownSize.height&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=e._dropDownSize.height;else{e.$.dropDownContainer.style.height="";let n=0;if(t.$.itemsContainer&&(n=2*parseInt(window.getComputedStyle(t.$.itemsContainer).getPropertyValue("--smart-list-item-vertical-offset"))),isNaN(n)&&(n=6),o=n,t.items&&t.items.length>0?t.items.map((e=>o+=e.height||e.offsetHeight)):o=t.$.placeholder?t.$.placeholder.offsetHeight:200,e.filterable){const e=t.$.filterInputContainer;o+=e.offsetHeight+e.offsetTop}o=o+e._dropDownSize.paddingWidth+e._dropDownSize.borderWidth,e.$.dropDownContainer.style.height=o+"px"}if(t){if(void 0===o||!t.$)return void t._refreshLayout();const n=t.$.horizontalScrollBar?t.$.horizontalScrollBar.offsetHeight:0,i=Math.max(0,e._dropDownSize.minHeight-(o-n));i&&(e.$.dropDownContainer.style.height=o+i+"px"),!e.opened&&e.virtualized&&t.refresh()}}_styleChangedHandler(e){const t=this;if(t.dropDownAppendTo){const o=e.detail.styleProperties,n=["font-size","font-family","font-style","font-weight"];for(let e=0;e<n.length;e++)o[n[e]]&&(t.$.dropDownContainer.style[n[e]]=o[n[e]].value)}"auto"===t._dropDownSize.height&&t._setDropDownSize()}_validateTemplate(e){const t=this;if(e&&"function"!=typeof e)if("content"in document.createElement("template")){if(e instanceof HTMLTemplateElement||(e=document.getElementById(e)),null!==e&&"content"in e)return e;t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"tokenTemplate"}))}else t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()}))}});
84
84
 
85
85
  /***/ }),
86
86
 
@@ -122,7 +122,7 @@ Smart("smart-input",class extends Smart.BaseElement{static get properties(){retu
122
122
  /***/ 7498:
123
123
  /***/ (() => {
124
124
 
125
- Smart("smart-kanban",class extends Smart.DataView{static get properties(){return{addNewButton:{value:!1,type:"boolean"},addNewButtonDisplayMode:{value:"top",allowedValues:["top","bottom","both"],type:"string"},addNewColumn:{value:!1,type:"boolean"},autoColumnHeight:{value:!1,type:"boolean"},applyColumnColorToTasks:{value:!1,type:"boolean"},addNewColumnWidth:{value:null,type:"any"},allowColumnEdit:{value:!1,type:"boolean"},allowColumnHide:{value:!0,type:"boolean"},allowColumnRemove:{value:!1,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowCustomTags:{value:!0,type:"boolean"},allowDrag:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDrop:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDropPlaceholder:{value:!1,type:"boolean",defaultReflectToAttribute:!0},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},cardHeight:{value:null,type:"number?"},currentUser:{value:null,type:"any"},columnColorEntireSurface:{value:!1,type:"boolean"},columnFooter:{value:!1,type:"boolean"},columnActions:{value:!1,type:"boolean"},columnColors:{value:!1,type:"boolean"},columnWidth:{value:null,type:"any"},columnSummary:{value:!1,type:"boolean"},columnEditMode:{value:"headerAndMenu",allowedValues:["header","menu","headerAndMenu"],type:"string"},columnHeaderTemplate:{value:null,type:"any"},disableDialog:{value:!1,type:"boolean"},disableAddNewDialog:{value:!1,type:"boolean"},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},editable:{value:!1,type:"boolean"},editMode:{value:"doubleClick",allowedValues:["singleClick","doubleClick"],type:"string"},dragOffset:{value:"auto",type:"any"},formatStringDate:{value:"d",type:"string"},formatStringTime:{value:"MMM d, HH:mm",type:"string"},hierarchy:{value:"columns",allowedValues:["columns","tabs"],type:"string"},messages:{value:{en:{actionsIcon:"Actions icon",actionsList:"Open actions list",unassignedTask:"Unassigned task",unassigned:"unassigned",assignedTask:"Assigned to {{userName}}",addNewStatus:"New status",addNewColumn:"Add new status",addNewTask:"Add new task",addSubtask:"Add subtask",assignedTo:"Assigned to",createdBy:"Created by",updatedBy:"Updated by",createdByDate:"Created",updatedByDate:"Updated",checklist:"Sub tasks",color:"Color",commentsIcon:"Comments icon",copy:"Copy",customize:"Customize tasks",customizeColumn:"Customize column",dueDate:"Due date",days:"days",edit:"Edit",editTask:"ID: {{taskId}} {{text}}",expand:"Expand column",collapse:"Collapse column",high:"High",low:"Low",critical:"Critical",newComment:"New comment",newSubtask:"New subtask",overdue:"Overdue",average:"Average",priority:"Priority",priorityIcon:"Priority icon",progress:"Progress",promptComment:"Are you sure you want to remove this comment?",promptTask:'Are you sure you want to remove the task "{{taskText}}"?',promptColumn:"Are you sure you want to remove this column?",remove:"Remove",removeSubtask:"Remove subtask",removeColumn:"Remove column",hideColumn:"Hide column",removeComment:"Remove comment",removeTask:"Remove task",showAllColumns:"Show all columns",send:"Send",startDate:"Start date",status:"Status",swimlane:"Swimlane",tags:"Tags",text:"Name",textPlaceholder:"Write a task name",description:"Description",taskProgress:"Task progress: {{value}}%",taskDescription:"Task description: {{value}}",taskCompleted:"Tasks completed: {{value}}/{{count}}",tasksSummary:"{{summary}} tasks",tasksSummaryOne:"1 task",userId:"User ID",userIcon:"User icon",guestUser:"Guest",detailsTab:"Details",commentsTab:"Comments",fieldsTab:"Fields",historyTab:"History",subtasksTab:"Subtasks",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'From "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed to "{{newValue}}"',invalidRange:'"{{start}}" should be less than "{{end}}"',historyDate:"Date",ok:"ok",cancel:"Cancel",delete:"Delete",taskDeadlineChanged:"Deadline changed",tagsChanged:"Tags changed",taskMoved:"Task moved",taskUpdated:"Task updated",taskCreated:"Task created",taskUserChanged:"Assignee changed",taskUserRemoved:"Assignee removed",taskDescriptionChanged:"Description changed",taskSubtasksChanged:"Subtasks changed",taskProgressChanged:"Progress changed",taskPriorityChanged:"Priority changed",taskSubtasksCompleted:"Completed {{value}}",taskStatusChanged:"Status changed",taskTagsChanged:"Tags changed",taskNameChanged:"Name changed",taskColorChanged:"Color changed",empty:"No tasks",emptyTags:"No tags available",emptyImage:"No image to display",emptyAttachment:"No attachment to display"}}},onColumnHeaderRender:{value:null,type:"any",reflectToAttribute:!1},onColumnFooterRender:{value:null,type:"any",reflectToAttribute:!1},onTaskRender:{value:null,type:"any",reflectToAttribute:!1},onSortPrepare:{value:null,type:"any",reflectToAttribute:!1},onFilterPrepare:{value:null,type:"any",reflectToAttribute:!1},priority:{value:[],type:"array",reflectToAttribute:!1},priorityList:{value:!0,type:"boolean"},readonly:{value:!1,type:"boolean"},selectionMode:{value:"zeroOrOne",allowedValues:["zeroOrOne","zeroOrManyExtended"],type:"string"},storeHistory:{value:!0,type:"boolean"},storeHistoryItems:{value:20,type:"number"},swimlanes:{value:[],type:"array",reflectToAttribute:!1},swimlanesFrom:{value:0,type:"number"},swimlanesTo:{value:null,type:"number?"},tags:{value:[],type:"array"},taskActions:{value:!1,type:"boolean"},taskActionsRendered:{value:null,type:"any"},taskComments:{value:!1,type:"boolean"},taskDue:{value:!1,type:"boolean"},taskPosition:{value:"all",allowedValues:["all","leaf"],type:"string"},taskPriority:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskProgress:{value:!1,type:"boolean"},taskTags:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskSubTasks:{allowedValues:["none","onePerRow","onlyUnfinished"],value:"none",type:"string"},taskSubTasksInput:{value:!0,type:"boolean"},taskUserIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskCustomFields:{value:[],type:"array",reflectToAttribute:!1},taskCustomFieldsHide:{value:!1,type:"boolean"},taskColor:{value:!0,type:"boolean"},taskColorEntireSurface:{value:!1,type:"boolean"},textTemplate:{value:null,type:"any"},userList:{value:!1,type:"boolean"},users:{value:[],type:"array",reflectToAttribute:!1},dialogCustomizationFunction:{value:null,type:"any"},dialogRendered:{value:null,type:"any"},dialogEditors:{value:["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"],type:"any"}}}static get listeners(){return{"body.focusin":"_bodyFocusinHandler",keyup:"_keyupHandler","container.click":"_containerClickHandler","container.down":"_containerDownHandler","container.keydown":"_containerKeydownHandler","container.touchmove":"_scrollViewerTouchmoveHandler"}}template(){const e=this._tabindex;return`<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize tasks"><div role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev"${e} role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next"${e} role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close"${e} role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n <smart-scroll-viewer auto-refresh vertical-scroll-bar-visibility="hidden" class="smart-kanban-scroll-viewer" id="scrollViewer">\n <div id="body" class="smart-kanban-body" role="presentation"></div>\n </smart-scroll-viewer>\n </div>`}_keyupHandler(e){const t=this;if("Escape"===e.key&&t._dragDetails){const e=t._dragDetails,a=Smart.Kanban.hoveredKanban,s=Smart.Kanban.hoveredItem;delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,e.ScrollViewer&&e.ScrollViewer._scrollView&&(e.ScrollViewer._scrollView.disableSwipeScroll=!1);let l=!1;if(document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.classList.remove("smart-kanban-task-placeholder"),e.style.marginTop=e.style.marginBottom="0px",l=!0})),l&&t._refreshButtonsAndSummaries(),!e.FeedbackShown)return;a&&clearInterval(a._dragInterval),t._preventSelection=!0;const r=t.isInShadowDOM?t.getRootNode().host:document.body;return r.classList.remove("smart-dragging"),r.style.overflow=t._originalBodyOverflow.overflow,r.style.eoverflowX=t._originalBodyOverflow.overflowX,r.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,e.Feedback.remove(),e.Items.forEach((e=>e.classList.remove("dragged"))),s.classList.remove("drop-target"),void(s.classList.contains("before")?s.classList.remove("before"):s.classList.contains("after")&&s.classList.remove("after"))}}render(){const e=this;Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getCurrentDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.isInitialized=!1,e._render(),super.render(),e.isInitialized=!0}_getPriority(){const e=this;if(!e.priority||e.priority&&0===e.priority.length)e.priority=[{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',label:"",value:""},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>',label:e.localize("low"),value:"low"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>',label:e.localize("average"),value:"average"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>',label:e.localize("high"),value:"high"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>',label:e.localize("critical"),value:"critical"}];else if(e.priority){const t=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let a=0;a<e.priority.length;a++){const s=e.priority[a];s.menuIcon=t(s)}}for(let t=0;t<e.priority.length;t++){const a=e.priority[t];a.menuLabel=`<div priority="${a.value}" class="smart-kanban-task-text">${a.menuIcon}${a.label}</div>`}return e.priority}_getTags(){const e=this,t=[];if(e.tags){for(let a=0;a<e.tags.length;a++){const s=e.tags[a];if("[]"!==s)if(s&&"string"==typeof s)t.push({label:s.trim(),value:s.trim()});else{const e={};if(s.label){if("[]"===s.label)continue;e.label=s.label}s.value?e.value=s.value:e.value=s.label,s.color&&(e.color=s.color),t.push(e)}}e.tags=t}}_render(){const e=this,t=getComputedStyle(e);if(e.columnColorEntireSurface?e.classList.add("smart-kanban-column-color"):e.classList.remove("smart-kanban-column-color"),e.$.body.innerHTML="",e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._kanbanTaskMinWidth=parseFloat(t.getPropertyValue("--smart-kanban-task-min-width")),e._dataViewPadding=parseFloat(t.getPropertyValue("--smart-data-view-padding")),e.uiTasksByDataField=[],e.tasksByDataField=[],e.taskById=[],e._allColumns=[],e._customTags=[],e._selectedTasks=[],e._dblclickObject={numberOfClicks:0},e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._sortPanelDataSource=[{label:e.localize("text"),dataField:"text",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("priority"),dataField:"priority",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowFilter:!0,allowSort:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowFilter:!0,allowSort:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowFilter:!0,allowSort:!0}],e.taskCustomFields){const t=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let a=0;a<e.taskCustomFields.length;a++){const s=e.taskCustomFields[a].label;if(t){const l=typeof t[e.taskCustomFields[a].dataField];"number"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"number"}):"date"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"date"}):e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}else e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}}const a={checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"};for(let t in a)e.dataSourceMap[t]||(e.dataSourceMap[t]=a[t]);e._getPriority(),e._getTags(),e._validateDataSourceMap(),e._getInnerElementMessages(),e._localizeHeader(),e._handleHeaderPosition(e.$.scrollViewer),e._validateSwimlanes(),e._renderColumns(),e._handleSwimlanes();let s=!1;e.autoLoadState&&(s=e.loadState()),e._getCurrentUser(),s||e._processDataSource(),e._setPriorityList(),e._setUserList(),e._setActionsList(),e._setColumnActionsList(),e._setCommentsList(),e._autoSaveState(),e._createAddNewButton(),e.$.scrollViewer.refresh()}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog))}detached(){const e=this;if(super.detached(),!e._dialog)return;const t=e._dialog;t.removeEventListener("open",e._dialogEventHandler),t.removeEventListener("closing",e._dialogEventHandler),t.removeEventListener("close",e._dialogEventHandler),t.removeEventListener("click",e._dialogClickHandler),t.remove()}addTask(e={},t){const a=this,s=a.columns;if("object"!=typeof e||0===s.length||!a._currentUser.allowAdd)return;const l=a.dataSourceMap;void 0===e[l.status]&&(e[l.status]=s[0].dataField),a._currentUser.info&&(void 0===e[l.createdUserId]?(e[l.createdUserId]=a._currentUser.info.id,e[l.createdDate]=new Date):e[l.createdDate]||(e[l.createdDate]=new Date));const r={value:e,id:e.id};a.$.fireEvent("taskBeforeAdd",r);let o=null;return a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("add",e,(function(e){return e})):(a.dataSource||(a.dataSource=[]),t>=0?a.dataSource.splice(t,0,e):a.dataSource.push(e),o=a._createTask(e,!0,t),a._autoSaveState("dataSource")),a.$.fireEvent("taskAdd",r),a._refreshButtonsAndSummaries(),a.virtualization&&(a._refreshColumns(),a._refreshButtonsAndSummaries()),o}addSort(e,t){const a=this,s=a.dataSource;let l;function r(e,s){const r=a._sortPanelDataSource.find((t=>t.dataField===e));if(r){let a=Array.isArray(t)?t[s]:"string"==typeof t?t:"ascending";l.dataFields.push(e),l.dataTypes.push(r.dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",l.orderBy.push(a)}}if(0!==arguments.length&&s&&0!==s.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)l=e;else if(l={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(r);else{if("string"!=typeof e)return;r(e,0)}super.addSort(l)}}beginEdit(e){const t=this;t.disabled||(e=t._validateTaskArgument(e))&&(t.editable||t.readonly)&&t._openDialog(e,"edit")}cancelEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&e.close()}hide(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!1!==e.visible&&(e.visible=!1,t.$.fireEvent("columnHide",{column:e}),t.refresh())}show(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!0!==e.visible&&(e.visible=!0,t.$.fireEvent("columnShow",{column:e}),t.refresh())}showAllColumns(){const e=this;for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0;e.refresh()}collapse(e){const t=this;if(!t.collapsible)return;if(!(e=t._validateColumnArgument(e))||e.collapsed||!e.collapsible)return;const a=t._columnToElement.get(e),s=a.siblingColumns;let l=0;e.collapsed=!0,a.classList.add("collapsed");const r=e.collapsed?t.localize("expand"):t.localize("collapse"),o=a.querySelector(".smart-kanban-column-header-toggle-button");if(o&&o.setAttribute("title",r),s.forEach((e=>e.collapsed&&l++)),l===s.length){const a=0!==s.indexOf(e)?0:1,l=s[a],r=t._columnToElement.get(l);l&&(l.collapsed=!1),r&&(r.classList.remove("collapsed"),t._updateColumnWidths(s,r.parentElement))}else t._updateColumnWidths(s,a.parentElement);t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t._doNotFireEvents||t.$.fireEvent("columnCollapse",{column:e})}copyTask(e){const t=this;if(!t._currentUser.allowAdd)return;if(!(e=t._validateTaskArgument(e)))return;const a=JSON.parse(JSON.stringify(e.data));a.history=[],t.dataSource&&t.dataSource.virtualDataSource?t._requestVirtualDataSource("add",a,(function(e){return t.$.fireEvent("taskAdd",{value:a}),e})):(a[t.dataSourceMap.id]=Math.floor(9e4*Math.random()+1e4),t._createTask(a,!0),t._autoSaveState("dataSource"),t.$.fireEvent("taskAdd",{value:a})),t.dataSource||(t.dataSource=[]),t.dataSource.push(a),t._refreshButtonsAndSummaries()}endEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&(e.ok=!0,e.close())}ensureVisible(e){const t=this;if(e&&"number"==typeof e){const a=t.getTask(e);if(!a)return;const s=a[t.dataSourceMap.status],l=t.querySelector('.smart-kanban-column[data-field="'+s+'"]');if(l){const e=l.querySelector("smart-scroll-viewer");e&&(a.top<e.scrollTop||a.top>e.scrollTop+e.offsetHeight?e.scrollTop=a.top:t._refreshScrollHeight(e,s))}return}if(!(e=t._validateTaskArgument(e))||e.filteredOut)return;const a=e.closest("smart-scroll-viewer");if(0===a.scrollHeight)return e;const s=a.scrollTop,l=e.offsetTop;return s<=l&&s+a.offsetHeight>=l+e.offsetHeight||(a.scrollTop=l),e}expand(e){const t=this;if(!(e=t._validateColumnArgument(e))||!e.collapsed)return;const a=t._columnToElement.get(e);e.collapsed=!1,a.classList.remove("collapsed");const s=e.collapsed?t.localize("expand"):t.localize("collapse"),l=a.querySelector(".smart-kanban-column-header-toggle-button");l&&l.setAttribute("title",s),t._updateColumnWidths(a.siblingColumns,a.parentElement),t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t.$.fireEvent("columnExpand",{column:e})}expandAll(){const e=this;e._allColumns.forEach((t=>{t.collapsed=!1,e._columnToElement.get(t).classList.remove("collapsed")})),e._allColumns.forEach((t=>e._refreshScrollViewer(t))),e._columnContainers.forEach((t=>e._updateColumnWidths(t.children,t))),e._autoSaveState("collapsed"),e._handleSwimlanes(!0)}exportData(e,t,a){const s=this,l=getComputedStyle(s),r=l.borderRightColor,o=s.swimlanes,i=new Smart.Utilities.DataExporter,n=s._getCurrentDataSource(),d=s.dataSourceMap,c=[{id:"Task ID",text:"Text",status:"Status",swimlane:"Swimlane",asignee:"Asignee",priority:"Priority",progress:"Progress",startDate:"Start date",dueDate:"Due date",subTasks:"Completed sub-tasks",tags:"Tags"}],u={},m={},p={};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)c[0][s.taskCustomFields[e].dataField]=s.taskCustomFields[e].label;i.style={border:"1px solid "+r,borderCollapse:"collapse",backgroundColor:l.backgroundColor,color:l.color,fontFamily:"Helvetica",header:{border:"1px solid "+r,fontWeight:"bold"},columns:{border:"1px solid "+r,progress:{format:"p0"},startDate:{format:s.formatStringDate},dueDate:{format:s.formatStringDate}},rows:{}},0===o.length&&delete c[0].swimlane;for(let e=0;e<n.length;e++){const t=n[e];let a=t[d.status],l=t[d.swimlane],r=t[d.userId],h=t[d.progress];u[a]?a=u[a]:(a=s._allColumns.find((e=>e.dataField===a)).label,u[t[d.status]]=a),null===r?r="":p[r]?r=p[r]:(r=s.users.find((e=>e.id===r)).name,p[t[d.userId]]=r),null===h?h="":h/=100;let g=t[d.tags];g&&"string"!=typeof g&&(g=g.map((e=>"string"==typeof e?e:e.label)));const f={id:t[d.id],text:t[d.text],description:t[d.description]||"",status:a,asignee:r,priority:t[d.priority]||"",progress:h,startDate:t[d.startDate]||"",dueDate:t[d.dueDate]||"",subTasks:s._getCompletedSubTasks(t[d.checklist]),tags:g};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)f[s.taskCustomFields[e].dataField]=`"${t[s.taskCustomFields[e].dataField]}"`.replaceAll(","," ");o.length&&(l?m[l]?l=m[l]:(l=o.find((e=>e.dataField===l)).label,m[t[d.swimlane]]=l):l="",f.swimlane=l),c.push(f),t[d.color]&&(i.style.rows[e]={backgroundColor:t[d.color]})}return i.exportData(c,e,t,a)}getState(e){const t=this,a={},s={collapsed:a,dataSource:t._getCurrentDataSource(),filtering:t._appliedFiltering,selection:{selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart:null},sorting:t._appliedSorting,tabs:t._selectedTabs,visibility:{taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}};let l=null,r=null;t._selectionInView&&(l=t._selectionInView.closest(".smart-kanban-column").column.dataField,r=t._selectionInView.getAttribute("swimlane")),s.selection.selectionInColumn=l,s.selection.swimlane=r;const o={};for(let e in t.tasksByDataField){o[e]=[];const a=t.tasksByDataField[e];for(let t=0;t<a.length;t++)o[e].push(a[t].id)}if(s.order=o,s.columnOrder=[],t._allColumns.forEach((e=>a[e.dataField]=e.collapsed)),t.columns.forEach((e=>s.columnOrder.push(e.dataField))),e){const t={};for(let a in e){const l=e[a];s[l]&&(t[l]=s[l])}return t}return s}loadState(e,t){const a=this;if(!e&&!(e=window.localStorage.getItem("smartKanban"+a.id)))return!1;let s=!0;"string"==typeof e&&(e=JSON.parse(e,((e,t)=>t&&-1!==["startDate","dueDate","time"].indexOf(e)?new Date(t):t))),e.dataSource||(t=!1),a._doNotFireEvents=!0,a._selectedTasks=[],delete a._selectionStart,delete a._selectionInView,a.expandAll(),!1!==t&&Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e&&e.clearContent&&e.isReady&&e.clearContent()}));let l=!1;a._allColumns.forEach((t=>{e.collapsed&&e.collapsed[t.dataField]&&(a.collapse(t),l=!0)}));for(let t in e.visibility)a[t]=e.visibility[t];if(!1!==t&&(a.dataSource=e.dataSource,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource()),e.filtering&&a.addFilter(a._constructFilterGroups(e.filtering),e.filtering.operator),e.sorting&&a.addSort(e.sorting),!1!==t&&a._autoSaveState(e),e.selection&&(e.selection.selected.forEach((e=>{const t=a.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`);t&&(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id))})),e.selection.selectionStart&&(a._selectionStart=a.$.container.querySelector(`.smart-kanban-task[data-id="${e.selection.selectionStart}"]`)),e.selection.selectionInColumn)){const t=a._columnToElement.get(a._allColumns.find((t=>t.dataField===e.selection.selectionInColumn)));e.selection.swimlane?a._selectionInView=t.querySelector(`smart-scroll-viewer[swimlane=${e.selection.swimlane}]`):a._selectionInView=t.querySelector("smart-scroll-viewer")}if(e.tabs){const t="tabs"===a.hierarchy;a._allColumns.forEach((s=>{if(void 0!==s.selected){const l=a._columnToElement.get(s),r=-1!==e.tabs.indexOf(s.dataField);s.selected=r,t&&(l.classList.toggle("smart-hidden",!r),l.tab.classList.toggle("selected",r),l.tab.setAttribute("aria-selected",r))}}))}const r=[],o={};if(e.columnOrder){a._allColumns.forEach((e=>{o[e.dataField]=e}));for(let t=0;t<e.columnOrder.length;t++){const a=e.columnOrder[t],s=o[a];s&&r.push(s)}r&&r.length===a.columns.length&&JSON.stringify(r.map((e=>e.value)))!==JSON.stringify(a.columns.map((e=>e.value)))&&(a.columns=r,a.refresh(),s=!1)}if(e.order){let t=!1,l=[];for(let s in e.order){const l=e.order[s];let r=a._getTasksByDataField(s);if(0!==r.length)for(let e=0;e<l.length;e++){const s=l[e],o=a.taskById[s];if(o){const s=r.indexOf(o);s!==e&&s>=0?(r.splice(e,0,r.splice(s,1)[0]),t=!0):-1===s&&a._getTasksByDataField(o[a.dataSourceMap.status]).indexOf(o)}}}if(t){const e=Object.keys(a.tasksByDataField);for(let t in e)l=l.concat(a.tasksByDataField[e[t]]);Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),a.dataSource=l,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource(),s=!1}}return a._doNotFireEvents=!1,s}moveTask(e,t){const a=this;if(a.disabled||""!==t&&!t)return;const s=a.dataSourceMap;if(!(e=a._validateTaskArgument(e))||!a._updateTaskInProgress&&e.data[s.status]===t)return;const l=a._allColumns.find((e=>e.dataField===t));function r(){const r=e.closest("smart-scroll-viewer"),o=a._columnToElement.get(l),i=e.data,n=a.getTaskScrollViewer(o,i);if(a.virtualization){const l=i,o=e.column.dataField,d=a._getTasksByDataField(o),c=d.findIndex((e=>e.id===l.id));return c>=0&&(d.splice(c,1),a._getTasksByDataField(t).push(l)),i[s.status]=t,a._refreshScrollViewer(r,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),void((a.shadowRoot||a.getRootNode()).activeElement===r&&a._focusTask(a._getFirstItem(r.$.content)))}i[s.status]=t,n.appendChild(e),a._dialog&&a._dialog.ok||(a.textTemplate&&a._renderTask(e),a._autoSaveState("dataSource")),a._refreshScrollViewer(r,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),(a.shadowRoot||a.getRootNode()).activeElement===r&&a._focusTask(a._getFirstItem(r.$.content))}l&&(a.dataSource&&a.dataSource.virtualDataSource&&!a._ignoreVirtualDataSource?a._requestVirtualDataSource("update",Object.assign({},e.data,{status:t}),(function(e){return e&&r(),e})):r())}_getCustomizeColumnPanelDataSource(){const e=this;return e._customizeColumns=[{label:e.localize("actionsIcon"),dataField:"taskActions",allowHide:!0,disableDrag:!0,visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",allowHide:!0,disableDrag:!0,visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",allowHide:!0,disableDrag:!0,visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",allowHide:!0,disableDrag:!0,visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",allowHide:!0,disableDrag:!0,visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",allowHide:!0,disableDrag:!0,visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",allowHide:!0,disableDrag:!0,visible:e.taskUserIcon}],e._customizeColumns}openCustomizePanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;const a=e.$.customize,s=[{label:e.localize("actionsIcon"),dataField:"taskActions",visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",visible:e.taskUserIcon}];let l;e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel"),a.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated?(l=a.firstElementChild,l.set("dataSource",s),l.propertyChangedHandler("dataSource",void 0,s),l.rightToLeft=e.rightToLeft):(l=document.createElement("smart-column-panel"),l.animation=e.animation,l.dataSource=s,l.locale=e.locale,l.messages=e._innerElementMessages.columnPanel,l.rightToLeft=e.rightToLeft,l.theme=e.theme,e.$.customize.appendChild(l),l.classList.add("smart-kanban-column-panel"),e._customizePartCreated=!0),e._openHeaderDropDown(e.$.customizeButton)}_getFilterPanelDataSource(){const e=this,t=[{label:e.localize("text"),dataField:"text",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("priority"),dataField:"priority",dataType:"enum",allowSort:!0,allowFilter:!0,options:e._getPriority()},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowSort:!0,allowFilter:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowSort:!0,allowFilter:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowSort:!0,allowFilter:!0}];if(e.taskCustomFields){const a=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let s=0;s<e.taskCustomFields.length;s++){const l=e.taskCustomFields[s].label;if(a){const r=typeof a[e.taskCustomFields[s].dataField];"number"===r?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"number"}):"date"===r?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"date"}):t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}else t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}}return e.onFilterPrepare&&e.onFilterPrepare(t),t}openFilterPanel(){const e=this,t=e._getFilterPanelDataSource();super.openFilterPanel(t,(function(t,a){"progress"===a.dataField?(t.min=0,t.max=100,t.showUnit=!0,t.unit="%"):"date"===a.dataType&&(t.formatString=e.formatStringDate)}))}_getSortPanelDataSource(){const e=this;return e.onSortPrepare&&e.onSortPrepare(this._sortPanelDataSource),this._sortPanelDataSource}openSortPanel(){const e=this,t=e._getSortPanelDataSource().map((t=>{const a=e._appliedSorting.dataFields.indexOf(t.dataField);return Object.assign({},t,{sortIndex:a,sortDirection:-1===a?"ascending":e._appliedSorting.orderBy[a]})}));super.openSortPanel(t)}removeTask(e,t){const a=this;function s(){const t=e.closest("smart-scroll-viewer"),s=e.data;if(a.virtualization||(e.remove(),a._refreshScrollViewer(t,!0)),a._autoSaveState("dataSource"),a.$.fireEvent("taskRemove",{value:s,id:e.data.id}),a.dataSource){const e=a.dataSource.findIndex?a.dataSource.findIndex((e=>e.id===s.id)):-1;if(e>-1){const t=s[a.dataSourceMap.status],l=a.tasksByDataField[t].findIndex((e=>e.id===s.id));l>=0&&a.tasksByDataField[t].splice(l,1),a.dataSource.splice(e,1)}}if(a._selectedTasks&&a._selectedTasks.indexOf(s.id)>=0){const e=a._selectedTasks.indexOf(s.id);a._selectedTasks.splice(e,1)}a._refreshSummaries(),a._refreshColumns()}a._currentUser.allowRemove&&(e=a._validateTaskArgument(e))&&(t?a._openDialog(e,"prompt"):a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("remove",e.data,(function(e){return e&&s(),e})):s())}saveState(e){const t=this.getState(e);return window.localStorage.setItem("smartKanban"+this.id,JSON.stringify(t)),t}addHistory(e,t){const a=this;if(!e||!t)return;const s=a.dataSourceMap;a.storeHistory?(void 0!==e[s.history]&&null!==e[s.history]||(e[s.history]=[]),e[s.history].length===a.storeHistoryItems&&e[s.history].splice(0,1),Array.isArray(e[s.history])||(e[s.history]=[]),e[s.history].push(t)):e[s.history]=[]}clearHistory(e){e&&(e.history=[])}updateTask(e,t){const a=this;if(!a._currentUser.allowEdit||!t)return;if(!(e=a._validateTaskArgument(e)))return;const s=a.dataSourceMap,l=e.data;function r(){if(e.data=t,t[s.status]!==l[s.status]&&(a._updateTaskInProgress=!0,a.moveTask(e,t[s.status]),delete a._updateTaskInProgress),t[s.swimlane]!==l[s.swimlane]){const r=e.closest(".smart-kanban-column");a._hasSwimlane(r.index)?(r.querySelector(`smart-scroll-viewer[swimlane=${t[s.swimlane]}]`).appendChild(e),l[s.swimlane]&&a._refreshScrollViewer(r.querySelector(`smart-scroll-viewer[swimlane=${l[s.swimlane]}]`))):delete t[s.swimlane]}const r=()=>{if(!a._currentUser||a._currentUser&&!a._currentUser.info)return;const e=()=>({user:a._currentUser.info.id,date:t[s.updatedDate]});if(t[s.userId]!==l[s.userId]){const r=e();r.action="user";let o=!0;l[s.userId]||t[s.userId]||(o=!1),o&&(r.details={oldValue:l[s.userId],value:t[s.userId]},a.addHistory(t,r))}if(""+t[s.dueDate]!=""+l[s.dueDate]){const r=e();r.action="deadline",r.details={oldValue:l[s.dueDate]?l[s.dueDate].toLocaleDateString():"",value:t[s.dueDate]?t[s.dueDate].toLocaleDateString():""},a.addHistory(t,r)}if(""+t[s.startDate]!=""+l[s.startDate]){const r=e();r.action="deadline",r.details={oldValue:l[s.startDate]?l[s.startDate].toLocaleDateString():"",value:t[s.startDate]?t[s.startDate].toLocaleDateString():""},a.addHistory(t,r)}if(t[s.color]!==l[s.color]){const r=e();r.action="color",r.details={oldValue:l[s.color],value:t[s.color]},a.addHistory(t,r)}if(t[s.status]!==l[s.status]){const r=e();r.action="status",r.details={oldValue:l[s.status],value:t[s.status]},a.addHistory(t,r)}if(JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])){const r=e();r.action="subtasks",r.details={oldValue:l[s.checklist],value:t[s.checklist]},a.addHistory(t,r)}if(parseFloat(t[s.progress])!==parseFloat(l[s.progress])){let r=!0;if(null===l[s.progress]&&0===parseFloat(t[s.progress])&&(r=!1),r){const r=e();r.action="progress";const o=l[s.progress]?l[s.progress]+"%":"0%",i=t[s.progress]?t[s.progress]+"%":"0%";o!==i&&(r.details={oldValue:o,value:i},a.addHistory(t,r))}}if(t[s.description]!==l[s.description]){const r=e();r.action="description",r.details={oldValue:l[s.description],value:t[s.description]},a.addHistory(t,r)}if(t[s.priority]!==l[s.priority]){const r=e();r.action="priority",r.details={oldValue:l[s.priority],value:t[s.priority]},a.addHistory(t,r)}if(t[s.tags]!==l[s.tags]){const r=e();r.action="tags",r.details={oldValue:l[s.tags],value:t[s.tags]},a.addHistory(t,r)}if(t[s.text]!==l[s.text]){const r=e();r.action="text",r.details={oldValue:l[s.text],value:t[s.text]},a.addHistory(t,r)}for(let s=0;s<a.taskCustomFields.length;s++){const r=a.taskCustomFields[s];let o=l[r.dataField],i=t[r.dataField];if(o!==i&&""+o!=""+i){const s=e();if(s.action=r.name?r.name:r.dataField,r.dataSource){const e=e=>{const t=r.dataSource.find((t=>t.value===e||t===e?t:void 0));return void 0!==t?t.label:""},t=t=>{if(void 0===t||t.length){if(void 0!==t&&t.length&&"string"!=typeof t){let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}if(t&&t.indexOf(",")>0){t=t.split(",");let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}return t}return e(t)};i=t(i),o=t(o)}s.details={oldValue:o,value:i},a.addHistory(t,s)}}};a.textTemplate||t[s.text]!==l[s.text]||t[s.tags]!==l[s.tags]||t[s.priority]!==l[s.priority]||t[s.description]!==l[s.description]?(a._renderTask(e),r()):(r(),t[s.userId]!==l[s.userId]&&a._updateUserIcon(e),t[s.dueDate]!==l[s.dueDate]&&a._updateTaskDueDate(e),t[s.color]!==l[s.color]&&a._updateTaskColor(e),JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])?(a._updateTaskChecked(e),a._updateTaskProgress(e)):parseFloat(t[s.progress])!==parseFloat(l[s.progress])&&a._updateTaskProgress(e),a._updateTaskSubtasks(e),a._updateTaskCustomFields(e));const o=a.getColumn(t.status);o&&(t.statusLabel=o.label);const i=a.getColumn(l.status);i&&(l.statusLabel=i.label);const n=JSON.parse(JSON.stringify(t)),d=JSON.parse(JSON.stringify(l));if(n.history=t.history,d.history=l.history,a.$.fireEvent("change",{task:e,id:n.id,value:n,oldValue:d}),a.virtualization){const t=e.data[s.status],l=a.tasksByDataField[t].findIndex((t=>t.id===e.data.id));if(l>=0){a.tasksByDataField[t][l]=e.data;const s=a._getTasksByDataField(t),r=s.findIndex((t=>t.id===e.data.id));r>=0&&(s[r]=e.data)}}if(a._refreshScrollViewer(e.closest("smart-scroll-viewer")),a.dataSource&&a.dataSource.findIndex){const t=a.dataSource.findIndex((t=>e.data.id===t.id));t>=0&&(a.dataSource[t]=e.data)}a._refreshSummaries(),a._updateTaskComments(e),a._autoSaveState("dataSource"),a.$.fireEvent("taskUpdate",{id:n.id,value:n,oldValue:d})}(t=Object.assign({},l,t))[s.checklist]&&0===t[s.checklist].length&&(t[s.checklist]=null),JSON.stringify(t)!==JSON.stringify(l)&&(a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("update",t,(function(e){return e&&(a._ignoreVirtualDataSource=!0,r(),delete a._ignoreVirtualDataSource),e})):r())}_refreshSelection(){const e=this;if("zeroOrOne"===e.selectionMode){const t=e._selectionStart;e._selectedTasks.forEach((a=>{if(a!==t){e.getTask(a).selected=!1;const t=e.querySelector('[data-id="'+a+'"]');t&&t.removeAttribute("selected")}})),e._selectedTasks=[t]}e._selectedTasks.forEach((t=>{const a=e.querySelector('[data-id="'+t+'"]');a&&a.setAttribute("selected","")})),e._refreshColumns()}propertyChangedHandler(e,t,a){const s=this,l=s._dialog;function r(){if(s.cancelEdit(),l&&l.close(),s._closeList(s._commentsList,"_commentSelectionFor"),s._getCurrentUser(),s.taskSubTasks){const e=s.querySelectorAll(".smart-kanban-task-input");s._currentUser&&!s._currentUser.allowEdit||s.disabled||!s.taskSubTasksInput?e.forEach((e=>{e.classList.add("smart-hidden")})):e.forEach((e=>{e.classList.remove("smart-hidden")}))}}switch(super.propertyChangedHandler(e,t,a),e){case"columnColorEntireSurface":a?s.classList.add("smart-kanban-column-color"):s.classList.remove("smart-kanban-column-color");break;case"columnFooter":case"addNewButton":case"addNewButtonDisplayMode":s._reset(),s._createAddNewButton();break;case"taskTags":case"autoColumnHeight":case"applyColumnColorToTasks":case"columnWidth":case"addNewColumn":s._reset();break;case"taskCustomFields":s._resetFields=!0,s._reset();break;case"allowDrag":s._getCurrentUser();break;case"animation":case"theme":{let t=Array.from(s.$.container.querySelectorAll("smart-column-panel, smart-multi-column-filter-panel, smart-sort-panel"));l&&(t.push(l),t=t.concat(Array.from(l.$.footer.children)),l.editPanelPopulated&&(t=t.concat(Array.from(l.$.container.querySelectorAll(".smart-element.editor"))))),t.forEach((t=>t[e]=a)),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskColor(e)));break}case"autoSaveState":s._autoSaveState();break;case"collapsible":a||s.expandAll();break;case"columnSummary":s._refreshSummaries();break;case"columns":s._render(),l&&l.editPanelPopulated&&(l.editors.status.dataSource=s._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))));break;case"currentUser":r();break;case"dataSource":case"dataSourceMap":if("dataSourceMap"===e&&s._validateDataSourceMap(),s._customTags=[],s._selectedTasks=[],s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),0===s.columns.length)return s._renderColumns(),s._handleSwimlanes(),void s._processDataSource();Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e.clearContent(),e.refresh(),s._refreshScrollViewer(e,!0)})),s._processDataSource(),s.dataSource||s._refresh(),s.columnSummary&&s._refreshSummaries();break;case"disabled":s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),s._setFocusable();break;case"formatStringDate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskDueDate(e))),l&&(l.editors.startDate.formatString=a,l.editors.dueDate.formatString=a);break;case"formatStringTime":s._closeList(s._commentsList,"_commentSelectionFor");break;case"editable":s.cancelEdit(),s._actionsList.classList.contains("edit-comment")||s._closeList(s._actionsList,"_actionSelectionFor"),s._getCurrentUser();break;case"headerPosition":s._handleHeaderPosition(s.$.body),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"hierarchy":0===s.swimlanes.length&&s.columns.length!==s._allColumns.length&&s._reset();break;case"locale":case"messages":s.closePanel(),s._localizeHeader(),s._getInnerElementMessages(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._setActionsList(),s._setColumnActionsList(),s._setCommentsList(),l&&(s.cancelEdit(),l.close(),l.$.footer.firstElementChild.innerHTML=s.localize("ok"),l.$.footer.children[1].innerHTML=s.localize("cancel"),l.$.footer.children[2].innerHTML=s.localize("delete"),l.editPanelPopulated&&(l.editors.priority.dataSource=s._getPriority(),l.$.container.querySelector(".new-subtask").placeholder=s.localize("newSubtask"),l.$.container.querySelector("smart-button.add").title=s.localize("addSubtask"),Array.from(l.$.container.getElementsByClassName("editor-label")).forEach((e=>{let t=e.id.slice(s.id.length+5);t=t.slice(0,1).toLowerCase()+t.slice(1),e.innerHTML=s.localize(t)})))),s._customizePartCreated&&(s.$.customize.firstElementChild.messages=s._innerElementMessages.columnPanel,s.$.customize.firstElementChild.locale=s.locale),s._filterPartCreated&&(s.$.filter.firstElementChild.messages=s._innerElementMessages.multiColumnFilterPanel,s.$.filter.firstElementChild.locale=s.locale,s.$.filter.firstElementChild.editorPlaceholder=s.localize("filterValuePlaceholder")),s._sortPartCreated&&(s.$.sort.firstElementChild.messages=s._innerElementMessages.sortPanel,s.$.sort.firstElementChild.locale=s.locale);break;case"rightToLeft":s._reset(!0);break;case"selectionMode":"zeroOrOne"===a&&s._selectedTasks.length>1&&s._refreshSelection();break;case"swimlanes":if(s._validateSwimlanes(),JSON.stringify(s.swimlanes)===JSON.stringify(t))return;s._reset(),l&&l.editPanelPopulated&&(l.editors.swimlane.dataSource=s.swimlanes.map((e=>({label:e.label,value:e.dataField}))));break;case"swimlanesFrom":case"swimlanesTo":{const e=s.swimlanesFrom,t=s.swimlanesTo;e<0&&(s.swimlanesFrom=0),null!==t&&e>t&&(s.swimlanesFrom=t),s.swimlanes.length>0&&s._reset();break}case"taskCustomFieldsHide":case"taskProgress":case"taskSubTasksInput":case"taskSubTasks":case"taskUserIcon":case"taskComments":case"taskDue":case"taskPriority":case"tags":case"taskColor":case"taskColorEntireSurface":case"textTemplate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._renderTask(e))),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"unfocusable":s._setFocusable();break;case"priority":s._closeList(s._priorityList,"_prioritySelectionFor"),s._setPriorityList();break;case"users":s._closeList(s._userList,"_userSelectionFor"),s._setUserList(),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateUserIcon(e))),l&&l.editPanelPopulated&&(l.editors.userId.dataSource=s.users.map((e=>({label:e.name,value:e.id})))),r()}}_reset(e){const t=this,a=t.getState();t._allColumns=[],t._customTags=[],t._selectedTasks=[],t._dialog&&(t.cancelEdit(),e&&(t._dialog.remove(),delete t._dialog)),t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t.$.body.innerHTML="",Array.from(t.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),t._renderColumns(),t._handleSwimlanes(),t._createAddNewButton(),t.loadState(a),t.$.scrollViewer.refresh()}_refresh(){const e=this;e._allColumns=[],e._customTags=[],e._selectedTasks=[],e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e.$.body.innerHTML="",Array.from(e.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),e._renderColumns(),e._handleSwimlanes(),e._createAddNewButton(),e.$.scrollViewer.refresh()}_closeAllLists(){const e=this;e.cancelEdit(),e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e._closeList(e._priorityList,"_prioritySelectionFor")}_inlineTaskAdd(e,t){const a=this;if(a._inlineEditDetails&&a._inlineEditDetails.popup.parentNode){const e=a._addToBottom;a._inlineEditDetails.addTask(),a._addToBottom=e}const s=document.createElement("div"),l={},r=a.dataSourceMap;l[r.status]=e.dataField,a._currentUser.info&&(void 0===l[r.createdUserId]?(l[r.createdUserId]=a._currentUser.info.id,l[r.createdDate]=new Date):l[r.createdDate]||(l[r.createdDate]=new Date));const o=document.createElement("div");o.style.position="relative",o.classList.add("smart-kanban-task"),s.appendChild(o);const i=t.parentElement.querySelector(".smart-kanban-column-content-tasks");if(a._addToBottom)i.appendChild(s);else{const e=i.querySelector(".smart-kanban-task");e?e.parentElement.insertBefore(s,e):i.appendChild(s)}a._refreshButtonsAndSummaries();const n=document.createElement("textarea");n.placeholder=a.localize("textPlaceholder"),n.style.position="absolute",n.style.backgroundColor="transparent",n.style.borderLeftWidth=n.style.borderTopWidth=n.style.borderRightWidth=n.style.borderBottomWidth="0px",n.style.outline="0px",n.style.left="0px",n.style.bottom="0px",n.style.width="100%",n.style.height="100%",n.style.resize="none",o.style.height="70px",o.style.marginBottom="10px";const d=()=>{a._addToBottom?i.scrollTop=i.scrollHeight:i.scrollTop=0};o.appendChild(n),d();const c=()=>{const e=a._inlineEditDetails.input,t=a._inlineEditDetails.popup;e.onchange=e.onblur=null,t.remove(),l[a.dataSourceMap.text]=e.value,a.addTask(l,a._addToBottom?-1:0)&&d(),delete a._addToBottom};n.onchange=n.onblur=e=>{c(),e.preventDefault()},n.onkeydown=e=>{"Enter"===e.key?(c(),e.preventDefault()):"Escape"===e.key&&(n.onchange=n.onblur=null,s.remove(),a._refreshButtonsAndSummaries(),d(),e.preventDefault())," "===e.key&&e.stopPropagation()},a._inlineEditDetails={popup:s,input:n,addTask:c},setTimeout((()=>{n.focus()}),50)}_containerClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(t.$.header.contains(a))return void t._headerClickHandler(a,t.$.body);const s=a.closest(".smart-kanban-column-header");if(s){const l=s.parentElement.column;if(a instanceof HTMLInputElement)return;if(t.columnActions&&a.classList.contains("smart-kanban-column-actions")){if(!t._columnActionsList.parentElement||t._columnActionsList.classList.contains("smart-visibility-hidden")){if(t._columnActionsListDate&&new Date-t._columnActionsListDate<300)return;t._openColumnActionsList(a,l)}return}if(a.closest(".smart-kanban-column-header-add")&&l)return void(t.disableAddNewDialog?t._inlineTaskAdd(l,s,e):t._openDialog(l,"add","column"));if(t.collapsible&&l&&l.collapsible&&a.closest(".smart-kanban-column-header-toggle-button"))return void t[l.collapsed?"expand":"collapse"](l)}const l=a.closest(".smart-kanban-tab");if(l){if(l.classList.contains("selected"))return;const e=l.parentElement.querySelector(".selected");return e.classList.remove("selected"),e.setAttribute("aria-selected",!1),e.columnElement.classList.add("smart-hidden"),e.columnElement.column.selected=!1,l.classList.add("selected"),l.setAttribute("aria-selected",!0),l.columnElement.classList.remove("smart-hidden"),l.columnElement.column.selected=!0,t._selectedTabs=t._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),t._autoSaveState("tabs"),void t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}if(t.addNewColumn){const e=a.closest(".smart-kanban-add-new-column"),s=a.closest(".smart-color-input"),l=a.closest(".smart-kanban-column-header");if(!s&&e&&!e.querySelector(".pending")&&l)return void t._addNewColumnDynamically()}const r=a.closest(".smart-kanban-list .item");if(r){const e=r.getAttribute("data-id"),a=t._userSelectionFor,s=t._prioritySelectionFor;if(a){const s=t.dataSourceMap,l=a.data[s.userId],r=JSON.parse(JSON.stringify(a.data));if(parseInt(a.data[s.userId])===parseInt(e)?a.data[s.userId]=null:a.data[s.userId]=e,t._updateUserIcon(a),t._closeList(t._userList,"_userSelectionFor"),a.data[s.userId]!==l){t.dataSource&&t.dataSource.virtualDataSource&&t._requestVirtualDataSource("update",a.data,(function(e){return e||(a.data[s.userId]=l,t._updateUserIcon(a)),e}));const e=a.data;if(t._currentUser.info){a.data[s.updatedUserId]=t._currentUser.info.id,a.data[s.updatedDate]=new Date;const l={user:t._currentUser.info.id,label:e[s.text],date:e[s.updatedDate]};e[s.userId]!==r[s.userId]&&(l.action="user",l.details={oldValue:r[s.userId],value:e[s.userId]},t.addHistory(e,l))}const o=JSON.parse(JSON.stringify(e));t.$.fireEvent("change",{task:a,id:o.id,value:o,oldValue:r}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:r}),t._autoSaveState("dataSource")}return}if(s){const e=t.dataSourceMap,a=s.data[e.priority],l=JSON.parse(JSON.stringify(s.data));if(s.data[e.priority]=r.getAttribute("priority"),t._closeList(t._priorityList,"_prioritySelectionFor"),s.data[e.priority]!==a){t._currentUser.info&&(s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date);const a=s.data,r=JSON.parse(JSON.stringify(a));if(t._currentUser.info){s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date;const r={user:t._currentUser.info.id,date:a[e.updatedDate]};a[e.priority]!==l[e.priority]&&(r.action="priority",r.details={oldValue:l[e.priority],value:a[e.priority]},t.addHistory(a,r))}t.$.fireEvent("change",{task:s,id:r.id,value:r,oldValue:l}),t.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:l}),t._updateTaskPriority(s),t._autoSaveState("dataSource")}}const l=t._actionSelectionFor,o=t._columnActionSelectionFor;if(l){switch(parseFloat(e)){case 0:r.hasAttribute("edit")&&(t._actionsList.classList.contains("edit-comment")?(t._commentsList.textarea.value=l.comment.text,t._commentsList.textarea.focus(),t._commentsList.editing=l,l.parentElement.scrollTop=l.offsetTop):t.beginEdit(l));break;case 1:r.hasAttribute("copy")&&t.copyTask(l);break;case 2:r.hasAttribute("remove")&&(t._actionsList.classList.contains("edit-comment")?t._openDialog(l,"prompt","comment"):t.removeTask(l,!0))}return void t._closeList(t._actionsList,"_actionSelectionFor")}if(o){switch(parseFloat(e)){case 0:t._handleColumnEditing(o.dataField);break;case 1:{const e=t._columnToElement.get(o).querySelector(".smart-kanban-column-header-add");e?e.click():t._openDialog(o,"add","column");break}case 2:t.collapse(o);break;case 3:t._openDialog(o,"prompt","column");break;case 4:t.hide(o);break;case 5:t.showAllColumns()}return void t._closeList(t._columnActionsList,"columnActionSelectionFor")}}if(a.closest(".smart-kanban-list.comments")){const e=a.closest(".send");if(e){if(e.disabled)return;const a=JSON.parse(JSON.stringify(t._commentSelectionFor.data)),s=t._createComment();t._commentsList.textarea.value="",e.disabled=!0;const l=JSON.parse(JSON.stringify(t._commentSelectionFor.data));t.$.fireEvent("change",{task:t._commentSelectionFor,id:l.id,value:l,oldValue:a}),t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:a}),t.$.fireEvent("commentAdd",{id:l.id,value:s})}else if(a.classList.contains("remove-button")&&a.classList.contains("enabled")){const e=a.closest(".smart-comment");t._actionSelectionFor&&(t._actionSelectionFor===e||t._actionSelectionFor.classList.contains("smart-kanban-task")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,void 0,e)}return}const o=a.closest(".smart-kanban-task");if(o)if(a.classList.contains("smart-kanban-task-user"))!t.userList||!t._currentUser.allowEdit||t._userSelectionFor&&(t._userSelectionFor===o||t._userList.parentElement&&!t._userList.classList.contains("smart-visibility-hidden"))||t._openUserList(a,o);else if(a.classList.contains("priority")&&t.priorityList)!t._priorityList||!t._currentUser.allowEdit||t._prioritySelectionFor&&(t._prioritySelectionFor===o||t._priorityList.parentElement&&!t._priorityList.classList.contains("smart-visibility-hidden"))||t._openPriorityList(a,o);else if(t.taskActions&&a.classList.contains("smart-kanban-task-actions"))t._actionSelectionFor&&(t._actionSelectionFor===o||t._actionSelectionFor.classList.contains("comment")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,o);else if(t.taskComments&&a.classList.contains("smart-kanban-task-comments"))t.users.length>0&&(!t._commentSelectionFor||t._commentSelectionFor!==o&&(!t._commentsList.parentElement||t._commentsList.classList.contains("smart-visibility-hidden")))&&t._openCommentsList(a,o);else if((!t.taskSubTasksInput||!a.classList.contains("smart-kanban-task-input"))&&(!t.taskSubTasksInput||!a.classList.contains("smart-kanban-task-subtasks")||"singleClick"!==t.editMode)&&(!o||o.data)&&(t.$.fireEvent("taskClick",{id:o.data.id,value:o.data,element:o}),t._preventSelection||t._selectTask(e,o),"singleClick"!==t.editMode||t._dragDetails||"INPUT"===a.nodeName||"TEXTAREA"===a.nodeName||a.classList.contains("smart-kanban-task-subtasks-container")||"IMG"===a.nodeName||t.beginEdit(o),e.type))if(clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks){if(t._dblclickObject.numberOfClicks=0,o.hasAttribute("selected")||t._selectTask(e,o),t.$.fireEvent("taskDoubleClick",{id:o.data.id,value:o.data,element:o}).defaultPrevented)return;"doubleClick"===t.editMode&&t.beginEdit(o)}else t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300)}_selectTask(e,t){const a=this,s=a.selectionMode,l=()=>{a._selectedTasks.forEach((e=>{if(e!==t.data.id){const t=a.querySelector('[data-id="'+e+'"]');t&&t.removeAttribute("selected")}}))};function r(){l(),t.hasAttribute("selected")||(t.setAttribute("selected",""),a._selectedTasks=[t.data.id]),a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._autoSaveState("selection"),a._focusTask(t)}if("zeroOrOne"===s)l(),t.hasAttribute("selected")?(a._focusTask(t),t.removeAttribute("selected"),a._selectedTasks=[],delete a._selectionInView):(t.setAttribute("selected",""),a._selectedTasks=[t.data.id],a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._focusTask(t)),a.virtualization&&a._refreshColumns();else{if(!e.ctrlKey&&!e.shiftKey&&!e.metaKey||0===a._selectedTasks.length||t.closest("smart-scroll-viewer")!==a._selectionInView)return void r();if(e.ctrlKey||e.metaKey)t.hasAttribute("selected")?(t.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((e=>e!==t.data.id))):(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id),a._selectionStart=t.data.id);else if(e.shiftKey){if(t&&t.id===a._selectionStart)return a._selectedTasks.length>1&&r(),void(a.virtualization&&a._refreshColumns());const e=t[a.dataSourceMap.status],s=a._getTasksByDataField(e),l=a.getTask(a._selectionStart);let o=s.indexOf(l),i=s.indexOf(t.id);const n=o;o=Math.min(o,i),i=Math.max(n,i),a._selectedTasks=[],s.forEach(((e,t)=>{const s=a.querySelector('[data-id="'+e.id+'"]');t>=o&&t<=i&&!e.filteredOut?(s&&s.setAttribute("selected",""),a._selectedTasks.push(e.id)):s&&s.removeAttribute("selected")}))}a._focusTask(t)}a.virtualization&&a._refreshColumns(),a._autoSaveState("selection")}_processDataSource(){const e=this;let t=e.dataSource;if(0!==e.columns.length&&null!=t){if(t instanceof Smart.DataAdapter){if(t.virtualDataSource)return void e._requestVirtualDataSource("dataBind");t=t.dataSource}t.length>500&&(e.virtualization=!0),t.forEach((t=>{e._createTask(t)})),e.virtualization&&(e._measureCardHeight(),e._refreshColumns()),e.whenRendered((()=>e._allColumns.forEach((t=>e._refreshScrollViewer(t)))))}}_requestVirtualDataSource(e,t,a){const s=this,l=s.dataSourceMap,r=[],o=[],i={},n=s._appliedFiltering;let d=null;if(n&&n.filterGroups.length>0&&(n.filterGroups.forEach((e=>o[e[0]]=e[1])),o.length=n.filterGroups.length,d=n.operator),s._appliedSorting&&s._appliedSorting.dataFields.length>0&&(s._appliedSorting.dataFields.forEach(((e,t)=>{let a=s._appliedSorting.orderBy[t].replace("ending","");r[e]={sortOrder:a,sortIndex:t}})),r.length=s._appliedSorting.dataFields.length),void 0!==t){const e=Object.assign({},t);e[l.checklist]=JSON.stringify(e[l.checklist]),e[l.history]=JSON.stringify(e[l.history],(function(e,t){return"date"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.comments]=JSON.stringify(e[l.comments],(function(e,t){return"time"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.updatedDate]&&(e[l.updatedDate]=e[l.updatedDate].toISOString().slice(0,10)),e[l.createdDate]&&(e[l.createdDate]=e[l.createdDate].toISOString().slice(0,10)),e[l.dueDate]&&(e[l.dueDate]=e[l.dueDate].toISOString().slice(0,10)),e[l.startDate]&&(e[l.startDate]=e[l.startDate].toISOString().slice(0,10)),i.row=e}s.dataSource.onVirtualDataSourceRequested((function(t){let l=!0;-1!==["add","update","remove"].indexOf(e)&&a&&(l=a(t.result),"add"!==e)||l&&(Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),s.dataSource.dataSource.forEach((e=>{s._createTask(e)})),s._allColumns.forEach((e=>s._refreshScrollViewer(e))),s._autoSaveState("dataSource"))}),{first:0,last:0,sorting:r,filtering:o,filterOperator:d,grouping:[],edit:i,action:e})}_setUserList(){const e=this,t=document.createElement("div");t.id=e.id+"UserList",t.className="smart-kanban-list users smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e.users.forEach((e=>{const a=document.createElement("div"),s=e?e.image:null,l=s?`background-image: url('${s}');`:"";a.className="item",a.innerHTML=`<div class="icon" style="${l}"></div><div class="name">${e.name}</div>`,a.setAttribute("data-id",e.id),a.setAttribute("role","option"),t.appendChild(a)})),e._userList=t}_setPriorityList(){const e=this,t=document.createElement("div");t.id=e.id+"PriorityList",t.className="smart-kanban-list priority smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e._getPriority().forEach((e=>{const a=document.createElement("div");a.className="item",e.menuLabel?a.innerHTML=e.menuLabel:a.innerHTML=`<div priority="${e.value}" class="smart-kanban-task-text">${e.menuIcon}${e.label}</div>`,a.setAttribute("priority",e.value),a.setAttribute("role","option"),t.appendChild(a)})),e._priorityList=t;const a=e._dialog;a&&a.editPanelPopulated&&(a.editors.priority.dataSource=e._getPriority())}_openList(e,t,a){const s=this,l=e.getBoundingClientRect();let r,o,i=l.left,n=l.top+e.offsetHeight;a=s.rightToLeft?!a:a,1===window.devicePixelRatio?(r=document.documentElement.clientWidth,o=document.documentElement.clientHeight):(r=window.innerWidth,o=window.innerHeight),t.classList.add("dialog"),document.body.appendChild(t),a&&(i=l.right-t.offsetWidth),i+t.offsetWidth>r&&(i=r-t.offsetWidth),n+t.offsetHeight>o&&(n=o-t.offsetHeight),t.style.left=Math.max(0,i)+"px",t.style.top=n+"px",t.classList.remove("smart-visibility-hidden"),e.setAttribute("aria-expanded",!0),e.setAttribute("aria-controls",t.id),s.unfocusable||requestAnimationFrame((function e(){0===t.getBoundingClientRect().height?requestAnimationFrame(e):t.focus()})),t.openedFrom=e,t.onclick=e=>{s._containerClickHandler(e)}}_openUserList(e,t){const a=this;if(0===a.users.length)return;const s=t.data[a.dataSourceMap.userId],l=a._userList,r=l.querySelector(".selected");if(r&&(r.classList.remove("selected"),r.removeAttribute("aria-selected")),a._openList(e,l),null!==s){const e=Array.from(l.children).find((e=>e.getAttribute("data-id")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._userSelectionFor=t}_openPriorityList(e,t){const a=this,s=t.data[a.dataSourceMap.priority],l=a._priorityList,r=l.querySelector(".selected");if(r&&(r.classList.remove("selected"),r.removeAttribute("aria-selected")),a._openList(e,l),null!=s){const e=Array.from(l.children).find((e=>e.getAttribute("priority")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._prioritySelectionFor=t}_closeList(e,t){const a=this;if(!e||!e.parentElement)return;const s=a.$.container.querySelector(`[aria-expanded="true"][aria-controls="${e.id}"]`);e.classList.add("smart-visibility-hidden"),requestAnimationFrame((function s(){e.classList.contains("smart-visibility-hidden")&&(e.getBoundingClientRect().height>0?requestAnimationFrame(s):(e.remove(),delete e.openedFrom,delete a[t]))})),s&&(s.removeAttribute("aria-expanded"),s.removeAttribute("aria-controls"))}_setActionsList(){const e=this,t=document.createElement("div");if(t.id=e.id+"ActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" edit data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n<div class="item" copy data-id="1" role="menuitem"><div class="name">${e.localize("copy")}</div></div>\n<div class="item" remove data-id="2" role="menuitem"><div class="name">${e.localize("remove")}</div></div>`,e.taskActionsRendered){e.taskActionsRendered(t);const a=Array.from(t.children);for(let e=0;e<a.length;e++){const t=a[e];t.classList.add("item"),t.setAttribute("data-id",e),t.setAttribute("role","menuitem"),t.firstElementChild&&t.firstElementChild.classList.add("name")}}e._actionsList=t}_setColumnActionsList(){const e=this,t=document.createElement("div");t.id=e.id+"ColumnActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n <div class="item" data-id="1" role="menuitem"><div class="name">${e.localize("addNewTask")}</div></div>\n <div class="item" data-id="2" role="menuitem"><div class="name">${e.localize("collapse")}</div></div>\n <div class="item" data-id="3" role="menuitem"><div class="name">${e.localize("removeColumn")}</div></div>\n <div class="item" data-id="4" role="menuitem"><div class="name">${e.localize("hideColumn")}</div></div>\n <div class="item" data-id="5" role="menuitem"><div class="name">${e.localize("showAllColumns")}</div></div>`,e._columnActionsList=t}_openActionsList(e,t,a){const s=this,l=s._currentUser,r=s._actionsList;s._openList(e,r,a),r.classList.toggle("edit-comment",!!a),s._actionSelectionFor=t||a,r.children[0]&&r.children[0].hasAttribute("edit")&&(t&&!l.allowEdit?r.children[0].classList.add("smart-hidden"):r.children[0].classList.remove("smart-hidden")),r.children[1]&&r.children[1].hasAttribute("add")&&(t&&!l.allowAdd?r.children[1].classList.add("smart-hidden"):r.children[1].classList.remove("smart-hidden")),r.children[2]&&r.children[0].hasAttribute("remove")&&(t&&!l.allowRemove?r.children[2].classList.add("smart-hidden"):r.children[2].classList.remove("smart-hidden")),Array.from(r.children).forEach((e=>e.classList.remove("selected")))}_openColumnActionsList(e,t){const a=this,s=a._columnActionsList,l=s.children;a.allowColumnEdit&&t.editable&&"header"!==a.columnEditMode?l[0].classList.remove("smart-hidden"):l[0].classList.add("smart-hidden"),a.addNewButton&&t.addNewButton?l[1].classList.remove("smart-hidden"):l[1].classList.add("smart-hidden"),a.allowColumnRemove&&t.allowRemove&&a._allColumns.length>1?l[3].classList.remove("smart-hidden"):l[3].classList.add("smart-hidden"),a.collapsible&&t.collapsible?l[2].classList.remove("smart-hidden"):l[2].classList.add("smart-hidden"),a.allowColumnHide&&t.allowHide&&a._allColumns.length>1?(l[4].classList.remove("smart-hidden"),l[5].classList.remove("smart-hidden")):(l[4].classList.add("smart-hidden"),l[5].classList.add("smart-hidden")),a._openList(e,s),a._columnActionSelectionFor=t,Array.from(s.children).forEach((e=>e.classList.remove("selected")))}_setCommentsList(){const e=this,t=document.createElement("div");t.id=e.id+"CommentsList",t.className="smart-kanban-list comments smart-visibility-hidden",t.setAttribute("role","dialog"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="smart-kanban-comments" role="list"></div>\n<div class="smart-kanban-new-comment" role="presentation">\n <textarea placeholder="${e.localize("newComment")}"></textarea>\n <smart-button class="send primary" disabled${e._rtlAttr}>${e.localize("send")}</smart-button>\n</div>`;const a=t.querySelector("textarea"),s=t.querySelector("smart-button");s.tabIndex=0,a.onfocus=()=>{t.classList.add("expanded"),s.disabled=""===a.value},a.onblur=e=>{s.contains(e.relatedTarget)||t.classList.remove("expanded")},a.onkeyup=()=>{s.disabled=""===a.value},a.oncut=()=>{s.disabled=""===a.value},a.onpaste=()=>{s.disabled=""===a.value},t.textarea=a,t.button=s,e._commentsList=t}_openCommentsList(e,t){const a=this,s=a._commentsList;s.classList.remove("expanded"),s.firstElementChild.innerHTML="",s.textarea.value="",s.textarea.disabled=!a._currentUser.allowComment,a.unfocusable?s.textarea.tabIndex=-1:s.textarea.removeAttribute("tabindex"),delete s.editing,t.data[a.dataSourceMap.comments].forEach((e=>a._createComment(e))),a._openList(e,s),a._commentSelectionFor=t}_getCommentsList(e){const t=this,a=t._commentsList;return a.classList.remove("expanded"),a.firstElementChild.innerHTML="",a.textarea.value="",a.textarea.disabled=!t._currentUser.allowComment,t.unfocusable?a.textarea.tabIndex=-1:a.textarea.removeAttribute("tabindex"),delete a.editing,e.data[t.dataSourceMap.comments].forEach((e=>t._createComment(e))),t._commentSelectionFor=e,a.classList.remove("smart-visibility-hidden"),a}_createComment(e){const t=this,a=document.createElement("div");let s,l;function r(){const r=t._commentsList.firstElementChild,o=l?l.image:null,i=l?l.name||l.id:t.localize("guestUser"),n=l?l.name:t.localize("guestUser");a.classList="smart-comment",a.setAttribute("role","listitem");const d=o?`background-image: url('${o}');`:"";a.innerHTML=`<div class="comment-indent" role="presentation">\n <div class="user-icon" style="${d}" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n <div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&l.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}"${t._tabindex} role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n </div>\n <div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,a.comment=e,o||a.querySelector(".user-icon").classList.add("empty"),r.appendChild(a),s&&(r.scrollTop=r.scrollHeight-r.offsetHeight)}if(e)l=t.users.find((t=>t.id===e.userId));else{const a=t.dataSourceMap,o=t.dataSource&&t.dataSource.virtualDataSource,i=t._commentsList.textarea.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),n=t._commentsList.editing,d=t._commentSelectionFor.data,c=JSON.parse(JSON.stringify(d));if(n){if(o){const e=Object.assign({},d);e[a.comments]=e[a.comments].slice(0),e[a.comments][e[a.comments].indexOf(n.comment)]=Object.assign({},n.comment,{text:i}),t._requestVirtualDataSource("update",e,(function(a){return a&&(t._commentSelectionFor.data=e,n.querySelector(".comment-body").innerHTML=i),delete t._commentsList.editing,a}))}else n.querySelector(".comment-body").innerHTML=i,n.comment.text=i,delete t._commentsList.editing;return t.$.fireEvent("commentUpdate",{id:d.id,value:n.comment}),t.$.fireEvent("taskUpdate",{id:d.id,value:d,oldValue:c}),void t.$.fireEvent("change",{task:t._commentSelectionFor,id:d.id,value:d,oldValue:c})}if(s=!0,e={text:i,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:t._currentUser.info?t._currentUser.info.id:-1,time:new Date},l=t._currentUser.info,o){const s=Object.assign({},d);s[a.comments]=s[a.comments].slice(0),s[a.comments].push(e),t._requestVirtualDataSource("update",s,(function(e){return e&&(t._commentSelectionFor.data=s,t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",s[a.comments].length||""),r()),e}))}else d[a.comments].push(e),t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",d[a.comments].length||"")}return e.time instanceof Date==0&&(e.time=new Date(e.time),e.time.setTime(e.time.getTime()-1*e.time.getTimezoneOffset()*60*1e3)),r(),e}_getTaskIndexByPosition(e,t){const a=(e,t)=>{const a=e.top,s=e.top+e.height,l=a<=t&&s>t;return 0!==e.height&&l},s=(t=>{let s=0,l=t.length-1;if(e<=0)return 0;const r=t[t.length-1];if(-1!==r.top&&r.top<=e)return t.length-1;for(;;){const r=Math.floor((s+l)/2),o=t[r];if(a(o,e))return r;o.top<e?s=r+1:o.top>e?l=r-1:s=r+1}})(t);return s}_refreshColumns(){const e=this;e.virtualization&&e._allColumns.forEach((t=>{e._refreshColumn(t.dataField)}))}_refreshColumn(e){const t=this.getColumn(e),a=this._columnToElement.get(t);if(!a)return;const s=a.querySelector("smart-scroll-viewer");this._refreshScrollHeight(s,e)}_getTasksByDataField(e){const t=this;let a=t.tasksByDataField[e];return a?a._filtered?a._filtered:a._sorted?a._sorted:a:(t.tasksByDataField[e]=[],t.tasksByDataField[e])}_refreshEmptyColumnState(e,t){const a=this;e&&(e.querySelector(".smart-kanban-task")||e.querySelector(".smart-kanban-task")&&!t?(e.removeAttribute("empty",a.localize("empty")),e.classList.remove("empty")):(e.setAttribute("empty",a.localize("empty")),e.classList.add("empty")))}_refreshScrollHeight(e,t){const a=this;if(a._refreshEmptyColumnState(e,t),!a.virtualization)return;const s=a._getTasksByDataField(t);if(!s)return;const l=a._autoCardHeight?a._autoCardHeight:a.cardHeight;e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight;for(let e=0;e<s.length;e++){const t=s[e];t.top=e*l,t.height=l}const r=e.querySelector(".smart-scroll-viewer-content-container"),o=e=>{const l=a._getTaskIndexByPosition(e,s),o=a.uiTasksByDataField[t].length;for(let e=0;e<o;e++){const o=s[l+e],i=a.uiTasksByDataField[t][e];i&&(a._dragDetails&&(i.classList.remove("dragged"),o&&a._dragDetails.ItemsData.forEach((e=>{e.id===o.id&&i.classList.add("dragged")}))),o?i.classList.remove("smart-hidden"):i.classList.add("smart-hidden"),0===e&&(r.style.marginTop=o?o.top+"px":"0px"),o)&&(i.hasAttribute("selected")&&i.removeAttribute("selected"),i.hasAttribute("focus")&&i.removeAttribute("focus"),JSON.stringify(o)!==JSON.stringify(i.data)&&(i.data=o,a._renderTask(i)),a._selectedTasks&&a._selectedTasks.indexOf(o.id)>=0&&i.setAttribute("selected",""),a._focusedTask===o.id&&i.setAttribute("focus",""))}};e.onVerticalChange=e=>{const t=e.detail.value;o(t)},a.uiTasksByDataField[t]||(a.uiTasksByDataField[t]=[]);const i=Math.round(e.offsetHeight/l)+2,n=a.uiTasksByDataField[t].length;if(0===n||n<i){const r=Math.round(e.offsetHeight/l)+2;for(let e=0;e<r;e++){const l=s[e];if(!l)continue;const r=a._createVirtualTask(l);a.uiTasksByDataField[t].push(r)}e.refresh(),e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight,o(e.scrollTop)}else o(e.scrollTop)}_createVirtualTask(e,t){const a=this,s=a.dataSourceMap,l=a._allColumns.find((t=>t.dataField===e[s.status]));if(!l)return;const r=document.createElement("div"),o=a._columnToElement.get(l),i=a.getTaskScrollViewer(o,e);return void 0===e[s.id]&&(e[s.id]=Math.floor(9e4*Math.random()+1e4)),r.className="smart-kanban-task smart-unselectable",r.setAttribute("role","listitem"),r.setAttribute("data-id",e[s.id]),a._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=a._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date),e[s.history]=[],a.addHistory(e,{action:"created",user:a._currentUser.info.id,details:{value:e[s.text]},date:e[s.createdDate]})),r.data=e,r.column=l,a._renderTask(r),e.class&&"string"==typeof e.class&&r.classList.add(e.class),i.appendChild(r),a._updateTaskColor(r),t&&(l.collapsed?i.toRefresh=!0:i.refresh()),r}_measureCardHeight(){const e=this,t=Object.keys(e.tasksByDataField);if(0===t.length||0===e.columns.length)return null;if(null===e.cardHeight&&!e._autoCardHeight){const a=e.tasksByDataField[t[0]],s=e._createVirtualTask(a[0]);e._renderTask(s),a.class&&"string"==typeof a.class&&s.classList.add(a.class);const l=e.columns[0],r=e._columnToElement.get(l),o=e.getTaskScrollViewer(r,a);o.appendChild(s);const i=o.querySelector(".smart-scroll-viewer-content-container"),n=getComputedStyle(i).rowGap;e._autoCardHeight=s.offsetHeight+parseInt(n),s.remove()}}_createTask(e,t,a){const s=this,l=s.dataSourceMap,r=s._allColumns.find((t=>t.dataField===e[l.status]));if(!r)return;const o=document.createElement("div"),i=s._columnToElement.get(r),n=s.getTaskScrollViewer(i,e);if(void 0===e[l.id]&&(e[l.id]=Math.floor(9e4*Math.random()+1e4)),o.className="smart-kanban-task smart-unselectable",o.setAttribute("role","listitem"),o.setAttribute("data-id",e[l.id]),s._currentUser&&s._currentUser.info&&(void 0===e[l.createdUserId]?(e[l.createdUserId]=s._currentUser.info.id,e[l.createdDate]=new Date):e[l.createdDate]||(e[l.createdDate]=new Date),e[l.history]||(e[l.history]=[],s.addHistory(e,{action:"created",user:s._currentUser.info.id,details:{value:e[l.text]},date:e[l.createdDate]}))),o.data=e,o.column=r,s.tasksByDataField[r.dataField]||(s.tasksByDataField[r.dataField]=[]),a>=0?s.tasksByDataField[r.dataField].splice(a,0,e):s.tasksByDataField[r.dataField].push(e),s.taskById[e.id]=e,!s.virtualization){if(s._renderTask(o),e.class&&"string"==typeof e.class&&o.classList.add(e.class),a>=0){const e=n.querySelector(".smart-kanban-task");e?e.parentElement.insertBefore(o,e):n.appendChild(o)}else n.appendChild(o);return s._updateTaskColor(o),t&&(r.collapsed?n.toRefresh=!0:n.refresh()),o}}getTaskScrollViewer(e,t){const a=this,s=a.dataSourceMap;let l;return a._hasSwimlane(e.index)?void 0!==t[s.swimlane]&&a.swimlanes.find((e=>e.dataField===t[s.swimlane]))?l=e.querySelector(`smart-scroll-viewer[swimlane="${t[s.swimlane]}"]`):(l=e.querySelector("smart-scroll-viewer"),t[s.swimlane]=l.getAttribute("swimlane")):(l=e.querySelector("smart-scroll-viewer"),delete t[s.swimlane]),l}_renderTask(e){const t=this;t._applyTaskTemplate(e),t._updateUserIcon(e),t._updateTaskChecked(e),t._updateTaskProgress(e),t._updateTaskDueDate(e),e.parentElement&&t._updateTaskColor(e),t._updateTaskPriority(e),e.column&&t.columnSummary&&t._updateColumnSummary(e.column),t.onTaskRender&&t.onTaskRender(e,e.data)}_refreshSummaries(){const e=this,t=e.querySelectorAll(".smart-kanban-column");for(let a=0;a<t.length;a++){const s=t[a].column;e._updateColumnSummary(s)}}_updateColumnSummary(e){const t=this,a=t._columnToElement.get(e);if(!a||!t.columnSummary)return;const s=t._getColumnSummary(e),l=a.querySelector(".summary");if(l&&(l.innerHTML=s),t.columnFooter){const l=a.querySelector(".smart-kanban-column-footer");if(s.length){let e=parseInt(s.replace("(","").replace(")","").trim());l.innerHTML=1===e?t.localize("tasksSummaryOne"):t.localize("tasksSummary",{summary:e})}else l.innerHTML="";t.onColumnFooterRender&&t.onColumnFooterRender(l,e,e.dataField)}a.removeAttribute("wip-min-error"),a.removeAttribute("wip-max-error"),void 0!==e.min&&(a.setAttribute("min",e.min),s.length?parseInt(s.replace("(","").replace(")","").trim())<e.min&&a.setAttribute("wip-min-error",""):0<e.min&&a.setAttribute("wip-min-error","")),void 0!==e.max&&(a.setAttribute("max",e.max),s.length)&&parseInt(s.replace("(","").replace(")","").trim())>e.max&&a.setAttribute("wip-max-error","")}_createImageModal(e,t){const a=this,s=document.createElement("smart-window");s.animation=a.animation,s.headerButtons=["close"],s.rightToLeft=a.rightToLeft,s.resizeMode="none",s.theme=a.theme,s.style.height="auto",s.style.width="auto",s.style.maxWidth="1200px",s.style.maxHeight="1200px",document.body.appendChild(s),s.onclose=()=>{document.body.removeChild(s)},s.innerHTML="",s.label=e.title;const l=e.cloneNode(!0);e.hasAttribute("value")&&(l.src=e.getAttribute("value")),l.removeAttribute("onpointerdown"),l.removeAttribute("width"),l.removeAttribute("height"),l.style.maxWidth="1000px",l.style.maxHeight="1000px",s.appendChild(l),s.open(),t.stopPropagation(),t.preventDefault()}_applyTagsContent(e,t,a){const s=this;let l=s.tags;const r=s.dataSourceMap;l||(l=[]);let o="";if(e&&e.indexOf&&e.indexOf("{")>=0&&(e=JSON.parse(e)),e&&"string"==typeof e){if("[]"===e)return t[r.tags]="",o;e=e.split(",");for(let t=0;t<e.length;t++)e[t]=e[t].trim();l&&l.length>0?(e=e.filter((e=>{if(-1!==l.indexOf(e))return!0})),t[r.tags]=e.join(", ")):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=[],o=e.map((e=>`<span class="smart-kanban-task-tag" role="listitem">${e}</span>`)).join("")}else e&&"object"==typeof e?(Array.isArray(e)||(e=[e],t[r.tags]=e),l.length>0?(s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=e.filter((e=>{if(-1!==l.indexOf(e))return!0;if(e.value){let t=!1;if(l.find((a=>{a===e.value&&(t=!0),a.value===e.value&&(t=!0)})),t)return!0}})),t[r.tags]=e):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):(e=[],t[r.tags]=[]),o=e.map((e=>{if(e.color){const t=e.color||"rgba(var(--smart-primary-rgb), 0.15)",a=document.createElement("div");document.body.appendChild(a),a.style.backgroundColor=t;const s=getComputedStyle(a).backgroundColor;return a.remove(),`<span style="color: ${new Smart.Color(s).getInvertedColor()}; background: ${t} " class="smart-kanban-task-tag" role="listitem">${e.label}</span>`}return`<span class="smart-kanban-task-tag" role="listitem">${"string"==typeof e?e:e.label}</span>`})).join("")):t[r.tags]="";return o}_applyTaskTemplate(e){const t=this,a=t.dataSourceMap,s=(t.tags,e.data),l=t._tabindex;let r=s[a.text],o=s[a.description],i=s[a.tags],n="",d=r;void 0===r&&(r="",s[a.text]="",d=r),void 0===o&&(o="",s[a.description]=""),r=t._applyTextTemplate(r,s,e),n=t._applyTagsContent(i,s,e),"string"==typeof s[a.priority]&&(s[a.priority]=s[a.priority].toLowerCase());const c=t._getPriority();let u=c.findIndex((e=>e.value===s[a.priority]));const m=c.length>0&&u>=0?c[u]:null;s[a.comments]&&Array.isArray(s[a.comments])||(s[a.comments]=[]);const p=t.localize(s[a.priority])+" "+t.localize("priority");let h=d?`${d}: ${p}`:`${p}`;t.taskPriority||(h=d);let g=`<div class="smart-kanban-task-cover"></div><div title="${h}" class="smart-kanban-task-content" role="presentation">\n <div class="smart-kanban-task-text">${r}`;g+=m?`${m.menuIcon}`:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',g+=`</div>\n <div class="smart-kanban-task-user"${l} role="button" aria-haspopup="listbox"></div>\n</div>\n<div class="smart-kanban-task-info" role="presentation">\n <div class="smart-kanban-task-progress-container">\n <div class="smart-kanban-task-progress" role="progressbar" aria-label="Task progress" aria-valuemin="0" aria-valuemax="100"></div>\n <div class="smart-kanban-task-checked" aria-label="Completed sub-tasks"></div>\n </div>\n <div class="smart-kanban-task-due" aria-label="Task due date"></div>\n</div>\n<div class="smart-kanban-task-fields"></div>\n<div class="smart-hidden smart-kanban-task-subtasks">\n <div class="smart-kanban-task-subtasks-container"></div>\n <div><input class="smart-kanban-task-input smart-input" placeholder="${t.localize("newSubtask")}"/></div>\n</div>\n<div class="smart-hidden smart-kanban-task-custom-fields"></div>\n<div class="smart-kanban-task-footer" role="toolbar" aria-label="Task footer">\n <div class="smart-kanban-task-tags" role="list" aria-label="Tags list">${n}</div>\n <div class="smart-kanban-task-edit smart-hidden"${l} title="${t.localize("edit")}" role="button" aria-label="Edit"></div>\n <div title="${t.localize("actionsList")}" class="smart-kanban-task-actions"${l} role="button" aria-haspopup="menu" aria-label="Open actions list"></div>\n <div class="smart-kanban-task-comments"${l} num="${s[a.comments].length||""}" role="button" aria-haspopup="dialog" aria-label="Open comments list"></div>\n <div class="smart-kanban-task-description smart-hidden"${l} title="${t.localize("taskDescription",{value:s[a.description]})}" num="${s[a.description]?s[a.description].length:""}" role="button" aria-label="Show description"></div>\n</div>`,e.innerHTML=g,e.setAttribute("aria-label",s[a.text]);const f=e.querySelector(".smart-kanban-task-description");s[a.description]?f.classList.remove("smart-hidden"):f.classList.add("smart-hidden");const b=e.querySelector(".smart-kanban-task-edit");t.editable?b.classList.remove("smart-hidden"):b.classList.add("smart-hidden"),b.onpointerdown=a=>{t.beginEdit(e),a.preventDefault(),a.stopPropagation()},e.onmousemove=()=>{Smart.Kanban.kanbanTaskDragged&&t.allowDropPlaceholder&&setTimeout((()=>{const a=e.classList.contains("before"),s=e.classList.contains("after");(a||s)&&(Smart.Kanban.dropOverTask&&Smart.Kanban.dropOverTask!==e&&delete Smart.Kanban.isBefore,Smart.Kanban.isBefore!==a&&(Smart.Kanban.isBefore=a,Smart.Kanban.dropOverTask=e,(a=>{e.classList.add("smart-kanban-task-placeholder"),t._dropAreaTimer&&clearTimeout(t._dropAreaTimer),t._dropAreaTimer=setTimeout((()=>{setTimeout((()=>{document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.style.marginTop=e.style.marginBottom="0px"}));const s=e.closest(".smart-kanban-column");if(s&&s.hasAttribute("orientation")&&"horizontal"!==s.getAttribute("orientation")){const s=t._dragDetails?t._dragDetails.Item:null;e!==s&&(a?e.previousElementSibling!==s&&(e.style.marginTop="100px"):e.nextElementSibling!==s&&(e.style.marginBottom="100px"))}t._refreshButtonsAndSummaries()}),20)}),20)})(a)))}))},t._updateTaskCustomFields(e),t._updateTaskSubtasks(e)}_updateTaskCustomFields(e){const t=this,a=e.data;if(t.taskCustomFieldsHide){const t=e.querySelector(".smart-kanban-task-custom-fields");t&&t.classList.remove("smart-hidden")}else if(t.taskCustomFields.length>0&&!t.taskCustomFieldsHide){const s=e.querySelector(".smart-kanban-task-custom-fields");s.classList.remove("smart-hidden");for(let l=0;l<t.taskCustomFields.length;l++){const r=t.taskCustomFields[l];let o=a[r.dataField],i="";if(!t.dataSourceMap[r.dataField]&&"password"!==r.editor)if(null!=o&&!1!==r.visible){if(void 0===r.visible&&(r.visible=!0),void 0===r.allowHide&&(r.allowHide=!0),"string"==typeof o&&(!r.dataSource||r.dataSource&&0===r.dataSource.length)&&o.length>50){if(o.indexOf("base64")>=0){o=JSON.parse(o),window.Smart._createSmartImageModal=t._createImageModal;let e="";for(let t=0;t<o.length;t++){const a=o[t];e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${a.value}" title="${a.label}"/>`}o=e}else if(r.image&&o.indexOf("http")>=0){if(window.Smart._createSmartImageModal=t._createImageModal,o.indexOf(",")>=0){let e="";o=o.split(",");for(let t=0;t<o.length;t++)e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${o[t]}"/>`;o=e}else o=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${o}"/>`;if(r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else if(r.image&&o.indexOf("http")>=0||r.editor&&"image"===r.editor&&o.indexOf("http")>=0)if(window.Smart._createSmartImageModal=t._createImageModal,o.indexOf("[{")>=0){o=JSON.parse(o);let e="";for(let t=0;t<o.length;t++){const a=o[t];a.label||(a.label=""),e+=`<img title="${a.label}" style="margin-left: 5px;" value="${a.value}" onpointerdown="Smart._createSmartImageModal(this, event)" src="${a.small||a.value}"/>`}o=e}else i=o,o=o.substring(0,50)+"...";else if(r.image){if(o=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${o}"/>`,r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else if("dateInput"===r.editor)o=new Smart.Utilities.DateTime(o).toString(this.formatStringDate);else if("dateRangeInput"===r.editor)o&&o.length&&(o[0]=new Smart.Utilities.DateTime(o[0]).toString(this.formatStringDate),o[1]=new Smart.Utilities.DateTime(o[1]).toString(this.formatStringDate),o=o[0]+"-"+o[1]);else if(r.dataSource)if(o&&o.indexOf(",")>0&&(o=o.split(",")),void 0!==o&&Array.isArray(o)){let e=[];for(let t=0;t<o.length;t++){const a=r.dataSource.find((e=>{if(e.value===o[t])return e}));a&&e.push(a.label)}o=e.toString()}else{const e=r.dataSource.find((e=>{if(e.value===o)return e}));e&&e.label&&(o=e.label)}const a=e.querySelector("[data-field="+r.dataField+"]");if(a)a.innerHTML=`<div class="smart-kanban-task-field-label">${r.label}</div><div title="${i}" class="smart-kanban-task-field-value">${o}</div>`,a.classList.remove("smart-hidden");else{const e=document.createElement("div");e.classList.add("smart-kanban-task-field"),e.setAttribute("data-field",r.dataField),e.innerHTML=`<div class="smart-kanban-task-field-label">${r.label}</div><div title="${i}" class="smart-kanban-task-field-value">${o}</div>`,s.appendChild(e)}}}else{const t=e.querySelector("[data-field="+r.dataField+"]");t&&t.classList.add("smart-hidden")}}}}_updateTaskSubtasks(e){const t=this;if("none"===t.taskSubTasks)return void e.querySelector(".smart-kanban-task-subtasks").classList.add("smart-hidden");const a=e.data,s=t.dataSourceMap,l=[],r=[];(a[s.checklist]||[]).forEach(((e,t)=>{e.completed&&l.push(t),r.push({label:e.text,selected:!0===e.completed})}));const o=e.querySelector(".smart-kanban-task-subtasks"),i=e.querySelector(".smart-kanban-task-subtasks-container");i.innerHTML="",o.classList.remove("smart-hidden");const n=e.querySelector(".smart-kanban-task-input");t._currentUser&&!t._currentUser.allowEdit||t.disabled||!t.taskSubTasksInput?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"),n.onfocus=function(e){e.preventDefault(),e.stopPropagation()},n.onkeydown=e=>{"Escape"===e.key&&(n.value="",n.blur())," "===e.key&&e.stopPropagation()},n.onchange=function(l){a[s.checklist]||(a[s.checklist]=[]);const r=JSON.parse(JSON.stringify(a));a[s.checklist].push({text:n.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),completed:!1}),n.value="",t._updateTaskSubtasks(e);const o=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:o.id,value:o,oldValue:r}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:r}),t._refreshColumnHeights(),l.preventDefault(),l.stopPropagation(),n.closest(".smart-scroll-viewer-container").scrollTop=0},r.length&&r.forEach(((l,o)=>{const n=document.createElement("div"),d=l.label;n.innerHTML=`<div data-index="${o}" class="smart-kanban-sub-task"><span title="${d}" class="label">${d}</span><span class="remove-subtask" aria-label="Remove subtask" title="${t.localize("removeSubtask")}"></span></div>`,l.selected&&n.firstChild.classList.add("selected"),"onlyUnfinished"===t.taskSubTasks&&l.selected&&n.classList.add("smart-hidden");let c=!0;(t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(c=!1),n.querySelector(".remove-subtask").style.opacity=c?1:0,n.onpointerup=n.onclick=e=>{t._dragDetails||(e.preventDefault(),e.stopPropagation())},n.onpointerdown=l=>{let o=!0;if((t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(o=!1),!o)return;const i=JSON.parse(JSON.stringify(a)),d=parseInt(n.firstChild.getAttribute("data-index")),c=r[d];l.target.classList.contains("remove-subtask")?(r.splice(d,1),n.classList.add("smart-hidden"),a[s.checklist].splice(d,1)):(n.firstChild.classList.toggle("selected"),c.selected=!c.selected,a[s.checklist][d].completed=c.selected,"onlyUnfinished"===t.taskSubTasks&&c.selected&&n.classList.add("smart-hidden")),t._updateTaskChecked(e);const u=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:u.id,value:u,oldValue:i}),t.$.fireEvent("taskUpdate",{id:u.id,value:u,oldValue:i}),l.preventDefault(),l.stopPropagation()},i.appendChild(n)}))}_applyTextTemplate(e,t,a){const s=this;let l=this.textTemplate;if(!l)return e;let r="";if("function"==typeof l){const s={data:t,task:a,text:e,template:null};if(l(s),e=s.text,null===s.template)return e;l=s.template}if(l.startsWith("#")){const a=document.querySelector(l);if(a&&a instanceof HTMLTemplateElement){const l=a.content.cloneNode(!0),o=document.createElement("div");return o.appendChild(l),e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),r=o.innerHTML.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),r.indexOf("{{text=")>=0&&(e?(r=r.substring(0,r.indexOf("{{text="))+e+r.substring(r.indexOf("}")),r=r.replace(/}/gi,""),r=r.replace(/{/gi,"")):(r=r.replace(/{{text=/gi,""),r=r.replace(/}}/gi,""))),r}}return r=l.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),r}_updateUserIcon(e){const t=this,a=this.dataSourceMap,s=e.data,l=e.getElementsByClassName("smart-kanban-task-user")[0];if(void 0!==s[a.userId]&&null!==s[a.userId]){const e=this.users.find((e=>e.id.toString()===s[a.userId].toString()));if(e)return s[a.userId]!==e.id&&(s[a.userId]=e.id),l.classList.remove("empty"),l.style.backgroundImage='url("'+e.image+'")',l.setAttribute("title",t.localize("assignedTask",{userName:e.name||e.id})),void l.setAttribute("aria-label","Icon of user "+(e.name||e.id))}s[a.userId]=null,l.classList.add("empty"),l.style.backgroundImage=null,l.setAttribute("aria-label","Empty user icon"),l.setAttribute("title",t.localize("unassignedTask"))}_updateTaskComments(e){const t=this.dataSourceMap,a=e.data;e.querySelector(".smart-kanban-task-comments").setAttribute("num",a[t.comments].length||"")}_updateTaskProgress(e){const t=this.dataSourceMap,a=e.data,s=e.querySelector(".smart-kanban-task-progress");let l=a[t.progress];if(void 0===l){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}if(l=parseFloat(l),isNaN(l)){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}l=Math.max(0,Math.min(parseFloat(l),100)),a[t.progress]=l,s.style.width=l+"%",s.classList.toggle("bottom",null!==a[t.checklist]),s.setAttribute("aria-valuenow",l);const r=this.localize("taskProgress",{value:l});s.parentElement.setAttribute("title",r)}_updateTaskChecked(e){const t=this.dataSourceMap,a=e.data,s=a[t.checklist],l=e.querySelector(".smart-kanban-task-checked");if(s&&Array.isArray(s)&&s.length>0?l.innerHTML=this._getCompletedSubTasks(s):(a[t.checklist]=null,l.innerHTML=""),l.innerHTML.length>0){let e=0;s.forEach((t=>t.completed&&e++));const t=e,a=s.length,r=this.localize("taskCompleted",{value:t,count:a});l.setAttribute("title",r)}else l.removeAttribute("title")}_getCompletedSubTasks(e){if(null===e)return"";let t=0;return e.forEach((e=>e.completed&&t++)),t+"/"+e.length}_updateTaskDueDate(e){const t=this.dataSourceMap;let a=e.data,s=a[t.dueDate],l=e.querySelector(".smart-kanban-task-due");if(s&&"string"==typeof s&&(s=new Date(s),s.setTime(s.getTime()-1*s.getTimezoneOffset()*60*1e3),a[t.dueDate]=s),s)if(l.innerHTML=new Smart.Utilities.DateTime(s).toString(this.formatStringDate),l.classList.toggle("overdue",s.getTime()<(new Date).getTime()&&100!==a[t.progress]),l.classList.contains("overdue")){const e=Math.abs(new Date-s),t=Math.ceil(e/864e5);l.setAttribute("title",this.localize("overdue")+" "+t+" "+this.localize("days"))}else l.removeAttribute("title");else a[t.dueDate]=null,l.innerHTML="",l.classList.remove("overdue"),l.removeAttribute("title");a[t.startDate]?"string"==typeof a[t.startDate]&&(a[t.startDate]=new Date(a[t.startDate]),a[t.startDate].setTime(a[t.startDate].getTime()-1*a[t.startDate].getTimezoneOffset()*60*1e3)):a[t.startDate]=null}_updateTaskColor(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".smart-kanban-task-progress-container"),r=e.querySelector(".smart-kanban-task-progress"),o=t.rightToLeft?"borderRightColor":"borderLeftColor";function i(e){let t=parseFloat(e).toString(16);return t="0".repeat(2-t.length)+t,t.toUpperCase()}if(e.style.borderLeftColor=null,e.style.borderRightColor=null,e.style.borderLeftWidth="",e.style.borderRightWidth="",s[a.color]){e.style[o]=s[a.color];const d=getComputedStyle(e)[o],c="dark"===t.theme?.4:.1;t.taskColor?e.style[o]=s[a.color]:(e.style[o]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px"),s[a.color]=(n=(n=d).match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+i(n[1])+i(n[2])+i(n[3]):null,l&&(l.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`,r.style.backgroundColor=d),t.taskColorEntireSurface&&(e.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`)}else{if(s[a.color]=null,l&&(l.style.backgroundColor=null,r.style.backgroundColor=null),t.taskColorEntireSurface){const a=getComputedStyle(e)[o],s="dark"===t.theme?.4:.1;e.style.backgroundColor=`rgba(${a.slice(4,a.length-1)}, ${s})`}t.taskColor||(e.style[o]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px")}var n}_updateTaskPriority(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".priority");l.className="priority";let r="";s[a.priority]&&(l.className+=" "+s[a.priority],r=t.localize(s[a.priority])+" "+t.localize("priority"));const o=s[a.text],i=e.querySelector(".smart-kanban-task-content");t.taskPriority?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),i&&(o&&t.taskPriority&&r?i.setAttribute("title",`${o}: ${r}`):i.removeAttribute("title"))}_validateSwimlanes(){const e=this,t=e.swimlanesFrom,a=e.swimlanesTo,s=[];t<0&&(e.swimlanesFrom=0),null!==a&&t>a&&(e.swimlanesFrom=a),e.swimlanes.forEach((e=>{"string"==typeof e&&(e={dataField:e,label:e}),(e.dataField||e.label)&&(e.label||(e.label=e.dataField),e.dataField||(e.dataField=e.label),s.push(e))})),e.swimlanes=s}_handleSwimlanes(e){const t=this,a=t.swimlanes;if(0===a.length||0===t.columns.length)return;const s=t.columns,l=parseFloat(getComputedStyle(t).getPropertyValue("--smart-kanban-header-size")),r=t.$.container,o=t.$.container.getBoundingClientRect(),i=t.$.container.querySelectorAll(".smart-kanban-column.has-swimlane");let n=i[0],d=i[i.length-1];if(t.rightToLeft){let e=n;n=d,d=e}const c=n.getBoundingClientRect(),u=i.length>1?d.getBoundingClientRect():c,m=Array.from(n.getElementsByTagName("smart-scroll-viewer"));let p,h,g,f,b=!1,v=!0,y=t.swimlanesTo;null===y&&(y=s.length-1),e&&(p=r.getElementsByClassName("swimlane")),n.column.collapsed&&(n.classList.remove("collapsed"),b=!0);for(let e=t.swimlanesFrom;e<=y;e++)v=v&&s[e].collapsed;v||(h=u.right-c.left+"px",g=c.left-o.left+"px",f=m.map((e=>e.getBoundingClientRect().top-o.top-l-t._dataViewPadding+"px"))),a.forEach(((t,a)=>{let s;e?s=p[a]:(s=document.createElement("div"),s.innerHTML=`<div class="swimlane-label">${t.label}</div>`,s.className="swimlane",s.setAttribute("role","heading"),s.setAttribute("aria-level",2),t.color&&(s.style.backgroundColor=t.color)),s.classList.toggle("smart-visibility-hidden",v),v||(s.style.width=h,s.style.left=g,s.style.top=f[a]),e||r.appendChild(s)})),b&&n.classList.add("collapsed")}_renderColumns(){const e=this,t=e.collapsible,a=[],s=e.$.body,l=document.createDocumentFragment();let r=e.columns;const o=e.context;if(e.context=e,e._columnToElement=new Map,e._columnContainers=[],0===r.length){const t=e.dataSource;t&&0!==t.length&&(r=[],t.forEach((t=>{const a=t[e.dataSourceMap.status];a&&-1===r.indexOf(a)&&r.push(a)})))}!function e(a,s,l){const r=[];let o=0;if(a.forEach((a=>{"string"==typeof a&&(a={dataField:a,label:a}),void 0!==a.dataField&&(void 0===a.label&&(a.label=a.dataField),void 0===a.dataField&&(a.dataField=a.label),"horizontal"!==a.orientation&&(a.orientation="vertical"),!1!==a.collapsible&&(a.collapsible=!0),a.collapsed&&t&&a.collapsible?o++:a.collapsed=!1,!1!==a.addNewButton&&(a.addNewButton=!0),!1!==a.allowRemove&&(a.allowRemove=!0),!1!==a.allowHide&&(a.allowHide=!0),!1!==a.editable&&(a.editable=!0),!1!==a.reorder&&(a.reorder=!0),0===l?delete a.selected:!0===a.selected?r.push(a):a.selected=!1,a.columns&&(a.validColumns=[],e(a.columns,a.validColumns,l+1),a.columns=a.validColumns,delete a.validColumns),s.push(a))})),o&&o===s.length&&(s[0].collapsed=!1),r.length>1)for(let e=r.length-2;e>=0;e--)r[e].selected=!1;else l>0&&0===r.length&&s.length>0&&(s[0].selected=!0)}(r,a,0),0===e.swimlanes.length?"columns"===e.hierarchy?e._createColumnElements(a,l,s,1):e._createColumnElementsTabs(a,l,s):e._createColumnElementsSwimlanes(a,l,s),s.appendChild(l),e._selectedTabs=e._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),e._autoSaveState("tabs"),e.context=o}_createAddNewButton(){const e=this,t=e.querySelectorAll(".smart-kanban-add-new-button");t.length&&t.forEach((e=>{e.remove()})),e.addNewButton&&"top"!==e.addNewButtonDisplayMode&&(e.addNewButtons=[],e.querySelectorAll(".smart-kanban-column").forEach((t=>{const a=t.querySelector(".smart-scroll-viewer");if(a){const s=(()=>{const t=document.createElement("div");return t.setAttribute("add-new-button",""),t.classList.add("smart-kanban-add-new-button"),t.title=e.localize("addNewTask"),t.onpointerdown=()=>{if(t.column){const a=t.column.querySelector(".smart-kanban-column-header-add");a&&(e._addToBottom=!0,a.click())}},t})(),l=t.column;if(!l||l&&l.collapsed||l&&!l.addNewButton)return;t.appendChild(s);const r=()=>{const l=a.getBoundingClientRect(),r=t.querySelectorAll(".smart-kanban-task"),o=e.offset(e);if(0===r.length){const a=t.querySelector(".smart-kanban-column-header"),l=e.offset(a).top-o.top,r=e.autoColumnHeight?60:0;s.style.top=l+r+a.offsetHeight+"px"}else{const i=r[r.length-1],n=e.offset(i);let d=parseInt(i.style.marginBottom);const c=e.offsetHeight-2*s.offsetHeight;isNaN(d)&&(d=0);const u=n.top-o.top+i.offsetHeight+d;if(a.computedVerticalScrollBarVisibility){const t=e.getBoundingClientRect();s.style.top=Math.min(l.top-t.top+a.offsetHeight,c)+"px"}else{const a=t.querySelector(".smart-kanban-column-footer");if(a){const t=e.offset(a).top-o.top-s.offsetHeight/2;s.style.top=Math.min(t,c)+"px"}else s.style.top=Math.min(u,c)+"px"}}const i=t.offsetWidth-a.offsetWidth;s.style.left=l.left+a.offsetWidth/2-i-s.offsetWidth/2-o.left+e.$.scrollViewer.scrollLeft+"px"};s.refresh=r,s.column=t,t.addNewButton=s,s.refresh(),e.addNewButtons.push(s),requestAnimationFrame((()=>{s.classList.add("show")}))}})),e._refreshSummaries())}_refreshColumnHeights(e=!0,t,a=0){const s=this;s.autoColumnHeight&&(s.virtualization?s.querySelectorAll(".smart-kanban-column").forEach((e=>{if(e.querySelector(".smart-scroll-viewer")){const t=e.column,a=s._getTasksByDataField(t.dataField),l=e.querySelector(".smart-kanban-column-header"),r=e.querySelector(".smart-kanban-column-footer"),o=r?r.offsetHeight:0;if(0===a.length)e.style.height=100+o+l.offsetHeight+"px";else{const t=s.offsetHeight,r=a[a.length-1],i=l.offsetHeight+o+r.top+r.height;isNaN(i)||(e.style.height=t<i?"":i-o+"px")}}})):s.querySelectorAll(".smart-kanban-column").forEach((l=>{const r=l.querySelector(".smart-scroll-viewer");if(r){const o=l.column;if(t&&o.dataField!==t)return;if(!o||o&&o.collapsed)return void(l.style.height="");const i=l.querySelectorAll(".smart-kanban-task"),n=l.querySelector(".smart-kanban-column-header"),d=l.querySelector(".smart-kanban-column-footer"),c=d?d.offsetHeight:0;if(0===i.length)l.style.height=100+c+n.offsetHeight+"px";else{const e=i[i.length-1];if(r.style.top="0px",!s._rowGap){const t=parseInt(getComputedStyle(e.parentElement).gridRowGap);s._rowGap=t,isNaN(s._rowGap)&&(s._rowGap=0)}let t=0;for(let e=0;e<i.length;e++)if(t+=i[e].offsetHeight+s._rowGap,i[e].classList.contains("smart-kanban-task-placeholder")){const a=parseInt(i[e].style.marginTop),s=parseInt(i[e].style.marginBottom);isNaN(a)||(t+=a),isNaN(s)||(t+=s)}const o=s.offsetHeight,d=n.offsetHeight+c+t+s._rowGap+s._rowGap+a;l.style.height=o<d?"":d+"px"}e&&r.refresh(),s._refreshEmptyColumnState(r)}})))}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")},e}_createColumnElements(e,t,a,s){const l=this,r=l.id,o=[],i=[];let n=0;const d=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;if(e.forEach(((a,c)=>{const u=document.createElement("div");let m=`${l._getColumnHeader(a,c<e.length-1,s)}\n <div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`,p=0;if(l.columnFooter&&(m+='<div class="smart-kanban-column-footer"></div>'),a.columns?(m=m.replace("AAA",""),m=m.replace("BBB",'<div class="smart-kanban-column-content-columns" role="presentation"></div>')):(m=m.replace("AAA"," no-sub-columns"),m=m.replace("BBB","")),u.className="smart-kanban-column",u.setAttribute("data-field",a.dataField),u.setAttribute("role","group"),u.setAttribute("aria-labelledby",`${r}ColumnHeaderLabel${a.dataField}`),u.setAttribute("orientation",a.orientation),a.color&&l.applyColumnColorToTasks&&u.style.setProperty("--smart-primary",a.color),a.collapsible&&u.setAttribute("collapsible",""),a.addNewButton&&u.setAttribute("add-new-button",""),u.innerHTML=m,u.siblingColumns=e,t.appendChild(u),u.column=a,u.index=c,u.onmouseleave=()=>{let e=!1;u.querySelectorAll(".smart-kanban-task-placeholder").forEach((t=>{t.classList.remove("smart-kanban-task-placeholder"),t.style.marginTop=t.style.marginBottom="0px",e=!0})),e&&l._refreshButtonsAndSummaries()},l.onColumnHeaderRender&&l.onColumnHeaderRender(u.querySelector(".smart-kanban-column-header"),a,a.dataField),l._columnToElement.set(a,u),a.columns){const e=u.querySelector(".smart-kanban-column-content-columns");p=l._createColumnElements(a.columns,e,e,s+1),n+=p}else n+=1;let h=(p||1)+"fr";l.columnWidth?h=d(l.columnWidth):a.width&&(h=d(a.width)),!1!==a.visible?(a.collapsed?(u.classList.add("collapsed"),o.push("auto")):o.push(h),i.push(h)):u.classList.add("smart-hidden"),l._allColumns.push(a)})),1===s&&l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth;e=d(t),o.push(e)}else o.push("var(--smart-kanban-add-new-column-width)");return a.style.gridTemplateColumns=o.join(" "),a.fractions=i,l._columnContainers.push(a),n}_createColumnElementsTabs(e,t,a,s){const l=this,r=l.id,o=[],i=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`<div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`;if(a.columns?(c=c.replace("AAA",""),c=c.replace("BBB",'<div class="smart-kanban-column-content-columns has-tabs" role="presentation"></div>')):(c=c.replace("AAA"," no-sub-columns"),c=c.replace("BBB","")),d.className="smart-kanban-column",d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),s){const e=document.createElement("div"),t=`${r}Tab${a.dataField}`,o=`${r}Column${a.dataField}`;e.id=t,e.className="smart-kanban-tab smart-unselectable",l.disabled||l.unfocusable||(e.tabIndex=0),e.setAttribute("role","tab"),e.setAttribute("aria-controls",o),e.innerHTML=`<div class="smart-kanban-tab-label">${a.label}</div>`,e.columnElement=d,d.id=o,d.setAttribute("role","tabpanel"),d.setAttribute("aria-labelledby",t),d.tab=e,s.appendChild(e),a.selected?e.classList.add("selected"):d.classList.add("smart-hidden"),e.setAttribute("aria-selected",a.selected)}else c=l._getColumnHeader(a,n<e.length-1)+c,d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${r}ColumnHeaderLabel${a.dataField}`);if(d.innerHTML=c,d.siblingColumns=e,t.appendChild(d),d.column=a,d.index=n,l._columnToElement.set(a,d),a.columns){const e=d.querySelector(".smart-kanban-column-content-columns"),t=document.createElement("div");t.className="smart-kanban-tab-strip",t.setAttribute("role","tablist"),e.appendChild(t),l._createColumnElementsTabs(a.columns,e,e,t)}s||(a.collapsed?(d.classList.add("collapsed"),o.push("auto")):o.push("1fr"),i.push("1fr")),l._allColumns.push(a)})),!s){if(l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth),o.push(e)}else o.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=o.join(" "),a.fractions=i,l._columnContainers.push(a)}}_createColumnElementsSwimlanes(e,t,a){const s=this,l=s.id,r=s.swimlanes,o=[],i=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`${s._getColumnHeader(a,n<e.length-1)}\n <div class="smart-kanban-column-content no-sub-columns" role="presentation"></div>`;d.className="smart-kanban-column",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${l}ColumnHeaderLabel${a.dataField}`),d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),d.innerHTML=c,d.siblingColumns=e;const u=d.children[1];let m="";if(s._hasSwimlane(n)){let e=[];for(let t=0;t<r.length;t++)m+=`<smart-scroll-viewer class="smart-kanban-column-content-tasks" swimlane="${r[t].dataField}"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`,e.push("1fr");d.classList.add("has-swimlane"),u.classList.add("has-swimlane"),u.style.gridTemplateRows=e.join(" ")}else m=`<smart-scroll-viewer class="smart-kanban-column-content-tasks"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`;u.innerHTML=m,t.appendChild(d),d.column=a,d.index=n,s._columnToElement.set(a,d),a.collapsed?(d.classList.add("collapsed"),o.push("auto")):o.push("1fr"),i.push("1fr"),s._allColumns.push(a)})),s.addNewColumn)if(s._appendAddNewColumn(t),s.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(s.addNewColumnWidth?s.addNewColumnWidth:s.columnWidth),o.push(e)}else o.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=o.join(" "),a.fractions=i,s._columnContainers.push(a)}_getColumnSummary(e){const t=this.getColumnDataItems(e.dataField);return this.columnSummary&&t.length?" ("+t.length+")":""}_getColumnHeaderTemplate(e,t){const a=e.headerTemplate||this.columnHeaderTemplate;if(a){const s=document.createElement("div");let l;if("string"==typeof a&&a.startsWith("#")?l=document.querySelector(a):"string"==typeof a&&(l=a),"function"==typeof a){const s=a(e,t);return s||t}if(l instanceof HTMLTemplateElement){s.appendChild(l.content.cloneNode(!0));const t=/{{\w+}}/g;let a=s.innerHTML;const r=t.exec(a);for(let t=0;t<r.length;t++){const t=e[r[0].replace("{{","").replace("}}","")];a=a.replace(r[0],t)}return a}return l instanceof HTMLElement?s.appendChild(l):s.innerHTML=l,s.innerHTML}return null}_getColumnHeader(e,t,a=1){const s=this,l=s._tabindex,r=e.collapsed?s.localize("expand"):s.localize("collapse"),o=s.localize("addNewTask"),i=s.allowColumnEdit||s.allowColumnRemove||s.allowColumnHide?"settings":"",n=s.localize("customizeColumn");let d=e.label;""===d&&(d="&nbsp;");const c=s._getColumnSummary(e);let u=`<span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span>`,m="smart-kanban-column-header-label";if(void 0!==e.color){if(e.color){const t=new Smart.Color(e.color).getInvertedColor();u=`<div class="heading" style="background: ${e.color}; color: ${t};"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`}else u=`<div class="heading"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`;m+=" pill"}const p=null!==s.columnHeaderTemplate||e.headerTemplate?s._getColumnHeaderTemplate(e,u):u,h="bottom"===s.addNewButtonDisplayMode?"":"add-new-button";return`<div status="${e.dataField}" ${i} ${h} class="smart-kanban-column-header smart-unselectable"${l} role="heading" aria-level=${a}>\n <div title="${o}" class="smart-kanban-column-header-add ${h}"${l} role="button" aria-label="Add new task"></div>\n <div id="${s.id}ColumnHeaderLabel${e.dataField}" class="${m}">${p}</div>\n <div title="${r}" class="smart-kanban-column-header-toggle-button smart-arrow smart-arrow-${t?"left":"right"}" role="button" aria-hidden="true"></div>\n <div title="${n}" class="smart-kanban-column-actions smart-kanban-column-header-settings-button" role="button" aria-haspopup="menu" aria-label="Open actions list" aria-hidden="true"></div>\n </div>`}_hasSwimlane(e){const t=this;if(0===t.swimlanes.length)return!1;const a=t.swimlanesFrom;let s=t.swimlanesTo;return null===s&&(s=t.columns.length-1),e>=a&&e<=s}_updateColumnWidths(e,t){const a=this;if(!e&&!t)return void a._columnContainers.forEach((e=>a._updateColumnWidths(e.children[0].siblingColumns,e)));const s=t.fractions,l=[];let r=0,o=0;for(let t=0;t<e.length;t++){const i=e[t];!1!==i.visible&&(l.push(e[t].collapsed?"auto":s[r++]),!i.collapsed&&a.columnWidth&&(o+=i.width?i.width:a.columnWidth))}if(t===a.$.body&&a.addNewColumn)if(a.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(a.addNewColumnWidth?a.addNewColumnWidth:a.columnWidth),l.push(e)}else l.push("var(--smart-kanban-add-new-column-width)");o<a.offsetWidth&&a.columnWidth&&l.push("1fr"),t.style.gridTemplateColumns=l.join(" "),a.columnWidth&&a.$.scrollViewer.refresh()}_validateColumnArgument(e){if(!isNaN(e))return this.columns[e];const t=this._allColumns;return"string"==typeof e?t.find((t=>t.dataField===e)):"object"==typeof e?t.find((t=>t===e)):null}_resizeHandler(){this.$.scrollViewer&&(this.$.scrollViewer.scrollLeft=0),this.refresh("resize")}refresh(e){const t=this;"resize"===e?(clearTimeout(t._resizeTimeout),t._resizeTimeout=setTimeout((function(){t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}),50),t._handleSwimlanes(!0)):(t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t._closeList(t._priorityList,"_prioritySelectionFor"),t._resetFields=!0,t._render()),t.$.scrollViewer.refresh()}_refreshScrollViewer(e,t){const a=this,s=e instanceof HTMLElement?e:this._columnToElement.get(e);function l(l,r){if(!t&&l&&l.$.scrollViewerContentContainer&&""===l.$.scrollViewerContentContainer.innerHTML.trim())return a.virtualization&&a._refreshScrollHeight(l,e.dataField),void a._refreshEmptyColumnState(l);if(e.collapsed?l.toRefresh=!0:(delete l.toRefresh,requestAnimationFrame((()=>{if(l.isReady&&l.refresh(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField);0===r&&"horizontal"===e.orientation&&(a.columnWidth||(l.$.content.offsetWidth<=2*a._kanbanTaskMinWidth+a._dataViewPadding?s.setAttribute("orientation","vertical"):"vertical"===s.getAttribute("orientation")&&s.setAttribute("orientation","horizontal")))}))),a._refreshButtonsAndSummaries(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField)}e instanceof Smart.ScrollViewer?l(e):this.swimlanes.length>0?Array.from(s.querySelectorAll("smart-scroll-viewer")).forEach(((e,t)=>l(e,t))):l(s.querySelector("smart-scroll-viewer"),0)}_containerDownHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,s=a.closest(".smart-kanban-task");if(delete t._preventSelection,t.allowColumnReorder){const l=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button");if(!s&&l&&!t._columnEditing){const s=a.closest(".smart-kanban-column");if(s){const a=e.originalEvent.composedPath();let l=0;for(let e=0;e<a.length;e++)a[e].classList&&a[e].classList.contains("smart-kanban-column")&&l++;s.column.reorder&&l<=1&&(t._columnDragDetails={x:e.pageX,y:e.pageY,event:e,kanbanColumn:s})}}}const l=a.closest(".smart-kanban-column"),r=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button"),o=l?l.column:null;if(o){if(r&&t.$.fireEvent("columnClick",{column:o}),new Date-t._clickTime<=300)return!s&&r&&!t._columnEditing&&t.allowColumnEdit&&(t._columnDragDetails=null,!1===o.collapsed&&o.editable&&"menu"!==t.columnEditMode&&t._handleColumnEditing(o.dataField)),void(r&&(o.collapsed?t.expand(o):(!t.allowColumnEdit||t.allowColumnEdit&&"menu"===t.columnEditMode)&&t.collapse(o),t.$.fireEvent("columnDoubleClick",{column:o})));t._clickTime=new Date}if(s&&3!==e.which){if(!s.data)return;if(t.taskSubTasksInput&&a.classList.contains("smart-kanban-task-input"))return;t.virtualization?(t.focusTask(s.data.id),t._refreshColumns()):t._focusTask(s),t._startDragging(s,e)}}_containerKeydownHandler(e){const t=this;if(t._dragDetails)return;const a=e.key,s=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;function l(a=s){delete t._preventSelection,t._documentUpHandler({originalEvent:{target:a}}),t._containerClickHandler({target:a,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey}),e.preventDefault()}if(s.closest(".smart-kanban-column, .smart-kanban-add-new-column"))return s.classList.contains("smart-kanban-column-content-tasks")?void t._selectViaKeyboard(s.$.content,e,l):void("Enter"!==a&&" "!==a||s instanceof HTMLInputElement!=0||l());if(t.$.headerDropDown.contains(s))"Escape"===a&&(t.closePanel(),t.$[/\s?([a-z]+)-panel/g.exec(t.$.headerDropDown.className)[1]+"Button"].focus());else if(!(s.classList.contains("smart-data-view-header-button")||s.closest(".smart-data-view-search-box")||s.classList.contains("remove-button"))||"Enter"!==a&&" "!==a||l(),s.classList.contains("smart-kanban-list")){const r=s;switch(a){case"ArrowDown":t._selectListItem(t._getNextItem(r));break;case"ArrowUp":t._selectListItem(t._getPrevItem(r));break;case"Home":t._selectListItem(t._getFirstItem(r));break;case"End":t._selectListItem(t._getLastItem(r));break;case"Escape":r.openedFrom.focus(),t._closeList(r,r===t._actionsList?"_actionSelectionFor":r===t._commentsList?"_commentSelectionFor":"_userSelectionFor"),r===t._columnActionsList&&t._closeList(t._columnActionsList,"_columnActionSelectionFor");break;case"Enter":case" ":{const e=t._getSelectedItem(r);e&&l(e);break}default:return}e.preventDefault()}}getTaskIndex(e){const t=this,a=t.getTask(e);if(!a)return-1;const s=a[t.dataSourceMap.status];return t._getTasksByDataField(s).findIndex((t=>{if(t.id===e)return!0}))}_getNextPrevColumn(e,t){const a=this;let s=null;return a._allColumns.forEach(((l,r)=>{if(l.dataField===e)if(t){if(r<a._allColumns.length-1)return s=a._allColumns[r+1],!0}else if(r>0)return s=a._allColumns[r-1],!0})),s}focusTask(e){const t=this;t._focusedTask=e,t.ensureVisible(e),t._refreshColumns()}_selectViaKeyboard(e,t,a){const s=this;let l=t.key;s.rightToLeft&&("ArrowRight"===l?l="ArrowLeft":"ArrowLeft"===l&&(l="ArrowRight"));const r=s._focusedTask,o=s.getTask(r);if(!o)return;const i=o[s.dataSourceMap.status],n=s._getTasksByDataField(i),d=s.getTaskIndex(r);switch(l){case"ArrowRight":{const e=s._getNextPrevColumn(i,!0);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e),a=t.querySelector(".smart-kanban-task");s._focusTask(a),t.focus()}break}case"ArrowLeft":{const e=s._getNextPrevColumn(i,!1);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e).querySelector(".smart-kanban-task");s._focusTask(t)}break}case"ArrowDown":if(s.virtualization)d<n.length-1&&s.focusTask(n[d+1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getNextItem(t,!0))}break;case"ArrowUp":if(s.virtualization)d>0&&s.focusTask(n[d-1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getPrevItem(t,!0))}break;case"Home":s.virtualization?s.focusTask(n[0].id):s._focusTask(s._getFirstItem(e));break;case"End":s.virtualization?s.focusTask(n[n.length-1].id):s._focusTask(s._getLastItem(e));break;case"Enter":case" ":case"F2":case"Delete":{const e=s.querySelector("[focus]");e&&("F2"===l||"Enter"===l?s.beginEdit(e):"Delete"===l?s.removeTask(e,!0):a(e));break}default:return}t.preventDefault()}_getFirstItem(e){const t=e.children;for(let e=0;e<t.length;e++){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getLastItem(e){const t=e.children;for(let e=t.length-1;e>=0;e--){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getPrevItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.previousElementSibling:this._getLastItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.previousElementSibling}}_getNextItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.nextElementSibling:this._getFirstItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.nextElementSibling}}_getSelectedItem(e,t){return e?t?e.querySelector("[focus]"):e.querySelector(".selected"):null}_selectListItem(e){if(!e)return;const t=e.parentElement,a=t.querySelector(".selected");a&&(a.classList.remove("selected"),a.removeAttribute("aria-selected")),e.classList.add("selected"),e.setAttribute("aria-selected",!0),t.scrollTop=e.offsetTop}_focusTask(e){if(!e)return;const t=this;t._isMobile||(Array.from(t.querySelectorAll("[focus]")).forEach((e=>e.removeAttribute("focus"))),e.setAttribute("focus",""),this._focusedTask=e.data.id,t.virtualization?t.ensureVisible(t._focusedTask):this.ensureVisible(e))}_setFocusable(){const e=this,t=e.$.container,a=e.disabled||e.unfocusable;let s=[e.$.customizeButton,e.$.filterButton,e.$.sortButton,e.$.searchButton,e.$.searchPrev,e.$.searchNext,e.$.searchClose,e._actionsList,e._userList];if(s=s.concat(Array.from(t.querySelectorAll(".smart-kanban-column-header, .smart-kanban-column-header-add, .smart-kanban-tab, .smart-kanban-column-content-tasks, .smart-kanban-task-user, .smart-kanban-task-actions, .smart-kanban-task-comments, .smart-kanban-add-new-column"))),s.forEach((e=>{a?e.removeAttribute("tabindex"):(null===e.getAttribute("tabindex")||e.getAttribute("tabindex")<0)&&e.setAttribute("tabindex",0)})),e._dialog&&e._dialog.editPanelPopulated){const t=Array.from(e._dialog.$.container.querySelectorAll(".text-editor, .new-subtask"));a?t.forEach((e=>e.tabIndex=-1)):t.forEach((e=>e.removeAttribute("tabindex"))),Array.from(e._dialog.$.container.querySelectorAll(".smart-element.editor, smart-button.add, smart-button.ok, smart-button.cancel")).forEach((e=>e.unfocusable=a)),e._dialog.unfocusable=a}}_startDragging(e,t){const a=this;if(!a._currentUser.allowDrag)return;if(a._isMobile)return;const s=e.closest("smart-scroll-viewer"),l=e.getBoundingClientRect();let r=e.hasAttribute("selected")?Array.from(e.parentElement.querySelectorAll("[selected]")):[e],o=r.map((e=>e.data));a._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:r,ItemsData:o,ItemData:e.data,Item:e,FeedbackShown:!1,OriginalEvent:t,Column:e.classList.contains("smart-kanban-column")?e:null,PointerOffset:[l.x-t.clientX,l.y-t.clientY],ScrollViewer:s,StartTime:new Date,Dragging:!0},Smart.Kanban.kanbanTaskDragged=!0,s&&s._scrollView&&(s._scrollView.disableSwipeScroll=!0),a.allowDrop&&(Smart.Kanban.hoveredKanban=a,Smart.Kanban.hoveredItem=e)}_documentMoveHandler(e){const t=this,a=t._dragDetails;function s(){delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,a.ScrollViewer._scrollView.disableSwipeScroll=!1}if(t.allowColumnReorder&&t._columnDragDetails&&(Math.abs(e.pageX-t._columnDragDetails.x)>=3||Math.abs(e.pageY-t._columnDragDetails.y)>=3)&&(t._startDragging(t._columnDragDetails.kanbanColumn,t._columnDragDetails.event),t._columnDragDetails=null),!a)return;if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,r=Math.abs(a.StartPosition.left-e.pageX)>5||Math.abs(a.StartPosition.top-e.pageY)>5;if(!r||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&r&&!l&&s());if(t.$.fireEvent("dragStart",{item:a.Item,items:a.Items,data:a,container:t,previousContainer:t,originalEvent:a.OriginalEvent}).defaultPrevented)return void s();t.closePanel(),t._hideBodyOverflow(),a.Feedback=t._addDragFeedback(),a.FeedbackShown=!0,a.Items.forEach((e=>e.classList.add("dragged")))}const l=a=>{a.scrollWidth&&(t._autoScrollDragInterval&&clearInterval(t._autoScrollDragInterval),t._autoScrollDragInterval=setInterval((function(){const t=a.getBoundingClientRect();e.clientX<=t.left+20?a.scrollLeft-=15:e.clientX>=t.left+t.width-20&&(a.scrollLeft+=15)}),25))};Smart.Kanban.hoveredKanban?l(Smart.Kanban.hoveredKanban.$.scrollViewer):l(t.$.scrollViewer);let r,o=t.dragOffset;if(o="auto"!==o&&Array.isArray(o)?o:a.PointerOffset,t.$.fireEvent("dragging",{item:a.Item,items:a.Items,data:a,originalEvent:e}),a.Feedback.style.left=e.pageX+(o[0]||0)+"px",a.Feedback.style.top=e.pageY+(o[1]||0)+"px",Smart.Kanban.hoveredKanban&&(clearInterval(Smart.Kanban.hoveredKanban._dragInterval),delete Smart.Kanban.hoveredKanban),Smart.Kanban.hoveredItem&&(Smart.Kanban.hoveredItem.classList.remove("drop-target"),Smart.Kanban.hoveredItem.classList.remove("before","after"),delete Smart.Kanban.hoveredItem),r=t._isMobile?(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY):t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,!r)return;const i=(t.shadowRoot?r.getRootNode().host:r).closest("smart-kanban");if(!i||!i.allowDrop)return;const n=r.closest(".smart-kanban-column-content-tasks");if(Smart.Kanban.hoveredKanban=i,a.Column)return void t._handleColumnDragging(e);if(!n)return;const d=n.parentElement.parentElement.getAttribute("orientation"),c=Array.from(n.$.content.children);let u=0;if(c.forEach((e=>e.filteredOut&&u++)),0===c.length||c.length===u)return Smart.Kanban.hoveredItem=n.$.scrollViewerContainer,void Smart.Kanban.hoveredItem.classList.add("drop-target");n.scrollHeight>0&&(i._dragInterval=setInterval((function(){const a=n.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientY>=a.top&&e.clientY<=a.top+20?n.scrollTop-=t._autoScrollCoefficient:e.clientY>=a.top+a.height-20&&e.clientY<=a.top+a.height?n.scrollTop+=t._autoScrollCoefficient:clearInterval(i._dragInterval):clearInterval(i._dragInterval)}),2));let m=r.closest(".smart-kanban-task");if(m&&-1===a.Items.indexOf(m)){const t=m.getBoundingClientRect();"vertical"===d&&e.clientY-t.top<=t.height/2||"horizontal"===d&&e.clientX-t.left<=t.width/2?m.classList.add("before"):m.classList.add("after")}else{if(m&&1===c.length)return;m=m&&1===a.Items.length?t[`_${d}ClosestTaskToHover`]([m.previousElementSibling,m.nextElementSibling],e,!0):t[`_${d}ClosestTaskToHover`](c,e,m||r===n.$.content)}m&&(m.classList.add("drop-target"),Smart.Kanban.hoveredItem=m)}_handleColumnDragging(e){const t=this.querySelectorAll(".smart-kanban-column");let a;for(let s=0;s<t.length;s++){const l=t[s],r=l.getBoundingClientRect();e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom&&(a=l)}if(a){const s=a.getBoundingClientRect();e.clientX-s.left<=s.width&&(a.classList.add("before"),a.classList.add("drop-target")),e.clientX-s.left>=s.width/2&&a===t[t.length-1]&&(a.classList.remove("before"),a.classList.add("after"),a.classList.add("drop-target")),Smart.Kanban.hoveredItem=a}}_hideBodyOverflow(){const e=this,t=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,a=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth,s=e.isInShadowDOM?e.getRootNode().host:document.body;e._originalBodyOverflow={overflowX:s.style.overflowX,overflowY:s.style.overflowY,overflow:s.style.overflow},s.classList.add("smart-dragging"),s.style.overflow=s.style.overflowX=s.style.overflowY="",t&&!a?s.style.overflowX="hidden":a&&!t?s.style.overflowY="hidden":a||t||(s.style.overflow="hidden")}_verticalClosestTaskToHover(e,t,a){const s=this._dragDetails.Items,l=t.clientY;let r,o,i=1/0,n=0,d=e.length-1,c=1;for(a||(n=d,d=0,c=-1);n!==d+c;){const t=e[n];if(n+=c,!t||t.filteredOut||-1!==s.indexOf(t))continue;if(!a){r=t,o="after";break}const d=t.getBoundingClientRect(),u=d.top+d.height/2,m=Math.abs(l-u);if(!(m<i))break;i=m,r=t,o=l<=u?"before":"after"}return r&&r.classList.add(o),r}_horizontalClosestTaskToHover(e,t){const a=this._dragDetails.Items,s=t.clientY,l=t.clientX;let r,o,i;return e.forEach((e=>{if(!e||e.filteredOut||-1!==a.indexOf(e))return;const t=e.getBoundingClientRect(),n=Math.abs(s-t.top),d=Math.abs(s-t.bottom),c=Math.min(n,d),u=Math.abs(l-t.left),m=Math.abs(l-t.right),p=Math.min(u,m),h=Math.sqrt(Math.pow(p,2)+Math.pow(c,2));(void 0===o||h<o)&&(r=e,o=h,i=u<m?"before":"after")})),r&&r.classList.add(i),r}_scrollViewerTouchmoveHandler(e){const t=this;t._dragDetails&&(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target).closest("smart-scroll-viewer")&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_documentUpHandler(e){const t=this,a=t._dragDetails;if(t._columnDragDetails=null,t.$.container.hasAttribute("modal"))return;const s=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.header;if(t._userSelectionFor&&!t._userList.contains(s)&&t._closeList(t._userList,"_userSelectionFor"),t._prioritySelectionFor&&!t._priorityList.contains(s)&&t._closeList(t._priorityList,"_prioritySelectionFor"),t._actionSelectionFor&&!t._actionsList.contains(s)&&t._closeList(t._actionsList,"_actionSelectionFor"),t._columnActionSelectionFor&&!t._columnActionsList.contains(s)&&(t._columnActionsList.classList.contains("smart-visibility-hidden")||(t._closeList(t._columnActionsList,"_columnActionSelectionFor"),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),t._columnActionsListDate=new Date)),t._commentSelectionFor){const e=t._commentsList;(t.shadowRoot||t.getRootNode()).activeElement!==e.textarea&&(t._actionSelectionFor||e.contains(s)?!e.classList.contains("expanded")||s===e.textarea||e.button.contains(s)||s.classList.contains("remove-button")||e.classList.remove("expanded"):t._closeList(e,"_commentSelectionFor"))}if(!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||s!==l&&l.contains(s))){const e=s.closest("smart-scroll-viewer"),a=s.closest(".smart-drop-down");e&&l.contains(e.ownerElement)||a&&(!a.ownerElement||l.contains(a.ownerElement))||t.closePanel()}if(!a)return;const r=Smart.Kanban.hoveredKanban,o=Smart.Kanban.hoveredItem;t._dragDetails&&e.originalEvent.preventDefault(),delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,delete Smart.Kanban.dropOverTask,delete Smart.Kanban.isBefore;let i=!1;if(document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.classList.remove("smart-kanban-task-placeholder"),e.style.marginTop=e.style.marginBottom="0px",i=!0})),i&&t._refreshButtonsAndSummaries(),a.ScrollViewer&&a.ScrollViewer._scrollView&&(a.ScrollViewer._scrollView.disableSwipeScroll=!1),!a.FeedbackShown)return;const n=r||(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY);t._preventSelection=!0;const d=t.isInShadowDOM?t.getRootNode().host:document.body;d.classList.remove("smart-dragging"),d.style.overflow=t._originalBodyOverflow.overflow,d.style.eoverflowX=t._originalBodyOverflow.overflowX,d.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,a.Feedback.remove(),r&&clearInterval(r._dragInterval);const c=a.Item,u=a.Items;if(u.forEach((e=>e.classList.remove("dragged"))),!n)return;if(!o)return void t.$.fireEvent("dragEnd",{item:c,items:u,target:n,data:a,previousContainer:t,container:n,originalEvent:e});if(!r||!r.allowDrop||r.disabled)return;let m=!1;if(o.classList.remove("drop-target"),o.classList.contains("before")?o.classList.remove("before"):o.classList.contains("after")&&(o.classList.remove("after"),m=!0),a.DropDetails={item:o,after:m},t.$.fireEvent("dragEnd",{item:c,items:u,target:o,data:a,previousContainer:t,container:r,originalEvent:e}).defaultPrevented)return;function p(e,s){t._requestVirtualDataSource("update",Object.assign({},e.data,{status:s}),(function(s){return s&&t._moveDraggedItems(Object.assign({},a,{Item:e,Items:[e]})),s}))}const h=o.closest(".smart-kanban-column"),g=h.column.dataField;if(a.Column){const e=()=>Array.from(h.parentElement.querySelectorAll(".smart-kanban-column")).filter((e=>e.parentElement===h.parentElement)),s=e().indexOf(a.Column);a.DropDetails.after?h.parentElement.appendChild(a.Column):h.parentElement.insertBefore(a.Column,h);const l=e().indexOf(a.Column),r=[],o=e();for(let e=0;e<o.length;e++)o[e].column&&!o[e].classList.contains("smart-kanban-add-new-column")&&r.push(o[e].column);return t.columns=r,t.$.fireEvent("columnReorder",{column:a.Column.column,oldIndex:s,index:l}),t._reset(),void t._createAddNewButton()}if(c&&c.data&&g!==c.data[t.dataSourceMap.status]){const e=Object.assign({},c.data);e[t.dataSourceMap.status]=g;const a=t.getColumn(g);a&&(e.statusLabel=a.label);const s=t.getColumn(c.data[t.dataSourceMap.status]);s&&(c.data.statusLabel=s.label);const l=JSON.parse(JSON.stringify(e)),r=JSON.parse(JSON.stringify(c.data));if(t.$.fireEvent("change",{task:c,id:l.id,value:l,oldValue:r}),t._currentUser.info){const e=t.dataSourceMap;c.data[e.updatedUserId]=t._currentUser.info.id,c.data[e.updatedDate]=new Date,t.addHistory(c.data,{action:"moved",user:t._currentUser.info.id,details:{id:c.data[e.id],oldValue:r[e.status],value:l[e.status]},label:c.data[e.text],date:c.data[e.updatedDate]}),l.history=c.data.history}t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:r})}if(t.dataSource&&t.dataSource.virtualDataSource&&g!==c.data[t.dataSourceMap.status])if(m)for(let e=u.length-1;e>=0;e--)p(u[e],g);else for(const e of u)p(e,g);else if(t._moveDraggedItems(a),c&&c.data){const e=Object.assign({},c.data),a=JSON.parse(JSON.stringify(e));t.$.fireEvent("taskReorder",{id:a.id,value:a})}}_refreshButtonsAndSummaries(){const e=this;e._refreshColumnHeights(),e.addNewButtons&&(e.addNewButtons.forEach((e=>{e.refresh()})),e._refreshSummaries())}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=e._dragDetails.Items.length,s=document.createElement("div"),l=t.offsetWidth+"px",r=t.offsetHeight+"px";let o=t.cloneNode(!0);if(o.style.width=l,o.style.height=r,t.classList.contains("smart-kanban-column")){o=document.createElement("smart-kanban");const a=Object.assign({},t.column);a.collapsed=!1;const r=[a];o.columns=r,o.dataSource=e.dataSource,o.users=e.users,o.taskActions=e.taskActions,o.taskDue=e.taskDue,o.taskProgress=e.taskProgress,o.style.height="100%",o.style.width=l,o.style.minWidth="250px",s.setAttribute("column-drag","")}if(s.className="smart-kanban-feedback",s.setAttribute("parent-kanban-id",e.id),e.theme&&s.setAttribute("theme",e.theme),["rightToLeft","taskActions","taskComments","taskDue","taskPriority","taskProgress","taskTags","taskUserIcon"].forEach((t=>{e[t]&&s.setAttribute(Smart.Utilities.Core.toDash(t),"")})),s.appendChild(o),a>1){const e=document.createElement("div");e.style.width=l,e.style.height=r,e.className="smart-kanban-feedback-additional",s.insertBefore(e,o),o.setAttribute("num",a),a>2&&e.classList.add("multiple")}return e.getShadowRootOrBody().appendChild(s),s}_moveDraggedItems(e){const t=this,a=t.dataSourceMap;let s,l=e.DropDetails,r=l.item,o=r.closest(".smart-kanban-column"),i=e.Item.closest("smart-scroll-viewer"),n=o.column;if(r.classList.contains("smart-kanban-task")?(s=r.parentElement,l.after&&(r=r.nextElementSibling,r&&r.classList.contains("smart-hidden")&&(r=null)),e.Items.forEach(((l,o)=>{if(t.virtualization){const s=e.ItemsData[o],i=s[a.status],d=t._getTasksByDataField(i),c=d.findIndex((e=>e.id===s.id));if(r){if(r.data!==l.data){d.splice(c,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(r.data);e.splice(a,0,s)}}else c>=0&&(d.splice(c,1),t._getTasksByDataField(n.dataField).push(s))}else{s.insertBefore(l,r);const i=e.ItemsData[o],d=i[a.status],c=t._getTasksByDataField(d),u=c.findIndex((e=>e.id===i.id));if(r){if(r.data!==l.data){c.splice(u,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(r.data);e.splice(a,0,i)}}else u>=0&&(c.splice(u,1),t._getTasksByDataField(n.dataField).push(i))}l.data[a.status]=n.dataField,l.data.statusLabel=n.label,l.column=n}))):(s=r.firstElementChild,e.Items.forEach((e=>{if(t.virtualization){const s=e.data[a.status],l=t._getTasksByDataField(s),r=l.findIndex((t=>t.id===e.data.id));l.splice(r,1),t._getTasksByDataField(n.dataField).push(e.data)}else{s.appendChild(e);const l=e.data[a.status],r=t._getTasksByDataField(l),o=r.findIndex((t=>t.id===e.data.id));r.splice(o,1),t._getTasksByDataField(n.dataField).push(e.data)}e.data[a.status]=n.dataField,e.data.statusLabel=n.label,e.column=n}))),s=s.closest("smart-scroll-viewer"),t.swimlanes.length>0){const t=s.getAttribute("swimlane");t?e.Items.forEach((e=>e.data[a.swimlane]=t)):e.Items.forEach((e=>delete e.data[a.swimlane]))}t.virtualization?(t._refreshColumns(),t.focusTask(e.ItemData.id)):t._focusTask(e.Item),i!==s?(s.focus(),t.textTemplate&&e.Items.forEach((e=>t._renderTask(e))),e.Item.hasAttribute("selected")&&(e.Items.forEach((e=>e.removeAttribute("selected"))),t._selectedTasks=[],t._autoSaveState("selection")),t._refreshScrollViewer(i,!0),t._refreshScrollViewer(s,!0)):t.virtualization&&t._refreshScrollViewer(i,!0),t._refreshSummaries(),t._autoSaveState("dataSource")}_getCurrentDataSource(){const e=Array.from(this.$.container.getElementsByClassName("smart-kanban-task")),t=[],a=this;if(a.virtualization){const e=Object.keys(a.tasksByDataField);let t=[];for(let s=0;s<e.length;s++){const l=e[s];let r=a._getTasksByDataField(l);t=[...t,...r]}return t}for(let a=0;a<e.length;a++)t.push(e[a].data);return t}_validateTaskArgument(e){const t=this;return e instanceof HTMLElement&&t.$.container.contains(e)&&e.classList.contains("smart-kanban-task")?e:null===e||"number"!=typeof e&&"string"!=typeof e?null!==e&&"object"==typeof e&&void 0!==e.id?t.$.container.querySelector(`.smart-kanban-task[data-id="${e.id}"]`):void 0:t.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`)}_openDialog(e,t,a="task"){const s=this,l={purpose:t};if(l[a]=e,s.$.fireEvent("opening",l).defaultPrevented)return;if(s.disableDialog)return;s._dialog||s._createDialog();const r=s._dialog,o="prompt"===t;r.refreshFieldsDirty=!0,r.openedFrom=(s.shadowRoot||s.getRootNode()).activeElement,r.classList.toggle("prompt",o),r.classList.toggle("edit",!o),r.style.top="",r.style.left="",r.style.width="",r.style.height="auto","edit"!==t||!s.readonly&&s._currentUser.allowEdit?r.removeAttribute("readonly"):r.setAttribute("readonly",""),s.offsetWidth<600&&(r.style.top="0px",r.style.left="0px",r.style.width="100%",r.style.height="100%");const i=e=>{s.applyColumnColorToTasks&&(e&&e.color?(r.style.setProperty("--smart-primary",e.color),r.style.setProperty("--smart-ui-state-active",e.color)):(r.style.setProperty("--smart-primary",""),r.style.setProperty("--smart-ui-state-active","")))};if(e&&e.column?i(e.column):"add"===t&&i(e),r.taskOrComment=e,"edit"===t?s._currentUser&&s._currentUser.allowRemove&&r.querySelector(".delete").classList.remove("smart-hidden"):r.querySelector(".delete").classList.add("smart-hidden"),r.editPanelPopulated&&(r.selectTab(0),r.editors.historyTab&&r.editors.historyTab.classList.add("smart-hidden")),o){let t="task"===a?s.localize("promptTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("promptComment"),l="task"===a?s.localize("removeTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("removeComment");"column"===a&&(t=s.localize("promptColumn"),l=s.localize("removeColumn")),r.label=l,r.setAttribute("aria-label",t),r.$.container.querySelector(".prompt").innerHTML=t}else{let a=!0;r.removeAttribute("aria-label"),r.headerPosition="top",r.editPanelPopulated||(s._initEditPanel(),a=!1),"edit"===t?s._beginEdit(e):"add"===t&&(r.label=s.localize("addNewTask"),delete r.taskOrComment,a&&s._clearEditors(),s._showHideDialogEditors(),r.refreshTabs(!1),r.selectTab(0),r.editors.status.selectedValues=[e.dataField],0===s.swimlanes.length?(r.editors.swimlane.classList.add("smart-hidden"),r.editors.swimlaneLabel.classList.add("smart-hidden"),r.editors.swimlane.parentElement.classList.add("single-column")):(r.editors.swimlane.classList.remove("smart-hidden"),r.editors.swimlaneLabel.classList.remove("smart-hidden"),r.editors.swimlane.parentElement.classList.remove("single-column")),r.editors.created.parentElement.classList.add("smart-hidden"),r.editors.updated.parentElement.classList.add("smart-hidden"))}s.$.container.setAttribute("modal","");const n=s.offset(s);s.offsetWidth>600&&(r.offsetHeight>s.offsetHeight?r.style.top=s.getBoundingClientRect().top+"px":r.style.top=n.top+s.offsetHeight/2-r.offsetHeight/2+"px",r.offsetWidth>s.offsetWidth?r.style.left=s.getBoundingClientRect().left+"px":r.style.left=n.left+s.offsetWidth/2-r.offsetWidth/2+"px"),s.dialogCustomizationFunction&&s.dialogCustomizationFunction(r,e,r.editors,r.labels,t,a),r.open()}_createDialog(){const e=this,t=document.createElement("smart-window"),a=document.createElement("template"),s=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;a.innerHTML=`<smart-button class="ok primary"${s}><span class="smart-icon"></span>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${s}><span class="smart-icon"></span>${e.localize("cancel")}</smart-button><smart-button class="smart-hidden delete secondary"${s}><span class="smart-icon"></span>${e.localize("delete")}</smart-button>`,t.animation=e.animation,t.footerTemplate=a,t.headerButtons=["close"],t.rightToLeft=e.rightToLeft,t.resizeMode="both",t.liveResize=!0,t.theme=e.theme,t.className="smart-kanban-window",t.innerHTML='<div class="prompt"></div>\n<div class="edit"></div>',t.ownerElement=e,e._dialog=t,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(t)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("open",e._dialogEventHandler),t.addEventListener("closing",e._dialogEventHandler),t.addEventListener("close",e._dialogEventHandler),t.addEventListener("click",e._dialogClickHandler),t.addEventListener("keydown",(e=>{if("Enter"===e.key){const e=t.querySelector(".ok"),a=t.querySelector('.smart-kanban-tab[view="details"]');a&&a.classList.contains("selected")&&(e.disabled||e.click())}}))}_dialogEventHandler(e){const t=this,a=t.ownerElement,s=e.type,l=a.context;(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target)===t&&(a.context=a,"open"===s?(a.$.fireEvent("open"),t.classList.contains("edit")&&(a.hasAnimation?t.addEventListener("transitionend",(function(){setTimeout((()=>{!a.readonly&&a._currentUser.allowEdit&&t.editors.text.focus()}),100)}),{once:!0}):requestAnimationFrame((()=>t.editors.text.focus())))):"closing"===s?a.$.fireEvent("closing").defaultPrevented&&(e.preventDefault(),delete t.ok):"close"===s&&(a.$.fireEvent("close"),a._dialogCloseHandler(e)),a.context=l)}_dialogClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.closest(".ok"))t.ok=!0,t.close();else if(a.closest(".cancel"))t.close();else if(a.closest(".delete"))t.ownerElement.removeTask(t.taskOrComment),t.close();else if(a.closest(".add")){const e=t.editors.newSubtask,a=e.value;if(""===a)return;const s=t.editors.checklist;s.insert(s.items.length,{label:a}),e.value="",t.$.content.scrollTop=t.$.content.scrollHeight-t.$.content.offsetHeight,t.refreshTabs()}else if(a.classList.contains("remove-subtask"))t.editors.checklist.removeChild(a.closest("smart-list-item")),t.refreshTabs();else if(a.classList.contains("remove-button")){const e=t.ownerElement,s=t.ownerElement.dataSourceMap,l=t.taskOrComment.data[s.comments],r=a.closest(".smart-comment").comment,o=JSON.parse(JSON.stringify(t.taskOrComment.data));t.taskOrComment.comment=r,t.taskOrComment.data[s.comments]=l.filter((e=>e!==t.taskOrComment.comment)),t.refreshComments();const i=JSON.parse(JSON.stringify(t.taskOrComment.data));e.$.fireEvent("change",{task:t.taskOrComment,id:i.id,value:i,oldValue:o}),e.$.fireEvent("taskUpdate",{id:i.id,value:i,oldValue:o}),e.$.fireEvent("commentRemove",{id:i.id,value:t.taskOrComment.comment})}}_dialogCloseHandler(){const e=this,t=e.dataSourceMap,a=e._dialog;function s(s){const l=JSON.parse(JSON.stringify(s.data));a.taskOrComment.remove(),s.querySelector(".smart-kanban-task-comments").setAttribute("num",s.data[t.comments].length||""),e._commentsList.editing&&(e._commentsList.textarea.value="",delete e._commentsList.editing);const r=JSON.parse(JSON.stringify(s.data));e.$.fireEvent("change",{task:s,id:r.id,value:r,oldValue:l}),e.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:l}),e.$.fireEvent("commentRemove",{id:r.id,value:a.taskOrComment.comment})}if(e.$.container.removeAttribute("modal"),a.ok){if(a.classList.contains("prompt")){const l=e._commentSelectionFor;if(l){const r=l.data;if(e.dataSource&&e.dataSource.virtualDataSource){const o=Object.assign({},r);o[t.comments]=o[t.comments].filter((e=>e!==a.taskOrComment.comment)),e._requestVirtualDataSource("update",o,(function(e){return e&&(l.data=o,s(l)),e}))}else r[t.comments]=r[t.comments].filter((e=>e!==a.taskOrComment.comment)),s(l)}else e._columnActionSelectionFor&&a.taskOrComment.dataField?e.removeColumn(a.taskOrComment.dataField):e.removeTask(a.taskOrComment)}else e._endEdit();delete a.ok}a.openedFrom&&requestAnimationFrame((()=>{e.getRootNode().contains(a.openedFrom)&&a.openedFrom.focus&&a.openedFrom.focus(),delete a.openedFrom})),delete a.taskOrComment}_closeDialog(){const e=this;e._dialog&&e._dialog.close()}_getHistoryItemLabel(e){const t=this;let a;switch(e.action){case"created":a=t.localize("taskCreated");break;case"tags":a=t.localize("taskTagsChanged");break;case"description":a=t.localize("taskDescriptionChanged");break;case"progress":a=t.localize("taskProgressChanged");break;case"text":a=t.localize("taskNameChanged");break;case"color":a=t.localize("taskColorChanged");break;case"priority":a=t.localize("taskPriorityChanged");break;case"deadline":a=t.localize("taskDeadlineChanged");break;case"subtasks":a=t.localize("taskSubtasksChanged");break;case"user":a=e.details.value?t.localize("taskUserChanged"):t.localize("taskUserRemoved");break;case"moved":a=t.localize("taskMoved");break;case"status":a=t.localize("taskStatusChanged");break;default:a=t.localize("taskUpdated")}return a}_initEditPanel(){const e=this,t=e.id,a=e._dialog,s=a.$.container.querySelector(".edit"),l=[""].concat(e.users.map((e=>({label:e.name,value:e.id,color:e.color,image:e.image})))),r=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))),o=e._getPriority(),i=e.swimlanes.map((e=>({label:e.label,value:e.dataField}))),n=document.createElement("template"),d=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;n.innerHTML=`<div class="smart-kanban-sub-task"><span class="label">{{label}}</span><span class="remove-subtask" aria-label="Remove subtask" title="${e.localize("removeSubtask")}"></span></div>`,n.id=e.id+"ChecklistTemplate",a.$.container.appendChild(n),s.innerHTML=`\n <div tabindex="0" class="smart-kanban-tab-strip">\n <div tabindex="0" view="details" class="selected smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("detailsTab")}</div></div>\n <div tabindex="0" view="subtasks" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("subtasksTab")}</div></div>\n <div tabindex="0" view="comments" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("commentsTab")}</div></div>\n <div tabindex="0" view="history" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("historyTab")}</div></div>\n <div tabindex="0" view="fields" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("fieldsTab")}</div></div>\n </div>\n <div class="smart-kanban-tab-content details">\n <div class="layout">\n <div class="column">\n <div id="${t}LabelText" class="editor-label">${e.localize("text")}</div>\n <smart-input class="editor text-editor" aria-labelledby="${t}LabelText"></smart-input>\n <div id="${t}LabelDescription" class="editor-label">${e.localize("description")}</div>\n <textarea class="editor description-editor" aria-labelledby="${t}LabelDescription"></textarea> \n <div id="${t}LabelStatus" class="editor-label">${e.localize("status")}</div>\n <smart-multi-combo-input single-select pills color-items class="editor status-editor" drop-down-open-position="auto" data-source='${JSON.stringify(r)}' drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelStatus"></smart-multi-combo-input>\n <div id="${t}LabelSwimlane" class="editor-label swimlane-label">${e.localize("swimlane")}</div>\n <smart-input class="editor swimlane-editor" drop-down-open-position="auto" data-source='${JSON.stringify(i)}'${0===i.length?" disabled":""} drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelSwimlane"></smart-input>\n </div>\n <div class="column">\n <div class="editor-container">\n <div id="${t}LabelAssignedTo" class="editor-label">${e.localize("assignedTo")}</div>\n <div id="${t}LabelProgress" class="editor-label">${e.localize("progress")}</div>\n <smart-multi-combo-input readonly pills class="editor asignee-editor" single-select data-source='${JSON.stringify(l)}'${0===l.length?" disabled":""} drop-down-button-position="right"${d} aria-labelledby="${t}LabelAssignedTo"></smart-multi-combo-input>\n <smart-numeric-text-box class="editor progress-editor" input-format="floatingPoint" min="0" max="100" show-unit unit="%"${d} aria-labelledby="${t}LabelProgress"></smart-numeric-text-box>\n </div>\n <div class="editor-container">\n <div id="${t}LabelStartDate" class="editor-label">${e.localize("startDate")}</div>\n <div id="${t}LabelDueDate" class="editor-label">${e.localize("dueDate")}</div>\n <smart-date-time-picker auto-close auto-open class="editor start-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelStartDate"></smart-date-time-picker>\n <smart-date-time-picker auto-close auto-open class="editor due-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelDueDate"></smart-date-time-picker>\n </div>\n <div class="editor-error-container smart-hidden" style="color: var(--smart-error);">\n <label id="${t}LabelRange">${e.localize("invalidRange",{start:e.localize("startDate"),end:e.localize("dueDate")})}</label>\n <br/> <br/>\n </div>\n <div class="editor-container">\n <div id="${t}LabelPriority" class="editor-label">${e.localize("priority")}</div>\n <div id="${t}LabelColor" class="editor-label">${e.localize("color")}</div>\n <div style="display: flex;"><span class="priority-editor-icon"></span><smart-input class="editor priority-editor" data-source='${JSON.stringify(o)}' drop-down-height="auto" drop-down-open-position="auto" drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelPriority"></smart-input></div>\n <smart-color-input value-display-mode="colorBox" class="editor color-editor" drop-down-open-position="auto" drop-down-button-position="right"${d} aria-labelledby="${t}LabelColor"></smart-color-input>\n </div>\n <div id="${t}LabelTags" class="editor-label">${e.localize("tags")}</div>\n <div aria-labelledby="${t}LabelTags">\n <smart-multi-combo-input color-items readonly pills class="editor tags-editor" drop-down-button-position="right" drop-down-open-position="auto" ${d} aria-labelledby="${t}LabelTags"></smart-multi-combo-input>\n <div class="smart-hidden editor empty-tags-label" id="${t}LabelEmptyTags" aria-labelledby="${t}LabelTags">${e.localize("emptyTags")}</div>\n </div>\n </div>\n </div>\n </div>\n <div class="smart-kanban-tab-content smart-hidden subtasks">\n <div id="${t}LabelChecklist" class="editor-label">${e.localize("checklist")}</div>\n <div class="new-container">\n <input type="text" class="new-subtask" placeholder="${e.localize("newSubtask")}" />\n <smart-button class="add primary" title="${e.localize("addSubtask")}" aria-label="Add subtask"${d}>+</smart-button>\n </div>\n <smart-list-box class="editor checklist-editor" item-template="${n.id}" selection-mode="checkBox"${d} aria-labelledby="${t}LabelChecklist"></smart-list-box>\n <br/>\n </div>\n <div class="smart-kanban-tab-content comments">\n </div>\n <div class="smart-kanban-tab-content smart-hidden history">\n <div class="editor-container">\n <div id="${t}LabelCreatedBy" class="editor-label">${e.localize("createdBy")}</div>\n <div id="${t}LabelCreatedByDate" class="editor-label">${e.localize("createdByDate")}</div>\n <div class="editor created" aria-labelledby="${t}LabelCreatedBy"></div>\n <div class="editor created-date" aria-labelledby="${t}LabelCreatedByDate"></div>\n </div>\n <div class="editor-container">\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedBy")}</div>\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedByDate")}</div>\n <div class="editor updated" aria-labelledby="${t}LabelUpdatedBy"></div>\n <div class="editor updated-date" aria-labelledby="${t}LabelUpdatedByDate"></div>\n </div>\n <div class="history-table smart-hidden editor-container">\n </div>\n </div>\n <div class="smart-kanban-tab-content fields">\n </div> \n<div class="template-container">\n</div>\n`,a.layout=s.querySelector(".layout"),a.editors={text:s.querySelector(".text-editor"),description:s.querySelector(".description-editor"),tags:s.querySelector(".tags-editor"),emptyTags:s.querySelector(".empty-tags-label"),userId:s.querySelector(".asignee-editor"),status:s.querySelector(".status-editor"),swimlane:s.querySelector(".swimlane-editor"),swimlaneLabel:s.querySelector(".swimlane-label"),startDate:s.querySelector(".start-date-editor"),dueDate:s.querySelector(".due-date-editor"),progress:s.querySelector(".progress-editor"),priority:s.querySelector(".priority-editor"),priorityIcon:s.querySelector(".priority-editor-icon"),color:s.querySelector(".color-editor"),newSubtask:s.querySelector(".new-subtask"),checklist:s.querySelector(".checklist-editor"),template:s.querySelector(".template-container"),created:s.querySelector(".created"),createdDate:s.querySelector(".created-date"),updated:s.querySelector(".updated"),updatedDate:s.querySelector(".updated-date"),tabs:s.querySelector(".smart-kanban-tab-strip"),detailsTab:s.querySelector('[view="details"]'),commentsTab:s.querySelector('[view="comments"]'),subtasksTab:s.querySelector('[view="subtasks"]'),historyTab:s.querySelector('[view="history"]'),fieldsTab:s.querySelector('[view="fields"]')},a.labels={};for(let e in a.editors){const t=a.editors[e].getAttribute("aria-labelledby"),l=s.querySelector("#"+t);l&&(a.labels[e]=l)}a.tabs={all:a.editors.tabs,detail:a.editors.detailsTab,comments:a.editors.commentsTab,history:a.editors.historyTab,subtasks:a.editors.subtasksTab,fields:a.editors.fieldsTab};const c=()=>{a.editors.status.classList.contains("smart-hidden")&&a.editors.text.classList.contains("smart-hidden")&&a.editors.description.classList.contains("smart-hidden")?(a.editors.description.closest(".column").classList.add("smart-hidden"),a.editors.description.closest(".layout").classList.add("single-column")):e.dialogEditors&&3===e.dialogEditors.length&&e.dialogEditors.indexOf("text")>=0&&e.dialogEditors.indexOf("description")>=0&&e.dialogEditors.indexOf("status")>=0?a.editors.description.closest(".layout").classList.add("single-column"):(a.editors.description.closest(".column").classList.remove("smart-hidden"),a.editors.description.closest(".column").classList.remove("single-column"),a.editors.description.closest(".layout").classList.remove("single-column"))};a.showEditor=e=>{const t=e=>{if(e){const t=[...e.children];let a=0;for(let e=0;e<t.length;e++)t[e].classList.contains("smart-hidden")||a++;a===t.length&&e.classList.remove("single-column")}};a.editors[e]&&(a.editors[e].classList.remove("smart-hidden"),t(a.editors[e].closest(".editor-container"))),a.labels[e]&&(a.labels[e].classList.remove("smart-hidden"),t(a.labels[e].closest(".editor-container"))),"checklist"===e&&a.tabs.subtasks.classList.remove("smart-hidden"),c()},a.hideEditor=e=>{if(a.editors[e]){a.editors[e].classList.add("smart-hidden");const t=a.editors[e].closest(".editor-container");t&&t.classList.add("single-column")}a.labels[e]&&a.labels[e].classList.add("smart-hidden"),"checklist"===e&&a.tabs.subtasks.classList.add("smart-hidden"),c()};const u=a.editors.tabs.querySelectorAll(".smart-kanban-tab");a.selectTab=e=>{if(u[e]&&!u[e].classList.contains("smart-hidden")&&u[e].click(),0===e){const e=[...a.tabs.all.children];for(let t=0;t<e.length;t++)if(e[t]&&!e[t].classList.contains("smart-hidden")){e[t].click();break}}},a.refreshTabs=t=>{const s=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.comments]:0,l=s&&s.length?'<span class="summary"> ('+s.length+")</span>":"";let r=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.checklist]:0,o=r&&r.length?'<span class="summary"> ('+r.length+")</span>":"";t||(r=a.editors.checklist.items.length,r&&(o=r?'<span class="summary"> ('+r+")</span>":"")),a.editors.commentsTab.innerHTML=`${e.localize("commentsTab")}${l}`,a.editors.subtasksTab.innerHTML=`${e.localize("subtasksTab")}${o}`,e._currentUser.allowComment&&a.taskOrComment?a.editors.commentsTab.classList.remove("smart-hidden"):a.editors.commentsTab.classList.add("smart-hidden"),e.readonly&&!r?a.editors.subtasksTab.classList.add("smart-hidden"):a.editors.checklist.classList.contains("smart-hidden")||a.editors.subtasksTab.classList.remove("smart-hidden"),e.taskCustomFields.length>0?a.editors.fieldsTab.classList.remove("smart-hidden"):a.editors.fieldsTab.classList.add("smart-hidden"),a.taskOrComment&&(a.taskOrComment.data[e.dataSourceMap.updatedDate]||a.taskOrComment.data[e.dataSourceMap.createdDate])?a.editors.historyTab.classList.remove("smart-hidden"):a.editors.historyTab.classList.add("smart-hidden");const i=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];let n=0;for(let e=0;e<i.length;e++){const t=i[e];a.editors[t].classList.contains("smart-hidden")&&n++}n===i.length?a.tabs.detail.classList.add("smart-hidden"):a.tabs.detail.classList.remove("smart-hidden")},a.refreshFields=()=>{const t=a.querySelector(".fields"),s=a.taskOrComment?a.taskOrComment.data:{},l=e.taskCustomFields.length,r=a.querySelectorAll(["[container-for]"]).length;if(e._resetFields&&(delete e._resetFields,a.refreshFieldsDirty=!0,t.innerHTML=""),!0===a.refreshFieldsDirty)if(a.refreshFieldsDirty=!1,t.firstElementChild&&l<=r)for(let t=0;t<e.taskCustomFields.length;t++){const l=e.taskCustomFields[t];let r=s[l.dataField];const o=a.querySelector("[container-for="+l.dataField+"]");if(!o)continue;e.dataSourceMap[l.dataField]?o.classList.add("smart-hidden"):o.classList.remove("smart-hidden"),null==r&&(r="");const i=o.lastElementChild.firstElementChild;i.removeAttribute("dirty"),r&&r instanceof Date?"dateInput"===l.editor?i.value=r:r&&"dateRangeInput"===l.editor?Array.isArray(r)&&(i.value=r):i.value=""+r:i.value=""+r,"image"===l.editor?r||(i.innerHTML=e.localize("emptyImage")):"attachments"===l.editor&&(r||(i.innerHTML=e.localize("emptyAttachment")))}else{const a=document.createDocumentFragment(),l=(t,a,s)=>{null==a&&(a="");const l=document.createElement("div"),r=document.createElement("div"),o=document.createElement("div");void 0===s.visible&&(s.visible=!0),void 0===s.allowHide&&(s.allowHide=!0),s.allowHide?r.innerHTML=t+'<span class="icon"></span>':r.innerHTML=t,r.classList.add("editor-label"),s.allowHide&&(!1===s.visible&&r.lastElementChild.classList.add("hide"),r.lastElementChild.onpointerdown=()=>{s.visible=!s.visible,r.lastElementChild.classList.toggle("hide")}),o.classList.add("editor");let i=document.createElement("input");if(i.classList.add("smart-input"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength),"textarea"===s.editor)i=document.createElement("smart-text-area"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength);else if("password"===s.editor)i.type="password";else if("phone"===s.editor||"tel"===s.editor)Smart.PhoneInput?i=document.createElement("smart-phone-input"):i.type="tel";else if("url"===s.editor)i.type="url";else if("email"===s.editor)i.type="email";else if("date"===s.dataType||"dateInput"===s.editor)"dateRangeInput"===s.editor?(i=document.createElement("smart-date-range-input"),i.selectedDates=a):i=document.createElement("smart-date-input"),i.autoClose=!0,""===a&&(a=new Date),void 0!==s.minDate&&(i.min=s.minDate),void 0!==s.maxDate&&(i.max=s.maxDate);else if("boolean"===s.dataType)i=document.createElement("smart-check-box"),""===a&&(a=!1);else if("number"===s.dataType||"numberInput"===s.editor)i=document.createElement("smart-number-input"),a||(a=0),void 0!==s.min&&(i.min=s.min),void 0!==s.max&&(i.max=s.max);else if("string"===s.dataType&&s.options)i=document.createElement("smart-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.options;else if("string"===s.dataType&&"multiComboInput"===s.editor)i=document.createElement("smart-multi-combo-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.dataSource,i.pills=!0,i.selectedValues=[""+a],s.singleSelect&&(i.singleSelect=!0),s.colorItems&&(i.colorItems=!0);else if("string"!==s.dataType||"image"!==s.editor&&"images"!==s.editor){if("string"===s.dataType&&("attachment"===s.editor||"attachments"===s.editor))if(a.length>50){if("string"==typeof a&&(a.indexOf("[{")>=0||a.indexOf("}]")>=0)){let e="";if(a)try{e=JSON.parse(a)}catch(e){console.log(e)}a=e}const t=document.createElement("div");if(Array.isArray(a)){a.forEach((e=>{const a=document.createElement("div");a.title=e.label,a.classList.add("item"),a.innerHTML="<div></div>",a.firstElementChild.classList.add("smart-grid-icon","show","attachment"),e.label.indexOf("png")>=0||e.label.indexOf("jpg")>=0||e.label.indexOf("jpeg")>=0||e.label.indexOf("gif")>=0?a.firstElementChild.classList.add("smart-icon-image"):e.label.indexOf(".pdf")>=0?a.firstElementChild.classList.add("smart-icon-pdf"):e.label.indexOf(".tsv")>=0||e.label.indexOf(".txt")>=0||e.label.indexOf(".csv")>=0?a.firstElementChild.classList.add("smart-icon-text"):e.label.indexOf(".xls")>=0||e.label.indexOf(".xlsx")>=0?a.firstElementChild.classList.add("smart-icon-excel"):e.label.indexOf(".ppt")>=0?a.firstElementChild.classList.add("smart-icon-powerpoint"):e.label.indexOf(".zip")>=0||e.label.indexOf(".rar")>=0||e.label.indexOf(".7z")>=0?a.firstElementChild.classList.add("smart-icon-archive"):e.label.indexOf(".doc")>=0||e.label.indexOf(".docx")>=0?a.firstElementChild.classList.add("smart-icon-word"):a.firstElementChild.classList.add("smart-icon-file"),t.appendChild(a)}));const s=t;t._value=a,t.onpointerdown=a=>{if(a.target.classList.contains("attachment")){const l=t._value&&"string"==typeof t._value?JSON.parse(t._value):t._value,r=[...s.children[0].children].indexOf(a.target);if(l[r]){const t=document.createElement("a");if(l[r].value.indexOf(window.location.host)>=0)fetch(l[r].value).then((e=>e.blob())).then((e=>{const a=URL.createObjectURL(e);t.download=l[r].label,t.href=a,t.click()}));else{if(l[r].value.indexOf("base64")>=0){const a=e._getFileFromBase64(l[r].value);t.href=URL.createObjectURL(a)}else t.href=l[r].value;t.target="_blank",t.click()}}a.stopPropagation(),a.preventDefault()}}}i=t}else i=document.createElement("div"),a||(i.innerHTML=e.localize("emptyAttachment"))}else if(a.length>50)if(a.indexOf("base64")>=0){a=JSON.parse(a),window.Smart._createSmartImageModal=e._createImageModal;let t="";for(let e=0;e<a.length;e++){const s=a[e];t+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" width="20" height="20" src="${s.value}" title="${s.label}"/>`}i=document.createElement("div"),i.innerHTML=t}else a=a.substring(0,50)+"...";else i=document.createElement("div"),a||(i.innerHTML=e.localize("emptyImage"));return i.setAttribute("data-field",s.dataField),i.classList.add("smart-kanban-task-field-editor"),s&&"dateRangeInput"===s.editor?i.value=a:i.value=""+a,i.onchange=()=>{i.setAttribute("dirty","")},o.appendChild(i),l.appendChild(r),l.appendChild(o),l.setAttribute("container-for",s.dataField),l},r=document.createElement("div");r.classList.add("editor-container"),a.appendChild(r);for(let t=0;t<e.taskCustomFields.length;t++){const a=e.taskCustomFields[t],o=l(a.label,s[a.dataField],a);r.appendChild(o),e.dataSourceMap[a.dataField]&&o.classList.add("smart-hidden")}t.innerHTML="",t.appendChild(a)}},a.refreshHistory=()=>{const t=a.querySelector(".history-table");if(!e.storeHistory)return void t.classList.add("smart-hidden");t.classList.remove("smart-hidden");const s=a.taskOrComment.data.history;let l=`<table><tr>\n <th>${e.localize("historyEvent")}</th>\n <th>${e.localize("historyAuthor")}</th>\n <th>${e.localize("historyDetails")}</th>\n <th>${e.localize("historyDate")}</th>\n </tr>\n `;for(let t=s.length-1;t>=0;t--){const a=s[t];if(l+=`<tr>\n <td>${e._getHistoryItemLabel(a)}</td>`,void 0!==a.user){const t=t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser")}},s=t(e.users.find((e=>e.id===a.user)));l+=`<td><div class="smart-kanban-task-user-history"><div class="icon smart-kanban-task-user" style="${s.image}"></div><div class="name">${s.label}</div></div></td>`}else l+="<td></td>";if("created"!==a.action){let t=a.details.oldValue,s=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t)),l=e.users.find((e=>e.id===s));t=a?a.name:e.localize("unassigned"),s=l?l.name:e.localize("unassigned")}if(t&&t instanceof Date&&(t=t.toLocaleString()),s&&s instanceof Date&&(s=s.toLocaleString()),"subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));l+=`<td><span class="smart-truncate">${e.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span></td>`}else l+=t?`<td><span class="smart-truncate">${e.localize("range",{oldValue:t,newValue:s})}</span></td>`:`<td><span class="smart-truncate">${e.localize("nullRange",{oldValue:t,newValue:s})}</span></td>`}else l+=`<td>${a.details.value}</td>`;l+=`\n <td>${a.date.toLocaleString()}</td>\n </tr>`}l+="</table>",t.innerHTML=l,a.refreshTabs()},a.refreshComments=()=>{if(!a.taskOrComment)return;const t=a.querySelector(".comments");t.classList.remove("smart-hidden");const s=e._getCommentsList(a.taskOrComment);s.classList.remove("dialog");const l=s.querySelector(".send");l&&(l.onclick=t=>{if(l.disabled)return;const s=JSON.parse(JSON.stringify(e._commentSelectionFor.data)),r=e._createComment();e._commentsList.textarea.value="",l.disabled=!0,a.refreshTabs();const o=JSON.parse(JSON.stringify(e._commentSelectionFor.data));e.$.fireEvent("change",{task:e._commentSelectionFor,id:o.id,value:o,oldValue:s}),e.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:s}),e.$.fireEvent("commentAdd",{id:o.id,value:r}),t.stopPropagation(),t.preventDefault()}),t.innerHTML="",t.appendChild(s),a.refreshTabs()},u.forEach((e=>{e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus")},e.onkeydown=t=>{"Enter"===t.key&&(e.click(),t.stopPropagation())},e.onclick=e=>{const t=e.target.closest(".smart-kanban-tab"),s=t.getAttribute("view");switch(u.forEach((e=>{e.classList.remove("selected")})),t.focus(),t.classList.add("selected"),a.querySelectorAll(".smart-kanban-tab-content").forEach((e=>{e.classList.add("smart-hidden")})),s){case"details":a.querySelector(".details").classList.remove("smart-hidden");break;case"subtasks":a.querySelector(".subtasks").classList.remove("smart-hidden");break;case"comments":a.refreshComments();break;case"history":a.querySelector(".history").classList.remove("smart-hidden"),a.refreshHistory();break;case"fields":a.querySelector(".fields").classList.remove("smart-hidden"),a.refreshFields()}}})),(()=>{const e=a.editors.color;e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.dropDownWidth=50;const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input"),e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")}})(),a.editors.newSubtask.onchange=()=>{a.editors.newSubtask.nextElementSibling.click()},a.editors.priority.onchange=()=>{e._setPriorityEditorIcon(!0)},e._setPriorityEditorIcon(),a.editPanelPopulated=!0,e.dialogRendered&&e.dialogRendered(a,a.editors,a.labels,a.tabs,a.layout,a.taskOrComment)}_setPriorityEditorIcon(e){const t=this,a=t._dialog;let s=a.editors.priority.selectedValues[0];null==s&&(s=""),e||a.taskOrComment&&a.taskOrComment.data&&void 0!==a.taskOrComment.data.priority&&(s=a.taskOrComment.data.priority);const l=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let e=0;e<t.priority.length;e++){const r=t.priority[e];if(s?a.editors.priorityIcon.classList.remove("smart-hidden"):a.editors.priorityIcon.classList.add("smart-hidden"),r.value===s){a.editors.priorityIcon.innerHTML='<div class="smart-kanban-task-text">'+l(r)+"</div>";break}}}_showHideDialogEditors(){const e=this,t=e._dialog,a=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];for(let s=0;s<a.length;s++){const l=a[s];e.dialogEditors.indexOf(l)>=0?t.showEditor(l):t.hideEditor(l)}const s=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})));s.length<=1&&t.hideEditor("status"),t.editors.status.dataSource=s,0===t.editors.tags.dataSource.length?(t.editors.tags.classList.add("smart-hidden"),t.editors.emptyTags.classList.remove("smart-hidden")):(t.editors.tags.classList.remove("smart-hidden"),t.editors.emptyTags.classList.add("smart-hidden")),0===e.users.length&&t.hideEditor("userId")}_unescapeValue(e){if(null==e)return e;const t=[{regex:"&",entity:"&amp;"},{regex:">",entity:"&gt;"},{regex:"<",entity:"&lt;"},{regex:'"',entity:"&quot;"},{regex:"'",entity:"&#39;"},{regex:"=",entity:"&#x3D;"},{regex:"/",entity:"&#x2F;"},{regex:"`",entity:"&#x60;"}];let a;for(let s in t)a=new RegExp(t[s].entity,"g"),e=e.replace(a,t[s].regex);return e}_escapeValue(e){return e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")}_beginEdit(e){const t=this;t.tags||(t.tags=[]);const a=t.dataSourceMap,s=e.data,l=t._dialog,r=l.editors,o=t.tags.length>0?[...t.tags,...t._customTags]:t._customTags,i=t._allColumns.find((e=>e.dataField===s[a.status]));if(l.label=t.localize("editTask",{taskId:s[a.id],text:s[a.text]}),r.text.value=t._unescapeValue(s[a.text]),r.description.value=t._unescapeValue(s[a.description]),r.tags.dataSource=o,t._showHideDialogEditors(),t.allowCustomTags,s[a.tags]){const e=e=>{let a=[];e.indexOf(",")>=0?a=e.split(","):Array.isArray(e)?a=a.concat(e):a.push(e);const s=[];for(let e=0;e<a.length;e++)"string"==typeof a[e]?(a[e]=t._unescapeValue(a[e].trim()),s.push(a[e])):(a[e].label=t._unescapeValue(a[e].label),s.push(a[e].value));return s};if(!t.allowCustomTags){const l=t.tags.length>0?t.tags:e(s[a.tags]);r.tags.dataSource=l}r.tags.selectedValues=e(s[a.tags])}else r.tags.selectedValues=[];0===r.tags.dataSource.length?(r.tags.classList.add("smart-hidden"),r.emptyTags.classList.remove("smart-hidden")):(r.tags.classList.remove("smart-hidden"),r.emptyTags.classList.add("smart-hidden")),l.editors.created.parentElement.classList.add("smart-hidden"),l.editors.updated.parentElement.classList.add("smart-hidden");const n=void 0!==s[a.createdUserId]?t.users.find((e=>e.id===s[a.createdUserId])):"",d=s[a.createdDate],c=void 0!==s[a.updatedUserId]?t.users.find((e=>e.id===s[a.updatedUserId])):"",u=s[a.updatedDate],m=e=>{const a=e?e.image:null;return{image:a?`background-image: url('${a}');`:"",label:e?e.name||e.id:t.localize("guestUser")}};if(n){const e=m(n);l.editors.created.parentElement.classList.remove("smart-hidden"),l.editors.created.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,d&&(l.editors.createdDate.innerHTML=d.toLocaleString())}if(c){const e=m(c);l.editors.updated.parentElement.classList.remove("smart-hidden"),l.editors.updated.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,u&&(l.editors.updatedDate.innerHTML=u.toLocaleString())}const p=null!==s[a.userId]?t.users.find((e=>e.id===s[a.userId])):"";p?r.userId.selectedItems=[{label:p.name,value:p.id,image:p.image?p.image:null}]:r.userId.value="",delete r.userId.$.input.dataValue,r.status.selectedValues=[i.dataField],t.readonly||!t._currentUser.allowEdit?(r.status.readonly=!1,r.priority.readonly=!1):(r.status.readonly=!0,r.priority.readonly=!0),delete r.status.$.input.dataValue,t._hasSwimlane(t.columns.indexOf(i))?r.swimlane.value=t.swimlanes.find((e=>e.dataField===s[a.swimlane])).label:r.swimlane.value="",delete r.swimlane.$.input.dataValue,r.startDate.value=s[a.startDate]||null,r.dueDate.value=s[a.dueDate]||null,r.progress.value=parseFloat(s[a.progress])||0;const h=t.localize(s[a.priority]);r.priority.value=null!=h?h:"",delete r.priority.$.input.dataValue,""===r.priority.value&&(r.priority.selectedValues=[]),r.color.value=s[a.color]||"";const g=[],f=[];(s[a.checklist]||[]).forEach(((e,t)=>{e.completed&&g.push(t),f.push({label:e.text,selected:!0===e.completed})})),0===t.swimlanes.length?(l.editors.swimlane.classList.add("smart-hidden"),l.editors.swimlaneLabel.classList.add("smart-hidden"),l.editors.swimlane.parentElement.classList.add("single-column")):(l.editors.swimlane.classList.remove("smart-hidden"),l.editors.swimlaneLabel.classList.remove("smart-hidden"),l.editors.swimlane.parentElement.classList.remove("single-column")),r.dueDate.onchange=r.startDate.onchange=()=>{r.startDate.value>=r.dueDate.value&&r.dueDate.value?(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")):(l.$.footer.firstElementChild.disabled=!1,l.querySelector(".editor-error-container").classList.add("smart-hidden"))},r.startDate.value&&r.startDate.value>=r.dueDate.value&&r.dueDate.value&&(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")),r.newSubtask.value="",r.checklist.dataSource=f,r.checklist.selectedIndexes=g,t._setPriorityEditorIcon(),l.refreshTabs(!0),l.selectTab(0)}_endEdit(){const e=this,t=e.dataSourceMap,a=e._dialog,s=a.editors,l=a.taskOrComment,r=l?l.data:void 0,o=Object.assign({},r);let i=s.startDate.value,n=s.dueDate.value;o[t.text]=e._escapeValue(s.text.value),o[t.description]=e._escapeValue(s.description.value);const d=[];for(let t=0;t<s.tags.dataSource.length;t++){const a=s.tags.dataSource[t];"string"==typeof a?s.tags.selectedValues.indexOf(a)>=0&&d.push(e._escapeValue(a)):s.tags.selectedValues.indexOf(a.value)>=0&&(a.label=e._escapeValue(a.label),d.push(a))}if(o[t.tags]=d,o[t.progress]=parseFloat(s.progress.value),o[t.color]=s.color.value,e._currentUser.info&&(o[t.updatedUserId]=e._currentUser.info.id,o[t.updatedDate]=new Date),o[t.color]||""===o[t.color]||delete o[t.color],void 0!==s.userId.$.input.dataValue&&(o[t.userId]=parseFloat(s.userId.$.input.dataValue)),void 0!==s.status.$.input.dataValue&&(o[t.status]=s.status.$.input.dataValue),s.swimlane.$.input.dataValue&&(o[t.swimlane]=s.swimlane.$.input.dataValue),i&&(i=i.toDate()),n&&(n=n.toDate()),o[t.startDate]=i,o[t.dueDate]=n,void 0!==s.priority.$.input.dataValue&&(o[t.priority]=s.priority.$.input.dataValue),o[t.checklist]=s.checklist.items.map((e=>({text:e.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),completed:e.selected}))),e.taskCustomFields&&e.taskCustomFields.length>0)for(let t=0;t<e.taskCustomFields.length;t++){const s=e.taskCustomFields[t],l=a.querySelector("[data-field="+s.dataField+"]");if(l){let t=l.value;l.dataSource&&l.dataSource.length>0&&l.selectedValues.length>0&&(t=l.selectedValues.toString()),"smart-number-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-range-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),(l.hasAttribute("dirty")||e.dialogCustomizationFunction)&&(o[s.dataField]=t)}}l?e.updateTask(l,o):e.addTask(o),s.tags.close()}_clearEditors(){const e=this,t=e._dialog.editors,a=e.tags.length>0?e.tags:e._customTags;t.text.value="",t.description.value="",t.tags.dataSource=a,t.tags.selectedValues=[],t.status.selectedValues=[],delete t.status.$.input.dataValue,t.swimlane.value="",delete t.swimlane.$.input.dataValue,t.userId.value="",delete t.userId.$.input.dataValue,t.progress.value=0,t.startDate.value=null,t.dueDate.value=null,t.priority.value="",t.priority.$.input.dataValue="",t.priority.selectedValues=[],t.color.value="",t.newSubtask.value="",t.created.innerHTML="",t.updated.innerHTML="",t.createdDate.innerHTML="",t.updatedDate.innerHTML="",t.checklist.dataSource=[],t.checklist.selectedIndexes=[]}_getCurrentUser(){const e=this,t=e.users;let a=e.currentUser,s=!0,l=!0,r=e.allowDrag,o=e.editable,i=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(s=!1!==a.allowAdd,l=!1!==a.allowComment,r=r&&!1!==a.allowDrag,o=o&&!1!==a.allowEdit,i=!1!==a.allowRemove)),e._currentUser={allowAdd:s,allowComment:l,allowDrag:r,allowEdit:o,allowRemove:i,info:a}}_autoSaveState(e){const t=this;if(t.autoSaveState)if("object"!=typeof e)if(e&&t._autoSavedState){switch(e){case"collapsed":t._allColumns.forEach((e=>t._autoSavedState.collapsed[e.dataField]=e.collapsed));break;case"dataSource":t._autoSavedState.dataSource=t._getCurrentDataSource();break;case"filtering":t._autoSavedState.filtering=t._appliedFiltering;break;case"selection":{const e=t.dataSourceMap;let a=null,s=null;t._selectionInView&&(a=t._selectionInView.closest(".smart-kanban-column").column.dataField,s=t._selectionInView.getAttribute("swimlane")),t._autoSavedState.selection={selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart.data[e.id]:null,selectionInColumn:a,swimlane:s};break}case"sorting":t._autoSaveState.sorting=t._appliedSorting;break;case"tabs":t._autoSaveState.tabs=t._selectedTabs;break;case"visibility":t._autoSavedState.visibility={taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}}window.localStorage.setItem("smartKanban"+t.id,JSON.stringify(t._autoSavedState))}else t._autoSavedState=t.saveState();else t._autoSavedState=e}_getCurrentDataFields(e){const t=this,a=[{name:"text",dataType:"string"},{name:"tags",dataType:"string"},{name:"priority",dataType:"string"},{name:"progress",dataType:"number"},{name:"startDate",dataType:"date"},{name:"dueDate",dataType:"date"},{name:"userId",dataType:"string"}],s=e&&e.length>0?e[0]:null;for(let e=0;e<t.taskCustomFields.length;e++)if(s){const l=typeof s[t.taskCustomFields[e].dataField];"number"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"number"}):"date"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"date"}):a.push({name:t.taskCustomFields[e].dataField,dataType:"string"})}else a.push({name:t.taskCustomFields[e].dataField,dataType:"string"});return a}_applyFilter(e,t){const a=this;if(a.dataSource&&a.dataSource.virtualDataSource)return a._requestVirtualDataSource("filter"),void a._autoSaveState("filtering");const s=a._getCurrentDataSource(),l=a._getCurrentDataFields(s),r=new Smart.DataAdapter({dataSource:s,dataFields:l,id:"id"});try{r._filter(e,t)}catch(e){return}if(a.virtualization){if(e&&e.length>0){const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered;let l=a._getTasksByDataField(s),o=[];for(let e=0;e<l.length;e++){const t=l[e],a=r.dataItemById[t.id];a&&a.$.filtered&&o.push(t)}a.tasksByDataField[s]._filtered=o}}else{const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered}}a._refreshColumns()}else{const e=Array.from(a.$.container.getElementsByClassName("smart-kanban-task"));for(let t=0;t<r.length;t++){const a=e[t],s=!r[t].$.filtered;a.classList.toggle("smart-hidden",s),a.filteredOut=s}a._allColumns.forEach((e=>a._refreshScrollViewer(e)))}a._autoSaveState("filtering")}_applyHandler(e,t){const a=this,s=a.isInShadowDOM||a.shadowRoot?e.composedPath()[0]:e.target,l=e.detail;a.$.customize.contains(s)||"customize"===t?(l.value.forEach((e=>a[e.dataField]=e.visible)),a._allColumns.forEach((e=>a._refreshScrollViewer(e))),a.virtualization&&(delete a._autoCardHeight,a._measureCardHeight(),a._refreshColumns()),a._autoSaveState("visibility")):a.$.filter.contains(s)||"filter"===t?a.addFilter(l.filters,l.operator,l.value):(a.$.sort.contains(s)||"sort"===t)&&a.addSort(l.sortByInfo),a.closePanel()}_applySort(){const e=this,t=e._appliedSorting;if(e._autoSaveState("sorting"),e.dataSource&&e.dataSource.virtualDataSource)e._requestVirtualDataSource("sort");else if(0!==t.dataFields.length)e._allColumns.forEach((a=>{const s=e._columnToElement.get(a).querySelector(".smart-scroll-viewer-content-container"),l=Array.from(s.children),r=[];if(l.length<2)return;let o;if(e.virtualization?e.tasksByDataField[a.dataField].forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t);"low"===l[s.priority]&&(l[s.priority]="z"),r.push(l)})):l.forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t.data);"low"===l[s.priority]&&(l[s.priority]="z"),r.push(l)})),e.taskCustomFields.length){const t=e._getCurrentDataFields(r);t.push({name:"taskIndex",dataType:"number"}),o=new Smart.DataAdapter({dataSource:r,observable:!1,dataFields:t,id:"id"})}else o=new Smart.DataAdapter({dataSource:r,observable:!1,dataFields:["taskIndex: number","text: string","tags: string","priority: string","progress: number","startDate: date","dueDate: date","userId: string"],id:"id"});if(o.sortBy(t.dataFields,t.dataTypes,t.orderBy),e.virtualization){if(e.tasksByDataField[a.dataField]._sorted=Smart.DataAdapter.Sort(e.tasksByDataField[a.dataField],t.dataFields,t.orderBy),e.tasksByDataField[a.dataField]._filtered){e.tasksByDataField[a.dataField]._originalFilteredData=JSON.parse(JSON.stringify(e.tasksByDataField[a.dataField]._filtered));const s=Smart.DataAdapter.Sort([...e.tasksByDataField[a.dataField]._filtered],t.dataFields,t.orderBy);e.tasksByDataField[a.dataField]._filtered=s||[]}e._refreshColumn(a.dataField)}else for(let e=0;e<o.length;e++)s.appendChild(l[o[e].taskIndex])}));else if(e.virtualization){const t=Object.keys(e.tasksByDataField);for(let a=0;a<t.length;a++){const s=t[a];delete e.tasksByDataField[s]._sorted,e.tasksByDataField[s]._filtered&&e.tasksByDataField[s]._originalFilteredData&&(e.tasksByDataField[s]._filtered=e.tasksByDataField[s]._originalFilteredData,delete e.tasksByDataField[s]._originalFilteredData),e._refreshColumn(s)}}}_closeSearchPanel(){const e=this;e._searchInfo&&(Array.from(e.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),delete e._searchInfo)}_constructFilterGroups(e){const t={text:"string",tags:"string",priority:"string",progress:"number",startDate:"date",dueDate:"date"},a={},s=[];e.filters.forEach((s=>{const l=s[0],r=t[l];let o=s[2],i=a[l];void 0===i&&(i=new Smart.Utilities.FilterGroup,a[l]=i),"date"===r&&"string"==typeof o&&(o=new Date(o));const n=i.createFilter(r,o,s[1]);i.addFilter(e.operator,n)}));for(let e in a)s.push([e,a[e]]);return s}_openSearchPanel(){const e=this;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._searchInfo={source:e._getCurrentDataSource(),stringDataFields:["text","tags"]},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(a._searchInfo.query=e,Array.from(a.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,void delete a._searchInfo.highlighted;const s=new Smart.DataAdapter({dataSource:a._searchInfo.source,dataFields:["text: string","tags: string"],id:"id"}),l=[],r=[],o={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,s=a.createFilter("string",e,"CONTAINS");a.addFilter("or",s),l.push([t,a])})),s._filter(l,"or");for(let e=0;e<s.length;e++){const t=s[e];!1!==t.$.filtered&&(r.push(t.$.id),o[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=r,a._searchInfo.foundIdsObject=o,Array.from(a.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>{const s=e.data[a.dataSourceMap.id];if(o[s]){if(e.filteredOut)return r.splice(r.indexOf(s),1),void delete o[s];t&&r[0]===s&&e.classList.add("smart-data-view-highlighted"),e.classList.add("smart-data-view-found")}})),r.length>0){if(t){let e=r[0];a._searchInfo.highlighted=e,a.ensureVisible(e)}return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),void(a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:r.length}))}a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_bodyFocusinHandler(e){const t=this;let a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.classList.contains("smart-kanban-column-content-tasks")&&(a=a.$.content,!t._getSelectedItem(a,!0))){if(t.virtualization){const e=t._focusedTask;return void t.focusTask(e)}if(void 0!==t._focusedTask)return void t.focusTask(t._focusedTask);t._focusTask(t._getFirstItem(a))}}get _rtlAttr(){return this.rightToLeft?" right-to-left":""}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}_appendAddNewColumn(e){const t=document.createElement("div");t.classList.add("smart-kanban-column","smart-kanban-add-new-column","smart-unselectable"),t.innerHTML=`<div class="smart-kanban-column-header smart-unselectable" > <div title="${this.localize("addNewColumn")}" class="smart-kanban-add-new-column-label smart-kanban-column-header-label"><span>+ ${this.localize("addNewStatus")}</span></div></div >\n <div class="smart-kanban-column-content no-sub-columns"><smart-scroll-viewer></smart-scroll-viewer></div>\n `,this.disabled||this.unfocusable||t.setAttribute("tabindex",0),t.column={dataField:"newStatus",label:"New Status"},e.appendChild(t)}selectTask(e){const t=this;t._selectedTasks.push(e),t._selectionStart=e,t._focusedTask=e;const a=t.querySelector(".smart-kanban-task[focus]");a&&a.removeAttribute("focus");const s=t.querySelector('.smart-kanban-task[data-id="'+e+'"]');s&&s.setAttribute("focus",""),t._refreshSelection(),t.ensureVisible(e)}unselectTask(e){const t=this,a=t._selectedTasks.indexOf(e);a>=0&&t._selectedTasks.splice(a,1),t._refreshSelection()}clearSelection(){const e=this;e._selectionStart=null,e._selectedTasks=[],e._refreshSelection()}getSelectedTasks(){return this._selectedTasks||(this._selectedTasks=[]),this._selectedTasks}getTask(e){return this.dataSource?this.dataSource.find((t=>{if(t.id===e)return t})):null}getColumn(e){const t=this;let a=null;for(let s=0;s<t.columns.length;s++)if(t.columns[s].dataField===e){a=t.columns[s];break}return a}getColumnDataItems(e){const t=this;let a=[];if(!t.getColumn(e)||!t.dataSource)return[];for(let s=0;s<t.dataSource.length;s++){const l=t.dataSource[s];l[t.dataSourceMap.status]===e&&a.push(l)}return a}_getFileFromBase64(e,t){let a=e.split(","),s=a[0].match(/:(.*?);/)[1],l=atob(a[1]),r=l.length,o=new Uint8Array(r);for(;r--;)o[r]=l.charCodeAt(r);return new File([o],t,{type:s})}updateColumn(e,t){const a=this;let s=null;for(let t=0;t<a.columns.length;t++)if(a.columns[t].dataField===e){s=a.columns[t];break}if(s){const e=s.label;void 0!==t.label&&(s.label=t.label),void 0!==t.collapsed&&(s.collapsed=t.collapsed),void 0!==t.collapsible&&(s.collapsible=t.collapsible),void 0!==t.orientation&&(s.orientation=t.orientation),void 0!==t.width&&(s.width=t.width),a._reset(),a.$.fireEvent("columnUpdate",{columnData:t,oldValue:e,value:s.label})}}addColumn(e){const t=this;e?(t.columns.push(e),t._reset(),t._createAddNewButton(),t.$.fireEvent("columnAdd",{columnData:e})):t._addNewColumnDynamically()}removeColumn(e){const t=this;let a=null,s=-1;for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){a=t.columns[l],s=l;break}if(a&&t.columns.splice(s,1),t.dataSource)for(let a=0;a<t.dataSource.length;a++){const s=t.dataSource[a];if(s[t.dataSourceMap.status]===e){const e=JSON.parse(JSON.stringify(s));s[t.dataSourceMap.status]=t.columns[0].value;const a=JSON.parse(JSON.stringify(s));t.$.fireEvent("change",{task:s,id:a.id,value:a,oldValue:e}),t.$.fireEvent("taskUpdate",{id:a.id,value:a,oldValue:e})}}t._reset(),t._createAddNewButton(),t.$.fireEvent("columnRemove",{column:a})}_addNewColumnDynamically(){const e=this,t=e._dialog,a=Math.floor(9e4*Math.random()+1e4),s={label:e.localize("addNewStatus")+" "+a,dataField:"newStatus"+a,addNewButton:!0,collapsed:!1,collapsible:!0,orientation:"vertical"},l=e.$.body.querySelector(".smart-kanban-add-new-column").querySelector(".smart-kanban-add-new-column-label"),r=document.createElement("input");if(l.classList.add("pending"),l.appendChild(r),r.classList.add("smart-kanban-column-header-input"),e.columnColors){l.classList.add("colors");const t=e._getColorInput();l.appendChild(t)}function o(a){let o=r.value,i=l.querySelector("smart-color-input");i&&i.opened?e._columnAddTimer&&clearTimeout(e._columnAddTimer):(!1===/^\s*$/.test(o)?(o=o.trim(),s.label=o,s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)):""===o&&(o="",s.label="",s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),l.classList.contains("pending")&&(e._columnAddTimer&&clearTimeout(e._columnAddTimer),e._columnAddTimer=setTimeout((()=>{if(l.classList.remove("pending"),r.parentNode&&r.parentNode.removeChild(r),i){s.color=i.value;const e=l.querySelector(".heading");if(e){const t=new Smart.Color(s.color).getInvertedColor();e.style.backgroundColor=s.color,e.style.color=t}i.remove()}e.columns.push(s),e._reset(),e._createAddNewButton(),t&&t.editPanelPopulated&&(t.editors.status.dataSource=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})))),e.$.fireEvent("columnAdd",{newColumn:s}),delete e._columnAddTimer}),50),a.stopPropagation()))}r.focus(),r.onkeydown=e=>{"Escape"===e.key?(l.classList.remove("pending"),r&&r.parentElement&&(r.nextElementSibling&&"Smart-COLOR-INPUT"===r.nextElementSibling.nodeName&&r.nextElementSibling.remove(),r.parentElement.removeChild(r),e.stopPropagation(),e.preventDefault())):"Enter"===e.key&&o(e)},r.addEventListener("blur",o),r.addEventListener("change",o)}_handleColumnEditing(e){const t=this,a=t.columns.find((t=>t.dataField===e));if(t._columnEditing)return;const s=Array.from(t.$.body.getElementsByClassName("smart-kanban-column")).find((t=>t.column.dataField===e)).querySelector(".smart-kanban-column-header-label"),l=document.createElement("input");s.classList.add("pending"),s.appendChild(l);const r=a.label,o=a.color;if(l.value=a.label,l.classList.add("smart-kanban-column-header-input"),t.columnColors){s.classList.add("colors");const e=t._getColorInput();e.value=a.color||"transparent",s.appendChild(e)}function i(e){let i=l.value,n=s.querySelector("smart-color-input");if(!n||!n.opened){if(!1===/^\s*$/.test(i)?(i=i.trim(),a.label=i,s.querySelector(".smart-kanban-title").innerHTML=i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,"")):""===i&&(a.label="",s.querySelector(".smart-kanban-title").innerHTML="&nbsp;"),n){a.color=n.value;const e=s.querySelector(".heading");if(e){const t=new Smart.Color(a.color).getInvertedColor();""===a.color?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=a.color,e.style.color=t)}t.applyColumnColorToTasks&&s.closest(".smart-kanban-column").style.setProperty("--smart-primary",a.color),n.remove()}s.classList.remove("pending");try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditTimer&&clearTimeout(t._columnEditTimer),t._columnEditing=!1,t._columnEditTimer=setTimeout((()=>{r===a.label&&o===a.color||t.$.fireEvent("columnUpdate",{column:a,oldValue:r,value:a.label}),delete t._columnEditTimer}),50),e.stopPropagation()}}t._columnEditing=!0,setTimeout((()=>{l.focus()}),50),l.onkeydown=e=>{if("Escape"===e.key){s.classList.remove("pending"),l.value=r;try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditing=!1}else"Enter"===e.key&&i(e)},l.addEventListener("blur",i),l.addEventListener("change",i)}_validateDataSourceMap(){this.dataSourceMap=Object.assign({},{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",userId:"userId"},this.dataSourceMap)}});
125
+ Smart("smart-kanban",class extends Smart.DataView{static get properties(){return{addNewButton:{value:!1,type:"boolean"},addNewButtonDisplayMode:{value:"top",allowedValues:["top","bottom","both"],type:"string"},addNewColumn:{value:!1,type:"boolean"},autoColumnHeight:{value:!1,type:"boolean"},applyColumnColorToTasks:{value:!1,type:"boolean"},addNewColumnWidth:{value:null,type:"any"},allowColumnEdit:{value:!1,type:"boolean"},allowColumnHide:{value:!0,type:"boolean"},allowColumnRemove:{value:!1,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowCustomTags:{value:!0,type:"boolean"},allowDrag:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDrop:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDropPlaceholder:{value:!1,type:"boolean",defaultReflectToAttribute:!0},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},cardHeight:{value:null,type:"number?"},currentUser:{value:null,type:"any"},columnColorEntireSurface:{value:!1,type:"boolean"},columnFooter:{value:!1,type:"boolean"},columnActions:{value:!1,type:"boolean"},columnColors:{value:!1,type:"boolean"},columnWidth:{value:null,type:"any"},columnSummary:{value:!1,type:"boolean"},columnEditMode:{value:"headerAndMenu",allowedValues:["header","menu","headerAndMenu"],type:"string"},columnHeaderTemplate:{value:null,type:"any"},disableDialog:{value:!1,type:"boolean"},disableAddNewDialog:{value:!1,type:"boolean"},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},editable:{value:!1,type:"boolean"},editMode:{value:"doubleClick",allowedValues:["singleClick","doubleClick"],type:"string"},dragOffset:{value:"auto",type:"any"},formatStringDate:{value:"d",type:"string"},formatStringTime:{value:"MMM d, HH:mm",type:"string"},hierarchy:{value:"columns",allowedValues:["columns","tabs"],type:"string"},messages:{value:{en:{actionsIcon:"Actions icon",actionsList:"Open actions list",unassignedTask:"Unassigned task",unassigned:"unassigned",assignedTask:"Assigned to {{userName}}",addNewStatus:"New status",addNewColumn:"Add new status",addNewTask:"Add new task",addSubtask:"Add subtask",assignedTo:"Assigned to",createdBy:"Created by",updatedBy:"Updated by",createdByDate:"Created",updatedByDate:"Updated",checklist:"Sub tasks",color:"Color",commentsIcon:"Comments icon",copy:"Copy",customize:"Customize tasks",customizeColumn:"Customize column",dueDate:"Due date",days:"days",edit:"Edit",editTask:"ID: {{taskId}} {{text}}",expand:"Expand column",collapse:"Collapse column",high:"High",low:"Low",critical:"Critical",newComment:"New comment",newSubtask:"New subtask",overdue:"Overdue",average:"Average",priority:"Priority",priorityIcon:"Priority icon",progress:"Progress",promptComment:"Are you sure you want to remove this comment?",promptTask:'Are you sure you want to remove the task "{{taskText}}"?',promptColumn:"Are you sure you want to remove this column?",remove:"Remove",removeSubtask:"Remove subtask",removeColumn:"Remove column",hideColumn:"Hide column",removeComment:"Remove comment",removeTask:"Remove task",showAllColumns:"Show all columns",send:"Send",startDate:"Start date",status:"Status",swimlane:"Swimlane",tags:"Tags",text:"Name",textPlaceholder:"Write a task name",description:"Description",taskProgress:"Task progress: {{value}}%",taskDescription:"Task description: {{value}}",taskCompleted:"Tasks completed: {{value}}/{{count}}",tasksSummary:"{{summary}} tasks",tasksSummaryOne:"1 task",userId:"User ID",userIcon:"User icon",guestUser:"Guest",detailsTab:"Details",commentsTab:"Comments",fieldsTab:"Fields",historyTab:"History",subtasksTab:"Subtasks",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'From "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed to "{{newValue}}"',invalidRange:'"{{start}}" should be less than "{{end}}"',historyDate:"Date",ok:"ok",cancel:"Cancel",delete:"Delete",taskDeadlineChanged:"Deadline changed",tagsChanged:"Tags changed",taskMoved:"Task moved",taskUpdated:"Task updated",taskCreated:"Task created",taskUserChanged:"Assignee changed",taskUserRemoved:"Assignee removed",taskDescriptionChanged:"Description changed",taskSubtasksChanged:"Subtasks changed",taskProgressChanged:"Progress changed",taskPriorityChanged:"Priority changed",taskSubtasksCompleted:"Completed {{value}}",taskStatusChanged:"Status changed",taskTagsChanged:"Tags changed",taskNameChanged:"Name changed",taskColorChanged:"Color changed",empty:"No tasks",emptyTags:"No tags available",emptyImage:"No image to display",emptyAttachment:"No attachment to display"}}},onColumnHeaderRender:{value:null,type:"any",reflectToAttribute:!1},onColumnFooterRender:{value:null,type:"any",reflectToAttribute:!1},onTaskRender:{value:null,type:"any",reflectToAttribute:!1},onSortPrepare:{value:null,type:"any",reflectToAttribute:!1},onFilterPrepare:{value:null,type:"any",reflectToAttribute:!1},priority:{value:[],type:"array",reflectToAttribute:!1},priorityList:{value:!0,type:"boolean"},readonly:{value:!1,type:"boolean"},selectionMode:{value:"zeroOrOne",allowedValues:["zeroOrOne","zeroOrManyExtended"],type:"string"},storeHistory:{value:!0,type:"boolean"},storeHistoryItems:{value:20,type:"number"},swimlanes:{value:[],type:"array",reflectToAttribute:!1},swimlanesFrom:{value:0,type:"number"},swimlanesTo:{value:null,type:"number?"},tags:{value:[],type:"array"},taskActions:{value:!1,type:"boolean"},taskActionsRendered:{value:null,type:"any"},taskComments:{value:!1,type:"boolean"},taskDue:{value:!1,type:"boolean"},taskPosition:{value:"all",allowedValues:["all","leaf"],type:"string"},taskPriority:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskProgress:{value:!1,type:"boolean"},taskTags:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskSubTasks:{allowedValues:["none","onePerRow","onlyUnfinished"],value:"none",type:"string"},taskSubTasksInput:{value:!0,type:"boolean"},taskUserIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskCustomFields:{value:[],type:"array",reflectToAttribute:!1},taskCustomFieldsHide:{value:!1,type:"boolean"},taskColor:{value:!0,type:"boolean"},taskColorEntireSurface:{value:!1,type:"boolean"},textTemplate:{value:null,type:"any"},userList:{value:!1,type:"boolean"},users:{value:[],type:"array",reflectToAttribute:!1},dialogCustomizationFunction:{value:null,type:"any"},dialogRendered:{value:null,type:"any"},dialogEditors:{value:["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"],type:"any"}}}static get listeners(){return{"body.focusin":"_bodyFocusinHandler",keyup:"_keyupHandler","container.click":"_containerClickHandler","container.down":"_containerDownHandler","container.keydown":"_containerKeydownHandler","container.touchmove":"_scrollViewerTouchmoveHandler"}}template(){const e=this._tabindex;return`<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize tasks"><div role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev"${e} role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next"${e} role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close"${e} role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n <smart-scroll-viewer auto-refresh vertical-scroll-bar-visibility="hidden" class="smart-kanban-scroll-viewer" id="scrollViewer">\n <div id="body" class="smart-kanban-body" role="presentation"></div>\n </smart-scroll-viewer>\n </div>`}_keyupHandler(e){const t=this;if("Escape"===e.key&&t._dragDetails){const e=t._dragDetails,a=Smart.Kanban.hoveredKanban,s=Smart.Kanban.hoveredItem;delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,e.ScrollViewer&&e.ScrollViewer._scrollView&&(e.ScrollViewer._scrollView.disableSwipeScroll=!1);let l=!1;if(document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.classList.remove("smart-kanban-task-placeholder"),e.style.marginTop=e.style.marginBottom="0px",l=!0})),l&&t._refreshButtonsAndSummaries(),!e.FeedbackShown)return;a&&clearInterval(a._dragInterval),t._preventSelection=!0;const i=t.isInShadowDOM?t.getRootNode().host:document.body;return i.classList.remove("smart-dragging"),i.style.overflow=t._originalBodyOverflow.overflow,i.style.eoverflowX=t._originalBodyOverflow.overflowX,i.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,e.Feedback.remove(),e.Items.forEach((e=>e.classList.remove("dragged"))),s.classList.remove("drop-target"),void(s.classList.contains("before")?s.classList.remove("before"):s.classList.contains("after")&&s.classList.remove("after"))}}render(){const e=this;Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getCurrentDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.isInitialized=!1,e._render(),super.render(),e.isInitialized=!0}_getPriority(){const e=this;if(!e.priority||e.priority&&0===e.priority.length)e.priority=[{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',label:"",value:""},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>',label:e.localize("low"),value:"low"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>',label:e.localize("average"),value:"average"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>',label:e.localize("high"),value:"high"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>',label:e.localize("critical"),value:"critical"}];else if(e.priority){const t=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":case"Low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":case"Average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":case"High":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":case"Critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let a=0;a<e.priority.length;a++){const s=e.priority[a];s.menuIcon=t(s)}}for(let t=0;t<e.priority.length;t++){const a=e.priority[t];a.menuLabel=`<div priority="${a.value}" class="smart-kanban-task-text">${a.menuIcon}${a.label}</div>`}return e.priority}_getTags(){const e=this,t=[];if(e.tags){for(let a=0;a<e.tags.length;a++){const s=e.tags[a];if("[]"!==s)if(s&&"string"==typeof s)t.push({label:s.trim(),value:s.trim()});else{const e={};if(s.label){if("[]"===s.label)continue;e.label=s.label}s.value?e.value=s.value:e.value=s.label,s.color&&(e.color=s.color),t.push(e)}}e.tags=t}}_render(){const e=this,t=getComputedStyle(e);if(e.columnColorEntireSurface?e.classList.add("smart-kanban-column-color"):e.classList.remove("smart-kanban-column-color"),e.$.body.innerHTML="",e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._kanbanTaskMinWidth=parseFloat(t.getPropertyValue("--smart-kanban-task-min-width")),e._dataViewPadding=parseFloat(t.getPropertyValue("--smart-data-view-padding")),e.uiTasksByDataField=[],e.tasksByDataField=[],e.taskById=[],e._allColumns=[],e._customTags=[],e._selectedTasks=[],e._dblclickObject={numberOfClicks:0},e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._sortPanelDataSource=[{label:e.localize("text"),dataField:"text",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("priority"),dataField:"priority",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowFilter:!0,allowSort:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowFilter:!0,allowSort:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowFilter:!0,allowSort:!0}],e.taskCustomFields){const t=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let a=0;a<e.taskCustomFields.length;a++){const s=e.taskCustomFields[a].label;if(t){const l=typeof t[e.taskCustomFields[a].dataField];"number"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"number"}):"date"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"date"}):e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}else e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}}const a={checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"};for(let t in a)e.dataSourceMap[t]||(e.dataSourceMap[t]=a[t]);e._getPriority(),e._getTags(),e._validateDataSourceMap(),e._getInnerElementMessages(),e._localizeHeader(),e._handleHeaderPosition(e.$.scrollViewer),e._validateSwimlanes(),e._renderColumns(),e._handleSwimlanes();let s=!1;e.autoLoadState&&(s=e.loadState()),e._getCurrentUser(),s||e._processDataSource(),e._setPriorityList(),e._setUserList(),e._setActionsList(),e._setColumnActionsList(),e._setCommentsList(),e._autoSaveState(),e._createAddNewButton(),e.$.scrollViewer.refresh()}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog))}detached(){const e=this;if(super.detached(),!e._dialog)return;const t=e._dialog;t.removeEventListener("open",e._dialogEventHandler),t.removeEventListener("closing",e._dialogEventHandler),t.removeEventListener("close",e._dialogEventHandler),t.removeEventListener("click",e._dialogClickHandler),t.remove()}addTask(e={},t){const a=this,s=a.columns;if("object"!=typeof e||0===s.length||!a._currentUser.allowAdd)return;const l=a.dataSourceMap;void 0===e[l.status]&&(e[l.status]=s[0].dataField),a._currentUser.info&&(void 0===e[l.createdUserId]?(e[l.createdUserId]=a._currentUser.info.id,e[l.createdDate]=new Date):e[l.createdDate]||(e[l.createdDate]=new Date));const i={value:e,id:e.id};a.$.fireEvent("taskBeforeAdd",i);let r=null;return a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("add",e,(function(e){return e})):(a.dataSource||(a.dataSource=[]),t>=0?a.dataSource.splice(t,0,e):a.dataSource.push(e),r=a._createTask(e,!0,t),a._autoSaveState("dataSource")),a.$.fireEvent("taskAdd",i),a._refreshButtonsAndSummaries(),a.virtualization&&(a._refreshColumns(),a._refreshButtonsAndSummaries()),r}addSort(e,t){const a=this,s=a.dataSource;let l;function i(e,s){const i=a._sortPanelDataSource.find((t=>t.dataField===e));if(i){let a=Array.isArray(t)?t[s]:"string"==typeof t?t:"ascending";l.dataFields.push(e),l.dataTypes.push(i.dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",l.orderBy.push(a)}}if(0!==arguments.length&&s&&0!==s.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)l=e;else if(l={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(i);else{if("string"!=typeof e)return;i(e,0)}super.addSort(l)}}beginEdit(e){const t=this;t.disabled||(e=t._validateTaskArgument(e))&&(t.editable||t.readonly)&&t._openDialog(e,"edit")}cancelEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&e.close()}hide(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!1!==e.visible&&(e.visible=!1,t.$.fireEvent("columnHide",{column:e}),t.refresh())}show(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!0!==e.visible&&(e.visible=!0,t.$.fireEvent("columnShow",{column:e}),t.refresh())}showAllColumns(){const e=this;for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0;e.refresh()}collapse(e){const t=this;if(!t.collapsible)return;if(!(e=t._validateColumnArgument(e))||e.collapsed||!e.collapsible)return;const a=t._columnToElement.get(e),s=a.siblingColumns;let l=0;e.collapsed=!0,a.classList.add("collapsed");const i=e.collapsed?t.localize("expand"):t.localize("collapse"),r=a.querySelector(".smart-kanban-column-header-toggle-button");if(r&&r.setAttribute("title",i),s.forEach((e=>e.collapsed&&l++)),l===s.length){const a=0!==s.indexOf(e)?0:1,l=s[a],i=t._columnToElement.get(l);l&&(l.collapsed=!1),i&&(i.classList.remove("collapsed"),t._updateColumnWidths(s,i.parentElement))}else t._updateColumnWidths(s,a.parentElement);t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t._doNotFireEvents||t.$.fireEvent("columnCollapse",{column:e})}copyTask(e){const t=this;if(!t._currentUser.allowAdd)return;if(!(e=t._validateTaskArgument(e)))return;const a=JSON.parse(JSON.stringify(e.data));a.history=[],t.dataSource&&t.dataSource.virtualDataSource?t._requestVirtualDataSource("add",a,(function(e){return t.$.fireEvent("taskAdd",{value:a}),e})):(a[t.dataSourceMap.id]=Math.floor(9e4*Math.random()+1e4),t._createTask(a,!0),t._autoSaveState("dataSource"),t.$.fireEvent("taskAdd",{value:a})),t.dataSource||(t.dataSource=[]),t.dataSource.push(a),t._refreshButtonsAndSummaries()}endEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&(e.ok=!0,e.close())}ensureVisible(e){const t=this;if(e&&"number"==typeof e){const a=t.getTask(e);if(!a)return;const s=a[t.dataSourceMap.status],l=t.querySelector('.smart-kanban-column[data-field="'+s+'"]');if(l){const e=l.querySelector("smart-scroll-viewer");e&&(a.top<e.scrollTop||a.top>e.scrollTop+e.offsetHeight?e.scrollTop=a.top:t._refreshScrollHeight(e,s))}return}if(!(e=t._validateTaskArgument(e))||e.filteredOut)return;const a=e.closest("smart-scroll-viewer");if(0===a.scrollHeight)return e;const s=a.scrollTop,l=e.offsetTop;return s<=l&&s+a.offsetHeight>=l+e.offsetHeight||(a.scrollTop=l),e}expand(e){const t=this;if(!(e=t._validateColumnArgument(e))||!e.collapsed)return;const a=t._columnToElement.get(e);e.collapsed=!1,a.classList.remove("collapsed");const s=e.collapsed?t.localize("expand"):t.localize("collapse"),l=a.querySelector(".smart-kanban-column-header-toggle-button");l&&l.setAttribute("title",s),t._updateColumnWidths(a.siblingColumns,a.parentElement),t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t.$.fireEvent("columnExpand",{column:e})}expandAll(){const e=this;e._allColumns.forEach((t=>{t.collapsed=!1,e._columnToElement.get(t).classList.remove("collapsed")})),e._allColumns.forEach((t=>e._refreshScrollViewer(t))),e._columnContainers.forEach((t=>e._updateColumnWidths(t.children,t))),e._autoSaveState("collapsed"),e._handleSwimlanes(!0)}exportData(e,t,a){const s=this,l=getComputedStyle(s),i=l.borderRightColor,r=s.swimlanes,o=new Smart.Utilities.DataExporter,n=s._getCurrentDataSource(),d=s.dataSourceMap,c=[{id:"Task ID",text:"Text",status:"Status",swimlane:"Swimlane",asignee:"Asignee",priority:"Priority",progress:"Progress",startDate:"Start date",dueDate:"Due date",subTasks:"Completed sub-tasks",tags:"Tags"}],u={},m={},p={};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)c[0][s.taskCustomFields[e].dataField]=s.taskCustomFields[e].label;o.style={border:"1px solid "+i,borderCollapse:"collapse",backgroundColor:l.backgroundColor,color:l.color,fontFamily:"Helvetica",header:{border:"1px solid "+i,fontWeight:"bold"},columns:{border:"1px solid "+i,progress:{format:"p0"},startDate:{format:s.formatStringDate},dueDate:{format:s.formatStringDate}},rows:{}},0===r.length&&delete c[0].swimlane;for(let e=0;e<n.length;e++){const t=n[e];let a=t[d.status],l=t[d.swimlane],i=t[d.userId],h=t[d.progress];u[a]?a=u[a]:(a=s._allColumns.find((e=>e.dataField===a)).label,u[t[d.status]]=a),null===i?i="":p[i]?i=p[i]:(i=s.users.find((e=>e.id===i)).name,p[t[d.userId]]=i),null===h?h="":h/=100;let g=t[d.tags];g&&"string"!=typeof g&&(g=g.map((e=>"string"==typeof e?e:e.label)));const f={id:t[d.id],text:t[d.text],description:t[d.description]||"",status:a,asignee:i,priority:t[d.priority]||"",progress:h,startDate:t[d.startDate]||"",dueDate:t[d.dueDate]||"",subTasks:s._getCompletedSubTasks(t[d.checklist]),tags:g};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)f[s.taskCustomFields[e].dataField]=`"${t[s.taskCustomFields[e].dataField]}"`.replaceAll(","," ");r.length&&(l?m[l]?l=m[l]:(l=r.find((e=>e.dataField===l)).label,m[t[d.swimlane]]=l):l="",f.swimlane=l),c.push(f),t[d.color]&&(o.style.rows[e]={backgroundColor:t[d.color]})}return o.exportData(c,e,t,a)}getState(e){const t=this,a={},s={collapsed:a,dataSource:t._getCurrentDataSource(),filtering:t._appliedFiltering,selection:{selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart:null},sorting:t._appliedSorting,tabs:t._selectedTabs,visibility:{taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}};let l=null,i=null;t._selectionInView&&(l=t._selectionInView.closest(".smart-kanban-column").column.dataField,i=t._selectionInView.getAttribute("swimlane")),s.selection.selectionInColumn=l,s.selection.swimlane=i;const r={};for(let e in t.tasksByDataField){r[e]=[];const a=t.tasksByDataField[e];for(let t=0;t<a.length;t++)r[e].push(a[t].id)}if(s.order=r,s.columnOrder=[],t._allColumns.forEach((e=>a[e.dataField]=e.collapsed)),t.columns.forEach((e=>s.columnOrder.push(e.dataField))),e){const t={};for(let a in e){const l=e[a];s[l]&&(t[l]=s[l])}return t}return s}loadState(e,t){const a=this;if(!e&&!(e=window.localStorage.getItem("smartKanban"+a.id)))return!1;let s=!0;"string"==typeof e&&(e=JSON.parse(e,((e,t)=>t&&-1!==["startDate","dueDate","time"].indexOf(e)?new Date(t):t))),e.dataSource||(t=!1),a._doNotFireEvents=!0,a._selectedTasks=[],delete a._selectionStart,delete a._selectionInView,a.expandAll(),!1!==t&&Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e&&e.clearContent&&e.isReady&&e.clearContent()}));let l=!1;a._allColumns.forEach((t=>{e.collapsed&&e.collapsed[t.dataField]&&(a.collapse(t),l=!0)}));for(let t in e.visibility)a[t]=e.visibility[t];if(!1!==t&&(a.dataSource=e.dataSource,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource()),e.filtering&&a.addFilter(a._constructFilterGroups(e.filtering),e.filtering.operator),e.sorting&&a.addSort(e.sorting),!1!==t&&a._autoSaveState(e),e.selection&&(e.selection.selected.forEach((e=>{const t=a.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`);t&&(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id))})),e.selection.selectionStart&&(a._selectionStart=a.$.container.querySelector(`.smart-kanban-task[data-id="${e.selection.selectionStart}"]`)),e.selection.selectionInColumn)){const t=a._columnToElement.get(a._allColumns.find((t=>t.dataField===e.selection.selectionInColumn)));e.selection.swimlane?a._selectionInView=t.querySelector(`smart-scroll-viewer[swimlane=${e.selection.swimlane}]`):a._selectionInView=t.querySelector("smart-scroll-viewer")}if(e.tabs){const t="tabs"===a.hierarchy;a._allColumns.forEach((s=>{if(void 0!==s.selected){const l=a._columnToElement.get(s),i=-1!==e.tabs.indexOf(s.dataField);s.selected=i,t&&(l.classList.toggle("smart-hidden",!i),l.tab.classList.toggle("selected",i),l.tab.setAttribute("aria-selected",i))}}))}const i=[],r={};if(e.columnOrder){a._allColumns.forEach((e=>{r[e.dataField]=e}));for(let t=0;t<e.columnOrder.length;t++){const a=e.columnOrder[t],s=r[a];s&&i.push(s)}i&&i.length===a.columns.length&&JSON.stringify(i.map((e=>e.value)))!==JSON.stringify(a.columns.map((e=>e.value)))&&(a.columns=i,a.refresh(),s=!1)}if(e.order){let t=!1,l=[];for(let s in e.order){const l=e.order[s];let i=a._getTasksByDataField(s);if(0!==i.length)for(let e=0;e<l.length;e++){const s=l[e],r=a.taskById[s];if(r){const s=i.indexOf(r);s!==e&&s>=0?(i.splice(e,0,i.splice(s,1)[0]),t=!0):-1===s&&a._getTasksByDataField(r[a.dataSourceMap.status]).indexOf(r)}}}if(t){const e=Object.keys(a.tasksByDataField);for(let t in e)l=l.concat(a.tasksByDataField[e[t]]);Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),a.dataSource=l,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource(),s=!1}}return a._doNotFireEvents=!1,s}moveTask(e,t){const a=this;if(a.disabled||""!==t&&!t)return;const s=a.dataSourceMap;if(!(e=a._validateTaskArgument(e))||!a._updateTaskInProgress&&e.data[s.status]===t)return;const l=a._allColumns.find((e=>e.dataField===t));function i(){const i=e.closest("smart-scroll-viewer"),r=a._columnToElement.get(l),o=e.data,n=a.getTaskScrollViewer(r,o);if(a.virtualization){const l=o,r=e.column.dataField,d=a._getTasksByDataField(r),c=d.findIndex((e=>e.id===l.id));return c>=0&&(d.splice(c,1),a._getTasksByDataField(t).push(l)),o[s.status]=t,a._refreshScrollViewer(i,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),void((a.shadowRoot||a.getRootNode()).activeElement===i&&a._focusTask(a._getFirstItem(i.$.content)))}o[s.status]=t,n.appendChild(e),a._dialog&&a._dialog.ok||(a.textTemplate&&a._renderTask(e),a._autoSaveState("dataSource")),a._refreshScrollViewer(i,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),(a.shadowRoot||a.getRootNode()).activeElement===i&&a._focusTask(a._getFirstItem(i.$.content))}l&&(a.dataSource&&a.dataSource.virtualDataSource&&!a._ignoreVirtualDataSource?a._requestVirtualDataSource("update",Object.assign({},e.data,{status:t}),(function(e){return e&&i(),e})):i())}_getCustomizeColumnPanelDataSource(){const e=this;return e._customizeColumns=[{label:e.localize("actionsIcon"),dataField:"taskActions",allowHide:!0,disableDrag:!0,visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",allowHide:!0,disableDrag:!0,visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",allowHide:!0,disableDrag:!0,visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",allowHide:!0,disableDrag:!0,visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",allowHide:!0,disableDrag:!0,visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",allowHide:!0,disableDrag:!0,visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",allowHide:!0,disableDrag:!0,visible:e.taskUserIcon}],e._customizeColumns}openCustomizePanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;const a=e.$.customize,s=[{label:e.localize("actionsIcon"),dataField:"taskActions",visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",visible:e.taskUserIcon}];let l;e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel"),a.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated?(l=a.firstElementChild,l.set("dataSource",s),l.propertyChangedHandler("dataSource",void 0,s),l.rightToLeft=e.rightToLeft):(l=document.createElement("smart-column-panel"),l.animation=e.animation,l.dataSource=s,l.locale=e.locale,l.messages=e._innerElementMessages.columnPanel,l.rightToLeft=e.rightToLeft,l.theme=e.theme,e.$.customize.appendChild(l),l.classList.add("smart-kanban-column-panel"),e._customizePartCreated=!0),e._openHeaderDropDown(e.$.customizeButton)}_getFilterPanelDataSource(){const e=this,t=[{label:e.localize("text"),dataField:"text",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("priority"),dataField:"priority",dataType:"enum",allowSort:!0,allowFilter:!0,options:e._getPriority()},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowSort:!0,allowFilter:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowSort:!0,allowFilter:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowSort:!0,allowFilter:!0}];if(e.taskCustomFields){const a=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let s=0;s<e.taskCustomFields.length;s++){const l=e.taskCustomFields[s].label;if(a){const i=typeof a[e.taskCustomFields[s].dataField];"number"===i?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"number"}):"date"===i?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"date"}):t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}else t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}}return e.onFilterPrepare&&e.onFilterPrepare(t),t}openFilterPanel(){const e=this,t=e._getFilterPanelDataSource();super.openFilterPanel(t,(function(t,a){"progress"===a.dataField?(t.min=0,t.max=100,t.showUnit=!0,t.unit="%"):"date"===a.dataType&&(t.formatString=e.formatStringDate)}))}_getSortPanelDataSource(){const e=this;return e.onSortPrepare&&e.onSortPrepare(this._sortPanelDataSource),this._sortPanelDataSource}openSortPanel(){const e=this,t=e._getSortPanelDataSource().map((t=>{const a=e._appliedSorting.dataFields.indexOf(t.dataField);return Object.assign({},t,{sortIndex:a,sortDirection:-1===a?"ascending":e._appliedSorting.orderBy[a]})}));super.openSortPanel(t)}removeTask(e,t){const a=this;function s(){const t=e.closest("smart-scroll-viewer"),s=e.data;if(a.virtualization||(e.remove(),a._refreshScrollViewer(t,!0)),a._autoSaveState("dataSource"),a.$.fireEvent("taskRemove",{value:s,id:e.data.id}),a.dataSource){const e=a.dataSource.findIndex?a.dataSource.findIndex((e=>e.id===s.id)):-1;if(e>-1){const t=s[a.dataSourceMap.status],l=a.tasksByDataField[t].findIndex((e=>e.id===s.id));l>=0&&a.tasksByDataField[t].splice(l,1),a.dataSource.splice(e,1)}}if(a._selectedTasks&&a._selectedTasks.indexOf(s.id)>=0){const e=a._selectedTasks.indexOf(s.id);a._selectedTasks.splice(e,1)}a._refreshSummaries(),a._refreshColumns()}a._currentUser.allowRemove&&(e=a._validateTaskArgument(e))&&(t?a._openDialog(e,"prompt"):a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("remove",e.data,(function(e){return e&&s(),e})):s())}saveState(e){const t=this.getState(e);return window.localStorage.setItem("smartKanban"+this.id,JSON.stringify(t)),t}addHistory(e,t){const a=this;if(!e||!t)return;const s=a.dataSourceMap;a.storeHistory?(void 0!==e[s.history]&&null!==e[s.history]||(e[s.history]=[]),e[s.history].length===a.storeHistoryItems&&e[s.history].splice(0,1),Array.isArray(e[s.history])||(e[s.history]=[]),e[s.history].push(t)):e[s.history]=[]}clearHistory(e){e&&(e.history=[])}updateTask(e,t){const a=this;if(!a._currentUser.allowEdit||!t)return;if(!(e=a._validateTaskArgument(e)))return;const s=a.dataSourceMap,l=e.data;function i(){if(e.data=t,t[s.status]!==l[s.status]&&(a._updateTaskInProgress=!0,a.moveTask(e,t[s.status]),delete a._updateTaskInProgress),t[s.swimlane]!==l[s.swimlane]){const i=e.closest(".smart-kanban-column");a._hasSwimlane(i.index)?(i.querySelector(`smart-scroll-viewer[swimlane=${t[s.swimlane]}]`).appendChild(e),l[s.swimlane]&&a._refreshScrollViewer(i.querySelector(`smart-scroll-viewer[swimlane=${l[s.swimlane]}]`))):delete t[s.swimlane]}const i=()=>{if(!a._currentUser||a._currentUser&&!a._currentUser.info)return;const e=()=>({user:a._currentUser.info.id,date:t[s.updatedDate]});if(t[s.userId]!==l[s.userId]){const i=e();i.action="user";let r=!0;l[s.userId]||t[s.userId]||(r=!1),r&&(i.details={oldValue:l[s.userId],value:t[s.userId]},a.addHistory(t,i))}if(""+t[s.dueDate]!=""+l[s.dueDate]){const i=e();i.action="deadline",i.details={oldValue:l[s.dueDate]?l[s.dueDate].toLocaleDateString():"",value:t[s.dueDate]?t[s.dueDate].toLocaleDateString():""},a.addHistory(t,i)}if(""+t[s.startDate]!=""+l[s.startDate]){const i=e();i.action="deadline",i.details={oldValue:l[s.startDate]?l[s.startDate].toLocaleDateString():"",value:t[s.startDate]?t[s.startDate].toLocaleDateString():""},a.addHistory(t,i)}if(t[s.color]!==l[s.color]){const i=e();i.action="color",i.details={oldValue:l[s.color],value:t[s.color]},a.addHistory(t,i)}if(t[s.status]!==l[s.status]){const i=e();i.action="status",i.details={oldValue:l[s.status],value:t[s.status]},a.addHistory(t,i)}if(JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])){const i=e();i.action="subtasks",i.details={oldValue:l[s.checklist],value:t[s.checklist]},a.addHistory(t,i)}if(parseFloat(t[s.progress])!==parseFloat(l[s.progress])){let i=!0;if(null===l[s.progress]&&0===parseFloat(t[s.progress])&&(i=!1),i){const i=e();i.action="progress";const r=l[s.progress]?l[s.progress]+"%":"0%",o=t[s.progress]?t[s.progress]+"%":"0%";r!==o&&(i.details={oldValue:r,value:o},a.addHistory(t,i))}}if(t[s.description]!==l[s.description]){const i=e();i.action="description",i.details={oldValue:l[s.description],value:t[s.description]},a.addHistory(t,i)}if(t[s.priority]!==l[s.priority]){const i=e();i.action="priority",i.details={oldValue:l[s.priority],value:t[s.priority]},a.addHistory(t,i)}if(t[s.tags]!==l[s.tags]){const i=e();i.action="tags",i.details={oldValue:l[s.tags],value:t[s.tags]},a.addHistory(t,i)}if(t[s.text]!==l[s.text]){const i=e();i.action="text",i.details={oldValue:l[s.text],value:t[s.text]},a.addHistory(t,i)}for(let s=0;s<a.taskCustomFields.length;s++){const i=a.taskCustomFields[s];let r=l[i.dataField],o=t[i.dataField];if(r!==o&&""+r!=""+o){const s=e();if(s.action=i.name?i.name:i.dataField,i.dataSource){const e=e=>{const t=i.dataSource.find((t=>t.value===e||t===e?t:void 0));return void 0!==t?t.label:""},t=t=>{if(void 0===t||t.length){if(void 0!==t&&t.length&&"string"!=typeof t){let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}if(t&&t.indexOf(",")>0){t=t.split(",");let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}return t}return e(t)};o=t(o),r=t(r)}s.details={oldValue:r,value:o},a.addHistory(t,s)}}};a.textTemplate||t[s.text]!==l[s.text]||t[s.tags]!==l[s.tags]||t[s.priority]!==l[s.priority]||t[s.description]!==l[s.description]?(a._renderTask(e),i()):(i(),t[s.userId]!==l[s.userId]&&a._updateUserIcon(e),t[s.dueDate]!==l[s.dueDate]&&a._updateTaskDueDate(e),t[s.color]!==l[s.color]&&a._updateTaskColor(e),JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])?(a._updateTaskChecked(e),a._updateTaskProgress(e)):parseFloat(t[s.progress])!==parseFloat(l[s.progress])&&a._updateTaskProgress(e),a._updateTaskSubtasks(e),a._updateTaskCustomFields(e));const r=a.getColumn(t.status);r&&(t.statusLabel=r.label);const o=a.getColumn(l.status);o&&(l.statusLabel=o.label);const n=JSON.parse(JSON.stringify(t)),d=JSON.parse(JSON.stringify(l));if(n.history=t.history,d.history=l.history,a.$.fireEvent("change",{task:e,id:n.id,value:n,oldValue:d}),a.virtualization){const t=e.data[s.status],l=a.tasksByDataField[t].findIndex((t=>t.id===e.data.id));if(l>=0){a.tasksByDataField[t][l]=e.data;const s=a._getTasksByDataField(t),i=s.findIndex((t=>t.id===e.data.id));i>=0&&(s[i]=e.data)}}if(a._refreshScrollViewer(e.closest("smart-scroll-viewer")),a.dataSource&&a.dataSource.findIndex){const t=a.dataSource.findIndex((t=>e.data.id===t.id));t>=0&&(a.dataSource[t]=e.data)}a._refreshSummaries(),a._updateTaskComments(e),a._autoSaveState("dataSource"),a.$.fireEvent("taskUpdate",{id:n.id,value:n,oldValue:d})}(t=Object.assign({},l,t))[s.checklist]&&0===t[s.checklist].length&&(t[s.checklist]=null),JSON.stringify(t)!==JSON.stringify(l)&&(a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("update",t,(function(e){return e&&(a._ignoreVirtualDataSource=!0,i(),delete a._ignoreVirtualDataSource),e})):i())}_refreshSelection(){const e=this;if("zeroOrOne"===e.selectionMode){const t=e._selectionStart;e._selectedTasks.forEach((a=>{if(a!==t){e.getTask(a).selected=!1;const t=e.querySelector('[data-id="'+a+'"]');t&&t.removeAttribute("selected")}})),e._selectedTasks=[t]}e._selectedTasks.forEach((t=>{const a=e.querySelector('[data-id="'+t+'"]');a&&a.setAttribute("selected","")})),e._refreshColumns()}propertyChangedHandler(e,t,a){const s=this,l=s._dialog;function i(){if(s.cancelEdit(),l&&l.close(),s._closeList(s._commentsList,"_commentSelectionFor"),s._getCurrentUser(),s.taskSubTasks){const e=s.querySelectorAll(".smart-kanban-task-input");s._currentUser&&!s._currentUser.allowEdit||s.disabled||!s.taskSubTasksInput?e.forEach((e=>{e.classList.add("smart-hidden")})):e.forEach((e=>{e.classList.remove("smart-hidden")}))}}switch(super.propertyChangedHandler(e,t,a),e){case"columnColorEntireSurface":a?s.classList.add("smart-kanban-column-color"):s.classList.remove("smart-kanban-column-color");break;case"columnFooter":case"addNewButton":case"addNewButtonDisplayMode":s._reset(),s._createAddNewButton();break;case"taskTags":case"autoColumnHeight":case"applyColumnColorToTasks":case"columnWidth":case"addNewColumn":s._reset();break;case"taskCustomFields":s._resetFields=!0,s._reset();break;case"allowDrag":s._getCurrentUser();break;case"animation":case"theme":{let t=Array.from(s.$.container.querySelectorAll("smart-column-panel, smart-multi-column-filter-panel, smart-sort-panel"));l&&(t.push(l),t=t.concat(Array.from(l.$.footer.children)),l.editPanelPopulated&&(t=t.concat(Array.from(l.$.container.querySelectorAll(".smart-element.editor"))))),t.forEach((t=>t[e]=a)),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskColor(e)));break}case"autoSaveState":s._autoSaveState();break;case"collapsible":a||s.expandAll();break;case"columnSummary":s._refreshSummaries();break;case"columns":s._render(),l&&l.editPanelPopulated&&(l.editors.status.dataSource=s._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))));break;case"currentUser":i();break;case"dataSource":case"dataSourceMap":if("dataSourceMap"===e&&s._validateDataSourceMap(),s._customTags=[],s._selectedTasks=[],s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),0===s.columns.length)return s._renderColumns(),s._handleSwimlanes(),void s._processDataSource();Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e.clearContent(),e.refresh(),s._refreshScrollViewer(e,!0)})),s._processDataSource(),s.dataSource||s._refresh(),s.columnSummary&&s._refreshSummaries();break;case"disabled":s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),s._setFocusable();break;case"formatStringDate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskDueDate(e))),l&&(l.editors.startDate.formatString=a,l.editors.dueDate.formatString=a);break;case"formatStringTime":s._closeList(s._commentsList,"_commentSelectionFor");break;case"editable":s.cancelEdit(),s._actionsList.classList.contains("edit-comment")||s._closeList(s._actionsList,"_actionSelectionFor"),s._getCurrentUser();break;case"headerPosition":s._handleHeaderPosition(s.$.body),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"hierarchy":0===s.swimlanes.length&&s.columns.length!==s._allColumns.length&&s._reset();break;case"locale":case"messages":s.closePanel(),s._localizeHeader(),s._getInnerElementMessages(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._setActionsList(),s._setColumnActionsList(),s._setCommentsList(),l&&(s.cancelEdit(),l.close(),l.$.footer.firstElementChild.innerHTML=s.localize("ok"),l.$.footer.children[1].innerHTML=s.localize("cancel"),l.$.footer.children[2].innerHTML=s.localize("delete"),l.editPanelPopulated&&(l.editors.priority.dataSource=s._getPriority(),l.$.container.querySelector(".new-subtask").placeholder=s.localize("newSubtask"),l.$.container.querySelector("smart-button.add").title=s.localize("addSubtask"),Array.from(l.$.container.getElementsByClassName("editor-label")).forEach((e=>{let t=e.id.slice(s.id.length+5);t=t.slice(0,1).toLowerCase()+t.slice(1),e.innerHTML=s.localize(t)})))),s._customizePartCreated&&(s.$.customize.firstElementChild.messages=s._innerElementMessages.columnPanel,s.$.customize.firstElementChild.locale=s.locale),s._filterPartCreated&&(s.$.filter.firstElementChild.messages=s._innerElementMessages.multiColumnFilterPanel,s.$.filter.firstElementChild.locale=s.locale,s.$.filter.firstElementChild.editorPlaceholder=s.localize("filterValuePlaceholder")),s._sortPartCreated&&(s.$.sort.firstElementChild.messages=s._innerElementMessages.sortPanel,s.$.sort.firstElementChild.locale=s.locale);break;case"rightToLeft":s._reset(!0);break;case"selectionMode":"zeroOrOne"===a&&s._selectedTasks.length>1&&s._refreshSelection();break;case"swimlanes":if(s._validateSwimlanes(),JSON.stringify(s.swimlanes)===JSON.stringify(t))return;s._reset(),l&&l.editPanelPopulated&&(l.editors.swimlane.dataSource=s.swimlanes.map((e=>({label:e.label,value:e.dataField}))));break;case"swimlanesFrom":case"swimlanesTo":{const e=s.swimlanesFrom,t=s.swimlanesTo;e<0&&(s.swimlanesFrom=0),null!==t&&e>t&&(s.swimlanesFrom=t),s.swimlanes.length>0&&s._reset();break}case"taskCustomFieldsHide":case"taskProgress":case"taskSubTasksInput":case"taskSubTasks":case"taskUserIcon":case"taskComments":case"taskDue":case"taskPriority":case"tags":case"taskColor":case"taskColorEntireSurface":case"textTemplate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._renderTask(e))),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"unfocusable":s._setFocusable();break;case"priority":s._closeList(s._priorityList,"_prioritySelectionFor"),s._setPriorityList();break;case"users":s._closeList(s._userList,"_userSelectionFor"),s._setUserList(),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateUserIcon(e))),l&&l.editPanelPopulated&&(l.editors.userId.dataSource=s.users.map((e=>({label:e.name,value:e.id})))),i()}}_reset(e){const t=this,a=t.getState();t._allColumns=[],t._customTags=[],t._selectedTasks=[],t._dialog&&(t.cancelEdit(),e&&(t._dialog.remove(),delete t._dialog)),t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t.$.body.innerHTML="",Array.from(t.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),t._renderColumns(),t._handleSwimlanes(),t._createAddNewButton(),t.loadState(a),t.$.scrollViewer.refresh()}_refresh(){const e=this;e._allColumns=[],e._customTags=[],e._selectedTasks=[],e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e.$.body.innerHTML="",Array.from(e.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),e._renderColumns(),e._handleSwimlanes(),e._createAddNewButton(),e.$.scrollViewer.refresh()}_closeAllLists(){const e=this;e.cancelEdit(),e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e._closeList(e._priorityList,"_prioritySelectionFor")}_inlineTaskAdd(e,t){const a=this;if(a._inlineEditDetails&&a._inlineEditDetails.popup.parentNode){const e=a._addToBottom;a._inlineEditDetails.addTask(),a._addToBottom=e}const s=document.createElement("div"),l={},i=a.dataSourceMap;l[i.status]=e.dataField,a._currentUser.info&&(void 0===l[i.createdUserId]?(l[i.createdUserId]=a._currentUser.info.id,l[i.createdDate]=new Date):l[i.createdDate]||(l[i.createdDate]=new Date));const r=document.createElement("div");r.style.position="relative",r.classList.add("smart-kanban-task"),s.appendChild(r);const o=t.parentElement.querySelector(".smart-kanban-column-content-tasks");if(a._addToBottom)o.appendChild(s);else{const e=o.querySelector(".smart-kanban-task");e?e.parentElement.insertBefore(s,e):o.appendChild(s)}a._refreshButtonsAndSummaries();const n=document.createElement("textarea");n.placeholder=a.localize("textPlaceholder"),n.style.position="absolute",n.style.backgroundColor="transparent",n.style.borderLeftWidth=n.style.borderTopWidth=n.style.borderRightWidth=n.style.borderBottomWidth="0px",n.style.outline="0px",n.style.left="0px",n.style.bottom="0px",n.style.width="100%",n.style.height="100%",n.style.resize="none",r.style.height="70px",r.style.marginBottom="10px";const d=()=>{a._addToBottom?o.scrollTop=o.scrollHeight:o.scrollTop=0};r.appendChild(n),d();const c=()=>{const e=a._inlineEditDetails.input,t=a._inlineEditDetails.popup;e.onchange=e.onblur=null,t.remove(),l[a.dataSourceMap.text]=e.value,a.addTask(l,a._addToBottom?-1:0)&&d(),delete a._addToBottom};n.onchange=n.onblur=e=>{c(),e.preventDefault()},n.onkeydown=e=>{"Enter"===e.key?(c(),e.preventDefault()):"Escape"===e.key&&(n.onchange=n.onblur=null,s.remove(),a._refreshButtonsAndSummaries(),d(),e.preventDefault())," "===e.key&&e.stopPropagation()},a._inlineEditDetails={popup:s,input:n,addTask:c},setTimeout((()=>{n.focus()}),50)}_containerClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(t.$.header.contains(a))return void t._headerClickHandler(a,t.$.body);const s=a.closest(".smart-kanban-column-header");if(s){const l=s.parentElement.column;if(a instanceof HTMLInputElement)return;if(t.columnActions&&a.classList.contains("smart-kanban-column-actions")){if(!t._columnActionsList.parentElement||t._columnActionsList.classList.contains("smart-visibility-hidden")){if(t._columnActionsListDate&&new Date-t._columnActionsListDate<300)return;t._openColumnActionsList(a,l)}return}if(a.closest(".smart-kanban-column-header-add")&&l)return void(t.disableAddNewDialog?t._inlineTaskAdd(l,s,e):t._openDialog(l,"add","column"));if(t.collapsible&&l&&l.collapsible&&a.closest(".smart-kanban-column-header-toggle-button"))return void t[l.collapsed?"expand":"collapse"](l)}const l=a.closest(".smart-kanban-tab");if(l){if(l.classList.contains("selected"))return;const e=l.parentElement.querySelector(".selected");return e.classList.remove("selected"),e.setAttribute("aria-selected",!1),e.columnElement.classList.add("smart-hidden"),e.columnElement.column.selected=!1,l.classList.add("selected"),l.setAttribute("aria-selected",!0),l.columnElement.classList.remove("smart-hidden"),l.columnElement.column.selected=!0,t._selectedTabs=t._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),t._autoSaveState("tabs"),void t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}if(t.addNewColumn){const e=a.closest(".smart-kanban-add-new-column"),s=a.closest(".smart-color-input"),l=a.closest(".smart-kanban-column-header");if(!s&&e&&!e.querySelector(".pending")&&l)return void t._addNewColumnDynamically()}const i=a.closest(".smart-kanban-list .item");if(i){const e=i.getAttribute("data-id"),a=t._userSelectionFor,s=t._prioritySelectionFor;if(a){const s=t.dataSourceMap,l=a.data[s.userId],i=JSON.parse(JSON.stringify(a.data));if(parseInt(a.data[s.userId])===parseInt(e)?a.data[s.userId]=null:a.data[s.userId]=e,t._updateUserIcon(a),t._closeList(t._userList,"_userSelectionFor"),a.data[s.userId]!==l){t.dataSource&&t.dataSource.virtualDataSource&&t._requestVirtualDataSource("update",a.data,(function(e){return e||(a.data[s.userId]=l,t._updateUserIcon(a)),e}));const e=a.data;if(t._currentUser.info){a.data[s.updatedUserId]=t._currentUser.info.id,a.data[s.updatedDate]=new Date;const l={user:t._currentUser.info.id,label:e[s.text],date:e[s.updatedDate]};e[s.userId]!==i[s.userId]&&(l.action="user",l.details={oldValue:i[s.userId],value:e[s.userId]},t.addHistory(e,l))}const r=JSON.parse(JSON.stringify(e));t.$.fireEvent("change",{task:a,id:r.id,value:r,oldValue:i}),t.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:i}),t._autoSaveState("dataSource")}return}if(s){const e=t.dataSourceMap,a=s.data[e.priority],l=JSON.parse(JSON.stringify(s.data));if(s.data[e.priority]=i.getAttribute("priority"),t._closeList(t._priorityList,"_prioritySelectionFor"),s.data[e.priority]!==a){t._currentUser.info&&(s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date);const a=s.data,i=JSON.parse(JSON.stringify(a));if(t._currentUser.info){s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date;const i={user:t._currentUser.info.id,date:a[e.updatedDate]};a[e.priority]!==l[e.priority]&&(i.action="priority",i.details={oldValue:l[e.priority],value:a[e.priority]},t.addHistory(a,i))}t.$.fireEvent("change",{task:s,id:i.id,value:i,oldValue:l}),t.$.fireEvent("taskUpdate",{id:i.id,value:i,oldValue:l}),t._updateTaskPriority(s),t._autoSaveState("dataSource")}}const l=t._actionSelectionFor,r=t._columnActionSelectionFor;if(l){switch(parseFloat(e)){case 0:i.hasAttribute("edit")&&(t._actionsList.classList.contains("edit-comment")?(t._commentsList.textarea.value=l.comment.text,t._commentsList.textarea.focus(),t._commentsList.editing=l,l.parentElement.scrollTop=l.offsetTop):t.beginEdit(l));break;case 1:i.hasAttribute("copy")&&t.copyTask(l);break;case 2:i.hasAttribute("remove")&&(t._actionsList.classList.contains("edit-comment")?t._openDialog(l,"prompt","comment"):t.removeTask(l,!0))}return void t._closeList(t._actionsList,"_actionSelectionFor")}if(r){switch(parseFloat(e)){case 0:t._handleColumnEditing(r.dataField);break;case 1:{const e=t._columnToElement.get(r).querySelector(".smart-kanban-column-header-add");e?e.click():t._openDialog(r,"add","column");break}case 2:t.collapse(r);break;case 3:t._openDialog(r,"prompt","column");break;case 4:t.hide(r);break;case 5:t.showAllColumns()}return void t._closeList(t._columnActionsList,"columnActionSelectionFor")}}if(a.closest(".smart-kanban-list.comments")){const e=a.closest(".send");if(e){if(e.disabled)return;const a=JSON.parse(JSON.stringify(t._commentSelectionFor.data)),s=t._createComment();t._commentsList.textarea.value="",e.disabled=!0;const l=JSON.parse(JSON.stringify(t._commentSelectionFor.data));t.$.fireEvent("change",{task:t._commentSelectionFor,id:l.id,value:l,oldValue:a}),t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:a}),t.$.fireEvent("commentAdd",{id:l.id,value:s})}else if(a.classList.contains("remove-button")&&a.classList.contains("enabled")){const e=a.closest(".smart-comment");t._actionSelectionFor&&(t._actionSelectionFor===e||t._actionSelectionFor.classList.contains("smart-kanban-task")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,void 0,e)}return}const r=a.closest(".smart-kanban-task");if(r)if(a.classList.contains("smart-kanban-task-user"))!t.userList||!t._currentUser.allowEdit||t._userSelectionFor&&(t._userSelectionFor===r||t._userList.parentElement&&!t._userList.classList.contains("smart-visibility-hidden"))||t._openUserList(a,r);else if(a.classList.contains("priority")&&t.priorityList)!t._priorityList||!t._currentUser.allowEdit||t._prioritySelectionFor&&(t._prioritySelectionFor===r||t._priorityList.parentElement&&!t._priorityList.classList.contains("smart-visibility-hidden"))||t._openPriorityList(a,r);else if(t.taskActions&&a.classList.contains("smart-kanban-task-actions"))t._actionSelectionFor&&(t._actionSelectionFor===r||t._actionSelectionFor.classList.contains("comment")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,r);else if(t.taskComments&&a.classList.contains("smart-kanban-task-comments"))t.users.length>0&&(!t._commentSelectionFor||t._commentSelectionFor!==r&&(!t._commentsList.parentElement||t._commentsList.classList.contains("smart-visibility-hidden")))&&t._openCommentsList(a,r);else if((!t.taskSubTasksInput||!a.classList.contains("smart-kanban-task-input"))&&(!t.taskSubTasksInput||!a.classList.contains("smart-kanban-task-subtasks")||"singleClick"!==t.editMode)&&(!r||r.data)&&(t.$.fireEvent("taskClick",{id:r.data.id,value:r.data,element:r}),t._preventSelection||t._selectTask(e,r),"singleClick"!==t.editMode||t._dragDetails||"INPUT"===a.nodeName||"TEXTAREA"===a.nodeName||a.classList.contains("smart-kanban-task-subtasks-container")||"IMG"===a.nodeName||t.beginEdit(r),e.type))if(clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks){if(t._dblclickObject.numberOfClicks=0,r.hasAttribute("selected")||t._selectTask(e,r),t.$.fireEvent("taskDoubleClick",{id:r.data.id,value:r.data,element:r}).defaultPrevented)return;"doubleClick"===t.editMode&&t.beginEdit(r)}else t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300)}_selectTask(e,t){const a=this,s=a.selectionMode,l=()=>{a._selectedTasks.forEach((e=>{if(e!==t.data.id){const t=a.querySelector('[data-id="'+e+'"]');t&&t.removeAttribute("selected")}}))};function i(){l(),t.hasAttribute("selected")||(t.setAttribute("selected",""),a._selectedTasks=[t.data.id]),a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._autoSaveState("selection"),a._focusTask(t)}if("zeroOrOne"===s)l(),t.hasAttribute("selected")?(a._focusTask(t),t.removeAttribute("selected"),a._selectedTasks=[],delete a._selectionInView):(t.setAttribute("selected",""),a._selectedTasks=[t.data.id],a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._focusTask(t)),a.virtualization&&a._refreshColumns();else{if(!e.ctrlKey&&!e.shiftKey&&!e.metaKey||0===a._selectedTasks.length||t.closest("smart-scroll-viewer")!==a._selectionInView)return void i();if(e.ctrlKey||e.metaKey)t.hasAttribute("selected")?(t.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((e=>e!==t.data.id))):(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id),a._selectionStart=t.data.id);else if(e.shiftKey){if(t&&t.id===a._selectionStart)return a._selectedTasks.length>1&&i(),void(a.virtualization&&a._refreshColumns());const e=t[a.dataSourceMap.status],s=a._getTasksByDataField(e),l=a.getTask(a._selectionStart);let r=s.indexOf(l),o=s.indexOf(t.id);const n=r;r=Math.min(r,o),o=Math.max(n,o),a._selectedTasks=[],s.forEach(((e,t)=>{const s=a.querySelector('[data-id="'+e.id+'"]');t>=r&&t<=o&&!e.filteredOut?(s&&s.setAttribute("selected",""),a._selectedTasks.push(e.id)):s&&s.removeAttribute("selected")}))}a._focusTask(t)}a.virtualization&&a._refreshColumns(),a._autoSaveState("selection")}_processDataSource(){const e=this;let t=e.dataSource;if(0!==e.columns.length&&null!=t){if(t instanceof Smart.DataAdapter){if(t.virtualDataSource)return void e._requestVirtualDataSource("dataBind");t=t.dataSource}t.length>500&&(e.virtualization=!0),t.forEach((t=>{e._createTask(t)})),e.virtualization&&(e._measureCardHeight(),e._refreshColumns()),e.whenRendered((()=>e._allColumns.forEach((t=>e._refreshScrollViewer(t)))))}}_requestVirtualDataSource(e,t,a){const s=this,l=s.dataSourceMap,i=[],r=[],o={},n=s._appliedFiltering;let d=null;if(n&&n.filterGroups.length>0&&(n.filterGroups.forEach((e=>r[e[0]]=e[1])),r.length=n.filterGroups.length,d=n.operator),s._appliedSorting&&s._appliedSorting.dataFields.length>0&&(s._appliedSorting.dataFields.forEach(((e,t)=>{let a=s._appliedSorting.orderBy[t].replace("ending","");i[e]={sortOrder:a,sortIndex:t}})),i.length=s._appliedSorting.dataFields.length),void 0!==t){const e=Object.assign({},t);e[l.checklist]=JSON.stringify(e[l.checklist]),e[l.history]=JSON.stringify(e[l.history],(function(e,t){return"date"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.comments]=JSON.stringify(e[l.comments],(function(e,t){return"time"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.updatedDate]&&(e[l.updatedDate]=e[l.updatedDate].toISOString().slice(0,10)),e[l.createdDate]&&(e[l.createdDate]=e[l.createdDate].toISOString().slice(0,10)),e[l.dueDate]&&(e[l.dueDate]=e[l.dueDate].toISOString().slice(0,10)),e[l.startDate]&&(e[l.startDate]=e[l.startDate].toISOString().slice(0,10)),o.row=e}s.dataSource.onVirtualDataSourceRequested((function(t){let l=!0;-1!==["add","update","remove"].indexOf(e)&&a&&(l=a(t.result),"add"!==e)||l&&(Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),s.dataSource.dataSource.forEach((e=>{s._createTask(e)})),s._allColumns.forEach((e=>s._refreshScrollViewer(e))),s._autoSaveState("dataSource"))}),{first:0,last:0,sorting:i,filtering:r,filterOperator:d,grouping:[],edit:o,action:e})}_setUserList(){const e=this,t=document.createElement("div");t.id=e.id+"UserList",t.className="smart-kanban-list users smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e.users.forEach((e=>{const a=document.createElement("div"),s=e?e.image:null,l=s?`background-image: url('${s}');`:"";a.className="item",a.innerHTML=`<div class="icon" style="${l}"></div><div class="name">${e.name}</div>`,a.setAttribute("data-id",e.id),a.setAttribute("role","option"),t.appendChild(a)})),e._userList=t}_setPriorityList(){const e=this,t=document.createElement("div");t.id=e.id+"PriorityList",t.className="smart-kanban-list priority smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e._getPriority().forEach((e=>{const a=document.createElement("div");a.className="item",e.menuLabel?a.innerHTML=e.menuLabel:a.innerHTML=`<div priority="${e.value}" class="smart-kanban-task-text">${e.menuIcon}${e.label}</div>`,a.setAttribute("priority",e.value),a.setAttribute("role","option"),t.appendChild(a)})),e._priorityList=t;const a=e._dialog;a&&a.editPanelPopulated&&(a.editors.priority.dataSource=e._getPriority())}_openList(e,t,a){const s=this,l=e.getBoundingClientRect();let i,r,o=l.left,n=l.top+e.offsetHeight;a=s.rightToLeft?!a:a,1===window.devicePixelRatio?(i=document.documentElement.clientWidth,r=document.documentElement.clientHeight):(i=window.innerWidth,r=window.innerHeight),t.classList.add("dialog"),document.body.appendChild(t),a&&(o=l.right-t.offsetWidth),o+t.offsetWidth>i&&(o=i-t.offsetWidth),n+t.offsetHeight>r&&(n=r-t.offsetHeight),t.style.left=Math.max(0,o)+"px",t.style.top=n+"px",t.classList.remove("smart-visibility-hidden"),e.setAttribute("aria-expanded",!0),e.setAttribute("aria-controls",t.id),s.unfocusable||requestAnimationFrame((function e(){0===t.getBoundingClientRect().height?requestAnimationFrame(e):t.focus()})),t.openedFrom=e,t.onclick=e=>{s._containerClickHandler(e)}}_openUserList(e,t){const a=this;if(0===a.users.length)return;const s=t.data[a.dataSourceMap.userId],l=a._userList,i=l.querySelector(".selected");if(i&&(i.classList.remove("selected"),i.removeAttribute("aria-selected")),a._openList(e,l),null!==s){const e=Array.from(l.children).find((e=>e.getAttribute("data-id")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._userSelectionFor=t}_openPriorityList(e,t){const a=this,s=t.data[a.dataSourceMap.priority],l=a._priorityList,i=l.querySelector(".selected");if(i&&(i.classList.remove("selected"),i.removeAttribute("aria-selected")),a._openList(e,l),null!=s){const e=Array.from(l.children).find((e=>e.getAttribute("priority")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._prioritySelectionFor=t}_closeList(e,t){const a=this;if(!e||!e.parentElement)return;const s=a.$.container.querySelector(`[aria-expanded="true"][aria-controls="${e.id}"]`);e.classList.add("smart-visibility-hidden"),requestAnimationFrame((function s(){e.classList.contains("smart-visibility-hidden")&&(e.getBoundingClientRect().height>0?requestAnimationFrame(s):(e.remove(),delete e.openedFrom,delete a[t]))})),s&&(s.removeAttribute("aria-expanded"),s.removeAttribute("aria-controls"))}_setActionsList(){const e=this,t=document.createElement("div");if(t.id=e.id+"ActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" edit data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n<div class="item" copy data-id="1" role="menuitem"><div class="name">${e.localize("copy")}</div></div>\n<div class="item" remove data-id="2" role="menuitem"><div class="name">${e.localize("remove")}</div></div>`,e.taskActionsRendered){e.taskActionsRendered(t);const a=Array.from(t.children);for(let e=0;e<a.length;e++){const t=a[e];t.classList.add("item"),t.setAttribute("data-id",e),t.setAttribute("role","menuitem"),t.firstElementChild&&t.firstElementChild.classList.add("name")}}e._actionsList=t}_setColumnActionsList(){const e=this,t=document.createElement("div");t.id=e.id+"ColumnActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n <div class="item" data-id="1" role="menuitem"><div class="name">${e.localize("addNewTask")}</div></div>\n <div class="item" data-id="2" role="menuitem"><div class="name">${e.localize("collapse")}</div></div>\n <div class="item" data-id="3" role="menuitem"><div class="name">${e.localize("removeColumn")}</div></div>\n <div class="item" data-id="4" role="menuitem"><div class="name">${e.localize("hideColumn")}</div></div>\n <div class="item" data-id="5" role="menuitem"><div class="name">${e.localize("showAllColumns")}</div></div>`,e._columnActionsList=t}_openActionsList(e,t,a){const s=this,l=s._currentUser,i=s._actionsList;s._openList(e,i,a),i.classList.toggle("edit-comment",!!a),s._actionSelectionFor=t||a,i.children[0]&&i.children[0].hasAttribute("edit")&&(t&&!l.allowEdit?i.children[0].classList.add("smart-hidden"):i.children[0].classList.remove("smart-hidden")),i.children[1]&&i.children[1].hasAttribute("add")&&(t&&!l.allowAdd?i.children[1].classList.add("smart-hidden"):i.children[1].classList.remove("smart-hidden")),i.children[2]&&i.children[0].hasAttribute("remove")&&(t&&!l.allowRemove?i.children[2].classList.add("smart-hidden"):i.children[2].classList.remove("smart-hidden")),Array.from(i.children).forEach((e=>e.classList.remove("selected")))}_openColumnActionsList(e,t){const a=this,s=a._columnActionsList,l=s.children;a.allowColumnEdit&&t.editable&&"header"!==a.columnEditMode?l[0].classList.remove("smart-hidden"):l[0].classList.add("smart-hidden"),a.addNewButton&&t.addNewButton?l[1].classList.remove("smart-hidden"):l[1].classList.add("smart-hidden"),a.allowColumnRemove&&t.allowRemove&&a._allColumns.length>1?l[3].classList.remove("smart-hidden"):l[3].classList.add("smart-hidden"),a.collapsible&&t.collapsible?l[2].classList.remove("smart-hidden"):l[2].classList.add("smart-hidden"),a.allowColumnHide&&t.allowHide&&a._allColumns.length>1?(l[4].classList.remove("smart-hidden"),l[5].classList.remove("smart-hidden")):(l[4].classList.add("smart-hidden"),l[5].classList.add("smart-hidden")),a._openList(e,s),a._columnActionSelectionFor=t,Array.from(s.children).forEach((e=>e.classList.remove("selected")))}_setCommentsList(){const e=this,t=document.createElement("div");t.id=e.id+"CommentsList",t.className="smart-kanban-list comments smart-visibility-hidden",t.setAttribute("role","dialog"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="smart-kanban-comments" role="list"></div>\n<div class="smart-kanban-new-comment" role="presentation">\n <textarea placeholder="${e.localize("newComment")}"></textarea>\n <smart-button class="send primary" disabled${e._rtlAttr}>${e.localize("send")}</smart-button>\n</div>`;const a=t.querySelector("textarea"),s=t.querySelector("smart-button");s.tabIndex=0,a.onfocus=()=>{t.classList.add("expanded"),s.disabled=""===a.value},a.onblur=e=>{s.contains(e.relatedTarget)||t.classList.remove("expanded")},a.onkeyup=()=>{s.disabled=""===a.value},a.oncut=()=>{s.disabled=""===a.value},a.onpaste=()=>{s.disabled=""===a.value},t.textarea=a,t.button=s,e._commentsList=t}_openCommentsList(e,t){const a=this,s=a._commentsList;s.classList.remove("expanded"),s.firstElementChild.innerHTML="",s.textarea.value="",s.textarea.disabled=!a._currentUser.allowComment,a.unfocusable?s.textarea.tabIndex=-1:s.textarea.removeAttribute("tabindex"),delete s.editing,t.data[a.dataSourceMap.comments].forEach((e=>a._createComment(e))),a._openList(e,s),a._commentSelectionFor=t}_getCommentsList(e){const t=this,a=t._commentsList;return a.classList.remove("expanded"),a.firstElementChild.innerHTML="",a.textarea.value="",a.textarea.disabled=!t._currentUser.allowComment,t.unfocusable?a.textarea.tabIndex=-1:a.textarea.removeAttribute("tabindex"),delete a.editing,e.data[t.dataSourceMap.comments].forEach((e=>t._createComment(e))),t._commentSelectionFor=e,a.classList.remove("smart-visibility-hidden"),a}_createComment(e){const t=this,a=document.createElement("div");let s,l;function i(){const i=t._commentsList.firstElementChild,r=l?l.image:null,o=l?l.name||l.id:t.localize("guestUser"),n=l?l.name:t.localize("guestUser");a.classList="smart-comment",a.setAttribute("role","listitem");const d=r?`background-image: url('${r}');`:"";a.innerHTML=`<div class="comment-indent" role="presentation">\n <div class="user-icon" style="${d}" role="img" aria-label="Icon of user ${o}"></div>\n</div>\n<div class="comment-main" role="presentation">\n <div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&l.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}"${t._tabindex} role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n </div>\n <div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,a.comment=e,r||a.querySelector(".user-icon").classList.add("empty"),i.appendChild(a),s&&(i.scrollTop=i.scrollHeight-i.offsetHeight)}if(e)l=t.users.find((t=>t.id===e.userId));else{const a=t.dataSourceMap,r=t.dataSource&&t.dataSource.virtualDataSource,o=t._commentsList.textarea.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),n=t._commentsList.editing,d=t._commentSelectionFor.data,c=JSON.parse(JSON.stringify(d));if(n){if(r){const e=Object.assign({},d);e[a.comments]=e[a.comments].slice(0),e[a.comments][e[a.comments].indexOf(n.comment)]=Object.assign({},n.comment,{text:o}),t._requestVirtualDataSource("update",e,(function(a){return a&&(t._commentSelectionFor.data=e,n.querySelector(".comment-body").innerHTML=o),delete t._commentsList.editing,a}))}else n.querySelector(".comment-body").innerHTML=o,n.comment.text=o,delete t._commentsList.editing;return t.$.fireEvent("commentUpdate",{id:d.id,value:n.comment}),t.$.fireEvent("taskUpdate",{id:d.id,value:d,oldValue:c}),void t.$.fireEvent("change",{task:t._commentSelectionFor,id:d.id,value:d,oldValue:c})}if(s=!0,e={text:o,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:t._currentUser.info?t._currentUser.info.id:-1,time:new Date},l=t._currentUser.info,r){const s=Object.assign({},d);s[a.comments]=s[a.comments].slice(0),s[a.comments].push(e),t._requestVirtualDataSource("update",s,(function(e){return e&&(t._commentSelectionFor.data=s,t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",s[a.comments].length||""),i()),e}))}else d[a.comments].push(e),t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",d[a.comments].length||"")}return e.time instanceof Date==0&&(e.time=new Date(e.time),e.time.setTime(e.time.getTime()-1*e.time.getTimezoneOffset()*60*1e3)),i(),e}_getTaskIndexByPosition(e,t){const a=(e,t)=>{const a=e.top,s=e.top+e.height,l=a<=t&&s>t;return 0!==e.height&&l},s=(t=>{let s=0,l=t.length-1;if(e<=0)return 0;const i=t[t.length-1];if(-1!==i.top&&i.top<=e)return t.length-1;for(;;){const i=Math.floor((s+l)/2),r=t[i];if(a(r,e))return i;r.top<e?s=i+1:r.top>e?l=i-1:s=i+1}})(t);return s}_refreshColumns(){const e=this;e.virtualization&&e._allColumns.forEach((t=>{e._refreshColumn(t.dataField)}))}_refreshColumn(e){const t=this.getColumn(e),a=this._columnToElement.get(t);if(!a)return;const s=a.querySelector("smart-scroll-viewer");this._refreshScrollHeight(s,e)}_getTasksByDataField(e){const t=this;let a=t.tasksByDataField[e];return a?a._filtered?a._filtered:a._sorted?a._sorted:a:(t.tasksByDataField[e]=[],t.tasksByDataField[e])}_refreshEmptyColumnState(e,t){const a=this;e&&(e.querySelector(".smart-kanban-task")||e.querySelector(".smart-kanban-task")&&!t?(e.removeAttribute("empty",a.localize("empty")),e.classList.remove("empty")):(e.setAttribute("empty",a.localize("empty")),e.classList.add("empty")))}_refreshScrollHeight(e,t){const a=this;if(a._refreshEmptyColumnState(e,t),!a.virtualization)return;const s=a._getTasksByDataField(t);if(!s)return;const l=a._autoCardHeight?a._autoCardHeight:a.cardHeight;e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight;for(let e=0;e<s.length;e++){const t=s[e];t.top=e*l,t.height=l}const i=e.querySelector(".smart-scroll-viewer-content-container"),r=e=>{const l=a._getTaskIndexByPosition(e,s),r=a.uiTasksByDataField[t].length;for(let e=0;e<r;e++){const r=s[l+e],o=a.uiTasksByDataField[t][e];o&&(a._dragDetails&&(o.classList.remove("dragged"),r&&a._dragDetails.ItemsData.forEach((e=>{e.id===r.id&&o.classList.add("dragged")}))),r?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),0===e&&(i.style.marginTop=r?r.top+"px":"0px"),r)&&(o.hasAttribute("selected")&&o.removeAttribute("selected"),o.hasAttribute("focus")&&o.removeAttribute("focus"),JSON.stringify(r)!==JSON.stringify(o.data)&&(o.data=r,a._renderTask(o)),a._selectedTasks&&a._selectedTasks.indexOf(r.id)>=0&&o.setAttribute("selected",""),a._focusedTask===r.id&&o.setAttribute("focus",""))}};e.onVerticalChange=e=>{const t=e.detail.value;r(t)},a.uiTasksByDataField[t]||(a.uiTasksByDataField[t]=[]);const o=Math.round(e.offsetHeight/l)+2,n=a.uiTasksByDataField[t].length;if(0===n||n<o){const i=Math.round(e.offsetHeight/l)+2;for(let e=0;e<i;e++){const l=s[e];if(!l)continue;const i=a._createVirtualTask(l);a.uiTasksByDataField[t].push(i)}e.refresh(),e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight,r(e.scrollTop)}else r(e.scrollTop)}_createVirtualTask(e,t){const a=this,s=a.dataSourceMap,l=a._allColumns.find((t=>t.dataField===e[s.status]));if(!l)return;const i=document.createElement("div"),r=a._columnToElement.get(l),o=a.getTaskScrollViewer(r,e);return void 0===e[s.id]&&(e[s.id]=Math.floor(9e4*Math.random()+1e4)),i.className="smart-kanban-task smart-unselectable",i.setAttribute("role","listitem"),i.setAttribute("data-id",e[s.id]),a._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=a._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date),e[s.history]=[],a.addHistory(e,{action:"created",user:a._currentUser.info.id,details:{value:e[s.text]},date:e[s.createdDate]})),i.data=e,i.column=l,a._renderTask(i),e.class&&"string"==typeof e.class&&i.classList.add(e.class),o.appendChild(i),a._updateTaskColor(i),t&&(l.collapsed?o.toRefresh=!0:o.refresh()),i}_measureCardHeight(){const e=this,t=Object.keys(e.tasksByDataField);if(0===t.length||0===e.columns.length)return null;if(null===e.cardHeight&&!e._autoCardHeight){const a=e.tasksByDataField[t[0]],s=e._createVirtualTask(a[0]);e._renderTask(s),a.class&&"string"==typeof a.class&&s.classList.add(a.class);const l=e.columns[0],i=e._columnToElement.get(l),r=e.getTaskScrollViewer(i,a);r.appendChild(s);const o=r.querySelector(".smart-scroll-viewer-content-container"),n=getComputedStyle(o).rowGap;e._autoCardHeight=s.offsetHeight+parseInt(n),s.remove()}}_createTask(e,t,a){const s=this,l=s.dataSourceMap,i=s._allColumns.find((t=>t.dataField===e[l.status]));if(!i)return;const r=document.createElement("div"),o=s._columnToElement.get(i),n=s.getTaskScrollViewer(o,e);if(void 0===e[l.id]&&(e[l.id]=Math.floor(9e4*Math.random()+1e4)),r.className="smart-kanban-task smart-unselectable",r.setAttribute("role","listitem"),r.setAttribute("data-id",e[l.id]),s._currentUser&&s._currentUser.info&&(void 0===e[l.createdUserId]?(e[l.createdUserId]=s._currentUser.info.id,e[l.createdDate]=new Date):e[l.createdDate]||(e[l.createdDate]=new Date),e[l.history]||(e[l.history]=[],s.addHistory(e,{action:"created",user:s._currentUser.info.id,details:{value:e[l.text]},date:e[l.createdDate]}))),r.data=e,r.column=i,s.tasksByDataField[i.dataField]||(s.tasksByDataField[i.dataField]=[]),a>=0?s.tasksByDataField[i.dataField].splice(a,0,e):s.tasksByDataField[i.dataField].push(e),s.taskById[e.id]=e,!s.virtualization){if(s._renderTask(r),e.class&&"string"==typeof e.class&&r.classList.add(e.class),a>=0){const e=n.querySelector(".smart-kanban-task");e?e.parentElement.insertBefore(r,e):n.appendChild(r)}else n.appendChild(r);return s._updateTaskColor(r),t&&(i.collapsed?n.toRefresh=!0:n.refresh()),r}}getTaskScrollViewer(e,t){const a=this,s=a.dataSourceMap;let l;return a._hasSwimlane(e.index)?void 0!==t[s.swimlane]&&a.swimlanes.find((e=>e.dataField===t[s.swimlane]))?l=e.querySelector(`smart-scroll-viewer[swimlane="${t[s.swimlane]}"]`):(l=e.querySelector("smart-scroll-viewer"),t[s.swimlane]=l.getAttribute("swimlane")):(l=e.querySelector("smart-scroll-viewer"),delete t[s.swimlane]),l}_renderTask(e){const t=this;t._applyTaskTemplate(e),t._updateUserIcon(e),t._updateTaskChecked(e),t._updateTaskProgress(e),t._updateTaskDueDate(e),e.parentElement&&t._updateTaskColor(e),t._updateTaskPriority(e),e.column&&t.columnSummary&&t._updateColumnSummary(e.column),t.onTaskRender&&t.onTaskRender(e,e.data)}_refreshSummaries(){const e=this,t=e.querySelectorAll(".smart-kanban-column");for(let a=0;a<t.length;a++){const s=t[a].column;e._updateColumnSummary(s)}}_updateColumnSummary(e){const t=this,a=t._columnToElement.get(e);if(!a||!t.columnSummary)return;const s=t._getColumnSummary(e),l=a.querySelector(".summary");if(l&&(l.innerHTML=s),t.columnFooter){const l=a.querySelector(".smart-kanban-column-footer");if(s.length){let e=parseInt(s.replace("(","").replace(")","").trim());l.innerHTML=1===e?t.localize("tasksSummaryOne"):t.localize("tasksSummary",{summary:e})}else l.innerHTML="";t.onColumnFooterRender&&t.onColumnFooterRender(l,e,e.dataField)}a.removeAttribute("wip-min-error"),a.removeAttribute("wip-max-error"),void 0!==e.min&&(a.setAttribute("min",e.min),s.length?parseInt(s.replace("(","").replace(")","").trim())<e.min&&a.setAttribute("wip-min-error",""):0<e.min&&a.setAttribute("wip-min-error","")),void 0!==e.max&&(a.setAttribute("max",e.max),s.length)&&parseInt(s.replace("(","").replace(")","").trim())>e.max&&a.setAttribute("wip-max-error","")}_createAttachment(e){const t=e.target.classList.contains("attachments")?e.target:e.target.closest(".attachments"),a=t.getAttribute("data-field"),s=t.closest("smart-kanban"),l=s._fieldAttachmentValue[a],i=l&&"string"==typeof l?JSON.parse(l):l,r=e.target.closest(".item");if(!r)return;const o=r.getAttribute("value"),n=l.findIndex((e=>e.value===o));if(i[n]){const e=document.createElement("a");if(i[n].value.indexOf(window.location.host)>=0)fetch(i[n].value).then((e=>e.blob())).then((t=>{const a=URL.createObjectURL(t);e.download=i[n].label,e.href=a,e.click()}));else{if(i[n].value.indexOf("base64")>=0){const t=s._getFileFromBase64(i[n].value);e.href=URL.createObjectURL(t)}else e.href=i[n].value;e.target="_blank",e.click()}}e.stopPropagation(),e.preventDefault()}_createImageModal(e,t){const a=this,s=document.createElement("smart-window");s.animation=a.animation,s.headerButtons=["close"],s.rightToLeft=a.rightToLeft,s.resizeMode="none",s.theme=a.theme,s.style.height="auto",s.style.width="auto",s.style.maxWidth="1200px",s.style.maxHeight="1200px",document.body.appendChild(s),s.onclose=()=>{document.body.removeChild(s)},s.innerHTML="",s.label=e.title;const l=e.cloneNode(!0);e.hasAttribute("value")&&(l.src=e.getAttribute("value")),l.removeAttribute("onpointerdown"),l.removeAttribute("width"),l.removeAttribute("height"),l.style.maxWidth="1000px",l.style.maxHeight="1000px",s.appendChild(l),s.open(),t.stopPropagation(),t.preventDefault()}_applyTagsContent(e,t,a){const s=this;let l=s.tags;const i=s.dataSourceMap;l||(l=[]);let r="";if(e&&e.indexOf&&e.indexOf("{")>=0&&(e=JSON.parse(e)),e&&"string"==typeof e){if("[]"===e)return t[i.tags]="",r;e=e.split(",");for(let t=0;t<e.length;t++)e[t]=e[t].trim();l&&l.length>0?(e=e.filter((e=>{if(-1!==l.indexOf(e))return!0})),t[i.tags]=e.join(", ")):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=[],r=e.map((e=>`<span class="smart-kanban-task-tag" role="listitem">${e}</span>`)).join("")}else e&&"object"==typeof e?(Array.isArray(e)||(e=[e],t[i.tags]=e),l.length>0?(s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=e.filter((e=>{if(-1!==l.indexOf(e))return!0;if(e.value){let t=!1;if(l.find((a=>{a===e.value&&(t=!0),a.value===e.value&&(t=!0)})),t)return!0}})),t[i.tags]=e):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):(e=[],t[i.tags]=[]),r=e.map((e=>{if(e.color){const t=e.color||"rgba(var(--smart-primary-rgb), 0.15)",a=document.createElement("div");document.body.appendChild(a),a.style.backgroundColor=t;const s=getComputedStyle(a).backgroundColor;return a.remove(),`<span style="color: ${new Smart.Color(s).getInvertedColor()}; background: ${t} " class="smart-kanban-task-tag" role="listitem">${e.label}</span>`}return`<span class="smart-kanban-task-tag" role="listitem">${"string"==typeof e?e:e.label}</span>`})).join("")):t[i.tags]="";return r}_applyTaskTemplate(e){const t=this,a=t.dataSourceMap,s=(t.tags,e.data),l=t._tabindex;let i=s[a.text],r=s[a.description],o=s[a.tags],n="",d=i;void 0===i&&(i="",s[a.text]="",d=i),void 0===r&&(r="",s[a.description]=""),i=t._applyTextTemplate(i,s,e),n=t._applyTagsContent(o,s,e),"string"==typeof s[a.priority]&&(s[a.priority]=s[a.priority].toLowerCase());const c=t._getPriority();let u=c.findIndex((e=>e.value===s[a.priority]));const m=c.length>0&&u>=0?c[u]:null;s[a.comments]&&Array.isArray(s[a.comments])||(s[a.comments]=[]);const p=t.localize(s[a.priority])+" "+t.localize("priority");let h=d?`${d}: ${p}`:`${p}`;t.taskPriority||(h=d);let g=`<div class="smart-kanban-task-cover"></div><div title="${h}" class="smart-kanban-task-content" role="presentation">\n <div class="smart-kanban-task-text">${i}`;g+=m?`${m.menuIcon}`:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',g+=`</div>\n <div class="smart-kanban-task-user"${l} role="button" aria-haspopup="listbox"></div>\n</div>\n<div class="smart-kanban-task-info" role="presentation">\n <div class="smart-kanban-task-progress-container">\n <div class="smart-kanban-task-progress" role="progressbar" aria-label="Task progress" aria-valuemin="0" aria-valuemax="100"></div>\n <div class="smart-kanban-task-checked" aria-label="Completed sub-tasks"></div>\n </div>\n <div class="smart-kanban-task-due" aria-label="Task due date"></div>\n</div>\n<div class="smart-kanban-task-fields"></div>\n<div class="smart-hidden smart-kanban-task-subtasks">\n <div class="smart-kanban-task-subtasks-container"></div>\n <div><input class="smart-kanban-task-input smart-input" placeholder="${t.localize("newSubtask")}"/></div>\n</div>\n<div class="smart-hidden smart-kanban-task-custom-fields"></div>\n<div class="smart-kanban-task-footer" role="toolbar" aria-label="Task footer">\n <div class="smart-kanban-task-tags" role="list" aria-label="Tags list">${n}</div>\n <div class="smart-kanban-task-edit smart-hidden"${l} title="${t.localize("edit")}" role="button" aria-label="Edit"></div>\n <div title="${t.localize("actionsList")}" class="smart-kanban-task-actions"${l} role="button" aria-haspopup="menu" aria-label="Open actions list"></div>\n <div class="smart-kanban-task-comments"${l} num="${s[a.comments].length||""}" role="button" aria-haspopup="dialog" aria-label="Open comments list"></div>\n <div class="smart-kanban-task-description smart-hidden"${l} title="${t.localize("taskDescription",{value:s[a.description]})}" num="${s[a.description]?s[a.description].length:""}" role="button" aria-label="Show description"></div>\n</div>`,e.innerHTML=g,e.setAttribute("aria-label",s[a.text]);const f=e.querySelector(".smart-kanban-task-description");s[a.description]?f.classList.remove("smart-hidden"):f.classList.add("smart-hidden");const b=e.querySelector(".smart-kanban-task-edit");t.editable?b.classList.remove("smart-hidden"):b.classList.add("smart-hidden"),b.onpointerdown=a=>{t.beginEdit(e),a.preventDefault(),a.stopPropagation()},e.onmousemove=()=>{Smart.Kanban.kanbanTaskDragged&&t.allowDropPlaceholder&&setTimeout((()=>{const a=e.classList.contains("before"),s=e.classList.contains("after");(a||s)&&(Smart.Kanban.dropOverTask&&Smart.Kanban.dropOverTask!==e&&delete Smart.Kanban.isBefore,Smart.Kanban.isBefore!==a&&(Smart.Kanban.isBefore=a,Smart.Kanban.dropOverTask=e,(a=>{e.classList.add("smart-kanban-task-placeholder"),t._dropAreaTimer&&clearTimeout(t._dropAreaTimer),t._dropAreaTimer=setTimeout((()=>{setTimeout((()=>{document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.style.marginTop=e.style.marginBottom="0px"}));const s=e.closest(".smart-kanban-column");if(s&&s.hasAttribute("orientation")&&"horizontal"!==s.getAttribute("orientation")){const s=t._dragDetails?t._dragDetails.Item:null;e!==s&&(a?e.previousElementSibling!==s&&(e.style.marginTop="100px"):e.nextElementSibling!==s&&(e.style.marginBottom="100px"))}t._refreshButtonsAndSummaries()}),20)}),20)})(a)))}))},t._updateTaskCustomFields(e),t._updateTaskSubtasks(e)}_updateTaskCustomFields(e){const t=this,a=e.data;if(t.taskCustomFieldsHide){const t=e.querySelector(".smart-kanban-task-custom-fields");t&&t.classList.remove("smart-hidden")}else if(t.taskCustomFields.length>0&&!t.taskCustomFieldsHide){const s=e.querySelector(".smart-kanban-task-custom-fields");s.classList.remove("smart-hidden");for(let l=0;l<t.taskCustomFields.length;l++){const i=t.taskCustomFields[l];let r=a[i.dataField],o="";if(!t.dataSourceMap[i.dataField]&&"password"!==i.editor)if(null!=r&&!1!==i.visible){if(void 0===i.visible&&(i.visible=!0),void 0===i.allowHide&&(i.allowHide=!0),"string"==typeof r&&(!i.dataSource||i.dataSource&&0===i.dataSource.length)&&r.length>50){if(r.indexOf("base64")>=0&&"image"===i.editor){r=JSON.parse(r),window.Smart._createSmartImageModal=t._createImageModal;let e="";for(let t=0;t<r.length;t++){const a=r[t];e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${a.value}" title="${a.label}"/>`}r=e}else if(i.image&&r.indexOf("http")>=0){if(window.Smart._createSmartImageModal=t._createImageModal,r.indexOf(",")>=0){let e="";r=r.split(",");for(let t=0;t<r.length;t++)e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${r[t]}"/>`;r=e}else r=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${r}"/>`;if(i.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=r}}else if(i.image&&r.indexOf("http")>=0||i.editor&&"image"===i.editor&&r.indexOf("http")>=0)if(window.Smart._createSmartImageModal=t._createImageModal,r.indexOf("[{")>=0){r=JSON.parse(r);let e="";for(let t=0;t<r.length;t++){const a=r[t];a.label||(a.label=""),e+=`<img title="${a.label}" style="margin-left: 5px;" value="${a.value}" onpointerdown="Smart._createSmartImageModal(this, event)" src="${a.small||a.value}"/>`}r=e}else o=r,r=r.substring(0,50)+"...";else if(i.image){if(r=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${r}"/>`,i.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=r}}else if("attachment"===i.editor)if(r.length>50){if("string"==typeof r&&(r.indexOf("[{")>=0||r.indexOf("}]")>=0)){let e="";if(r)try{e=JSON.parse(r)}catch(e){console.log(e)}r=e}const e=document.createElement("div");Array.isArray(r)&&(r.forEach((t=>{const a=document.createElement("div");a.title=t.label,a.classList.add("item"),a.innerHTML="<div></div>",a.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.label.indexOf("png")>=0||t.label.indexOf("jpg")>=0||t.label.indexOf("jpeg")>=0||t.label.indexOf("gif")>=0?a.firstElementChild.classList.add("smart-icon-image"):t.label.indexOf(".pdf")>=0?a.firstElementChild.classList.add("smart-icon-pdf"):t.label.indexOf(".tsv")>=0||t.label.indexOf(".txt")>=0||t.label.indexOf(".csv")>=0?a.firstElementChild.classList.add("smart-icon-text"):t.label.indexOf(".xls")>=0||t.label.indexOf(".xlsx")>=0?a.firstElementChild.classList.add("smart-icon-excel"):t.label.indexOf(".ppt")>=0?a.firstElementChild.classList.add("smart-icon-powerpoint"):t.label.indexOf(".zip")>=0||t.label.indexOf(".rar")>=0||t.label.indexOf(".7z")>=0?a.firstElementChild.classList.add("smart-icon-archive"):t.label.indexOf(".doc")>=0||t.label.indexOf(".docx")>=0?a.firstElementChild.classList.add("smart-icon-word"):a.firstElementChild.classList.add("smart-icon-file"),a.setAttribute("value",t.value),e.appendChild(a)})),t._fieldAttachmentValue||(t._fieldAttachmentValue=[]),t._fieldAttachmentValue[i.dataField]=r),window.Smart._createSmartAttachment=t._createAttachment,r='<div data-field="'+i.dataField+'" onpointerdown="Smart._createSmartAttachment(event)" class="attachments">'+e.innerHTML+"</div>"}else input=document.createElement("div"),r||(r=t.localize("emptyAttachment"));else if("dateInput"===i.editor)r=new Smart.Utilities.DateTime(r).toString(this.formatStringDate);else if("dateRangeInput"===i.editor)r&&r.length&&(r[0]=new Smart.Utilities.DateTime(r[0]).toString(this.formatStringDate),r[1]=new Smart.Utilities.DateTime(r[1]).toString(this.formatStringDate),r=r[0]+"-"+r[1]);else if(i.dataSource)if(r&&r.indexOf(",")>0&&(r=r.split(",")),void 0!==r&&Array.isArray(r)){let e=[];for(let t=0;t<r.length;t++){const a=i.dataSource.find((e=>{if(e.value===r[t])return e}));a&&e.push(a.label)}r=e.toString()}else{const e=i.dataSource.find((e=>{if(e.value===r)return e}));e&&e.label&&(r=e.label)}const a=e.querySelector("[data-field="+i.dataField+"]");if(a)a.innerHTML=`<div class="smart-kanban-task-field-label">${i.label}</div><div title="${o}" class="smart-kanban-task-field-value">${r}</div>`,a.classList.remove("smart-hidden");else{const e=document.createElement("div");e.classList.add("smart-kanban-task-field"),e.setAttribute("data-field",i.dataField),e.innerHTML=`<div class="smart-kanban-task-field-label">${i.label}</div><div title="${o}" class="smart-kanban-task-field-value">${r}</div>`,s.appendChild(e)}}}else{const t=e.querySelector("[data-field="+i.dataField+"]");t&&t.classList.add("smart-hidden")}}}}_updateTaskSubtasks(e){const t=this;if("none"===t.taskSubTasks)return void e.querySelector(".smart-kanban-task-subtasks").classList.add("smart-hidden");const a=e.data,s=t.dataSourceMap,l=[],i=[];(a[s.checklist]||[]).forEach(((e,t)=>{e.completed&&l.push(t),i.push({label:e.text,selected:!0===e.completed})}));const r=e.querySelector(".smart-kanban-task-subtasks"),o=e.querySelector(".smart-kanban-task-subtasks-container");o.innerHTML="",r.classList.remove("smart-hidden");const n=e.querySelector(".smart-kanban-task-input");t._currentUser&&!t._currentUser.allowEdit||t.disabled||!t.taskSubTasksInput?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"),n.onfocus=function(e){e.preventDefault(),e.stopPropagation()},n.onkeydown=e=>{"Escape"===e.key&&(n.value="",n.blur())," "===e.key&&e.stopPropagation()},n.onchange=function(l){a[s.checklist]||(a[s.checklist]=[]);const i=JSON.parse(JSON.stringify(a));a[s.checklist].push({text:n.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),completed:!1}),n.value="",t._updateTaskSubtasks(e);const r=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:r.id,value:r,oldValue:i}),t.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:i}),t._refreshColumnHeights(),l.preventDefault(),l.stopPropagation(),n.closest(".smart-scroll-viewer-container").scrollTop=0},i.length&&i.forEach(((l,r)=>{const n=document.createElement("div"),d=l.label;n.innerHTML=`<div data-index="${r}" class="smart-kanban-sub-task"><span title="${d}" class="label">${d}</span><span class="remove-subtask" aria-label="Remove subtask" title="${t.localize("removeSubtask")}"></span></div>`,l.selected&&n.firstChild.classList.add("selected"),"onlyUnfinished"===t.taskSubTasks&&l.selected&&n.classList.add("smart-hidden");let c=!0;(t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(c=!1),n.querySelector(".remove-subtask").style.opacity=c?1:0,n.onpointerup=n.onclick=e=>{t._dragDetails||(e.preventDefault(),e.stopPropagation())},n.onpointerdown=l=>{let r=!0;if((t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(r=!1),!r)return;const o=JSON.parse(JSON.stringify(a)),d=parseInt(n.firstChild.getAttribute("data-index")),c=i[d];l.target.classList.contains("remove-subtask")?(i.splice(d,1),n.classList.add("smart-hidden"),a[s.checklist].splice(d,1)):(n.firstChild.classList.toggle("selected"),c.selected=!c.selected,a[s.checklist][d].completed=c.selected,"onlyUnfinished"===t.taskSubTasks&&c.selected&&n.classList.add("smart-hidden")),t._updateTaskChecked(e);const u=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:u.id,value:u,oldValue:o}),t.$.fireEvent("taskUpdate",{id:u.id,value:u,oldValue:o}),l.preventDefault(),l.stopPropagation()},o.appendChild(n)}))}_applyTextTemplate(e,t,a){const s=this;let l=this.textTemplate;if(!l)return e;let i="";if("function"==typeof l){const s={data:t,task:a,text:e,template:null};if(l(s),e=s.text,null===s.template)return e;l=s.template}if(l.startsWith("#")){const a=document.querySelector(l);if(a&&a instanceof HTMLTemplateElement){const l=a.content.cloneNode(!0),r=document.createElement("div");return r.appendChild(l),e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),i=r.innerHTML.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),i.indexOf("{{text=")>=0&&(e?(i=i.substring(0,i.indexOf("{{text="))+e+i.substring(i.indexOf("}")),i=i.replace(/}/gi,""),i=i.replace(/{/gi,"")):(i=i.replace(/{{text=/gi,""),i=i.replace(/}}/gi,""))),i}}return i=l.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),i}_updateUserIcon(e){const t=this,a=this.dataSourceMap,s=e.data,l=e.getElementsByClassName("smart-kanban-task-user")[0];if(void 0!==s[a.userId]&&null!==s[a.userId]){const e=this.users.find((e=>e.id.toString()===s[a.userId].toString()));if(e)return s[a.userId]!==e.id&&(s[a.userId]=e.id),l.classList.remove("empty"),l.style.backgroundImage='url("'+e.image+'")',l.setAttribute("title",t.localize("assignedTask",{userName:e.name||e.id})),void l.setAttribute("aria-label","Icon of user "+(e.name||e.id))}s[a.userId]=null,l.classList.add("empty"),l.style.backgroundImage=null,l.setAttribute("aria-label","Empty user icon"),l.setAttribute("title",t.localize("unassignedTask"))}_updateTaskComments(e){const t=this.dataSourceMap,a=e.data;e.querySelector(".smart-kanban-task-comments").setAttribute("num",a[t.comments].length||"")}_updateTaskProgress(e){const t=this.dataSourceMap,a=e.data,s=e.querySelector(".smart-kanban-task-progress");let l=a[t.progress];if(void 0===l){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}if(l=parseFloat(l),isNaN(l)){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}l=Math.max(0,Math.min(parseFloat(l),100)),a[t.progress]=l,s.style.width=l+"%",s.classList.toggle("bottom",null!==a[t.checklist]),s.setAttribute("aria-valuenow",l);const i=this.localize("taskProgress",{value:l});s.parentElement.setAttribute("title",i)}_updateTaskChecked(e){const t=this.dataSourceMap,a=e.data,s=a[t.checklist],l=e.querySelector(".smart-kanban-task-checked");if(s&&Array.isArray(s)&&s.length>0?l.innerHTML=this._getCompletedSubTasks(s):(a[t.checklist]=null,l.innerHTML=""),l.innerHTML.length>0){let e=0;s.forEach((t=>t.completed&&e++));const t=e,a=s.length,i=this.localize("taskCompleted",{value:t,count:a});l.setAttribute("title",i)}else l.removeAttribute("title")}_getCompletedSubTasks(e){if(null===e)return"";let t=0;return e.forEach((e=>e.completed&&t++)),t+"/"+e.length}_updateTaskDueDate(e){const t=this.dataSourceMap;let a=e.data,s=a[t.dueDate],l=e.querySelector(".smart-kanban-task-due");if(s&&"string"==typeof s&&(s=new Date(s),s.setTime(s.getTime()-1*s.getTimezoneOffset()*60*1e3),a[t.dueDate]=s),s)if(l.innerHTML=new Smart.Utilities.DateTime(s).toString(this.formatStringDate),l.classList.toggle("overdue",s.getTime()<(new Date).getTime()&&100!==a[t.progress]),l.classList.contains("overdue")){const e=Math.abs(new Date-s),t=Math.ceil(e/864e5);l.setAttribute("title",this.localize("overdue")+" "+t+" "+this.localize("days"))}else l.removeAttribute("title");else a[t.dueDate]=null,l.innerHTML="",l.classList.remove("overdue"),l.removeAttribute("title");a[t.startDate]?"string"==typeof a[t.startDate]&&(a[t.startDate]=new Date(a[t.startDate]),a[t.startDate].setTime(a[t.startDate].getTime()-1*a[t.startDate].getTimezoneOffset()*60*1e3)):a[t.startDate]=null}_updateTaskColor(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".smart-kanban-task-progress-container"),i=e.querySelector(".smart-kanban-task-progress"),r=t.rightToLeft?"borderRightColor":"borderLeftColor";function o(e){let t=parseFloat(e).toString(16);return t="0".repeat(2-t.length)+t,t.toUpperCase()}if(e.style.borderLeftColor=null,e.style.borderRightColor=null,e.style.borderLeftWidth="",e.style.borderRightWidth="",s[a.color]){e.style[r]=s[a.color];const d=getComputedStyle(e)[r],c="dark"===t.theme?.4:.1;t.taskColor?e.style[r]=s[a.color]:(e.style[r]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px"),s[a.color]=(n=(n=d).match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+o(n[1])+o(n[2])+o(n[3]):null,l&&(l.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`,i.style.backgroundColor=d),t.taskColorEntireSurface&&(e.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`)}else{if(s[a.color]=null,l&&(l.style.backgroundColor=null,i.style.backgroundColor=null),t.taskColorEntireSurface){const a=getComputedStyle(e)[r],s="dark"===t.theme?.4:.1;e.style.backgroundColor=`rgba(${a.slice(4,a.length-1)}, ${s})`}t.taskColor||(e.style[r]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px")}var n}_updateTaskPriority(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".priority");l.className="priority";let i="";s[a.priority]&&(l.className+=" "+s[a.priority],i=t.localize(s[a.priority])+" "+t.localize("priority"));const r=s[a.text],o=e.querySelector(".smart-kanban-task-content");t.taskPriority?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),o&&(r&&t.taskPriority&&i?o.setAttribute("title",`${r}: ${i}`):o.removeAttribute("title"))}_validateSwimlanes(){const e=this,t=e.swimlanesFrom,a=e.swimlanesTo,s=[];t<0&&(e.swimlanesFrom=0),null!==a&&t>a&&(e.swimlanesFrom=a),e.swimlanes.forEach((e=>{"string"==typeof e&&(e={dataField:e,label:e}),(e.dataField||e.label)&&(e.label||(e.label=e.dataField),e.dataField||(e.dataField=e.label),s.push(e))})),e.swimlanes=s}_handleSwimlanes(e){const t=this,a=t.swimlanes;if(0===a.length||0===t.columns.length)return;const s=t.columns,l=parseFloat(getComputedStyle(t).getPropertyValue("--smart-kanban-header-size")),i=t.$.container,r=t.$.container.getBoundingClientRect(),o=t.$.container.querySelectorAll(".smart-kanban-column.has-swimlane");let n=o[0],d=o[o.length-1];if(t.rightToLeft){let e=n;n=d,d=e}const c=n.getBoundingClientRect(),u=o.length>1?d.getBoundingClientRect():c,m=Array.from(n.getElementsByTagName("smart-scroll-viewer"));let p,h,g,f,b=!1,v=!0,y=t.swimlanesTo;null===y&&(y=s.length-1),e&&(p=i.getElementsByClassName("swimlane")),n.column.collapsed&&(n.classList.remove("collapsed"),b=!0);for(let e=t.swimlanesFrom;e<=y;e++)v=v&&s[e].collapsed;v||(h=u.right-c.left+"px",g=c.left-r.left+"px",f=m.map((e=>e.getBoundingClientRect().top-r.top-l-t._dataViewPadding+"px"))),a.forEach(((t,a)=>{let s;e?s=p[a]:(s=document.createElement("div"),s.innerHTML=`<div class="swimlane-label">${t.label}</div>`,s.className="swimlane",s.setAttribute("role","heading"),s.setAttribute("aria-level",2),t.color&&(s.style.backgroundColor=t.color)),s.classList.toggle("smart-visibility-hidden",v),v||(s.style.width=h,s.style.left=g,s.style.top=f[a]),e||i.appendChild(s)})),b&&n.classList.add("collapsed")}_renderColumns(){const e=this,t=e.collapsible,a=[],s=e.$.body,l=document.createDocumentFragment();let i=e.columns;const r=e.context;if(e.context=e,e._columnToElement=new Map,e._columnContainers=[],0===i.length){const t=e.dataSource;t&&0!==t.length&&(i=[],t.forEach((t=>{const a=t[e.dataSourceMap.status];a&&-1===i.indexOf(a)&&i.push(a)})))}!function e(a,s,l){const i=[];let r=0;if(a.forEach((a=>{"string"==typeof a&&(a={dataField:a,label:a}),void 0!==a.dataField&&(void 0===a.label&&(a.label=a.dataField),void 0===a.dataField&&(a.dataField=a.label),"horizontal"!==a.orientation&&(a.orientation="vertical"),!1!==a.collapsible&&(a.collapsible=!0),a.collapsed&&t&&a.collapsible?r++:a.collapsed=!1,!1!==a.addNewButton&&(a.addNewButton=!0),!1!==a.allowRemove&&(a.allowRemove=!0),!1!==a.allowHide&&(a.allowHide=!0),!1!==a.editable&&(a.editable=!0),!1!==a.reorder&&(a.reorder=!0),0===l?delete a.selected:!0===a.selected?i.push(a):a.selected=!1,a.columns&&(a.validColumns=[],e(a.columns,a.validColumns,l+1),a.columns=a.validColumns,delete a.validColumns),s.push(a))})),r&&r===s.length&&(s[0].collapsed=!1),i.length>1)for(let e=i.length-2;e>=0;e--)i[e].selected=!1;else l>0&&0===i.length&&s.length>0&&(s[0].selected=!0)}(i,a,0),0===e.swimlanes.length?"columns"===e.hierarchy?e._createColumnElements(a,l,s,1):e._createColumnElementsTabs(a,l,s):e._createColumnElementsSwimlanes(a,l,s),s.appendChild(l),e._selectedTabs=e._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),e._autoSaveState("tabs"),e.context=r}_createAddNewButton(){const e=this,t=e.querySelectorAll(".smart-kanban-add-new-button");t.length&&t.forEach((e=>{e.remove()})),e.addNewButton&&"top"!==e.addNewButtonDisplayMode&&(e.addNewButtons=[],e.querySelectorAll(".smart-kanban-column").forEach((t=>{const a=t.querySelector(".smart-scroll-viewer");if(a){const s=(()=>{const t=document.createElement("div");return t.setAttribute("add-new-button",""),t.classList.add("smart-kanban-add-new-button"),t.title=e.localize("addNewTask"),t.onpointerdown=()=>{if(t.column){const a=t.column.querySelector(".smart-kanban-column-header-add");a&&(e._addToBottom=!0,a.click())}},t})(),l=t.column;if(!l||l&&l.collapsed||l&&!l.addNewButton)return;t.appendChild(s);const i=()=>{const l=a.getBoundingClientRect(),i=t.querySelectorAll(".smart-kanban-task"),r=e.offset(e);if(0===i.length){const a=t.querySelector(".smart-kanban-column-header"),l=e.offset(a).top-r.top,i=e.autoColumnHeight?60:0;s.style.top=l+i+a.offsetHeight+"px"}else{const o=i[i.length-1],n=e.offset(o);let d=parseInt(o.style.marginBottom);const c=e.offsetHeight-2*s.offsetHeight;isNaN(d)&&(d=0);const u=n.top-r.top+o.offsetHeight+d;if(a.computedVerticalScrollBarVisibility){const t=e.getBoundingClientRect();s.style.top=Math.min(l.top-t.top+a.offsetHeight,c)+"px"}else{const a=t.querySelector(".smart-kanban-column-footer");if(a){const t=e.offset(a).top-r.top-s.offsetHeight/2;s.style.top=Math.min(t,c)+"px"}else s.style.top=Math.min(u,c)+"px"}}const o=t.offsetWidth-a.offsetWidth;s.style.left=l.left+a.offsetWidth/2-o-s.offsetWidth/2-r.left+e.$.scrollViewer.scrollLeft+"px"};s.refresh=i,s.column=t,t.addNewButton=s,s.refresh(),e.addNewButtons.push(s),requestAnimationFrame((()=>{s.classList.add("show")}))}})),e._refreshSummaries())}_refreshColumnHeights(e=!0,t,a=0){const s=this;s.autoColumnHeight&&(s.virtualization?s.querySelectorAll(".smart-kanban-column").forEach((e=>{if(e.querySelector(".smart-scroll-viewer")){const t=e.column,a=s._getTasksByDataField(t.dataField),l=e.querySelector(".smart-kanban-column-header"),i=e.querySelector(".smart-kanban-column-footer"),r=i?i.offsetHeight:0;if(0===a.length)e.style.height=100+r+l.offsetHeight+"px";else{const t=s.offsetHeight,i=a[a.length-1],o=l.offsetHeight+r+i.top+i.height;isNaN(o)||(e.style.height=t<o?"":o-r+"px")}}})):s.querySelectorAll(".smart-kanban-column").forEach((l=>{const i=l.querySelector(".smart-scroll-viewer");if(i){const r=l.column;if(t&&r.dataField!==t)return;if(!r||r&&r.collapsed)return void(l.style.height="");const o=l.querySelectorAll(".smart-kanban-task"),n=l.querySelector(".smart-kanban-column-header"),d=l.querySelector(".smart-kanban-column-footer"),c=d?d.offsetHeight:0;if(0===o.length)l.style.height=100+c+n.offsetHeight+"px";else{const e=o[o.length-1];if(i.style.top="0px",!s._rowGap){const t=parseInt(getComputedStyle(e.parentElement).gridRowGap);s._rowGap=t,isNaN(s._rowGap)&&(s._rowGap=0)}let t=0;for(let e=0;e<o.length;e++)if(t+=o[e].offsetHeight+s._rowGap,o[e].classList.contains("smart-kanban-task-placeholder")){const a=parseInt(o[e].style.marginTop),s=parseInt(o[e].style.marginBottom);isNaN(a)||(t+=a),isNaN(s)||(t+=s)}const r=s.offsetHeight,d=n.offsetHeight+c+t+s._rowGap+s._rowGap+a;l.style.height=r<d?"":d+"px"}e&&i.refresh(),s._refreshEmptyColumnState(i)}})))}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")},e}_createColumnElements(e,t,a,s){const l=this,i=l.id,r=[],o=[];let n=0;const d=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;if(e.forEach(((a,c)=>{const u=document.createElement("div");let m=`${l._getColumnHeader(a,c<e.length-1,s)}\n <div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`,p=0;if(l.columnFooter&&(m+='<div class="smart-kanban-column-footer"></div>'),a.columns?(m=m.replace("AAA",""),m=m.replace("BBB",'<div class="smart-kanban-column-content-columns" role="presentation"></div>')):(m=m.replace("AAA"," no-sub-columns"),m=m.replace("BBB","")),u.className="smart-kanban-column",u.setAttribute("data-field",a.dataField),u.setAttribute("role","group"),u.setAttribute("aria-labelledby",`${i}ColumnHeaderLabel${a.dataField}`),u.setAttribute("orientation",a.orientation),a.color&&l.applyColumnColorToTasks&&u.style.setProperty("--smart-primary",a.color),a.collapsible&&u.setAttribute("collapsible",""),a.addNewButton&&u.setAttribute("add-new-button",""),u.innerHTML=m,u.siblingColumns=e,t.appendChild(u),u.column=a,u.index=c,u.onmouseleave=()=>{let e=!1;u.querySelectorAll(".smart-kanban-task-placeholder").forEach((t=>{t.style.marginTop=t.style.marginBottom="0px",e=!0})),e&&l._refreshButtonsAndSummaries()},l.onColumnHeaderRender&&l.onColumnHeaderRender(u.querySelector(".smart-kanban-column-header"),a,a.dataField),l._columnToElement.set(a,u),a.columns){const e=u.querySelector(".smart-kanban-column-content-columns");p=l._createColumnElements(a.columns,e,e,s+1),n+=p}else n+=1;let h=(p||1)+"fr";l.columnWidth?h=d(l.columnWidth):a.width&&(h=d(a.width)),!1!==a.visible?(a.collapsed?(u.classList.add("collapsed"),r.push("auto")):r.push(h),o.push(h)):u.classList.add("smart-hidden"),l._allColumns.push(a)})),1===s&&l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth;e=d(t),r.push(e)}else r.push("var(--smart-kanban-add-new-column-width)");return a.style.gridTemplateColumns=r.join(" "),a.fractions=o,l._columnContainers.push(a),n}_createColumnElementsTabs(e,t,a,s){const l=this,i=l.id,r=[],o=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`<div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`;if(a.columns?(c=c.replace("AAA",""),c=c.replace("BBB",'<div class="smart-kanban-column-content-columns has-tabs" role="presentation"></div>')):(c=c.replace("AAA"," no-sub-columns"),c=c.replace("BBB","")),d.className="smart-kanban-column",d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),s){const e=document.createElement("div"),t=`${i}Tab${a.dataField}`,r=`${i}Column${a.dataField}`;e.id=t,e.className="smart-kanban-tab smart-unselectable",l.disabled||l.unfocusable||(e.tabIndex=0),e.setAttribute("role","tab"),e.setAttribute("aria-controls",r),e.innerHTML=`<div class="smart-kanban-tab-label">${a.label}</div>`,e.columnElement=d,d.id=r,d.setAttribute("role","tabpanel"),d.setAttribute("aria-labelledby",t),d.tab=e,s.appendChild(e),a.selected?e.classList.add("selected"):d.classList.add("smart-hidden"),e.setAttribute("aria-selected",a.selected)}else c=l._getColumnHeader(a,n<e.length-1)+c,d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${i}ColumnHeaderLabel${a.dataField}`);if(d.innerHTML=c,d.siblingColumns=e,t.appendChild(d),d.column=a,d.index=n,l._columnToElement.set(a,d),a.columns){const e=d.querySelector(".smart-kanban-column-content-columns"),t=document.createElement("div");t.className="smart-kanban-tab-strip",t.setAttribute("role","tablist"),e.appendChild(t),l._createColumnElementsTabs(a.columns,e,e,t)}s||(a.collapsed?(d.classList.add("collapsed"),r.push("auto")):r.push("1fr"),o.push("1fr")),l._allColumns.push(a)})),!s){if(l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth),r.push(e)}else r.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=r.join(" "),a.fractions=o,l._columnContainers.push(a)}}_createColumnElementsSwimlanes(e,t,a){const s=this,l=s.id,i=s.swimlanes,r=[],o=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`${s._getColumnHeader(a,n<e.length-1)}\n <div class="smart-kanban-column-content no-sub-columns" role="presentation"></div>`;d.className="smart-kanban-column",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${l}ColumnHeaderLabel${a.dataField}`),d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),d.innerHTML=c,d.siblingColumns=e;const u=d.children[1];let m="";if(s._hasSwimlane(n)){let e=[];for(let t=0;t<i.length;t++)m+=`<smart-scroll-viewer class="smart-kanban-column-content-tasks" swimlane="${i[t].dataField}"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`,e.push("1fr");d.classList.add("has-swimlane"),u.classList.add("has-swimlane"),u.style.gridTemplateRows=e.join(" ")}else m=`<smart-scroll-viewer class="smart-kanban-column-content-tasks"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`;u.innerHTML=m,t.appendChild(d),d.column=a,d.index=n,s._columnToElement.set(a,d),a.collapsed?(d.classList.add("collapsed"),r.push("auto")):r.push("1fr"),o.push("1fr"),s._allColumns.push(a)})),s.addNewColumn)if(s._appendAddNewColumn(t),s.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(s.addNewColumnWidth?s.addNewColumnWidth:s.columnWidth),r.push(e)}else r.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=r.join(" "),a.fractions=o,s._columnContainers.push(a)}_getColumnSummary(e){const t=this.getColumnDataItems(e.dataField);return this.columnSummary&&t.length?" ("+t.length+")":""}_getColumnHeaderTemplate(e,t){const a=e.headerTemplate||this.columnHeaderTemplate;if(a){const s=document.createElement("div");let l;if("string"==typeof a&&a.startsWith("#")?l=document.querySelector(a):"string"==typeof a&&(l=a),"function"==typeof a){const s=a(e,t);return s||t}if(l instanceof HTMLTemplateElement){s.appendChild(l.content.cloneNode(!0));const t=/{{\w+}}/g;let a=s.innerHTML;const i=t.exec(a);for(let t=0;t<i.length;t++){const t=e[i[0].replace("{{","").replace("}}","")];a=a.replace(i[0],t)}return a}return l instanceof HTMLElement?s.appendChild(l):s.innerHTML=l,s.innerHTML}return null}_getColumnHeader(e,t,a=1){const s=this,l=s._tabindex,i=e.collapsed?s.localize("expand"):s.localize("collapse"),r=s.localize("addNewTask"),o=s.allowColumnEdit||s.allowColumnRemove||s.allowColumnHide?"settings":"",n=s.localize("customizeColumn");let d=e.label;""===d&&(d="&nbsp;");const c=s._getColumnSummary(e);let u=`<span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span>`,m="smart-kanban-column-header-label";if(void 0!==e.color){if(e.color){const t=new Smart.Color(e.color).getInvertedColor();u=`<div class="heading" style="background: ${e.color}; color: ${t};"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`}else u=`<div class="heading"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`;m+=" pill"}const p=null!==s.columnHeaderTemplate||e.headerTemplate?s._getColumnHeaderTemplate(e,u):u,h="bottom"===s.addNewButtonDisplayMode?"":"add-new-button";return`<div status="${e.dataField}" ${o} ${h} class="smart-kanban-column-header smart-unselectable"${l} role="heading" aria-level=${a}>\n <div title="${r}" class="smart-kanban-column-header-add ${h}"${l} role="button" aria-label="Add new task"></div>\n <div id="${s.id}ColumnHeaderLabel${e.dataField}" class="${m}">${p}</div>\n <div title="${i}" class="smart-kanban-column-header-toggle-button smart-arrow smart-arrow-${t?"left":"right"}" role="button" aria-hidden="true"></div>\n <div title="${n}" class="smart-kanban-column-actions smart-kanban-column-header-settings-button" role="button" aria-haspopup="menu" aria-label="Open actions list" aria-hidden="true"></div>\n </div>`}_hasSwimlane(e){const t=this;if(0===t.swimlanes.length)return!1;const a=t.swimlanesFrom;let s=t.swimlanesTo;return null===s&&(s=t.columns.length-1),e>=a&&e<=s}_updateColumnWidths(e,t){const a=this;if(!e&&!t)return void a._columnContainers.forEach((e=>a._updateColumnWidths(e.children[0].siblingColumns,e)));const s=t.fractions,l=[];let i=0,r=0;for(let t=0;t<e.length;t++){const o=e[t];!1!==o.visible&&(l.push(e[t].collapsed?"auto":s[i++]),!o.collapsed&&a.columnWidth&&(r+=o.width?o.width:a.columnWidth))}if(t===a.$.body&&a.addNewColumn)if(a.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(a.addNewColumnWidth?a.addNewColumnWidth:a.columnWidth),l.push(e)}else l.push("var(--smart-kanban-add-new-column-width)");r<a.offsetWidth&&a.columnWidth&&l.push("1fr"),t.style.gridTemplateColumns=l.join(" "),a.columnWidth&&a.$.scrollViewer.refresh()}_validateColumnArgument(e){if(!isNaN(e))return this.columns[e];const t=this._allColumns;return"string"==typeof e?t.find((t=>t.dataField===e)):"object"==typeof e?t.find((t=>t===e)):null}_resizeHandler(){this.$.scrollViewer&&(this.$.scrollViewer.scrollLeft=0),this.refresh("resize")}refresh(e){const t=this;"resize"===e?(clearTimeout(t._resizeTimeout),t._resizeTimeout=setTimeout((function(){t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}),50),t._handleSwimlanes(!0)):(t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t._closeList(t._priorityList,"_prioritySelectionFor"),t._resetFields=!0,t._render()),t.$.scrollViewer.refresh()}_refreshScrollViewer(e,t){const a=this,s=e instanceof HTMLElement?e:this._columnToElement.get(e);function l(l,i){if(!t&&l&&l.$.scrollViewerContentContainer&&""===l.$.scrollViewerContentContainer.innerHTML.trim())return a.virtualization&&a._refreshScrollHeight(l,e.dataField),void a._refreshEmptyColumnState(l);if(e.collapsed?l.toRefresh=!0:(delete l.toRefresh,requestAnimationFrame((()=>{if(l.isReady&&l.refresh(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField);0===i&&"horizontal"===e.orientation&&(a.columnWidth||(l.$.content.offsetWidth<=2*a._kanbanTaskMinWidth+a._dataViewPadding?s.setAttribute("orientation","vertical"):"vertical"===s.getAttribute("orientation")&&s.setAttribute("orientation","horizontal")))}))),a._refreshButtonsAndSummaries(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField)}e instanceof Smart.ScrollViewer?l(e):this.swimlanes.length>0?Array.from(s.querySelectorAll("smart-scroll-viewer")).forEach(((e,t)=>l(e,t))):l(s.querySelector("smart-scroll-viewer"),0)}_containerDownHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,s=a.closest(".smart-kanban-task");if(delete t._preventSelection,t.allowColumnReorder){const l=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button");if(!s&&l&&!t._columnEditing){const s=a.closest(".smart-kanban-column");if(s){const a=e.originalEvent.composedPath();let l=0;for(let e=0;e<a.length;e++)a[e].classList&&a[e].classList.contains("smart-kanban-column")&&l++;s.column.reorder&&l<=1&&(t._columnDragDetails={x:e.pageX,y:e.pageY,event:e,kanbanColumn:s})}}}const l=a.closest(".smart-kanban-column"),i=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button"),r=l?l.column:null;if(r){if(i&&t.$.fireEvent("columnClick",{column:r}),new Date-t._clickTime<=300)return!s&&i&&!t._columnEditing&&t.allowColumnEdit&&(t._columnDragDetails=null,!1===r.collapsed&&r.editable&&"menu"!==t.columnEditMode&&t._handleColumnEditing(r.dataField)),void(i&&(r.collapsed?t.expand(r):(!t.allowColumnEdit||t.allowColumnEdit&&"menu"===t.columnEditMode)&&t.collapse(r),t.$.fireEvent("columnDoubleClick",{column:r})));t._clickTime=new Date}if(s&&3!==e.which){if(!s.data)return;if(t.taskSubTasksInput&&a.classList.contains("smart-kanban-task-input"))return;t.virtualization?(t.focusTask(s.data.id),t._refreshColumns()):t._focusTask(s),t._startDragging(s,e)}}_containerKeydownHandler(e){const t=this;if(t._dragDetails)return;const a=e.key,s=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;function l(a=s){delete t._preventSelection,t._documentUpHandler({originalEvent:{target:a}}),t._containerClickHandler({target:a,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey}),e.preventDefault()}if(s.closest(".smart-kanban-column, .smart-kanban-add-new-column"))return s.classList.contains("smart-kanban-column-content-tasks")?void t._selectViaKeyboard(s.$.content,e,l):void("Enter"!==a&&" "!==a||s instanceof HTMLInputElement!=0||l());if(t.$.headerDropDown.contains(s))"Escape"===a&&(t.closePanel(),t.$[/\s?([a-z]+)-panel/g.exec(t.$.headerDropDown.className)[1]+"Button"].focus());else if(!(s.classList.contains("smart-data-view-header-button")||s.closest(".smart-data-view-search-box")||s.classList.contains("remove-button"))||"Enter"!==a&&" "!==a||l(),s.classList.contains("smart-kanban-list")){const i=s;switch(a){case"ArrowDown":t._selectListItem(t._getNextItem(i));break;case"ArrowUp":t._selectListItem(t._getPrevItem(i));break;case"Home":t._selectListItem(t._getFirstItem(i));break;case"End":t._selectListItem(t._getLastItem(i));break;case"Escape":i.openedFrom.focus(),t._closeList(i,i===t._actionsList?"_actionSelectionFor":i===t._commentsList?"_commentSelectionFor":"_userSelectionFor"),i===t._columnActionsList&&t._closeList(t._columnActionsList,"_columnActionSelectionFor");break;case"Enter":case" ":{const e=t._getSelectedItem(i);e&&l(e);break}default:return}e.preventDefault()}}getTaskIndex(e){const t=this,a=t.getTask(e);if(!a)return-1;const s=a[t.dataSourceMap.status];return t._getTasksByDataField(s).findIndex((t=>{if(t.id===e)return!0}))}_getNextPrevColumn(e,t){const a=this;let s=null;return a._allColumns.forEach(((l,i)=>{if(l.dataField===e)if(t){if(i<a._allColumns.length-1)return s=a._allColumns[i+1],!0}else if(i>0)return s=a._allColumns[i-1],!0})),s}focusTask(e){const t=this;t._focusedTask=e,t.ensureVisible(e),t._refreshColumns()}_selectViaKeyboard(e,t,a){const s=this;let l=t.key;s.rightToLeft&&("ArrowRight"===l?l="ArrowLeft":"ArrowLeft"===l&&(l="ArrowRight"));const i=s._focusedTask,r=s.getTask(i);if(!r)return;const o=r[s.dataSourceMap.status],n=s._getTasksByDataField(o),d=s.getTaskIndex(i);switch(l){case"ArrowRight":{const e=s._getNextPrevColumn(o,!0);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e),a=t.querySelector(".smart-kanban-task");s._focusTask(a),t.focus()}break}case"ArrowLeft":{const e=s._getNextPrevColumn(o,!1);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e).querySelector(".smart-kanban-task");s._focusTask(t)}break}case"ArrowDown":if(s.virtualization)d<n.length-1&&s.focusTask(n[d+1].id);else{const e=s.getColumn(o),t=s._columnToElement.get(e);s._focusTask(s._getNextItem(t,!0))}break;case"ArrowUp":if(s.virtualization)d>0&&s.focusTask(n[d-1].id);else{const e=s.getColumn(o),t=s._columnToElement.get(e);s._focusTask(s._getPrevItem(t,!0))}break;case"Home":s.virtualization?s.focusTask(n[0].id):s._focusTask(s._getFirstItem(e));break;case"End":s.virtualization?s.focusTask(n[n.length-1].id):s._focusTask(s._getLastItem(e));break;case"Enter":case" ":case"F2":case"Delete":{const e=s.querySelector("[focus]");e&&("F2"===l||"Enter"===l?s.beginEdit(e):"Delete"===l?s.removeTask(e,!0):a(e));break}default:return}t.preventDefault()}_getFirstItem(e){const t=e.children;for(let e=0;e<t.length;e++){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getLastItem(e){const t=e.children;for(let e=t.length-1;e>=0;e--){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getPrevItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.previousElementSibling:this._getLastItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.previousElementSibling}}_getNextItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.nextElementSibling:this._getFirstItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.nextElementSibling}}_getSelectedItem(e,t){return e?t?e.querySelector("[focus]"):e.querySelector(".selected"):null}_selectListItem(e){if(!e)return;const t=e.parentElement,a=t.querySelector(".selected");a&&(a.classList.remove("selected"),a.removeAttribute("aria-selected")),e.classList.add("selected"),e.setAttribute("aria-selected",!0),t.scrollTop=e.offsetTop}_focusTask(e){if(!e)return;const t=this;t._isMobile||(Array.from(t.querySelectorAll("[focus]")).forEach((e=>e.removeAttribute("focus"))),e.setAttribute("focus",""),this._focusedTask=e.data.id,t.virtualization?t.ensureVisible(t._focusedTask):this.ensureVisible(e))}_setFocusable(){const e=this,t=e.$.container,a=e.disabled||e.unfocusable;let s=[e.$.customizeButton,e.$.filterButton,e.$.sortButton,e.$.searchButton,e.$.searchPrev,e.$.searchNext,e.$.searchClose,e._actionsList,e._userList];if(s=s.concat(Array.from(t.querySelectorAll(".smart-kanban-column-header, .smart-kanban-column-header-add, .smart-kanban-tab, .smart-kanban-column-content-tasks, .smart-kanban-task-user, .smart-kanban-task-actions, .smart-kanban-task-comments, .smart-kanban-add-new-column"))),s.forEach((e=>{a?e.removeAttribute("tabindex"):(null===e.getAttribute("tabindex")||e.getAttribute("tabindex")<0)&&e.setAttribute("tabindex",0)})),e._dialog&&e._dialog.editPanelPopulated){const t=Array.from(e._dialog.$.container.querySelectorAll(".text-editor, .new-subtask"));a?t.forEach((e=>e.tabIndex=-1)):t.forEach((e=>e.removeAttribute("tabindex"))),Array.from(e._dialog.$.container.querySelectorAll(".smart-element.editor, smart-button.add, smart-button.ok, smart-button.cancel")).forEach((e=>e.unfocusable=a)),e._dialog.unfocusable=a}}_startDragging(e,t){const a=this;if(!a._currentUser.allowDrag)return;if(a._isMobile)return;const s=e.closest("smart-scroll-viewer"),l=e.getBoundingClientRect();let i=e.hasAttribute("selected")?Array.from(e.parentElement.querySelectorAll("[selected]")):[e],r=i.map((e=>e.data));a._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:i,ItemsData:r,ItemData:e.data,Item:e,FeedbackShown:!1,OriginalEvent:t,Column:e.classList.contains("smart-kanban-column")?e:null,PointerOffset:[l.x-t.clientX,l.y-t.clientY],ScrollViewer:s,StartTime:new Date,Dragging:!0},Smart.Kanban.kanbanTaskDragged=!0,s&&s._scrollView&&(s._scrollView.disableSwipeScroll=!0),a.allowDrop&&(Smart.Kanban.hoveredKanban=a,Smart.Kanban.hoveredItem=e)}_documentMoveHandler(e){const t=this,a=t._dragDetails;function s(){delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,a.ScrollViewer._scrollView.disableSwipeScroll=!1}if(t.allowColumnReorder&&t._columnDragDetails&&(Math.abs(e.pageX-t._columnDragDetails.x)>=3||Math.abs(e.pageY-t._columnDragDetails.y)>=3)&&(t._startDragging(t._columnDragDetails.kanbanColumn,t._columnDragDetails.event),t._columnDragDetails=null),!a)return;if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,i=Math.abs(a.StartPosition.left-e.pageX)>5||Math.abs(a.StartPosition.top-e.pageY)>5;if(!i||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&i&&!l&&s());if(t.$.fireEvent("dragStart",{item:a.Item,items:a.Items,data:a,container:t,previousContainer:t,originalEvent:a.OriginalEvent}).defaultPrevented)return void s();t.closePanel(),t._hideBodyOverflow(),a.Feedback=t._addDragFeedback(),a.FeedbackShown=!0,a.Items.forEach((e=>e.classList.add("dragged")))}const l=a=>{a.scrollWidth&&(t._autoScrollDragInterval&&clearInterval(t._autoScrollDragInterval),t._autoScrollDragInterval=setInterval((function(){const t=a.getBoundingClientRect();e.clientX<=t.left+20?a.scrollLeft-=15:e.clientX>=t.left+t.width-20&&(a.scrollLeft+=15)}),25))};Smart.Kanban.hoveredKanban?l(Smart.Kanban.hoveredKanban.$.scrollViewer):l(t.$.scrollViewer);let i,r=t.dragOffset;if(r="auto"!==r&&Array.isArray(r)?r:a.PointerOffset,t.$.fireEvent("dragging",{item:a.Item,items:a.Items,data:a,originalEvent:e}),a.Feedback.style.left=e.pageX+(r[0]||0)+"px",a.Feedback.style.top=e.pageY+(r[1]||0)+"px",Smart.Kanban.hoveredKanban&&(clearInterval(Smart.Kanban.hoveredKanban._dragInterval),delete Smart.Kanban.hoveredKanban),Smart.Kanban.hoveredItem&&(Smart.Kanban.hoveredItem.classList.remove("drop-target"),Smart.Kanban.hoveredItem.classList.remove("before","after"),delete Smart.Kanban.hoveredItem),i=t._isMobile?(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY):t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,!i)return;const o=(t.shadowRoot?i.getRootNode().host:i).closest("smart-kanban");if(!o||!o.allowDrop)return;const n=i.closest(".smart-kanban-column-content-tasks");if(Smart.Kanban.hoveredKanban=o,a.Column)return void t._handleColumnDragging(e);if(!n)return;const d=n.parentElement.parentElement.getAttribute("orientation"),c=Array.from(n.$.content.children);let u=0;if(c.forEach((e=>e.filteredOut&&u++)),0===c.length||c.length===u)return Smart.Kanban.hoveredItem=n.$.scrollViewerContainer,void Smart.Kanban.hoveredItem.classList.add("drop-target");n.scrollHeight>0&&(o._dragInterval=setInterval((function(){const a=n.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientY>=a.top&&e.clientY<=a.top+20?n.scrollTop-=t._autoScrollCoefficient:e.clientY>=a.top+a.height-20&&e.clientY<=a.top+a.height?n.scrollTop+=t._autoScrollCoefficient:clearInterval(o._dragInterval):clearInterval(o._dragInterval)}),2));let m=i.closest(".smart-kanban-task");if(m&&-1===a.Items.indexOf(m)){const t=m.getBoundingClientRect();"vertical"===d&&e.clientY-t.top<=t.height/2||"horizontal"===d&&e.clientX-t.left<=t.width/2?m.classList.add("before"):m.classList.add("after")}else{if(m&&1===c.length)return;m=m&&1===a.Items.length?t[`_${d}ClosestTaskToHover`]([m.previousElementSibling,m.nextElementSibling],e,!0):t[`_${d}ClosestTaskToHover`](c,e,m||i===n.$.content)}m&&(m.classList.add("drop-target"),Smart.Kanban.hoveredItem=m)}_handleColumnDragging(e){const t=this.querySelectorAll(".smart-kanban-column");let a;for(let s=0;s<t.length;s++){const l=t[s],i=l.getBoundingClientRect();e.clientX>=i.left&&e.clientX<=i.right&&e.clientY>=i.top&&e.clientY<=i.bottom&&(a=l)}if(a){const s=a.getBoundingClientRect();e.clientX-s.left<=s.width&&(a.classList.add("before"),a.classList.add("drop-target")),e.clientX-s.left>=s.width/2&&a===t[t.length-1]&&(a.classList.remove("before"),a.classList.add("after"),a.classList.add("drop-target")),Smart.Kanban.hoveredItem=a}}_hideBodyOverflow(){const e=this,t=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,a=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth,s=e.isInShadowDOM?e.getRootNode().host:document.body;e._originalBodyOverflow={overflowX:s.style.overflowX,overflowY:s.style.overflowY,overflow:s.style.overflow},s.classList.add("smart-dragging"),s.style.overflow=s.style.overflowX=s.style.overflowY="",t&&!a?s.style.overflowX="hidden":a&&!t?s.style.overflowY="hidden":a||t||(s.style.overflow="hidden")}_verticalClosestTaskToHover(e,t,a){const s=this._dragDetails.Items,l=t.clientY;let i,r,o=1/0,n=0,d=e.length-1,c=1;for(a||(n=d,d=0,c=-1);n!==d+c;){const t=e[n];if(n+=c,!t||t.filteredOut||-1!==s.indexOf(t))continue;if(!a){i=t,r="after";break}const d=t.getBoundingClientRect(),u=d.top+d.height/2,m=Math.abs(l-u);if(!(m<o))break;o=m,i=t,r=l<=u?"before":"after"}return i&&i.classList.add(r),i}_horizontalClosestTaskToHover(e,t){const a=this._dragDetails.Items,s=t.clientY,l=t.clientX;let i,r,o;return e.forEach((e=>{if(!e||e.filteredOut||-1!==a.indexOf(e))return;const t=e.getBoundingClientRect(),n=Math.abs(s-t.top),d=Math.abs(s-t.bottom),c=Math.min(n,d),u=Math.abs(l-t.left),m=Math.abs(l-t.right),p=Math.min(u,m),h=Math.sqrt(Math.pow(p,2)+Math.pow(c,2));(void 0===r||h<r)&&(i=e,r=h,o=u<m?"before":"after")})),i&&i.classList.add(o),i}_scrollViewerTouchmoveHandler(e){const t=this;t._dragDetails&&(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target).closest("smart-scroll-viewer")&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_documentUpHandler(e){const t=this,a=t._dragDetails;if(t._columnDragDetails=null,t.$.container.hasAttribute("modal"))return;const s=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.header;if(t._userSelectionFor&&!t._userList.contains(s)&&t._closeList(t._userList,"_userSelectionFor"),t._prioritySelectionFor&&!t._priorityList.contains(s)&&t._closeList(t._priorityList,"_prioritySelectionFor"),t._actionSelectionFor&&!t._actionsList.contains(s)&&t._closeList(t._actionsList,"_actionSelectionFor"),t._columnActionSelectionFor&&!t._columnActionsList.contains(s)&&(t._columnActionsList.classList.contains("smart-visibility-hidden")||(t._closeList(t._columnActionsList,"_columnActionSelectionFor"),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),t._columnActionsListDate=new Date)),t._commentSelectionFor){const e=t._commentsList;(t.shadowRoot||t.getRootNode()).activeElement!==e.textarea&&(t._actionSelectionFor||e.contains(s)?!e.classList.contains("expanded")||s===e.textarea||e.button.contains(s)||s.classList.contains("remove-button")||e.classList.remove("expanded"):t._closeList(e,"_commentSelectionFor"))}if(!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||s!==l&&l.contains(s))){const e=s.closest("smart-scroll-viewer"),a=s.closest(".smart-drop-down");e&&l.contains(e.ownerElement)||a&&(!a.ownerElement||l.contains(a.ownerElement))||t.closePanel()}if(!a)return;const i=Smart.Kanban.hoveredKanban,r=Smart.Kanban.hoveredItem;t._dragDetails&&e.originalEvent.preventDefault(),delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,delete Smart.Kanban.dropOverTask,delete Smart.Kanban.isBefore;let o=!1;if(document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.classList.remove("smart-kanban-task-placeholder"),e.style.marginTop=e.style.marginBottom="0px",o=!0})),o&&t._refreshButtonsAndSummaries(),a.ScrollViewer&&a.ScrollViewer._scrollView&&(a.ScrollViewer._scrollView.disableSwipeScroll=!1),!a.FeedbackShown)return;const n=i||(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY);t._preventSelection=!0;const d=t.isInShadowDOM?t.getRootNode().host:document.body;d.classList.remove("smart-dragging"),d.style.overflow=t._originalBodyOverflow.overflow,d.style.eoverflowX=t._originalBodyOverflow.overflowX,d.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,a.Feedback.remove(),i&&clearInterval(i._dragInterval);const c=a.Item,u=a.Items;if(u.forEach((e=>e.classList.remove("dragged"))),!n)return;if(!r)return void t.$.fireEvent("dragEnd",{item:c,items:u,target:n,data:a,previousContainer:t,container:n,originalEvent:e});if(!i||!i.allowDrop||i.disabled)return;let m=!1;if(r.classList.remove("drop-target"),r.classList.contains("before")?r.classList.remove("before"):r.classList.contains("after")&&(r.classList.remove("after"),m=!0),a.DropDetails={item:r,after:m},t.$.fireEvent("dragEnd",{item:c,items:u,target:r,data:a,previousContainer:t,container:i,originalEvent:e}).defaultPrevented)return;function p(e,s){t._requestVirtualDataSource("update",Object.assign({},e.data,{status:s}),(function(s){return s&&t._moveDraggedItems(Object.assign({},a,{Item:e,Items:[e]})),s}))}const h=r.closest(".smart-kanban-column"),g=h.column.dataField;if(a.Column){const e=()=>Array.from(h.parentElement.querySelectorAll(".smart-kanban-column")).filter((e=>e.parentElement===h.parentElement)),s=e().indexOf(a.Column);a.DropDetails.after?h.parentElement.appendChild(a.Column):h.parentElement.insertBefore(a.Column,h);const l=e().indexOf(a.Column),i=[],r=e();for(let e=0;e<r.length;e++)r[e].column&&!r[e].classList.contains("smart-kanban-add-new-column")&&i.push(r[e].column);return t.columns=i,t.$.fireEvent("columnReorder",{column:a.Column.column,oldIndex:s,index:l}),t._reset(),void t._createAddNewButton()}if(c&&c.data&&g!==c.data[t.dataSourceMap.status]){const e=Object.assign({},c.data);e[t.dataSourceMap.status]=g;const a=t.getColumn(g);a&&(e.statusLabel=a.label);const s=t.getColumn(c.data[t.dataSourceMap.status]);s&&(c.data.statusLabel=s.label);const l=JSON.parse(JSON.stringify(e)),i=JSON.parse(JSON.stringify(c.data));if(t.$.fireEvent("change",{task:c,id:l.id,value:l,oldValue:i}),t._currentUser.info){const e=t.dataSourceMap;c.data[e.updatedUserId]=t._currentUser.info.id,c.data[e.updatedDate]=new Date,t.addHistory(c.data,{action:"moved",user:t._currentUser.info.id,details:{id:c.data[e.id],oldValue:i[e.status],value:l[e.status]},label:c.data[e.text],date:c.data[e.updatedDate]}),l.history=c.data.history}t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:i})}if(t.dataSource&&t.dataSource.virtualDataSource&&g!==c.data[t.dataSourceMap.status])if(m)for(let e=u.length-1;e>=0;e--)p(u[e],g);else for(const e of u)p(e,g);else if(t._moveDraggedItems(a),c&&c.data){const e=Object.assign({},c.data),a=JSON.parse(JSON.stringify(e));t.$.fireEvent("taskReorder",{id:a.id,value:a})}}_refreshButtonsAndSummaries(){const e=this;e._refreshColumnHeights(),e.addNewButtons&&(e.addNewButtons.forEach((e=>{e.refresh()})),e._refreshSummaries())}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=e._dragDetails.Items.length,s=document.createElement("div"),l=t.offsetWidth+"px",i=t.offsetHeight+"px";let r=t.cloneNode(!0);if(r.style.width=l,r.style.height=i,t.classList.contains("smart-kanban-column")){r=document.createElement("smart-kanban");const a=Object.assign({},t.column);a.collapsed=!1;const i=[a];r.columns=i,r.dataSource=e.dataSource,r.users=e.users,r.taskActions=e.taskActions,r.taskDue=e.taskDue,r.taskProgress=e.taskProgress,r.style.height="100%",r.style.width=l,r.style.minWidth="250px",s.setAttribute("column-drag","")}if(s.className="smart-kanban-feedback",s.setAttribute("parent-kanban-id",e.id),e.theme&&s.setAttribute("theme",e.theme),["rightToLeft","taskActions","taskComments","taskDue","taskPriority","taskProgress","taskTags","taskUserIcon"].forEach((t=>{e[t]&&s.setAttribute(Smart.Utilities.Core.toDash(t),"")})),s.appendChild(r),a>1){const e=document.createElement("div");e.style.width=l,e.style.height=i,e.className="smart-kanban-feedback-additional",s.insertBefore(e,r),r.setAttribute("num",a),a>2&&e.classList.add("multiple")}return e.getShadowRootOrBody().appendChild(s),s}_moveDraggedItems(e){const t=this,a=t.dataSourceMap;let s,l=e.DropDetails,i=l.item,r=i.closest(".smart-kanban-column"),o=e.Item.closest("smart-scroll-viewer"),n=r.column;if(i.classList.contains("smart-kanban-task")?(s=i.parentElement,l.after&&(i=i.nextElementSibling,i&&i.classList.contains("smart-hidden")&&(i=null)),e.Items.forEach(((l,r)=>{if(t.virtualization){const s=e.ItemsData[r],o=s[a.status],d=t._getTasksByDataField(o),c=d.findIndex((e=>e.id===s.id));if(i){if(i.data!==l.data){d.splice(c,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(i.data);e.splice(a,0,s)}}else c>=0&&(d.splice(c,1),t._getTasksByDataField(n.dataField).push(s))}else{s.insertBefore(l,i);const o=e.ItemsData[r],d=o[a.status],c=t._getTasksByDataField(d),u=c.findIndex((e=>e.id===o.id));if(i){if(i.data!==l.data){c.splice(u,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(i.data);e.splice(a,0,o)}}else u>=0&&(c.splice(u,1),t._getTasksByDataField(n.dataField).push(o))}l.data[a.status]=n.dataField,l.data.statusLabel=n.label,l.column=n}))):(s=i.firstElementChild,e.Items.forEach((e=>{if(t.virtualization){const s=e.data[a.status],l=t._getTasksByDataField(s),i=l.findIndex((t=>t.id===e.data.id));l.splice(i,1),t._getTasksByDataField(n.dataField).push(e.data)}else{s.appendChild(e);const l=e.data[a.status],i=t._getTasksByDataField(l),r=i.findIndex((t=>t.id===e.data.id));i.splice(r,1),t._getTasksByDataField(n.dataField).push(e.data)}e.data[a.status]=n.dataField,e.data.statusLabel=n.label,e.column=n}))),s=s.closest("smart-scroll-viewer"),t.swimlanes.length>0){const t=s.getAttribute("swimlane");t?e.Items.forEach((e=>e.data[a.swimlane]=t)):e.Items.forEach((e=>delete e.data[a.swimlane]))}t.virtualization?(t._refreshColumns(),t.focusTask(e.ItemData.id)):t._focusTask(e.Item),o!==s?(s.focus(),t.textTemplate&&e.Items.forEach((e=>t._renderTask(e))),e.Item.hasAttribute("selected")&&(e.Items.forEach((e=>e.removeAttribute("selected"))),t._selectedTasks=[],t._autoSaveState("selection")),t._refreshScrollViewer(o,!0),t._refreshScrollViewer(s,!0)):t.virtualization&&t._refreshScrollViewer(o,!0),t._refreshSummaries(),t._autoSaveState("dataSource")}_getCurrentDataSource(){const e=Array.from(this.$.container.getElementsByClassName("smart-kanban-task")),t=[],a=this;if(a.virtualization){const e=Object.keys(a.tasksByDataField);let t=[];for(let s=0;s<e.length;s++){const l=e[s];let i=a._getTasksByDataField(l);t=[...t,...i]}return t}for(let a=0;a<e.length;a++)t.push(e[a].data);return t}_validateTaskArgument(e){const t=this;return e instanceof HTMLElement&&t.$.container.contains(e)&&e.classList.contains("smart-kanban-task")?e:null===e||"number"!=typeof e&&"string"!=typeof e?null!==e&&"object"==typeof e&&void 0!==e.id?t.$.container.querySelector(`.smart-kanban-task[data-id="${e.id}"]`):void 0:t.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`)}_openDialog(e,t,a="task"){const s=this,l={purpose:t};if(l[a]=e,s.$.fireEvent("opening",l).defaultPrevented)return;if(s.disableDialog)return;s._dialog||s._createDialog();const i=s._dialog,r="prompt"===t;i.refreshFieldsDirty=!0,i.openedFrom=(s.shadowRoot||s.getRootNode()).activeElement,i.classList.toggle("prompt",r),i.classList.toggle("edit",!r),i.style.top="",i.style.left="",i.style.width="",i.style.height="auto","edit"!==t||!s.readonly&&s._currentUser.allowEdit?i.removeAttribute("readonly"):i.setAttribute("readonly",""),s.offsetWidth<600&&(i.style.top="0px",i.style.left="0px",i.style.width="100%",i.style.height="100%");const o=e=>{s.applyColumnColorToTasks&&(e&&e.color?(i.style.setProperty("--smart-primary",e.color),i.style.setProperty("--smart-ui-state-active",e.color)):(i.style.setProperty("--smart-primary",""),i.style.setProperty("--smart-ui-state-active","")))};if(e&&e.column?o(e.column):"add"===t&&o(e),i.taskOrComment=e,"edit"===t?s._currentUser&&s._currentUser.allowRemove&&i.querySelector(".delete").classList.remove("smart-hidden"):i.querySelector(".delete").classList.add("smart-hidden"),i.editPanelPopulated&&(i.selectTab(0),i.editors.historyTab&&i.editors.historyTab.classList.add("smart-hidden")),r){let t="task"===a?s.localize("promptTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("promptComment"),l="task"===a?s.localize("removeTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("removeComment");"column"===a&&(t=s.localize("promptColumn"),l=s.localize("removeColumn")),i.label=l,i.setAttribute("aria-label",t),i.$.container.querySelector(".prompt").innerHTML=t}else{let a=!0;i.removeAttribute("aria-label"),i.headerPosition="top",i.editPanelPopulated||(s._initEditPanel(),a=!1),"edit"===t?s._beginEdit(e):"add"===t&&(i.label=s.localize("addNewTask"),delete i.taskOrComment,a&&s._clearEditors(),s._showHideDialogEditors(),i.refreshTabs(!1),i.selectTab(0),i.editors.status.selectedValues=[e.dataField],0===s.swimlanes.length?(i.editors.swimlane.classList.add("smart-hidden"),i.editors.swimlaneLabel.classList.add("smart-hidden"),i.editors.swimlane.parentElement.classList.add("single-column")):(i.editors.swimlane.classList.remove("smart-hidden"),i.editors.swimlaneLabel.classList.remove("smart-hidden"),i.editors.swimlane.parentElement.classList.remove("single-column")),i.editors.created.parentElement.classList.add("smart-hidden"),i.editors.updated.parentElement.classList.add("smart-hidden"))}s.$.container.setAttribute("modal","");const n=s.offset(s);s.offsetWidth>600&&(i.offsetHeight>s.offsetHeight?i.style.top=s.getBoundingClientRect().top+"px":i.style.top=n.top+s.offsetHeight/2-i.offsetHeight/2+"px",i.offsetWidth>s.offsetWidth?i.style.left=s.getBoundingClientRect().left+"px":i.style.left=n.left+s.offsetWidth/2-i.offsetWidth/2+"px"),s.dialogCustomizationFunction&&s.dialogCustomizationFunction(i,e,i.editors,i.labels,t,a),i.open()}_createDialog(){const e=this,t=document.createElement("smart-window"),a=document.createElement("template"),s=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;a.innerHTML=`<smart-button class="ok primary"${s}><span class="smart-icon"></span>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${s}><span class="smart-icon"></span>${e.localize("cancel")}</smart-button><smart-button class="smart-hidden delete secondary"${s}><span class="smart-icon"></span>${e.localize("delete")}</smart-button>`,t.animation=e.animation,t.footerTemplate=a,t.headerButtons=["close"],t.rightToLeft=e.rightToLeft,t.resizeMode="both",t.liveResize=!0,t.theme=e.theme,t.className="smart-kanban-window",t.innerHTML='<div class="prompt"></div>\n<div class="edit"></div>',t.ownerElement=e,e._dialog=t,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(t)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("open",e._dialogEventHandler),t.addEventListener("closing",e._dialogEventHandler),t.addEventListener("close",e._dialogEventHandler),t.addEventListener("click",e._dialogClickHandler),t.addEventListener("keydown",(e=>{if("Enter"===e.key){const e=t.querySelector(".ok"),a=t.querySelector('.smart-kanban-tab[view="details"]');a&&a.classList.contains("selected")&&(e.disabled||e.click())}}))}_dialogEventHandler(e){const t=this,a=t.ownerElement,s=e.type,l=a.context;(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target)===t&&(a.context=a,"open"===s?(a.$.fireEvent("open"),t.classList.contains("edit")&&(a.hasAnimation?t.addEventListener("transitionend",(function(){setTimeout((()=>{!a.readonly&&a._currentUser.allowEdit&&t.editors.text.focus()}),100)}),{once:!0}):requestAnimationFrame((()=>t.editors.text.focus())))):"closing"===s?a.$.fireEvent("closing").defaultPrevented&&(e.preventDefault(),delete t.ok):"close"===s&&(a.$.fireEvent("close"),a._dialogCloseHandler(e)),a.context=l)}_dialogClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.closest(".ok"))t.ok=!0,t.close();else if(a.closest(".cancel"))t.close();else if(a.closest(".delete"))t.ownerElement.removeTask(t.taskOrComment),t.close();else if(a.closest(".add")){const e=t.editors.newSubtask,a=e.value;if(""===a)return;const s=t.editors.checklist;s.insert(s.items.length,{label:a}),e.value="",t.$.content.scrollTop=t.$.content.scrollHeight-t.$.content.offsetHeight,t.refreshTabs()}else if(a.classList.contains("remove-subtask"))t.editors.checklist.removeChild(a.closest("smart-list-item")),t.refreshTabs();else if(a.classList.contains("remove-button")){const e=t.ownerElement,s=t.ownerElement.dataSourceMap,l=t.taskOrComment.data[s.comments],i=a.closest(".smart-comment").comment,r=JSON.parse(JSON.stringify(t.taskOrComment.data));t.taskOrComment.comment=i,t.taskOrComment.data[s.comments]=l.filter((e=>e!==t.taskOrComment.comment)),t.refreshComments();const o=JSON.parse(JSON.stringify(t.taskOrComment.data));e.$.fireEvent("change",{task:t.taskOrComment,id:o.id,value:o,oldValue:r}),e.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:r}),e.$.fireEvent("commentRemove",{id:o.id,value:t.taskOrComment.comment})}}_dialogCloseHandler(){const e=this,t=e.dataSourceMap,a=e._dialog;function s(s){const l=JSON.parse(JSON.stringify(s.data));a.taskOrComment.remove(),s.querySelector(".smart-kanban-task-comments").setAttribute("num",s.data[t.comments].length||""),e._commentsList.editing&&(e._commentsList.textarea.value="",delete e._commentsList.editing);const i=JSON.parse(JSON.stringify(s.data));e.$.fireEvent("change",{task:s,id:i.id,value:i,oldValue:l}),e.$.fireEvent("taskUpdate",{id:i.id,value:i,oldValue:l}),e.$.fireEvent("commentRemove",{id:i.id,value:a.taskOrComment.comment})}if(e.$.container.removeAttribute("modal"),a.ok){if(a.classList.contains("prompt")){const l=e._commentSelectionFor;if(l){const i=l.data;if(e.dataSource&&e.dataSource.virtualDataSource){const r=Object.assign({},i);r[t.comments]=r[t.comments].filter((e=>e!==a.taskOrComment.comment)),e._requestVirtualDataSource("update",r,(function(e){return e&&(l.data=r,s(l)),e}))}else i[t.comments]=i[t.comments].filter((e=>e!==a.taskOrComment.comment)),s(l)}else e._columnActionSelectionFor&&a.taskOrComment.dataField?e.removeColumn(a.taskOrComment.dataField):e.removeTask(a.taskOrComment)}else e._endEdit();delete a.ok}a.openedFrom&&requestAnimationFrame((()=>{e.getRootNode().contains(a.openedFrom)&&a.openedFrom.focus&&a.openedFrom.focus(),delete a.openedFrom})),delete a.taskOrComment}_closeDialog(){const e=this;e._dialog&&e._dialog.close()}_getHistoryItemLabel(e){const t=this;let a;switch(e.action){case"created":a=t.localize("taskCreated");break;case"tags":a=t.localize("taskTagsChanged");break;case"description":a=t.localize("taskDescriptionChanged");break;case"progress":a=t.localize("taskProgressChanged");break;case"text":a=t.localize("taskNameChanged");break;case"color":a=t.localize("taskColorChanged");break;case"priority":a=t.localize("taskPriorityChanged");break;case"deadline":a=t.localize("taskDeadlineChanged");break;case"subtasks":a=t.localize("taskSubtasksChanged");break;case"user":a=e.details.value?t.localize("taskUserChanged"):t.localize("taskUserRemoved");break;case"moved":a=t.localize("taskMoved");break;case"status":a=t.localize("taskStatusChanged");break;default:a=t.localize("taskUpdated")}return a}_initEditPanel(){const e=this,t=e.id,a=e._dialog,s=a.$.container.querySelector(".edit"),l=[""].concat(e.users.map((e=>({label:e.name,value:e.id,color:e.color,image:e.image})))),i=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))),r=e._getPriority(),o=e.swimlanes.map((e=>({label:e.label,value:e.dataField}))),n=document.createElement("template"),d=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;n.innerHTML=`<div class="smart-kanban-sub-task"><span class="label">{{label}}</span><span class="remove-subtask" aria-label="Remove subtask" title="${e.localize("removeSubtask")}"></span></div>`,n.id=e.id+"ChecklistTemplate",a.$.container.appendChild(n),s.innerHTML=`\n <div tabindex="0" class="smart-kanban-tab-strip">\n <div tabindex="0" view="details" class="selected smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("detailsTab")}</div></div>\n <div tabindex="0" view="subtasks" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("subtasksTab")}</div></div>\n <div tabindex="0" view="comments" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("commentsTab")}</div></div>\n <div tabindex="0" view="history" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("historyTab")}</div></div>\n <div tabindex="0" view="fields" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("fieldsTab")}</div></div>\n </div>\n <div class="smart-kanban-tab-content details">\n <div class="layout">\n <div class="column">\n <div id="${t}LabelText" class="editor-label">${e.localize("text")}</div>\n <smart-input class="editor text-editor" aria-labelledby="${t}LabelText"></smart-input>\n <div id="${t}LabelDescription" class="editor-label">${e.localize("description")}</div>\n <textarea class="editor description-editor" aria-labelledby="${t}LabelDescription"></textarea> \n <div id="${t}LabelStatus" class="editor-label">${e.localize("status")}</div>\n <smart-multi-combo-input single-select pills color-items class="editor status-editor" drop-down-open-position="auto" data-source='${JSON.stringify(i)}' drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelStatus"></smart-multi-combo-input>\n <div id="${t}LabelSwimlane" class="editor-label swimlane-label">${e.localize("swimlane")}</div>\n <smart-input class="editor swimlane-editor" drop-down-open-position="auto" data-source='${JSON.stringify(o)}'${0===o.length?" disabled":""} drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelSwimlane"></smart-input>\n </div>\n <div class="column">\n <div class="editor-container">\n <div id="${t}LabelAssignedTo" class="editor-label">${e.localize("assignedTo")}</div>\n <div id="${t}LabelProgress" class="editor-label">${e.localize("progress")}</div>\n <smart-multi-combo-input readonly pills class="editor asignee-editor" single-select data-source='${JSON.stringify(l)}'${0===l.length?" disabled":""} drop-down-button-position="right"${d} aria-labelledby="${t}LabelAssignedTo"></smart-multi-combo-input>\n <smart-numeric-text-box class="editor progress-editor" input-format="floatingPoint" min="0" max="100" show-unit unit="%"${d} aria-labelledby="${t}LabelProgress"></smart-numeric-text-box>\n </div>\n <div class="editor-container">\n <div id="${t}LabelStartDate" class="editor-label">${e.localize("startDate")}</div>\n <div id="${t}LabelDueDate" class="editor-label">${e.localize("dueDate")}</div>\n <smart-date-time-picker auto-close auto-open class="editor start-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelStartDate"></smart-date-time-picker>\n <smart-date-time-picker auto-close auto-open class="editor due-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelDueDate"></smart-date-time-picker>\n </div>\n <div class="editor-error-container smart-hidden" style="color: var(--smart-error);">\n <label id="${t}LabelRange">${e.localize("invalidRange",{start:e.localize("startDate"),end:e.localize("dueDate")})}</label>\n <br/> <br/>\n </div>\n <div class="editor-container">\n <div id="${t}LabelPriority" class="editor-label">${e.localize("priority")}</div>\n <div id="${t}LabelColor" class="editor-label">${e.localize("color")}</div>\n <div style="display: flex;"><span class="priority-editor-icon"></span><smart-input class="editor priority-editor" data-source='${JSON.stringify(r)}' drop-down-height="auto" drop-down-open-position="auto" drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelPriority"></smart-input></div>\n <smart-color-input value-display-mode="colorBox" class="editor color-editor" drop-down-open-position="auto" drop-down-button-position="right"${d} aria-labelledby="${t}LabelColor"></smart-color-input>\n </div>\n <div id="${t}LabelTags" class="editor-label">${e.localize("tags")}</div>\n <div aria-labelledby="${t}LabelTags">\n <smart-multi-combo-input color-items readonly pills class="editor tags-editor" drop-down-button-position="right" drop-down-open-position="auto" ${d} aria-labelledby="${t}LabelTags"></smart-multi-combo-input>\n <div class="smart-hidden editor empty-tags-label" id="${t}LabelEmptyTags" aria-labelledby="${t}LabelTags">${e.localize("emptyTags")}</div>\n </div>\n </div>\n </div>\n </div>\n <div class="smart-kanban-tab-content smart-hidden subtasks">\n <div id="${t}LabelChecklist" class="editor-label">${e.localize("checklist")}</div>\n <div class="new-container">\n <input type="text" class="new-subtask" placeholder="${e.localize("newSubtask")}" />\n <smart-button class="add primary" title="${e.localize("addSubtask")}" aria-label="Add subtask"${d}>+</smart-button>\n </div>\n <smart-list-box class="editor checklist-editor" item-template="${n.id}" selection-mode="checkBox"${d} aria-labelledby="${t}LabelChecklist"></smart-list-box>\n <br/>\n </div>\n <div class="smart-kanban-tab-content comments">\n </div>\n <div class="smart-kanban-tab-content smart-hidden history">\n <div class="editor-container">\n <div id="${t}LabelCreatedBy" class="editor-label">${e.localize("createdBy")}</div>\n <div id="${t}LabelCreatedByDate" class="editor-label">${e.localize("createdByDate")}</div>\n <div class="editor created" aria-labelledby="${t}LabelCreatedBy"></div>\n <div class="editor created-date" aria-labelledby="${t}LabelCreatedByDate"></div>\n </div>\n <div class="editor-container">\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedBy")}</div>\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedByDate")}</div>\n <div class="editor updated" aria-labelledby="${t}LabelUpdatedBy"></div>\n <div class="editor updated-date" aria-labelledby="${t}LabelUpdatedByDate"></div>\n </div>\n <div class="history-table smart-hidden editor-container">\n </div>\n </div>\n <div class="smart-kanban-tab-content fields">\n </div> \n<div class="template-container">\n</div>\n`,a.layout=s.querySelector(".layout"),a.editors={text:s.querySelector(".text-editor"),description:s.querySelector(".description-editor"),tags:s.querySelector(".tags-editor"),emptyTags:s.querySelector(".empty-tags-label"),userId:s.querySelector(".asignee-editor"),status:s.querySelector(".status-editor"),swimlane:s.querySelector(".swimlane-editor"),swimlaneLabel:s.querySelector(".swimlane-label"),startDate:s.querySelector(".start-date-editor"),dueDate:s.querySelector(".due-date-editor"),progress:s.querySelector(".progress-editor"),priority:s.querySelector(".priority-editor"),priorityIcon:s.querySelector(".priority-editor-icon"),color:s.querySelector(".color-editor"),newSubtask:s.querySelector(".new-subtask"),checklist:s.querySelector(".checklist-editor"),template:s.querySelector(".template-container"),created:s.querySelector(".created"),createdDate:s.querySelector(".created-date"),updated:s.querySelector(".updated"),updatedDate:s.querySelector(".updated-date"),tabs:s.querySelector(".smart-kanban-tab-strip"),detailsTab:s.querySelector('[view="details"]'),commentsTab:s.querySelector('[view="comments"]'),subtasksTab:s.querySelector('[view="subtasks"]'),historyTab:s.querySelector('[view="history"]'),fieldsTab:s.querySelector('[view="fields"]')},a.labels={};for(let e in a.editors){const t=a.editors[e].getAttribute("aria-labelledby"),l=s.querySelector("#"+t);l&&(a.labels[e]=l)}a.tabs={all:a.editors.tabs,detail:a.editors.detailsTab,comments:a.editors.commentsTab,history:a.editors.historyTab,subtasks:a.editors.subtasksTab,fields:a.editors.fieldsTab};const c=()=>{a.editors.status.classList.contains("smart-hidden")&&a.editors.text.classList.contains("smart-hidden")&&a.editors.description.classList.contains("smart-hidden")?(a.editors.description.closest(".column").classList.add("smart-hidden"),a.editors.description.closest(".layout").classList.add("single-column")):e.dialogEditors&&3===e.dialogEditors.length&&e.dialogEditors.indexOf("text")>=0&&e.dialogEditors.indexOf("description")>=0&&e.dialogEditors.indexOf("status")>=0?a.editors.description.closest(".layout").classList.add("single-column"):(a.editors.description.closest(".column").classList.remove("smart-hidden"),a.editors.description.closest(".column").classList.remove("single-column"),a.editors.description.closest(".layout").classList.remove("single-column"))};a.showEditor=e=>{const t=e=>{if(e){const t=[...e.children];let a=0;for(let e=0;e<t.length;e++)t[e].classList.contains("smart-hidden")||a++;a===t.length&&e.classList.remove("single-column")}};a.editors[e]&&(a.editors[e].classList.remove("smart-hidden"),t(a.editors[e].closest(".editor-container"))),a.labels[e]&&(a.labels[e].classList.remove("smart-hidden"),t(a.labels[e].closest(".editor-container"))),"checklist"===e&&a.tabs.subtasks.classList.remove("smart-hidden"),c()},a.hideEditor=e=>{if(a.editors[e]){a.editors[e].classList.add("smart-hidden");const t=a.editors[e].closest(".editor-container");t&&t.classList.add("single-column")}a.labels[e]&&a.labels[e].classList.add("smart-hidden"),"checklist"===e&&a.tabs.subtasks.classList.add("smart-hidden"),c()};const u=a.editors.tabs.querySelectorAll(".smart-kanban-tab");a.selectTab=e=>{if(u[e]&&!u[e].classList.contains("smart-hidden")&&u[e].click(),0===e){const e=[...a.tabs.all.children];for(let t=0;t<e.length;t++)if(e[t]&&!e[t].classList.contains("smart-hidden")){e[t].click();break}}},a.refreshTabs=t=>{const s=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.comments]:0,l=s&&s.length?'<span class="summary"> ('+s.length+")</span>":"";let i=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.checklist]:0,r=i&&i.length?'<span class="summary"> ('+i.length+")</span>":"";t||(i=a.editors.checklist.items.length,i&&(r=i?'<span class="summary"> ('+i+")</span>":"")),a.editors.commentsTab.innerHTML=`${e.localize("commentsTab")}${l}`,a.editors.subtasksTab.innerHTML=`${e.localize("subtasksTab")}${r}`,e._currentUser.allowComment&&a.taskOrComment?a.editors.commentsTab.classList.remove("smart-hidden"):a.editors.commentsTab.classList.add("smart-hidden"),e.readonly&&!i?a.editors.subtasksTab.classList.add("smart-hidden"):a.editors.checklist.classList.contains("smart-hidden")||a.editors.subtasksTab.classList.remove("smart-hidden"),e.taskCustomFields.length>0?a.editors.fieldsTab.classList.remove("smart-hidden"):a.editors.fieldsTab.classList.add("smart-hidden"),a.taskOrComment&&(a.taskOrComment.data[e.dataSourceMap.updatedDate]||a.taskOrComment.data[e.dataSourceMap.createdDate])?a.editors.historyTab.classList.remove("smart-hidden"):a.editors.historyTab.classList.add("smart-hidden");const o=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];let n=0;for(let e=0;e<o.length;e++){const t=o[e];a.editors[t].classList.contains("smart-hidden")&&n++}n===o.length?a.tabs.detail.classList.add("smart-hidden"):a.tabs.detail.classList.remove("smart-hidden")},a.refreshFields=()=>{const t=a.querySelector(".fields"),s=a.taskOrComment?a.taskOrComment.data:{},l=e.taskCustomFields.length,i=a.querySelectorAll(["[container-for]"]).length;if(e._resetFields&&(delete e._resetFields,a.refreshFieldsDirty=!0,t.innerHTML=""),!0===a.refreshFieldsDirty)if(a.refreshFieldsDirty=!1,t.firstElementChild&&l<=i)for(let t=0;t<e.taskCustomFields.length;t++){const l=e.taskCustomFields[t];let i=s[l.dataField];const r=a.querySelector("[container-for="+l.dataField+"]");if(!r)continue;e.dataSourceMap[l.dataField]?r.classList.add("smart-hidden"):r.classList.remove("smart-hidden"),null==i&&(i="");const o=r.lastElementChild.firstElementChild;o.removeAttribute("dirty"),i&&i instanceof Date?"dateInput"===l.editor?o.value=i:i&&"dateRangeInput"===l.editor?Array.isArray(i)&&(o.value=i):o.value=""+i:o.value=""+i,"image"===l.editor?i||(o.innerHTML=e.localize("emptyImage")):"attachments"!==l.editor&&"attachment"!==field.editor||i||(o.innerHTML=e.localize("emptyAttachment"))}else{const a=document.createDocumentFragment(),l=(t,a,s)=>{null==a&&(a="");const l=document.createElement("div"),i=document.createElement("div"),r=document.createElement("div");void 0===s.visible&&(s.visible=!0),void 0===s.allowHide&&(s.allowHide=!0),s.allowHide?i.innerHTML=t+'<span class="icon"></span>':i.innerHTML=t,i.classList.add("editor-label"),s.allowHide&&(!1===s.visible&&i.lastElementChild.classList.add("hide"),i.lastElementChild.onpointerdown=()=>{s.visible=!s.visible,i.lastElementChild.classList.toggle("hide")}),r.classList.add("editor");let o=document.createElement("input");if(o.classList.add("smart-input"),void 0!==s.minLength&&(o.minLength=s.minLength),void 0!==s.maxLength&&(o.maxLength=s.maxLength),"textarea"===s.editor)o=document.createElement("smart-text-area"),void 0!==s.minLength&&(o.minLength=s.minLength),void 0!==s.maxLength&&(o.maxLength=s.maxLength);else if("password"===s.editor)o.type="password";else if("phone"===s.editor||"tel"===s.editor)Smart.PhoneInput?o=document.createElement("smart-phone-input"):o.type="tel";else if("url"===s.editor)o.type="url";else if("email"===s.editor)o.type="email";else if("date"===s.dataType||"dateInput"===s.editor)"dateRangeInput"===s.editor?(o=document.createElement("smart-date-range-input"),o.selectedDates=a):o=document.createElement("smart-date-input"),o.autoClose=!0,""===a&&(a=new Date),void 0!==s.minDate&&(o.min=s.minDate),void 0!==s.maxDate&&(o.max=s.maxDate);else if("boolean"===s.dataType)o=document.createElement("smart-check-box"),""===a&&(a=!1);else if("number"===s.dataType||"numberInput"===s.editor)o=document.createElement("smart-number-input"),a||(a=0),void 0!==s.min&&(o.min=s.min),void 0!==s.max&&(o.max=s.max);else if("string"===s.dataType&&s.options)o=document.createElement("smart-input"),o.readonly=!0,o.dropDownButtonPosition="right",o.dataSource=s.options;else if("string"===s.dataType&&"multiComboInput"===s.editor)o=document.createElement("smart-multi-combo-input"),o.readonly=!0,o.dropDownButtonPosition="right",o.dataSource=s.dataSource,o.pills=!0,o.selectedValues=[""+a],s.singleSelect&&(o.singleSelect=!0),s.colorItems&&(o.colorItems=!0);else if("string"!==s.dataType||"image"!==s.editor&&"images"!==s.editor){if("string"===s.dataType&&("attachment"===s.editor||"attachments"===s.editor))if(a.length>50){if("string"==typeof a&&(a.indexOf("[{")>=0||a.indexOf("}]")>=0)){let e="";if(a)try{e=JSON.parse(a)}catch(e){console.log(e)}a=e}const t=document.createElement("div");if(Array.isArray(a)){a.forEach((e=>{const a=document.createElement("div");a.title=e.label,a.classList.add("item"),a.innerHTML="<div></div>",a.firstElementChild.classList.add("smart-grid-icon","show","attachment"),e.label.indexOf("png")>=0||e.label.indexOf("jpg")>=0||e.label.indexOf("jpeg")>=0||e.label.indexOf("gif")>=0?a.firstElementChild.classList.add("smart-icon-image"):e.label.indexOf(".pdf")>=0?a.firstElementChild.classList.add("smart-icon-pdf"):e.label.indexOf(".tsv")>=0||e.label.indexOf(".txt")>=0||e.label.indexOf(".csv")>=0?a.firstElementChild.classList.add("smart-icon-text"):e.label.indexOf(".xls")>=0||e.label.indexOf(".xlsx")>=0?a.firstElementChild.classList.add("smart-icon-excel"):e.label.indexOf(".ppt")>=0?a.firstElementChild.classList.add("smart-icon-powerpoint"):e.label.indexOf(".zip")>=0||e.label.indexOf(".rar")>=0||e.label.indexOf(".7z")>=0?a.firstElementChild.classList.add("smart-icon-archive"):e.label.indexOf(".doc")>=0||e.label.indexOf(".docx")>=0?a.firstElementChild.classList.add("smart-icon-word"):a.firstElementChild.classList.add("smart-icon-file"),t.appendChild(a)}));const s=t;t._value=a,t.onpointerdown=a=>{if(a.target.classList.contains("attachment")){const l=t._value&&"string"==typeof t._value?JSON.parse(t._value):t._value,i=[...s.children[0].children].indexOf(a.target);if(l[i]){const t=document.createElement("a");if(l[i].value.indexOf(window.location.host)>=0)fetch(l[i].value).then((e=>e.blob())).then((e=>{const a=URL.createObjectURL(e);t.download=l[i].label,t.href=a,t.click()}));else{if(l[i].value.indexOf("base64")>=0){const a=e._getFileFromBase64(l[i].value);t.href=URL.createObjectURL(a)}else t.href=l[i].value;t.target="_blank",t.click()}}a.stopPropagation(),a.preventDefault()}}}o=t}else o=document.createElement("div"),a||(o.innerHTML=e.localize("emptyAttachment"))}else if(a.length>50)if(a.indexOf("base64")>=0){a=JSON.parse(a),window.Smart._createSmartImageModal=e._createImageModal;let t="";for(let e=0;e<a.length;e++){const s=a[e];t+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" width="20" height="20" src="${s.value}" title="${s.label}"/>`}o=document.createElement("div"),o.innerHTML=t}else a=a.substring(0,50)+"...";else o=document.createElement("div"),a||(o.innerHTML=e.localize("emptyImage"));return o.setAttribute("data-field",s.dataField),o.classList.add("smart-kanban-task-field-editor"),s&&"dateRangeInput"===s.editor?o.value=a:o.value=""+a,o.onchange=()=>{o.setAttribute("dirty","")},r.appendChild(o),l.appendChild(i),l.appendChild(r),l.setAttribute("container-for",s.dataField),l},i=document.createElement("div");i.classList.add("editor-container"),a.appendChild(i);for(let t=0;t<e.taskCustomFields.length;t++){const a=e.taskCustomFields[t],r=l(a.label,s[a.dataField],a);i.appendChild(r),e.dataSourceMap[a.dataField]&&r.classList.add("smart-hidden")}t.innerHTML="",t.appendChild(a)}},a.refreshHistory=()=>{const t=a.querySelector(".history-table");if(!e.storeHistory)return void t.classList.add("smart-hidden");t.classList.remove("smart-hidden");const s=a.taskOrComment.data.history;let l=`<table><tr>\n <th>${e.localize("historyEvent")}</th>\n <th>${e.localize("historyAuthor")}</th>\n <th>${e.localize("historyDetails")}</th>\n <th>${e.localize("historyDate")}</th>\n </tr>\n `;for(let t=s.length-1;t>=0;t--){const a=s[t];if(l+=`<tr>\n <td>${e._getHistoryItemLabel(a)}</td>`,void 0!==a.user){const t=t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser")}},s=t(e.users.find((e=>e.id===a.user)));l+=`<td><div class="smart-kanban-task-user-history"><div class="icon smart-kanban-task-user" style="${s.image}"></div><div class="name">${s.label}</div></div></td>`}else l+="<td></td>";if("created"!==a.action){let t=a.details.oldValue,s=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t)),l=e.users.find((e=>e.id===s));t=a?a.name:e.localize("unassigned"),s=l?l.name:e.localize("unassigned")}if(t&&t instanceof Date&&(t=t.toLocaleString()),s&&s instanceof Date&&(s=s.toLocaleString()),"subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));l+=`<td><span class="smart-truncate">${e.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span></td>`}else l+=t?`<td><span class="smart-truncate">${e.localize("range",{oldValue:t,newValue:s})}</span></td>`:`<td><span class="smart-truncate">${e.localize("nullRange",{oldValue:t,newValue:s})}</span></td>`}else l+=`<td>${a.details.value}</td>`;l+=`\n <td>${a.date.toLocaleString()}</td>\n </tr>`}l+="</table>",t.innerHTML=l,a.refreshTabs()},a.refreshComments=()=>{if(!a.taskOrComment)return;const t=a.querySelector(".comments");t.classList.remove("smart-hidden");const s=e._getCommentsList(a.taskOrComment);s.classList.remove("dialog");const l=s.querySelector(".send");l&&(l.onclick=t=>{if(l.disabled)return;const s=JSON.parse(JSON.stringify(e._commentSelectionFor.data)),i=e._createComment();e._commentsList.textarea.value="",l.disabled=!0,a.refreshTabs();const r=JSON.parse(JSON.stringify(e._commentSelectionFor.data));e.$.fireEvent("change",{task:e._commentSelectionFor,id:r.id,value:r,oldValue:s}),e.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:s}),e.$.fireEvent("commentAdd",{id:r.id,value:i}),t.stopPropagation(),t.preventDefault()}),t.innerHTML="",t.appendChild(s),a.refreshTabs()},u.forEach((e=>{e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus")},e.onkeydown=t=>{"Enter"===t.key&&(e.click(),t.stopPropagation())},e.onclick=e=>{const t=e.target.closest(".smart-kanban-tab"),s=t.getAttribute("view");switch(u.forEach((e=>{e.classList.remove("selected")})),t.focus(),t.classList.add("selected"),a.querySelectorAll(".smart-kanban-tab-content").forEach((e=>{e.classList.add("smart-hidden")})),s){case"details":a.querySelector(".details").classList.remove("smart-hidden");break;case"subtasks":a.querySelector(".subtasks").classList.remove("smart-hidden");break;case"comments":a.refreshComments();break;case"history":a.querySelector(".history").classList.remove("smart-hidden"),a.refreshHistory();break;case"fields":a.querySelector(".fields").classList.remove("smart-hidden"),a.refreshFields()}}})),(()=>{const e=a.editors.color;e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.dropDownWidth=50;const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input"),e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")}})(),a.editors.newSubtask.onchange=()=>{a.editors.newSubtask.nextElementSibling.click()},a.editors.priority.onchange=()=>{e._setPriorityEditorIcon(!0)},e._setPriorityEditorIcon(),a.editPanelPopulated=!0,e.dialogRendered&&e.dialogRendered(a,a.editors,a.labels,a.tabs,a.layout,a.taskOrComment)}_setPriorityEditorIcon(e){const t=this,a=t._dialog;let s=a.editors.priority.selectedValues[0];null==s&&(s=""),e||a.taskOrComment&&a.taskOrComment.data&&void 0!==a.taskOrComment.data.priority&&(s=a.taskOrComment.data.priority);const l=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let e=0;e<t.priority.length;e++){const i=t.priority[e];if(s?a.editors.priorityIcon.classList.remove("smart-hidden"):a.editors.priorityIcon.classList.add("smart-hidden"),i.value===s){a.editors.priorityIcon.innerHTML='<div class="smart-kanban-task-text">'+l(i)+"</div>";break}}}_showHideDialogEditors(){const e=this,t=e._dialog,a=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];for(let s=0;s<a.length;s++){const l=a[s];e.dialogEditors.indexOf(l)>=0?t.showEditor(l):t.hideEditor(l)}const s=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})));s.length<=1&&t.hideEditor("status"),t.editors.status.dataSource=s,0===t.editors.tags.dataSource.length?(t.editors.tags.classList.add("smart-hidden"),t.editors.emptyTags.classList.remove("smart-hidden")):(t.editors.tags.classList.remove("smart-hidden"),t.editors.emptyTags.classList.add("smart-hidden")),0===e.users.length&&t.hideEditor("userId")}_unescapeValue(e){if(null==e)return e;const t=[{regex:"&",entity:"&amp;"},{regex:">",entity:"&gt;"},{regex:"<",entity:"&lt;"},{regex:'"',entity:"&quot;"},{regex:"'",entity:"&#39;"},{regex:"=",entity:"&#x3D;"},{regex:"/",entity:"&#x2F;"},{regex:"`",entity:"&#x60;"}];let a;for(let s in t)a=new RegExp(t[s].entity,"g"),e=e.replace(a,t[s].regex);return e}_escapeValue(e){return e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")}_beginEdit(e){const t=this;t.tags||(t.tags=[]);const a=t.dataSourceMap,s=e.data,l=t._dialog,i=l.editors,r=t.tags.length>0?[...t.tags,...t._customTags]:t._customTags,o=t._allColumns.find((e=>e.dataField===s[a.status]));if(l.label=t.localize("editTask",{taskId:s[a.id],text:s[a.text]}),i.text.value=t._unescapeValue(s[a.text]),i.description.value=t._unescapeValue(s[a.description]),i.tags.dataSource=r,t._showHideDialogEditors(),t.allowCustomTags,s[a.tags]){const e=e=>{let a=[];e.indexOf(",")>=0?a=e.split(","):Array.isArray(e)?a=a.concat(e):a.push(e);const s=[];for(let e=0;e<a.length;e++)"string"==typeof a[e]?(a[e]=t._unescapeValue(a[e].trim()),s.push(a[e])):(a[e].label=t._unescapeValue(a[e].label),s.push(a[e].value));return s};if(!t.allowCustomTags){const l=t.tags.length>0?t.tags:e(s[a.tags]);i.tags.dataSource=l}i.tags.selectedValues=e(s[a.tags])}else i.tags.selectedValues=[];0===i.tags.dataSource.length?(i.tags.classList.add("smart-hidden"),i.emptyTags.classList.remove("smart-hidden")):(i.tags.classList.remove("smart-hidden"),i.emptyTags.classList.add("smart-hidden")),l.editors.created.parentElement.classList.add("smart-hidden"),l.editors.updated.parentElement.classList.add("smart-hidden");const n=void 0!==s[a.createdUserId]?t.users.find((e=>e.id===s[a.createdUserId])):"",d=s[a.createdDate],c=void 0!==s[a.updatedUserId]?t.users.find((e=>e.id===s[a.updatedUserId])):"",u=s[a.updatedDate],m=e=>{const a=e?e.image:null;return{image:a?`background-image: url('${a}');`:"",label:e?e.name||e.id:t.localize("guestUser")}};if(n){const e=m(n);l.editors.created.parentElement.classList.remove("smart-hidden"),l.editors.created.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,d&&(l.editors.createdDate.innerHTML=d.toLocaleString())}if(c){const e=m(c);l.editors.updated.parentElement.classList.remove("smart-hidden"),l.editors.updated.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,u&&(l.editors.updatedDate.innerHTML=u.toLocaleString())}const p=null!==s[a.userId]?t.users.find((e=>e.id===s[a.userId])):"";p?i.userId.selectedItems=[{label:p.name,value:p.id,image:p.image?p.image:null}]:i.userId.value="",delete i.userId.$.input.dataValue,i.status.selectedValues=[o.dataField],t.readonly||!t._currentUser.allowEdit?(i.status.readonly=!1,i.priority.readonly=!1):(i.status.readonly=!0,i.priority.readonly=!0),delete i.status.$.input.dataValue,t._hasSwimlane(t.columns.indexOf(o))?i.swimlane.value=t.swimlanes.find((e=>e.dataField===s[a.swimlane])).label:i.swimlane.value="",delete i.swimlane.$.input.dataValue,i.startDate.value=s[a.startDate]||null,i.dueDate.value=s[a.dueDate]||null,i.progress.value=parseFloat(s[a.progress])||0;const h=t.localize(s[a.priority]);i.priority.value=null!=h?h:"",delete i.priority.$.input.dataValue,""===i.priority.value&&(i.priority.selectedValues=[]),i.color.value=s[a.color]||"";const g=[],f=[];(s[a.checklist]||[]).forEach(((e,t)=>{e.completed&&g.push(t),f.push({label:e.text,selected:!0===e.completed})})),0===t.swimlanes.length?(l.editors.swimlane.classList.add("smart-hidden"),l.editors.swimlaneLabel.classList.add("smart-hidden"),l.editors.swimlane.parentElement.classList.add("single-column")):(l.editors.swimlane.classList.remove("smart-hidden"),l.editors.swimlaneLabel.classList.remove("smart-hidden"),l.editors.swimlane.parentElement.classList.remove("single-column")),i.dueDate.onchange=i.startDate.onchange=()=>{i.startDate.value>=i.dueDate.value&&i.dueDate.value?(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")):(l.$.footer.firstElementChild.disabled=!1,l.querySelector(".editor-error-container").classList.add("smart-hidden"))},i.startDate.value&&i.startDate.value>=i.dueDate.value&&i.dueDate.value&&(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")),i.newSubtask.value="",i.checklist.dataSource=f,i.checklist.selectedIndexes=g,t._setPriorityEditorIcon(),l.refreshTabs(!0),l.selectTab(0)}_endEdit(){const e=this,t=e.dataSourceMap,a=e._dialog,s=a.editors,l=a.taskOrComment,i=l?l.data:void 0,r=Object.assign({},i);let o=s.startDate.value,n=s.dueDate.value;r[t.text]=e._escapeValue(s.text.value),r[t.description]=e._escapeValue(s.description.value);const d=[];for(let t=0;t<s.tags.dataSource.length;t++){const a=s.tags.dataSource[t];"string"==typeof a?s.tags.selectedValues.indexOf(a)>=0&&d.push(e._escapeValue(a)):s.tags.selectedValues.indexOf(a.value)>=0&&(a.label=e._escapeValue(a.label),d.push(a))}if(r[t.tags]=d,r[t.progress]=parseFloat(s.progress.value),r[t.color]=s.color.value,e._currentUser.info&&(r[t.updatedUserId]=e._currentUser.info.id,r[t.updatedDate]=new Date),r[t.color]||""===r[t.color]||delete r[t.color],void 0!==s.userId.$.input.dataValue&&(r[t.userId]=parseFloat(s.userId.$.input.dataValue)),void 0!==s.status.$.input.dataValue&&(r[t.status]=s.status.$.input.dataValue),s.swimlane.$.input.dataValue&&(r[t.swimlane]=s.swimlane.$.input.dataValue),o&&(o=o.toDate()),n&&(n=n.toDate()),r[t.startDate]=o,r[t.dueDate]=n,void 0!==s.priority.$.input.dataValue&&(r[t.priority]=s.priority.$.input.dataValue),r[t.checklist]=s.checklist.items.map((e=>({text:e.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),completed:e.selected}))),e.taskCustomFields&&e.taskCustomFields.length>0)for(let t=0;t<e.taskCustomFields.length;t++){const s=e.taskCustomFields[t],l=a.querySelector("[data-field="+s.dataField+"]");if(l){let t=l.value;l.dataSource&&l.dataSource.length>0&&l.selectedValues.length>0&&(t=l.selectedValues.toString()),"smart-number-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-range-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),(l.hasAttribute("dirty")||e.dialogCustomizationFunction)&&(r[s.dataField]=t)}}l?e.updateTask(l,r):e.addTask(r),s.tags.close()}_clearEditors(){const e=this,t=e._dialog.editors,a=e.tags.length>0?e.tags:e._customTags;t.text.value="",t.description.value="",t.tags.dataSource=a,t.tags.selectedValues=[],t.status.selectedValues=[],delete t.status.$.input.dataValue,t.swimlane.value="",delete t.swimlane.$.input.dataValue,t.userId.value="",delete t.userId.$.input.dataValue,t.progress.value=0,t.startDate.value=null,t.dueDate.value=null,t.priority.value="",t.priority.$.input.dataValue="",t.priority.selectedValues=[],t.color.value="",t.newSubtask.value="",t.created.innerHTML="",t.updated.innerHTML="",t.createdDate.innerHTML="",t.updatedDate.innerHTML="",t.checklist.dataSource=[],t.checklist.selectedIndexes=[]}_getCurrentUser(){const e=this,t=e.users;let a=e.currentUser,s=!0,l=!0,i=e.allowDrag,r=e.editable,o=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(s=!1!==a.allowAdd,l=!1!==a.allowComment,i=i&&!1!==a.allowDrag,r=r&&!1!==a.allowEdit,o=!1!==a.allowRemove)),e._currentUser={allowAdd:s,allowComment:l,allowDrag:i,allowEdit:r,allowRemove:o,info:a}}_autoSaveState(e){const t=this;if(t.autoSaveState)if("object"!=typeof e)if(e&&t._autoSavedState){switch(e){case"collapsed":t._allColumns.forEach((e=>t._autoSavedState.collapsed[e.dataField]=e.collapsed));break;case"dataSource":t._autoSavedState.dataSource=t._getCurrentDataSource();break;case"filtering":t._autoSavedState.filtering=t._appliedFiltering;break;case"selection":{const e=t.dataSourceMap;let a=null,s=null;t._selectionInView&&(a=t._selectionInView.closest(".smart-kanban-column").column.dataField,s=t._selectionInView.getAttribute("swimlane")),t._autoSavedState.selection={selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart.data[e.id]:null,selectionInColumn:a,swimlane:s};break}case"sorting":t._autoSaveState.sorting=t._appliedSorting;break;case"tabs":t._autoSaveState.tabs=t._selectedTabs;break;case"visibility":t._autoSavedState.visibility={taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}}window.localStorage.setItem("smartKanban"+t.id,JSON.stringify(t._autoSavedState))}else t._autoSavedState=t.saveState();else t._autoSavedState=e}_getCurrentDataFields(e){const t=this,a=[{name:"text",dataType:"string"},{name:"tags",dataType:"string"},{name:"priority",dataType:"string"},{name:"progress",dataType:"number"},{name:"startDate",dataType:"date"},{name:"dueDate",dataType:"date"},{name:"userId",dataType:"string"}],s=e&&e.length>0?e[0]:null;for(let e=0;e<t.taskCustomFields.length;e++)if(s){const l=typeof s[t.taskCustomFields[e].dataField];"number"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"number"}):"date"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"date"}):a.push({name:t.taskCustomFields[e].dataField,dataType:"string"})}else a.push({name:t.taskCustomFields[e].dataField,dataType:"string"});return a}_applyFilter(e,t){const a=this;if(a.dataSource&&a.dataSource.virtualDataSource)return a._requestVirtualDataSource("filter"),void a._autoSaveState("filtering");const s=a._getCurrentDataSource(),l=a._getCurrentDataFields(s),i=new Smart.DataAdapter({dataSource:s,dataFields:l,id:"id"});try{i._filter(e,t)}catch(e){return}if(a.virtualization){if(e&&e.length>0){const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered;let l=a._getTasksByDataField(s),r=[];for(let e=0;e<l.length;e++){const t=l[e],a=i.dataItemById[t.id];a&&a.$.filtered&&r.push(t)}a.tasksByDataField[s]._filtered=r}}else{const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered}}a._refreshColumns()}else{const e=Array.from(a.$.container.getElementsByClassName("smart-kanban-task"));for(let t=0;t<i.length;t++){const a=e[t],s=!i[t].$.filtered;a.classList.toggle("smart-hidden",s),a.filteredOut=s}a._allColumns.forEach((e=>a._refreshScrollViewer(e)))}a._autoSaveState("filtering")}_applyHandler(e,t){const a=this,s=a.isInShadowDOM||a.shadowRoot?e.composedPath()[0]:e.target,l=e.detail;a.$.customize.contains(s)||"customize"===t?(l.value.forEach((e=>a[e.dataField]=e.visible)),a._allColumns.forEach((e=>a._refreshScrollViewer(e))),a.virtualization&&(delete a._autoCardHeight,a._measureCardHeight(),a._refreshColumns()),a._autoSaveState("visibility")):a.$.filter.contains(s)||"filter"===t?a.addFilter(l.filters,l.operator,l.value):(a.$.sort.contains(s)||"sort"===t)&&a.addSort(l.sortByInfo),a.closePanel()}_applySort(){const e=this,t=e._appliedSorting;if(e._autoSaveState("sorting"),e.dataSource&&e.dataSource.virtualDataSource)e._requestVirtualDataSource("sort");else if(0!==t.dataFields.length)e._allColumns.forEach((a=>{const s=e._columnToElement.get(a).querySelector(".smart-scroll-viewer-content-container"),l=Array.from(s.children),i=[];if(l.length<2)return;let r;if(e.virtualization?e.tasksByDataField[a.dataField].forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t);"low"===l[s.priority]&&(l[s.priority]="z"),i.push(l)})):l.forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t.data);"low"===l[s.priority]&&(l[s.priority]="z"),i.push(l)})),e.taskCustomFields.length){const t=e._getCurrentDataFields(i);t.push({name:"taskIndex",dataType:"number"}),r=new Smart.DataAdapter({dataSource:i,observable:!1,dataFields:t,id:"id"})}else r=new Smart.DataAdapter({dataSource:i,observable:!1,dataFields:["taskIndex: number","text: string","tags: string","priority: string","progress: number","startDate: date","dueDate: date","userId: string"],id:"id"});if(r.sortBy(t.dataFields,t.dataTypes,t.orderBy),e.virtualization){if(e.tasksByDataField[a.dataField]._sorted=Smart.DataAdapter.Sort(e.tasksByDataField[a.dataField],t.dataFields,t.orderBy),e.tasksByDataField[a.dataField]._filtered){e.tasksByDataField[a.dataField]._originalFilteredData=JSON.parse(JSON.stringify(e.tasksByDataField[a.dataField]._filtered));const s=Smart.DataAdapter.Sort([...e.tasksByDataField[a.dataField]._filtered],t.dataFields,t.orderBy);e.tasksByDataField[a.dataField]._filtered=s||[]}e._refreshColumn(a.dataField)}else for(let e=0;e<r.length;e++)s.appendChild(l[r[e].taskIndex])}));else if(e.virtualization){const t=Object.keys(e.tasksByDataField);for(let a=0;a<t.length;a++){const s=t[a];delete e.tasksByDataField[s]._sorted,e.tasksByDataField[s]._filtered&&e.tasksByDataField[s]._originalFilteredData&&(e.tasksByDataField[s]._filtered=e.tasksByDataField[s]._originalFilteredData,delete e.tasksByDataField[s]._originalFilteredData),e._refreshColumn(s)}}}_closeSearchPanel(){const e=this;e._searchInfo&&(Array.from(e.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),delete e._searchInfo)}_constructFilterGroups(e){const t={text:"string",tags:"string",priority:"string",progress:"number",startDate:"date",dueDate:"date"},a={},s=[];e.filters.forEach((s=>{const l=s[0],i=t[l];let r=s[2],o=a[l];void 0===o&&(o=new Smart.Utilities.FilterGroup,a[l]=o),"date"===i&&"string"==typeof r&&(r=new Date(r));const n=o.createFilter(i,r,s[1]);o.addFilter(e.operator,n)}));for(let e in a)s.push([e,a[e]]);return s}_openSearchPanel(){const e=this;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._searchInfo={source:e._getCurrentDataSource(),stringDataFields:["text","tags"]},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(a._searchInfo.query=e,Array.from(a.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,void delete a._searchInfo.highlighted;const s=new Smart.DataAdapter({dataSource:a._searchInfo.source,dataFields:["text: string","tags: string"],id:"id"}),l=[],i=[],r={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,s=a.createFilter("string",e,"CONTAINS");a.addFilter("or",s),l.push([t,a])})),s._filter(l,"or");for(let e=0;e<s.length;e++){const t=s[e];!1!==t.$.filtered&&(i.push(t.$.id),r[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=i,a._searchInfo.foundIdsObject=r,Array.from(a.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>{const s=e.data[a.dataSourceMap.id];if(r[s]){if(e.filteredOut)return i.splice(i.indexOf(s),1),void delete r[s];t&&i[0]===s&&e.classList.add("smart-data-view-highlighted"),e.classList.add("smart-data-view-found")}})),i.length>0){if(t){let e=i[0];a._searchInfo.highlighted=e,a.ensureVisible(e)}return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),void(a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:i.length}))}a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_bodyFocusinHandler(e){const t=this;let a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.classList.contains("smart-kanban-column-content-tasks")&&(a=a.$.content,!t._getSelectedItem(a,!0))){if(t.virtualization){const e=t._focusedTask;return void t.focusTask(e)}if(void 0!==t._focusedTask)return void t.focusTask(t._focusedTask);t._focusTask(t._getFirstItem(a))}}get _rtlAttr(){return this.rightToLeft?" right-to-left":""}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}_appendAddNewColumn(e){const t=document.createElement("div");t.classList.add("smart-kanban-column","smart-kanban-add-new-column","smart-unselectable"),t.innerHTML=`<div class="smart-kanban-column-header smart-unselectable" > <div title="${this.localize("addNewColumn")}" class="smart-kanban-add-new-column-label smart-kanban-column-header-label"><span>+ ${this.localize("addNewStatus")}</span></div></div >\n <div class="smart-kanban-column-content no-sub-columns"><smart-scroll-viewer></smart-scroll-viewer></div>\n `,this.disabled||this.unfocusable||t.setAttribute("tabindex",0),t.column={dataField:"newStatus",label:"New Status"},e.appendChild(t)}selectTask(e){const t=this;t._selectedTasks.push(e),t._selectionStart=e,t._focusedTask=e;const a=t.querySelector(".smart-kanban-task[focus]");a&&a.removeAttribute("focus");const s=t.querySelector('.smart-kanban-task[data-id="'+e+'"]');s&&s.setAttribute("focus",""),t._refreshSelection(),t.ensureVisible(e)}unselectTask(e){const t=this,a=t._selectedTasks.indexOf(e);a>=0&&t._selectedTasks.splice(a,1),t._refreshSelection()}clearSelection(){const e=this;e._selectionStart=null,e._selectedTasks=[],e._refreshSelection()}getSelectedTasks(){return this._selectedTasks||(this._selectedTasks=[]),this._selectedTasks}getTask(e){return this.dataSource?this.dataSource.find((t=>{if(t.id===e)return t})):null}getColumn(e){const t=this;let a=null;for(let s=0;s<t.columns.length;s++)if(t.columns[s].dataField===e){a=t.columns[s];break}return a}getColumnDataItems(e){const t=this;let a=[];if(!t.getColumn(e)||!t.dataSource)return[];for(let s=0;s<t.dataSource.length;s++){const l=t.dataSource[s];l[t.dataSourceMap.status]===e&&a.push(l)}return a}_getFileFromBase64(e,t){let a=e.split(","),s=a[0].match(/:(.*?);/)[1],l=atob(a[1]),i=l.length,r=new Uint8Array(i);for(;i--;)r[i]=l.charCodeAt(i);return new File([r],t,{type:s})}updateColumn(e,t){const a=this;let s=null;for(let t=0;t<a.columns.length;t++)if(a.columns[t].dataField===e){s=a.columns[t];break}if(s){const e=s.label;void 0!==t.label&&(s.label=t.label),void 0!==t.collapsed&&(s.collapsed=t.collapsed),void 0!==t.collapsible&&(s.collapsible=t.collapsible),void 0!==t.orientation&&(s.orientation=t.orientation),void 0!==t.width&&(s.width=t.width),a._reset(),a.$.fireEvent("columnUpdate",{columnData:t,oldValue:e,value:s.label})}}addColumn(e){const t=this;e?(t.columns.push(e),t._reset(),t._createAddNewButton(),t.$.fireEvent("columnAdd",{columnData:e})):t._addNewColumnDynamically()}removeColumn(e){const t=this;let a=null,s=-1;for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){a=t.columns[l],s=l;break}if(a&&t.columns.splice(s,1),t.dataSource)for(let a=0;a<t.dataSource.length;a++){const s=t.dataSource[a];if(s[t.dataSourceMap.status]===e){const e=JSON.parse(JSON.stringify(s));s[t.dataSourceMap.status]=t.columns[0].value;const a=JSON.parse(JSON.stringify(s));t.$.fireEvent("change",{task:s,id:a.id,value:a,oldValue:e}),t.$.fireEvent("taskUpdate",{id:a.id,value:a,oldValue:e})}}t._reset(),t._createAddNewButton(),t.$.fireEvent("columnRemove",{column:a})}_addNewColumnDynamically(){const e=this,t=e._dialog,a=Math.floor(9e4*Math.random()+1e4),s={label:e.localize("addNewStatus")+" "+a,dataField:"newStatus"+a,addNewButton:!0,collapsed:!1,collapsible:!0,orientation:"vertical"},l=e.$.body.querySelector(".smart-kanban-add-new-column").querySelector(".smart-kanban-add-new-column-label"),i=document.createElement("input");if(l.classList.add("pending"),l.appendChild(i),i.classList.add("smart-kanban-column-header-input"),e.columnColors){l.classList.add("colors");const t=e._getColorInput();l.appendChild(t)}function r(a){let r=i.value,o=l.querySelector("smart-color-input");o&&o.opened?e._columnAddTimer&&clearTimeout(e._columnAddTimer):(!1===/^\s*$/.test(r)?(r=r.trim(),s.label=r,s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)):""===r&&(r="",s.label="",s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),l.classList.contains("pending")&&(e._columnAddTimer&&clearTimeout(e._columnAddTimer),e._columnAddTimer=setTimeout((()=>{if(l.classList.remove("pending"),i.parentNode&&i.parentNode.removeChild(i),o){s.color=o.value;const e=l.querySelector(".heading");if(e){const t=new Smart.Color(s.color).getInvertedColor();e.style.backgroundColor=s.color,e.style.color=t}o.remove()}e.columns.push(s),e._reset(),e._createAddNewButton(),t&&t.editPanelPopulated&&(t.editors.status.dataSource=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})))),e.$.fireEvent("columnAdd",{newColumn:s}),delete e._columnAddTimer}),50),a.stopPropagation()))}i.focus(),i.onkeydown=e=>{"Escape"===e.key?(l.classList.remove("pending"),i&&i.parentElement&&(i.nextElementSibling&&"Smart-COLOR-INPUT"===i.nextElementSibling.nodeName&&i.nextElementSibling.remove(),i.parentElement.removeChild(i),e.stopPropagation(),e.preventDefault())):"Enter"===e.key&&r(e)},i.addEventListener("blur",r),i.addEventListener("change",r)}_handleColumnEditing(e){const t=this,a=t.columns.find((t=>t.dataField===e));if(t._columnEditing)return;const s=Array.from(t.$.body.getElementsByClassName("smart-kanban-column")).find((t=>t.column.dataField===e)).querySelector(".smart-kanban-column-header-label"),l=document.createElement("input");s.classList.add("pending"),s.appendChild(l);const i=a.label,r=a.color;if(l.value=a.label,l.classList.add("smart-kanban-column-header-input"),t.columnColors){s.classList.add("colors");const e=t._getColorInput();e.value=a.color||"transparent",s.appendChild(e)}function o(e){let o=l.value,n=s.querySelector("smart-color-input");if(!n||!n.opened){if(!1===/^\s*$/.test(o)?(o=o.trim(),a.label=o,s.querySelector(".smart-kanban-title").innerHTML=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,"")):""===o&&(a.label="",s.querySelector(".smart-kanban-title").innerHTML="&nbsp;"),n){a.color=n.value;const e=s.querySelector(".heading");if(e){const t=new Smart.Color(a.color).getInvertedColor();""===a.color?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=a.color,e.style.color=t)}t.applyColumnColorToTasks&&s.closest(".smart-kanban-column").style.setProperty("--smart-primary",a.color),n.remove()}s.classList.remove("pending");try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditTimer&&clearTimeout(t._columnEditTimer),t._columnEditing=!1,t._columnEditTimer=setTimeout((()=>{i===a.label&&r===a.color||t.$.fireEvent("columnUpdate",{column:a,oldValue:i,value:a.label}),delete t._columnEditTimer}),50),e.stopPropagation()}}t._columnEditing=!0,setTimeout((()=>{l.focus()}),50),l.onkeydown=e=>{if("Escape"===e.key){s.classList.remove("pending"),l.value=i;try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditing=!1}else"Enter"===e.key&&o(e)},l.addEventListener("blur",o),l.addEventListener("change",o)}_validateDataSourceMap(){this.dataSourceMap=Object.assign({},{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",userId:"userId"},this.dataSourceMap)}});
126
126
 
127
127
  /***/ }),
128
128
 
@@ -322,7 +322,7 @@ var __webpack_exports__ = {};
322
322
  /* harmony import */ var _smart_kanban_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(7498);
323
323
  /* harmony import */ var _smart_kanban_js__WEBPACK_IMPORTED_MODULE_27___default = /*#__PURE__*/__webpack_require__.n(_smart_kanban_js__WEBPACK_IMPORTED_MODULE_27__);
324
324
 
325
- /* Smart UI v17.0.3 (2023-10-20)
325
+ /* Smart UI v17.0.17 (2023-11-08)
326
326
  Copyright (c) 2011-2023 jQWidgets.
327
327
  License: https://htmlelements.com/license/ */ //
328
328