smart-webcomponents-react 25.0.1 → 25.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/package.json +1 -1
  2. package/source/modules/smart.3dchart.js +2 -2
  3. package/source/modules/smart.accordion.js +2 -2
  4. package/source/modules/smart.array.js +2 -2
  5. package/source/modules/smart.barcode.js +2 -2
  6. package/source/modules/smart.breadcrumb.js +2 -2
  7. package/source/modules/smart.button.js +2 -2
  8. package/source/modules/smart.buttongroup.js +2 -2
  9. package/source/modules/smart.calendar.js +2 -2
  10. package/source/modules/smart.card.js +2 -2
  11. package/source/modules/smart.cardview.js +2 -2
  12. package/source/modules/smart.carousel.js +2 -2
  13. package/source/modules/smart.chart.js +2 -2
  14. package/source/modules/smart.checkbox.js +2 -2
  15. package/source/modules/smart.checkinput.js +2 -2
  16. package/source/modules/smart.chip.js +2 -2
  17. package/source/modules/smart.colorinput.js +2 -2
  18. package/source/modules/smart.colorpanel.js +2 -2
  19. package/source/modules/smart.colorpicker.js +2 -2
  20. package/source/modules/smart.combobox.js +2 -2
  21. package/source/modules/smart.common.js +2 -2
  22. package/source/modules/smart.countryinput.js +2 -2
  23. package/source/modules/smart.dateinput.js +2 -2
  24. package/source/modules/smart.daterangeinput.js +2 -2
  25. package/source/modules/smart.datetimepicker.js +2 -2
  26. package/source/modules/smart.dockinglayout.js +2 -2
  27. package/source/modules/smart.dropdownbutton.js +2 -2
  28. package/source/modules/smart.dropdownlist.js +2 -2
  29. package/source/modules/smart.editor.js +2 -2
  30. package/source/modules/smart.element.js +2 -2
  31. package/source/modules/smart.fileupload.js +2 -2
  32. package/source/modules/smart.form.js +2 -2
  33. package/source/modules/smart.formulaparser.js +2 -2
  34. package/source/modules/smart.ganttchart.js +2 -2
  35. package/source/modules/smart.gauge.js +2 -2
  36. package/source/modules/smart.grid.js +6 -6
  37. package/source/modules/smart.gridpanel.js +2 -2
  38. package/source/modules/smart.gridview.js +6 -6
  39. package/source/modules/smart.input.js +2 -2
  40. package/source/modules/smart.kanban.js +2 -2
  41. package/source/modules/smart.layout.js +2 -2
  42. package/source/modules/smart.led.js +2 -2
  43. package/source/modules/smart.listbox.js +2 -2
  44. package/source/modules/smart.listmenu.js +2 -2
  45. package/source/modules/smart.map.js +2 -2
  46. package/source/modules/smart.maskedtextbox.js +2 -2
  47. package/source/modules/smart.menu.js +2 -2
  48. package/source/modules/smart.multicomboinput.js +2 -2
  49. package/source/modules/smart.multiinput.js +2 -2
  50. package/source/modules/smart.multilinetextbox.js +2 -2
  51. package/source/modules/smart.multisplitbutton.js +2 -2
  52. package/source/modules/smart.numberinput.js +2 -2
  53. package/source/modules/smart.numerictextbox.js +2 -2
  54. package/source/modules/smart.pager.js +2 -2
  55. package/source/modules/smart.passwordinput.js +2 -2
  56. package/source/modules/smart.passwordtextbox.js +2 -2
  57. package/source/modules/smart.path.js +2 -2
  58. package/source/modules/smart.phoneinput.js +2 -2
  59. package/source/modules/smart.pivottable.js +2 -2
  60. package/source/modules/smart.progressbar.js +2 -2
  61. package/source/modules/smart.qrcode.js +2 -2
  62. package/source/modules/smart.querybuilder.js +2 -2
  63. package/source/modules/smart.radiobutton.js +2 -2
  64. package/source/modules/smart.rating.js +2 -2
  65. package/source/modules/smart.ribbon.js +2 -2
  66. package/source/modules/smart.router.js +2 -2
  67. package/source/modules/smart.scheduler.js +2 -2
  68. package/source/modules/smart.scrollbar.js +2 -2
  69. package/source/modules/smart.slider.js +2 -2
  70. package/source/modules/smart.sortable.js +2 -2
  71. package/source/modules/smart.splitter.js +2 -2
  72. package/source/modules/smart.switchbutton.js +2 -2
  73. package/source/modules/smart.table.js +2 -2
  74. package/source/modules/smart.tabs.js +2 -2
  75. package/source/modules/smart.tank.js +2 -2
  76. package/source/modules/smart.textarea.js +2 -2
  77. package/source/modules/smart.textbox.js +2 -2
  78. package/source/modules/smart.timeinput.js +2 -2
  79. package/source/modules/smart.timeline.js +2 -2
  80. package/source/modules/smart.timepicker.js +2 -2
  81. package/source/modules/smart.toast.js +2 -2
  82. package/source/modules/smart.tooltip.js +2 -2
  83. package/source/modules/smart.tree.js +2 -2
  84. package/source/modules/smart.validator.js +2 -2
  85. package/source/modules/smart.window.js +2 -2
  86. package/source/smart.3dchart.js +1 -1
  87. package/source/smart.accordion.js +1 -1
  88. package/source/smart.ajax.js +1 -1
  89. package/source/smart.array.js +1 -1
  90. package/source/smart.barcode.js +1 -1
  91. package/source/smart.bootstrap.js +1 -1
  92. package/source/smart.breadcrumb.js +1 -1
  93. package/source/smart.button.js +1 -1
  94. package/source/smart.buttongroup.js +1 -1
  95. package/source/smart.calendar.js +1 -1
  96. package/source/smart.card.js +1 -1
  97. package/source/smart.cardview.js +1 -1
  98. package/source/smart.carousel.js +1 -1
  99. package/source/smart.chart.annotations.js +1 -1
  100. package/source/smart.chart.api.js +1 -1
  101. package/source/smart.chart.core.js +1 -1
  102. package/source/smart.chart.js +1 -1
  103. package/source/smart.chart.rangeselector.js +1 -1
  104. package/source/smart.chart.waterfall.js +1 -1
  105. package/source/smart.checkbox.js +1 -1
  106. package/source/smart.checkinput.js +1 -1
  107. package/source/smart.chip.js +1 -1
  108. package/source/smart.colorinput.js +1 -1
  109. package/source/smart.colorpanel.js +1 -1
  110. package/source/smart.colorpicker.js +1 -1
  111. package/source/smart.combobox.js +1 -1
  112. package/source/smart.complex.js +1 -1
  113. package/source/smart.core.js +1 -1
  114. package/source/smart.countryinput.js +1 -1
  115. package/source/smart.data.js +1 -1
  116. package/source/smart.date.js +1 -1
  117. package/source/smart.dateformatpanel.js +1 -1
  118. package/source/smart.dateinput.js +1 -1
  119. package/source/smart.daterangeinput.js +1 -1
  120. package/source/smart.datetimepicker.js +1 -1
  121. package/source/smart.dockinglayout.js +1 -1
  122. package/source/smart.draw.js +1 -1
  123. package/source/smart.dropdownbutton.js +1 -1
  124. package/source/smart.dropdownlist.js +1 -1
  125. package/source/smart.editor.js +1 -1
  126. package/source/smart.element.js +1 -1
  127. package/source/smart.elements.js +5 -5
  128. package/source/smart.export.js +1 -1
  129. package/source/smart.fileupload.js +1 -1
  130. package/source/smart.filter.js +1 -1
  131. package/source/smart.filterbuilder.js +1 -1
  132. package/source/smart.filterpanel.js +1 -1
  133. package/source/smart.form.js +1 -1
  134. package/source/smart.format.js +1 -1
  135. package/source/smart.formulaparser.js +1 -1
  136. package/source/smart.ganttchart.js +1 -1
  137. package/source/smart.gauge.js +1 -1
  138. package/source/smart.grid.cell.js +2 -2
  139. package/source/smart.grid.chart.js +1 -1
  140. package/source/smart.grid.column.js +2 -2
  141. package/source/smart.grid.core.js +2 -2
  142. package/source/smart.grid.dialog.js +1 -1
  143. package/source/smart.grid.edit.js +1 -1
  144. package/source/smart.grid.export.js +1 -1
  145. package/source/smart.grid.filter.js +1 -1
  146. package/source/smart.grid.group.js +1 -1
  147. package/source/smart.grid.js +1 -1
  148. package/source/smart.grid.menu.js +1 -1
  149. package/source/smart.grid.pager.js +1 -1
  150. package/source/smart.grid.reorder.js +1 -1
  151. package/source/smart.grid.resize.js +1 -1
  152. package/source/smart.grid.row.js +1 -1
  153. package/source/smart.grid.select.js +1 -1
  154. package/source/smart.grid.sort.js +1 -1
  155. package/source/smart.grid.toolbar.js +2 -2
  156. package/source/smart.grid.tree.js +1 -1
  157. package/source/smart.grid.view.js +1 -1
  158. package/source/smart.gridpanel.js +1 -1
  159. package/source/smart.input.js +1 -1
  160. package/source/smart.kanban.js +1 -1
  161. package/source/smart.layout.js +1 -1
  162. package/source/smart.led.js +1 -1
  163. package/source/smart.listbox.js +1 -1
  164. package/source/smart.listmenu.js +1 -1
  165. package/source/smart.map.js +1 -1
  166. package/source/smart.maskedtextbox.js +1 -1
  167. package/source/smart.math.js +1 -1
  168. package/source/smart.menu.js +1 -1
  169. package/source/smart.multicomboinput.js +1 -1
  170. package/source/smart.multiinput.js +1 -1
  171. package/source/smart.multilinetextbox.js +1 -1
  172. package/source/smart.multisplitbutton.js +1 -1
  173. package/source/smart.numberformatpanel.js +1 -1
  174. package/source/smart.numberinput.js +1 -1
  175. package/source/smart.numeric.js +1 -1
  176. package/source/smart.numerictextbox.js +1 -1
  177. package/source/smart.pager.js +1 -1
  178. package/source/smart.passwordinput.js +1 -1
  179. package/source/smart.passwordtextbox.js +1 -1
  180. package/source/smart.path.js +1 -1
  181. package/source/smart.phoneinput.js +1 -1
  182. package/source/smart.pivottable.js +1 -1
  183. package/source/smart.powerbutton.js +1 -1
  184. package/source/smart.progressbar.js +1 -1
  185. package/source/smart.qrcode.js +1 -1
  186. package/source/smart.radiobutton.js +1 -1
  187. package/source/smart.rating.js +1 -1
  188. package/source/smart.ribbon.js +1 -1
  189. package/source/smart.router.js +1 -1
  190. package/source/smart.scheduler.js +1 -1
  191. package/source/smart.scrollbar.js +1 -1
  192. package/source/smart.slider.js +1 -1
  193. package/source/smart.sortable.js +1 -1
  194. package/source/smart.sparkline.js +1 -1
  195. package/source/smart.splitter.js +1 -1
  196. package/source/smart.switchbutton.js +1 -1
  197. package/source/smart.table.js +1 -1
  198. package/source/smart.tabs.js +1 -1
  199. package/source/smart.tank.js +1 -1
  200. package/source/smart.textarea.js +1 -1
  201. package/source/smart.textbox.js +1 -1
  202. package/source/smart.tickintervalhandler.js +1 -1
  203. package/source/smart.timeinput.js +1 -1
  204. package/source/smart.timeline.js +1 -1
  205. package/source/smart.timepicker.js +1 -1
  206. package/source/smart.toast.js +1 -1
  207. package/source/smart.tooltip.js +1 -1
  208. package/source/smart.tree.js +1 -1
  209. package/source/smart.validationpanel.js +1 -1
  210. package/source/smart.validator.js +1 -1
  211. package/source/smart.window.js +1 -1
  212. package/source/styles/bootstrap/dark/smart.bootstrap.blue.css +3373 -3373
  213. package/source/styles/bootstrap/dark/smart.bootstrap.css +3373 -3373
  214. package/source/styles/bootstrap/dark/smart.bootstrap.cyan.css +3373 -3373
  215. package/source/styles/bootstrap/dark/smart.bootstrap.green.css +3373 -3373
  216. package/source/styles/bootstrap/dark/smart.bootstrap.indigo.css +3373 -3373
  217. package/source/styles/bootstrap/dark/smart.bootstrap.orange.css +3373 -3373
  218. package/source/styles/bootstrap/dark/smart.bootstrap.pink.css +3373 -3373
  219. package/source/styles/bootstrap/dark/smart.bootstrap.purple.css +3373 -3373
  220. package/source/styles/bootstrap/dark/smart.bootstrap.red.css +3373 -3373
  221. package/source/styles/bootstrap/dark/smart.bootstrap.teal.css +3373 -3373
  222. package/source/styles/bootstrap/dark/smart.bootstrap.turquoise.css +3373 -3373
  223. package/source/styles/bootstrap/light/smart.bootstrap.blue.css +3373 -3373
  224. package/source/styles/bootstrap/light/smart.bootstrap.css +3373 -3373
  225. package/source/styles/bootstrap/light/smart.bootstrap.cyan.css +3373 -3373
  226. package/source/styles/bootstrap/light/smart.bootstrap.green.css +3373 -3373
  227. package/source/styles/bootstrap/light/smart.bootstrap.indigo.css +3373 -3373
  228. package/source/styles/bootstrap/light/smart.bootstrap.orange.css +3373 -3373
  229. package/source/styles/bootstrap/light/smart.bootstrap.pink.css +3373 -3373
  230. package/source/styles/bootstrap/light/smart.bootstrap.purple.css +3373 -3373
  231. package/source/styles/bootstrap/light/smart.bootstrap.red.css +3373 -3373
  232. package/source/styles/bootstrap/light/smart.bootstrap.teal.css +3373 -3373
  233. package/source/styles/bootstrap/light/smart.bootstrap.turquoise.css +3373 -3373
  234. package/source/styles/bootstrap/smart.bootstrap.blue.css +234 -215
  235. package/source/styles/bootstrap/smart.bootstrap.css +277 -286
  236. package/source/styles/bootstrap/smart.bootstrap.cyan.css +234 -215
  237. package/source/styles/bootstrap/smart.bootstrap.green.css +234 -215
  238. package/source/styles/bootstrap/smart.bootstrap.indigo.css +234 -215
  239. package/source/styles/bootstrap/smart.bootstrap.orange.css +234 -215
  240. package/source/styles/bootstrap/smart.bootstrap.pink.css +237 -215
  241. package/source/styles/bootstrap/smart.bootstrap.purple.css +237 -215
  242. package/source/styles/bootstrap/smart.bootstrap.red.css +234 -215
  243. package/source/styles/bootstrap/smart.bootstrap.teal.css +234 -215
  244. package/source/styles/bootstrap/smart.bootstrap.turquoise.css +234 -215
  245. package/source/styles/components/smart.datetimeformatpanel.css +1 -1
  246. package/source/styles/components/smart.dropdownbutton.css +1 -1
  247. package/source/styles/components/smart.grid.css +1 -1
  248. package/source/styles/components/smart.ribbon.css +1 -1
  249. package/source/styles/default/scss/smart.dropdownbutton.scss +21 -20
  250. package/source/styles/default/scss/smart.grid.scss +190 -115
  251. package/source/styles/default/smart.dropdownbutton.css +5 -3
  252. package/source/styles/default/smart.grid.css +34 -15
  253. package/source/styles/smart.default.css +2 -2
@@ -1,5 +1,5 @@
1
1
 
2
- /* Smart UI v25.0.2 (2025-11-27)
2
+ /* Smart UI v25.0.1 (2025-11-26)
3
3
  Copyright (c) 2011-2024 jQWidgets.
4
4
  License: https://htmlelements.com/license/ */ //
5
5
 
@@ -1425,7 +1425,7 @@ Smart.Utilities.Assign("ConditionalFormatter",class{constructor(e){const t=this;
1425
1425
  /***/ 9719:
1426
1426
  /***/ (() => {
1427
1427
 
1428
- (()=>{Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,l.format=null,l.formula=null,e._style){const a=e._style;t.autoGenerated||(l.color=void 0!==a.color?a.color:null,l.background=void 0!==a.background?a.background:null,l.fontFamily=void 0!==a.fontFamily?a.fontFamily:null,l.fontSize=void 0!==a.fontSize?a.fontSize:null,l.fontStyle=void 0!==a.fontStyle?a.fontStyle:null,l.textDecoration=void 0!==a.textDecoration?a.textDecoration:null,l.fontWeight=void 0!==a.fontWeight?a.fontWeight:null),a[t.dataField]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[t.dataField][e]&&(l[e]=a[t.dataField][e],l._styleChanged=!0)}))}if(l.grid&&l.grid.formulas){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(a,i){if("value"===i){const a=l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if(l.grid&&l.grid.formulas&&(l.formula||t.formula)){const a=l.grid._formulaParser;if(a){if(l.grid&&l.grid.formulas&&l._formula!==t.formula){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return a.parse(l.formula.slice(1))}}return a}if("editor"===i||"template"===i)return a[i]||l.column[i];if("focused"===i){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===i)return!0===l.row.getProperty("selected")||(!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField]);if("modifiedValue"===i){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const e=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==e?e:a.value}return a[i]},set:function(e,a,i){const r=this.get(e,a);if(r===i)return!0;if(e[a]=i,"element"===a||"isEditing"===a||"oldValue"===a||"_updating"===a||"notifyFn"===a||a.startsWith("_")||"canNotify"===a)return!0;if("error"===a)return!0;if("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||"formula"===a)return"formula"===a&&(l.formula=l._parseFormula(l.formula)),!0;if("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a){void 0===l.oldValue&&(l.oldValue=r),null==i&&delete l._formula;(()=>{if(l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),void 0===i&&(i=null),null!==i&&void 0!==i.label&&void 0!==i.value)l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value;else if(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i,l.column.displayField!==l.column.dataField&&"object"!=typeof i)if(l.column._dataSource){let e=i;for(let t=0;t<l.column._dataSource.length;t++)if(l.column._dataSource[t].value===i){e=l.column._dataSource[t].label;break}l.row.data[l.column.displayField]=e}else l.row.data[l.column.displayField]=i;const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;if(l.grid.dataSource)if(null!==i&&i.label&&i.value&&l.column.displayField!==l.column.dataField)l.grid._sortedColumns&&l.grid._sortedColumns.length>0?(e[l.column.dataField]=i.value,e[l.column.displayField]=i.label):(l.grid.dataSource.boundSource[t][l.column.dataField]=i.value,l.grid.dataSource.boundSource[t][l.column.displayField]=i.label);else if(i!==l.grid.dataSource.boundSource[t][l.column.dataField])if(l.grid._sortedColumns&&l.grid._sortedColumns.length>0)e[l.column.dataField]=i;else if(l.grid.dataSource.boundHierarchy&&l.grid.dataSource.childrenDataField){const t=(e=>function e(t,a){for(let i=0;i<t.length;i++){const r=t[i];if(r.id===a)return r;if(r[l.grid.dataSource.childrenDataField]&&r[l.grid.dataSource.childrenDataField].length>0){const t=e(r[l.grid.dataSource.childrenDataField],a);if(t)return t}}return null}(l.grid.dataSource.boundSource,e))(e.$.id);t&&(t[l.column.dataField]=i),e[l.column.dataField]=i}else l.grid.dataSource.boundSource[t][l.column.dataField]=i}l.grid.dataSource.boundSource.canNotify=!0,l.grid.onCellValueChanged&&i!==r&&l.grid.onCellValueChanged({id:l.row.id,dataField:l.column.dataField,value:i,oldValue:r})})()}return"selected"===a?(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0),l.grid._recycle(!1,!0,!1),l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0):!(!l._updating&&l.canNotify)||(l.grid._recycle(),!l.row.canNotify||(l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0))}})}_parseFormula(e){const t=this.row;if(!e)return e;return"string"!=typeof e&&(e=""+e),!1===e.startsWith("=")&&(e="="+e),e=function(e,t){return e.replace(/COL\(([^)]+)\)/g,((e,l)=>`${l}${t}`))}(e,1+t.index)}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const r=a[e];l+=`${r}: ${i};`},r=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<r.length;e++)i(r[e]);e.getAttribute("style")!==l&&(""===l?e.removeAttribute("style"):e.setAttribute("style",l)),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.grid&&!t.grid.appearance.showSelectionOnTop||t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(l.column.placeholder&&e===l.column.placeholder)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("any"===l.column.dataType||"string"===l.column.dataType&&t&&t.length){let a=!1;const i=""+e;if((i.indexOf("/")>=0||i.indexOf("-")>=0||i.indexOf(":")>=0)&&(t.indexOf("d")>=0&&t.indexOf("M")>=0&&(a=!0),(t.indexOf("d")>=0||t.indexOf("M")>=0||t.indexOf("y")>=0||t.indexOf("h")>=0||t.indexOf("H")>=0||t.indexOf("m")>=0)&&(a=!0)),a){let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{"string"==typeof e&&(e=parseFloat(e));let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat){return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e)}!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const a=t.NumberFormat&&void 0!==t.NumberFormat.maximumFractionDigits?t.NumberFormat.maximumFractionDigits:2,i=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:a,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+i.replace("-","")+")":i}if(l.column.formatSettings.Intl.NumberFormat.locale){return new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,t.NumberFormat).format(e)}{const a=new Intl.NumberFormat(this.grid.locale,t.NumberFormat).format(e);if("percent"===l.column.formatSettings.Intl.NumberFormat.style){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits?l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits:2;return new Intl.NumberFormat(this.grid.locale,{style:"decimal",minimumFractionDigits:t}).format(100*e)+" %"}return"squaremeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m²":"cubicmeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m³":a}}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const r=i.formatNumber(e,t);return void 0===r?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+r+")":r}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let r=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(r=r.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let n=0;n<i._cellsMerge.length;n++){const s=i._cellsMerge[n];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=r.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)r[t]&&-1===o.indexOf(r[t])&&o.push(r[t])}if(d.push(s.column.dataField),s.colspan>1){const e=i.columns.indexOf(i.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const r=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=r,r}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=s,e.appendChild(a),e.appendChild(n),n.setAttribute("content",""),a.setAttribute("indent",""),r.setAttribute("label",""),i.setAttribute("toggle-button",""),i.setAttribute("role","presentation"),i.setAttribute("aria-label","Expand/Collapse Row"),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),s.setAttribute("aria-checked","false"),s.setAttribute("aria-label","Select Row"),l.setAttribute("has-toggle-button",""),n.appendChild(i),n.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),n.appendChild(r),l.content=r}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let r=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(r=!0,e.row.filterRow&&(r=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(r=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(r=!1)),r)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group",""),e.setAttribute("role","gridcell");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let r=a.label;const n=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&n(e,i.children,l))}return l};let s="";if(void 0!==a.label){let o="",d=[];if(t.grouping.summaryRow.visible){let r=[];const s={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;c.length&&(r=n(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[])),s[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([s],r):null;if(m)for(let r=0;r<c.length;r++){const n=c[r];r>0&&(o+=", ");let u=m[l.dataField][n];const p=l.cellsFormat;if(void 0!==u){if(p&&(u=e.cell.getFormattedValue(u,p)),i){const i=t.columnByDataField[a.groupDataField];if(i){s[i.dataField]=c,m[i.dataField]=m[l.dataField],u=m[i.dataField][n];const t=i.cellsFormat;t&&(u=e.cell.getFormattedValue(u,t))}}o+=t.localize(n,{value:u}),m[l.dataField]&&m[l.dataField][n]&&d.push(m[l.dataField][n])}}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)r="<div header group-advanced><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let n="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e||t.label===e));t&&t.color?(n=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}else if("object"==typeof e&&e&&e instanceof Date){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,"d")}const s=t.editing.addNewRow.visible?'<span add-row class="smart-grid-icon smart-icon-plus-circled show"></span>':"";if(r=`<div style="${n}" header group-advanced><span group>${s}${i}: </span><span value>${e}</span>`,e=""+e,e&&e.indexOf(",")>=0){let t="";r=`<div style="display: flex;" header group-advanced><span group>${s}${i}: </span>`;let a=e.split(",");for(let e=0;e<a.length;e++){let i=a[e].trim();if(l&&l.editor&&l.editor.dataSource){const e=l.editor.dataSource.find((e=>e.value===i||e.label===i));e&&e.color?(n=`--smart-primary: ${e.color}`,e.label&&(i=e.label)):e&&e.label&&(i=e.label),t+=`<span style="${n}" value>${i}</span>`}}r+=t}o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=""+o,r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)r="<div header><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label;if(l.displayField!==l.dataField&&a.data.data&&(e=a.data.data[l.displayField]),"object"==typeof e&&l.cellsFormat){e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)}r="<div header><span group>"+i+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("basic"===t.grouping.renderMode){if(r=a.label,l.displayField!==l.dataField&&a.data.data&&(r=a.data.data[l.displayField]),"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}else if("multipleColumns"===t.grouping.renderMode){if(r=a.label,"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),r=o;s=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&i){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const n=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];n.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),a.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",n.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';n.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),n.innerHTML=m,c.innerHTML=r,i&&t.grouping.formatFunction){const i={row:a,column:l,groupDataField:a.groupDataField,cell:e.cell,value:r,data:a.data,template:null},n=t.grouping.formatFunction(i);n&&(i.value=n),i.value!==r?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:t._unescapeString(r)):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(o.innerHTML=r,l.summary.length&&t.grouping.summaryRow.inline&&r&&e.classList.remove("smart-hidden"));void 0!==a.label&&t.grouping.enabled&&i&&!l._treeColumn&&l.summary.length&&t.grouping.summaryRow.inline&&r&&(t.rightToLeft||e.style.left!==l.left+"px"&&(e.style.left=l.left+"px"),e.removeAttribute("has-toggle-button",""),r=s,o.innerHTML=r);let d="smart-label";e.style.zIndex="";const c=t.editing.addNewColumn.visible&&t._addNewColumn?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l&&(l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),l.summary.length&&t.grouping.summaryRow.inline&&r&&(e.style.width=l.computedWidth+"px",e.style.zIndex=11,e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign));if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),o.className!==d&&(o.className=d),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,data:null,group:{value:r,template:null}},i=l.formatFunction(t);if(i&&(t.group.value=i),t.group.value!==r)if(l._treeColumn){o.children[1].children[2].innerHTML=t.group.value}else o.innerHTML=t.group.value;null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const r=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:r,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:r,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:r,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:r,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:r,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:r,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:r,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:r,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:r,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:r,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]);const n=l._getFilterDataType(a);i="string"===n?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let s="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition||void 0===a._filterInfo.condition)a._filterInfo.condition="",s="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":s="smart-icon-equals";break;case"starts_with":s="smart-icon-starts-with";break;case"ends_with":s="smart-icon-ends-with";break;case"not_equal":s="smart-icon-not-equal";break;case"less_than":s="smart-icon-less-than";break;case"less_than_or_equal":s="smart-icon-less-than-or-equal";break;case"greater_than":s="smart-icon-greater-than";break;case"greater_than_or_equal":s="smart-icon-greater-than-or-equal";break;case"contains":s="smart-icon-contains";break;case"does_not_contain":s="smart-icon-does-not-contain";break;case"range":s="smart-icon-between";break;default:s="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${s} show"></i></div> `;if("string"===n)o+=`<input class="smart-filter-input-value" data-type="${n}" /> `,e.innerHTML=o;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;o+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const i=document.createElement("div");i.classList.add("smart-input"),i.classList.add("smart-grid-check-box-cell-editor"),i.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),i.setAttribute("checked","indeterminate"),a._filterInfo&&a._filterInfo.value?i.setAttribute("checked",""):a._filterInfo&&!1===a._filterInfo.value&&i.removeAttribute("checked"),o=i.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const d=e.querySelector("input");if(d&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),d.onpaste=function(e){setTimeout((()=>{l._handleFilterCellKeyUp(this.cell,e)}))}.bind(this),d.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),d.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),d.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),d.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=d,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&d&&(d.value=a._filterInfo.value,"date"===a.dataType&&(d.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),e.removeAttribute("disabled"),a.allowFilter||(d.disabled=!0,e.setAttribute("disabled","")),a.filterEditor||"multi"===a.filterMenuMode)if("multi"===a.filterEditor.template||"multi"===a.filterMenuMode){const t=document.createElement("div");t.className="smart-arrow-down",t.style.fontSize="16px",t.style.marginRight="4px",t.style.marginLeft="4px",t.style.alignSelf="center",t.style.cursor="pointer",t.onclick=function(e){l._handleFilterCellExcelIconClick(this.cell)}.bind(this),e.appendChild(t)}else if(a.filterEditor.template){const t=a.filterEditor.template,i=document.createElement("div");if(a.filterTemplate instanceof HTMLTemplateElement)i.appendChild(t.content.cloneNode(!0));else if(t instanceof HTMLElement)i.appendChild(t);else if("checkList"===t){const e=document.createElement("smart-drop-down-list");e.className="smart-filter-check-list",e.selectionMode="checkBox",e.filterable=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownAppendTo="body",e.dropDownButtonPosition="right",e.dataSource=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField),e.whenRendered((()=>{e.checkAll()})),a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember),e.onchange=()=>{const t=this.cell.column;if(e.selectedValues.length===e.dataSource.length)return t._filterInfo.value=null,e.close(),delete t._filterInfo.excelValues,void l.removeFilter(t.dataField);t._filterInfo.excelValues=e.selectedValues,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else if("list"===t||"dropDownList"===t||"select"===t){const e=document.createElement("smart-input");e.className="smart-filter-list",e.readonly=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownButtonPosition="right",a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember);let t=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField);t=[{label:"-",value:null}].concat(t),e.dataSource=t,e.onchange=()=>{this.cell.column._filterInfo.value=e.selectedValue,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else i.innerHTML=t;e.innerHTML="",e.appendChild(i),i.style.height="100%",i.style.width="100%";const r=e.querySelector("input");r&&(r.onfocus=()=>{e.setAttribute("focus","")},r.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,i)}else void 0!==a.filterEditor.min&&(d.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(d.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(d.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(d.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(d.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(d.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(d.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(d.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(t,l,a){const i=this,r=i.cell.grid,n=i.cell.column;r._cellCachedValues||(r._cellCachedValues=[]);const s=()=>!!r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML!==r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML=r._cellCachedValues[n.dataField+"_"+t]),i.cell._setStyle(a),i.setAttribute("template",i.cell.template),!0);let o=null;switch((!r.editing.enabled||!n.allowEdit||i.cell.readonly||"none"===r.editing.action||r.editing.enabled&&r.editing.commandColumn.visible&&r.editing.editRow!==i.cell.row)&&i.setAttribute("readonly",""),n.placeholder&&t===n.placeholder&&(t=""),l){case"checkBox":case"radioButton":case"switchButton":if(a.firstElementChild&&a.firstElementChild.classList&&a.firstElementChild.classList.contains("smart-input")){if(o=a.firstElementChild,t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),o.setAttribute("color","")}return void i.cell._setStyle(a)}if(o=document.createElement("span"),o.className="smart-input",t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color)}a.innerHTML="",a.appendChild(o),i.cell._setStyle(a);break;case"checklist":if(t&&t.indexOf("[")>=0&&(t=JSON.parse(t)),a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&e===t.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t&&Array.isArray(t)&&t.length>0){const e=t.filter((e=>e.completed)).length,l=["#D50000","#F4511E","#F6BF26","#33B679"],a=e+"/"+t.length;let i=l[0];e===t.length?i=l[3]:e>0&&e<t.length&&(i=l[2]),t=`<div style="display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${i}; width:16px; height: 16px;"><span title="${a}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${a}</span></div>`}else t="";o=document.createElement("span"),o.innerHTML=t,i.setAttribute("template",i.cell.template),o.setAttribute("value",t.length);break;case"createdBy":case"updatedBy":{const e=i.cell.row;let t=null,s=null;if(t="createdBy"===l?e.createdBy:e.updatedBy,e.history&&e.history.length&&(t="createdBy"===l?e.history[0].user:e.history[e.history.length-1].user),a.firstElementChild&&a.firstElementChild.hasAttribute("user-id")){if(t===parseInt(a.firstElementChild.getAttribute("user-id")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const l=a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild?a.firstElementChild.firstElementChild.firstElementChild.firstElementChild:null;if(l){a.firstElementChild.setAttribute("user-id",t);const i="string"==typeof e?e:e.name,r="string"==typeof e?null:e.color;if(("string"==typeof e?null:e.image)&&(l.firstElementChild.style.backgroundImage=`url('${e.image}')`),r){const e=new Smart.Color(r).getInvertedColor();l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",r),l.setAttribute("color",e),l.lastElementChild.textContent=i}else l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",""),l.setAttribute("color","");return}}}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id),d.style.width="100%",d.style.paddingRight="6px";let c='<div class="smart-flex smart-flex-auto smart-tokens-layout">';if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,i=document.createElement("span");if(a&&(i.style.backgroundImage=`url('${e.image}')`,i.className="smart-drop-down-list-selection-image"),l){c+='<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+'; overflow: visible;" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c+='<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c=""}d.innerHTML=c+"</div>";const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),o=m,o.setAttribute("user-id",t),i.setAttribute("template",i.cell.template);break}case"collaborator":case"tags":{let e=[];if("number"==typeof t&&(t=""+t),""===t||null===t||"uncategorized"===t){let e=`\n <div class="smart-multi-combo-input-container tokens smart-flex smart-flex-auto" data-field="${n.dataField}" row-id="${i.cell.row.id}"> \n <div class="smart-multi-combo-input" data-field="${n.dataField}" row-id="${i.cell.row.id}" class="tokens smart-flex smart-flex-auto">\n <div class=" smart-flex-auto smart-flex"></div>\n </div>\n </div>\n `;return a.innerHTML!==e&&(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild&&""===a.firstElementChild.firstElementChild.firstElementChild.textContent?(a.firstElementChild.setAttribute("row-id",i.cell.row.id),a.firstElementChild.firstElementChild.setAttribute("row-id",i.cell.row.id)):a.innerHTML=e),n.placeholder&&a.firstElementChild&&a.firstElementChild.firstElementChild&&(a.firstElementChild.firstElementChild.innerHTML=n.placeholder),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;if(null!==t&&(e=Array.isArray(t)?e.map((e=>e.trim())):t.indexOf("{")>=0||"[]"===t?JSON.parse(t):t.split(",").map((e=>e.trim()))),a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&n.editor._items&&n.editor._items[t]){if(a.firstElementChild.getAttribute("value")===t){i.cell._setStyle(a),i.setAttribute("template",i.cell.template);const e=n.editor.dots;if(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild){if(a.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),a.firstElementChild.firstElementChild.firstElementChild.firstElementChild){const t=a.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild;t&&(e?t.classList.add("dots"):t.classList.remove("dots"))}if(i.cell.row.height>45){a.firstElementChild.firstElementChild.firstElementChild.classList.add("smart-flex-wrap");const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1)for(let t=0;t<e.children.length;t++)e.children[t].style.maxWidth&&(e.children[t].style.maxWidth="")}else if(r.layout.rowHeight<=45&&i.cell.row.height<=45){const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1){const t=parseInt(n.computedWidth/e.children.length)-5;let l=0;for(let t=0;t<e.children.length;t++)l+=e.children[t].textContent.length,e.children[t].style.maxWidth="";if(14*l*.52+20*e.children.length>n.computedWidth)for(let l=0;l<e.children.length;l++)e.children[l].style.maxWidth=t+"px"}}}return}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id);let c='<div class="smart-tokens-layout smart-flex smart-flex-auto">';if(e.length>2&&i.cell.row.height>45){c='<div style="max-width: '+(n.computedWidth-10+"px")+'" class="smart-flex smart-flex-wrap">'}let m=0;if(t)for(let t=0;t<e.length;t++){const a=e[t];let i=null;if("collaborator"===l||n.editor&&n.editor.collaborator)i=r.users.find((e=>{if("string"==typeof a||"number"==typeof a){if(e.value===a||parseInt(e.value)===parseInt(a))return e;if(e.id===a||parseInt(e.id)===parseInt(a))return e}else if("object"==typeof a&&e.value===a.value)return e})),i&&(i.label=i.name);else{const e=n.editor.dataSource||n.options;if(e)if("string"==typeof a&&n.editor._items&&n.editor._items[a])i=n.editor._items[a];else{for(let t=0;t<e.length;t++){const l=e[t];if(void 0!==l.value&&void 0!==a&&void 0!==a.value&&l.value===a.value){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}if(void 0===l.value&&l===a||void 0!==l.value&&""+l.value===a){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}}n.editor.allowItemsAdd&&!i&&a&&(i=a)}else i=a}if(!i)continue;const s="string"==typeof i?i:i.label,o="string"==typeof i?null:i.color,d="string"==typeof i?null:i.image;if(""===s)continue;const u=document.createElement("span");d&&(u.style.backgroundImage=`url('${i.image}')`,u.className="smart-drop-down-list-selection-image");const p="smart-truncate";if(o&&n.editor.colorItems){const e=new Smart.Color(o).getInvertedColor(),t=n.editor.dots?" dots":"";c+='<span title="'+s+'" data-item="'+s+'" style="background: '+o+"; color: "+e+"; --smart-primary-color: "+e+'; overflow: visible;" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label"+t+'\' role="presentation">'+s+"</span>"}else c+='<span title="'+s+'" data-item="'+s+'" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>";m+=s.length;if(n.editor.dataSource||n.options){if(n.editor.singleSelect){c+="</span>";break}c+='<span class=\'smart-hidden smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else c+="</span>"}d.innerHTML=c+"</div>";const u=14*m*.52,p=d.firstElementChild;if(r.layout.rowHeight<=45&&i.cell.row.height<=45&&d&&p.children.length>1&&u+20*p.children.length>n.computedWidth){const e=parseInt(n.computedWidth/p.children.length)-5;for(let t=0;t<p.children.length;t++)p.children[t].style.maxWidth=e+"px"}if(d.style.width="100%",d.style.paddingRight="6px",d.onpointerdown=t=>{if(!r._mobile)if(t.target&&"#text"!==t.target.nodeName&&t.target.classList.contains("smart-drop-down-list-unselect-button")){let l=t.target.parentNode.getAttribute("data-item");const a=n.editor.dataSource||n.options;if(a&&"string"==typeof l&&a)for(let e=0;e<a.length;e++)a[e].label===l&&(l=a[e],l.value&&(l=l.value));if(e[0]&&e[0].label){const a=e.map((e=>e.value)).indexOf(l);if(a>=0){e.splice(a,1);const l=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,JSON.stringify(e)),r.onCellUpdate&&r.onCellUpdate([i.cell],[l],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(e.indexOf(l)>=0){e.splice(e.indexOf(l),1);const a=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,s),r.onCellUpdate&&r.onCellUpdate([i.cell],[a],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(t.target.classList.contains("smart-drop-down-list-selection-label")){if(r.editing.enabled&&r.editing.allowListOpenOnContentClick){const e=t.target.closest(".smart-multi-combo-input"),l=e.getAttribute("data-field"),a=e.getAttribute("row-id");r.beginEdit(a,l)}t.stopPropagation(),t.preventDefault()}},!n.cellsWrap&&n.allowEdit&&r.editing.enabled&&"card"!==r.view){let t=n.editor.dataSource&&n.editor.dataSource.length;n.editor.collaborator&&(t=r.users&&r.users.length);const l=document.createElement("div");t&&l.classList.add("items"),l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),l.appendChild(d),o=l}else if(n.cellsWrap||n.allowEdit){const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),t.appendChild(d),o=t}else d.classList.add("smart-flex-auto","smart-flex","tokens"),o=d;i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break}case"dropdownGrid":case"dropDownList":case"dropdownlist":case"list":{const e=document.createElement("div");if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(a.firstElementChild.getAttribute("value")===t&&!i.cell.column._isDirty)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if("dropdownGrid"!==i.cell.template){if(s()){const e=a.querySelector(".smart-arrow-down");return void(e&&(e.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}))}}if("dropdownGrid"===i.cell.template){const l=i.cell.column.templateSettings.dataFields;let a=i.cell.editor.dataSource?i.cell.editor.dataSource[t]:"";if(i.cell.column.relationId&&i.cell.column.relationField&&i.cell.column._isDirty&&(!i.cell.column.editor.dataSource||i.cell.column.editor.dataSource&&0===i.cell.column.editor.dataSource.length)){const e=r._getRelationData(i.cell.column.relationId,i.cell.column.relationField,i.cell.column.relationCascadingFields),l=r._getRelationColumns(i.cell.column.relationId);e&&(a=e[t]),i.cell.column.editor.columns=l,i.cell.column.editor.dataSource=e}if(e.classList.add("smart-flex","center"),e.style.alignItems="center",e.onmouseenter=()=>{e.querySelectorAll("i").forEach((e=>e.classList.add("show")))},e.onmouseleave=()=>{e.querySelectorAll("i").forEach((e=>e.classList.remove("show")))},a){e.style.justifyContent="space-between";let t="";for(let e=0;e<l.length;e++){const i=a[l[e]];i&&(t+='<span style="" class="smart-truncate smart-token smart-flex middle center ">'+i+"</span>")}e.innerHTML=t}else e.style.justifyContent="",e.innerHTML='<span class="smart-truncate"></span>'}else"card"===r.view?e.textContent=t:e.innerHTML='<span class="smart-truncate">'+t+"</span>";if(n.allowEdit&&r.editing.enabled&&"card"!==r.view){const t=document.createElement("span");t.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),e.classList.add("smart-flex-auto","smart-multi-combo-input"),l.appendChild(e),l.appendChild(t),l.classList.add(i.cell.template.toLowerCase()),o=l,t.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}}else o=e;i.setAttribute("template",i.cell.template.toLowerCase()),o.setAttribute("value",t);break}case"password":a.innerHTML=t?'<span class="smart-truncate">'+t.replace(/./g,"*")+"</span>":"",i.setAttribute("template",i.cell.template);break;case"richText":if(a.innerHTML=t?'<div class="textwrap" style="height: 100%; padding-top: 5px; padding-left: 5px;">'+r._unescapeString(t)+"</div>":"",r.layout.autoWrap&&i.cell.row.height>40&&1===i.cell.colSpan&&"string"===n.dataType){null==t&&(t="");if(14*t.length*.52>n.computedWidth){const e=parseInt(i.cell.row.height/20);a.firstElementChild.style["-webkit-line-clamp"]=e}}a.onpointerdown=e=>{if(!r._mobile&&r.editing.enabled){const t=r.offset(a);if(e.pageX>t.left+a.offsetWidth-20){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),i=l.getAttribute("data-id");delete r._beginEditKey,r.beginEdit(i,a)}}},o=a.firstElementChild,i.setAttribute("template",i.cell.template);break;case"color":a.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${t};"></span>`,i.setAttribute("template",i.cell.template);break;case"autoNumber":o=document.createElement("span"),o.innerHTML=1+i.cell.row.visibleIndex,i.setAttribute("template",i.cell.template);break;case"uuid":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}o=document.createElement("span"),o.style.paddingLeft="7px";const e=r._generateUUID(),l=i.cell.canNotify;i.cell.canNotify=!1,t||(i.cell.value=e,r.onCellUpdate&&!r.editing.editRow&&r.onCellUpdate([i.cell],[e],[e],(function(){r.onCellUpdated&&r.onCellUpdated([i.cell.row.index],[i.cell.row],[i.cell.column],[i.cell.row.data],[i.cell.value],[i.cell.value],i)}),i)),o.textContent=i.cell.value,i.cell.canNotify=l,i.setAttribute("template",i.cell.template),o.setAttribute("value",e);break}case"ai":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=(e,t)=>{const l=r.ai.url,a=r.ai.key;e.stopPropagation(),e.preventDefault();const i=e.target.closest("smart-grid-cell"),n=e.target.closest("smart-grid-row"),s=i.getAttribute("data-field"),d=n.getAttribute("data-id");t?(e.target.classList.remove("smart-icon-reload"),e.target.classList.add("smart-grid-loading")):e.target.classList.add("smart-grid-loading");let c=""+r.columnByDataField[s].AIQuery;r.columnByDataField[c]&&(c=""+r.getCellValue(d,c));for(let e=0;e<r.ai.promptVariables.length;e++){const t=r.ai.promptVariables[e],l=r.getCellValue(d,t.dataField)||"",a=new RegExp(`{{${t.name}}}`,"g");c=c.replace(a,l)}c=c.trim(),c=c.replaceAll("\n"," "),c=c.replaceAll("\r"," "),c=c.replaceAll(" "," "),c=c.substring(0,2e3),c&&l&&a?async function(e){e+="\nRespond in less than "+r.ai.maxResponseLength+" words.",e+="\nOutput always in plain text.";const t=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r.ai.model,messages:[{role:"user",content:e}],max_tokens:r.ai.maxTokens,temperature:r.ai.temperature})});if(!t.ok)throw new Error(`Error: ${t.statusText}`);return(await t.json()).choices[0].message.content.trim()}(c).then((e=>{const t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");r.setCellValue(d,s,t),o.setAttribute("value",t)})).catch((e=>{console.error("Error:",e)})):(r.setCellValue(d,s,r.localize("noResults")),o.setAttribute("value",r.localize("noResults")))};if(t){o=document.createElement("span"),o.style.paddingLeft="7px",o.classList.add("smart-flex");const l=i.cell.canNotify;i.cell.canNotify=!1,o.textContent=i.cell.value,i.cell.canNotify=l;const a=document.createElement("span");o.appendChild(a),a.classList.add("smart-grid-icon","show","smart-icon-reload"),a.style.position="absolute",a.style.right=a.style.top="0px",a.onpointerdown=t=>{e(t,!0)},i.setAttribute("template",i.cell.template),o.setAttribute("value",t)}else o=document.createElement("div"),o.classList.add("smart-flex","center","middle"),o.style.height="100%",o.innerHTML=`<button style="border-radius: 10px; line-height: 13px; height: 30px; padding-inline: 30px; padding-block: 2px;" class="smart-button" type="button">✨︎ ${r.localize("generate")}</button\n `,o.firstElementChild.onpointerdown=t=>{e(t)},i.setAttribute("template",i.cell.template);break}case"createdDate":case"createdTime":{const e=i.cell.row;let t=e.createdDate;if(s())return;e.history&&e.history[0]&&(t=e.history[0].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("created-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span created-date class="align-left smart-truncate">'+l+" "+r+"</span>";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break}case"updatedDate":case"updatedTime":if(s())return;if(i.cell.row.updatedDate){const e=i.cell.row;let t=e.updatedDate;e.history&&(t=e.history[e.history.length-1].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("updated-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span updated-date class="align-left smart-truncate">'+l+" "+r+"</span>"}else a.innerHTML="";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break;case"progress":{const e=t?parseInt(100*t)+"%":"0%";if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const l="white",r=["#D50000","#F4511E","#F6BF26","#33B679"];let s=r[0];if(s=t<.25?r[0]:t<.5?r[1]:t<.75?r[2]:r[3],n.templateSettings){if(n.templateSettings.getComputedValue){const e=n.templateSettings.getComputedValue(i.cell.row.data,i.cell.row,i.cell.column,t);t=e}if(n.templateSettings.conditions){for(let e=0;e<n.templateSettings.conditions.length;e++){const l=n.templateSettings.conditions[e];null!==l.value&&t>=l.value&&(s=l.color)}let l=0,r=1;void 0!==n.templateSettings.min&&(l=n.templateSettings.min),void 0!==n.templateSettings.max&&(r=n.templateSettings.max);const o=t/(r-l)*100;return a.innerHTML=`\n <div style="height: 40%; top: 30%; position: relative; left: 5%; right:5%; width: 90%; overflow:hidden; border-radius: 8px; background: var(--smart-surface); border: 1px solid var(--smart-border);" class="smart-grid-progress-container" role="progressbar" \n aria-valuemin="0" aria-valuemax="100" aria-valuenow="${t}" \n aria-label="Progress: ${e}" tabindex="0">\n <div class="smart-grid-progress-fill" style="width: ${o}%; background: ${s};">\n <span class="smart-grid-progress-label">${e}</span>\n </div>\n </div>\n `,void i.setAttribute("template",i.cell.template)}}a.innerHTML='<div value="'+e+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+e+';"><div title="'+e+'" style="width: 100%; height: 4px; background: '+s+"; color: "+l+';" class="smart-truncate smart-token"></div></div><span>'+e+"</span></div>",i.setAttribute("template",i.cell.template);break}case"rating":{const e=i.cell.column.editor.max?i.cell.column.editor.max:5,l=t?parseInt(t):0;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(l===parseInt(a.firstElementChild.getAttribute("value")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);a.firstElementChild.setAttribute("value",l);for(let t=0;t<e;t++){const e=a.firstElementChild.children[t];let i="";l>0&&l>t&&(i="value"),i?e.classList.add("value"):e.classList.remove("value")}return void i.setAttribute("template",i.cell.template)}const n=t=>{let l="";for(let a=0;a<e;a++){let e="";t>0&&t>a&&(e="value"),l+=`<div rating-value title="${a+1}" value="${a+1}" class="smart-grid-icon show smart-icon-star ${e}"></div>`}return l};a.innerHTML=`<div value="${l}" class="rating">${n(l)}</div>`;const s=e=>{if(!r._mobile&&e.hasAttribute("rating-value")){const t=e.getAttribute("value"),l=e.closest("smart-grid-cell"),a=e.closest("smart-grid-row");if(l&&a){const e=l.querySelector(".rating"),s=a.getAttribute("data-id"),o=l.getAttribute("data-field"),d=r.rowById[s],c=r.getCellValue(s,o),m=l.cell;let u=null;r.storeHistory&&(u=r._stringifyRow(d)),c===t?(a.row.data[o]=0,e.innerHTML=n(0),e.setAttribute("value",0)):(a.row.data[o]=parseInt(t),e.innerHTML=n(parseInt(t)),e.setAttribute("value",t));const p=a.row.data[o];r._setCellUndoRedo(m,c,p),r.onCellUpdate&&r.onCellUpdate([m],[c],[p],(function(e){r.onCellUpdated&&r.onCellUpdated([m.row.index],[m.row],[m.column],[m.row.data],[c],[p],i),r._onCellUpdated&&r._onCellUpdated(m.row.index,m.row,m.column,m.row.data,c,p)}),i);const g=e=>{if(e!==c&&(d.updatedDate=new Date,d.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(d);t[m.column.dataField]=e,r._updateRowHistory(d,u,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p);const f=l.querySelector(".rating"),h=parseInt(t)-1;f.children[h].classList.add("down"),setTimeout((()=>{f.children[h].classList.remove("down")}),1e3)}}},o=(e,t=!0)=>{if(e&&[...e.querySelectorAll(".smart-icon-star")].forEach((e=>{e.classList.remove("hover")})),e.hasAttribute("value")){const l=[...e.parentElement.children],a=l.indexOf(e);l.forEach(((e,l)=>{e.classList.remove("hover"),l<=a&&t&&e.classList.add("hover")}))}};r.editing.enabled?(r.handleRatingClick||(r._handleRatingMove=o,r._handleRatingClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointermove=e=>{o(e.target)},a.firstElementChild.onpointerleave=e=>{o(e.target)}):a.firstElementChild.style.pointerEvents="none",i.setAttribute("template",i.cell.template);break}case"vote":{let e=t;const l=(e,t)=>{const l=e.firstElementChild.firstElementChild,a=r.users?r.users.length:1,i=t.length*(100/a)+"%",n=t.length>0?"voted":"",s=l.firstElementChild,o=s.children[0];l.children[1].children[0].classList.remove("smart-votes-bar-animate"),r.isScrolling||l.children[1].children[0].classList.add("smart-votes-bar-animate");const d=l.children[1].firstElementChild.children[0],c=l.children[2];s.classList.remove("voted"),o.classList.remove("smart-icon-check"),n&&(o.classList.add("smart-icon-check"),s.classList.add("voted")),c.textContent=t.length,d.style.width=i,e.firstElementChild.setAttribute("value",t)};if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const t=a.firstElementChild.getAttribute("value"),r=a.firstElementChild;return r.removeAttribute("color"),r.style.setProperty("--smart-check-template-color","var(--smart-primary)"),r.style.setProperty("--smart-check-template-forecolor","#ffffff"),i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(r.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),r.setAttribute("color","")),e=e?e.split():[],l(a,e),e===t?(i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)):(a.firstElementChild.setAttribute("value",e),void i.setAttribute("template",i.cell.template))}const n=e=>{e&&!Array.isArray(e)&&(e=e?e.split():[]);const t=r.users?r.users.length:1,l=e.length*(100/t)+"%;";return`<div vote-value class="smart-flex middle center smart-votes-cell-component">\n <div class="smart-flex middle center smart-vote-button ${e.length>0?"voted":""}">\n <span class="smart-icon smart-grid-icon show ${e.length>0?"smart-icon-check":""}"></span>\n </div>\n <div class="smart-votes-bar-container">\n <div class="smart-votes-bar-component">\n <div class="smart-votes-bar" style="width: ${l} opacity: 1;"></div>\n <div class="smart-votes-bar-frame" style="width: 100%; opacity: 0.2;"></div>\n </div>\n </div>\n <div class="smart-voters-info">${e.length}</div>\n </div>`};a.innerHTML=`<div value="${e}" class="vote">${n(e)}</div>`,i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(o=a.firstElementChild,o.style.setProperty("--smart-check-template-forecolor","#ffffff"),o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color));const s=(e,t,a)=>{if(r._mobile)return;const n=e.closest("smart-grid-cell"),s=e.closest("smart-grid-row"),o=(e,t)=>{const a=r.rowById[e],o=r.getCellValue(e,t),d=n.cell;let c=null;r.storeHistory&&(c=r._stringifyRow(a));const m=o?o.split(","):[],u=r._currentUser?""+r._currentUser.info.id:null;if(void 0===u)return;m.indexOf(u)>=0?(m.splice(m.indexOf(u),1),s.row.data[t]=m.toString(),l(n.firstElementChild,m)):(m.push(u),s.row.data[t]=m.toString(),l(n.firstElementChild,m));const p=s.row.data[t];r._setCellUndoRedo(d,o,p),r.onCellUpdate&&r.onCellUpdate([d],[o],[p],(function(){r.onCellUpdated&&r.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[p],i),r._onCellUpdated&&r._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,p)}),i);const g=e=>{if(e!==o&&(a.updatedDate=new Date,a.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(a);t[d.column.dataField]=e,r._updateRowHistory(a,c,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p)};if(n&&s){o(s.getAttribute("data-id"),n.getAttribute("data-field"))}else null!==t&&null!==a&&o(t,a)};r._handleVoteClick||(r._handleVoteClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointerenter=e=>{const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row");if(t&&l){const i=l.getAttribute("data-id"),n=t.getAttribute("data-field");let s=r.getCellValue(i,n);if(s){if(r.users){let e="";s=s.split(),r.users.forEach((t=>{(s.indexOf(""+t.id)>=0||s.indexOf(""+t.value)>=0)&&(e+=t.name||t.label)})),e&&(s=r.localize("votes",{value:e}))}}else s=r.localize("noVotes");r._createTooltip(e,s,a,"top")}},a.firstElementChild.onpointerleave=()=>{r._cellTooltip&&(r._cellTooltip.style.visibility="hidden")},i.setAttribute("template",i.cell.template);break}case"duration":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t){const e=864e5;let l="MMM dd",n="MMM dd";if("string"==typeof t[0]&&(Array.isArray(t)?(t[0]=new Date(t[0]),t[1]=new Date(t[1])):((t=t.split(","))[0]=new Date(t[0]),t[1]=new Date(t[1]))),Array.isArray(t)){t[0]&&"string"==typeof t[0]&&(t[0]=new Date(t[0])),t[1]&&"string"==typeof t[1]&&(t[1]=new Date(t[1])),t[1]&&t[1].getMonth()===t[0].getMonth()&&(n="dd"),t[0]&&t[0].getFullYear()!==(new Date).getFullYear()&&(l+=", yyyy","dd"===n?(l="MMM dd",n+=", yyyy"):n=l);let s=!1;t[0]&&(0===t[0].getHours()&&0===t[0].getHours()||(l+=" hh:mm","dd"===n?n=l:n+=" hh:mm",s=!0));let o=null;o=Math.round(t[1].getTime()-t[0].getTime())/e;const d=o?parseInt(Math.abs(o).toFixed(0)):0;if(d>0){const e=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],n);let s="";s=r.localize("days",{value:d}),a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${e}</span><span style="font-size: 11px;" class="smart-quiet">${s}</span></div>`}else{let e="";if(s){const r=t[1]-t[0],n=Math.floor(r%864e5/36e5);let s=Math.round(r%864e5%36e5/6e4);s<10&&(s+="0"+s),e=n+":"+s;const o=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],"hh:mm");a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${o}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else{const r=i.cell.getFormattedValue(t[0],l);a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${r}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}}}}else a.innerHTML="";i.setAttribute("template",i.cell.template),a.firstElementChild&&a.firstElementChild.setAttribute("value",e);break}case"startDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;let l=t;if(n.cellsFormat?l=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(l=i.cell.getFormattedValue(t,n.formatSettings.Intl)),t){const e=864e5,s="string"==typeof t?new Date(t):t;let o=r.columnByDataField.taskDueDate;n.editor.boundDateField?o=r.columnByDataField[n.editor.boundDateField]:n.relationField&&(o=r.columnByDataField[n.relationField]);let d=o?i.cell.row.data[o.dataField]:"";d&&"string"==typeof d&&(d=new Date(d));let c=null;d&&(c=Math.round(s.getTime()-d.getTime())/e);const m=c?parseInt(Math.abs(c).toFixed(0)):0;if(m>0){let e="";e=r.localize("days",{value:m}),a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto 25px"><span style="color: var(--smart-primary);" title="${e}" class="smart-icon-clock smart-grid-icon show"></span><span>${l}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else a.innerHTML='<div style="padding-left: 7px;">'+l+"</div>"}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"dueDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;const l=["#D50000","#F4511E","#F6BF26","#33B679"],o=n.editor.date||(n.templateSettings&&n.templateSettings.date?n.templateSettings.date:new Date)||new Date;o.setHours(0,0,0);let d=t;n.cellsFormat?d=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(d=i.cell.getFormattedValue(t,n.formatSettings.Intl));const c=(e,t)=>{const l=e<=8?e/8:1;return`<div title="${t}" class="smart-element smart-circular-progress-bar" style="background: inherit; padding-left:4px; position: relative; top: calc(50% - 12px); padding-top:4px; width: 20px; height: 20px;">\n <div class="smart-container">\n <svg style="left: 0px; top: 0px; background: var(--smart-background);"width="100%" height="100%" viewPort="0 0 100 100" viewBox="0 0 100 100" role="presentation" aria-hidden="true">\n <circle id="value" class="smart-value-path" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n <circle id="value" style="stroke-dashoffset: ${100*Math.PI-(1-l)*Math.PI*100}; stroke-width: 100%;" class="smart-value" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n </svg>\n </div>\n </div>\n `};if(t){const s=864e5,m="string"==typeof t?new Date(t):t,u=Math.round(m.getTime()-o.getTime())/s,p=parseInt(Math.abs(u).toFixed(0));let g=r.columnByDataField.taskStatus;n.editor.boundDataField?g=r.columnByDataField[n.editor.boundDataField]:n.relationField&&(g=r.columnByDataField[n.relationField]);const f=g?i.cell.row.data[g.dataField]:"";if("done"===f||"complete"===f||"completed"===f||"finished"===f||!0===f||"done"===f.toLowerCase()||"complete"===f.toLowerCase()||"completed"===f.toLowerCase()||"finished"===f.toLowerCase()||1===f||"1"===f){let e=r.localize("done");a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${l[3]}; width:16px; height: 16px;"><span title="${e}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${d}</span></div>`}else{let t="";t=0===p?r.localize("today"):1===p?e<o?r.localize("yesterday"):r.localize("tomorrow"):e<o?r.localize("daysOverdue",{value:p}):r.localize("daysLeft",{value:p}),a.innerHTML=e>=o?`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto">${c(p,t)}<span>${d}</span></div>`:`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><span title="${t}" style="font-size: 16px; color: ${l[0]}" class="smart-grid-icon show smart-icon-attention-circled"></span>${d}</span></div>`}t=t+"_"+f}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"attachments":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="attachments"><div title="${r.localize("addFiles")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return a.innerHTML!==e&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div");e.classList.add("file-container"),l.classList.add("attachments");let n=t;if(r._findIsFile(n)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}if("string"==typeof n&&(n.indexOf("[{")>=0||n.indexOf("}]")>=0)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}Array.isArray(n)&&n.forEach((t=>{const l=document.createElement("div");l.title=t.label,l.classList.add("item"),l.innerHTML="<div></div>",l.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.label||(t.label=""),t.label.indexOf("png")>=0||t.label.indexOf("jpg")>=0||t.label.indexOf("jpeg")>=0||t.label.indexOf("gif")>=0?l.firstElementChild.classList.add("smart-icon-image"):t.label.indexOf(".pdf")>=0?l.firstElementChild.classList.add("smart-icon-pdf"):t.label.indexOf(".tsv")>=0||t.label.indexOf(".txt")>=0||t.label.indexOf(".csv")>=0?l.firstElementChild.classList.add("smart-icon-text"):t.label.indexOf(".xls")>=0||t.label.indexOf(".xlsx")>=0?l.firstElementChild.classList.add("smart-icon-excel"):t.label.indexOf(".ppt")>=0?l.firstElementChild.classList.add("smart-icon-powerpoint"):t.label.indexOf(".zip")>=0||t.label.indexOf(".rar")>=0||t.label.indexOf(".7z")>=0?l.firstElementChild.classList.add("smart-icon-archive"):t.label.indexOf(".doc")>=0||t.label.indexOf(".docx")>=0?l.firstElementChild.classList.add("smart-icon-word"):t.label.indexOf(".mp3")>=0?l.firstElementChild.classList.add("smart-icon-music"):t.label.indexOf(".mp4")>=0||t.label.indexOf(".avi")>=0||t.label.indexOf(".mov")>=0||t.label.indexOf(".mp4")>=0||t.label.indexOf(".mpeg")>=0||t.label.indexOf(".webm")>=0||t.value&&t.value.indexOf("youtube")>=0?l.firstElementChild.classList.add("smart-icon-video"):l.firstElementChild.classList.add("smart-icon-file"),e.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");d.classList.add("smart-arrow-right","arrowbtn");const c=document.createElement("div");if(c.classList.add("smart-icon-plus","smart-grid-icon","show"),c.title=r.localize("addFiles"),"card"!==r.view&&l.appendChild(c),l.onpointerdown=t=>{if(t.target.classList.contains("attachment")){const e=JSON.parse(i.cell.value),a=[...l.children[1].children],n=a&&a.indexOf?a.indexOf(t.target.parentNode):-1;if(e[n]){const t=document.createElement("a");if(e[n].value.indexOf(window.location.host)>=0)fetch(e[n].value).then((e=>e.blob())).then((l=>{const a=URL.createObjectURL(l);t.download=e[n].label,t.href=a,t.click()}));else{if(e[n].value.indexOf("base64")>=0){const l=r._getFileFromBase64(e[n].value);t.href=URL.createObjectURL(l)}else t.href=e[n].value;t.target="_blank",t.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=s===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.children.length){if(l.appendChild(e),"card"!==r.view){const t=25*n.length;t-i.offsetWidth+30>30&&(l.appendChild(s),l.appendChild(d)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",s.classList.add("smart-hidden"),a<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),a>30&&(l.appendChild(s),l.appendChild(d))}}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):n&&n[0]&&n[0].label?o.setAttribute("value",n[0].label):o.setAttribute("value",t);break}case"images":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="images"><div title="${r.localize("addImages")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return e!==a.innerHTML&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(!r._recycleFiles&&a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div"),s=document.createDocumentFragment();e.classList.add("file-container"),l.classList.add("images");let d=t;if(r._findIsFile(d)){let e="";if(d&&d.indexOf("{")>=0)try{e=JSON.parse(d)}catch(e){console.log(e)}else e=d.split(","),e=e.map((e=>({label:e,value:e})));d=e}if("string"==typeof d&&(d.indexOf("[{")>=0||d.indexOf("}]")>=0)){let e="";if(d)try{e=JSON.parse(d)}catch(e){console.log(e)}d=e}else"string"==typeof d&&d.indexOf("./")>=0&&(d=d.split(","),d=d.map((e=>({label:e,value:e}))));Array.isArray(d)&&d.forEach((e=>{if(e.label||(e.label=""),e.label.indexOf(".mp4")>=0||e.label.indexOf(".avi")>=0||e.label.indexOf(".mov")>=0||e.label.indexOf(".mp4")>=0||e.label.indexOf(".mpeg")>=0||e.label.indexOf(".webm")>=0||e.value&&e.value.indexOf("youtube")>=0){const t=document.createElement("div");t.title=e.label,t.classList.add("item"),t.innerHTML="<div></div>",t.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.firstElementChild.classList.add("smart-icon-video"),s.appendChild(t)}else{const t=document.createElement("img");t.style.display="none";let l="";l=e.label.indexOf(".gif")>=0?e.value:e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,t.onload=()=>{t.style.display=""},l.indexOf("base64")>=0?t.src=l:(r._imagesCache||(r._imagesCache=[]),r.uploadSettings.url?r._imagesCache[l]?r._findUserFile(e)&&(t.src=l):(r._imagesCache[l]=!0,t.style.display="none",r._findUserFile(e)?(t.src=l,t.style.display=""):l&&l.startsWith("https://")&&(t.src=l)):t.src=l,t.onerror=()=>{t.style.display="none"}),t.title=e.label,t.setAttribute("data-url",e.large||e.value),s.appendChild(t)}}));const c=document.createElement("div");c.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const m=document.createElement("div");m.classList.add("smart-arrow-right","arrowbtn");const u=document.createElement("div");u.classList.add("smart-icon-plus","smart-grid-icon","show"),u.title=r.localize("addImages");const p=document.createElement("div");if(p.classList.add("smart-navigation"),"card"!==r.view&&r.editing.enabled&&n.allowEdit&&l.appendChild(u),l.onpointerdown=t=>{if("IMG"===t.target.nodeName&&("card"!==r.view&&[...e.children].forEach((e=>e.classList.remove("smart-hidden"))),r._openImagePreviewDialog(t.target),t.stopPropagation(),t.preventDefault()),t.target.classList.contains("attachment")){const l=JSON.parse(i.cell.value),a=[...e.children].indexOf(t.target.parentNode);if(l[a]){const e=document.createElement("a");if(l[a].value.indexOf(window.location.host)>=0)fetch(l[a].value).then((e=>e.blob())).then((t=>{const i=URL.createObjectURL(t);e.download=l[a].label,e.href=i,e.click()}));else{if(l[a].value.indexOf("base64")>=0){const t=r._getFileFromBase64(l[a].value);e.href=URL.createObjectURL(t)}else e.href=l[a].value;e.target="_blank",e.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("smart-navigation-item")){[...p.children].forEach((e=>e.classList.remove("active"))),t.target.classList.add("active"),[...e.children].forEach((e=>e.classList.add("smart-hidden")));const l=[...p.children].indexOf(t.target);e.children[l].classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=c===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?c.classList.add("smart-hidden"):c.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.appendChild(s),e.children.length){if(l.appendChild(e),"card"===r.view&&l.appendChild(p),"card"!==r.view){const t=25*d.length;t-i.offsetWidth+30>30&&(l.appendChild(c),l.appendChild(m)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",c.classList.add("smart-hidden"),a<0?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden"),a>30&&(l.appendChild(c),l.appendChild(m))}}else{for(let t=0;t<e.children.length;t++){const l=document.createElement("div");l.classList.add("smart-navigation-item"),0===t?l.classList.add("active"):e.children[t].classList.add("smart-hidden"),p.appendChild(l)}1===e.children.length&&p.classList.add("smart-visibility-hidden")}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):d&&d[0]&&d[0].label?o.setAttribute("value",d[0].label):o.setAttribute("value",t);break}case"email":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;o=document.createElement("span"),null===t||""===t?o.innerHTML="":Smart.Validator.email(t)?o.innerHTML=t:(o.className="url center middle",o.innerHTML='<a href="mailto:'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()}))}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"url":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;const l=e=>{e.classList.add("center","middle"),null===t||""===t?e.classList.add("smart-hidden"):Smart.Validator.url(t)?(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="https://'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden")):(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden"))};a.firstElementChild&&a.firstElementChild.classList.contains("url")?(o=a.firstElementChild,l(o)):(o=document.createElement("span"),o.className="url",l(o)),o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()})}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"sparklines":{const l=t,o=""+n.computedWidth;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value"),t=a.firstElementChild.getAttribute("width"),n=a.firstElementChild.getAttribute("height"),s=i.cell.row.cellHeight||r.layout.rowMinHeight;if(l===e&&t===o&&s===n)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const d=(e,t,l)=>{if(!1===c.tooltip)return;const a=e.pageX,i=e.pageY-10;if(!r._sparklineTooltip){const e=document.createElement("smart-button");e.classList.add("secondary"),e.style.boxShadow="var(--smart-elevation-4)",e.style.opacity=.9,e.style.transition="all cubic-bezier(0.6, 0.2, 0, 0.8) 0.2s",document.body.appendChild(e),e.style.position="absolute",e.style.zIndex=999,r._sparklineTooltip=e}const n=r._sparklineTooltip;n.innerHTML===t&&n.element===l||(n.style.top=i+25+"px",n.style.left=a-15+"px"),n.innerHTML=""+t,n.style.display=""},c=n.templateSettings,m=()=>{a.onmousemove=e=>{if("column"!==c.type&&"bar"!==c.type||a.querySelectorAll("rect").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&l.top<=e.clientY&&e.clientY<=l.bottom&&(t.setAttribute("highlight",""),d(e,t.getAttribute("data-title"),t))})),"pie"===c.type){let t=!1;a.querySelectorAll("path").forEach((l=>{var a=l.getBoundingClientRect();l.removeAttribute("highlight"),t||a.left<=e.clientX&&e.clientX<=a.right&&a.top<=e.clientY&&e.clientY<=a.bottom&&(l.setAttribute("highlight",""),t=!0,d(e,l.getAttribute("data-title"),l))}))}"line"===c.type&&a.querySelectorAll("line").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&(t.previousElementSibling&&(t.previousElementSibling.style.display="none"),t.nextElementSibling&&(t.nextElementSibling.style.display="none"),t.setAttribute("highlight",""),l.left+l.width/2>=e.clientX?t.previousElementSibling&&(t.previousElementSibling.style.display="",d(e,t.previousElementSibling.getAttribute("data-title"),t.previousElementSibling)):t.nextElementSibling&&(t.nextElementSibling.style.display="",d(e,t.nextElementSibling.getAttribute("data-title"),t.nextElementSibling)))}))},a.onmouseleave=()=>{r._sparklineTooltip&&(r._sparklineTooltip.style.display="none"),a.querySelectorAll("rect").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("path").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("line").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("circle").forEach((e=>{e.style.display="none"}))}};if(s())return void m();const u=new e,p=i.cell.row.cellHeight||r.layout.rowMinHeight;if(p>=7)if(i._sparklinesRender&&cancelAnimationFrame(i._sparklinesRender),t){const e=u.render({width:o-10,height:Math.max(0,p-7),points:t,colors:c.colors,type:c.type,gap:c.gap,max:c.max,min:c.min,padding:c.padding,roundedCorners:c.roundedCorners,strokeWidth:c.strokeWidth,colorFunction:c.colorFunction,tooltipFormatFunction:c.tooltipFormatFunction});a.innerHTML=`<div height="${p}" width="${o}" value="${l}" style="padding-top: 5px; padding-left: 5px; padding-right: 5px;">${e}</div>`,m()}else a.innerHTML="",a.onmousemove=a.onmouseleave=null;i.setAttribute("template",i.cell.template);break}default:{let e=null;i.setAttribute("template","");const l=i.cell.row,s=a;let o=i.cell.getFormattedValue(t,n.cellsFormat);if(s.style.lineHeight="","function"==typeof i.cell.template){const e={row:l,column:n,cell:i.cell,oldValue:i.cell.oldValue,value:t,data:l.data,template:null},a=i.cell.column.templateSettings.React||r.React,d=i.cell.column.templateSettings.ReactDOM||r.ReactDOM;if(i.cell.column.templateSettings&&a&&d){return void d.createRoot(s).render(a.createElement(i.cell.template,e))}let c=s.querySelector(".smart-grid-cell-template");const m=l.id;r.isHScrolling&&(r._cachedTemplates||(r._cachedTemplates=[]),c&&0===c.innerHTML.length&&(c=null),!c&&r._cachedTemplates&&r._cachedTemplates[n.dataField+"_"+m]&&(0===r._cachedTemplates[n.dataField+"_"+m].innerHTML.length?delete r._cachedTemplates[n.dataField+"_"+m]:e.template=r._cachedTemplates[n.dataField+"_"+m])),c&&c.getAttribute("column")===n.dataField?e.template=c.firstElementChild:c=null,i.formattedValue!==o&&(c=null),i.cell.canNotify=!1,l.canNotify=!1;const u=Object.assign({},{background:i.cell.background,color:i.cell.color,fontSize:i.cell.fontSize,fontFamily:i.cell.fontFamily,fontWeight:i.cell.fontWeight,textDecoration:i.cell.textDecoration,fontStyle:i.cell.fontStyle});if(i.cell.template(e),!c&&e.template)if(e.template instanceof HTMLElement){const t=document.createElement("div");t.classList.add("smart-grid-cell-template"),t.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(t),t.appendChild(e.template)}else s.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+e.template+"</div>";else c||null!==e.template||(s.innerHTML=t);if(r.isHScrolling&&!r._cachedTemplates[n.dataField+"_"+m]&&s.firstElementChild.firstElementChild){const e=s.firstElementChild.firstElementChild;e&&(r._cachedTemplates[n.dataField+"_"+m]=e)}s.style.background===u.background&&s.style.color===u.color&&s.style.fontSize===u.fontSize&&s.style.fontWeight===u.fontWeight&&s.style.fontStyle===u.fontStyle||(i.cell._styleChanged=!0,i.cell._setStyle(s)),i.cell.background!==u.background||i.cell.color!==u.color||i.cell.fontSize!==u.fontSize||i.cell.fontWeight!==u.fontWeight||i.cell.fontStyle!==u.fontStyle?(i.cell._styleChanged=!0,i.cell._setStyle(s)):i.cell._styleChanged&&i.cell._setStyle(s),void 0===i.cell.oldValue&&(i.cell.oldValue=t),i.formattedValue=o,i.cell.canNotify=!0,l.canNotify=!0}else if(Array.isArray(i.cell.template)){const e=document.createElement("div");if(s.firstElementChild&&s.firstElementChild.classList.contains("smart-grid-cell-template"))for(let e=0;e<i.cell.template.length;e++){const t=s.firstElementChild.children[e].firstElementChild,a=i.cell.template[e];if(a.length>1&&t){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t.src&&t.src!==e?(i._imageUpdateTimer&&clearTimeout(i._imageUpdateTimer),i._imageUpdateTimer=setTimeout((()=>{t.src=e}),50)):t.textContent!==e&&(t.textContent=e)}}else{e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(e);let t="";for(let e=0;e<i.cell.template.length;e++){const a=i.cell.template[e];if(a.length>1){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t+='<span class="smart-template-part">'+a[0].replaceAll("{{value}}",e)+"</span>"}}e.innerHTML=t}}else{if(""!==s.textContent&&(s.textContent=""),i.cell.template instanceof HTMLTemplateElement)e=i.cell.template;else if(i.cell.template instanceof HTMLElement){const e=i.cell.template.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);s.innerHTML!==e&&(s.innerHTML=e)}else if("function"==typeof i.cell.template&&i.cell.template.prototype&&"undefined"!=typeof ngApp){const e=ngApp.injector,l=e.get(ComponentFactoryResolver).resolveComponentFactory(i.cell.template),a=s.appendChild(l.create(e));return a.instance.value=t,void a.changeDetectorRef.detectChanges()}if(i.cell.template.startsWith&&i.cell.template.startsWith("#")&&(e=document.querySelector(i.cell.template)),e){let a=e.content.cloneNode(!0).firstElementChild;const d=t;if(t=(t=(t=t.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),a.querySelector("[smart-if]")){const e=a.querySelector("[smart-else]"),l=a.querySelectorAll("[smart-if]");let i=!1;for(let e=0;e<l.length;e++){const r=l[e],s=r.getAttribute("smart-if"),o=s.split(" "),c=o[1].trim();let m=o[2].trim();s.indexOf("'")>=0&&(m=s.substring(s.indexOf("'")+1),m=m.replaceAll("'",""));let u=t;switch("Today"===m&&(m=new Date),"date"===n.dataType&&(t=new Date(d).getTime(),m=new Date(m).getTime()),c){case">":t>parseFloat(m)&&(a=r,i=!0);break;case">=":t>=parseFloat(m)&&(a=r,i=!0);break;case"=":case"==":case"===":t===m&&(a=r,i=!0);break;case"<":t<parseFloat(m)&&(a=r,i=!0);break;case"<=":t<=parseFloat(m)&&(a=r,i=!0)}if(t=u,i)break}!i&&e&&(a=e)}let c=a.outerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);for(c.indexOf("{{value=")>=0&&(t?(c=c.substring(0,c.indexOf("{{value="))+t+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const e=c.indexOf("{{value::"),l=c.substring(e+9,c.indexOf("}}")),a=i.cell.getFormattedValue(t,l);c=c.replace(`{{value::${l}}}`,a)}if(n._treeColumn){const e=s.firstChild;if(e&&e.classList&&i.toggleButton&&n._treeColumn&&s.children[1]){const e=s.children[0],t=s.children[1].children[0],a=s.children[1].children[1].firstChild,i=s.children[1].children[2];let n="";if(r.grouping.enabled){let e=l.level-1;"multipleColumns"!==r.grouping.renderMode&&(n+='<div style="width: '+(1+e)*r.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<l.level;e++)n+="<div class='smart-indent'></div>";l.checked?a.setAttribute("checked",""):!1===l.checked?a.removeAttribute("checked"):null===l.checked&&a.setAttribute("checked","indeterminate"),l.leaf?l.allowCheck?a.classList.remove("smart-visibility-hidden"):a.classList.add("smart-visibility-hidden"):l.allowCheck?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),l.allowCheck?r.checkBoxes.visible?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"):r.checkBoxes.visible||a.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),l.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),l.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),l.data.isEmpty&&t.classList.add("smart-visibility-hidden"),i.innerHTML=c,r.appearance.showTooltips?i.setAttribute("title",r._unescapeString(o)):i.hasAttribute("title")&&i.removeAttribute("title")}}else s.innerHTML!==c&&(s.innerHTML=c)}else if("string"==typeof i.cell.template){""===t&&(t="&nbsp;");let e=i.cell.template.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);if(e.indexOf("{{"))for(let t=0;t<r.dataSource.dataFields.length;t++){const a=r.dataSource.dataFields[t].name;if(e.indexOf("{{"+a+"}}")>=0&&(e=e.replace("{{"+a+"}}",l.data[a]),-1===e.indexOf("{{")))break}s.innerHTML!==e&&(s.innerHTML=e)}}if("auto"===i.cell.row.height||r.layout.allowCellsWrap||"auto"===r.layout.rowHeight){const e=s.querySelector(".smart-grid-cell-template");if(e){l._templatesHeight||(l._templatesHeight=[]);const t=(e,t)=>{if(e){const l=r.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0;const a=l.canNotify;l.canNotify=!1,l.autoSize(),l.canNotify=a,delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),r.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(o)return a.innerHTML="",a.appendChild(o),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML),i.cell._setStyle(a),o;i.cell._setStyle(a),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML)}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,r=a._isMeasureRow?null:e.cell.format||l.cellsFormat,n=t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0;if(e.setAttribute("data-type",l.dataType),!(!1!==t._recycleValues||n||l.formatFunction||l._treeColumn||a.summaryRow||"grid"!==t.view)){if(e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element&&a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id?a.element.star.classList.remove("smart-hidden"):t.appearance.showRowComments&&!a.element.hasAttribute("focus")&&a.element.toggleDetailButton&&a.element.toggleDetailButton.classList.add("smart-visibility-hidden")),e.cell.background||e.cell.color){e.cell._styleChanged=!0;const t=e.firstChild;e.cell._setStyle(t)}return}if(t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&"card"!==t.view){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return void 0===t&&i.data&&(t=l.displayField?i.data[l.displayField]:i.data[l.dataField]),e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button"),t.dataSource.boundHierarchy||!e.hasAttribute("has-toggle-button")||l._treeColumn||e.removeAttribute("has-toggle-button");let s=l.displayField?i[l.displayField]:i[l.dataField];if(e.removeAttribute("placeholder"),!l.placeholder||""!==s&&null!=s||(s=l.placeholder,e.setAttribute("placeholder","")),l.parentDataField){const e=t.columnByDataField[l.parentDataField];if(e){let i=e.editor.dataSource;e.relationId&&e.relationField&&e._isDirty&&(!e.editor.dataSource||e.editor.dataSource&&0===e.editor.dataSource.length)&&(i=t._getRelationData(e.relationId));const r=i[t.getCellValue(a.id,l.parentDataField)];if(r){s=r[l.cascadingDataField]}}}if(null!==s||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(s=0),"string"===l.dataType&&(s=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(s=!1),"date"===l.dataType&&(s=new Date)),t.formulas&&e.cell.formula&&"string"==typeof e.cell.formula&&e.cell.formula.startsWith("=")&&/=.+/.test(e.cell.formula)){const i=t._formulaParser;if(i){if(t&&t.formulas&&e.cell._formula!==l.formula){let t=a.data[l.dataField];l.formula&&(e.cell.formula=e.cell._parseFormula(l.formula)),t&&(""+t).startsWith("=")&&(e.cell.formula=e.cell._parseFormula(""+t)),e.cell._formula=l.formula}const r=i.parse(e.cell.formula.slice(1));s=isNaN(r)?"#VALUE!"===r?"":"#ERROR!"===r?"#ERROR!":r:r}}t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(s="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row"),t.editing.enabled&&(e.cell.readonly||!l.allowEdit?e.classList.add("smart-readonly"):e.classList.remove("smart-readonly"));const o=t=>{if(t){if((t=""+t).startsWith("off_"))return e.classList.remove(t.substring(4)),!1;if(e.classList.add(t),e.hasAttribute("customCSS")){t=t+" "+e.getAttribute("customCSS")}return e.setAttribute("customCSS",t),!0}return e.setAttribute("highlight",""),!0};if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS");const l=t.split(" ");for(let t=0;t<l.length;t++)e.classList.remove(l[t])}if(l.highlight&&!a.summaryRow&&(o(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]){o(t.highlightedCells[a.id][l.dataField])}if(t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]){o(t.highlightedRows[a.id])}if(t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),s=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,s=e.cell.value),void 0===s&&(s="");let d=s;if(r)d=e.cell.getFormattedValue(s,r);else if(l.formatSettings&&l.formatSettings.Intl)if(""===s)d="";else if(l.editor.decimalPlaces>=0){const t=JSON.parse(JSON.stringify(l.formatSettings.Intl));t.NumberFormat.minimumFractionDigits=l.editor.decimalPlaces,t.NumberFormat.maximumFractionDigits=l.editor.decimalPlaces,d=e.cell.getFormattedValue(s,t)}else d=e.cell.getFormattedValue(s,l.formatSettings.Intl);else l.formatSettings&&l.formatSettings.formatString&&(d=e.cell.getFormattedValue(s,l.formatSettings.formatString));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML="",a.filterRow&&(l._filterEditorInitialized=!1)),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==s&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames||e._rowClassNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,s,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,s,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);let r=[];for(let n=0;n<i.length;n++){let o=i[n];const d={index:a.visibleIndex,value:s,dataField:l.dataField,row:a,data:a.data,api:t};l.cellsCSSRules[o](d)&&(e.classList.add(o),r.push(o))}e.__classNames=r}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let p="";if(m.align&&(p+=m.align+" "),m.verticalAlign&&(p+=m.verticalAlign+" "),l.cellsWrap)p+="wrap ";else if(t.layout.autoWrap&&a.height>40&&1===e.cell.colSpan&&"string"===l.dataType){if(14*(d||"").length*.52>l.computedWidth){if("url"!==e.cell.template&&"email"!==e.cell.template){p+="textwrap ";const e=parseInt(a.height/20);c.style["-webkit-line-clamp"]=e}}}if(p+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}if(l.grid.appearance.showRowComments&&l.rowHeaderColumn){const a=t.rowDetailColumn,i=a?a.width:0;e.style.width=l.computedWidth+i+"px",e.classList.add("row-number")}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.appearance.showColumnGroupCellLines||l.parent&&!l.element.hasAttribute("column-group-first-child")&&e.classList.add("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let g=l.left;if(t.rightToLeft?e.style.right!==g+"px"&&(e.style.right=g+"px"):e.style.left!==g+"px"&&(e.style.left=g+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),p+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze",""),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command","")),t.appearance.showRowComments&&(a.comments&&a.comments.length>0&&l===t._firstVisibleUserColumn?e.classList.add("row-comments"):e.classList.remove("row-comments")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,s))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)""!==c.innerHTML&&(c.innerHTML="");else if(l.autoGenerated&&""!==c.innerHTML&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary&&l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let r in a){if("status"===r)continue;const n=l.cellsFormat;let s=a[r];n&&n.indexOf("p")>=0&&"count"===r?s=a[r]:n&&"date"!==l.dataType&&(s=e.cell.getFormattedValue(s,n)),t.messages&&t.messages[t.locale]&&t.messages[t.locale][r]?i.push(t.localize(r,{value:s})):i.push(r+": "+s)}let r=[],n="";if(a&&a.status&&l.editor){n+='<div style="margin-right: 5px; display: flex; border-radius: 8px; align-items: center;">';const e=l.editor.dataSource,i=a.status,s=t.rows.length,o=l.computedWidth;let d=0;if(e)for(let l=0;l<e.length;l++){const a=e[l];if(i[a.value]){const e=a.label?a.label:t.localize("blankSummary"),l=i[a.value].length,c=new Number(l/s*100).toFixed(2),m=e+" "+l+"/"+s+" "+c+"%",u=o*c/100/2;r.push(m);const p=["#D50000","#F6BF26","#33B679","#039BE5","#3F51B5","#8E24AA"];d>p.length-1&&(d=0);n+='<span class="summary-value-part" title="'+m+'" style="width: '+u+"px; font-size: 11px; padding: 5px; background:"+(a.color||p[d++])+'; color: white;"></span>'}}n+="</div>"}const s=i.join(", "),o=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let d=`<div title = "${s}" class="smart-truncate summary-value" > <span class="label">${s}</span>${o}</div> `;r.length&&(d=`<div title = "${s}" class="smart-truncate summary-value" > <span style="align-items: center; display: flex;" class="label">${n}${s}</span>${o}</div> `);if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;d=`<div title = "${s}" class="smart-truncate summary-value" > ${`<span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> `} <span class="label">${s}</span>${o}</div> `}c.innerHTML!==d&&(c.innerHTML=d)}else if(t.summaryRow.editing&&l.allowSummary){if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value"><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value"><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==e&&(c.innerHTML=e)}}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{!0!==t._mobile&&c._clickTarget!==l.target||(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="",i=t.appearance.showRowStatus||t.appearance.showRowComments?"smart-visibility-hidden":"";if(a.showDetail){l='<button tabindex="-1" class="'+i+' smart-animate" toggled toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}else{l='<button tabindex="-1" class="'+i+" smart-animate"+(t.rowDetail.dialog.enabled?" row-detail":"")+'" toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}if(t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let r="";for(let e=0;e<t;e++)r+="A";return r+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=s;else switch(c.removeAttribute("title"),e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(s,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(s,e.cell.template,c);break;case"attachment":e._setTemplate(s,"attachments",c);break;case"image":e._setTemplate(s,"images",c);break;case"email":e._setTemplate(s,"email",c);break;case"url":e._setTemplate(s,"url",c);break;case"richText":e._setTemplate(s,"richText",c);break;default:e._setTemplate(s,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],r=c.children[1].children[1].firstChild,n=c.children[1].children[2];let s="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?s="":"multipleColumns"!==t.grouping.renderMode&&(s+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)s+="<div class='smart-indent'></div>";if(a.checked?r.setAttribute("checked",""):!1===a.checked?r.removeAttribute("checked"):null===a.checked&&r.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?r.classList.remove("smart-visibility-hidden"):r.classList.add("smart-visibility-hidden"):a.allowCheck?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"):t.checkBoxes.visible||r.classList.add("smart-hidden"),"card"===t.view&&(r.classList.add("smart-hidden"),i.classList.add("smart-hidden")),e.innerHTML=s,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),n.innerHTML=d,t.appearance.showTooltips?n.setAttribute("title",t._unescapeString(d)):n.hasAttribute("title")&&n.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let r=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(r+=l.computedWidth)}e.style.width=r+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let r=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let r=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const n="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(s,a.visibleIndex,a.data),o=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(o>l[0]&&o<l[1]){d=!0;break}}if(a._rowSpan=n,n&&!d){let s=0;t._cellRowSpan.push([o,o+n,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(n,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=o;e<=o+n-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(s+=l.cellHeight)}e.style.height=s+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",n),i._styleChanged=!0,r=n}}if(1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width=l.computedWidth+"px",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===r&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||("string"==typeof d&&d.indexOf("&")>=0?"card"===t.view?c.innerHTML=d:t.isScrolling?requestAnimationFrame((()=>{c.innerHTML=d})):c.innerHTML=d:c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),c.setAttribute("title",i.tooltip||t._unescapeString(d))):c.hasAttribute("title")&&c.removeAttribute("title"),t.appearance.showTooltipsOverflow&&(!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"),d&&d.length)){14*(d||"").length*.52>l.computedWidth?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),"image"!==l.template&&"attachment"===l.template&&c.setAttribute("title",i.tooltip||t._unescapeString(d))):!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title")}}else c.textContent=d}}if(c.className!==p&&(c.className=p),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const i={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:s,data:a.data,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const r=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});if(t.hasAttribute("smart-blazor"))await l.formatFunction(i);else{const e=l.formatFunction(i);e&&(i.value=e)}c.style.background===r.background&&c.style.color===r.color&&c.style.fontSize===r.fontSize&&c.style.fontFamily===r.fontFamily&&c.style.textDecoration===r.textDecoration&&c.style.fontWeight===r.fontWeight&&c.style.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===r.background&&e.cell.color===r.color&&e.cell.fontSize===r.fontSize&&e.cell.fontWeight===r.fontWeight&&e.cell.textDecoration===r.textDecoration&&e.cell.fontFamily===r.fontFamily&&e.cell.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let n=!0;if(i.value!==s){if(e.toggleButton){c.children[1].children[2].innerHTML=i.value}else c.innerHTML=i.value;n=!1}if(null!==i.template){if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==i.template&&(e.innerHTML=i.template)}}else if(c.innerHTML!==i.template){const e=document.createElement("div");e.innerHTML=i.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=i.template)}n=!1}n&&(l.cellsFormat?c.textContent=d:c.textContent=s),e.cell.canNotify=!0,a.canNotify=!0}if(l.tooltipRenderer&&!a.summaryRow&&!a.autoGenerated){const e=l.tooltipRenderer(a.id,l.dataField,s,d,a.data);null!=e&&""!==e&&(c.setAttribute("data-title",e),c.onmouseenter=function(l){t._createTooltip(l,e,c,"top")},c.onmouseleave=function(){t._cellTooltip&&(t._cellTooltip.style.visibility="hidden")})}if(l.cellsRenderer&&!a.summaryRow){const t=l.cellsRenderer(a.id,l.dataField,s,a.data,c);if(null!=t)if("string"==typeof t)if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==t&&(e.innerHTML=t)}}else c.innerHTML!==t&&(c.innerHTML=t);else t instanceof HTMLElement&&c.firstChild!==t&&(c.innerHTML="",c.appendChild(t))}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),r=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),r.appendChild(l),r.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(r),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const r=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-r.top+"px",i.style.left=a._offsetLeft(l)-r.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,r=e.column,n=e.row,s=e.row.index,o=n._style,d=n.data&&n.data.$?n.data.$.id:null;if(e.column.autoGenerated){const l=t._conditionalColors;if(l&&e.column.rowHeaderColumn)if("border"===l.decorate){const t=l.colors;t&&t[d]?(e.element.classList.add("smart-decorate"),e.element.style.setProperty("--smart-decorate-color",t[d].color)):e.element.classList.remove("smart-decorate")}else e.element.classList.remove("smart-decorate")}else{if(t._conditionalColors){const r=t._conditionalColors,s=()=>{e.row.style&&e.row.style[e.column.dataField]&&(e._styleChanged=!0,e.row.style[e.column.dataField].background&&(e.background=e.row.style[e.column.dataField].background),e.row.style[e.column.dataField].color&&(e.color=e.row.style[e.column.dataField].color))};if("border"!==r.decorate){const t=r.colors;if(t&&t[d]){const o="cell"===r.decorate?t[d][i]:t[d].color;if(o){const t=new Smart.Color(o).getInvertedColor();a.cell.canNotify=!1,n.canNotify=!1,e.background=o,e.color=t,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}if(a.cell._customInlineStyles&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.textDecoration=null,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),r.cellsCSSInlineRules){const e=r.cellsCSSInlineRules;for(let i=0;i<e.length;i++){const r=e[i];if(!r.field)break;const s=r.condition;let o=r.value,d=r.value2,c=n.data[r.field],m=t.columnByDataField[r.field];if("string"==typeof c&&(o=""+o,d=""+d),"date"===m.dataType||"dateTime"===m.dataType){if(o=Smart.Utilities.DateTime.ParseDate(o,m.cellsFormat),void 0!==d){d=Smart.Utilities.DateTime.ParseDate(d,m.cellsFormat)}}"number"!==m.dataType&&"float"!==m.dataType&&"decimal"!==m.dataType&&"currency"!==m.dataType||(o=parseFloat(o),void 0!==d&&(d=parseFloat(d))),"boolean"===m.dataType&&("string"==typeof o&&(o="true"===o.toLowerCase()),"1"===o&&(o=!0),"0"===o&&(o=!1),void 0!==d&&("string"==typeof d&&(d="true"===d.toLowerCase()),"1"===d&&(d=!0),"0"===d&&(d=!1)));let u=!1;switch(s){case">":u=o<c;break;case">=":u=o<=c;break;case"<":u=o>c;break;case"<=":u=o>=c;break;case"=":u=o===c;break;case"<>":u=o!==c;break;case"between":u=c>=o&&c<=d}u&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=r.background,a.cell.color=r.color,a.cell.textDecoration=r.textDecoration,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),a.cell._customInlineStyles=!0}}if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][s];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const r={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":r.align="align-left";break;case"center":case"middle":r.align="align-center";break;case"right":r.align="align-right"}switch(a){case"top":r.verticalAlign="align-top";break;case"center":case"middle":r.verticalAlign="align-middle";break;case"bottom":r.verticalAlign="align-bottom"}return r}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});class e{render(e){const t=this,l={svg:null,roundedCorners:e.roundedCorners||0,padding:e.padding||null,width:e.width||100,height:e.height||30,gap:e.gap||5,strokeWidth:e.strokeWidth||2,type:e.type||"column",colors:e.colors||["var(--smart-primary)"],points:e.points,labels:e.labels,colorFunction:e.colorFunction,tooltipFormatFunction:e.tooltipFormatFunction,min:e.min,max:e.max};switch(l.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),l.svg.setAttribute("width",l.width),l.svg.setAttribute("height",l.height),function(e){Array.isArray(e.colors)||(e.colors=t.colors.split(",")),e.points&&(Array.isArray(e.points)?e.points=e.points.map((e=>parseInt(e,10))):(e.points&&"number"==typeof e.points&&(e.points=""+e.points),e.points=e.points.split(",").map((e=>parseInt(e,10)))))}(l),l.type){case"column":return t.column(l);case"bar":return t.bar(l);case"line":return t.line(l);case"pie":return t.pie(l);case"stacked":return t.stacked(l)}}colorFunction(e,t){const l=function(e,t){e===t&&(t=e+100);const l=(t-e)/5;return[e+l,e+2*l,e+3*l,e+4*l]}(e,t),a=["#D50000","#F4511E","#F6BF26","#039BE5","#33B679"];return e=>e<l[0]?a[0]:e<l[1]?a[1]:e<l[2]?a[2]:e<l[3]?a[3]:a[4]}column(e){const t=e.gap/e.points.length+e.width/e.points.length-e.gap,l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;return e.colorFunction||(e.colorFunction=this.colorFunction(a,l)),e.points.forEach(((n,s)=>{isNaN(n)&&(n=0);const o=document.createElementNS("http://www.w3.org/2000/svg","rect"),d=Math.abs(n)*i;o.setAttribute("x",s*t+s*e.gap),o.setAttribute("point",n);let c=n>=0?"var(--smart-primary)":"var(--smart-error)";if(l>0&&a<0?n>=0?o.setAttribute("y",e.height-r-1-d):o.setAttribute("y",e.height-r-1):l>=0&&a>=0?o.setAttribute("y",e.height-d):a<=0&&l<=0&&o.setAttribute("y",d),o.setAttribute("width",t),o.setAttribute("height",d),e.colorFunction){const t=e.colorFunction(n);t&&(c=t)}o.setAttribute("fill",c);const m=e.tooltipFormatFunction?e.tooltipFormatFunction(n):n;o.setAttribute("data-title",m),e.svg.appendChild(o)})),e.svg.outerHTML}bar(e){const t=e.padding||0;let l=e.roundedCorners||0;"boolean"==typeof l&&(l=l?3:0);const a=e.height-3-2*t,i=Math.max(5,e.gap/e.points.length+a/e.points.length-e.gap),r=e.max||Math.max(...e.points),n=e.min||Math.min(...e.points);let s=e.width/(Math.abs(n)+Math.abs(r));const o=Math.abs(n)*s;return e.colorFunction||(e.colorFunction=this.colorFunction(n,r)),e.points.forEach(((a,d)=>{isNaN(a)&&(a=0);const c=document.createElementNS("http://www.w3.org/2000/svg","rect"),m=Math.abs(a)*s;c.setAttribute("y",d*i+d*e.gap+t),c.setAttribute("point",a),l>0&&(c.setAttribute("rx",l),c.setAttribute("ry",l));let u=a>=0?"var(--smart-primary)":"var(--smart-error)";if(r>0&&n<0?a>=0?c.setAttribute("x",o):c.setAttribute("x",o-m):(r>=0&&n>=0||n<=0&&r<=0)&&c.setAttribute("x",0),c.setAttribute("width",m),c.setAttribute("height",i),e.colorFunction){const t=e.colorFunction(a);t&&(u=t)}c.setAttribute("fill",u);const p=e.tooltipFormatFunction?e.tooltipFormatFunction(a):a;c.setAttribute("data-title",p),e.svg.appendChild(c)})),e.svg.outerHTML}line(e){const t=e.width/(e.points.length-1),l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;e.colorFunction||(e.colorFunction=this.colorFunction(a,l));let n="var(--smart-primary)",s=[],o=[];e.svg.setAttribute("overflow","visible");for(let l=0;l<e.points.length;l++){let a=e.points[l];isNaN(a)&&(a=0);const n=l*t,d=e.height-r-a*i;o.push({x:n,y:d,point:a}),2===o.length&&(s.push(o),o=[]),s.length>0&&0===o.length&&o.push(s[s.length-1][1])}for(let t=0;t<s.length;t++){const l=s[t];if(e.colorFunction){const t=e.colorFunction(l[0].point);t&&(n=t)}if(0===t){const t=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(t),t.setAttribute("cx",l[0].x),t.setAttribute("cy",l[0].y),t.setAttribute("r",3),t.setAttribute("fill",n);const a=e.tooltipFormatFunction?e.tooltipFormatFunction(l[0].point):l[0].point;t.setAttribute("data-title",a),t.style.display="none"}const a=document.createElementNS("http://www.w3.org/2000/svg","line");e.svg.appendChild(a),a.setAttribute("x1",l[0].x),a.setAttribute("y1",l[0].y),a.setAttribute("x2",l[1].x),a.setAttribute("y2",l[1].y);const i=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(i),i.setAttribute("cx",l[1].x),i.setAttribute("cy",l[1].y),i.setAttribute("r",3),i.setAttribute("fill",n);const r=e.tooltipFormatFunction?e.tooltipFormatFunction(l[1].point):l[1].point;i.setAttribute("data-title",r),i.style.display="none",a.setAttribute("fill","none"),a.setAttribute("stroke-width",e.strokeWidth),a.setAttribute("stroke",n)}return e.svg.outerHTML}pie(e){const t=Math.min(e.width,e.height)/2,l=e.width/2,a=e.height/2,i=e.points.reduce(((e,t)=>e+Math.abs(t)),0);let r=0;const n=e.max||Math.max(...e.points),s=e.min||Math.min(...e.points);return e.colorFunction||(e.colorFunction=this.colorFunction(s,n)),e.points.forEach((n=>{isNaN(n)&&(n=0);let s=e.color;if(e.colorFunction){const t=e.colorFunction(n);t&&(s=t)}const o=Math.abs(n)/i*2*Math.PI,d=r+o,c=l+t*Math.cos(r),m=a+t*Math.sin(r),u=l+t*Math.cos(d),p=a+t*Math.sin(d),g=document.createElementNS("http://www.w3.org/2000/svg","path"),f=o>Math.PI?1:0,h=`M ${l},${a} L ${c},${m} A ${t},${t} 0 ${f} 1 ${u},${p} Z`;g.setAttribute("d",h),g.setAttribute("fill",s);const b=e.tooltipFormatFunction?e.tooltipFormatFunction(n):`${(n/i*100).toFixed(2)}%`;g.setAttribute("data-title",b),e.svg.appendChild(g),r=d})),e.svg.outerHTML}stacked(e){let t=e.points.reduce(((e,t)=>e+t),0),l=(e.points.length-1)*e.gap,a=e.width-l;const i=e.max||Math.max(...e.points),r=e.min||Math.min(...e.points);e.colorFunction||(e.colorFunction=this.colorFunction(r,i));let n=0;return e.points.forEach(((l,i)=>{isNaN(l)&&(l=0);let r=e.colors[i%e.colors.length];if(e.colorFunction){const t=e.colorFunction(l);t&&(r=t)}const s=l/t*a,o=document.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttribute("x",n),o.setAttribute("y",0),o.setAttribute("width",s),o.setAttribute("height",e.height),o.setAttribute("fill",r);const d=document.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=l,o.appendChild(d),e.svg.appendChild(o),n+=s+e.gap})),e.svg.outerHTML}}})();
1428
+ (()=>{Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,l.format=null,l.formula=null,e._style){const a=e._style;t.autoGenerated||(l.color=void 0!==a.color?a.color:null,l.background=void 0!==a.background?a.background:null,l.fontFamily=void 0!==a.fontFamily?a.fontFamily:null,l.fontSize=void 0!==a.fontSize?a.fontSize:null,l.fontStyle=void 0!==a.fontStyle?a.fontStyle:null,l.textDecoration=void 0!==a.textDecoration?a.textDecoration:null,l.fontWeight=void 0!==a.fontWeight?a.fontWeight:null),a[t.dataField]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[t.dataField][e]&&(l[e]=a[t.dataField][e],l._styleChanged=!0)}))}if(l.grid&&l.grid.formulas){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(a,i){if("value"===i){const a=l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if(l.grid&&l.grid.formulas&&(l.formula||t.formula)){const a=l.grid._formulaParser;if(a){if(l.grid&&l.grid.formulas&&l._formula!==t.formula){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return a.parse(l.formula.slice(1))}}return a}if("editor"===i||"template"===i)return a[i]||l.column[i];if("focused"===i){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===i)return!0===l.row.getProperty("selected")||(!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField]);if("modifiedValue"===i){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const e=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==e?e:a.value}return a[i]},set:function(e,a,i){const r=this.get(e,a);if(r===i)return!0;if(e[a]=i,"element"===a||"isEditing"===a||"oldValue"===a||"_updating"===a||"notifyFn"===a||a.startsWith("_")||"canNotify"===a)return!0;if("error"===a)return!0;if("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||"formula"===a)return"formula"===a&&(l.formula=l._parseFormula(l.formula)),!0;if("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a){void 0===l.oldValue&&(l.oldValue=r),null==i&&delete l._formula;(()=>{if(l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),void 0===i&&(i=null),null!==i&&void 0!==i.label&&void 0!==i.value)l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value;else if(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i,l.column.displayField!==l.column.dataField&&"object"!=typeof i)if(l.column._dataSource){let e=i;for(let t=0;t<l.column._dataSource.length;t++)if(l.column._dataSource[t].value===i){e=l.column._dataSource[t].label;break}l.row.data[l.column.displayField]=e}else l.row.data[l.column.displayField]=i;const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;if(l.grid.dataSource)if(null!==i&&i.label&&i.value&&l.column.displayField!==l.column.dataField)l.grid._sortedColumns&&l.grid._sortedColumns.length>0?(e[l.column.dataField]=i.value,e[l.column.displayField]=i.label):(l.grid.dataSource.boundSource[t][l.column.dataField]=i.value,l.grid.dataSource.boundSource[t][l.column.displayField]=i.label);else if(i!==l.grid.dataSource.boundSource[t][l.column.dataField])if(l.grid._sortedColumns&&l.grid._sortedColumns.length>0)e[l.column.dataField]=i;else if(l.grid.dataSource.boundHierarchy&&l.grid.dataSource.childrenDataField){const t=(e=>function e(t,a){for(let i=0;i<t.length;i++){const r=t[i];if(r.id===a)return r;if(r[l.grid.dataSource.childrenDataField]&&r[l.grid.dataSource.childrenDataField].length>0){const t=e(r[l.grid.dataSource.childrenDataField],a);if(t)return t}}return null}(l.grid.dataSource.boundSource,e))(e.$.id);t&&(t[l.column.dataField]=i),e[l.column.dataField]=i}else l.grid.dataSource.boundSource[t][l.column.dataField]=i}l.grid.dataSource.boundSource.canNotify=!0,l.grid.onCellValueChanged&&i!==r&&l.grid.onCellValueChanged({id:l.row.id,dataField:l.column.dataField,value:i,oldValue:r})})()}return"selected"===a?(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0),l.grid._recycle(!1,!0,!1),l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0):!(!l._updating&&l.canNotify)||(l.grid._recycle(),!l.row.canNotify||(l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0))}})}_parseFormula(e){const t=this.row;if(!e)return e;return"string"!=typeof e&&(e=""+e),!1===e.startsWith("=")&&(e="="+e),e=function(e,t){return e.replace(/COL\(([^)]+)\)/g,((e,l)=>`${l}${t}`))}(e,1+t.index)}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const r=a[e];l+=`${r}: ${i};`},r=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<r.length;e++)i(r[e]);e.getAttribute("style")!==l&&(""===l?e.removeAttribute("style"):e.setAttribute("style",l)),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.grid&&!t.grid.appearance.showSelectionOnTop||t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(l.column.placeholder&&e===l.column.placeholder)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("any"===l.column.dataType||"string"===l.column.dataType&&t&&t.length){let a=!1;const i=""+e;if((i.indexOf("/")>=0||i.indexOf("-")>=0||i.indexOf(":")>=0)&&(t.indexOf("d")>=0&&t.indexOf("M")>=0&&(a=!0),(t.indexOf("d")>=0||t.indexOf("M")>=0||t.indexOf("y")>=0||t.indexOf("h")>=0||t.indexOf("H")>=0||t.indexOf("m")>=0)&&(a=!0)),a){let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{"string"==typeof e&&(e=parseFloat(e));let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat){return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e)}!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const a=t.NumberFormat&&void 0!==t.NumberFormat.maximumFractionDigits?t.NumberFormat.maximumFractionDigits:2,i=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:a,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+i.replace("-","")+")":i}if(l.column.formatSettings.Intl.NumberFormat.locale){return new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,t.NumberFormat).format(e)}{const a=new Intl.NumberFormat(this.grid.locale,t.NumberFormat).format(e);if("percent"===l.column.formatSettings.Intl.NumberFormat.style){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits?l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits:2;return new Intl.NumberFormat(this.grid.locale,{style:"decimal",minimumFractionDigits:t}).format(100*e)+" %"}return"squaremeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m²":"cubicmeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m³":a}}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const r=i.formatNumber(e,t);return void 0===r?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+r+")":r}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let r=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(r=r.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let n=0;n<i._cellsMerge.length;n++){const s=i._cellsMerge[n];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=r.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)r[t]&&-1===o.indexOf(r[t])&&o.push(r[t])}if(d.push(s.column.dataField),s.colspan>1){const e=i.columns.indexOf(i.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const r=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=r,r}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=s,e.appendChild(a),e.appendChild(n),n.setAttribute("content",""),a.setAttribute("indent",""),r.setAttribute("label",""),i.setAttribute("toggle-button",""),i.setAttribute("role","presentation"),i.setAttribute("aria-label","Expand/Collapse Row"),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),s.setAttribute("aria-checked","false"),s.setAttribute("aria-label","Select Row"),l.setAttribute("has-toggle-button",""),n.appendChild(i),n.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),n.appendChild(r),l.content=r}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let r=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(r=!0,e.row.filterRow&&(r=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(r=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(r=!1)),r)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group",""),e.setAttribute("role","gridcell");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let r=a.label;const n=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&n(e,i.children,l))}return l};let s="";if(void 0!==a.label){let o="",d=[];if(t.grouping.summaryRow.visible){let r=[];const s={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;c.length&&(r=n(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[])),s[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([s],r):null;if(m)for(let r=0;r<c.length;r++){const n=c[r];r>0&&(o+=", ");let u=m[l.dataField][n];const p=l.cellsFormat;if(void 0!==u){if(p&&(u=e.cell.getFormattedValue(u,p)),i){const i=t.columnByDataField[a.groupDataField];if(i){s[i.dataField]=c,m[i.dataField]=m[l.dataField],u=m[i.dataField][n];const t=i.cellsFormat;t&&(u=e.cell.getFormattedValue(u,t))}}o+=t.localize(n,{value:u}),m[l.dataField]&&m[l.dataField][n]&&d.push(m[l.dataField][n])}}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)r="<div header group-advanced><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let n="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e||t.label===e));t&&t.color?(n=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}else if("object"==typeof e&&e&&e instanceof Date){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,"d")}const s=t.editing.addNewRow.visible?'<span add-row class="smart-grid-icon smart-icon-plus-circled show"></span>':"";if(r=`<div style="${n}" header group-advanced><span group>${s}${i}: </span><span value>${e}</span>`,e=""+e,e&&e.indexOf(",")>=0){let t="";r=`<div style="display: flex;" header group-advanced><span group>${s}${i}: </span>`;let a=e.split(",");for(let e=0;e<a.length;e++){let i=a[e].trim();if(l&&l.editor&&l.editor.dataSource){const e=l.editor.dataSource.find((e=>e.value===i||e.label===i));e&&e.color?(n=`--smart-primary: ${e.color}`,e.label&&(i=e.label)):e&&e.label&&(i=e.label),t+=`<span style="${n}" value>${i}</span>`}}r+=t}o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=""+o,r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)r="<div header><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label;if(l.displayField!==l.dataField&&a.data.data&&(e=a.data.data[l.displayField]),"object"==typeof e&&l.cellsFormat){e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)}r="<div header><span group>"+i+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("basic"===t.grouping.renderMode){if(r=a.label,l.displayField!==l.dataField&&a.data.data&&(r=a.data.data[l.displayField]),"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}else if("multipleColumns"===t.grouping.renderMode){if(r=a.label,"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),r=o;s=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&i){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const n=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];n.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),a.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",n.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';n.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),n.innerHTML=m,c.innerHTML=r,i&&t.grouping.formatFunction){const i={row:a,column:l,groupDataField:a.groupDataField,cell:e.cell,value:r,data:a.data,template:null},n=t.grouping.formatFunction(i);n&&(i.value=n),i.value!==r?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:t._unescapeString(r)):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(o.innerHTML=r,l.summary.length&&t.grouping.summaryRow.inline&&r&&e.classList.remove("smart-hidden"));void 0!==a.label&&t.grouping.enabled&&i&&!l._treeColumn&&l.summary.length&&t.grouping.summaryRow.inline&&r&&(t.rightToLeft||e.style.left!==l.left+"px"&&(e.style.left=l.left+"px"),e.removeAttribute("has-toggle-button",""),r=s,o.innerHTML=r);let d="smart-label";e.style.zIndex="";const c=t.editing.addNewColumn.visible&&t._addNewColumn?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l&&(l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),l.summary.length&&t.grouping.summaryRow.inline&&r&&(e.style.width=l.computedWidth+"px",e.style.zIndex=11,e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign));if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),o.className!==d&&(o.className=d),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,data:null,group:{value:r,template:null}},i=l.formatFunction(t);if(i&&(t.group.value=i),t.group.value!==r)if(l._treeColumn){o.children[1].children[2].innerHTML=t.group.value}else o.innerHTML=t.group.value;null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const r=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:r,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:r,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:r,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:r,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:r,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:r,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:r,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:r,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:r,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:r,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]);const n=l._getFilterDataType(a);i="string"===n?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let s="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition||void 0===a._filterInfo.condition)a._filterInfo.condition="",s="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":s="smart-icon-equals";break;case"starts_with":s="smart-icon-starts-with";break;case"ends_with":s="smart-icon-ends-with";break;case"not_equal":s="smart-icon-not-equal";break;case"less_than":s="smart-icon-less-than";break;case"less_than_or_equal":s="smart-icon-less-than-or-equal";break;case"greater_than":s="smart-icon-greater-than";break;case"greater_than_or_equal":s="smart-icon-greater-than-or-equal";break;case"contains":s="smart-icon-contains";break;case"does_not_contain":s="smart-icon-does-not-contain";break;case"range":s="smart-icon-between";break;default:s="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${s} show"></i></div> `;if("string"===n)o+=`<input class="smart-filter-input-value" data-type="${n}" /> `,e.innerHTML=o;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;o+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const i=document.createElement("div");i.classList.add("smart-input"),i.classList.add("smart-grid-check-box-cell-editor"),i.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),i.setAttribute("checked","indeterminate"),a._filterInfo&&a._filterInfo.value?i.setAttribute("checked",""):a._filterInfo&&!1===a._filterInfo.value&&i.removeAttribute("checked"),o=i.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const d=e.querySelector("input");if(d&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),d.onpaste=function(e){setTimeout((()=>{l._handleFilterCellKeyUp(this.cell,e)}))}.bind(this),d.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),d.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),d.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),d.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=d,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&d&&(d.value=a._filterInfo.value,"date"===a.dataType&&(d.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),e.removeAttribute("disabled"),a.allowFilter||(d.disabled=!0,e.setAttribute("disabled","")),a.filterEditor||"multi"===a.filterMenuMode)if("multi"===a.filterEditor.template||"multi"===a.filterMenuMode){const t=document.createElement("div");t.className="smart-arrow-down",t.style.fontSize="16px",t.style.marginRight="4px",t.style.marginLeft="4px",t.style.alignSelf="center",t.style.cursor="pointer",t.onclick=function(e){l._handleFilterCellExcelIconClick(this.cell)}.bind(this),e.appendChild(t)}else if(a.filterEditor.template){const t=a.filterEditor.template,i=document.createElement("div");if(a.filterTemplate instanceof HTMLTemplateElement)i.appendChild(t.content.cloneNode(!0));else if(t instanceof HTMLElement)i.appendChild(t);else if("checkList"===t){const e=document.createElement("smart-drop-down-list");e.className="smart-filter-check-list",e.selectionMode="checkBox",e.filterable=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownAppendTo="body",e.dropDownButtonPosition="right",e.dataSource=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField),e.whenRendered((()=>{e.checkAll()})),a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember),e.onchange=()=>{const t=this.cell.column;if(e.selectedValues.length===e.dataSource.length)return t._filterInfo.value=null,e.close(),delete t._filterInfo.excelValues,void l.removeFilter(t.dataField);t._filterInfo.excelValues=e.selectedValues,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else if("list"===t||"dropDownList"===t||"select"===t){const e=document.createElement("smart-input");e.className="smart-filter-list",e.readonly=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownButtonPosition="right",a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember);let t=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField);t=[{label:"-",value:null}].concat(t),e.dataSource=t,e.onchange=()=>{this.cell.column._filterInfo.value=e.selectedValue,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else i.innerHTML=t;e.innerHTML="",e.appendChild(i),i.style.height="100%",i.style.width="100%";const r=e.querySelector("input");r&&(r.onfocus=()=>{e.setAttribute("focus","")},r.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,i)}else void 0!==a.filterEditor.min&&(d.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(d.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(d.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(d.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(d.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(d.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(d.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(d.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(t,l,a){const i=this,r=i.cell.grid,n=i.cell.column;r._cellCachedValues||(r._cellCachedValues=[]);const s=()=>!!r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML!==r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML=r._cellCachedValues[n.dataField+"_"+t]),i.cell._setStyle(a),i.setAttribute("template",i.cell.template),!0);let o=null;switch((!r.editing.enabled||!n.allowEdit||i.cell.readonly||"none"===r.editing.action||r.editing.enabled&&r.editing.commandColumn.visible&&r.editing.editRow!==i.cell.row)&&i.setAttribute("readonly",""),n.placeholder&&t===n.placeholder&&(t=""),l){case"checkBox":case"radioButton":case"switchButton":if(a.firstElementChild&&a.firstElementChild.classList&&a.firstElementChild.classList.contains("smart-input")){if(o=a.firstElementChild,t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),o.setAttribute("color","")}return void i.cell._setStyle(a)}if(o=document.createElement("span"),o.className="smart-input",t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color)}a.innerHTML="",a.appendChild(o),i.cell._setStyle(a);break;case"checklist":if(t&&t.indexOf("[")>=0&&(t=JSON.parse(t)),a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&e===t.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t&&Array.isArray(t)&&t.length>0){const e=t.filter((e=>e.completed)).length,l=["#D50000","#F4511E","#F6BF26","#33B679"],a=e+"/"+t.length;let i=l[0];e===t.length?i=l[3]:e>0&&e<t.length&&(i=l[2]),t=`<div style="display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${i}; width:16px; height: 16px;"><span title="${a}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${a}</span></div>`}else t="";o=document.createElement("span"),o.innerHTML=t,i.setAttribute("template",i.cell.template),o.setAttribute("value",t.length);break;case"createdBy":case"updatedBy":{const e=i.cell.row;let t=null,s=null;if(t="createdBy"===l?e.createdBy:e.updatedBy,e.history&&e.history.length&&(t="createdBy"===l?e.history[0].user:e.history[e.history.length-1].user),a.firstElementChild&&a.firstElementChild.hasAttribute("user-id")){if(t===parseInt(a.firstElementChild.getAttribute("user-id")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const l=a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild?a.firstElementChild.firstElementChild.firstElementChild.firstElementChild:null;if(l){a.firstElementChild.setAttribute("user-id",t);const i="string"==typeof e?e:e.name,r="string"==typeof e?null:e.color;if(("string"==typeof e?null:e.image)&&(l.firstElementChild.style.backgroundImage=`url('${e.image}')`),r){const e=new Smart.Color(r).getInvertedColor();l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",r),l.setAttribute("color",e),l.lastElementChild.textContent=i}else l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",""),l.setAttribute("color","");return}}}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id),d.style.width="100%",d.style.paddingRight="6px";let c='<div class="smart-flex smart-flex-auto smart-tokens-layout">';if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,i=document.createElement("span");if(a&&(i.style.backgroundImage=`url('${e.image}')`,i.className="smart-drop-down-list-selection-image"),l){c+='<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+'; overflow: visible;" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c+='<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c=""}d.innerHTML=c+"</div>";const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),o=m,o.setAttribute("user-id",t),i.setAttribute("template",i.cell.template);break}case"collaborator":case"tags":{let e=[];if("number"==typeof t&&(t=""+t),""===t||null===t||"uncategorized"===t){let e=`\n <div class="smart-multi-combo-input-container tokens smart-flex smart-flex-auto" data-field="${n.dataField}" row-id="${i.cell.row.id}"> \n <div class="smart-multi-combo-input" data-field="${n.dataField}" row-id="${i.cell.row.id}" class="tokens smart-flex smart-flex-auto">\n <div class=" smart-flex-auto smart-flex"></div>\n </div>\n </div>\n `;return a.innerHTML!==e&&(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild&&""===a.firstElementChild.firstElementChild.firstElementChild.textContent?(a.firstElementChild.setAttribute("row-id",i.cell.row.id),a.firstElementChild.firstElementChild.setAttribute("row-id",i.cell.row.id)):a.innerHTML=e),n.placeholder&&a.firstElementChild&&a.firstElementChild.firstElementChild&&(a.firstElementChild.firstElementChild.innerHTML=n.placeholder),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;if(null!==t&&(e=Array.isArray(t)?e.map((e=>e.trim())):t.indexOf("{")>=0||"[]"===t?JSON.parse(t):t.split(",").map((e=>e.trim()))),a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&n.editor._items&&n.editor._items[t]){if(a.firstElementChild.getAttribute("value")===t){i.cell._setStyle(a),i.setAttribute("template",i.cell.template);const e=n.editor.dots;if(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild){if(a.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),a.firstElementChild.firstElementChild.firstElementChild.firstElementChild){const t=a.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild;t&&(e?t.classList.add("dots"):t.classList.remove("dots"))}if(i.cell.row.height>45){a.firstElementChild.firstElementChild.firstElementChild.classList.add("smart-flex-wrap");const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1)for(let t=0;t<e.children.length;t++)e.children[t].style.maxWidth&&(e.children[t].style.maxWidth="")}else if(r.layout.rowHeight<=45&&i.cell.row.height<=45){const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1){const t=parseInt(n.computedWidth/e.children.length)-5;let l=0;for(let t=0;t<e.children.length;t++)l+=e.children[t].textContent.length,e.children[t].style.maxWidth="";if(14*l*.52+20*e.children.length>n.computedWidth)for(let l=0;l<e.children.length;l++)e.children[l].style.maxWidth=t+"px"}}}return}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id);let c='<div class="smart-tokens-layout smart-flex smart-flex-auto">';if(e.length>2&&i.cell.row.height>45){c='<div style="max-width: '+(n.computedWidth-10+"px")+'" class="smart-flex smart-flex-wrap">'}let m=0;if(t)for(let t=0;t<e.length;t++){const a=e[t];let i=null;if("collaborator"===l||n.editor&&n.editor.collaborator)i=r.users.find((e=>{if("string"==typeof a||"number"==typeof a){if(e.value===a||parseInt(e.value)===parseInt(a))return e;if(e.id===a||parseInt(e.id)===parseInt(a))return e}else if("object"==typeof a&&e.value===a.value)return e})),i&&(i.label=i.name);else{const e=n.editor.dataSource||n.options;if(e)if("string"==typeof a&&n.editor._items&&n.editor._items[a])i=n.editor._items[a];else{for(let t=0;t<e.length;t++){const l=e[t];if(void 0!==l.value&&void 0!==a&&void 0!==a.value&&l.value===a.value){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}if(void 0===l.value&&l===a||void 0!==l.value&&""+l.value===a){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}}n.editor.allowItemsAdd&&!i&&a&&(i=a)}else i=a}if(!i)continue;const s="string"==typeof i?i:i.label,o="string"==typeof i?null:i.color,d="string"==typeof i?null:i.image;if(""===s)continue;const u=document.createElement("span");d&&(u.style.backgroundImage=`url('${i.image}')`,u.className="smart-drop-down-list-selection-image");const p="smart-truncate";if(o&&n.editor.colorItems){const e=new Smart.Color(o).getInvertedColor(),t=n.editor.dots?" dots":"";c+='<span title="'+s+'" data-item="'+s+'" style="background: '+o+"; color: "+e+"; --smart-primary-color: "+e+'; overflow: visible;" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label"+t+'\' role="presentation">'+s+"</span>"}else c+='<span title="'+s+'" data-item="'+s+'" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>";m+=s.length;if(n.editor.dataSource||n.options){if(n.editor.singleSelect){c+="</span>";break}c+='<span class=\'smart-hidden smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else c+="</span>"}d.innerHTML=c+"</div>";const u=14*m*.52,p=d.firstElementChild;if(r.layout.rowHeight<=45&&i.cell.row.height<=45&&d&&p.children.length>1&&u+20*p.children.length>n.computedWidth){const e=parseInt(n.computedWidth/p.children.length)-5;for(let t=0;t<p.children.length;t++)p.children[t].style.maxWidth=e+"px"}if(d.style.width="100%",d.style.paddingRight="6px",d.onpointerdown=t=>{if(!r._mobile)if(t.target&&"#text"!==t.target.nodeName&&t.target.classList.contains("smart-drop-down-list-unselect-button")){let l=t.target.parentNode.getAttribute("data-item");const a=n.editor.dataSource||n.options;if(a&&"string"==typeof l&&a)for(let e=0;e<a.length;e++)a[e].label===l&&(l=a[e],l.value&&(l=l.value));if(e[0]&&e[0].label){const a=e.map((e=>e.value)).indexOf(l);if(a>=0){e.splice(a,1);const l=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,JSON.stringify(e)),r.onCellUpdate&&r.onCellUpdate([i.cell],[l],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(e.indexOf(l)>=0){e.splice(e.indexOf(l),1);const a=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,s),r.onCellUpdate&&r.onCellUpdate([i.cell],[a],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(t.target.classList.contains("smart-drop-down-list-selection-label")){if(r.editing.enabled&&r.editing.allowListOpenOnContentClick){const e=t.target.closest(".smart-multi-combo-input"),l=e.getAttribute("data-field"),a=e.getAttribute("row-id");r.beginEdit(a,l)}t.stopPropagation(),t.preventDefault()}},!n.cellsWrap&&n.allowEdit&&r.editing.enabled&&"card"!==r.view){let t=n.editor.dataSource&&n.editor.dataSource.length;n.editor.collaborator&&(t=r.users&&r.users.length);const l=document.createElement("div");t&&l.classList.add("items"),l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),l.appendChild(d),o=l}else if(n.cellsWrap||n.allowEdit){const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),t.appendChild(d),o=t}else d.classList.add("smart-flex-auto","smart-flex","tokens"),o=d;i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break}case"dropdownGrid":case"dropDownList":case"dropdownlist":case"list":{const e=document.createElement("div");if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(a.firstElementChild.getAttribute("value")===t&&!i.cell.column._isDirty)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if("dropdownGrid"!==i.cell.template){if(s()){const e=a.querySelector(".smart-arrow-down");return void(e&&(e.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}))}}if("dropdownGrid"===i.cell.template){const l=i.cell.column.templateSettings.dataFields;let a=i.cell.editor.dataSource?i.cell.editor.dataSource[t]:"";if(i.cell.column.relationId&&i.cell.column.relationField&&i.cell.column._isDirty&&(!i.cell.column.editor.dataSource||i.cell.column.editor.dataSource&&0===i.cell.column.editor.dataSource.length)){const e=r._getRelationData(i.cell.column.relationId,i.cell.column.relationField,i.cell.column.relationCascadingFields),l=r._getRelationColumns(i.cell.column.relationId);e&&(a=e[t]),i.cell.column.editor.columns=l,i.cell.column.editor.dataSource=e}if(e.classList.add("smart-flex","center"),e.style.alignItems="center",e.onmouseenter=()=>{e.querySelectorAll("i").forEach((e=>e.classList.add("show")))},e.onmouseleave=()=>{e.querySelectorAll("i").forEach((e=>e.classList.remove("show")))},a){e.style.justifyContent="space-between";let t="";for(let e=0;e<l.length;e++){const i=a[l[e]];i&&(t+='<span style="" class="smart-truncate smart-token smart-flex middle center ">'+i+"</span>")}e.innerHTML=t}else e.style.justifyContent="",e.innerHTML='<span class="smart-truncate"></span>'}else"card"===r.view?e.textContent=t:e.innerHTML='<span class="smart-truncate">'+t+"</span>";if(n.allowEdit&&r.editing.enabled&&"card"!==r.view){const t=document.createElement("span");t.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),e.classList.add("smart-flex-auto","smart-multi-combo-input"),l.appendChild(e),l.appendChild(t),l.classList.add(i.cell.template.toLowerCase()),o=l,t.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}}else o=e;i.setAttribute("template",i.cell.template.toLowerCase()),o.setAttribute("value",t);break}case"password":a.innerHTML=t?'<span class="smart-truncate">'+t.replace(/./g,"*")+"</span>":"",i.setAttribute("template",i.cell.template);break;case"richText":if(a.innerHTML=t?'<div class="textwrap" style="height: 100%; padding-top: 5px; padding-left: 5px;">'+r._unescapeString(t)+"</div>":"",r.layout.autoWrap&&i.cell.row.height>40&&1===i.cell.colSpan&&"string"===n.dataType){null==t&&(t="");if(14*t.length*.52>n.computedWidth){const e=parseInt(i.cell.row.height/20);a.firstElementChild.style["-webkit-line-clamp"]=e}}a.onpointerdown=e=>{if(!r._mobile&&r.editing.enabled){const t=r.offset(a);if(e.pageX>t.left+a.offsetWidth-20){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),i=l.getAttribute("data-id");delete r._beginEditKey,r.beginEdit(i,a)}}},o=a.firstElementChild,i.setAttribute("template",i.cell.template);break;case"color":a.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${t};"></span>`,i.setAttribute("template",i.cell.template);break;case"autoNumber":o=document.createElement("span"),o.innerHTML=1+i.cell.row.visibleIndex,i.setAttribute("template",i.cell.template);break;case"uuid":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}o=document.createElement("span"),o.style.paddingLeft="7px";const e=r._generateUUID(),l=i.cell.canNotify;i.cell.canNotify=!1,t||(i.cell.value=e,r.onCellUpdate&&!r.editing.editRow&&r.onCellUpdate([i.cell],[e],[e],(function(){r.onCellUpdated&&r.onCellUpdated([i.cell.row.index],[i.cell.row],[i.cell.column],[i.cell.row.data],[i.cell.value],[i.cell.value],i)}),i)),o.textContent=i.cell.value,i.cell.canNotify=l,i.setAttribute("template",i.cell.template),o.setAttribute("value",e);break}case"ai":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=(e,t)=>{const l=r.ai.url,a=r.ai.key;e.stopPropagation(),e.preventDefault();const i=e.target.closest("smart-grid-cell"),n=e.target.closest("smart-grid-row"),s=i.getAttribute("data-field"),d=n.getAttribute("data-id");t?(e.target.classList.remove("smart-icon-reload"),e.target.classList.add("smart-grid-loading")):e.target.classList.add("smart-grid-loading");let c=""+r.columnByDataField[s].AIQuery;r.columnByDataField[c]&&(c=""+r.getCellValue(d,c));for(let e=0;e<r.ai.promptVariables.length;e++){const t=r.ai.promptVariables[e],l=r.getCellValue(d,t.dataField)||"",a=new RegExp(`{{${t.name}}}`,"g");c=c.replace(a,l)}c=c.trim(),c=c.replaceAll("\n"," "),c=c.replaceAll("\r"," "),c=c.replaceAll(" "," "),c=c.substring(0,2e3),c&&l&&a?async function(e){e+="\nRespond in less than "+r.ai.maxResponseLength+" words.",e+="\nOutput always in plain text.";const t=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r.ai.model,messages:[{role:"user",content:e}],max_tokens:r.ai.maxTokens,temperature:r.ai.temperature})});if(!t.ok)throw new Error(`Error: ${t.statusText}`);return(await t.json()).choices[0].message.content.trim()}(c).then((e=>{const t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");r.setCellValue(d,s,t),o.setAttribute("value",t)})).catch((e=>{console.error("Error:",e)})):(r.setCellValue(d,s,r.localize("noResults")),o.setAttribute("value",r.localize("noResults")))};if(t){o=document.createElement("span"),o.style.paddingLeft="7px",o.classList.add("smart-flex");const l=i.cell.canNotify;i.cell.canNotify=!1,o.textContent=i.cell.value,i.cell.canNotify=l;const a=document.createElement("span");o.appendChild(a),a.classList.add("smart-grid-icon","show","smart-icon-reload"),a.style.position="absolute",a.style.right=a.style.top="0px",a.onpointerdown=t=>{e(t,!0)},i.setAttribute("template",i.cell.template),o.setAttribute("value",t)}else o=document.createElement("div"),o.classList.add("smart-flex","center","middle"),o.style.height="100%",o.innerHTML=`<button style="border-radius: 10px; line-height: 13px; height: 30px; padding-inline: 30px; padding-block: 2px;" class="smart-button" type="button">✨︎ ${r.localize("generate")}</button\n `,o.firstElementChild.onpointerdown=t=>{e(t)},i.setAttribute("template",i.cell.template);break}case"createdDate":case"createdTime":{const e=i.cell.row;let t=e.createdDate;if(s())return;e.history&&e.history[0]&&(t=e.history[0].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("created-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span created-date class="align-left smart-truncate">'+l+" "+r+"</span>";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break}case"updatedDate":case"updatedTime":if(s())return;if(i.cell.row.updatedDate){const e=i.cell.row;let t=e.updatedDate;e.history&&(t=e.history[e.history.length-1].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("updated-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span updated-date class="align-left smart-truncate">'+l+" "+r+"</span>"}else a.innerHTML="";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break;case"progress":{const e=t?parseInt(100*t)+"%":"0%";if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const l="white",r=["#D50000","#F4511E","#F6BF26","#33B679"];let s=r[0];if(s=t<.25?r[0]:t<.5?r[1]:t<.75?r[2]:r[3],n.templateSettings){if(n.templateSettings.getComputedValue){const e=n.templateSettings.getComputedValue(i.cell.row.data,i.cell.row,i.cell.column,t);t=e}if(n.templateSettings.conditions){for(let e=0;e<n.templateSettings.conditions.length;e++){const l=n.templateSettings.conditions[e];null!==l.value&&t>=l.value&&(s=l.color)}let l=0,r=1;void 0!==n.templateSettings.min&&(l=n.templateSettings.min),void 0!==n.templateSettings.max&&(r=n.templateSettings.max);const o=t/(r-l)*100;return a.innerHTML=`\n <div style="height: 40%; top: 30%; position: relative; left: 5%; right:5%; width: 90%; overflow:hidden; border-radius: 8px; background: var(--smart-surface); border: 1px solid var(--smart-border);" class="smart-grid-progress-container" role="progressbar" \n aria-valuemin="0" aria-valuemax="100" aria-valuenow="${t}" \n aria-label="Progress: ${e}" tabindex="0">\n <div class="smart-grid-progress-fill" style="height: 100%; width: ${o}%; background: ${s};">\n </div>\n </div>\n `,void i.setAttribute("template",i.cell.template)}}a.innerHTML='<div value="'+e+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+e+';"><div title="'+e+'" style="width: 100%; height: 4px; background: '+s+"; color: "+l+';" class="smart-truncate smart-token"></div></div><span>'+e+"</span></div>",i.setAttribute("template",i.cell.template);break}case"rating":{const e=i.cell.column.editor.max?i.cell.column.editor.max:5,l=t?parseInt(t):0;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(l===parseInt(a.firstElementChild.getAttribute("value")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);a.firstElementChild.setAttribute("value",l);for(let t=0;t<e;t++){const e=a.firstElementChild.children[t];let i="";l>0&&l>t&&(i="value"),i?e.classList.add("value"):e.classList.remove("value")}return void i.setAttribute("template",i.cell.template)}const n=t=>{let l="";for(let a=0;a<e;a++){let e="";t>0&&t>a&&(e="value"),l+=`<div rating-value title="${a+1}" value="${a+1}" class="smart-grid-icon show smart-icon-star ${e}"></div>`}return l};a.innerHTML=`<div value="${l}" class="rating">${n(l)}</div>`;const s=e=>{if(!r._mobile&&e.hasAttribute("rating-value")){const t=e.getAttribute("value"),l=e.closest("smart-grid-cell"),a=e.closest("smart-grid-row");if(l&&a){const e=l.querySelector(".rating"),s=a.getAttribute("data-id"),o=l.getAttribute("data-field"),d=r.rowById[s],c=r.getCellValue(s,o),m=l.cell;let u=null;r.storeHistory&&(u=r._stringifyRow(d)),c===t?(a.row.data[o]=0,e.innerHTML=n(0),e.setAttribute("value",0)):(a.row.data[o]=parseInt(t),e.innerHTML=n(parseInt(t)),e.setAttribute("value",t));const p=a.row.data[o];r._setCellUndoRedo(m,c,p),r.onCellUpdate&&r.onCellUpdate([m],[c],[p],(function(e){r.onCellUpdated&&r.onCellUpdated([m.row.index],[m.row],[m.column],[m.row.data],[c],[p],i),r._onCellUpdated&&r._onCellUpdated(m.row.index,m.row,m.column,m.row.data,c,p)}),i);const g=e=>{if(e!==c&&(d.updatedDate=new Date,d.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(d);t[m.column.dataField]=e,r._updateRowHistory(d,u,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p);const f=l.querySelector(".rating"),h=parseInt(t)-1;f.children[h].classList.add("down"),setTimeout((()=>{f.children[h].classList.remove("down")}),1e3)}}},o=(e,t=!0)=>{if(e&&[...e.querySelectorAll(".smart-icon-star")].forEach((e=>{e.classList.remove("hover")})),e.hasAttribute("value")){const l=[...e.parentElement.children],a=l.indexOf(e);l.forEach(((e,l)=>{e.classList.remove("hover"),l<=a&&t&&e.classList.add("hover")}))}};r.editing.enabled?(r.handleRatingClick||(r._handleRatingMove=o,r._handleRatingClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointermove=e=>{o(e.target)},a.firstElementChild.onpointerleave=e=>{o(e.target)}):a.firstElementChild.style.pointerEvents="none",i.setAttribute("template",i.cell.template);break}case"vote":{let e=t;const l=(e,t)=>{const l=e.firstElementChild.firstElementChild,a=r.users?r.users.length:1,i=t.length*(100/a)+"%",n=t.length>0?"voted":"",s=l.firstElementChild,o=s.children[0];l.children[1].children[0].classList.remove("smart-votes-bar-animate"),r.isScrolling||l.children[1].children[0].classList.add("smart-votes-bar-animate");const d=l.children[1].firstElementChild.children[0],c=l.children[2];s.classList.remove("voted"),o.classList.remove("smart-icon-check"),n&&(o.classList.add("smart-icon-check"),s.classList.add("voted")),c.textContent=t.length,d.style.width=i,e.firstElementChild.setAttribute("value",t)};if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const t=a.firstElementChild.getAttribute("value"),r=a.firstElementChild;return r.removeAttribute("color"),r.style.setProperty("--smart-check-template-color","var(--smart-primary)"),r.style.setProperty("--smart-check-template-forecolor","#ffffff"),i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(r.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),r.setAttribute("color","")),e=e?e.split():[],l(a,e),e===t?(i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)):(a.firstElementChild.setAttribute("value",e),void i.setAttribute("template",i.cell.template))}const n=e=>{e&&!Array.isArray(e)&&(e=e?e.split():[]);const t=r.users?r.users.length:1,l=e.length*(100/t)+"%;";return`<div vote-value class="smart-flex middle center smart-votes-cell-component">\n <div class="smart-flex middle center smart-vote-button ${e.length>0?"voted":""}">\n <span class="smart-icon smart-grid-icon show ${e.length>0?"smart-icon-check":""}"></span>\n </div>\n <div class="smart-votes-bar-container">\n <div class="smart-votes-bar-component">\n <div class="smart-votes-bar" style="width: ${l} opacity: 1;"></div>\n <div class="smart-votes-bar-frame" style="width: 100%; opacity: 0.2;"></div>\n </div>\n </div>\n <div class="smart-voters-info">${e.length}</div>\n </div>`};a.innerHTML=`<div value="${e}" class="vote">${n(e)}</div>`,i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(o=a.firstElementChild,o.style.setProperty("--smart-check-template-forecolor","#ffffff"),o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color));const s=(e,t,a)=>{if(r._mobile)return;const n=e.closest("smart-grid-cell"),s=e.closest("smart-grid-row"),o=(e,t)=>{const a=r.rowById[e],o=r.getCellValue(e,t),d=n.cell;let c=null;r.storeHistory&&(c=r._stringifyRow(a));const m=o?o.split(","):[],u=r._currentUser?""+r._currentUser.info.id:null;if(void 0===u)return;m.indexOf(u)>=0?(m.splice(m.indexOf(u),1),s.row.data[t]=m.toString(),l(n.firstElementChild,m)):(m.push(u),s.row.data[t]=m.toString(),l(n.firstElementChild,m));const p=s.row.data[t];r._setCellUndoRedo(d,o,p),r.onCellUpdate&&r.onCellUpdate([d],[o],[p],(function(){r.onCellUpdated&&r.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[p],i),r._onCellUpdated&&r._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,p)}),i);const g=e=>{if(e!==o&&(a.updatedDate=new Date,a.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(a);t[d.column.dataField]=e,r._updateRowHistory(a,c,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p)};if(n&&s){o(s.getAttribute("data-id"),n.getAttribute("data-field"))}else null!==t&&null!==a&&o(t,a)};r._handleVoteClick||(r._handleVoteClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointerenter=e=>{const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row");if(t&&l){const i=l.getAttribute("data-id"),n=t.getAttribute("data-field");let s=r.getCellValue(i,n);if(s){if(r.users){let e="";s=s.split(),r.users.forEach((t=>{(s.indexOf(""+t.id)>=0||s.indexOf(""+t.value)>=0)&&(e+=t.name||t.label)})),e&&(s=r.localize("votes",{value:e}))}}else s=r.localize("noVotes");r._createTooltip(e,s,a,"top")}},a.firstElementChild.onpointerleave=()=>{r._cellTooltip&&(r._cellTooltip.style.visibility="hidden")},i.setAttribute("template",i.cell.template);break}case"duration":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t){const e=864e5;let l="MMM dd",n="MMM dd";if("string"==typeof t[0]&&(Array.isArray(t)?(t[0]=new Date(t[0]),t[1]=new Date(t[1])):((t=t.split(","))[0]=new Date(t[0]),t[1]=new Date(t[1]))),Array.isArray(t)){t[0]&&"string"==typeof t[0]&&(t[0]=new Date(t[0])),t[1]&&"string"==typeof t[1]&&(t[1]=new Date(t[1])),t[1]&&t[1].getMonth()===t[0].getMonth()&&(n="dd"),t[0]&&t[0].getFullYear()!==(new Date).getFullYear()&&(l+=", yyyy","dd"===n?(l="MMM dd",n+=", yyyy"):n=l);let s=!1;t[0]&&(0===t[0].getHours()&&0===t[0].getHours()||(l+=" hh:mm","dd"===n?n=l:n+=" hh:mm",s=!0));let o=null;o=Math.round(t[1].getTime()-t[0].getTime())/e;const d=o?parseInt(Math.abs(o).toFixed(0)):0;if(d>0){const e=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],n);let s="";s=r.localize("days",{value:d}),a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${e}</span><span style="font-size: 11px;" class="smart-quiet">${s}</span></div>`}else{let e="";if(s){const r=t[1]-t[0],n=Math.floor(r%864e5/36e5);let s=Math.round(r%864e5%36e5/6e4);s<10&&(s+="0"+s),e=n+":"+s;const o=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],"hh:mm");a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${o}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else{const r=i.cell.getFormattedValue(t[0],l);a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${r}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}}}}else a.innerHTML="";i.setAttribute("template",i.cell.template),a.firstElementChild&&a.firstElementChild.setAttribute("value",e);break}case"startDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;let l=t;if(n.cellsFormat?l=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(l=i.cell.getFormattedValue(t,n.formatSettings.Intl)),t){const e=864e5,s="string"==typeof t?new Date(t):t;let o=r.columnByDataField.taskDueDate;n.editor.boundDateField?o=r.columnByDataField[n.editor.boundDateField]:n.relationField&&(o=r.columnByDataField[n.relationField]);let d=o?i.cell.row.data[o.dataField]:"";d&&"string"==typeof d&&(d=new Date(d));let c=null;d&&(c=Math.round(s.getTime()-d.getTime())/e);const m=c?parseInt(Math.abs(c).toFixed(0)):0;if(m>0){let e="";e=r.localize("days",{value:m}),a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto 25px"><span style="color: var(--smart-primary);" title="${e}" class="smart-icon-clock smart-grid-icon show"></span><span>${l}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else a.innerHTML='<div style="padding-left: 7px;">'+l+"</div>"}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"dueDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;const l=["#D50000","#F4511E","#F6BF26","#33B679"],o=n.editor.date||(n.templateSettings&&n.templateSettings.date?n.templateSettings.date:new Date)||new Date;o.setHours(0,0,0);let d=t;n.cellsFormat?d=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(d=i.cell.getFormattedValue(t,n.formatSettings.Intl));const c=(e,t)=>{const l=e<=8?e/8:1;return`<div title="${t}" class="smart-element smart-circular-progress-bar" style="background: inherit; padding-left:4px; position: relative; top: calc(50% - 12px); padding-top:4px; width: 20px; height: 20px;">\n <div class="smart-container">\n <svg style="left: 0px; top: 0px; background: var(--smart-background);"width="100%" height="100%" viewPort="0 0 100 100" viewBox="0 0 100 100" role="presentation" aria-hidden="true">\n <circle id="value" class="smart-value-path" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n <circle id="value" style="stroke-dashoffset: ${100*Math.PI-(1-l)*Math.PI*100}; stroke-width: 100%;" class="smart-value" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n </svg>\n </div>\n </div>\n `};if(t){const s=864e5,m="string"==typeof t?new Date(t):t,u=Math.round(m.getTime()-o.getTime())/s,p=parseInt(Math.abs(u).toFixed(0));let g=r.columnByDataField.taskStatus;n.editor.boundDataField?g=r.columnByDataField[n.editor.boundDataField]:n.relationField&&(g=r.columnByDataField[n.relationField]);const f=g?i.cell.row.data[g.dataField]:"";if("done"===f||"complete"===f||"completed"===f||"finished"===f||!0===f||"done"===(""+f).toLowerCase()||"complete"===(""+f).toLowerCase()||"completed"===(""+f).toLowerCase()||"finished"===(""+f).toLowerCase()||1===f||"1"===f){let e=r.localize("done");a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${l[3]}; width:16px; height: 16px;"><span title="${e}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${d}</span></div>`}else{let t="";t=0===p?r.localize("today"):1===p?e<o?r.localize("yesterday"):r.localize("tomorrow"):e<o?r.localize("daysOverdue",{value:p}):r.localize("daysLeft",{value:p}),a.innerHTML=e>=o?`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto">${c(p,t)}<span>${d}</span></div>`:`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><span title="${t}" style="font-size: 16px; color: ${l[0]}" class="smart-grid-icon show smart-icon-attention-circled"></span>${d}</span></div>`}t=t+"_"+f}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"attachments":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="attachments"><div title="${r.localize("addFiles")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return a.innerHTML!==e&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div");e.classList.add("file-container"),l.classList.add("attachments");let n=t;if(r._findIsFile(n)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}if("string"==typeof n&&(n.indexOf("[{")>=0||n.indexOf("}]")>=0)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}Array.isArray(n)&&n.forEach((t=>{const l=document.createElement("div");l.title=t.label,l.classList.add("item"),l.innerHTML="<div></div>",l.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.label||(t.label=""),t.label.indexOf("png")>=0||t.label.indexOf("jpg")>=0||t.label.indexOf("jpeg")>=0||t.label.indexOf("gif")>=0?l.firstElementChild.classList.add("smart-icon-image"):t.label.indexOf(".pdf")>=0?l.firstElementChild.classList.add("smart-icon-pdf"):t.label.indexOf(".tsv")>=0||t.label.indexOf(".txt")>=0||t.label.indexOf(".csv")>=0?l.firstElementChild.classList.add("smart-icon-text"):t.label.indexOf(".xls")>=0||t.label.indexOf(".xlsx")>=0?l.firstElementChild.classList.add("smart-icon-excel"):t.label.indexOf(".ppt")>=0?l.firstElementChild.classList.add("smart-icon-powerpoint"):t.label.indexOf(".zip")>=0||t.label.indexOf(".rar")>=0||t.label.indexOf(".7z")>=0?l.firstElementChild.classList.add("smart-icon-archive"):t.label.indexOf(".doc")>=0||t.label.indexOf(".docx")>=0?l.firstElementChild.classList.add("smart-icon-word"):t.label.indexOf(".mp3")>=0?l.firstElementChild.classList.add("smart-icon-music"):t.label.indexOf(".mp4")>=0||t.label.indexOf(".avi")>=0||t.label.indexOf(".mov")>=0||t.label.indexOf(".mp4")>=0||t.label.indexOf(".mpeg")>=0||t.label.indexOf(".webm")>=0||t.value&&t.value.indexOf("youtube")>=0?l.firstElementChild.classList.add("smart-icon-video"):l.firstElementChild.classList.add("smart-icon-file"),e.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");d.classList.add("smart-arrow-right","arrowbtn");const c=document.createElement("div");if(c.classList.add("smart-icon-plus","smart-grid-icon","show"),c.title=r.localize("addFiles"),"card"!==r.view&&l.appendChild(c),l.onpointerdown=t=>{if(t.target.classList.contains("attachment")){const e=JSON.parse(i.cell.value),a=[...l.children[1].children],n=a&&a.indexOf?a.indexOf(t.target.parentNode):-1;if(e[n]){const t=document.createElement("a");if(e[n].value.indexOf(window.location.host)>=0)fetch(e[n].value).then((e=>e.blob())).then((l=>{const a=URL.createObjectURL(l);t.download=e[n].label,t.href=a,t.click()}));else{if(e[n].value.indexOf("base64")>=0){const l=r._getFileFromBase64(e[n].value);t.href=URL.createObjectURL(l)}else t.href=e[n].value;t.target="_blank",t.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=s===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.children.length){if(l.appendChild(e),"card"!==r.view){const t=25*n.length;t-i.offsetWidth+30>30&&(l.appendChild(s),l.appendChild(d)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",s.classList.add("smart-hidden"),a<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),a>30&&(l.appendChild(s),l.appendChild(d))}}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):n&&n[0]&&n[0].label?o.setAttribute("value",n[0].label):o.setAttribute("value",t);break}case"images":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="images"><div title="${r.localize("addImages")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return e!==a.innerHTML&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(!r._recycleFiles&&a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div"),s=document.createDocumentFragment();e.classList.add("file-container"),l.classList.add("images");let d=t;if(r._findIsFile(d)){let e="";if(d&&d.indexOf("{")>=0)try{e=JSON.parse(d)}catch(e){console.log(e)}else e=d.split(","),e=e.map((e=>({label:e,value:e})));d=e}if("string"==typeof d&&(d.indexOf("[{")>=0||d.indexOf("}]")>=0)){let e="";if(d)try{e=JSON.parse(d)}catch(e){console.log(e)}d=e}else"string"==typeof d&&d.indexOf("./")>=0&&(d=d.split(","),d=d.map((e=>({label:e,value:e}))));Array.isArray(d)&&d.forEach((e=>{if(e.label||(e.label=""),e.label.indexOf(".mp4")>=0||e.label.indexOf(".avi")>=0||e.label.indexOf(".mov")>=0||e.label.indexOf(".mp4")>=0||e.label.indexOf(".mpeg")>=0||e.label.indexOf(".webm")>=0||e.value&&e.value.indexOf("youtube")>=0){const t=document.createElement("div");t.title=e.label,t.classList.add("item"),t.innerHTML="<div></div>",t.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.firstElementChild.classList.add("smart-icon-video"),s.appendChild(t)}else{const t=document.createElement("img");t.style.display="none";let l="";l=e.label.indexOf(".gif")>=0?e.value:e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,t.onload=()=>{t.style.display=""},l.indexOf("base64")>=0?t.src=l:(r._imagesCache||(r._imagesCache=[]),r.uploadSettings.url?r._imagesCache[l]?r._findUserFile(e)&&(t.src=l):(r._imagesCache[l]=!0,t.style.display="none",r._findUserFile(e)?(t.src=l,t.style.display=""):l&&l.startsWith("https://")&&(t.src=l)):t.src=l,t.onerror=()=>{t.style.display="none"}),t.title=e.label,t.setAttribute("data-url",e.large||e.value),s.appendChild(t)}}));const c=document.createElement("div");c.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const m=document.createElement("div");m.classList.add("smart-arrow-right","arrowbtn");const u=document.createElement("div");u.classList.add("smart-icon-plus","smart-grid-icon","show"),u.title=r.localize("addImages");const p=document.createElement("div");if(p.classList.add("smart-navigation"),"card"!==r.view&&r.editing.enabled&&n.allowEdit&&l.appendChild(u),l.onpointerdown=t=>{if("IMG"===t.target.nodeName&&("card"!==r.view&&[...e.children].forEach((e=>e.classList.remove("smart-hidden"))),r._openImagePreviewDialog(t.target),t.stopPropagation(),t.preventDefault()),t.target.classList.contains("attachment")){const l=JSON.parse(i.cell.value),a=[...e.children].indexOf(t.target.parentNode);if(l[a]){const e=document.createElement("a");if(l[a].value.indexOf(window.location.host)>=0)fetch(l[a].value).then((e=>e.blob())).then((t=>{const i=URL.createObjectURL(t);e.download=l[a].label,e.href=i,e.click()}));else{if(l[a].value.indexOf("base64")>=0){const t=r._getFileFromBase64(l[a].value);e.href=URL.createObjectURL(t)}else e.href=l[a].value;e.target="_blank",e.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("smart-navigation-item")){[...p.children].forEach((e=>e.classList.remove("active"))),t.target.classList.add("active"),[...e.children].forEach((e=>e.classList.add("smart-hidden")));const l=[...p.children].indexOf(t.target);e.children[l].classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=c===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?c.classList.add("smart-hidden"):c.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.appendChild(s),e.children.length){if(l.appendChild(e),"card"===r.view&&l.appendChild(p),"card"!==r.view){const t=25*d.length;t-i.offsetWidth+30>30&&(l.appendChild(c),l.appendChild(m)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",c.classList.add("smart-hidden"),a<0?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden"),a>30&&(l.appendChild(c),l.appendChild(m))}}else{for(let t=0;t<e.children.length;t++){const l=document.createElement("div");l.classList.add("smart-navigation-item"),0===t?l.classList.add("active"):e.children[t].classList.add("smart-hidden"),p.appendChild(l)}1===e.children.length&&p.classList.add("smart-visibility-hidden")}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):d&&d[0]&&d[0].label?o.setAttribute("value",d[0].label):o.setAttribute("value",t);break}case"email":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;o=document.createElement("span"),null===t||""===t?o.innerHTML="":Smart.Validator.email(t)?o.innerHTML=t:(o.className="url center middle",o.innerHTML='<a href="mailto:'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()}))}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"url":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;const l=e=>{e.classList.add("center","middle"),null===t||""===t?e.classList.add("smart-hidden"):Smart.Validator.url(t)?(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="https://'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden")):(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden"))};a.firstElementChild&&a.firstElementChild.classList.contains("url")?(o=a.firstElementChild,l(o)):(o=document.createElement("span"),o.className="url",l(o)),o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()})}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"sparklines":{const l=t,o=""+n.computedWidth;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value"),t=a.firstElementChild.getAttribute("width"),n=a.firstElementChild.getAttribute("height"),s=i.cell.row.cellHeight||r.layout.rowMinHeight;if(l===e&&t===o&&s===n)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const d=(e,t,l)=>{if(!1===c.tooltip)return;const a=e.pageX,i=e.pageY-10;if(!r._sparklineTooltip){const e=document.createElement("smart-button");e.classList.add("secondary"),e.style.boxShadow="var(--smart-elevation-4)",e.style.opacity=.9,e.style.transition="all cubic-bezier(0.6, 0.2, 0, 0.8) 0.2s",document.body.appendChild(e),e.style.position="absolute",e.style.zIndex=999,r._sparklineTooltip=e}const n=r._sparklineTooltip;n.innerHTML===t&&n.element===l||(n.style.top=i+25+"px",n.style.left=a-15+"px"),n.innerHTML=""+t,n.style.display=""},c=n.templateSettings,m=()=>{a.onmousemove=e=>{if("column"!==c.type&&"bar"!==c.type||a.querySelectorAll("rect").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&l.top<=e.clientY&&e.clientY<=l.bottom&&(t.setAttribute("highlight",""),d(e,t.getAttribute("data-title"),t))})),"pie"===c.type){let t=!1;a.querySelectorAll("path").forEach((l=>{var a=l.getBoundingClientRect();l.removeAttribute("highlight"),t||a.left<=e.clientX&&e.clientX<=a.right&&a.top<=e.clientY&&e.clientY<=a.bottom&&(l.setAttribute("highlight",""),t=!0,d(e,l.getAttribute("data-title"),l))}))}"line"===c.type&&a.querySelectorAll("line").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&(t.previousElementSibling&&(t.previousElementSibling.style.display="none"),t.nextElementSibling&&(t.nextElementSibling.style.display="none"),t.setAttribute("highlight",""),l.left+l.width/2>=e.clientX?t.previousElementSibling&&(t.previousElementSibling.style.display="",d(e,t.previousElementSibling.getAttribute("data-title"),t.previousElementSibling)):t.nextElementSibling&&(t.nextElementSibling.style.display="",d(e,t.nextElementSibling.getAttribute("data-title"),t.nextElementSibling)))}))},a.onmouseleave=()=>{r._sparklineTooltip&&(r._sparklineTooltip.style.display="none"),a.querySelectorAll("rect").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("path").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("line").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("circle").forEach((e=>{e.style.display="none"}))}};if(s())return void m();const u=new e,p=i.cell.row.cellHeight||r.layout.rowMinHeight;if(p>=7)if(i._sparklinesRender&&cancelAnimationFrame(i._sparklinesRender),t){const e=u.render({width:o-10,height:Math.max(0,p-7),points:t,colors:c.colors,type:c.type,gap:c.gap,max:c.max,min:c.min,padding:c.padding,roundedCorners:c.roundedCorners,strokeWidth:c.strokeWidth,colorFunction:c.colorFunction,tooltipFormatFunction:c.tooltipFormatFunction});a.innerHTML=`<div height="${p}" width="${o}" value="${l}" style="padding-top: 5px; padding-left: 5px; padding-right: 5px;">${e}</div>`,m()}else a.innerHTML="",a.onmousemove=a.onmouseleave=null;i.setAttribute("template",i.cell.template);break}default:{let e=null;i.setAttribute("template","");const l=i.cell.row,s=a;let o=i.cell.getFormattedValue(t,n.cellsFormat);if(s.style.lineHeight="","function"==typeof i.cell.template){const e={row:l,column:n,cell:i.cell,oldValue:i.cell.oldValue,value:t,data:l.data,template:null},a=i.cell.column.templateSettings.React||r.React,d=i.cell.column.templateSettings.ReactDOM||r.ReactDOM;if(i.cell.column.templateSettings&&a&&d){return void d.createRoot(s).render(a.createElement(i.cell.template,e))}let c=s.querySelector(".smart-grid-cell-template");const m=l.id;r.isHScrolling&&(r._cachedTemplates||(r._cachedTemplates=[]),c&&0===c.innerHTML.length&&(c=null),!c&&r._cachedTemplates&&r._cachedTemplates[n.dataField+"_"+m]&&(0===r._cachedTemplates[n.dataField+"_"+m].innerHTML.length?delete r._cachedTemplates[n.dataField+"_"+m]:e.template=r._cachedTemplates[n.dataField+"_"+m])),c&&c.getAttribute("column")===n.dataField?e.template=c.firstElementChild:c=null,i.formattedValue!==o&&(c=null),i.cell.canNotify=!1,l.canNotify=!1;const u=Object.assign({},{background:i.cell.background,color:i.cell.color,fontSize:i.cell.fontSize,fontFamily:i.cell.fontFamily,fontWeight:i.cell.fontWeight,textDecoration:i.cell.textDecoration,fontStyle:i.cell.fontStyle});if(i.cell.template(e),!c&&e.template)if(e.template instanceof HTMLElement){const t=document.createElement("div");t.classList.add("smart-grid-cell-template"),t.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(t),t.appendChild(e.template)}else s.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+e.template+"</div>";else c||null!==e.template||(s.innerHTML=t);if(r.isHScrolling&&!r._cachedTemplates[n.dataField+"_"+m]&&s.firstElementChild.firstElementChild){const e=s.firstElementChild.firstElementChild;e&&(r._cachedTemplates[n.dataField+"_"+m]=e)}s.style.background===u.background&&s.style.color===u.color&&s.style.fontSize===u.fontSize&&s.style.fontWeight===u.fontWeight&&s.style.fontStyle===u.fontStyle||(i.cell._styleChanged=!0,i.cell._setStyle(s)),i.cell.background!==u.background||i.cell.color!==u.color||i.cell.fontSize!==u.fontSize||i.cell.fontWeight!==u.fontWeight||i.cell.fontStyle!==u.fontStyle?(i.cell._styleChanged=!0,i.cell._setStyle(s)):i.cell._styleChanged&&i.cell._setStyle(s),void 0===i.cell.oldValue&&(i.cell.oldValue=t),i.formattedValue=o,i.cell.canNotify=!0,l.canNotify=!0}else if(Array.isArray(i.cell.template)){const e=document.createElement("div");if(s.firstElementChild&&s.firstElementChild.classList.contains("smart-grid-cell-template"))for(let e=0;e<i.cell.template.length;e++){const t=s.firstElementChild.children[e].firstElementChild,a=i.cell.template[e];if(a.length>1&&t){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t.src&&t.src!==e?(i._imageUpdateTimer&&clearTimeout(i._imageUpdateTimer),i._imageUpdateTimer=setTimeout((()=>{t.src=e}),50)):t.textContent!==e&&(t.textContent=e)}}else{e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(e);let t="";for(let e=0;e<i.cell.template.length;e++){const a=i.cell.template[e];if(a.length>1){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t+='<span class="smart-template-part">'+a[0].replaceAll("{{value}}",e)+"</span>"}}e.innerHTML=t}}else{if(""!==s.textContent&&(s.textContent=""),i.cell.template instanceof HTMLTemplateElement)e=i.cell.template;else if(i.cell.template instanceof HTMLElement){const e=i.cell.template.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);s.innerHTML!==e&&(s.innerHTML=e)}else if("function"==typeof i.cell.template&&i.cell.template.prototype&&"undefined"!=typeof ngApp){const e=ngApp.injector,l=e.get(ComponentFactoryResolver).resolveComponentFactory(i.cell.template),a=s.appendChild(l.create(e));return a.instance.value=t,void a.changeDetectorRef.detectChanges()}if(i.cell.template.startsWith&&i.cell.template.startsWith("#")&&(e=document.querySelector(i.cell.template)),e){let a=e.content.cloneNode(!0).firstElementChild;const d=t;if(t=(t=(t=t.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),a.querySelector("[smart-if]")){const e=a.querySelector("[smart-else]"),l=a.querySelectorAll("[smart-if]");let i=!1;for(let e=0;e<l.length;e++){const r=l[e],s=r.getAttribute("smart-if"),o=s.split(" "),c=o[1].trim();let m=o[2].trim();s.indexOf("'")>=0&&(m=s.substring(s.indexOf("'")+1),m=m.replaceAll("'",""));let u=t;switch("Today"===m&&(m=new Date),"date"===n.dataType&&(t=new Date(d).getTime(),m=new Date(m).getTime()),c){case">":t>parseFloat(m)&&(a=r,i=!0);break;case">=":t>=parseFloat(m)&&(a=r,i=!0);break;case"=":case"==":case"===":t===m&&(a=r,i=!0);break;case"<":t<parseFloat(m)&&(a=r,i=!0);break;case"<=":t<=parseFloat(m)&&(a=r,i=!0)}if(t=u,i)break}!i&&e&&(a=e)}let c=a.outerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);for(c.indexOf("{{value=")>=0&&(t?(c=c.substring(0,c.indexOf("{{value="))+t+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const e=c.indexOf("{{value::"),l=c.substring(e+9,c.indexOf("}}")),a=i.cell.getFormattedValue(t,l);c=c.replace(`{{value::${l}}}`,a)}if(n._treeColumn){const e=s.firstChild;if(e&&e.classList&&i.toggleButton&&n._treeColumn&&s.children[1]){const e=s.children[0],t=s.children[1].children[0],a=s.children[1].children[1].firstChild,i=s.children[1].children[2];let n="";if(r.grouping.enabled){let e=l.level-1;"multipleColumns"!==r.grouping.renderMode&&(n+='<div style="width: '+(1+e)*r.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<l.level;e++)n+="<div class='smart-indent'></div>";l.checked?a.setAttribute("checked",""):!1===l.checked?a.removeAttribute("checked"):null===l.checked&&a.setAttribute("checked","indeterminate"),l.leaf?l.allowCheck?a.classList.remove("smart-visibility-hidden"):a.classList.add("smart-visibility-hidden"):l.allowCheck?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),l.allowCheck?r.checkBoxes.visible?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"):r.checkBoxes.visible||a.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),l.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),l.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),l.data.isEmpty&&t.classList.add("smart-visibility-hidden"),i.innerHTML=c,r.appearance.showTooltips?i.setAttribute("title",r._unescapeString(o)):i.hasAttribute("title")&&i.removeAttribute("title")}}else s.innerHTML!==c&&(s.innerHTML=c)}else if("string"==typeof i.cell.template){""===t&&(t="&nbsp;");let e=i.cell.template.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);if(e.indexOf("{{"))for(let t=0;t<r.dataSource.dataFields.length;t++){const a=r.dataSource.dataFields[t].name;if(e.indexOf("{{"+a+"}}")>=0&&(e=e.replace("{{"+a+"}}",l.data[a]),-1===e.indexOf("{{")))break}s.innerHTML!==e&&(s.innerHTML=e)}}if("auto"===i.cell.row.height||r.layout.allowCellsWrap||"auto"===r.layout.rowHeight){const e=s.querySelector(".smart-grid-cell-template");if(e){l._templatesHeight||(l._templatesHeight=[]);const t=(e,t)=>{if(e){const l=r.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0;const a=l.canNotify;l.canNotify=!1,l.autoSize(),l.canNotify=a,delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),r.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(o)return a.innerHTML="",a.appendChild(o),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML),i.cell._setStyle(a),o;i.cell._setStyle(a),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML)}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,r=a._isMeasureRow?null:e.cell.format||l.cellsFormat,n=t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0;if(e.setAttribute("data-type",l.dataType),!(!1!==t._recycleValues||n||l.formatFunction||l._treeColumn||a.summaryRow||"grid"!==t.view)){if(e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element&&a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id?a.element.star.classList.remove("smart-hidden"):t.appearance.showRowComments&&!a.element.hasAttribute("focus")&&a.element.toggleDetailButton&&a.element.toggleDetailButton.classList.add("smart-visibility-hidden")),e.cell.background||e.cell.color){e.cell._styleChanged=!0;const t=e.firstChild;e.cell._setStyle(t)}return}if(t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&"card"!==t.view){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return void 0===t&&i.data&&(t=l.displayField?i.data[l.displayField]:i.data[l.dataField]),e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button"),t.dataSource.boundHierarchy||!e.hasAttribute("has-toggle-button")||l._treeColumn||e.removeAttribute("has-toggle-button");let s=l.displayField?i[l.displayField]:i[l.dataField];if(e.removeAttribute("placeholder"),!l.placeholder||""!==s&&null!=s||(s=l.placeholder,e.setAttribute("placeholder","")),l.parentDataField){const e=t.columnByDataField[l.parentDataField];if(e){let i=e.editor.dataSource;e.relationId&&e.relationField&&e._isDirty&&(!e.editor.dataSource||e.editor.dataSource&&0===e.editor.dataSource.length)&&(i=t._getRelationData(e.relationId));const r=i[t.getCellValue(a.id,l.parentDataField)];if(r){s=r[l.cascadingDataField]}}}if(null!==s||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(s=0),"string"===l.dataType&&(s=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(s=!1),"date"===l.dataType&&(s=new Date)),t.formulas&&e.cell.formula&&"string"==typeof e.cell.formula&&e.cell.formula.startsWith("=")&&/=.+/.test(e.cell.formula)){const i=t._formulaParser;if(i){if(t&&t.formulas&&e.cell._formula!==l.formula){let t=a.data[l.dataField];l.formula&&(e.cell.formula=e.cell._parseFormula(l.formula)),t&&(""+t).startsWith("=")&&(e.cell.formula=e.cell._parseFormula(""+t)),e.cell._formula=l.formula}const r=i.parse(e.cell.formula.slice(1));s=isNaN(r)?"#VALUE!"===r?"":"#ERROR!"===r?"#ERROR!":r:r}}t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(s="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row"),t.editing.enabled&&(e.cell.readonly||!l.allowEdit?e.classList.add("smart-readonly"):e.classList.remove("smart-readonly"));const o=t=>{if(t){if((t=""+t).startsWith("off_"))return e.classList.remove(t.substring(4)),!1;if(e.classList.add(t),e.hasAttribute("customCSS")){t=t+" "+e.getAttribute("customCSS")}return e.setAttribute("customCSS",t),!0}return e.setAttribute("highlight",""),!0};if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS");const l=t.split(" ");for(let t=0;t<l.length;t++)e.classList.remove(l[t])}if(l.highlight&&!a.summaryRow&&(o(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]){o(t.highlightedCells[a.id][l.dataField])}if(t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]){o(t.highlightedRows[a.id])}if(t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),s=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,s=e.cell.value),void 0===s&&(s="");let d=s;if(r)d=e.cell.getFormattedValue(s,r);else if(l.formatSettings&&l.formatSettings.Intl)if(""===s)d="";else if(l.editor.decimalPlaces>=0){const t=JSON.parse(JSON.stringify(l.formatSettings.Intl));t.NumberFormat.minimumFractionDigits=l.editor.decimalPlaces,t.NumberFormat.maximumFractionDigits=l.editor.decimalPlaces,d=e.cell.getFormattedValue(s,t)}else d=e.cell.getFormattedValue(s,l.formatSettings.Intl);else l.formatSettings&&l.formatSettings.formatString&&(d=e.cell.getFormattedValue(s,l.formatSettings.formatString));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML="",a.filterRow&&(l._filterEditorInitialized=!1)),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==s&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames||e._rowClassNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,s,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,s,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);let r=[];for(let n=0;n<i.length;n++){let o=i[n];const d={index:a.visibleIndex,value:s,dataField:l.dataField,row:a,data:a.data,api:t};l.cellsCSSRules[o](d)&&(e.classList.add(o),r.push(o))}e.__classNames=r}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let p="";if(m.align&&(p+=m.align+" "),m.verticalAlign&&(p+=m.verticalAlign+" "),l.cellsWrap)p+="wrap ";else if(t.layout.autoWrap&&a.height>40&&1===e.cell.colSpan&&"string"===l.dataType){if(14*(d||"").length*.52>l.computedWidth){if("url"!==e.cell.template&&"email"!==e.cell.template){p+="textwrap ";const e=parseInt(a.height/20);c.style["-webkit-line-clamp"]=e}}}if(p+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}if(l.grid.appearance.showRowComments&&l.rowHeaderColumn){const a=t.rowDetailColumn,i=a?a.width:0;e.style.width=l.computedWidth+i+"px",e.classList.add("row-number")}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.appearance.showColumnGroupCellLines||l.parent&&!l.element.hasAttribute("column-group-first-child")&&e.classList.add("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let g=l.left;if(t.rightToLeft?e.style.right!==g+"px"&&(e.style.right=g+"px"):e.style.left!==g+"px"&&(e.style.left=g+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),p+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze",""),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command","")),t.appearance.showRowComments&&(a.comments&&a.comments.length>0&&l===t._firstVisibleUserColumn?e.classList.add("row-comments"):e.classList.remove("row-comments")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,s))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)""!==c.innerHTML&&(c.innerHTML="");else if(l.autoGenerated&&""!==c.innerHTML&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary&&l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let r in a){if("status"===r)continue;const n=l.cellsFormat;let s=a[r];n&&n.indexOf("p")>=0&&"count"===r?s=a[r]:n&&"date"!==l.dataType&&(s=e.cell.getFormattedValue(s,n)),t.messages&&t.messages[t.locale]&&t.messages[t.locale][r]?i.push(t.localize(r,{value:s})):i.push(r+": "+s)}let r=[],n="";if(a&&a.status&&l.editor){n+='<div style="margin-right: 5px; display: flex; border-radius: 8px; align-items: center;">';const e=l.editor.dataSource,i=a.status,s=t.rows.length,o=l.computedWidth;let d=0;if(e)for(let l=0;l<e.length;l++){const a=e[l];if(i[a.value]){const e=a.label?a.label:t.localize("blankSummary"),l=i[a.value].length,c=new Number(l/s*100).toFixed(2),m=e+" "+l+"/"+s+" "+c+"%",u=o*c/100/2;r.push(m);const p=["#D50000","#F6BF26","#33B679","#039BE5","#3F51B5","#8E24AA"];d>p.length-1&&(d=0);n+='<span class="summary-value-part" title="'+m+'" style="width: '+u+"px; font-size: 11px; padding: 5px; background:"+(a.color||p[d++])+'; color: white;"></span>'}}n+="</div>"}const s=i.join(", "),o=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let d=`<div title = "${s}" class="smart-truncate summary-value" > <span class="label">${s}</span>${o}</div> `;r.length&&(d=`<div title = "${s}" class="smart-truncate summary-value" > <span style="align-items: center; display: flex;" class="label">${n}${s}</span>${o}</div> `);if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;d=`<div title = "${s}" class="smart-truncate summary-value" > ${`<span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> `} <span class="label">${s}</span>${o}</div> `}c.innerHTML!==d&&(c.innerHTML=d)}else if(t.summaryRow.editing&&l.allowSummary){if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value"><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value"><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==e&&(c.innerHTML=e)}}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{!0!==t._mobile&&c._clickTarget!==l.target||(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="",i=t.appearance.showRowStatus||t.appearance.showRowComments?"smart-visibility-hidden":"";if(a.showDetail){l='<button tabindex="-1" class="'+i+' smart-animate" toggled toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}else{l='<button tabindex="-1" class="'+i+" smart-animate"+(t.rowDetail.dialog.enabled?" row-detail":"")+'" toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}if(t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let r="";for(let e=0;e<t;e++)r+="A";return r+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=s;else switch(c.removeAttribute("title"),e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(s,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(s,e.cell.template,c);break;case"attachment":e._setTemplate(s,"attachments",c);break;case"image":e._setTemplate(s,"images",c);break;case"email":e._setTemplate(s,"email",c);break;case"url":e._setTemplate(s,"url",c);break;case"richText":e._setTemplate(s,"richText",c);break;default:e._setTemplate(s,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],r=c.children[1].children[1].firstChild,n=c.children[1].children[2];let s="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?s="":"multipleColumns"!==t.grouping.renderMode&&(s+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)s+="<div class='smart-indent'></div>";if(a.checked?r.setAttribute("checked",""):!1===a.checked?r.removeAttribute("checked"):null===a.checked&&r.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?r.classList.remove("smart-visibility-hidden"):r.classList.add("smart-visibility-hidden"):a.allowCheck?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"):t.checkBoxes.visible||r.classList.add("smart-hidden"),"card"===t.view&&(r.classList.add("smart-hidden"),i.classList.add("smart-hidden")),e.innerHTML=s,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),n.innerHTML=d,t.appearance.showTooltips?n.setAttribute("title",t._unescapeString(d)):n.hasAttribute("title")&&n.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let r=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(r+=l.computedWidth)}e.style.width=r+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let r=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let r=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const n="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(s,a.visibleIndex,a.data),o=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(o>l[0]&&o<l[1]){d=!0;break}}if(a._rowSpan=n,n&&!d){let s=0;t._cellRowSpan.push([o,o+n,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(n,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=o;e<=o+n-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(s+=l.cellHeight)}e.style.height=s+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",n),i._styleChanged=!0,r=n}}if(1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width=l.computedWidth+"px",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===r&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||("string"==typeof d&&d.indexOf("&")>=0?"card"===t.view?c.innerHTML=d:t.isScrolling?requestAnimationFrame((()=>{c.innerHTML=d})):c.innerHTML=d:c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),c.setAttribute("title",i.tooltip||t._unescapeString(d))):c.hasAttribute("title")&&c.removeAttribute("title"),t.appearance.showTooltipsOverflow&&(!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"),d&&d.length)){14*(d||"").length*.52>l.computedWidth?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),"image"!==l.template&&"attachment"===l.template&&c.setAttribute("title",i.tooltip||t._unescapeString(d))):!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title")}}else c.textContent=d}}if(c.className!==p&&(c.className=p),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const i={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:s,data:a.data,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const r=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});if(t.hasAttribute("smart-blazor"))await l.formatFunction(i);else{const e=l.formatFunction(i);e&&(i.value=e)}c.style.background===r.background&&c.style.color===r.color&&c.style.fontSize===r.fontSize&&c.style.fontFamily===r.fontFamily&&c.style.textDecoration===r.textDecoration&&c.style.fontWeight===r.fontWeight&&c.style.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===r.background&&e.cell.color===r.color&&e.cell.fontSize===r.fontSize&&e.cell.fontWeight===r.fontWeight&&e.cell.textDecoration===r.textDecoration&&e.cell.fontFamily===r.fontFamily&&e.cell.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let n=!0;if(i.value!==s){if(e.toggleButton){c.children[1].children[2].innerHTML=i.value}else c.innerHTML=i.value;n=!1}if(null!==i.template){if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==i.template&&(e.innerHTML=i.template)}}else if(c.innerHTML!==i.template){const e=document.createElement("div");e.innerHTML=i.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=i.template)}n=!1}n&&(l.cellsFormat?c.textContent=d:c.textContent=s),e.cell.canNotify=!0,a.canNotify=!0}if(l.tooltipRenderer&&!a.summaryRow&&!a.autoGenerated){const e=l.tooltipRenderer(a.id,l.dataField,s,d,a.data);null!=e&&""!==e&&(c.setAttribute("data-title",e),c.onmouseenter=function(l){const a=l.target.closest("smart-grid-cell");if(a&&a.cell.column){if(!a.cell.column.tooltipRenderer)return}t._createTooltip(l,e,c,"top")},c.onmouseleave=function(){t._cellTooltip&&(t._cellTooltip.style.visibility="hidden")})}if(l.cellsRenderer&&!a.summaryRow){const t=l.cellsRenderer(a.id,l.dataField,s,a.data,c);if(null!=t)if("string"==typeof t)if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==t&&(e.innerHTML=t)}}else c.innerHTML!==t&&(c.innerHTML=t);else t instanceof HTMLElement&&c.firstChild!==t&&(c.innerHTML="",c.appendChild(t))}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),r=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),r.appendChild(l),r.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(r),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const r=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-r.top+"px",i.style.left=a._offsetLeft(l)-r.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,r=e.column,n=e.row,s=e.row.index,o=n._style,d=n.data&&n.data.$?n.data.$.id:null;if(e.column.autoGenerated){const l=t._conditionalColors;if(l&&e.column.rowHeaderColumn)if("border"===l.decorate){const t=l.colors;t&&t[d]?(e.element.classList.add("smart-decorate"),e.element.style.setProperty("--smart-decorate-color",t[d].color)):e.element.classList.remove("smart-decorate")}else e.element.classList.remove("smart-decorate")}else{if(t._conditionalColors){const r=t._conditionalColors,s=()=>{e.row.style&&e.row.style[e.column.dataField]&&(e._styleChanged=!0,e.row.style[e.column.dataField].background&&(e.background=e.row.style[e.column.dataField].background),e.row.style[e.column.dataField].color&&(e.color=e.row.style[e.column.dataField].color))};if("border"!==r.decorate){const t=r.colors;if(t&&t[d]){const o="cell"===r.decorate?t[d][i]:t[d].color;if(o){const t=new Smart.Color(o).getInvertedColor();a.cell.canNotify=!1,n.canNotify=!1,e.background=o,e.color=t,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}if(a.cell._customInlineStyles&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.textDecoration=null,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),r.cellsCSSInlineRules){const e=r.cellsCSSInlineRules;for(let i=0;i<e.length;i++){const r=e[i];if(!r.field)break;const s=r.condition;let o=r.value,d=r.value2,c=n.data[r.field],m=t.columnByDataField[r.field];if("string"==typeof c&&(o=""+o,d=""+d),"date"===m.dataType||"dateTime"===m.dataType){if(o=Smart.Utilities.DateTime.ParseDate(o,m.cellsFormat),void 0!==d){d=Smart.Utilities.DateTime.ParseDate(d,m.cellsFormat)}}"number"!==m.dataType&&"float"!==m.dataType&&"decimal"!==m.dataType&&"currency"!==m.dataType||(o=parseFloat(o),void 0!==d&&(d=parseFloat(d))),"boolean"===m.dataType&&("string"==typeof o&&(o="true"===o.toLowerCase()),"1"===o&&(o=!0),"0"===o&&(o=!1),void 0!==d&&("string"==typeof d&&(d="true"===d.toLowerCase()),"1"===d&&(d=!0),"0"===d&&(d=!1)));let u=!1;switch(s){case">":u=o<c;break;case">=":u=o<=c;break;case"<":u=o>c;break;case"<=":u=o>=c;break;case"=":u=o===c;break;case"<>":u=o!==c;break;case"between":u=c>=o&&c<=d}u&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=r.background,a.cell.color=r.color,a.cell.textDecoration=r.textDecoration,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),a.cell._customInlineStyles=!0}}if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][s];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const r={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":r.align="align-left";break;case"center":case"middle":r.align="align-center";break;case"right":r.align="align-right"}switch(a){case"top":r.verticalAlign="align-top";break;case"center":case"middle":r.verticalAlign="align-middle";break;case"bottom":r.verticalAlign="align-bottom"}return r}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});class e{render(e){const t=this,l={svg:null,roundedCorners:e.roundedCorners||0,padding:e.padding||null,width:e.width||100,height:e.height||30,gap:e.gap||5,strokeWidth:e.strokeWidth||2,type:e.type||"column",colors:e.colors||["var(--smart-primary)"],points:e.points,labels:e.labels,colorFunction:e.colorFunction,tooltipFormatFunction:e.tooltipFormatFunction,min:e.min,max:e.max};switch(l.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),l.svg.setAttribute("width",l.width),l.svg.setAttribute("height",l.height),function(e){Array.isArray(e.colors)||(e.colors=t.colors.split(",")),e.points&&(Array.isArray(e.points)?e.points=e.points.map((e=>parseInt(e,10))):(e.points&&"number"==typeof e.points&&(e.points=""+e.points),e.points=e.points.split(",").map((e=>parseInt(e,10)))))}(l),l.type){case"column":return t.column(l);case"bar":return t.bar(l);case"line":return t.line(l);case"pie":return t.pie(l);case"stacked":return t.stacked(l)}}colorFunction(e,t){const l=function(e,t){e===t&&(t=e+100);const l=(t-e)/5;return[e+l,e+2*l,e+3*l,e+4*l]}(e,t),a=["#D50000","#F4511E","#F6BF26","#039BE5","#33B679"];return e=>e<l[0]?a[0]:e<l[1]?a[1]:e<l[2]?a[2]:e<l[3]?a[3]:a[4]}column(e){const t=e.gap/e.points.length+e.width/e.points.length-e.gap,l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;return e.colorFunction||(e.colorFunction=this.colorFunction(a,l)),e.points.forEach(((n,s)=>{isNaN(n)&&(n=0);const o=document.createElementNS("http://www.w3.org/2000/svg","rect"),d=Math.abs(n)*i;o.setAttribute("x",s*t+s*e.gap),o.setAttribute("point",n);let c=n>=0?"var(--smart-primary)":"var(--smart-error)";if(l>0&&a<0?n>=0?o.setAttribute("y",e.height-r-1-d):o.setAttribute("y",e.height-r-1):l>=0&&a>=0?o.setAttribute("y",e.height-d):a<=0&&l<=0&&o.setAttribute("y",d),o.setAttribute("width",t),o.setAttribute("height",d),e.colorFunction){const t=e.colorFunction(n);t&&(c=t)}o.setAttribute("fill",c);const m=e.tooltipFormatFunction?e.tooltipFormatFunction(n):n;o.setAttribute("data-title",m),e.svg.appendChild(o)})),e.svg.outerHTML}bar(e){const t=e.padding||0;let l=e.roundedCorners||0;"boolean"==typeof l&&(l=l?3:0);const a=e.height-3-2*t,i=Math.max(5,e.gap/e.points.length+a/e.points.length-e.gap),r=e.max||Math.max(...e.points),n=e.min||Math.min(...e.points);let s=e.width/(Math.abs(n)+Math.abs(r));const o=Math.abs(n)*s;return e.colorFunction||(e.colorFunction=this.colorFunction(n,r)),e.points.forEach(((a,d)=>{isNaN(a)&&(a=0);const c=document.createElementNS("http://www.w3.org/2000/svg","rect"),m=Math.abs(a)*s;c.setAttribute("y",d*i+d*e.gap+t),c.setAttribute("point",a),l>0&&(c.setAttribute("rx",l),c.setAttribute("ry",l));let u=a>=0?"var(--smart-primary)":"var(--smart-error)";if(r>0&&n<0?a>=0?c.setAttribute("x",o):c.setAttribute("x",o-m):(r>=0&&n>=0||n<=0&&r<=0)&&c.setAttribute("x",0),c.setAttribute("width",m),c.setAttribute("height",i),e.colorFunction){const t=e.colorFunction(a);t&&(u=t)}c.setAttribute("fill",u);const p=e.tooltipFormatFunction?e.tooltipFormatFunction(a):a;c.setAttribute("data-title",p),e.svg.appendChild(c)})),e.svg.outerHTML}line(e){const t=e.width/(e.points.length-1),l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;e.colorFunction||(e.colorFunction=this.colorFunction(a,l));let n="var(--smart-primary)",s=[],o=[];e.svg.setAttribute("overflow","visible");for(let l=0;l<e.points.length;l++){let a=e.points[l];isNaN(a)&&(a=0);const n=l*t,d=e.height-r-a*i;o.push({x:n,y:d,point:a}),2===o.length&&(s.push(o),o=[]),s.length>0&&0===o.length&&o.push(s[s.length-1][1])}for(let t=0;t<s.length;t++){const l=s[t];if(e.colorFunction){const t=e.colorFunction(l[0].point);t&&(n=t)}if(0===t){const t=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(t),t.setAttribute("cx",l[0].x),t.setAttribute("cy",l[0].y),t.setAttribute("r",3),t.setAttribute("fill",n);const a=e.tooltipFormatFunction?e.tooltipFormatFunction(l[0].point):l[0].point;t.setAttribute("data-title",a),t.style.display="none"}const a=document.createElementNS("http://www.w3.org/2000/svg","line");e.svg.appendChild(a),a.setAttribute("x1",l[0].x),a.setAttribute("y1",l[0].y),a.setAttribute("x2",l[1].x),a.setAttribute("y2",l[1].y);const i=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(i),i.setAttribute("cx",l[1].x),i.setAttribute("cy",l[1].y),i.setAttribute("r",3),i.setAttribute("fill",n);const r=e.tooltipFormatFunction?e.tooltipFormatFunction(l[1].point):l[1].point;i.setAttribute("data-title",r),i.style.display="none",a.setAttribute("fill","none"),a.setAttribute("stroke-width",e.strokeWidth),a.setAttribute("stroke",n)}return e.svg.outerHTML}pie(e){const t=Math.min(e.width,e.height)/2,l=e.width/2,a=e.height/2,i=e.points.reduce(((e,t)=>e+Math.abs(t)),0);let r=0;const n=e.max||Math.max(...e.points),s=e.min||Math.min(...e.points);return e.colorFunction||(e.colorFunction=this.colorFunction(s,n)),e.points.forEach((n=>{isNaN(n)&&(n=0);let s=e.color;if(e.colorFunction){const t=e.colorFunction(n);t&&(s=t)}const o=Math.abs(n)/i*2*Math.PI,d=r+o,c=l+t*Math.cos(r),m=a+t*Math.sin(r),u=l+t*Math.cos(d),p=a+t*Math.sin(d),g=document.createElementNS("http://www.w3.org/2000/svg","path"),f=o>Math.PI?1:0,h=`M ${l},${a} L ${c},${m} A ${t},${t} 0 ${f} 1 ${u},${p} Z`;g.setAttribute("d",h),g.setAttribute("fill",s);const b=e.tooltipFormatFunction?e.tooltipFormatFunction(n):`${(n/i*100).toFixed(2)}%`;g.setAttribute("data-title",b),e.svg.appendChild(g),r=d})),e.svg.outerHTML}stacked(e){let t=e.points.reduce(((e,t)=>e+t),0),l=(e.points.length-1)*e.gap,a=e.width-l;const i=e.max||Math.max(...e.points),r=e.min||Math.min(...e.points);e.colorFunction||(e.colorFunction=this.colorFunction(r,i));let n=0;return e.points.forEach(((l,i)=>{isNaN(l)&&(l=0);let r=e.colors[i%e.colors.length];if(e.colorFunction){const t=e.colorFunction(l);t&&(r=t)}const s=l/t*a,o=document.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttribute("x",n),o.setAttribute("y",0),o.setAttribute("width",s),o.setAttribute("height",e.height),o.setAttribute("fill",r);const d=document.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=l,o.appendChild(d),e.svg.appendChild(o),n+=s+e.gap})),e.svg.outerHTML}}})();
1429
1429
 
1430
1430
  /***/ }),
1431
1431
 
@@ -1439,14 +1439,14 @@ Smart.Utilities.Assign("Grid.Chart",class{_getChartDataFields(t){const e=this,n=
1439
1439
  /***/ 8228:
1440
1440
  /***/ (() => {
1441
1441
 
1442
- Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!=typeof t?Object.assign(e,t):(e.label=t,e.dataField=t),e.dataField||(e.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),e.tooltip||(e.tooltip=""),e.tooltipRenderer||(e.tooltipRenderer=""),e.rowSpan||(e.rowSpan=null),e.formula||(e.formula=null),e.AIQuery||(e.AIQuery=null),e.columnGroup||(e.columnGroup=""),e.canNotify=!0,(!t||t&&!t.properties)&&(e.data=t);let o="left";switch(e.dataType){case"string":case"date":o="left";break;case"number":"rating"===t.template&&(o="left");break;case"boolean":o="center"}if(e.displayField!==e.dataField&&(o="left"),e.relationId||(e.relationId=""),e.relationField||(e.relationField=""),e.relationCascadingFields||(e.relationCascadingFields=""),e.highlight||(e.highlight=!1),void 0===e.index&&(e.index=-1),void 0===e.visibleIndex&&(e.visibleIndex=-1),void 0===e.selected&&(e.selected=!1),void 0===e.freeze&&(e.freeze=!1),e.label||(e.label=""),e.menuItems||(e.menuItems=null),e.options||(e.options=null),e.displayField||(e.displayField=e.dataField),e.template||(e.template=""),e.editor||(e.editor="input"),"string"==typeof e.editor){e.editor={template:e.editor,autoFocus:!0};let t=!0;e.editor.template&&e.editor.template.indexOf("<input")>=0&&(t=!1),t&&("number"===e.dataType||"int"===e.dataType||"float"===e.dataType?"slider"!==e.editor.template&&(e.editor.template="numberInput"):"date"===e.dataType?("timeInput"!==e.editor.template&&"dateTimePicker"!==e.editor.template&&(e.editor.template="dateInput"),e.editor.autoOpen=!0,e.cellsFormat||e.formatSettings||(e.cellsFormat="M/d/yyyy")):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType||"bool"===e.dataType?e.editor.template="checkBox":"string"===e.dataType&&"tags"===e.template?(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,singleSelect:!0},e.templateSettings&&!0===e.templateSettings.multiSelect&&(e.editor.singleSelect=!1),e.options&&(e.editor.dataSource=e.options)):"string"===e.dataType&&"collaborator"===e.template&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,collaborator:!0,singleSelect:!0}))}else if(void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0),e.editor.relationId&&e.editor.relationField&&e.grid){const t=e.grid._getRelationData(e.editor.relationId,e.editor.relationField,e.editor.singleSelect);e.editor.dataSource=t}if(e.icon||(e.icon="smart-icon-font","modifiedTime"===e.template&&(e.template="updatedTime"),"modifiedBy"===e.template&&(e.template="updatedBy"),"select"===e.editor.template&&(e.icon="smart-icon-sort-down"),"multiComboInput"===e.editor.template&&(e.icon="smart-icon-list-unordered"),"textArea"!==e.editor.template&&"textarea"!==e.editor.template||(e.icon="smart-icon-fontsize"),"url"===e.template&&(e.icon="smart-icon-link"),"email"===e.template&&(e.icon="smart-icon-mail"),"color"===e.template&&(e.icon="smart-icon-color-background"),"updatedTime"!==e.template&&"createdTime"!==e.template||(e.icon="smart-icon-clock"),"multiComboInput"===e.editor.template&&e.editor.collaborator&&(e.icon="smart-icon-user"),"createdBy"!==e.template&&"updatedBy"!==e.template&&"collaborator"!==e.template||(e.icon="smart-icon-user"),"image"===e.editor.template&&(e.icon="smart-icon-image"),"attachment"===e.editor.template&&(e.icon="smart-icon-docs"),"password"===e.editor.template&&(e.icon="smart-icon-lock"),"phone"===e.editor.template?e.icon="smart-icon-phone":"checkBox"===e.editor.template||"boolean"===e.dataType?e.icon="smart-icon-ok-squared":"numberInput"===e.editor.template||"slider"===e.editor.template||"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.icon="smart-icon-number":"dateInput"===e.editor.template||"dateTimePicker"===e.editor.template||"date"===e.dataType?(e.icon="smart-icon-calendar","timeInput"===e.editor.template&&(e.icon="smart-icon-clock")):"timeInput"===e.editor.template||"time"===e.dataType?e.icon="smart-icon-clock":"grid"===e.editor.template?e.icon="smart-icon-table-alt":e.editor.template&&e.editor.template.indexOf("multi")>=0&&"collaborator"!==e.template&&(e.editor.collaborator?e.icon="smart-icon-user":e.icon="smart-icon-list-ordered",e.editor.singleSelect&&(e.icon="smart-icon-sort-down")),e.relationId&&(e.icon="smart-icon-table-alt"),e.formula&&(e.icon="smart-icon-math"),(e.AIQuery||"ai"===e.template)&&(e.icon="smart-icon-ai"),"uuid"===e.template&&(e.icon="smart-icon-number"),"rating"!==e.editor.template&&"rating"!==e.template||(e.icon="smart-icon-star"),"sparklines"===e.template&&(e.icon="smart-icon-chart"),"vote"===e.template&&(e.icon="smart-icon-like"),"autoNumber"===e.template&&(e.icon="smart-icon-list-ordered")),e.menu=null,void 0===e.allowActionButtonAnimation&&(e.grid?e.allowActionButtonAnimation=e.grid.appearance.allowColumnActionButtonAnimation:e.allowActionButtonAnimation=!1),void 0===e.allowSortButtonAnimation&&(e.grid?e.allowSortButtonAnimation=e.grid.appearance.allowColumnSortButtonAnimation:e.allowSortButtonAnimation=!1),void 0===e.autoShowActionButton&&(e.grid?e.autoShowActionButton=e.grid.appearance.autoShowColumnActionButton:e.autoShowActionButton=!1),void 0===e.autoShowSortButton&&(e.grid?e.autoShowSortButton=e.grid.appearance.autoShowColumnSortButton:e.autoShowSortButton=!0),void 0===e.showSortButton&&(e.grid?e.showSortButton=e.grid.appearance.showColumnSortButton:e.showSortButton=!1),void 0===e.showCardLabel&&(e.showCardLabel=!0),void 0===e.cardSpan&&(e.cardSpan=!1),void 0===e.allowItemsAdd&&(e.allowItemsAdd=!1),void 0===e.dots&&(e.dots=!1),void 0===e.cardHeight&&(e.cardHeight=0,("image"===e.template||e.editor&&"textarea"===e.editor.template)&&(e.cardHeight=4)),void 0===e.showIcon&&(e.grid&&!e.autoGenerated?e.showIcon=e.grid.appearance.showColumnIcon:e.showIcon=!1),void 0===e.showDescriptionButton&&(e.grid?e.showDescriptionButton=e.grid.appearance.showColumnDescriptionButton:e.showDescriptionButton=!1),void 0===e.showCustomButton&&(e.grid?e.showCustomButton=e.grid.appearance.showColumnCustomButton:e.showCustomButton=!1),void 0===e.showActionButton&&(e.grid?e.showActionButton=e.grid.appearance.showColumnActionButton:e.showActionButton=!1),void 0===e.allowLabelAnimation&&(e.grid?e.allowLabelAnimation=e.grid.appearance.allowColumnLabelAnimation:e.allowLabelAnimation=!1),void 0===e.autoShowFilterButton&&(e.grid?e.autoShowFilterButton=e.grid.appearance.autoShowColumnFilterButton:e.autoShowFilterButton=!1),void 0===e.showFilterButton&&(e.grid?e.showFilterButton=e.grid.appearance.showColumnFilterButton:e.showFilterButton=!1),void 0===e.autoCloseMenu&&(e.grid?e.autoCloseMenu=e.grid.columnMenu.autoClose:e.autoCloseMenu=!0),void 0===e.allowNull&&(e.allowNull=!0),e.formatFunction||(e.formatFunction=null),e.cellsRenderer||(e.cellsRenderer=null),e.sortOrder||(e.sortOrder=null),void 0===e.sortIndex&&(e.sortIndex=null),e.sortComparator||(e.sortComparator=null),e.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),e.cellsCSSRules||(e.cellsCSSRules=null),e.cellsCSSInlineRules||(e.cellsCSSInlineRules=null),e.filterMenuMode||(e.filterMenuMode="default",e.grid&&"excel"===e.grid.filtering.filterMenu.mode&&(e.filterMenuMode="excel"),e.autoGenerated&&(e.filterMenuMode="none")),e.align||(e.align=o),!e.cellsAlign)switch(e.cellsAlign=o,e.dataType){case"date":case"number":e.cellsAlign="right"}if(!(e.cellsWrap||(e.cellsWrap=!1,e.grid&&e.grid.layout.allowCellsWrap&&(e.cellsWrap=e.grid.layout.allowCellsWrap)),e.minWidth||(e.minWidth=30),e.width||(e.width=null),e.autoGenerated||e.width&&"number"==typeof e.width))if(e.grid&&e.grid.layout.columnWidth)e.width=e.grid.layout.columnWidth;else if(e.grid&&e.grid.layout.autoSizeNewColumn&&!e._autoSizeWidth){const t=e._autoSize();e.width=Math.max(e.grid.layout.autoSizeNewColumnMinWidth,t),e._autoSizeWidth=e.width}else e.width&&"string"==typeof e.width&&(isNaN(parseInt(e.width))||-1===e.width.indexOf("%")&&(e.width=parseInt(e.width)));if(void 0===e.visible&&(e.visible=!0),void 0===e.allowResize&&(e.allowResize=!0),void 0===e.allowFreeze&&(e.allowFreeze=!0),void 0===e.allowReorder&&(e.allowReorder=!0),void 0===e.allowHide&&(e.allowHide=!0),void 0===e.allowDelete&&(e.allowDelete=!0),void 0===e.allowSort&&(e.allowSort=!0),void 0===e.allowSelect&&(e.allowSelect=!0),void 0===e.allowSortToggleOnClick&&(e.allowSortToggleOnClick=!0),void 0===e.allowGroup&&(e.allowGroup=!0),void 0===e.allowFilter&&(e.allowFilter=!0),void 0===e.allowEdit&&(e.allowEdit=!0),void 0===e.allowTypeChange&&(e.allowTypeChange=!0),void 0===e.allowSummary&&(e.allowSummary=!0),void 0===e.allowHeaderEdit&&(e.allowHeaderEdit=!0),void 0===e.allowExport&&(e.allowExport=!0),void 0===e.allowCollapse&&(e.allowCollapse=!0),void 0===e.collapsed&&(e.collapsed=!1),void 0===e.description&&(e.description=""),void 0===e.group&&(e.group=!1),e.summary||(e.summary=[]),"false"===e.freeze&&(e.freeze=!1),"true"===e.freeze&&(e.freeze=!0),!1===e.allowFreeze&&(e.freeze=!1),void 0===e.defaultValue&&(e.defaultValue=null),e.disabledDialogOptions||(e.disabledDialogOptions=[]),e.formatSettings||(e.formatSettings={decimalPlaces:null,decimalSeparator:null,negativeWithBrackets:null,prefix:null,sufix:null,thousandsSeparator:null,dateFormat:"d"}),this.validationRules||(this.validationRules=[]),e.selected=!1,e.sorted=!1,e.filtered=!1,e.filter&&(e.filtered=!0),e.parent=null,e.children=[],e.templateSettings||(e.templateSettings={}),e.dataSet||(e.dataSet={}),e.grid&&e.formula){let t=e.formula;for(let o=0;o<e.grid.columns.length;o++){const l=e.grid.columns[o];-1===t.indexOf("COL("+l.dataField+")")&&-1===t.indexOf("COL("+l.label+")")&&(t.indexOf(l.label)>=0?(t=t.replaceAll(l.label,"COL("+l.dataField+")"),e.formula=t):t.indexOf(l.dataField)>=0&&(t=t.replaceAll(l.dataField,"COL("+l.dataField+")"),e.formula=t))}}if(!e.placeholder&&e.grid&&e.grid.appearance.allowColumnAutoPlaceholder&&("string"===e.dataType||"text"===e.dataType?e.placeholder=e.label:"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.placeholder="##":"date"===e.dataType&&(e.placeholder=e.cellsFormat||"m/d/yyyy"),e._state.placeholder=e.placeholder),"createdTime"===e.template||"updatedTime"===e.template||"createdBy"===e.template||"updatedBy"===e.template){const t=[];t.createdTime="createdDate",t.updatedTime="updatedDate",t.createdDate="createdDate",t.updatedDate="updatedDate",t.createdBy="createdBy",t.updatedBy="updatedBy",e.sortComparator=function(o,l,i,n){if(e.grid){const o=e.grid.rowById[i.$.id],l=e.grid.rowById[n.$.id],a=t[e.template];if("createdDate"===a){if(o.history[0].date<l.history[0].date)return-1;if(o.history[0].date>l.history[0].date)return 1}if("updatedDate"===a){if(o.history[o.history.length-1].date<l.history[l.history.length-1].date)return-1;if(o.history[o.history.length-1].date>l.history[l.history.length-1].date)return 1}}return 0}}}refresh(){const t=this;t.element&&t.element._refresh()}render(){const t=this;t.element.column=t,t.element&&t.element._render()}get stateProps(){return["allowExport","allowCollapse","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","formula","AIQuery","rowSpan","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","thHierarchy","dataSet","valueField","onAction","title","tooltip","tooltipRenderer","showCustomButton","showFilterButton","computedFields","showSortButton","editor","template","visibleIndex","validationRules","relationId","relationField","relationCascadingFields","parentDataField","cascadingDataField","allowItemsAdd","dots","placeholder"]}setState(t){const e=this;if(!t)return;if(e._state={},!t.dataField)return;if(t.dataField.startsWith("_"))return{};const o=e.stateProps;for(let l in t)if(!l.startsWith("_")&&o.indexOf(l)>=0)if("editor"===l){e._state[l]={};for(let t in e[l])"row"!==t&&"column"!==t&&"cell"!==t&&"columns"!==t&&"column"!==t&&"instance"!==t&&"element"!==t&&(e._state[l][t]=e[l][t])}else"groups"===l?e[l]&&e[l].length>0&&(e._state[l]=e[l]):e._state[l]=e[l]}getState(){const t=this;if(t.dataField.startsWith("_"))return{};if(t._state){t._state._visible=t._visible,t._state._dataField=t._dataField,t._state.editor={};for(let e in t.editor)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state.editor[e]=t.editor[e])}if(!t._state){t._state={label:t.label,dataField:t.dataField,dataType:t.dataType,_visible:t._visible};const e=t.stateProps;for(let o in t)if(!o.startsWith("_")&&e.indexOf(o)>=0)if("editor"===o){t._state[o]={};for(let e in t[o])"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state[o][e]=t[o][e])}else"groups"===o?t[o]&&t[o].length>0&&(t._state[o]=t[o]):"filter"===o?t[o]&&"string"!=typeof t[o]&&(t._state[o]=t[o].toString()):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const l=this,i=l.getProperty(t);i!==e&&(l.canNotify=!1,l[t]=e,o&&(l.propertyChanged(t,i,e),l.grid&&l.grid.onColumnChange&&l.stateProps.indexOf(t)>=0&&l.grid.onColumnChange(l,t,i,e)),l.canNotify=!0)}getProperty(t){const e=this;if("selected"===t){let o=!1;return e.grid&&(e.grid._selection.cells["column"+e.dataField]&&(o=null),e.grid&&e.grid._selection.columns[e.dataField]&&(o=!0),e.grid.columns.canNotify=!1,e[t]!==o&&(e[t]=o),e.grid.columns.canNotify=!0),o}return"group"===t?!(!e.dataSource||!e.dataSource.groupBy)&&e.dataSource.groupBy.indexOf(e.dataField)>=0:e[t]}get properties(){return["allowExport","allowCollapse","dataSet","options","allowTypeChange","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","canNotify","data","disabledDialogOptions","description","grid","icon","menuItems","menu","summary","cellsFormat","className","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","formula","AIQuery","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","rowSpan","showDescriptionButton","statusColumn","treeColumn","computedWidth","computedHeight","overflowWidth","parent","showCardLabel","cardSpan","tooltip","tooltipRenderer","cardHeight","relationId","relationField","relationCascadingFields","getFilterPanel","getCellValue","updateFilterPanel","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules","parentDataField","cascadingDataField","computedFields","allowItemsAdd","dots","placeholder","detailColumns","collapsed"]}propertyChanged(t,e,o){const l=this;if(l.data&&void 0!==l.data[t]&&(l.data[t]=o),l._state||(l._state={label:l.label,dataField:l.dataField,dataType:l.dataType,_visible:l._visible}),l._state&&o!==e&&l.dataField&&!l.dataField.startsWith("_"))if("editor"===t){l._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(l._state[t][e]=o[e])}else"filter"===t?l[t]&&"string"!=typeof o?l._state[t]=o.toString():l._state[t]=o:"sortOrder"===t?("asc"!==o&&"desc"!==o&&null!==o&&"ascending"!==o&&"descending"!==o&&(o=null),l.stateProps.indexOf(t)>=0&&(l._state[t]=o)):l.stateProps.indexOf(t)>=0&&(l._state[t]=o);if("formula"!==t)if("highlight"!==t)if("className"!==t)if("editor"!==t)if("allowSort"!==t&&"allowFilter"!==t)if("showIcon"!==t){if("visible"===t){const t=l.grid.grouping.enabled;return l.grid.refresh(t),void(t&&l.grid._filters&&l.grid.refreshFilters(t))}if("showCustomButton"===t&&(o?l.element._showCustomButton():l.element._hideCustomButton()),"showDescriptionButton"===t)return o?l.element._showDescriptionButton():l.element._hideDescriptionButton(),void l.refresh();if("description"!==t){if("filter"===t&&(l.filter?l.filter&&Array.isArray(l.filter)&&0===l.filter.length?(l.filter=null,l.filtered=!1,l.grid.removeFilter(l.dataField)):(l.grid.addFilter(l.dataField,l.filter),l.filtered=!0):(l.grid.removeFilter(l.dataField),l.filtered=!1),(l.autoShowFilterButton||l.showFilterButton)&&(o?l.element._showFilterButton():l.element._hideFilterButton()),l.grid.autoSaveState()),"sortIndex"===t)return-1===l.sortIndex&&(l.sortIndex=null),"many"===l.grid.sorting.mode&&l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),null!==l.sortIndex&&-1!==l.sortIndex?l.element.setAttribute("sort-index",l.sortIndex):l.element.removeAttribute("sort-index"),void l.element._updateSortOrder();if("selected"===t){if(!1===l.allowSelect)return;l.selectionColumn&&l.refresh(),o?l.grid._selection.columns[l.dataField]||(l.grid._selection.columns[l.dataField]=!0):!1===o&&l.grid._selection.columns[l.dataField]&&delete l.grid._selection.columns[l.dataField],l.grid._recycle(!1)}if("formatSettings"===t&&l.grid._recycle(!1),"sortOrder"===t)return l.sorted=!1,null===o?l.element._hideSortButton():(l.element._showSortButton(),l.sorted=!0),"asc"!==l.sortOrder&&"desc"!==l.sortOrder&&null!==l.sortOrder&&"ascending"!==l.sortOrder&&"descending"!==l.sortOrder&&(l.sortOrder=null),l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),void(l.sorted?l.element.setAttribute("aria-sort","asc"===l.sortOrder?"ascending":"descenting"):(l.element.removeAttribute("aria-sort"),l.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._showActionButton():l.element._hideActionButton(),l.element.allowAnimations=!0),"autoShowActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._hideActionButton():l.element._showActionButton(),l.element.allowAnimations=!0),"showFilterButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowFilterButton&&(l._autoShowFilterButton=l.autoShowFilterButton),o?(l.autoShowFilterButton=!1,l.element._showFilterButton()):(l.element._hideFilterButton(),l.autoShowFilterButton=l._autoShowFilterButton),l.element.allowAnimations=!0),"showSortButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowSortButton&&(l._autoShowSortButton=l.autoShowSortButton),o?(l.autoShowSortButton=!1,l.element._showSortButton()):(l.element._hideSortButton(),l.autoShowSortButton=l._autoShowSortButton),l.element.allowAnimations=!0),"autoShowSortButton"===t&&(l.element.allowAnimations=!1,l._autoShowSortButton=l.autoShowSortButton,o?l.element._hideSortButton():l.element._showSortButton(),l.element.allowAnimations=!0),"menu"===t&&(o?l.element.setAttribute("aria-controls",l.menu.id):(l.element.removeAttribute("aria-controls"),l.autoShowActionButton&&l.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||l.grid._recycle(),"label"!==t&&"labelTemplate"!==t&&"width"!==t&&"minWidth"!==t||l.grid.refresh(),"freeze"===t){if(!l.allowFreeze)return;const t=l.grid,e=()=>{const e=t.context;t.context=t,t._renderColumns(),!1===o&&t._initializeRowElements(),t.refresh(),t.context=e};if(t.columnGroups&&t.columnGroups.length>0&&l.columnGroup)return void e();e()}}else l.grid.context===document&&(o?l.grid.addGroup(l.dataField):l.grid.removeGroup(l.dataField))}else l.refresh()}else l.refresh();else l.refresh();else l._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else l.refresh();else this.refresh();else l.grid&&l.grid._initFormulaParser()}_measureSize(t){const e=this.grid,o=function(){const o=[],l=document.createElement("div"),i=document.createElement("div"),n=Array.isArray(t)?t:[t];i.classList.add("smart-label"),l.appendChild(i),l.style.width="auto",l.style.position="static",e.$.columnHeader.appendChild(l);for(let t=0;t<n.length;t++){i.innerHTML="<span>"+n[t]+"</span>";const e=20+i.firstChild.offsetWidth,l=Math.max(30,e);o.push(l)}return e.$.columnHeader.removeChild(l),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let l=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const i=t[o],n=""+i.data[e.dataField];if("image"===e.template)break;n&&n.length>l.length&&(l=n),"date"===e.dataType&&n&&e.cellsFormat&&i.data[e.dataField]&&(l=new Smart.Utilities.DateTime(i.data[e.dataField]).toString(e.cellsFormat))}}const i=e._measureSize(l);return e.showIcon?i+20:i}autoSize(t){const e=this._autoSize(t);this.width=e}createElement(){const t=this,e=document.createElement("smart-grid-column");return e._initialize(t),e.setAttribute("role","columnheader"),e.setAttribute("aria-haspopup",""),t.element=e,t.grid.notify((function(e,o,l){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",l);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",l);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",l);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",l);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",l);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",l);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",l);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",l);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",l);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",l);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",l);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",l);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",l);break;case"appearance_showFrozenColumnBackground":case"appearance_showSortColumnBackground":case"appearance_showFilterColumnBackground":t.grid._recycle(!1)}})),e}}),Smart("smart-grid-column",class extends Smart.BaseElement{_showSortButton(t){const e=this;e.column&&(e.column.autoGenerated||(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.column&&e.column.grid&&!1===e.column.grid.sorting.maintainSort?e.sortButton.removeAttribute("order"):(e.column.autoShowSortButton||e.column.allowSort&&e.sortButton.classList.add("smart-icon-sort","smart-grid-icon"),"asc"===e.column.sortOrder?e.sortButton.classList.add("asc"):"desc"===e.column.sortOrder&&e.sortButton.classList.add("desc"),e.column.showSortButton&&(e.sortButton.classList.add("show"),!1!==t&&e._refresh()),null!==e.column.sortIndex?e.sortButton.setAttribute("order",1+e.column.sortIndex):e.sortButton.removeAttribute("order"))))}_updateSortOrder(){const t=this;if(!t.column)return t.removeAttribute("sort-index"),void t.sortButton.removeAttribute("order");null!==t.column.sortIndex?(t.setAttribute("sort-index",t.column.sortIndex),t.sortButton.setAttribute("order",1+t.column.sortIndex)):(t.removeAttribute("sort-index"),t.sortButton.removeAttribute("order"))}_hideSortButton(t){const e=this;e.column&&(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.sortButton.removeAttribute("order"),e.column.showSortButton&&!e.column.autoShowSortButton||(e.sortButton.classList.remove("show"),e.sortButton.classList.remove("smart-icon-sort"),!1!==t&&e._refresh()))}_showFilterButton(t){const e=this;e.column&&!e.column.autoGenerated&&(e.filterButton.classList.add("show"),e._isInitialized&&!1!==t&&e._refresh())}_hideFilterButton(t){const e=this;e.column&&(e.filterButton.classList.remove("show"),e._isInitialized&&!1!==t&&e._refresh())}_showDescriptionButton(){const t=this;t.column&&!t.column.autoGenerated?t.hasAttribute("columnHeader")||(t.column.description?(t.descriptionButton.setAttribute("title",t.column.description),t.descriptionButton.classList.add("show")):t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh()):t.descriptionButton.classList.remove("show")}_hideDescriptionButton(){const t=this;t.column&&(t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh())}_showIcon(){const t=this;t.column&&!t.column.autoGenerated&&(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon",""),t._isInitialized&&t._refresh())}_hideIcon(){const t=this;t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon"),t._refresh()}_showCustomButton(){const t=this;t.column&&!t.column.autoGenerated&&(t.customButton.classList.add("show"),t._refresh())}_hideCustomButton(){const t=this;t.column&&(t.customButton.classList.remove("show"),t._refresh())}_showActionButton(){const t=this;t.column&&t.column.showActionButton&&t.column.grid.hasColumnMenu(t.column)&&!t.column.autoGenerated&&t.actionButton&&(t.actionButton.classList.add("show"),t._refresh())}_hideActionButton(){const t=this;t.column&&t.column.showActionButton&&t.actionButton&&!t.hasAttribute("aria-controls")&&t.actionButton.classList.contains("show")&&(t.actionButton.classList.remove("show"),t._refresh())}_rotate(){const t=this,e=document.createElement("span");return t.label.innerHTML="",e.innerHTML=t.column.label,t.label.appendChild(e),e.className="rotate",e.style.transform="rotate("+t.column.rotationAngle+"deg)",t.column.grid._recycleRotate(t.label,e,t.column.align,t.column.verticalAlign,t.column.label)}_align(){const t=this;let e=t.column.align;switch(t.column.grid.rightToLeft&&("left"===e?e="right":"right"===e&&(e="left")),e){case"left":t.label.classList.add("align-left");break;case"center":t.label.classList.add("align-center");break;case"right":t.label.classList.add("align-right")}switch(t.column.verticalAlign){case"top":t.label.classList.add("align-top");break;case"middle":t.label.classList.add("align-middle");break;case"bottom":t.label.classList.add("align-bottom")}}_refresh(){const t=this;if(!t.column)return;const e=t.column.grid;if(t.sortButton.classList.remove("filter"),t.sortButton.classList.remove("action"),t.label.className="smart-label",t.label.firstElementChild&&t.column.className&&(t.label.className="smart-label "+t.column.className),t.descriptionButton&&t.descriptionButton.setAttribute("title",t.column.description),!0===t.column.autoGenerated||t.hasAttribute("columnHeader")?t.descriptionButton.classList.remove("show"):t.column.showDescriptionButton&&t.column.description?t.descriptionButton.classList.add("show"):t.descriptionButton.classList.remove("show"),t.column.highlight?t.setAttribute("highlight",""):t.removeAttribute("highlight"),t.column.visible&&"_checkBoxColumn"===t.column.dataField){const e=t.column.grid;let o=e.getVisibleRows();e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode&&(o=o.slice(e.paging.pageIndex*e.paging.pageSize,(e.paging.pageIndex+1)*e.paging.pageSize));const l=e._getSelectedRows(!0,!1);if(e.selection.checkBoxes.autoShow?t.setAttribute("auto-show",""):t.removeAttribute("auto-show"),e._isVirtualMode()){const o=e.dataSource.virtualDataSourceLength;l>0&&l===o?t.setAttribute("selected",""):l>0&&l<o?t.setAttribute("selected","indeterminate"):0!==l&&0!==o||t.removeAttribute("selected")}else l.length>0&&l.length===o.length?t.setAttribute("selected",""):l.length>0&&l.length<o.length?t.setAttribute("selected","indeterminate"):0!==l.length&&0!==o.length||t.removeAttribute("selected");return t.removeAttribute("checkbox"),t.label.classList.remove("smart-input"),void("none"!==e.selection.checkBoxes.selectAllMode&&(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")))}if("_rowHeaderColumn"===this.column.dataField){const e=t.column.grid;if(e.selection.enabled&&e.selection.allowRowHeaderSelection&&e.appearance.showRowHeaderSelectIcon){let o='<div class="smart-grid-command-item">',l=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(l=""),o+='<span class="smart-grid-icon '+l+'"></span>',o+="</div>",t.label.style.paddingLeft="0px",t.label.style.paddingRight="0px",t.label.innerHTML=o}}if("_commandColumn"===t.column.dataField){const e=t.column.grid,o="icon"!==e.editing.commandColumn.displayMode,l="label"!==e.editing.commandColumn.displayMode,i=e.editing.commandColumn.dataSource.commandColumnMenu;let n='<div class="smart-grid-command-item">';const a="{{messages}}"===i.label?e.localize("commandColumnMenu"):i.label,r=i.icon;l&&o?(n+='<span class="smart-grid-icon '+r+'"></span>',n+='<span class="smart-grid-label">'+a+"</span>"):l&&!o?n+='<span class="smart-grid-icon '+r+'"></span>':o&&!l&&(n+='<span class="smart-grid-label">'+a+"</span>"),n+="</div>",i.visible&&(t.label.innerHTML=n)}const o=t.column.getProperty("selected");if(!1===o&&t.hasAttribute("selected")?t.removeAttribute("selected"):!0===o?t.setAttribute("selected",""):null===o&&t.setAttribute("selected","indeterminate"),t.column.allowSortButtonAnimation?t.sortButton.classList.add("smart-animate"):t.sortButton.classList.remove("smart-animate"),e.dragDrop&&e.dragDrop.column===t.column?t.classList.add("dragged"):t.classList.remove("dragged"),t.column.sorted?t._showSortButton(!1):t._hideSortButton(!1),t.column.sorted?(t.setAttribute("aria-sort","asc"===t.column.sortOrder?"ascending":"descenting"),t._updateSortOrder()):(t.removeAttribute("aria-sort"),t.removeAttribute("sort-index")),(t.column.autoShowFilterButton||t.column.showFilterButton)&&(t.column.filtered?t._showFilterButton(!1):t._hideFilterButton(!1)),t.column.allowFilterButtonAnimation?t.filterButton.classList.add("smart-animate"):t.filterButton.classList.remove("smart-animate"),t.column.allowActionButtonAnimation&&!1!==t.allowAnimations?t.buttonsGroup.classList.add("smart-animate"):t.buttonsGroup.classList.remove("smart-animate"),t.column.allowLabelAnimation&&!1!==t.allowAnimations?t.label.classList.add("smart-animate"):t.label.classList.remove("smart-animate"),t.buttonsGroup.classList.remove("action"),t.actionButton.classList.contains("show")&&t.buttonsGroup.classList.add("action"),t.column.showIcon?(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon","")):(t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon","")),t.icon.classList.contains("show"))if(t.icon.className="smart-grid-icon show column-icon",t.column.icon&&t.column.icon.indexOf(" ")>=0){const e=t.column.icon.trim().split(" ");for(let o=0;o<e.length;o++)t.icon.classList.add(e[o])}else t.icon.classList.add(t.column.icon);let l=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&l++;switch(l){case 1:t.label.classList.add("one");break;case 2:t.label.classList.add("two");break;case 3:t.label.classList.add("three");break;case 4:t.label.classList.add("four");break;case 5:t.label.classList.add("five");break;case 6:t.label.classList.add("six")}t.classList.remove("smart-visibility-hidden"),t.column.grid._columnGap>0?t.classList.add("smart-grid-column-border"):t.classList.remove("smart-grid-column-border"),t.column.grid.appearance.showColumnHeaderLines?t.classList.remove("smart-grid-vertical-border-collapse"):t.classList.add("smart-grid-vertical-border-collapse"),(!t.column.rotationAngle||t._rotate())&&t._align()}_renderTemplate(){const t=this,e=t.column,o=e.labelTemplate;let l="";if("function"!=typeof o){if(o instanceof HTMLTemplateElement)l=o;else{if("string"!=typeof o||!o.startsWith||!o.startsWith("#"))return void(t.label.innerHTML=o);l=document.querySelector(o)}if(l){let o=l.content.cloneNode(!0).firstElementChild,i=e.label;i=i.toString(),i=i.replace(/'/gi,"\\'"),i=i.replace(/"/gi,'\\"');const n=o.outerHTML.replace(/{{value}}/gi,i).replace(/{{id}}/gi,e.label);t.label.innerHTML=n}}else t.label.innerHTML=o(e.label)}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;if(t.column.labelTemplate?t._renderTemplate():t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(t.column.label.indexOf("&")>=0||"SPAN"!==t.label.firstChild.nodeName?t.label.innerHTML="<span>"+t.column.label+"</span>":t.label.firstChild.textContent=t.column.label):t.label.innerHTML="<span>"+t.column.label+"</span>",t.column.title?t.setAttribute("title",t.column.title):t.removeAttribute("title"),t.column.tooltip&&(t.onmouseenter=e=>{t.column.grid._createTooltip(e,t.column.tooltip,t,"top")},t.onmouseleave=()=>{t.column.grid._cellTooltip&&(t.column.grid._cellTooltip.style.visibility="hidden")}),t._refresh(),t.column.autoGenerated&&t.setAttribute("auto-generated",""),t.column.autoGenerated||o){if(t.style.width=t.column.computedWidth+"px",t.column.grid.appearance.showRowComments&&t.column.rowHeaderColumn){const e=t.column.grid.rowDetailColumn,o=e?e.width:0;t.style.width=t.column.computedWidth+o+"px",t.style.zIndex=5}}else t.style.width=t.column.computedWidth-t.column.grid._columnGap+"px";if(t.style.height!==t.column.computedHeight+"px"&&(t.style.height=t.column.computedHeight+"px"),t.style.lineHeight!==t.column.computedHeight+"px"&&(t.style.lineHeight=t.column.computedHeight+"px"),t.column.grid.rightToLeft?t.style.right!==t.column.left+"px"&&(t.style.right=t.column.left+"px"):t.style.left!==t.column.left+"px"&&(t.style.left=t.column.left+"px"),t.style.top!==t.column.top+"px"&&(t.style.top=t.column.top+"px"),t.getAttribute("data-field")!==e&&t.setAttribute("data-field",e),t.setAttribute("header",""),t.column.freeze&&t.setAttribute("freeze",""),t.column.level>0&&(t.style.top=t.column.top+"px"),t.column.detailColumns&&t.column.detailColumns.length>0){const e=t.column.grid;if(t.column._collapseButton)return;const o={},l=[];for(let o=0;o<t.column.detailColumns.length;o++){const i=e.columnByDataField[t.column.detailColumns[o]];i&&l.push(i)}o.inline=!0,o.columns=l,o.collapsed=t.column.collapsed,o.column=t.column,e._initializeColumnGroupCollapsing(o);const i=o.collapseButton;i&&(o.column._collapseButton=i,o.column.element.label.appendChild(i),o.column.element.label.style.display="flex",o.column.element.label.style.justifyContent="space-between")}t.column.headerTemplate&&t.column.headerTemplate(t.label)}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_initialize(t){const e=this;e._isInitialized=!1;const o=document.createElement("div"),l=document.createElement("div"),i=document.createElement("div"),n=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),c.classList.add("smart-drag-handle"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),l.classList.add("smart-sort-button","smart-grid-icon"),i.classList.add("smart-filter-button","smart-icon-filter","smart-grid-icon"),n.classList.add("smart-action-button","smart-grid-icon"),n.setAttribute("aria-haspopup",""),a.classList.add("smart-description-button","smart-icon-help-circled","smart-grid-icon"),r.classList.add("smart-custom-button",t.customButtonIcon?t.customButtonIcon:"smart-icon-tools","smart-grid-icon"),d.classList.add("smart-buttons-group"),n.innerHTML="<div></div>",e.style.width=e.column.computedWidth+"px",e.appendChild(c),e.appendChild(s),e.appendChild(o),e.appendChild(d),d.appendChild(l),d.appendChild(i),d.appendChild(a),d.appendChild(r),d.appendChild(n),e.handle=c,e.icon=s,e.label=o,e.sortButton=l,e.filterButton=i,e.actionButton=n,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=d,e._properties=[];const u=window.PointerEvent?"pointerdown":"mousedown",m=window.PointerEvent?"pointerup":"mouseup";e._filterDownEvent=function(t){"col-resize"!==t.target.style.cursor&&(t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t))}.bind(e),e._filterUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionDownEvent=function(t){t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t)}.bind(e),e.filterButton.addEventListener(u,e._filterDownEvent),e.filterButton.addEventListener(m,e._filterUpEvent),e.actionButton.addEventListener(m,e._actionUpEvent),e.actionButton.addEventListener(u,e._actionDownEvent),!e.column.autoShowActionButton&&e.column.showActionButton&&e._showActionButton(),!e.column.autoShowSortButton&&e.column.showSortButton&&e._showSortButton(),!e.column.autoShowFilterButton&&e.column.showFilterButton&&e._showFilterButton(),e.column.showDescriptionButton&&e._showDescriptionButton(),e.column.showCustomButton&&e._showCustomButton(),e.column.showIcon&&e._showIcon(),"_rowHeaderColumn"===e.column.dataField&&e.classList.add("top-near-corner"),e.customButton.onclick=function(t){e.column.onCustomButtonClick&&e.column.onCustomButtonClick(t)}.bind(e),e.column.sorted||e.column.sortOrder?(e.column.sorted=!0,e.setAttribute("aria-sort","asc"===e.column.sortOrder?"ascending":"descenting"),e._updateSortOrder()):(e.removeAttribute("aria-sort"),e.removeAttribute("sort-index")),e._properties=[],e._isInitialized=!0}template(){return""}_detach(){const t=this,e=window.PointerEvent?"pointerdown":"mousedown",o=window.PointerEvent?"pointerup":"mouseup";t.filterButton.removeEventListener(e,t._filterDownEven),t.filterButton.removeEventListener(o,t._filterUpEvent),t.actionButton.removeEventListener(o,t._actionUpEvent),t.actionButton.removeEventListener(e,t._actionDownEvent),t.element=null,t.column&&(t.column.grid=null,t.column.element=null),t.icon=null,t.label=null,t.sortButton=null,t.filterButton=null,t.actionButton=null,t.descriptionButton=null,t.customButton=null,t.buttonsGroup=null,t.column=null,delete t.grid,delete t.column,delete t.icon,delete t.label,delete t.sortButton,delete t.filterButton,delete t.actionButton,delete t.descriptionButton,delete t.customButton,delete t.buttonsGroup}onDetached(){this._detach()}});
1442
+ Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!=typeof t?Object.assign(e,t):(e.label=t,e.dataField=t),e.dataField||(e.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),e.tooltip||(e.tooltip=""),e.tooltipRenderer||(e.tooltipRenderer=""),e.rowSpan||(e.rowSpan=null),e.formula||(e.formula=null),e.AIQuery||(e.AIQuery=null),e.columnGroup||(e.columnGroup=""),e.canNotify=!0,(!t||t&&!t.properties)&&(e.data=t);let o="left";switch(e.dataType){case"string":case"date":o="left";break;case"number":"rating"===t.template&&(o="left");break;case"boolean":o="center"}if(e.displayField!==e.dataField&&(o="left"),e.relationId||(e.relationId=""),e.relationField||(e.relationField=""),e.relationCascadingFields||(e.relationCascadingFields=""),e.highlight||(e.highlight=!1),void 0===e.index&&(e.index=-1),void 0===e.visibleIndex&&(e.visibleIndex=-1),void 0===e.selected&&(e.selected=!1),void 0===e.freeze&&(e.freeze=!1),e.label||(e.label=""),e.menuItems||(e.menuItems=null),e.options||(e.options=null),e.displayField||(e.displayField=e.dataField),e.template||(e.template=""),e.editor||(e.editor="input"),"string"==typeof e.editor){e.editor={template:e.editor,autoFocus:!0};let t=!0;e.editor.template&&e.editor.template.indexOf("<input")>=0&&(t=!1),t&&("number"===e.dataType||"int"===e.dataType||"float"===e.dataType?"slider"!==e.editor.template&&(e.editor.template="numberInput"):"date"===e.dataType?("timeInput"!==e.editor.template&&"dateTimePicker"!==e.editor.template&&(e.editor.template="dateInput"),e.editor.autoOpen=!0,e.cellsFormat||e.formatSettings||(e.cellsFormat="M/d/yyyy")):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType||"bool"===e.dataType?e.editor.template="checkBox":"string"===e.dataType&&"tags"===e.template?(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,singleSelect:!0},e.templateSettings&&!0===e.templateSettings.multiSelect&&(e.editor.singleSelect=!1),e.options&&(e.editor.dataSource=e.options)):"string"===e.dataType&&"collaborator"===e.template&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,collaborator:!0,singleSelect:!0}))}else if(void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0),e.editor.relationId&&e.editor.relationField&&e.grid){const t=e.grid._getRelationData(e.editor.relationId,e.editor.relationField,e.editor.singleSelect);e.editor.dataSource=t}if(e.icon||(e.icon="smart-icon-font","modifiedTime"===e.template&&(e.template="updatedTime"),"modifiedBy"===e.template&&(e.template="updatedBy"),"select"===e.editor.template&&(e.icon="smart-icon-sort-down"),"multiComboInput"===e.editor.template&&(e.icon="smart-icon-list-unordered"),"textArea"!==e.editor.template&&"textarea"!==e.editor.template||(e.icon="smart-icon-fontsize"),"url"===e.template&&(e.icon="smart-icon-link"),"email"===e.template&&(e.icon="smart-icon-mail"),"color"===e.template&&(e.icon="smart-icon-color-background"),"updatedTime"!==e.template&&"createdTime"!==e.template||(e.icon="smart-icon-clock"),"multiComboInput"===e.editor.template&&e.editor.collaborator&&(e.icon="smart-icon-user"),"createdBy"!==e.template&&"updatedBy"!==e.template&&"collaborator"!==e.template||(e.icon="smart-icon-user"),"image"===e.editor.template&&(e.icon="smart-icon-image"),"attachment"===e.editor.template&&(e.icon="smart-icon-docs"),"password"===e.editor.template&&(e.icon="smart-icon-lock"),"phone"===e.editor.template?e.icon="smart-icon-phone":"checkBox"===e.editor.template||"boolean"===e.dataType?e.icon="smart-icon-ok-squared":"numberInput"===e.editor.template||"slider"===e.editor.template||"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.icon="smart-icon-number":"dateInput"===e.editor.template||"dateTimePicker"===e.editor.template||"date"===e.dataType?(e.icon="smart-icon-calendar","timeInput"===e.editor.template&&(e.icon="smart-icon-clock")):"timeInput"===e.editor.template||"time"===e.dataType?e.icon="smart-icon-clock":"grid"===e.editor.template?e.icon="smart-icon-table-alt":e.editor.template&&e.editor.template.indexOf("multi")>=0&&"collaborator"!==e.template&&(e.editor.collaborator?e.icon="smart-icon-user":e.icon="smart-icon-list-ordered",e.editor.singleSelect&&(e.icon="smart-icon-sort-down")),e.relationId&&(e.icon="smart-icon-table-alt"),e.formula&&(e.icon="smart-icon-math"),(e.AIQuery||"ai"===e.template)&&(e.icon="smart-icon-ai"),"uuid"===e.template&&(e.icon="smart-icon-number"),"rating"!==e.editor.template&&"rating"!==e.template||(e.icon="smart-icon-star"),"sparklines"===e.template&&(e.icon="smart-icon-chart"),"vote"===e.template&&(e.icon="smart-icon-like"),"autoNumber"===e.template&&(e.icon="smart-icon-list-ordered")),e.menu=null,void 0===e.allowActionButtonAnimation&&(e.grid?e.allowActionButtonAnimation=e.grid.appearance.allowColumnActionButtonAnimation:e.allowActionButtonAnimation=!1),void 0===e.allowSortButtonAnimation&&(e.grid?e.allowSortButtonAnimation=e.grid.appearance.allowColumnSortButtonAnimation:e.allowSortButtonAnimation=!1),void 0===e.autoShowActionButton&&(e.grid?e.autoShowActionButton=e.grid.appearance.autoShowColumnActionButton:e.autoShowActionButton=!1),void 0===e.autoShowSortButton&&(e.grid?e.autoShowSortButton=e.grid.appearance.autoShowColumnSortButton:e.autoShowSortButton=!0),void 0===e.showSortButton&&(e.grid?e.showSortButton=e.grid.appearance.showColumnSortButton:e.showSortButton=!1),void 0===e.showCardLabel&&(e.showCardLabel=!0),void 0===e.cardSpan&&(e.cardSpan=!1),void 0===e.allowItemsAdd&&(e.allowItemsAdd=!1),void 0===e.dots&&(e.dots=!1),void 0===e.cardHeight&&(e.cardHeight=0,("image"===e.template||e.editor&&"textarea"===e.editor.template)&&(e.cardHeight=4)),void 0===e.showIcon&&(e.grid&&!e.autoGenerated?e.showIcon=e.grid.appearance.showColumnIcon:e.showIcon=!1),void 0===e.showDescriptionButton&&(e.grid?e.showDescriptionButton=e.grid.appearance.showColumnDescriptionButton:e.showDescriptionButton=!1),void 0===e.showCustomButton&&(e.grid?e.showCustomButton=e.grid.appearance.showColumnCustomButton:e.showCustomButton=!1),void 0===e.showActionButton&&(e.grid?e.showActionButton=e.grid.appearance.showColumnActionButton:e.showActionButton=!1),void 0===e.allowLabelAnimation&&(e.grid?e.allowLabelAnimation=e.grid.appearance.allowColumnLabelAnimation:e.allowLabelAnimation=!1),void 0===e.autoShowFilterButton&&(e.grid?e.autoShowFilterButton=e.grid.appearance.autoShowColumnFilterButton:e.autoShowFilterButton=!1),void 0===e.showFilterButton&&(e.grid?e.showFilterButton=e.grid.appearance.showColumnFilterButton:e.showFilterButton=!1),void 0===e.autoCloseMenu&&(e.grid?e.autoCloseMenu=e.grid.columnMenu.autoClose:e.autoCloseMenu=!0),void 0===e.allowNull&&(e.allowNull=!0),e.formatFunction||(e.formatFunction=null),e.cellsRenderer||(e.cellsRenderer=null),e.sortOrder||(e.sortOrder=null),void 0===e.sortIndex&&(e.sortIndex=null),e.sortComparator||(e.sortComparator=null),e.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),e.cellsCSSRules||(e.cellsCSSRules=null),e.cellsCSSInlineRules||(e.cellsCSSInlineRules=null),e.filterMenuMode||(e.filterMenuMode="default",e.grid&&"excel"===e.grid.filtering.filterMenu.mode&&(e.filterMenuMode="excel"),e.autoGenerated&&(e.filterMenuMode="none")),e.align||(e.align=o),!e.cellsAlign)switch(e.cellsAlign=o,e.dataType){case"date":case"number":e.cellsAlign="right"}if(!(e.cellsWrap||(e.cellsWrap=!1,e.grid&&e.grid.layout.allowCellsWrap&&(e.cellsWrap=e.grid.layout.allowCellsWrap)),e.minWidth||(e.minWidth=30),e.width||(e.width=null),e.autoGenerated||e.width&&"number"==typeof e.width))if(e.grid&&e.grid.layout.columnWidth)e.width=e.grid.layout.columnWidth;else if(e.grid&&e.grid.layout.autoSizeNewColumn&&!e._autoSizeWidth){const t=e._autoSize();e.width=Math.max(e.grid.layout.autoSizeNewColumnMinWidth,t),e._autoSizeWidth=e.width}else e.width&&"string"==typeof e.width&&(isNaN(parseInt(e.width))||-1===e.width.indexOf("%")&&(e.width=parseInt(e.width)));if(void 0===e.visible&&(e.visible=!0),void 0===e.allowResize&&(e.allowResize=!0),void 0===e.allowFreeze&&(e.allowFreeze=!0),void 0===e.allowReorder&&(e.allowReorder=!0),void 0===e.allowHide&&(e.allowHide=!0),void 0===e.allowDelete&&(e.allowDelete=!0),void 0===e.allowSort&&(e.allowSort=!0),void 0===e.allowSelect&&(e.allowSelect=!0),void 0===e.allowSortToggleOnClick&&(e.allowSortToggleOnClick=!0),void 0===e.allowGroup&&(e.allowGroup=!0),void 0===e.allowFilter&&(e.allowFilter=!0),void 0===e.allowEdit&&(e.allowEdit=!0),void 0===e.allowTypeChange&&(e.allowTypeChange=!0),void 0===e.allowSummary&&(e.allowSummary=!0),void 0===e.allowHeaderEdit&&(e.allowHeaderEdit=!0),void 0===e.allowExport&&(e.allowExport=!0),void 0===e.allowCollapse&&(e.allowCollapse=!0),void 0===e.collapsed&&(e.collapsed=!1),void 0===e.description&&(e.description=""),void 0===e.group&&(e.group=!1),e.summary||(e.summary=[]),"false"===e.freeze&&(e.freeze=!1),"true"===e.freeze&&(e.freeze=!0),!1===e.allowFreeze&&(e.freeze=!1),void 0===e.defaultValue&&(e.defaultValue=null),e.disabledDialogOptions||(e.disabledDialogOptions=[]),e.formatSettings||(e.formatSettings={decimalPlaces:null,decimalSeparator:null,negativeWithBrackets:null,prefix:null,sufix:null,thousandsSeparator:null,dateFormat:"d"}),this.validationRules||(this.validationRules=[]),e.selected=!1,e.sorted=!1,e.filtered=!1,e.filter&&(e.filtered=!0),e.parent=null,e.children=[],e.templateSettings||(e.templateSettings={}),e.dataSet||(e.dataSet={}),e.grid&&e.formula){let t=e.formula;for(let o=0;o<e.grid.columns.length;o++){const l=e.grid.columns[o];-1===t.indexOf("COL("+l.dataField+")")&&-1===t.indexOf("COL("+l.label+")")&&(t.indexOf(l.label)>=0?(t=t.replaceAll(l.label,"COL("+l.dataField+")"),e.formula=t):t.indexOf(l.dataField)>=0&&(t=t.replaceAll(l.dataField,"COL("+l.dataField+")"),e.formula=t))}}if(!e.placeholder&&e.grid&&e.grid.appearance.allowColumnAutoPlaceholder&&("string"===e.dataType||"text"===e.dataType?e.placeholder=e.label:"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.placeholder="##":"date"===e.dataType&&(e.placeholder=e.cellsFormat||"m/d/yyyy"),e._state.placeholder=e.placeholder),"createdTime"===e.template||"updatedTime"===e.template||"createdBy"===e.template||"updatedBy"===e.template){const t=[];t.createdTime="createdDate",t.updatedTime="updatedDate",t.createdDate="createdDate",t.updatedDate="updatedDate",t.createdBy="createdBy",t.updatedBy="updatedBy",e.sortComparator=function(o,l,n,i){if(e.grid){const o=e.grid.rowById[n.$.id],l=e.grid.rowById[i.$.id],a=t[e.template];if("createdDate"===a){if(o.history[0].date<l.history[0].date)return-1;if(o.history[0].date>l.history[0].date)return 1}if("updatedDate"===a){if(o.history[o.history.length-1].date<l.history[l.history.length-1].date)return-1;if(o.history[o.history.length-1].date>l.history[l.history.length-1].date)return 1}}return 0}}}refresh(){const t=this;t.element&&t.element._refresh()}render(){const t=this;t.element.column=t,t.element&&t.element._render()}get stateProps(){return["allowExport","allowCollapse","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","formula","AIQuery","rowSpan","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","thHierarchy","dataSet","valueField","onAction","title","tooltip","tooltipRenderer","showCustomButton","showFilterButton","computedFields","showSortButton","editor","template","visibleIndex","validationRules","relationId","relationField","relationCascadingFields","parentDataField","cascadingDataField","allowItemsAdd","dots","placeholder"]}setState(t){const e=this;if(!t)return;if(e._state={},!t.dataField)return;if(t.dataField.startsWith("_"))return{};const o=e.stateProps;for(let l in t)if(!l.startsWith("_")&&o.indexOf(l)>=0)if("editor"===l){e._state[l]={};for(let t in e[l])"row"!==t&&"column"!==t&&"cell"!==t&&"columns"!==t&&"column"!==t&&"instance"!==t&&"element"!==t&&(e._state[l][t]=e[l][t])}else"groups"===l?e[l]&&e[l].length>0&&(e._state[l]=e[l]):e._state[l]=e[l]}getState(){const t=this;if(t.dataField.startsWith("_"))return{};if(t._state){t._state._visible=t._visible,t._state._dataField=t._dataField,t._state.editor={};for(let e in t.editor)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state.editor[e]=t.editor[e])}if(!t._state){t._state={label:t.label,dataField:t.dataField,dataType:t.dataType,_visible:t._visible};const e=t.stateProps;for(let o in t)if(!o.startsWith("_")&&e.indexOf(o)>=0)if("editor"===o){t._state[o]={};for(let e in t[o])"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state[o][e]=t[o][e])}else"groups"===o?t[o]&&t[o].length>0&&(t._state[o]=t[o]):"filter"===o?t[o]&&"string"!=typeof t[o]&&(t._state[o]=t[o].toString()):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const l=this,n=l.getProperty(t);n!==e&&(l.canNotify=!1,l[t]=e,o&&(l.propertyChanged(t,n,e),l.grid&&l.grid.onColumnChange&&l.stateProps.indexOf(t)>=0&&l.grid.onColumnChange(l,t,n,e)),l.canNotify=!0)}getProperty(t){const e=this;if("selected"===t){let o=!1;return e.grid&&(e.grid._selection.cells["column"+e.dataField]&&(o=null),e.grid&&e.grid._selection.columns[e.dataField]&&(o=!0),e.grid.columns.canNotify=!1,e[t]!==o&&(e[t]=o),e.grid.columns.canNotify=!0),o}return"group"===t?!(!e.dataSource||!e.dataSource.groupBy)&&e.dataSource.groupBy.indexOf(e.dataField)>=0:e[t]}get properties(){return["allowExport","allowCollapse","dataSet","options","allowTypeChange","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","canNotify","data","disabledDialogOptions","description","grid","icon","menuItems","menu","summary","cellsFormat","className","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","formula","AIQuery","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","rowSpan","showDescriptionButton","statusColumn","treeColumn","computedWidth","computedHeight","overflowWidth","parent","showCardLabel","cardSpan","tooltip","tooltipRenderer","cardHeight","relationId","relationField","relationCascadingFields","getFilterPanel","getCellValue","updateFilterPanel","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules","parentDataField","cascadingDataField","computedFields","allowItemsAdd","dots","placeholder","detailColumns","collapsed"]}propertyChanged(t,e,o){const l=this;if(l.data&&void 0!==l.data[t]&&(l.data[t]=o),l._state||(l._state={label:l.label,dataField:l.dataField,dataType:l.dataType,_visible:l._visible}),l._state&&o!==e&&l.dataField&&!l.dataField.startsWith("_"))if("editor"===t){l._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(l._state[t][e]=o[e])}else"filter"===t?l[t]&&"string"!=typeof o?l._state[t]=o.toString():l._state[t]=o:"sortOrder"===t?("asc"!==o&&"desc"!==o&&null!==o&&"ascending"!==o&&"descending"!==o&&(o=null),l.stateProps.indexOf(t)>=0&&(l._state[t]=o)):l.stateProps.indexOf(t)>=0&&(l._state[t]=o);if("formula"!==t)if("highlight"!==t)if("className"!==t)if("editor"!==t)if("allowSort"!==t&&"allowFilter"!==t)if("showIcon"!==t){if("visible"===t){const t=l.grid.grouping.enabled;return l.grid.refresh(t),void(t&&l.grid._filters&&l.grid.refreshFilters(t))}if("showCustomButton"===t&&(o?l.element._showCustomButton():l.element._hideCustomButton()),"showDescriptionButton"===t)return o?l.element._showDescriptionButton():l.element._hideDescriptionButton(),void l.refresh();if("description"!==t){if("filter"===t&&(l.filter?l.filter&&Array.isArray(l.filter)&&0===l.filter.length?(l.filter=null,l.filtered=!1,l.grid.removeFilter(l.dataField)):(l.grid.addFilter(l.dataField,l.filter),l.filtered=!0):(l.grid.removeFilter(l.dataField),l.filtered=!1),(l.autoShowFilterButton||l.showFilterButton)&&(o?l.element._showFilterButton():l.element._hideFilterButton()),l.grid.autoSaveState()),"sortIndex"===t)return-1===l.sortIndex&&(l.sortIndex=null),"many"===l.grid.sorting.mode&&l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),null!==l.sortIndex&&-1!==l.sortIndex?l.element.setAttribute("sort-index",l.sortIndex):l.element.removeAttribute("sort-index"),void l.element._updateSortOrder();if("selected"===t){if(!1===l.allowSelect)return;l.selectionColumn&&l.refresh(),o?l.grid._selection.columns[l.dataField]||(l.grid._selection.columns[l.dataField]=!0):!1===o&&l.grid._selection.columns[l.dataField]&&delete l.grid._selection.columns[l.dataField],l.grid._recycle(!1)}if("formatSettings"===t&&l.grid._recycle(!1),"sortOrder"===t)return l.sorted=!1,null===o?l.element._hideSortButton():(l.element._showSortButton(),l.sorted=!0),"asc"!==l.sortOrder&&"desc"!==l.sortOrder&&null!==l.sortOrder&&"ascending"!==l.sortOrder&&"descending"!==l.sortOrder&&(l.sortOrder=null),l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),void(l.sorted?l.element.setAttribute("aria-sort","asc"===l.sortOrder?"ascending":"descenting"):(l.element.removeAttribute("aria-sort"),l.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._showActionButton():l.element._hideActionButton(),l.element.allowAnimations=!0),"autoShowActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._hideActionButton():l.element._showActionButton(),l.element.allowAnimations=!0),"showFilterButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowFilterButton&&(l._autoShowFilterButton=l.autoShowFilterButton),o?(l.autoShowFilterButton=!1,l.element._showFilterButton()):(l.element._hideFilterButton(),l.autoShowFilterButton=l._autoShowFilterButton),l.element.allowAnimations=!0),"showSortButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowSortButton&&(l._autoShowSortButton=l.autoShowSortButton),o?(l.autoShowSortButton=!1,l.element._showSortButton()):(l.element._hideSortButton(),l.autoShowSortButton=l._autoShowSortButton),l.element.allowAnimations=!0),"autoShowSortButton"===t&&(l.element.allowAnimations=!1,l._autoShowSortButton=l.autoShowSortButton,o?l.element._hideSortButton():l.element._showSortButton(),l.element.allowAnimations=!0),"menu"===t&&(o?l.element.setAttribute("aria-controls",l.menu.id):(l.element.removeAttribute("aria-controls"),l.autoShowActionButton&&l.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||l.grid._recycle(),"label"!==t&&"labelTemplate"!==t&&"width"!==t&&"minWidth"!==t||l.grid.refresh(),"freeze"===t){if(!l.allowFreeze)return;const t=l.grid,e=()=>{const e=t.context;t.context=t,t._renderColumns(),!1===o&&t._initializeRowElements(),t.refresh(),t.context=e};if(t.columnGroups&&t.columnGroups.length>0&&l.columnGroup)return void e();e()}}else l.grid.context===document&&(o?l.grid.addGroup(l.dataField):l.grid.removeGroup(l.dataField))}else l.refresh()}else l.refresh();else l.refresh();else l._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else l.refresh();else this.refresh();else l.grid&&l.grid._initFormulaParser()}_measureSize(t){const e=this.grid,o=function(){const o=[],l=document.createElement("div"),n=document.createElement("div"),i=Array.isArray(t)?t:[t];n.classList.add("smart-label"),l.appendChild(n),l.style.width="auto",l.style.position="static",e.$.columnHeader.appendChild(l);for(let t=0;t<i.length;t++){n.innerHTML="<span>"+i[t]+"</span>";const e=20+n.firstChild.offsetWidth,l=Math.max(30,e);o.push(l)}return e.$.columnHeader.removeChild(l),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let l=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const n=t[o],i=""+n.data[e.dataField];if("image"===e.template)break;i&&i.length>l.length&&(l=i),"date"===e.dataType&&i&&e.cellsFormat&&n.data[e.dataField]&&(l=new Smart.Utilities.DateTime(n.data[e.dataField]).toString(e.cellsFormat))}}const n=e._measureSize(l);return e.showIcon?n+20:n}autoSize(t){const e=this._autoSize(t);this.width=e}createElement(){const t=this,e=document.createElement("smart-grid-column");return e._initialize(t),e.setAttribute("role","columnheader"),e.setAttribute("aria-haspopup",""),t.element=e,t.grid.notify((function(e,o,l){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",l);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",l);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",l);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",l);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",l);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",l);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",l);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",l);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",l);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",l);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",l);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",l);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",l);break;case"appearance_showFrozenColumnBackground":case"appearance_showSortColumnBackground":case"appearance_showFilterColumnBackground":t.grid._recycle(!1)}})),e}}),Smart("smart-grid-column",class extends Smart.BaseElement{_showSortButton(t){const e=this;e.column&&(e.column.autoGenerated||(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.column&&e.column.grid&&!1===e.column.grid.sorting.maintainSort?e.sortButton.removeAttribute("order"):(e.column.autoShowSortButton||e.column.allowSort&&e.sortButton.classList.add("smart-icon-sort","smart-grid-icon"),"asc"===e.column.sortOrder?e.sortButton.classList.add("asc"):"desc"===e.column.sortOrder&&e.sortButton.classList.add("desc"),e.column.showSortButton&&(e.sortButton.classList.add("show"),!1!==t&&e._refresh()),null!==e.column.sortIndex?e.sortButton.setAttribute("order",1+e.column.sortIndex):e.sortButton.removeAttribute("order"))))}_updateSortOrder(){const t=this;if(!t.column)return t.removeAttribute("sort-index"),void t.sortButton.removeAttribute("order");null!==t.column.sortIndex?(t.setAttribute("sort-index",t.column.sortIndex),t.sortButton.setAttribute("order",1+t.column.sortIndex)):(t.removeAttribute("sort-index"),t.sortButton.removeAttribute("order"))}_hideSortButton(t){const e=this;e.column&&(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.sortButton.removeAttribute("order"),e.column.showSortButton&&!e.column.autoShowSortButton||(e.sortButton.classList.remove("show"),e.sortButton.classList.remove("smart-icon-sort"),!1!==t&&e._refresh()))}_showFilterButton(t){const e=this;e.column&&!e.column.autoGenerated&&(e.filterButton.classList.add("show"),e._isInitialized&&!1!==t&&e._refresh())}_hideFilterButton(t){const e=this;e.column&&(e.filterButton.classList.remove("show"),e._isInitialized&&!1!==t&&e._refresh())}_showDescriptionButton(){const t=this;t.column&&!t.column.autoGenerated?t.hasAttribute("columnHeader")||(t.column.description?(t.descriptionButton.setAttribute("title",t.column.description),t.descriptionButton.classList.add("show")):t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh()):t.descriptionButton.classList.remove("show")}_hideDescriptionButton(){const t=this;t.column&&(t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh())}_showIcon(){const t=this;t.column&&!t.column.autoGenerated&&(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon",""),t._isInitialized&&t._refresh())}_hideIcon(){const t=this;t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon"),t._refresh()}_showCustomButton(){const t=this;t.column&&!t.column.autoGenerated&&(t.customButton.classList.add("show"),t._refresh())}_hideCustomButton(){const t=this;t.column&&(t.customButton.classList.remove("show"),t._refresh())}_showActionButton(){const t=this;t.column&&t.column.showActionButton&&t.column.grid.hasColumnMenu(t.column)&&!t.column.autoGenerated&&t.actionButton&&(t.actionButton.classList.add("show"),t._refresh())}_hideActionButton(){const t=this;t.column&&t.column.showActionButton&&t.actionButton&&!t.hasAttribute("aria-controls")&&t.actionButton.classList.contains("show")&&(t.actionButton.classList.remove("show"),t._refresh())}_rotate(){const t=this,e=document.createElement("span");return t.label.innerHTML="",e.innerHTML=t.column.label,t.label.appendChild(e),e.className="rotate",e.style.transform="rotate("+t.column.rotationAngle+"deg)",t.column.grid._recycleRotate(t.label,e,t.column.align,t.column.verticalAlign,t.column.label)}_align(){const t=this;let e=t.column.align;switch(t.column.grid.rightToLeft&&("left"===e?e="right":"right"===e&&(e="left")),e){case"left":t.label.classList.add("align-left");break;case"center":t.label.classList.add("align-center");break;case"right":t.label.classList.add("align-right")}switch(t.column.verticalAlign){case"top":t.label.classList.add("align-top");break;case"middle":t.label.classList.add("align-middle");break;case"bottom":t.label.classList.add("align-bottom")}}_refresh(){const t=this;if(!t.column)return;const e=t.column.grid;if(t.sortButton.classList.remove("filter"),t.sortButton.classList.remove("action"),t.label.className="smart-label",t.label.firstElementChild&&t.column.className&&(t.label.className="smart-label "+t.column.className),t.descriptionButton&&t.descriptionButton.setAttribute("title",t.column.description),!0===t.column.autoGenerated||t.hasAttribute("columnHeader")?t.descriptionButton.classList.remove("show"):t.column.showDescriptionButton&&t.column.description?t.descriptionButton.classList.add("show"):t.descriptionButton.classList.remove("show"),t.column.highlight?t.setAttribute("highlight",""):t.removeAttribute("highlight"),t.column.visible&&"_checkBoxColumn"===t.column.dataField){const e=t.column.grid;let o=e.getVisibleRows();e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode&&(o=o.slice(e.paging.pageIndex*e.paging.pageSize,(e.paging.pageIndex+1)*e.paging.pageSize));const l=e._getSelectedRows(!0,!1);if(e.selection.checkBoxes.autoShow?t.setAttribute("auto-show",""):t.removeAttribute("auto-show"),e._isVirtualMode()){const o=e.dataSource.virtualDataSourceLength;l>0&&l===o?t.setAttribute("selected",""):l>0&&l<o?t.setAttribute("selected","indeterminate"):0!==l&&0!==o||t.removeAttribute("selected")}else l.length>0&&l.length===o.length?t.setAttribute("selected",""):l.length>0&&l.length<o.length?t.setAttribute("selected","indeterminate"):0!==l.length&&0!==o.length||t.removeAttribute("selected");return t.removeAttribute("checkbox"),t.label.classList.remove("smart-input"),void("none"!==e.selection.checkBoxes.selectAllMode&&(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")))}if("_rowHeaderColumn"===this.column.dataField){const e=t.column.grid;if(e.selection.enabled&&e.selection.allowRowHeaderSelection&&e.appearance.showRowHeaderSelectIcon){let o='<div class="smart-grid-command-item">',l=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(l=""),o+='<span class="smart-grid-icon '+l+'"></span>',o+="</div>",t.label.style.paddingLeft="0px",t.label.style.paddingRight="0px",t.label.innerHTML=o}}if("_commandColumn"===t.column.dataField){const e=t.column.grid,o="icon"!==e.editing.commandColumn.displayMode,l="label"!==e.editing.commandColumn.displayMode,n=e.editing.commandColumn.dataSource.commandColumnMenu;let i='<div class="smart-grid-command-item">';const a="{{messages}}"===n.label?e.localize("commandColumnMenu"):n.label,r=n.icon;l&&o?(i+='<span class="smart-grid-icon '+r+'"></span>',i+='<span class="smart-grid-label">'+a+"</span>"):l&&!o?i+='<span class="smart-grid-icon '+r+'"></span>':o&&!l&&(i+='<span class="smart-grid-label">'+a+"</span>"),i+="</div>",n.visible&&(t.label.innerHTML=i)}const o=t.column.getProperty("selected");if(!1===o&&t.hasAttribute("selected")?t.removeAttribute("selected"):!0===o?t.setAttribute("selected",""):null===o&&t.setAttribute("selected","indeterminate"),t.column.allowSortButtonAnimation?t.sortButton.classList.add("smart-animate"):t.sortButton.classList.remove("smart-animate"),e.dragDrop&&e.dragDrop.column===t.column?t.classList.add("dragged"):t.classList.remove("dragged"),t.column.sorted?t._showSortButton(!1):t._hideSortButton(!1),t.column.sorted?(t.setAttribute("aria-sort","asc"===t.column.sortOrder?"ascending":"descenting"),t._updateSortOrder()):(t.removeAttribute("aria-sort"),t.removeAttribute("sort-index")),(t.column.autoShowFilterButton||t.column.showFilterButton)&&(t.column.filtered?t._showFilterButton(!1):t._hideFilterButton(!1)),t.column.allowFilterButtonAnimation?t.filterButton.classList.add("smart-animate"):t.filterButton.classList.remove("smart-animate"),t.column.allowActionButtonAnimation&&!1!==t.allowAnimations?t.buttonsGroup.classList.add("smart-animate"):t.buttonsGroup.classList.remove("smart-animate"),t.column.allowLabelAnimation&&!1!==t.allowAnimations?t.label.classList.add("smart-animate"):t.label.classList.remove("smart-animate"),t.buttonsGroup.classList.remove("action"),t.actionButton.classList.contains("show")&&t.buttonsGroup.classList.add("action"),t.column.showIcon?(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon","")):(t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon","")),t.icon.classList.contains("show"))if(t.icon.className="smart-grid-icon show column-icon",t.column.icon&&t.column.icon.indexOf(" ")>=0){const e=t.column.icon.trim().split(" ");for(let o=0;o<e.length;o++)t.icon.classList.add(e[o])}else t.icon.classList.add(t.column.icon);let l=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&l++;switch(l){case 1:t.label.classList.add("one");break;case 2:t.label.classList.add("two");break;case 3:t.label.classList.add("three");break;case 4:t.label.classList.add("four");break;case 5:t.label.classList.add("five");break;case 6:t.label.classList.add("six")}t.classList.remove("smart-visibility-hidden"),t.column.grid._columnGap>0?t.classList.add("smart-grid-column-border"):t.classList.remove("smart-grid-column-border"),t.column.grid.appearance.showColumnHeaderLines?t.classList.remove("smart-grid-vertical-border-collapse"):t.classList.add("smart-grid-vertical-border-collapse"),(!t.column.rotationAngle||t._rotate())&&t._align()}_renderTemplate(){const t=this,e=t.column,o=e.labelTemplate;let l="";if("function"!=typeof o){if(o instanceof HTMLTemplateElement)l=o;else{if("string"!=typeof o||!o.startsWith||!o.startsWith("#"))return void(t.label.innerHTML=o);l=document.querySelector(o)}if(l){let o=l.content.cloneNode(!0).firstElementChild,n=e.label;n=n.toString(),n=n.replace(/'/gi,"\\'"),n=n.replace(/"/gi,'\\"');const i=o.outerHTML.replace(/{{value}}/gi,n).replace(/{{id}}/gi,e.label);t.label.innerHTML=i}}else t.label.innerHTML=o(e.label)}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;if(t.column.labelTemplate?t._renderTemplate():t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(t.column.label.indexOf("&")>=0||"SPAN"!==t.label.firstChild.nodeName?t.label.innerHTML="<span>"+t.column.label+"</span>":t.label.firstChild.textContent=t.column.label):t.label.innerHTML="<span>"+t.column.label+"</span>",t.column.title?t.setAttribute("title",t.column.title):t.removeAttribute("title"),t.column.tooltip&&(t.onmouseenter=e=>{t.column.tooltip&&t.column.grid._createTooltip(e,t.column.tooltip,t,"top")},t.onmouseleave=()=>{t.column.grid._cellTooltip&&(t.column.grid._cellTooltip.style.visibility="hidden")}),t._refresh(),t.column.autoGenerated&&t.setAttribute("auto-generated",""),t.column.autoGenerated||o){if(t.style.width=t.column.computedWidth+"px",t.column.grid.appearance.showRowComments&&t.column.rowHeaderColumn){const e=t.column.grid.rowDetailColumn,o=e?e.width:0;t.style.width=t.column.computedWidth+o+"px",t.style.zIndex=5}}else t.style.width=t.column.computedWidth-t.column.grid._columnGap+"px";if(t.style.height!==t.column.computedHeight+"px"&&(t.style.height=t.column.computedHeight+"px"),t.style.lineHeight!==t.column.computedHeight+"px"&&(t.style.lineHeight=t.column.computedHeight+"px"),t.column.grid.rightToLeft?t.style.right!==t.column.left+"px"&&(t.style.right=t.column.left+"px"):t.style.left!==t.column.left+"px"&&(t.style.left=t.column.left+"px"),t.style.top!==t.column.top+"px"&&(t.style.top=t.column.top+"px"),t.getAttribute("data-field")!==e&&t.setAttribute("data-field",e),t.setAttribute("header",""),t.column.freeze&&t.setAttribute("freeze",""),t.column.level>0&&(t.style.top=t.column.top+"px"),t.column.detailColumns&&t.column.detailColumns.length>0){const e=t.column.grid,o=e=>{e.classList.remove("smart-hidden"),t.column.element.label.appendChild(e),t.column.element.label.style.display="flex",t.column.element.label.style.justifyContent="space-between"};if(t.column._collapseButton&&!t.column._collapseButton.parentNode&&delete t.column._collapseButton,t.column._collapseButton)return void o(t.column._collapseButton);const l={},n=[];for(let o=0;o<t.column.detailColumns.length;o++){const l=e.columnByDataField[t.column.detailColumns[o]];l&&n.push(l)}l.inline=!0,l.columns=n,l.collapsed=t.column.collapsed,l.column=t.column,e._initializeColumnGroupCollapsing(l);const i=l.collapseButton;i&&(l.column._collapseButton=i,o(i),e._detailColumns||(e._detailColumns=[]),e._detailColumns[t.column.dataField]=!0)}else{const e=t.column.grid;e._detailColumns&&!e._detailColumns[t.column.dataField]&&t.label.querySelector(".smart-grid-column-group-collapse-button")&&t.label.querySelector(".smart-grid-column-group-collapse-button").remove()}t.column.headerTemplate&&t.column.headerTemplate(t.label)}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_initialize(t){const e=this;e._isInitialized=!1;const o=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),c.classList.add("smart-drag-handle"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),l.classList.add("smart-sort-button","smart-grid-icon"),n.classList.add("smart-filter-button","smart-icon-filter","smart-grid-icon"),i.classList.add("smart-action-button","smart-grid-icon"),i.setAttribute("aria-haspopup",""),a.classList.add("smart-description-button","smart-icon-help-circled","smart-grid-icon"),r.classList.add("smart-custom-button",t.customButtonIcon?t.customButtonIcon:"smart-icon-tools","smart-grid-icon"),d.classList.add("smart-buttons-group"),i.innerHTML="<div></div>",e.style.width=e.column.computedWidth+"px",e.appendChild(c),e.appendChild(s),e.appendChild(o),e.appendChild(d),d.appendChild(l),d.appendChild(n),d.appendChild(a),d.appendChild(r),d.appendChild(i),e.handle=c,e.icon=s,e.label=o,e.sortButton=l,e.filterButton=n,e.actionButton=i,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=d,e._properties=[];const u=window.PointerEvent?"pointerdown":"mousedown",m=window.PointerEvent?"pointerup":"mouseup";e._filterDownEvent=function(t){"col-resize"!==t.target.style.cursor&&(t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t))}.bind(e),e._filterUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionDownEvent=function(t){t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t)}.bind(e),e.filterButton.addEventListener(u,e._filterDownEvent),e.filterButton.addEventListener(m,e._filterUpEvent),e.actionButton.addEventListener(m,e._actionUpEvent),e.actionButton.addEventListener(u,e._actionDownEvent),!e.column.autoShowActionButton&&e.column.showActionButton&&e._showActionButton(),!e.column.autoShowSortButton&&e.column.showSortButton&&e._showSortButton(),!e.column.autoShowFilterButton&&e.column.showFilterButton&&e._showFilterButton(),e.column.showDescriptionButton&&e._showDescriptionButton(),e.column.showCustomButton&&e._showCustomButton(),e.column.showIcon&&e._showIcon(),"_rowHeaderColumn"===e.column.dataField&&e.classList.add("top-near-corner"),e.customButton.onclick=function(t){e.column.onCustomButtonClick&&e.column.onCustomButtonClick(t)}.bind(e),e.column.sorted||e.column.sortOrder?(e.column.sorted=!0,e.setAttribute("aria-sort","asc"===e.column.sortOrder?"ascending":"descenting"),e._updateSortOrder()):(e.removeAttribute("aria-sort"),e.removeAttribute("sort-index")),e._properties=[],e._isInitialized=!0}template(){return""}_detach(){const t=this,e=window.PointerEvent?"pointerdown":"mousedown",o=window.PointerEvent?"pointerup":"mouseup";t.filterButton.removeEventListener(e,t._filterDownEven),t.filterButton.removeEventListener(o,t._filterUpEvent),t.actionButton.removeEventListener(o,t._actionUpEvent),t.actionButton.removeEventListener(e,t._actionDownEvent),t.element=null,t.column&&(t.column.grid=null,t.column.element=null),t.icon=null,t.label=null,t.sortButton=null,t.filterButton=null,t.actionButton=null,t.descriptionButton=null,t.customButton=null,t.buttonsGroup=null,t.column=null,delete t.grid,delete t.column,delete t.icon,delete t.label,delete t.sortButton,delete t.filterButton,delete t.actionButton,delete t.descriptionButton,delete t.customButton,delete t.buttonsGroup}onDetached(){this._detach()}});
1443
1443
 
1444
1444
  /***/ }),
1445
1445
 
1446
1446
  /***/ 5306:
1447
1447
  /***/ (() => {
1448
1448
 
1449
- Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{ai:{type:"any",reflectToAttribute:!1,value:{model:{value:"gpt-4.1",type:"string"},maxTokens:{value:200,type:"number"},temperature:{value:.7,type:"number"},url:{value:"https://api.openai.com/v1/chat/completions",type:"string"},key:{value:"",type:"string",reflectToAttribute:!1},maxResponseLength:{value:100,type:"number"},promptVariables:{value:null,type:"any",reflectToAttribute:!1},prompts:{value:null,type:"any",reflectToAttribute:!1},includeUserPrompts:{value:!0,type:"boolean"}}},appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnAutoPlaceholder:{value:!1,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowEditDialogDetails:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!1,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupCellLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"},showViewBarAsDropdown:{value:!1,type:"boolean"},viewBarAppendTo:{value:null,type:"any"}},type:"object"},behavior:{value:{autoDestroy:{value:!0,type:"boolean"},allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},allowMouseWheel:{value:!0,type:"boolean"},allowRenderCache:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowMobileHeight:{value:null,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"any"},fileName:{value:"SmartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"},headerContent:{value:null,type:"any",reflectToAttribute:!1},footerContent:{value:null,type:"any",reflectToAttribute:!1},addImageToCell:{value:null,type:"any",reflectToAttribute:!1},setRowHeight:{value:null,type:"any",reflectToAttribute:!1},cellFormatFunction:{value:null,type:"any",reflectToAttribute:!1},autoConvertFormulas:{value:!0,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},onlySelected:{value:!1,type:"boolean"},exportAsTable:{value:!1,type:"boolean"},exportStyles:{value:!0,type:"boolean"},formatData:{value:null,type:"any",reflectToAttribute:!1},getSpreadsheets:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},copyHeadersToClipboard:{value:!1,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:"auto",type:"any"},height:{value:null,type:"any"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemChart:{value:{command:{value:"contextMenuItemChartCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-chart",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemSelectRow:{value:{command:{value:"contextMenuItemSelectRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-check-squared",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemExpand:{value:{command:{value:"contextMenuItemExpandCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-resize-full",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemInsertRow:{value:{command:{value:"contextMenuItemInsertRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCloneRow:{value:{command:{value:"contextMenuItemCloneRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCut:{value:{command:{value:"contextMenuItemCutCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-cut",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCopy:{value:{command:{value:"contextMenuItemCopyCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-copy-record",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemPaste:{value:{command:{value:"contextMenuItemPasteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-paste",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemClear:{value:{command:{value:"contextMenuItemClearCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-close",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemComment:{value:{command:{value:"contextMenuItemAddCommentCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-comment",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsert:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:500,type:"any"},width:{value:800,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban","card","scheduler","timeline"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeInput:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeDataField:{value:"",type:"string",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},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},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array",reflectToAttribute:!1},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object",reflectToAttribute:!1},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},keys:{value:null,reflectToAttribute:!1,type:"any"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the SmartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",viewScheduler:"Calendar",viewTimeline:"Timeline",kanbanNone:"Blank",schedulerDescription:"Which date column would you like to use for this view? Your data would be placed based on the dates in this column.",schedulerDescriptionInfo:"A range of data would be displayed when a start date field has an associated due date field.",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',schedulerDateColumn:"Create a new date column",schedulerPromptLabel:"Using date column(s)",schedulerDateRangeColumn:"Create a new date range",schedulerToolLabel:"Using '{{column}}'",toolLabel:"Labeled by '{{column}}'",uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsert:"Insert column",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",contextMenuItemSelectRow:"Select row",contextMenuItemCloneRow:"Clone row",contextMenuItemInsertRow:"Insert row",contextMenuItemChart:"Chart range",contextMenuItemAddRow:"Add {{value}} rows",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Ctrl</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnDate:"Choose a date column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeAIQuery:"AI Button",dialogAddColumnTypeSparklines:"Sparklines",dialogAddColumnAIQuery:"AI Query",dialogAddColumnTypeAIQueryInfo:"Example: Write a short description for an article or choose a column to query by it",dialogAddColumnTypeUUID:"UUID",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnTypeVote:"Vote",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatMonthYear:"Month & Year",dialogAddColumnDateFormatCasualUS:"Casual US",dialogAddColumnDateFormatWeekdayOnly:"Weekday",dialogAddColumnDateFormatUS:"US",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatDecimalPlaces:"Decimal places",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnDotItems:"Show Dots",dialogAddColumnCustomItems:"Custom Items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkFieldMore:"Cascading readonly fields",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnListItemsEditError:"You cannot edit an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnBlankItem:"Blank Item",dialogAddColumnFormatting:"Rich Formatting",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",strikethrough:"Strikethrough",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",commentPlaceholder:"Leave a comment",noComments:"Leave a comment and collaborate with your team.",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Format",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:"Changed {{column}} from {{oldValue}} to {{newValue}}",nullRange:"Changed {{column}} to {{newValue}}",rowCreated:"Row Created",propertyUpdated:"{{value}} updated",propertyRemoved:"{{value}} removed",dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",copyURL:"Copy row URL",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}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",addAIFilter:" ✨︎ Ask AI",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",noOptions:"No options",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by '{{column}}'",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",expandCell:"Expand cell",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'SmartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'SmartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",tomorrow:"Tomorrow",yesterday:"Yesterday",formatColumn:"Format Column",formating:"Color",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",formatingBy:"Colored by '{{value}}'",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",newScheduler:"Calendar",newTimeline:"Timeline",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",schedulerView:"View your records in a Calendar view",timelineView:"View your records in a Timeline view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows",columnPlaceholder:"Placeholder",pieChart:"Pie",columnChart:"Column",barChart:"Bar",stackedChart:"Stacked",lineChart:"Line",projectStatus:"Project Status",reviewStatus:"Review Status",taskStatus:"Task Status",priority:"Priority",size:"Size",yesNo:"Yes/No/Maybe",backlog:"Backlog",notStarted:"Not Started",underReview:"Under review",approved:"Approved",rejected:"Rejected",blocked:"Blocked",completedStatus:"Completed",generate:"Generate",aiPrompt:"Enter your prompt for the AI:",agenda:"Agenda",checkStyle:"Style",noVotes:"No votes yet",votes:"Voted by {{value}}",clearContents:"Clear contents",paste:"Paste",minPromptChars:"Enter AI prompt. Min 20 chars.",aiResponse:"Response",noAIResponse:"No response from AI",promptSuggest:"Prompt Suggestions"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onCellValueChanged:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},allowListOpenOnContentClick:{value:!0,type:"boolean"},allowDynamicButtons:{value:!1,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},customCommandColumns:{value:null,type:"any"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","insertButton","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},sidePanel:{value:!1,type:"boolean"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},appendTo:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},searchCommand:{value:"search",allowedValues:["search","filter"],type:"string"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["Smart.menu.css","Smart.filterpanel.css","Smart.pager.css","Smart.grid.css","Smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' >\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' role='grid' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' style=\"opacity: 0.99\" role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler",mouseleave:"_mouseLeaveHandler"}}_mouseLeaveHandler(){const e=this;e.editing.addNewRow._insertButton&&e.editing.addNewRow._insertButton.classList.remove("show")}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template||"richText"===a.template)){e.preventDefault();let n=(e.clipboardData||e.originalEvent.clipboardData).items,i=null,r=0,s=0,d=[];for(let e=0;e<n.length;e++)if(0===n[e].type.indexOf("image")&&(i=n[e].getAsFile(),r++,null!==i)){let e={label:i.name,size:i.size},n=new FileReader;n.onload=function(n){s++;const i=n.target.result;e.value=i;let c=!1;for(let o=0;o<t.uploadSettings.userFiles.length;o++){const l=t.uploadSettings.userFiles[o];if(l.name===e.label||l.label===e.label){c=!0;break}}if(c||t.uploadSettings.userFiles.push(e),d.push(e),s===r){let e=t.getCellValue(o,l);e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...d];let n=e;if("richText"===a.template){const a=document.createElement("span");for(let t=0;t<e.length;t++){const o=document.createElement("img");o.src=e[t].value,o.title=o.name=e[t].label,a.appendChild(o)}t.setCellValue(o,l,a.outerHTML),n=a.outerHTML}else t.setCellValue(o,l,e);const i=t.rowById[o].getCell(l),r="";t.onCellUpdate&&t.onCellUpdate([i],[r],[e],(function(){t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[r],[e],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,r,e)}),t)}},n.readAsDataURL(i)}}}}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1;this._mobile&&(e.preventDefault(),e.stopPropagation())}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_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)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(t.isInShadowDOM){const t=e.getBoundingClientRect();let o=window.pageXOffset,l=window.pageYOffset,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){const e=a.parentNode;null!==a.scrollLeft&&(o+=a.scrollLeft),null!==a.scrollTop&&(l+=a.scrollTop);const t=a.getRootNode?a.getRootNode():null;if(t&&t instanceof ShadowRoot)a=t.host;else{if(!e||1!==e.nodeType)break;a=e}}return o+=window.pageXOffset,l+=window.pageYOffset,{top:t.top+l,left:t.left+o,right:t.right+o,bottom:t.bottom+l,width:t.width,height:t.height}}if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);if(super._upHandler(),t._spinTimeout&&clearTimeout(t._spinTimeout),t._spinInterval&&clearInterval(t._spinInterval),t._tapTimer&&clearTimeout(t._tapTimer),t._mobile&&e.originalEvent&&"pointercancel"===e.originalEvent.type)return;const l=()=>{if(t.editing.isEditing&&!t.editing.dialog.enabled){if(t._hasRichTextEditor)return;setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(o.element&&o.element&&o.element.firstElementChild&&o.element.firstElementChild.hasAttribute("aria-owns")){const t=o.element.firstElementChild.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}else if(t.editing.editRow){const o=t.editing.editRow.cells;for(let t=0;t<o.length;t++){const l=o[t];if(l&&l.editor&&l.editor.instance){if(l.editor.instance.element&&l.editor.instance.element.hasAttribute("aria-owns")){const t=l.editor.instance.element.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(l.editor.instance.element&&l.editor.instance.element.firstElementChild&&l.editor.instance.element.firstElementChild.hasAttribute("aria-owns")){const t=l.editor.instance.element.firstElementChild.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(l.editor.instance.blur(e),e.defaultPrevented)return}}}t.isAttached&&t.endEdit()}}),50)}};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const l=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),i=n.querySelectorAll("smart-date-input"),r=n.querySelectorAll("smart-input");for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;for(let e=0;e<r.length;e++)if(r[e].$.scrollView.contains(o))return;return t.closeMenu(),t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e)}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._mobile||this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;if(t._mobile)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l),i=t.parentElement,r=i?i.scrollTop:0,s=i?i.scrollLeft:0;if(n.left-s<=e.pageX&&n.left-s+a.width-10>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),i("doubleClick"),t._onColumnDoubleClick(o,e)),Smart.Utilities.Core.isMobile){const o=t.rightToLeft?a.getBoundingClientRect().left:a.getBoundingClientRect().right,n=10;if(o-n<=e.clientX&&e.clientX<=o+n){const o=t.columnByDataField[l];if(!o||o&&!o.allowResize)return;const n=t._isLastVisibleColumn(o);if("split"===t.behavior.columnResizeMode&&n)return;a.style.cursor="col-resize",a.sortButton.style.cursor="col-resize",a.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(a),t._columnToResizeElement=a,t._columnToResizeDataField=l,e.preventDefault(),e.originalEvent&&e.originalEvent.preventDefault()}}if(t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null,d=null,c=null,u=null,m=null;t._lastPointerDownTime=new Date;for(let p=0;p<a.length;p++){const g=a[p];if(g.hasAttribute("toggle-button")&&(i=g),g.hasAttribute("add-row")&&(d=g),g.hasAttribute("checkbox")&&(r=g),"A"===g.nodeName&&e.ctrlKey&&g.click(),g.hasAttribute("rating-value")&&(c=g),g.hasAttribute("vote-value")&&(u=g),!s&&"smart-grid-cell"===g.nodeName.toLowerCase()&&!g.classList.contains("smart-grid-filter-row-cell")){if(s=g,g.hasAttribute("data-type")&&"string"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit&&!s.cell.column.autoGenerated){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id"),n=g.getBoundingClientRect(),i=t.columnByDataField[l];if(o>=n.right-20&&("tags"===i.template||"list"===i.template||"dropdownlist"===i.template||"combobox"===i.template))return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"date"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id");if(o>=g.getBoundingClientRect().right-20)return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"number"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const a=g.getAttribute("data-field"),n=g.closest("smart-grid-row").getAttribute("data-id"),i=g.getBoundingClientRect();if(o>=i.right-20){const o=()=>{let e=t.getCellValue(n,a);null!=e&&""!==e||(e=0);const o=e;let r=1;const s=t.columnByDataField[a];s&&s.formatSettings&&s.formatSettings.Intl&&("percent"===s.formatSettings.Intl.NumberFormat.style&&(r=.01),"currency"===s.formatSettings.Intl.NumberFormat.style&&void 0===s.formatSettings.Intl.NumberFormat.minimumFractionDigits&&(r=.01),s.formatSettings.Intl.NumberFormat.minimumFractionDigits>0&&(r=.01)),l>=i.top&&l<=i.bottom-i.height/2?e+=r:e-=r,s.editor&&(e>s.editor.max&&(e=s.editor.max),e<s.editor.min&&(e=s.editor.min)),t.setCellValue(n,a,e);const d=t.rowById[n].getCell(a);t.onCellUpdate&&t.onCellUpdate([d],[o],[e],(function(){t.onCellUpdated&&t.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[e],t),t._onCellUpdated&&t._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,e)}),t)};return o(),clearTimeout(t._spinTimeout),t._spinTimeout=setTimeout((()=>{clearTimeout(t._spinTimeout),t._spinInterval=setInterval((()=>{t._spinInterval&&o()}),50)}),150),e.stopPropagation(),void e.preventDefault()}}}if(!m&&g.classList.contains("smart-card")&&(m=g),!n&&"smart-grid-row"===g.nodeName.toLowerCase()){n=g;break}}if("card"===t.view){if(m){const o=m.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(m.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;m.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}return}c&&(t._ratingElement=c),u&&(t._voteElement=u);const p=!!e.originalEvent&&3===e.originalEvent.which;if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn&&!p){const e=n.row;if(t._overlay||e.header&&"row-resize"===e.header.style.cursor||e.header&&"row-resize"===e.header.parentElement.style.cursor)return;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(t._overlay||o.header&&"row-resize"===o.header.style.cursor||o.header&&"row-resize"===o.header.parentElement.style.cursor)return;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize&&(t._rowToResize.onpointerup=null),t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,c=e.originalEvent?e.originalEvent:e,u=3===c.which;if(u||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),u&&t.contextMenu.enabled){t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField;const e=t.getSelectedCells();let a=!0;if(t.contextMenu.dataField&&!t.contextMenu.dataField.startsWith("_"))if(e.length){for(let t=0;t<e.length;t++){const n=e[t],i=n[0],r=n[1];if(""+i==""+o.id&&l.column.dataField===r){a=!1;break}}t._focusCell(o.id,l.column.dataField,a),a&&t._selectCellsRange(o,o,l.column.dataField,l.column.dataField)}else{const e=t.getSelectedRowIds();(0===e.length||e.length>1)&&(t._focusCell(o.id,l.column.dataField),t._selectCellsRange(o,o,l.column.dataField,l.column.dataField))}else t._copyRects&&t._copyRects.length&&t.clearSelection(),t.selectRow(o.id);return t.openContextMenu(c.pageX+10,c.pageY+10),void(t.contextMenu.selector&&(c.stopPropagation(),c.preventDefault()))}if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}refreshRelations(){const e=this;if(e.dataSourceSettings&&e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length){for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&(o._isDirty=!0)}e._recycle(!1);for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&delete o._isDirty}}}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){if("object"==typeof e)return o&&o.columns&&(l.__measuredColumnHeight=null),void l.render();switch(l._notify(e,t,o),e){case"dataSourceSettings_relations":return void l.refreshRelations();case"dataSourceSettings_transpose":return void l.render();case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban?(l._kanban.selectTask(o),l._kanban.ensureVisible(o)):"scheduler"===l.view&&l._scheduler&&l._scheduler.focusEvent(o);break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return l._setLoadingIndicatorVisibility(),void l._recycle(!1);case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnGroupLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":if(l.header.visible&&""===l.header.template){let e=l.$.header;l.header.appendTo&&(e=document.querySelector(l.header.appendTo),e?e.onclick=e=>{l._headerClickHandler(e)}:e=l.$.header),e.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=e.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar)}break;case"header_buttons":l.header.visible&&""===l.header.template&&l._refreshHeaderBar();break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection&&(l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index})}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l.grouping.groupBar.visible&&l._renderGroupBar(),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":{l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(l.columns&&l.columns.length)for(let t=0;t<l.columns.length;t++)if(l.columns[t].freeze){e=!0;break}if(e&&l._initializeRowElements(),l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}l._renderColumns(),l._refreshHeaderBar();const o=l._sortedColumns;if(o){l.clearSort();for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;l._refreshSort(o)}if(l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return l.layout.isDirty=!0,l._resetCachedLayout(),void l._refreshLayout()}case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":delete l._isFirstVirtualDataSourceRequest,l._isUpdating&&l.endUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.editor&&(delete t.editor.isInitialized,delete t.editor.dataSource,delete t.editor._items,t.options&&(t.editor.dataSource=t.options),t.editor.isDirty=!0),t._cellsCachedValues=[],delete l._cellCachedValues,l._cellEditors=[]}if("dataSource"===e&&t&&o){const e=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&"infinite"!==l.scrolling,a=e=>Array.isArray(e)&&e.every((e=>Array.isArray(e)));if(o&&a(o)){const e=[];for(let t=0;t<o.length;t++){const a={};for(let e=0;e<l.columns.length;e++){const n=l.columns[e];let i=o[t][e];if(n.options){const e=n.options.find((e=>e.label===i||e.value===i));e&&(i=e.value)}"date"===n.dataType&&null!==i&&(i=new Smart.Utilities.DateTime(i).toDate()),a[n.dataField]=i}e.push(a)}o=e}if(t instanceof Smart.DataAdapter&&!e){if(t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.childrenDataField&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&l.dataSource&&l.dataSource._expandedRowIds){let t={};for(let e in l.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}l.beginUpdate();const a=l._sortedColumns;l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId()&&l.clearSort();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e]?l.dataSource[e].$.id:e;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const n=l._filters;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(a&&l._refreshSort(a),n&&n.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}if(l.dataSource&&l.dataSource.url&&l.filtering.enabled&&l.filtering.filterRow.visible){let e=!1;for(let t=0;t<l.columns.length;t++)l.columns[t]._filterEditorInitialized&&(e=!0),l.columns[t]._filterEditorInitialized=!1;e&&setTimeout((()=>{l._refreshFilterRowEditors(),l.refreshFilters(),l._recycle(!1)}),100)}}}return l.dataSource&&l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"row"!==l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.$.content.removeAttribute("aria-readonly"):l.$.content.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"layout_isDirty":return;case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){const e=this;e.disableSwipeScroll=!0,super.ready(),e._renderInDropDown();const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].loadingIndicatorPlaceholder?e.localize("loadingIndicatorPlaceholder"):e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e._details=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];if(e.filtering.enabled&&0===e._filterPanels.length){if(e.header.visible&&e.header.buttons.indexOf("filter")>=0)return;requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};if(e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const c=e._measureRowElement(o[0].data),u=o.length;for(let s=0;s<u;s++){let d=o[s];if(!d.visible||!1===d.filtered){d.height=0,d.cellHeight=0,d.top=l;continue}const u=e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled;let m=!d.height||!d.cellHeight||u||"auto"===d.height||"auto"===d._height||"auto"===e.layout.rowHeight||e.layout.isDirty;if(t&&d.height!==r&&(d.height=d.cellHeight=r),m&&!d.expandHeight){if(d.detailHeight||(d.detailHeight=200),t)d.height=d.cellHeight=r;else if(e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.height=e.layout.rowHeight,d.computedHeight&&(d.height=d.computedHeight),d.minHeight>d.height&&(d.height=d.minHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.element=c,d.grid=e,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a,o=d.canNotify;d.canNotify=!1,d.height=t,d.computedHeight&&(d.height=d.computedHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight),d.canNotify=o}else e.layout.rowHeight(s,d),d.height||(d.height=a),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}else{if("auto"===d.height||"auto"===d._height){d.element=c,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a;d.height=t,d._height="auto"}else d.height=a;void 0===d.label||d.summaryRow||"advanced"!==e.grouping.renderMode||(d.height=e.grouping.groupRowHeight),d.computedHeight&&(d.height=d.computedHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}e._rowGap&&s<e.rows.length-1&&(d.height+=e._rowGap)}!t&&(!0===d.freeze||"near"===d.freeze?d.visible&&(n+=d.height):"far"===d.freeze&&d.visible&&(i+=d.height),d.freeze&&d.visible)?d.top=l:(d.top!==l&&(d.top=l),d.expandHeight?l+=d.cellHeight:l+=d.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(l+=1*a),e.editing.addNewRow&&"row"!==e.editing.addNewRow.displayMode&&(l+=1*a),e.filtering&&e.filtering.filterRow.visible&&(n+=a+1),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(l+=a,"far"!==e.editing.addNewRow.position&&(n+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(l=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return t&&(l=r*Math.ceil(o.length/s)),e.__scrollHeight=l,e.__frozenNearHeight=n,e.__frozenFarHeight=i,e._scrollView.scrollHeight=l-e.$.scrollView.offsetHeight+n+i,l=e.__scrollHeight+n+i-1,e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(l+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=l,c.remove(),o[0]&&delete o[0]._isMeasureRow,e.rows.canNotify=!0,l}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.collapsible&&e._initializeColumnGroupCollapsing(o)}}_initializeColumnGroupCollapsing(e){const t=this;e.collapsed=e.collapsed||!1,e.collapseButton=document.createElement("div"),e.collapseButtonIcon=document.createElement("span"),e.collapseButton.appendChild(e.collapseButtonIcon),e.collapseButton.classList.add("smart-grid-column-group-collapse-button"),e.collapseButtonIcon.classList.add("smart-grid-icon",e.collapsed?"smart-icon-right":"smart-icon-left","show"),e.collapseButton.setAttribute("role","button"),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"));const o=(e,l)=>{if(e.collapsed=l,e.collapseButtonIcon.classList.remove("smart-icon-left"),e.collapseButtonIcon.classList.remove("smart-icon-right"),e.collapsed?e.collapseButtonIcon.classList.add("smart-icon-right"):e.collapseButtonIcon.classList.add("smart-icon-left"),t.beginUpdate(),e.collapsed){const t=e=>{let t=0;for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.allowCollapse&&(l.visible=!1,t++)}t===e.columns.length&&e.columns[0]&&!e.inline&&(e.columns[0]._visible=!0,e.columns[0].visible=!0)};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}else{const t=e=>{for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}t.endUpdate(),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"))};e.collapsed&&requestAnimationFrame((()=>{o(e,e.collapsed)})),e.collapseButton.addEventListener("click",(function(t){t.stopPropagation(),o(e,!e.collapsed)}))}_refreshColumnHeights(){const e=this;if("card"===e.view)return;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,c=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,c+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=c,c+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(a.parent&&n.setAttribute("column-group",a.parent.name),a.parent&&a.parent.columns&&a.parent.columns[0].dataField===a.dataField&&n.setAttribute("column-group-first-child",""),l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this,n.onpointerdown=()=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let l=0;l<e.groups.length;l++)if(e.groups[l].columnGroup)o.push(e.groups[l]);else if(e.groups[l].groups){let a=t(e.groups[l]);for(let e=0;e<a.length;e++)o.push(a[e])}return o},o=t(l);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",!1===e.appearance.showColumnGroupLines&&e.setAttribute("appearance_hide-column-group-lines",""),e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e._autoHeight&&e.paging.enabled&&(e._overflowOffset=Math.max(o,e.paging.pageSize*e.layout.rowMinHeight)),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;if(t.summaryRow.visible)t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{if(!0!==t.editing.isEditing){t._calculateSummary();const o=t.$.headerBar;o&&o._updateTools&&o._updateTools(),!1!==e&&t._recycle(!1,!0,!1)}}),100);else{const e=t.$.headerBar;e&&e._updateTools&&e._updateTools()}}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[],e._frozenRowsById=[];let o=e._createdDate||new Date,l=void 0!==e._createdBy?e._createdBy:e.currentUser;const a=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a&&a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}));e._details[i]=s.showDetail}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0)}else if("far"===s.freeze){e.rows.push(s);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&(e._frozenFarRows.push(t),e._frozenRowsById[t.id]=!0)}}else e.rows[i]?(e.rows.splice(i,0,s),e.rows[i].index=e.rows.length):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(e._rowInsertedCallback=o,void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:i});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([i],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),r&&r(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([i],[t],o,e)}else{const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i];void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),r&&r(t)}},r=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._onRowRemoved&&e._onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},s=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._onRowRemoved&&e._onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=i,e._removeLastRow=r,e._removeAt=s,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length,c=e.onRowInserted;e.onRowInserted=null,e.$.content.setAttribute("aria-rowcount",d);const u=e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling;if(e.dataSource&&e.dataSource.virtualDataSource&&e.paging.enabled&&!e.dataSource.virtualDataSourceOnExpand)for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource[t],l=t+e.paging.pageIndex*e.paging.pageSize;e.dataSource.id||(o.$.id=l),i(o,l)}else if(u){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];i(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];i(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.onRowInserted=c,e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)i(o[t],e.dataSource.length-o.length+t);else i(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],n=[];for(let r=0;r<n.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=n[r],o.push(s),a.push(e.rows[s]),n.push(e.rows[s].data)):(i(n[r],n[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,n,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:i(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":i(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":s(t.index);break;case"removeLast":r();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),t.$&&o.$.pageSizeSelector&&(t.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0])),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),o.$&&o.$.pageSizeSelector&&(o.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0]))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0):"far"===o.freeze&&(e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}if(e.dataSource.id&&(null===l.data[e.dataSource.id]||void 0===l.data[e.dataSource.id])){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.data[e.dataSource.id]=t()}if(o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]){l.data=e.dataSource[o];for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t].name;e.dataSource.id&&o===e.dataSource.id||e.dataSource.keyDataField&&o===e.dataSource.keyDataField||e.dataSource.parentDataField&&o===e.dataSource.parentDataField||e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l),e._frozenRowsById[l.id]=!0),e._conditionalColors&&e._conditionalColors.update&&setTimeout((()=>{e._conditionalColors.update(),e._recycle(!1)}),100)})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l&&(l.data=o,l.id=o.$.id,e.rowById[l.id]=l)}return e.rows.canNotify=!0,e.refresh(),void e._refreshPaging(!1)}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(!1,o),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}setDropDownLabel(e){const t=this;t.$.dropDownElement&&(t.dropDownModeInput?t.$.dropDownElement.querySelector(".smart-action-button smart-input").value=e:t.$.dropDownElement.querySelector(".smart-action-button").innerHTML=e)}openDropDown(){const e=this;if(!e.dropDownMode)return;if(!e.$.dropDownPopup)return;const t=e.$.dropDownPopup,o=e.$.dropDownElement;o.setAttribute("active",""),o.querySelector(".smart-drop-down-button").setAttribute("active",""),(()=>{const l=0,a=0;if(e.layout.isDirty=!0,window.screen.availWidth<400)return t.open("left","top"),t.style.width=e.offsetWidth+"px",void(t.style.height=e.offsetHeight+"px");{const o={width:e.layout.dropDownWidth,height:e.layout.dropDownHeight};t.style.width="auto"===o.width?o.width:o.width+"px",t.style.height="auto"===o.height?o.height:o.height+"px"}const n=o;if(n){const o=e.offset(n),i=o.left-l,r=l,s=Math.max(r,i);t.open(s,o.top+n.offsetHeight-a)}else t.classList.add("center"),t.open("center","center");e.style.display=""})()}isDropDownOpened(){return!!this.$.dropDownElement.hasAttribute("active")}closeDropDown(){const e=this;e.dropDownMode&&e.$.dropDownPopup&&(e.$.dropDownElement.removeAttribute("active"),e.$.dropDownElement.querySelector(".smart-drop-down-button").removeAttribute("active"),e.$.dropDownPopup.close())}_renderInDropDown(){const e=this;if(e.dropDownMode&&(e.dropDownMode&&(e.style.display="none"),e.dropDownMode&&void 0===e._dropDownMode)){e._dropDownMode=!0;const t=document.createElement("div"),o=e._createPopup();if(o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span 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>\n </div>`,e.dropDownModeInput){const o=t.querySelector(".smart-action-button");o.innerHTML='<smart-input style="color: var(--smart-background-color); background: var(--smart-background); border-radius: 0px; width: calc(100% - 6px); height: calc(100% - 6px);"></smart-input>';const l=o.firstElementChild;l.onpointerdown=l.onclick=l.onpointerup=e=>{e.stopPropagation()},l.oninput=l.onchange=l.onkeyup=t=>{const o=e.rows||e.dataSource;clearTimeout(e._dropDownInputTimer),e._dropDownInputTimer=setTimeout((()=>{if(l.value.length>=2)for(let a=0;a<o.length;a++){const n=o[a],i=(""+(n.data?n.data:n)[e.dropDownModeDataField]).toLowerCase(),r=(""+l.value).toLowerCase();if(i.indexOf(r)>=0){"Enter"===t.key&&(l.value=i),e.selection.enabled&&(e.isDropDownOpened()||e.openDropDown(),e.rows&&(e.clearSelection(),e.selection.allowCellSelection?e.selectCell(n.id,e.dropDownModeDataField):e.selectRow(n.id),e.ensureVisible(n.id)));break}}}),300)}}if(t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],!e._popupDropDown){e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""};const l=()=>{if(e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}};o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen"),e.$.listen("cellClick",l)},o.onClose=function(){if(e.$.unlisten("cellClick"),e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())}}}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.$.content.setAttribute("role","grid"),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),void super.render();const o=e.context;e.context=e,e.$.content.setAttribute("role","grid"),"grid"!==e.view&&e.setAttribute("view",e.view),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}transpose(e,t=180,o){const l=this,a=l.dataSource,n=l.columns;if(!a||!n)return null;let i=[],r=[];i=a instanceof Smart.DataAdapter?a.boundSource.toArray():a,r=n.toArray();const s=[],d=[{label:"",dataField:"field",freeze:!0,width:150}];for(let l=0;l<i.length;l++){const a={label:i[l][e]||`Row ${l+1}`,width:t,dataField:String(l)};o&&o(a),d.push(a)}for(let e of r){const t={field:e.label||e.dataField};i.forEach(((o,l)=>{t[l]=o[e.dataField]})),s.push(t)}l.beginUpdate(),l.dataSource=new Smart.DataAdapter({dataSource:s}),l.columns=d,l.endUpdate(),l.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_setupMobile(){const e=this;if(void 0===e._mobile&&(e._mobile=Smart.Utilities.Core.isMobile),e._mobile){e.layout.rowMobileHeight&&(e.layout.rowMinHeight=e.layout.rowHeight=e.layout.columnMinHeight=e.layout.columnHeight=e.layout.rowMobileHeight),e.behavior.rowResizeMode="none",e.behavior.allowRowReorder=!1,e.selection.allowDragSelectionAutoScroll=!1,e._scrollView.vScrollBar.showButtons=!1,e._scrollView.hScrollBar.showButtons=!1,e.style.setProperty("--smart-scroll-bar-size","12px"),document.body.style.setProperty("--smart-data-view-sort-panel-width","345px"),e._scrollContent=document.createElement("div"),e._scrollContent.style.width="100%",e._scrollContent.style.height="100%",e._scrollContent.style.position="absolute",e._scrollContent.style.left="0px",e._scrollContent.style.top="0px",e._scrollContent.style.background="white",e._scrollContent.style.zIndex=9999,e._scrollContent.style.opacity=.1,e._scrollContent.style.overflow="auto",e.addEventListener("viewChange",(()=>{"grid"===e.view?e._scrollContent.classList.remove("smart-hidden"):e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("beginEdit",(()=>{e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("endEdit",(()=>{e._scrollContent.classList.remove("smart-hidden")})),e._scrollContent.ontouchend=()=>{e._mobileDownTime=null},e._scrollContent.ontouchmove=t=>{if(t.stopPropagation(),!e._scrollContentScroll&&e.selection.enabled&&e.selection.allowDragSelection&&e.selection.allowCellSelection&&e._mobileDownDataField&&void 0!==e._mobileDownId&&e._mobileDownTime&&new Date-e._mobileDownTime>=800){const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY});e._mobileSelect=!0,e._dragSelection(o("mousemove")),e._mobileSelect=!1,t.preventDefault()}},e._scrollContent.ontouchstart=e=>{e.stopPropagation()},e._scrollContent.onpointerup=t=>{if(e._dragSelectionStartDataField=null,e._dragSelectionStartRow=null,e._mobileDownDataField&&void 0!==e._mobileDownId){let o=null,l=null;const a=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);for(let t=0;t<a.length;t++){const n=a[t];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const t=n.closest("smart-grid-cell").cell;l=t.row.id,o=t.column.dataField;break}}new Date-e._mobileDownTime>=1e3&&e.editing.enabled&&e.selection.enabled&&e.selection.allowCellSelection&&o===e._mobileDownDataField&&l===e._mobileDownId&&e.beginEdit(e._mobileDownId,e._mobileDownDataField),e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null,t.preventDefault(),t.stopPropagation()}},e._scrollContent.onpointerdown=t=>{e._scrollContentScroll=!1;const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY});setTimeout((()=>{if(e._scrollContentScroll)e._hideActionButtons();else{const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);if(l[2]){if(e.selection.enabled&&e.selection.allowCellSelection){const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null;for(let a=0;a<l.length;a++){const n=l[a];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const a=n.closest("smart-grid-cell").cell;return e._mobileDownTime=new Date,e._mobileDownId=a.row.id,e._mobileDownDataField=a.column.dataField,e._dragSelectionStartDataField=a.column.dataField,e._dragSelectionStartRow=a.row,e._mobileSelect=!0,l[2].dispatchEvent(o("pointerdown")),e._mobileSelect=!1,t.stopPropagation(),void t.preventDefault()}}}if(l[2].classList.contains("smart-grid-add-row-button"))e._hideActionButtons(),l[2].dispatchEvent(o("click"));else if(l[2].classList.contains("smart-summary-placeholder")||l[2].classList.contains("summary-value-part"))e._hideActionButtons(),l[2].dispatchEvent(o("pointerup"));else if(l[2].closest("smart-menu-item")){e._hideActionButtons();const t=l[2].closest("smart-menu-item");l[2].closest("smart-menu")._menuItemSelectionHandler(t)}else{if(l[2].dispatchEvent(o("pointerdown")),e._lastMobileClickRange){const o=e._lastMobileClickRange;let l=!0;o.left<=t.pageX&&o.left+o.right>=t.pageX&&(l=!1),l&&e._hideActionButtons()}else e._hideActionButtons();const a=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=e.offset(l);if(n.left<=t.pageX&&n.left+a.width-6>=t.pageX){if(!e.hasColumnMenu(o))return;e._lastMobileClickRange={left:n.left,right:n.left+a.width-6},l._showActionButton()}else l._hideActionButton()}};for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t];a(o.column,o)}}}}}),300),t.stopPropagation()};let t=0;const o=()=>{const t=e._scrollContent.scrollLeft,o=e._scrollContent.scrollTop;e._scrollView.vScrollBar.value=o,e._scrollView.hScrollBar.value=t,e._scrollContentScroll=!0};e._scrollContent.onscroll=()=>{cancelAnimationFrame(t),t=0,t=requestAnimationFrame(o)},e._scrollContentView=document.createElement("div"),e._scrollContentView.style.width=e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e._scrollView.scrollHeight+"px",e._scrollContent.appendChild(e._scrollContentView),e.$.scrollView.appendChild(e._scrollContent)}}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&(e.header.buttons.indexOf("views")>=0||e.header.buttons.indexOf("states")>=0)&&e._updateKanbanTaskFields()),e._setupMobile(),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,id:e.dataSourceSettings.id,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e._initFormulaParser(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale;let o=e.$.header;e.header.appendTo&&(o=document.querySelector(e.header.appendTo),o?o.onclick=t=>{e._headerClickHandler(t)}:o=e.$.header),o.appendChild(t),e.$.headerBar&&e.$.headerBar.remove(),e.$.headerBar=o.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e.filtering.enabled&&e.filtering.filterRow.visible&&e._refreshFilterRowEditors(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view?e._initKanbanView():"scheduler"===e.view&&e._initSchedulerView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)?r=o.parse(r.slice(1)):"string"==typeof r&&"number"===l.columns[a].dataType&&(r=parseFloat(r)),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(e){const t=this,o=t.conditionalFormatting;if(!o||0===o.length)return;if(!t._defaults){const e=getComputedStyle(t);t._defaults={fontFamily:e.fontFamily,fontSize:e.fontSize,text:t._toHex(e.color),highlight:t._toHex(e.backgroundColor)}}t._formatter||(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource)),e&&(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource),delete t._conditionalFormatting);const l=t._defaults,a=t._formatter,n=[],i=function(e){if("all"===e){if(t.columns&&t.columns.map){const e=[];for(let o=0;o<t.columns.length;o++){const l=t.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||e.push(l.dataField)}return e}return[]}return[e]};for(let e=0;e<o.length;e++){o[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},o[e]);const t=o[e],r=i(t.column),s=t.condition;a.color=t.highlight,a.comparator=t.firstValue,a.min=t.firstValue,a.max=t.secondValue;const d=a.format(s,r);for(let e in d){const o=d[e];for(let e in o){const l=o[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=o),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}}t._conditionalFormatting=r,e&&t._recycle(!1)}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.$.content.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){if(l!==a||"selected"===o){if(null==l&&null==a)return;if(l&&"object"==typeof l&&Array.isArray(l)&&a&&"object"==typeof a&&Array.isArray(a)&&JSON.stringify(l)===JSON.stringify(a))return;t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a})}};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,e._hScrollTimer&&clearTimeout(e._hScrollTimer),e._hScrollTimer=setTimeout((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=15*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-15*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t._cellCachedValues=[],t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.$.content.setAttribute("role","treegrid"),t.$.container.removeAttribute("role")),(t.isInitialized||l)&&t._refreshColumnsResponsiveVisibility(),t._refreshLayout(),o!==t.$.verticalScrollBar.offsetWidth&&(t.__scrollWidth=null,t._refreshColumnsResponsiveVisibility(),t._refreshScrollBars(),0===t.$.verticalScrollBar.offsetWidth&&t.isRendered&&requestAnimationFrame((()=>{t._refreshScrollBars()}))),t._refreshSelection(),t._deleteCopyRects(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),"remove"===e?(t._recycle(!1),t._refreshHeaderBar()):t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),t.dataSource&&t.dataSource.boundHierarchy&&t.conditionalFormatting&&t._renderConditionalFormatting(!1),t.filtering.enabled&&t.filtering.filterRow.visible&&(t._suspendFilterRowRefresh||t._refreshFilterRowEditors(),t._recycle(!1)),requestAnimationFrame((()=>{t._width=t.offsetWidth,t._height=t.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return t._undoRedo=[],t._refreshCurrentUser(),void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return void(!1===t._resizeHandling&&(t.layout.isDirty=!0));t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view&&"card"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,c=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(c+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===c&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=c,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t._mobile&&e.preventDefault(),t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible&&!e.header.appendTo),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,l){for(let c=0;c<t.length;c++){const u=t[c];let m=o.rowById[u.$.id];if(n&&(m=o.rows[s],m||(m=r(u),o.rows.push(m)),u[i.leaf]?m.id=u.$.id:m.id="Group_"+u.$.id,o.rowById[m.id]=m),m||(m=r(u),o.rowById[m.id]=m),m.data=u,m.leaf=u[i.leaf]||!1,m.level=u[i.level],m.groupDataField=u.groupDataField,o.hasAttribute("tree")&&o.dataSource&&o.dataSource.childrenDataField&&(m.index=s),!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=u.label,m.groupDataField){const e=o.columnByDataField[m.groupDataField];if(e&&e.editor.dataSource)for(let t=0;t<e.editor.dataSource.length;t++){const o=e.editor.dataSource[t];if(""+o.value===m.label){void 0!==o.label?(m.label=o.label,m.labelValue=o.value):void 0!==o.name&&(m.label=o.name,m.labelValue=o.value);break}}}if(m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),u.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),u.parent?(m.parent=o.rowById[u.parent.$.id],m.parentId=u.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(u);e&&(m.expanded=u[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==u[i.expanded]&&(m.expanded=u[i.expanded]);let p=!!e||m.expanded;a&&(p=!0);const g=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(g&&!m.data[g]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];u.parent&&u.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[g])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,p||u[i.leaf])if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let c=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<c.length;o++){let l=c[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;!a&&null!==a||0!==l.level||l.parent||(t(l.children).length,e.push(l))}c=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}const u=o.rows.canNotify;o.rows.canNotify=!1,o.rowHierarchy=d(c,new Array),o.rows.canNotify=u;let m=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&m.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=m),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow){o._initializeRowElements();let e=0,t=o.rows.canNotify;o.rows.canNotify=!1;for(let t=0;t<o.rowHierarchy.length;t++){const l=o.rowHierarchy[t],a=o.layout.rowHeight||o.layout.rowMinHeight;void 0===l.top&&(l.top=e,l.height=l.cellHeight=a),l.height?e+=l.height:e+=a}o.rows.canNotify=t,o._recycle(!1,!0)}if(o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible,e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),c=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=c,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px"),e.filtering.enabled&&e.filtering.filterRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||c>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-c+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",c+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",c+e.__scrollBarSize+"px"))),t.refresh(),o.refresh(),e._mobile&&(e._scrollContentView.style.width=e.$.scrollView.offsetWidth+e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e.$.scrollView.offsetHeight+e._scrollView.scrollHeight+"px")}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getData(){const e=this;if(!e.dataSource)return[];const t=[];for(let o=0;o<e.dataSource.length;o++){const l=e.dataSource[o];if(l.$){const o={};for(let t=0;t<e.dataSource.dataFields.length;t++){const a=e.dataSource.dataFields[t].name;o[a]=l[a]}t.push(o)}else t.push(l)}return t}getDataFields(){const e=this;return e.columns?e.columns.map((e=>e.dataField)):[]}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}resetState(e=!0){const t=this;t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border",t._conditionalColors.update=()=>{}),t.$.headerBar&&delete t.$.headerBar._appliedColors,delete t._labeledBy,delete t._dateStackedBySelect,t.highlighted=null,t.columns.canNotify=!1;let o=[],l=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?o[a.index]=a:o.push(a),a.index!==e&&(l=!0)}l&&(t.columns=o),"grid"!==t.view&&e&&(t.view="grid",t._hideKanbanView(),t._hideSchedulerView()),t.columns.canNotify=!0,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.$.headerBar&&t.$.headerBar._setView&&"grid"===t.view&&t.$.headerBar._setView("grid"),t._kanban&&t._kanban._reset(),t.layout.isDirty=!0,t.endUpdate(),l&&(t._renderColumns(),t._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1,n=!1;if("grid"===e.view||"card"===e.view||void 0===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}else if(t.grouping.enabled&&t.dataSource.groupBy.length)for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0);t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());let a=[];for(let o=0;o<e.columns.length;o++){const i=e.columns[o];if(i.dataField){const e=t.columnByDataField[i.dataField];if(e){const r=e.canNotify;e.canNotify=!1,i.width?e.width=i.width:e.width=180,e.sortOrder="",e.sorted="",a.push(e),e.index!==o&&(n=!0),e.visible=void 0===i.visible||i.visible,e._state&&(e._state.visible=void 0===i.visible||i.visible,e._state.freeze=void 0!==i.freeze&&i.freeze,e._state.width=i.width?i.width:180);const s=e.freeze;e.freeze=void 0!==i.freeze&&i.freeze,s!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=r}}}n&&(t.columns=a)}}if(e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let l=[];if(e.colors.conditions)for(let t=0;t<e.colors.conditions.length;t++){let o=e.colors.conditions[t],a=[];for(let e in o)a.push(o[e]);l.push(a)}o||(o=!0,t.beginUpdate());const a={type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate};t.$.headerBar._appliedColors=[l,a],t._conditionalColors.update=e=>{t.$.headerBar._updateConditionalColors(e,t,a)}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort){const l=e.sort[o];if(l){const e=l.sortOrder,a=l.dataField?l.dataField:o,n=t.columnByDataField[a];n&&t.sortBy(n.dataField,e)}}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){let l=o,a=e.filter[l];if(e.filter[0]&&(l=e.filter[o].dataField,a=e.filter[o].filter),a){t.addFilter(l,a,!1);const e=t.columnByDataField[l];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(e.selectedCells&&(o||(o=!0,t.beginUpdate()),t.selectCellsById(e.selectedCells)),e.selectedRows&&t.selectRows(e.selectedRows),e.labeledBy&&(t._labeledBy=e.labeledBy),o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),(l||n)&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let i=!1;if(e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(i=!0),t._stackedBy=e.kanban.stackedBy),e.scheduler&&e.scheduler.stackedBy&&(void 0===t._dateStackedBy&&(t._dateStackedBy=e.scheduler.stackedBy),t._dateStackedBy!==e.scheduler.stackedBy&&(i=!0),e.scheduler.labeledBy&&(t._labeledBy=e.scheduler.labeledBy),e.scheduler.viewType&&(t._schedulerViewType=e.scheduler.viewType),void 0===t._dateStackedBySelect&&(t._dateStackedBySelect=e.scheduler.groupBy),t._dateStackedBySelect!==e.scheduler.groupBy&&(i=!0),t._dateStackedBy&&Array.isArray(t._dateStackedBy)&&e.scheduler.stackedBy&&Array.isArray(e.scheduler.stackedBy)&&JSON.stringify(t._dateStackedBy)===JSON.stringify(e.scheduler.stackedBy)&&(i=!1),t._dateStackedBy=e.scheduler.stackedBy),(i||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.selectedCells){const o=[];let l=99999999,a=null,n=99999999,i=null,r=99999999,s=null;for(let l=0;l<e.selectedCells.length;l++){const a=e.selectedCells[l],d=a[0],c=a[1],u=t.columnByDataField[c];if(u&&(n=Math.min(n,u.index),i=Math.max(i,u.index)),!t.rowById[d])continue;const m=t.rowById[d].visibleIndex;m>=0&&(r=Math.min(r,m),s=Math.max(s,m)),o[d]||(o[d]=[]),o[d].push(c)}let d=0,c=!0;for(let e in o){const t=o[e];if(d&&t.length!==d){c=!1;break}d=t.length}if(c){const e=t.getRows(),o=e[r],d=e[s];if(l=o?o.id:-1,a=d?d.id:-1,o){const e=t.columns[n];if(e){const o=t.rowById[l].getCell(e.dataField);t._selection.focusedCell={id:o.row.id,value:o.value,dataField:o.column.dataField,index:o.row.index},setTimeout((()=>{t._selectCellsRange(t.rowById[l],t.rowById[a],t.columns[n].dataField,t.columns[i].dataField)}),50)}}}}e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),delete t._labeledBy,delete t._dateStackedBySelect,t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)||o.stateSettings.onStateChange&&o._forceStateChange?o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r):o.stateSettings.onStateChange&&"grid"!==o.view&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;e._savingState&&clearTimeout(e._savingState),e._savingState=setTimeout((()=>{if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){let t=e.localize("newGrid")+" "+e.localize("view");"kanban"===e.view?t=e.localize("newKanban")+" "+e.localize("view"):"card"===e.view?t=e.localize("newCard")+" "+e.localize("view"):"scheduler"===e.view&&(t=e.localize("newScheduler")+" "+e.localize("view")),e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}),50)}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t){const o=this;o._conditionalColors={type:t.type,decorate:t.decorate,conditions:e,singleSelect:t.singleSelect},o.$.headerBar.addColors(JSON.parse(JSON.stringify(e)),{type:t.type,singleSelect:t.singleSelect,decorate:t.decorate},[]),o._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells(!1):null,i=!e||e&&e.includes("selection")?t.getSelectedRowIds():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const c={count:d,index:t.paging.pageIndex,size:t._pageSize},u={};o&&o.length&&(u.sort=o),l&&l.length&&(u.filter=l),a&&a.length&&(u.groups=a),c&&t.paging.enabled&&(u.paging=c),n&&n.length&&(u.selectedCells=n),i&&i.length&&(u.selectedRows=i),s&&(delete s.colors,u.colors=s),t._labeledBy&&(u.labeledBy=t._labeledBy),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"===t.view&&(u.kanban=t.getKanbanState()),"scheduler"===t.view&&(u.scheduler=t.getSchedulerState()),u.view=t.view);const m=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&m.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}u.columns=m}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}Object.values(e).length&&(u.expandedRows=e)}if((t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"!==t.view&&"scheduler"!==t.view||(delete u.expandedRows,delete u.columns,delete u.paging,delete u.selectedCells,delete u.selectedRows)),e){const t={};for(let o in e){const l=e[o];u[l]&&(t[l]=u[l])}return t}return u}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),o.column.element.setAttribute("level",o.level),0===o.columns.length&&o.column.element.classList.add("smart-hidden");const l=o.collapseButton;l&&o.column.element.appendChild(l),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o,l){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(!0===a._disableEndEdit||a.editing.dialog.visible||a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],c=d?d.top:0,u=0,m=0,p=0,g=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(r>=5?e=5:r>=4?e=4:r>=3?e=3:r>=2?e=2:r>=1&&(e=1),e>0){const t=s[r-e];t&&(d=t,c=d?d.top:0,p=e*d.height,r-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=s.indexOf(t.row);if(r>o&&r<=o+t.rowSpan&&(r=o,d=t.row,p=Math.max(p,c-d.top),c=d.top,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=u&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];g=Math.max(g,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let h=null;if(!1!==e||a._cellsMerge.length>0){if(a._columnElements)for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._firstVisibleUserColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._firstVisibleUserColumn||t.autoGenerated||(a._firstVisibleUserColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),!1!==a.appearance.showColumnGroupCellLines&&!1!==a.appearance.showColumnGroupLines||(t.parent&&t.parent.columns&&t.parent.columns[0].dataField===t.dataField?t.element.setAttribute("column-group-first-child",""):t.parent&&t.element.removeAttribute("column-group-first-child")),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){a._columnElements||(a._columnElements=[]);const o=a._columnElements[m++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),h||(h=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===i&&(i=t.left))}}}if(void 0===i&&(i=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const f=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;let y=0,w=a.behavior.allowRenderCache&&!f&&"grid"===a.view&&!a.dataSource.virtualDataSourceOnExpand&&!a.rowDetail.template&&!a.rowDetail.enabled&&!a._autoHeight&&!a.pager.visible&&!a._frozenFarColumns.length&&!a.hasAttribute("tree");if("grid"!==a.view)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];t.style.transform="",t.style.top="",t.style.position=""}if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;if(f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),c=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.paging.enabled||(r=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize)),"card"===a.view&&a._cardHeight&&(e+=a._cardHeight),w)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];delete t.isRendered,t.classList.remove("smart-hidden"),t.classList.remove("aria-rowindex"),t.style.transform="",t.style.top="",t.style.position=""}if(w){let e=Math.max(a._clientSize.height,a._overflowOffset),o=[],l=c;for(let t=r;t<s.length;t++){const i=s[t];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),l+r>=n-p&&l<=n+e||a._autoHeight){for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];if(t.hasAttribute("data-id")&&t.getAttribute("data-id")===""+i.id){o[i.id]=t,t.isRendered=!0;break}}l+=r}}e=Math.max(a._clientSize.height,a._overflowOffset);for(let l=r;l<s.length;l++){const i=s[l];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),c+r>=n-p&&c<=n+e||a._autoHeight){let e;if(e=a._rowElements[m++],!e)break;for(;e&&e.isRendered;)e=a._rowElements[m++];if(!e){console.log("Did not found a row element during the rendering.");continue}e.setAttribute("aria-rowindex",t+l+1);let n=!1;if(i.element=e,i.grid=a,o[i.id]){const a=o[i.id];a.hasAttribute("data-id")&&a.getAttribute("data-id")===""+i.id&&(a===e&&(a.isRendered=!0,n=!0,m=0),n=!0,m=0,i.element=a,e.style.top="999999px",e.setAttribute("data-id",999999),e.setAttribute("aria-rowindex",t+l+1),e=a,a.isRendered=!0)}e.style.top=y+"px",e.style.position="absolute",i.render(n),e.isRendered=!0,c+=r,y+=r}}}else{a.rowDetail.enabled&&(e+=a.offsetHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(c+i>=n-p&&c<=n+e||a._autoHeight))break;{let e;if(e=a._rowElements[m++],!e)break;if(e.isRendered&&(e.classList.remove("smart-hidden"),e.classList.remove("aria-rowindex"),e.style.transform="",e.style.top="",e.style.position=""),e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render(),e.isRendered=!0}c+=i,y+=i}}}a._renderFrozenRows();let _=m;if(m<a._rowElements.length&&!w)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}if(w)for(let e=0;e<a._rowElements.length;e++)if(!a._rowElements[e].isRendered){const t=a._rowElements[e];t.classList.add("smart-hidden"),t.removeAttribute("aria-rowindex")}if(a.editing.addNewRow&&a.editing.addNewRow.visible&&"row"!==a.editing.addNewRow.displayMode&&a._rowElements[_]){a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0}));for(let e=a._rowElements.length-1;e>=0;e--)if(!a._rowElements[e].isRendered){a._newRow.element=a._rowElements[e],a._newRow.element.classList.remove("smart-hidden"),a._newRow.element.style.top=y+"px",a._newRow.element.style.position="absolute",a._newRow.render();break}}f&&(a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects())}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e.filtering.filterRow.visible&&e.$.rowNearContainer.classList.remove("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||"add"===e||"update"===e||"delete"===e||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo||null,sorting:o.getSortedColumnsByDataField(),filtering:o.getFilteredColumnsByDataField(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action){if(t&&t(e.result),o._autoHeight&&o.rows.length>=o._rowElements.length-1&&(o._initializeRows(),o._initializeRowElements(),o.refresh(),o.filtering.filterRow)){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}return}if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}localizeString(e,t,o="en"){const l=this;o&&l.messages[o][e]&&(l.messages[o][e]=t,l.refresh())}localizeStrings(e,t="en"){const o=this;t&&(Object.assign(o.messages[t],e),o.refresh())}_createInsertNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus insert",t.title=e.localize("contextMenuItemInsertRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",t.style.boxShadow="var(--smart-elevation-1)",t.style.width="16px",t.style.height="16px",t.style.fontSize="12px",t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0;const o=e.editing.addNewRow._insertButton.row;o?e.insertRow(t,1+o.visibleIndex):e._add(t),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}removeColumn(e){const t=this;let o=-1;if(e)for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){o=l;break}o>=0&&t.columns.splice(o,1)}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.classList.add("smart-hidden"),void t.editing.addNewRow._addButton.classList.remove("show");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy&&t.dataSource.groupBy.length>0)||t.editing.addNewRow._addButton.classList.remove("show"))};t.editing.addNewRow._addButton&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),!t.editing.addNewRow.visible||"row"===t.editing.addNewRow.displayMode&&t.$.placeholder.classList.contains("smart-hidden")||(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=!t.appearance.showViewBar||t.appearance.viewBarAppendTo||t.appearance.showViewBarAsDropdown||t._mobile?"":10+t.layout.viewBarWidth+"px",o(),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),t.editing.addNewRow.visible&&!t.computedVerticalScrollBarVisibility&&t._newRow&&t.editing.addNewRow._addButton.classList.remove("show"),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"))})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.editing.addNewRow._insertButton=t._createInsertNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),t.appendChild(t.editing.addNewRow._insertButton),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o(),(t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode||!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden"))&&t.editing.addNewRow._addButton.classList.remove("show"))}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollRecycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(!0!==o._disableEndEdit&&o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect(),o._copyRects&&o._copyRects.length&&o._refreshCopyRects();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"row"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"),"grid"===t.view&&"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")}),0))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}setCellFormula(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,e.formula=o,e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e,t){const o=this;o.isInitialized&&(e&&(o._initializeRows(),o._initializeRowElements()),o._refresh(t),o._refreshSummary())}refreshView(e=!0){const t=this;if(t._recycleFiles=!0,!e)return t._recycle(!1,!0),void delete t._recycleFiles;t._recycle(),delete t._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t,o=!0){const l=this;l._isUpdating--,l._isUpdating<0&&(l._isUpdating=0),!1!==e?l.refresh():!1!==t&&l.refreshView(o)}_generateUUID(){const e=window.crypto,t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=Array.from(t,(e=>e.toString(16).padStart(2,"0"))).join("");return`${o.substring(0,8)}-${o.substring(8,12)}-${o.substring(12,16)}-${o.substring(16,20)}-${o.substring(20)}`}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1449
+ Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{ai:{type:"any",reflectToAttribute:!1,value:{model:{value:"gpt-4.1",type:"string"},maxTokens:{value:200,type:"number"},temperature:{value:.7,type:"number"},maxResponseLength:{value:100,type:"number"},promptVariables:{value:null,type:"any",reflectToAttribute:!1},prompts:{value:null,type:"any",reflectToAttribute:!1},includeUserPrompts:{value:!0,type:"boolean"},url:{value:"",type:"string"},key:{value:"",type:"string"}}},appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnAutoPlaceholder:{value:!1,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowEditDialogDetails:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!1,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupCellLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"},showViewBarAsDropdown:{value:!1,type:"boolean"},viewBarAppendTo:{value:null,type:"any"}},type:"object"},behavior:{value:{autoDestroy:{value:!0,type:"boolean"},allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},allowMouseWheel:{value:!0,type:"boolean"},allowRenderCache:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowMobileHeight:{value:null,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"any"},fileName:{value:"SmartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"},headerContent:{value:null,type:"any",reflectToAttribute:!1},footerContent:{value:null,type:"any",reflectToAttribute:!1},addImageToCell:{value:null,type:"any",reflectToAttribute:!1},setRowHeight:{value:null,type:"any",reflectToAttribute:!1},cellFormatFunction:{value:null,type:"any",reflectToAttribute:!1},autoConvertFormulas:{value:!0,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},onlySelected:{value:!1,type:"boolean"},exportAsTable:{value:!1,type:"boolean"},exportStyles:{value:!0,type:"boolean"},formatData:{value:null,type:"any",reflectToAttribute:!1},getSpreadsheets:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},copyHeadersToClipboard:{value:!1,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:"auto",type:"any"},height:{value:null,type:"any"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemChart:{value:{command:{value:"contextMenuItemChartCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-chart",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemSelectRow:{value:{command:{value:"contextMenuItemSelectRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-check-squared",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemExpand:{value:{command:{value:"contextMenuItemExpandCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-resize-full",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemInsertRow:{value:{command:{value:"contextMenuItemInsertRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCloneRow:{value:{command:{value:"contextMenuItemCloneRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCut:{value:{command:{value:"contextMenuItemCutCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-cut",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCopy:{value:{command:{value:"contextMenuItemCopyCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-copy-record",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemPaste:{value:{command:{value:"contextMenuItemPasteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-paste",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemClear:{value:{command:{value:"contextMenuItemClearCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-close",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemComment:{value:{command:{value:"contextMenuItemAddCommentCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-comment",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsert:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:500,type:"any"},width:{value:800,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban","card","scheduler","timeline"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeInput:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeDataField:{value:"",type:"string",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},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},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array",reflectToAttribute:!1},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object",reflectToAttribute:!1},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},keys:{value:null,reflectToAttribute:!1,type:"any"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the SmartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",viewScheduler:"Calendar",viewTimeline:"Timeline",kanbanNone:"Blank",schedulerDescription:"Which date column would you like to use for this view? Your data would be placed based on the dates in this column.",schedulerDescriptionInfo:"A range of data would be displayed when a start date field has an associated due date field.",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',schedulerDateColumn:"Create a new date column",schedulerPromptLabel:"Using date column(s)",schedulerDateRangeColumn:"Create a new date range",schedulerToolLabel:"Using '{{column}}'",toolLabel:"Labeled by '{{column}}'",uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsert:"Insert column",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",contextMenuItemSelectRow:"Select row",contextMenuItemCloneRow:"Clone row",contextMenuItemInsertRow:"Insert row",contextMenuItemChart:"Chart range",contextMenuItemAddRow:"Add {{value}} rows",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Ctrl</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnDate:"Choose a date column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeAIQuery:"AI Button",dialogAddColumnTypeSparklines:"Sparklines",dialogAddColumnAIQuery:"AI Query",dialogAddColumnTypeAIQueryInfo:"Example: Write a short description for an article or choose a column to query by it",dialogAddColumnTypeUUID:"UUID",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnTypeVote:"Vote",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatMonthYear:"Month & Year",dialogAddColumnDateFormatCasualUS:"Casual US",dialogAddColumnDateFormatWeekdayOnly:"Weekday",dialogAddColumnDateFormatUS:"US",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatDecimalPlaces:"Decimal places",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnDotItems:"Show Dots",dialogAddColumnCustomItems:"Custom Items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkFieldMore:"Cascading readonly fields",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnListItemsEditError:"You cannot edit an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnBlankItem:"Blank Item",dialogAddColumnFormatting:"Rich Formatting",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",strikethrough:"Strikethrough",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",commentPlaceholder:"Leave a comment",noComments:"Leave a comment and collaborate with your team.",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Format",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:"Changed {{column}} from {{oldValue}} to {{newValue}}",nullRange:"Changed {{column}} to {{newValue}}",rowCreated:"Row Created",propertyUpdated:"{{value}} updated",propertyRemoved:"{{value}} removed",dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",copyURL:"Copy row URL",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}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",addAIFilter:" ✨︎ Ask AI",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",noOptions:"No options",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by '{{column}}'",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",expandCell:"Expand cell",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'SmartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'SmartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",tomorrow:"Tomorrow",yesterday:"Yesterday",formatColumn:"Format Column",formating:"Color",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",formatingBy:"Colored by '{{value}}'",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",newScheduler:"Calendar",newTimeline:"Timeline",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",schedulerView:"View your records in a Calendar view",timelineView:"View your records in a Timeline view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows",columnPlaceholder:"Placeholder",pieChart:"Pie",columnChart:"Column",barChart:"Bar",stackedChart:"Stacked",lineChart:"Line",projectStatus:"Project Status",reviewStatus:"Review Status",taskStatus:"Task Status",priority:"Priority",size:"Size",yesNo:"Yes/No/Maybe",backlog:"Backlog",notStarted:"Not Started",underReview:"Under review",approved:"Approved",rejected:"Rejected",blocked:"Blocked",completedStatus:"Completed",generate:"Generate",aiPrompt:"Enter your prompt for the AI:",agenda:"Agenda",checkStyle:"Style",noVotes:"No votes yet",votes:"Voted by {{value}}",clearContents:"Clear contents",paste:"Paste",minPromptChars:"Enter AI prompt. Min 20 chars.",aiResponse:"Response",noAIResponse:"No response from AI",promptSuggest:"Prompt Suggestions"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onCellValueChanged:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},allowListOpenOnContentClick:{value:!0,type:"boolean"},allowDynamicButtons:{value:!1,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},customCommandColumns:{value:null,type:"any"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","insertButton","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},sidePanel:{value:!1,type:"boolean"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},appendTo:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},searchCommand:{value:"search",allowedValues:["search","filter"],type:"string"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["Smart.menu.css","Smart.filterpanel.css","Smart.pager.css","Smart.grid.css","Smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' >\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' role='grid' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' style=\"opacity: 0.99\" role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler",mouseleave:"_mouseLeaveHandler"}}_mouseLeaveHandler(){const e=this;e.editing.addNewRow._insertButton&&e.editing.addNewRow._insertButton.classList.remove("show")}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template||"richText"===a.template)){e.preventDefault();let n=(e.clipboardData||e.originalEvent.clipboardData).items,i=null,r=0,s=0,d=[];for(let e=0;e<n.length;e++)if(0===n[e].type.indexOf("image")&&(i=n[e].getAsFile(),r++,null!==i)){let e={label:i.name,size:i.size},n=new FileReader;n.onload=function(n){s++;const i=n.target.result;e.value=i;let c=!1;for(let o=0;o<t.uploadSettings.userFiles.length;o++){const l=t.uploadSettings.userFiles[o];if(l.name===e.label||l.label===e.label){c=!0;break}}if(c||t.uploadSettings.userFiles.push(e),d.push(e),s===r){let e=t.getCellValue(o,l);e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...d];let n=e;if("richText"===a.template){const a=document.createElement("span");for(let t=0;t<e.length;t++){const o=document.createElement("img");o.src=e[t].value,o.title=o.name=e[t].label,a.appendChild(o)}t.setCellValue(o,l,a.outerHTML),n=a.outerHTML}else t.setCellValue(o,l,e);const i=t.rowById[o].getCell(l),r="";t.onCellUpdate&&t.onCellUpdate([i],[r],[e],(function(){t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[r],[e],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,r,e)}),t)}},n.readAsDataURL(i)}}}}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1;this._mobile&&(e.preventDefault(),e.stopPropagation())}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_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)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(t.isInShadowDOM){const t=e.getBoundingClientRect();let o=window.pageXOffset,l=window.pageYOffset,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){const e=a.parentNode;null!==a.scrollLeft&&(o+=a.scrollLeft),null!==a.scrollTop&&(l+=a.scrollTop);const t=a.getRootNode?a.getRootNode():null;if(t&&t instanceof ShadowRoot)a=t.host;else{if(!e||1!==e.nodeType)break;a=e}}return o+=window.pageXOffset,l+=window.pageYOffset,{top:t.top+l,left:t.left+o,right:t.right+o,bottom:t.bottom+l,width:t.width,height:t.height}}if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);if(super._upHandler(),t._spinTimeout&&clearTimeout(t._spinTimeout),t._spinInterval&&clearInterval(t._spinInterval),t._tapTimer&&clearTimeout(t._tapTimer),t._mobile&&e.originalEvent&&"pointercancel"===e.originalEvent.type)return;const l=()=>{if(t.editing.isEditing&&!t.editing.dialog.enabled){if(t._hasRichTextEditor)return;setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(o.element&&o.element&&o.element.firstElementChild&&o.element.firstElementChild.hasAttribute("aria-owns")){const t=o.element.firstElementChild.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}else if(t.editing.editRow){const o=t.editing.editRow.cells;for(let t=0;t<o.length;t++){const l=o[t];if(l&&l.editor&&l.editor.instance){if(l.editor.instance.element&&l.editor.instance.element.hasAttribute("aria-owns")){const t=l.editor.instance.element.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(l.editor.instance.element&&l.editor.instance.element.firstElementChild&&l.editor.instance.element.firstElementChild.hasAttribute("aria-owns")){const t=l.editor.instance.element.firstElementChild.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(l.editor.instance.blur(e),e.defaultPrevented)return}}}t.isAttached&&t.endEdit()}}),50)}};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const l=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),i=n.querySelectorAll("smart-date-input"),r=n.querySelectorAll("smart-input");for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;for(let e=0;e<r.length;e++)if(r[e].$.scrollView.contains(o))return;return t.closeMenu(),t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e)}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._mobile||this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;if(t._mobile)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l),i=t.parentElement,r=i?i.scrollTop:0,s=i?i.scrollLeft:0;if(n.left-s<=e.pageX&&n.left-s+a.width-10>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),i("doubleClick"),t._onColumnDoubleClick(o,e)),Smart.Utilities.Core.isMobile){const o=t.rightToLeft?a.getBoundingClientRect().left:a.getBoundingClientRect().right,n=10;if(o-n<=e.clientX&&e.clientX<=o+n){const o=t.columnByDataField[l];if(!o||o&&!o.allowResize)return;const n=t._isLastVisibleColumn(o);if("split"===t.behavior.columnResizeMode&&n)return;a.style.cursor="col-resize",a.sortButton.style.cursor="col-resize",a.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(a),t._columnToResizeElement=a,t._columnToResizeDataField=l,e.preventDefault(),e.originalEvent&&e.originalEvent.preventDefault()}}if(t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null,d=null,c=null,u=null,m=null;t._lastPointerDownTime=new Date;for(let p=0;p<a.length;p++){const g=a[p];if(g.hasAttribute("toggle-button")&&(i=g),g.hasAttribute("add-row")&&(d=g),g.hasAttribute("checkbox")&&(r=g),"A"===g.nodeName&&e.ctrlKey&&g.click(),g.hasAttribute("rating-value")&&(c=g),g.hasAttribute("vote-value")&&(u=g),!s&&"smart-grid-cell"===g.nodeName.toLowerCase()&&!g.classList.contains("smart-grid-filter-row-cell")){if(s=g,g.hasAttribute("data-type")&&"string"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit&&!s.cell.column.autoGenerated){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id"),n=g.getBoundingClientRect(),i=t.columnByDataField[l];if(o>=n.right-20&&("tags"===i.template||"list"===i.template||"dropdownlist"===i.template||"combobox"===i.template))return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"date"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id");if(o>=g.getBoundingClientRect().right-20)return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"number"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const a=g.getAttribute("data-field"),n=g.closest("smart-grid-row").getAttribute("data-id"),i=g.getBoundingClientRect();if(o>=i.right-20){const o=()=>{let e=t.getCellValue(n,a);null!=e&&""!==e||(e=0);const o=e;let r=1;const s=t.columnByDataField[a];s&&s.formatSettings&&s.formatSettings.Intl&&("percent"===s.formatSettings.Intl.NumberFormat.style&&(r=.01),"currency"===s.formatSettings.Intl.NumberFormat.style&&void 0===s.formatSettings.Intl.NumberFormat.minimumFractionDigits&&(r=.01),s.formatSettings.Intl.NumberFormat.minimumFractionDigits>0&&(r=.01)),l>=i.top&&l<=i.bottom-i.height/2?e+=r:e-=r,s.editor&&(e>s.editor.max&&(e=s.editor.max),e<s.editor.min&&(e=s.editor.min)),t.setCellValue(n,a,e);const d=t.rowById[n].getCell(a);t.onCellUpdate&&t.onCellUpdate([d],[o],[e],(function(){t.onCellUpdated&&t.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[e],t),t._onCellUpdated&&t._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,e)}),t)};return o(),clearTimeout(t._spinTimeout),t._spinTimeout=setTimeout((()=>{clearTimeout(t._spinTimeout),t._spinInterval=setInterval((()=>{t._spinInterval&&o()}),50)}),150),e.stopPropagation(),void e.preventDefault()}}}if(!m&&g.classList.contains("smart-card")&&(m=g),!n&&"smart-grid-row"===g.nodeName.toLowerCase()){n=g;break}}if("card"===t.view){if(m){const o=m.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(m.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;m.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}return}c&&(t._ratingElement=c),u&&(t._voteElement=u);const p=!!e.originalEvent&&3===e.originalEvent.which;if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn&&!p){const e=n.row;if(t._overlay||e.header&&"row-resize"===e.header.style.cursor||e.header&&"row-resize"===e.header.parentElement.style.cursor)return;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(t._overlay||o.header&&"row-resize"===o.header.style.cursor||o.header&&"row-resize"===o.header.parentElement.style.cursor)return;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize&&(t._rowToResize.onpointerup=null),t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,c=e.originalEvent?e.originalEvent:e,u=3===c.which;if(u||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),u&&t.contextMenu.enabled){t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField;const e=t.getSelectedCells();let a=!0;if(t.contextMenu.dataField&&!t.contextMenu.dataField.startsWith("_"))if(e.length){for(let t=0;t<e.length;t++){const n=e[t],i=n[0],r=n[1];if(""+i==""+o.id&&l.column.dataField===r){a=!1;break}}t._focusCell(o.id,l.column.dataField,a),a&&t._selectCellsRange(o,o,l.column.dataField,l.column.dataField)}else{const e=t.getSelectedRowIds();(0===e.length||e.length>1)&&(t._focusCell(o.id,l.column.dataField),t._selectCellsRange(o,o,l.column.dataField,l.column.dataField))}else t._copyRects&&t._copyRects.length&&t.clearSelection(),t.selectRow(o.id);return t.openContextMenu(c.pageX+10,c.pageY+10),void(t.contextMenu.selector&&(c.stopPropagation(),c.preventDefault()))}if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}refreshRelations(){const e=this;if(e.dataSourceSettings&&e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length){for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&(o._isDirty=!0)}e._recycle(!1);for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&delete o._isDirty}}}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){if("object"==typeof e)return o&&o.columns&&(l.__measuredColumnHeight=null),void l.render();switch(l._notify(e,t,o),e){case"dataSourceSettings_relations":return void l.refreshRelations();case"dataSourceSettings_transpose":return void l.render();case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban?(l._kanban.selectTask(o),l._kanban.ensureVisible(o)):"scheduler"===l.view&&l._scheduler&&l._scheduler.focusEvent(o);break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return l._setLoadingIndicatorVisibility(),void l._recycle(!1);case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnGroupLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":if(l.header.visible&&""===l.header.template){let e=l.$.header;l.header.appendTo&&(e=document.querySelector(l.header.appendTo),e?e.onclick=e=>{l._headerClickHandler(e)}:e=l.$.header),e.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=e.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar)}break;case"header_buttons":l.header.visible&&""===l.header.template&&l._refreshHeaderBar();break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection&&(l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index})}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l.grouping.groupBar.visible&&l._renderGroupBar(),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":{l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(l.columns&&l.columns.length)for(let t=0;t<l.columns.length;t++)if(l.columns[t].freeze){e=!0;break}if(e&&l._initializeRowElements(),l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}l._renderColumns(),l._refreshHeaderBar();const o=l._sortedColumns;if(o){l.clearSort();for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;l._refreshSort(o)}if(l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return l.layout.isDirty=!0,l._resetCachedLayout(),void l._refreshLayout()}case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":delete l._isFirstVirtualDataSourceRequest,l._isUpdating&&l.endUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.editor&&(delete t.editor.isInitialized,delete t.editor.dataSource,delete t.editor._items,t.options&&(t.editor.dataSource=t.options),t.editor.isDirty=!0),t._cellsCachedValues=[],delete l._cellCachedValues,l._cellEditors=[]}if("dataSource"===e&&t&&o){const e=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&"infinite"!==l.scrolling,a=e=>Array.isArray(e)&&e.every((e=>Array.isArray(e)));if(o&&a(o)){const e=[];for(let t=0;t<o.length;t++){const a={};for(let e=0;e<l.columns.length;e++){const n=l.columns[e];let i=o[t][e];if(n.options){const e=n.options.find((e=>e.label===i||e.value===i));e&&(i=e.value)}"date"===n.dataType&&null!==i&&(i=new Smart.Utilities.DateTime(i).toDate()),a[n.dataField]=i}e.push(a)}o=e}if(t instanceof Smart.DataAdapter&&!e){if(t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.childrenDataField&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&l.dataSource&&l.dataSource._expandedRowIds){let t={};for(let e in l.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}l.beginUpdate();const a=l._sortedColumns;l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId()&&l.clearSort();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e]?l.dataSource[e].$.id:e;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const n=l._filters;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(a&&l._refreshSort(a),n&&n.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}if(l.dataSource&&l.dataSource.url&&l.filtering.enabled&&l.filtering.filterRow.visible){let e=!1;for(let t=0;t<l.columns.length;t++)l.columns[t]._filterEditorInitialized&&(e=!0),l.columns[t]._filterEditorInitialized=!1;e&&setTimeout((()=>{l._refreshFilterRowEditors(),l.refreshFilters(),l._recycle(!1)}),100)}}}return l.dataSource&&l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"row"!==l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.$.content.removeAttribute("aria-readonly"):l.$.content.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"layout_isDirty":return;case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){const e=this;e.disableSwipeScroll=!0,super.ready(),e._renderInDropDown();const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].loadingIndicatorPlaceholder?e.localize("loadingIndicatorPlaceholder"):e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e._details=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];if(e.filtering.enabled&&0===e._filterPanels.length){if(e.header.visible&&e.header.buttons.indexOf("filter")>=0)return;requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};if(e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const c=e._measureRowElement(o[0].data),u=o.length;for(let s=0;s<u;s++){let d=o[s];if(!d.visible||!1===d.filtered){d.height=0,d.cellHeight=0,d.top=l;continue}const u=e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled;let m=!d.height||!d.cellHeight||u||"auto"===d.height||"auto"===d._height||"auto"===e.layout.rowHeight||e.layout.isDirty;if(t&&d.height!==r&&(d.height=d.cellHeight=r),m&&!d.expandHeight){if(d.detailHeight||(d.detailHeight=200),t)d.height=d.cellHeight=r;else if(e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.height=e.layout.rowHeight,d.computedHeight&&(d.height=d.computedHeight),d.minHeight>d.height&&(d.height=d.minHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.element=c,d.grid=e,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a,o=d.canNotify;d.canNotify=!1,d.height=t,d.computedHeight&&(d.height=d.computedHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight),d.canNotify=o}else e.layout.rowHeight(s,d),d.height||(d.height=a),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}else{if("auto"===d.height||"auto"===d._height){d.element=c,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a;d.height=t,d._height="auto"}else d.height=a;void 0===d.label||d.summaryRow||"advanced"!==e.grouping.renderMode||(d.height=e.grouping.groupRowHeight),d.computedHeight&&(d.height=d.computedHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}e._rowGap&&s<e.rows.length-1&&(d.height+=e._rowGap)}!t&&(!0===d.freeze||"near"===d.freeze?d.visible&&(n+=d.height):"far"===d.freeze&&d.visible&&(i+=d.height),d.freeze&&d.visible)?d.top=l:(d.top!==l&&(d.top=l),d.expandHeight?l+=d.cellHeight:l+=d.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(l+=1*a),e.editing.addNewRow&&"row"!==e.editing.addNewRow.displayMode&&(l+=1*a),e.filtering&&e.filtering.filterRow.visible&&(n+=a+1),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(l+=a,"far"!==e.editing.addNewRow.position&&(n+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(l=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return t&&(l=r*Math.ceil(o.length/s)),e.__scrollHeight=l,e.__frozenNearHeight=n,e.__frozenFarHeight=i,e._scrollView.scrollHeight=l-e.$.scrollView.offsetHeight+n+i,l=e.__scrollHeight+n+i-1,e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(l+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=l,c.remove(),o[0]&&delete o[0]._isMeasureRow,e.rows.canNotify=!0,l}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.collapsible&&e._initializeColumnGroupCollapsing(o)}}_initializeColumnGroupCollapsing(e){const t=this;e.collapsed=e.collapsed||!1,e.collapseButton=document.createElement("div"),e.collapseButtonIcon=document.createElement("span"),e.collapseButton.appendChild(e.collapseButtonIcon),e.collapseButton.classList.add("smart-grid-column-group-collapse-button"),e.collapseButtonIcon.classList.add("smart-grid-icon",e.collapsed?"smart-icon-right":"smart-icon-left","show"),e.collapseButton.setAttribute("role","button"),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"));const o=(e,l)=>{if(e.collapsed=l,e.column&&(e.column.canNotify=!1,e.column.collapsed=l,e.column.canNotify=!0),e.collapseButtonIcon.classList.remove("smart-icon-left"),e.collapseButtonIcon.classList.remove("smart-icon-right"),e.collapsed?e.collapseButtonIcon.classList.add("smart-icon-right"):e.collapseButtonIcon.classList.add("smart-icon-left"),t.beginUpdate(),e.collapsed){const t=e=>{let t=0;for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.allowCollapse&&(l.visible=!1,t++)}t===e.columns.length&&e.columns[0]&&!e.inline&&(e.columns[0]._visible=!0,e.columns[0].visible=!0)};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}else{const t=e=>{for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}t.endUpdate(),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"))};e.collapsed&&requestAnimationFrame((()=>{o(e,e.collapsed)})),e.collapseButton.addEventListener("click",(function(t){t.stopPropagation(),o(e,!e.collapsed)}))}_refreshColumnHeights(){const e=this;if("card"===e.view)return;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,c=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,c+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=c,c+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(a.parent&&n.setAttribute("column-group",a.parent.name),a.parent&&a.parent.columns&&a.parent.columns[0].dataField===a.dataField&&n.setAttribute("column-group-first-child",""),l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this,n.onpointerdown=()=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let l=0;l<e.groups.length;l++)if(e.groups[l].columnGroup)o.push(e.groups[l]);else if(e.groups[l].groups){let a=t(e.groups[l]);for(let e=0;e<a.length;e++)o.push(a[e])}return o},o=t(l);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",!1===e.appearance.showColumnGroupLines&&e.setAttribute("appearance_hide-column-group-lines",""),e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e._autoHeight&&e.paging.enabled&&(e._overflowOffset=Math.max(o,e.paging.pageSize*e.layout.rowMinHeight)),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;if(t.summaryRow.visible)t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{if(!0!==t.editing.isEditing){t._calculateSummary();const o=t.$.headerBar;o&&o._updateTools&&o._updateTools(),!1!==e&&t._recycle(!1,!0,!1)}}),100);else{const e=t.$.headerBar;e&&e._updateTools&&e._updateTools()}}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[],e._frozenRowsById=[];let o=e._createdDate||new Date,l=void 0!==e._createdBy?e._createdBy:e.currentUser;const a=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a&&a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}));e._details[i]=s.showDetail}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0)}else if("far"===s.freeze){e.rows.push(s);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&(e._frozenFarRows.push(t),e._frozenRowsById[t.id]=!0)}}else e.rows[i]?(e.rows.splice(i,0,s),e.rows[i].index=e.rows.length):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(e._rowInsertedCallback=o,void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:i});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([i],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),r&&r(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([i],[t],o,e)}else{const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i];void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),r&&r(t)}},r=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._onRowRemoved&&e._onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},s=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._onRowRemoved&&e._onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=i,e._removeLastRow=r,e._removeAt=s,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length,c=e.onRowInserted;e.onRowInserted=null,e.$.content.setAttribute("aria-rowcount",d);const u=e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling;if(e.dataSource&&e.dataSource.virtualDataSource&&e.paging.enabled&&!e.dataSource.virtualDataSourceOnExpand)for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource[t],l=t+e.paging.pageIndex*e.paging.pageSize;e.dataSource.id||(o.$.id=l),i(o,l)}else if(u){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];i(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];i(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.onRowInserted=c,e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)i(o[t],e.dataSource.length-o.length+t);else i(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],n=[];for(let r=0;r<n.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=n[r],o.push(s),a.push(e.rows[s]),n.push(e.rows[s].data)):(i(n[r],n[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,n,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:i(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":i(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":s(t.index);break;case"removeLast":r();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),t.$&&o.$.pageSizeSelector&&(t.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0])),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),o.$&&o.$.pageSizeSelector&&(o.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0]))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0):"far"===o.freeze&&(e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}if(e.dataSource.id&&(null===l.data[e.dataSource.id]||void 0===l.data[e.dataSource.id])){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.data[e.dataSource.id]=t()}if(o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]){l.data=e.dataSource[o];for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t].name;e.dataSource.id&&o===e.dataSource.id||e.dataSource.keyDataField&&o===e.dataSource.keyDataField||e.dataSource.parentDataField&&o===e.dataSource.parentDataField||e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l),e._frozenRowsById[l.id]=!0),e._conditionalColors&&e._conditionalColors.update&&setTimeout((()=>{e._conditionalColors.update(),e._recycle(!1)}),100)})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l&&(l.data=o,l.id=o.$.id,e.rowById[l.id]=l)}return e.rows.canNotify=!0,e.refresh(),void e._refreshPaging(!1)}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(!1,o),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}setDropDownLabel(e){const t=this;t.$.dropDownElement&&(t.dropDownModeInput?t.$.dropDownElement.querySelector(".smart-action-button smart-input").value=e:t.$.dropDownElement.querySelector(".smart-action-button").innerHTML=e)}openDropDown(){const e=this;if(!e.dropDownMode)return;if(!e.$.dropDownPopup)return;const t=e.$.dropDownPopup,o=e.$.dropDownElement;o.setAttribute("active",""),o.querySelector(".smart-drop-down-button").setAttribute("active",""),(()=>{const l=0,a=0;if(e.layout.isDirty=!0,window.screen.availWidth<400)return t.open("left","top"),t.style.width=e.offsetWidth+"px",void(t.style.height=e.offsetHeight+"px");{const o={width:e.layout.dropDownWidth,height:e.layout.dropDownHeight};t.style.width="auto"===o.width?o.width:o.width+"px",t.style.height="auto"===o.height?o.height:o.height+"px"}const n=o;if(n){const o=e.offset(n),i=o.left-l,r=l,s=Math.max(r,i);t.open(s,o.top+n.offsetHeight-a)}else t.classList.add("center"),t.open("center","center");e.style.display=""})()}isDropDownOpened(){return!!this.$.dropDownElement.hasAttribute("active")}closeDropDown(){const e=this;e.dropDownMode&&e.$.dropDownPopup&&(e.$.dropDownElement.removeAttribute("active"),e.$.dropDownElement.querySelector(".smart-drop-down-button").removeAttribute("active"),e.$.dropDownPopup.close())}_renderInDropDown(){const e=this;if(e.dropDownMode&&(e.dropDownMode&&(e.style.display="none"),e.dropDownMode&&void 0===e._dropDownMode)){e._dropDownMode=!0;const t=document.createElement("div"),o=e._createPopup();if(o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span 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>\n </div>`,e.dropDownModeInput){const o=t.querySelector(".smart-action-button");o.innerHTML='<smart-input style="color: var(--smart-background-color); background: var(--smart-background); border-radius: 0px; width: calc(100% - 6px); height: calc(100% - 6px);"></smart-input>';const l=o.firstElementChild;l.onpointerdown=l.onclick=l.onpointerup=e=>{e.stopPropagation()},l.oninput=l.onchange=l.onkeyup=t=>{const o=e.rows||e.dataSource;clearTimeout(e._dropDownInputTimer),e._dropDownInputTimer=setTimeout((()=>{if(l.value.length>=2)for(let a=0;a<o.length;a++){const n=o[a],i=(""+(n.data?n.data:n)[e.dropDownModeDataField]).toLowerCase(),r=(""+l.value).toLowerCase();if(i.indexOf(r)>=0){"Enter"===t.key&&(l.value=i),e.selection.enabled&&(e.isDropDownOpened()||e.openDropDown(),e.rows&&(e.clearSelection(),e.selection.allowCellSelection?e.selectCell(n.id,e.dropDownModeDataField):e.selectRow(n.id),e.ensureVisible(n.id)));break}}}),300)}}if(t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],!e._popupDropDown){e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""};const l=()=>{if(e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}};o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen"),e.$.listen("cellClick",l)},o.onClose=function(){if(e.$.unlisten("cellClick"),e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())}}}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.$.content.setAttribute("role","grid"),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),void super.render();const o=e.context;e.context=e,e.$.content.setAttribute("role","grid"),"grid"!==e.view&&e.setAttribute("view",e.view),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}transpose(e,t=180,o){const l=this,a=l.dataSource,n=l.columns;if(!a||!n)return null;let i=[],r=[];i=a instanceof Smart.DataAdapter?a.boundSource.toArray():a,r=n.toArray();const s=[],d=[{label:"",dataField:"field",freeze:!0,width:150}];for(let l=0;l<i.length;l++){const a={label:i[l][e]||`Row ${l+1}`,width:t,dataField:String(l)};o&&o(a),d.push(a)}for(let e of r){const t={field:e.label||e.dataField};i.forEach(((o,l)=>{t[l]=o[e.dataField]})),s.push(t)}l.beginUpdate(),l.dataSource=new Smart.DataAdapter({dataSource:s}),l.columns=d,l.endUpdate(),l.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_setupMobile(){const e=this;if(void 0===e._mobile&&(e._mobile=Smart.Utilities.Core.isMobile),e._mobile){e.layout.rowMobileHeight&&(e.layout.rowMinHeight=e.layout.rowHeight=e.layout.columnMinHeight=e.layout.columnHeight=e.layout.rowMobileHeight),e.behavior.rowResizeMode="none",e.behavior.allowRowReorder=!1,e.selection.allowDragSelectionAutoScroll=!1,e._scrollView.vScrollBar.showButtons=!1,e._scrollView.hScrollBar.showButtons=!1,e.style.setProperty("--smart-scroll-bar-size","12px"),document.body.style.setProperty("--smart-data-view-sort-panel-width","345px"),e._scrollContent=document.createElement("div"),e._scrollContent.style.width="100%",e._scrollContent.style.height="100%",e._scrollContent.style.position="absolute",e._scrollContent.style.left="0px",e._scrollContent.style.top="0px",e._scrollContent.style.background="white",e._scrollContent.style.zIndex=9999,e._scrollContent.style.opacity=.1,e._scrollContent.style.overflow="auto",e.addEventListener("viewChange",(()=>{"grid"===e.view?e._scrollContent.classList.remove("smart-hidden"):e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("beginEdit",(()=>{e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("endEdit",(()=>{e._scrollContent.classList.remove("smart-hidden")})),e._scrollContent.ontouchend=()=>{e._mobileDownTime=null},e._scrollContent.ontouchmove=t=>{if(t.stopPropagation(),!e._scrollContentScroll&&e.selection.enabled&&e.selection.allowDragSelection&&e.selection.allowCellSelection&&e._mobileDownDataField&&void 0!==e._mobileDownId&&e._mobileDownTime&&new Date-e._mobileDownTime>=800){const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY});e._mobileSelect=!0,e._dragSelection(o("mousemove")),e._mobileSelect=!1,t.preventDefault()}},e._scrollContent.selectstart=e=>{e.stopPropagation(),e.preventDefault()},e._scrollContent.ontouchstart=e=>{e.stopPropagation()},e._scrollContent.onpointerup=t=>{if(e._dragSelectionStartDataField=null,e._dragSelectionStartRow=null,e._mobileDownDataField&&void 0!==e._mobileDownId){let o=null,l=null;const a=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);for(let t=0;t<a.length;t++){const n=a[t];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const t=n.closest("smart-grid-cell").cell;l=t.row.id,o=t.column.dataField;break}}new Date-e._mobileDownTime>=1e3&&e.editing.enabled&&e.selection.enabled&&e.selection.allowCellSelection&&o===e._mobileDownDataField&&l===e._mobileDownId&&e.beginEdit(e._mobileDownId,e._mobileDownDataField),e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null,t.preventDefault(),t.stopPropagation()}},e._scrollContent.onpointerdown=t=>{e._scrollContentScroll=!1;const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY});setTimeout((()=>{if(e._scrollContentScroll)e._hideActionButtons();else{const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);if(l[2]){if(e.selection.enabled&&e.selection.allowCellSelection){const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null;for(let a=0;a<l.length;a++){const n=l[a];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const a=n.closest("smart-grid-cell").cell;return e._mobileDownTime=new Date,e._mobileDownId=a.row.id,e._mobileDownDataField=a.column.dataField,e._dragSelectionStartDataField=a.column.dataField,e._dragSelectionStartRow=a.row,e._mobileSelect=!0,l[2].dispatchEvent(o("pointerdown")),e._mobileSelect=!1,t.stopPropagation(),void t.preventDefault()}}}if(l[2].classList.contains("smart-grid-add-row-button"))e._hideActionButtons(),l[2].dispatchEvent(o("click"));else if(l[2].classList.contains("smart-summary-placeholder")||l[2].classList.contains("summary-value-part"))e._hideActionButtons(),l[2].dispatchEvent(o("pointerup"));else if(l[2].closest("smart-menu-item")){e._hideActionButtons();const t=l[2].closest("smart-menu-item");l[2].closest("smart-menu")._menuItemSelectionHandler(t)}else{if(l[2].dispatchEvent(o("pointerdown")),e._lastMobileClickRange){const o=e._lastMobileClickRange;let l=!0;o.left<=t.pageX&&o.left+o.right>=t.pageX&&(l=!1),l&&e._hideActionButtons()}else e._hideActionButtons();const a=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=e.offset(l);if(n.left<=t.pageX&&n.left+a.width-6>=t.pageX){if(!e.hasColumnMenu(o))return;e._lastMobileClickRange={left:n.left,right:n.left+a.width-6},l._showActionButton()}else l._hideActionButton()}};for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t];a(o.column,o)}}}}}),300),t.stopPropagation()};let t=0;const o=()=>{const t=e._scrollContent.scrollLeft,o=e._scrollContent.scrollTop;e._scrollView.vScrollBar.value=o,e._scrollView.hScrollBar.value=t,e._scrollContentScroll=!0};e._scrollContent.onscroll=()=>{cancelAnimationFrame(t),t=0,t=requestAnimationFrame(o)},e._scrollContentView=document.createElement("div"),e._scrollContentView.style.width=e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e._scrollView.scrollHeight+"px",e._scrollContent.appendChild(e._scrollContentView),e.$.scrollView.appendChild(e._scrollContent)}}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&(e.header.buttons.indexOf("views")>=0||e.header.buttons.indexOf("states")>=0)&&e._updateKanbanTaskFields()),e._setupMobile(),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,id:e.dataSourceSettings.id,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e._initFormulaParser(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale;let o=e.$.header;e.header.appendTo&&(o=document.querySelector(e.header.appendTo),o?o.onclick=t=>{e._headerClickHandler(t)}:o=e.$.header),o.appendChild(t),e.$.headerBar&&e.$.headerBar.remove(),e.$.headerBar=o.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e.filtering.enabled&&e.filtering.filterRow.visible&&e._refreshFilterRowEditors(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view?e._initKanbanView():"scheduler"===e.view&&e._initSchedulerView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)?r=o.parse(r.slice(1)):"string"==typeof r&&"number"===l.columns[a].dataType&&(r=parseFloat(r)),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(e){const t=this,o=t.conditionalFormatting;if(!o||0===o.length)return;if(!t._defaults){const e=getComputedStyle(t);t._defaults={fontFamily:e.fontFamily,fontSize:e.fontSize,text:t._toHex(e.color),highlight:t._toHex(e.backgroundColor)}}t._formatter||(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource)),e&&(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource),delete t._conditionalFormatting);const l=t._defaults,a=t._formatter,n=[],i=function(e){if("all"===e){if(t.columns&&t.columns.map){const e=[];for(let o=0;o<t.columns.length;o++){const l=t.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||e.push(l.dataField)}return e}return[]}return[e]};for(let e=0;e<o.length;e++){o[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},o[e]);const t=o[e],r=i(t.column),s=t.condition;a.color=t.highlight,a.comparator=t.firstValue,a.min=t.firstValue,a.max=t.secondValue;const d=a.format(s,r);for(let e in d){const o=d[e];for(let e in o){const l=o[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=o),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}}t._conditionalFormatting=r,e&&t._recycle(!1)}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.$.content.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){if(l!==a||"selected"===o){if(null==l&&null==a)return;if(l&&"object"==typeof l&&Array.isArray(l)&&a&&"object"==typeof a&&Array.isArray(a)&&JSON.stringify(l)===JSON.stringify(a))return;t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a})}};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,e._hScrollTimer&&clearTimeout(e._hScrollTimer),e._hScrollTimer=setTimeout((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=15*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-15*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t._cellCachedValues=[],t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.$.content.setAttribute("role","treegrid"),t.$.container.removeAttribute("role")),(t.isInitialized||l)&&t._refreshColumnsResponsiveVisibility(),t._refreshLayout(),o!==t.$.verticalScrollBar.offsetWidth&&(t.__scrollWidth=null,t._refreshColumnsResponsiveVisibility(),t._refreshScrollBars(),0===t.$.verticalScrollBar.offsetWidth&&t.isRendered&&requestAnimationFrame((()=>{t._refreshScrollBars()}))),t._refreshSelection(),t._deleteCopyRects(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),"remove"===e?(t._recycle(!1),t._refreshHeaderBar()):t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),t.dataSource&&t.dataSource.boundHierarchy&&t.conditionalFormatting&&t._renderConditionalFormatting(!1),t.filtering.enabled&&t.filtering.filterRow.visible&&(t._suspendFilterRowRefresh||t._refreshFilterRowEditors(),t._recycle(!1)),requestAnimationFrame((()=>{t._width=t.offsetWidth,t._height=t.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return t._undoRedo=[],t._refreshCurrentUser(),void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return void(!1===t._resizeHandling&&(t.layout.isDirty=!0));t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view&&"card"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,c=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(c+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===c&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=c,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t._mobile&&e.preventDefault(),t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible&&!e.header.appendTo),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,l){for(let c=0;c<t.length;c++){const u=t[c];let m=o.rowById[u.$.id];if(n&&(m=o.rows[s],m||(m=r(u),o.rows.push(m)),u[i.leaf]?m.id=u.$.id:m.id="Group_"+u.$.id,o.rowById[m.id]=m),m||(m=r(u),o.rowById[m.id]=m),m.data=u,m.leaf=u[i.leaf]||!1,m.level=u[i.level],m.groupDataField=u.groupDataField,o.hasAttribute("tree")&&o.dataSource&&o.dataSource.childrenDataField&&(m.index=s),!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=u.label,m.groupDataField){const e=o.columnByDataField[m.groupDataField];if(e&&e.editor.dataSource)for(let t=0;t<e.editor.dataSource.length;t++){const o=e.editor.dataSource[t];if(""+o.value===m.label){void 0!==o.label?(m.label=o.label,m.labelValue=o.value):void 0!==o.name&&(m.label=o.name,m.labelValue=o.value);break}}}if(m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),u.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),u.parent?(m.parent=o.rowById[u.parent.$.id],m.parentId=u.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(u);e&&(m.expanded=u[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==u[i.expanded]&&(m.expanded=u[i.expanded]);let p=!!e||m.expanded;a&&(p=!0);const g=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(g&&!m.data[g]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];u.parent&&u.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[g])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,p||u[i.leaf])if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let c=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<c.length;o++){let l=c[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;!a&&null!==a||0!==l.level||l.parent||(t(l.children).length,e.push(l))}c=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}const u=o.rows.canNotify;o.rows.canNotify=!1,o.rowHierarchy=d(c,new Array),o.rows.canNotify=u;let m=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&m.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=m),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow){o._initializeRowElements();let e=0,t=o.rows.canNotify;o.rows.canNotify=!1;for(let t=0;t<o.rowHierarchy.length;t++){const l=o.rowHierarchy[t],a=o.layout.rowHeight||o.layout.rowMinHeight;void 0===l.top&&(l.top=e,l.height=l.cellHeight=a),l.height?e+=l.height:e+=a}o.rows.canNotify=t,o._recycle(!1,!0)}if(o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible,e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),c=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=c,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px"),e.filtering.enabled&&e.filtering.filterRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||c>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-c+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",c+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",c+e.__scrollBarSize+"px"))),t.refresh(),o.refresh(),e._mobile&&(e._scrollContentView.style.width=e.$.scrollView.offsetWidth+e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e.$.scrollView.offsetHeight+e._scrollView.scrollHeight+"px")}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getData(){const e=this;if(!e.dataSource)return[];const t=[];for(let o=0;o<e.dataSource.length;o++){const l=e.dataSource[o];if(l.$){const o={};for(let t=0;t<e.dataSource.dataFields.length;t++){const a=e.dataSource.dataFields[t].name;o[a]=l[a]}t.push(o)}else t.push(l)}return t}getDataFields(){const e=this;return e.columns?e.columns.map((e=>e.dataField)):[]}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}resetState(e=!0){const t=this;t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border",t._conditionalColors.update=()=>{}),t.$.headerBar&&delete t.$.headerBar._appliedColors,delete t._labeledBy,delete t._dateStackedBySelect,t.highlighted=null,t.columns.canNotify=!1;let o=[],l=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?o[a.index]=a:o.push(a),a.index!==e&&(l=!0)}l&&(t.columns=o),"grid"!==t.view&&e&&(t.view="grid",t._hideKanbanView(),t._hideSchedulerView()),t.columns.canNotify=!0,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.$.headerBar&&t.$.headerBar._setView&&"grid"===t.view&&t.$.headerBar._setView("grid"),t._kanban&&t._kanban._reset(),t.layout.isDirty=!0,t.endUpdate(),l&&(t._renderColumns(),t._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1,n=!1;if("grid"===e.view||"card"===e.view||void 0===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}else if(t.grouping.enabled&&t.dataSource.groupBy.length)for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0);t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());let a=[];for(let o=0;o<e.columns.length;o++){const i=e.columns[o];if(i.dataField){const e=t.columnByDataField[i.dataField];if(e){const r=e.canNotify;e.canNotify=!1,i.width?e.width=i.width:e.width=180,e.sortOrder="",e.sorted="",a.push(e),e.index!==o&&(n=!0),e.visible=void 0===i.visible||i.visible,e._state&&(e._state.visible=void 0===i.visible||i.visible,e._state.freeze=void 0!==i.freeze&&i.freeze,e._state.width=i.width?i.width:180);const s=e.freeze;e.freeze=void 0!==i.freeze&&i.freeze,s!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=r}}}n&&(t.columns=a)}}if(e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let l=[];if(e.colors.conditions)for(let t=0;t<e.colors.conditions.length;t++){let o=e.colors.conditions[t],a=[];for(let e in o)a.push(o[e]);l.push(a)}o||(o=!0,t.beginUpdate());const a={type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate};t.$.headerBar._appliedColors=[l,a],t._conditionalColors.update=e=>{t.$.headerBar._updateConditionalColors(e,t,a)}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort){const l=e.sort[o];if(l){const e=l.sortOrder,a=l.dataField?l.dataField:o,n=t.columnByDataField[a];n&&t.sortBy(n.dataField,e)}}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){let l=o,a=e.filter[l];if(e.filter[0]&&(l=e.filter[o].dataField,a=e.filter[o].filter),a){t.addFilter(l,a,!1);const e=t.columnByDataField[l];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(e.selectedCells&&(o||(o=!0,t.beginUpdate()),t.selectCellsById(e.selectedCells)),e.selectedRows&&t.selectRows(e.selectedRows),e.labeledBy&&(t._labeledBy=e.labeledBy),o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),(l||n)&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let i=!1;if(e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(i=!0),t._stackedBy=e.kanban.stackedBy),e.scheduler&&e.scheduler.stackedBy&&(void 0===t._dateStackedBy&&(t._dateStackedBy=e.scheduler.stackedBy),t._dateStackedBy!==e.scheduler.stackedBy&&(i=!0),e.scheduler.labeledBy&&(t._labeledBy=e.scheduler.labeledBy),e.scheduler.viewType&&(t._schedulerViewType=e.scheduler.viewType),void 0===t._dateStackedBySelect&&(t._dateStackedBySelect=e.scheduler.groupBy),t._dateStackedBySelect!==e.scheduler.groupBy&&(i=!0),t._dateStackedBy&&Array.isArray(t._dateStackedBy)&&e.scheduler.stackedBy&&Array.isArray(e.scheduler.stackedBy)&&JSON.stringify(t._dateStackedBy)===JSON.stringify(e.scheduler.stackedBy)&&(i=!1),t._dateStackedBy=e.scheduler.stackedBy),(i||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.selectedCells){const o=[];let l=99999999,a=null,n=99999999,i=null,r=99999999,s=null;for(let l=0;l<e.selectedCells.length;l++){const a=e.selectedCells[l],d=a[0],c=a[1],u=t.columnByDataField[c];if(u&&(n=Math.min(n,u.index),i=Math.max(i,u.index)),!t.rowById[d])continue;const m=t.rowById[d].visibleIndex;m>=0&&(r=Math.min(r,m),s=Math.max(s,m)),o[d]||(o[d]=[]),o[d].push(c)}let d=0,c=!0;for(let e in o){const t=o[e];if(d&&t.length!==d){c=!1;break}d=t.length}if(c){const e=t.getRows(),o=e[r],d=e[s];if(l=o?o.id:-1,a=d?d.id:-1,o){const e=t.columns[n];if(e){const o=t.rowById[l].getCell(e.dataField);t._selection.focusedCell={id:o.row.id,value:o.value,dataField:o.column.dataField,index:o.row.index},setTimeout((()=>{t._selectCellsRange(t.rowById[l],t.rowById[a],t.columns[n].dataField,t.columns[i].dataField)}),50)}}}}e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),delete t._labeledBy,delete t._dateStackedBySelect,t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)||o.stateSettings.onStateChange&&o._forceStateChange?o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r):o.stateSettings.onStateChange&&"grid"!==o.view&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;e._savingState&&clearTimeout(e._savingState),e._savingState=setTimeout((()=>{if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){let t=e.localize("newGrid")+" "+e.localize("view");"kanban"===e.view?t=e.localize("newKanban")+" "+e.localize("view"):"card"===e.view?t=e.localize("newCard")+" "+e.localize("view"):"scheduler"===e.view&&(t=e.localize("newScheduler")+" "+e.localize("view")),e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}),50)}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t){const o=this;o._conditionalColors={type:t.type,decorate:t.decorate,conditions:e,singleSelect:t.singleSelect},o.$.headerBar.addColors(JSON.parse(JSON.stringify(e)),{type:t.type,singleSelect:t.singleSelect,decorate:t.decorate},[]),o._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells(!1):null,i=!e||e&&e.includes("selection")?t.getSelectedRowIds():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const c={count:d,index:t.paging.pageIndex,size:t._pageSize},u={};o&&o.length&&(u.sort=o),l&&l.length&&(u.filter=l),a&&a.length&&(u.groups=a),c&&t.paging.enabled&&(u.paging=c),n&&n.length&&(u.selectedCells=n),i&&i.length&&(u.selectedRows=i),s&&(delete s.colors,u.colors=s),t._labeledBy&&(u.labeledBy=t._labeledBy),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"===t.view&&(u.kanban=t.getKanbanState()),"scheduler"===t.view&&(u.scheduler=t.getSchedulerState()),u.view=t.view);const m=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&m.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}u.columns=m}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}Object.values(e).length&&(u.expandedRows=e)}if((t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"!==t.view&&"scheduler"!==t.view||(delete u.expandedRows,delete u.columns,delete u.paging,delete u.selectedCells,delete u.selectedRows)),e){const t={};for(let o in e){const l=e[o];u[l]&&(t[l]=u[l])}return t}return u}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),o.column.element.setAttribute("level",o.level),0===o.columns.length&&o.column.element.classList.add("smart-hidden");const l=o.collapseButton;l&&o.column.element.appendChild(l),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o,l){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(!0===a._disableEndEdit||a.editing.dialog.visible||a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],c=d?d.top:0,u=0,m=0,p=0,g=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(r>=5?e=5:r>=4?e=4:r>=3?e=3:r>=2?e=2:r>=1&&(e=1),e>0){const t=s[r-e];t&&(d=t,c=d?d.top:0,p=e*d.height,r-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=s.indexOf(t.row);if(r>o&&r<=o+t.rowSpan&&(r=o,d=t.row,p=Math.max(p,c-d.top),c=d.top,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=u&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];g=Math.max(g,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let h=null;if(!1!==e||a._cellsMerge.length>0){if(a._columnElements)for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._firstVisibleUserColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._firstVisibleUserColumn||t.autoGenerated||(a._firstVisibleUserColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),!1!==a.appearance.showColumnGroupCellLines&&!1!==a.appearance.showColumnGroupLines||(t.parent&&t.parent.columns&&t.parent.columns[0].dataField===t.dataField?t.element.setAttribute("column-group-first-child",""):t.parent&&t.element.removeAttribute("column-group-first-child")),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){a._columnElements||(a._columnElements=[]);const o=a._columnElements[m++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),h||(h=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===i&&(i=t.left))}}}if(void 0===i&&(i=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const f=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;let y=0,w=a.behavior.allowRenderCache&&!f&&"grid"===a.view&&!a.dataSource.virtualDataSourceOnExpand&&!a.rowDetail.template&&!a.rowDetail.enabled&&!a._autoHeight&&!a.pager.visible&&!a._frozenFarColumns.length&&!a.hasAttribute("tree");if("grid"!==a.view)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];t.style.transform="",t.style.top="",t.style.position=""}if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;if(f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),c=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.paging.enabled||(r=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize)),"card"===a.view&&a._cardHeight&&(e+=a._cardHeight),w)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];delete t.isRendered,t.classList.remove("smart-hidden"),t.classList.remove("aria-rowindex"),t.style.transform="",t.style.top="",t.style.position=""}if(w){let e=Math.max(a._clientSize.height,a._overflowOffset),o=[],l=c;for(let t=r;t<s.length;t++){const i=s[t];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),l+r>=n-p&&l<=n+e||a._autoHeight){for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];if(t.hasAttribute("data-id")&&t.getAttribute("data-id")===""+i.id){o[i.id]=t,t.isRendered=!0;break}}l+=r}}e=Math.max(a._clientSize.height,a._overflowOffset);for(let l=r;l<s.length;l++){const i=s[l];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),c+r>=n-p&&c<=n+e||a._autoHeight){let e;if(e=a._rowElements[m++],!e)break;for(;e&&e.isRendered;)e=a._rowElements[m++];if(!e){console.log("Did not found a row element during the rendering.");continue}e.setAttribute("aria-rowindex",t+l+1);let n=!1;if(i.element=e,i.grid=a,o[i.id]){const a=o[i.id];a.hasAttribute("data-id")&&a.getAttribute("data-id")===""+i.id&&(a===e&&(a.isRendered=!0,n=!0,m=0),n=!0,m=0,i.element=a,e.style.top="999999px",e.setAttribute("data-id",999999),e.setAttribute("aria-rowindex",t+l+1),e=a,a.isRendered=!0)}e.style.top=y+"px",e.style.position="absolute",i.render(n),e.isRendered=!0,c+=r,y+=r}}}else{a.rowDetail.enabled&&(e+=a.offsetHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(c+i>=n-p&&c<=n+e||a._autoHeight))break;{let e;if(e=a._rowElements[m++],!e)break;if(e.isRendered&&(e.classList.remove("smart-hidden"),e.classList.remove("aria-rowindex"),e.style.transform="",e.style.top="",e.style.position=""),e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render(),e.isRendered=!0}c+=i,y+=i}}}a._renderFrozenRows();let _=m;if(m<a._rowElements.length&&!w)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}if(w)for(let e=0;e<a._rowElements.length;e++)if(!a._rowElements[e].isRendered){const t=a._rowElements[e];t.classList.add("smart-hidden"),t.removeAttribute("aria-rowindex")}if(a.editing.addNewRow&&a.editing.addNewRow.visible&&"row"!==a.editing.addNewRow.displayMode&&a._rowElements[_]){a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0}));for(let e=a._rowElements.length-1;e>=0;e--)if(!a._rowElements[e].isRendered){a._newRow.element=a._rowElements[e],a._newRow.element.classList.remove("smart-hidden"),a._newRow.element.style.top=y+"px",a._newRow.element.style.position="absolute",a._newRow.render();break}}f&&(a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects())}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e.filtering.filterRow.visible&&e.$.rowNearContainer.classList.remove("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||"add"===e||"update"===e||"delete"===e||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo||null,sorting:o.getSortedColumnsByDataField(),filtering:o.getFilteredColumnsByDataField(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action){if(t&&t(e.result),o._autoHeight&&o.rows.length>=o._rowElements.length-1&&(o._initializeRows(),o._initializeRowElements(),o.refresh(),o.filtering.filterRow)){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}return}if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}localizeString(e,t,o="en"){const l=this;o&&l.messages[o][e]&&(l.messages[o][e]=t,l.refresh())}localizeStrings(e,t="en"){const o=this;t&&(Object.assign(o.messages[t],e),o.refresh())}_createInsertNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus insert",t.title=e.localize("contextMenuItemInsertRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",t.style.boxShadow="var(--smart-elevation-1)",t.style.width="16px",t.style.height="16px",t.style.fontSize="12px",t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0;const o=e.editing.addNewRow._insertButton.row;o?e.insertRow(t,1+o.visibleIndex):e._add(t),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}removeColumn(e){const t=this;let o=-1;if(e)for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){o=l;break}o>=0&&t.columns.splice(o,1)}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.classList.add("smart-hidden"),void t.editing.addNewRow._addButton.classList.remove("show");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy&&t.dataSource.groupBy.length>0)||t.editing.addNewRow._addButton.classList.remove("show"))};t.editing.addNewRow._addButton&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),!t.editing.addNewRow.visible||"row"===t.editing.addNewRow.displayMode&&t.$.placeholder.classList.contains("smart-hidden")||(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=!t.appearance.showViewBar||t.appearance.viewBarAppendTo||t.appearance.showViewBarAsDropdown||t._mobile?"":10+t.layout.viewBarWidth+"px",o(),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),t.editing.addNewRow.visible&&!t.computedVerticalScrollBarVisibility&&t._newRow&&t.editing.addNewRow._addButton.classList.remove("show"),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"))})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.editing.addNewRow._insertButton=t._createInsertNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),t.appendChild(t.editing.addNewRow._insertButton),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o(),(t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode||!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden"))&&t.editing.addNewRow._addButton.classList.remove("show"))}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollRecycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(!0!==o._disableEndEdit&&o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect(),o._copyRects&&o._copyRects.length&&o._refreshCopyRects();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"row"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"),"grid"===t.view&&"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")}),0))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}setCellFormula(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,e.formula=o,e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e,t){const o=this;o.isInitialized&&(e&&(o._initializeRows(),o._initializeRowElements()),o._refresh(t),o._refreshSummary())}refreshView(e=!0){const t=this;if(t._recycleFiles=!0,!e)return t._recycle(!1,!0),void delete t._recycleFiles;t._recycle(),delete t._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t,o=!0){const l=this;l._isUpdating--,l._isUpdating<0&&(l._isUpdating=0),!1!==e?l.refresh():!1!==t&&l.refreshView(o)}_generateUUID(){const e=window.crypto,t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=Array.from(t,(e=>e.toString(16).padStart(2,"0"))).join("");return`${o.substring(0,8)}-${o.substring(8,12)}-${o.substring(12,16)}-${o.substring(16,20)}-${o.substring(20)}`}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1450
1450
 
1451
1451
  /***/ }),
1452
1452
 
@@ -1537,7 +1537,7 @@ Smart.Utilities.Assign("Grid.Sort",class{clearSort(){const t=this;if(!t._isSorti
1537
1537
  /***/ 238:
1538
1538
  /***/ (() => {
1539
1539
 
1540
- Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewStatesButton" class="smart-data-view-header-button smart-data-view-states-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ViewStates"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="aiButton" class="smart-data-view-header-button smart-data-view-ai-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ai"></div>\n <div id="resourceButton" class="smart-data-view-header-button smart-data-view-resource-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Resource"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="labelButton" class="smart-data-view-header-button smart-data-view-label-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Lael"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="colorsButton" class="smart-data-view-header-button smart-data-view-colors-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Colors"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customButton" class="smart-data-view-header-button smart-data-view-custom-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Custom"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="boldButton" class="smart-data-view-header-button smart-data-view-bold-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Bold"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="italicButton" class="smart-data-view-header-button smart-data-view-italic-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Italic">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="underlineButton" class="smart-data-view-header-button smart-data-view-underline-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Underline">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="strikethroughButton" class="smart-data-view-header-button smart-data-view-strikethrough-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Strikethrough">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontFamilyButton" class="smart-data-view-header-button smart-data-view-fontfamily-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Family">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontSizeButton" class="smart-data-view-header-button smart-data-view-fontsize-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Size">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="backgroundButton" class="smart-data-view-header-button smart-data-view-background-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Background">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="colorButton" class="smart-data-view-header-button smart-data-view-textcolor-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Text Color">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="view" class="smart-hidden" role="presentation"></div>\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="ai" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="colors" 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" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}_refreshMobileViewTools(){const e=this;e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden"),e.parentNode.classList.add("mobile")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden"),e.parentNode.classList.remove("mobile")}))}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e._refreshMobileViewTools(),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;const o=t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.colorsButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled"),e.$.resourceButton.classList[a]("smart-disabled"),e.$.labelButton.classList[a]("smart-disabled")};o(e.dataSource&&0===e.dataSource.length),t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&"infinite"!==t.scrolling&&o(!1),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),t.$.headerDropDown.addEventListener("close",(()=>{t._dropDownCloseDate=new Date})),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget);const a=t.grid.parentElement,o=a?a.scrollTop:0;if(t.grid.header.appendTo){const e=document.querySelector(t.grid.header.appendTo);t.$.headerDropDown.style.top=t.grid.offset(e).top+e.offsetHeight-o+"px"}else t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight-o+"px";const s=()=>{if(e){const a=t.grid.offset(e);if(a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px",a.top+t.$.headerDropDown.offsetHeight>=document.documentElement.clientHeight-40){let e=t.grid.offset(t.grid).top-t.$.headerDropDown.offsetHeight;if(t.grid.header.appendTo){const a=document.querySelector(t.grid.header.appendTo);e=t.grid.offset(a).top-t.$.headerDropDown.offsetHeight}e<0&&(e=0),t.$.headerDropDown.style.top=e+"px"}}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",s())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;if(s.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}const n=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");n&&s.ai&&s.ai.key&&(n.$.addAIFilterButton.classList.remove("smart-hidden"),n.$.aiFilterPrompt.classList.add("smart-hidden"),n.$.spinner.classList.add("smart-hidden"),n.$.addAIFilterButton.onclick=()=>{n.$.aiFilterPrompt.placeholder=s.localize("dialogFilterHeader"),n.$.aiFilterPrompt.classList.toggle("smart-hidden"),n.$.spinner.classList.remove("smart-hidden"),n.$.aiFilterPrompt.focus(),n.$.aiFilterPrompt.parentElement.style.display="flex",n.$.aiFilterPrompt.parentElement.style.flexDirection="column",n.$.aiFilterPrompt.onchange=n.$.aiFilterPrompt.oninput=e=>{const t=()=>{let e=0;const t=setInterval((()=>{n.$.spinner.innerHTML=`\rThinking${".".repeat(e%4)} `,e++}),500);try{s.filterBy(n.$.aiFilterPrompt.value,null,(e=>{n.$.spinner.innerHTML="",n.$.spinner.classList.add("smart-hidden"),clearInterval(t);const a=[];for(let t in e){const o=e[t].filterGroup;for(let e=0;e<o.filters.length;e++){const s=o.filters[e];a.push([t,s.condition,s.value])}}n.value=a}))}catch(e){n.$.spinner.innerHTML=s.localize("noResults"),clearInterval(t)}};"Enter"===e.key?(n.aiTimer&&clearTimeout(n.aiTimer),t()):(n.aiTimer&&clearTimeout(n.aiTimer),n.aiTimer=setTimeout((()=>{t()}),800))}})}openColorsPanel(){const e=this,t=e.dataSource;e._refreshColumns("colors"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden");const a=this.columns.map((e=>{const a=Object.assign({},e),o=t.dataFields.find((e=>e.name===a.dataField));return o&&(a.dataType=o.dataType),a}));super.openColorsPanel(a,null,e.grid),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.grid.closeMenu()}openViewPanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;if(!1===e.grid.appearance.showViewBarAsDropdown)return;let t;e.$.headerDropDown.classList.add("view-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel","colors-panel"),e.$.view.classList.remove("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.format&&e.$.format.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._viewPartCreated?t=e.$.view.firstElementChild:(t=document.createElement("div"),t.classList.add("smart-view-panel","smart-grid-view-bar"),e.$.view.appendChild(t),e.$.viewPanel=t,e._viewPartCreated=!0,e._updateViews()),e._openHeaderDropDown(e.$.viewStatesButton)}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=t.columns.map((e=>{const o=Object.assign({},e),s=t._appliedSorting.dataFields.indexOf(o.dataField),n=a.dataFields.find((e=>e.name===o.dataField));return n&&(o.dataType=n.dataType,o.sortIndex=s,-1!==s&&(o.sortDirection=t._appliedSorting.orderBy[s])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;s.closeMenu();const n=t.$.headerDropDown.querySelector("smart-sort-panel");if(!n)return;n.grid=s,n.$.maintainSortContainer.classList.remove("smart-hidden"),s.sorting.maintainSort?n.$.maintainSortContainer.firstElementChild.setAttribute("active",""):n.$.maintainSortContainer.firstElementChild.removeAttribute("active"),n._changeApplyButtonText();const i=n.$.inputNotSorted,r=()=>{const e=n.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};n.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,s=0,n=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(s++,n.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===s||o===s&&i.toString()!==n.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,s=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let n;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)n=o.querySelector("smart-column-panel"),n.locale=e.locale,n.messages=e._innerElementMessages.columnPanel,n.set("dataSource",s),n.propertyChangedHandler("dataSource",void 0,s),n.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=s,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],s=o[0],n=o[1];a.grid.columnByDataField[s].filter=n}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document,a.grid.autoSaveState()}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document,e.grid.autoSaveState()}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")?t="customize":e.$.headerDropDown.classList.contains("view-panel")?t="view":e.$.headerDropDown.classList.contains("colors-panel")&&(t="colors"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,s=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&s.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();t.$.ai.contains(a)&&t._applyAI(),s.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)?t.addSort(o.sortByInfo):t.$.colors.contains(a)&&t.addColors(o.value,o.decorator,o.filters),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target,o=t.grid?t.grid.$.header:null;if(t.grid&&t.grid.header.appendTo&&(o=document.querySelector(t.grid.header.appendTo)),!o)return;t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]);const s=e.originalEvent.composedPath();for(let e=0;e<s.length;e++){const t=s[e];if(t&&t.classList&&t.classList.contains("smart-menu-item")){const e=t.closest("smart-menu");if(e&&e.classList.contains("smart-grid-views-menu"))return;if(e&&e.classList.contains("smart-grid-download-menu"))return}}if(t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),a!==t.$.colorButton&&a!==t.$.backgroundButton&&t._closeColorMenu(),a!==t.$.fontSizeButton&&t._closeFontSizeMenu(),a!==t.$.fontFamilyButton&&t._closeFontFamilyMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||a!==o&&o.contains(a))){const s=a.closest("smart-scroll-viewer"),n=a.closest(".smart-drop-down");if((!s||!o.contains(s.ownerElement))&&(!n||n.ownerElement&&!o.contains(n.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;if(t._dropDownCloseDate&&new Date-t._dropDownCloseDate<500)return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,s=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((t=>!(!t||!1===t._visible||("filter"===e||"sort"===e)&&("sort"===e&&!t.sortOrder||"filter"===e&&!t.filter)&&!1===t.visible))),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null,options:e.editor&&e.editor.dataSource?e.editor.dataSource:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;s.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;s.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),t.grid.appearance.showViewBarAsDropdown||t._updateViews(),e.header.onInit&&e.header.onInit(t)}_removeFontFamilyMenu(){const e=this;if(e.fontFamilyMenu){const t=e.fontFamilyMenu.querySelector("smart-menu");t&&e.fontFamilyMenu.removeChild(t)}}_removeFontSizeMenu(){const e=this;if(e.fontSizeMenu){const t=e.fontSizeMenu.querySelector("smart-menu");t&&e.fontSizeMenu.removeChild(t)}}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeLabelMenu(){const e=this;if(e.labelMenu){const t=e.labelMenu.querySelector("smart-menu");t&&e.labelMenu.removeChild(t);const a=e.labelMenu.querySelector(".label");a&&e.labelMenu.removeChild(a)}}_removeResourceMenu(){const e=this;if(e.resourceMenu){const t=e.resourceMenu.querySelector("smart-menu");t&&e.resourceMenu.removeChild(t);const a=e.resourceMenu.querySelector(".label");a&&e.resourceMenu.removeChild(a)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t);const a=e.viewsMenu.querySelector(".label");a&&e.viewsMenu.removeChild(a)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o)=>{const s=document.createElement("smart-menu-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt","grid"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("gridView");break;case"kanban":n="smart-icon-kanban-alt","kanban"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("kanbanView");break;case"card":n="smart-icon-card-alt","card"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("cardView");break;case"scheduler":n="smart-icon-scheduler","scheduler"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("schedulerView");break;case"timeline":n="smart-icon-timeline","timeline"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("timelineView")}return s.label='<span class="smart-grid-icon '+n+'"></span>'+e,s.value=a,s};o.appendChild(s(t.localize("viewGrid"),"grid",!0)),o.appendChild(s(t.localize("viewKanban"),"kanban",!0)),o.appendChild(s(t.localize("viewCard"),"card",!0)),o.appendChild(s(t.localize("viewScheduler"),"scheduler",!0)),a.appendChild(o),e.viewsMenu.insertBefore(a,e.viewsMenu.children[e.viewsMenu.children.length-1]),e.viewsMenu.onpointerup=()=>!1,a.onItemClick=a=>{e._setView(a.detail.value),e._closeViewsMenu(),t.autoSaveState(),e._updateViews()}}_createResourceMenuItems(){const e=this,t=e.grid;e._removeResourceMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._dateStackedBySelect===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};let n=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.editor&&a.editor.dataSource&&a.editor.singleSelect&&a.editor.dataSource.length&&("collaborator"===a.template||"tags"===a.template)&&(o.appendChild(s(a.label,a.icon,0,a.dataField)),n=!0)}if(a.appendChild(o),n&&e.resourceMenu.insertBefore(a,e.resourceMenu.children[e.resourceMenu.children.length-1]),e.resourceMenu.onpointerup=()=>!1,!n){const a=document.createElement("div");a.classList.add("label","smart-flex","middle","center","smart-quiet"),a.style.minHeight="60px",a.style.height="100%",a.innerHTML=t.localize("noGrouping"),e.resourceMenu.appendChild(a)}a.onItemClick=a=>{t._dateStackedBySelect===a.detail.item.value?delete t._dateStackedBySelect:t._dateStackedBySelect=a.detail.item.value,t._onSort&&t._onSort(),e._closeResourceMenu(),t.autoSaveState()}}_updateViews(){const e=this,t=e.grid;if(t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.removeAttribute("aria-expanded"),t.stateSettings.enabled&&t.appearance.showViewBar){const a=e=>{(!t.users.length||!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser)&&(delete t.stateSettings.storage[e.valueName],t.stateSettings.current===e.valueName&&(t.stateSettings.current=""),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],e.valueName,t.stateSettings.storage,t.stringify_object),e.remove())},o=a=>{const o=document.createElement("input");if(o.value=a.valueName,t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser))return;const s=()=>{if(o.value){if(t.stateSettings.storage[o.value])return;const s=t.stateSettings.storage[a.valueName];t.stateSettings.current===a.valueName&&(t.stateSettings.current=o.value),delete t.stateSettings.storage[s.name],s.name=o.value,t.stateSettings.storage[s.name]=s,t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],s.name,t.stateSettings.storage,t.stringify_object),delete t.stateSettings.storage[a.valueName],o.remove();const n=o.value;a.valueName=n;let i="smart-icon-grid-alt";switch(s.view){case"grid":i="smart-icon-grid-alt";break;case"kanban":i="smart-icon-kanban-alt";break;case"card":i="smart-icon-card-alt";break;case"scheduler":i="smart-icon-scheduler";break;case"timeline":i="smart-icon-timeline"}n===t.stateSettings.current?(a.selected=!0,a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',e._refreshViewsButton()}};o.onselectstart=e=>{e.stopPropagation()},o.onpointerdown=o.onpointerup=e=>{e.stopPropagation()},o.onkeydown=e=>{e.stopPropagation()},o.onkeyup=e=>{"Escape"===e.key&&(o.onchange=o.onblur=null,o.remove()),"Enter"===e.key&&(o.onchange=o.onblur=null,s()),e.stopPropagation()},o.onchange=()=>{o.onblur=null,o.onkeyup=null,s()},o.onblur=()=>{o.remove()},o.style.width="100%",o.style.height="100%",o.style.position="absolute",o.style.left="0px",o.style.top="0px",o.style.zIndex=99,o.classList.add("smart-input"),o.classList.add("underlined"),o.style.backgroundColor="var(--smart-background)",o.style.color="var(--smart-background-color)",a.querySelector(".smart-list-item-label-element").appendChild(o),setTimeout((()=>{o.focus()}),50)},s=(e,a,o)=>{const s=document.createElement("smart-list-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt";break;case"kanban":n="smart-icon-kanban-alt";break;case"card":n="smart-icon-card-alt";break;case"scheduler":n="smart-icon-scheduler";break;case"timeline":n="smart-icon-timeline"}return s.value=o,s.valueName=e,e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>')),s};t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.setAttribute("aria-expanded",!0);let n=t.$.viewBar;if(t.appearance.showViewBarAsDropdown&&(n=e.$.viewPanel),t.appearance.viewBarAppendTo&&(n=document.querySelector(t.appearance.viewBarAppendTo),n&&n.classList.add("smart-grid-view-bar")),n&&!n.querySelector(".smart-grid-view-chooser-container")){const a=document.createElement("div");a.classList.add("smart-grid-view-chooser-container","smart-container");const o=document.createElement("div");o.classList.add("new-view"),!1===t.editing.enabled&&o.classList.add("smart-hidden");const s=(a,o)=>{a.stopPropagation(),a.preventDefault(),t.beginUpdate();let s=0,i=[];if(t.stateSettings.storage){for(;t.stateSettings.storage[t.localize("view")+" "+s];)s++;for(let e in t.stateSettings.storage){const a=t.stateSettings.storage[e];i[a.view]=1+i[a.view]||1}}let r="";switch(o){case"grid":r=t.localize("viewGrid");break;case"kanban":r=t.localize("viewKanban");break;case"card":r=t.localize("viewCard");break;case"scheduler":r=t.localize("viewScheduler");break;case"timeline":r=t.localize("viewTimeline")}if(i[o]||(i[o]=""),t.stateSettings.storage){let e=i[o]?t.localize("view")+" "+i[o]:t.localize("view");for(;t.stateSettings.storage[r+" "+e];)e=t.localize("view")+" "+i[o],i[o]++}const l=i[o]?t.localize("view")+" "+i[o]:t.localize("view");if(!n){let a=t.$.viewBar;t.appearance.showViewBarAsDropdown&&(a=e.$.viewPanel),t.appearance.viewBarAppendTo&&(a=document.querySelector(t.appearance.viewBarAppendTo),a&&a.classList.add("smart-grid-view-bar")),a&&(n=a)}if(!n)return void t.endUpdate();n._input.value=r+" "+l,t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,e._closeViewsMenu(),t.resetState(!1);const d=t.view;t.set("view","grid",!1),t._kanban&&t._kanban._reset(),delete t.columnByDataField.taskStatus,"grid"===o&&"grid"!==d?e._setView("grid",!0):"kanban"===o?e._setView("kanban"):"card"===o?e._setView("card"):"scheduler"===o?e._setView("scheduler"):"timeline"===o&&e._setView("timeline"),t.saveState(),t.endUpdate(),e._updateViews(),t.$.fireEvent("viewChanged",{view:t.view})},i=document.createElement("smart-button");i.classList.add("selected"),i.classList.add("view"),i.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-grid-alt"></span>'+t.localize("newGrid")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',i.title=t.localize("gridView");const r=document.createElement("smart-button");r.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-kanban-alt"></span>'+t.localize("newKanban")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',r.classList.add("view"),r.title=t.localize("kanbanView");const l=document.createElement("smart-button");l.classList.add("selected"),l.classList.add("view"),l.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-card-alt"></span>'+t.localize("newCard")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',l.title=t.localize("cardView");const d=document.createElement("smart-button");d.classList.add("selected"),d.classList.add("view"),d.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-scheduler"></span>'+t.localize("newScheduler")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',d.title=t.localize("schedulerView");const c=document.createElement("smart-button");c.classList.add("selected"),c.classList.add("view"),c.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-timeline"></span>'+t.localize("newTimeline")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',c.title=t.localize("timelineView");const u=document.createElement("div");u.classList.add("smart-grid-view-storage"),a.appendChild(u);const m=document.createElement("smart-input");m.classList.add("underlined"),m.placeholder=t.localize("viewNamePlaceholder"),m.hint=t.localize("viewNamePlaceholder"),m.onselectstart=e=>{e.stopPropagation()};const p=document.createElement("div");p.innerHTML="<span>"+t.localize("settings")+'</span><span class="smart-grid-icon show smart-icon-sort-down"></span>',p.classList.add("view-label"),o.appendChild(p);const h=document.createElement("div");o.appendChild(h),h.classList.add("footer"),t.users&&t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(h.classList.add("smart-hidden"),p.classList.add("smart-hidden"))),h.appendChild(i),h.appendChild(r),h.appendChild(l),h.appendChild(d),p.onclick=()=>{p.classList.toggle("collapsed"),h.classList.toggle("collapsed")};const g=document.createElement("div");g.innerHTML='<span class="smart-grid-icon show smart-icon-plus"></span><span><a href="javascript:void();">'+t.localize("createView")+"</a></span>",g.classList.add("view-button"),g.onclick=e=>{let t="grid";r.classList.contains("selected")&&(t="kanban"),l.classList.contains("selected")&&(t="card"),d.classList.contains("selected")&&(t="scheduler"),c.classList.contains("selected")&&(t="timeline"),s(e,t,o)},r.onpointerdown=()=>{r.classList.add("selected"),i.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},i.onpointerdown=()=>{i.classList.add("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},l.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.add("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},d.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.add("selected"),c.classList.remove("selected"),g.click()},c.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.add("selected"),g.click()};const v=()=>{t.stateSettings.storage&&!t.stateSettings.storage[m.value]||m.value&&!t.stateSettings.storage?g.classList.remove("disabled"):g.classList.add("disabled")};m.update=()=>v(),m.onkeyup=m.onchange=()=>{v()},v(),a.appendChild(o),n._storage=u,n._input=m,n.appendChild(a)}let i=t.stateSettings.storage;(i&&0===Object.keys(i).length||!i)&&(n._input.value||("kanban"===t.view?n._input.value=t.localize("newKanban")+" "+t.localize("view"):"card"===t.view?n._input.value=t.localize("newCard")+" "+t.localize("view"):"scheduler"===t.view?n._input.value=t.localize("newScheduler")+" "+t.localize("view"):n._input.value=t.localize("newGrid")+" "+t.localize("view")),t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,i=t.stateSettings.storage);const r=n?n._storage:document.createElement("div");if(r.innerHTML="",i){let e=1;const l=document.createDocumentFragment();let d=[],c=[];for(let e in i){const t=i[e];c[t.name]||(c[t.name]=t,d.push({name:e,value:t}))}d.sort(((e,t)=>{const a=new Date(e.value.date),o=new Date(t.value.date);if(e.value&&e.value.date&&t.value&&t.value.date){if(!e.value.date||!t.value.date)return-1;if(a<o)return-1;if(a>o)return 1;if(a===o)return 0}else{if(e.name<t.name)return-1;if(e.name>t.name)return 1;if(e.name===t.name)return 0}}));let u=[],m=-1;for(let t in d){const a=d[t],o=a.name,n=a.value;e++,u[n.view]=u[n.view]++||1;const i=s(o,n.view,n);i.selected&&(m=parseInt(t),delete i.selected),l.appendChild(i)}if(e){const e=document.createElement("smart-list-box");e.style.width="100%",e.style.height="100%",e.allowDrag=!0,e.allowDrop=!0,e.itemHeight=32,e.mode="vertical",e.style.borderColor="transparent",e.classList.add("smart-grid-views-menu"),e.checkable=!0,e.checkboxes=!0,e.filterable=!0,e.filterInputPlaceholder=t.localize("commandBarSearch")+" "+t.localize("view"),e.selectionMode="one",e.disableAutoCheck=!0,e.rightToLeft=t.rightToLeft,e.ondragend=e=>{const t=e.detail.item;if(i[t.valueName]){const t=e.detail.target;if(t){const e=i[t.valueName],a=e?e.date:null;if(a){let t=new Smart.Utilities.DateTime(a);const o="top"===Smart.ListBox.DragDrop.DropDetails.position?-10:10;t=t.addSeconds(o),e.date=t.toDate().toJSON()}}}},e.onkeydown=t=>{const a=e.querySelector("smart-list-item[checked]");a&&"F2"===t.key&&o(a)},e.onDoubleClick=e=>{const t=e.target.closest("smart-list-item");o(t)},e.onClick=e=>{if(e.target&&e.target.classList.contains("smart-icon-delete")){const t=e.target.closest("smart-list-item");a(t),e.preventDefault(),e.stopPropagation()}else if(e.target&&e.target.classList.contains("smart-icon-mode-edit")){const t=e.target.closest("smart-list-item");o(t),e.preventDefault(),e.stopPropagation()}else if("INPUT"===e.target.nodeName)return},e.appendChild(l),r.appendChild(e),e.clearSelection(),e.selectedIndexes=[m],e.onchange=a=>{if(a.detail&&a.detail.selected){const o=a.detail.addedItems[0];t.loadState(o.valueName),e.querySelectorAll("smart-list-item").forEach((e=>{e.querySelector(".smart-icon-delete").classList.add("show")})),o.querySelector(".smart-icon-delete").classList.remove("show"),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],o.valueName,t.stateSettings.storage,t.stringify_object)}}}if(t.stateSettings.storage)for(;t.stateSettings.storage[t.localize("view")+" "+e];)e++;let p="";switch(t.view){case"grid":p=t.localize("viewGrid");break;case"kanban":p=t.localize("viewKanban");break;case"card":p=t.localize("viewCard");break;case"scheduler":p=t.localize("viewScheduler");break;case"timeline":p=t.localize("viewTimeline")}if(t.stateSettings.storage)for(;t.stateSettings.storage[p+" "+t.localize("view")+" "+u[t.view]];)u[t.view]++;n&&n._input&&(n._input.value=p+" "+t.localize("view")+" "+u[t.view],n._input.update())}}}_setView(e,t){const a=this,o=a.grid;if(o.view===e&&!0!==t)return;o.view;const s=o.context;if("kanban"===e)if(o.context=o,o.view="kanban",o.context=s,o._kanbanInitialized&&o.columnByDataField.taskStatus)if(o.columnByDataField.taskStatus&&o._stackedBy&&o.columnByDataField.taskStatus.dataField!==o._stackedBy){o.beginUpdate(),delete o.columnByDataField.taskStatus;const e=o.columnByDataField[o._stackedBy];o.columnByDataField.taskStatus=e,o._createKanban(e),o._refreshHeaderBar(),o.endUpdate(!1),o._hideSchedulerView(),o._showKanbanView(),a._refresh()}else o._hideSchedulerView(),o._showKanbanView(),a._refresh();else delete o._kanbanInitialized,o._initKanbanView("dynamic","grid");else"grid"===e?(o.context=o,o.view="grid",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"card"===e?(o.context=o,o.view="card",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"scheduler"!==e&&"timeline"!==e||(o.context=o,o.view=e,o.context=s,t?(o._hideKanbanView(),o._showSchedulerView(),a._refresh()):(o._createScheduler(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()));o.$.fireEvent("viewChanged",{view:e}),a._refresh()}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const s=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const s='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+s+e,a.value=t,a};o.appendChild(s(t.localize("download")+" CSV","csv")),o.appendChild(s(t.localize("download")+" XLSX","xlsx")),o.appendChild(s(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")?e._closeViewsMenu():e.resourceMenu&&e.resourceMenu.classList.contains("open")?e._closeResourceMenu():e.labelMenu&&e.labelMenu.classList.contains("open")?e._closeLabelMenu():e.colorMenu&&e.colorMenu.classList.contains("open")&&e._closeColorMenu()}_closeResourceMenu(){const e=this,t=e.resourceMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.resourceButton.classList.remove("selected"),e.$.resourceButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openResourceMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.resourceMenu&&e.resourceMenu.classList.contains("open"))return void e._closeResourceMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.resourceButton.classList.add("selected"),e.$.resourceButton.setAttribute("aria-expanded",!0),e.resourceMenu||(e.resourceMenu=document.createElement("div"),e.resourceMenu.classList.add("smart-grid-column-menu","smart-grid-resource-menu"),e.resourceMenu.setAttribute("theme",e.getAttribute("theme")),e.resourceMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.resourceMenu.classList.add("smart-animate"),e._createResourceMenuItems(),e.resourceMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.resourceMenu):document.body.appendChild(e.resourceMenu);const t=e.$.resourceButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.resourceMenu.offsetWidth,a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.resourceMenu.offsetWidth)),e.resourceMenu.style.left=a+"px",e.resourceMenu.style.top=o+"px",e.resourceMenu.classList.remove("smart-hidden"),e.resourceMenu.classList.add("open")}_closeLabelMenu(){const e=this,t=e.labelMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.labelButton.classList.remove("selected"),e.$.labelButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_createLabelMenuItems(){const e=this,t=e.grid;e._removeLabelMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._labeledBy===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};for(let e=0;e<t.columns.length;e++){const a=t.columns[e];"string"!==a.dataType||a.relationField||"input"!==a.editor.template&&"textarea"!==a.editor.template||o.appendChild(s(a.label,a.icon,0,a.dataField))}a.appendChild(o),e.labelMenu.insertBefore(a,e.labelMenu.children[e.labelMenu.children.length-1]),e.labelMenu.onpointerup=()=>!1,a.onItemClick=a=>{t._labeledBy===a.detail.item.value?delete t._labeledBy:t._labeledBy=a.detail.item.value,t._onSort&&t._onSort(),e._closeLabelMenu(),t.autoSaveState()}}_closeColorMenu(){const e=this,t=e.colorMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.colorButton.classList.remove("selected"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.classList.remove("selected"),e.$.backgroundButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_closeFontSizeMenu(){const e=this,t=e.fontSizeMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontSizeButton.classList.remove("selected"),e.$.fontSizeButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontSizeMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontSizeMenu&&e.fontSizeMenu.classList.contains("open"))return void e._closeFontSizeMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontSizeButton.classList.add("selected"),e.$.fontSizeButton.setAttribute("aria-expanded",!0),e.fontSizeMenu||(e.fontSizeMenu=document.createElement("div"),e.fontSizeMenu.classList.add("smart-grid-column-menu","smart-grid-fontsize-menu"),e.fontSizeMenu.setAttribute("theme",e.getAttribute("theme")),e.fontSizeMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontSizeMenu.classList.add("smart-animate");const t=e.grid;e._removeFontSizeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","8px","10px","12px","14px","18px","24px"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontSizeMenu.appendChild(a),a.onItemClick=t=>{const a=t.detail.value;e._setStyle("fontSize",a)},e.fontSizeMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontSizeMenu):document.body.appendChild(e.fontSizeMenu);const n=e.$.fontSizeButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontSizeMenu.offsetWidth,i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontSizeButton.offsetWidth)),e.fontSizeMenu.style.width="60px",e.fontSizeMenu.style.left=i+"px",e.fontSizeMenu.style.top=r+"px",e.fontSizeMenu.classList.remove("smart-hidden"),e.fontSizeMenu.classList.add("open")}_closeFontFamilyMenu(){const e=this,t=e.fontFamilyMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontFamilyButton.classList.remove("selected"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontFamilyMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontFamilyMenu&&e.fontFamilyMenu.classList.contains("open"))return void e._closeFontFamilyMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontFamilyButton.classList.add("selected"),e.$.fontFamilyButton.setAttribute("aria-expanded",!0),e.fontFamilyMenu||(e.fontFamilyMenu=document.createElement("div"),e.fontFamilyMenu.classList.add("smart-grid-column-menu","smart-grid-fontfamily-menu"),e.fontFamilyMenu.setAttribute("theme",e.getAttribute("theme")),e.fontFamilyMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontFamilyMenu.classList.add("smart-animate");const t=e.grid;e._removeFontFamilyMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","Roboto","Segoe UI","Arial","Georgia","Tahoma","Times New Roman","Courier New","Verdana"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontFamilyMenu.appendChild(a),a.onItemClick=t=>{e._setStyle("fontFamily",t.detail.value)},e.fontFamilyMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontFamilyMenu):document.body.appendChild(e.fontFamilyMenu);const n=e.$.fontFamilyButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontFamilyMenu.offsetWidth,i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontFamilyButton.offsetWidth)),e.fontFamilyMenu.style.width="140px",e.fontFamilyMenu.style.left=i+"px",e.fontFamilyMenu.style.top=r+"px",e.fontFamilyMenu.classList.remove("smart-hidden"),e.fontFamilyMenu.classList.add("open")}_openColorMenu(e,t){const a=this;if(a.grid.editing.isEditing&&a.grid.cancelEdit(),a.colorMenu&&a.colorMenu.classList.contains("open")){if(a.colorMenu.classList.remove("open"),a.colorMenu.isBackground&&t)return void a._closeColorMenu();if(!a.colorMenu.isBackground&&!t)return void a._closeColorMenu()}a.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),a.$.group.classList.add("smart-hidden"),a.$.filter.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a.$.format.classList.add("smart-hidden"),a.$.view.classList.add("smart-hidden"),a.$.ai.classList.add("smart-hidden"),a.closePanel(),a.$.colorButton.classList.remove("selected"),a.$.colorButton.removeAttribute("aria-expanded"),a.$.backgroundButton.classList.remove("selected"),a.$.backgroundButton.removeAttribute("aria-expanded"),t?(a.$.backgroundButton.classList.add("selected"),a.$.backgroundButton.setAttribute("aria-expanded",!0)):(a.$.colorButton.classList.add("selected"),a.$.colorButton.setAttribute("aria-expanded",!0)),a.colorMenu||(a.colorMenu=document.createElement("div"),a.colorMenu.className="smart-grid-column-menu smart-grid-color-menu smart-color-input-drop-down-menu smart-color-panel smart-input-drop-down-menu underlined-drop-down-menu smart-grid-color-input-drop-down-menu smart-drop-down-box-drop-down-menu smart-color-picker-drop-down-menu smart-grid-color-input",a.colorMenu.setAttribute("theme",a.getAttribute("theme")),a.colorMenu.id=a.id+"_"+a.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),a.colorMenu.innerHTML=a._getColors()),a.colorMenu.classList.add("smart-animate"),a.colorMenu.isBackground=t,a.colorMenu.style.height="auto",a.isInShadowDOM?a.getRootNode().appendChild(a.colorMenu):document.body.appendChild(a.colorMenu);const o=t?a.$.backgroundButton.getBoundingClientRect():a.$.colorButton.getBoundingClientRect();let s=o.left+window.pageXOffset,n=o.bottom+window.pageYOffset;s+a.colorMenu.offsetWidth>window.innerWidth&&(s=o.right+window.pageXOffset-a.colorMenu.offsetWidth,s+a.colorMenu.offsetWidth>window.innerWidth&&(s=window.innerWidth-a.colorMenu.offsetWidth)),a.colorMenu.style.left=s+"px",a.colorMenu.style.top=n+"px",a.colorMenu.classList.remove("smart-hidden"),a.colorMenu.classList.add("open"),a.colorMenu.querySelectorAll(".color-sample").forEach((t=>{t.classList.remove("selected"),t.getAttribute("value")===e&&t.classList.add("selected")})),a.colorMenu.onpointerup=e=>{const o=e.target.getAttribute("value");void 0!==o&&(a._closeColorMenu(),t?(a.$.backgroundButton.style.setProperty("--smart-surface-color",o),a._setStyle("background",o)):(a.$.colorButton.style.setProperty("--smart-surface-color",o),a._setStyle("color",o)))}}_openLabelMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.labelMenu&&e.labelMenu.classList.contains("open"))return void e._closeLabelMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.labelButton.classList.add("selected"),e.$.labelButton.setAttribute("aria-expanded",!0),e.labelMenu||(e.labelMenu=document.createElement("div"),e.labelMenu.classList.add("smart-grid-column-menu","smart-grid-label-menu"),e.labelMenu.setAttribute("theme",e.getAttribute("theme")),e.labelMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.labelMenu.classList.add("smart-animate"),e._createLabelMenuItems(),e.labelMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.labelMenu):document.body.appendChild(e.labelMenu);const t=e.$.labelButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.labelMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.labelMenu.offsetWidth,a+e.labelMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.labelMenu.offsetWidth)),e.labelMenu.style.left=a+"px",e.labelMenu.style.top=o+"px",e.labelMenu.classList.remove("smart-hidden"),e.labelMenu.classList.add("open")}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu","smart-grid-view-chooser"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_setStyle(e,t){const a=this.grid;if(!a._selection)return;const o=a._selection.cells;if(o&&Object.keys(o).length>0){const o=a.getSelectedCells(!1),s={};for(let n=0;n<o.length;n++){const i=o[n],r=i[0],l=i[1],d=a.rowById[r],c=d.style?JSON.parse(JSON.stringify(d.style)):{};s[r]||(s[r]={});for(let e in c){for(let e=0;e<a.columns.length;e++){const t=a.columns[e].dataField;c[t]&&(s[r][t]=c[t])}c[e]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].indexOf(e)>=0&&(s[r][e]=c[e])}const u=s[r];if(d){const a=d.getCell(l);if(a){const o=a.canNotify;a.canNotify=!1,"textDecoration"===e?(a[e]||(a[e]=""),a[e].indexOf(t)>=0?a[e]=a[e].replace(t,"").trim():a[e]+=" "+t):a[e]===t?a[e]="":a[e]=t,a.canNotify=o;const s=u[a.column.dataField]={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[e]&&(s[e]=a[e])}))}const o=d.canNotify;if(0===Object.keys(u).length){delete s[r];continue}d.canNotify=!1,d.style=u,d.canNotify=o}}if(a.onRowStyle){const e=[],t=[],o=[];Object.keys(s).forEach(((n,i)=>{const r=s[n];e.push(i),t.push(a.rowById[n]),o.push(r)})),a.onRowStyle(e,t,o)}a._recycle(!1,!0)}else{const o=a.getSelectedRowIds(),s=[],n=[],i=[];for(let r=0;r<o.length;r++){const l=o[r],d=a.rowById[l],c=d.style?JSON.parse(JSON.stringify(d.style)):{};if("textDecoration"===e?(c[e]||(c[e]=""),c[e].indexOf(t)>=0?c[e]=c[e].replace(t,"").trim():c[e]+=" "+t):c[e]===t?c[e]="":c[e]=t,a.setRowStyle(l,c),a.onRowStyle){s.push(d.index),n.push(d);const e={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((t=>{c[t]&&(e[t]=c[t])})),i.push(e)}}a.onRowStyle&&a.onRowStyle(s,n,i)}}_updateTools(){const e=this,t=e.grid;if(!t._selection)return;const a=t._selection.cells;if(a&&Object.keys(a).length>0){const a=t.getSelectedCells(!1);for(let o=0;o<a.length;o++){const s=a[o],n=s[0],i=s[1],r=t.rowById[n];if(r){const t=r.getCell(i);if(t){e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),e.$.backgroundButton.style.setProperty("--smart-surface-color","inherit"),e.$.colorButton.style.setProperty("--smart-surface-color","inherit"),e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),t.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),t.background&&e.$.backgroundButton.style.setProperty("--smart-surface-color",t.background),t.color&&e.$.colorButton.style.setProperty("--smart-surface-color",t.color),t.fontStyle&&e.$.italicButton.setAttribute("aria-expanded","true"),t.textDecoration&&(t.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),t.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true")),t.fontSize&&e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontSize&&e.setAttribute("focus","")})),t.fontFamily&&e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontFamily&&e.setAttribute("focus","")}));break}}}}else{const a=t.getSelectedRowIds();for(let o=0;o<a.length;o++){const s=a[o],n=t.rowById[s],i=n.style?JSON.parse(JSON.stringify(n.style)):{};e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),i.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),i.background&&(e.$.backgroundButton.style.color=i.background),i.color&&(e.$.colorButton.style.color=i.color),i.fontStyle&&e.$.fontFamilyButton.setAttribute("aria-expanded","true"),i.textDecoration&&(i.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),i.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true"));break}}}_getColors(){return'<div class="default-samples-container grid-mode-container smart-container" role="presentation" style="">\n <div class="grid-samples-container" role="menu">\n <div id="colorInputca5bItem858b" data-label="#D50000" value="#D50000" role="menuitem" aria-label="#D50000" class="color-sample" style="background-color: rgb(213, 0, 0);"></div>\n <div id="colorInputca5bItem963b" data-label="#E67C73" value="#E67C73" role="menuitem" aria-label="#E67C73" class="color-sample" style="background-color: rgb(230, 124, 115);"></div><div id="colorInputca5bItem2f1f" data-label="#F4511E" value="#F4511E" role="menuitem" aria-label="#F4511E" class="color-sample" style="background-color: rgb(244, 81, 30);"></div><div id="colorInputca5bItem1a87" data-label="#F6BF26" value="#F6BF26" role="menuitem" aria-label="#F6BF26" class="color-sample" style="background-color: rgb(246, 191, 38);"></div><div id="colorInputca5bItem4c44" data-label="#0B8043" value="#0B8043" role="menuitem" aria-label="#0B8043" class="color-sample" style="background-color: rgb(11, 128, 67);"></div><div id="colorInputca5bItem8669" data-label="#33B679" value="#33B679" role="menuitem" aria-label="#33B679" class="color-sample" style="background-color: rgb(51, 182, 121);"></div><div id="colorInputca5bItem488c" data-label="#3F51B5" value="#3F51B5" role="menuitem" aria-label="#3F51B5" class="color-sample" style="background-color: rgb(63, 81, 181);"></div><div id="colorInputca5bItemc3aa" data-label="#039BE5" value="#039BE5" role="menuitem" aria-label="#039BE5" class="color-sample" style="background-color: rgb(3, 155, 229);"></div><div id="colorInputca5bItem4277" data-label="#7986CB" value="#7986CB" role="menuitem" aria-label="#7986CB" class="color-sample" style="background-color: rgb(121, 134, 203);"></div><div id="colorInputca5bItem3b61" data-label="#8C47FF" value="#8C47FF" role="menuitem" aria-label="#8C47FF" class="color-sample" style="background-color: rgb(140, 71, 255);"></div><div id="colorInputca5bItema4a6" data-label="#8E24AA" value="#8E24AA" role="menuitem" aria-label="#8E24AA" class="color-sample" style="background-color: rgb(142, 36, 170);"></div><div id="colorInputca5bItemdd64" data-label="#FF36C2" value="#FF36C2" role="menuitem" aria-label="#FF36C2" class="color-sample" style="background-color: rgb(255, 54, 194);"></div><div id="colorInputca5bItem07d0" data-label="#616161" value="#616161" role="menuitem" aria-label="#616161" class="color-sample" style="background-color: rgb(97, 97, 97);"></div><div id="colorInputca5bItemb2a4" data-label="#454545" value="#454545" role="menuitem" aria-label="#454545" class="color-sample" style="background-color: rgb(69, 69, 69);"></div><div id="colorInputca5bItem8de8" data-label="#949494" value="#949494" role="menuitem" aria-label="#949494" class="color-sample" style="background-color: rgb(148, 148, 148);"></div><div id="colorInputca5bItem75ce" data-label="#000000" value="#000000" role="menuitem" aria-label="#000000" class="color-sample" style="background-color: rgb(0, 0, 0);"></div></div><div class="grid-samples-container" role="menu"><div id="colorInputca5bItem932f" data-label="#FF9EB7" value="#FF9EB7" role="menuitem" aria-label="#FF9EB7" class="color-sample" style="background-color: rgb(255, 158, 183);"></div><div id="colorInputca5bItemc244" data-label="#FFCFC9" value="#FFCFC9" role="menuitem" aria-label="#FFCFC9" class="color-sample" style="background-color: rgb(255, 207, 201);"></div><div id="colorInputca5bItemcfb1" data-label="#FFD66D" value="#FFD66D" role="menuitem" aria-label="#FFD66D" class="color-sample" style="background-color: rgb(255, 214, 109);"></div><div id="colorInputca5bItem2827" data-label="#FFEBB6" value="#FFEBB6" role="menuitem" aria-label="#FFEBB6" class="color-sample" style="background-color: rgb(255, 235, 182);"></div><div id="colorInputca5bItem766c" data-label="#93DF89" value="#93DF89" role="menuitem" aria-label="#93DF89" class="color-sample" style="background-color: rgb(147, 223, 137);"></div><div id="colorInputca5bItem10b3" data-label="#D1F7C4" value="#D1F7C4" role="menuitem" aria-label="#D1F7C4" class="color-sample" style="background-color: rgb(209, 247, 196);"></div><div id="colorInputca5bItemb8a4" data-label="#9DC7FF" value="#9DC7FF" role="menuitem" aria-label="#9DC7FF" class="color-sample" style="background-color: rgb(157, 199, 255);"></div><div id="colorInputca5bItem78ff" data-label="#D0F0FD" value="#D0F0FD" role="menuitem" aria-label="#D0F0FD" class="color-sample" style="background-color: rgb(208, 240, 253);"></div><div id="colorInputca5bItem71b8" data-label="#CDAFFF" value="#CDAFFF" role="menuitem" aria-label="#CDAFFF" class="color-sample" style="background-color: rgb(205, 175, 255);"></div><div id="colorInputca5bIteme4d6" data-label="#ECE1FD" value="#ECE1FD" role="menuitem" aria-label="#ECE1FD" class="color-sample" style="background-color: rgb(236, 225, 253);"></div><div id="colorInputca5bItem3576" data-label="#FA9DE2" value="#FA9DE2" role="menuitem" aria-label="#FA9DE2" class="color-sample" style="background-color: rgb(250, 157, 226);"></div><div id="colorInputca5bItem8136" data-label="#FFDAF6" value="#FFDAF6" role="menuitem" aria-label="#FFDAF6" class="color-sample" style="background-color: rgb(255, 218, 246);"></div><div id="colorInputca5bItem26e5" data-label="#CBCBCB" value="#CBCBCB" role="menuitem" aria-label="#CBCBCB" class="color-sample" style="background-color: rgb(203, 203, 203);"></div><div id="colorInputca5bItemdc8a" data-label="#EDEDED" value="#EDEDED" role="menuitem" aria-label="#EDEDED" class="color-sample" style="background-color: rgb(237, 237, 237);"></div><div id="colorInputca5bItemd895" data-label="#FFFFFF" value="#FFFFFF" role="menuitem" aria-label="#FFFFFF" class="color-sample" style="background-color: rgb(255, 255, 255); border-color: var(--smart-border); border-style: solid; border-width: 1px;"></div><div id="colorInputca5bItem7231" data-label="" value="" role="menuitem" aria-label="" class="color-sample no-color"></div></div>\n </div>'}_boldCommand(){this._setStyle("fontWeight","bold"),this._updateTools()}_italicCommand(){this._setStyle("fontStyle","italic"),this._updateTools()}_underlineCommand(){this._setStyle("textDecoration","underline"),this._updateTools()}_strikethroughCommand(){this._setStyle("textDecoration","line-through"),this._updateTools()}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("colors")>=0?e.$.colorsButton.classList.remove("smart-hidden"):e.$.colorsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0&&t.editing.enabled?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("states")>=0&&t.stateSettings.enabled&&!t.appearance.viewBarAppendTo?e.$.viewStatesButton.classList.remove("smart-hidden"):e.$.viewStatesButton.classList.add("smart-hidden"),t.header.buttons.indexOf("formatting")>=0&&"grid"===t.view?(e.$.boldButton.classList.remove("smart-hidden"),e.$.italicButton.classList.remove("smart-hidden"),e.$.underlineButton.classList.remove("smart-hidden"),e.$.strikethroughButton.classList.remove("smart-hidden"),e.$.colorButton.classList.remove("smart-hidden"),e.$.backgroundButton.classList.remove("smart-hidden"),e.$.fontSizeButton.classList.remove("smart-hidden"),e.$.fontFamilyButton.classList.remove("smart-hidden"),e.$.boldButton.title=t.localize("bold")+" (Ctrl + B)",e.$.italicButton.title=t.localize("italic")+" (Ctrl + I)",e.$.underlineButton.title=t.localize("underline")+" (Ctrl + U)",e.$.strikethroughButton.title=t.localize("strikethrough")+" (Ctrl + Y)",e.$.colorButton.title=t.localize("color"),e.$.backgroundButton.title=t.localize("background"),e.$.fontSizeButton.title=t.localize("fontSize").replace(":",""),e.$.fontFamilyButton.title=t.localize("fontFamily").replace(":",""),e.$.boldButton.onpointerup=()=>{e._boldCommand()},e.$.italicButton.onpointerup=()=>{e._italicCommand()},e.$.underlineButton.onpointerup=()=>{e._underlineCommand()},e.$.strikethroughButton.onpointerup=()=>{e._strikethroughCommand()},e.$.colorButton.onpointerup=()=>{const t=e.$.colorButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t)},e.$.backgroundButton.onpointerup=()=>{const t=e.$.backgroundButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t,!0)},e.$.fontSizeButton.onpointerup=()=>{e._openFontSizeMenu(),e._updateTools()},e.$.fontFamilyButton.onpointerup=()=>{e._openFontFamilyMenu(),e._updateTools()}):(e.$.boldButton.classList.add("smart-hidden"),e.$.italicButton.classList.add("smart-hidden"),e.$.underlineButton.classList.add("smart-hidden"),e.$.strikethroughButton.classList.add("smart-hidden"),e.$.colorButton.classList.add("smart-hidden"),e.$.backgroundButton.classList.add("smart-hidden"),e.$.fontSizeButton.classList.add("smart-hidden"),e.$.fontFamilyButton.classList.add("smart-hidden")),t.users&&t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser)&&(t.stateSettings.storage&&Object.keys(t.stateSettings.storage).length,t.stateSettings.enabled),"scheduler"===t.view||"timeline"===t.view?(e.$.resourceButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.resourceButton.classList.remove("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.labelButton.classList.remove("smart-hidden")):(e.$.labelButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden")),e.$.labelButton.onpointerup=a=>{t.closeMenu(),e._openLabelMenu(),a.stopPropagation()},e.$.resourceButton.onpointerup=a=>{t.closeMenu(),e._openResourceMenu(),a.stopPropagation()},e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},!1===t.appearance.showViewBarAsDropdown&&(e.$.viewStatesButton.onpointerup=a=>{t.closeMenu(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.appearance.showViewBar=!t.appearance.showViewBar,a.stopPropagation(),e._updateViews()}),t._sortedColumns){const a=[],o=[],s=[];for(let e=0;e<t._sortedColumns.length;e++){const n=t._sortedColumns[e];a.push(n.dataField),o.push(n.sortOrder),s.push(n.dataType)}e._appliedSorting={dataFields:a,dataTypes:s,orderBy:o},e._refreshSortButton()}if("scheduler"!==t.view&&"timeline"!==t.view&&"kanban"!==t.view||e.$.sortButton.classList.add("smart-hidden"),"grid"===t.view||"card"===t.view||"scheduler"===t.view||"timeline"===t.view||"kanban"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumnsByDataField();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const s=t.filters[o];a.filters.push([e,s.condition,s.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshCustomButton(),e._refreshAIButton(),e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshResourceButton(),e._refreshLabelButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e._refreshColorsButton(),e.refreshTools(),Smart.Utilities.Core.isMobile,!1===t.editing.enabled&&(e.$.customButton.classList.add("smart-hidden"),e.$.downloadButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.$.viewsButton.classList.add("smart-hidden"))}_refreshCustomButton(){const e=this,t=e.grid;t.header.customButton.visible?(e.$.customButton.style.paddingLeft="0px",e.$.customButton.classList.remove("smart-hidden")):e.$.customButton.classList.add("smart-hidden"),t.header.customButton.enabled?e.$.customButton.classList.remove("smart-disabled"):e.$.customButton.classList.add("smart-disabled"),e.$.customButton.innerHTML=`<span class="smart-grid-icon show ${t.header.customButton.icon}"></span><div class="smart-tool-label" role="presentation">${t.header.customButton.label}</div>`,e.$.customButton.onclick=()=>{t.header.customButton.command&&t.header.customButton.command()};for(let a=0;a<t.header.buttons.length;a++){const o=t.header.buttons[a];if("object"==typeof o){const t=e.$.customButton.cloneNode(!0);t.classList.remove("smart-hidden"),t.style.paddingLeft="0px",e.$.customButton.parentNode.insertBefore(t,e.$.customButton),o.label&&(t.querySelector(".smart-tool-label").innerHTML=o.label),o.icon&&(t.querySelector(".smart-grid-icon").className="smart-grid-icon show "+o.icon),t.onclick=()=>{o.command&&o.command()}}}}_refreshViewsButton(){const e=this;if(!e.grid)return;let t=e.grid.localize("viewGrid");switch(e.$.viewsButton.classList.remove("kanban"),e.$.viewsButton.classList.remove("card"),e.$.viewsButton.classList.remove("scheduler"),e.$.viewsButton.classList.remove("timeline"),e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":t=e.grid.localize("viewGrid");break;case"card":e.$.viewsButton.classList.add("card"),t=e.grid.localize("viewCard");break;case"scheduler":e.$.viewsButton.classList.add("scheduler"),t=e.grid.localize("viewScheduler");break;case"timeline":e.$.viewsButton.classList.add("timeline"),t=e.grid.localize("viewTimeline")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>";let a=this.grid.stateSettings.current||"";if(a.length>30)a=a.substring(0,30)+"...";else if(!a){let e=[],t=this.grid.view,o="";switch(t){case"grid":o=this.grid.localize("viewGrid");break;case"kanban":o=this.grid.localize("viewKanban");break;case"card":o=this.grid.localize("viewCard");break;case"scheduler":o=this.grid.localize("viewScheduler");break;case"timeline":o=this.grid.localize("viewTimeline")}if(this.grid&&this.grid.stateSettings.storage)for(;this.grid.stateSettings.storage[o+" "+this.grid.localize("view")+" "+e[t]];)e[t]++;void 0===e[t]&&(e[t]=""),a=o+" "+this.grid.localize("view")+" "+e[t]}const o=""!==a?a:this.grid.localize("views");e.$.viewStatesButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o+"</div>"}_refreshDownloadButton(){const e=this;e.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation"></div>',e.$.downloadButton.title=e.grid.localize("download")}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.$.headerBar.$.deleteButton,o=a.closest("smart-grid");(!o||o._currentUser&&(!o._currentUser||o._currentUser.info&&"guest"!==o._currentUser.info))&&0!==t?(!0===e.editing.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.$.headerBar._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;if("kanban"===o.view||"scheduler"===o.view||"timeline"===o.view)return;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._refreshColumns("group"),o.closeMenu();const s=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(s.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=s,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=s,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,s=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const n=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&s)for(let e=0;e<s.length;e++){const t=o.columnByDataField[s[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate(),o.autoSaveState();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=n}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshLabelButton(){const e=this;if(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel")+"</div>",e.$.labelButton.classList.remove("grouped"),e.grid&&e.grid._labeledBy){const t=e.grid.columnByDataField[e.grid._labeledBy];t&&(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:t.label})+"</div>",e.$.labelButton.classList.add("grouped"))}else if(e.grid)for(let t=0;t<e.columns.length;t++){const a=e.columns[t];if("string"===a.dataType){e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:a.label})+"</div>",e.$.labelButton.classList.add("grouped");break}}}_refreshResourceButton(){const e=this;if(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("firstByGroup")+"</div>",e.$.resourceButton.classList.remove("grouped"),e.grid&&e.grid._dateStackedBySelect){const t=e.grid.columnByDataField[e.grid._dateStackedBySelect];t&&(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("groupedBy",{column:t.label})+"</div>",e.$.resourceButton.classList.add("grouped"))}}_refreshAIButton(){const e=this;e.$.aiButton.classList.add("smart-hidden"),-1!==e.grid.header.buttons.indexOf("ai")&&(e.$.aiButton.classList.remove("smart-hidden"),e.$.aiButton.style.paddingLeft="0px",e.$.aiButton.innerHTML='<div class="smart-tool-label" role="presentation" style="padding: 5px;">'+e.grid.localize("addAIFilter")+"</div>")}_applyAI(){const e=this,t=e.grid;e.closePanel();const a=e.$.ai.firstElementChild,o=a.getAIInstructions();if(t.beginUpdate(),o&&o.sort&&o.sort.length>0){t.clearSort();const e=o.sort;for(let a=0;a<e.length;a++){const o=e[a],s=o.field,n=o.order;t.sortBy(s,n)}}if(o&&o.filters&&o.filters.length>0&&t._applyJSONFilters(o.filters),o&&o.group&&o.group.length>0){t.clearGroups();let e=o.group.map((e=>e.field));e.length&&e[0]&&t.addGroup(e)}const s=a.$.aiPrompt.value,n=s.indexOf("column")>=0||s.indexOf("cells")>=0;if(t.ai.includeUserPrompts&&(t.ai.userPrompts||(t.ai.userPrompts=[]),t.ai.userPrompts.push(s)),o&&o.format&&o.format.length>0){const e=o.format;let a={};for(let o=0;o<e.length;o++){const s=e[o],i=s.field;if(i&&n)a[i]||(a[i]=[]),a[i].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration});else for(let e=0;e<t.columns.length;e++){const o=t.columns[e];a[o.dataField]||(a[o.dataField]=[]),a[o.dataField].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration})}}for(let e=0;e<t.columns.length;e++)t.columns[e].cellsCSSInlineRules=null;for(let e in a){const o=t.columnByDataField[e];o&&(o.cellsCSSInlineRules=a[e])}}if(o&&o.edit&&o.edit.length>0){const e=o.edit;for(let a=0;a<e.length;a++){const o=e[a],s=o.row,n=o.value,i=o.field;s>=0&&(t.setCellValue(s,i,n),t.flashCell(s,i))}}t.endUpdate()}openAIPanel(){const e=this,t=e.grid;let a;if(e.$.headerDropDown.classList.add("ai-panel"),e.$.headerDropDown.classList.remove("view-panel","search-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.remove("smart-hidden"),e._aiPartCreated)a=e.$.ai.firstElementChild,a.set("locale",e.locale),a.messages=e._innerElementMessages.multiColumnFilterPanel,a.editorPlaceholder=e.localize("aiPrompt"),a.$.applyButton.classList.add("smart-disabled"),a.$.aiResponse.innerHTML=`${t.localize("noAIResponse")}`,a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[0].classList.add("active"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[1].classList.remove("active"),a.$.aiPrompt.value="",a.$.spinner.innerHTML="",a.$.spinner.classList.add("smart-hidden"),a._applyValue(),a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-grid-ai-panel"),a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.locale=e.locale,a.messages=e._innerElementMessages.multiColumnFilterPanel,a.operator=e._appliedFiltering.operator,a.editorPlaceholder=e.localize("aiPrompt"),a.theme=e.theme,a.value=e._appliedFiltering.filters,e.$.ai.appendChild(a),e._aiPartCreated=!0,a.$.addFilterButton.innerHTML="↑ "+t.localize("send"),a.$.addFilterButton.classList.add("smart-ai-button-send"),a.$.addFilterButton.style.background="var(--smart-ui-state-selected)",a.$.addFilterButton.style.borderRadius="15px",a.$.addFilterButton.style.color="var(--smart-primary)",a.$.addFilterButton.style.padding="6px 14px";const o=a.querySelector(".smart-grid-panel-apply-button");a.$.applyButton=o,o.classList.add("smart-disabled"),a.$.itemsContainer.innerHTML=`<style>\n .smart-ai-tabs {\n display: flex;\n align-items: baseline;\n border-bottom: 1px solid var(--smart-border-color);\n font-family: var(--smart-font-family);\n }\n\n .smart-ai-tab {\n padding: 4px 6px;\n cursor: pointer;\n display: flex;\n color: var(--smart-background-color);\n transition: color 0.2s, border-color 0.2s;\n border-bottom: 2px solid transparent;\n }\n\n .smart-ai-tab:hover {\n color: var(--smart-ui-state-color-hover);\n }\n\n .smart-ai-tab.active {\n color: var(--smart-primary);\n border-bottom-color: var(--smart-primary);\n font-weight: 600;\n }\n\n .smart-ai-response {\n min-height: 80px;\n padding: 10px;\n margin-top: 10px;\n width: 360px;\n user-select: text;\n border-radius: var(--smart-border-radius);\n border: 1px solid var(--smart-border);\n }\n\n </style><div class="smart-ai-tabs">\n <div class="smart-ai-tab active" data-tab="add-filter">\n ${t.localize("addAIFilter")}\n </div>\n <div class="smart-ai-tab" data-tab="response">\n <span class="smart-grid-icon show smart-icon-comment"></span> ${t.localize("aiResponse")}\n </div>\n </div>\n <div class="smart-hidden smart-ai-response">\n ${t.localize("noAIResponse")}\n </div>\n `,a.$.itemsContainer.style.paddingTop="0px",a.$.aiResponse=a.$.itemsContainer.querySelector(".smart-ai-response"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>{e.addEventListener("click",(()=>{a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>e.classList.remove("active"))),e.classList.add("active"),"add-filter"===e.getAttribute("data-tab")?(a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden")):(a.$.addFilterButton.classList.add("smart-hidden"),a.$.aiPrompt.classList.add("smart-hidden"),a.$.aiResponse.classList.remove("smart-hidden"))}))}))}e._openHeaderDropDown(e.$.aiButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu();const o=e.$.headerDropDown.querySelector("smart-grid-ai-panel");if(o&&t.ai&&t.ai.key){o.$.addAIFilterButton.classList.remove("smart-hidden"),o.$.aiPrompt.classList.add("smart-hidden"),o.$.aiPrompt.placeholder=t.localize("aiPrompt"),o.$.aiPrompt.classList.toggle("smart-hidden"),o.$.spinner.classList.remove("smart-hidden"),o.$.aiPrompt.focus(),o.$.aiPrompt.maxRows=5,o.$.aiPrompt.style.minHeight="80px",o.$.aiPrompt.style.resize="none",o.$.aiPrompt.parentElement.style.display="flex",o.$.aiPrompt.parentElement.style.flexDirection="column";const a=t.ai.prompts||[];if(t.ai.includeUserPrompts&&t.ai.userPrompts)for(let e=0;e<t.ai.userPrompts.length;e++){const o=t.ai.userPrompts[e];-1===a.indexOf(o)&&a.unshift(o)}const s=o.$.aiPrompt,n=o.$.suggestions;s.onpointerdown=()=>{e._dropDownCloseDate=new Date},s.onselectionchange=()=>{e._dropDownCloseDate=new Date},n.innerHTML='<style>\n .smart-ai-suggestion {\n padding: 6px 10px;\n border-bottom: 1px solid var(--smart-border-color);\n cursor: pointer;\n max-width: 360px;\n }\n .smart-ai-suggestion:hover {\n background-color: var(--smart-ui-state-hover);\n }\n .smart-ai-suggestions-container {\n max-height: 200px;\n overflow-y: auto;\n border: 1px solid var(--smart-border-color);\n border-radius: var(--smart-border-radius);\n margin-top: 5px;\n }\n </style>\n <div class="smart-ai-suggestions-container">\n \n </div>';const i=n.querySelector(".smart-ai-suggestions-container");a.forEach((e=>{const t=document.createElement("div");t.classList.add("smart-ai-suggestion"),t.innerText=e,t.onclick=()=>{s.value=e,i.classList.add("smart-hidden"),s.focus()},i.appendChild(t)})),s.oninput=()=>{s.value.length>0?i.classList.add("smart-hidden"):i.classList.remove("smart-hidden")},o.$.addFilterButton.onclick=()=>{let a=0;o.$.spinner.classList.remove("smart-hidden");const s=setInterval((()=>{o.$.spinner.innerHTML=`\rThinking${".".repeat(a%4)} `,a++}),500);let n='\nYou are a helpful assistant that converts natural language data manipulation requests\ninto structured JSON instructions for Smart.Grid AND produces a detailed, user-friendly explanation.\n\nImportant:\nThe JSON you produce represents actions that will be applied ONLY AFTER the user clicks "Apply".\nTherefore, all natural-language explanations must describe what *will happen* once the user applies the changes.\nDo not describe the action as already completed.\n\nUse only these columns:\n';for(let t=0;t<e.columns.length;t++){const a=e.columns[t];(a.allowFilter||a.allowSort||a.allowGroup||a.allowFormat)&&(n+="- "+a.label+" ("+a.dataType+") => "+a.dataField+"\\n")}const i=t.getSelection();let r=i.rows||[],l=i.columns||[],d=i.cells||[];d&&(d=d.map((e=>({row:e.row.id,column:e.column.label,value:e.row.data[e.dataField]})))),r&&(r=r.map((e=>e.id))),l&&(l=l.map((e=>t.columnByDataField[e].label)));let c={};t.getColumnStatistics=e=>{const a=t.getData().map((t=>t[e])).filter((e=>null!=e&&""!==e));if(0===a.length)return{};const o=a.filter((e=>"number"==typeof e)),s={count:a.length,uniqueCount:new Set(a).size};if(o.length>0){const e=o.reduce(((e,t)=>e+t),0),t=e/o.length,a=Math.min(...o),n=Math.max(...o);s.sum=e,s.average=t,s.min=a,s.max=n,s.range=n-a}return s};let u={};for(let a=0;a<e.columns.length;a++){const o=e.columns[a],s=t.getColumnStatistics(o.dataField);c[o.label]=s,o.options&&Array.isArray(o.options)&&(u[o.label]=o.options.map((e=>"object"==typeof e&&null!==e?void 0!==e.label?e.label:e.value:e)))}const m=t._rowElements.filter((e=>!e.classList.contains("smart-hidden"))).map((e=>e.row.data)).map((t=>{const a={};for(let o=0;o<e.columns.length;o++){const s=e.columns[o];a[s.label]=t[s.dataField]}return a}));n+=`\n visibleRows: ${JSON.stringify(m)}\n datasetStats: ${JSON.stringify(c)}\n columnOptions: ${JSON.stringify(u)}\n CurrentSelection: rows: ${JSON.stringify(r)}, columns: ${JSON.stringify(l)}, cells: ${JSON.stringify(d)}\n\n If datasetStats lacks the required numbers for a requested metric, the assistant MUST exclude that metric rather than invent numbers.\n\nThe user may request any combination of the following actions: filtering, sorting, grouping, conditional formatting, editing or summarization.`,n+='\nSupported filter operators:\n CONTAINS, EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN,\n GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, STARTS_WITH, ENDS_WITH\n\nRespond in this format for Filtering\n[\n {\n "field": "dataField",\n "operator": "some operator",\n "value": "some value",\n "type": "some type",\n "logic": "AND }\n]\nWhen the user requests to clear or remove or delete the Filtering\nRespond in this format for Filtering\n[\n {\n "field": null,\n "operator": "null,\n "value": null,\n "type": null,\n "logic": null\n }\n]\nSupported types:\n string, number, date, boolean\n\nThe assistant MUST understand and support operations on the user\'s current selection.\nA selection may include rows, columns, or specific cells.\n\nEDIT RULE: \nSupported edit actions include:\n- fill_empty: Fill empty cells using a source (e.g., from selection, constant value, or text).\n- translate: Translate text in the selected cells or columns.\n- replace_values: Replace or modify values inside the selection or target columns.\n- transform_text: Apply transformations such as uppercase, lowercase, trim, etc.\n\nThe assistant MUST check columnOptions when performing edit actions to ensure the requested action is allowed on the target column(s).\n\nOPTION-CONSTRAINT RULE FOR EDITING:\nSome columns contain restricted, predefined allowed values (options list).\n\nWhen performing an edit action (fill_empty, translate, replace_values, transform_text):\n- The assistant MUST verify that the target value is one of the allowed options if the column contains predefined options.\n- The assistant MUST NOT write a value that does not exist in the options list.\n- The assistant MUST NOT invent new options.\n- If a requested value is not part of the options list, the assistant MUST reply in HTML to request clarification rather than performing the edit.\n\n\nWhen the user requests an action involving selected cells, the assistant MUST include \nthe appropriate "edit" instructions in the JSON.\n\nWhen the user requests an edit action (fill, translate, replace, transform), the assistant MUST compute the actual resulting values for the affected cells using the visible data or selection provided.\nThe assistant MUST place these computed results inside the edit object.\nThe assistant MUST NOT output formulas, instructions, or placeholders. Only the final, edited values are allowed.\n\nRespond in this format for Editing\n[\n {\n "field": "dataField",\n "row": "some row id",\n "oldValue": "some old value",\n "value": "some value",\n "type": "some type",\n "editAction": "fill_empty/translate/replace_values/transform_text }\n]\n\nSORT RULE:\nWhen the user requests sorting (“sort by”, “order by”, etc.):\nRespond in this format for Sorting\n[\n {\n "field": "dataField",\n "order": "asc/desc"\n }\n]\nWhen the user requests to clear or remove or delete the sorting\nRespond in this format for Sorting\n[\n {\n "field": null,\n "order": null\n }\n]\nGROUP RULE:\nWhen the user requests grouping (“group by”, “categorize by”, etc.):\nRespond in this format for Grouping\n[\n {\n "field": "dataField"\n }\n]\nWhen the user requests to clear or remove or delete the grouping\nRespond in this format for Grouping\n[\n {\n "field": null\n }\n]\nFORMAT RULE (STRICT):\n\nWhen the user requests conditional formatting (“highlight”, “color code”, “format”, etc.):\nYou MUST respond ONLY in this exact JSON structure:\n\n[\n {\n "field": "dataField",\n "condition": "=/<>/<=/>=/</>/between",\n "value": "STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nif the user requests formatting for a RANGE of values (e.g., "between 10 and 20"):\nYou MUST add condition2 and value2 keys to the JSON structure like this:\n\n[\n {\n "field": "dataField",\n "condition": "between",\n "value": "lower bound STRING or NUMBER or DATE or BOOLEAN",\n "value2": "upper bound STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nCLEARING FORMATTING:\nWhen the user requests to clear, remove, or delete formatting:\nYou MUST respond ONLY in this structure:\n\n[\n {\n "field": null,\n "condition": "=",\n "value": "",\n "background": null,\n "color": null,\n "textDecoration": null,\n }\n]\n\nADDITIONAL STRICT RULES:\n- Do NOT add extra keys.\n- Do NOT omit required keys.\n- Do NOT output explanations, text, or comments — ONLY the JSON.\n- “condition” MUST be one of: =, <>, <, <=, >, >=.\n- “value” MUST be a STRING, NUMBER, DATE, or BOOLEAN literal.\n- Colors MUST be written as strings.\n\nSUMMARY RULE:\nWhen the user requests a summary (“give me a summary”, “summarize my data”,\n“show totals/averages/count”, etc.):\n\n1. You MUST compute actual numeric results using datasetStats and/or selection.\n - Place these results inside the "summary" JSON object.\n - NEVER output formulas or operations.\n\n2. You MUST generate a full natural-language summary report in the "message" field.\n The report MUST:\n - Use PRESENT TENSE (because summary is computed immediately).\n - Describe totals, averages, minimums, maximums, counts, and ranges.\n - Highlight notable patterns IF AND ONLY IF the stats allow it.\n - Be narrative, readable, and helpful.\n - NOT hallucinate any values not present in datasetStats or selection.\n\nYour task:\nConvert user requests about filtering, sorting, grouping, conditional formatting, editing, \nor summarization into a structured JSON format AND produce a verbose, friendly explanation.\n\nRespond ONLY in this structure:\n\n{\n "json": {\n "filters": [...],\n "sort": [...],\n "group": [...],\n "format": [...],\n "summary": {},\n "edit": []\n },\n "message": "A detailed explanation using FUTURE TENSE, describing what the changes will do once applied. The mssage should be in HTML Format. The explanation MUST be a well-structured HTML message with short paragraphs and bullet points when appropriate. It MUST NOT exceed 200 words unless summarization requires more"\n}\n\nGuidelines for the natural-language \'message\':\n- Use future tense: “will filter”, “will highlight”, “will sort”, etc.\n- Summary results are computed immediately and DO NOT depend on the Apply button.\n Therefore, the explanation for summaries may use PRESENT TENSE (e.g., “The total is 2300”).\n- Do NOT imply the action has already happened.\n- Explain clearly what the user should expect AFTER applying the settings.\n- Be helpful, descriptive, and user-friendly.\n- Avoid referencing JSON or internal logic.\n\nThe assistant MUST NOT invent additional JSON keys or structures.\nIf the user requests an unsupported action, the assistant MUST politely decline.\n\nIf the user request is ambiguous, the assistant MUST reply with a polite clarifying question\ninstead of guessing the action.\n\nIf the user asks a general question, tutorial question, or conceptual question that does NOT request\nfiltering, sorting, grouping, conditional formatting, editing, or summarization,\nthe assistant MUST NOT generate JSON.\n\nInstead, the assistant MUST reply with a natural-language explanation in HTML format.\n\nIf the user asks for help, instructions, or examples, the assistant MUST NOT perform actions.\nThe assistant MUST explain concepts in HTML using concise, user-friendly language.\n',t.ai.getAIResponse=async function(e,a){const o=t.ai.key,s=t.ai.url||"https://api.openai.com/v1/chat/completions",n={"Content-Type":"application/json",Authorization:`Bearer ${o}`},i={model:t.ai.model||"gpt-3.5-turbo",messages:[{role:"system",content:e},{role:"user",content:a}],temperature:.7,max_tokens:1e3},r=await fetch(s,{method:"POST",headers:n,body:JSON.stringify(i)});return(await r.json()).choices[0].message.content};try{t.ai.getAIResponse(n,o.$.aiPrompt.value).then((e=>{let a,n=t.localize("noAIResponse");try{const t=e.indexOf("{");a=JSON.parse(e.substring(t)),a.message&&(n=a.message)}catch(e){a={filters:[]}}if(o.$.aiResponse.innerHTML=n,o.$.spinner.innerHTML="",o.$.spinner.classList.add("smart-hidden"),clearInterval(s),o.$.itemsContainer.querySelector('.smart-ai-tab[data-tab="response"]').click(),a.json){const e=a.json.filters,t=a.json.sort,s=a.json.group,n=a.json.format,i=a.json.summary,r=a.json.edit;o.getAIInstructions=()=>({filters:e||[],sort:t||[],group:s||[],format:n||[],summary:i||{},edit:r||[]}),o.$.applyButton.classList.remove("smart-disabled")}}))}catch(e){o.$.spinner.innerHTML=t.localize("noResults"),clearInterval(s)}},o.$.applyButton.onclick=()=>{o.$.applyButton.classList.contains("smart-disabled")||e._applyAI()}}}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(e.grid&&"kanban"===e.grid.view){e.$.groupButton.onclick=()=>{"kanban"===e.grid.view&&e.grid._initKanbanView("dynamic","kanban")};const t=e.grid.columnByDataField[e.grid._stackedBy];return t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("groupedBy",{column:t.label}),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped"),void e.$.groupButton.classList.remove("scheduler")}if(!e.grid||"scheduler"!==e.grid.view&&"timeline"!==e.grid.view){if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}else if(e.$.groupButton.onclick=()=>{"scheduler"!==e.grid.view&&"timeline"!==e.grid.view||e.grid._createScheduler("update")},e.grid._dateStackedBy&&Array.isArray(e.grid._dateStackedBy)){const t=e.grid.columnByDataField[e.grid._dateStackedBy[0]].label,a=e.grid.columnByDataField[e.grid._dateStackedBy[1]].label;e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t+"-"+a}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")}else{const t=e.grid.columnByDataField[e.grid._dateStackedBy];t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t.label}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped")}}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search(this.$.searchInput.value,!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;if(e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu(),"filter"===t.header.searchCommand){const t=e.$.headerDropDown.querySelector(".smart-data-view-search-prev"),a=e.$.headerDropDown.querySelector(".smart-data-view-search-next");t.classList.add("smart-hidden"),a.classList.add("smart-hidden")}const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const s=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:s,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}addColors(e,t,a){const o=this,s=o.grid;let n=[e,t],i=[];if(o.closePanel(),JSON.stringify(n)===JSON.stringify(o._appliedColors))return;o._appliedColors=n;const r=[],l=o.grid.getRows();for(let e=0;e<l.length;e++)r.push(Object.assign(l[e].data));if("conditions"===t.type){const t=new Smart.DataAdapter({id:"id",observable:!1,dataSource:r,dataFields:o.grid.dataSource.dataFields});t._filter(a,"or");const n=[];for(let e=0;e<t.length;e++){const a=t[e];!1!==a.$.filtered&&n.push(a)}const l=e,d=[];for(let e=0;e<l.length;e++){const t=l[e],a=t[0],o=t[1],n=t[3]?t[2]:void 0,i=t[3]?t[3]:t[2],r=s.columnByDataField[a].dataType,c=new Smart.Utilities.FilterGroup,u=c.createFilter(r,n,o);c.addFilter("or",u),d.push({dataField:a,color:i,filterGroup:c})}for(let e=0;e<n.length;e++){const t=n[e];for(let e=0;e<d.length;e++){const a=d[e].dataField,o=d[e].filterGroup,s=d[e].color,n=t[a];o.evaluate(n)&&(void 0===i[t.$.id]&&(i[t.$.id]={}),i[t.$.id].color=s,i[t.$.id][a]=s)}}}else{const e=t.singleSelect,a=s.columnByDataField[e];if(!a)return s._conditionalColors={colors:[],type:t.type,conditions:[],update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(),o._refreshColorsButton(),void(s._onColors&&s._onColors(s._conditionalColors));const n="collaborator"===a.template?s.users:a.editor.dataSource,r={};n.forEach((e=>"collaborator"===a.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color)));for(let t=0;t<l.length;t++){const a=l[t].data,o=a[e],s=r[o];s&&(i[a.$.id]={color:s})}}s._conditionalColors={colors:i,type:t.type,conditions:e,update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(!1),o._refreshColorsButton(),s.autoSaveState(),o.$.fireEvent("colors"),s._onColors&&s._onColors(s._conditionalColors)}_updateConditionalColors(e,t,a){let o=[];const s=t.getRows();if("conditions"===a.type){const a=t._conditionalColors.conditions,n=[];for(let e=0;e<a.length;e++){const o=a[e],s=o[0],i=o[1],r=o[3]?o[2]:void 0,l=o[3]?o[3]:o[2],d=t.columnByDataField[s];if(d){const e=d.dataType,t=new Smart.Utilities.FilterGroup,a=t.createFilter(e,r,i);t.addFilter("or",a),n.push({dataField:s,color:l,filterGroup:t})}}const i=e=>{for(let t=0;t<n.length;t++){const a=n[t].dataField,s=n[t].filterGroup,i=n[t].color,r=e[a];s.evaluate(r)?(void 0===o[e.$.id]&&(o[e.$.id]={}),o[e.$.id].color=i,o[e.$.id][a]=i):delete o[e.$.id]}};if(e)o=t._conditionalColors.colors,i(e.data);else for(let e=0;e<s.length;e++)i(s[e].data)}else{const n=a.singleSelect,i=t.columnByDataField[n];if(i){const a="collaborator"===i.template?t.users:i.editor.dataSource,r={};if(a.forEach((e=>"collaborator"===i.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color))),e){o=t._conditionalColors.colors,o||(o=t._conditionalColors.colors=[]);const a=e.data,s=a[n],i=r[s];i?o[a.$.id]={color:i}:delete o[a.$.id]}else for(let e=0;e<s.length;e++){const t=s[e].data,a=t[n],i=r[a];i&&(o[t.$.id]={color:i})}}}t._conditionalColors.colors=o,t.autoSaveState(),t.summaryRow.visible||t._recycle(!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,a.grid._recycle(!1),void("filter"===a.grid.header.searchCommand&&a.grid.clearFilter());const o=a._searchInfo.source,s=[],n=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),s.push([t,a])})),o._filter(s,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(n.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=n,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,"filter"===a.grid.header.searchCommand){a.grid.beginUpdate();const t=a.grid.filtering.operator;return a.grid.filtering.operator="or",a.grid.clearFilter(),a._searchInfo.stringDataFields.forEach((t=>{const o=new Smart.Utilities.FilterGroup,s=o.createFilter("string",e,"CONTAINS"),n=a.grid.columnByDataField[t];if(n&&n.editor&&n.editor.dataSource)return!1;n&&(o.addFilter("or",s),a.grid.addFilter(t,o),n._filterInfo&&n.filter.filters[0]&&(n._filterInfo.value=n.filter.filters[0].value,n._filterInfo.condition=n.filter.filters[0].condition))})),a.grid.endUpdate(),a.grid.refreshFilters(),void(a.grid.filtering.operator=t)}if(n.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:n.length}),a._searchInfo.highlighted||(a._searchInfo.highlighted=n[0]),a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}isGrid(){const e=this.grid;return!(e&&("kanban"===e.view&&e._kanban||"scheduler"===e.view&&e._scheduler||"timeline"===e.view&&e._scheduler))}_refreshColorsButton(){const e=this,t=e.grid;let a=0;if(a=t._conditionalColors&&t._conditionalColors.conditions?Object.keys(t._conditionalColors.conditions).length:0,t._conditionalColors&&"singleSelect"===t._conditionalColors.type){a=1;const o=t.columnByDataField[t._conditionalColors.singleSelect];return o?(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formatingBy",{value:o.label})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted"),void e._refreshMobileViewTools()):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),void e.$.colorsButton.classList.remove("formatted"))}a>0?(e.$.colorsButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("formatingOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("formatingByMultiple",{n:a})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted")):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),e.$.colorsButton.classList.remove("formatted")),e._refreshMobileViewTools()}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if(!e.isGrid())return t._kanban&&t._kanban.localize&&(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&(o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++))}a>0?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),e._refreshMobileViewTools()}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let s=0,n=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(n.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||s++)}o.onColumnChange=l,o.onColumnChange?o.onColumnChange(n,"visible",i,r):o.$.fireEvent("columnChange",{column:n,propertyName:"visible",oldValue:i,value:r}),s>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n:s})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],s=a.oldIndex,n=a.newIndex,i=o.columns[n+1],r=o.columns[n-1],l=o.columns[s];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(s,n,!0)}if(o.filtering.enabled&&o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized=!1;o.endUpdate();const d=o.grouping.enabled;d&&o._filters&&o.refreshFilters(d),o.autoSaveState()}});
1540
+ Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewStatesButton" class="smart-data-view-header-button smart-data-view-states-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ViewStates"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="aiButton" class="smart-data-view-header-button smart-data-view-ai-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ai"></div>\n <div id="resourceButton" class="smart-data-view-header-button smart-data-view-resource-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Resource"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="labelButton" class="smart-data-view-header-button smart-data-view-label-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Lael"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="colorsButton" class="smart-data-view-header-button smart-data-view-colors-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Colors"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customButton" class="smart-data-view-header-button smart-data-view-custom-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Custom"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="boldButton" class="smart-data-view-header-button smart-data-view-bold-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Bold"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="italicButton" class="smart-data-view-header-button smart-data-view-italic-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Italic">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="underlineButton" class="smart-data-view-header-button smart-data-view-underline-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Underline">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="strikethroughButton" class="smart-data-view-header-button smart-data-view-strikethrough-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Strikethrough">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontFamilyButton" class="smart-data-view-header-button smart-data-view-fontfamily-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Family">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontSizeButton" class="smart-data-view-header-button smart-data-view-fontsize-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Size">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="backgroundButton" class="smart-data-view-header-button smart-data-view-background-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Background">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="colorButton" class="smart-data-view-header-button smart-data-view-textcolor-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Text Color">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="view" class="smart-hidden" role="presentation"></div>\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="ai" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="colors" 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" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}_refreshMobileViewTools(){const e=this;e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden"),e.parentNode.classList.add("mobile")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden"),e.parentNode.classList.remove("mobile")}))}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e._refreshMobileViewTools(),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;const o=t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.colorsButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled"),e.$.resourceButton.classList[a]("smart-disabled"),e.$.labelButton.classList[a]("smart-disabled")};o(e.dataSource&&0===e.dataSource.length),t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&"infinite"!==t.scrolling&&o(!1),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),t.$.headerDropDown.addEventListener("close",(()=>{t._dropDownCloseDate=new Date})),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget);const a=t.grid.parentElement,o=a?a.scrollTop:0;if(t.grid.header.appendTo){const e=document.querySelector(t.grid.header.appendTo);t.$.headerDropDown.style.top=t.grid.offset(e).top+e.offsetHeight-o+"px"}else t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight-o+"px";const s=()=>{if(e){const a=t.grid.offset(e);if(a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px",a.top+t.$.headerDropDown.offsetHeight>=document.documentElement.clientHeight-40){let e=t.grid.offset(t.grid).top-t.$.headerDropDown.offsetHeight;if(t.grid.header.appendTo){const a=document.querySelector(t.grid.header.appendTo);e=t.grid.offset(a).top-t.$.headerDropDown.offsetHeight}e<0&&(e=0),t.$.headerDropDown.style.top=e+"px"}}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",s())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;if(s.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}const n=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");n&&s.ai&&s.ai.key&&(n.$.addAIFilterButton.classList.remove("smart-hidden"),n.$.aiFilterPrompt.classList.add("smart-hidden"),n.$.spinner.classList.add("smart-hidden"),n.$.addAIFilterButton.onclick=()=>{n.$.aiFilterPrompt.placeholder=s.localize("dialogFilterHeader"),n.$.aiFilterPrompt.classList.toggle("smart-hidden"),n.$.spinner.classList.remove("smart-hidden"),n.$.aiFilterPrompt.focus(),n.$.aiFilterPrompt.parentElement.style.display="flex",n.$.aiFilterPrompt.parentElement.style.flexDirection="column",n.$.aiFilterPrompt.onchange=n.$.aiFilterPrompt.oninput=e=>{const t=()=>{let e=0;const t=setInterval((()=>{n.$.spinner.innerHTML=`\rThinking${".".repeat(e%4)} `,e++}),500);try{s.filterBy(n.$.aiFilterPrompt.value,null,(e=>{n.$.spinner.innerHTML="",n.$.spinner.classList.add("smart-hidden"),clearInterval(t);const a=[];for(let t in e){const o=e[t].filterGroup;for(let e=0;e<o.filters.length;e++){const s=o.filters[e];a.push([t,s.condition,s.value])}}n.value=a}))}catch(e){n.$.spinner.innerHTML=s.localize("noResults"),clearInterval(t)}};"Enter"===e.key?(n.aiTimer&&clearTimeout(n.aiTimer),t()):(n.aiTimer&&clearTimeout(n.aiTimer),n.aiTimer=setTimeout((()=>{t()}),800))}})}openColorsPanel(){const e=this,t=e.dataSource;e._refreshColumns("colors"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden");const a=this.columns.map((e=>{const a=Object.assign({},e),o=t.dataFields.find((e=>e.name===a.dataField));return o&&(a.dataType=o.dataType),a}));super.openColorsPanel(a,null,e.grid),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.grid.closeMenu()}openViewPanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;if(!1===e.grid.appearance.showViewBarAsDropdown)return;let t;e.$.headerDropDown.classList.add("view-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel","colors-panel"),e.$.view.classList.remove("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.format&&e.$.format.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._viewPartCreated?t=e.$.view.firstElementChild:(t=document.createElement("div"),t.classList.add("smart-view-panel","smart-grid-view-bar"),e.$.view.appendChild(t),e.$.viewPanel=t,e._viewPartCreated=!0,e._updateViews()),e._openHeaderDropDown(e.$.viewStatesButton)}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=t.columns.map((e=>{const o=Object.assign({},e),s=t._appliedSorting.dataFields.indexOf(o.dataField),n=a.dataFields.find((e=>e.name===o.dataField));return n&&(o.dataType=n.dataType,o.sortIndex=s,-1!==s&&(o.sortDirection=t._appliedSorting.orderBy[s])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;s.closeMenu();const n=t.$.headerDropDown.querySelector("smart-sort-panel");if(!n)return;n.grid=s,n.$.maintainSortContainer.classList.remove("smart-hidden"),s.sorting.maintainSort?n.$.maintainSortContainer.firstElementChild.setAttribute("active",""):n.$.maintainSortContainer.firstElementChild.removeAttribute("active"),n._changeApplyButtonText();const i=n.$.inputNotSorted,r=()=>{const e=n.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};n.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,s=0,n=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(s++,n.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===s||o===s&&i.toString()!==n.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,s=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let n;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)n=o.querySelector("smart-column-panel"),n.locale=e.locale,n.messages=e._innerElementMessages.columnPanel,n.set("dataSource",s),n.propertyChangedHandler("dataSource",void 0,s),n.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=s,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],s=o[0],n=o[1];a.grid.columnByDataField[s].filter=n}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document,a.grid.autoSaveState()}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document,e.grid.autoSaveState()}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")?t="customize":e.$.headerDropDown.classList.contains("view-panel")?t="view":e.$.headerDropDown.classList.contains("colors-panel")&&(t="colors"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,s=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&s.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();t.$.ai.contains(a)&&t._applyAI(),s.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)?t.addSort(o.sortByInfo):t.$.colors.contains(a)&&t.addColors(o.value,o.decorator,o.filters),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target,o=t.grid?t.grid.$.header:null;if(t.grid&&t.grid.header.appendTo&&(o=document.querySelector(t.grid.header.appendTo)),!o)return;t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]);const s=e.originalEvent.composedPath();for(let e=0;e<s.length;e++){const t=s[e];if(t&&t.classList&&t.classList.contains("smart-menu-item")){const e=t.closest("smart-menu");if(e&&e.classList.contains("smart-grid-views-menu"))return;if(e&&e.classList.contains("smart-grid-download-menu"))return}}if(t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),a!==t.$.colorButton&&a!==t.$.backgroundButton&&t._closeColorMenu(),a!==t.$.fontSizeButton&&t._closeFontSizeMenu(),a!==t.$.fontFamilyButton&&t._closeFontFamilyMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||a!==o&&o.contains(a))){const s=a.closest("smart-scroll-viewer"),n=a.closest(".smart-drop-down");if((!s||!o.contains(s.ownerElement))&&(!n||n.ownerElement&&!o.contains(n.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;if(t._dropDownCloseDate&&new Date-t._dropDownCloseDate<500)return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,s=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((t=>!(!t||!1===t._visible||("filter"===e||"sort"===e)&&("sort"===e&&!t.sortOrder||"filter"===e&&!t.filter)&&!1===t.visible))),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null,options:e.editor&&e.editor.dataSource?e.editor.dataSource:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;s.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;s.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),t.grid.appearance.showViewBarAsDropdown||t._updateViews(),e.header.onInit&&e.header.onInit(t)}_removeFontFamilyMenu(){const e=this;if(e.fontFamilyMenu){const t=e.fontFamilyMenu.querySelector("smart-menu");t&&e.fontFamilyMenu.removeChild(t)}}_removeFontSizeMenu(){const e=this;if(e.fontSizeMenu){const t=e.fontSizeMenu.querySelector("smart-menu");t&&e.fontSizeMenu.removeChild(t)}}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeLabelMenu(){const e=this;if(e.labelMenu){const t=e.labelMenu.querySelector("smart-menu");t&&e.labelMenu.removeChild(t);const a=e.labelMenu.querySelector(".label");a&&e.labelMenu.removeChild(a)}}_removeResourceMenu(){const e=this;if(e.resourceMenu){const t=e.resourceMenu.querySelector("smart-menu");t&&e.resourceMenu.removeChild(t);const a=e.resourceMenu.querySelector(".label");a&&e.resourceMenu.removeChild(a)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t);const a=e.viewsMenu.querySelector(".label");a&&e.viewsMenu.removeChild(a)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o)=>{const s=document.createElement("smart-menu-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt","grid"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("gridView");break;case"kanban":n="smart-icon-kanban-alt","kanban"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("kanbanView");break;case"card":n="smart-icon-card-alt","card"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("cardView");break;case"scheduler":n="smart-icon-scheduler","scheduler"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("schedulerView");break;case"timeline":n="smart-icon-timeline","timeline"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("timelineView")}return s.label='<span class="smart-grid-icon '+n+'"></span>'+e,s.value=a,s};o.appendChild(s(t.localize("viewGrid"),"grid",!0)),o.appendChild(s(t.localize("viewKanban"),"kanban",!0)),o.appendChild(s(t.localize("viewCard"),"card",!0)),o.appendChild(s(t.localize("viewScheduler"),"scheduler",!0)),a.appendChild(o),e.viewsMenu.insertBefore(a,e.viewsMenu.children[e.viewsMenu.children.length-1]),e.viewsMenu.onpointerup=()=>!1,a.onItemClick=a=>{e._setView(a.detail.value),e._closeViewsMenu(),t.autoSaveState(),e._updateViews()}}_createResourceMenuItems(){const e=this,t=e.grid;e._removeResourceMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._dateStackedBySelect===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};let n=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.editor&&a.editor.dataSource&&a.editor.singleSelect&&a.editor.dataSource.length&&("collaborator"===a.template||"tags"===a.template)&&(o.appendChild(s(a.label,a.icon,0,a.dataField)),n=!0)}if(a.appendChild(o),n&&e.resourceMenu.insertBefore(a,e.resourceMenu.children[e.resourceMenu.children.length-1]),e.resourceMenu.onpointerup=()=>!1,!n){const a=document.createElement("div");a.classList.add("label","smart-flex","middle","center","smart-quiet"),a.style.minHeight="60px",a.style.height="100%",a.innerHTML=t.localize("noGrouping"),e.resourceMenu.appendChild(a)}a.onItemClick=a=>{t._dateStackedBySelect===a.detail.item.value?delete t._dateStackedBySelect:t._dateStackedBySelect=a.detail.item.value,t._onSort&&t._onSort(),e._closeResourceMenu(),t.autoSaveState()}}_updateViews(){const e=this,t=e.grid;if(t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.removeAttribute("aria-expanded"),t.stateSettings.enabled&&t.appearance.showViewBar){const a=e=>{(!t.users.length||!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser)&&(delete t.stateSettings.storage[e.valueName],t.stateSettings.current===e.valueName&&(t.stateSettings.current=""),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],e.valueName,t.stateSettings.storage,t.stringify_object),e.remove())},o=a=>{const o=document.createElement("input");if(o.value=a.valueName,t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser))return;const s=()=>{if(o.value){if(t.stateSettings.storage[o.value])return;const s=t.stateSettings.storage[a.valueName];t.stateSettings.current===a.valueName&&(t.stateSettings.current=o.value),delete t.stateSettings.storage[s.name],s.name=o.value,t.stateSettings.storage[s.name]=s,t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],s.name,t.stateSettings.storage,t.stringify_object),delete t.stateSettings.storage[a.valueName],o.remove();const n=o.value;a.valueName=n;let i="smart-icon-grid-alt";switch(s.view){case"grid":i="smart-icon-grid-alt";break;case"kanban":i="smart-icon-kanban-alt";break;case"card":i="smart-icon-card-alt";break;case"scheduler":i="smart-icon-scheduler";break;case"timeline":i="smart-icon-timeline"}n===t.stateSettings.current?(a.selected=!0,a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',e._refreshViewsButton()}};o.onselectstart=e=>{e.stopPropagation()},o.onpointerdown=o.onpointerup=e=>{e.stopPropagation()},o.onkeydown=e=>{e.stopPropagation()},o.onkeyup=e=>{"Escape"===e.key&&(o.onchange=o.onblur=null,o.remove()),"Enter"===e.key&&(o.onchange=o.onblur=null,s()),e.stopPropagation()},o.onchange=()=>{o.onblur=null,o.onkeyup=null,s()},o.onblur=()=>{o.remove()},o.style.width="100%",o.style.height="100%",o.style.position="absolute",o.style.left="0px",o.style.top="0px",o.style.zIndex=99,o.classList.add("smart-input"),o.classList.add("underlined"),o.style.backgroundColor="var(--smart-background)",o.style.color="var(--smart-background-color)",a.querySelector(".smart-list-item-label-element").appendChild(o),setTimeout((()=>{o.focus()}),50)},s=(e,a,o)=>{const s=document.createElement("smart-list-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt";break;case"kanban":n="smart-icon-kanban-alt";break;case"card":n="smart-icon-card-alt";break;case"scheduler":n="smart-icon-scheduler";break;case"timeline":n="smart-icon-timeline"}return s.value=o,s.valueName=e,e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>')),s};t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.setAttribute("aria-expanded",!0);let n=t.$.viewBar;if(t.appearance.showViewBarAsDropdown&&(n=e.$.viewPanel),t.appearance.viewBarAppendTo&&(n=document.querySelector(t.appearance.viewBarAppendTo),n&&n.classList.add("smart-grid-view-bar")),n&&!n.querySelector(".smart-grid-view-chooser-container")){const a=document.createElement("div");a.classList.add("smart-grid-view-chooser-container","smart-container");const o=document.createElement("div");o.classList.add("new-view"),!1===t.editing.enabled&&o.classList.add("smart-hidden");const s=(a,o)=>{a.stopPropagation(),a.preventDefault(),t.beginUpdate();let s=0,i=[];if(t.stateSettings.storage){for(;t.stateSettings.storage[t.localize("view")+" "+s];)s++;for(let e in t.stateSettings.storage){const a=t.stateSettings.storage[e];i[a.view]=1+i[a.view]||1}}let r="";switch(o){case"grid":r=t.localize("viewGrid");break;case"kanban":r=t.localize("viewKanban");break;case"card":r=t.localize("viewCard");break;case"scheduler":r=t.localize("viewScheduler");break;case"timeline":r=t.localize("viewTimeline")}if(i[o]||(i[o]=""),t.stateSettings.storage){let e=i[o]?t.localize("view")+" "+i[o]:t.localize("view");for(;t.stateSettings.storage[r+" "+e];)e=t.localize("view")+" "+i[o],i[o]++}const l=i[o]?t.localize("view")+" "+i[o]:t.localize("view");if(!n){let a=t.$.viewBar;t.appearance.showViewBarAsDropdown&&(a=e.$.viewPanel),t.appearance.viewBarAppendTo&&(a=document.querySelector(t.appearance.viewBarAppendTo),a&&a.classList.add("smart-grid-view-bar")),a&&(n=a)}if(!n)return void t.endUpdate();n._input.value=r+" "+l,t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,e._closeViewsMenu(),t.resetState(!1);const d=t.view;t.set("view","grid",!1),t._kanban&&t._kanban._reset(),delete t.columnByDataField.taskStatus,"grid"===o&&"grid"!==d?e._setView("grid",!0):"kanban"===o?e._setView("kanban"):"card"===o?e._setView("card"):"scheduler"===o?e._setView("scheduler"):"timeline"===o&&e._setView("timeline"),t.saveState(),t.endUpdate(),e._updateViews(),t.$.fireEvent("viewChanged",{view:t.view})},i=document.createElement("smart-button");i.classList.add("selected"),i.classList.add("view"),i.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-grid-alt"></span>'+t.localize("newGrid")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',i.title=t.localize("gridView");const r=document.createElement("smart-button");r.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-kanban-alt"></span>'+t.localize("newKanban")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',r.classList.add("view"),r.title=t.localize("kanbanView");const l=document.createElement("smart-button");l.classList.add("selected"),l.classList.add("view"),l.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-card-alt"></span>'+t.localize("newCard")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',l.title=t.localize("cardView");const d=document.createElement("smart-button");d.classList.add("selected"),d.classList.add("view"),d.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-scheduler"></span>'+t.localize("newScheduler")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',d.title=t.localize("schedulerView");const c=document.createElement("smart-button");c.classList.add("selected"),c.classList.add("view"),c.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-timeline"></span>'+t.localize("newTimeline")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',c.title=t.localize("timelineView");const u=document.createElement("div");u.classList.add("smart-grid-view-storage"),a.appendChild(u);const m=document.createElement("smart-input");m.classList.add("underlined"),m.placeholder=t.localize("viewNamePlaceholder"),m.hint=t.localize("viewNamePlaceholder"),m.onselectstart=e=>{e.stopPropagation()};const p=document.createElement("div");p.innerHTML="<span>"+t.localize("settings")+'</span><span class="smart-grid-icon show smart-icon-sort-down"></span>',p.classList.add("view-label"),o.appendChild(p);const h=document.createElement("div");o.appendChild(h),h.classList.add("footer"),t.users&&t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(h.classList.add("smart-hidden"),p.classList.add("smart-hidden"))),h.appendChild(i),h.appendChild(r),h.appendChild(l),h.appendChild(d),p.onclick=()=>{p.classList.toggle("collapsed"),h.classList.toggle("collapsed")};const g=document.createElement("div");g.innerHTML='<span class="smart-grid-icon show smart-icon-plus"></span><span><a href="javascript:void();">'+t.localize("createView")+"</a></span>",g.classList.add("view-button"),g.onclick=e=>{let t="grid";r.classList.contains("selected")&&(t="kanban"),l.classList.contains("selected")&&(t="card"),d.classList.contains("selected")&&(t="scheduler"),c.classList.contains("selected")&&(t="timeline"),s(e,t,o)},r.onpointerdown=()=>{r.classList.add("selected"),i.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},i.onpointerdown=()=>{i.classList.add("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},l.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.add("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},d.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.add("selected"),c.classList.remove("selected"),g.click()},c.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.add("selected"),g.click()};const v=()=>{t.stateSettings.storage&&!t.stateSettings.storage[m.value]||m.value&&!t.stateSettings.storage?g.classList.remove("disabled"):g.classList.add("disabled")};m.update=()=>v(),m.onkeyup=m.onchange=()=>{v()},v(),a.appendChild(o),n._storage=u,n._input=m,n.appendChild(a)}let i=t.stateSettings.storage;(i&&0===Object.keys(i).length||!i)&&(n._input.value||("kanban"===t.view?n._input.value=t.localize("newKanban")+" "+t.localize("view"):"card"===t.view?n._input.value=t.localize("newCard")+" "+t.localize("view"):"scheduler"===t.view?n._input.value=t.localize("newScheduler")+" "+t.localize("view"):n._input.value=t.localize("newGrid")+" "+t.localize("view")),t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,i=t.stateSettings.storage);const r=n?n._storage:document.createElement("div");if(r.innerHTML="",i){let e=1;const l=document.createDocumentFragment();let d=[],c=[];for(let e in i){const t=i[e];c[t.name]||(c[t.name]=t,d.push({name:e,value:t}))}d.sort(((e,t)=>{const a=new Date(e.value.date),o=new Date(t.value.date);if(e.value&&e.value.date&&t.value&&t.value.date){if(!e.value.date||!t.value.date)return-1;if(a<o)return-1;if(a>o)return 1;if(a===o)return 0}else{if(e.name<t.name)return-1;if(e.name>t.name)return 1;if(e.name===t.name)return 0}}));let u=[],m=-1;for(let t in d){const a=d[t],o=a.name,n=a.value;e++,u[n.view]=u[n.view]++||1;const i=s(o,n.view,n);i.selected&&(m=parseInt(t),delete i.selected),l.appendChild(i)}if(e){const e=document.createElement("smart-list-box");e.style.width="100%",e.style.height="100%",e.allowDrag=!0,e.allowDrop=!0,e.itemHeight=32,e.mode="vertical",e.style.borderColor="transparent",e.classList.add("smart-grid-views-menu"),e.checkable=!0,e.checkboxes=!0,e.filterable=!0,e.filterInputPlaceholder=t.localize("commandBarSearch")+" "+t.localize("view"),e.selectionMode="one",e.disableAutoCheck=!0,e.rightToLeft=t.rightToLeft,e.ondragend=e=>{const t=e.detail.item;if(i[t.valueName]){const t=e.detail.target;if(t){const e=i[t.valueName],a=e?e.date:null;if(a){let t=new Smart.Utilities.DateTime(a);const o="top"===Smart.ListBox.DragDrop.DropDetails.position?-10:10;t=t.addSeconds(o),e.date=t.toDate().toJSON()}}}},e.onkeydown=t=>{const a=e.querySelector("smart-list-item[checked]");a&&"F2"===t.key&&o(a)},e.onDoubleClick=e=>{const t=e.target.closest("smart-list-item");o(t)},e.onClick=e=>{if(e.target&&e.target.classList.contains("smart-icon-delete")){const t=e.target.closest("smart-list-item");a(t),e.preventDefault(),e.stopPropagation()}else if(e.target&&e.target.classList.contains("smart-icon-mode-edit")){const t=e.target.closest("smart-list-item");o(t),e.preventDefault(),e.stopPropagation()}else if("INPUT"===e.target.nodeName)return},e.appendChild(l),r.appendChild(e),e.clearSelection(),e.selectedIndexes=[m],e.onchange=a=>{if(a.detail&&a.detail.selected){const o=a.detail.addedItems[0];t.loadState(o.valueName),e.querySelectorAll("smart-list-item").forEach((e=>{e.querySelector(".smart-icon-delete").classList.add("show")})),o.querySelector(".smart-icon-delete").classList.remove("show"),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],o.valueName,t.stateSettings.storage,t.stringify_object)}}}if(t.stateSettings.storage)for(;t.stateSettings.storage[t.localize("view")+" "+e];)e++;let p="";switch(t.view){case"grid":p=t.localize("viewGrid");break;case"kanban":p=t.localize("viewKanban");break;case"card":p=t.localize("viewCard");break;case"scheduler":p=t.localize("viewScheduler");break;case"timeline":p=t.localize("viewTimeline")}if(t.stateSettings.storage)for(;t.stateSettings.storage[p+" "+t.localize("view")+" "+u[t.view]];)u[t.view]++;n&&n._input&&(n._input.value=p+" "+t.localize("view")+" "+u[t.view],n._input.update())}}}_setView(e,t){const a=this,o=a.grid;if(o.view===e&&!0!==t)return;o.view;const s=o.context;if("kanban"===e)if(o.context=o,o.view="kanban",o.context=s,o._kanbanInitialized&&o.columnByDataField.taskStatus)if(o.columnByDataField.taskStatus&&o._stackedBy&&o.columnByDataField.taskStatus.dataField!==o._stackedBy){o.beginUpdate(),delete o.columnByDataField.taskStatus;const e=o.columnByDataField[o._stackedBy];o.columnByDataField.taskStatus=e,o._createKanban(e),o._refreshHeaderBar(),o.endUpdate(!1),o._hideSchedulerView(),o._showKanbanView(),a._refresh()}else o._hideSchedulerView(),o._showKanbanView(),a._refresh();else delete o._kanbanInitialized,o._initKanbanView("dynamic","grid");else"grid"===e?(o.context=o,o.view="grid",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"card"===e?(o.context=o,o.view="card",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"scheduler"!==e&&"timeline"!==e||(o.context=o,o.view=e,o.context=s,t?(o._hideKanbanView(),o._showSchedulerView(),a._refresh()):(o._createScheduler(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()));o.$.fireEvent("viewChanged",{view:e}),a._refresh()}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const s=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const s='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+s+e,a.value=t,a};o.appendChild(s(t.localize("download")+" CSV","csv")),o.appendChild(s(t.localize("download")+" XLSX","xlsx")),o.appendChild(s(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")?e._closeViewsMenu():e.resourceMenu&&e.resourceMenu.classList.contains("open")?e._closeResourceMenu():e.labelMenu&&e.labelMenu.classList.contains("open")?e._closeLabelMenu():e.colorMenu&&e.colorMenu.classList.contains("open")&&e._closeColorMenu()}_closeResourceMenu(){const e=this,t=e.resourceMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.resourceButton.classList.remove("selected"),e.$.resourceButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openResourceMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.resourceMenu&&e.resourceMenu.classList.contains("open"))return void e._closeResourceMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.resourceButton.classList.add("selected"),e.$.resourceButton.setAttribute("aria-expanded",!0),e.resourceMenu||(e.resourceMenu=document.createElement("div"),e.resourceMenu.classList.add("smart-grid-column-menu","smart-grid-resource-menu"),e.resourceMenu.setAttribute("theme",e.getAttribute("theme")),e.resourceMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.resourceMenu.classList.add("smart-animate"),e._createResourceMenuItems(),e.resourceMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.resourceMenu):document.body.appendChild(e.resourceMenu);const t=e.$.resourceButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.resourceMenu.offsetWidth,a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.resourceMenu.offsetWidth)),e.resourceMenu.style.left=a+"px",e.resourceMenu.style.top=o+"px",e.resourceMenu.classList.remove("smart-hidden"),e.resourceMenu.classList.add("open")}_closeLabelMenu(){const e=this,t=e.labelMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.labelButton.classList.remove("selected"),e.$.labelButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_createLabelMenuItems(){const e=this,t=e.grid;e._removeLabelMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._labeledBy===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};for(let e=0;e<t.columns.length;e++){const a=t.columns[e];"string"!==a.dataType||a.relationField||"input"!==a.editor.template&&"textarea"!==a.editor.template||o.appendChild(s(a.label,a.icon,0,a.dataField))}a.appendChild(o),e.labelMenu.insertBefore(a,e.labelMenu.children[e.labelMenu.children.length-1]),e.labelMenu.onpointerup=()=>!1,a.onItemClick=a=>{t._labeledBy===a.detail.item.value?delete t._labeledBy:t._labeledBy=a.detail.item.value,t._onSort&&t._onSort(),e._closeLabelMenu(),t.autoSaveState()}}_closeColorMenu(){const e=this,t=e.colorMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.colorButton.classList.remove("selected"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.classList.remove("selected"),e.$.backgroundButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_closeFontSizeMenu(){const e=this,t=e.fontSizeMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontSizeButton.classList.remove("selected"),e.$.fontSizeButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontSizeMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontSizeMenu&&e.fontSizeMenu.classList.contains("open"))return void e._closeFontSizeMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontSizeButton.classList.add("selected"),e.$.fontSizeButton.setAttribute("aria-expanded",!0),e.fontSizeMenu||(e.fontSizeMenu=document.createElement("div"),e.fontSizeMenu.classList.add("smart-grid-column-menu","smart-grid-fontsize-menu"),e.fontSizeMenu.setAttribute("theme",e.getAttribute("theme")),e.fontSizeMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontSizeMenu.classList.add("smart-animate");const t=e.grid;e._removeFontSizeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","8px","10px","12px","14px","18px","24px"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontSizeMenu.appendChild(a),a.onItemClick=t=>{const a=t.detail.value;e._setStyle("fontSize",a)},e.fontSizeMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontSizeMenu):document.body.appendChild(e.fontSizeMenu);const n=e.$.fontSizeButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontSizeMenu.offsetWidth,i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontSizeButton.offsetWidth)),e.fontSizeMenu.style.width="60px",e.fontSizeMenu.style.left=i+"px",e.fontSizeMenu.style.top=r+"px",e.fontSizeMenu.classList.remove("smart-hidden"),e.fontSizeMenu.classList.add("open")}_closeFontFamilyMenu(){const e=this,t=e.fontFamilyMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontFamilyButton.classList.remove("selected"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontFamilyMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontFamilyMenu&&e.fontFamilyMenu.classList.contains("open"))return void e._closeFontFamilyMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontFamilyButton.classList.add("selected"),e.$.fontFamilyButton.setAttribute("aria-expanded",!0),e.fontFamilyMenu||(e.fontFamilyMenu=document.createElement("div"),e.fontFamilyMenu.classList.add("smart-grid-column-menu","smart-grid-fontfamily-menu"),e.fontFamilyMenu.setAttribute("theme",e.getAttribute("theme")),e.fontFamilyMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontFamilyMenu.classList.add("smart-animate");const t=e.grid;e._removeFontFamilyMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","Roboto","Segoe UI","Arial","Georgia","Tahoma","Times New Roman","Courier New","Verdana"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontFamilyMenu.appendChild(a),a.onItemClick=t=>{e._setStyle("fontFamily",t.detail.value)},e.fontFamilyMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontFamilyMenu):document.body.appendChild(e.fontFamilyMenu);const n=e.$.fontFamilyButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontFamilyMenu.offsetWidth,i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontFamilyButton.offsetWidth)),e.fontFamilyMenu.style.width="140px",e.fontFamilyMenu.style.left=i+"px",e.fontFamilyMenu.style.top=r+"px",e.fontFamilyMenu.classList.remove("smart-hidden"),e.fontFamilyMenu.classList.add("open")}_openColorMenu(e,t){const a=this;if(a.grid.editing.isEditing&&a.grid.cancelEdit(),a.colorMenu&&a.colorMenu.classList.contains("open")){if(a.colorMenu.classList.remove("open"),a.colorMenu.isBackground&&t)return void a._closeColorMenu();if(!a.colorMenu.isBackground&&!t)return void a._closeColorMenu()}a.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),a.$.group.classList.add("smart-hidden"),a.$.filter.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a.$.format.classList.add("smart-hidden"),a.$.view.classList.add("smart-hidden"),a.$.ai.classList.add("smart-hidden"),a.closePanel(),a.$.colorButton.classList.remove("selected"),a.$.colorButton.removeAttribute("aria-expanded"),a.$.backgroundButton.classList.remove("selected"),a.$.backgroundButton.removeAttribute("aria-expanded"),t?(a.$.backgroundButton.classList.add("selected"),a.$.backgroundButton.setAttribute("aria-expanded",!0)):(a.$.colorButton.classList.add("selected"),a.$.colorButton.setAttribute("aria-expanded",!0)),a.colorMenu||(a.colorMenu=document.createElement("div"),a.colorMenu.className="smart-grid-column-menu smart-grid-color-menu smart-color-input-drop-down-menu smart-color-panel smart-input-drop-down-menu underlined-drop-down-menu smart-grid-color-input-drop-down-menu smart-drop-down-box-drop-down-menu smart-color-picker-drop-down-menu smart-grid-color-input",a.colorMenu.setAttribute("theme",a.getAttribute("theme")),a.colorMenu.id=a.id+"_"+a.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),a.colorMenu.innerHTML=a._getColors()),a.colorMenu.classList.add("smart-animate"),a.colorMenu.isBackground=t,a.colorMenu.style.height="auto",a.isInShadowDOM?a.getRootNode().appendChild(a.colorMenu):document.body.appendChild(a.colorMenu);const o=t?a.$.backgroundButton.getBoundingClientRect():a.$.colorButton.getBoundingClientRect();let s=o.left+window.pageXOffset,n=o.bottom+window.pageYOffset;s+a.colorMenu.offsetWidth>window.innerWidth&&(s=o.right+window.pageXOffset-a.colorMenu.offsetWidth,s+a.colorMenu.offsetWidth>window.innerWidth&&(s=window.innerWidth-a.colorMenu.offsetWidth)),a.colorMenu.style.left=s+"px",a.colorMenu.style.top=n+"px",a.colorMenu.classList.remove("smart-hidden"),a.colorMenu.classList.add("open"),a.colorMenu.querySelectorAll(".color-sample").forEach((t=>{t.classList.remove("selected"),t.getAttribute("value")===e&&t.classList.add("selected")})),a.colorMenu.onpointerup=e=>{const o=e.target.getAttribute("value");void 0!==o&&(a._closeColorMenu(),t?(a.$.backgroundButton.style.setProperty("--smart-surface-color",o),a._setStyle("background",o)):(a.$.colorButton.style.setProperty("--smart-surface-color",o),a._setStyle("color",o)))}}_openLabelMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.labelMenu&&e.labelMenu.classList.contains("open"))return void e._closeLabelMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.labelButton.classList.add("selected"),e.$.labelButton.setAttribute("aria-expanded",!0),e.labelMenu||(e.labelMenu=document.createElement("div"),e.labelMenu.classList.add("smart-grid-column-menu","smart-grid-label-menu"),e.labelMenu.setAttribute("theme",e.getAttribute("theme")),e.labelMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.labelMenu.classList.add("smart-animate"),e._createLabelMenuItems(),e.labelMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.labelMenu):document.body.appendChild(e.labelMenu);const t=e.$.labelButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.labelMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.labelMenu.offsetWidth,a+e.labelMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.labelMenu.offsetWidth)),e.labelMenu.style.left=a+"px",e.labelMenu.style.top=o+"px",e.labelMenu.classList.remove("smart-hidden"),e.labelMenu.classList.add("open")}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu","smart-grid-view-chooser"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_setStyle(e,t){const a=this.grid;if(!a._selection)return;const o=a._selection.cells;if(o&&Object.keys(o).length>0){const o=a.getSelectedCells(!1),s={};for(let n=0;n<o.length;n++){const i=o[n],r=i[0],l=i[1],d=a.rowById[r],c=d.style?JSON.parse(JSON.stringify(d.style)):{};s[r]||(s[r]={});for(let e in c){for(let e=0;e<a.columns.length;e++){const t=a.columns[e].dataField;c[t]&&(s[r][t]=c[t])}c[e]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].indexOf(e)>=0&&(s[r][e]=c[e])}const u=s[r];if(d){const a=d.getCell(l);if(a){const o=a.canNotify;a.canNotify=!1,"textDecoration"===e?(a[e]||(a[e]=""),a[e].indexOf(t)>=0?a[e]=a[e].replace(t,"").trim():a[e]+=" "+t):a[e]===t?a[e]="":a[e]=t,a.canNotify=o;const s=u[a.column.dataField]={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[e]&&(s[e]=a[e])}))}const o=d.canNotify;if(0===Object.keys(u).length){delete s[r];continue}d.canNotify=!1,d.style=u,d.canNotify=o}}if(a.onRowStyle){const e=[],t=[],o=[];Object.keys(s).forEach(((n,i)=>{const r=s[n];e.push(i),t.push(a.rowById[n]),o.push(r)})),a.onRowStyle(e,t,o)}a._recycle(!1,!0)}else{const o=a.getSelectedRowIds(),s=[],n=[],i=[];for(let r=0;r<o.length;r++){const l=o[r],d=a.rowById[l],c=d.style?JSON.parse(JSON.stringify(d.style)):{};if("textDecoration"===e?(c[e]||(c[e]=""),c[e].indexOf(t)>=0?c[e]=c[e].replace(t,"").trim():c[e]+=" "+t):c[e]===t?c[e]="":c[e]=t,a.setRowStyle(l,c),a.onRowStyle){s.push(d.index),n.push(d);const e={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((t=>{c[t]&&(e[t]=c[t])})),i.push(e)}}a.onRowStyle&&a.onRowStyle(s,n,i)}}_updateTools(){const e=this,t=e.grid;if(!t._selection)return;const a=t._selection.cells;if(a&&Object.keys(a).length>0){const a=t.getSelectedCells(!1);for(let o=0;o<a.length;o++){const s=a[o],n=s[0],i=s[1],r=t.rowById[n];if(r){const t=r.getCell(i);if(t){e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),e.$.backgroundButton.style.setProperty("--smart-surface-color","inherit"),e.$.colorButton.style.setProperty("--smart-surface-color","inherit"),e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),t.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),t.background&&e.$.backgroundButton.style.setProperty("--smart-surface-color",t.background),t.color&&e.$.colorButton.style.setProperty("--smart-surface-color",t.color),t.fontStyle&&e.$.italicButton.setAttribute("aria-expanded","true"),t.textDecoration&&(t.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),t.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true")),t.fontSize&&e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontSize&&e.setAttribute("focus","")})),t.fontFamily&&e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontFamily&&e.setAttribute("focus","")}));break}}}}else{const a=t.getSelectedRowIds();for(let o=0;o<a.length;o++){const s=a[o],n=t.rowById[s],i=n.style?JSON.parse(JSON.stringify(n.style)):{};e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),i.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),i.background&&(e.$.backgroundButton.style.color=i.background),i.color&&(e.$.colorButton.style.color=i.color),i.fontStyle&&e.$.fontFamilyButton.setAttribute("aria-expanded","true"),i.textDecoration&&(i.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),i.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true"));break}}}_getColors(){return'<div class="default-samples-container grid-mode-container smart-container" role="presentation" style="">\n <div class="grid-samples-container" role="menu">\n <div id="colorInputca5bItem858b" data-label="#D50000" value="#D50000" role="menuitem" aria-label="#D50000" class="color-sample" style="background-color: rgb(213, 0, 0);"></div>\n <div id="colorInputca5bItem963b" data-label="#E67C73" value="#E67C73" role="menuitem" aria-label="#E67C73" class="color-sample" style="background-color: rgb(230, 124, 115);"></div><div id="colorInputca5bItem2f1f" data-label="#F4511E" value="#F4511E" role="menuitem" aria-label="#F4511E" class="color-sample" style="background-color: rgb(244, 81, 30);"></div><div id="colorInputca5bItem1a87" data-label="#F6BF26" value="#F6BF26" role="menuitem" aria-label="#F6BF26" class="color-sample" style="background-color: rgb(246, 191, 38);"></div><div id="colorInputca5bItem4c44" data-label="#0B8043" value="#0B8043" role="menuitem" aria-label="#0B8043" class="color-sample" style="background-color: rgb(11, 128, 67);"></div><div id="colorInputca5bItem8669" data-label="#33B679" value="#33B679" role="menuitem" aria-label="#33B679" class="color-sample" style="background-color: rgb(51, 182, 121);"></div><div id="colorInputca5bItem488c" data-label="#3F51B5" value="#3F51B5" role="menuitem" aria-label="#3F51B5" class="color-sample" style="background-color: rgb(63, 81, 181);"></div><div id="colorInputca5bItemc3aa" data-label="#039BE5" value="#039BE5" role="menuitem" aria-label="#039BE5" class="color-sample" style="background-color: rgb(3, 155, 229);"></div><div id="colorInputca5bItem4277" data-label="#7986CB" value="#7986CB" role="menuitem" aria-label="#7986CB" class="color-sample" style="background-color: rgb(121, 134, 203);"></div><div id="colorInputca5bItem3b61" data-label="#8C47FF" value="#8C47FF" role="menuitem" aria-label="#8C47FF" class="color-sample" style="background-color: rgb(140, 71, 255);"></div><div id="colorInputca5bItema4a6" data-label="#8E24AA" value="#8E24AA" role="menuitem" aria-label="#8E24AA" class="color-sample" style="background-color: rgb(142, 36, 170);"></div><div id="colorInputca5bItemdd64" data-label="#FF36C2" value="#FF36C2" role="menuitem" aria-label="#FF36C2" class="color-sample" style="background-color: rgb(255, 54, 194);"></div><div id="colorInputca5bItem07d0" data-label="#616161" value="#616161" role="menuitem" aria-label="#616161" class="color-sample" style="background-color: rgb(97, 97, 97);"></div><div id="colorInputca5bItemb2a4" data-label="#454545" value="#454545" role="menuitem" aria-label="#454545" class="color-sample" style="background-color: rgb(69, 69, 69);"></div><div id="colorInputca5bItem8de8" data-label="#949494" value="#949494" role="menuitem" aria-label="#949494" class="color-sample" style="background-color: rgb(148, 148, 148);"></div><div id="colorInputca5bItem75ce" data-label="#000000" value="#000000" role="menuitem" aria-label="#000000" class="color-sample" style="background-color: rgb(0, 0, 0);"></div></div><div class="grid-samples-container" role="menu"><div id="colorInputca5bItem932f" data-label="#FF9EB7" value="#FF9EB7" role="menuitem" aria-label="#FF9EB7" class="color-sample" style="background-color: rgb(255, 158, 183);"></div><div id="colorInputca5bItemc244" data-label="#FFCFC9" value="#FFCFC9" role="menuitem" aria-label="#FFCFC9" class="color-sample" style="background-color: rgb(255, 207, 201);"></div><div id="colorInputca5bItemcfb1" data-label="#FFD66D" value="#FFD66D" role="menuitem" aria-label="#FFD66D" class="color-sample" style="background-color: rgb(255, 214, 109);"></div><div id="colorInputca5bItem2827" data-label="#FFEBB6" value="#FFEBB6" role="menuitem" aria-label="#FFEBB6" class="color-sample" style="background-color: rgb(255, 235, 182);"></div><div id="colorInputca5bItem766c" data-label="#93DF89" value="#93DF89" role="menuitem" aria-label="#93DF89" class="color-sample" style="background-color: rgb(147, 223, 137);"></div><div id="colorInputca5bItem10b3" data-label="#D1F7C4" value="#D1F7C4" role="menuitem" aria-label="#D1F7C4" class="color-sample" style="background-color: rgb(209, 247, 196);"></div><div id="colorInputca5bItemb8a4" data-label="#9DC7FF" value="#9DC7FF" role="menuitem" aria-label="#9DC7FF" class="color-sample" style="background-color: rgb(157, 199, 255);"></div><div id="colorInputca5bItem78ff" data-label="#D0F0FD" value="#D0F0FD" role="menuitem" aria-label="#D0F0FD" class="color-sample" style="background-color: rgb(208, 240, 253);"></div><div id="colorInputca5bItem71b8" data-label="#CDAFFF" value="#CDAFFF" role="menuitem" aria-label="#CDAFFF" class="color-sample" style="background-color: rgb(205, 175, 255);"></div><div id="colorInputca5bIteme4d6" data-label="#ECE1FD" value="#ECE1FD" role="menuitem" aria-label="#ECE1FD" class="color-sample" style="background-color: rgb(236, 225, 253);"></div><div id="colorInputca5bItem3576" data-label="#FA9DE2" value="#FA9DE2" role="menuitem" aria-label="#FA9DE2" class="color-sample" style="background-color: rgb(250, 157, 226);"></div><div id="colorInputca5bItem8136" data-label="#FFDAF6" value="#FFDAF6" role="menuitem" aria-label="#FFDAF6" class="color-sample" style="background-color: rgb(255, 218, 246);"></div><div id="colorInputca5bItem26e5" data-label="#CBCBCB" value="#CBCBCB" role="menuitem" aria-label="#CBCBCB" class="color-sample" style="background-color: rgb(203, 203, 203);"></div><div id="colorInputca5bItemdc8a" data-label="#EDEDED" value="#EDEDED" role="menuitem" aria-label="#EDEDED" class="color-sample" style="background-color: rgb(237, 237, 237);"></div><div id="colorInputca5bItemd895" data-label="#FFFFFF" value="#FFFFFF" role="menuitem" aria-label="#FFFFFF" class="color-sample" style="background-color: rgb(255, 255, 255); border-color: var(--smart-border); border-style: solid; border-width: 1px;"></div><div id="colorInputca5bItem7231" data-label="" value="" role="menuitem" aria-label="" class="color-sample no-color"></div></div>\n </div>'}_boldCommand(){this._setStyle("fontWeight","bold"),this._updateTools()}_italicCommand(){this._setStyle("fontStyle","italic"),this._updateTools()}_underlineCommand(){this._setStyle("textDecoration","underline"),this._updateTools()}_strikethroughCommand(){this._setStyle("textDecoration","line-through"),this._updateTools()}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("colors")>=0?e.$.colorsButton.classList.remove("smart-hidden"):e.$.colorsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0&&t.editing.enabled?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("states")>=0&&t.stateSettings.enabled&&!t.appearance.viewBarAppendTo?e.$.viewStatesButton.classList.remove("smart-hidden"):e.$.viewStatesButton.classList.add("smart-hidden"),t.header.buttons.indexOf("formatting")>=0&&"grid"===t.view?(e.$.boldButton.classList.remove("smart-hidden"),e.$.italicButton.classList.remove("smart-hidden"),e.$.underlineButton.classList.remove("smart-hidden"),e.$.strikethroughButton.classList.remove("smart-hidden"),e.$.colorButton.classList.remove("smart-hidden"),e.$.backgroundButton.classList.remove("smart-hidden"),e.$.fontSizeButton.classList.remove("smart-hidden"),e.$.fontFamilyButton.classList.remove("smart-hidden"),e.$.boldButton.title=t.localize("bold")+" (Ctrl + B)",e.$.italicButton.title=t.localize("italic")+" (Ctrl + I)",e.$.underlineButton.title=t.localize("underline")+" (Ctrl + U)",e.$.strikethroughButton.title=t.localize("strikethrough")+" (Ctrl + Y)",e.$.colorButton.title=t.localize("color"),e.$.backgroundButton.title=t.localize("background"),e.$.fontSizeButton.title=t.localize("fontSize").replace(":",""),e.$.fontFamilyButton.title=t.localize("fontFamily").replace(":",""),e.$.boldButton.onpointerup=()=>{e._boldCommand()},e.$.italicButton.onpointerup=()=>{e._italicCommand()},e.$.underlineButton.onpointerup=()=>{e._underlineCommand()},e.$.strikethroughButton.onpointerup=()=>{e._strikethroughCommand()},e.$.colorButton.onpointerup=()=>{const t=e.$.colorButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t)},e.$.backgroundButton.onpointerup=()=>{const t=e.$.backgroundButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t,!0)},e.$.fontSizeButton.onpointerup=()=>{e._openFontSizeMenu(),e._updateTools()},e.$.fontFamilyButton.onpointerup=()=>{e._openFontFamilyMenu(),e._updateTools()}):(e.$.boldButton.classList.add("smart-hidden"),e.$.italicButton.classList.add("smart-hidden"),e.$.underlineButton.classList.add("smart-hidden"),e.$.strikethroughButton.classList.add("smart-hidden"),e.$.colorButton.classList.add("smart-hidden"),e.$.backgroundButton.classList.add("smart-hidden"),e.$.fontSizeButton.classList.add("smart-hidden"),e.$.fontFamilyButton.classList.add("smart-hidden")),t.users&&t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser)&&(t.stateSettings.storage&&Object.keys(t.stateSettings.storage).length,t.stateSettings.enabled),"scheduler"===t.view||"timeline"===t.view?(e.$.resourceButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.resourceButton.classList.remove("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.labelButton.classList.remove("smart-hidden")):(e.$.labelButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden")),e.$.labelButton.onpointerup=a=>{t.closeMenu(),e._openLabelMenu(),a.stopPropagation()},e.$.resourceButton.onpointerup=a=>{t.closeMenu(),e._openResourceMenu(),a.stopPropagation()},e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},!1===t.appearance.showViewBarAsDropdown&&(e.$.viewStatesButton.onpointerup=a=>{t.closeMenu(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.appearance.showViewBar=!t.appearance.showViewBar,a.stopPropagation(),e._updateViews()}),t._sortedColumns){const a=[],o=[],s=[];for(let e=0;e<t._sortedColumns.length;e++){const n=t._sortedColumns[e];a.push(n.dataField),o.push(n.sortOrder),s.push(n.dataType)}e._appliedSorting={dataFields:a,dataTypes:s,orderBy:o},e._refreshSortButton()}if("scheduler"!==t.view&&"timeline"!==t.view&&"kanban"!==t.view||e.$.sortButton.classList.add("smart-hidden"),"grid"===t.view||"card"===t.view||"scheduler"===t.view||"timeline"===t.view||"kanban"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumnsByDataField();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const s=t.filters[o];a.filters.push([e,s.condition,s.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshCustomButton(),e._refreshAIButton(),e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshResourceButton(),e._refreshLabelButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e._refreshColorsButton(),e.refreshTools(),Smart.Utilities.Core.isMobile,!1===t.editing.enabled&&(e.$.customButton.classList.add("smart-hidden"),e.$.downloadButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.$.viewsButton.classList.add("smart-hidden"))}_refreshCustomButton(){const e=this,t=e.grid;t.header.customButton.visible?(e.$.customButton.style.paddingLeft="0px",e.$.customButton.classList.remove("smart-hidden")):e.$.customButton.classList.add("smart-hidden"),t.header.customButton.enabled?e.$.customButton.classList.remove("smart-disabled"):e.$.customButton.classList.add("smart-disabled"),e.$.customButton.innerHTML=`<span class="smart-grid-icon show ${t.header.customButton.icon}"></span><div class="smart-tool-label" role="presentation">${t.header.customButton.label}</div>`,e.$.customButton.onclick=()=>{t.header.customButton.command&&t.header.customButton.command()};for(let a=0;a<t.header.buttons.length;a++){const o=t.header.buttons[a];if("object"==typeof o){const t=e.$.customButton.cloneNode(!0);t.classList.remove("smart-hidden"),t.style.paddingLeft="0px",e.$.customButton.parentNode.insertBefore(t,e.$.customButton),o.label&&(t.querySelector(".smart-tool-label").innerHTML=o.label),o.icon&&(t.querySelector(".smart-grid-icon").className="smart-grid-icon show "+o.icon),t.onclick=()=>{o.command&&o.command()}}}}_refreshViewsButton(){const e=this;if(!e.grid)return;let t=e.grid.localize("viewGrid");switch(e.$.viewsButton.classList.remove("kanban"),e.$.viewsButton.classList.remove("card"),e.$.viewsButton.classList.remove("scheduler"),e.$.viewsButton.classList.remove("timeline"),e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":t=e.grid.localize("viewGrid");break;case"card":e.$.viewsButton.classList.add("card"),t=e.grid.localize("viewCard");break;case"scheduler":e.$.viewsButton.classList.add("scheduler"),t=e.grid.localize("viewScheduler");break;case"timeline":e.$.viewsButton.classList.add("timeline"),t=e.grid.localize("viewTimeline")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>";let a=this.grid.stateSettings.current||"";if(a.length>30)a=a.substring(0,30)+"...";else if(!a){let e=[],t=this.grid.view,o="";switch(t){case"grid":o=this.grid.localize("viewGrid");break;case"kanban":o=this.grid.localize("viewKanban");break;case"card":o=this.grid.localize("viewCard");break;case"scheduler":o=this.grid.localize("viewScheduler");break;case"timeline":o=this.grid.localize("viewTimeline")}if(this.grid&&this.grid.stateSettings.storage)for(;this.grid.stateSettings.storage[o+" "+this.grid.localize("view")+" "+e[t]];)e[t]++;void 0===e[t]&&(e[t]=""),a=o+" "+this.grid.localize("view")+" "+e[t]}const o=""!==a?a:this.grid.localize("views");e.$.viewStatesButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o+"</div>"}_refreshDownloadButton(){const e=this;e.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation"></div>',e.$.downloadButton.title=e.grid.localize("download")}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.$.headerBar.$.deleteButton,o=a.closest("smart-grid");(!o||o._currentUser&&(!o._currentUser||o._currentUser.info&&"guest"!==o._currentUser.info))&&0!==t?(!0===e.editing.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.$.headerBar._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;if("kanban"===o.view||"scheduler"===o.view||"timeline"===o.view)return;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._refreshColumns("group"),o.closeMenu();const s=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(s.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=s,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=s,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,s=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const n=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&s)for(let e=0;e<s.length;e++){const t=o.columnByDataField[s[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate(),o.autoSaveState();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=n}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshLabelButton(){const e=this;if(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel")+"</div>",e.$.labelButton.classList.remove("grouped"),e.grid&&e.grid._labeledBy){const t=e.grid.columnByDataField[e.grid._labeledBy];t&&(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:t.label})+"</div>",e.$.labelButton.classList.add("grouped"))}else if(e.grid)for(let t=0;t<e.columns.length;t++){const a=e.columns[t];if("string"===a.dataType){e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:a.label})+"</div>",e.$.labelButton.classList.add("grouped");break}}}_refreshResourceButton(){const e=this;if(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("firstByGroup")+"</div>",e.$.resourceButton.classList.remove("grouped"),e.grid&&e.grid._dateStackedBySelect){const t=e.grid.columnByDataField[e.grid._dateStackedBySelect];t&&(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("groupedBy",{column:t.label})+"</div>",e.$.resourceButton.classList.add("grouped"))}}_refreshAIButton(){const e=this;e.$.aiButton.classList.add("smart-hidden"),-1!==e.grid.header.buttons.indexOf("ai")&&(e.$.aiButton.classList.remove("smart-hidden"),e.$.aiButton.style.paddingLeft="0px",e.$.aiButton.innerHTML='<div class="smart-tool-label" role="presentation" style="padding: 5px;">'+e.grid.localize("addAIFilter")+"</div>")}_applyAI(){const e=this,t=e.grid;e.closePanel();const a=e.$.ai.firstElementChild,o=a.getAIInstructions();if(t.beginUpdate(),o&&o.sort&&o.sort.length>0){t.clearSort();const e=o.sort;for(let a=0;a<e.length;a++){const o=e[a],s=o.field,n=o.order;t.sortBy(s,n)}}if(o&&o.filters&&o.filters.length>0&&t._applyJSONFilters(o.filters),o&&o.group&&o.group.length>0){t.clearGroups();let e=o.group.map((e=>e.field));e.length&&e[0]&&t.addGroup(e)}const s=a.$.aiPrompt.value,n=s.indexOf("column")>=0||s.indexOf("cells")>=0;if(t.ai.includeUserPrompts&&(t.ai.userPrompts||(t.ai.userPrompts=[]),t.ai.userPrompts.push(s)),o&&o.format&&o.format.length>0){const e=o.format;let a={};for(let o=0;o<e.length;o++){const s=e[o],i=s.field;if(i&&n)a[i]||(a[i]=[]),a[i].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration});else for(let e=0;e<t.columns.length;e++){const o=t.columns[e];a[o.dataField]||(a[o.dataField]=[]),a[o.dataField].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration})}}for(let e=0;e<t.columns.length;e++)t.columns[e].cellsCSSInlineRules=null;for(let e in a){const o=t.columnByDataField[e];o&&(o.cellsCSSInlineRules=a[e])}}if(o&&o.edit&&o.edit.length>0){const e=o.edit;for(let a=0;a<e.length;a++){const o=e[a],s=o.row,n=o.value,i=o.field;s>=0&&(t.setCellValue(s,i,n),t.flashCell(s,i))}}t.endUpdate()}openAIPanel(){const e=this,t=e.grid;let a;if(e.$.headerDropDown.classList.add("ai-panel"),e.$.headerDropDown.classList.remove("view-panel","search-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.remove("smart-hidden"),e._aiPartCreated)a=e.$.ai.firstElementChild,a.set("locale",e.locale),a.messages=e._innerElementMessages.multiColumnFilterPanel,a.editorPlaceholder=e.localize("aiPrompt"),a.$.applyButton.classList.add("smart-disabled"),a.$.aiResponse.innerHTML=`${t.localize("noAIResponse")}`,a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[0].classList.add("active"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[1].classList.remove("active"),a.$.aiPrompt.value="",a.$.spinner.innerHTML="",a.$.spinner.classList.add("smart-hidden"),a._applyValue(),a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-grid-ai-panel"),a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.locale=e.locale,a.messages=e._innerElementMessages.multiColumnFilterPanel,a.operator=e._appliedFiltering.operator,a.editorPlaceholder=e.localize("aiPrompt"),a.theme=e.theme,a.value=e._appliedFiltering.filters,e.$.ai.appendChild(a),e._aiPartCreated=!0,a.$.addFilterButton.innerHTML="↑ "+t.localize("send"),a.$.addFilterButton.classList.add("smart-ai-button-send"),a.$.addFilterButton.style.background="var(--smart-ui-state-selected)",a.$.addFilterButton.style.borderRadius="15px",a.$.addFilterButton.style.color="var(--smart-primary)",a.$.addFilterButton.style.padding="6px 14px";const o=a.querySelector(".smart-grid-panel-apply-button");a.$.applyButton=o,o.classList.add("smart-disabled"),a.$.itemsContainer.innerHTML=`<style>\n .smart-ai-tabs {\n display: flex;\n align-items: baseline;\n border-bottom: 1px solid var(--smart-border-color);\n font-family: var(--smart-font-family);\n }\n\n .smart-ai-tab {\n padding: 4px 6px;\n cursor: pointer;\n display: flex;\n color: var(--smart-background-color);\n transition: color 0.2s, border-color 0.2s;\n border-bottom: 2px solid transparent;\n }\n\n .smart-ai-tab:hover {\n color: var(--smart-ui-state-color-hover);\n }\n\n .smart-ai-tab.active {\n color: var(--smart-primary);\n border-bottom-color: var(--smart-primary);\n font-weight: 600;\n }\n\n .smart-ai-response {\n min-height: 80px;\n padding: 10px;\n margin-top: 10px;\n width: 360px;\n user-select: text;\n border-radius: var(--smart-border-radius);\n border: 1px solid var(--smart-border);\n }\n\n </style><div class="smart-ai-tabs">\n <div class="smart-ai-tab active" data-tab="add-filter">\n ${t.localize("addAIFilter")}\n </div>\n <div class="smart-ai-tab" data-tab="response">\n <span class="smart-grid-icon show smart-icon-comment"></span> ${t.localize("aiResponse")}\n </div>\n </div>\n <div class="smart-hidden smart-ai-response">\n ${t.localize("noAIResponse")}\n </div>\n `,a.$.itemsContainer.style.paddingTop="0px",a.$.aiResponse=a.$.itemsContainer.querySelector(".smart-ai-response"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>{e.addEventListener("click",(()=>{a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>e.classList.remove("active"))),e.classList.add("active"),"add-filter"===e.getAttribute("data-tab")?(a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden")):(a.$.addFilterButton.classList.add("smart-hidden"),a.$.aiPrompt.classList.add("smart-hidden"),a.$.aiResponse.classList.remove("smart-hidden"))}))}))}e._openHeaderDropDown(e.$.aiButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu();const o=e.$.headerDropDown.querySelector("smart-grid-ai-panel");if(o){o.$.addAIFilterButton.classList.remove("smart-hidden"),o.$.aiPrompt.classList.add("smart-hidden"),o.$.aiPrompt.placeholder=t.localize("aiPrompt"),o.$.aiPrompt.classList.toggle("smart-hidden"),o.$.spinner.classList.remove("smart-hidden"),o.$.aiPrompt.focus(),o.$.aiPrompt.maxRows=5,o.$.aiPrompt.style.minHeight="80px",o.$.aiPrompt.style.resize="none",o.$.aiPrompt.parentElement.style.display="flex",o.$.aiPrompt.parentElement.style.flexDirection="column",t.ai&&!t.ai.key&&o.$.aiPrompt.classList.add("smart-disabled");const a=t.ai.prompts||[];if(t.ai.includeUserPrompts&&t.ai.userPrompts)for(let e=0;e<t.ai.userPrompts.length;e++){const o=t.ai.userPrompts[e];-1===a.indexOf(o)&&a.unshift(o)}const s=o.$.aiPrompt,n=o.$.suggestions;s.onpointerdown=()=>{e._dropDownCloseDate=new Date},s.onselectionchange=()=>{e._dropDownCloseDate=new Date},n.innerHTML='<style>\n .smart-ai-suggestion {\n padding: 6px 10px;\n border-bottom: 1px solid var(--smart-border-color);\n cursor: pointer;\n max-width: 360px;\n }\n .smart-ai-suggestion:hover {\n background-color: var(--smart-ui-state-hover);\n }\n .smart-ai-suggestions-container {\n max-height: 200px;\n overflow-y: auto;\n border: 1px solid var(--smart-border-color);\n border-radius: var(--smart-border-radius);\n margin-top: 5px;\n }\n </style>\n <div class="smart-ai-suggestions-container">\n \n </div>';const i=n.querySelector(".smart-ai-suggestions-container");t.ai&&t.ai.key&&a.forEach((e=>{const t=document.createElement("div");t.classList.add("smart-ai-suggestion"),t.innerText=e,t.onclick=()=>{s.value=e,i.classList.add("smart-hidden"),s.focus()},i.appendChild(t)})),s.oninput=()=>{s.value.length>0?i.classList.add("smart-hidden"):i.classList.remove("smart-hidden")},o.$.addFilterButton.onclick=()=>{let a=0;o.$.spinner.classList.remove("smart-hidden");const s=setInterval((()=>{o.$.spinner.innerHTML=`\rThinking${".".repeat(a%4)} `,a++}),500);let n='\nYou are a helpful assistant that converts natural language data manipulation requests\ninto structured JSON instructions for Smart.Grid AND produces a detailed, user-friendly explanation.\n\nImportant:\nThe JSON you produce represents actions that will be applied ONLY AFTER the user clicks "Apply".\nTherefore, all natural-language explanations must describe what *will happen* once the user applies the changes.\nDo not describe the action as already completed.\n\nUse only these columns:\n';for(let t=0;t<e.columns.length;t++){const a=e.columns[t];(a.allowFilter||a.allowSort||a.allowGroup||a.allowFormat)&&(n+="- "+a.label+" ("+a.dataType+") => "+a.dataField+"\\n")}const i=t.getSelection();let r=i.rows||[],l=i.columns||[],d=i.cells||[];d&&(d=d.map((e=>({row:e.row.id,column:e.column.label,value:e.row.data[e.dataField]})))),r&&(r=r.map((e=>e.id))),l&&(l=l.map((e=>t.columnByDataField[e].label)));let c={};t.getColumnStatistics=e=>{const a=t.getData().map((t=>t[e])).filter((e=>null!=e&&""!==e));if(0===a.length)return{};const o=a.filter((e=>"number"==typeof e)),s={count:a.length,uniqueCount:new Set(a).size};if(o.length>0){const e=o.reduce(((e,t)=>e+t),0),t=e/o.length,a=Math.min(...o),n=Math.max(...o);s.sum=e,s.average=t,s.min=a,s.max=n,s.range=n-a}return s};let u={};for(let a=0;a<e.columns.length;a++){const o=e.columns[a],s=t.getColumnStatistics(o.dataField);c[o.label]=s,o.options&&Array.isArray(o.options)&&(u[o.label]=o.options.map((e=>"object"==typeof e&&null!==e?void 0!==e.label?e.label:e.value:e)))}const m=t._rowElements.filter((e=>!e.classList.contains("smart-hidden"))).map((e=>e.row.data)).map((t=>{const a={};for(let o=0;o<e.columns.length;o++){const s=e.columns[o];a[s.label]=t[s.dataField]}return a}));n+=`\n visibleRows: ${JSON.stringify(m)}\n datasetStats: ${JSON.stringify(c)}\n columnOptions: ${JSON.stringify(u)}\n CurrentSelection: rows: ${JSON.stringify(r)}, columns: ${JSON.stringify(l)}, cells: ${JSON.stringify(d)}\n\n If datasetStats lacks the required numbers for a requested metric, the assistant MUST exclude that metric rather than invent numbers.\n\nThe user may request any combination of the following actions: filtering, sorting, grouping, conditional formatting, editing or summarization.`,n+='\nSupported filter operators:\n CONTAINS, EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN,\n GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, STARTS_WITH, ENDS_WITH\n\nRespond in this format for Filtering\n[\n {\n "field": "dataField",\n "operator": "some operator",\n "value": "some value",\n "type": "some type",\n "logic": "AND }\n]\nWhen the user requests to clear or remove or delete the Filtering\nRespond in this format for Filtering\n[\n {\n "field": null,\n "operator": "null,\n "value": null,\n "type": null,\n "logic": null\n }\n]\nSupported types:\n string, number, date, boolean\n\nThe assistant MUST understand and support operations on the user\'s current selection.\nA selection may include rows, columns, or specific cells.\n\nEDIT RULE: \nSupported edit actions include:\n- fill_empty: Fill empty cells using a source (e.g., from selection, constant value, or text).\n- translate: Translate text in the selected cells or columns.\n- replace_values: Replace or modify values inside the selection or target columns.\n- transform_text: Apply transformations such as uppercase, lowercase, trim, etc.\n\nThe assistant MUST check columnOptions when performing edit actions to ensure the requested action is allowed on the target column(s).\n\nOPTION-CONSTRAINT RULE FOR EDITING:\nSome columns contain restricted, predefined allowed values (options list).\n\nWhen performing an edit action (fill_empty, translate, replace_values, transform_text):\n- The assistant MUST verify that the target value is one of the allowed options if the column contains predefined options.\n- The assistant MUST NOT write a value that does not exist in the options list.\n- The assistant MUST NOT invent new options.\n- If a requested value is not part of the options list, the assistant MUST reply in HTML to request clarification rather than performing the edit.\n\n\nWhen the user requests an action involving selected cells, the assistant MUST include \nthe appropriate "edit" instructions in the JSON.\n\nWhen the user requests an edit action (fill, translate, replace, transform), the assistant MUST compute the actual resulting values for the affected cells using the visible data or selection provided.\nThe assistant MUST place these computed results inside the edit object.\nThe assistant MUST NOT output formulas, instructions, or placeholders. Only the final, edited values are allowed.\n\nRespond in this format for Editing\n[\n {\n "field": "dataField",\n "row": "some row id",\n "oldValue": "some old value",\n "value": "some value",\n "type": "some type",\n "editAction": "fill_empty/translate/replace_values/transform_text }\n]\n\nSORT RULE:\nWhen the user requests sorting (“sort by”, “order by”, etc.):\nRespond in this format for Sorting\n[\n {\n "field": "dataField",\n "order": "asc/desc"\n }\n]\nWhen the user requests to clear or remove or delete the sorting\nRespond in this format for Sorting\n[\n {\n "field": null,\n "order": null\n }\n]\nGROUP RULE:\nWhen the user requests grouping (“group by”, “categorize by”, etc.):\nRespond in this format for Grouping\n[\n {\n "field": "dataField"\n }\n]\nWhen the user requests to clear or remove or delete the grouping\nRespond in this format for Grouping\n[\n {\n "field": null\n }\n]\nFORMAT RULE (STRICT):\n\nWhen the user requests conditional formatting (“highlight”, “color code”, “format”, etc.):\nYou MUST respond ONLY in this exact JSON structure:\n\n[\n {\n "field": "dataField",\n "condition": "=/<>/<=/>=/</>/between",\n "value": "STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nif the user requests formatting for a RANGE of values (e.g., "between 10 and 20"):\nYou MUST add condition2 and value2 keys to the JSON structure like this:\n\n[\n {\n "field": "dataField",\n "condition": "between",\n "value": "lower bound STRING or NUMBER or DATE or BOOLEAN",\n "value2": "upper bound STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nCLEARING FORMATTING:\nWhen the user requests to clear, remove, or delete formatting:\nYou MUST respond ONLY in this structure:\n\n[\n {\n "field": null,\n "condition": "=",\n "value": "",\n "background": null,\n "color": null,\n "textDecoration": null,\n }\n]\n\nADDITIONAL STRICT RULES:\n- Do NOT add extra keys.\n- Do NOT omit required keys.\n- Do NOT output explanations, text, or comments — ONLY the JSON.\n- “condition” MUST be one of: =, <>, <, <=, >, >=.\n- “value” MUST be a STRING, NUMBER, DATE, or BOOLEAN literal.\n- Colors MUST be written as strings.\n\nSUMMARY RULE:\nWhen the user requests a summary (“give me a summary”, “summarize my data”,\n“show totals/averages/count”, etc.):\n\n1. You MUST compute actual numeric results using datasetStats and/or selection.\n - Place these results inside the "summary" JSON object.\n - NEVER output formulas or operations.\n\n2. You MUST generate a full natural-language summary report in the "message" field.\n The report MUST:\n - Use PRESENT TENSE (because summary is computed immediately).\n - Describe totals, averages, minimums, maximums, counts, and ranges.\n - Highlight notable patterns IF AND ONLY IF the stats allow it.\n - Be narrative, readable, and helpful.\n - NOT hallucinate any values not present in datasetStats or selection.\n\nYour task:\nConvert user requests about filtering, sorting, grouping, conditional formatting, editing, \nor summarization into a structured JSON format AND produce a verbose, friendly explanation.\n\nRespond ONLY in this structure:\n\n{\n "json": {\n "filters": [...],\n "sort": [...],\n "group": [...],\n "format": [...],\n "summary": {},\n "edit": []\n },\n "message": "A detailed explanation using FUTURE TENSE, describing what the changes will do once applied. The mssage should be in HTML Format. The explanation MUST be a well-structured HTML message with short paragraphs and bullet points when appropriate. It MUST NOT exceed 200 words unless summarization requires more"\n}\n\nGuidelines for the natural-language \'message\':\n- Use future tense: “will filter”, “will highlight”, “will sort”, etc.\n- Summary results are computed immediately and DO NOT depend on the Apply button.\n Therefore, the explanation for summaries may use PRESENT TENSE (e.g., “The total is 2300”).\n- Do NOT imply the action has already happened.\n- Explain clearly what the user should expect AFTER applying the settings.\n- Be helpful, descriptive, and user-friendly.\n- Avoid referencing JSON or internal logic.\n\nThe assistant MUST NOT invent additional JSON keys or structures.\nIf the user requests an unsupported action, the assistant MUST politely decline.\n\nIf the user request is ambiguous, the assistant MUST reply with a polite clarifying question\ninstead of guessing the action.\n\nIf the user asks a general question, tutorial question, or conceptual question that does NOT request\nfiltering, sorting, grouping, conditional formatting, editing, or summarization,\nthe assistant MUST NOT generate JSON.\n\nInstead, the assistant MUST reply with a natural-language explanation in HTML format.\n\nIf the user asks for help, instructions, or examples, the assistant MUST NOT perform actions.\nThe assistant MUST explain concepts in HTML using concise, user-friendly language.\n',t.ai.getAIResponse=async function(e,a){const o=t.ai.key,s=t.ai.url||"https://api.openai.com/v1/chat/completions",n={"Content-Type":"application/json",Authorization:`Bearer ${o}`},i={model:t.ai.model||"gpt-3.5-turbo",messages:[{role:"system",content:e},{role:"user",content:a}],temperature:.7,max_tokens:1e3},r=await fetch(s,{method:"POST",headers:n,body:JSON.stringify(i)});return(await r.json()).choices[0].message.content};try{t.ai.getAIResponse(n,o.$.aiPrompt.value).then((e=>{let a,n=t.localize("noAIResponse");try{const t=e.indexOf("{");a=JSON.parse(e.substring(t)),a.message&&(n=a.message)}catch(e){a={filters:[]}}if(o.$.aiResponse.innerHTML=n,o.$.spinner.innerHTML="",o.$.spinner.classList.add("smart-hidden"),clearInterval(s),o.$.itemsContainer.querySelector('.smart-ai-tab[data-tab="response"]').click(),a.json){const e=a.json.filters,t=a.json.sort,s=a.json.group,n=a.json.format,i=a.json.summary,r=a.json.edit;o.getAIInstructions=()=>({filters:e||[],sort:t||[],group:s||[],format:n||[],summary:i||{},edit:r||[]}),o.$.applyButton.classList.remove("smart-disabled")}}))}catch(e){o.$.spinner.innerHTML=t.localize("noResults"),clearInterval(s)}},o.$.applyButton.onclick=()=>{o.$.applyButton.classList.contains("smart-disabled")||e._applyAI()}}}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(e.grid&&"kanban"===e.grid.view){e.$.groupButton.onclick=()=>{"kanban"===e.grid.view&&e.grid._initKanbanView("dynamic","kanban")};const t=e.grid.columnByDataField[e.grid._stackedBy];return t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("groupedBy",{column:t.label}),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped"),void e.$.groupButton.classList.remove("scheduler")}if(!e.grid||"scheduler"!==e.grid.view&&"timeline"!==e.grid.view){if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}else if(e.$.groupButton.onclick=()=>{"scheduler"!==e.grid.view&&"timeline"!==e.grid.view||e.grid._createScheduler("update")},e.grid._dateStackedBy&&Array.isArray(e.grid._dateStackedBy)){const t=e.grid.columnByDataField[e.grid._dateStackedBy[0]].label,a=e.grid.columnByDataField[e.grid._dateStackedBy[1]].label;e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t+"-"+a}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")}else{const t=e.grid.columnByDataField[e.grid._dateStackedBy];t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t.label}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped")}}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search(this.$.searchInput.value,!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;if(e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu(),"filter"===t.header.searchCommand){const t=e.$.headerDropDown.querySelector(".smart-data-view-search-prev"),a=e.$.headerDropDown.querySelector(".smart-data-view-search-next");t.classList.add("smart-hidden"),a.classList.add("smart-hidden")}const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const s=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:s,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}addColors(e,t,a){const o=this,s=o.grid;let n=[e,t],i=[];if(o.closePanel(),JSON.stringify(n)===JSON.stringify(o._appliedColors))return;o._appliedColors=n;const r=[],l=o.grid.getRows();for(let e=0;e<l.length;e++)r.push(Object.assign(l[e].data));if("conditions"===t.type){const t=new Smart.DataAdapter({id:"id",observable:!1,dataSource:r,dataFields:o.grid.dataSource.dataFields});t._filter(a,"or");const n=[];for(let e=0;e<t.length;e++){const a=t[e];!1!==a.$.filtered&&n.push(a)}const l=e,d=[];for(let e=0;e<l.length;e++){const t=l[e],a=t[0],o=t[1],n=t[3]?t[2]:void 0,i=t[3]?t[3]:t[2],r=s.columnByDataField[a].dataType,c=new Smart.Utilities.FilterGroup,u=c.createFilter(r,n,o);c.addFilter("or",u),d.push({dataField:a,color:i,filterGroup:c})}for(let e=0;e<n.length;e++){const t=n[e];for(let e=0;e<d.length;e++){const a=d[e].dataField,o=d[e].filterGroup,s=d[e].color,n=t[a];o.evaluate(n)&&(void 0===i[t.$.id]&&(i[t.$.id]={}),i[t.$.id].color=s,i[t.$.id][a]=s)}}}else{const e=t.singleSelect,a=s.columnByDataField[e];if(!a)return s._conditionalColors={colors:[],type:t.type,conditions:[],update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(),o._refreshColorsButton(),void(s._onColors&&s._onColors(s._conditionalColors));const n="collaborator"===a.template?s.users:a.editor.dataSource,r={};n.forEach((e=>"collaborator"===a.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color)));for(let t=0;t<l.length;t++){const a=l[t].data,o=a[e],s=r[o];s&&(i[a.$.id]={color:s})}}s._conditionalColors={colors:i,type:t.type,conditions:e,update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(!1),o._refreshColorsButton(),s.autoSaveState(),o.$.fireEvent("colors"),s._onColors&&s._onColors(s._conditionalColors)}_updateConditionalColors(e,t,a){let o=[];const s=t.getRows();if("conditions"===a.type){const a=t._conditionalColors.conditions,n=[];for(let e=0;e<a.length;e++){const o=a[e],s=o[0],i=o[1],r=o[3]?o[2]:void 0,l=o[3]?o[3]:o[2],d=t.columnByDataField[s];if(d){const e=d.dataType,t=new Smart.Utilities.FilterGroup,a=t.createFilter(e,r,i);t.addFilter("or",a),n.push({dataField:s,color:l,filterGroup:t})}}const i=e=>{for(let t=0;t<n.length;t++){const a=n[t].dataField,s=n[t].filterGroup,i=n[t].color,r=e[a];s.evaluate(r)?(void 0===o[e.$.id]&&(o[e.$.id]={}),o[e.$.id].color=i,o[e.$.id][a]=i):delete o[e.$.id]}};if(e)o=t._conditionalColors.colors,i(e.data);else for(let e=0;e<s.length;e++)i(s[e].data)}else{const n=a.singleSelect,i=t.columnByDataField[n];if(i){const a="collaborator"===i.template?t.users:i.editor.dataSource,r={};if(a.forEach((e=>"collaborator"===i.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color))),e){o=t._conditionalColors.colors,o||(o=t._conditionalColors.colors=[]);const a=e.data,s=a[n],i=r[s];i?o[a.$.id]={color:i}:delete o[a.$.id]}else for(let e=0;e<s.length;e++){const t=s[e].data,a=t[n],i=r[a];i&&(o[t.$.id]={color:i})}}}t._conditionalColors.colors=o,t.autoSaveState(),t.summaryRow.visible||t._recycle(!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,a.grid._recycle(!1),void("filter"===a.grid.header.searchCommand&&a.grid.clearFilter());const o=a._searchInfo.source,s=[],n=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),s.push([t,a])})),o._filter(s,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(n.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=n,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,"filter"===a.grid.header.searchCommand){a.grid.beginUpdate();const t=a.grid.filtering.operator;return a.grid.filtering.operator="or",a.grid.clearFilter(),a._searchInfo.stringDataFields.forEach((t=>{const o=new Smart.Utilities.FilterGroup,s=o.createFilter("string",e,"CONTAINS"),n=a.grid.columnByDataField[t];if(n&&n.editor&&n.editor.dataSource)return!1;n&&(o.addFilter("or",s),a.grid.addFilter(t,o),n._filterInfo&&n.filter.filters[0]&&(n._filterInfo.value=n.filter.filters[0].value,n._filterInfo.condition=n.filter.filters[0].condition))})),a.grid.endUpdate(),a.grid.refreshFilters(),void(a.grid.filtering.operator=t)}if(n.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:n.length}),a._searchInfo.highlighted||(a._searchInfo.highlighted=n[0]),a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}isGrid(){const e=this.grid;return!(e&&("kanban"===e.view&&e._kanban||"scheduler"===e.view&&e._scheduler||"timeline"===e.view&&e._scheduler))}_refreshColorsButton(){const e=this,t=e.grid;let a=0;if(a=t._conditionalColors&&t._conditionalColors.conditions?Object.keys(t._conditionalColors.conditions).length:0,t._conditionalColors&&"singleSelect"===t._conditionalColors.type){a=1;const o=t.columnByDataField[t._conditionalColors.singleSelect];return o?(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formatingBy",{value:o.label})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted"),void e._refreshMobileViewTools()):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),void e.$.colorsButton.classList.remove("formatted"))}a>0?(e.$.colorsButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("formatingOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("formatingByMultiple",{n:a})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted")):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),e.$.colorsButton.classList.remove("formatted")),e._refreshMobileViewTools()}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if(!e.isGrid())return t._kanban&&t._kanban.localize&&(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&(o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++))}a>0?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),e._refreshMobileViewTools()}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let s=0,n=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(n.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||s++)}o.onColumnChange=l,o.onColumnChange?o.onColumnChange(n,"visible",i,r):o.$.fireEvent("columnChange",{column:n,propertyName:"visible",oldValue:i,value:r}),s>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n:s})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],s=a.oldIndex,n=a.newIndex,i=o.columns[n+1],r=o.columns[n-1],l=o.columns[s];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(s,n,!0)}if(o.filtering.enabled&&o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized=!1;o.endUpdate();const d=o.grouping.enabled;d&&o._filters&&o.refreshFilters(d),o.autoSaveState()}});
1541
1541
 
1542
1542
  /***/ }),
1543
1543
 
@@ -1889,7 +1889,7 @@ var __webpack_exports__ = {};
1889
1889
  /* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(5306);
1890
1890
  /* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61___default = /*#__PURE__*/__webpack_require__.n(_smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__);
1891
1891
 
1892
- /* Smart UI v25.0.2 (2025-11-27)
1892
+ /* Smart UI v25.0.1 (2025-11-26)
1893
1893
  Copyright (c) 2011-2025 jQWidgets.
1894
1894
  License: https://htmlelements.com/license/ */ //
1895
1895