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.
- package/package.json +1 -1
- package/source/modules/smart.3dchart.js +2 -2
- package/source/modules/smart.accordion.js +2 -2
- package/source/modules/smart.array.js +2 -2
- package/source/modules/smart.barcode.js +2 -2
- package/source/modules/smart.breadcrumb.js +2 -2
- package/source/modules/smart.button.js +2 -2
- package/source/modules/smart.buttongroup.js +2 -2
- package/source/modules/smart.calendar.js +2 -2
- package/source/modules/smart.card.js +2 -2
- package/source/modules/smart.cardview.js +2 -2
- package/source/modules/smart.carousel.js +2 -2
- package/source/modules/smart.chart.js +2 -2
- package/source/modules/smart.checkbox.js +2 -2
- package/source/modules/smart.checkinput.js +2 -2
- package/source/modules/smart.chip.js +2 -2
- package/source/modules/smart.colorinput.js +2 -2
- package/source/modules/smart.colorpanel.js +2 -2
- package/source/modules/smart.colorpicker.js +2 -2
- package/source/modules/smart.combobox.js +2 -2
- package/source/modules/smart.common.js +2 -2
- package/source/modules/smart.countryinput.js +2 -2
- package/source/modules/smart.dateinput.js +2 -2
- package/source/modules/smart.daterangeinput.js +2 -2
- package/source/modules/smart.datetimepicker.js +2 -2
- package/source/modules/smart.dockinglayout.js +2 -2
- package/source/modules/smart.dropdownbutton.js +2 -2
- package/source/modules/smart.dropdownlist.js +2 -2
- package/source/modules/smart.editor.js +2 -2
- package/source/modules/smart.element.js +2 -2
- package/source/modules/smart.fileupload.js +2 -2
- package/source/modules/smart.form.js +2 -2
- package/source/modules/smart.formulaparser.js +2 -2
- package/source/modules/smart.ganttchart.js +2 -2
- package/source/modules/smart.gauge.js +2 -2
- package/source/modules/smart.grid.js +6 -6
- package/source/modules/smart.gridpanel.js +2 -2
- package/source/modules/smart.gridview.js +6 -6
- package/source/modules/smart.input.js +2 -2
- package/source/modules/smart.kanban.js +2 -2
- package/source/modules/smart.layout.js +2 -2
- package/source/modules/smart.led.js +2 -2
- package/source/modules/smart.listbox.js +2 -2
- package/source/modules/smart.listmenu.js +2 -2
- package/source/modules/smart.map.js +2 -2
- package/source/modules/smart.maskedtextbox.js +2 -2
- package/source/modules/smart.menu.js +2 -2
- package/source/modules/smart.multicomboinput.js +2 -2
- package/source/modules/smart.multiinput.js +2 -2
- package/source/modules/smart.multilinetextbox.js +2 -2
- package/source/modules/smart.multisplitbutton.js +2 -2
- package/source/modules/smart.numberinput.js +2 -2
- package/source/modules/smart.numerictextbox.js +2 -2
- package/source/modules/smart.pager.js +2 -2
- package/source/modules/smart.passwordinput.js +2 -2
- package/source/modules/smart.passwordtextbox.js +2 -2
- package/source/modules/smart.path.js +2 -2
- package/source/modules/smart.phoneinput.js +2 -2
- package/source/modules/smart.pivottable.js +2 -2
- package/source/modules/smart.progressbar.js +2 -2
- package/source/modules/smart.qrcode.js +2 -2
- package/source/modules/smart.querybuilder.js +2 -2
- package/source/modules/smart.radiobutton.js +2 -2
- package/source/modules/smart.rating.js +2 -2
- package/source/modules/smart.ribbon.js +2 -2
- package/source/modules/smart.router.js +2 -2
- package/source/modules/smart.scheduler.js +2 -2
- package/source/modules/smart.scrollbar.js +2 -2
- package/source/modules/smart.slider.js +2 -2
- package/source/modules/smart.sortable.js +2 -2
- package/source/modules/smart.splitter.js +2 -2
- package/source/modules/smart.switchbutton.js +2 -2
- package/source/modules/smart.table.js +2 -2
- package/source/modules/smart.tabs.js +2 -2
- package/source/modules/smart.tank.js +2 -2
- package/source/modules/smart.textarea.js +2 -2
- package/source/modules/smart.textbox.js +2 -2
- package/source/modules/smart.timeinput.js +2 -2
- package/source/modules/smart.timeline.js +2 -2
- package/source/modules/smart.timepicker.js +2 -2
- package/source/modules/smart.toast.js +2 -2
- package/source/modules/smart.tooltip.js +2 -2
- package/source/modules/smart.tree.js +2 -2
- package/source/modules/smart.validator.js +2 -2
- package/source/modules/smart.window.js +2 -2
- package/source/smart.3dchart.js +1 -1
- package/source/smart.accordion.js +1 -1
- package/source/smart.ajax.js +1 -1
- package/source/smart.array.js +1 -1
- package/source/smart.barcode.js +1 -1
- package/source/smart.bootstrap.js +1 -1
- package/source/smart.breadcrumb.js +1 -1
- package/source/smart.button.js +1 -1
- package/source/smart.buttongroup.js +1 -1
- package/source/smart.calendar.js +1 -1
- package/source/smart.card.js +1 -1
- package/source/smart.cardview.js +1 -1
- package/source/smart.carousel.js +1 -1
- package/source/smart.chart.annotations.js +1 -1
- package/source/smart.chart.api.js +1 -1
- package/source/smart.chart.core.js +1 -1
- package/source/smart.chart.js +1 -1
- package/source/smart.chart.rangeselector.js +1 -1
- package/source/smart.chart.waterfall.js +1 -1
- package/source/smart.checkbox.js +1 -1
- package/source/smart.checkinput.js +1 -1
- package/source/smart.chip.js +1 -1
- package/source/smart.colorinput.js +1 -1
- package/source/smart.colorpanel.js +1 -1
- package/source/smart.colorpicker.js +1 -1
- package/source/smart.combobox.js +1 -1
- package/source/smart.complex.js +1 -1
- package/source/smart.core.js +1 -1
- package/source/smart.countryinput.js +1 -1
- package/source/smart.data.js +1 -1
- package/source/smart.date.js +1 -1
- package/source/smart.dateformatpanel.js +1 -1
- package/source/smart.dateinput.js +1 -1
- package/source/smart.daterangeinput.js +1 -1
- package/source/smart.datetimepicker.js +1 -1
- package/source/smart.dockinglayout.js +1 -1
- package/source/smart.draw.js +1 -1
- package/source/smart.dropdownbutton.js +1 -1
- package/source/smart.dropdownlist.js +1 -1
- package/source/smart.editor.js +1 -1
- package/source/smart.element.js +1 -1
- package/source/smart.elements.js +5 -5
- package/source/smart.export.js +1 -1
- package/source/smart.fileupload.js +1 -1
- package/source/smart.filter.js +1 -1
- package/source/smart.filterbuilder.js +1 -1
- package/source/smart.filterpanel.js +1 -1
- package/source/smart.form.js +1 -1
- package/source/smart.format.js +1 -1
- package/source/smart.formulaparser.js +1 -1
- package/source/smart.ganttchart.js +1 -1
- package/source/smart.gauge.js +1 -1
- package/source/smart.grid.cell.js +2 -2
- package/source/smart.grid.chart.js +1 -1
- package/source/smart.grid.column.js +2 -2
- package/source/smart.grid.core.js +2 -2
- package/source/smart.grid.dialog.js +1 -1
- package/source/smart.grid.edit.js +1 -1
- package/source/smart.grid.export.js +1 -1
- package/source/smart.grid.filter.js +1 -1
- package/source/smart.grid.group.js +1 -1
- package/source/smart.grid.js +1 -1
- package/source/smart.grid.menu.js +1 -1
- package/source/smart.grid.pager.js +1 -1
- package/source/smart.grid.reorder.js +1 -1
- package/source/smart.grid.resize.js +1 -1
- package/source/smart.grid.row.js +1 -1
- package/source/smart.grid.select.js +1 -1
- package/source/smart.grid.sort.js +1 -1
- package/source/smart.grid.toolbar.js +2 -2
- package/source/smart.grid.tree.js +1 -1
- package/source/smart.grid.view.js +1 -1
- package/source/smart.gridpanel.js +1 -1
- package/source/smart.input.js +1 -1
- package/source/smart.kanban.js +1 -1
- package/source/smart.layout.js +1 -1
- package/source/smart.led.js +1 -1
- package/source/smart.listbox.js +1 -1
- package/source/smart.listmenu.js +1 -1
- package/source/smart.map.js +1 -1
- package/source/smart.maskedtextbox.js +1 -1
- package/source/smart.math.js +1 -1
- package/source/smart.menu.js +1 -1
- package/source/smart.multicomboinput.js +1 -1
- package/source/smart.multiinput.js +1 -1
- package/source/smart.multilinetextbox.js +1 -1
- package/source/smart.multisplitbutton.js +1 -1
- package/source/smart.numberformatpanel.js +1 -1
- package/source/smart.numberinput.js +1 -1
- package/source/smart.numeric.js +1 -1
- package/source/smart.numerictextbox.js +1 -1
- package/source/smart.pager.js +1 -1
- package/source/smart.passwordinput.js +1 -1
- package/source/smart.passwordtextbox.js +1 -1
- package/source/smart.path.js +1 -1
- package/source/smart.phoneinput.js +1 -1
- package/source/smart.pivottable.js +1 -1
- package/source/smart.powerbutton.js +1 -1
- package/source/smart.progressbar.js +1 -1
- package/source/smart.qrcode.js +1 -1
- package/source/smart.radiobutton.js +1 -1
- package/source/smart.rating.js +1 -1
- package/source/smart.ribbon.js +1 -1
- package/source/smart.router.js +1 -1
- package/source/smart.scheduler.js +1 -1
- package/source/smart.scrollbar.js +1 -1
- package/source/smart.slider.js +1 -1
- package/source/smart.sortable.js +1 -1
- package/source/smart.sparkline.js +1 -1
- package/source/smart.splitter.js +1 -1
- package/source/smart.switchbutton.js +1 -1
- package/source/smart.table.js +1 -1
- package/source/smart.tabs.js +1 -1
- package/source/smart.tank.js +1 -1
- package/source/smart.textarea.js +1 -1
- package/source/smart.textbox.js +1 -1
- package/source/smart.tickintervalhandler.js +1 -1
- package/source/smart.timeinput.js +1 -1
- package/source/smart.timeline.js +1 -1
- package/source/smart.timepicker.js +1 -1
- package/source/smart.toast.js +1 -1
- package/source/smart.tooltip.js +1 -1
- package/source/smart.tree.js +1 -1
- package/source/smart.validationpanel.js +1 -1
- package/source/smart.validator.js +1 -1
- package/source/smart.window.js +1 -1
- package/source/styles/bootstrap/dark/smart.bootstrap.blue.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.cyan.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.green.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.indigo.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.orange.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.pink.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.purple.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.red.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.teal.css +3373 -3373
- package/source/styles/bootstrap/dark/smart.bootstrap.turquoise.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.blue.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.cyan.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.green.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.indigo.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.orange.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.pink.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.purple.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.red.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.teal.css +3373 -3373
- package/source/styles/bootstrap/light/smart.bootstrap.turquoise.css +3373 -3373
- package/source/styles/bootstrap/smart.bootstrap.blue.css +234 -215
- package/source/styles/bootstrap/smart.bootstrap.css +277 -286
- package/source/styles/bootstrap/smart.bootstrap.cyan.css +234 -215
- package/source/styles/bootstrap/smart.bootstrap.green.css +234 -215
- package/source/styles/bootstrap/smart.bootstrap.indigo.css +234 -215
- package/source/styles/bootstrap/smart.bootstrap.orange.css +234 -215
- package/source/styles/bootstrap/smart.bootstrap.pink.css +237 -215
- package/source/styles/bootstrap/smart.bootstrap.purple.css +237 -215
- package/source/styles/bootstrap/smart.bootstrap.red.css +234 -215
- package/source/styles/bootstrap/smart.bootstrap.teal.css +234 -215
- package/source/styles/bootstrap/smart.bootstrap.turquoise.css +234 -215
- package/source/styles/components/smart.datetimeformatpanel.css +1 -1
- package/source/styles/components/smart.dropdownbutton.css +1 -1
- package/source/styles/components/smart.grid.css +1 -1
- package/source/styles/components/smart.ribbon.css +1 -1
- package/source/styles/default/scss/smart.dropdownbutton.scss +21 -20
- package/source/styles/default/scss/smart.grid.scss +190 -115
- package/source/styles/default/smart.dropdownbutton.css +5 -3
- package/source/styles/default/smart.grid.css +34 -15
- package/source/styles/smart.default.css +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI v25.0.
|
|
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
|
|
|
6
|
-
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()}});
|
|
6
|
+
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()}});
|