smart-webcomponents-react 15.2.3 → 15.2.10
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/index.d.ts +1 -2
- package/package.json +1 -1
- package/source/modules/smart.3dchart.js +3 -3
- package/source/modules/smart.accordion.js +2 -2
- package/source/modules/smart.array.js +3 -3
- 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 +5 -5
- package/source/modules/smart.carousel.js +2 -2
- package/source/modules/smart.chart.js +3 -3
- 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 +3 -3
- package/source/modules/smart.colorpicker.js +3 -3
- package/source/modules/smart.combobox.js +3 -3
- package/source/modules/smart.common.js +3 -3
- package/source/modules/smart.countryinput.js +2 -2
- package/source/modules/smart.dateinput.js +3 -3
- package/source/modules/smart.daterangeinput.js +4 -4
- package/source/modules/smart.datetimepicker.js +3 -3
- package/source/modules/smart.dockinglayout.js +4 -4
- package/source/modules/smart.dropdownbutton.js +2 -2
- package/source/modules/smart.dropdownlist.js +3 -3
- package/source/modules/smart.editor.js +4 -4
- package/source/modules/smart.element.js +2 -2
- package/source/modules/smart.fileupload.js +3 -3
- package/source/modules/smart.form.js +3 -3
- package/source/modules/smart.formulaparser.js +2 -2
- package/source/modules/smart.ganttchart.js +7 -7
- package/source/modules/smart.gauge.js +2 -2
- package/source/modules/smart.grid.js +16 -16
- package/source/modules/smart.gridpanel.js +4 -4
- package/source/modules/smart.input.js +2 -2
- package/source/modules/smart.kanban.js +6 -6
- 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 +3 -3
- package/source/modules/smart.multisplitbutton.js +3 -3
- package/source/modules/smart.numberinput.js +3 -3
- package/source/modules/smart.numerictextbox.js +3 -3
- package/source/modules/smart.pager.js +3 -3
- 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 +6 -6
- package/source/modules/smart.progressbar.js +2 -2
- package/source/modules/smart.qrcode.js +2 -2
- package/source/modules/smart.querybuilder.js +3 -3
- package/source/modules/smart.radiobutton.js +2 -2
- package/source/modules/smart.rating.js +2 -2
- package/source/modules/smart.router.js +3 -3
- package/source/modules/smart.scheduler.js +6 -6
- 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 +6 -6
- package/source/modules/smart.tabs.js +3 -3
- package/source/modules/smart.tank.js +2 -2
- package/source/modules/smart.textarea.js +2 -2
- package/source/modules/smart.textbox.js +3 -3
- package/source/modules/smart.timeinput.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 +4 -4
- 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 +2 -2
- package/source/smart.date.js +1 -1
- package/source/smart.dateformatpanel.js +1 -1
- package/source/smart.dateinput.js +2 -2
- 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 +2 -2
- package/source/smart.editor.js +1 -1
- package/source/smart.element.js +2 -2
- package/source/smart.elements.js +18 -18
- 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 +1 -1
- package/source/smart.grid.core.js +2 -2
- package/source/smart.grid.dialog.js +2 -2
- package/source/smart.grid.edit.js +2 -2
- 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 +2 -2
- package/source/smart.grid.pager.js +2 -2
- package/source/smart.grid.reorder.js +1 -1
- package/source/smart.grid.resize.js +1 -1
- package/source/smart.grid.row.js +2 -2
- 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 +2 -2
- package/source/smart.gridpanel.js +1 -1
- package/source/smart.input.js +1 -1
- package/source/smart.kanban.js +2 -2
- 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 +2 -2
- package/source/smart.numeric.js +1 -1
- package/source/smart.numerictextbox.js +1 -1
- package/source/smart.pager.js +2 -2
- 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.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.splitter.js +1 -1
- package/source/smart.switchbutton.js +1 -1
- package/source/smart.table.js +1 -1
- package/source/smart.tabs.js +2 -2
- 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.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 +2 -2
- package/source/typescript/smart.elements.d.ts +1 -2
- package/source/typescript/smart.table.d.ts +1 -2
- package/table/table.d.ts +2 -3
- package/table/table.esm.js +9 -4
- package/table/table.umd.js +9 -4
- package/source/modules/smart.ribbon.js +0 -286
- package/source/smart.ribbon.js +0 -6
- package/source/styles/components/smart.ribbon.css +0 -13
- package/source/styles/default/smart.ribbon.css +0 -235
|
@@ -52,7 +52,7 @@ Smart.Utilities.Assign("Complex",class{constructor(r,a){if("string"==typeof r)th
|
|
|
52
52
|
/***/ 6057:
|
|
53
53
|
/***/ (() => {
|
|
54
54
|
|
|
55
|
-
(()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};"string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0?(t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0?(t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0?(t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0?(t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType)?(t._bindToICS(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType)?(t._bindToXML(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType)?(t._bindToCSV(),a()):"array"===t.dataSourceType?(t._bindToArray(),a()):"json"===t.dataSourceType&&(t._bindToJSON(),a())}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={},l=i[t].split(a);for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{switch(t.condition){case"EQUAL":return e+" = "+t.value;case"NOT_EQUAL":return e+" != "+t.value;case"GREATER_THAN":return e+" > "+t.value;case"GREATER_THAN_OR_EQUAL":return e+" >= "+t.value;case"LESS_THAN":return e+" < "+t.value;case"LESS_THAN_OR_EQUAL":return e+" <= "+t.value;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+t.value+" and "+e+" <= "+t.valueTo+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1===o.logicalOperators[t]&&(s=" OR ")}r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=Object.assign({},e.boundSource[n]);if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let f=new Array;for(let t=0;t<e.length;t++)f[t]=u();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const h=new Array,p=new Array;let g=0;const S=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};let y=!1;for(let n=0;n<d.length;n++){let m=Object.assign({},S(d[n]));m[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=m[a];null!=n?((""===n||void 0===n&&0===t)&&(y=!0),T[b++]={value:n,group:a,hash:f[t]}):(T[b++]={value:null,group:a,hash:f[t]},0===t&&(y=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===p[v]||null===p[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=m,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==m[c.expanded]?x[c.expanded]=m[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=m[i]),x[t]=new Array;let e=h.length+l;this.id&&"number"!=typeof m.$.id&&!isFinite(m.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),h[g++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=m,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==m[c.expanded]?e[c.expanded]=m[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=m[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}p[v]=x}else x=p[v]}m&&(m[c.leaf]=!0),null!==x?(null===this.id?void 0===m.$.id&&(m.$.id=x.$.id+"_"+x[t].length):void 0===m.$.id&&-1===m.$.id.toString().indexOf(x.$.id)&&(m.$.id=x.$.id+"_"+m.$.id),m[o]=x,m[c.level]=x[c.level]+1,x[t][x[t].length]=m):void 0===m.$.id&&(m.$.id=u())}if(y){let e=null,t=!1;for(let a=0;a<h.length;a++){const n=h[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),h.splice(a,1);break}}if(e&&(h.push(e),t))for(let e=0;e<h.length;e++){const t=h[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return h}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType)if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0);else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];""!==t&&" "!==t&&i.push(t.trim())}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy)throw new Error("sort: Missing or Invalid arguments!");"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
|
|
55
|
+
(()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};"string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0?(t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0?(t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0?(t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0?(t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType)?(t._bindToICS(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType)?(t._bindToXML(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType)?(t._bindToCSV(),a()):"array"===t.dataSourceType?(t._bindToArray(),a()):"json"===t.dataSourceType&&(t._bindToJSON(),a())}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{switch(t.condition){case"EQUAL":return e+" = "+t.value;case"NOT_EQUAL":return e+" != "+t.value;case"GREATER_THAN":return e+" > "+t.value;case"GREATER_THAN_OR_EQUAL":return e+" >= "+t.value;case"LESS_THAN":return e+" < "+t.value;case"LESS_THAN_OR_EQUAL":return e+" <= "+t.value;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+t.value+" and "+e+" <= "+t.valueTo+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1===o.logicalOperators[t]&&(s=" OR ")}r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let f=new Array;for(let t=0;t<e.length;t++)f[t]=u();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const h=new Array,p=new Array;let g=0;const S=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};let y=!1;for(let n=0;n<d.length;n++){let m=Object.assign({},S(d[n]));m[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=m[a];null!=n?((""===n||void 0===n&&0===t)&&(y=!0),T[b++]={value:n,group:a,hash:f[t]}):(T[b++]={value:null,group:a,hash:f[t]},0===t&&(y=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===p[v]||null===p[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=m,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==m[c.expanded]?x[c.expanded]=m[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=m[i]),x[t]=new Array;let e=h.length+l;this.id&&"number"!=typeof m.$.id&&!isFinite(m.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),h[g++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=m,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==m[c.expanded]?e[c.expanded]=m[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=m[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}p[v]=x}else x=p[v]}m&&(m[c.leaf]=!0),null!==x?(null===this.id?void 0===m.$.id&&(m.$.id=x.$.id+"_"+x[t].length):void 0===m.$.id&&-1===m.$.id.toString().indexOf(x.$.id)&&(m.$.id=x.$.id+"_"+m.$.id),m[o]=x,m[c.level]=x[c.level]+1,x[t][x[t].length]=m):void 0===m.$.id&&(m.$.id=u())}if(y){let e=null,t=!1;for(let a=0;a<h.length;a++){const n=h[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),h.splice(a,1);break}}if(e&&(h.push(e),t))for(let e=0;e<h.length;e++){const t=h[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return h}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType)if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0);else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];""!==t&&" "!==t&&i.push(t.trim())}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
|
|
56
56
|
|
|
57
57
|
/***/ }),
|
|
58
58
|
|
|
@@ -80,14 +80,14 @@ Smart.Utilities.Assign("Draw",class{constructor(t,e){const i=this;i.host=t,i.ren
|
|
|
80
80
|
/***/ 7650:
|
|
81
81
|
/***/ (() => {
|
|
82
82
|
|
|
83
|
-
Smart("smart-drop-down-list",class extends Smart.ContentElement{static get properties(){return{autoCloseDelay:{value:100,type:"number"},dataSource:{value:null,type:"any",reflectToAttribute:!1},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownButtonPosition:{allowedValues:["none","left","right","top","bottom"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownMinHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownOpenMode:{allowedValues:["none","default","dropDownButton","auto"],value:"default",type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPlaceholder:{value:"No Items",type:"string"},dropDownPosition:{allowedValues:["auto","top","bottom","overlay-top","overlay-center","overlay-bottom","center-bottom","center-top"],value:"auto",type:"string"},dropDownMinWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxWidth:{value:"",type:"any",validator:"_propertyValidator"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterCallback:{value:null,type:"function?"},filterMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},hint:{value:"",type:"string"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},inputMember:{value:"label",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},label:{value:"",type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{invalidNode:'{{elementType}}: Invalid parameter "{{node}}" when calling {{method}}.'}},type:"object"},name:{value:"",type:"string"},opened:{value:!1,type:"boolean"},placeholder:{value:"",type:"string"},resizeMode:{value:"none",allowedValues:["none","horizontal","vertical","both"],type:"string"},resizeIndicator:{value:!1,type:"boolean"},selectionDisplayMode:{value:"plain",allowedValues:["plain","placeholder","tokens"],type:"string"},selectionMode:{value:"zeroAndOne",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},tokenTemplate:{value:null,type:"any"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]}}}static get listeners(){return{"actionButton.down":"_buttonsDownHandler","actionButton.mouseenter":"_buttonsMouseEventsHandler","actionButton.mouseleave":"_buttonsMouseEventsHandler","actionButton.focus":"_buttonsFocusHandler","actionButton.blur":"_buttonsFocusHandler","document.selectstart":"_selectStartHandler","document.dragstart":"_dragStartHandler","document.down":"_documentDownHandler","document.up":"_documentUpHandler","document.move":"_documentMoveHandler","dropDownButton.down":"_buttonsDownHandler","dropDownButton.mouseenter":"_buttonsMouseEventsHandler","dropDownButton.mouseleave":"_buttonsMouseEventsHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",focus:"_focusEventHandler",blur:"_blurEventHandler","dropDownButton.focus":"_buttonsFocusHandler","dropDownButton.blur":"_buttonsFocusHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","listBox.change":"_listBoxChangeHandler","listBox.itemClick":"_listBoxItemClickHandler","listBox.keydown":"_listBoxKeyDownHandler","listBox.bindingComplete":"_bindingCompleteHandler",mouseenter:"_mouseEnterHandler",mouseleave:"_mouseLeaveHandler",resize:"_resizeHandler","resizeBar.move":"_resizeBarMoveHandler",styleChanged:"_styleChangedHandler",wheel:"_mouseWheelHandler"}}template(){return'<div id="container" role="presentation">\n <span class="smart-label" id="label">[[label]]</span>\n <div id="content" class="smart-content" role="presentation">\n <div class="smart-buttons-container" id="buttonsContainer" role="presentation">\n <span id="actionButton" class ="smart-action-button" role="presentation">[[placeholder]]</span>\n <span id="dropDownButton" class="smart-drop-down-button">\n <span class ="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n <div id="dropDownContainer" class="smart-drop-down smart-drop-down-container smart-visibility-hidden" role="presentation">\n <smart-list-box id="listBox" unfocusable\n animation="[[animation]]"\n data-source="[[dataSource]]"\n disabled="[[disabled]]"\n display-loading-indicator="[[displayLoadingIndicator]]"\n display-member="[[displayMember]]"\n filterable="[[filterable]]"\n filter-callback="[[filterCallback]]"\n filter-mode="[[filterMode]]"\n filter-input-placeholder="[[filterInputPlaceholder]]"\n grouped="[[grouped]]"\n group-member="[[groupMember]]"\n item-height="[[itemHeight]]"\n item-measure-mode="[[itemMeasureMode]]"\n item-template="[[itemTemplate]]"\n incremental-search-delay="[[incrementalSearchDelay]]"\n incremental-search-mode="[[incrementalSearchMode]]"\n loading-indicator-placeholder="[[loadingIndicatorPlaceholder]]"\n loading-indicator-position="[[loadingIndicatorPosition]]"\n name="[[name]]"\n placeholder="[[dropDownPlaceholder]]"\n right-to-left="[[rightToLeft]]"\n readonly="[[readonly]]"\n selected-indexes="{{selectedIndexes}}"\n selection-mode="[[selectionMode]]"\n selected-values="{{selectedValues}}"\n sorted="[[sorted]]"\n sort-direction="[[sortDirection]]"\n theme="[[theme]]"\n value-member="[[valueMember]]"\n horizontal-scroll-bar-visibility="[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility="[[verticalScrollBarVisibility]]"\n virtualized="[[virtualized]]">\n <content></content>\n </smart-list-box>\n <div id="resizeBar" class="smart-drop-down-resize-bar" aria-label="Resize">\n <div></div>\n </div>\n </div>\n </div>\n <span class="smart-hint smart-hidden" id="hint">[[hint]]</span>\n </div>'}static get styleUrls(){return["smart.dropdownlist.css","smart.dropdown.css"]}propertyChangedHandler(e,t,o){super.propertyChangedHandler(e,t,o);const n=this;switch(e){case"animation":n.$.dropDownContainer.setAttribute("animation",n.animation);break;case"disabled":n._setFocusable(),n.close(),n._positionDetection.handleAutoPositioning();break;case"dataSource":case"displayMember":case"inputMember":n.$.actionButton&&(n.$.actionButton.innerHTML=n.placeholder),n._setDropDownSize(),n._positionDetection.checkBrowserBounds("vertically"),n._positionDetection.positionDropDown(),n._positionDetection.checkBrowserBounds("horizontally");break;case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownOpenMode":n._setFocusable(),n.$dropDownContainer.addClass("smart-visibility-hidden"),n.$.dropDownContainer.setAttribute("drop-down-open-mode",o),n.$.dropDownButton.removeAttribute("selected"),n.removeAttribute("drop-down-button-focus"),n.removeAttribute("action-button-focus"),n.opened=!1,n._ariaButton&&n._ariaButton.setAttribute("aria-expanded",!1),n._setAriaRelations();break;case"dropDownOverlay":o||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"dropDownMinWidth":case"dropDownWidth":case"dropDownMaxWidth":case"dropDownHeight":case"dropDownMinHeight":case"dropDownMaxHeight":n._setDropDownSize();break;case"filterable":n.$.listBox.filterable=o,n._dropDownSize&&"auto"===n._dropDownSize.height&&n._setDropDownSize();break;case"label":if(!n._ariaButton)return;o?n._ariaButton.setAttribute("aria-labelledby",n.$.label.id):"DropDownList"===n.elementName&&n._ariaButton.setAttribute("aria-labelledby",n.$.actionButton.id);break;case"opened":if(n.disabled||n.readonly)return;o?n.open():n.close();break;case"placeholder":n._applySelection();break;case"readonly":n.close();break;case"resizeIndicator":o?n.$.dropDownContainer.setAttribute("resize-indicator",""):n.$.dropDownContainer.removeAttribute("resize-indicator");break;case"resizeMode":n.$.dropDownContainer.setAttribute("resize-mode",n.resizeMode);break;case"selectedValues":case"selectedIndexes":0===o.length?n.$.actionButton.innerHTML=n.placeholder:n._applySelection();break;case"selectionMode":n.$.listBox&&(n.$.listBox[e]=o,"checkBox"!==o&&"radioButton"!==o&&"checkBox"!==t&&"radioButton"!==t||n._setDropDownSize());break;case"selectionDisplayMode":n._applySelection();break;case"tokenTemplate":n._tokenTemplate=n._validateTemplate(n.tokenTemplate),n._applySelection();break;case"unfocusable":n._setFocusable()}}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const o=e.dataset.property,n=e.value;o&&void 0!==t[o]&&(t[o]=n)}}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(t.$.listBox.appendChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}attached(){const e=this;super.attached(),e.isCompleted&&e.$.dropDownContainer&&(e._positionDetection.dropDownAttached("_setDropDownSize"),e._positionDetection.checkBrowserBounds(),e.selectedIndexes&&e._applySelection())}detached(){const e=this;super.detached(),e.$.dropDownContainer&&(e.close(),e._positionDetection&&e._positionDetection.dropDownDetached())}clearItems(){const e=this;e.$.listBox&&(e.$.listBox.clearItems(),e.$.actionButton.innerHTML=e.placeholder)}clearSelection(){const e=this;e.$.listBox&&(e.$.listBox.clearSelection(),e.$.actionButton.innerHTML=e.placeholder)}close(){const e=this;e.$dropDownContainer.hasClass("smart-visibility-hidden")||e.$.fireEvent("closing").defaultPrevented||(e.$dropDownContainer.addClass("smart-visibility-hidden"),e.$.fireEvent("close"),e.$.dropDownButton&&e.$.dropDownButton.removeAttribute("selected"),e.opened=!1,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!1),e._preventDropDownClose=!1,e._positionDetection.removeOverlay(!0),e.$.listBox.removeAttribute("focus"),e._edgeMacFF&&!e.hasAnimation&&e.$.dropDownContainer&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view")))}cloneNode(){const e=this;if(!e.$.listBox)return;let t=HTMLElement.prototype.cloneNode.apply(e,Array.prototype.slice.call(arguments,0,1));return t.dataSource=e.dataSource,t}ensureVisible(e){this.$.listBox&&this.$.listBox.ensureVisible(e)}getItem(e){if(this.$.listBox)return this.$.listBox.getItem(e)}get items(){const e=this;return e.$&&e.$.listBox?e.$.listBox.items:[]}get _focusedItem(){const e=this;return e.$&&e.$.listBox?e.$.listBox._focusedItem:null}insert(e,t){const o=this;o.$.listBox&&(o.$.listBox.insert(e,t),o._applySelection(),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize())}insertBefore(e,t){const o=this;if(!o.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(o,e.concat(Array.prototype.slice.call(arguments)))}e&&t?o.$.listBox&&(o.$.listBox.insertBefore(e,t),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize()):o.error(o.localize("invalidNode",{elementType:o.nodeName.toLowerCase(),method:"insertBefore",node:"newNode/referenceNode"}))}toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this,t=function(){for(let t=0;t<e.items.length;t++)if(!e.items[t].disabled)return e.items[t]};if(!e.disabled&&e.offsetHeight&&e.$dropDownContainer.hasClass("smart-visibility-hidden")){if(e.$dropDownContainer.hasClass("not-in-view")&&e.$dropDownContainer.removeClass("not-in-view"),e.$.dropDownContainer.style.transition=null,e.dropDownAppendTo){const t=e.getBoundingClientRect();if(e.$.container.contains(e.$.dropDownContainer)){let t=0;const o=setInterval((function(){const n=e.getBoundingClientRect();t++,n.top===e._positionTop&&t<10||(e.open(),clearInterval(o),e._positionTop=n.top)}),100);return}t.top!==e._positionTop&&(e._positionTop=t.top)}e.$.fireEvent("opening").defaultPrevented||(e._shadowDOMStylesDelay&&(e._setDropDownSize(),delete e._shadowDOMStylesDelay),e.opened=!0,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!0),e.$.listBox.setAttribute("focus",""),e._positionDetection.placeOverlay(),e._positionDetection.checkBrowserBounds("vertically"),e._positionDetection.positionDropDown(),e._positionDetection.checkBrowserBounds("horizontally"),e.$dropDownContainer.removeClass("smart-visibility-hidden"),e.$.fireEvent("open"),e.$.dropDownButton&&("dropDownButton"===e.dropDownOpenMode?e.$.dropDownButton.setAttribute("selected",""):e.$.dropDownButton.removeAttribute("selected")),(e.$.listBox&&!e._focusedItem||e._focusedItem&&!e._focusedItem._focused)&&(e.selectedIndexes.length>0?e._focus(e.items[e.selectedIndexes[0]]):e._focus(t)),e.$.input&&!Smart.Utilities.Core.isMobile&&e.$.input.focus())}}ready(){super.ready()}render(){const e=this;e.rightToLeft&&(e.dropDownButtonPosition="right"===e.dropDownButtonPosition?"left":"right"),e.classList.add("smart-drop-down-box"),e.$.dropDownContainer&&(e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.container,"close"),e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e._calculateDropDownSize(),e.$.dropDownContainer.setAttribute("resize-mode",e.resizeMode),e.$.dropDownContainer.setAttribute("drop-down-open-mode",e.dropDownOpenMode),e.resizeIndicator&&e.$.dropDownContainer.setAttribute("resize-indicator",""),e._positionDetection.handleAutoPositioning()),e.opened&&e.open(),e._positionTop=e.getBoundingClientRect().top,e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._edgeMacFF&&e.hasAnimation&&e.$.dropDownContainer&&e.$dropDownContainer.addClass("not-in-view"),e.$.label&&!e.$.label.id&&(e.$.label.id=e.id+"Label"),e.$.actionButton&&!e.$.actionButton.id&&(e.$.actionButton.id=e.id+"ActionButton"),e.$.hint&&!e.$.hint.id&&(e.$.hint.id=e.id+"Hint"),e._createElement(),super.render()}removeAt(e){const t=this;t.$.listBox&&(t.$.listBox.removeAt(e),t._applySelection(),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize())}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e&&e instanceof Smart.ListItem?(t.$.listBox.removeChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}get value(){const e=this;return e.isRendered&&e.$.listBox?e.$.listBox.value:null}set value(e){const t=this;return t.isRendered&&t.$.listBox?void(t.$.listBox.value=e):null}select(e){this.$.listBox&&this.$.listBox.select(e)}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.removeAttribute("tabindex"),e.$.actionButton.removeAttribute("tabindex"),void e.$.dropDownButton.removeAttribute("tabindex");let t=e.tabIndex>0?e.tabIndex:0;e.tabIndex=t,"dropDownButton"===e.dropDownOpenMode?(e.removeAttribute("tabindex"),e.$.actionButton.setAttribute("tabindex",t),e.$.dropDownButton.setAttribute("tabindex",t)):(e.$.actionButton.removeAttribute("tabindex"),e.$.dropDownButton.removeAttribute("tabindex"))}static get requires(){return{"Smart.ListBox":"smart.listbox.js"}}unselect(e){this.$.listBox&&this.$.listBox.unselect(e)}update(e,t){const o=this;o.$.listBox&&(o.$.listBox.update(e,t),o._applySelection())}_resizeBarMoveHandler(e){"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_createToken(){const e=this;let t,o=!1;const n=document.createDocumentFragment(),i=e.selectedIndexes[e.selectedIndexes.length-1];"plain"!==e.selectionDisplayMode||"one"!==e.selectionMode&&"zeroAndOne"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode&&"radioButton"!==e.selectionMode?"tokens"===e.selectionDisplayMode?1===e.selectedIndexes.length&&["oneOrManyExtended","oneOrMany","zeroAndOne","one","radioButton"].indexOf(e.selectionMode)>-1?t="":(t="✖",o=!0):t=1===e.selectedIndexes.length?"":",":t="";const r=e.selectedIndexes,a=e.$.listBox._items;for(let s=0;s<r.length;s++){const l=r[s];a[l]&&n.appendChild(e._applyTokenTemplate(a[l][e.inputMember],"tokens"!==e.selectionDisplayMode&&l===i?"":t,o))}return n}_applySelection(){const e=this;if("placeholder"!==e.selectionDisplayMode&&0!==e.selectedIndexes.length){if(e.$.listBox._items&&0!==e.$.listBox._items.length)if("plain"!==e.selectionDisplayMode)e.$.actionButton.innerHTML="",e.$.actionButton.appendChild(e._createToken());else{const t=e.$.listBox.selectedIndexes,o=e.$.listBox._items;let n=[];for(let i=0;i<t.length;i++){const r=t[i];o[r]&&n.push(o[r][e.inputMember])}e.$.actionButton.innerHTML=n.length?`<span class="smart-token">${n.join(", ").trim()}</span>`:""}}else e.$.actionButton.innerHTML=e.placeholder}_applyTokenTemplate(e,t,o){const n=this,i=document.createElement("span"),r=function(){return"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+e+`</span><span class='smart-drop-down-list-unselect-button' role="button"${o?' aria-label="Unselect"':""}>${t}</span>`};if(i.classList.add("smart-token"),n._tokenTemplate){let e=document.importNode(n._tokenTemplate.content,!0);const t=e.childNodes.length,o=/{{\w+}}/g;let a;for(let n=0;n<t;n++)a=o.exec(e.childNodes[n].innerHTML),a&&(e.childNodes[n].innerHTML=e.childNodes[n].innerHTML.replace(a[0],r())),e.childNodes[n].outerHTML&&(i.innerHTML+=e.childNodes[n].outerHTML)}else"function"==typeof n.tokenTemplate?n.tokenTemplate(i,{label:e,iconSeparator:t}):i.innerHTML=r();return i}_bindingCompleteHandler(){const e=this;e.$.listBox&&requestAnimationFrame((()=>{e._setDropDownSize(),e._positionDetection.checkBrowserBounds()}))}_buttonsDownHandler(e){const t=this;if(!t.disabled){if(t.hasRippleAnimation)if(t.$.buttonsContainer&&"dropDownButton"!==t.dropDownOpenMode){const o=t.$.buttonsContainer;o.firstElementChild.noRipple=!0,Smart.Utilities.Animation.Ripple.animate(o,e.pageX,e.pageY),o.firstElementChild.noRipple=!1}else Smart.Utilities.Animation.Ripple.animate(e.target,e.pageX,e.pageY);t._preventsSelectStart=!0,t.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.actionButton&&t.$.actionButton.setAttribute("active",""),t.opened&&(t._preventDropDownClose=!0)}}_buttonsMouseEventsHandler(e){const t=this;t.disabled||("mouseenter"===e.type?(t.setAttribute("hover",""),e.target.setAttribute("hover",""),"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.dropDownButton&&t.setAttribute("drop-down-button-hover","")):(t.removeAttribute("hover"),t.removeAttribute("drop-down-button-hover"),e.target.removeAttribute("hover")))}_calculateDropDownSize(){const e=this;e._dropDownSize={};const t=window.getComputedStyle(e.$.dropDownContainer),o=parseFloat(t.getPropertyValue("border-top-width").trim()),n=parseFloat(t.getPropertyValue("border-bottom-width").trim()),i=parseFloat(t.getPropertyValue("margin-top").trim()),r=parseFloat(t.getPropertyValue("margin-bottom").trim()),a=parseFloat(t.getPropertyValue("padding-top").trim()),s=parseFloat(t.getPropertyValue("padding-bottom").trim());Smart.Utilities.Core.CSSVariablesSupport()&&(e._dropDownSize.width=t.getPropertyValue("--smart-drop-down-list-drop-down-width").trim(),e._dropDownSize.height=t.getPropertyValue("--smart-drop-down-list-drop-down-height").trim()),(!e._dropDownSize.width||e._dropDownSize.width.indexOf("initial")>-1)&&(e._dropDownSize.width=e.offsetWidth),e._dropDownSize.height||(e._dropDownSize.height="auto"),e._dropDownSize.minHeight=parseFloat(t.getPropertyValue("min-height").trim()),e._dropDownSize.maxHeight=parseFloat(t.getPropertyValue("max-height").trim()),e._dropDownSize.borderWidth=(isNaN(o)?0:o)+(isNaN(n)?0:n),e._dropDownSize.paddingWidth=(isNaN(a)?0:a)+(isNaN(s)?0:s),e._dropDownSize.marginWidth=(isNaN(i)?0:i)+(isNaN(r)?0:r)}_createElement(){const e=this;e._tokenTemplate=e._validateTemplate(e.tokenTemplate),e._applySelection(),e._setDropDownSize(),e._setFocusable(),e.$.arrow.noRipple=!0,e._shadowDOMStylesDelay=e.shadowRoot,e._setAriaRelations(!0)}_documentDownHandler(e){const t=this;if(t.disabled||t.readonly)return;let o=e.originalEvent.target;if(o===t._overlay&&(t._overlayDown=!0),t.shadowRoot){o=e.originalEvent.composedPath()[0];let n=o.getRootNode().host;for(;n;)n.closest(".smart-drop-down-container")===t.$.dropDownContainer&&(t._isDropDownClicked=!0),n=n.getRootNode().host}else t.isInShadowDOM&&(o=e.originalEvent.composedPath()[0]),t._isDropDownClicked=o.closest(".smart-drop-down-container")===t.$.dropDownContainer;if(t._buttonClicked=o.closest(".smart-action-button")||o.closest(".smart-drop-down-button"),t.$.listBox){let n=o.closest("smart-list-item");t.$.listBox.contains(n)||(n=void 0),t.hasRippleAnimation&&n&&Smart.Utilities.Animation.Ripple.animate(n,e.pageX,e.pageY),(n||o===t.$.listBox.$.filterInput||o.closest(".smart-token"))&&(t._preventDropDownClose=!0)}if(t._isDropDownClicked&&(t._preventDropDownClose=!0),o!==t.$.resizeBar||"none"===t.resizeMode)return;t._resizeDetails||(t._resizeDetails={});const n=t.$.dropDownContainer.getBoundingClientRect();t._resizeDetails.started=!0,t._resizeDetails.x=e.pageX,t._resizeDetails.y=e.pageY,t._resizeDetails.width=t.$.dropDownContainer.offsetWidth,t._resizeDetails.height=t.$.dropDownContainer.offsetHeight,t._resizeDetails.offsetXL=e.clientX-n.left,t._resizeDetails.offsetXR=n.left+t.$.dropDownContainer.offsetWidth-e.clientX,t._resizeDetails.offsetY=n.top+t.$.dropDownContainer.offsetHeight-e.clientY,t._resizeDetails.offsetYtop=e.clientY-n.top,t._preventDropDownClose=!0}_documentMoveHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if("auto"===t.dropDownOpenMode&&null!==t.dropDownAppendTo&&(t.contains(o)||t.$.dropDownContainer.contains(o)?t._isElementHovered=!0:(t._isElementHovered=!1,t._autoClose())),!t._resizeDetails||t._resizeDetails&&!t._resizeDetails.started)return;t.setAttribute("resizing",""),t._resizeDetails.resizeEventFired||(t.$.fireEvent("resizeStart",{position:{left:e.pageX,top:e.pageY}}),t._resizeDetails.resizeEventFired=!0);const n=document.documentElement,i=t.$.dropDownContainer.getBoundingClientRect(),r=t.getBoundingClientRect(),a=t.$.dropDownContainer.hasAttribute("top")?"top":"bottom";let s;function l(){if(s=e.pageY-t._resizeDetails.y,"bottom"===a)t._resizeDetails.height=Math.min(n.clientHeight-i.top-6,Math.max(0,t._resizeDetails.height+s)),t._resizeDetails.y=Math.max(i.top+n.scrollTop-t._resizeDetails.offsetY,Math.min(n.clientHeight+n.scrollTop-1.5*t._resizeDetails.offsetY,e.pageY));else{if(t._resizeDetails.height=Math.min(t._dropDownSize.maxHeight,Math.max(0,Math.min(r.top,t._resizeDetails.height-s))),s=Math.max(0,i.top+(i.height-Math.max(t._dropDownSize.minHeight,t._resizeDetails.height))),t.dropDownAppendTo){const e=Math.abs(parseFloat(getComputedStyle(t.$.dropDownContainer).getPropertyValue("margin-bottom")))||0;t.$.dropDownContainer.style.top=t.dropDownAppendTo?e+s+"px":""}const o=r.top+n.scrollTop+t._resizeDetails.offsetYtop;t._resizeDetails.y=Math.max(t._resizeDetails.offsetYtop,Math.min(o,Math.max(o-t._dropDownSize.maxHeight,e.pageY)))}t.$.dropDownContainer.style.height=t._resizeDetails.height+"px"}function d(){s=e.pageX-t._resizeDetails.x,t._resizeDetails.width=Math.min(n.clientWidth-i.left-6,Math.max(0,t._resizeDetails.width+s)),t.$.dropDownContainer.style.width=t._resizeDetails.width+"px",t._resizeDetails.x=Math.max(i.left+n.scrollLeft-t._resizeDetails.offsetXR,Math.min(n.clientWidth+n.scrollLeft-1.5*t._resizeDetails.offsetXR,e.pageX))}switch(t.resizeMode){case"vertical":l();break;case"horizontal":d();break;case"both":d(),l()}}_documentUpHandler(e){const t=this;if(t.$.actionButton.removeAttribute("active"),t._resizeDetails&&t._resizeDetails.started)return t._resizeDetails.started=t._resizeDetails.resizeEventFired=!1,t.removeAttribute("resizing"),t._preventDropDownClose=!1,t.focus(),void t.$.fireEvent("resizeEnd",{position:{left:e.pageX,top:e.pageY}});if(t.disabled||t._isDropDownClicked||t.readonly)return void delete t._isDropDownClicked;if(t._overlayDown)return t.close(),void delete t._overlayDown;let o=e.originalEvent.target,n=o.closest?o.closest("smart-drop-down-list"):void 0;if((t.enableShadowDOM||t.isInShadowDOM)&&(o=e.originalEvent.composedPath()[0],n=o.getRootNode().host),t._preventsSelectStart=!1,void 0===o||o===t.$.resizeBar)return;if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-selection-label")&&n===t){"none"!==t.dropDownOpenMode&&t.open();let e=t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.textContent))[0];return t.$.listBox._scrollView.scrollTop=e.offsetTop,void t._focus(e)}if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-unselect-button")&&n===t){if(1===t.selectedIndexes.length&&["zeroOrMany","zeroOrOne","checkBox"].indexOf(t.selectionMode)<0)return;return void t.unselect(t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.previousElementSibling.textContent))[0])}const i=o.closest(".smart-action-button");let r;if(t._buttonClicked&&("dropDownButton"===t.dropDownOpenMode&&i&&t._buttonClicked===t.$.actionButton?t.$.fireEvent("actionButtonClick"):o.closest(".smart-drop-down-button")!==t._buttonClicked&&i!==t._buttonClicked||(r=!0,t.$.fireEvent("dropDownButtonClick"))),t._buttonClicked=void 0,i===t.$.actionButton||o.closest(".smart-drop-down-button")===t.$.dropDownButton)return"dropDownButton"===t.dropDownOpenMode&&i===t.$.actionButton?void t.close():void(t.$dropDownContainer.hasClass("smart-visibility-hidden")&&"none"!==t.dropDownOpenMode&&r&&"pointercancel"!==e.originalEvent.type?t.open():t.close());o=t._getUpEventTarget(o),void 0!==o&&("dropDownContainer"!==o&&"item"!==o||"item"===o&&"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0)&&t.close()}_dragStartHandler(e){this._resizeDetails&&this._resizeDetails.started&&e.preventDefault()}_dropDownTransitionendHandler(){const e=this;e._edgeMacFF&&!e.opened&&e.hasAnimation&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view"))}_focus(e){this.$.listBox._focus(e)}_blurEventHandler(){const e=this;e.$.dropDownButton&&(e.removeAttribute("focus"),e.$.dropDownButton.removeAttribute("focus")),e.$.actionButton&&(e.removeAttribute("focus"),e.$.actionButton.removeAttribute("focus")),e.nodeName&&"smart-drop-down-list"===e.nodeName.toLowerCase()&&!e._preventDropDownClose&&e.close()}_focusEventHandler(){const e=this;e.$.dropDownButton&&(e.setAttribute("focus",""),e.$.dropDownButton.setAttribute("focus","")),e.$.actionButton&&(e.setAttribute("focus",""),e.$.actionButton.setAttribute("focus","")),e.removeAttribute("drop-down-button-focus"),e.removeAttribute("action-button-focus")}_buttonsFocusHandler(e){const t=this;e.target===t.$.dropDownButton?"focus"===e.type?t.setAttribute("drop-down-button-focus",""):(t.removeAttribute("drop-down-button-focus"),t.nodeName&&"smart-drop-down-list"===t.nodeName.toLowerCase()&&!t._preventDropDownClose&&t.close()):"focus"===e.type?t.setAttribute("action-button-focus",""):t.removeAttribute("action-button-focus")}_getUpEventTarget(e){const t=this;let o=e;for(o=void 0===o.parentElement?o.getRootNode().host:o.parentElement;o;){if(o===t.$.dropDownContainer){o="dropDownContainer";break}o=void 0===o.parentElement?o.getRootNode().host:o.parentElement}return o}_keyDownHandler(e){const t=this,o=t.enableShadowDOM&&t.shadowRoot.activeElement||document.activeElement,n=t.enableShadowDOM?e.composedPath()[0]:e.target;if(!(t.$.listBox&&n===t.$.listBox.$.filterInput||o!==t&&o!==t.$.dropDownButton&&o!==t.$.actionButton)||"Tab"===e.key)switch(e.key){case"Tab":if(t.filterable&&t.opened){const o=function(){for(let e=0;e<t.items.length;e++)if(!t.items[e].disabled)return t.items[e]};t.$.listBox.$.filterInput&&!Smart.Utilities.Core.isMobile&&document.activeElement!==t.$.listBox.$.filterInput?(t.$.listBox.$.filterInput.focus(),t._preventDropDownClose=!0):t.$.listBox&&(t.focus(),t.selectedIndexes.length>0?t._focus(t.items[t.selectedIndexes[0]]):t._focus(o),t._preventDropDownClose=!0),e.preventDefault()}break;case"Enter":case" ":e.preventDefault(),n!==t.$.actionButton&&(t._keyPressed=!0,t.opened?(t._focusedItem&&t.select(t._focusedItem),("Enter"===e.key&&["none"].indexOf(t.selectionMode)<0||" "===e.key&&["none","zeroAndOne","one","radioButton"].indexOf(t.selectionMode)>-1)&&t.close()):t.opened||t.readonly||"none"===t.dropDownOpenMode||t.open()),"dropDownButton"===t.dropDownOpenMode&&n.setAttribute("active","");break;case"End":case"Home":case"PageUp":case"PageDown":case"ArrowUp":case"ArrowDown":if(t.readonly)return;if(e.altKey)return t._keyPressed=!1,void(t.$dropDownContainer.hasClass("smart-visibility-hidden")?t.open():t.close());e.preventDefault(),t.$.listBox._handleKeyStrokes(e.key);break;case"Escape":e.preventDefault(),t.close();break;default:if(t.readonly)return;"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!0),t.$.listBox._applyIncrementalSearch(e.key)}}_keyUpHandler(e){const t=this,o=t.enableShadowDOM?e.composedPath()[0]:e.target;t.$.listBox&&o===t.$.listBox.$.filterInput||("Enter"!==e.key&&" "!==e.key||(o.removeAttribute("active"),t.$dropDownContainer.hasClass("smart-visibility-hidden")||(t._keyPressed=!1)),t.$.listBox&&"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!1))}_listBoxChangeHandler(e){const t=this;if(e.target===t.$.listBox){if((t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent("change",e.detail),"list"===t.autoComplete&&e.detail){const o=t.$.listBox._items[e.detail.index];t._lastSelectedItem=o&&o.selected?o:void 0}t._applySelection(t.selectionMode,e.detail),t._updateTargetValue()}else e.stopPropagation()}_listBoxItemClickHandler(e){const t=this;(t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent(e.type,e.detail),"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0&&t.close(),Smart.Utilities.Core.isMobile||t.focus(),delete t._isDropDownClicked}_listBoxKeyDownHandler(e){const t=this;if("Enter"===e.key)return t.close(),"dropDownButton"===t.dropDownOpenMode?t.$.dropDownButton.focus():t.focus(),void e.stopPropagation();"Escape"!==e.key||t.close()}_mouseEnterHandler(){const e=this;e._isElementHovered=!0,e.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"auto"===e.dropDownOpenMode&&!e.disabled&&!e.readonly&&e.open()}_mouseLeaveHandler(){const e=this;e.removeAttribute("hover"),e._isElementHovered=!1,"auto"!==e.dropDownOpenMode||e.disabled||e.readonly||e._autoClose()}_mouseWheelHandler(e){const t=this;t.disabled||t.readonly||t.items&&0===t.items.length||t.$dropDownContainer&&!t.$dropDownContainer.hasClass("smart-visibility-hidden")||t.$.listBox&&(e.preventDefault(),t.$.listBox._handleKeyStrokes(e.deltaY>0?"ArrowDown":"ArrowUp"))}_autoClose(){const e=this;e._autoCloseTimeout=setTimeout(function(){e._isElementHovered||e.close(),clearTimeout(e._autoCloseTimeout)}.bind(e),e.autoCloseDelay)}_propertyValidator(e,t){return"number"!=typeof t&&"string"!=typeof t?e:t}_resizeHandler(){this.refresh()}refresh(){const e=this;"none"===e.resizeMode&&(e._calculateDropDownSize(),e._setDropDownSize())}_selectStartHandler(e){this._preventsSelectStart&&e.preventDefault()}_setAriaRelations(e){const t=this;let o,n;"dropDownButton"!==t.dropDownOpenMode?(o=t.$.dropDownButton,o.setAttribute("aria-hidden",!0),n=t,t.$.actionButton.removeAttribute("role")):(o=t,n=t.$.dropDownButton,n.removeAttribute("aria-hidden"),t.$.actionButton.setAttribute("role","button")),t._ariaButton=n,n.setAttribute("role","button"),n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-owns",t.$.listBox.id),n.setAttribute("aria-describedby",t.$.hint.id),t.label?n.setAttribute("aria-labelledby",t.$.label.id):"DropDownList"===t.elementName&&n.setAttribute("aria-labelledby",t.$.actionButton.id),o.setAttribute("role","presentation"),o.removeAttribute("aria-owns"),e?n.setAttribute("aria-expanded",t.opened):(o.removeAttribute("aria-describedby"),o.removeAttribute("aria-expanded"),o.removeAttribute("aria-haspopup"),o.removeAttribute("aria-labelledby"))}_setDropDownSize(){const e=this,t=e.$.listBox;let o;if(e._dropDownSize||e._calculateDropDownSize(),["dropDownMinWidth","dropDownMaxWidth"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]="initial"===e[t]?e.offsetWidth+"px":e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),["dropDownMinHeight","dropDownMaxHeight"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]=e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),e.dropDownWidth?"auto"!==e.dropDownWidth?e.$.dropDownContainer.style.width=("initial"===e.dropDownWidth?e.offsetWidth:parseFloat(e.dropDownWidth))+"px":e.$.dropDownContainer.style.width="auto":e.$.dropDownContainer.style.width="auto"===e._dropDownSize.width?"auto":(parseFloat(e._dropDownSize.width)||0)+"px",e.dropDownHeight&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=parseFloat(e.dropDownHeight)+((e.dropDownHeight+"").indexOf("%")>-1?"%":"px");else if(!e.$.listBox||"auto"!==e._dropDownSize.height&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=e._dropDownSize.height;else{e.$.dropDownContainer.style.height="";let n=0;if(t.$.itemsContainer&&(n=2*parseInt(window.getComputedStyle(t.$.itemsContainer).getPropertyValue("--smart-list-item-vertical-offset"))),isNaN(n)&&(n=6),o=n,t.items&&t.items.length>0?t.items.map((e=>o+=e.height||e.offsetHeight)):o=t.$.placeholder?t.$.placeholder.offsetHeight:200,e.filterable){const e=t.$.filterInputContainer;o+=e.offsetHeight+e.offsetTop}o=o+e._dropDownSize.paddingWidth+e._dropDownSize.borderWidth,e.$.dropDownContainer.style.height=o+"px"}if(t){if(void 0===o||!t.$)return void t._refreshLayout();const n=t.$.horizontalScrollBar?t.$.horizontalScrollBar.offsetHeight:0,i=Math.max(0,e._dropDownSize.minHeight-(o-n));i&&(e.$.dropDownContainer.style.height=o+i+"px"),!e.opened&&e.virtualized&&t.refresh()}}_styleChangedHandler(e){const t=this;if(t.dropDownAppendTo){const o=e.detail.styleProperties,n=["font-size","font-family","font-style","font-weight"];for(let e=0;e<n.length;e++)o[n[e]]&&(t.$.dropDownContainer.style[n[e]]=o[n[e]].value)}"auto"===t._dropDownSize.height&&t._setDropDownSize()}_validateTemplate(e){const t=this;if(e&&"function"!=typeof e)if("content"in document.createElement("template")){if(e instanceof HTMLTemplateElement||(e=document.getElementById(e)),null!==e&&"content"in e)return e;t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"tokenTemplate"}))}else t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()}))}});
|
|
83
|
+
Smart("smart-drop-down-list",class extends Smart.ContentElement{static get properties(){return{autoCloseDelay:{value:100,type:"number"},dataSource:{value:null,type:"any",reflectToAttribute:!1},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownButtonPosition:{allowedValues:["none","left","right","top","bottom"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownMinHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownOpenMode:{allowedValues:["none","default","dropDownButton","auto"],value:"default",type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPlaceholder:{value:"No Items",type:"string"},dropDownPosition:{allowedValues:["auto","top","bottom","overlay-top","overlay-center","overlay-bottom","center-bottom","center-top"],value:"auto",type:"string"},dropDownMinWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxWidth:{value:"",type:"any",validator:"_propertyValidator"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterCallback:{value:null,type:"function?"},filterMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},hint:{value:"",type:"string"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},inputMember:{value:"label",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},label:{value:"",type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{invalidNode:'{{elementType}}: Invalid parameter "{{node}}" when calling {{method}}.'}},type:"object"},name:{value:"",type:"string"},opened:{value:!1,type:"boolean"},placeholder:{value:"",type:"string"},resizeMode:{value:"none",allowedValues:["none","horizontal","vertical","both"],type:"string"},resizeIndicator:{value:!1,type:"boolean"},selectionDisplayMode:{value:"plain",allowedValues:["plain","placeholder","tokens"],type:"string"},selectionMode:{value:"zeroAndOne",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},tokenTemplate:{value:null,type:"any"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]}}}static get listeners(){return{"actionButton.down":"_buttonsDownHandler","actionButton.mouseenter":"_buttonsMouseEventsHandler","actionButton.mouseleave":"_buttonsMouseEventsHandler","actionButton.focus":"_buttonsFocusHandler","actionButton.blur":"_buttonsFocusHandler","document.selectstart":"_selectStartHandler","document.dragstart":"_dragStartHandler","document.down":"_documentDownHandler","document.up":"_documentUpHandler","document.move":"_documentMoveHandler","dropDownButton.down":"_buttonsDownHandler","dropDownButton.mouseenter":"_buttonsMouseEventsHandler","dropDownButton.mouseleave":"_buttonsMouseEventsHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",focus:"_focusEventHandler",blur:"_blurEventHandler","dropDownButton.focus":"_buttonsFocusHandler","dropDownButton.blur":"_buttonsFocusHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","listBox.change":"_listBoxChangeHandler","listBox.itemClick":"_listBoxItemClickHandler","listBox.keydown":"_listBoxKeyDownHandler","listBox.bindingComplete":"_bindingCompleteHandler",mouseenter:"_mouseEnterHandler",mouseleave:"_mouseLeaveHandler",resize:"_resizeHandler","resizeBar.move":"_resizeBarMoveHandler",styleChanged:"_styleChangedHandler",wheel:"_mouseWheelHandler"}}template(){return'<div id="container" role="presentation">\n <span class="smart-label" id="label">[[label]]</span>\n <div id="content" class="smart-content" role="presentation">\n <div class="smart-buttons-container" id="buttonsContainer" role="presentation">\n <span id="actionButton" class ="smart-action-button" role="presentation">[[placeholder]]</span>\n <span id="dropDownButton" class="smart-drop-down-button">\n <span class ="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n <div id="dropDownContainer" class="smart-drop-down smart-drop-down-container smart-visibility-hidden" role="presentation">\n <smart-list-box id="listBox" unfocusable\n animation="[[animation]]"\n data-source="[[dataSource]]"\n disabled="[[disabled]]"\n display-loading-indicator="[[displayLoadingIndicator]]"\n display-member="[[displayMember]]"\n filterable="[[filterable]]"\n filter-callback="[[filterCallback]]"\n filter-mode="[[filterMode]]"\n filter-input-placeholder="[[filterInputPlaceholder]]"\n grouped="[[grouped]]"\n group-member="[[groupMember]]"\n item-height="[[itemHeight]]"\n item-measure-mode="[[itemMeasureMode]]"\n item-template="[[itemTemplate]]"\n incremental-search-delay="[[incrementalSearchDelay]]"\n incremental-search-mode="[[incrementalSearchMode]]"\n loading-indicator-placeholder="[[loadingIndicatorPlaceholder]]"\n loading-indicator-position="[[loadingIndicatorPosition]]"\n name="[[name]]"\n placeholder="[[dropDownPlaceholder]]"\n right-to-left="[[rightToLeft]]"\n readonly="[[readonly]]"\n selected-indexes="{{selectedIndexes}}"\n selection-mode="[[selectionMode]]"\n selected-values="{{selectedValues}}"\n sorted="[[sorted]]"\n sort-direction="[[sortDirection]]"\n theme="[[theme]]"\n value-member="[[valueMember]]"\n horizontal-scroll-bar-visibility="[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility="[[verticalScrollBarVisibility]]"\n virtualized="[[virtualized]]">\n <content></content>\n </smart-list-box>\n <div id="resizeBar" class="smart-drop-down-resize-bar" aria-label="Resize">\n <div></div>\n </div>\n </div>\n </div>\n <span class="smart-hint smart-hidden" id="hint">[[hint]]</span>\n </div>'}static get styleUrls(){return["smart.dropdownlist.css","smart.dropdown.css"]}propertyChangedHandler(e,t,o){super.propertyChangedHandler(e,t,o);const n=this;switch(e){case"animation":n.$.dropDownContainer.setAttribute("animation",n.animation);break;case"disabled":n._setFocusable(),n.close(),n._positionDetection.handleAutoPositioning();break;case"dataSource":case"displayMember":case"inputMember":n.$.actionButton&&(n.$.actionButton.innerHTML=n.placeholder),n._setDropDownSize(),n._positionDetection.checkBrowserBounds("vertically"),n._positionDetection.positionDropDown(),n._positionDetection.checkBrowserBounds("horizontally");break;case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownOpenMode":n._setFocusable(),n.$dropDownContainer.addClass("smart-visibility-hidden"),n.$.dropDownContainer.setAttribute("drop-down-open-mode",o),n.$.dropDownButton.removeAttribute("selected"),n.removeAttribute("drop-down-button-focus"),n.removeAttribute("action-button-focus"),n.opened=!1,n._ariaButton&&n._ariaButton.setAttribute("aria-expanded",!1),n._setAriaRelations();break;case"dropDownOverlay":o||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"dropDownMinWidth":case"dropDownWidth":case"dropDownMaxWidth":case"dropDownHeight":case"dropDownMinHeight":case"dropDownMaxHeight":n._setDropDownSize();break;case"filterable":n.$.listBox.filterable=o,n._dropDownSize&&"auto"===n._dropDownSize.height&&n._setDropDownSize();break;case"label":if(!n._ariaButton)return;o?n._ariaButton.setAttribute("aria-labelledby",n.$.label.id):"DropDownList"===n.elementName&&n._ariaButton.setAttribute("aria-labelledby",n.$.actionButton.id);break;case"opened":if(n.disabled||n.readonly)return;o?n.open():n.close();break;case"placeholder":n._applySelection();break;case"readonly":n.close();break;case"resizeIndicator":o?n.$.dropDownContainer.setAttribute("resize-indicator",""):n.$.dropDownContainer.removeAttribute("resize-indicator");break;case"resizeMode":n.$.dropDownContainer.setAttribute("resize-mode",n.resizeMode);break;case"selectedValues":case"selectedIndexes":0===o.length?n.$.actionButton.innerHTML=n.placeholder:n._applySelection();break;case"selectionMode":n.$.listBox&&(n.$.listBox[e]=o,"checkBox"!==o&&"radioButton"!==o&&"checkBox"!==t&&"radioButton"!==t||n._setDropDownSize());break;case"selectionDisplayMode":n._applySelection();break;case"tokenTemplate":n._tokenTemplate=n._validateTemplate(n.tokenTemplate),n._applySelection();break;case"unfocusable":n._setFocusable()}}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const o=e.dataset.property,n=e.value;o&&void 0!==t[o]&&(t[o]=n)}}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(t.$.listBox.appendChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}attached(){const e=this;super.attached(),e.isCompleted&&e.$.dropDownContainer&&(e._positionDetection.dropDownAttached("_setDropDownSize"),e._positionDetection.checkBrowserBounds(),e.selectedIndexes&&e._applySelection())}detached(){const e=this;super.detached(),e.$.dropDownContainer&&(e.close(),e._positionDetection&&e._positionDetection.dropDownDetached())}clearItems(){const e=this;e.$.listBox&&(e.$.listBox.clearItems(),e.$.actionButton.innerHTML=e.placeholder)}clearSelection(){const e=this;e.$.listBox&&(e.$.listBox.clearSelection(),e.$.actionButton.innerHTML=e.placeholder)}close(){const e=this;e.$dropDownContainer.hasClass("smart-visibility-hidden")||e.$.fireEvent("closing").defaultPrevented||(e.$dropDownContainer.addClass("smart-visibility-hidden"),e.$.fireEvent("close"),e.$.dropDownButton&&e.$.dropDownButton.removeAttribute("selected"),e.opened=!1,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!1),e._preventDropDownClose=!1,e._positionDetection.removeOverlay(!0),e.$.listBox.removeAttribute("focus"),e._edgeMacFF&&!e.hasAnimation&&e.$.dropDownContainer&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view")))}cloneNode(){const e=this;if(!e.$.listBox)return;let t=HTMLElement.prototype.cloneNode.apply(e,Array.prototype.slice.call(arguments,0,1));return t.dataSource=e.dataSource,t}ensureVisible(e){this.$.listBox&&this.$.listBox.ensureVisible(e)}getItem(e){if(this.$.listBox)return this.$.listBox.getItem(e)}get items(){const e=this;return e.$&&e.$.listBox?e.$.listBox.items:[]}get _focusedItem(){const e=this;return e.$&&e.$.listBox?e.$.listBox._focusedItem:null}insert(e,t){const o=this;o.$.listBox&&(o.$.listBox.insert(e,t),o._applySelection(),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize())}insertBefore(e,t){const o=this;if(!o.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(o,e.concat(Array.prototype.slice.call(arguments)))}e&&t?o.$.listBox&&(o.$.listBox.insertBefore(e,t),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize()):o.error(o.localize("invalidNode",{elementType:o.nodeName.toLowerCase(),method:"insertBefore",node:"newNode/referenceNode"}))}toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this,t=function(){for(let t=0;t<e.items.length;t++)if(!e.items[t].disabled)return e.items[t]};if(!e.disabled&&e.offsetHeight&&e.$dropDownContainer.hasClass("smart-visibility-hidden")){if(e.$dropDownContainer.hasClass("not-in-view")&&e.$dropDownContainer.removeClass("not-in-view"),e.$.dropDownContainer.style.transition=null,e.dropDownAppendTo){const t=e.getBoundingClientRect();if(e.$.container.contains(e.$.dropDownContainer)){let t=0;const o=setInterval((function(){const n=e.getBoundingClientRect();t++,n.top===e._positionTop&&t<10||(e.open(),clearInterval(o),e._positionTop=n.top)}),100);return}t.top!==e._positionTop&&(e._positionTop=t.top)}e.$.fireEvent("opening").defaultPrevented||(e._shadowDOMStylesDelay&&(e._setDropDownSize(),delete e._shadowDOMStylesDelay),e.opened=!0,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!0),e.$.listBox.setAttribute("focus",""),e._positionDetection.placeOverlay(),e._positionDetection.checkBrowserBounds("vertically"),e._positionDetection.positionDropDown(),e._positionDetection.checkBrowserBounds("horizontally"),e.$dropDownContainer.removeClass("smart-visibility-hidden"),e.$.fireEvent("open"),e.$.dropDownButton&&("dropDownButton"===e.dropDownOpenMode?e.$.dropDownButton.setAttribute("selected",""):e.$.dropDownButton.removeAttribute("selected")),(e.$.listBox&&!e._focusedItem||e._focusedItem&&!e._focusedItem._focused)&&(e.selectedIndexes.length>0?e._focus(e.items[e.selectedIndexes[0]]):e._focus(t)),e.$.input&&!Smart.Utilities.Core.isMobile&&e.$.input.focus())}}ready(){super.ready()}render(){const e=this;e.rightToLeft&&(e.dropDownButtonPosition="right"===e.dropDownButtonPosition?"left":"right"),e.classList.add("smart-drop-down-box"),e.$.dropDownContainer&&(e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.container,"close"),e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e._calculateDropDownSize(),e.$.dropDownContainer.setAttribute("resize-mode",e.resizeMode),e.$.dropDownContainer.setAttribute("drop-down-open-mode",e.dropDownOpenMode),e.resizeIndicator&&e.$.dropDownContainer.setAttribute("resize-indicator",""),e._positionDetection.handleAutoPositioning()),e.opened&&e.open(),e._positionTop=e.getBoundingClientRect().top,e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._edgeMacFF&&e.hasAnimation&&e.$.dropDownContainer&&e.$dropDownContainer.addClass("not-in-view"),e.$.label&&!e.$.label.id&&(e.$.label.id=e.id+"Label"),e.$.actionButton&&!e.$.actionButton.id&&(e.$.actionButton.id=e.id+"ActionButton"),e.$.hint&&!e.$.hint.id&&(e.$.hint.id=e.id+"Hint"),e._createElement(),super.render()}removeAt(e){const t=this;t.$.listBox&&(t.$.listBox.removeAt(e),t._applySelection(),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize())}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e&&e instanceof Smart.ListItem?(t.$.listBox.removeChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}get value(){const e=this;return e.isRendered&&e.$.listBox?e.$.listBox.value:null}set value(e){const t=this;return t.isRendered&&t.$.listBox?void(t.$.listBox.value=e):null}select(e){this.$.listBox&&this.$.listBox.select(e)}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.removeAttribute("tabindex"),e.$.actionButton.removeAttribute("tabindex"),void e.$.dropDownButton.removeAttribute("tabindex");let t=e.tabIndex>0?e.tabIndex:0;e.tabIndex=t,"dropDownButton"===e.dropDownOpenMode?(e.removeAttribute("tabindex"),e.$.actionButton.setAttribute("tabindex",t),e.$.dropDownButton.setAttribute("tabindex",t)):(e.$.actionButton.removeAttribute("tabindex"),e.$.dropDownButton.removeAttribute("tabindex"))}static get requires(){return{"Smart.ListBox":"smart.listbox.js"}}unselect(e){this.$.listBox&&this.$.listBox.unselect(e)}update(e,t){const o=this;o.$.listBox&&(o.$.listBox.update(e,t),o._applySelection())}_resizeBarMoveHandler(e){"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_createToken(){const e=this;let t,o=!1;const n=document.createDocumentFragment(),i=e.selectedIndexes[e.selectedIndexes.length-1];"plain"!==e.selectionDisplayMode||"one"!==e.selectionMode&&"zeroAndOne"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode&&"radioButton"!==e.selectionMode?"tokens"===e.selectionDisplayMode?1===e.selectedIndexes.length&&["oneOrManyExtended","oneOrMany","zeroAndOne","one","radioButton"].indexOf(e.selectionMode)>-1?t="":(t="✖",o=!0):t=1===e.selectedIndexes.length?"":",":t="";const r=e.selectedIndexes,a=e.$.listBox._items;for(let s=0;s<r.length;s++){const l=r[s];a[l]&&n.appendChild(e._applyTokenTemplate(a[l][e.inputMember],"tokens"!==e.selectionDisplayMode&&l===i?"":t,o))}return n}_applySelection(){const e=this;if("placeholder"!==e.selectionDisplayMode&&0!==e.selectedIndexes.length){if(e.$.listBox._items&&0!==e.$.listBox._items.length)if("plain"!==e.selectionDisplayMode)e.$.actionButton.innerHTML="",e.$.actionButton.appendChild(e._createToken());else{const t=e.$.listBox.selectedIndexes,o=e.$.listBox._items;let n=[];for(let i=0;i<t.length;i++){const r=t[i];o[r]&&n.push(o[r][e.inputMember])}e.$.actionButton.innerHTML=n.length?`<span class="smart-token">${n.join(", ").trim()}</span>`:""}}else e.$.actionButton.innerHTML=e.placeholder}_applyTokenTemplate(e,t,o){const n=this,i=document.createElement("span"),r=function(){return"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+e+`</span><span class='smart-drop-down-list-unselect-button' role="button"${o?' aria-label="Unselect"':""}>${t}</span>`};if(i.classList.add("smart-token"),n._tokenTemplate){let e=document.importNode(n._tokenTemplate.content,!0);const t=e.childNodes.length,o=/{{\w+}}/g;let a;for(let n=0;n<t;n++)a=o.exec(e.childNodes[n].innerHTML),a&&(e.childNodes[n].innerHTML=e.childNodes[n].innerHTML.replace(a[0],r())),e.childNodes[n].outerHTML&&(i.innerHTML+=e.childNodes[n].outerHTML)}else"function"==typeof n.tokenTemplate?n.tokenTemplate(i,{label:e,iconSeparator:t}):i.innerHTML=r();return i}_bindingCompleteHandler(){const e=this;e.$.listBox&&requestAnimationFrame((()=>{e._setDropDownSize(),e._positionDetection.checkBrowserBounds()}))}_buttonsDownHandler(e){const t=this;if(!t.disabled){if(t.hasRippleAnimation)if(t.$.buttonsContainer&&"dropDownButton"!==t.dropDownOpenMode){const o=t.$.buttonsContainer;o.firstElementChild.noRipple=!0,Smart.Utilities.Animation.Ripple.animate(o,e.pageX,e.pageY),o.firstElementChild.noRipple=!1}else Smart.Utilities.Animation.Ripple.animate(e.target,e.pageX,e.pageY);t._preventsSelectStart=!0,t.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.actionButton&&t.$.actionButton.setAttribute("active",""),t.opened&&(t._preventDropDownClose=!0)}}_buttonsMouseEventsHandler(e){const t=this;t.disabled||("mouseenter"===e.type?(t.setAttribute("hover",""),e.target.setAttribute("hover",""),"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.dropDownButton&&t.setAttribute("drop-down-button-hover","")):(t.removeAttribute("hover"),t.removeAttribute("drop-down-button-hover"),e.target.removeAttribute("hover")))}_calculateDropDownSize(){const e=this;e._dropDownSize={};const t=window.getComputedStyle(e.$.dropDownContainer),o=parseFloat(t.getPropertyValue("border-top-width").trim()),n=parseFloat(t.getPropertyValue("border-bottom-width").trim()),i=parseFloat(t.getPropertyValue("margin-top").trim()),r=parseFloat(t.getPropertyValue("margin-bottom").trim()),a=parseFloat(t.getPropertyValue("padding-top").trim()),s=parseFloat(t.getPropertyValue("padding-bottom").trim());Smart.Utilities.Core.CSSVariablesSupport()&&(e._dropDownSize.width=t.getPropertyValue("--smart-drop-down-list-drop-down-width").trim(),e._dropDownSize.height=t.getPropertyValue("--smart-drop-down-list-drop-down-height").trim()),(!e._dropDownSize.width||e._dropDownSize.width.indexOf("initial")>-1)&&(e._dropDownSize.width=e.offsetWidth),e._dropDownSize.height||(e._dropDownSize.height="auto"),e._dropDownSize.minHeight=parseFloat(t.getPropertyValue("min-height").trim()),e._dropDownSize.maxHeight=parseFloat(t.getPropertyValue("max-height").trim()),e._dropDownSize.borderWidth=(isNaN(o)?0:o)+(isNaN(n)?0:n),e._dropDownSize.paddingWidth=(isNaN(a)?0:a)+(isNaN(s)?0:s),e._dropDownSize.marginWidth=(isNaN(i)?0:i)+(isNaN(r)?0:r)}_createElement(){const e=this;e._tokenTemplate=e._validateTemplate(e.tokenTemplate),e._applySelection(),e._setDropDownSize(),e._setFocusable(),e.$.arrow.noRipple=!0,e._shadowDOMStylesDelay=e.shadowRoot,e._setAriaRelations(!0)}_documentDownHandler(e){const t=this;if(t.disabled||t.readonly)return;let o=e.originalEvent.target;if(o===t._overlay&&(t._overlayDown=!0),t.shadowRoot){o=e.originalEvent.composedPath()[0];let n=o.getRootNode().host;for(;n;)n.closest(".smart-drop-down-container")===t.$.dropDownContainer&&(t._isDropDownClicked=!0),n=n.getRootNode().host}else t.isInShadowDOM&&(o=e.originalEvent.composedPath()[0]),t._isDropDownClicked=o.closest(".smart-drop-down-container")===t.$.dropDownContainer;if(t._buttonClicked=o.closest(".smart-action-button")||o.closest(".smart-drop-down-button"),t.$.listBox){let n=o.closest("smart-list-item");t.$.listBox.contains(n)||(n=void 0),t.hasRippleAnimation&&n&&Smart.Utilities.Animation.Ripple.animate(n,e.pageX,e.pageY),(n||o===t.$.listBox.$.filterInput||o.closest(".smart-token"))&&(t._preventDropDownClose=!0)}if(t._isDropDownClicked&&(t._preventDropDownClose=!0),o!==t.$.resizeBar||"none"===t.resizeMode)return;t._resizeDetails||(t._resizeDetails={});const n=t.$.dropDownContainer.getBoundingClientRect();t._resizeDetails.started=!0,t._resizeDetails.x=e.pageX,t._resizeDetails.y=e.pageY,t._resizeDetails.width=t.$.dropDownContainer.offsetWidth,t._resizeDetails.height=t.$.dropDownContainer.offsetHeight,t._resizeDetails.offsetXL=e.clientX-n.left,t._resizeDetails.offsetXR=n.left+t.$.dropDownContainer.offsetWidth-e.clientX,t._resizeDetails.offsetY=n.top+t.$.dropDownContainer.offsetHeight-e.clientY,t._resizeDetails.offsetYtop=e.clientY-n.top,t._preventDropDownClose=!0}_documentMoveHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if("auto"===t.dropDownOpenMode&&null!==t.dropDownAppendTo&&(t.contains(o)||t.$.dropDownContainer.contains(o)?t._isElementHovered=!0:(t._isElementHovered=!1,t._autoClose())),!t._resizeDetails||t._resizeDetails&&!t._resizeDetails.started)return;t.setAttribute("resizing",""),t._resizeDetails.resizeEventFired||(t.$.fireEvent("resizeStart",{position:{left:e.pageX,top:e.pageY}}),t._resizeDetails.resizeEventFired=!0);const n=document.documentElement,i=t.$.dropDownContainer.getBoundingClientRect(),r=t.getBoundingClientRect(),a=t.$.dropDownContainer.hasAttribute("top")?"top":"bottom";let s;function l(){if(s=e.pageY-t._resizeDetails.y,"bottom"===a)t._resizeDetails.height=Math.min(n.clientHeight-i.top-6,Math.max(0,t._resizeDetails.height+s)),t._resizeDetails.y=Math.max(i.top+n.scrollTop-t._resizeDetails.offsetY,Math.min(n.clientHeight+n.scrollTop-1.5*t._resizeDetails.offsetY,e.pageY));else{if(t._resizeDetails.height=Math.min(t._dropDownSize.maxHeight,Math.max(0,Math.min(r.top,t._resizeDetails.height-s))),s=Math.max(0,i.top+(i.height-Math.max(t._dropDownSize.minHeight,t._resizeDetails.height))),t.dropDownAppendTo){const e=Math.abs(parseFloat(getComputedStyle(t.$.dropDownContainer).getPropertyValue("margin-bottom")))||0;t.$.dropDownContainer.style.top=t.dropDownAppendTo?e+s+"px":""}const o=r.top+n.scrollTop+t._resizeDetails.offsetYtop;t._resizeDetails.y=Math.max(t._resizeDetails.offsetYtop,Math.min(o,Math.max(o-t._dropDownSize.maxHeight,e.pageY)))}t.$.dropDownContainer.style.height=t._resizeDetails.height+"px"}function d(){s=e.pageX-t._resizeDetails.x,t._resizeDetails.width=Math.min(n.clientWidth-i.left-6,Math.max(0,t._resizeDetails.width+s)),t.$.dropDownContainer.style.width=t._resizeDetails.width+"px",t._resizeDetails.x=Math.max(i.left+n.scrollLeft-t._resizeDetails.offsetXR,Math.min(n.clientWidth+n.scrollLeft-1.5*t._resizeDetails.offsetXR,e.pageX))}switch(t.resizeMode){case"vertical":l();break;case"horizontal":d();break;case"both":d(),l()}}_documentUpHandler(e){const t=this;if(t.$.actionButton.removeAttribute("active"),t._resizeDetails&&t._resizeDetails.started)return t._resizeDetails.started=t._resizeDetails.resizeEventFired=!1,t.removeAttribute("resizing"),t._preventDropDownClose=!1,t.focus(),void t.$.fireEvent("resizeEnd",{position:{left:e.pageX,top:e.pageY}});if(t.disabled||t._isDropDownClicked||t.readonly)return void delete t._isDropDownClicked;if(t._overlayDown)return t.close(),void delete t._overlayDown;let o=e.originalEvent.target,n=o.closest?o.closest("smart-drop-down-list"):void 0;if((t.enableShadowDOM||t.isInShadowDOM)&&(o=e.originalEvent.composedPath()[0],n=o.getRootNode().host),t._preventsSelectStart=!1,void 0===o||o===t.$.resizeBar)return;if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-selection-label")&&n===t){"none"!==t.dropDownOpenMode&&t.open();let e=t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.textContent))[0];return t.$.listBox._scrollView.scrollTop=e.offsetTop,void t._focus(e)}if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-unselect-button")&&n===t){if(1===t.selectedIndexes.length&&["zeroOrMany","zeroOrOne","checkBox"].indexOf(t.selectionMode)<0)return;return void t.unselect(t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.previousElementSibling.textContent))[0])}const i=!(!o||!o.closest)&&o.closest(".smart-action-button");let r;if(t._buttonClicked&&("dropDownButton"===t.dropDownOpenMode&&i&&t._buttonClicked===t.$.actionButton?t.$.fireEvent("actionButtonClick"):o.closest(".smart-drop-down-button")!==t._buttonClicked&&i!==t._buttonClicked||(r=!0,t.$.fireEvent("dropDownButtonClick"))),t._buttonClicked=void 0,i===t.$.actionButton||o&&o.closest&&o.closest(".smart-drop-down-button")===t.$.dropDownButton)return"dropDownButton"===t.dropDownOpenMode&&i===t.$.actionButton?void t.close():void(t.$dropDownContainer.hasClass("smart-visibility-hidden")&&"none"!==t.dropDownOpenMode&&r&&"pointercancel"!==e.originalEvent.type?t.open():t.close());o=t._getUpEventTarget(o),void 0!==o&&("dropDownContainer"!==o&&"item"!==o||"item"===o&&"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0)&&t.close()}_dragStartHandler(e){this._resizeDetails&&this._resizeDetails.started&&e.preventDefault()}_dropDownTransitionendHandler(){const e=this;e._edgeMacFF&&!e.opened&&e.hasAnimation&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view"))}_focus(e){this.$.listBox._focus(e)}_blurEventHandler(){const e=this;e.$.dropDownButton&&(e.removeAttribute("focus"),e.$.dropDownButton.removeAttribute("focus")),e.$.actionButton&&(e.removeAttribute("focus"),e.$.actionButton.removeAttribute("focus")),e.nodeName&&"smart-drop-down-list"===e.nodeName.toLowerCase()&&!e._preventDropDownClose&&e.close()}_focusEventHandler(){const e=this;e.$.dropDownButton&&(e.setAttribute("focus",""),e.$.dropDownButton.setAttribute("focus","")),e.$.actionButton&&(e.setAttribute("focus",""),e.$.actionButton.setAttribute("focus","")),e.removeAttribute("drop-down-button-focus"),e.removeAttribute("action-button-focus")}_buttonsFocusHandler(e){const t=this;e.target===t.$.dropDownButton?"focus"===e.type?t.setAttribute("drop-down-button-focus",""):(t.removeAttribute("drop-down-button-focus"),t.nodeName&&"smart-drop-down-list"===t.nodeName.toLowerCase()&&!t._preventDropDownClose&&t.close()):"focus"===e.type?t.setAttribute("action-button-focus",""):t.removeAttribute("action-button-focus")}_getUpEventTarget(e){const t=this;let o=e;for(o=void 0===o.parentElement?o.getRootNode().host:o.parentElement;o;){if(o===t.$.dropDownContainer){o="dropDownContainer";break}o=void 0===o.parentElement?o.getRootNode().host:o.parentElement}return o}_keyDownHandler(e){const t=this,o=t.enableShadowDOM&&t.shadowRoot.activeElement||document.activeElement,n=t.enableShadowDOM?e.composedPath()[0]:e.target;if(!(t.$.listBox&&n===t.$.listBox.$.filterInput||o!==t&&o!==t.$.dropDownButton&&o!==t.$.actionButton)||"Tab"===e.key)switch(e.key){case"Tab":if(t.filterable&&t.opened){const o=function(){for(let e=0;e<t.items.length;e++)if(!t.items[e].disabled)return t.items[e]};t.$.listBox.$.filterInput&&!Smart.Utilities.Core.isMobile&&document.activeElement!==t.$.listBox.$.filterInput?(t.$.listBox.$.filterInput.focus(),t._preventDropDownClose=!0):t.$.listBox&&(t.focus(),t.selectedIndexes.length>0?t._focus(t.items[t.selectedIndexes[0]]):t._focus(o),t._preventDropDownClose=!0),e.preventDefault()}break;case"Enter":case" ":e.preventDefault(),n!==t.$.actionButton&&(t._keyPressed=!0,t.opened?(t._focusedItem&&t.select(t._focusedItem),("Enter"===e.key&&["none"].indexOf(t.selectionMode)<0||" "===e.key&&["none","zeroAndOne","one","radioButton"].indexOf(t.selectionMode)>-1)&&t.close()):t.opened||t.readonly||"none"===t.dropDownOpenMode||t.open()),"dropDownButton"===t.dropDownOpenMode&&n.setAttribute("active","");break;case"End":case"Home":case"PageUp":case"PageDown":case"ArrowUp":case"ArrowDown":if(t.readonly)return;if(e.altKey)return t._keyPressed=!1,void(t.$dropDownContainer.hasClass("smart-visibility-hidden")?t.open():t.close());e.preventDefault(),t.$.listBox._handleKeyStrokes(e.key);break;case"Escape":e.preventDefault(),t.close();break;default:if(t.readonly)return;"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!0),t.$.listBox._applyIncrementalSearch(e.key)}}_keyUpHandler(e){const t=this,o=t.enableShadowDOM?e.composedPath()[0]:e.target;t.$.listBox&&o===t.$.listBox.$.filterInput||("Enter"!==e.key&&" "!==e.key||(o.removeAttribute("active"),t.$dropDownContainer.hasClass("smart-visibility-hidden")||(t._keyPressed=!1)),t.$.listBox&&"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!1))}_listBoxChangeHandler(e){const t=this;if(e.target===t.$.listBox){if((t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent("change",e.detail),"list"===t.autoComplete&&e.detail){const o=t.$.listBox._items[e.detail.index];t._lastSelectedItem=o&&o.selected?o:void 0}t._applySelection(t.selectionMode,e.detail),t._updateTargetValue()}else e.stopPropagation()}_listBoxItemClickHandler(e){const t=this;(t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent(e.type,e.detail),"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0&&t.close(),Smart.Utilities.Core.isMobile||t.focus(),delete t._isDropDownClicked}_listBoxKeyDownHandler(e){const t=this;if("Enter"===e.key)return t.close(),"dropDownButton"===t.dropDownOpenMode?t.$.dropDownButton.focus():t.focus(),void e.stopPropagation();"Escape"!==e.key||t.close()}_mouseEnterHandler(){const e=this;e._isElementHovered=!0,e.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"auto"===e.dropDownOpenMode&&!e.disabled&&!e.readonly&&e.open()}_mouseLeaveHandler(){const e=this;e.removeAttribute("hover"),e._isElementHovered=!1,"auto"!==e.dropDownOpenMode||e.disabled||e.readonly||e._autoClose()}_mouseWheelHandler(e){const t=this;t.disabled||t.readonly||t.items&&0===t.items.length||t.$dropDownContainer&&!t.$dropDownContainer.hasClass("smart-visibility-hidden")||t.$.listBox&&(e.preventDefault(),t.$.listBox._handleKeyStrokes(e.deltaY>0?"ArrowDown":"ArrowUp"))}_autoClose(){const e=this;e._autoCloseTimeout=setTimeout(function(){e._isElementHovered||e.close(),clearTimeout(e._autoCloseTimeout)}.bind(e),e.autoCloseDelay)}_propertyValidator(e,t){return"number"!=typeof t&&"string"!=typeof t?e:t}_resizeHandler(){this.refresh()}refresh(){const e=this;"none"===e.resizeMode&&(e._calculateDropDownSize(),e._setDropDownSize())}_selectStartHandler(e){this._preventsSelectStart&&e.preventDefault()}_setAriaRelations(e){const t=this;let o,n;"dropDownButton"!==t.dropDownOpenMode?(o=t.$.dropDownButton,o.setAttribute("aria-hidden",!0),n=t,t.$.actionButton.removeAttribute("role")):(o=t,n=t.$.dropDownButton,n.removeAttribute("aria-hidden"),t.$.actionButton.setAttribute("role","button")),t._ariaButton=n,n.setAttribute("role","button"),n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-owns",t.$.listBox.id),n.setAttribute("aria-describedby",t.$.hint.id),t.label?n.setAttribute("aria-labelledby",t.$.label.id):"DropDownList"===t.elementName&&n.setAttribute("aria-labelledby",t.$.actionButton.id),o.setAttribute("role","presentation"),o.removeAttribute("aria-owns"),e?n.setAttribute("aria-expanded",t.opened):(o.removeAttribute("aria-describedby"),o.removeAttribute("aria-expanded"),o.removeAttribute("aria-haspopup"),o.removeAttribute("aria-labelledby"))}_setDropDownSize(){const e=this,t=e.$.listBox;let o;if(e._dropDownSize||e._calculateDropDownSize(),["dropDownMinWidth","dropDownMaxWidth"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]="initial"===e[t]?e.offsetWidth+"px":e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),["dropDownMinHeight","dropDownMaxHeight"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]=e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),e.dropDownWidth?"auto"!==e.dropDownWidth?e.$.dropDownContainer.style.width=("initial"===e.dropDownWidth?e.offsetWidth:parseFloat(e.dropDownWidth))+"px":e.$.dropDownContainer.style.width="auto":e.$.dropDownContainer.style.width="auto"===e._dropDownSize.width?"auto":(parseFloat(e._dropDownSize.width)||0)+"px",e.dropDownHeight&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=parseFloat(e.dropDownHeight)+((e.dropDownHeight+"").indexOf("%")>-1?"%":"px");else if(!e.$.listBox||"auto"!==e._dropDownSize.height&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=e._dropDownSize.height;else{e.$.dropDownContainer.style.height="";let n=0;if(t.$.itemsContainer&&(n=2*parseInt(window.getComputedStyle(t.$.itemsContainer).getPropertyValue("--smart-list-item-vertical-offset"))),isNaN(n)&&(n=6),o=n,t.items&&t.items.length>0?t.items.map((e=>o+=e.height||e.offsetHeight)):o=t.$.placeholder?t.$.placeholder.offsetHeight:200,e.filterable){const e=t.$.filterInputContainer;o+=e.offsetHeight+e.offsetTop}o=o+e._dropDownSize.paddingWidth+e._dropDownSize.borderWidth,e.$.dropDownContainer.style.height=o+"px"}if(t){if(void 0===o||!t.$)return void t._refreshLayout();const n=t.$.horizontalScrollBar?t.$.horizontalScrollBar.offsetHeight:0,i=Math.max(0,e._dropDownSize.minHeight-(o-n));i&&(e.$.dropDownContainer.style.height=o+i+"px"),!e.opened&&e.virtualized&&t.refresh()}}_styleChangedHandler(e){const t=this;if(t.dropDownAppendTo){const o=e.detail.styleProperties,n=["font-size","font-family","font-style","font-weight"];for(let e=0;e<n.length;e++)o[n[e]]&&(t.$.dropDownContainer.style[n[e]]=o[n[e]].value)}"auto"===t._dropDownSize.height&&t._setDropDownSize()}_validateTemplate(e){const t=this;if(e&&"function"!=typeof e)if("content"in document.createElement("template")){if(e instanceof HTMLTemplateElement||(e=document.getElementById(e)),null!==e&&"content"in e)return e;t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"tokenTemplate"}))}else t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()}))}});
|
|
84
84
|
|
|
85
85
|
/***/ }),
|
|
86
86
|
|
|
87
87
|
/***/ 6321:
|
|
88
88
|
/***/ (() => {
|
|
89
89
|
|
|
90
|
-
!function(){const e="16.0.0",t=[];let n="Smart";if(window[n]&&window[n].Version){if(window[n].Version===e)return;if(window[n].Version!==e)n+=e;else{let e=2;for(;window[n];)n+=e.toString(),e++}}const r=navigator.userAgent.indexOf("Edge")>-1&&navigator.appVersion.indexOf("Edge")>-1;document.elementsFromPoint||(document.elementsFromPoint=document.msElementsFromPoint);class o{static isBoolean(e){return"boolean"==typeof e}static isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)}static isArray(e){return Array.isArray(e)}static isObject(e){return e&&("object"==typeof e||this.isFunction(e))||!1}static isDate(e){return e instanceof Date}static isString(e){return"string"==typeof e}static isNumber(e){return"number"==typeof e}static getType(e){const t=this,n=["Boolean","Number","String","Function","Array","Date","Object"].find((n=>{if(t["is"+n](e))return n}));return n?n.toLowerCase():void 0}}class i{static animate(e,t,r,o){const i=e;if(!i||i instanceof HTMLElement==0)return;if(0===i.getElementsByClassName("smart-ripple").length){const e=document.createElement("span");e.classList.add("smart-ripple"),e.setAttribute("role","presentation");let t=!0,r=null;if(window[n].EnableShadowDOM&&i.enableShadowDOM&&!0!==i.isInShadowDOM){for(let e=0;e<i.shadowRoot.host.shadowRoot.children.length;e++)"link"!==i.shadowRoot.host.shadowRoot.children[e].tagName.toLowerCase()&&(r=i.shadowRoot.host.shadowRoot.children[e]);i.shadowRoot.host.shadowRoot.querySelector(".smart-ripple")&&(t=!1)}else r=i.firstElementChild;t&&(r&&!r.noRipple&&r.offsetHeight>0?r.appendChild(e):i.appendChild(e))}let s=null;if(s=window[n].EnableShadowDOM&&i.shadowRoot?i.shadowRoot.host.shadowRoot.querySelector(".smart-ripple"):i.getElementsByClassName("smart-ripple")[0],!s)return;s.innerHTML="",s.classList.remove("smart-animate"),s.style.height=s.style.width=Math.max(i.offsetHeight,i.offsetWidth)+"px";const a=window.getComputedStyle(s.parentElement),l=parseInt(a.borderLeftWidth)||0,d=parseInt(a.borderTopWidth)||0,c=i.getBoundingClientRect(),u=t-(c.left+window.pageXOffset)-s.offsetWidth/2-l,p=r-(c.top+window.pageYOffset)-s.offsetHeight/2-d;s.style.left=u+"px",s.style.top=p+"px",s.classList.add("smart-animate"),s.addEventListener("animationend",(function e(){s.parentElement&&s.parentElement.removeChild(s),o&&o(),s.removeEventListener("animationend",e),s.removeEventListener("animationcancel",e)})),s.addEventListener("animationcancel",(function e(){s.parentElement&&s.parentElement.removeChild(s),o&&o(),s.removeEventListener("animationcancel",e),s.removeEventListener("animationend",e)}))}}class s{static easeInQuad(e,t,n,r){return n*(e/=r)*e+t}static easeOutQuad(e,t,n,r){return-n*(e/=r)*(e-2)+t}static easeInOutQuad(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t}static easeInCubic(e,t,n,r){return n*(e/=r)*e*e+t}static easeOutCubic(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}static easeInOutCubic(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t}static easeInQuart(e,t,n,r){return n*(e/=r)*e*e*e+t}static easeOutQuart(e,t,n,r){return-n*((e=e/r-1)*e*e*e-1)+t}static easeInOutQuart(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t}static easeInQuint(e,t,n,r){return n*(e/=r)*e*e*e*e+t}static easeOutQuint(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t}static easeInOutQuint(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t}static easeInSine(e,t,n,r){return-n*Math.cos(e/r*(Math.PI/2))+n+t}static easeOutSine(e,t,n,r){return n*Math.sin(e/r*(Math.PI/2))+t}static easeInOutSine(e,t,n,r){return-n/2*(Math.cos(Math.PI*e/r)-1)+t}static easeInExpo(e,t,n,r){return 0===e?t:n*Math.pow(2,10*(e/r-1))+t}static easeOutExpo(e,t,n,r){return e===r?t+n:n*(1-Math.pow(2,-10*e/r))+t}static easeInOutExpo(e,t,n,r){return 0===e?t:e===r?t+n:(e/=r/2)<1?n/2*Math.pow(2,10*(e-1))+t:n/2*(2-Math.pow(2,-10*--e))+t}static easeInCirc(e,t,n,r){return-n*(Math.sqrt(1-(e/=r)*e)-1)+t}static easeOutCirc(e,t,n,r){return n*Math.sqrt(1-(e=e/r-1)*e)+t}static easeInOutCirc(e,t,n,r){return(e/=r/2)<1?-n/2*(Math.sqrt(1-e*e)-1)+t:n/2*(Math.sqrt(1-(e-=2)*e)+1)+t}static easeInElastic(e,t,n,r){let o=1.70158,i=0,s=n;return 0===e?t:1==(e/=r)?t+n:(i||(i=.3*r),s<Math.abs(n)?(s=n,o=i/4):o=i/(2*Math.PI)*Math.asin(n/s),-s*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*(2*Math.PI)/i)+t)}static easeOutElastic(e,t,n,r){let o=1.70158,i=0,s=n;return 0===e?t:1==(e/=r)?t+n:(i||(i=.3*r),s<Math.abs(n)?(s=n,o=i/4):o=i/(2*Math.PI)*Math.asin(n/s),s*Math.pow(2,-10*e)*Math.sin((e*r-o)*(2*Math.PI)/i)+n+t)}static easeInOutElastic(e,t,n,r){let o=1.70158,i=0,s=n;return 0===e?t:2==(e/=r/2)?t+n:(i||(i=r*(.3*1.5)),s<Math.abs(n)?(s=n,o=i/4):o=i/(2*Math.PI)*Math.asin(n/s),e<1?s*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*(2*Math.PI)/i)*-.5+t:s*Math.pow(2,-10*(e-=1))*Math.sin((e*r-o)*(2*Math.PI)/i)*.5+n+t)}static easeInBack(e,t,n,r,o){return void 0===o&&(o=1.70158),n*(e/=r)*e*((o+1)*e-o)+t}static easeOutBack(e,t,n,r,o){return void 0===o&&(o=1.70158),n*((e=e/r-1)*e*((o+1)*e+o)+1)+t}static easeInOutBack(e,t,n,r,o){return void 0===o&&(o=1.70158),(e/=r/2)<1?n/2*(e*e*((1+(o*=1.525))*e-o))+t:n/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t}static easeInBounce(e,t,n,r){return n-this.easeOutBounce(r-e,0,n,r)+t}static easeOutBounce(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t}static easeInOutBounce(e,t,n,r){return e<r/2?.5*this.easeInBounce(2*e,0,n,r)+t:.5*this.easeOutBounce(2*e-r,0,n,r)+.5*n+t}}class a{static get isMobile(){const e=/(iphone|ipod|ipad|android|iemobile|blackberry|bada)/.test(window.navigator.userAgent.toLowerCase());return e||["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}static get Browser(){let e;const t=function(t){let n=t.indexOf(e);if(-1===n)return;const r=t.indexOf("rv:");return"Trident"===e&&-1!==r?parseFloat(t.substring(r+3)):parseFloat(t.substring(n+e.length+1))};let n={};return n[function(){const t=[{string:navigator.userAgent,subString:"Edge",identity:"Edge"},{string:navigator.userAgent,subString:"MSIE",identity:"IE"},{string:navigator.userAgent,subString:"Trident",identity:"IE"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"Opera",identity:"Opera"},{string:navigator.userAgent,subString:"OPR",identity:"Opera"},{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"Safari",identity:"Safari"}];for(let n=0;n<t.length;n++){let r=t[n].string;if(e=t[n].subString,-1!==r.indexOf(t[n].subString))return t[n].identity}return"Other"}()]=!0,n.version=t(navigator.userAgent)||t(navigator.appVersion)||"Unknown",n}static toCamelCase(e){return e.replace(/-([a-z])/g,(function(e){return e[1].toUpperCase()}))}static toDash(e){return e.split(/(?=[A-Z])/).join("-").toLowerCase()}static unescapeHTML(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent}static escapeHTML(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(e).replace(/[&<>"'`=\/]/g,(e=>t[e]))}static sanitizeHTML(e){if(e&&(e.indexOf("onclick")>=0||e.indexOf("onload")>=0||e.indexOf("onerror")>=0))return this.escapeHTML(e);const t=new RegExp("<s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)[^>]*>(.*?)<s*/s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)>","ig");return String(e).replace(t,(e=>this.escapeHTML(e)))}static createGUID(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}static getScriptLocation(){return"./"!==window[n].BaseUrl?window[n].BaseUrl:function(){if(document.currentScript){let e=document.currentScript.src,t=e.lastIndexOf("/");return e=e.substring(0,t),e}const e=new Error;let t="(",n=")";if(Smart.Utilities.Core.Browser.Safari&&(t="@",n="\n"),e.fileName)return e.fileName.replace("/smart.element.js","");let r=e.stack.split(t);return r=r[1],r=r.split(n)[0],r=r.split(":"),r.splice(-2,2),r=r.join(":"),r.replace("/smart.element.js","")}()}static CSSVariablesSupport(){return window.CSS&&window.CSS.supports&&window.CSS.supports("(--fake-var: 0)")}static assign(e,t){const n=e=>e&&"object"==typeof e&&!Array.isArray(e)&&null!==e;let r=Object.assign({},e);return n(e)&&n(t)&&Object.keys(t).forEach((o=>{n(t[o])?o in e?r[o]=this.assign(e[o],t[o]):Object.assign(r,{[o]:t[o]}):Object.assign(r,{[o]:t[o]})})),r}static html(e,t){const n=this;let r="",o=e.childNodes;if(!t){for(let e,t=0,i=o.length;t<i&&(e=o[t]);t++){const t=["strong"];if(e instanceof HTMLElement||e.tagName&&t.indexOf(e.tagName.toLowerCase())>=0){const t=e.tagName.toLowerCase(),o=e.attributes;let i="<"+t;for(let e,t=0;e=o[t];t++)i+=" "+e.name+'="'+e.value.replace(/[&\u00A0"]/g,y.Core.escapeHTML)+'"';i+=">",["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"][t]&&(r+=i),r=r+i+n.html(e)+"</"+t+">"}else{if(8===e.nodeType)continue;r+=e.textContent.replace(/[&\u00A0<>]/g,y.Core.escapeHTML)}}return r}{const n=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi;e.innerHTML=t.replace(n,"<$1></$2>")}}}let l=[];class d{static watch(e){switch(e.nodeName.toLowerCase()){case"smart-grid":case"smart-kanban":case"smart-table":case"smart-pivot-table":case"smart-scheduler":case"smart-tabs":case"smart-card-view":case"smart-list-box":case"smart-combo-box":case"smart-drop-down-list":case"smart-calendar":case"smart-gauge":case"smart-numeric-text-box":case"smart-menu":case"smart-tree":l.push(e);break;default:return}d.start()}static start(){d.isStarted||(d.isStarted=!0,d.interval&&clearInterval(d.interval),0===l.length||document.hidden?d.isStarted=!1:d.interval=setInterval((function(){d.observe()}),100))}static stop(){d.isStarted=!1,d.interval&&clearInterval(d.interval)}static observeElement(e){const t=e;if("test"===window.Smart.Mode||document.hidden)return void(d.interval&&clearInterval(d.interval));let n=e._computedStyle||"resize"!==t.hasStyleObserver?document.defaultView.getComputedStyle(t,null):{},r=!0,o="resize"!==t.hasStyleObserver?["paddingLeft","paddingRight","paddingTop","paddingBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","display","visibility","font-size","font-family","font-style","font-weight","max-height","min-height","max-width","min-width","overflow","overflow-x","overflow-y"]:[];if(e.styleProperties&&(o=o.concat(e.styleProperties)),e.observableStyleProperties&&(o=e.observableStyleProperties),!t._styleInfo){t._styleInfo=[];for(let e=0;e<o.length;e++){const r=o[e],i=r.startsWith("--")?n.getPropertyValue(r):n[r];t._styleInfo[r]=i}return}if(e.isHidden||"none"!==n.display&&(0!==e.offsetWidth&&0!==e.offsetHeight||(e.isHidden=!0)),e.isHidden){if(e.visibilityChangedHandler(),e.isHidden)return;r=!1}let i=[];for(let e=0;e<o.length;e++){const r=o[e],s=r.startsWith("--")?n.getPropertyValue(r):n[r];t._styleInfo[r]!==s&&(i[r]={oldValue:t._styleInfo[r],value:s},i.length++),t._styleInfo[r]=s}i.length>0&&(t.$.fireEvent("styleChanged",{styleProperties:i},{bubbles:!1,cancelable:!0}),i.display&&r&&t.$.fireEvent("resize",t,{bubbles:!1,cancelable:!0}))}static observe(){for(let e=0;e<l.length;e++){const t=l[e];this.observeElement(t)}}static unwatch(e){d.stop();const t=l.indexOf(e);-1!==t&&l.splice(t,1),d.start()}}let c=[];const u=[],p=["resize","down","up","move","tap","taphold","swipeleft","swiperight","swipetop","swipebottom"];class h{constructor(e){const t=this;t.target=e,t.$target=new f(e),t.$document=e.$document?e.$document:new f(document),t.id=(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase();let n={handlers:{},boundEventTypes:[],listen:t.listen.bind(t),unlisten:t.unlisten.bind(t)};return t.tapHoldDelay=750,t.swipeMin=10,t.swipeMax=5e3,t.swipeDelay=1e3,t.tapHoldDelay=750,t.inputEventProperties=["clientX","clientY","pageX","pageY","screenX","screenY"],p.forEach((e=>{n[e]=t=>{n.handlers[e]=t},t[e]=e=>{if(!n.handlers[e.type]){if(("mousemove"===e.type||"pointermove"===e.type||"touchmove"===e.type)&&n.handlers.move){const r=t.createEvent(e,"move");n.handlers.move(r)}return!0}return n.handlers[e.type](e)}})),t.listen(),t.handlers=n.handlers,n}listen(e){const t=this;if("resize"===e&&t.target!==document&&t.target!==window&&!1!==t.target.hasResizeObserver)if(Smart.Utilities.Core.Browser.Firefox){if(!t.target.resizeObserver){let e,n,r,o=!1,i=t.target.offsetWidth,s=t.target.offsetHeight;const a=new ResizeObserver((()=>{if(!o)return void(o=!0);const a=new CustomEvent("resize",{bubbles:!1,cancelable:!0});n=t.target.offsetWidth,r=t.target.offsetHeight,e=n!==i||r!==s,t.target.requiresLayout&&(e=!0),e&&(t.resize(a),t.target.requiresLayout=!1)}));a.observe(t.target),t.target.resizeObserver=a}}else if(!t.target.resizeTrigger){const e=document.createElement("div");e.className="smart-resize-trigger-container",e.innerHTML='<div class="smart-resize-trigger-container"><div class="smart-resize-trigger"></div></div><div class="smart-resize-trigger-container"><div class="smart-resize-trigger-shrink"></div></div>',e.setAttribute("aria-hidden",!0),window[n].EnableShadowDOM&&t.target.shadowRoot?t.target.shadowRoot.appendChild(e):t.target.appendChild(e),t.target.resizeTrigger=e;const r=e.childNodes[0],o=r.childNodes[0],i=e.childNodes[1],s=function(){o.style.width="100000px",o.style.height="100000px",r.scrollLeft=1e5,r.scrollTop=1e5,i.scrollLeft=1e5,i.scrollTop=1e5};let a,l,d,c,u=t.target.offsetWidth,p=t.target.offsetHeight;if(0===u||0===p){const e=function(){s(),t.target.removeEventListener("resize",e)};t.target.addEventListener("resize",e),s()}else s();t.target.resizeHandler=function(){l||(l=requestAnimationFrame((function(){if(l=0,d=t.target.offsetWidth,c=t.target.offsetHeight,a=d!==u||c!==p,t.target.requiresLayout&&(a=!0),!a)return;u=d,p=c;const e=new CustomEvent("resize",{bubbles:!1,cancelable:!0});t.resize(e),t.target.requiresLayout=!1}))),s()},r.addEventListener("scroll",t.target.resizeHandler),i.addEventListener("scroll",t.target.resizeHandler)}t.isListening||(t.isListening=!0,t.isPressed=!1,t.isReleased=!1,t.isInBounds=!1,window.PointerEvent?(t.$target.listen("pointerdown.inputEvents"+t.id,t.pointerDown.bind(t)),t.$target.listen("pointerup.inputEvents"+t.id,t.pointerUp.bind(t)),t.$target.listen("pointermove.inputEvents"+t.id,t.pointerMove.bind(t)),t.$target.listen("pointercancel.inputEvents"+t.id,t.pointerCancel.bind(t))):("ontouchstart"in window&&(t.$target.listen("touchmove.inputEvents"+t.id,t.touchMove.bind(t)),t.$target.listen("touchstart.inputEvents"+t.id,t.touchStart.bind(t)),t.$target.listen("touchend.inputEvents"+t.id,t.touchEnd.bind(t)),t.$target.listen("touchcancel.inputEvents"+t.id,t.touchCancel.bind(t))),t.$target.listen("mousedown.inputEvents"+t.id,t.mouseDown.bind(t)),t.$target.listen("mouseup.inputEvents"+t.id,t.mouseUp.bind(t)),t.$target.listen("mousemove.inputEvents"+t.id,t.mouseMove.bind(t)),t.$target.listen("mouseleave.inputEvents"+t.id,t.mouseLeave.bind(t))),t.target._handleDocumentUp||(t.target._handleDocumentUp=t.handleDocumentUp.bind(t),t.target._handleDocumentUpId=t.id,t.$document.listen("mouseup.inputEvents"+t.target._handleDocumentUpId,t.target._handleDocumentUp)))}unlisten(e){const t=this;if(t.isListening=!1,window.PointerEvent?(t.$target.unlisten("pointerdown.inputEvents"+t.id),t.$target.unlisten("pointerup.inputEvents"+t.id),t.$target.unlisten("pointermove.inputEvents"+t.id),t.$target.unlisten("pointercancel.inputEvents"+t.id)):("ontouchstart"in window&&(t.$target.unlisten("touchstart.inputEvents"+t.id),t.$target.unlisten("touchmove.inputEvents"+t.id),t.$target.unlisten("touchend.inputEvents"+t.id),t.$target.unlisten("touchcancel.inputEvents"+t.id)),t.$target.unlisten("mousedown.inputEvents"+t.id),t.$target.unlisten("mouseup.inputEvents"+t.id),t.$target.unlisten("mousemove.inputEvents"+t.id),t.$target.unlisten("mouseleave.inputEvents"+t.id)),t.target._handleDocumentUp&&(t.$document.unlisten("mouseup.inputEvents"+t.target._handleDocumentUpId,t.target._handleDocumentUp),delete t.target._handleDocumentUp,delete t.target._handleDocumentUpId),"resize"===e)if(Smart.Utilities.Core.Browser.Firefox)t.target.resizeObserver&&(t.target.resizeObserver.unobserve(t.target),delete t.target.resizeObserver);else if(t.target.resizeTrigger){const e=t.target.resizeTrigger,n=e.childNodes[0],r=e.childNodes[1];n.removeEventListener("scroll",t.target.resizeHandler),r.removeEventListener("scroll",t.target.resizeHandler),t.target.resizeHandler=null,e.parentNode.removeChild(e),delete t.target.resizeTrigger}}handleDocumentUp(e){const t=this;t.isPressed=!1,t.isReleased=!1,t.resetSwipe(e)}createEvent(e,t){const n=this,r=e.touches,o=e.changedTouches,i=r&&r.length?r[0]:o&&o.length?o[0]:void 0,s=new CustomEvent(t,{bubbles:!0,cancelable:!0,composed:void 0!==n.$target.element.getRootNode().host});if(s.originalEvent=e,i){for(let e=0;e<n.inputEventProperties.length;e++){const t=n.inputEventProperties[e];s[t]=i[t]}return s}for(let t in e)t in s||(s[t]=e[t]);return s}fireTap(e){const t=this;if(clearTimeout(this.tapHoldTimeout),!this.tapHoldFired&&this.isInBounds){const n=t.createEvent(e,"tap");t.tap(n)}}initTap(e){const t=this;t.isInBounds=!0,t.tapHoldFired=!1,t.tapHoldTimeout=setTimeout((function(){if(t.isInBounds){t.tapHoldFired=!0;const n=t.createEvent(e,"taphold");t.taphold(n)}}),t.tapHoldDelay)}pointerDown(e){return this.handleDown(e)}mouseDown(e){const t=this;if(!(t.isPressed||t.touchStartTime&&new Date-t.touchStartTime<500))return t.handleDown(e)}touchStart(e){const t=this;return t.touchStartTime=new Date,t.isTouchMoved=!0,t.handleDown(e)}mouseUp(e){const t=this;if(!(t.isReleased||t.touchEndTime&&new Date-t.touchEndTime<500))return t.handleUp(e)}handleDown(e){const t=this;t.isReleased=!1,t.isPressed=!0;const n=t.createEvent(e,"down");return(t.handlers.tap||t.handlers.taphold)&&t.initTap(n),(t.handlers.swipeleft||t.handlers.swiperight||t.handlers.swipetop||t.handlers.swipebottom)&&t.initSwipe(n),t.down(n)}handleUp(e){const t=this;t.isReleased=!0,t.isPressed=!1;const n=t.createEvent(e,"up"),r=t.up(n);return(t.handlers.tap||t.handlers.taphold)&&t.fireTap(n),t.resetSwipe(n),r}handleMove(e){const t=this;let n=t.move(e);return t.isPressed&&(t._maxSwipeVerticalDistance=Math.max(t._maxSwipeVerticalDistance,Math.abs(t._startY-e.pageY)),t._maxSwipeHorizontalDistance=Math.max(t._maxSwipeHorizontalDistance,Math.abs(t._startX-e.pageX)),n=t.handleSwipeEvents(e)),n}touchEnd(e){return this.touchEndTime=new Date,this.handleUp(e)}pointerUp(e){return this.handleUp(e)}pointerCancel(e){this.pointerUp(e)}touchCancel(e){this.touchEnd(e)}mouseLeave(){this.isInBounds=!1}mouseMove(e){if(!this.isTouchMoved)return this.handleMove(e)}pointerMove(e){return this.handleMove(e)}touchMove(e){const t=this,n=e.touches,r=e.changedTouches,o=n&&n.length?n[0]:r&&r.length?r[0]:void 0;for(let n=0;n<t.inputEventProperties.length;n++){const r=t.inputEventProperties[n];void 0===e[r]&&(e[r]=o[r])}return t.isTouchMoved=!0,t.handleMove(e)}handleSwipeEvents(e){const t=this;let n=!0;return(t.handlers.swipetop||t.handlers.swipebottom)&&(n=this.handleVerticalSwipeEvents(e)),!1===n||(t.handlers.swipeleft||t.handlers.swiperight)&&(n=this.handleHorizontalSwipeEvents(e)),n}handleVerticalSwipeEvents(e){let t,n;return t=e.pageY,n=t-this._startY,this.swiped(e,n,"vertical")}handleHorizontalSwipeEvents(e){let t,n;return t=e.pageX,n=t-this._startX,this.swiped(e,n,"horizontal")}swiped(e,t,n){const r=this;if(n=n||0,Math.abs(t)>=r.swipeMin&&!r._swipeEvent&&!r._swipeLocked){let o=t<0?"swipeleft":"swiperight";if("horizontal"===n?r._swipeEvent=r.createEvent(e,o):(o=t<0?"swipetop":"swipebottom",r._swipeEvent=r.createEvent(e,t<0?"swipetop":"swipebottom")),r[o]&&(r[o](this._swipeEvent),Math.abs(t)<=this.swipeMax))return e.stopImmediatePropagation(),!1}return!0}resetSwipe(){this._swipeEvent=null,clearTimeout(this._swipeTimeout)}initSwipe(e){const t=this;t._maxSwipeVerticalDistance=0,t._maxSwipeHorizontalDistance=0,t._startX=e.pageX,t._startY=e.pageY,t._swipeLocked=!1,t._swipeEvent=null,t._swipeTimeout=setTimeout((function(){t._swipeLocked=!0}),t.swipeDelay)}}class m{get scrollWidth(){const e=this;return e.horizontalScrollBar?e.horizontalScrollBar.max:-1}set scrollWidth(e){const t=this;e<0&&(e=0),t.horizontalScrollBar&&(t.horizontalScrollBar.max=e)}get scrollHeight(){const e=this;return e.verticalScrollBar?e.verticalScrollBar.max:-1}set scrollHeight(e){const t=this;e<0&&(e=0),t.verticalScrollBar&&(t.verticalScrollBar.max=e)}get scrollLeft(){const e=this;return e.horizontalScrollBar?e.horizontalScrollBar.value:-1}set scrollLeft(e){const t=this;e<0&&(e=0),t.horizontalScrollBar&&(t.horizontalScrollBar.value=e)}get scrollTop(){const e=this;return e.verticalScrollBar?e.verticalScrollBar.value:-1}set scrollTop(e){const t=this;e<0&&(e=0),t.verticalScrollBar&&(t.verticalScrollBar.value=e)}get vScrollBar(){return this.verticalScrollBar}get hScrollBar(){return this.horizontalScrollBar}constructor(e,t,n){const r=this;r.container=e,r.horizontalScrollBar=t,r.verticalScrollBar=n,r.disableSwipeScroll=!1,r.listen()}listen(){const e=this,t=a.isMobile,n=e.horizontalScrollBar,r=e.verticalScrollBar;let o,i,s,l,d,c,u,p;e.inputEvents=new h(e.container);const m=function(e){return{amplitude:0,delta:0,initialValue:0,min:0,max:e.max,previousValue:0,pointerPosition:0,targetValue:0,scrollBar:e,value:0,velocity:0}},f=m(n),g=m(r),w=function(){const t=e.container.touchVelocityCoefficient||50;c=Date.now(),u=c-l,l=c;const n=function(e){e.delta=e.value-e.previousValue,e.previousValue=e.value;let n=t*e.delta/(1+u);e.velocity=.8*n+.2*e.velocity};n(g),n(f)},b=function(e){return p.value=e>p.max?p.max:e<p.min?p.min:e,p.scrollBar.value=p.value,e>p.max?"max":e<p.min?"min":"value"};function v(){let t,n;p.amplitude&&(e.container.$.fireEvent("kineticScroll"),t=Date.now()-l,n=-p.amplitude*Math.exp(-t/500),n>5||n<-5?(b(p.targetValue+n),cancelAnimationFrame(i),i=0,i=requestAnimationFrame(v)):b(p.targetValue))}let _;e.inputEvents.down((function(n){if(!t)return;const r=n.originalEvent.target,i=r&&r.closest?r.closest("smart-scroll-bar"):void 0;if(i===e.horizontalScrollBar||i===e.verticalScrollBar)return;s=!0,o=!1;const a=function(e,t){e.amplitude=0,e.pointerPosition=t,e.previousValue=e.value,e.value=e.scrollBar.value,e.initialValue=e.value,e.max=e.scrollBar.max};a(g,n.clientY),a(f,n.clientX),l=Date.now(),clearInterval(d),d=setInterval(w,500)})),e.inputEvents.up((function(){if(!s)return!0;if(clearInterval(d),e.disableSwipeScroll)return void(s=!1);const t=function(e){p=e,e.amplitude=.8*e.velocity,e.targetValue=Math.round(e.value+e.amplitude),l=Date.now(),cancelAnimationFrame(i),i=requestAnimationFrame(v),e.velocity=0};g.velocity>10||g.velocity<-10?t(g):(f.velocity>10||f.velocity<-10)&&t(f),s=!1})),e.inputEvents.move((function(t){if(!s)return!0;if(e.disableSwipeScroll)return;if(o&&(t.originalEvent.preventDefault(),t.originalEvent.stopPropagation()),f.visible=e.scrollWidth>0,g.visible=e.scrollHeight>0,!s||!f.visible&&!g.visible)return;const n=e.container.touchScrollRatio,r=e.container;let i,a;n&&("number"==typeof n?(i=-n,a=-n):"function"==typeof n&&(i=n(g.max,r.offsetHeight),a=n(f.max,r.offsetWidth))),g.ratio=i||-g.max/r.offsetHeight,g.delta=(t.clientY-g.pointerPosition)*g.ratio,f.ratio=a||-f.max/r.offsetWidth,f.delta=(t.clientX-f.pointerPosition)*f.ratio;let l="value";const d=function(t,n,r){return t.delta>5||t.delta<-5?(p=t,l=t.initialValue+t.delta>p.max?"max":t.initialValue+t.delta<p.min?"min":"value","min"===l&&0===t.initialValue||"max"===l&&t.initialValue===t.max||!t.visible||(e.container.$.fireEvent("kineticScroll"),b(t.initialValue+t.delta),w(),r.originalEvent.preventDefault(),r.originalEvent.stopPropagation(),o=!0,!1)):null};let c=d(g,t.clientY,t);if(null!==c)return c;{let e=d(f,t.clientX,t);if(null!==e)return e}})),e.scrollTo=function(t,n){const r=!1===n?f:g;let o=!1;l||(l=Date.now()),_||(_=Date.now()),Math.abs(Date.now()-_)>375?l=Date.now():o=!0,_=Date.now(),r.value=r.scrollBar.value,r.delta=t-r.value,r.max=r.scrollBar.max,t<=r.min&&(t=r.min),t>=r.max&&(t=r.max),r.targetValue=t;const s=t;let a=r.value;r.velocity=100*r.delta/(1+r.max),r.from=a;const d=function(e){return r.value=e>r.max?r.max:e<r.min?r.min:e,r.scrollBar.value=r.value,e>r.max?"max":e<r.min?"min":"value"},c=function(){let n,u=Date.now()-_,p=Math.min(1e3,Date.now()-l),h=r.velocity*Math.exp(p/175);if(o)(h<0&&r.value<=t||h>0&&r.value>=t)&&(h=0),(r.value+h<=r.min||r.value+h>=r.max)&&(h=0),h>.5||h<-.5?(d(r.value+h),cancelAnimationFrame(i),i=0,i=requestAnimationFrame(c)):d(r.targetValue);else{if(u>=175)return cancelAnimationFrame(i),e.container.$.fireEvent("kineticScroll"),void(i=0);n=y.Animation.Easings.easeInSine(u,a,s-a,175),d(n),cancelAnimationFrame(i),i=0,i=requestAnimationFrame(c)}};cancelAnimationFrame(i),i=requestAnimationFrame(c)},e.inputEvents.listen()}unlisten(){const e=this;e.inputEvents&&e.inputEvents.unlisten(),delete e.inputEvents}}class f{constructor(e){this.events={},this.handlers={},this.element=e}hasClass(e){const t=this,n=e.split(" ");for(let e=0;e<n.length;e++)if(!t.element.classList.contains(n[e]))return!1;return!0}addClass(e){const t=this;if(t.hasClass(e))return;const n=e.split(" ");for(let e=0;e<n.length;e++)t.element.classList.add(n[e]);t.isNativeElement||d.observeElement(t.element)}removeClass(e){const t=this;if(0===arguments.length)return void t.element.removeAttribute("class");const n=e.split(" ");for(let e=0;e<n.length;e++)t.element.classList.remove(n[e]);""===t.element.className&&t.element.removeAttribute("class"),t.isNativeElement||d.observeElement(t.element)}get isCustomElement(){const e=this;return!!e.element.tagName.startsWith(n)||e.element instanceof window[n].BaseElement==1||"DIV"!==e.element.tagName&&"SPAN"!==e.element.tagName&&"BUTTON"!==e.element.tagName&&"INPUT"!==e.element.tagName&&"UL"!==e.element.tagName&&"LI"!==e.element.tagName&&document.createElement(e.element.nodeName)instanceof window[n].BaseElement==1}get isNativeElement(){return!this.isCustomElement}dispatch(e){const t=this,n=t.events[e.type];let r=!1;if(n.length>1)for(let e=0;e<n.length;e++){const t=n[e];if(t.namespace&&t.namespace.indexOf("_")>=0){r=!0;break}}r&&n.sort((function(e,t){let n=e.namespace,r=t.namespace;return n=-1===n.indexOf("_")?0:parseInt(n.substring(n.indexOf("_")+1)),r=-1===r.indexOf("_")?0:parseInt(r.substring(r.indexOf("_")+1)),n<r?-1:n>r?1:0}));for(let r=0;r<n.length;r++){const o=n[r];if(e.namespace=o.namespace,e.context=o.context,e.defaultPrevented)break;const i=o.handler.apply(t.element,[e]);if(void 0!==i&&(e.result=i,!1===i)){e.preventDefault(),e.stopPropagation();break}}return e.result}fireEvent(e,t,n){const r=this;n||(n={bubbles:!0,cancelable:!0,composed:null!==r.element.getRootNode().host}),n.detail=t||{};const o=new CustomEvent(e,n);return o.originalStopPropagation=o.stopPropagation,o.stopPropagation=function(){return o.isPropagationStopped=!0,o.originalStopPropagation()},r.dispatchEvent(o),o}get isPassiveSupported(){const e=this;if(void 0!==e.supportsPassive)return e.supportsPassive;e.supportsPassive=!1;try{let t=Object.defineProperty({},"passive",{get:function(){e.supportsPassive=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}return e.supportsPassive}dispatchEvent(e){const t=this,n=e.type,r=t.element.context,o=n.substring(0,1).toUpperCase()+n.substring(1);t.element.context=document,t.element["on"+o]?t.element["on"+o](e):t.element["on"+n.toLowerCase()]?t.element["on"+n.toLowerCase()](e):t.element.dispatchEvent(e),t.element.context=r}listen(e,t){const n=this,r=e.split("."),o=r.slice(1).join("."),i=r[0];n.events[i]||(n.events[i]=[]);const s={type:i,handler:t,context:n.element,namespace:o};p.indexOf(i)>=0&&(n.inputEvents||(n.inputEvents=new h(n.element)),n.inputEvents[i]((function(e){n.dispatchEvent(e)})),n.inputEvents.boundEventTypes.push(i),n.inputEvents.listen(i)),0===n.events[i].length&&(n.handlers[i]=n.dispatch.bind(n),"wheel"===i?n.element.addEventListener("wheel",n.handlers[i],!!n.isPassiveSupported&&{passive:!1}):"touchmove"===i||"touchstart"===i||"touchend"===i?n.element.addEventListener(i,n.handlers[i],!!n.isPassiveSupported&&{passive:!1}):n.element.addEventListener(i,n.handlers[i],!1)),n.events[i].push(s)}unlisten(e){const t=this,n=e.split("."),r=n.slice(1).join("."),o=n[0];let i=t.events[o];if(t.inputEvents&&t.inputEvents.boundEventTypes.indexOf(o)>=0&&(t.inputEvents.boundEventTypes.splice(t.inputEvents.boundEventTypes.indexOf(o),1),0===t.inputEvents.boundEventTypes.length&&t.inputEvents.unlisten(o)),i){for(let e=0;e<i.length;e++){if(""!==r){let e=i.findIndex((e=>e.namespace===r));i.splice(e,1);break}i=[]}0===i.length&&(t.element.removeEventListener(o,t.handlers[o]),t.events[o]=[],delete t.handlers[o])}}getAttributeValue(e,t){const n=this,r=n.element.getAttribute(e);if(n.isNativeElement)return n.deserialize(r,t);const o=n.element.propertyByAttributeName[e];return void 0===o.deserialize?n.deserialize(r,t,o.nullable):n.element[o.deserialize](r)}setAttributeValue(e,t,n){const r=this;let o,i=!1;if(r.isNativeElement){if(o=r.serialize(t,n),"boolean"===n&&["checked","selected","async","autofocus","autoplay","controls","defer","disabled","hidden","ismap","loop","multiple","open","readonly","required","scoped"].indexOf(e)>=0)return void(t?r.element.setAttribute(e,""):r.element.removeAttribute(e))}else{const s=r.element.propertyByAttributeName[e];i=!s||s.nullable,o=s&&s.serialize?r.element[s.serialize](t):r.serialize(t,n,i)}"array"!==n&&"object"!==n||"[]"!==o&&"{}"!==o?void 0===o?(r.element.removeAttribute(e),r.element.shadowRoot&&r.element.$.root&&r.element.$.root.removeAttribute(e)):(r.element.setAttribute(e,o),r.element.shadowRoot&&r.element.$.root&&r.element.$.root.setAttribute(e,o)):r.element.removeAttribute(e)}serialize(e,t,n){if(void 0===t&&(t=y.Types.getType(e)),void 0!==e&&(n||null!==e)){if(n&&null===e)return"null";if("string"===t)return e;if("boolean"===t||"bool"===t){if(!0===e||"true"===e||1===e||"1"===e)return"";if(!1===e||"false"===e||0===e||"0"===e)return}return"array"===t?JSON.stringify(e):["string","number","int","integer","float","date","any","function"].indexOf(t)>=0?e.toString():"object"===t?JSON.stringify(e):void 0}}deserialize(e,t,n){const r="null"===e;if(void 0!==e&&(!r||n)){if(r&&n)return null;if("boolean"===t||"bool"===t)return null!==e;if("number"===t||"float"===t)return"NaN"===e?NaN:"Infinity"===e?1/0:"-Infinity"===e?-1/0:parseFloat(e);if("int"===t||"integer"===t)return"NaN"===e?NaN:"Infinity"===e?1/0:"-Infinity"===e?-1/0:parseInt(e);if("string"===t)return e;if("any"===t)return e;if("date"===t)return new Date(e);if("function"===t){if("function"==typeof window[e])return window[e]}else if("array"===t||"object"===t)try{const t=JSON.parse(e);if(t)return t}catch(n){if(window[e]&&"object"==typeof window[e])return window[e];if("array"===t&&e.indexOf("[")>=0){if(e.indexOf("{")>=0){let t=e.replace(/{/gi,"").replace("[","").replace("]","").replace(/'/gi,"").replace(/"/gi,"").trim();t=t.split("},");for(let e=0;e<t.length;e++){let n={},r=t[e].trim().split(",");for(let e=0;e<r.length;e++){const t=r[e].split(":")[0].trim(),o=r[e].split(":")[1].trim();n[t]=o}t[e]=n}return t}return e.replace("[","").replace("]","").replace(/'/gi,"").replace(/"/gi,"").trim().split(",")}}}}}class g{static get Ripple(){return i}static get Easings(){return s}}class y{static get Types(){return o}static get Core(){return a}static get Animation(){return g}static get Scroll(){return m}static get InputEvents(){return h}static Extend(e){return new f(e)}static Assign(e,t){if(e.indexOf(".")>=0){const n=e.split(".");return y[n[0]]||(y[n[0]]={}),void(y[n[0]][n[1]]=t)}y[e]=t}}const w=y.Extend(document);let b=null;document.addEventListener("click",(()=>{d.start(),b&&clearTimeout(b),b=setTimeout((()=>{d.stop()}),1e4)})),document.addEventListener("mouseenter",(()=>{d.start()})),document.addEventListener("mouseleave",(()=>{d.stop()}));class v{}v.cache={};class _ extends HTMLElement{static get properties(){return{animation:{value:"advanced",type:"string",allowedValues:["none","simple","advanced"]},unfocusable:{value:!1,type:"boolean"},disabled:{value:!1,type:"boolean"},dataContext:{value:null,reflectToAttribute:!1,type:"any"},debugMode:{value:!0,type:"boolean",reflectToAttribute:!1},locale:{value:"en",type:"string",reflectToAttribute:!1},localizeFormatFunction:{value:null,type:"any",reflectToAttribute:!1},messages:{value:{en:{propertyUnknownName:"Invalid property name: '{{name}}'!",propertyUnknownType:"'{{name}}' property is with undefined 'type' member!",propertyInvalidValue:"Invalid '{{name}}' property value! Actual value: '{{actualValue}}', Expected value: '{{value}}'!",propertyInvalidValueType:"Invalid '{{name}}' property value type! Actual type: '{{actualType}}', Expected type: '{{type}}'!",methodInvalidValueType:"Invalid '{{name}}' method argument value type! Actual type: '{{actualType}}', Expected type: '{{type}}' for argument with index: '{{argumentIndex}}'!",methodInvalidArgumentsCount:"Invalid '{{name}}' method arguments count! Actual arguments count: '{{actualArgumentsCount}}', Expected at least: '{{argumentsCount}}' argument(s)!",methodInvalidReturnType:"Invalid '{{name}}' method return type! Actual type: '{{actualType}}', Expected type: '{{type}}'!",elementNotInDOM:"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",moduleUndefined:"Module is undefined.",missingReference:"{{elementType}}: Missing reference to '{{files}}'.",htmlTemplateNotSuported:"{{elementType}}: Web Browser doesn't support HTMLTemplate elements.",invalidTemplate:"{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."}},reflectToAttribute:!1,inherit:!0,type:"object"},props:{value:null,reflectToAttribute:!1,isHierarchicalProperty:!0,type:"any"},readonly:{value:!1,type:"boolean"},renderMode:{value:"auto",type:"string",reflectToAttribute:!1,allowedValues:["auto","manual"]},rightToLeft:{value:!1,type:"boolean"},rethrowError:{value:!0,type:"boolean",reflectToAttribute:!1},theme:{value:window[n].Theme,type:"string"},visibility:{value:"visible",allowedValues:["visible","collapsed","hidden"],type:"string"},wait:{value:!1,type:"boolean"}}}getBindings(e,t){const n=this;let r=0,o={},i=(e=>{if(e instanceof HTMLElement)return n.parseAttributes(e);{let t=n.parseProperty(e.data?e.data.trim():null,"textContent",e);if(t)return n&&e.parentNode===n.$.content&&(t.value=""!==n.$.html?n.$.html:void 0,n.innerHTML=""),{textContent:t}}})(e);i&&(o.data=i),t||(o.mapping=[],t=o),e.getAttribute&&(o.nodeId=e.getAttribute("smart-id"),t&&i&&(t.mapping[o.nodeId]=i)),o.node=e,e.firstChild&&(o.children={});for(let i=e.firstChild;i;i=i.nextSibling)o.children[r++]=n.getBindings(i,t);return o}_addRemovePropertyBinding(e,t,n,r,o){if(!e||!t||!n)return;const i=this,s=i.bindings,a=n.getAttribute("smart-id"),l=e.indexOf("{{")>=0;let d=!1;(e=e.replace("{{","").replace("}}","").replace("[[","").replace("]]","")).indexOf("!")>=0&&(e=e.replace("!",""),d=!0);const c=i._properties[e],u={name:e,reflectToAttribute:c.reflectToAttribute,twoWay:l,type:c.type,not:d};if(o&&!r){const n={},r={name:e,targetPropertyName:t,reflectToAttribute:c.reflectToAttribute,twoWay:l,type:c.type,not:d};n[e]=r,s.mapping[a]=n}const p=function(e){for(let o in e){const s=e[o];if(s.nodeId===a){s.data||(s.data={}),r?(s.data[t]=null,delete s.data[t]):s.data[t]=u;break}if(s.children)p(s.children);else if(s.node&&s.node.children&&s.node===n.parentElement){const e=s.node;if(!e.firstChild)continue;s.children={};let t=0;for(let n=e.firstChild;n;n=n.nextSibling)s.children[t++]=i.getBindings(n);p(s.children)}}};p(s.children),r?delete i.boundProperties[e]:i.boundProperties[e]=!0,i.updateBoundNodes(e)}addPropertyBinding(e,t,n,r){this._addRemovePropertyBinding(e,t,n,!1,r)}removePropertyBinding(e,t,n,r){this._addRemovePropertyBinding(e,t,n,!0,r)}parseAttributes(e){const t=this;let n;for(let r=0;r<e.attributes.length;r++){const o=e.attributes[r],i=o.name,s=o.value;v.cache["toCamelCase"+i]||(v.cache["toCamelCase"+i]=y.Core.toCamelCase(i));const a=v.cache["toCamelCase"+i];if(i.indexOf("(")>=0){let r=i.substring(1,i.length-1);if(t&&!t.dataContext){t.templateListeners[e.getAttribute("smart-id")+"."+r]=s,e.removeAttribute(i);continue}{n||(n={});const e=s.substring(0,s.indexOf("("));n[a]={isEvent:!0,name:r,value:e};continue}}let l=t.parseProperty(s,i,e);l&&(n||(n={}),n[a]=l)}return n}parseProperty(e,t){if(!e||!e.length)return;const n=this;let r,o=e.length,i=0,s=0,a=0,l=!0;for(;s<o;){i=e.indexOf("{{",s);let t=e.indexOf("[[",s),n="}}";if(t>=0&&(i<0||t<i)&&(i=t,l=!1,n="]]"),a=i<0?-1:e.indexOf(n,i+2),a<0)return;r=r||{};let o=e.slice(i+2,a).trim();r.name=o,s=a+2}const d=r.name,c=n?n._properties[d]:null;return r.twoWay=l,r.ready=!1,n&&(d.indexOf("::")>=0?n.boundProperties[d.substring(0,d.indexOf("::"))]=!0:n.boundProperties[d]=!0),c?(r.type=c.type,r.reflectToAttribute=c.reflectToAttribute):(["checked","selected","async","autofocus","autoplay","controls","defer","disabled","hidden","ismap","loop","multiple","open","readonly","required","scoped"].indexOf(t)>=0?r.type="boolean":r.type="string",r.reflectToAttribute=!0),r}updateTextNodes(){const e=this;e.updateTextNode(e.shadowRoot||e,e.bindings,e)}updateTextNode(e,t,n){const r=this;if(!t)return;let o=0;for(let i=e.firstChild;i&&t.children;i=i.nextSibling)r.updateTextNode(i,t.children[o++],n);if(t&&t.data)for(let e in t.data){const r=t.data[e],o=r.name;"textContent"===e&&r.twoWay&&!r.updating&&void 0!==r.value&&(n[o]=r.value)}}updateBoundProperty(e,t){if(t.updating)return;const n=this;t.updating=!0,n[e]=t.value,t.updating=!1}updateBoundNodes(e){const t=this;if(t.updateBoundNode(t.shadowRoot||t,t.bindings,t,e),t.detachedChildren.length>0)for(let n=0;n<t.detachedChildren.length;n++){const r=t.detachedChildren[n],o=r.getAttribute("smart-id"),i=function(e){if(e.nodeId===o)return e;for(let t in e.children){const n=e.children[t];if((n.getAttribute?n.getAttribute("smart-id"):"")===o)return e;if(n.children){const e=i(n);if(e)return e}}return null},s=i(t.bindings);if(s)t.updateBoundNode(r,s,t,e,!0);else if(r.getAttribute&&t.bindings.mapping){const n=t,r=t.bindings;if(r)for(let o in r.mapping){const i=n.querySelector('[smart-id="'+o+'"]');if(i){const s=r.mapping[o];t.updateBoundData(i,s,n,e)}}}}}updateBoundMappedNodes(){const e=this,t=e.bindings,n=e;if(t.mapping)for(let r in t.mapping){let o=n.querySelector('[smart-id="'+r+'"]');if(n.shadowRoot&&(o=n.querySelector('[id="'+r+'"]'),o||(o=n.shadowRoot.querySelector('[id="'+r+'"]')||n.shadowRoot.querySelector('[smart-id="'+r+'"]'))),o){const i=t.mapping[r];e.updateBoundData(o,i,n)}else if(n.getAttribute("aria-controls")){let i=document.getElementById(n.getAttribute("aria-controls"));if(!i&&n.shadowRoot&&(i=n.shadowRoot.getElementById(n.getAttribute("aria-controls"))),o=i.querySelector('[smart-id="'+r+'"]'),o){const i=t.mapping[r];e.updateBoundData(o,i,n)}}}}updateBoundNode(e,t,n,r,o){const i=this;if(!t)return;let s=0;if(o){if(o&&!t.data)for(let a=e.firstChild;a&&t.children;a=a.nextSibling)if(a.getAttribute){const e=a.getAttribute("smart-id"),o=function(){for(let n in t.children)if(t.children[n].nodeId===e)return t.children[n]}();i.updateBoundNode(a,o,n,r),s++}else i.updateBoundNode(a,t.children[s++],n,r,o)}else for(let o=e.firstChild;o&&t.children;o=o.nextSibling)if(o.getAttribute){const e=o.getAttribute("smart-id"),a=function(){for(let n in t.children)if(t.children[n].nodeId===e)return t.children[n]}();i.updateBoundNode(o,a,n,r),s++}else i.updateBoundNode(o,t.children[s++],n,r);if(!t||!t.data)return;const a=t.data;i.updateBoundData(e,a,n,r)}updateBoundData(e,t,n,r){const o=this;for(let i in t){const s=t[i];let a=s.name;if(!s.updating&&(a.indexOf("::")>=0&&(a=a.substring(0,a.indexOf("::"))),void 0===r||r===a)){if(a.indexOf("(")>=0){let e=a.substring(a.indexOf("("));const t=a.substring(0,a.indexOf("("));if(e=e.substring(1,e.length-1),e=e.replace(/ /gi,""),e=e.split(","),e.length>0&&""!==e[0]){let r=[];for(let t=0;t<e.length;t++)r.push(n[e[t]]);s.value=n[t].apply(n,r)}else s.value=n[t]();s.type=typeof s.value}else s.value=n[a];if("innerHTML"===a){if(e[i].toString().trim()!==n[a].toString().trim()){if(window.smartBlazor&&e[i].indexOf("\x3c!--")>=0){(s.ready||n._properties[a].defaultValue!==s.value)&&(e[i]=s.value.toString());continue}(s.ready||n._properties[a].defaultValue!==s.value)&&(e[i]=s.value.toString().trim())}}else s.not?(e[i]=!s.value,s.targetPropertyName&&(e[s.targetPropertyName]=!s.value)):(e[i]=s.value,s.targetPropertyName&&(e[s.targetPropertyName]=s.value));if(e.$&&e.$.isNativeElement){v.cache["toDash"+i]||(v.cache["toDash"+i]=y.Core.toDash(i));const t=v.cache["toDash"+i],n=e.$.getAttributeValue(t,s.type);!s.reflectToAttribute||n===s.value&&s.ready||e.$.setAttributeValue(t,s.value,s.type),s.reflectToAttribute||e.$.setAttributeValue(t,null,s.type)}if(!s.ready){if(e.$&&e.$.isCustomElement){v.cache["toDash"+i]||(v.cache["toDash"+i]=y.Core.toDash(i));const t=v.cache["toDash"+i];e._properties||(e._beforeCreatedProperties=e._properties=e.propertyByAttributeName=[]),e._properties[i]||(e._properties[i]={attributeName:t},e._beforeCreatedProperties&&(e._beforeCreatedProperties[i]=e._properties[i]),e.propertyByAttributeName[t]=e._properties[i]);const n=e._properties[i];n.isUpdating=!0,s.reflectToAttribute&&(s.not?e.$.setAttributeValue(n.attributeName,!s.value,s.type):e.$.setAttributeValue(n.attributeName,s.value,s.type)),s.reflectToAttribute||e.$.setAttributeValue(n.attributeName,null,s.type),n.isUpdating=!1}if(s.twoWay){const t=function(t){if(s.value=t,e.$&&e.$.isNativeElement){v.cache["toDash"+i]||(v.cache["toDash"+i]=y.Core.toDash(i));const t=v.cache["toDash"+i],n=e.$.getAttributeValue(t,s.type);s.reflectToAttribute&&n!==s.value&&e.$.setAttributeValue(t,s.value,s.type),s.reflectToAttribute||e.$.setAttributeValue(t,null,s.type)}};if(s.name.indexOf("::")>=0){const n=s.name.indexOf("::"),r=s.name.substring(n+2);o["$"+e.getAttribute("smart-id")].listen(r,(function(){t(e[i]);const n=s.name.substring(0,s.name.indexOf("::"));o.updateBoundProperty(n,s)}))}if(e.$&&e.$.isCustomElement){e._properties[i]&&(e._properties[i].notify=!0),v.cache["toDash"+i]||(v.cache["toDash"+i]=y.Core.toDash(i));const n=v.cache["toDash"+i];o["$"+e.getAttribute("smart-id")].listen(n+"-changed",(function(e){let n=e.detail;t(n.value);const r=o.context;e.context!==document&&(o.context=o),o.updateBoundProperty(s.name,s),o.context=r}))}}}s.ready=!0}}}static clearCache(){this.cache={}}addMessages(e,t){Object.assign(this.messages[e],t)}localize(e,t){const n=this;if(!n.messages||!n.messages[n.locale])return;let r=n.messages[n.locale][e];if(""===r)return"";if(!r){const r=n.messages.en;if(r){let n=r[e];if(n){for(let e in t){let r=t[e];n=n.replace(new RegExp("{{"+e+"}}","g"),r)}return n}return e}}const o=r;for(let e in t){let n=t[e];r=r.replace(new RegExp("{{"+e+"}}","g"),n)}if(n.localizeFormatFunction){const i=n.localizeFormatFunction(o,r,t,e);if(void 0!==i)return i}return r}static get requires(){return{}}static get listeners(){return{"theme-changed":function(e){this.theme=e.detail.newValue}}}static get methods(){return{}}get classNamesMap(){return{animation:"smart-animate",rippleAnimation:"smart-ripple"}}get hasAnimation(){return"none"!==this.animation}get hasRippleAnimation(){return"none"!==this.animation&&"advanced"===this.animation}static get modules(){return window[n].Modules}get properties(){const e=this;return e._properties||(e._properties=[]),e._properties}get parents(){const e=this;let t=[],r=e.parentNode;for(;r&&9!==r.nodeType;)r instanceof HTMLElement==1&&t.push(r),r=r.parentNode;const o=e.getRootNode();if(o.host){const e=e=>{let t=[e],n=e.parentNode;for(;n&&9!==n.nodeType;)n instanceof HTMLElement==1&&t.push(n),n=n.parentNode;return t};t=t.concat(e(o.host))}return window[n].EnableShadowDOM&&e.isInShadowDOM&&e.shadowParent&&(t=t.concat(e.shadowParent.parents)),t}log(e){this._logger("log",e)}warn(e){this._logger("warn",e)}error(e){this._logger("error",e)}_logger(e,t){if(this.debugMode){const n=t instanceof Error?t.message:t.toString();console[e](n)}if(this.rethrowError&&"error"===e)throw t}get focused(){return this.contains(document.activeElement)}template(){return"<div></div>"}registered(){const e=this;e.onRegistered&&e.onRegistered()}created(){const e=this;e.isReady=!1,e._initElement(e),e._setModuleState("created"),e.onCreated&&e.onCreated()}completed(){const e=this;e.isCompleted=!0,e._onCompleted&&e._onCompleted(),e.onCompleted&&e.onCompleted()}whenReady(e){const t=this;t.isCompleted?e():(t.whenReadyCallbacks||(t.whenReadyCallbacks=[]),t.whenReadyCallbacks.push(e))}whenRendered(e){const t=this;t.isRendered?e():(t.whenRenderedCallbacks||(t.whenRenderedCallbacks=[]),t.whenRenderedCallbacks.push(e))}addThemeClass(){const e=this;""!==e.theme&&e.classList.add("smart-"+e.theme)}addDefaultClass(){const e=this;e.classList.add(n.toLowerCase()+"-element"),e.classList.add(e.nodeName.toLowerCase())}_renderShadowRoot(){const e=this;if(e.shadowRoot){e.$.root.classList.add(e.nodeName.toLowerCase());for(let t=0;t<e.attributes.length;t++){const n=e.attributes[t];"class"===n.name||"id"===n.name||"style"===n.name||"tabindex"===n.name||n.name.indexOf("aria")>=0||e.$.root.setAttribute(n.name,n.value)}for(let t=0;t<e.classList.length;t++){const n=e.classList[t];"smart-element-init"!==n&&"smart-element"!==n&&"smart-hidden"!==n&&"smart-visibility-hidden"!==n&&e.$.root.classList.add(n)}}}render(){const e=this;if(!e.isRendered&&(e.isRendered=!0,e.isRendering=!1,e.context=document,e._renderShadowRoot(),e.whenRenderedCallbacks)){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}e.onRender&&e.onRender(),e.disabled&&e.setAttribute("aria-disabled",!0),e.readonly&&-1!==["checkbox","combobox","grid","gridcell","listbox","radiogroup","slider","spinbutton","textbox"].indexOf(e.getAttribute("role"))&&e.setAttribute("aria-readonly",!0)}ready(){const e=this;if(e._setId(),e.addThemeClass(),e.addDefaultClass(),"collapsed"===e.visibility?e.classList.add("smart-hidden"):"hidden"===e.visibility&&e.classList.add("smart-visibility-hidden"),e.dataContext&&e.applyDataContext(),e.onReady&&e.onReady(),e.shadowRoot&&Smart(e._selector)){if(Smart(e._selector).styleUrls){const t=Smart(e._selector).styleUrls;for(let n=0;n<t.length;n++)e.importStyle(t[n])}if(Smart(e._selector).styles){const t=document.createElement("style");t.innerHTML=Smart(e._selector).styles,e.shadowRoot.insertBefore(t,e.shadowRoot.firstChild)}}Smart(e._selector)&&Smart(e._selector).ready&&Smart(e._selector).ready()}_setId(){const e=this;if(!e.id){const t=e.elementName;e.id=t.slice(0,1).toLowerCase()+t.slice(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)}}checkLicense(){const e=this;"Evaluation"===window[n].License&&-1===window.location.hostname.indexOf("htmlelements")&&(e.logWatermark(),e.logLicense(),window[n].License="")}logWatermark(){const e=document.createElement("a");e.href="https://www.htmlelements.com/",e.innerHTML="https://www.htmlelements.com/",e.style.position="absolute",e.style.right="5px",e.style.bottom="5px",e.style.color="#fff",e.style.padding="20px",e.style.borderRadius="5px",e.style.background="#0C3D78",e.style.cursor="pointer",e.style.zIndex="999999",e.style.display="block",e.style.fontSize="24px",e.style.textDecoration="none",e.style.fontWeight="bold",e.style.opacity=0,e.style.transition="opacity .35s ease-in-out",e.id="watermark",document.getElementById("watermark")||setTimeout((()=>{document.getElementById("watermark")||(document.body.appendChild(e),setTimeout((()=>{e.style.opacity=1})),setTimeout((()=>{e.style.opacity=0,setTimeout((()=>{e.parentNode.removeChild(e)}),350)}),6e3))}),1e3)}logLicense(){console.log("****************************************************************************************************************"),console.log("****************************************************************************************************************"),console.log("****************************************************************************************************************"),console.log("*jQWidgets License Key Not Found."),console.log("*This is an EVALUATION only Version, it is NOT Licensed for software projects intended for PRODUCTION."),console.log("*if you want to hide this message, please send an email to: sales@jqwidgets.com for a license."),console.log("****************************************************************************************************************"),console.log("****************************************************************************************************************"),console.log("****************************************************************************************************************")}get _selector(){const e=this;return e.id?"#"+e.id:e.classList.length>0?"."+e.classList[0]:""}applyDataContext(e){const t=this;let n="string"==typeof t.dataContext?window[t.dataContext]||document[t.dataContext]:t.dataContext;if(e&&(n=e,t.dataContext=e),n){if(!n._uid){n._uid=(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase(),n._properties=[];for(let e in n){const r=n[e];"function"!=typeof r&&"_properties"!==e&&"_uid"!==e&&(n._properties[e]=r,Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:()=>n._properties[e],set(r){const o=n._properties[e];n._properties[e]=r;let i=[];i[e]={oldValue:o,value:r},i.length++,t.updatingDataContext=!0,w.fireEvent("dataContextPropertyChanged",{dataContext:n,properties:i},{bubbles:!1,cancelable:!0}),t.updatingDataContext=!1}}))}}if(t.dataContextProperties=t.parseAttributes(t),t.dataContextPropertiesMap={},t.dataContextListeners={},t.dataContextProperties){t.updatingDataContext=!0;for(let e in t.dataContextProperties){const r=t.dataContextProperties[e],o=r.name;if(r.propertyName=e,t.dataContextPropertiesMap[o]=e,v.cache["toDash"+e]||(v.cache["toDash"+e]=y.Core.toDash(o)),r.isEvent){const e=r.value;t.dataContextListeners[o]&&t.removeEventListener(o,t.dataContextListeners[o]),t.dataContextListeners[o]=function(t){n[e](t)},t.addEventListener(o,t.dataContextListeners[o])}if(o.indexOf(".")>=0){const r=o.split(".");let i=n[r[0]];for(let e=1;e<r.length;e++)i=i[r[e]];void 0!==i&&(t[e]=i)}else t[e]=n[o]}t.dataContextPropertyChangedHandler=function(e){const n=e.detail.properties;if(e.detail.dataContext===("string"==typeof t.dataContext?window[t.dataContext]||document[t.dataContext]:t.dataContext))for(let e in n){const r=t.dataContextPropertiesMap[e],o=t.context;r&&(t.context=document,t[r]=n[e].value,t.context=o)}},w.listen("dataContextPropertyChanged",t.dataContextPropertyChangedHandler),t.updatingDataContext=!1}else t.dataContextProperties=null}else{t.dataContextProperties=null;const e=function(){("string"==typeof t.dataContext?window[t.dataContext]||document[t.dataContext]:t.dataContext)&&(t.applyDataContext(),window.removeEventListener("load",e))};window.addEventListener("load",e)}}updateDataContextProperty(e){const t=this,n="string"==typeof t.dataContext?window[t.dataContext]||document[t.dataContext]:t.dataContext,r=t.dataContextProperties[e];if(!t.updatingDataContext&&r.twoWay){const o=r.name;if(o.indexOf(".")>=0){const r=o.split(".");let i=n[r[0]];for(let e=1;e<r.length;e++)i=i[r[e]];void 0!==i&&(i=t[e],c[n._uid]&&(c[n._uid][e]=i))}else n[o]=t[e],c[n._uid]&&(c[n._uid][e]=n[o])}}static get version(){return window[n].Version}initProperties(){const e=this;if(Smart(e._selector)&&Smart(e._selector).properties&&(e._initProperties=Smart(e._selector).properties),e.hasAttribute("props")&&!e.props?e._initProperties=window[e.getAttribute("props")]:e.props&&(e._initProperties=e.props),e._initProperties){const t=Object.keys(e._initProperties);for(let n=0;n<t.length;n++){const r=t[n],o=e._initProperties[r];if(void 0!==o){if(o.constructor===Smart.ObservableArray||o instanceof Smart.ObservableArray){e[r]=o.toArray();continue}if(o.constructor===Smart.DataAdapter||"smartDataAdapter"===o.constructor.name||"object"==typeof o&&Smart.DataAdapter&&o instanceof Smart.DataAdapter||o instanceof Smart.Observable||o.constructor===Smart.Observable||"object"!=typeof o||y.Types.isArray(o)||o instanceof Date){if(void 0===e[r]&&-1===["onReady","onAttached","onDetached","onCreated","onCompleted"].indexOf(r)){const t=e.localize("propertyUnknownName",{name:r});e.log(t)}e[r]=o;continue}}if("messages"!==r)if("dataSourceMap"!==r&&"rowCSSRules"!==r){if(o&&"object"==typeof o){const t=function(n,r){const o=Object.keys(n);for(let i=0;i<o.length;i++){const s=o[i],a=n[s],l=e._properties[r+"_"+s];if(l&&null===l.value){if(void 0===e[r+"_"+s]){const t=e.localize("propertyUnknownName",{name:r+"_"+s});e.log(t)}e[r+"_"+s]=a}else if("object"==typeof a&&!y.Types.isArray(a)&&a&&a.constructor!==Date)t(a,r+"_"+s);else{if(void 0===e[r+"_"+s]){const t=e.localize("propertyUnknownName",{name:r+"_"+s});e.log(t)}e[r+"_"+s]=a}}};t(o,r)}}else e[r]=o;else e[r]=Object.assign(e[r],o)}}}setProperties(e){const t=this,n=Object.keys(e);for(let r=0;r<n.length;r++){const o=n[r],i=e[o];if(i.constructor===Smart.ObservableArray||i instanceof Smart.ObservableArray)t[o]=i.toArray();else if(i.constructor===Smart.DataAdapter||"smartDataAdapter"===i.constructor.name||"object"==typeof i&&Smart.DataAdapter&&i instanceof Smart.DataAdapter||i instanceof Smart.Observable||i.constructor===Smart.Observable||"object"!=typeof i||y.Types.isArray(i)||i instanceof Date){if(void 0===t[o]&&-1===["onReady","onAttached","onDetached","onCreated","onCompleted"].indexOf(o))continue;const e=t._properties[o];"int"===e.type||"number"===e.type&&"string"==typeof subPropertyValue?"int"===e.type?t[o]=parseInt(i):t[o]=parseFloat(i):t[o]=i}else if("messages"!==o&&"dataSourceMap"!==o){if("object"==typeof i){const e=function(n,r){const o=Object.keys(n);for(let i=0;i<o.length;i++){const s=o[i],a=n[s],l=t._properties[r+"_"+s];if(l&&null===l.value){if(void 0===t[r+"_"+s])continue;const e=t._properties[r+"_"+s];"int"===e.type||"number"===e.type&&"string"==typeof a?"int"===e.type?t[r+"_"+s]=parseInt(a):t[r+"_"+s]=parseFloat(a):t[r+"_"+s]=a}else if("object"==typeof a&&!y.Types.isArray(a)&&a&&a.constructor!==Date)e(a,r+"_"+s);else{if(void 0===t[r+"_"+s])continue;const e=t._properties[r+"_"+s];"int"===e.type||"number"===e.type&&"string"==typeof a?"int"===e.type?t[r+"_"+s]=parseInt(a):t[r+"_"+s]=parseFloat(a):t[r+"_"+s]=a}}};e(i,o)}}else t[o]=i}}setup(){const e=this;if(e.context=this,e.isReady&&!e.isCompleted)return;if(e.isReady)return e._setModuleState("attached"),e.isAttached=!0,e.attached(),e._handleListeners("listen"),void(e.context=document);e.ownerElement&&e.ownerElement.detachedChildren.indexOf(e)>=0&&e.ownerElement.detachedChildren.splice(e.ownerElement.detachedChildren.indexOf(e),1),e.isReady=!0,e.methods=e.getStaticMember("methods"),e.initProperties(),a.isMobile&&e.classList.add("smart-mobile");for(let t=0;t<e.attributes.length;t+=1){const n=e.propertyByAttributeName[e.attributes[t].name];if(!n)continue;let r=e.$.getAttributeValue(n.attributeName,n.type);const o=r?r.toString():"";if(!(o.indexOf("{{")>=0||o.indexOf("[[")>=0||"object"!==n.type&&"array"!==n.type&&(e.attributes[t].value.indexOf("{{")>=0||e.attributes[t].value.indexOf("[[")>=0)||void 0===r||n.value===r)){const o=y.Types.getType(r),i=e.attributes[t].value;if(("any"===n.type||"object"===n.type)&&""+e[n.name]===r)continue;if("array"===n.type&&e[n.name]&&JSON.stringify(e[n.name])===r)continue;if("number"===o&&isNaN(r)&&"NaN"!==i&&"Infinity"!==i&&"-Infinity"!==i){const t=e.localize("propertyInvalidValueType",{name:n.name,actualType:"string",type:n.type});e.log(t)}n.isUpdatingFromAttribute=!0,e[n.name]=r,n.isUpdatingFromAttribute=!1}}for(let t in e._properties){const n=e._properties[t];if("innerHTML"===t&&n.value===n.defaultValue&&(n.value=n.defaultValue=y.Core.html(e)),"boolean"!==n.type&&"bool"!==n.type||"false"===e.getAttribute(n.attributeName)&&(n.isUpdating=!0,e.setAttribute(n.attributeName,""),n.isUpdating=!1),n.defaultReflectToAttribute&&n.reflectToAttribute){if(n.defaultReflectToAttribute&&n.defaultReflectToAttributeConditions){let t=!0;for(let r=0;r<n.defaultReflectToAttributeConditions.length;r++){const o=n.defaultReflectToAttributeConditions[r];let i,s;for(let e in o)i=e,s=o[e];e._properties[i]&&e._properties[i].value!==s&&(t=!1)}if(!t)continue}n.isUpdating=!0,e.$.setAttributeValue(n.attributeName,n.value,n.type),n.isUpdating=!1}}const t=[];if(e.children.length>0)for(let n=0;n<e.children.length;n++){const r=e.children[n];y.Extend(r).isCustomElement&&t.push(r)}e.applyTemplate(),e.complete=function(){if(!e.templateBindingsReady){const t=e=>{e.templateBindingsReady||(e.templateBindingsReady=!0,e.updateTextNodes(),e.updateBoundNodes())};if(e.ownerElement){let n=e.ownerElement,r=[];for(;n;)r.push(n),n=n.ownerElement;for(let e=r.length-1;e>=0;e--)t(r[e]);t(e)}else t(e)}const t=()=>{if(e._setModuleState("ready"),e.ready(),"auto"!==e.renderMode||e.isRendered||e.render(),e.isAttached=!0,e._setModuleState("attached"),e.attached(),e._handleListeners("listen"),e.isHidden||0!==e.offsetWidth&&0!==e.offsetHeight||(e.isHidden=!0),e.completed(),e.isRendered&&(e.context=document),e.whenReadyCallbacks){for(let t=0;t<e.whenReadyCallbacks.length;t++)e.whenReadyCallbacks[t]();e.whenReadyCallbacks=[]}};if(e.wait)e.classList.add("smart-visibility-hidden");else if(e.classList.contains("smart-async"))requestAnimationFrame((()=>{t()}));else{const n=e.shadowParent;e.shadowParent=null;const r=e.parents;if(e.shadowParent=n,0===r.length)return;const o=()=>{let t=e.ownerElement,n=[];for(;t;)n.push(t),t=t.ownerElement;for(let e=n.length-1;e>=0;e--)n[e].updateBoundMappedNodes()};e.ownerElement&&"HTML"!==r[r.length-1].nodeName?e.getRootNode().host?t():e.ownerElement&&"HTML"===e.ownerElement.parents[e.ownerElement.parents.length-1].nodeName?(o(),t()):e.checkIsInDomInterval=setInterval((()=>{const n=e.parents;"HTML"===n[n.length-1].nodeName&&(clearInterval(e.checkIsInDomInterval),o(),t())}),100):t()}};let r=[].slice.call(e.querySelectorAll("[smart-id]")).concat(t);if(window[n].EnableShadowDOM&&!0!==e.isInShadowDOM&&(r=[].slice.call(e.shadowRoot.querySelectorAll("[smart-id]")).concat(t)),0===r.length)e.complete();else{e._completeListeners=0;for(let t=0;t<r.length;t++){const n=r[t];if(y.Extend(n).isCustomElement){const t=function(){e._completeListeners--,0===e._completeListeners&&(e.complete(),delete e._completeListeners)}.bind(e);n.isCompleted||n.isUtilityElement||!0===n.wait||(e._completeListeners++,n._onCompleted||(n.completeHandlers=[],n._onCompleted=function(){for(let e=0;e<n.completeHandlers.length;e++)n.completeHandlers[e]()}),n.completeHandlers.push(t))}}0===e._completeListeners&&e.complete()}}visibilityChangedHandler(){const e=this;e.isReady&&requestAnimationFrame((()=>{0===e.offsetWidth||0===e.offsetHeight?e.isHidden=!0:(e.isHidden=!1,e.$.fireEvent("resize",e,{bubbles:!1,cancelable:!0}))}))}attributeChangedCallback(e,t,n){const r=this,o=r.propertyByAttributeName[e];if("class"!==e&&"style"!==e||r.visibilityChangedHandler(),o||r.attributeChanged(e,t,n),r.onAttributeChanged&&r.onAttributeChanged(e,t,n),!o||o&&o.isUpdating)return;let i=r.$.getAttributeValue(o.attributeName,o.type);void 0!==n&&r[o.name]!==i&&(o.isUpdatingFromAttribute=!0,r[o.name]=void 0!==i?i:r._properties[o.name].defaultValue,o.isUpdatingFromAttribute=!1)}attributeChanged(e,t,n){}set hasStyleObserver(e){const t=this;void 0===t._hasStyleObserver&&(t._hasStyleObserver=e),e?d.watch(t):d.unwatch(t)}get hasStyleObserver(){const e=this;return void 0===e._hasStyleObserver||e._hasStyleObserver}attached(){const e=this;e.hasStyleObserver&&d.watch(e),e.onAttached&&e.onAttached(),Smart(e._selector)&&Smart(e._selector).attached&&Smart(e._selector).attached()}detached(){const e=this;e.hasStyleObserver&&d.unwatch(e),e._setModuleState("detached"),e.isAttached=!1,e.ownerElement&&-1===e.ownerElement.detachedChildren.indexOf(e)&&e.ownerElement.detachedChildren.push(e),e._handleListeners("unlisten"),e.onDetached&&e.onDetached(),Smart(e._selector)&&Smart(e._selector).detached&&Smart(e._selector).detached(),u&&u[e._selector]&&delete u[e._selector]}propertyChangedHandler(e,t,n){const r=this;t!==n&&("theme"===e&&(""!==t&&r.classList.remove("smart-"+t),""!==n&&r.classList.add("smart-"+n)),"visibility"===e?("collapsed"===t?r.classList.remove("smart-hidden"):"hidden"===t&&r.classList.remove("smart-visibility-hidden"),"collapsed"===n?r.classList.add("smart-hidden"):"hidden"===n&&r.classList.add("smart-visibility-hidden")):("disabled"===e||"readonly"===e)&&r._ariaPropertyChangedHandler(e,n),r.propertyChanged&&r.propertyChanged(e,t,n))}_ariaPropertyChangedHandler(e,t){const n=this;"readonly"===e&&-1===["checkbox","combobox","grid","gridcell","listbox","radiogroup","slider","spinbutton","textbox"].indexOf(n.getAttribute("role"))||(t?n.setAttribute("aria-"+e,!0):n.removeAttribute("aria-"+e))}_handleListeners(e){const t=this,n=t.tagName.toLowerCase(),r=r=>{for(let o in r){const i=o.split(".");let s=i[0],a=t.$;if(i[1])if(s=i[1],a=t["$"+i[0]],"document"===i[0]){let e=t.smartId;""===e&&(e=y.Core.toCamelCase(n)),s=s+"."+e}else t.smartId&&(s=s+"."+t.smartId+"_"+t.parents.length);else t.smartId&&(s=s+"."+t.smartId);const l=r[o],d=function(e){const n=t.context;t.context=t,t[l]&&t[l].apply(t,[e]),t.context=n};a&&a[e](s,d)}};r(t.getStaticMember("listeners")),r(t.templateListeners),Smart(t._selector)&&Smart(t._selector).properties&&r(Smart(t._selector).listeners)}parseTemplate(){const e=this,n=e.template(),o=document.createDocumentFragment();if(t[e.nodeName]&&!r)return t[e.nodeName].cloneNode(!0);if(""===n)return null;let i=document.createElement("div");o.appendChild(i),i.innerHTML=n;let s=i.childNodes;i.parentNode.removeChild(i);for(let e=0;e<s.length;e++)o.appendChild(s[e]);return t[e.nodeName]=o,r?o:o.cloneNode(!0)}applyTemplate(){const e=this,t=e.parseTemplate();if(!t)return;if(!t.hasChildNodes)return;const n=t.childNodes[0],r=(t,n)=>{e["$"+t]=n.$=y.Extend(n),e.$[t]=n,n.ownerElement=e};let o=n;if(n.getElementsByTagName("content").length>0){let e=n.getElementsByTagName("content")[0];o=e.parentNode,o.removeChild(e)}else{const e=t.querySelectorAll("[inner-h-t-m-l]");e&&e.length>0&&(o=e[0])}e.$.template="template"===n.nodeName.toLowerCase()?n:n.querySelector("template");let i=t.querySelectorAll("[id]");0===i.length&&(i=t.querySelectorAll("*")),r("root",n),r("content",o),e.$.html=e.innerHTML.toString().trim();for(let t=0;t<i.length;t+=1){let n=i[t];""===n.id&&(n.id="child"+t),r(n.id,n),n.setAttribute("smart-id",n.id),e.shadowRoot?n.shadowParent=e:n.removeAttribute("id")}for(!1!==e.hasTemplateBindings?e.bindings=e.getBindings(t):e.bindings=[],e.$root.addClass("smart-container");e.childNodes.length;)o.appendChild(e.firstChild);if(e.appendTemplate(t),e.$.template){const t=document.createElement("div");t.classList.add("smart-template-container"),e.$.templateContainer=t,e.$.template.parentNode.insertBefore(t,e.$.template),e.refreshTemplate()}}refreshTemplate(){const e=this;if(!e.$.templateContainer)return;e.templateDetached(e.$.templateContainer);const t=e.$.template.content.cloneNode(!0);e.templateBindings=e.getBindings(t),e.templateProperties=[];let n=document.createDocumentFragment();const r=function(t,n,o){for(let i in t){const s=t[i],a=s.node.cloneNode();n.appendChild(a);let l=[],d=!1;if(s.data)for(let t in s.data){const r=s.data[t],i=r.name;if(e.templateProperties[i]=!0,a.removeAttribute(y.Core.toDash(t)),"*items"===t)l=e[i],d=!0;else if(i.indexOf("item.")>=0&&void 0!==o)r.value=o[i.substring("item.".length)],a[t]=r.value;else if(i.indexOf("item")>=0&&void 0!==o)r.value=o,a[t]=r.value;else if("*if"===t)if(i.indexOf("(")>=0){let t,r=i.substring(i.indexOf("("));const o=i.substring(0,i.indexOf("("));if(r=r.substring(1,r.length-1),r=r.replace(/ /gi,""),r=r.split(","),r.length>0&&""!==r[0]){let n=[];for(let t=0;t<r.length;t++)n.push(e[r[t]]);t=e[o].apply(e,n)}else t=e[o]();!1===t&&n.removeChild(a)}else e[i]||n.removeChild(a);else e.updateBoundNode(a,s,e,i)}if(l.length>0||d){for(let e=0;e<l.length;e++)s.children&&r(s.children,a,l[e]);if("number"==typeof l)for(let e=0;e<l;e++)s.children&&r(s.children,a,e)}else s.children&&r(s.children,a,o)}};r(e.templateBindings.children,n),e.$.templateContainer.innerHTML="",e.$.templateContainer.appendChild(n),e.templateAttached(e.$.templateContainer)}templateAttached(){}templateDetached(){}appendTemplate(e){this.appendChild(e)}defineElementModules(){const e=this,t=e.constructor.prototype;if("BaseElement"===t.elementName){t.modules=e.constructor.modules;const n=t.modules;for(let t=0;t<n.length;t+=1)e.addModule(n[t])}else{const n=t.modules;if(!n)return;for(let t=0;t<n.length;t+=1){const r=n[t],o=r.prototype;e.defineElementMethods(o.methodNames,o),e.defineElementProperties(r.properties)}}}watch(e,t){const n=this;n._watch=null!==e&&null!==t?{properties:e,propertyChangedCallback:t}:null}unwatch(){this._watch=null}set(e,t,n){const r=this,o=r.context;r.context=!0===n?document:r,r[e]=t,r.context=o}get(e){return this[e]}_setModuleState(e,t){const n=this,r="is"+e.substring(0,1).toUpperCase()+e.substring(1),o="on"+e.substring(0,1).toUpperCase()+e.substring(1);for(let i=0;i<n.modulesList.length;i++){const s=n.modulesList[i];s[r]=!0,s[e]&&s[e](t),s[o]&&s[o](t)}}addModule(e,t){const n=this;if(!e)return;const r=n.modules.slice(0),o=e.prototype,i=Object.getPrototypeOf(e);if(i.name&&i.name!==e.name&&n.addModule(i),!e.moduleName&&e.name&&(e.moduleName=e.name),-1===r.findIndex((t=>e.moduleName===t.moduleName))&&r.push(e),n.defineModule(e),n.defineElementMethods(o.methodNames,o),n.defineElementProperties(e.properties),n.constructor.prototype.modules=r,t)for(let t in Smart.Elements.tagNames){const r=Smart.Elements.tagNames[t];let o=Object.getPrototypeOf(r),i=[];for(;o!==HTMLElement;)i.push(o.prototype),o=Object.getPrototypeOf(o);i.indexOf(n)>=0&&r!==n&&r.prototype.addModule(e)}}defineModule(e){if(e.isDefined)return;e.prototype._initModule=function(e){this.ownerElement=e};const t=e.properties||{},n=Object.keys(t),r=Object.getOwnPropertyNames(e.prototype);e.prototype.methodNames=r;for(let r=0;r<n.length;r+=1){const o=n[r],i=t[o];Object.defineProperty(e.prototype,o,{configurable:!1,enumerable:!0,get(){return this.ownerElement?this.ownerElement[o]:i.value},set(e){this.ownerElement[o]=e}})}e.isDefined=!0}getStaticMember(e,t){const r=window[n][this.elementName],o=r[e];t||(t="");let i="array"===t?[]:"string"===t?"":{},s=Object.getPrototypeOf(r),a=[];for(;s[e];)a.push(s[e]),s=Object.getPrototypeOf(s);for(let e=a.length-1;e>=0;e--)if("array"===t)for(let t=0;t<a[e].length;t++)-1===i.indexOf(a[e][t])&&i.push(a[e][t]);else"string"===t?-1===i.indexOf(a[e])&&(i+=a[e]):i=y.Core.assign(i,a[e]);if("array"===t){for(let e=0;e<o.length;e++)-1===i.indexOf(o[e])&&i.push(o[e]);return i}return"string"===t?(-1===i.indexOf(o)&&(i+=o),i):y.Core.assign(i,o)}defineElementHierarchicalProperties(e,t){const n=this,r=[];!function(e){const n=Object.keys(e);for(let o=0;o<n.length;o++){const i=n[o];if("messages"===i)continue;const s=e[i],a=Object.keys(s),l=a.indexOf("value")>=0&&a.indexOf("type")>=0&&"object"==typeof s.value;if("propertyObject"===s.type||l){const e=function(n,o){if(!n.value)return;const i=Object.keys(n.value);for(let s=0;s<i.length;s++){const a=i[s],l=n.value[a],d=o+"_"+a;if("object"!=typeof l||null===l)break;const c=Object.keys(l);if(!(c.indexOf("value")>=0&&c.indexOf("type")>=0))break;if("array"!==n.type&&(n.isHierarchicalProperty=!0),l.parentPropertyName=o,t){const e=t._properties[d];if(n.value.hasOwnProperty(a)){if(e.isDefined)continue;delete n.value[a]}e.isDefined=!0,Object.defineProperty(n.value,a,{configurable:!1,enumerable:!0,get:()=>t._properties[d].value,set(e){t.updateProperty(t,t._properties[d],e)}})}r[d]||(r[d]=l,r.length++),("propertyObject"===l.type||"object"==typeof l.value&&"array"!==l.type)&&e(t?t._properties[d]:l,d)}};e(s,i)}}}(e),r.length>0&&!t&&n.defineElementProperties(r)}defineElement(){const e=this,t=e.constructor.prototype,n=e.getStaticMember("properties"),r=Object.getOwnPropertyNames(t);t.extendedProperties={},t.boundProperties={},t.templateListeners={},e.defineElementModules(),e.defineElementMethods(r,t),e.defineElementProperties(n),e.defineElementHierarchicalProperties(e.extendedProperties),t._initElement=function(){const e=this,n=t.extendedProperties,r=Object.keys(n),o=e.modules;e.$=y.Extend(e),e.$document=w,e.smartId=(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase(),e.isCreated||(e.modulesList=[],e._properties=[],e._beforeCreatedProperties&&(e._properties=e._beforeCreatedProperties,delete e._beforeCreatedProperties),e.detachedChildren=[],e.propertyByAttributeName=[]);for(let t=0;t<o.length;t+=1){let n=new(0,o[t]);n._initModule(e),e.modulesList.push(n)}for(let t=0;t<r.length;t+=1){const o=r[t],i=n[o];let s=i.value;if(e._properties[o]){if(void 0!==e._properties[o].notify)continue;delete e._properties[o]}if(E&&"innerHTML"===o&&delete e[o],-1===window.navigator.userAgent.indexOf("PhantomJS")&&e.hasOwnProperty(o)&&(s=e[o],delete e[o]),"array"===i.type&&null!=s&&(s=s.slice(0)),"object"===i.type&&null!=s&&(s=Array.isArray(s)?s.slice(0):Object.assign({},s)),e._properties[o]={name:o,notify:i.notify,allowedValues:i.allowedValues,type:i.type,nullable:i.nullable,reflectToAttribute:i.reflectToAttribute,defaultReflectToAttribute:i.defaultReflectToAttribute,defaultReflectToAttributeConditions:i.defaultReflectToAttributeConditions,value:s,readOnly:i.readOnly,defaultValue:s,attributeName:i.attributeName,observer:i.observer,inherit:i.inherit,extend:i.extend,validator:i.validator},e.propertyByAttributeName[i.attributeName]=e._properties[o],!i.hasOwnProperty("type")){const t=e.localize("propertyUnknownType",{name:o});e.log(t)}if("any"===i.type||"propertyObject"===i.type)continue;const a=y.Types.getType(s);if(null!=s&&i.type!==a&&!i.validator){if("object"===i.type&&"array"===a)continue;if("number"===a&&["integer","int","float"].findIndex((e=>e===i.type))>=0)continue;const t=e.localize("propertyInvalidValueType",{name:o,actualType:a,type:i.type});e.log(t)}}e.defineElementHierarchicalProperties(e._properties,e),e.isCreated=!0},t.registered()}defineElementMethods(e,t){const n=this.constructor.prototype,r=function(e,t){const n=Array.prototype.slice.call(arguments,2),r=function(){if(!this.isReady&&"localize"!==t&&"localize"!==t&&"cloneNode"!==t&&"importStyle"!==t&&"log"!==t&&"parseAttributes"!==t){const e=this.localize("elementNotInDOM");this.log(e)}let r=this;for(let e=0;e<this.modulesList.length;e++){let n=this.modulesList[e];if(t in n){r=n;break}}const o=this.context,i=n.concat(Array.prototype.slice.call(arguments));let s=null;const a=function(e,t){return e===t||"number"===e&&("int"===t||"integer"===t||"float"===t)||"bool"===e&&"boolean"===t||"boolean"===e&&"bool"===t||"object"===e&&"any"===t||void 0};if(this.methods){const e=this.methods[t];if(e){const n=e.split(":");s=n[n.length-1].trim();const r=[],o=e.substring(1+e.indexOf("("),e.lastIndexOf(")")).split(",");let l="";for(let e=0;e<o.length;e++){const t=o[e];l+=t,t.indexOf(":")>=0?(r.push(l),l=""):l+=","}let d=r.length;for(let e=0;e<r.length;e++){const n=r[e].trim().split(":"),o=n[0].split("=")[0].trim().indexOf("?")>=0,s=n[1].indexOf("?")>=0,l=n[1].replace(/\?/gi,"").trim(),c=l.split("|");let u=n[0].split("=")[1];const p=y.Types.getType(i[e]);if(void 0===i[e]&&u){switch(u=u.trim(),l[0]){case"date":{let e=u.substring(u.indexOf("(")+1,u.lastIndexOf(")"));e=e.length>0?e.split(",").map((e=>parseInt(e))):[],u=0===e.length?new Date:new Date(e[0],e[1],e[2]);break}case"bool":case"boolean":u="true"===u||"1"===u;break;case"int":case"integer":u=parseInt(u);break;case"float":case"number":u=parseFloat(u);break;case"any":case"object":u=u.indexOf("{")>=0?JSON.parse(u):u}i.push(u)}else o&&d--;if(l!==p&&p){let n=!0;for(let e=0;e<c.length;e++)if(a(p,c[e])){n=!1;break}if(n&&(null!==i[e]||!s)){const n=this.localize("methodInvalidValueType",{name:t,actualType:p,type:l,argumentIndex:e});this.log(n)}}if(i.length<d){const e=this.localize("methodInvalidArgumentsCount",{name:t,actualArgumentsCount:i.length,argumentsCount:d});this.log(e)}}}}this.context=this;const l=e.apply(r,i);if(s){const e=void 0===y.Types.getType(l)?"void":y.Types.getType(l);if(!a(e,s)){const n=this.localize("methodInvalidReturnType",{name:t,actualType:e,type:s});this.log(n)}}return this.context=o,l};return r},o=["constructor","ready","created","render","attached","detached","appendChild","insertBefore","removeChild","connect","disconnectedCallback","connectedCallback","attributeChangedCallback","propertyChangedHandler","enableShadowDOM","isInShadowDOM","addPropertyBindings"];for(let i in e){let s=e[i];s&&s.startsWith&&s.startsWith("_")||void 0!==o.find((e=>e===s))||n.extendedProperties[s]||y.Types.isFunction(t[s])&&(n[s]=r(t[s],s))}}defineElementProperties(e){if(!e)return;const t=this,n=t.constructor.prototype,r=Object.keys(e),o=t.getStaticMember("properties");Object.assign(n.extendedProperties,e),t.updateProperty=function(e,t,n){const r=e;if(!t||t.readOnly)return;if(t.allowedValues){let e=!1;for(let r=0;r<t.allowedValues.length;r++)if(t.allowedValues[r]===n){e=!0;break}if(!e){const e=JSON.stringify(t.allowedValues).replace(/\[|\]/gi,"").replace(",",", ").replace(/"/gi,"'"),o="'"+n+"'",i=r.localize("propertyInvalidValue",{name:t.name,actualValue:o,value:e});return void r.log(i)}}const o=t.name,i=r._properties[o].value;if(t.validator&&r[t.validator]){const e=r.context;r.context=r;const o=r[t.validator](i,n);void 0!==o&&(n=o),r.context=e}if(i!==n){if(r.propertyChanging){const e=r.propertyChanging(o,i,n);if(!1===e||null===e)return}if(!t.hasOwnProperty("type")){const e=r.localize("propertyUnknownType",{name:o});r.log(e)}if("array"!==t.type||JSON.stringify(i)!==JSON.stringify(n)){if(null!=n&&"any"!==t.type&&"propertyObject"!==t.type&&t.type!==y.Types.getType(n)&&!t.validator||null===n&&!t.nullable){let e=!0;if("object"===t.type&&"array"===y.Types.getType(n)&&(e=!1),"number"===y.Types.getType(n)&&["integer","int","float"].findIndex((e=>e===t.type))>=0&&(e=!1),e){const e=r.localize("propertyInvalidValueType",{name:o,actualType:y.Types.getType(n),type:t.type});return void r.error(e)}}if(t.isUpdating=!0,t.isHierarchicalProperty){const e=function(t,n){if(!t)return;const o=Object.keys(t);for(let i=0;i<o.length;i++){const s=o[i],a=t[s];"object"==typeof a&&!y.Types.isArray(a)&&a&&a.constructor!==Date?e(a,n+"_"+s):r[n+"_"+s]=a}};e(n,o)}else r._properties[o].value=n;if(!t.isUpdatingFromAttribute&&t.reflectToAttribute&&r.$.setAttributeValue(t.attributeName,n,t.type),r.isReady&&(!r.ownerElement||r.ownerElement&&r.ownerElement.isReady)){if("wait"===o&&(n||!i||r.isCompleted||(r.classList.remove("smart-visibility-hidden"),r.ownerElement&&r.ownerElement.updateBoundMappedNodes(),r.updateBoundMappedNodes(),r.complete())),"renderMode"===o)return;if(r.context!==r&&!r.wait){const e=r.context;r.context=r,r.propertyChangedHandler(o,i,n),r.context=e,t.observer&&r[t.observer]&&(r.context=r,r[t.observer](i,n),r.context=document),r._watch&&r._watch.properties.indexOf(o)>=0&&r._watch.propertyChangedCallback(o,i,n)}const e=t.notify||r.boundProperties[o];e&&(r.$.fireEvent(t.attributeName+"-changed",{context:r.context,oldValue:i,value:r[o]}),r.boundProperties[o]&&r.updateBoundNodes(o)),e&&r.templateProperties&&r.templateProperties[o]&&r.refreshTemplate(),r.dataContextProperties&&("dataContext"===o?r.applyDataContext():r.dataContextProperties[o]&&r.updateDataContextProperty(o))}t.isUpdating=!1}}};for(let t=0;t<r.length;t+=1){const i=r[t],s=e[i],a=y.Core.toDash(i),l=s.type||"any",d=l.indexOf("?")>=0||"any"===l;d&&"any"!==l&&(s.type=l.substring(0,l.length-1)),s.nullable=d,s.attributeName=a.toLowerCase(),s.name=i,s.reflectToAttribute=void 0===s.reflectToAttribute||s.reflectToAttribute,s.inherit&&o[i]&&(s.value=o[i].value),s.extend&&o[i]&&y.Core.assign(s.value,o[i].value),n.hasOwnProperty(i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get(){if(this._properties[i])return this._properties[i].value},set(e){const t=this;t.updateProperty(t,t._properties[i],e)}})}}}let C=[],S=[],x=[],E=!1;const A=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);A&&parseInt(A[2],10)<=50&&(E=!0);class T{static register(e,t){const r=t.prototype;let o=a.toCamelCase(e).replace(/[a-z]+/,""),i=t.version||window[n].Version;if(window.customElements.get(e)&&window.customElements.get(e).version===i)return;let s=e;for(i=i.split(".");window.customElements.get(e);)e=s+"-"+i.join("."),i[2]=parseInt(i[2])+1;if(!C[e]){if(e.startsWith(n.toLowerCase()))C[e]=window[n][o]=window[n.toLowerCase()+o]=t;else{let r=e.split("-")[0];r=r.substring(0,1).toUpperCase()+r.substring(1),window[n][r]||(window[n][r]={}),C[e]=window[n][r][o]=window[r.toLowerCase()+o]=t,window[n][o]&&(o=a.toCamelCase(e)),window[n][o]=t}r.elementName=o,r.defineElement(),S[e]&&S[e](r),window.customElements.define(e,t)}}static registerElements(){const e=this;if(e.toRegister){e.isRegistering=!0;for(let t=0;t<e.toRegister.length;t++){const n=e.toRegister[t];e.register(n.tagName,n.element)}e.isRegistering=!1}}static get(e){if(C[e])return C[e]}static whenRegistered(e,t){if(!e)throw new Error("Syntax Error: Invalid tag name");const n=S[e],r=this.get(e),o=r?r.modules.length:3;try{n||r?!n&&r?(t(r.prototype),S[e]=void 0):n&&!r?S[e]=function(e){n(e),t(e)}:n&&r&&(r.proto&&(n(r.proto),t(r.proto)),S[e]=void 0):S[e]=function(e){try{t(e)}catch(e){const t=e instanceof Error?e.message:e.toString();console.log(t)}}}catch(e){const t=e instanceof Error?e.message:e.toString();console.log(t)}if(r&&o!==r.prototype.modules.length){const t=document.querySelectorAll(e);for(let e=0;e<t.length;e++){const n=t[e];n.isCreated&&n._initElement()}}}}T.lazyRegister=!1,T.tagNames=[];class P{constructor(){const e=this;e.name="observableArray",e.observables=arguments.length<3?null:arguments[2];const t=new Proxy(e,{deleteProperty:function(e,t){return delete e[t],!0},apply:function(e,t,n){return e.apply(t,n)},get:function(t,n){return"symbol"==typeof(r=n)||"object"==typeof r&&"[object Symbol]"===Object.prototype.toString.call(r)||t[n]||isNaN(parseInt(n))?t[n]:e.getItem(parseInt(n));var r},set:function(t,n,r){return t[n]||isNaN(parseInt(n))?(t[n]=r,!0):(e.setItem(parseInt(n),r),!0)}});if(e._addArgs={eventName:"change",object:t,action:"add",index:null,removed:new Array,addedCount:1},e._removeArgs={eventName:"change",object:t,action:"remove",index:null,removed:null,addedCount:0},arguments.length>=1&&Array.isArray(arguments[0])){e._array=[];const t=arguments[0];for(let n=0,r=t.length;n<r;n++){const r=e._getItem(e._array.length,t[n]);e._array.push(r)}}else e._array=Array.apply(null,arguments);return 2===arguments.length&&(e.notifyFn=arguments[1]),t}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){return this._array}_getItem(e,t){const n=this;return"string"==typeof t||"number"==typeof t||void 0===t?t:new Proxy(t,{deleteProperty:function(e,t){return delete e[t],!0},set:function(t,r,o){const i=t[r];return t[r]=o,!n._canNotify||!1===t.canNotify||(n.observables&&!n.observables[r]||n._notify({eventName:"change",object:n,target:t,action:"update",index:e,path:e+"."+r,oldValue:i,newValue:o,propertyName:r}),!0)}})}getItem(e){return this._array[e]}setItem(e,t){const n=this,r=n._array[e];n._array[e]=n._getItem(e,t),n._notify({eventName:"change",object:n._array,action:"update",index:e,removed:[r],addedCount:1})}get length(){return this._array.length}set length(e){const t=this;o.isNumber(e)&&t._array&&t._array.length!==e&&t.splice(e,t._array.length-e)}toString(){return this._array.toString()}toLocaleString(){return this._array.toLocaleString()}concat(){const e=this;e._addArgs.index=e._array.length;const t=e._array.concat.apply(e._array,arguments);return new Smart.ObservableArray(t)}join(e){return this._array.join(e)}pop(){const e=this;e._removeArgs.index=e._array.length-1,delete e[e._array.length-1];const t=e._array.pop();return e._removeArgs.removed=[t],e._notify(e._removeArgs),e._notifyLengthChange(),t}push(){const e=this;if(e._addArgs.index=e._array.length,1===arguments.length&&Array.isArray(arguments[0])){const t=arguments[0];for(let n=0,r=t.length;n<r;n++){const r=e._getItem(e._array.length,t[n]);e._array.push(r)}}else{const t=e._getItem(e._addArgs.index,arguments[0]);e._array.push.apply(e._array,[t])}return e._addArgs.addedCount=e._array.length-e._addArgs.index,e._notify(e._addArgs),e._notifyLengthChange(),e._array.length}_notifyLengthChange(){const e=this;if(!e.canNotify)return;const t=e._createPropertyChangeData("length",e._array.length);e._notify(t)}_createPropertyChangeData(e,t,n){return{eventName:"change",object:this,action:e,value:t,oldValue:n}}reverse(){return this._array.reverse()}shift(){const e=this,t=e._array.shift();return e._removeArgs.index=0,e._removeArgs.removed=[t],e._notify(e._removeArgs),e._notifyLengthChange(),t}slice(e,t){return this._array.slice(e,t)}sort(e){return this._array.sort(e)}splice(e,t,n){const r=this,o=r._array.length;let i;if(n&&n.length)for(let o=0;o<n.length;o++)i=r._array.splice(e+o,t,n[o]);else i=r._array.splice.apply(r._array,arguments);if(n){let t=r.canNotify;if(r.canNotify=!1,n.length)for(let t=0;t<n.length;t++)r.setItem(e+t,n[t]);else r.setItem(e,n);r.canNotify=t,r._notify({eventName:"change",object:this,action:"add",index:e,added:i,addedCount:r._array.length>o?r._array.length-o:0})}else r._notify({eventName:"change",object:this,action:"remove",index:e,removed:i,addedCount:r._array.length>o?r._array.length-o:0});return r._array.length!==o&&r._notifyLengthChange(),i}unshift(){const e=this,t=e._array.length,n=e._array.unshift.apply(e._array,arguments);return e._addArgs.index=0,e._addArgs.addedCount=n-t,e._notify(this._addArgs),e._notifyLengthChange(),n}indexOf(e,t){const n=this;for(let r=t||0,o=n._array.length;r<o;r++)if(n._array[r]===e)return r;return-1}lastIndexOf(e,t){const n=this;for(let r=t||n._array.length-1;r>=0;r--)if(n._array[r]===e)return r;return-1}find(e,t){return this._array.find(e,t)}findIndex(e,t){return this._array.findIndex(e,t)}every(e,t){return this._array.every(e,t)}some(e,t){return this._array.some(e,t)}forEach(e,t){this._array.forEach(e,t)}map(e,t){return this._array.map(e,t)}filter(e,t){return this._array.filter(e,t)}reduce(e,t){return void 0!==t?this._array.reduce(e,t):this._array.reduce(e)}reduceRight(e,t){return void 0!==t?this._array.reduceRight(e,t):this._array.reduceRight(e)}move(e,t){this.splice(t,0,this.splice(e,1)[0])}}let D={};window[n]&&(D=window[n]),window[n]=function(e,t){let r=e;if(e){if(e.indexOf("#")>=0||e.indexOf(".")>=0)return u[e]?u[e]:t?(u[e]=new t,function(e,t){const n=t.properties;t._properties=[];const r=function(n,o){const i=Object.keys(n);for(let s=0;s<i.length;s++){const a=i[s],l=n[a];t._properties[o+a]=l,Array.isArray(l)?t._properties[o+a]=new P(l,(function(t){const n=a+"."+t.path,r=t.newValue,o=document.querySelector(e);if(o){const e=n.split(".");let t=o;for(let n=0;n<e.length;n++)t=t[e[n]];t=r}})):(Object.defineProperty(n,a,{configurable:!1,enumerable:!0,get:()=>t._properties[o+a],set(e){t._properties[o+a]=e}}),l&&"DataAdapter"===l.constructor.name||l&&"object"==typeof l&&Smart.DataAdapter&&l instanceof Smart.DataAdapter||"object"==typeof l&&l&&Object.keys(l).length>0&&r(l,o+a+"."))}};r(n,""),Object.defineProperty(t,"properties",{configurable:!1,enumerable:!0,get:()=>n});const o=document.querySelector(e);if(o&&o.isReady)for(let e in n)o[e]=n[e];else if(o){o.props={};for(let e in n)o.props[e]=n[e]}}(e,u[e]),u[e]):void 0;if(t){if(T.tagNames[e]=t,T.lazyRegister){T.toRegister||(T.toRegister=[]);const e=a.toCamelCase(r).replace(/[a-z]+/,"");return window[n][e]=t,void T.toRegister.push({tagName:r,element:t})}T.register(r,t)}}},window.addEventListener("load",(function(){const e=window[n].Elements.tagNames;let t=[];for(let r in e){const o=e[r];let i=document.querySelectorAll("["+r+"]");for(let e=0;e<i.length;e++){const t=i[e];t instanceof HTMLDivElement&&(t.__proto__=o.prototype,t.created(),t.connectedCallback()),t.classList.add("smart-element-ready")}let s=o.name;"Item"===s&&(s="ListItem"),i=document.querySelectorAll('[is="'+n.toLocaleLowerCase()+s+'"]');for(let e=0;e<i.length;e++)t.push(i[e])}if(t.length>0){const e=e=>{let t=[],n=e.parentNode;for(;n&&9!==n.nodeType;)n instanceof HTMLElement==1&&t.push(n),n=n.parentNode;return t};t.sort((function(t,n){let r=e(t).length,o=e(n).length;return r<o?1:r>o?-1:0}));for(let e=0;e<t.length;e++){const n=t[e],r=n.getAttribute("is");let o;o="smartItem"===r?new window.smartListItem(n):new window[r](n),o.removeAttribute("is")}}}));const L=function(){if("complete"===document.readyState&&"manual"!==window[n].RenderMode){x.sort((function(e,t){let n=e.element.parents.length,r=t.element.parents.length;return n<r?-1:n>r?1:0}));for(let e=0;e<x.length;e++)window[n].RenderMode="",x[e].element.isLoading=!1,x[e].callback(),window[n].RenderMode="";x=[],document.removeEventListener("readystatechange",L)}};Object.assign(window[n],{Elements:T,Modules:[],BaseElement:class extends _{static get observedAttributes(){let e=this,t=["external-style"];for(let n in e.prototype.extendedProperties){const r=e.prototype.extendedProperties[n];t.push(r.attributeName)}return t}static get styleUrls(){return[]}static get styles(){return""}get styleUrl(){return this._styleUrl}set styleUrl(e){this._styleUrl=e}get isInShadowDOM(){const e=this,t=e.getRootNode();return!e.hasAttribute("smart-blazor")&&t!==document&&t!==e}getShadowRootOrBody(){const e=this;return e.isInShadowDOM&&e.getRootNode().host?e.getRootNode().host.shadowRoot:document.body}get enableShadowDOM(){return window[n].EnableShadowDOM}importStyle(e,t){this._importStyle(e,t)}_importStyle(e,t){const n=this;if(!n.shadowRoot||!e)return;const r=e=>{const r=n.shadowRoot.children;for(let n=0;n<r.length;n++){const o=r[n];if(o instanceof HTMLLinkElement&&o.href===e)return t&&t(),null}const o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",o.href=e,o.onload=t,o},o=(()=>{const e=n.shadowRoot.children;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r instanceof HTMLLinkElement&&(t=r)}return t})(),i=(e,t)=>{t.parentNode.insertBefore(e,t.nextSibling)};if(Array.isArray(e)){const t=document.createDocumentFragment();for(let n=0;n<e.length;n++){const o=r(e[n]);o&&t.appendChild(o)}o?i(t,o):n.shadowRoot.insertBefore(t,n.shadowRoot.firstChild)}else{const t=r(e);if(!t)return;o?i(t,o):n.shadowRoot.insertBefore(t,n.shadowRoot.firstChild)}}attributeChanged(e,t,n){"style-url"===e&&(this.styleUrl=n)}attributeChangedCallback(e,t,n){this.isReady&&super.attributeChangedCallback(e,t,n)}constructor(e,t){super();const n=this;if(e){t&&(n._initProperties=t);const r=e=>{if("string"==typeof e?document.querySelector(e):e){const r="string"==typeof e?document.querySelector(e):e;if(r instanceof HTMLDivElement){const o=document.createElement(n.tagName);for(let e of r.attributes)o.setAttribute(e.name,r.getAttribute(e.name));for(;r.childNodes.length;)o.appendChild(r.firstChild);return"string"==typeof e&&(o.id=e.substring(1)),o._initProperties=t,r.parentNode&&r.parentNode.replaceChild(o,r),o}if(t){const e=r.context;if(r._initProperties=t,r.isReady){r.context=r;const n={},o={};for(let e in t)n[e]=r[e],o[e]=t[e];Object.getOwnPropertyNames(t).length>0&&(r.initProperties(),r.propertyChangedHandler(t,n,o)),r.context=e}}return r}};if("string"==typeof e){const t=document.querySelectorAll(e),n=[];if(t.length>1){for(let e=0;e<t.length;e++){const o=r(t[e]);n.push(o)}return n}}else if(e&&e.length>0){const t=e;if(t.length>1){for(let e=0;e<t.length;e++){const n=r(t[e]);C.push(n)}return C}}return r(e)}n._styleUrl="",n.isUtilityElement||n.created()}_getRootShadowParent(){let e=this.shadowParent;for(;e;){if(!e.shadowParent)return e;e=e.shadowParent}return e||this.shadowParent}_getStyleUrl(e){let t=y.Core.getScriptLocation()+window[n].StyleBaseUrl+e;return this.shadowParent&&(t=t.replace("scoped/","")),t}_getStyleUrls(){const e=this;e.nodeName.startsWith(n);const t=e.getStaticMember("styleUrls","array"),r=[];for(let n=0;n<t.length;n++){const o=t[n],i=e._getStyleUrl(o);r.push(i)}return r}_setupShadowRoot(){const e=this;e.classList.add("smart-element-init");const t=t=>{t.$.root&&(t.$.root.classList.add(n.toLowerCase()+"-element"),t.$.root.classList.add(e.nodeName.toLowerCase())),t.setup(),t.classList.remove("smart-element-init")};if(document.adoptedStyleSheets)if(window[n].AdoptedStyleSheets)window[n].AdoptedStyleSheetsLoaded?(e.shadowRoot.adoptedStyleSheets=window[n].AdoptedStyleSheets,t(e)):(e.shadowRoot.adoptedStyleSheets=window[n].AdoptedStyleSheets,window[n].AdoptedStyleSheetsLoadedQueue||(window[n].AdoptedStyleSheetsLoadedQueue=[]),window[n].AdoptedStyleSheetsLoadedQueue.push(e));else{const r=new CSSStyleSheet;let o=y.Core.getScriptLocation()+"/styles/smart.default.css";r.replace('@import url("'+o+'")').then((()=>{if(t(e),window[n].AdoptedStyleSheetsLoaded=!0,window[n].AdoptedStyleSheetsLoadedQueue){const e=window[n].AdoptedStyleSheetsLoadedQueue;for(let n=0;n<e.length;n++){const r=e[n];t(r)}delete window[n].AdoptedStyleSheetsLoadedQueue}})).catch((e=>{console.error("Failed to load:",e)})),window[n].AdoptedStyleSheets=[r],document.adoptedStyleSheets=[r],e.shadowRoot.adoptedStyleSheets=window[n].AdoptedStyleSheets}}connect(){const e=this;window[n].EnableShadowDOM&&!e.shadowRoot&&!0!==e.isInShadowDOM&&(e.attachShadow({mode:"open"}),e.shadowRoot&&e.$.root&&(e.shadowRoot.appendChild(e.$.root),e.$.root.classList.add(e.nodeName.toLowerCase()))),e.shadowRoot||e.shadowParent?e.shadowRoot?e._setupShadowRoot():(e.shadowParent&&window[n].EnableShadowDOM,e.setup()):e.setup()}connectedCallback(){const e=this;if(e.isLoading||e.isUtilityElement)return;e.classList.add("smart-element-init");const t=function(){e.classList.remove("smart-element-init")};if("complete"===document.readyState&&(void 0===window[n].isAngular&&(window[n].isAngular=null!==document.body.querySelector("[ng-version]")),window[n].isAngular))for(let t=0;t<e.parents.length&&!e.parents[t].nodeName.toLowerCase().startsWith(n.toLowerCase()+"-");t++)if(e.parents[t].hasAttribute("ng-version")&&!e.classList.contains("smart-angular")){window[n].RenderMode="manual";break}if("complete"===document.readyState&&"manual"!==window[n].RenderMode){const n=e.parents;n.length&&"HTML"===n[n.length-1].nodeName||e.getRootNode().host?(e.checkIsInDomTimer&&clearInterval(e.checkIsInDomTimer),t(),e.connect()):(e.checkIsInDomTimer&&clearInterval(e.checkIsInDomTimer),n.length>0&&(e.checkIsInDomTimer=setInterval((()=>{const n=e.parents;0===n.length&&clearInterval(e.checkIsInDomTimer),n.length>0&&"HTML"===n[n.length-1].nodeName&&(clearInterval(e.checkIsInDomTimer),t(),e.connect())}),100)))}else e.isLoading=!0,x.push({element:this,callback:function(){this.isReady||(t(),this.connect())}.bind(e)})}disconnectedCallback(){const e=this;e.isAttached?(e.shadowParent=null,e.detached()):e._resetShadowParent()}adoptedCallback(){this.setup()}appendTemplate(e){const t=this;t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}_resetShadowParent(){const e=this;if(!window[n].EnableShadowDOM||null===e.shadowParent)return;const t=[];let r=e.parentNode;for(;r&&9!==r.nodeType;){if(r instanceof HTMLElement==1)t.push(r);else if(11===r.nodeType&&r.host){r=r.host;continue}r=r.parentNode}for(let n=0;n<t.length;n++)if(t[n]===e.shadowParent)return;t.length>0&&"HTML"===t[t.length-1].nodeName&&(e.shadowParent=null)}},Utilities:y,Import:function(e,t){let n=0;const r=function(e,t){return new Promise((n=>{const r=document.createElement("script");r.src=e,r.onload=n;for(let e=0;e<document.head.children.length;e++){const r=document.head.children[e];if(r.src&&r.src.toString().indexOf(t)>=0)return void n()}document.head.appendChild(r)}))};return new Promise((o=>{const i=y.Core.getScriptLocation(),s=function(t){if(!e[t])return;const a=i+"/"+e[t];r(a,e[t]).then((function(){n++,n===e.length&&o(),s(t+1)}))};if(t)for(let t=0;t<e.length;t++){const s=i+"/"+e[t];r(s,e[t]).then((function(){n++,n===e.length&&o()}))}else s(0)}))},ObservableArray:P,Observable:class{constructor(e,t){const n=this;var r;return this.name="observable",e&&Object.assign(n,e),r=e,Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((e=>"constructor"===e||!!e.startsWith("_")||void(n[e]=r[e]))),new Proxy(n,{deleteProperty:function(e,t){return delete e[t],!0},get:function(e,t){return e[t]},set:function(e,r,o){const i=e[r];return i===o||(e[r]=o,!("notifyFn"!==r&&!r.startsWith("_")&&"canNotify"!==r&&(!t||-1!==t.indexOf(r))&&n.canNotify&&(n._notify({target:e,propertyName:r,oldValue:i,newValue:o}),0)))}})}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;if(t.canNotify&&t.notifyFn)for(let n=0;n<t.notifyFn.length;n++)t.notifyFn[n](e)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}},Component:class{constructor(e,t){const n=this.name;let r=null;return e?r=new window[n](e,t):(r=new window[n],r._initProperties=t),this._element=r,r}get name(){return"Component"}get element(){return this._element}},Theme:D.Theme||"",EnableShadowDOM:D.ShadowDom||!1,BaseUrl:"./",StyleBaseUrl:"/styles/default/",Version:e,Templates:t,RenderMode:D.RenderMode||"auto",Render:function(){const e=()=>{window[n].RenderMode="",L()};"complete"===document.readyState?e():(window.removeEventListener("load",e),window.addEventListener("load",e))},Data:u,Mode:D.Mode||"production",License:D.License||"Evaluation"});let O=window[n].Theme;"manual"!==window[n].RenderMode&&document.addEventListener("readystatechange",L),Object.defineProperty(window[n],"Theme",{configurable:!1,enumerable:!0,get:()=>O,set(e){const t=O;O=e,w.fireEvent("theme-changed",{oldValue:t,newValue:e},{bubbles:!0,cancelable:!0})}}),window[n]("smart-base-element",window[n].BaseElement),window[n]("smart-content-element",class extends window[n].BaseElement{static get properties(){return{content:{type:"any",reflectToAttribute:!1},innerHTML:{type:"string",reflectToAttribute:!1}}}template(){return"<div inner-h-t-m-l='[[innerHTML]]'></div>"}ready(){super.ready(),this.applyContent()}refresh(){}clearContent(){const e=this;for(;e.$.content.firstChild;)e.$.content.removeChild(e.$.content.firstChild)}applyContent(){const e=this;if(void 0===e.content)return void(e.content=e.$.content);if(""===e.content||null===e.content)return void e.clearContent();if(e.content instanceof HTMLElement)return e.clearContent(),void e.$.content.appendChild(e.content);const t=document.createDocumentFragment();let n=document.createElement("div");t.appendChild(n),e.content instanceof HTMLElement?n.appendChild(e.content):n.innerHTML=e.content;let r=Array.from(n.childNodes);n.parentNode.removeChild(n);for(let e=0;e<r.length;e++)t.appendChild(r[e]);e.clearContent(),e.$.content.appendChild(t)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const r=this;t!==n&&("innerHTML"===e&&(r.content=n,r.applyContent(),r.innerHTML=r.content=y.Core.html(r.$.content)),"content"===e&&r.applyContent())}}),window[n]("smart-scroll-viewer",class extends window[n].ContentElement{static get properties(){return{autoRefresh:{type:"boolean",value:!1},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},touchScrollRatio:{type:"any",value:null},touchVelocityCoefficient:{type:"number",value:50},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]}}}static get listeners(){return{touchmove:"_touchmoveHandler",touchstart:"_touchstartHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler"}}static get styleUrls(){return["smart.scrollviewer.css"]}template(){return'<div id="container" class="smart-container" role="presentation">\n <div id="scrollViewerContainer" class="smart-scroll-viewer-container" role="presentation">\n <div id="scrollViewerContentContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-scroll-viewer-content-container" role="presentation">\n <content></content>\n </div>\n </div>\n <smart-scroll-bar id="verticalScrollBar" theme="[[theme]]" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" orientation="vertical"></smart-scroll-bar>\n <smart-scroll-bar id="horizontalScrollBar" theme="[[theme]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]"></smart-scroll-bar>\n </div>'}appendChild(e){const t=this;if(e){if(!t.isCompleted||e.classList&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.$.scrollViewerContentContainer.appendChild(e)}}removeChild(e){const t=this;if(e){if(!t.isCompleted||e.classList&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.$.scrollViewerContentContainer.removeChild(e)}}removeAll(){const e=this;e.isCompleted&&(e.$.scrollViewerContentContainer.innerHTML="")}_horizontalScrollbarHandler(e){const t=this;t.$.scrollViewerContentContainer.style.left=(t.rightToLeft?1:-1)*t.scrollLeft+"px",e.stopPropagation&&e.stopPropagation(),t.onHorizontalChange&&t.onHorizontalChange(e)}_verticalScrollbarHandler(e){const t=this;t.$.scrollViewerContentContainer.style.top=-t.scrollTop+"px",e.stopPropagation&&e.stopPropagation(),t.onVerticalChange&&t.onVerticalChange(e)}_touchmoveHandler(e){const t=this;if(t._touchmoveInside&&e.cancelable)return e.preventDefault(),void e.stopPropagation();const n=t.scrollHeight>0,r=t.scrollWidth>0,o=t._touchCoords;if(!n&&!r||!o)return;const i=e.touches[0];let s,a,l,d;t._touchCoords=[i.pageX,i.pageY],n?(s=t.scrollTop,a=t.scrollHeight,l=i.pageY,d=o[1]):(s=t.scrollLeft,a=t.scrollWidth,l=i.pageX,d=o[0]);const c=parseFloat(l.toFixed(5)),u=parseFloat(d.toFixed(5));0===s&&c>=u||s===a&&c<=u||(l!==d&&(t._touchmoveInside=!0),e.cancelable&&(e.preventDefault(),e.stopPropagation()))}_touchstartHandler(e){const t=e.touches[0];this._touchCoords=[t.pageX,t.pageY]}_mouseWheelHandler(e){const t=this;if(!t.disabled&&(t.computedHorizontalScrollBarVisibility||t.computedVerticalScrollBarVisibility)){if(e.shiftKey&&t.computedHorizontalScrollBarVisibility){const n=t.scrollLeft;if(0===n&&e.deltaX<0||n===t.scrollHeight&&e.deltaX>0)return;return e.stopPropagation(),e.preventDefault(),void(t.scrollWidth>0&&t.scrollTo(void 0,t.scrollLeft+t._getScrollCoefficient(e,t.offsetWidth)))}if(t.computedVerticalScrollBarVisibility){const n=t.scrollTop;if(0===n&&e.deltaY<0||n===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault(),t.scrollHeight>0&&t.scrollTo(t.scrollTop+t._getScrollCoefficient(e,t.offsetHeight))}}}_overriddenHandler(){}_upHandler(){delete this._touchCoords,delete this._touchmoveInside}_getScrollCoefficient(e,t){const n=e.deltaMode,r=Math.abs(e.deltaY);let o;return 0===n?o=r<100/3?r:t:1===n?o=r<1?r*(100/3):t:2===n&&(o=t),e.deltaY<0?-o:o}applyContent(){super.applyContent(),this.refresh()}get computedHorizontalScrollBarVisibility(){const e=this;return e._scrollView&&e._scrollView.hScrollBar?!e._scrollView.hScrollBar.$.hasClass("smart-hidden"):null}get computedVerticalScrollBarVisibility(){const e=this;return e._scrollView&&e._scrollView.vScrollBar?!e._scrollView.vScrollBar.$.hasClass("smart-hidden"):null}scrollTo(e,t){const n=this;n._scrollView&&(void 0!==e&&n._scrollView.scrollTo(e),void 0!==t&&n._scrollView.scrollTo(t,!1))}refreshScrollBarsVisibility(){const e=this;e._scrollView&&(e._scrollView.hScrollBar.disabled=e.disabled,e._scrollView.vScrollBar.disabled=e.disabled,"disabled"===e.horizontalScrollBarVisibility&&(e._scrollView.hScrollBar.disabled=!0),"disabled"===e.verticalScrollBarVisibility&&(e._scrollView.vScrollBar.disabled=!0),e.scrollWidth>0?e._scrollView.hScrollBar.$.removeClass("smart-hidden"):"visible"!==e.horizontalScrollBarVisibility&&e._scrollView.hScrollBar.$.addClass("smart-hidden"),e.scrollHeight>0?e._scrollView.vScrollBar.$.removeClass("smart-hidden"):"visible"!==e.verticalScrollBarVisibility&&e._scrollView.vScrollBar.$.addClass("smart-hidden"),"hidden"===e.horizontalScrollBarVisibility&&e._scrollView.hScrollBar.$.addClass("smart-hidden"),"hidden"===e.verticalScrollBarVisibility&&e._scrollView.vScrollBar.$.addClass("smart-hidden"),"visible"===e.horizontalScrollBarVisibility&&e._scrollView.hScrollBar.$.removeClass("smart-hidden"),"visible"===e.verticalScrollBarVisibility&&(e._scrollView.vScrollBar.$.removeClass("smart-hidden"),e.disabled||(e._scrollView.vScrollBar.disabled=e.scrollHeight<=0)),e.computedHorizontalScrollBarVisibility&&e.computedVerticalScrollBarVisibility?(e._scrollView.hScrollBar.$.addClass("bottom-corner"),e._scrollView.vScrollBar.$.addClass("bottom-corner")):(e._scrollView.hScrollBar.$.removeClass("bottom-corner"),e._scrollView.vScrollBar.$.removeClass("bottom-corner")))}ready(){super.ready();const e=this;e.$.verticalScrollBar.onChange=t=>{t.detail=t,e._verticalScrollbarHandler(t)},e.$.horizontalScrollBar.onChange=t=>{t.detail=t,e._horizontalScrollbarHandler(t)},e.$.verticalScrollBar.setAttribute("aria-controls",e.id),e.$.horizontalScrollBar.setAttribute("aria-controls",e.id),e._customScrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.refresh()}refresh(){const e=this;function t(){const t=e.$.scrollViewerContainer.classList.contains("vscroll");e.$.scrollViewerContainer.classList.remove("vscroll");const n=e.$.scrollViewerContentContainer.offsetWidth-e.$.scrollViewerContainer.offsetWidth;return n>0&&"hidden"!==e.horizontalScrollBarVisibility||"visible"===e.horizontalScrollBarVisibility?e.$.scrollViewerContainer.classList.add("hscroll"):e.$.scrollViewerContainer.classList.remove("hscroll"),t&&e.$.scrollViewerContainer.classList.add("vscroll"),n}function n(){let t;const n=e.$.scrollViewerContainer.classList.contains("hscroll");if(e.$.scrollViewerContainer.classList.remove("hscroll"),Smart.Utilities.Core.Browser.Safari){const n=e.$.scrollViewerContentContainer.getBoundingClientRect().height,r=e.$.scrollViewerContainer.getBoundingClientRect().height;t=n&&r?parseInt(n)-parseInt(r):e.$.scrollViewerContentContainer.offsetHeight-e.$.scrollViewerContainer.offsetHeight}else t=e.$.scrollViewerContentContainer.offsetHeight-e.$.scrollViewerContainer.offsetHeight;return e.virtualScrollHeight&&(t=e.virtualScrollHeight),t>0&&"hidden"!==e.verticalScrollBarVisibility||"visible"===e.verticalScrollBarVisibility?e.$.scrollViewerContainer.classList.add("vscroll"):e.$.scrollViewerContainer.classList.remove("vscroll"),n&&e.$.scrollViewerContainer.classList.add("hscroll"),t}if(!e.$.scrollViewerContentContainer)return;"hidden"===e.verticalScrollBarVisibility&&e.$.scrollViewerContentContainer.setAttribute("disable-vertical",""),"hidden"===e.horizontalScrollBarVisibility&&e.$.scrollViewerContentContainer.setAttribute("disable-horizontal","");let r=e.scrollWidth,o=e.scrollHeight;e.scrollWidth=t(),e.scrollHeight=n(),e.scrollHeight&&o===e.scrollHeight||(e.scrollWidth=t()),e.scrollWidth&&r===e.scrollWidth||(e.scrollHeight=n()),e.computedVerticalScrollBarVisibility&&(e.scrollHeight+=e._scrollView.hScrollBar.offsetHeight),e.computedHorizontalScrollBarVisibility&&(e.scrollWidth+=e._scrollView.vScrollBar.offsetWidth),0===e.scrollHeight&&e.scrollWidth>0&&e.$.container.offsetHeight-e.$.content.offsetHeight<5&&(e.$.container.style.paddingBottom=e._scrollView.hScrollBar.offsetHeight+"px"),e.autoRefresh&&(e.$.scrollViewerContainer.scrollLeft=0,e.$.scrollViewerContainer.scrollTop=0)}attached(){const e=this;super.attached(),e._scrollView||e._customScrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar))}detached(){const e=this;super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView)}get scrollWidth(){const e=this;return e._scrollView&&e._scrollView.hScrollBar?1===e._scrollView.hScrollBar.max&&"visible"===e.horizontalScrollBarVisibility?0:e._scrollView.hScrollBar.max:-1}set scrollWidth(e){const t=this;e<0&&(e=0),t._scrollView&&t._scrollView.hScrollBar&&(0===e&&"visible"===t.horizontalScrollBarVisibility?t._scrollView.hScrollBar.max=0:t._scrollView.hScrollBar.max=e,t.refreshScrollBarsVisibility())}get scrollHeight(){const e=this;return e._scrollView&&e._scrollView.vScrollBar?1===e._scrollView.vScrollBar.max&&"visible"===e.verticalScrollBarVisibility?0:e._scrollView.vScrollBar.max:0}set scrollHeight(e){const t=this;e<0&&(e=0),t._scrollView&&t._scrollView.vScrollBar&&(0===e&&"visible"===t.verticalScrollBarVisibility?t._scrollView.vScrollBar.max=1:t._scrollView.vScrollBar.max=e,t.refreshScrollBarsVisibility())}get scrollLeft(){const e=this;return e._scrollView&&e._scrollView.hScrollBar?e._scrollView.hScrollBar.value:0}set scrollLeft(e){const t=this;e<0&&(e=0),t._scrollView&&t._scrollView.hScrollBar&&(t._scrollView.hScrollBar.value=e)}get scrollTop(){const e=this;return e._scrollView&&e._scrollView.vScrollBar?e._scrollView.vScrollBar.value:0}set scrollTop(e){const t=this;e<0&&(e=0),t._scrollView&&t._scrollView.vScrollBar&&(t._scrollView.vScrollBar.value=e)}propertyChangedHandler(e,t,n){const r=this;super.propertyChangedHandler(e,t,n),"animation"!==e&&"theme"!==e&&r.refresh()}}),window[n].Utilities.Assign("PositionDetection",class{constructor(e,t,n,r){const o=this;if(t){const n="dropDown"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);t.id=n,e.setAttribute("aria-owns",n)}o.context=e,o.dropDown=t,o.defaultParent=n,o.closeMethod=r}handleAutoPositioning(){const e=this,t=e.context;if("auto"!==t.dropDownPosition||t.disabled||t.isHidden)return;const n=window.requestAnimationFrame;let r,o=Date.now();return r=n((function i(){t.isHidden||document.hidden||(r=n(i),"auto"===t.dropDownPosition&&!t.disabled&&(t.isInShadowDOM?document.body.contains(t.shadowParent):document.body.contains(t))||cancelAnimationFrame(r),t.isHidden&&cancelAnimationFrame(r),Date.now()-o>=200&&(e.scrollHandler(),o=Date.now()))}))}checkBrowserBounds(e){const t=this.context;if("auto"===t.dropDownPosition&&!t.disabled)switch(e){case"vertically":this.checkBrowserBoundsVertically();break;case"horizontally":this.checkBrowserBoundsHorizontally();break;default:this.checkBrowserBoundsVertically(),this.checkBrowserBoundsHorizontally()}}checkBrowserBoundsHorizontally(){const e=this.context,t=this.dropDown;let n,r=0;a.isMobile||window.innerWidth===document.documentElement.clientWidth||(r=window.innerWidth-document.documentElement.clientWidth),null!==e._dropDownParent?n=!0:t.style.left="";const o=window.innerWidth-r;let i=e.getBoundingClientRect().left;if(i<0&&(t.style.left=(n?0:Math.abs(i))+"px",i=parseFloat(t.style.left)),i+t.offsetWidth>o){let e=i-Math.abs(o-i-t.offsetWidth);n&&(e+=window.pageXOffset),t.style.left=(n?e:e-i)+"px",window.innerWidth===document.documentElement.clientWidth&&(t.style.left=parseFloat(t.style.left)+r+"px"),n&&window.innerHeight===document.documentElement.clientHeight&&this.positionDropDown(!0)}}checkBrowserBoundsVertically(e){const t=this.context,n=this.dropDown,r=t._dropDownListPosition;e||(e=t.getBoundingClientRect()),0!==e.height&&(document.documentElement.clientHeight-Math.abs(e.top+e.height+n.offsetHeight)>=0?t._dropDownListPosition="bottom":e.top-n.offsetHeight>=0?t._dropDownListPosition="top":t._dropDownListPosition="overlay-center",this.updatePositionAttribute(r,t._dropDownListPosition))}scrollHandler(){const e=this.context;if(!e.parentElement)return;const t=e.getBoundingClientRect();if(t.top===e._positionTop)return;const n=e._dropDownListPosition;this.checkBrowserBoundsVertically(t),e._dropDownListPosition!==n&&this.positionDropDown(),e._positionTop=t.top}getDropDownParent(e){const t=this.context,n=this.dropDown;let r=t.dropDownAppendTo;t._positionedParent=null,null===r?t._dropDownParent=null:"body"===r||r===document.body?t.getRootNode().host?t._dropDownParent=t.getRootNode().host.shadowRoot:t._dropDownParent=document.body:r instanceof HTMLElement?t._dropDownParent=r:"string"==typeof r?(r=document.getElementById(r),r instanceof HTMLElement?t._dropDownParent=r:(t.dropDownAppendTo=null,t._dropDownParent=null)):(t.dropDownAppendTo=null,t._dropDownParent=null);let o=t._dropDownParent;if(null!==o){for(;o&&o instanceof HTMLElement&&"static"===window.getComputedStyle(o).position&&o!==t.getShadowRootOrBody();)o=o.parentElement;o===document.body?t._positionedParent=null:t._positionedParent=o,n&&(n.setAttribute("animation",t.animation),""!==t.theme&&n.$.addClass(t.theme),e&&(t._dropDownParent.appendChild(n),n.$.addClass("smart-drop-down-repositioned")),-1===t.detachedChildren.indexOf(n)&&t.detachedChildren.push(n))}}dropDownAppendToChangedHandler(){const e=this.context,t=this.dropDown,n=e._dropDownParent;this.getDropDownParent(),e._dropDownParent!==n&&(e[this.closeMethod](),["left","top","font-size","font-family","font-style","font-weight"].forEach((e=>t.style[e]=null)),null===e._dropDownParent?(this.defaultParent.appendChild(t),t.$.removeClass("smart-drop-down-repositioned")):(e._dropDownParent.appendChild(t),t.$.addClass("smart-drop-down-repositioned")))}dropDownPositionChangedHandler(){const e=this;e.dropDown.style.transition="none",e.context[e.closeMethod](),e.setDropDownPosition(),e.handleAutoPositioning()}dropDownAttached(e){const t=this.context;null!==t._dropDownParent&&(t._dropDownParent.appendChild(this.dropDown),this.handleAutoPositioning(),e&&t[e]())}dropDownDetached(){const e=this.context;null!==e._dropDownParent&&document.body.contains(this.dropDown)&&document.body.contains(e._dropDownParent)&&e._dropDownParent.removeChild(this.dropDown)}setDropDownPosition(){const e=this.context,t=e.dropDownPosition,n=e._dropDownListPosition;"auto"===t?this.checkBrowserBounds():e._dropDownListPosition=t,this.updatePositionAttribute(n,e._dropDownListPosition)}updatePositionAttribute(e,t){const n=this.context,r=this.dropDown;n.$.dropDownButton&&!n.$.dropDownButton.hasAttribute(t)&&(n.$.dropDownButton.removeAttribute(e),n.$.dropDownButton.setAttribute(t,"")),r.hasAttribute(t)||(r.style.transition="none",r.removeAttribute(e),r.setAttribute(t,""),requestAnimationFrame((function(){r.style.transition=null})))}positionDropDown(e){const t=this.context,n=this.dropDown;if(!t.opened||null===t._dropDownParent)return;const r=t.getBoundingClientRect();let o,i;if(this.customPositionDropDown){const e=this.customPositionDropDown(r);o=e.left,i=e.top}else switch(o=r.left,i=r.top,t._dropDownListPosition){case"bottom":i+=t.$.container.offsetHeight-1;break;case"center-bottom":i+=t.$.container.offsetHeight-1,o+=t.offsetWidth-n.offsetWidth/2;break;case"center-top":i-=n.offsetHeight-1,o+=t.offsetWidth-n.offsetWidth/2;break;case"top":i-=n.offsetHeight-1;break;case"overlay-bottom":break;case"overlay-center":i-=n.offsetHeight/2-t.offsetHeight/2;break;case"overlay-top":i-=n.offsetHeight-t.offsetHeight}const s=this.getDropDownOffset();n.style.top=i+s.y+"px",e||(n.style.left=o+s.x+"px")}getDropDownOffset(){const e=this.context._positionedParent;let t,n;if(e&&"#document-fragment"!==e.nodeName){const r=e.getBoundingClientRect();t=-r.left,n=-r.top}else t=window.pageXOffset,n=window.pageYOffset;return{x:t,y:n}}placeOverlay(){const e=this.context;if(!e.dropDownOverlay||e._overlay)return;const t=document.createElement("div");t.classList.add("smart-drop-down-overlay"),t.style.width=document.documentElement.scrollWidth+"px",t.style.height=document.documentElement.scrollHeight+"px",document.body.appendChild(t),e._overlay=t}removeOverlay(e){const t=this,n=t.context;n._overlay&&(n.hasAnimation&&e?requestAnimationFrame((function e(){t.dropDown.getBoundingClientRect().height>0?requestAnimationFrame(e):(document.body.removeChild(n._overlay),delete n._overlay)})):(document.body.removeChild(n._overlay),delete n._overlay))}}),window.Smart.Color=class{constructor(e){if(window.Smart._colors||(window.Smart._colors=[]),window.Smart._colors[e]){const t=window.Smart._colors[e];return this.hex=t.hex,this.r=t.r,this.g=t.g,void(this.b=t.b)}this.r=this.g=this.b=0,this.hex="";const t=this.getStandardizedColor(e);t&&(this.setHex(t.substring(1)),window.Smart._colors[e]={hex:this.hex,r:this.r,g:this.g,b:this.b})}getStandardizedColor(e){const t=document.createElement("canvas").getContext("2d");return t.fillStyle=e,t.fillStyle}getInvertedColor(){return""===this.hex?"transparent":255-(.299*this.r+.587*this.g+.114*this.b)<105?"Black":"White"}hexToRgb(e){let t="00",n="00",r="00";return 6===(e=this.validateHex(e)).length?(t=e.substring(0,2),n=e.substring(2,4),r=e.substring(4,6)):(e.length>4&&(t=e.substring(4,e.length),e=e.substring(0,4)),e.length>2&&(n=e.substring(2,e.length),e=e.substring(0,2)),e.length>0&&(r=e.substring(0,e.length))),{r:this.hexToInt(t),g:this.hexToInt(n),b:this.hexToInt(r)}}validateHex(e){return(e=(e=new String(e).toUpperCase()).replace(/[^A-F0-9]/g,"0")).length>6&&(e=e.substring(0,6)),e}webSafeDec(e){return e=Math.round(e/51),e*=51}hexToWebSafe(e){let t,n,r;return 3===e.length?(t=e.substring(0,1),n=e.substring(1,1),r=e.substring(2,1)):(t=e.substring(0,2),n=e.substring(2,4),r=e.substring(4,6)),this.intToHex(this.webSafeDec(this.hexToInt(t)))+this.intToHex(this.webSafeDec(this.hexToInt(n)))+this.intToHex(this.webSafeDec(this.hexToInt(r)))}rgbToWebSafe(e){return{r:this.webSafeDec(e.r),g:this.webSafeDec(e.g),b:this.webSafeDec(e.b)}}rgbToHex(e){return this.intToHex(e.r)+this.intToHex(e.g)+this.intToHex(e.b)}intToHex(e){let t=parseInt(e).toString(16);return 1===t.length&&(t="0"+t),t.toUpperCase()}hexToInt(e){return parseInt(e,16)}setRgb(e,t,n){let r=function(e){return e<0||e>255||isNaN(parseInt(e))?0:e};this.r=r(e),this.g=r(t),this.b=r(n),this.hex=this.rgbToHex(this)}setHex(e){this.hex=e;let t=this.hexToRgb(this.hex);this.r=t.r,this.g=t.g,this.b=t.b}}}();
|
|
90
|
+
!function(){const e="16.0.0",t=[];let n="Smart";if(window[n]&&window[n].Version){if(window[n].Version===e)return;if(window[n].Version!==e)n+=e;else{let e=2;for(;window[n];)n+=e.toString(),e++}}const r=navigator.userAgent.indexOf("Edge")>-1&&navigator.appVersion.indexOf("Edge")>-1;document.elementsFromPoint||(document.elementsFromPoint=document.msElementsFromPoint);class o{static isBoolean(e){return"boolean"==typeof e}static isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)}static isArray(e){return Array.isArray(e)}static isObject(e){return e&&("object"==typeof e||this.isFunction(e))||!1}static isDate(e){return e instanceof Date}static isString(e){return"string"==typeof e}static isNumber(e){return"number"==typeof e}static getType(e){const t=this,n=["Boolean","Number","String","Function","Array","Date","Object"].find((n=>{if(t["is"+n](e))return n}));return n?n.toLowerCase():void 0}}class i{static animate(e,t,r,o){const i=e;if(!i||i instanceof HTMLElement==0)return;if(0===i.getElementsByClassName("smart-ripple").length){const e=document.createElement("span");e.classList.add("smart-ripple"),e.setAttribute("role","presentation");let t=!0,r=null;if(window[n].EnableShadowDOM&&i.enableShadowDOM&&!0!==i.isInShadowDOM){for(let e=0;e<i.shadowRoot.host.shadowRoot.children.length;e++)"link"!==i.shadowRoot.host.shadowRoot.children[e].tagName.toLowerCase()&&(r=i.shadowRoot.host.shadowRoot.children[e]);i.shadowRoot.host.shadowRoot.querySelector(".smart-ripple")&&(t=!1)}else r=i.firstElementChild;t&&(r&&!r.noRipple&&r.offsetHeight>0?r.appendChild(e):i.appendChild(e))}let s=null;if(s=window[n].EnableShadowDOM&&i.shadowRoot?i.shadowRoot.host.shadowRoot.querySelector(".smart-ripple"):i.getElementsByClassName("smart-ripple")[0],!s)return;s.innerHTML="",s.classList.remove("smart-animate"),s.style.height=s.style.width=Math.max(i.offsetHeight,i.offsetWidth)+"px";const a=window.getComputedStyle(s.parentElement),l=parseInt(a.borderLeftWidth)||0,d=parseInt(a.borderTopWidth)||0,c=i.getBoundingClientRect(),u=t-(c.left+window.pageXOffset)-s.offsetWidth/2-l,p=r-(c.top+window.pageYOffset)-s.offsetHeight/2-d;s.style.left=u+"px",s.style.top=p+"px",s.classList.add("smart-animate"),s.addEventListener("animationend",(function e(){s.parentElement&&s.parentElement.removeChild(s),o&&o(),s.removeEventListener("animationend",e),s.removeEventListener("animationcancel",e)})),s.addEventListener("animationcancel",(function e(){s.parentElement&&s.parentElement.removeChild(s),o&&o(),s.removeEventListener("animationcancel",e),s.removeEventListener("animationend",e)}))}}class s{static easeInQuad(e,t,n,r){return n*(e/=r)*e+t}static easeOutQuad(e,t,n,r){return-n*(e/=r)*(e-2)+t}static easeInOutQuad(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t}static easeInCubic(e,t,n,r){return n*(e/=r)*e*e+t}static easeOutCubic(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}static easeInOutCubic(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t}static easeInQuart(e,t,n,r){return n*(e/=r)*e*e*e+t}static easeOutQuart(e,t,n,r){return-n*((e=e/r-1)*e*e*e-1)+t}static easeInOutQuart(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t}static easeInQuint(e,t,n,r){return n*(e/=r)*e*e*e*e+t}static easeOutQuint(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t}static easeInOutQuint(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t}static easeInSine(e,t,n,r){return-n*Math.cos(e/r*(Math.PI/2))+n+t}static easeOutSine(e,t,n,r){return n*Math.sin(e/r*(Math.PI/2))+t}static easeInOutSine(e,t,n,r){return-n/2*(Math.cos(Math.PI*e/r)-1)+t}static easeInExpo(e,t,n,r){return 0===e?t:n*Math.pow(2,10*(e/r-1))+t}static easeOutExpo(e,t,n,r){return e===r?t+n:n*(1-Math.pow(2,-10*e/r))+t}static easeInOutExpo(e,t,n,r){return 0===e?t:e===r?t+n:(e/=r/2)<1?n/2*Math.pow(2,10*(e-1))+t:n/2*(2-Math.pow(2,-10*--e))+t}static easeInCirc(e,t,n,r){return-n*(Math.sqrt(1-(e/=r)*e)-1)+t}static easeOutCirc(e,t,n,r){return n*Math.sqrt(1-(e=e/r-1)*e)+t}static easeInOutCirc(e,t,n,r){return(e/=r/2)<1?-n/2*(Math.sqrt(1-e*e)-1)+t:n/2*(Math.sqrt(1-(e-=2)*e)+1)+t}static easeInElastic(e,t,n,r){let o=1.70158,i=0,s=n;return 0===e?t:1==(e/=r)?t+n:(i||(i=.3*r),s<Math.abs(n)?(s=n,o=i/4):o=i/(2*Math.PI)*Math.asin(n/s),-s*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*(2*Math.PI)/i)+t)}static easeOutElastic(e,t,n,r){let o=1.70158,i=0,s=n;return 0===e?t:1==(e/=r)?t+n:(i||(i=.3*r),s<Math.abs(n)?(s=n,o=i/4):o=i/(2*Math.PI)*Math.asin(n/s),s*Math.pow(2,-10*e)*Math.sin((e*r-o)*(2*Math.PI)/i)+n+t)}static easeInOutElastic(e,t,n,r){let o=1.70158,i=0,s=n;return 0===e?t:2==(e/=r/2)?t+n:(i||(i=r*(.3*1.5)),s<Math.abs(n)?(s=n,o=i/4):o=i/(2*Math.PI)*Math.asin(n/s),e<1?s*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*(2*Math.PI)/i)*-.5+t:s*Math.pow(2,-10*(e-=1))*Math.sin((e*r-o)*(2*Math.PI)/i)*.5+n+t)}static easeInBack(e,t,n,r,o){return void 0===o&&(o=1.70158),n*(e/=r)*e*((o+1)*e-o)+t}static easeOutBack(e,t,n,r,o){return void 0===o&&(o=1.70158),n*((e=e/r-1)*e*((o+1)*e+o)+1)+t}static easeInOutBack(e,t,n,r,o){return void 0===o&&(o=1.70158),(e/=r/2)<1?n/2*(e*e*((1+(o*=1.525))*e-o))+t:n/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t}static easeInBounce(e,t,n,r){return n-this.easeOutBounce(r-e,0,n,r)+t}static easeOutBounce(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t}static easeInOutBounce(e,t,n,r){return e<r/2?.5*this.easeInBounce(2*e,0,n,r)+t:.5*this.easeOutBounce(2*e-r,0,n,r)+.5*n+t}}class a{static get isMobile(){const e=/(iphone|ipod|ipad|android|iemobile|blackberry|bada)/.test(window.navigator.userAgent.toLowerCase());return e||["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}static get Browser(){let e;const t=function(t){let n=t.indexOf(e);if(-1===n)return;const r=t.indexOf("rv:");return"Trident"===e&&-1!==r?parseFloat(t.substring(r+3)):parseFloat(t.substring(n+e.length+1))};let n={};return n[function(){const t=[{string:navigator.userAgent,subString:"Edge",identity:"Edge"},{string:navigator.userAgent,subString:"MSIE",identity:"IE"},{string:navigator.userAgent,subString:"Trident",identity:"IE"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"Opera",identity:"Opera"},{string:navigator.userAgent,subString:"OPR",identity:"Opera"},{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"Safari",identity:"Safari"}];for(let n=0;n<t.length;n++){let r=t[n].string;if(e=t[n].subString,-1!==r.indexOf(t[n].subString))return t[n].identity}return"Other"}()]=!0,n.version=t(navigator.userAgent)||t(navigator.appVersion)||"Unknown",n}static toCamelCase(e){return e.replace(/-([a-z])/g,(function(e){return e[1].toUpperCase()}))}static toDash(e){return e.split(/(?=[A-Z])/).join("-").toLowerCase()}static unescapeHTML(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent}static escapeHTML(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(e).replace(/[&<>"'`=\/]/g,(e=>t[e]))}static sanitizeHTML(e){if(e&&(e.indexOf("onclick")>=0||e.indexOf("onload")>=0||e.indexOf("onerror")>=0))return this.escapeHTML(e);const t=new RegExp("<s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)[^>]*>(.*?)<s*/s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)>","ig");return String(e).replace(t,(e=>this.escapeHTML(e)))}static createGUID(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}static getScriptLocation(){return"./"!==window[n].BaseUrl?window[n].BaseUrl:function(){if(document.currentScript){let e=document.currentScript.src,t=e.lastIndexOf("/");return e=e.substring(0,t),e}const e=new Error;let t="(",n=")";if(Smart.Utilities.Core.Browser.Safari&&(t="@",n="\n"),e.fileName)return e.fileName.replace("/smart.element.js","");let r=e.stack.split(t);return r=r[1],r=r.split(n)[0],r=r.split(":"),r.splice(-2,2),r=r.join(":"),r.replace("/smart.element.js","")}()}static CSSVariablesSupport(){return window.CSS&&window.CSS.supports&&window.CSS.supports("(--fake-var: 0)")}static assign(e,t){const n=e=>e&&"object"==typeof e&&!Array.isArray(e)&&null!==e;let r=Object.assign({},e);return n(e)&&n(t)&&Object.keys(t).forEach((o=>{n(t[o])?o in e?r[o]=this.assign(e[o],t[o]):Object.assign(r,{[o]:t[o]}):Object.assign(r,{[o]:t[o]})})),r}static html(e,t){const n=this;let r="",o=e.childNodes;if(!t){for(let e,t=0,i=o.length;t<i&&(e=o[t]);t++){const t=["strong"];if(e instanceof HTMLElement||e.tagName&&t.indexOf(e.tagName.toLowerCase())>=0){const t=e.tagName.toLowerCase(),o=e.attributes;let i="<"+t;for(let e,t=0;e=o[t];t++)i+=" "+e.name+'="'+e.value.replace(/[&\u00A0"]/g,y.Core.escapeHTML)+'"';i+=">",["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"][t]&&(r+=i),r=r+i+n.html(e)+"</"+t+">"}else{if(8===e.nodeType)continue;r+=e.textContent.replace(/[&\u00A0<>]/g,y.Core.escapeHTML)}}return r}{const n=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi;e.innerHTML=t.replace(n,"<$1></$2>")}}}let l=[];class d{static watch(e){switch(e.nodeName.toLowerCase()){case"smart-grid":case"smart-kanban":case"smart-table":case"smart-pivot-table":case"smart-scheduler":case"smart-tabs":case"smart-card-view":case"smart-list-box":case"smart-combo-box":case"smart-drop-down-list":case"smart-calendar":case"smart-gauge":case"smart-numeric-text-box":case"smart-menu":case"smart-tree":l.push(e);break;default:return}d.start()}static start(){d.isStarted||(d.isStarted=!0,d.interval&&clearInterval(d.interval),0===l.length||document.hidden?d.isStarted=!1:d.interval=setInterval((function(){d.observe()}),100))}static stop(){d.isStarted=!1,d.interval&&clearInterval(d.interval)}static observeElement(e){const t=e;if("test"===window.Smart.Mode||document.hidden)return void(d.interval&&clearInterval(d.interval));let n=e._computedStyle||"resize"!==t.hasStyleObserver?document.defaultView.getComputedStyle(t,null):{},r=!0,o="resize"!==t.hasStyleObserver?["paddingLeft","paddingRight","paddingTop","paddingBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","display","visibility","font-size","font-family","font-style","font-weight","max-height","min-height","max-width","min-width","overflow","overflow-x","overflow-y"]:[];if(e.styleProperties&&(o=o.concat(e.styleProperties)),e.observableStyleProperties&&(o=e.observableStyleProperties),!t._styleInfo){t._styleInfo=[];for(let e=0;e<o.length;e++){const r=o[e],i=r.startsWith("--")?n.getPropertyValue(r):n[r];t._styleInfo[r]=i}return}if(e.isHidden||"none"!==n.display&&(0!==e.offsetWidth&&0!==e.offsetHeight||(e.isHidden=!0)),e.isHidden){if(e.visibilityChangedHandler(),e.isHidden)return;r=!1}let i=[];for(let e=0;e<o.length;e++){const r=o[e],s=r.startsWith("--")?n.getPropertyValue(r):n[r];t._styleInfo[r]!==s&&(i[r]={oldValue:t._styleInfo[r],value:s},i.length++),t._styleInfo[r]=s}i.length>0&&(t.$.fireEvent("styleChanged",{styleProperties:i},{bubbles:!1,cancelable:!0}),i.display&&r&&t.$.fireEvent("resize",t,{bubbles:!1,cancelable:!0}))}static observe(){for(let e=0;e<l.length;e++){const t=l[e];this.observeElement(t)}}static unwatch(e){d.stop();const t=l.indexOf(e);-1!==t&&l.splice(t,1),d.start()}}let c=[];const u=[],p=["resize","down","up","move","tap","taphold","swipeleft","swiperight","swipetop","swipebottom"];class h{constructor(e){const t=this;t.target=e,t.$target=new f(e),t.$document=e.$document?e.$document:new f(document),t.id=(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase();let n={handlers:{},boundEventTypes:[],listen:t.listen.bind(t),unlisten:t.unlisten.bind(t)};return t.tapHoldDelay=750,t.swipeMin=10,t.swipeMax=5e3,t.swipeDelay=1e3,t.tapHoldDelay=750,t.inputEventProperties=["clientX","clientY","pageX","pageY","screenX","screenY"],p.forEach((e=>{n[e]=t=>{n.handlers[e]=t},t[e]=e=>{if(!n.handlers[e.type]){if(("mousemove"===e.type||"pointermove"===e.type||"touchmove"===e.type)&&n.handlers.move){const r=t.createEvent(e,"move");n.handlers.move(r)}return!0}return n.handlers[e.type](e)}})),t.listen(),t.handlers=n.handlers,n}listen(e){const t=this;if("resize"===e&&t.target!==document&&t.target!==window&&!1!==t.target.hasResizeObserver)if(Smart.Utilities.Core.Browser.Firefox){if(!t.target.resizeObserver){let e,n,r,o=!1,i=t.target.offsetWidth,s=t.target.offsetHeight;const a=new ResizeObserver((()=>{if(!o)return void(o=!0);const a=new CustomEvent("resize",{bubbles:!1,cancelable:!0});n=t.target.offsetWidth,r=t.target.offsetHeight,e=n!==i||r!==s,t.target.requiresLayout&&(e=!0),e&&(t.resize(a),t.target.requiresLayout=!1)}));a.observe(t.target),t.target.resizeObserver=a}}else if(!t.target.resizeTrigger){const e=document.createElement("div");e.className="smart-resize-trigger-container",e.innerHTML='<div class="smart-resize-trigger-container"><div class="smart-resize-trigger"></div></div><div class="smart-resize-trigger-container"><div class="smart-resize-trigger-shrink"></div></div>',e.setAttribute("aria-hidden",!0),window[n].EnableShadowDOM&&t.target.shadowRoot?t.target.shadowRoot.appendChild(e):t.target.appendChild(e),t.target.resizeTrigger=e;const r=e.childNodes[0],o=r.childNodes[0],i=e.childNodes[1],s=function(){o.style.width="100000px",o.style.height="100000px",r.scrollLeft=1e5,r.scrollTop=1e5,i.scrollLeft=1e5,i.scrollTop=1e5};let a,l,d,c,u=t.target.offsetWidth,p=t.target.offsetHeight;if(0===u||0===p){const e=function(){s(),t.target.removeEventListener("resize",e)};t.target.addEventListener("resize",e),s()}else s();t.target.resizeHandler=function(){l||(l=requestAnimationFrame((function(){if(l=0,d=t.target.offsetWidth,c=t.target.offsetHeight,a=d!==u||c!==p,t.target.requiresLayout&&(a=!0),!a)return;u=d,p=c;const e=new CustomEvent("resize",{bubbles:!1,cancelable:!0});t.resize(e),t.target.requiresLayout=!1}))),s()},r.addEventListener("scroll",t.target.resizeHandler),i.addEventListener("scroll",t.target.resizeHandler)}t.isListening||(t.isListening=!0,t.isPressed=!1,t.isReleased=!1,t.isInBounds=!1,window.PointerEvent?(t.$target.listen("pointerdown.inputEvents"+t.id,t.pointerDown.bind(t)),t.$target.listen("pointerup.inputEvents"+t.id,t.pointerUp.bind(t)),t.$target.listen("pointermove.inputEvents"+t.id,t.pointerMove.bind(t)),t.$target.listen("pointercancel.inputEvents"+t.id,t.pointerCancel.bind(t))):("ontouchstart"in window&&(t.$target.listen("touchmove.inputEvents"+t.id,t.touchMove.bind(t)),t.$target.listen("touchstart.inputEvents"+t.id,t.touchStart.bind(t)),t.$target.listen("touchend.inputEvents"+t.id,t.touchEnd.bind(t)),t.$target.listen("touchcancel.inputEvents"+t.id,t.touchCancel.bind(t))),t.$target.listen("mousedown.inputEvents"+t.id,t.mouseDown.bind(t)),t.$target.listen("mouseup.inputEvents"+t.id,t.mouseUp.bind(t)),t.$target.listen("mousemove.inputEvents"+t.id,t.mouseMove.bind(t)),t.$target.listen("mouseleave.inputEvents"+t.id,t.mouseLeave.bind(t))),t.target._handleDocumentUp||(t.target._handleDocumentUp=t.handleDocumentUp.bind(t),t.target._handleDocumentUpId=t.id,t.$document.listen("mouseup.inputEvents"+t.target._handleDocumentUpId,t.target._handleDocumentUp)))}unlisten(e){const t=this;if(t.isListening=!1,window.PointerEvent?(t.$target.unlisten("pointerdown.inputEvents"+t.id),t.$target.unlisten("pointerup.inputEvents"+t.id),t.$target.unlisten("pointermove.inputEvents"+t.id),t.$target.unlisten("pointercancel.inputEvents"+t.id)):("ontouchstart"in window&&(t.$target.unlisten("touchstart.inputEvents"+t.id),t.$target.unlisten("touchmove.inputEvents"+t.id),t.$target.unlisten("touchend.inputEvents"+t.id),t.$target.unlisten("touchcancel.inputEvents"+t.id)),t.$target.unlisten("mousedown.inputEvents"+t.id),t.$target.unlisten("mouseup.inputEvents"+t.id),t.$target.unlisten("mousemove.inputEvents"+t.id),t.$target.unlisten("mouseleave.inputEvents"+t.id)),t.target._handleDocumentUp&&(t.$document.unlisten("mouseup.inputEvents"+t.target._handleDocumentUpId,t.target._handleDocumentUp),delete t.target._handleDocumentUp,delete t.target._handleDocumentUpId),"resize"===e)if(Smart.Utilities.Core.Browser.Firefox)t.target.resizeObserver&&(t.target.resizeObserver.unobserve(t.target),delete t.target.resizeObserver);else if(t.target.resizeTrigger){const e=t.target.resizeTrigger,n=e.childNodes[0],r=e.childNodes[1];n.removeEventListener("scroll",t.target.resizeHandler),r.removeEventListener("scroll",t.target.resizeHandler),t.target.resizeHandler=null,e.parentNode.removeChild(e),delete t.target.resizeTrigger}}handleDocumentUp(e){const t=this;t.isPressed=!1,t.isReleased=!1,t.resetSwipe(e)}createEvent(e,t){const n=this,r=e.touches,o=e.changedTouches,i=r&&r.length?r[0]:o&&o.length?o[0]:void 0,s=new CustomEvent(t,{bubbles:!0,cancelable:!0,composed:void 0!==n.$target.element.getRootNode().host});if(s.originalEvent=e,i){for(let e=0;e<n.inputEventProperties.length;e++){const t=n.inputEventProperties[e];s[t]=i[t]}return s}for(let t in e)t in s||(s[t]=e[t]);return s}fireTap(e){const t=this;if(clearTimeout(this.tapHoldTimeout),!this.tapHoldFired&&this.isInBounds){const n=t.createEvent(e,"tap");t.tap(n)}}initTap(e){const t=this;t.isInBounds=!0,t.tapHoldFired=!1,t.tapHoldTimeout=setTimeout((function(){if(t.isInBounds){t.tapHoldFired=!0;const n=t.createEvent(e,"taphold");t.taphold(n)}}),t.tapHoldDelay)}pointerDown(e){return this.handleDown(e)}mouseDown(e){const t=this;if(!(t.isPressed||t.touchStartTime&&new Date-t.touchStartTime<500))return t.handleDown(e)}touchStart(e){const t=this;return t.touchStartTime=new Date,t.isTouchMoved=!0,t.handleDown(e)}mouseUp(e){const t=this;if(!(t.isReleased||t.touchEndTime&&new Date-t.touchEndTime<500))return t.handleUp(e)}handleDown(e){const t=this;t.isReleased=!1,t.isPressed=!0;const n=t.createEvent(e,"down");return(t.handlers.tap||t.handlers.taphold)&&t.initTap(n),(t.handlers.swipeleft||t.handlers.swiperight||t.handlers.swipetop||t.handlers.swipebottom)&&t.initSwipe(n),t.down(n)}handleUp(e){const t=this;t.isReleased=!0,t.isPressed=!1;const n=t.createEvent(e,"up"),r=t.up(n);return(t.handlers.tap||t.handlers.taphold)&&t.fireTap(n),t.resetSwipe(n),r}handleMove(e){const t=this;let n=t.move(e);return t.isPressed&&(t._maxSwipeVerticalDistance=Math.max(t._maxSwipeVerticalDistance,Math.abs(t._startY-e.pageY)),t._maxSwipeHorizontalDistance=Math.max(t._maxSwipeHorizontalDistance,Math.abs(t._startX-e.pageX)),n=t.handleSwipeEvents(e)),n}touchEnd(e){return this.touchEndTime=new Date,this.handleUp(e)}pointerUp(e){return this.handleUp(e)}pointerCancel(e){this.pointerUp(e)}touchCancel(e){this.touchEnd(e)}mouseLeave(){this.isInBounds=!1}mouseMove(e){if(!this.isTouchMoved)return this.handleMove(e)}pointerMove(e){return this.handleMove(e)}touchMove(e){const t=this,n=e.touches,r=e.changedTouches,o=n&&n.length?n[0]:r&&r.length?r[0]:void 0;for(let n=0;n<t.inputEventProperties.length;n++){const r=t.inputEventProperties[n];void 0===e[r]&&(e[r]=o[r])}return t.isTouchMoved=!0,t.handleMove(e)}handleSwipeEvents(e){const t=this;let n=!0;return(t.handlers.swipetop||t.handlers.swipebottom)&&(n=this.handleVerticalSwipeEvents(e)),!1===n||(t.handlers.swipeleft||t.handlers.swiperight)&&(n=this.handleHorizontalSwipeEvents(e)),n}handleVerticalSwipeEvents(e){let t,n;return t=e.pageY,n=t-this._startY,this.swiped(e,n,"vertical")}handleHorizontalSwipeEvents(e){let t,n;return t=e.pageX,n=t-this._startX,this.swiped(e,n,"horizontal")}swiped(e,t,n){const r=this;if(n=n||0,Math.abs(t)>=r.swipeMin&&!r._swipeEvent&&!r._swipeLocked){let o=t<0?"swipeleft":"swiperight";if("horizontal"===n?r._swipeEvent=r.createEvent(e,o):(o=t<0?"swipetop":"swipebottom",r._swipeEvent=r.createEvent(e,t<0?"swipetop":"swipebottom")),r[o]&&(r[o](this._swipeEvent),Math.abs(t)<=this.swipeMax))return e.stopImmediatePropagation(),!1}return!0}resetSwipe(){this._swipeEvent=null,clearTimeout(this._swipeTimeout)}initSwipe(e){const t=this;t._maxSwipeVerticalDistance=0,t._maxSwipeHorizontalDistance=0,t._startX=e.pageX,t._startY=e.pageY,t._swipeLocked=!1,t._swipeEvent=null,t._swipeTimeout=setTimeout((function(){t._swipeLocked=!0}),t.swipeDelay)}}class m{get scrollWidth(){const e=this;return e.horizontalScrollBar?e.horizontalScrollBar.max:-1}set scrollWidth(e){const t=this;e<0&&(e=0),t.horizontalScrollBar&&(t.horizontalScrollBar.max=e)}get scrollHeight(){const e=this;return e.verticalScrollBar?e.verticalScrollBar.max:-1}set scrollHeight(e){const t=this;e<0&&(e=0),t.verticalScrollBar&&(t.verticalScrollBar.max=e)}get scrollLeft(){const e=this;return e.horizontalScrollBar?e.horizontalScrollBar.value:-1}set scrollLeft(e){const t=this;e<0&&(e=0),t.horizontalScrollBar&&(t.horizontalScrollBar.value=e)}get scrollTop(){const e=this;return e.verticalScrollBar?e.verticalScrollBar.value:-1}set scrollTop(e){const t=this;e<0&&(e=0),t.verticalScrollBar&&(t.verticalScrollBar.value=e)}get vScrollBar(){return this.verticalScrollBar}get hScrollBar(){return this.horizontalScrollBar}constructor(e,t,n){const r=this;r.container=e,r.horizontalScrollBar=t,r.verticalScrollBar=n,r.disableSwipeScroll=!1,r.listen()}listen(){const e=this,t=a.isMobile,n=e.horizontalScrollBar,r=e.verticalScrollBar;let o,i,s,l,d,c,u,p;e.inputEvents=new h(e.container);const m=function(e){return{amplitude:0,delta:0,initialValue:0,min:0,max:e.max,previousValue:0,pointerPosition:0,targetValue:0,scrollBar:e,value:0,velocity:0}},f=m(n),g=m(r),w=function(){const t=e.container.touchVelocityCoefficient||50;c=Date.now(),u=c-l,l=c;const n=function(e){e.delta=e.value-e.previousValue,e.previousValue=e.value;let n=t*e.delta/(1+u);e.velocity=.8*n+.2*e.velocity};n(g),n(f)},b=function(e){return p.value=e>p.max?p.max:e<p.min?p.min:e,p.scrollBar.value=p.value,e>p.max?"max":e<p.min?"min":"value"};function v(){let t,n;p.amplitude&&(e.container.$.fireEvent("kineticScroll"),t=Date.now()-l,n=-p.amplitude*Math.exp(-t/500),n>5||n<-5?(b(p.targetValue+n),cancelAnimationFrame(i),i=0,i=requestAnimationFrame(v)):b(p.targetValue))}let _;e.inputEvents.down((function(n){if(!t)return;const r=n.originalEvent.target,i=r&&r.closest?r.closest("smart-scroll-bar"):void 0;if(i===e.horizontalScrollBar||i===e.verticalScrollBar)return;s=!0,o=!1;const a=function(e,t){e.amplitude=0,e.pointerPosition=t,e.previousValue=e.value,e.value=e.scrollBar.value,e.initialValue=e.value,e.max=e.scrollBar.max};a(g,n.clientY),a(f,n.clientX),l=Date.now(),clearInterval(d),d=setInterval(w,500)})),e.inputEvents.up((function(){if(!s)return!0;if(clearInterval(d),e.disableSwipeScroll)return void(s=!1);const t=function(e){p=e,e.amplitude=.8*e.velocity,e.targetValue=Math.round(e.value+e.amplitude),l=Date.now(),cancelAnimationFrame(i),i=requestAnimationFrame(v),e.velocity=0};g.velocity>10||g.velocity<-10?t(g):(f.velocity>10||f.velocity<-10)&&t(f),s=!1})),e.inputEvents.move((function(t){if(!s)return!0;if(e.disableSwipeScroll)return;if(o&&(t.originalEvent.preventDefault(),t.originalEvent.stopPropagation()),f.visible=e.scrollWidth>0,g.visible=e.scrollHeight>0,!s||!f.visible&&!g.visible)return;const n=e.container.touchScrollRatio,r=e.container;let i,a;n&&("number"==typeof n?(i=-n,a=-n):"function"==typeof n&&(i=n(g.max,r.offsetHeight),a=n(f.max,r.offsetWidth))),g.ratio=i||-g.max/r.offsetHeight,g.delta=(t.clientY-g.pointerPosition)*g.ratio,f.ratio=a||-f.max/r.offsetWidth,f.delta=(t.clientX-f.pointerPosition)*f.ratio;let l="value";const d=function(t,n,r){return t.delta>5||t.delta<-5?(p=t,l=t.initialValue+t.delta>p.max?"max":t.initialValue+t.delta<p.min?"min":"value","min"===l&&0===t.initialValue||"max"===l&&t.initialValue===t.max||!t.visible||(e.container.$.fireEvent("kineticScroll"),b(t.initialValue+t.delta),w(),r.originalEvent.preventDefault(),r.originalEvent.stopPropagation(),o=!0,!1)):null};let c=d(g,t.clientY,t);if(null!==c)return c;{let e=d(f,t.clientX,t);if(null!==e)return e}})),e.scrollTo=function(t,n){const r=!1===n?f:g;let o=!1;l||(l=Date.now()),_||(_=Date.now()),Math.abs(Date.now()-_)>375?l=Date.now():o=!0,_=Date.now(),r.value=r.scrollBar.value,r.delta=t-r.value,r.max=r.scrollBar.max,t<=r.min&&(t=r.min),t>=r.max&&(t=r.max),r.targetValue=t;const s=t;let a=r.value;r.velocity=100*r.delta/(1+r.max),r.from=a;const d=function(e){return r.value=e>r.max?r.max:e<r.min?r.min:e,r.scrollBar.value=r.value,e>r.max?"max":e<r.min?"min":"value"},c=function(){let n,u=Date.now()-_,p=Math.min(1e3,Date.now()-l),h=r.velocity*Math.exp(p/175);if(o)(h<0&&r.value<=t||h>0&&r.value>=t)&&(h=0),(r.value+h<=r.min||r.value+h>=r.max)&&(h=0),h>.5||h<-.5?(d(r.value+h),cancelAnimationFrame(i),i=0,i=requestAnimationFrame(c)):d(r.targetValue);else{if(u>=175)return cancelAnimationFrame(i),e.container.$.fireEvent("kineticScroll"),void(i=0);n=y.Animation.Easings.easeInSine(u,a,s-a,175),d(n),cancelAnimationFrame(i),i=0,i=requestAnimationFrame(c)}};cancelAnimationFrame(i),i=requestAnimationFrame(c)},e.inputEvents.listen()}unlisten(){const e=this;e.inputEvents&&e.inputEvents.unlisten(),delete e.inputEvents}}class f{constructor(e){this.events={},this.handlers={},this.element=e}hasClass(e){const t=this,n=e.split(" ");for(let e=0;e<n.length;e++)if(!t.element.classList.contains(n[e]))return!1;return!0}addClass(e){const t=this;if(t.hasClass(e))return;const n=e.split(" ");for(let e=0;e<n.length;e++)t.element.classList.add(n[e]);t.isNativeElement||d.observeElement(t.element)}removeClass(e){const t=this;if(0===arguments.length)return void t.element.removeAttribute("class");const n=e.split(" ");for(let e=0;e<n.length;e++)t.element.classList.remove(n[e]);""===t.element.className&&t.element.removeAttribute("class"),t.isNativeElement||d.observeElement(t.element)}get isCustomElement(){const e=this;return!!e.element.tagName.startsWith(n)||e.element instanceof window[n].BaseElement==1||"DIV"!==e.element.tagName&&"SPAN"!==e.element.tagName&&"BUTTON"!==e.element.tagName&&"INPUT"!==e.element.tagName&&"UL"!==e.element.tagName&&"LI"!==e.element.tagName&&document.createElement(e.element.nodeName)instanceof window[n].BaseElement==1}get isNativeElement(){return!this.isCustomElement}dispatch(e){const t=this,n=t.events[e.type];let r=!1;if(n.length>1)for(let e=0;e<n.length;e++){const t=n[e];if(t.namespace&&t.namespace.indexOf("_")>=0){r=!0;break}}r&&n.sort((function(e,t){let n=e.namespace,r=t.namespace;return n=-1===n.indexOf("_")?0:parseInt(n.substring(n.indexOf("_")+1)),r=-1===r.indexOf("_")?0:parseInt(r.substring(r.indexOf("_")+1)),n<r?-1:n>r?1:0}));for(let r=0;r<n.length;r++){const o=n[r];if(e.namespace=o.namespace,e.context=o.context,e.defaultPrevented)break;const i=o.handler.apply(t.element,[e]);if(void 0!==i&&(e.result=i,!1===i)){e.preventDefault(),e.stopPropagation();break}}return e.result}fireEvent(e,t,n){const r=this;n||(n={bubbles:!0,cancelable:!0,composed:null!==r.element.getRootNode().host}),n.detail=t||{};const o=new CustomEvent(e,n);return o.originalStopPropagation=o.stopPropagation,o.stopPropagation=function(){return o.isPropagationStopped=!0,o.originalStopPropagation()},r.dispatchEvent(o),o}get isPassiveSupported(){const e=this;if(void 0!==e.supportsPassive)return e.supportsPassive;e.supportsPassive=!1;try{let t=Object.defineProperty({},"passive",{get:function(){e.supportsPassive=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}return e.supportsPassive}dispatchEvent(e){const t=this,n=e.type,r=t.element.context,o=n.substring(0,1).toUpperCase()+n.substring(1);t.element.context=document,t.element["on"+o]?t.element["on"+o](e):t.element["on"+n.toLowerCase()]?t.element["on"+n.toLowerCase()](e):t.element.dispatchEvent(e),t.element.context=r}listen(e,t){const n=this,r=e.split("."),o=r.slice(1).join("."),i=r[0];n.events[i]||(n.events[i]=[]);const s={type:i,handler:t,context:n.element,namespace:o};p.indexOf(i)>=0&&(n.inputEvents||(n.inputEvents=new h(n.element)),n.inputEvents[i]((function(e){n.dispatchEvent(e)})),n.inputEvents.boundEventTypes.push(i),n.inputEvents.listen(i)),0===n.events[i].length&&(n.handlers[i]=n.dispatch.bind(n),"wheel"===i?n.element.addEventListener("wheel",n.handlers[i],!!n.isPassiveSupported&&{passive:!1}):"touchmove"===i||"touchstart"===i||"touchend"===i?n.element.addEventListener(i,n.handlers[i],!!n.isPassiveSupported&&{passive:!1}):n.element.addEventListener(i,n.handlers[i],!1)),n.events[i].push(s)}unlisten(e){const t=this,n=e.split("."),r=n.slice(1).join("."),o=n[0];let i=t.events[o];if(t.inputEvents&&t.inputEvents.boundEventTypes.indexOf(o)>=0&&(t.inputEvents.boundEventTypes.splice(t.inputEvents.boundEventTypes.indexOf(o),1),0===t.inputEvents.boundEventTypes.length&&t.inputEvents.unlisten(o)),i){for(let e=0;e<i.length;e++){if(""!==r){let e=i.findIndex((e=>e.namespace===r));i.splice(e,1);break}i=[]}0===i.length&&(t.element.removeEventListener(o,t.handlers[o]),t.events[o]=[],delete t.handlers[o])}}getAttributeValue(e,t){const n=this,r=n.element.getAttribute(e);if(n.isNativeElement)return n.deserialize(r,t);const o=n.element.propertyByAttributeName[e];return void 0===o.deserialize?n.deserialize(r,t,o.nullable):n.element[o.deserialize](r)}setAttributeValue(e,t,n){const r=this;let o,i=!1;if(r.isNativeElement){if(o=r.serialize(t,n),"boolean"===n&&["checked","selected","async","autofocus","autoplay","controls","defer","disabled","hidden","ismap","loop","multiple","open","readonly","required","scoped"].indexOf(e)>=0)return void(t?r.element.setAttribute(e,""):r.element.removeAttribute(e))}else{const s=r.element.propertyByAttributeName[e];i=!s||s.nullable,o=s&&s.serialize?r.element[s.serialize](t):r.serialize(t,n,i)}"array"!==n&&"object"!==n||"[]"!==o&&"{}"!==o?void 0===o?(r.element.removeAttribute(e),r.element.shadowRoot&&r.element.$.root&&r.element.$.root.removeAttribute(e)):(r.element.setAttribute(e,o),r.element.shadowRoot&&r.element.$.root&&r.element.$.root.setAttribute(e,o)):r.element.removeAttribute(e)}serialize(e,t,n){if(void 0===t&&(t=y.Types.getType(e)),void 0!==e&&(n||null!==e)){if(n&&null===e)return"null";if("string"===t)return e;if("boolean"===t||"bool"===t){if(!0===e||"true"===e||1===e||"1"===e)return"";if(!1===e||"false"===e||0===e||"0"===e)return}return"array"===t?JSON.stringify(e):["string","number","int","integer","float","date","any","function"].indexOf(t)>=0?e.toString():"object"===t?JSON.stringify(e):void 0}}deserialize(e,t,n){const r="null"===e;if(void 0!==e&&(!r||n)){if(r&&n)return null;if("boolean"===t||"bool"===t)return null!==e;if("number"===t||"float"===t)return"NaN"===e?NaN:"Infinity"===e?1/0:"-Infinity"===e?-1/0:parseFloat(e);if("int"===t||"integer"===t)return"NaN"===e?NaN:"Infinity"===e?1/0:"-Infinity"===e?-1/0:parseInt(e);if("string"===t)return e;if("any"===t)return e;if("date"===t)return new Date(e);if("function"===t){if("function"==typeof window[e])return window[e]}else if("array"===t||"object"===t)try{const t=JSON.parse(e);if(t)return t}catch(n){if(window[e]&&"object"==typeof window[e])return window[e];if("object"===t&&e.indexOf("{")>=0){let t=(e=e.replace(/{/gi,"").replace(/}/gi,"").replace("[","").replace("]","").replace(/'/gi,"").replace(/"/gi,"").trim()).trim().split(","),n={};for(let e=0;e<t.length;e++){const r=t[e].split(":")[0].trim(),o=t[e].split(":")[1].trim();n[r]=o}return n}if("array"===t&&e.indexOf("[")>=0){if(e.indexOf("{")>=0){let t=e.replace(/{/gi,"").replace("[","").replace("]","").replace(/'/gi,"").replace(/"/gi,"").trim();t=t.split("},");for(let e=0;e<t.length;e++){let n={},r=t[e].trim().split(",");for(let e=0;e<r.length;e++){const t=r[e].split(":")[0].trim(),o=r[e].split(":")[1].trim();n[t]=o}t[e]=n}return t}return e.replace("[","").replace("]","").replace(/'/gi,"").replace(/"/gi,"").trim().split(",")}}}}}class g{static get Ripple(){return i}static get Easings(){return s}}class y{static get Types(){return o}static get Core(){return a}static get Animation(){return g}static get Scroll(){return m}static get InputEvents(){return h}static Extend(e){return new f(e)}static Assign(e,t){if(e.indexOf(".")>=0){const n=e.split(".");return y[n[0]]||(y[n[0]]={}),void(y[n[0]][n[1]]=t)}y[e]=t}}const w=y.Extend(document);let b=null;document.addEventListener("click",(()=>{d.start(),b&&clearTimeout(b),b=setTimeout((()=>{d.stop()}),1e4)})),document.addEventListener("mouseenter",(()=>{d.start()})),document.addEventListener("mouseleave",(()=>{d.stop()}));class v{}v.cache={};class _ extends HTMLElement{static get properties(){return{animation:{value:"advanced",type:"string",allowedValues:["none","simple","advanced"]},unfocusable:{value:!1,type:"boolean"},disabled:{value:!1,type:"boolean"},dataContext:{value:null,reflectToAttribute:!1,type:"any"},debugMode:{value:!0,type:"boolean",reflectToAttribute:!1},locale:{value:"en",type:"string",reflectToAttribute:!1},localizeFormatFunction:{value:null,type:"any",reflectToAttribute:!1},messages:{value:{en:{propertyUnknownName:"Invalid property name: '{{name}}'!",propertyUnknownType:"'{{name}}' property is with undefined 'type' member!",propertyInvalidValue:"Invalid '{{name}}' property value! Actual value: '{{actualValue}}', Expected value: '{{value}}'!",propertyInvalidValueType:"Invalid '{{name}}' property value type! Actual type: '{{actualType}}', Expected type: '{{type}}'!",methodInvalidValueType:"Invalid '{{name}}' method argument value type! Actual type: '{{actualType}}', Expected type: '{{type}}' for argument with index: '{{argumentIndex}}'!",methodInvalidArgumentsCount:"Invalid '{{name}}' method arguments count! Actual arguments count: '{{actualArgumentsCount}}', Expected at least: '{{argumentsCount}}' argument(s)!",methodInvalidReturnType:"Invalid '{{name}}' method return type! Actual type: '{{actualType}}', Expected type: '{{type}}'!",elementNotInDOM:"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",moduleUndefined:"Module is undefined.",missingReference:"{{elementType}}: Missing reference to '{{files}}'.",htmlTemplateNotSuported:"{{elementType}}: Web Browser doesn't support HTMLTemplate elements.",invalidTemplate:"{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."}},reflectToAttribute:!1,inherit:!0,type:"object"},props:{value:null,reflectToAttribute:!1,isHierarchicalProperty:!0,type:"any"},readonly:{value:!1,type:"boolean"},renderMode:{value:"auto",type:"string",reflectToAttribute:!1,allowedValues:["auto","manual"]},rightToLeft:{value:!1,type:"boolean"},rethrowError:{value:!0,type:"boolean",reflectToAttribute:!1},theme:{value:window[n].Theme,type:"string"},visibility:{value:"visible",allowedValues:["visible","collapsed","hidden"],type:"string"},wait:{value:!1,type:"boolean"}}}getBindings(e,t){const n=this;let r=0,o={},i=(e=>{if(e instanceof HTMLElement)return n.parseAttributes(e);{let t=n.parseProperty(e.data?e.data.trim():null,"textContent",e);if(t)return n&&e.parentNode===n.$.content&&(t.value=""!==n.$.html?n.$.html:void 0,n.innerHTML=""),{textContent:t}}})(e);i&&(o.data=i),t||(o.mapping=[],t=o),e.getAttribute&&(o.nodeId=e.getAttribute("smart-id"),t&&i&&(t.mapping[o.nodeId]=i)),o.node=e,e.firstChild&&(o.children={});for(let i=e.firstChild;i;i=i.nextSibling)o.children[r++]=n.getBindings(i,t);return o}_addRemovePropertyBinding(e,t,n,r,o){if(!e||!t||!n)return;const i=this,s=i.bindings,a=n.getAttribute("smart-id"),l=e.indexOf("{{")>=0;let d=!1;(e=e.replace("{{","").replace("}}","").replace("[[","").replace("]]","")).indexOf("!")>=0&&(e=e.replace("!",""),d=!0);const c=i._properties[e],u={name:e,reflectToAttribute:c.reflectToAttribute,twoWay:l,type:c.type,not:d};if(o&&!r){const n={},r={name:e,targetPropertyName:t,reflectToAttribute:c.reflectToAttribute,twoWay:l,type:c.type,not:d};n[e]=r,s.mapping[a]=n}const p=function(e){for(let o in e){const s=e[o];if(s.nodeId===a){s.data||(s.data={}),r?(s.data[t]=null,delete s.data[t]):s.data[t]=u;break}if(s.children)p(s.children);else if(s.node&&s.node.children&&s.node===n.parentElement){const e=s.node;if(!e.firstChild)continue;s.children={};let t=0;for(let n=e.firstChild;n;n=n.nextSibling)s.children[t++]=i.getBindings(n);p(s.children)}}};p(s.children),r?delete i.boundProperties[e]:i.boundProperties[e]=!0,i.updateBoundNodes(e)}addPropertyBinding(e,t,n,r){this._addRemovePropertyBinding(e,t,n,!1,r)}removePropertyBinding(e,t,n,r){this._addRemovePropertyBinding(e,t,n,!0,r)}parseAttributes(e){const t=this;let n;for(let r=0;r<e.attributes.length;r++){const o=e.attributes[r],i=o.name,s=o.value;v.cache["toCamelCase"+i]||(v.cache["toCamelCase"+i]=y.Core.toCamelCase(i));const a=v.cache["toCamelCase"+i];if(i.indexOf("(")>=0){let r=i.substring(1,i.length-1);if(t&&!t.dataContext){t.templateListeners[e.getAttribute("smart-id")+"."+r]=s,e.removeAttribute(i);continue}{n||(n={});const e=s.substring(0,s.indexOf("("));n[a]={isEvent:!0,name:r,value:e};continue}}let l=t.parseProperty(s,i,e);l&&(n||(n={}),n[a]=l)}return n}parseProperty(e,t){if(!e||!e.length)return;const n=this;let r,o=e.length,i=0,s=0,a=0,l=!0;for(;s<o;){i=e.indexOf("{{",s);let t=e.indexOf("[[",s),n="}}";if(t>=0&&(i<0||t<i)&&(i=t,l=!1,n="]]"),a=i<0?-1:e.indexOf(n,i+2),a<0)return;r=r||{};let o=e.slice(i+2,a).trim();r.name=o,s=a+2}const d=r.name,c=n?n._properties[d]:null;return r.twoWay=l,r.ready=!1,n&&(d.indexOf("::")>=0?n.boundProperties[d.substring(0,d.indexOf("::"))]=!0:n.boundProperties[d]=!0),c?(r.type=c.type,r.reflectToAttribute=c.reflectToAttribute):(["checked","selected","async","autofocus","autoplay","controls","defer","disabled","hidden","ismap","loop","multiple","open","readonly","required","scoped"].indexOf(t)>=0?r.type="boolean":r.type="string",r.reflectToAttribute=!0),r}updateTextNodes(){const e=this;e.updateTextNode(e.shadowRoot||e,e.bindings,e)}updateTextNode(e,t,n){const r=this;if(!t)return;let o=0;for(let i=e.firstChild;i&&t.children;i=i.nextSibling)r.updateTextNode(i,t.children[o++],n);if(t&&t.data)for(let e in t.data){const r=t.data[e],o=r.name;"textContent"===e&&r.twoWay&&!r.updating&&void 0!==r.value&&(n[o]=r.value)}}updateBoundProperty(e,t){if(t.updating)return;const n=this;t.updating=!0,n[e]=t.value,t.updating=!1}updateBoundNodes(e){const t=this;if(t.updateBoundNode(t.shadowRoot||t,t.bindings,t,e),t.detachedChildren.length>0)for(let n=0;n<t.detachedChildren.length;n++){const r=t.detachedChildren[n],o=r.getAttribute("smart-id"),i=function(e){if(e.nodeId===o)return e;for(let t in e.children){const n=e.children[t];if((n.getAttribute?n.getAttribute("smart-id"):"")===o)return e;if(n.children){const e=i(n);if(e)return e}}return null},s=i(t.bindings);if(s)t.updateBoundNode(r,s,t,e,!0);else if(r.getAttribute&&t.bindings.mapping){const n=t,r=t.bindings;if(r)for(let o in r.mapping){const i=n.querySelector('[smart-id="'+o+'"]');if(i){const s=r.mapping[o];t.updateBoundData(i,s,n,e)}}}}}updateBoundMappedNodes(){const e=this,t=e.bindings,n=e;if(t.mapping)for(let r in t.mapping){let o=n.querySelector('[smart-id="'+r+'"]');if(n.shadowRoot&&(o=n.querySelector('[id="'+r+'"]'),o||(o=n.shadowRoot.querySelector('[id="'+r+'"]')||n.shadowRoot.querySelector('[smart-id="'+r+'"]'))),o){const i=t.mapping[r];e.updateBoundData(o,i,n)}else if(n.getAttribute("aria-controls")){let i=document.getElementById(n.getAttribute("aria-controls"));if(!i&&n.shadowRoot&&(i=n.shadowRoot.getElementById(n.getAttribute("aria-controls"))),o=i.querySelector('[smart-id="'+r+'"]'),o){const i=t.mapping[r];e.updateBoundData(o,i,n)}}}}updateBoundNode(e,t,n,r,o){const i=this;if(!t)return;let s=0;if(o){if(o&&!t.data)for(let a=e.firstChild;a&&t.children;a=a.nextSibling)if(a.getAttribute){const e=a.getAttribute("smart-id"),o=function(){for(let n in t.children)if(t.children[n].nodeId===e)return t.children[n]}();i.updateBoundNode(a,o,n,r),s++}else i.updateBoundNode(a,t.children[s++],n,r,o)}else for(let o=e.firstChild;o&&t.children;o=o.nextSibling)if(o.getAttribute){const e=o.getAttribute("smart-id"),a=function(){for(let n in t.children)if(t.children[n].nodeId===e)return t.children[n]}();i.updateBoundNode(o,a,n,r),s++}else i.updateBoundNode(o,t.children[s++],n,r);if(!t||!t.data)return;const a=t.data;i.updateBoundData(e,a,n,r)}updateBoundData(e,t,n,r){const o=this;for(let i in t){const s=t[i];let a=s.name;if(!s.updating&&(a.indexOf("::")>=0&&(a=a.substring(0,a.indexOf("::"))),void 0===r||r===a)){if(a.indexOf("(")>=0){let e=a.substring(a.indexOf("("));const t=a.substring(0,a.indexOf("("));if(e=e.substring(1,e.length-1),e=e.replace(/ /gi,""),e=e.split(","),e.length>0&&""!==e[0]){let r=[];for(let t=0;t<e.length;t++)r.push(n[e[t]]);s.value=n[t].apply(n,r)}else s.value=n[t]();s.type=typeof s.value}else s.value=n[a];if("innerHTML"===a){if(e[i].toString().trim()!==n[a].toString().trim()){if(window.smartBlazor&&e[i].indexOf("\x3c!--")>=0){(s.ready||n._properties[a].defaultValue!==s.value)&&(e[i]=s.value.toString());continue}(s.ready||n._properties[a].defaultValue!==s.value)&&(e[i]=s.value.toString().trim())}}else s.not?(e[i]=!s.value,s.targetPropertyName&&(e[s.targetPropertyName]=!s.value)):(e[i]=s.value,s.targetPropertyName&&(e[s.targetPropertyName]=s.value));if(e.$&&e.$.isNativeElement){v.cache["toDash"+i]||(v.cache["toDash"+i]=y.Core.toDash(i));const t=v.cache["toDash"+i],n=e.$.getAttributeValue(t,s.type);!s.reflectToAttribute||n===s.value&&s.ready||e.$.setAttributeValue(t,s.value,s.type),s.reflectToAttribute||e.$.setAttributeValue(t,null,s.type)}if(!s.ready){if(e.$&&e.$.isCustomElement){v.cache["toDash"+i]||(v.cache["toDash"+i]=y.Core.toDash(i));const t=v.cache["toDash"+i];e._properties||(e._beforeCreatedProperties=e._properties=e.propertyByAttributeName=[]),e._properties[i]||(e._properties[i]={attributeName:t},e._beforeCreatedProperties&&(e._beforeCreatedProperties[i]=e._properties[i]),e.propertyByAttributeName[t]=e._properties[i]);const n=e._properties[i];n.isUpdating=!0,s.reflectToAttribute&&(s.not?e.$.setAttributeValue(n.attributeName,!s.value,s.type):e.$.setAttributeValue(n.attributeName,s.value,s.type)),s.reflectToAttribute||e.$.setAttributeValue(n.attributeName,null,s.type),n.isUpdating=!1}if(s.twoWay){const t=function(t){if(s.value=t,e.$&&e.$.isNativeElement){v.cache["toDash"+i]||(v.cache["toDash"+i]=y.Core.toDash(i));const t=v.cache["toDash"+i],n=e.$.getAttributeValue(t,s.type);s.reflectToAttribute&&n!==s.value&&e.$.setAttributeValue(t,s.value,s.type),s.reflectToAttribute||e.$.setAttributeValue(t,null,s.type)}};if(s.name.indexOf("::")>=0){const n=s.name.indexOf("::"),r=s.name.substring(n+2);o["$"+e.getAttribute("smart-id")].listen(r,(function(){t(e[i]);const n=s.name.substring(0,s.name.indexOf("::"));o.updateBoundProperty(n,s)}))}if(e.$&&e.$.isCustomElement){e._properties[i]&&(e._properties[i].notify=!0),v.cache["toDash"+i]||(v.cache["toDash"+i]=y.Core.toDash(i));const n=v.cache["toDash"+i];o["$"+e.getAttribute("smart-id")].listen(n+"-changed",(function(e){let n=e.detail;t(n.value);const r=o.context;e.context!==document&&(o.context=o),o.updateBoundProperty(s.name,s),o.context=r}))}}}s.ready=!0}}}static clearCache(){this.cache={}}addMessages(e,t){Object.assign(this.messages[e],t)}localize(e,t){const n=this;if(!n.messages||!n.messages[n.locale])return;let r=n.messages[n.locale][e];if(""===r)return"";if(!r){const r=n.messages.en;if(r){let n=r[e];if(n){for(let e in t){let r=t[e];n=n.replace(new RegExp("{{"+e+"}}","g"),r)}return n}return e}}const o=r;for(let e in t){let n=t[e];r=r.replace(new RegExp("{{"+e+"}}","g"),n)}if(n.localizeFormatFunction){const i=n.localizeFormatFunction(o,r,t,e);if(void 0!==i)return i}return r}static get requires(){return{}}static get listeners(){return{"theme-changed":function(e){this.theme=e.detail.newValue}}}static get methods(){return{}}get classNamesMap(){return{animation:"smart-animate",rippleAnimation:"smart-ripple"}}get hasAnimation(){return"none"!==this.animation}get hasRippleAnimation(){return"none"!==this.animation&&"advanced"===this.animation}static get modules(){return window[n].Modules}get properties(){const e=this;return e._properties||(e._properties=[]),e._properties}get parents(){const e=this;let t=[],r=e.parentNode;for(;r&&9!==r.nodeType;)r instanceof HTMLElement==1&&t.push(r),r=r.parentNode;const o=e.getRootNode();if(o.host){const e=e=>{let t=[e],n=e.parentNode;for(;n&&9!==n.nodeType;)n instanceof HTMLElement==1&&t.push(n),n=n.parentNode;return t};t=t.concat(e(o.host))}return window[n].EnableShadowDOM&&e.isInShadowDOM&&e.shadowParent&&(t=t.concat(e.shadowParent.parents)),t}log(e){this._logger("log",e)}warn(e){this._logger("warn",e)}error(e){this._logger("error",e)}_logger(e,t){if(this.debugMode){const n=t instanceof Error?t.message:t.toString();console[e](n)}if(this.rethrowError&&"error"===e)throw t}get focused(){return this.contains(document.activeElement)}template(){return"<div></div>"}registered(){const e=this;e.onRegistered&&e.onRegistered()}created(){const e=this;e.isReady=!1,e._initElement(e),e._setModuleState("created"),e.onCreated&&e.onCreated()}completed(){const e=this;e.isCompleted=!0,e._onCompleted&&e._onCompleted(),e.onCompleted&&e.onCompleted()}whenReady(e){const t=this;t.isCompleted?e():(t.whenReadyCallbacks||(t.whenReadyCallbacks=[]),t.whenReadyCallbacks.push(e))}whenRendered(e){const t=this;t.isRendered?e():(t.whenRenderedCallbacks||(t.whenRenderedCallbacks=[]),t.whenRenderedCallbacks.push(e))}addThemeClass(){const e=this;""!==e.theme&&e.classList.add("smart-"+e.theme)}addDefaultClass(){const e=this;e.classList.add(n.toLowerCase()+"-element"),e.classList.add(e.nodeName.toLowerCase())}_renderShadowRoot(){const e=this;if(e.shadowRoot){e.$.root.classList.add(e.nodeName.toLowerCase());for(let t=0;t<e.attributes.length;t++){const n=e.attributes[t];"class"===n.name||"id"===n.name||"style"===n.name||"tabindex"===n.name||n.name.indexOf("aria")>=0||e.$.root.setAttribute(n.name,n.value)}for(let t=0;t<e.classList.length;t++){const n=e.classList[t];"smart-element-init"!==n&&"smart-element"!==n&&"smart-hidden"!==n&&"smart-visibility-hidden"!==n&&e.$.root.classList.add(n)}}}render(){const e=this;if(!e.isRendered&&(e.isRendered=!0,e.isRendering=!1,e.context=document,e._renderShadowRoot(),e.whenRenderedCallbacks)){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}e.onRender&&e.onRender(),e.disabled&&e.setAttribute("aria-disabled",!0),e.readonly&&-1!==["checkbox","combobox","grid","gridcell","listbox","radiogroup","slider","spinbutton","textbox"].indexOf(e.getAttribute("role"))&&e.setAttribute("aria-readonly",!0)}ready(){const e=this;if(e._setId(),e.addThemeClass(),e.addDefaultClass(),"collapsed"===e.visibility?e.classList.add("smart-hidden"):"hidden"===e.visibility&&e.classList.add("smart-visibility-hidden"),e.dataContext&&e.applyDataContext(),e.onReady&&e.onReady(),e.shadowRoot&&Smart(e._selector)){if(Smart(e._selector).styleUrls){const t=Smart(e._selector).styleUrls;for(let n=0;n<t.length;n++)e.importStyle(t[n])}if(Smart(e._selector).styles){const t=document.createElement("style");t.innerHTML=Smart(e._selector).styles,e.shadowRoot.insertBefore(t,e.shadowRoot.firstChild)}}Smart(e._selector)&&Smart(e._selector).ready&&Smart(e._selector).ready()}_setId(){const e=this;if(!e.id){const t=e.elementName;e.id=t.slice(0,1).toLowerCase()+t.slice(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)}}checkLicense(){const e=this;"Evaluation"===window[n].License&&-1===window.location.hostname.indexOf("htmlelements")&&(e.logWatermark(),e.logLicense(),window[n].License="")}logWatermark(){const e=document.createElement("a");e.href="https://www.htmlelements.com/",e.innerHTML="https://www.htmlelements.com/",e.style.position="absolute",e.style.right="5px",e.style.bottom="5px",e.style.color="#fff",e.style.padding="20px",e.style.borderRadius="5px",e.style.background="#0C3D78",e.style.cursor="pointer",e.style.zIndex="999999",e.style.display="block",e.style.fontSize="24px",e.style.textDecoration="none",e.style.fontWeight="bold",e.style.opacity=0,e.style.transition="opacity .35s ease-in-out",e.id="watermark",document.getElementById("watermark")||setTimeout((()=>{document.getElementById("watermark")||(document.body.appendChild(e),setTimeout((()=>{e.style.opacity=1})),setTimeout((()=>{e.style.opacity=0,setTimeout((()=>{e.parentNode.removeChild(e)}),350)}),6e3))}),1e3)}logLicense(){console.log("****************************************************************************************************************"),console.log("****************************************************************************************************************"),console.log("****************************************************************************************************************"),console.log("*jQWidgets License Key Not Found."),console.log("*This is an EVALUATION only Version, it is NOT Licensed for software projects intended for PRODUCTION."),console.log("*if you want to hide this message, please send an email to: sales@jqwidgets.com for a license."),console.log("****************************************************************************************************************"),console.log("****************************************************************************************************************"),console.log("****************************************************************************************************************")}get _selector(){const e=this;return e.id?"#"+e.id:e.classList.length>0?"."+e.classList[0]:""}applyDataContext(e){const t=this;let n="string"==typeof t.dataContext?window[t.dataContext]||document[t.dataContext]:t.dataContext;if(e&&(n=e,t.dataContext=e),n){if(!n._uid){n._uid=(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase(),n._properties=[];for(let e in n){const r=n[e];"function"!=typeof r&&"_properties"!==e&&"_uid"!==e&&(n._properties[e]=r,Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:()=>n._properties[e],set(r){const o=n._properties[e];n._properties[e]=r;let i=[];i[e]={oldValue:o,value:r},i.length++,t.updatingDataContext=!0,w.fireEvent("dataContextPropertyChanged",{dataContext:n,properties:i},{bubbles:!1,cancelable:!0}),t.updatingDataContext=!1}}))}}if(t.dataContextProperties=t.parseAttributes(t),t.dataContextPropertiesMap={},t.dataContextListeners={},t.dataContextProperties){t.updatingDataContext=!0;for(let e in t.dataContextProperties){const r=t.dataContextProperties[e],o=r.name;if(r.propertyName=e,t.dataContextPropertiesMap[o]=e,v.cache["toDash"+e]||(v.cache["toDash"+e]=y.Core.toDash(o)),r.isEvent){const e=r.value;t.dataContextListeners[o]&&t.removeEventListener(o,t.dataContextListeners[o]),t.dataContextListeners[o]=function(t){n[e](t)},t.addEventListener(o,t.dataContextListeners[o])}if(o.indexOf(".")>=0){const r=o.split(".");let i=n[r[0]];for(let e=1;e<r.length;e++)i=i[r[e]];void 0!==i&&(t[e]=i)}else t[e]=n[o]}t.dataContextPropertyChangedHandler=function(e){const n=e.detail.properties;if(e.detail.dataContext===("string"==typeof t.dataContext?window[t.dataContext]||document[t.dataContext]:t.dataContext))for(let e in n){const r=t.dataContextPropertiesMap[e],o=t.context;r&&(t.context=document,t[r]=n[e].value,t.context=o)}},w.listen("dataContextPropertyChanged",t.dataContextPropertyChangedHandler),t.updatingDataContext=!1}else t.dataContextProperties=null}else{t.dataContextProperties=null;const e=function(){("string"==typeof t.dataContext?window[t.dataContext]||document[t.dataContext]:t.dataContext)&&(t.applyDataContext(),window.removeEventListener("load",e))};window.addEventListener("load",e)}}updateDataContextProperty(e){const t=this,n="string"==typeof t.dataContext?window[t.dataContext]||document[t.dataContext]:t.dataContext,r=t.dataContextProperties[e];if(!t.updatingDataContext&&r.twoWay){const o=r.name;if(o.indexOf(".")>=0){const r=o.split(".");let i=n[r[0]];for(let e=1;e<r.length;e++)i=i[r[e]];void 0!==i&&(i=t[e],c[n._uid]&&(c[n._uid][e]=i))}else n[o]=t[e],c[n._uid]&&(c[n._uid][e]=n[o])}}static get version(){return window[n].Version}initProperties(){const e=this;if(Smart(e._selector)&&Smart(e._selector).properties&&(e._initProperties=Smart(e._selector).properties),e.hasAttribute("props")&&!e.props?e._initProperties=window[e.getAttribute("props")]:e.props&&(e._initProperties=e.props),e._initProperties){const t=Object.keys(e._initProperties);for(let n=0;n<t.length;n++){const r=t[n],o=e._initProperties[r];if(void 0!==o){if(o.constructor===Smart.ObservableArray||o instanceof Smart.ObservableArray){e[r]=o.toArray();continue}if(o.constructor===Smart.DataAdapter||"smartDataAdapter"===o.constructor.name||"object"==typeof o&&Smart.DataAdapter&&o instanceof Smart.DataAdapter||o instanceof Smart.Observable||o.constructor===Smart.Observable||"object"!=typeof o||y.Types.isArray(o)||o instanceof Date){if(void 0===e[r]&&-1===["onReady","onAttached","onDetached","onCreated","onCompleted"].indexOf(r)){const t=e.localize("propertyUnknownName",{name:r});e.log(t)}e[r]=o;continue}}if("messages"!==r)if("dataSourceMap"!==r&&"rowCSSRules"!==r){if(o&&"object"==typeof o){const t=function(n,r){const o=Object.keys(n);for(let i=0;i<o.length;i++){const s=o[i],a=n[s],l=e._properties[r+"_"+s];if(l&&null===l.value){if(void 0===e[r+"_"+s]){const t=e.localize("propertyUnknownName",{name:r+"_"+s});e.log(t)}e[r+"_"+s]=a}else if("object"==typeof a&&!y.Types.isArray(a)&&a&&a.constructor!==Date)t(a,r+"_"+s);else{if(void 0===e[r+"_"+s]){const t=e.localize("propertyUnknownName",{name:r+"_"+s});e.log(t)}e[r+"_"+s]=a}}};t(o,r)}}else e[r]=o;else e[r]=Object.assign(e[r],o)}}}setProperties(e){const t=this,n=Object.keys(e);for(let r=0;r<n.length;r++){const o=n[r],i=e[o];if(i.constructor===Smart.ObservableArray||i instanceof Smart.ObservableArray)t[o]=i.toArray();else if(i.constructor===Smart.DataAdapter||"smartDataAdapter"===i.constructor.name||"object"==typeof i&&Smart.DataAdapter&&i instanceof Smart.DataAdapter||i instanceof Smart.Observable||i.constructor===Smart.Observable||"object"!=typeof i||y.Types.isArray(i)||i instanceof Date){if(void 0===t[o]&&-1===["onReady","onAttached","onDetached","onCreated","onCompleted"].indexOf(o))continue;const e=t._properties[o];"int"===e.type||"number"===e.type&&"string"==typeof subPropertyValue?"int"===e.type?t[o]=parseInt(i):t[o]=parseFloat(i):t[o]=i}else if("messages"!==o&&"dataSourceMap"!==o){if("object"==typeof i){const e=function(n,r){const o=Object.keys(n);for(let i=0;i<o.length;i++){const s=o[i],a=n[s],l=t._properties[r+"_"+s];if(l&&null===l.value){if(void 0===t[r+"_"+s])continue;const e=t._properties[r+"_"+s];"int"===e.type||"number"===e.type&&"string"==typeof a?"int"===e.type?t[r+"_"+s]=parseInt(a):t[r+"_"+s]=parseFloat(a):t[r+"_"+s]=a}else if("object"==typeof a&&!y.Types.isArray(a)&&a&&a.constructor!==Date)e(a,r+"_"+s);else{if(void 0===t[r+"_"+s])continue;const e=t._properties[r+"_"+s];"int"===e.type||"number"===e.type&&"string"==typeof a?"int"===e.type?t[r+"_"+s]=parseInt(a):t[r+"_"+s]=parseFloat(a):t[r+"_"+s]=a}}};e(i,o)}}else t[o]=i}}setup(){const e=this;if(e.context=this,e.isReady&&!e.isCompleted)return;if(e.isReady)return e._setModuleState("attached"),e.isAttached=!0,e.attached(),e._handleListeners("listen"),void(e.context=document);e.ownerElement&&e.ownerElement.detachedChildren.indexOf(e)>=0&&e.ownerElement.detachedChildren.splice(e.ownerElement.detachedChildren.indexOf(e),1),e.isReady=!0,e.methods=e.getStaticMember("methods"),e.initProperties(),a.isMobile&&e.classList.add("smart-mobile");for(let t=0;t<e.attributes.length;t+=1){const n=e.propertyByAttributeName[e.attributes[t].name];if(!n)continue;let r=e.$.getAttributeValue(n.attributeName,n.type);const o=r?r.toString():"";if(!(o.indexOf("{{")>=0||o.indexOf("[[")>=0||"object"!==n.type&&"array"!==n.type&&(e.attributes[t].value.indexOf("{{")>=0||e.attributes[t].value.indexOf("[[")>=0)||void 0===r||n.value===r)){const o=y.Types.getType(r),i=e.attributes[t].value;if(("any"===n.type||"object"===n.type)&&""+e[n.name]===r)continue;if("array"===n.type&&e[n.name]&&JSON.stringify(e[n.name])===r)continue;if("number"===o&&isNaN(r)&&"NaN"!==i&&"Infinity"!==i&&"-Infinity"!==i){const t=e.localize("propertyInvalidValueType",{name:n.name,actualType:"string",type:n.type});e.log(t)}n.isUpdatingFromAttribute=!0,e[n.name]=r,n.isUpdatingFromAttribute=!1}}for(let t in e._properties){const n=e._properties[t];if("innerHTML"===t&&n.value===n.defaultValue&&(n.value=n.defaultValue=y.Core.html(e)),"boolean"!==n.type&&"bool"!==n.type||"false"===e.getAttribute(n.attributeName)&&(n.isUpdating=!0,e.setAttribute(n.attributeName,""),n.isUpdating=!1),n.defaultReflectToAttribute&&n.reflectToAttribute){if(n.defaultReflectToAttribute&&n.defaultReflectToAttributeConditions){let t=!0;for(let r=0;r<n.defaultReflectToAttributeConditions.length;r++){const o=n.defaultReflectToAttributeConditions[r];let i,s;for(let e in o)i=e,s=o[e];e._properties[i]&&e._properties[i].value!==s&&(t=!1)}if(!t)continue}n.isUpdating=!0,e.$.setAttributeValue(n.attributeName,n.value,n.type),n.isUpdating=!1}}const t=[];if(e.children.length>0)for(let n=0;n<e.children.length;n++){const r=e.children[n];y.Extend(r).isCustomElement&&t.push(r)}e.applyTemplate(),e.complete=function(){if(!e.templateBindingsReady){const t=e=>{e.templateBindingsReady||(e.templateBindingsReady=!0,e.updateTextNodes(),e.updateBoundNodes())};if(e.ownerElement){let n=e.ownerElement,r=[];for(;n;)r.push(n),n=n.ownerElement;for(let e=r.length-1;e>=0;e--)t(r[e]);t(e)}else t(e)}const t=()=>{if(e._setModuleState("ready"),e.ready(),"auto"!==e.renderMode||e.isRendered||e.render(),e.isAttached=!0,e._setModuleState("attached"),e.attached(),e._handleListeners("listen"),e.isHidden||0!==e.offsetWidth&&0!==e.offsetHeight||(e.isHidden=!0),e.completed(),e.isRendered&&(e.context=document),e.whenReadyCallbacks){for(let t=0;t<e.whenReadyCallbacks.length;t++)e.whenReadyCallbacks[t]();e.whenReadyCallbacks=[]}};if(e.wait)e.classList.add("smart-visibility-hidden");else if(e.classList.contains("smart-async"))requestAnimationFrame((()=>{t()}));else{const n=e.shadowParent;e.shadowParent=null;const r=e.parents;if(e.shadowParent=n,0===r.length)return;const o=()=>{let t=e.ownerElement,n=[];for(;t;)n.push(t),t=t.ownerElement;for(let e=n.length-1;e>=0;e--)n[e].updateBoundMappedNodes()};e.ownerElement&&"HTML"!==r[r.length-1].nodeName?e.getRootNode().host?t():e.ownerElement&&"HTML"===e.ownerElement.parents[e.ownerElement.parents.length-1].nodeName?(o(),t()):e.checkIsInDomInterval=setInterval((()=>{const n=e.parents;"HTML"===n[n.length-1].nodeName&&(clearInterval(e.checkIsInDomInterval),o(),t())}),100):t()}};let r=[].slice.call(e.querySelectorAll("[smart-id]")).concat(t);if(window[n].EnableShadowDOM&&!0!==e.isInShadowDOM&&(r=[].slice.call(e.shadowRoot.querySelectorAll("[smart-id]")).concat(t)),0===r.length)e.complete();else{e._completeListeners=0;for(let t=0;t<r.length;t++){const n=r[t];if(y.Extend(n).isCustomElement){const t=function(){e._completeListeners--,0===e._completeListeners&&(e.complete(),delete e._completeListeners)}.bind(e);n.isCompleted||n.isUtilityElement||!0===n.wait||(e._completeListeners++,n._onCompleted||(n.completeHandlers=[],n._onCompleted=function(){for(let e=0;e<n.completeHandlers.length;e++)n.completeHandlers[e]()}),n.completeHandlers.push(t))}}0===e._completeListeners&&e.complete()}}visibilityChangedHandler(){const e=this;e.isReady&&requestAnimationFrame((()=>{0===e.offsetWidth||0===e.offsetHeight?e.isHidden=!0:(e.isHidden=!1,e.$.fireEvent("resize",e,{bubbles:!1,cancelable:!0}))}))}attributeChangedCallback(e,t,n){const r=this,o=r.propertyByAttributeName[e];if("class"!==e&&"style"!==e||r.visibilityChangedHandler(),o||r.attributeChanged(e,t,n),r.onAttributeChanged&&r.onAttributeChanged(e,t,n),!o||o&&o.isUpdating)return;let i=r.$.getAttributeValue(o.attributeName,o.type);void 0!==n&&r[o.name]!==i&&(o.isUpdatingFromAttribute=!0,r[o.name]=void 0!==i?i:r._properties[o.name].defaultValue,o.isUpdatingFromAttribute=!1)}attributeChanged(e,t,n){}set hasStyleObserver(e){const t=this;void 0===t._hasStyleObserver&&(t._hasStyleObserver=e),e?d.watch(t):d.unwatch(t)}get hasStyleObserver(){const e=this;return void 0===e._hasStyleObserver||e._hasStyleObserver}attached(){const e=this;e.hasStyleObserver&&d.watch(e),e.onAttached&&e.onAttached(),Smart(e._selector)&&Smart(e._selector).attached&&Smart(e._selector).attached()}detached(){const e=this;e.hasStyleObserver&&d.unwatch(e),e._setModuleState("detached"),e.isAttached=!1,e.ownerElement&&-1===e.ownerElement.detachedChildren.indexOf(e)&&e.ownerElement.detachedChildren.push(e),e._handleListeners("unlisten"),e.onDetached&&e.onDetached(),Smart(e._selector)&&Smart(e._selector).detached&&Smart(e._selector).detached(),u&&u[e._selector]&&delete u[e._selector]}propertyChangedHandler(e,t,n){const r=this;t!==n&&("theme"===e&&(""!==t&&r.classList.remove("smart-"+t),""!==n&&r.classList.add("smart-"+n)),"visibility"===e?("collapsed"===t?r.classList.remove("smart-hidden"):"hidden"===t&&r.classList.remove("smart-visibility-hidden"),"collapsed"===n?r.classList.add("smart-hidden"):"hidden"===n&&r.classList.add("smart-visibility-hidden")):("disabled"===e||"readonly"===e)&&r._ariaPropertyChangedHandler(e,n),r.propertyChanged&&r.propertyChanged(e,t,n))}_ariaPropertyChangedHandler(e,t){const n=this;"readonly"===e&&-1===["checkbox","combobox","grid","gridcell","listbox","radiogroup","slider","spinbutton","textbox"].indexOf(n.getAttribute("role"))||(t?n.setAttribute("aria-"+e,!0):n.removeAttribute("aria-"+e))}_handleListeners(e){const t=this,n=t.tagName.toLowerCase(),r=r=>{for(let o in r){const i=o.split(".");let s=i[0],a=t.$;if(i[1])if(s=i[1],a=t["$"+i[0]],"document"===i[0]){let e=t.smartId;""===e&&(e=y.Core.toCamelCase(n)),s=s+"."+e}else t.smartId&&(s=s+"."+t.smartId+"_"+t.parents.length);else t.smartId&&(s=s+"."+t.smartId);const l=r[o],d=function(e){const n=t.context;t.context=t,t[l]&&t[l].apply(t,[e]),t.context=n};a&&a[e](s,d)}};r(t.getStaticMember("listeners")),r(t.templateListeners),Smart(t._selector)&&Smart(t._selector).properties&&r(Smart(t._selector).listeners)}parseTemplate(){const e=this,n=e.template(),o=document.createDocumentFragment();if(t[e.nodeName]&&!r)return t[e.nodeName].cloneNode(!0);if(""===n)return null;let i=document.createElement("div");o.appendChild(i),i.innerHTML=n;let s=i.childNodes;i.parentNode.removeChild(i);for(let e=0;e<s.length;e++)o.appendChild(s[e]);return t[e.nodeName]=o,r?o:o.cloneNode(!0)}applyTemplate(){const e=this,t=e.parseTemplate();if(!t)return;if(!t.hasChildNodes)return;const n=t.childNodes[0],r=(t,n)=>{e["$"+t]=n.$=y.Extend(n),e.$[t]=n,n.ownerElement=e};let o=n;if(n.getElementsByTagName("content").length>0){let e=n.getElementsByTagName("content")[0];o=e.parentNode,o.removeChild(e)}else{const e=t.querySelectorAll("[inner-h-t-m-l]");e&&e.length>0&&(o=e[0])}e.$.template="template"===n.nodeName.toLowerCase()?n:n.querySelector("template");let i=t.querySelectorAll("[id]");0===i.length&&(i=t.querySelectorAll("*")),r("root",n),r("content",o),e.$.html=e.innerHTML.toString().trim();for(let t=0;t<i.length;t+=1){let n=i[t];""===n.id&&(n.id="child"+t),r(n.id,n),n.setAttribute("smart-id",n.id),e.shadowRoot?n.shadowParent=e:n.removeAttribute("id")}for(!1!==e.hasTemplateBindings?e.bindings=e.getBindings(t):e.bindings=[],e.$root.addClass("smart-container");e.childNodes.length;)o.appendChild(e.firstChild);if(e.appendTemplate(t),e.$.template){const t=document.createElement("div");t.classList.add("smart-template-container"),e.$.templateContainer=t,e.$.template.parentNode.insertBefore(t,e.$.template),e.refreshTemplate()}}refreshTemplate(){const e=this;if(!e.$.templateContainer)return;e.templateDetached(e.$.templateContainer);const t=e.$.template.content.cloneNode(!0);e.templateBindings=e.getBindings(t),e.templateProperties=[];let n=document.createDocumentFragment();const r=function(t,n,o){for(let i in t){const s=t[i],a=s.node.cloneNode();n.appendChild(a);let l=[],d=!1;if(s.data)for(let t in s.data){const r=s.data[t],i=r.name;if(e.templateProperties[i]=!0,a.removeAttribute(y.Core.toDash(t)),"*items"===t)l=e[i],d=!0;else if(i.indexOf("item.")>=0&&void 0!==o)r.value=o[i.substring("item.".length)],a[t]=r.value;else if(i.indexOf("item")>=0&&void 0!==o)r.value=o,a[t]=r.value;else if("*if"===t)if(i.indexOf("(")>=0){let t,r=i.substring(i.indexOf("("));const o=i.substring(0,i.indexOf("("));if(r=r.substring(1,r.length-1),r=r.replace(/ /gi,""),r=r.split(","),r.length>0&&""!==r[0]){let n=[];for(let t=0;t<r.length;t++)n.push(e[r[t]]);t=e[o].apply(e,n)}else t=e[o]();!1===t&&n.removeChild(a)}else e[i]||n.removeChild(a);else e.updateBoundNode(a,s,e,i)}if(l.length>0||d){for(let e=0;e<l.length;e++)s.children&&r(s.children,a,l[e]);if("number"==typeof l)for(let e=0;e<l;e++)s.children&&r(s.children,a,e)}else s.children&&r(s.children,a,o)}};r(e.templateBindings.children,n),e.$.templateContainer.innerHTML="",e.$.templateContainer.appendChild(n),e.templateAttached(e.$.templateContainer)}templateAttached(){}templateDetached(){}appendTemplate(e){this.appendChild(e)}defineElementModules(){const e=this,t=e.constructor.prototype;if("BaseElement"===t.elementName){t.modules=e.constructor.modules;const n=t.modules;for(let t=0;t<n.length;t+=1)e.addModule(n[t])}else{const n=t.modules;if(!n)return;for(let t=0;t<n.length;t+=1){const r=n[t],o=r.prototype;e.defineElementMethods(o.methodNames,o),e.defineElementProperties(r.properties)}}}watch(e,t){const n=this;n._watch=null!==e&&null!==t?{properties:e,propertyChangedCallback:t}:null}unwatch(){this._watch=null}set(e,t,n){const r=this,o=r.context;r.context=!0===n?document:r,r[e]=t,r.context=o}get(e){return this[e]}_setModuleState(e,t){const n=this,r="is"+e.substring(0,1).toUpperCase()+e.substring(1),o="on"+e.substring(0,1).toUpperCase()+e.substring(1);for(let i=0;i<n.modulesList.length;i++){const s=n.modulesList[i];s[r]=!0,s[e]&&s[e](t),s[o]&&s[o](t)}}addModule(e,t){const n=this;if(!e)return;const r=n.modules.slice(0),o=e.prototype,i=Object.getPrototypeOf(e);if(i.name&&i.name!==e.name&&n.addModule(i),!e.moduleName&&e.name&&(e.moduleName=e.name),-1===r.findIndex((t=>e.moduleName===t.moduleName))&&r.push(e),n.defineModule(e),n.defineElementMethods(o.methodNames,o),n.defineElementProperties(e.properties),n.constructor.prototype.modules=r,t)for(let t in Smart.Elements.tagNames){const r=Smart.Elements.tagNames[t];let o=Object.getPrototypeOf(r),i=[];for(;o!==HTMLElement;)i.push(o.prototype),o=Object.getPrototypeOf(o);i.indexOf(n)>=0&&r!==n&&r.prototype.addModule(e)}}defineModule(e){if(e.isDefined)return;e.prototype._initModule=function(e){this.ownerElement=e};const t=e.properties||{},n=Object.keys(t),r=Object.getOwnPropertyNames(e.prototype);e.prototype.methodNames=r;for(let r=0;r<n.length;r+=1){const o=n[r],i=t[o];Object.defineProperty(e.prototype,o,{configurable:!1,enumerable:!0,get(){return this.ownerElement?this.ownerElement[o]:i.value},set(e){this.ownerElement[o]=e}})}e.isDefined=!0}getStaticMember(e,t){const r=window[n][this.elementName],o=r[e];t||(t="");let i="array"===t?[]:"string"===t?"":{},s=Object.getPrototypeOf(r),a=[];for(;s[e];)a.push(s[e]),s=Object.getPrototypeOf(s);for(let e=a.length-1;e>=0;e--)if("array"===t)for(let t=0;t<a[e].length;t++)-1===i.indexOf(a[e][t])&&i.push(a[e][t]);else"string"===t?-1===i.indexOf(a[e])&&(i+=a[e]):i=y.Core.assign(i,a[e]);if("array"===t){for(let e=0;e<o.length;e++)-1===i.indexOf(o[e])&&i.push(o[e]);return i}return"string"===t?(-1===i.indexOf(o)&&(i+=o),i):y.Core.assign(i,o)}defineElementHierarchicalProperties(e,t){const n=this,r=[];!function(e){const n=Object.keys(e);for(let o=0;o<n.length;o++){const i=n[o];if("messages"===i)continue;const s=e[i],a=Object.keys(s),l=a.indexOf("value")>=0&&a.indexOf("type")>=0&&"object"==typeof s.value;if("propertyObject"===s.type||l){const e=function(n,o){if(!n.value)return;const i=Object.keys(n.value);for(let s=0;s<i.length;s++){const a=i[s],l=n.value[a],d=o+"_"+a;if("object"!=typeof l||null===l)break;const c=Object.keys(l);if(!(c.indexOf("value")>=0&&c.indexOf("type")>=0))break;if("array"!==n.type&&(n.isHierarchicalProperty=!0),l.parentPropertyName=o,t){const e=t._properties[d];if(n.value.hasOwnProperty(a)){if(e.isDefined)continue;delete n.value[a]}e.isDefined=!0,Object.defineProperty(n.value,a,{configurable:!1,enumerable:!0,get:()=>t._properties[d].value,set(e){t.updateProperty(t,t._properties[d],e)}})}r[d]||(r[d]=l,r.length++),("propertyObject"===l.type||"object"==typeof l.value&&"array"!==l.type)&&e(t?t._properties[d]:l,d)}};e(s,i)}}}(e),r.length>0&&!t&&n.defineElementProperties(r)}defineElement(){const e=this,t=e.constructor.prototype,n=e.getStaticMember("properties"),r=Object.getOwnPropertyNames(t);t.extendedProperties={},t.boundProperties={},t.templateListeners={},e.defineElementModules(),e.defineElementMethods(r,t),e.defineElementProperties(n),e.defineElementHierarchicalProperties(e.extendedProperties),t._initElement=function(){const e=this,n=t.extendedProperties,r=Object.keys(n),o=e.modules;e.$=y.Extend(e),e.$document=w,e.smartId=(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase(),e.isCreated||(e.modulesList=[],e._properties=[],e._beforeCreatedProperties&&(e._properties=e._beforeCreatedProperties,delete e._beforeCreatedProperties),e.detachedChildren=[],e.propertyByAttributeName=[]);for(let t=0;t<o.length;t+=1){let n=new(0,o[t]);n._initModule(e),e.modulesList.push(n)}for(let t=0;t<r.length;t+=1){const o=r[t],i=n[o];let s=i.value;if(e._properties[o]){if(void 0!==e._properties[o].notify)continue;delete e._properties[o]}if(E&&"innerHTML"===o&&delete e[o],-1===window.navigator.userAgent.indexOf("PhantomJS")&&e.hasOwnProperty(o)&&(s=e[o],delete e[o]),"array"===i.type&&null!=s&&(s=s.slice(0)),"object"===i.type&&null!=s&&(s=Array.isArray(s)?s.slice(0):Object.assign({},s)),e._properties[o]={name:o,notify:i.notify,allowedValues:i.allowedValues,type:i.type,nullable:i.nullable,reflectToAttribute:i.reflectToAttribute,defaultReflectToAttribute:i.defaultReflectToAttribute,defaultReflectToAttributeConditions:i.defaultReflectToAttributeConditions,value:s,readOnly:i.readOnly,defaultValue:s,attributeName:i.attributeName,observer:i.observer,inherit:i.inherit,extend:i.extend,validator:i.validator},e.propertyByAttributeName[i.attributeName]=e._properties[o],!i.hasOwnProperty("type")){const t=e.localize("propertyUnknownType",{name:o});e.log(t)}if("any"===i.type||"propertyObject"===i.type)continue;const a=y.Types.getType(s);if(null!=s&&i.type!==a&&!i.validator){if("object"===i.type&&"array"===a)continue;if("number"===a&&["integer","int","float"].findIndex((e=>e===i.type))>=0)continue;const t=e.localize("propertyInvalidValueType",{name:o,actualType:a,type:i.type});e.log(t)}}e.defineElementHierarchicalProperties(e._properties,e),e.isCreated=!0},t.registered()}defineElementMethods(e,t){const n=this.constructor.prototype,r=function(e,t){const n=Array.prototype.slice.call(arguments,2),r=function(){if(!this.isReady&&"localize"!==t&&"localize"!==t&&"cloneNode"!==t&&"importStyle"!==t&&"log"!==t&&"parseAttributes"!==t){const e=this.localize("elementNotInDOM");this.log(e)}let r=this;for(let e=0;e<this.modulesList.length;e++){let n=this.modulesList[e];if(t in n){r=n;break}}const o=this.context,i=n.concat(Array.prototype.slice.call(arguments));let s=null;const a=function(e,t){return e===t||"number"===e&&("int"===t||"integer"===t||"float"===t)||"bool"===e&&"boolean"===t||"boolean"===e&&"bool"===t||"object"===e&&"any"===t||void 0};if(this.methods){const e=this.methods[t];if(e){const n=e.split(":");s=n[n.length-1].trim();const r=[],o=e.substring(1+e.indexOf("("),e.lastIndexOf(")")).split(",");let l="";for(let e=0;e<o.length;e++){const t=o[e];l+=t,t.indexOf(":")>=0?(r.push(l),l=""):l+=","}let d=r.length;for(let e=0;e<r.length;e++){const n=r[e].trim().split(":"),o=n[0].split("=")[0].trim().indexOf("?")>=0,s=n[1].indexOf("?")>=0,l=n[1].replace(/\?/gi,"").trim(),c=l.split("|");let u=n[0].split("=")[1];const p=y.Types.getType(i[e]);if(void 0===i[e]&&u){switch(u=u.trim(),l[0]){case"date":{let e=u.substring(u.indexOf("(")+1,u.lastIndexOf(")"));e=e.length>0?e.split(",").map((e=>parseInt(e))):[],u=0===e.length?new Date:new Date(e[0],e[1],e[2]);break}case"bool":case"boolean":u="true"===u||"1"===u;break;case"int":case"integer":u=parseInt(u);break;case"float":case"number":u=parseFloat(u);break;case"any":case"object":u=u.indexOf("{")>=0?JSON.parse(u):u}i.push(u)}else o&&d--;if(l!==p&&p){let n=!0;for(let e=0;e<c.length;e++)if(a(p,c[e])){n=!1;break}if(n&&(null!==i[e]||!s)){const n=this.localize("methodInvalidValueType",{name:t,actualType:p,type:l,argumentIndex:e});this.log(n)}}if(i.length<d){const e=this.localize("methodInvalidArgumentsCount",{name:t,actualArgumentsCount:i.length,argumentsCount:d});this.log(e)}}}}this.context=this;const l=e.apply(r,i);if(s){const e=void 0===y.Types.getType(l)?"void":y.Types.getType(l);if(!a(e,s)){const n=this.localize("methodInvalidReturnType",{name:t,actualType:e,type:s});this.log(n)}}return this.context=o,l};return r},o=["constructor","ready","created","render","attached","detached","appendChild","insertBefore","removeChild","connect","disconnectedCallback","connectedCallback","attributeChangedCallback","propertyChangedHandler","enableShadowDOM","isInShadowDOM","addPropertyBindings"];for(let i in e){let s=e[i];s&&s.startsWith&&s.startsWith("_")||void 0!==o.find((e=>e===s))||n.extendedProperties[s]||y.Types.isFunction(t[s])&&(n[s]=r(t[s],s))}}defineElementProperties(e){if(!e)return;const t=this,n=t.constructor.prototype,r=Object.keys(e),o=t.getStaticMember("properties");Object.assign(n.extendedProperties,e),t.updateProperty=function(e,t,n){const r=e;if(!t||t.readOnly)return;if(t.allowedValues){let e=!1;for(let r=0;r<t.allowedValues.length;r++)if(t.allowedValues[r]===n){e=!0;break}if(!e){const e=JSON.stringify(t.allowedValues).replace(/\[|\]/gi,"").replace(",",", ").replace(/"/gi,"'"),o="'"+n+"'",i=r.localize("propertyInvalidValue",{name:t.name,actualValue:o,value:e});return void r.log(i)}}const o=t.name,i=r._properties[o].value;if(t.validator&&r[t.validator]){const e=r.context;r.context=r;const o=r[t.validator](i,n);void 0!==o&&(n=o),r.context=e}if(i!==n){if(r.propertyChanging){const e=r.propertyChanging(o,i,n);if(!1===e||null===e)return}if(!t.hasOwnProperty("type")){const e=r.localize("propertyUnknownType",{name:o});r.log(e)}if("array"!==t.type||JSON.stringify(i)!==JSON.stringify(n)){if(null!=n&&"any"!==t.type&&"propertyObject"!==t.type&&t.type!==y.Types.getType(n)&&!t.validator||null===n&&!t.nullable){let e=!0;if("object"===t.type&&"array"===y.Types.getType(n)&&(e=!1),"number"===y.Types.getType(n)&&["integer","int","float"].findIndex((e=>e===t.type))>=0&&(e=!1),e){const e=r.localize("propertyInvalidValueType",{name:o,actualType:y.Types.getType(n),type:t.type});return void r.error(e)}}if(t.isUpdating=!0,t.isHierarchicalProperty){const e=function(t,n){if(!t)return;const o=Object.keys(t);for(let i=0;i<o.length;i++){const s=o[i],a=t[s];"object"==typeof a&&!y.Types.isArray(a)&&a&&a.constructor!==Date?e(a,n+"_"+s):r[n+"_"+s]=a}};e(n,o)}else r._properties[o].value=n;if(!t.isUpdatingFromAttribute&&t.reflectToAttribute&&r.$.setAttributeValue(t.attributeName,n,t.type),r.isReady&&(!r.ownerElement||r.ownerElement&&r.ownerElement.isReady)){if("wait"===o&&(n||!i||r.isCompleted||(r.classList.remove("smart-visibility-hidden"),r.ownerElement&&r.ownerElement.updateBoundMappedNodes(),r.updateBoundMappedNodes(),r.complete())),"renderMode"===o)return;if(r.context!==r&&!r.wait){const e=r.context;r.context=r,r.propertyChangedHandler(o,i,n),r.context=e,t.observer&&r[t.observer]&&(r.context=r,r[t.observer](i,n),r.context=document),r._watch&&r._watch.properties.indexOf(o)>=0&&r._watch.propertyChangedCallback(o,i,n)}const e=t.notify||r.boundProperties[o];e&&(r.$.fireEvent(t.attributeName+"-changed",{context:r.context,oldValue:i,value:r[o]}),r.boundProperties[o]&&r.updateBoundNodes(o)),e&&r.templateProperties&&r.templateProperties[o]&&r.refreshTemplate(),r.dataContextProperties&&("dataContext"===o?r.applyDataContext():r.dataContextProperties[o]&&r.updateDataContextProperty(o))}t.isUpdating=!1}}};for(let t=0;t<r.length;t+=1){const i=r[t],s=e[i],a=y.Core.toDash(i),l=s.type||"any",d=l.indexOf("?")>=0||"any"===l;d&&"any"!==l&&(s.type=l.substring(0,l.length-1)),s.nullable=d,s.attributeName=a.toLowerCase(),s.name=i,s.reflectToAttribute=void 0===s.reflectToAttribute||s.reflectToAttribute,s.inherit&&o[i]&&(s.value=o[i].value),s.extend&&o[i]&&y.Core.assign(s.value,o[i].value),n.hasOwnProperty(i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get(){if(this._properties[i])return this._properties[i].value},set(e){const t=this;t.updateProperty(t,t._properties[i],e)}})}}}let C=[],S=[],x=[],E=!1;const A=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);A&&parseInt(A[2],10)<=50&&(E=!0);class T{static register(e,t){const r=t.prototype;let o=a.toCamelCase(e).replace(/[a-z]+/,""),i=t.version||window[n].Version;if(window.customElements.get(e)&&window.customElements.get(e).version===i)return;let s=e;for(i=i.split(".");window.customElements.get(e);)e=s+"-"+i.join("."),i[2]=parseInt(i[2])+1;if(!C[e]){if(e.startsWith(n.toLowerCase()))C[e]=window[n][o]=window[n.toLowerCase()+o]=t;else{let r=e.split("-")[0];r=r.substring(0,1).toUpperCase()+r.substring(1),window[n][r]||(window[n][r]={}),C[e]=window[n][r][o]=window[r.toLowerCase()+o]=t,window[n][o]&&(o=a.toCamelCase(e)),window[n][o]=t}r.elementName=o,r.defineElement(),S[e]&&S[e](r),window.customElements.define(e,t)}}static registerElements(){const e=this;if(e.toRegister){e.isRegistering=!0;for(let t=0;t<e.toRegister.length;t++){const n=e.toRegister[t];e.register(n.tagName,n.element)}e.isRegistering=!1}}static get(e){if(C[e])return C[e]}static whenRegistered(e,t){if(!e)throw new Error("Syntax Error: Invalid tag name");const n=S[e],r=this.get(e),o=r?r.modules.length:3;try{n||r?!n&&r?(t(r.prototype),S[e]=void 0):n&&!r?S[e]=function(e){n(e),t(e)}:n&&r&&(r.proto&&(n(r.proto),t(r.proto)),S[e]=void 0):S[e]=function(e){try{t(e)}catch(e){const t=e instanceof Error?e.message:e.toString();console.log(t)}}}catch(e){const t=e instanceof Error?e.message:e.toString();console.log(t)}if(r&&o!==r.prototype.modules.length){const t=document.querySelectorAll(e);for(let e=0;e<t.length;e++){const n=t[e];n.isCreated&&n._initElement()}}}}T.lazyRegister=!1,T.tagNames=[];class P{constructor(){const e=this;e.name="observableArray",e.observables=arguments.length<3?null:arguments[2];const t=new Proxy(e,{deleteProperty:function(e,t){return delete e[t],!0},apply:function(e,t,n){return e.apply(t,n)},get:function(t,n){return"symbol"==typeof(r=n)||"object"==typeof r&&"[object Symbol]"===Object.prototype.toString.call(r)||t[n]||isNaN(parseInt(n))?t[n]:e.getItem(parseInt(n));var r},set:function(t,n,r){return t[n]||isNaN(parseInt(n))?(t[n]=r,!0):(e.setItem(parseInt(n),r),!0)}});if(e._addArgs={eventName:"change",object:t,action:"add",index:null,removed:new Array,addedCount:1},e._removeArgs={eventName:"change",object:t,action:"remove",index:null,removed:null,addedCount:0},arguments.length>=1&&Array.isArray(arguments[0])){e._array=[];const t=arguments[0];for(let n=0,r=t.length;n<r;n++){const r=e._getItem(e._array.length,t[n]);e._array.push(r)}}else e._array=Array.apply(null,arguments);return 2===arguments.length&&(e.notifyFn=arguments[1]),t}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){return this._array}_getItem(e,t){const n=this;return"string"==typeof t||"number"==typeof t||void 0===t?t:new Proxy(t,{deleteProperty:function(e,t){return delete e[t],!0},set:function(t,r,o){const i=t[r];return t[r]=o,!n._canNotify||!1===t.canNotify||(n.observables&&!n.observables[r]||n._notify({eventName:"change",object:n,target:t,action:"update",index:e,path:e+"."+r,oldValue:i,newValue:o,propertyName:r}),!0)}})}getItem(e){return this._array[e]}setItem(e,t){const n=this,r=n._array[e];n._array[e]=n._getItem(e,t),n._notify({eventName:"change",object:n._array,action:"update",index:e,removed:[r],addedCount:1})}get length(){return this._array.length}set length(e){const t=this;o.isNumber(e)&&t._array&&t._array.length!==e&&t.splice(e,t._array.length-e)}toString(){return this._array.toString()}toLocaleString(){return this._array.toLocaleString()}concat(){const e=this;e._addArgs.index=e._array.length;const t=e._array.concat.apply(e._array,arguments);return new Smart.ObservableArray(t)}join(e){return this._array.join(e)}pop(){const e=this;e._removeArgs.index=e._array.length-1,delete e[e._array.length-1];const t=e._array.pop();return e._removeArgs.removed=[t],e._notify(e._removeArgs),e._notifyLengthChange(),t}push(){const e=this;if(e._addArgs.index=e._array.length,1===arguments.length&&Array.isArray(arguments[0])){const t=arguments[0];for(let n=0,r=t.length;n<r;n++){const r=e._getItem(e._array.length,t[n]);e._array.push(r)}}else{const t=e._getItem(e._addArgs.index,arguments[0]);e._array.push.apply(e._array,[t])}return e._addArgs.addedCount=e._array.length-e._addArgs.index,e._notify(e._addArgs),e._notifyLengthChange(),e._array.length}_notifyLengthChange(){const e=this;if(!e.canNotify)return;const t=e._createPropertyChangeData("length",e._array.length);e._notify(t)}_createPropertyChangeData(e,t,n){return{eventName:"change",object:this,action:e,value:t,oldValue:n}}reverse(){return this._array.reverse()}shift(){const e=this,t=e._array.shift();return e._removeArgs.index=0,e._removeArgs.removed=[t],e._notify(e._removeArgs),e._notifyLengthChange(),t}slice(e,t){return this._array.slice(e,t)}sort(e){return this._array.sort(e)}splice(e,t,n){const r=this,o=r._array.length;let i;if(n&&n.length)for(let o=0;o<n.length;o++)i=r._array.splice(e+o,t,n[o]);else i=r._array.splice.apply(r._array,arguments);if(n){let t=r.canNotify;if(r.canNotify=!1,n.length)for(let t=0;t<n.length;t++)r.setItem(e+t,n[t]);else r.setItem(e,n);r.canNotify=t,r._notify({eventName:"change",object:this,action:"add",index:e,added:i,addedCount:r._array.length>o?r._array.length-o:0})}else r._notify({eventName:"change",object:this,action:"remove",index:e,removed:i,addedCount:r._array.length>o?r._array.length-o:0});return r._array.length!==o&&r._notifyLengthChange(),i}unshift(){const e=this,t=e._array.length,n=e._array.unshift.apply(e._array,arguments);return e._addArgs.index=0,e._addArgs.addedCount=n-t,e._notify(this._addArgs),e._notifyLengthChange(),n}indexOf(e,t){const n=this;for(let r=t||0,o=n._array.length;r<o;r++)if(n._array[r]===e)return r;return-1}lastIndexOf(e,t){const n=this;for(let r=t||n._array.length-1;r>=0;r--)if(n._array[r]===e)return r;return-1}find(e,t){return this._array.find(e,t)}findIndex(e,t){return this._array.findIndex(e,t)}every(e,t){return this._array.every(e,t)}some(e,t){return this._array.some(e,t)}forEach(e,t){this._array.forEach(e,t)}map(e,t){return this._array.map(e,t)}filter(e,t){return this._array.filter(e,t)}reduce(e,t){return void 0!==t?this._array.reduce(e,t):this._array.reduce(e)}reduceRight(e,t){return void 0!==t?this._array.reduceRight(e,t):this._array.reduceRight(e)}move(e,t){this.splice(t,0,this.splice(e,1)[0])}}let D={};window[n]&&(D=window[n]),window[n]=function(e,t){let r=e;if(e){if(e.indexOf("#")>=0||e.indexOf(".")>=0)return u[e]?u[e]:t?(u[e]=new t,function(e,t){const n=t.properties;t._properties=[];const r=function(n,o){const i=Object.keys(n);for(let s=0;s<i.length;s++){const a=i[s],l=n[a];t._properties[o+a]=l,Array.isArray(l)?t._properties[o+a]=new P(l,(function(t){const n=a+"."+t.path,r=t.newValue,o=document.querySelector(e);if(o){const e=n.split(".");let t=o;for(let n=0;n<e.length;n++)t=t[e[n]];t=r}})):(Object.defineProperty(n,a,{configurable:!1,enumerable:!0,get:()=>t._properties[o+a],set(e){t._properties[o+a]=e}}),l&&"DataAdapter"===l.constructor.name||l&&"object"==typeof l&&Smart.DataAdapter&&l instanceof Smart.DataAdapter||"object"==typeof l&&l&&Object.keys(l).length>0&&r(l,o+a+"."))}};r(n,""),Object.defineProperty(t,"properties",{configurable:!1,enumerable:!0,get:()=>n});const o=document.querySelector(e);if(o&&o.isReady)for(let e in n)o[e]=n[e];else if(o){o.props={};for(let e in n)o.props[e]=n[e]}}(e,u[e]),u[e]):void 0;if(t){if(T.tagNames[e]=t,T.lazyRegister){T.toRegister||(T.toRegister=[]);const e=a.toCamelCase(r).replace(/[a-z]+/,"");return window[n][e]=t,void T.toRegister.push({tagName:r,element:t})}T.register(r,t)}}},window.addEventListener("load",(function(){const e=window[n].Elements.tagNames;let t=[];for(let r in e){const o=e[r];let i=document.querySelectorAll("["+r+"]");for(let e=0;e<i.length;e++){const t=i[e];t instanceof HTMLDivElement&&(t.__proto__=o.prototype,t.created(),t.connectedCallback()),t.classList.add("smart-element-ready")}let s=o.name;"Item"===s&&(s="ListItem"),i=document.querySelectorAll('[is="'+n.toLocaleLowerCase()+s+'"]');for(let e=0;e<i.length;e++)t.push(i[e])}if(t.length>0){const e=e=>{let t=[],n=e.parentNode;for(;n&&9!==n.nodeType;)n instanceof HTMLElement==1&&t.push(n),n=n.parentNode;return t};t.sort((function(t,n){let r=e(t).length,o=e(n).length;return r<o?1:r>o?-1:0}));for(let e=0;e<t.length;e++){const n=t[e],r=n.getAttribute("is");let o;o="smartItem"===r?new window.smartListItem(n):new window[r](n),o.removeAttribute("is")}}}));const L=function(){if("complete"===document.readyState&&"manual"!==window[n].RenderMode){x.sort((function(e,t){let n=e.element.parents.length,r=t.element.parents.length;return n<r?-1:n>r?1:0}));for(let e=0;e<x.length;e++)window[n].RenderMode="",x[e].element.isLoading=!1,x[e].callback(),window[n].RenderMode="";x=[],document.removeEventListener("readystatechange",L)}};Object.assign(window[n],{Elements:T,Modules:[],BaseElement:class extends _{static get observedAttributes(){let e=this,t=["external-style"];for(let n in e.prototype.extendedProperties){const r=e.prototype.extendedProperties[n];t.push(r.attributeName)}return t}static get styleUrls(){return[]}static get styles(){return""}get styleUrl(){return this._styleUrl}set styleUrl(e){this._styleUrl=e}get isInShadowDOM(){const e=this,t=e.getRootNode();return!e.hasAttribute("smart-blazor")&&t!==document&&t!==e}getShadowRootOrBody(){const e=this;return e.isInShadowDOM&&e.getRootNode().host?e.getRootNode().host.shadowRoot:document.body}get enableShadowDOM(){return window[n].EnableShadowDOM}importStyle(e,t){this._importStyle(e,t)}_importStyle(e,t){const n=this;if(!n.shadowRoot||!e)return;const r=e=>{const r=n.shadowRoot.children;for(let n=0;n<r.length;n++){const o=r[n];if(o instanceof HTMLLinkElement&&o.href===e)return t&&t(),null}const o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",o.href=e,o.onload=t,o},o=(()=>{const e=n.shadowRoot.children;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r instanceof HTMLLinkElement&&(t=r)}return t})(),i=(e,t)=>{t.parentNode.insertBefore(e,t.nextSibling)};if(Array.isArray(e)){const t=document.createDocumentFragment();for(let n=0;n<e.length;n++){const o=r(e[n]);o&&t.appendChild(o)}o?i(t,o):n.shadowRoot.insertBefore(t,n.shadowRoot.firstChild)}else{const t=r(e);if(!t)return;o?i(t,o):n.shadowRoot.insertBefore(t,n.shadowRoot.firstChild)}}attributeChanged(e,t,n){"style-url"===e&&(this.styleUrl=n)}attributeChangedCallback(e,t,n){this.isReady&&super.attributeChangedCallback(e,t,n)}constructor(e,t){super();const n=this;if(e){t&&(n._initProperties=t);const r=e=>{if("string"==typeof e?document.querySelector(e):e){const r="string"==typeof e?document.querySelector(e):e;if(r instanceof HTMLDivElement){const o=document.createElement(n.tagName);for(let e of r.attributes)o.setAttribute(e.name,r.getAttribute(e.name));for(;r.childNodes.length;)o.appendChild(r.firstChild);return"string"==typeof e&&(o.id=e.substring(1)),o._initProperties=t,r.parentNode&&r.parentNode.replaceChild(o,r),o}if(t){const e=r.context;if(r._initProperties=t,r.isReady){r.context=r;const n={},o={};for(let e in t)n[e]=r[e],o[e]=t[e];Object.getOwnPropertyNames(t).length>0&&(r.initProperties(),r.propertyChangedHandler(t,n,o)),r.context=e}}return r}};if("string"==typeof e){const t=document.querySelectorAll(e),n=[];if(t.length>1){for(let e=0;e<t.length;e++){const o=r(t[e]);n.push(o)}return n}}else if(e&&e.length>0){const t=e;if(t.length>1){for(let e=0;e<t.length;e++){const n=r(t[e]);C.push(n)}return C}}return r(e)}n._styleUrl="",n.isUtilityElement||n.created()}_getRootShadowParent(){let e=this.shadowParent;for(;e;){if(!e.shadowParent)return e;e=e.shadowParent}return e||this.shadowParent}_getStyleUrl(e){let t=y.Core.getScriptLocation()+window[n].StyleBaseUrl+e;return this.shadowParent&&(t=t.replace("scoped/","")),t}_getStyleUrls(){const e=this;e.nodeName.startsWith(n);const t=e.getStaticMember("styleUrls","array"),r=[];for(let n=0;n<t.length;n++){const o=t[n],i=e._getStyleUrl(o);r.push(i)}return r}_setupShadowRoot(){const e=this;e.classList.add("smart-element-init");const t=t=>{t.$.root&&(t.$.root.classList.add(n.toLowerCase()+"-element"),t.$.root.classList.add(e.nodeName.toLowerCase())),t.setup(),t.classList.remove("smart-element-init")};if(document.adoptedStyleSheets)if(window[n].AdoptedStyleSheets)window[n].AdoptedStyleSheetsLoaded?(e.shadowRoot.adoptedStyleSheets=window[n].AdoptedStyleSheets,t(e)):(e.shadowRoot.adoptedStyleSheets=window[n].AdoptedStyleSheets,window[n].AdoptedStyleSheetsLoadedQueue||(window[n].AdoptedStyleSheetsLoadedQueue=[]),window[n].AdoptedStyleSheetsLoadedQueue.push(e));else{const r=new CSSStyleSheet;let o=y.Core.getScriptLocation()+"/styles/smart.default.css";r.replace('@import url("'+o+'")').then((()=>{if(t(e),window[n].AdoptedStyleSheetsLoaded=!0,window[n].AdoptedStyleSheetsLoadedQueue){const e=window[n].AdoptedStyleSheetsLoadedQueue;for(let n=0;n<e.length;n++){const r=e[n];t(r)}delete window[n].AdoptedStyleSheetsLoadedQueue}})).catch((e=>{console.error("Failed to load:",e)})),window[n].AdoptedStyleSheets=[r],document.adoptedStyleSheets=[r],e.shadowRoot.adoptedStyleSheets=window[n].AdoptedStyleSheets}}connect(){const e=this;window[n].EnableShadowDOM&&!e.shadowRoot&&!0!==e.isInShadowDOM&&(e.attachShadow({mode:"open"}),e.shadowRoot&&e.$.root&&(e.shadowRoot.appendChild(e.$.root),e.$.root.classList.add(e.nodeName.toLowerCase()))),e.shadowRoot||e.shadowParent?e.shadowRoot?e._setupShadowRoot():(e.shadowParent&&window[n].EnableShadowDOM,e.setup()):e.setup()}connectedCallback(){const e=this;if(e.isLoading||e.isUtilityElement)return;e.classList.add("smart-element-init");const t=function(){e.classList.remove("smart-element-init")};if("complete"===document.readyState&&(void 0===window[n].isAngular&&(window[n].isAngular=null!==document.body.querySelector("[ng-version]")),window[n].isAngular))for(let t=0;t<e.parents.length&&!e.parents[t].nodeName.toLowerCase().startsWith(n.toLowerCase()+"-");t++)if(e.parents[t].hasAttribute("ng-version")&&!e.classList.contains("smart-angular")){window[n].RenderMode="manual";break}if("complete"===document.readyState&&"manual"!==window[n].RenderMode){const n=e.parents;n.length&&"HTML"===n[n.length-1].nodeName||e.getRootNode().host?(e.checkIsInDomTimer&&clearInterval(e.checkIsInDomTimer),t(),e.connect()):(e.checkIsInDomTimer&&clearInterval(e.checkIsInDomTimer),n.length>0&&(e.checkIsInDomTimer=setInterval((()=>{const n=e.parents;0===n.length&&clearInterval(e.checkIsInDomTimer),n.length>0&&"HTML"===n[n.length-1].nodeName&&(clearInterval(e.checkIsInDomTimer),t(),e.connect())}),100)))}else e.isLoading=!0,x.push({element:this,callback:function(){this.isReady||(t(),this.connect())}.bind(e)})}disconnectedCallback(){const e=this;e.isAttached?(e.shadowParent=null,e.detached()):e._resetShadowParent()}adoptedCallback(){this.setup()}appendTemplate(e){const t=this;t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}_resetShadowParent(){const e=this;if(!window[n].EnableShadowDOM||null===e.shadowParent)return;const t=[];let r=e.parentNode;for(;r&&9!==r.nodeType;){if(r instanceof HTMLElement==1)t.push(r);else if(11===r.nodeType&&r.host){r=r.host;continue}r=r.parentNode}for(let n=0;n<t.length;n++)if(t[n]===e.shadowParent)return;t.length>0&&"HTML"===t[t.length-1].nodeName&&(e.shadowParent=null)}},Utilities:y,Import:function(e,t){let n=0;const r=function(e,t){return new Promise((n=>{const r=document.createElement("script");r.src=e,r.onload=n;for(let e=0;e<document.head.children.length;e++){const r=document.head.children[e];if(r.src&&r.src.toString().indexOf(t)>=0)return void n()}document.head.appendChild(r)}))};return new Promise((o=>{const i=y.Core.getScriptLocation(),s=function(t){if(!e[t])return;const a=i+"/"+e[t];r(a,e[t]).then((function(){n++,n===e.length&&o(),s(t+1)}))};if(t)for(let t=0;t<e.length;t++){const s=i+"/"+e[t];r(s,e[t]).then((function(){n++,n===e.length&&o()}))}else s(0)}))},ObservableArray:P,Observable:class{constructor(e,t){const n=this;var r;return this.name="observable",e&&Object.assign(n,e),r=e,Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((e=>"constructor"===e||!!e.startsWith("_")||void(n[e]=r[e]))),new Proxy(n,{deleteProperty:function(e,t){return delete e[t],!0},get:function(e,t){return e[t]},set:function(e,r,o){const i=e[r];return i===o||(e[r]=o,!("notifyFn"!==r&&!r.startsWith("_")&&"canNotify"!==r&&(!t||-1!==t.indexOf(r))&&n.canNotify&&(n._notify({target:e,propertyName:r,oldValue:i,newValue:o}),0)))}})}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;if(t.canNotify&&t.notifyFn)for(let n=0;n<t.notifyFn.length;n++)t.notifyFn[n](e)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}},Component:class{constructor(e,t){const n=this.name;let r=null;return e?r=new window[n](e,t):(r=new window[n],r._initProperties=t),this._element=r,r}get name(){return"Component"}get element(){return this._element}},Theme:D.Theme||"",EnableShadowDOM:D.ShadowDom||!1,BaseUrl:"./",StyleBaseUrl:"/styles/default/",Version:e,Templates:t,RenderMode:D.RenderMode||"auto",Render:function(){const e=()=>{window[n].RenderMode="",L()};"complete"===document.readyState?e():(window.removeEventListener("load",e),window.addEventListener("load",e))},Data:u,Mode:D.Mode||"production",License:D.License||"Evaluation"});let O=window[n].Theme;"manual"!==window[n].RenderMode&&document.addEventListener("readystatechange",L),Object.defineProperty(window[n],"Theme",{configurable:!1,enumerable:!0,get:()=>O,set(e){const t=O;O=e,w.fireEvent("theme-changed",{oldValue:t,newValue:e},{bubbles:!0,cancelable:!0})}}),window[n]("smart-base-element",window[n].BaseElement),window[n]("smart-content-element",class extends window[n].BaseElement{static get properties(){return{content:{type:"any",reflectToAttribute:!1},innerHTML:{type:"string",reflectToAttribute:!1}}}template(){return"<div inner-h-t-m-l='[[innerHTML]]'></div>"}ready(){super.ready(),this.applyContent()}refresh(){}clearContent(){const e=this;for(;e.$.content.firstChild;)e.$.content.removeChild(e.$.content.firstChild)}applyContent(){const e=this;if(void 0===e.content)return void(e.content=e.$.content);if(""===e.content||null===e.content)return void e.clearContent();if(e.content instanceof HTMLElement)return e.clearContent(),void e.$.content.appendChild(e.content);const t=document.createDocumentFragment();let n=document.createElement("div");t.appendChild(n),e.content instanceof HTMLElement?n.appendChild(e.content):n.innerHTML=e.content;let r=Array.from(n.childNodes);n.parentNode.removeChild(n);for(let e=0;e<r.length;e++)t.appendChild(r[e]);e.clearContent(),e.$.content.appendChild(t)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const r=this;t!==n&&("innerHTML"===e&&(r.content=n,r.applyContent(),r.innerHTML=r.content=y.Core.html(r.$.content)),"content"===e&&r.applyContent())}}),window[n]("smart-scroll-viewer",class extends window[n].ContentElement{static get properties(){return{autoRefresh:{type:"boolean",value:!1},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},touchScrollRatio:{type:"any",value:null},touchVelocityCoefficient:{type:"number",value:50},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]}}}static get listeners(){return{touchmove:"_touchmoveHandler",touchstart:"_touchstartHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler"}}static get styleUrls(){return["smart.scrollviewer.css"]}template(){return'<div id="container" class="smart-container" role="presentation">\n <div id="scrollViewerContainer" class="smart-scroll-viewer-container" role="presentation">\n <div id="scrollViewerContentContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-scroll-viewer-content-container" role="presentation">\n <content></content>\n </div>\n </div>\n <smart-scroll-bar id="verticalScrollBar" theme="[[theme]]" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" orientation="vertical"></smart-scroll-bar>\n <smart-scroll-bar id="horizontalScrollBar" theme="[[theme]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]"></smart-scroll-bar>\n </div>'}appendChild(e){const t=this;if(e){if(!t.isCompleted||e.classList&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.$.scrollViewerContentContainer.appendChild(e)}}removeChild(e){const t=this;if(e){if(!t.isCompleted||e.classList&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.$.scrollViewerContentContainer.removeChild(e)}}removeAll(){const e=this;e.isCompleted&&(e.$.scrollViewerContentContainer.innerHTML="")}_horizontalScrollbarHandler(e){const t=this;t.$.scrollViewerContentContainer.style.left=(t.rightToLeft?1:-1)*t.scrollLeft+"px",e.stopPropagation&&e.stopPropagation(),t.onHorizontalChange&&t.onHorizontalChange(e)}_verticalScrollbarHandler(e){const t=this;t.$.scrollViewerContentContainer.style.top=-t.scrollTop+"px",e.stopPropagation&&e.stopPropagation(),t.onVerticalChange&&t.onVerticalChange(e)}_touchmoveHandler(e){const t=this;if(t._touchmoveInside&&e.cancelable)return e.preventDefault(),void e.stopPropagation();const n=t.scrollHeight>0,r=t.scrollWidth>0,o=t._touchCoords;if(!n&&!r||!o)return;const i=e.touches[0];let s,a,l,d;t._touchCoords=[i.pageX,i.pageY],n?(s=t.scrollTop,a=t.scrollHeight,l=i.pageY,d=o[1]):(s=t.scrollLeft,a=t.scrollWidth,l=i.pageX,d=o[0]);const c=parseFloat(l.toFixed(5)),u=parseFloat(d.toFixed(5));0===s&&c>=u||s===a&&c<=u||(l!==d&&(t._touchmoveInside=!0),e.cancelable&&(e.preventDefault(),e.stopPropagation()))}_touchstartHandler(e){const t=e.touches[0];this._touchCoords=[t.pageX,t.pageY]}_mouseWheelHandler(e){const t=this;if(!t.disabled&&(t.computedHorizontalScrollBarVisibility||t.computedVerticalScrollBarVisibility)){if(e.shiftKey&&t.computedHorizontalScrollBarVisibility){const n=t.scrollLeft;if(0===n&&e.deltaX<0||n===t.scrollHeight&&e.deltaX>0)return;return e.stopPropagation(),e.preventDefault(),void(t.scrollWidth>0&&t.scrollTo(void 0,t.scrollLeft+t._getScrollCoefficient(e,t.offsetWidth)))}if(t.computedVerticalScrollBarVisibility){const n=t.scrollTop;if(0===n&&e.deltaY<0||n===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault(),t.scrollHeight>0&&t.scrollTo(t.scrollTop+t._getScrollCoefficient(e,t.offsetHeight))}}}_overriddenHandler(){}_upHandler(){delete this._touchCoords,delete this._touchmoveInside}_getScrollCoefficient(e,t){const n=e.deltaMode,r=Math.abs(e.deltaY);let o;return 0===n?o=r<100/3?r:t:1===n?o=r<1?r*(100/3):t:2===n&&(o=t),e.deltaY<0?-o:o}applyContent(){super.applyContent(),this.refresh()}get computedHorizontalScrollBarVisibility(){const e=this;return e._scrollView&&e._scrollView.hScrollBar?!e._scrollView.hScrollBar.$.hasClass("smart-hidden"):null}get computedVerticalScrollBarVisibility(){const e=this;return e._scrollView&&e._scrollView.vScrollBar?!e._scrollView.vScrollBar.$.hasClass("smart-hidden"):null}scrollTo(e,t){const n=this;n._scrollView&&(void 0!==e&&n._scrollView.scrollTo(e),void 0!==t&&n._scrollView.scrollTo(t,!1))}refreshScrollBarsVisibility(){const e=this;e._scrollView&&(e._scrollView.hScrollBar.disabled=e.disabled,e._scrollView.vScrollBar.disabled=e.disabled,"disabled"===e.horizontalScrollBarVisibility&&(e._scrollView.hScrollBar.disabled=!0),"disabled"===e.verticalScrollBarVisibility&&(e._scrollView.vScrollBar.disabled=!0),e.scrollWidth>0?e._scrollView.hScrollBar.$.removeClass("smart-hidden"):"visible"!==e.horizontalScrollBarVisibility&&e._scrollView.hScrollBar.$.addClass("smart-hidden"),e.scrollHeight>0?e._scrollView.vScrollBar.$.removeClass("smart-hidden"):"visible"!==e.verticalScrollBarVisibility&&e._scrollView.vScrollBar.$.addClass("smart-hidden"),"hidden"===e.horizontalScrollBarVisibility&&e._scrollView.hScrollBar.$.addClass("smart-hidden"),"hidden"===e.verticalScrollBarVisibility&&e._scrollView.vScrollBar.$.addClass("smart-hidden"),"visible"===e.horizontalScrollBarVisibility&&e._scrollView.hScrollBar.$.removeClass("smart-hidden"),"visible"===e.verticalScrollBarVisibility&&(e._scrollView.vScrollBar.$.removeClass("smart-hidden"),e.disabled||(e._scrollView.vScrollBar.disabled=e.scrollHeight<=0)),e.computedHorizontalScrollBarVisibility&&e.computedVerticalScrollBarVisibility?(e._scrollView.hScrollBar.$.addClass("bottom-corner"),e._scrollView.vScrollBar.$.addClass("bottom-corner")):(e._scrollView.hScrollBar.$.removeClass("bottom-corner"),e._scrollView.vScrollBar.$.removeClass("bottom-corner")))}ready(){super.ready();const e=this;e.$.verticalScrollBar.onChange=t=>{t.detail=t,e._verticalScrollbarHandler(t)},e.$.horizontalScrollBar.onChange=t=>{t.detail=t,e._horizontalScrollbarHandler(t)},e.$.verticalScrollBar.setAttribute("aria-controls",e.id),e.$.horizontalScrollBar.setAttribute("aria-controls",e.id),e._customScrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.refresh()}refresh(){const e=this;function t(){const t=e.$.scrollViewerContainer.classList.contains("vscroll");e.$.scrollViewerContainer.classList.remove("vscroll");const n=e.$.scrollViewerContentContainer.offsetWidth-e.$.scrollViewerContainer.offsetWidth;return n>0&&"hidden"!==e.horizontalScrollBarVisibility||"visible"===e.horizontalScrollBarVisibility?e.$.scrollViewerContainer.classList.add("hscroll"):e.$.scrollViewerContainer.classList.remove("hscroll"),t&&e.$.scrollViewerContainer.classList.add("vscroll"),n}function n(){let t;const n=e.$.scrollViewerContainer.classList.contains("hscroll");if(e.$.scrollViewerContainer.classList.remove("hscroll"),Smart.Utilities.Core.Browser.Safari){const n=e.$.scrollViewerContentContainer.getBoundingClientRect().height,r=e.$.scrollViewerContainer.getBoundingClientRect().height;t=n&&r?parseInt(n)-parseInt(r):e.$.scrollViewerContentContainer.offsetHeight-e.$.scrollViewerContainer.offsetHeight}else t=e.$.scrollViewerContentContainer.offsetHeight-e.$.scrollViewerContainer.offsetHeight;return e.virtualScrollHeight&&(t=e.virtualScrollHeight),t>0&&"hidden"!==e.verticalScrollBarVisibility||"visible"===e.verticalScrollBarVisibility?e.$.scrollViewerContainer.classList.add("vscroll"):e.$.scrollViewerContainer.classList.remove("vscroll"),n&&e.$.scrollViewerContainer.classList.add("hscroll"),t}if(!e.$.scrollViewerContentContainer)return;"hidden"===e.verticalScrollBarVisibility&&e.$.scrollViewerContentContainer.setAttribute("disable-vertical",""),"hidden"===e.horizontalScrollBarVisibility&&e.$.scrollViewerContentContainer.setAttribute("disable-horizontal","");let r=e.scrollWidth,o=e.scrollHeight;e.scrollWidth=t(),e.scrollHeight=n(),e.scrollHeight&&o===e.scrollHeight||(e.scrollWidth=t()),e.scrollWidth&&r===e.scrollWidth||(e.scrollHeight=n()),e.computedVerticalScrollBarVisibility&&(e.scrollHeight+=e._scrollView.hScrollBar.offsetHeight),e.computedHorizontalScrollBarVisibility&&(e.scrollWidth+=e._scrollView.vScrollBar.offsetWidth),0===e.scrollHeight&&e.scrollWidth>0&&e.$.container.offsetHeight-e.$.content.offsetHeight<5&&(e.$.container.style.paddingBottom=e._scrollView.hScrollBar.offsetHeight+"px"),e.autoRefresh&&(e.$.scrollViewerContainer.scrollLeft=0,e.$.scrollViewerContainer.scrollTop=0)}attached(){const e=this;super.attached(),e._scrollView||e._customScrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar))}detached(){const e=this;super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView)}get scrollWidth(){const e=this;return e._scrollView&&e._scrollView.hScrollBar?1===e._scrollView.hScrollBar.max&&"visible"===e.horizontalScrollBarVisibility?0:e._scrollView.hScrollBar.max:-1}set scrollWidth(e){const t=this;e<0&&(e=0),t._scrollView&&t._scrollView.hScrollBar&&(0===e&&"visible"===t.horizontalScrollBarVisibility?t._scrollView.hScrollBar.max=0:t._scrollView.hScrollBar.max=e,t.refreshScrollBarsVisibility())}get scrollHeight(){const e=this;return e._scrollView&&e._scrollView.vScrollBar?1===e._scrollView.vScrollBar.max&&"visible"===e.verticalScrollBarVisibility?0:e._scrollView.vScrollBar.max:0}set scrollHeight(e){const t=this;e<0&&(e=0),t._scrollView&&t._scrollView.vScrollBar&&(0===e&&"visible"===t.verticalScrollBarVisibility?t._scrollView.vScrollBar.max=1:t._scrollView.vScrollBar.max=e,t.refreshScrollBarsVisibility())}get scrollLeft(){const e=this;return e._scrollView&&e._scrollView.hScrollBar?e._scrollView.hScrollBar.value:0}set scrollLeft(e){const t=this;e<0&&(e=0),t._scrollView&&t._scrollView.hScrollBar&&(t._scrollView.hScrollBar.value=e)}get scrollTop(){const e=this;return e._scrollView&&e._scrollView.vScrollBar?e._scrollView.vScrollBar.value:0}set scrollTop(e){const t=this;e<0&&(e=0),t._scrollView&&t._scrollView.vScrollBar&&(t._scrollView.vScrollBar.value=e)}propertyChangedHandler(e,t,n){const r=this;super.propertyChangedHandler(e,t,n),"animation"!==e&&"theme"!==e&&r.refresh()}}),window[n].Utilities.Assign("PositionDetection",class{constructor(e,t,n,r){const o=this;if(t){const n="dropDown"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);t.id=n,e.setAttribute("aria-owns",n)}o.context=e,o.dropDown=t,o.defaultParent=n,o.closeMethod=r}handleAutoPositioning(){const e=this,t=e.context;if("auto"!==t.dropDownPosition||t.disabled||t.isHidden)return;const n=window.requestAnimationFrame;let r,o=Date.now();return r=n((function i(){t.isHidden||document.hidden||(r=n(i),"auto"===t.dropDownPosition&&!t.disabled&&(t.isInShadowDOM?document.body.contains(t.shadowParent):document.body.contains(t))||cancelAnimationFrame(r),t.isHidden&&cancelAnimationFrame(r),Date.now()-o>=200&&(e.scrollHandler(),o=Date.now()))}))}checkBrowserBounds(e){const t=this.context;if("auto"===t.dropDownPosition&&!t.disabled)switch(e){case"vertically":this.checkBrowserBoundsVertically();break;case"horizontally":this.checkBrowserBoundsHorizontally();break;default:this.checkBrowserBoundsVertically(),this.checkBrowserBoundsHorizontally()}}checkBrowserBoundsHorizontally(){const e=this.context,t=this.dropDown;let n,r=0;a.isMobile||window.innerWidth===document.documentElement.clientWidth||(r=window.innerWidth-document.documentElement.clientWidth),null!==e._dropDownParent?n=!0:t.style.left="";const o=window.innerWidth-r;let i=e.getBoundingClientRect().left;if(i<0&&(t.style.left=(n?0:Math.abs(i))+"px",i=parseFloat(t.style.left)),i+t.offsetWidth>o){let e=i-Math.abs(o-i-t.offsetWidth);n&&(e+=window.pageXOffset),t.style.left=(n?e:e-i)+"px",window.innerWidth===document.documentElement.clientWidth&&(t.style.left=parseFloat(t.style.left)+r+"px"),n&&window.innerHeight===document.documentElement.clientHeight&&this.positionDropDown(!0)}}checkBrowserBoundsVertically(e){const t=this.context,n=this.dropDown,r=t._dropDownListPosition;e||(e=t.getBoundingClientRect()),0!==e.height&&(document.documentElement.clientHeight-Math.abs(e.top+e.height+n.offsetHeight)>=0?t._dropDownListPosition="bottom":e.top-n.offsetHeight>=0?t._dropDownListPosition="top":t._dropDownListPosition="overlay-center",this.updatePositionAttribute(r,t._dropDownListPosition))}scrollHandler(){const e=this.context;if(!e.parentElement)return;const t=e.getBoundingClientRect();if(t.top===e._positionTop)return;const n=e._dropDownListPosition;this.checkBrowserBoundsVertically(t),e._dropDownListPosition!==n&&this.positionDropDown(),e._positionTop=t.top}getDropDownParent(e){const t=this.context,n=this.dropDown;let r=t.dropDownAppendTo;t._positionedParent=null,null===r?t._dropDownParent=null:"body"===r||r===document.body?t.getRootNode().host?t._dropDownParent=t.getRootNode().host.shadowRoot:t._dropDownParent=document.body:r instanceof HTMLElement?t._dropDownParent=r:"string"==typeof r?(r=document.getElementById(r),r instanceof HTMLElement?t._dropDownParent=r:(t.dropDownAppendTo=null,t._dropDownParent=null)):(t.dropDownAppendTo=null,t._dropDownParent=null);let o=t._dropDownParent;if(null!==o){for(;o&&o instanceof HTMLElement&&"static"===window.getComputedStyle(o).position&&o!==t.getShadowRootOrBody();)o=o.parentElement;o===document.body?t._positionedParent=null:t._positionedParent=o,n&&(n.setAttribute("animation",t.animation),""!==t.theme&&n.$.addClass(t.theme),e&&(t._dropDownParent.appendChild(n),n.$.addClass("smart-drop-down-repositioned")),-1===t.detachedChildren.indexOf(n)&&t.detachedChildren.push(n))}}dropDownAppendToChangedHandler(){const e=this.context,t=this.dropDown,n=e._dropDownParent;this.getDropDownParent(),e._dropDownParent!==n&&(e[this.closeMethod](),["left","top","font-size","font-family","font-style","font-weight"].forEach((e=>t.style[e]=null)),null===e._dropDownParent?(this.defaultParent.appendChild(t),t.$.removeClass("smart-drop-down-repositioned")):(e._dropDownParent.appendChild(t),t.$.addClass("smart-drop-down-repositioned")))}dropDownPositionChangedHandler(){const e=this;e.dropDown.style.transition="none",e.context[e.closeMethod](),e.setDropDownPosition(),e.handleAutoPositioning()}dropDownAttached(e){const t=this.context;null!==t._dropDownParent&&(t._dropDownParent.appendChild(this.dropDown),this.handleAutoPositioning(),e&&t[e]())}dropDownDetached(){const e=this.context;null!==e._dropDownParent&&document.body.contains(this.dropDown)&&document.body.contains(e._dropDownParent)&&e._dropDownParent.removeChild(this.dropDown)}setDropDownPosition(){const e=this.context,t=e.dropDownPosition,n=e._dropDownListPosition;"auto"===t?this.checkBrowserBounds():e._dropDownListPosition=t,this.updatePositionAttribute(n,e._dropDownListPosition)}updatePositionAttribute(e,t){const n=this.context,r=this.dropDown;n.$.dropDownButton&&!n.$.dropDownButton.hasAttribute(t)&&(n.$.dropDownButton.removeAttribute(e),n.$.dropDownButton.setAttribute(t,"")),r.hasAttribute(t)||(r.style.transition="none",r.removeAttribute(e),r.setAttribute(t,""),requestAnimationFrame((function(){r.style.transition=null})))}positionDropDown(e){const t=this.context,n=this.dropDown;if(!t.opened||null===t._dropDownParent)return;const r=t.getBoundingClientRect();let o,i;if(this.customPositionDropDown){const e=this.customPositionDropDown(r);o=e.left,i=e.top}else switch(o=r.left,i=r.top,t._dropDownListPosition){case"bottom":i+=t.$.container.offsetHeight-1;break;case"center-bottom":i+=t.$.container.offsetHeight-1,o+=t.offsetWidth-n.offsetWidth/2;break;case"center-top":i-=n.offsetHeight-1,o+=t.offsetWidth-n.offsetWidth/2;break;case"top":i-=n.offsetHeight-1;break;case"overlay-bottom":break;case"overlay-center":i-=n.offsetHeight/2-t.offsetHeight/2;break;case"overlay-top":i-=n.offsetHeight-t.offsetHeight}const s=this.getDropDownOffset();n.style.top=i+s.y+"px",e||(n.style.left=o+s.x+"px")}getDropDownOffset(){const e=this.context._positionedParent;let t,n;if(e&&"#document-fragment"!==e.nodeName){const r=e.getBoundingClientRect();t=-r.left,n=-r.top}else t=window.pageXOffset,n=window.pageYOffset;return{x:t,y:n}}placeOverlay(){const e=this.context;if(!e.dropDownOverlay||e._overlay)return;const t=document.createElement("div");t.classList.add("smart-drop-down-overlay"),t.style.width=document.documentElement.scrollWidth+"px",t.style.height=document.documentElement.scrollHeight+"px",document.body.appendChild(t),e._overlay=t}removeOverlay(e){const t=this,n=t.context;n._overlay&&(n.hasAnimation&&e?requestAnimationFrame((function e(){t.dropDown.getBoundingClientRect().height>0?requestAnimationFrame(e):(document.body.removeChild(n._overlay),delete n._overlay)})):(document.body.removeChild(n._overlay),delete n._overlay))}}),window.Smart.Color=class{constructor(e){if(window.Smart._colors||(window.Smart._colors=[]),window.Smart._colors[e]){const t=window.Smart._colors[e];return this.hex=t.hex,this.r=t.r,this.g=t.g,void(this.b=t.b)}this.r=this.g=this.b=0,this.hex="";const t=this.getStandardizedColor(e);t&&(this.setHex(t.substring(1)),window.Smart._colors[e]={hex:this.hex,r:this.r,g:this.g,b:this.b})}getStandardizedColor(e){const t=document.createElement("canvas").getContext("2d");return t.fillStyle=e,t.fillStyle}getInvertedColor(){return""===this.hex?"transparent":255-(.299*this.r+.587*this.g+.114*this.b)<105?"Black":"White"}hexToRgb(e){let t="00",n="00",r="00";return 6===(e=this.validateHex(e)).length?(t=e.substring(0,2),n=e.substring(2,4),r=e.substring(4,6)):(e.length>4&&(t=e.substring(4,e.length),e=e.substring(0,4)),e.length>2&&(n=e.substring(2,e.length),e=e.substring(0,2)),e.length>0&&(r=e.substring(0,e.length))),{r:this.hexToInt(t),g:this.hexToInt(n),b:this.hexToInt(r)}}validateHex(e){return(e=(e=new String(e).toUpperCase()).replace(/[^A-F0-9]/g,"0")).length>6&&(e=e.substring(0,6)),e}webSafeDec(e){return e=Math.round(e/51),e*=51}hexToWebSafe(e){let t,n,r;return 3===e.length?(t=e.substring(0,1),n=e.substring(1,1),r=e.substring(2,1)):(t=e.substring(0,2),n=e.substring(2,4),r=e.substring(4,6)),this.intToHex(this.webSafeDec(this.hexToInt(t)))+this.intToHex(this.webSafeDec(this.hexToInt(n)))+this.intToHex(this.webSafeDec(this.hexToInt(r)))}rgbToWebSafe(e){return{r:this.webSafeDec(e.r),g:this.webSafeDec(e.g),b:this.webSafeDec(e.b)}}rgbToHex(e){return this.intToHex(e.r)+this.intToHex(e.g)+this.intToHex(e.b)}intToHex(e){let t=parseInt(e).toString(16);return 1===t.length&&(t="0"+t),t.toUpperCase()}hexToInt(e){return parseInt(e,16)}setRgb(e,t,n){let r=function(e){return e<0||e>255||isNaN(parseInt(e))?0:e};this.r=r(e),this.g=r(t),this.b=r(n),this.hex=this.rgbToHex(this)}setHex(e){this.hex=e;let t=this.hexToRgb(this.hex);this.r=t.r,this.g=t.g,this.b=t.b}}}();
|
|
91
91
|
|
|
92
92
|
/***/ }),
|
|
93
93
|
|
|
@@ -122,7 +122,7 @@ Smart("smart-input",class extends Smart.BaseElement{static get properties(){retu
|
|
|
122
122
|
/***/ 7498:
|
|
123
123
|
/***/ (() => {
|
|
124
124
|
|
|
125
|
-
Smart("smart-kanban",class extends Smart.DataView{static get properties(){return{addNewButton:{value:!1,type:"boolean"},addNewButtonDisplayMode:{value:"top",allowedValues:["top","bottom","both"],type:"string"},addNewColumn:{value:!1,type:"boolean"},autoColumnHeight:{value:!1,type:"boolean"},applyColumnColorToTasks:{value:!1,type:"boolean"},addNewColumnWidth:{value:null,type:"any"},allowColumnEdit:{value:!1,type:"boolean"},allowColumnHide:{value:!0,type:"boolean"},allowColumnRemove:{value:!1,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowCustomTags:{value:!0,type:"boolean"},allowDrag:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDrop:{value:!0,type:"boolean",defaultReflectToAttribute:!0},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},cardHeight:{value:null,type:"number?"},currentUser:{value:null,type:"any"},columnColorEntireSurface:{value:!1,type:"boolean"},columnFooter:{value:!1,type:"boolean"},columnActions:{value:!1,type:"boolean"},columnColors:{value:!1,type:"boolean"},columnWidth:{value:null,type:"any"},columnSummary:{value:!1,type:"boolean"},columnEditMode:{value:"headerAndMenu",allowedValues:["header","menu","headerAndMenu"],type:"string"},columnHeaderTemplate:{value:null,type:"any"},disableDialog:{value:!1,type:"boolean"},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},editable:{value:!1,type:"boolean"},dragOffset:{value:"auto",type:"any"},formatStringDate:{value:"d",type:"string"},formatStringTime:{value:"MMM d, HH:mm",type:"string"},hierarchy:{value:"columns",allowedValues:["columns","tabs"],type:"string"},messages:{value:{en:{actionsIcon:"Actions icon",actionsList:"Open actions list",unassignedTask:"Unassigned task",unassigned:"unassigned",assignedTask:"Assigned to {{userName}}",addNewStatus:"New status",addNewColumn:"Add new status",addNewTask:"Add new task",addSubtask:"Add subtask",assignedTo:"Assigned to",createdBy:"Created by",updatedBy:"Updated by",createdByDate:"Created",updatedByDate:"Updated",checklist:"Sub tasks",color:"Color",commentsIcon:"Comments icon",copy:"Copy",customize:"Customize tasks",customizeColumn:"Customize column",dueDate:"Due date",days:"days",edit:"Edit",editTask:"ID: {{taskId}} {{text}}",expand:"Expand column",collapse:"Collapse column",high:"High",low:"Low",critical:"Critical",newComment:"New comment",newSubtask:"New subtask",overdue:"Overdue",average:"Average",priority:"Priority",priorityIcon:"Priority icon",progress:"Progress",promptComment:"Are you sure you want to remove this comment?",promptTask:'Are you sure you want to remove the task "{{taskText}}"?',promptColumn:"Are you sure you want to remove this column?",remove:"Remove",removeSubtask:"Remove subtask",removeColumn:"Remove column",hideColumn:"Hide column",removeComment:"Remove comment",removeTask:"Remove task",showAllColumns:"Show all columns",send:"Send",startDate:"Start date",status:"Status",swimlane:"Swimlane",tags:"Tags",text:"Name",description:"Description",taskProgress:"Task progress: {{value}}%",taskDescription:"Task description: {{value}}",taskCompleted:"Tasks completed: {{value}}/{{count}}",tasksSummary:"{{summary}} tasks",tasksSummaryOne:"1 task",userId:"User ID",userIcon:"User icon",guestUser:"Guest",detailsTab:"Details",commentsTab:"Comments",fieldsTab:"Fields",historyTab:"History",subtasksTab:"Subtasks",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'From "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed to "{{newValue}}"',invalidRange:'"{{start}}" should be less than "{{end}}"',historyDate:"Date",ok:"ok",cancel:"Cancel",delete:"Delete",taskDeadlineChanged:"Deadline changed",tagsChanged:"Tags changed",taskMoved:"Task moved",taskUpdated:"Task updated",taskCreated:"Task created",taskUserChanged:"Assignee changed",taskUserRemoved:"Assignee removed",taskDescriptionChanged:"Description changed",taskSubtasksChanged:"Subtasks changed",taskProgressChanged:"Progress changed",taskPriorityChanged:"Priority changed",taskSubtasksCompleted:"Completed {{value}}",taskStatusChanged:"Status changed",taskTagsChanged:"Tags changed",taskNameChanged:"Name changed",taskColorChanged:"Color changed",empty:"No tasks"}}},onColumnHeaderRender:{value:null,type:"any",reflectToAttribute:!1},onColumnFooterRender:{value:null,type:"any",reflectToAttribute:!1},onTaskRender:{value:null,type:"any",reflectToAttribute:!1},onSortPrepare:{value:null,type:"any",reflectToAttribute:!1},onFilterPrepare:{value:null,type:"any",reflectToAttribute:!1},priority:{value:[],type:"array",reflectToAttribute:!1},priorityList:{value:!0,type:"boolean"},readonly:{value:!1,type:"boolean"},selectionMode:{value:"zeroOrOne",allowedValues:["zeroOrOne","zeroOrManyExtended"],type:"string"},storeHistory:{value:!0,type:"boolean"},storeHistoryItems:{value:20,type:"number"},swimlanes:{value:[],type:"array",reflectToAttribute:!1},swimlanesFrom:{value:0,type:"number"},swimlanesTo:{value:null,type:"number?"},tags:{value:[],type:"array"},taskActions:{value:!1,type:"boolean"},taskActionsRendered:{value:null,type:"any"},taskComments:{value:!1,type:"boolean"},taskDue:{value:!1,type:"boolean"},taskPosition:{value:"all",allowedValues:["all","leaf"],type:"string"},taskPriority:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskProgress:{value:!1,type:"boolean"},taskTags:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskSubTasks:{allowedValues:["none","onePerRow","onlyUnfinished"],value:"none",type:"string"},taskSubTasksInput:{value:!0,type:"boolean"},taskUserIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskCustomFields:{value:[],type:"array",reflectToAttribute:!1},taskCustomFieldsHide:{value:!1,type:"boolean"},taskColor:{value:!0,type:"boolean"},taskColorEntireSurface:{value:!1,type:"boolean"},textTemplate:{value:null,type:"any"},userList:{value:!1,type:"boolean"},users:{value:[],type:"array",reflectToAttribute:!1},dialogCustomizationFunction:{value:null,type:"any"},dialogRendered:{value:null,type:"any"},dialogEditors:{value:["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"],type:"any"}}}static get listeners(){return{"body.focusin":"_bodyFocusinHandler",keyup:"_keyupHandler","container.click":"_containerClickHandler","container.down":"_containerDownHandler","container.keydown":"_containerKeydownHandler","container.touchmove":"_scrollViewerTouchmoveHandler"}}template(){const e=this._tabindex;return`<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize tasks"><div role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev"${e} role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next"${e} role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close"${e} role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n <smart-scroll-viewer auto-refresh vertical-scroll-bar-visibility="hidden" class="smart-kanban-scroll-viewer" id="scrollViewer">\n <div id="body" class="smart-kanban-body" role="presentation"></div>\n </smart-scroll-viewer>\n </div>`}_keyupHandler(e){const t=this;if("Escape"===e.key&&t._dragDetails){const e=t._dragDetails,a=Smart.Kanban.hoveredKanban,s=Smart.Kanban.hoveredItem;if(delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,e.ScrollViewer&&e.ScrollViewer._scrollView&&(e.ScrollViewer._scrollView.disableSwipeScroll=!1),!e.FeedbackShown)return;a&&clearInterval(a._dragInterval),t._preventSelection=!0;const l=t.isInShadowDOM?t.getRootNode().host:document.body;return l.classList.remove("smart-dragging"),l.style.overflow=t._originalBodyOverflow.overflow,l.style.eoverflowX=t._originalBodyOverflow.overflowX,l.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,e.Feedback.remove(),e.Items.forEach((e=>e.classList.remove("dragged"))),s.classList.remove("drop-target"),void(s.classList.contains("before")?s.classList.remove("before"):s.classList.contains("after")&&s.classList.remove("after"))}}render(){const e=this;Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getCurrentDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.isInitialized=!1,e._render(),super.render(),e.isInitialized=!0}_getPriority(){const e=this;if(!e.priority||e.priority&&0===e.priority.length)e.priority=[{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',label:"",value:""},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>',label:e.localize("low"),value:"low"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>',label:e.localize("average"),value:"average"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>',label:e.localize("high"),value:"high"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>',label:e.localize("critical"),value:"critical"}];else if(e.priority){const t=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let a=0;a<e.priority.length;a++){const s=e.priority[a];s.menuIcon=t(s)}}for(let t=0;t<e.priority.length;t++){const a=e.priority[t];a.menuLabel=`<div priority="${a.value}" class="smart-kanban-task-text">${a.menuIcon}${a.label}</div>`}return e.priority}_getTags(){const e=this,t=[];if(e.tags){for(let a=0;a<e.tags.length;a++){const s=e.tags[a];if(s&&"string"==typeof s)t.push({label:s.trim(),value:s.trim()});else{const e={};s.label&&(e.label=s.label),s.value?e.value=s.value:e.value=s.label,s.color&&(e.color=s.color),t.push(e)}}e.tags=t}}_render(){const e=this,t=getComputedStyle(e);if(e.columnColorEntireSurface?e.classList.add("smart-kanban-column-color"):e.classList.remove("smart-kanban-column-color"),e.$.body.innerHTML="",e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._kanbanTaskMinWidth=parseFloat(t.getPropertyValue("--smart-kanban-task-min-width")),e._dataViewPadding=parseFloat(t.getPropertyValue("--smart-data-view-padding")),e.uiTasksByDataField=[],e.tasksByDataField=[],e.taskById=[],e._allColumns=[],e._customTags=[],e._selectedTasks=[],e._dblclickObject={numberOfClicks:0},e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._sortPanelDataSource=[{label:e.localize("text"),dataField:"text",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("priority"),dataField:"priority",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowFilter:!0,allowSort:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowFilter:!0,allowSort:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowFilter:!0,allowSort:!0}],e.taskCustomFields){const t=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let a=0;a<e.taskCustomFields.length;a++){const s=e.taskCustomFields[a].label;if(t){const l=typeof t[e.taskCustomFields[a].dataField];"number"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"number"}):"date"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"date"}):e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}else e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}}const a={checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"};for(let t in a)e.dataSourceMap[t]||(e.dataSourceMap[t]=a[t]);e._getPriority(),e._getTags(),e._validateDataSourceMap(),e._getInnerElementMessages(),e._localizeHeader(),e._handleHeaderPosition(e.$.scrollViewer),e._validateSwimlanes(),e._renderColumns(),e._handleSwimlanes();let s=!1;e.autoLoadState&&(s=e.loadState()),e._getCurrentUser(),s||e._processDataSource(),e._setPriorityList(),e._setUserList(),e._setActionsList(),e._setColumnActionsList(),e._setCommentsList(),e._autoSaveState(),e._createAddNewButton(),e.$.scrollViewer.refresh()}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog))}detached(){const e=this;if(super.detached(),!e._dialog)return;const t=e._dialog;t.removeEventListener("open",e._dialogEventHandler),t.removeEventListener("closing",e._dialogEventHandler),t.removeEventListener("close",e._dialogEventHandler),t.removeEventListener("click",e._dialogClickHandler),t.remove()}addTask(e={}){const t=this,a=t.columns;if("object"!=typeof e||0===a.length||!t._currentUser.allowAdd)return;const s=t.dataSourceMap;void 0===e[s.status]&&(e[s.status]=a[0].dataField),t._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=t._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date));const l={value:e,id:e.id};t.$.fireEvent("taskBeforeAdd",l),t.dataSource&&t.dataSource.virtualDataSource?t._requestVirtualDataSource("add",e,(function(e){return e})):(t.dataSource||(t.dataSource=[]),t.dataSource.push(e),t._createTask(e,!0),t._autoSaveState("dataSource")),t.$.fireEvent("taskAdd",l),t._refreshButtonsAndSummaries(),t.virtualization&&t._refreshColumns()}addSort(e,t){const a=this,s=a.dataSource;let l;function o(e,s){const o=a._sortPanelDataSource.find((t=>t.dataField===e));if(o){let a=Array.isArray(t)?t[s]:"string"==typeof t?t:"ascending";l.dataFields.push(e),l.dataTypes.push(o.dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",l.orderBy.push(a)}}if(0!==arguments.length&&s&&0!==s.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)l=e;else if(l={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(o);else{if("string"!=typeof e)return;o(e,0)}super.addSort(l)}}beginEdit(e){const t=this;t.disabled||(e=t._validateTaskArgument(e))&&(t.editable||t.readonly)&&t._openDialog(e,"edit")}cancelEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&e.close()}hide(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!1!==e.visible&&(e.visible=!1,t.$.fireEvent("columnHide",{column:e}),t.refresh())}show(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!0!==e.visible&&(e.visible=!0,t.$.fireEvent("columnShow",{column:e}),t.refresh())}showAllColumns(){const e=this;for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0;e.refresh()}collapse(e){const t=this;if(!t.collapsible)return;if(!(e=t._validateColumnArgument(e))||e.collapsed||!e.collapsible)return;const a=t._columnToElement.get(e),s=a.siblingColumns;let l=0;e.collapsed=!0,a.classList.add("collapsed");const o=e.collapsed?t.localize("expand"):t.localize("collapse"),r=a.querySelector(".smart-kanban-column-header-toggle-button");if(r&&r.setAttribute("title",o),s.forEach((e=>e.collapsed&&l++)),l===s.length){const a=0!==s.indexOf(e)?0:1,l=s[a],o=t._columnToElement.get(l);l&&(l.collapsed=!1),o&&(o.classList.remove("collapsed"),t._updateColumnWidths(s,o.parentElement))}else t._updateColumnWidths(s,a.parentElement);t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t._doNotFireEvents||t.$.fireEvent("columnCollapse",{column:e})}copyTask(e){const t=this;if(!t._currentUser.allowAdd)return;if(!(e=t._validateTaskArgument(e)))return;const a=JSON.parse(JSON.stringify(e.data));a.history=[],t.dataSource&&t.dataSource.virtualDataSource?t._requestVirtualDataSource("add",a,(function(e){return t.$.fireEvent("taskAdd",{value:a}),e})):(a[t.dataSourceMap.id]=Math.floor(9e4*Math.random()+1e4),t._createTask(a,!0),t._autoSaveState("dataSource"),t.$.fireEvent("taskAdd",{value:a})),t.dataSource||(t.dataSource=[]),t.dataSource.push(a),t._refreshButtonsAndSummaries()}endEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&(e.ok=!0,e.close())}ensureVisible(e){const t=this;if(e&&"number"==typeof e){const a=t.getTask(e);if(!a)return;const s=a[t.dataSourceMap.status],l=t.querySelector('.smart-kanban-column[data-field="'+s+'"]');if(l){const e=l.querySelector("smart-scroll-viewer");e&&(a.top<e.scrollTop||a.top>e.scrollTop+e.offsetHeight?e.scrollTop=a.top:t._refreshScrollHeight(e,s))}return}if(!(e=t._validateTaskArgument(e))||e.filteredOut)return;const a=e.closest("smart-scroll-viewer");if(0===a.scrollHeight)return e;const s=a.scrollTop,l=e.offsetTop;return s<=l&&s+a.offsetHeight>=l+e.offsetHeight||(a.scrollTop=l),e}expand(e){const t=this;if(!(e=t._validateColumnArgument(e))||!e.collapsed)return;const a=t._columnToElement.get(e);e.collapsed=!1,a.classList.remove("collapsed");const s=e.collapsed?t.localize("expand"):t.localize("collapse"),l=a.querySelector(".smart-kanban-column-header-toggle-button");l&&l.setAttribute("title",s),t._updateColumnWidths(a.siblingColumns,a.parentElement),t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t.$.fireEvent("columnExpand",{column:e})}expandAll(){const e=this;e._allColumns.forEach((t=>{t.collapsed=!1,e._columnToElement.get(t).classList.remove("collapsed")})),e._allColumns.forEach((t=>e._refreshScrollViewer(t))),e._columnContainers.forEach((t=>e._updateColumnWidths(t.children,t))),e._autoSaveState("collapsed"),e._handleSwimlanes(!0)}exportData(e,t,a){const s=this,l=getComputedStyle(s),o=l.borderRightColor,r=s.swimlanes,i=new Smart.Utilities.DataExporter,n=s._getCurrentDataSource(),d=s.dataSourceMap,c=[{id:"Task ID",text:"Text",status:"Status",swimlane:"Swimlane",asignee:"Asignee",priority:"Priority",progress:"Progress",startDate:"Start date",dueDate:"Due date",subTasks:"Completed sub-tasks",tags:"Tags"}],u={},m={},p={};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)c[0][s.taskCustomFields[e].dataField]=s.taskCustomFields[e].label;i.style={border:"1px solid "+o,borderCollapse:"collapse",backgroundColor:l.backgroundColor,color:l.color,fontFamily:"Helvetica",header:{border:"1px solid "+o,fontWeight:"bold"},columns:{border:"1px solid "+o,progress:{format:"p0"},startDate:{format:s.formatStringDate},dueDate:{format:s.formatStringDate}},rows:{}},0===r.length&&delete c[0].swimlane;for(let e=0;e<n.length;e++){const t=n[e];let a=t[d.status],l=t[d.swimlane],o=t[d.userId],h=t[d.progress];u[a]?a=u[a]:(a=s._allColumns.find((e=>e.dataField===a)).label,u[t[d.status]]=a),null===o?o="":p[o]?o=p[o]:(o=s.users.find((e=>e.id===o)).name,p[t[d.userId]]=o),null===h?h="":h/=100;let g=t[d.tags];g&&"string"!=typeof g&&(g=g.map((e=>"string"==typeof e?e:e.label)));const b={id:t[d.id],text:t[d.text],description:t[d.description]||"",status:a,asignee:o,priority:t[d.priority]||"",progress:h,startDate:t[d.startDate]||"",dueDate:t[d.dueDate]||"",subTasks:s._getCompletedSubTasks(t[d.checklist]),tags:g};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)b[s.taskCustomFields[e].dataField]=`"${t[s.taskCustomFields[e].dataField]}"`.replaceAll(","," ");r.length&&(l?m[l]?l=m[l]:(l=r.find((e=>e.dataField===l)).label,m[t[d.swimlane]]=l):l="",b.swimlane=l),c.push(b),t[d.color]&&(i.style.rows[e]={backgroundColor:t[d.color]})}return i.exportData(c,e,t,a)}getState(e){const t=this,a={},s={collapsed:a,dataSource:t._getCurrentDataSource(),filtering:t._appliedFiltering,selection:{selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart:null},sorting:t._appliedSorting,tabs:t._selectedTabs,visibility:{taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}};let l=null,o=null;t._selectionInView&&(l=t._selectionInView.closest(".smart-kanban-column").column.dataField,o=t._selectionInView.getAttribute("swimlane")),s.selection.selectionInColumn=l,s.selection.swimlane=o;const r={};for(let e in t.tasksByDataField){r[e]=[];const a=t.tasksByDataField[e];for(let t=0;t<a.length;t++)r[e].push(a[t].id)}if(s.order=r,t._allColumns.forEach((e=>a[e.dataField]=e.collapsed)),e){const t={};for(let a in e){const l=e[a];s[l]&&(t[l]=s[l])}return t}return s}loadState(e,t){const a=this;if(!e&&!(e=window.localStorage.getItem("smartKanban"+a.id)))return!1;"string"==typeof e&&(e=JSON.parse(e,((e,t)=>t&&-1!==["startDate","dueDate","time"].indexOf(e)?new Date(t):t))),e.dataSource||(t=!1),a._doNotFireEvents=!0,a._selectedTasks=[],delete a._selectionStart,delete a._selectionInView,a.expandAll(),!1!==t&&Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),a._allColumns.forEach((t=>{e.collapsed&&e.collapsed[t.dataField]&&a.collapse(t)}));for(let t in e.visibility)a[t]=e.visibility[t];if(!1!==t&&(a.dataSource=e.dataSource,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource()),e.order){let t=!1,s=[];for(let s in e.order){const l=e.order[s];let o=a._getTasksByDataField(s);for(let e=0;e<l.length;e++){const r=l[e],i=a.taskById[r];if(i){const l=o.indexOf(i);if(l!==e&&l>=0)o.splice(e,0,o.splice(l,1)[0]),t=!0;else if(-1===l){let l=a._getTasksByDataField(i[a.dataSourceMap.status]);const r=l.indexOf(i);r>=0&&(l.splice(r,1),i[a.dataSourceMap.status]=s,o.splice(e,0,i),t=!0)}}}}if(t){const e=Object.keys(a.tasksByDataField);for(let t in e)s=s.concat(a.tasksByDataField[e[t]]);Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),a.dataSource=s,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource()}}if(e.filtering&&a.addFilter(a._constructFilterGroups(e.filtering),e.filtering.operator),e.sorting&&a.addSort(e.sorting),!1!==t&&a._autoSaveState(e),e.selection&&(e.selection.selected.forEach((e=>{const t=a.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`);t&&(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id))})),e.selection.selectionStart&&(a._selectionStart=a.$.container.querySelector(`.smart-kanban-task[data-id="${e.selection.selectionStart}"]`)),e.selection.selectionInColumn)){const t=a._columnToElement.get(a._allColumns.find((t=>t.dataField===e.selection.selectionInColumn)));e.selection.swimlane?a._selectionInView=t.querySelector(`smart-scroll-viewer[swimlane=${e.selection.swimlane}]`):a._selectionInView=t.querySelector("smart-scroll-viewer")}if(e.tabs){const t="tabs"===a.hierarchy;a._allColumns.forEach((s=>{if(void 0!==s.selected){const l=a._columnToElement.get(s),o=-1!==e.tabs.indexOf(s.dataField);s.selected=o,t&&(l.classList.toggle("smart-hidden",!o),l.tab.classList.toggle("selected",o),l.tab.setAttribute("aria-selected",o))}}))}return a._doNotFireEvents=!1,!0}moveTask(e,t){const a=this;if(a.disabled||""!==t&&!t)return;const s=a.dataSourceMap;if(!(e=a._validateTaskArgument(e))||!a._updateTaskInProgress&&e.data[s.status]===t)return;const l=a._allColumns.find((e=>e.dataField===t));function o(){const o=e.closest("smart-scroll-viewer"),r=a._columnToElement.get(l),i=e.data,n=a.getTaskScrollViewer(r,i);if(a.virtualization){const l=i,r=e.column.dataField,d=a._getTasksByDataField(r),c=d.findIndex((e=>e.id===l.id));return c>=0&&(d.splice(c,1),a._getTasksByDataField(t).push(l)),i[s.status]=t,a._refreshScrollViewer(o,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),void((a.shadowRoot||a.getRootNode()).activeElement===o&&a._focusTask(a._getFirstItem(o.$.content)))}i[s.status]=t,n.appendChild(e),a._dialog&&a._dialog.ok||(a.textTemplate&&a._renderTask(e),a._autoSaveState("dataSource")),a._refreshScrollViewer(o,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),(a.shadowRoot||a.getRootNode()).activeElement===o&&a._focusTask(a._getFirstItem(o.$.content))}l&&(a.dataSource&&a.dataSource.virtualDataSource&&!a._ignoreVirtualDataSource?a._requestVirtualDataSource("update",Object.assign({},e.data,{status:t}),(function(e){return e&&o(),e})):o())}_getCustomizeColumnPanelDataSource(){const e=this;return e._customizeColumns=[{label:e.localize("actionsIcon"),dataField:"taskActions",allowHide:!0,disableDrag:!0,visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",allowHide:!0,disableDrag:!0,visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",allowHide:!0,disableDrag:!0,visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",allowHide:!0,disableDrag:!0,visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",allowHide:!0,disableDrag:!0,visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",allowHide:!0,disableDrag:!0,visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",allowHide:!0,disableDrag:!0,visible:e.taskUserIcon}],e._customizeColumns}openCustomizePanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;const a=e.$.customize,s=[{label:e.localize("actionsIcon"),dataField:"taskActions",visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",visible:e.taskUserIcon}];let l;e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel"),a.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated?(l=a.firstElementChild,l.set("dataSource",s),l.propertyChangedHandler("dataSource",void 0,s),l.rightToLeft=e.rightToLeft):(l=document.createElement("smart-column-panel"),l.animation=e.animation,l.dataSource=s,l.locale=e.locale,l.messages=e._innerElementMessages.columnPanel,l.rightToLeft=e.rightToLeft,l.theme=e.theme,e.$.customize.appendChild(l),l.classList.add("smart-kanban-column-panel"),e._customizePartCreated=!0),e._openHeaderDropDown(e.$.customizeButton)}_getFilterPanelDataSource(){const e=this,t=[{label:e.localize("text"),dataField:"text",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("priority"),dataField:"priority",dataType:"enum",allowSort:!0,allowFilter:!0,options:e._getPriority()},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowSort:!0,allowFilter:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowSort:!0,allowFilter:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowSort:!0,allowFilter:!0}];if(e.taskCustomFields){const a=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let s=0;s<e.taskCustomFields.length;s++){const l=e.taskCustomFields[s].label;if(a){const o=typeof a[e.taskCustomFields[s].dataField];"number"===o?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"number"}):"date"===o?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"date"}):t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}else t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}}return e.onFilterPrepare&&e.onFilterPrepare(t),t}openFilterPanel(){const e=this,t=e._getFilterPanelDataSource();super.openFilterPanel(t,(function(t,a){"progress"===a.dataField?(t.min=0,t.max=100,t.showUnit=!0,t.unit="%"):"date"===a.dataType&&(t.formatString=e.formatStringDate)}))}_getSortPanelDataSource(){const e=this;return e.onSortPrepare&&e.onSortPrepare(this._sortPanelDataSource),this._sortPanelDataSource}openSortPanel(){const e=this,t=e._getSortPanelDataSource().map((t=>{const a=e._appliedSorting.dataFields.indexOf(t.dataField);return Object.assign({},t,{sortIndex:a,sortDirection:-1===a?"ascending":e._appliedSorting.orderBy[a]})}));super.openSortPanel(t)}removeTask(e,t){const a=this;function s(){const t=e.closest("smart-scroll-viewer"),s=e.data;if(a.virtualization||(e.remove(),a._refreshScrollViewer(t,!0)),a._autoSaveState("dataSource"),a.$.fireEvent("taskRemove",{value:s,id:e.data.id}),a.dataSource){const e=a.dataSource.findIndex((e=>e.id===s.id));if(e>-1){const t=s[a.dataSourceMap.status],l=a.tasksByDataField[t].findIndex((e=>e.id===s.id));l>=0&&a.tasksByDataField[t].splice(l,1),a.dataSource.splice(e,1)}}if(a._selectedTasks&&a._selectedTasks.indexOf(s.id)>=0){const e=a._selectedTasks.indexOf(s.id);a._selectedTasks.splice(e,1)}a._refreshSummaries(),a._refreshColumns()}a._currentUser.allowRemove&&(e=a._validateTaskArgument(e))&&(t?a._openDialog(e,"prompt"):a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("remove",e.data,(function(e){return e&&s(),e})):s())}saveState(e){const t=this.getState(e);return window.localStorage.setItem("smartKanban"+this.id,JSON.stringify(t)),t}addHistory(e,t){const a=this;if(!e||!t)return;const s=a.dataSourceMap;a.storeHistory?(void 0!==e[s.history]&&null!==e[s.history]||(e[s.history]=[]),e[s.history].length===a.storeHistoryItems&&e[s.history].splice(0,1),e[s.history].push(t)):e[s.history]=[]}clearHistory(e){e&&(e.history=[])}updateTask(e,t){const a=this;if(!a._currentUser.allowEdit||!t)return;if(!(e=a._validateTaskArgument(e)))return;const s=a.dataSourceMap,l=e.data;function o(){if(e.data=t,t[s.status]!==l[s.status]&&(a._updateTaskInProgress=!0,a.moveTask(e,t[s.status]),delete a._updateTaskInProgress),t[s.swimlane]!==l[s.swimlane]){const o=e.closest(".smart-kanban-column");a._hasSwimlane(o.index)?(o.querySelector(`smart-scroll-viewer[swimlane=${t[s.swimlane]}]`).appendChild(e),l[s.swimlane]&&a._refreshScrollViewer(o.querySelector(`smart-scroll-viewer[swimlane=${l[s.swimlane]}]`))):delete t[s.swimlane]}const o=()=>{if(!a._currentUser||a._currentUser&&!a._currentUser.info)return;const e=()=>({user:a._currentUser.info.id,date:t[s.updatedDate]});if(t[s.userId]!==l[s.userId]){const o=e();o.action="user";let r=!0;l[s.userId]||t[s.userId]||(r=!1),r&&(o.details={oldValue:l[s.userId],value:t[s.userId]},a.addHistory(t,o))}if(""+t[s.dueDate]!=""+l[s.dueDate]){const o=e();o.action="deadline",o.details={oldValue:l[s.dueDate]?l[s.dueDate].toLocaleDateString():"",value:t[s.dueDate]?t[s.dueDate].toLocaleDateString():""},a.addHistory(t,o)}if(""+t[s.startDate]!=""+l[s.startDate]){const o=e();o.action="deadline",o.details={oldValue:l[s.startDate]?l[s.startDate].toLocaleDateString():"",value:t[s.startDate]?t[s.startDate].toLocaleDateString():""},a.addHistory(t,o)}if(t[s.color]!==l[s.color]){const o=e();o.action="color",o.details={oldValue:l[s.color],value:t[s.color]},a.addHistory(t,o)}if(t[s.status]!==l[s.status]){const o=e();o.action="status",o.details={oldValue:l[s.status],value:t[s.status]},a.addHistory(t,o)}if(JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])){const o=e();o.action="subtasks",o.details={oldValue:l[s.checklist],value:t[s.checklist]},a.addHistory(t,o)}if(parseFloat(t[s.progress])!==parseFloat(l[s.progress])){let o=!0;if(null===l[s.progress]&&0===parseFloat(t[s.progress])&&(o=!1),o){const o=e();o.action="progress",o.details={oldValue:l[s.progress]?l[s.progress]+"%":"0%",value:t[s.progress]+"%"},a.addHistory(t,o)}}if(t[s.description]!==l[s.description]){const o=e();o.action="description",o.details={oldValue:l[s.description],value:t[s.description]},a.addHistory(t,o)}if(t[s.priority]!==l[s.priority]){const o=e();o.action="priority",o.details={oldValue:l[s.priority],value:t[s.priority]},a.addHistory(t,o)}if(t[s.tags]!==l[s.tags]){const o=e();o.action="tags",o.details={oldValue:l[s.tags],value:t[s.tags]},a.addHistory(t,o)}if(t[s.text]!==l[s.text]){const o=e();o.action="text",o.details={oldValue:l[s.text],value:t[s.text]},a.addHistory(t,o)}for(let s=0;s<a.taskCustomFields.length;s++){const o=a.taskCustomFields[s];let r=l[o.dataField],i=t[o.dataField];if(r!==i&&""+r!=""+i){const s=e();if(s.action=o.name?o.name:o.dataField,o.dataSource){const e=e=>{const t=o.dataSource.find((t=>t.value===e||t===e?t:void 0));return void 0!==t?t.label:""},t=t=>{if(void 0===t||t.length){if(void 0!==t&&t.length&&"string"!=typeof t){let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}if(t&&t.indexOf(",")>0){t=t.split(",");let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}return t}return e(t)};i=t(i),r=t(r)}s.details={oldValue:r,value:i},a.addHistory(t,s)}}};a.textTemplate||t[s.text]!==l[s.text]||t[s.tags]!==l[s.tags]||t[s.priority]!==l[s.priority]||t[s.description]!==l[s.description]?(a._renderTask(e),o()):(o(),t[s.userId]!==l[s.userId]&&a._updateUserIcon(e),t[s.dueDate]!==l[s.dueDate]&&a._updateTaskDueDate(e),t[s.color]!==l[s.color]&&a._updateTaskColor(e),JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])?(a._updateTaskChecked(e),a._updateTaskProgress(e)):parseFloat(t[s.progress])!==parseFloat(l[s.progress])&&a._updateTaskProgress(e),a._updateTaskSubtasks(e),a._updateTaskCustomFields(e));const r=a.getColumn(t.status);r&&(t.statusLabel=r.label);const i=a.getColumn(l.status);i&&(l.statusLabel=i.label);const n=JSON.parse(JSON.stringify(t)),d=JSON.parse(JSON.stringify(l));if(n.history=t.history,d.history=l.history,a.$.fireEvent("change",{task:e,id:n.id,value:n,oldValue:d}),a.virtualization){const t=e.data[s.status],l=a.tasksByDataField[t].findIndex((t=>t.id===e.data.id));if(l>=0){a.tasksByDataField[t][l]=e.data;const s=a._getTasksByDataField(t),o=s.findIndex((t=>t.id===e.data.id));o>=0&&(s[o]=e.data)}}a._refreshScrollViewer(e.closest("smart-scroll-viewer"));const c=a.dataSource.findIndex((t=>e.data.id===t.id));c>=0&&(a.dataSource[c]=e.data),a._refreshSummaries(),a._updateTaskComments(e),a._autoSaveState("dataSource"),a.$.fireEvent("taskUpdate",{id:n.id,value:n,oldValue:d})}(t=Object.assign({},l,t))[s.checklist]&&0===t[s.checklist].length&&(t[s.checklist]=null),JSON.stringify(t)!==JSON.stringify(l)&&(a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("update",t,(function(e){return e&&(a._ignoreVirtualDataSource=!0,o(),delete a._ignoreVirtualDataSource),e})):o())}_refreshSelection(){const e=this;if("zeroOrOne"===e.selectionMode){const t=e._selectionStart;e._selectedTasks.forEach((a=>{if(a!==t){e.getTask(a).selected=!1;const t=e.querySelector('[data-id="'+a+'"]');t&&t.removeAttribute("selected")}})),e._selectedTasks=[t]}e._selectedTasks.forEach((t=>{const a=e.querySelector('[data-id="'+t+'"]');a&&a.setAttribute("selected","")})),e._refreshColumns()}propertyChangedHandler(e,t,a){const s=this,l=s._dialog;function o(){if(s.cancelEdit(),l&&l.close(),s._closeList(s._commentsList,"_commentSelectionFor"),s._getCurrentUser(),s.taskSubTasks){const e=s.querySelectorAll(".smart-kanban-task-input");s._currentUser&&!s._currentUser.allowEdit||s.disabled||!s.taskSubTasksInput?e.forEach((e=>{e.classList.add("smart-hidden")})):e.forEach((e=>{e.classList.remove("smart-hidden")}))}}switch(super.propertyChangedHandler(e,t,a),e){case"columnColorEntireSurface":a?s.classList.add("smart-kanban-column-color"):s.classList.remove("smart-kanban-column-color");break;case"columnFooter":case"addNewButton":case"addNewButtonDisplayMode":s._reset(),s._createAddNewButton();break;case"taskTags":s._reset();break;case"taskCustomFields":s._resetFields=!0,s._reset();break;case"autoColumnHeight":case"applyColumnColorToTasks":case"columnWidth":case"addNewColumn":s._reset();break;case"allowDrag":s._getCurrentUser();break;case"animation":case"theme":{let t=Array.from(s.$.container.querySelectorAll("smart-column-panel, smart-multi-column-filter-panel, smart-sort-panel"));l&&(t.push(l),t=t.concat(Array.from(l.$.footer.children)),l.editPanelPopulated&&(t=t.concat(Array.from(l.$.container.querySelectorAll(".smart-element.editor"))))),t.forEach((t=>t[e]=a)),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskColor(e)));break}case"autoSaveState":s._autoSaveState();break;case"collapsible":a||s.expandAll();break;case"columnSummary":s._refreshSummaries();break;case"columns":s._render(),l&&l.editPanelPopulated&&(l.editors.status.dataSource=s._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))));break;case"currentUser":o();break;case"dataSource":case"dataSourceMap":if("dataSourceMap"===e&&s._validateDataSourceMap(),s._customTags=[],s._selectedTasks=[],s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),0===s.columns.length)return s._renderColumns(),s._handleSwimlanes(),void s._processDataSource();Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e.clearContent(),e.refresh(),s._refreshScrollViewer(e,!0)})),s._processDataSource(),s.dataSource||s._refresh(),s.columnSummary&&s._refreshSummaries();break;case"disabled":s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),s._setFocusable();break;case"formatStringDate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskDueDate(e))),l&&(l.editors.startDate.formatString=a,l.editors.dueDate.formatString=a);break;case"formatStringTime":s._closeList(s._commentsList,"_commentSelectionFor");break;case"editable":s.cancelEdit(),s._actionsList.classList.contains("edit-comment")||s._closeList(s._actionsList,"_actionSelectionFor"),s._getCurrentUser();break;case"headerPosition":s._handleHeaderPosition(s.$.body),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"hierarchy":0===s.swimlanes.length&&s.columns.length!==s._allColumns.length&&s._reset();break;case"locale":case"messages":s.closePanel(),s._localizeHeader(),s._getInnerElementMessages(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._setActionsList(),s._setColumnActionsList(),s._setCommentsList(),l&&(s.cancelEdit(),l.close(),l.$.footer.firstElementChild.innerHTML=s.localize("ok"),l.$.footer.children[1].innerHTML=s.localize("cancel"),l.$.footer.children[2].innerHTML=s.localize("delete"),l.editPanelPopulated&&(l.editors.priority.dataSource=s._getPriority(),l.$.container.querySelector(".new-subtask").placeholder=s.localize("newSubtask"),l.$.container.querySelector("smart-button.add").title=s.localize("addSubtask"),Array.from(l.$.container.getElementsByClassName("editor-label")).forEach((e=>{let t=e.id.slice(s.id.length+5);t=t.slice(0,1).toLowerCase()+t.slice(1),e.innerHTML=s.localize(t)})))),s._customizePartCreated&&(s.$.customize.firstElementChild.messages=s._innerElementMessages.columnPanel,s.$.customize.firstElementChild.locale=s.locale),s._filterPartCreated&&(s.$.filter.firstElementChild.messages=s._innerElementMessages.multiColumnFilterPanel,s.$.filter.firstElementChild.locale=s.locale,s.$.filter.firstElementChild.editorPlaceholder=s.localize("filterValuePlaceholder")),s._sortPartCreated&&(s.$.sort.firstElementChild.messages=s._innerElementMessages.sortPanel,s.$.sort.firstElementChild.locale=s.locale);break;case"rightToLeft":s._reset(!0);break;case"selectionMode":"zeroOrOne"===a&&s._selectedTasks.length>1&&s._refreshSelection();break;case"swimlanes":if(s._validateSwimlanes(),JSON.stringify(s.swimlanes)===JSON.stringify(t))return;s._reset(),l&&l.editPanelPopulated&&(l.editors.swimlane.dataSource=s.swimlanes.map((e=>({label:e.label,value:e.dataField}))));break;case"swimlanesFrom":case"swimlanesTo":{const e=s.swimlanesFrom,t=s.swimlanesTo;e<0&&(s.swimlanesFrom=0),null!==t&&e>t&&(s.swimlanesFrom=t),s.swimlanes.length>0&&s._reset();break}case"taskCustomFieldsHide":case"taskProgress":case"taskSubTasksInput":case"taskSubTasks":case"taskUserIcon":case"taskComments":case"taskDue":case"taskPriority":case"tags":case"taskColor":case"taskColorEntireSurface":case"textTemplate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._renderTask(e))),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"unfocusable":s._setFocusable();break;case"priority":s._closeList(s._priorityList,"_prioritySelectionFor"),s._setPriorityList();break;case"users":s._closeList(s._userList,"_userSelectionFor"),s._setUserList(),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateUserIcon(e))),l&&l.editPanelPopulated&&(l.editors.userId.dataSource=s.users.map((e=>({label:e.name,value:e.id})))),o()}}_reset(e){const t=this,a=t.getState();t._allColumns=[],t._customTags=[],t._selectedTasks=[],t._dialog&&(t.cancelEdit(),e&&(t._dialog.remove(),delete t._dialog)),t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t.$.body.innerHTML="",Array.from(t.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),t._renderColumns(),t._handleSwimlanes(),t._createAddNewButton(),t.loadState(a),t.$.scrollViewer.refresh()}_refresh(){const e=this;e._allColumns=[],e._customTags=[],e._selectedTasks=[],e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e.$.body.innerHTML="",Array.from(e.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),e._renderColumns(),e._handleSwimlanes(),e._createAddNewButton(),e.$.scrollViewer.refresh()}_closeAllLists(){const e=this;e.cancelEdit(),e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e._closeList(e._priorityList,"_prioritySelectionFor")}_containerClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(t.$.header.contains(a))return void t._headerClickHandler(a,t.$.body);const s=a.closest(".smart-kanban-column-header");if(s){const e=s.parentElement.column;if(a instanceof HTMLInputElement)return;if(t.columnActions&&a.classList.contains("smart-kanban-column-actions")){if(!t._columnActionsList.parentElement||t._columnActionsList.classList.contains("smart-visibility-hidden")){if(t._columnActionsListDate&&new Date-t._columnActionsListDate<300)return;t._openColumnActionsList(a,e)}return}if(a.closest(".smart-kanban-column-header-add")&&e)return void t._openDialog(e,"add","column");if(t.collapsible&&e&&e.collapsible&&a.closest(".smart-kanban-column-header-toggle-button"))return void t[e.collapsed?"expand":"collapse"](e)}const l=a.closest(".smart-kanban-tab");if(l){if(l.classList.contains("selected"))return;const e=l.parentElement.querySelector(".selected");return e.classList.remove("selected"),e.setAttribute("aria-selected",!1),e.columnElement.classList.add("smart-hidden"),e.columnElement.column.selected=!1,l.classList.add("selected"),l.setAttribute("aria-selected",!0),l.columnElement.classList.remove("smart-hidden"),l.columnElement.column.selected=!0,t._selectedTabs=t._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),t._autoSaveState("tabs"),void t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}if(t.addNewColumn){const e=a.closest(".smart-kanban-add-new-column"),s=a.closest(".smart-color-input"),l=a.closest(".smart-kanban-column-header");if(!s&&e&&!e.querySelector(".pending")&&l)return void t._addNewColumnDynamically()}const o=a.closest(".smart-kanban-list .item");if(o){const e=o.getAttribute("data-id"),a=t._userSelectionFor,s=t._prioritySelectionFor;if(a){const s=t.dataSourceMap,l=a.data[s.userId],o=JSON.parse(JSON.stringify(a.data));if(a.data[s.userId]=e,t._updateUserIcon(a),t._closeList(t._userList,"_userSelectionFor"),a.data[s.userId]!==l){t.dataSource&&t.dataSource.virtualDataSource&&t._requestVirtualDataSource("update",a.data,(function(e){return e||(a.data[s.userId]=l,t._updateUserIcon(a)),e}));const e=a.data;if(t._currentUser.info){a.data[s.updatedUserId]=t._currentUser.info.id,a.data[s.updatedDate]=new Date;const l={user:t._currentUser.info.id,label:e[s.text],date:e[s.updatedDate]};e[s.userId]!==o[s.userId]&&(l.action="user",l.details={oldValue:o[s.userId],value:e[s.userId]},t.addHistory(e,l))}const r=JSON.parse(JSON.stringify(e));t.$.fireEvent("change",{task:a,id:r.id,value:r,oldValue:o}),t.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:o}),t._autoSaveState("dataSource")}return}if(s){const e=t.dataSourceMap,a=s.data[e.priority],l=JSON.parse(JSON.stringify(s.data));if(s.data[e.priority]=o.getAttribute("priority"),t._closeList(t._priorityList,"_prioritySelectionFor"),s.data[e.priority]!==a){t._currentUser.info&&(s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date);const a=s.data,o=JSON.parse(JSON.stringify(a));if(t._currentUser.info){s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date;const o={user:t._currentUser.info.id,date:a[e.updatedDate]};a[e.priority]!==l[e.priority]&&(o.action="priority",o.details={oldValue:l[e.priority],value:a[e.priority]},t.addHistory(a,o))}t.$.fireEvent("change",{task:s,id:o.id,value:o,oldValue:l}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:l}),t._updateTaskPriority(s),t._autoSaveState("dataSource")}}const l=t._actionSelectionFor,r=t._columnActionSelectionFor;if(l){switch(parseFloat(e)){case 0:o.hasAttribute("edit")&&(t._actionsList.classList.contains("edit-comment")?(t._commentsList.textarea.value=l.comment.text,t._commentsList.textarea.focus(),t._commentsList.editing=l,l.parentElement.scrollTop=l.offsetTop):t.beginEdit(l));break;case 1:o.hasAttribute("copy")&&t.copyTask(l);break;case 2:o.hasAttribute("remove")&&(t._actionsList.classList.contains("edit-comment")?t._openDialog(l,"prompt","comment"):t.removeTask(l,!0))}return void t._closeList(t._actionsList,"_actionSelectionFor")}if(r){switch(parseFloat(e)){case 0:t._handleColumnEditing(r.dataField);break;case 1:t._openDialog(r,"add","column");break;case 2:t.collapse(r);break;case 3:t._openDialog(r,"prompt","column");break;case 4:t.hide(r);break;case 5:t.showAllColumns()}return void t._closeList(t._columnActionsList,"columnActionSelectionFor")}}if(a.closest(".smart-kanban-list.comments")){const e=a.closest(".send");if(e){if(e.disabled)return;const a=JSON.parse(JSON.stringify(t._commentSelectionFor.data)),s=t._createComment();t._commentsList.textarea.value="",e.disabled=!0;const l=JSON.parse(JSON.stringify(t._commentSelectionFor.data));t.$.fireEvent("change",{task:t._commentSelectionFor,id:l.id,value:l,oldValue:a}),t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:a}),t.$.fireEvent("commentAdd",{id:l.id,value:s})}else if(a.classList.contains("remove-button")&&a.classList.contains("enabled")){const e=a.closest(".smart-comment");t._actionSelectionFor&&(t._actionSelectionFor===e||t._actionSelectionFor.classList.contains("smart-kanban-task")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,void 0,e)}return}const r=a.closest(".smart-kanban-task");if(r)if(a.classList.contains("smart-kanban-task-user"))!t.userList||!t._currentUser.allowEdit||t._userSelectionFor&&(t._userSelectionFor===r||t._userList.parentElement&&!t._userList.classList.contains("smart-visibility-hidden"))||t._openUserList(a,r);else if(a.classList.contains("priority")&&t.priorityList)!t._priorityList||!t._currentUser.allowEdit||t._prioritySelectionFor&&(t._prioritySelectionFor===r||t._priorityList.parentElement&&!t._priorityList.classList.contains("smart-visibility-hidden"))||t._openPriorityList(a,r);else if(t.taskActions&&a.classList.contains("smart-kanban-task-actions"))t._actionSelectionFor&&(t._actionSelectionFor===r||t._actionSelectionFor.classList.contains("comment")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,r);else if(t.taskComments&&a.classList.contains("smart-kanban-task-comments"))t.users.length>0&&(!t._commentSelectionFor||t._commentSelectionFor!==r&&(!t._commentsList.parentElement||t._commentsList.classList.contains("smart-visibility-hidden")))&&t._openCommentsList(a,r);else if(t.$.fireEvent("taskClick",{id:r.data.id,value:r.data,element:r}),t._preventSelection||t._selectTask(e,r),e.type)if(clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks){if(t._dblclickObject.numberOfClicks=0,r.hasAttribute("selected")||t._selectTask(e,r),t.$.fireEvent("taskDoubleClick",{id:r.data.id,value:r.data,element:r}).defaultPrevented)return;t.beginEdit(r)}else t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300)}_selectTask(e,t){const a=this,s=a.selectionMode,l=()=>{a._selectedTasks.forEach((e=>{if(e!==t.data.id){const t=a.querySelector('[data-id="'+e+'"]');t&&t.removeAttribute("selected")}}))};function o(){l(),t.hasAttribute("selected")||(t.setAttribute("selected",""),a._selectedTasks=[t.data.id]),a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._autoSaveState("selection"),a._focusTask(t)}if("zeroOrOne"===s)l(),t.hasAttribute("selected")?(a._focusTask(t),t.removeAttribute("selected"),a._selectedTasks=[],delete a._selectionInView):(t.setAttribute("selected",""),a._selectedTasks=[t.data.id],a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._focusTask(t)),a.virtualization&&a._refreshColumns();else{if(!e.ctrlKey&&!e.shiftKey&&!e.metaKey||0===a._selectedTasks.length||t.closest("smart-scroll-viewer")!==a._selectionInView)return void o();if(e.ctrlKey||e.metaKey)t.hasAttribute("selected")?(t.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((e=>e!==t.data.id))):(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id),a._selectionStart=t.data.id);else if(e.shiftKey){if(t&&t.id===a._selectionStart)return a._selectedTasks.length>1&&o(),void(a.virtualization&&a._refreshColumns());const e=t[a.dataSourceMap.status],s=a._getTasksByDataField(e),l=a.getTask(a._selectionStart);let r=s.indexOf(l),i=s.indexOf(t.id);const n=r;r=Math.min(r,i),i=Math.max(n,i),a._selectedTasks=[],s.forEach(((e,t)=>{const s=a.querySelector('[data-id="'+e.id+'"]');t>=r&&t<=i&&!e.filteredOut?(s&&s.setAttribute("selected",""),a._selectedTasks.push(e.id)):s&&s.removeAttribute("selected")}))}a._focusTask(t)}a.virtualization&&a._refreshColumns(),a._autoSaveState("selection")}_processDataSource(){const e=this;let t=e.dataSource;if(0!==e.columns.length&&null!=t){if(t instanceof Smart.DataAdapter){if(t.virtualDataSource)return void e._requestVirtualDataSource("dataBind");t=t.dataSource}t.length>500&&(e.virtualization=!0),t.forEach((t=>{e._createTask(t)})),e.virtualization&&(e._measureCardHeight(),e._refreshColumns()),e.whenRendered((()=>e._allColumns.forEach((t=>e._refreshScrollViewer(t)))))}}_requestVirtualDataSource(e,t,a){const s=this,l=s.dataSourceMap,o=[],r=[],i={},n=s._appliedFiltering;let d=null;if(n&&n.filterGroups.length>0&&(n.filterGroups.forEach((e=>r[e[0]]=e[1])),r.length=n.filterGroups.length,d=n.operator),s._appliedSorting&&s._appliedSorting.dataFields.length>0&&(s._appliedSorting.dataFields.forEach(((e,t)=>{let a=s._appliedSorting.orderBy[t].replace("ending","");o[e]={sortOrder:a,sortIndex:t}})),o.length=s._appliedSorting.dataFields.length),void 0!==t){const e=Object.assign({},t);e[l.checklist]=JSON.stringify(e[l.checklist]),e[l.history]=JSON.stringify(e[l.history],(function(e,t){return"date"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.comments]=JSON.stringify(e[l.comments],(function(e,t){return"time"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.updatedDate]&&(e[l.updatedDate]=e[l.updatedDate].toISOString().slice(0,10)),e[l.createdDate]&&(e[l.createdDate]=e[l.createdDate].toISOString().slice(0,10)),e[l.dueDate]&&(e[l.dueDate]=e[l.dueDate].toISOString().slice(0,10)),e[l.startDate]&&(e[l.startDate]=e[l.startDate].toISOString().slice(0,10)),i.row=e}s.dataSource.onVirtualDataSourceRequested((function(t){let l=!0;-1!==["add","update","remove"].indexOf(e)&&a&&(l=a(t.result),"add"!==e)||l&&(Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),s.dataSource.dataSource.forEach((e=>{s._createTask(e)})),s._allColumns.forEach((e=>s._refreshScrollViewer(e))),s._autoSaveState("dataSource"))}),{first:0,last:0,sorting:o,filtering:r,filterOperator:d,grouping:[],edit:i,action:e})}_setUserList(){const e=this,t=document.createElement("div");t.id=e.id+"UserList",t.className="smart-kanban-list users smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e.users.forEach((e=>{const a=document.createElement("div"),s=e?e.image:null,l=s?`background-image: url('${s}');`:"";a.className="item",a.innerHTML=`<div class="icon" style="${l}"></div><div class="name">${e.name}</div>`,a.setAttribute("data-id",e.id),a.setAttribute("role","option"),t.appendChild(a)})),e._userList=t}_setPriorityList(){const e=this,t=document.createElement("div");t.id=e.id+"PriorityList",t.className="smart-kanban-list priority smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e._getPriority().forEach((e=>{const a=document.createElement("div");a.className="item",e.menuLabel?a.innerHTML=e.menuLabel:a.innerHTML=`<div priority="${e.value}" class="smart-kanban-task-text">${e.menuIcon}${e.label}</div>`,a.setAttribute("priority",e.value),a.setAttribute("role","option"),t.appendChild(a)})),e._priorityList=t;const a=e._dialog;a&&a.editPanelPopulated&&(a.editors.priority.dataSource=e._getPriority())}_openList(e,t,a){const s=this,l=e.getBoundingClientRect();let o,r,i=l.left,n=l.top+e.offsetHeight;a=s.rightToLeft?!a:a,1===window.devicePixelRatio?(o=document.documentElement.clientWidth,r=document.documentElement.clientHeight):(o=window.innerWidth,r=window.innerHeight),t.classList.add("dialog"),document.body.appendChild(t),a&&(i=l.right-t.offsetWidth),i+t.offsetWidth>o&&(i=o-t.offsetWidth),n+t.offsetHeight>r&&(n=r-t.offsetHeight),t.style.left=Math.max(0,i)+"px",t.style.top=n+"px",t.classList.remove("smart-visibility-hidden"),e.setAttribute("aria-expanded",!0),e.setAttribute("aria-controls",t.id),s.unfocusable||requestAnimationFrame((function e(){0===t.getBoundingClientRect().height?requestAnimationFrame(e):t.focus()})),t.openedFrom=e,t.onclick=e=>{s._containerClickHandler(e)}}_openUserList(e,t){const a=this;if(0===a.users.length)return;const s=t.data[a.dataSourceMap.userId],l=a._userList,o=l.querySelector(".selected");if(o&&(o.classList.remove("selected"),o.removeAttribute("aria-selected")),a._openList(e,l),null!==s){const e=Array.from(l.children).find((e=>e.getAttribute("data-id")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._userSelectionFor=t}_openPriorityList(e,t){const a=this,s=t.data[a.dataSourceMap.priority],l=a._priorityList,o=l.querySelector(".selected");if(o&&(o.classList.remove("selected"),o.removeAttribute("aria-selected")),a._openList(e,l),null!=s){const e=Array.from(l.children).find((e=>e.getAttribute("priority")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._prioritySelectionFor=t}_closeList(e,t){const a=this;if(!e||!e.parentElement)return;const s=a.$.container.querySelector(`[aria-expanded="true"][aria-controls="${e.id}"]`);e.classList.add("smart-visibility-hidden"),requestAnimationFrame((function s(){e.classList.contains("smart-visibility-hidden")&&(e.getBoundingClientRect().height>0?requestAnimationFrame(s):(e.remove(),delete e.openedFrom,delete a[t]))})),s&&(s.removeAttribute("aria-expanded"),s.removeAttribute("aria-controls"))}_setActionsList(){const e=this,t=document.createElement("div");if(t.id=e.id+"ActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" edit data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n<div class="item" copy data-id="1" role="menuitem"><div class="name">${e.localize("copy")}</div></div>\n<div class="item" remove data-id="2" role="menuitem"><div class="name">${e.localize("remove")}</div></div>`,e.taskActionsRendered){e.taskActionsRendered(t);const a=Array.from(t.children);for(let e=0;e<a.length;e++){const t=a[e];t.classList.add("item"),t.setAttribute("data-id",e),t.setAttribute("role","menuitem"),t.firstElementChild&&t.firstElementChild.classList.add("name")}}e._actionsList=t}_setColumnActionsList(){const e=this,t=document.createElement("div");t.id=e.id+"ColumnActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n <div class="item" data-id="1" role="menuitem"><div class="name">${e.localize("addNewTask")}</div></div>\n <div class="item" data-id="2" role="menuitem"><div class="name">${e.localize("collapse")}</div></div>\n <div class="item" data-id="3" role="menuitem"><div class="name">${e.localize("removeColumn")}</div></div>\n <div class="item" data-id="4" role="menuitem"><div class="name">${e.localize("hideColumn")}</div></div>\n <div class="item" data-id="5" role="menuitem"><div class="name">${e.localize("showAllColumns")}</div></div>`,e._columnActionsList=t}_openActionsList(e,t,a){const s=this,l=s._currentUser,o=s._actionsList;s._openList(e,o,a),o.classList.toggle("edit-comment",!!a),s._actionSelectionFor=t||a,o.children[0]&&o.children[0].hasAttribute("edit")&&(t&&!l.allowEdit?o.children[0].classList.add("smart-hidden"):o.children[0].classList.remove("smart-hidden")),o.children[1]&&o.children[1].hasAttribute("add")&&(t&&!l.allowAdd?o.children[1].classList.add("smart-hidden"):o.children[1].classList.remove("smart-hidden")),o.children[2]&&o.children[0].hasAttribute("remove")&&(t&&!l.allowRemove?o.children[2].classList.add("smart-hidden"):o.children[2].classList.remove("smart-hidden")),Array.from(o.children).forEach((e=>e.classList.remove("selected")))}_openColumnActionsList(e,t){const a=this,s=a._columnActionsList,l=s.children;a.allowColumnEdit&&t.editable&&"header"!==a.columnEditMode?l[0].classList.remove("smart-hidden"):l[0].classList.add("smart-hidden"),a.addNewButton&&t.addNewButton?l[1].classList.remove("smart-hidden"):l[1].classList.add("smart-hidden"),a.allowColumnRemove&&t.allowRemove&&a._allColumns.length>1?l[3].classList.remove("smart-hidden"):l[3].classList.add("smart-hidden"),a.collapsible&&t.collapsible?l[2].classList.remove("smart-hidden"):l[2].classList.add("smart-hidden"),a.allowColumnHide&&t.allowHide&&a._allColumns.length>1?(l[4].classList.remove("smart-hidden"),l[5].classList.remove("smart-hidden")):(l[4].classList.add("smart-hidden"),l[5].classList.add("smart-hidden")),a._openList(e,s),a._columnActionSelectionFor=t,Array.from(s.children).forEach((e=>e.classList.remove("selected")))}_setCommentsList(){const e=this,t=document.createElement("div");t.id=e.id+"CommentsList",t.className="smart-kanban-list comments smart-visibility-hidden",t.setAttribute("role","dialog"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="smart-kanban-comments" role="list"></div>\n<div class="smart-kanban-new-comment" role="presentation">\n <textarea placeholder="${e.localize("newComment")}"></textarea>\n <smart-button class="send primary" disabled${e._rtlAttr}>${e.localize("send")}</smart-button>\n</div>`;const a=t.querySelector("textarea"),s=t.querySelector("smart-button");s.tabIndex=0,a.onfocus=()=>{t.classList.add("expanded"),s.disabled=""===a.value},a.onblur=e=>{s.contains(e.relatedTarget)||t.classList.remove("expanded")},a.onkeyup=()=>{s.disabled=""===a.value},a.oncut=()=>{s.disabled=""===a.value},a.onpaste=()=>{s.disabled=""===a.value},t.textarea=a,t.button=s,e._commentsList=t}_openCommentsList(e,t){const a=this,s=a._commentsList;s.classList.remove("expanded"),s.firstElementChild.innerHTML="",s.textarea.value="",s.textarea.disabled=!a._currentUser.allowComment,a.unfocusable?s.textarea.tabIndex=-1:s.textarea.removeAttribute("tabindex"),delete s.editing,t.data[a.dataSourceMap.comments].forEach((e=>a._createComment(e))),a._openList(e,s),a._commentSelectionFor=t}_getCommentsList(e){const t=this,a=t._commentsList;return a.classList.remove("expanded"),a.firstElementChild.innerHTML="",a.textarea.value="",a.textarea.disabled=!t._currentUser.allowComment,t.unfocusable?a.textarea.tabIndex=-1:a.textarea.removeAttribute("tabindex"),delete a.editing,e.data[t.dataSourceMap.comments].forEach((e=>t._createComment(e))),t._commentSelectionFor=e,a.classList.remove("smart-visibility-hidden"),a}_createComment(e){const t=this,a=document.createElement("div");let s,l;function o(){const o=t._commentsList.firstElementChild,r=l?l.image:null,i=l?l.name||l.id:t.localize("guestUser"),n=l?l.name:t.localize("guestUser");a.classList="smart-comment",a.setAttribute("role","listitem");const d=r?`background-image: url('${r}');`:"";a.innerHTML=`<div class="comment-indent" role="presentation">\n <div class="user-icon" style="${d}" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n <div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&l.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}"${t._tabindex} role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n </div>\n <div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,a.comment=e,r||a.querySelector(".user-icon").classList.add("empty"),o.appendChild(a),s&&(o.scrollTop=o.scrollHeight-o.offsetHeight)}if(e)l=t.users.find((t=>t.id===e.userId));else{const a=t.dataSourceMap,r=t.dataSource&&t.dataSource.virtualDataSource,i=t._commentsList.textarea.value,n=t._commentsList.editing,d=t._commentSelectionFor.data,c=JSON.parse(JSON.stringify(d));if(n){if(r){const e=Object.assign({},d);e[a.comments]=e[a.comments].slice(0),e[a.comments][e[a.comments].indexOf(n.comment)]=Object.assign({},n.comment,{text:i}),t._requestVirtualDataSource("update",e,(function(a){return a&&(t._commentSelectionFor.data=e,n.querySelector(".comment-body").innerHTML=i),delete t._commentsList.editing,a}))}else n.querySelector(".comment-body").innerHTML=i,n.comment.text=i,delete t._commentsList.editing;return t.$.fireEvent("commentUpdate",{id:d.id,value:n.comment}),t.$.fireEvent("taskUpdate",{id:d.id,value:d,oldValue:c}),void t.$.fireEvent("change",{task:t._commentSelectionFor,id:d.id,value:d,oldValue:c})}if(s=!0,e={text:i,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:t._currentUser.info?t._currentUser.info.id:-1,time:new Date},l=t._currentUser.info,r){const s=Object.assign({},d);s[a.comments]=s[a.comments].slice(0),s[a.comments].push(e),t._requestVirtualDataSource("update",s,(function(e){return e&&(t._commentSelectionFor.data=s,t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",s[a.comments].length||""),o()),e}))}else d[a.comments].push(e),t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",d[a.comments].length||"")}return e.time instanceof Date==0&&(e.time=new Date(e.time),e.time.setTime(e.time.getTime()-1*e.time.getTimezoneOffset()*60*1e3)),o(),e}_getTaskIndexByPosition(e,t){const a=(e,t)=>{const a=e.top,s=e.top+e.height,l=a<=t&&s>t;return 0!==e.height&&l};return(t=>{let s=0,l=t.length-1;if(e<=0)return 0;const o=t[t.length-1];if(-1!==o.top&&o.top<=e)return t.length-1;for(;;){const o=Math.floor((s+l)/2),r=t[o];if(a(r,e))return o;r.top<e?s=o+1:r.top>e?l=o-1:s=o+1}})(t)}_refreshColumns(){const e=this;e.virtualization&&e._allColumns.forEach((t=>{e._refreshColumn(t.dataField)}))}_refreshColumn(e){const t=this.getColumn(e),a=this._columnToElement.get(t);if(!a)return;const s=a.querySelector("smart-scroll-viewer");this._refreshScrollHeight(s,e)}_getTasksByDataField(e){const t=this;let a=t.tasksByDataField[e];return a?a._filtered?a._filtered:a._sorted?a._sorted:a:(t.tasksByDataField[e]=[],t.tasksByDataField[e])}_refreshEmptyColumnState(e,t){const a=this;e&&(e.querySelector(".smart-kanban-task")||e.querySelector(".smart-kanban-task")&&!t?(e.removeAttribute("empty",a.localize("empty")),e.classList.remove("empty")):(e.setAttribute("empty",a.localize("empty")),e.classList.add("empty")))}_refreshScrollHeight(e,t){const a=this;if(a._refreshEmptyColumnState(e,t),!a.virtualization)return;const s=a._getTasksByDataField(t);if(!s)return;const l=a._autoCardHeight?a._autoCardHeight:a.cardHeight;e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight;for(let e=0;e<s.length;e++){const t=s[e];t.top=e*l,t.height=l}const o=e.querySelector(".smart-scroll-viewer-content-container"),r=e=>{const l=a._getTaskIndexByPosition(e,s),r=a.uiTasksByDataField[t].length;for(let e=0;e<r;e++){const r=s[l+e],i=a.uiTasksByDataField[t][e];i&&(a._dragDetails&&(i.classList.remove("dragged"),r&&a._dragDetails.ItemsData.forEach((e=>{e.id===r.id&&i.classList.add("dragged")}))),r?i.classList.remove("smart-hidden"):i.classList.add("smart-hidden"),0===e&&(o.style.marginTop=r?r.top+"px":"0px"),r)&&(i.hasAttribute("selected")&&i.removeAttribute("selected"),i.hasAttribute("focus")&&i.removeAttribute("focus"),JSON.stringify(r)!==JSON.stringify(i.data)&&(i.data=r,a._renderTask(i)),a._selectedTasks&&a._selectedTasks.indexOf(r.id)>=0&&i.setAttribute("selected",""),a._focusedTask===r.id&&i.setAttribute("focus",""))}};e.onVerticalChange=e=>{const t=e.detail.value;r(t)},a.uiTasksByDataField[t]||(a.uiTasksByDataField[t]=[]);const i=Math.round(e.offsetHeight/l)+2,n=a.uiTasksByDataField[t].length;if(0===n||n<i){const o=Math.round(e.offsetHeight/l)+2;for(let e=0;e<o;e++){const l=s[e];if(!l)continue;const o=a._createVirtualTask(l);a.uiTasksByDataField[t].push(o)}e.refresh(),e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight,r(e.scrollTop)}else r(e.scrollTop)}_createVirtualTask(e,t){const a=this,s=a.dataSourceMap,l=a._allColumns.find((t=>t.dataField===e[s.status]));if(!l)return;const o=document.createElement("div"),r=a._columnToElement.get(l),i=a.getTaskScrollViewer(r,e);return void 0===e[s.id]&&(e[s.id]=Math.floor(9e4*Math.random()+1e4)),o.className="smart-kanban-task smart-unselectable",o.setAttribute("role","listitem"),o.setAttribute("data-id",e[s.id]),a._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=a._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date),e[s.history]=[],a.addHistory(e,{action:"created",user:a._currentUser.info.id,details:{value:e[s.text]},date:e[s.createdDate]})),o.data=e,o.column=l,a._renderTask(o),e.class&&"string"==typeof e.class&&o.classList.add(e.class),i.appendChild(o),a._updateTaskColor(o),t&&(l.collapsed?i.toRefresh=!0:i.refresh()),o}_measureCardHeight(){const e=this,t=Object.keys(e.tasksByDataField);if(0===t.length||0===e.columns.length)return null;if(null===e.cardHeight&&!e._autoCardHeight){const a=e.tasksByDataField[t[0]],s=e._createVirtualTask(a[0]);e._renderTask(s),a.class&&"string"==typeof a.class&&s.classList.add(a.class);const l=e.columns[0],o=e._columnToElement.get(l),r=e.getTaskScrollViewer(o,a);r.appendChild(s);const i=r.querySelector(".smart-scroll-viewer-content-container"),n=getComputedStyle(i).rowGap;e._autoCardHeight=s.offsetHeight+parseInt(n),s.remove()}}_createTask(e,t){const a=this,s=a.dataSourceMap,l=a._allColumns.find((t=>t.dataField===e[s.status]));if(!l)return;const o=document.createElement("div"),r=a._columnToElement.get(l),i=a.getTaskScrollViewer(r,e);void 0===e[s.id]&&(e[s.id]=Math.floor(9e4*Math.random()+1e4)),o.className="smart-kanban-task smart-unselectable",o.setAttribute("role","listitem"),o.setAttribute("data-id",e[s.id]),a._currentUser&&a._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=a._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date),e[s.history]||(e[s.history]=[],a.addHistory(e,{action:"created",user:a._currentUser.info.id,details:{value:e[s.text]},date:e[s.createdDate]}))),o.data=e,o.column=l,a.tasksByDataField[l.dataField]||(a.tasksByDataField[l.dataField]=[]),a.tasksByDataField[l.dataField].push(e),a.taskById[e.id]=e,a.virtualization||(a._renderTask(o),e.class&&"string"==typeof e.class&&o.classList.add(e.class),i.appendChild(o),a._updateTaskColor(o),t&&(l.collapsed?i.toRefresh=!0:i.refresh()))}getTaskScrollViewer(e,t){const a=this,s=a.dataSourceMap;let l;return a._hasSwimlane(e.index)?void 0!==t[s.swimlane]&&a.swimlanes.find((e=>e.dataField===t[s.swimlane]))?l=e.querySelector(`smart-scroll-viewer[swimlane="${t[s.swimlane]}"]`):(l=e.querySelector("smart-scroll-viewer"),t[s.swimlane]=l.getAttribute("swimlane")):(l=e.querySelector("smart-scroll-viewer"),delete t[s.swimlane]),l}_renderTask(e){const t=this;t._applyTaskTemplate(e),t._updateUserIcon(e),t._updateTaskChecked(e),t._updateTaskProgress(e),t._updateTaskDueDate(e),e.parentElement&&t._updateTaskColor(e),t._updateTaskPriority(e),e.column&&t.columnSummary&&t._updateColumnSummary(e.column),t.onTaskRender&&t.onTaskRender(e,e.data)}_refreshSummaries(){const e=this,t=e.querySelectorAll(".smart-kanban-column");for(let a=0;a<t.length;a++){const s=t[a].column;e._updateColumnSummary(s)}}_updateColumnSummary(e){const t=this,a=t._columnToElement.get(e);if(!a||!t.columnSummary)return;const s=t._getColumnSummary(e),l=a.querySelector(".summary");if(l&&(l.innerHTML=s),t.columnFooter){const l=a.querySelector(".smart-kanban-column-footer");if(s.length){let e=parseInt(s.replace("(","").replace(")","").trim());l.innerHTML=1===e?t.localize("tasksSummaryOne"):t.localize("tasksSummary",{summary:e})}else l.innerHTML="";t.onColumnFooterRender&&t.onColumnFooterRender(l,e,e.dataField)}}_createImageModal(e,t){const a=this,s=document.createElement("smart-window");s.animation=a.animation,s.headerButtons=["close"],s.rightToLeft=a.rightToLeft,s.resizeMode="none",s.theme=a.theme,s.style.height="auto",s.style.width="auto",s.style.maxWidth="1200px",s.style.maxHeight="1200px",document.body.appendChild(s),s.onclose=()=>{document.body.removeChild(s)},s.innerHTML="",s.label=e.title;const l=e.cloneNode(!0);l.removeAttribute("onpointerdown"),l.removeAttribute("width"),l.removeAttribute("height"),l.style.maxWidth="1000px",l.style.maxHeight="1000px",s.appendChild(l),s.open(),t.stopPropagation(),t.preventDefault()}_applyTagsContent(e,t,a){const s=this;let l=s.tags;const o=s.dataSourceMap;l||(l=[]);let r="";if(e&&e.indexOf&&e.indexOf("{")>=0&&(e=JSON.parse(e)),e&&"string"==typeof e){e=e.split(",");for(let t=0;t<e.length;t++)e[t]=e[t].trim();l.length>0?(e=e.filter((e=>{if(-1!==l.indexOf(e))return!0})),t[o.tags]=e.join(", ")):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=[],r=e.map((e=>`<span class="smart-kanban-task-tag" role="listitem">${e}</span>`)).join("")}else e&&"object"==typeof e?(Array.isArray(e)||(e=[e],t[o.tags]=e),l.length>0?(e=e.filter((e=>{if(-1!==l.indexOf(e))return!0;if(e.value){let t=!1;if(l.find((a=>{a===e.value&&(t=!0),a.value===e.value&&(t=!0)})),t)return!0}})),t[o.tags]=e):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=[],r=e.map((e=>{if(e.color){const t=e.color||"rgba(var(--smart-primary-rgb), 0.15)",a=document.createElement("div");document.body.appendChild(a),a.style.backgroundColor=t;const s=getComputedStyle(a).backgroundColor;return a.remove(),`<span style="color: ${new Smart.Color(s).getInvertedColor()}; background: ${t} " class="smart-kanban-task-tag" role="listitem">${e.label}</span>`}return`<span class="smart-kanban-task-tag" role="listitem">${"string"==typeof e?e:e.label}</span>`})).join("")):t[o.tags]="";return r}_applyTaskTemplate(e){const t=this,a=t.dataSourceMap,s=(t.tags,e.data),l=t._tabindex;let o=s[a.text],r=s[a.description],i=s[a.tags],n="",d=o;void 0===o&&(o="",s[a.text]="",d=o),void 0===r&&(r="",s[a.description]=""),o=t._applyTextTemplate(o,s,e),n=t._applyTagsContent(i,s,e),"string"==typeof s[a.priority]&&(s[a.priority]=s[a.priority].toLowerCase());const c=t._getPriority();let u=c.findIndex((e=>e.value===s[a.priority]));const m=c.length>0&&u>=0?c[u]:null;s[a.comments]&&Array.isArray(s[a.comments])||(s[a.comments]=[]);const p=t.localize(s[a.priority])+" "+t.localize("priority");let h=d?`${d}: ${p}`:`${p}`;t.taskPriority||(h=d);let g=`<div class="smart-kanban-task-cover"></div><div title="${h}" class="smart-kanban-task-content" role="presentation">\n <div class="smart-kanban-task-text">${o}`;g+=m?`${m.menuIcon}`:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',g+=`</div>\n <div class="smart-kanban-task-user"${l} role="button" aria-haspopup="listbox"></div>\n</div>\n<div class="smart-kanban-task-info" role="presentation">\n <div class="smart-kanban-task-progress-container">\n <div class="smart-kanban-task-progress" role="progressbar" aria-label="Task progress" aria-valuemin="0" aria-valuemax="100"></div>\n <div class="smart-kanban-task-checked" aria-label="Completed sub-tasks"></div>\n </div>\n <div class="smart-kanban-task-due" aria-label="Task due date"></div>\n</div>\n<div class="smart-kanban-task-fields"></div>\n<div class="smart-hidden smart-kanban-task-subtasks">\n <div class="smart-kanban-task-subtasks-container"></div>\n <div><input class="smart-kanban-task-input smart-input" placeholder="${t.localize("newSubtask")}"/></div>\n</div>\n<div class="smart-hidden smart-kanban-task-custom-fields"></div>\n<div class="smart-kanban-task-footer" role="toolbar" aria-label="Task footer">\n <div class="smart-kanban-task-tags" role="list" aria-label="Tags list">${n}</div>\n <div class="smart-kanban-task-edit smart-hidden"${l} title="${t.localize("edit")}" role="button" aria-label="Edit"></div>\n <div title="${t.localize("actionsList")}" class="smart-kanban-task-actions"${l} role="button" aria-haspopup="menu" aria-label="Open actions list"></div>\n <div class="smart-kanban-task-comments"${l} num="${s[a.comments].length||""}" role="button" aria-haspopup="dialog" aria-label="Open comments list"></div>\n <div class="smart-kanban-task-description smart-hidden"${l} title="${t.localize("taskDescription",{value:s[a.description]})}" num="${s[a.description].length||""}" role="button" aria-label="Show description"></div>\n</div>`,e.innerHTML=g,e.setAttribute("aria-label",s[a.text]);const b=e.querySelector(".smart-kanban-task-description");s[a.description]?b.classList.remove("smart-hidden"):b.classList.add("smart-hidden");const f=e.querySelector(".smart-kanban-task-edit");t.editable?f.classList.remove("smart-hidden"):f.classList.add("smart-hidden"),f.onpointerdown=a=>{t.beginEdit(e),a.preventDefault(),a.stopPropagation()},t._updateTaskCustomFields(e),t._updateTaskSubtasks(e)}_updateTaskCustomFields(e){const t=this,a=e.data;if(t.taskCustomFieldsHide){const t=e.querySelector(".smart-kanban-task-custom-fields");t&&t.classList.remove("smart-hidden")}else if(t.taskCustomFields.length>0&&!t.taskCustomFieldsHide){const s=e.querySelector(".smart-kanban-task-custom-fields");s.classList.remove("smart-hidden");for(let l=0;l<t.taskCustomFields.length;l++){const o=t.taskCustomFields[l];let r=a[o.dataField],i="";if(t.dataSourceMap[o.dataField])continue;if("password"===o.editor)continue;if(null==r||!1===o.visible){const t=e.querySelector("[data-field="+o.dataField+"]");t&&t.classList.add("smart-hidden");continue}if(void 0===o.visible&&(o.visible=!0),void 0===o.allowHide&&(o.allowHide=!0),"string"==typeof r&&(!o.dataSource||o.dataSource&&0===o.dataSource.length)){if(r.length>50)if(r.indexOf("base64")>=0){r=JSON.parse(r),window.Smart._createSmartImageModal=t._createImageModal;let e="";for(let t=0;t<r.length;t++){const a=r[t];e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${a.value}" title="${a.label}"/>`}r=e}else if(o.image&&r.indexOf("http")>=0){if(window.Smart._createSmartImageModal=t._createImageModal,r.indexOf(",")>=0){let e="";r=r.split(",");for(let t=0;t<r.length;t++)e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${r[t]}"/>`;r=e}else r=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${r}"/>`;if(o.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=r}}else i=r,r=r.substring(0,50)+"..."}else if(o.image){if(r=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${r}"/>`,o.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=r}}else if("dateInput"===o.editor)r=new Smart.Utilities.DateTime(r).toString(this.formatStringDate);else if(o.dataSource)if(r&&r.indexOf(",")>0&&(r=r.split(",")),void 0!==r&&Array.isArray(r)){let e=[];for(let t=0;t<r.length;t++){const a=o.dataSource.find((e=>{if(e.value===r[t])return e}));a&&e.push(a.label)}r=e.toString()}else{const e=o.dataSource.find((e=>{if(e.value===r)return e}));e&&e.label&&(r=e.label)}const n=e.querySelector("[data-field="+o.dataField+"]");if(n)n.innerHTML=`<div class="smart-kanban-task-field-label">${o.label}</div><div title="${i}" class="smart-kanban-task-field-value">${r}</div>`,n.classList.remove("smart-hidden");else{const e=document.createElement("div");e.classList.add("smart-kanban-task-field"),e.setAttribute("data-field",o.dataField),e.innerHTML=`<div class="smart-kanban-task-field-label">${o.label}</div><div title="${i}" class="smart-kanban-task-field-value">${r}</div>`,s.appendChild(e)}}}}_updateTaskSubtasks(e){const t=this;if("none"===t.taskSubTasks)return void e.querySelector(".smart-kanban-task-subtasks").classList.add("smart-hidden");const a=e.data,s=t.dataSourceMap,l=[],o=[];(a[s.checklist]||[]).forEach(((e,t)=>{e.completed&&l.push(t),o.push({label:e.text,selected:!0===e.completed})}));const r=e.querySelector(".smart-kanban-task-subtasks"),i=e.querySelector(".smart-kanban-task-subtasks-container");i.innerHTML="",r.classList.remove("smart-hidden");const n=e.querySelector(".smart-kanban-task-input");t._currentUser&&!t._currentUser.allowEdit||t.disabled||!t.taskSubTasksInput?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"),n.onchange=function(){a[s.checklist]||(a[s.checklist]=[]);const l=JSON.parse(JSON.stringify(a));a[s.checklist].push({text:n.value,completed:!1}),n.value="",t._updateTaskSubtasks(e);const o=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:o.id,value:o,oldValue:l}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:l})},o.length&&o.forEach(((l,r)=>{const n=document.createElement("div"),d=l.label;n.innerHTML=`<div data-index="${r}" class="smart-kanban-sub-task"><span title="${d}" class="smart-truncate label">${d}</span><span class="remove-subtask" aria-label="Remove subtask" title="${t.localize("removeSubtask")}"></span></div>`,l.selected&&n.firstChild.classList.add("selected"),"onlyUnfinished"===t.taskSubTasks&&l.selected&&n.classList.add("smart-hidden");let c=!0;(t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(c=!1),n.querySelector(".remove-subtask").style.opacity=c?1:0,n.onclick=l=>{let r=!0;if((t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(r=!1),!r)return;const i=JSON.parse(JSON.stringify(a)),d=parseInt(n.firstChild.getAttribute("data-index")),c=o[d];l.target.classList.contains("remove-subtask")?(o.splice(d,1),n.classList.add("smart-hidden"),a[s.checklist].splice(d,1)):(n.firstChild.classList.toggle("selected"),c.selected=!c.selected,a[s.checklist][d].completed=c.selected,"onlyUnfinished"===t.taskSubTasks&&c.selected&&n.classList.add("smart-hidden")),t._updateTaskChecked(e);const u=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:u.id,value:u,oldValue:i}),t.$.fireEvent("taskUpdate",{id:u.id,value:u,oldValue:i}),l.preventDefault(),l.stopPropagation()},i.appendChild(n)}))}_applyTextTemplate(e,t,a){const s=this;let l=this.textTemplate;if(!l)return e;let o="";if("function"==typeof l){const s={data:t,task:a,text:e,template:null};if(l(s),e=s.text,null===s.template)return e;l=s.template}if(l.startsWith("#")){const a=document.querySelector(l);if(a&&a instanceof HTMLTemplateElement){const l=a.content.cloneNode(!0),r=document.createElement("div");return r.appendChild(l),e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),o=r.innerHTML.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),o.indexOf("{{text=")>=0&&(e?(o=o.substring(0,o.indexOf("{{text="))+e+o.substring(o.indexOf("}")),o=o.replace(/}/gi,""),o=o.replace(/{/gi,"")):(o=o.replace(/{{text=/gi,""),o=o.replace(/}}/gi,""))),o}}return o=l.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),o}_updateUserIcon(e){const t=this,a=this.dataSourceMap,s=e.data,l=e.getElementsByClassName("smart-kanban-task-user")[0];if(void 0!==s[a.userId]&&null!==s[a.userId]){const e=this.users.find((e=>e.id.toString()===s[a.userId].toString()));if(e)return s[a.userId]!==e.id&&(s[a.userId]=e.id),l.classList.remove("empty"),l.style.backgroundImage='url("'+e.image+'")',l.setAttribute("title",t.localize("assignedTask",{userName:e.name||e.id})),void l.setAttribute("aria-label","Icon of user "+(e.name||e.id))}s[a.userId]=null,l.classList.add("empty"),l.style.backgroundImage=null,l.setAttribute("aria-label","Empty user icon"),l.setAttribute("title",t.localize("unassignedTask"))}_updateTaskComments(e){const t=this.dataSourceMap,a=e.data;e.querySelector(".smart-kanban-task-comments").setAttribute("num",a[t.comments].length||"")}_updateTaskProgress(e){const t=this.dataSourceMap,a=e.data,s=e.querySelector(".smart-kanban-task-progress");let l=a[t.progress];if(void 0===l){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}if(l=parseFloat(l),isNaN(l)){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}l=Math.max(0,Math.min(parseFloat(l),100)),a[t.progress]=l,s.style.width=l+"%",s.classList.toggle("bottom",null!==a[t.checklist]),s.setAttribute("aria-valuenow",l);const o=this.localize("taskProgress",{value:l});s.parentElement.setAttribute("title",o)}_updateTaskChecked(e){const t=this.dataSourceMap,a=e.data,s=a[t.checklist],l=e.querySelector(".smart-kanban-task-checked");if(s&&Array.isArray(s)&&s.length>0?l.innerHTML=this._getCompletedSubTasks(s):(a[t.checklist]=null,l.innerHTML=""),l.innerHTML.length>0){let e=0;s.forEach((t=>t.completed&&e++));const t=e,a=s.length,o=this.localize("taskCompleted",{value:t,count:a});l.setAttribute("title",o)}else l.removeAttribute("title")}_getCompletedSubTasks(e){if(null===e)return"";let t=0;return e.forEach((e=>e.completed&&t++)),t+"/"+e.length}_updateTaskDueDate(e){const t=this.dataSourceMap;let a=e.data,s=a[t.dueDate],l=e.querySelector(".smart-kanban-task-due");if(s&&"string"==typeof s&&(s=new Date(s),s.setTime(s.getTime()-1*s.getTimezoneOffset()*60*1e3),a[t.dueDate]=s),s)if(l.innerHTML=new Smart.Utilities.DateTime(s).toString(this.formatStringDate),l.classList.toggle("overdue",s.getTime()<(new Date).getTime()&&100!==a[t.progress]),l.classList.contains("overdue")){const e=Math.abs(new Date-s),t=Math.ceil(e/864e5);l.setAttribute("title",this.localize("overdue")+" "+t+" "+this.localize("days"))}else l.removeAttribute("title");else a[t.dueDate]=null,l.innerHTML="",l.classList.remove("overdue"),l.removeAttribute("title");a[t.startDate]?"string"==typeof a[t.startDate]&&(a[t.startDate]=new Date(a[t.startDate]),a[t.startDate].setTime(a[t.startDate].getTime()-1*a[t.startDate].getTimezoneOffset()*60*1e3)):a[t.startDate]=null}_updateTaskColor(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".smart-kanban-task-progress-container"),o=e.querySelector(".smart-kanban-task-progress"),r=t.rightToLeft?"borderRightColor":"borderLeftColor";function i(e){let t=parseFloat(e).toString(16);return t="0".repeat(2-t.length)+t,t.toUpperCase()}if(e.style.borderLeftColor=null,e.style.borderRightColor=null,e.style.borderLeftWidth="",e.style.borderRightWidth="",s[a.color]){e.style[r]=s[a.color];const d=getComputedStyle(e)[r],c="dark"===t.theme?.4:.1;t.taskColor?e.style[r]=s[a.color]:(e.style[r]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px"),s[a.color]=(n=(n=d).match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+i(n[1])+i(n[2])+i(n[3]):null,l&&(l.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`,o.style.backgroundColor=d),t.taskColorEntireSurface&&(e.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`)}else{if(s[a.color]=null,l&&(l.style.backgroundColor=null,o.style.backgroundColor=null),t.taskColorEntireSurface){const a=getComputedStyle(e)[r],s="dark"===t.theme?.4:.1;e.style.backgroundColor=`rgba(${a.slice(4,a.length-1)}, ${s})`}t.taskColor||(e.style[r]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px")}var n}_updateTaskPriority(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".priority");l.className="priority";let o="";s[a.priority]&&(l.className+=" "+s[a.priority],o=t.localize(s[a.priority])+" "+t.localize("priority"));const r=s[a.text],i=e.querySelector(".smart-kanban-task-content");t.taskPriority?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),i&&(r&&t.taskPriority&&o?i.setAttribute("title",`${r}: ${o}`):i.removeAttribute("title"))}_validateSwimlanes(){const e=this,t=e.swimlanesFrom,a=e.swimlanesTo,s=[];t<0&&(e.swimlanesFrom=0),null!==a&&t>a&&(e.swimlanesFrom=a),e.swimlanes.forEach((e=>{"string"==typeof e&&(e={dataField:e,label:e}),(e.dataField||e.label)&&(e.label||(e.label=e.dataField),e.dataField||(e.dataField=e.label),s.push(e))})),e.swimlanes=s}_handleSwimlanes(e){const t=this,a=t.swimlanes;if(0===a.length||0===t.columns.length)return;const s=t.columns,l=parseFloat(getComputedStyle(t).getPropertyValue("--smart-kanban-header-size")),o=t.$.container,r=t.$.container.getBoundingClientRect(),i=t.$.container.querySelectorAll(".smart-kanban-column.has-swimlane");let n=i[0],d=i[i.length-1];if(t.rightToLeft){let e=n;n=d,d=e}const c=n.getBoundingClientRect(),u=i.length>1?d.getBoundingClientRect():c,m=Array.from(n.getElementsByTagName("smart-scroll-viewer"));let p,h,g,b,f=!1,v=!0,k=t.swimlanesTo;null===k&&(k=s.length-1),e&&(p=o.getElementsByClassName("swimlane")),n.column.collapsed&&(n.classList.remove("collapsed"),f=!0);for(let e=t.swimlanesFrom;e<=k;e++)v=v&&s[e].collapsed;v||(h=u.right-c.left+"px",g=c.left-r.left+"px",b=m.map((e=>e.getBoundingClientRect().top-r.top-l-t._dataViewPadding+"px"))),a.forEach(((t,a)=>{let s;e?s=p[a]:(s=document.createElement("div"),s.innerHTML=`<div class="swimlane-label">${t.label}</div>`,s.className="swimlane",s.setAttribute("role","heading"),s.setAttribute("aria-level",2),t.color&&(s.style.backgroundColor=t.color)),s.classList.toggle("smart-visibility-hidden",v),v||(s.style.width=h,s.style.left=g,s.style.top=b[a]),e||o.appendChild(s)})),f&&n.classList.add("collapsed")}_renderColumns(){const e=this,t=e.collapsible,a=[],s=e.$.body,l=document.createDocumentFragment();let o=e.columns;const r=e.context;if(e.context=e,e._columnToElement=new Map,e._columnContainers=[],0===o.length){const t=e.dataSource;t&&0!==t.length&&(o=[],t.forEach((t=>{const a=t[e.dataSourceMap.status];a&&-1===o.indexOf(a)&&o.push(a)})))}!function e(a,s,l){const o=[];let r=0;if(a.forEach((a=>{"string"==typeof a&&(a={dataField:a,label:a}),void 0!==a.dataField&&(void 0===a.label&&(a.label=a.dataField),void 0===a.dataField&&(a.dataField=a.label),"horizontal"!==a.orientation&&(a.orientation="vertical"),!1!==a.collapsible&&(a.collapsible=!0),a.collapsed&&t&&a.collapsible?r++:a.collapsed=!1,!1!==a.addNewButton&&(a.addNewButton=!0),!1!==a.allowRemove&&(a.allowRemove=!0),!1!==a.allowHide&&(a.allowHide=!0),!1!==a.editable&&(a.editable=!0),!1!==a.reorder&&(a.reorder=!0),0===l?delete a.selected:!0===a.selected?o.push(a):a.selected=!1,a.columns&&(a.validColumns=[],e(a.columns,a.validColumns,l+1),a.columns=a.validColumns,delete a.validColumns),s.push(a))})),r&&r===s.length&&(s[0].collapsed=!1),o.length>1)for(let e=o.length-2;e>=0;e--)o[e].selected=!1;else l>0&&0===o.length&&s.length>0&&(s[0].selected=!0)}(o,a,0),0===e.swimlanes.length?"columns"===e.hierarchy?e._createColumnElements(a,l,s,1):e._createColumnElementsTabs(a,l,s):e._createColumnElementsSwimlanes(a,l,s),s.appendChild(l),e._selectedTabs=e._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),e._autoSaveState("tabs"),e.context=r}_createAddNewButton(){const e=this,t=e.querySelectorAll(".smart-kanban-add-new-button");t.length&&t.forEach((e=>{e.remove()})),e.addNewButton&&"top"!==e.addNewButtonDisplayMode&&(e.addNewButtons=[],e.querySelectorAll(".smart-kanban-column").forEach((t=>{const a=t.querySelector(".smart-scroll-viewer");if(a){const s=(()=>{const t=document.createElement("div");return t.setAttribute("add-new-button",""),t.classList.add("smart-kanban-add-new-button"),t.title=e.localize("addNewTask"),t.onclick=()=>{if(t.column){const e=t.column.querySelector(".smart-kanban-column-header-add");e&&e.click()}},t})(),l=t.column;if(!l||l&&l.collapsed||l&&!l.addNewButton)return;t.appendChild(s);const o=()=>{const l=a.getBoundingClientRect(),o=t.querySelectorAll(".smart-kanban-task"),r=e.offset(e);if(0===o.length){const a=t.querySelector(".smart-kanban-column-header"),l=e.offset(a).top-r.top,o=e.autoColumnHeight?60:0;s.style.top=l+o+a.offsetHeight+"px"}else{const t=o[o.length-1],i=e.offset(t),n=e.offsetHeight-2*s.offsetHeight,d=i.top-r.top+t.offsetHeight;if(a.computedVerticalScrollBarVisibility){const t=e.getBoundingClientRect();s.style.top=Math.min(l.top-t.top+a.offsetHeight,n)+"px"}else s.style.top=Math.min(d,n)+"px"}const i=t.offsetWidth-a.offsetWidth;s.style.left=l.left+a.offsetWidth/2-i-s.offsetWidth/2-r.left+e.$.scrollViewer.scrollLeft+"px"};s.refresh=o,s.column=t,t.addNewButton=s,s.refresh(),e.addNewButtons.push(s),requestAnimationFrame((()=>{s.classList.add("show")}))}})),e._refreshSummaries())}_refreshColumnHeights(){const e=this;e.autoColumnHeight&&e.querySelectorAll(".smart-kanban-column").forEach((t=>{const a=t.querySelector(".smart-scroll-viewer");if(a){const s=t.column;if(!s||s&&s.collapsed||s&&!s.addNewButton)return;const l=t.querySelectorAll(".smart-kanban-task"),o=t.querySelector(".smart-kanban-column-header"),r=t.querySelector(".smart-kanban-column-footer"),i=r?r.offsetHeight:0;if(0===l.length)t.style.height=100+i+o.offsetHeight+"px";else{const a=e.offset(e),s=l[l.length-1],r=e.offset(s),n=e.offsetHeight,d=o.offsetHeight+i+r.top-a.top+s.offsetHeight;t.style.height=n<d?"":d-i+"px"}a.refresh(),e._refreshEmptyColumnState(a)}}))}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")},e}_createColumnElements(e,t,a,s){const l=this,o=l.id,r=[],i=[];let n=0;const d=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;if(e.forEach(((a,c)=>{const u=document.createElement("div");let m=`${l._getColumnHeader(a,c<e.length-1,s)}\n <div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`,p=0;if(l.columnFooter&&(m+='<div class="smart-kanban-column-footer"></div>'),a.columns?(m=m.replace("AAA",""),m=m.replace("BBB",'<div class="smart-kanban-column-content-columns" role="presentation"></div>')):(m=m.replace("AAA"," no-sub-columns"),m=m.replace("BBB","")),u.className="smart-kanban-column",u.setAttribute("data-field",a.dataField),u.setAttribute("role","group"),u.setAttribute("aria-labelledby",`${o}ColumnHeaderLabel${a.dataField}`),u.setAttribute("orientation",a.orientation),a.color&&l.applyColumnColorToTasks&&u.style.setProperty("--smart-primary",a.color),a.collapsible&&u.setAttribute("collapsible",""),a.addNewButton&&u.setAttribute("add-new-button",""),u.innerHTML=m,u.siblingColumns=e,t.appendChild(u),u.column=a,u.index=c,l.onColumnHeaderRender&&l.onColumnHeaderRender(u.querySelector(".smart-kanban-column-header"),a,a.dataField),l._columnToElement.set(a,u),a.columns){const e=u.querySelector(".smart-kanban-column-content-columns");p=l._createColumnElements(a.columns,e,e,s+1),n+=p}else n+=1;let h=(p||1)+"fr";l.columnWidth?h=d(l.columnWidth):a.width&&(h=d(a.width)),!1!==a.visible?(a.collapsed?(u.classList.add("collapsed"),r.push("auto")):r.push(h),i.push(h)):u.classList.add("smart-hidden"),l._allColumns.push(a)})),1===s&&l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth;e=d(t),r.push(e)}else r.push("var(--smart-kanban-add-new-column-width)");return a.style.gridTemplateColumns=r.join(" "),a.fractions=i,l._columnContainers.push(a),n}_createColumnElementsTabs(e,t,a,s){const l=this,o=l.id,r=[],i=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`<div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`;if(a.columns?(c=c.replace("AAA",""),c=c.replace("BBB",'<div class="smart-kanban-column-content-columns has-tabs" role="presentation"></div>')):(c=c.replace("AAA"," no-sub-columns"),c=c.replace("BBB","")),d.className="smart-kanban-column",d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),s){const e=document.createElement("div"),t=`${o}Tab${a.dataField}`,r=`${o}Column${a.dataField}`;e.id=t,e.className="smart-kanban-tab smart-unselectable",l.disabled||l.unfocusable||(e.tabIndex=0),e.setAttribute("role","tab"),e.setAttribute("aria-controls",r),e.innerHTML=`<div class="smart-kanban-tab-label">${a.label}</div>`,e.columnElement=d,d.id=r,d.setAttribute("role","tabpanel"),d.setAttribute("aria-labelledby",t),d.tab=e,s.appendChild(e),a.selected?e.classList.add("selected"):d.classList.add("smart-hidden"),e.setAttribute("aria-selected",a.selected)}else c=l._getColumnHeader(a,n<e.length-1)+c,d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${o}ColumnHeaderLabel${a.dataField}`);if(d.innerHTML=c,d.siblingColumns=e,t.appendChild(d),d.column=a,d.index=n,l._columnToElement.set(a,d),a.columns){const e=d.querySelector(".smart-kanban-column-content-columns"),t=document.createElement("div");t.className="smart-kanban-tab-strip",t.setAttribute("role","tablist"),e.appendChild(t),l._createColumnElementsTabs(a.columns,e,e,t)}s||(a.collapsed?(d.classList.add("collapsed"),r.push("auto")):r.push("1fr"),i.push("1fr")),l._allColumns.push(a)})),!s){if(l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth),r.push(e)}else r.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=r.join(" "),a.fractions=i,l._columnContainers.push(a)}}_createColumnElementsSwimlanes(e,t,a){const s=this,l=s.id,o=s.swimlanes,r=[],i=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`${s._getColumnHeader(a,n<e.length-1)}\n <div class="smart-kanban-column-content no-sub-columns" role="presentation"></div>`;d.className="smart-kanban-column",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${l}ColumnHeaderLabel${a.dataField}`),d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),d.innerHTML=c,d.siblingColumns=e;const u=d.children[1];let m="";if(s._hasSwimlane(n)){let e=[];for(let t=0;t<o.length;t++)m+=`<smart-scroll-viewer class="smart-kanban-column-content-tasks" swimlane="${o[t].dataField}"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`,e.push("1fr");d.classList.add("has-swimlane"),u.classList.add("has-swimlane"),u.style.gridTemplateRows=e.join(" ")}else m=`<smart-scroll-viewer class="smart-kanban-column-content-tasks"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`;u.innerHTML=m,t.appendChild(d),d.column=a,d.index=n,s._columnToElement.set(a,d),a.collapsed?(d.classList.add("collapsed"),r.push("auto")):r.push("1fr"),i.push("1fr"),s._allColumns.push(a)})),s.addNewColumn)if(s._appendAddNewColumn(t),s.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(s.addNewColumnWidth?s.addNewColumnWidth:s.columnWidth),r.push(e)}else r.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=r.join(" "),a.fractions=i,s._columnContainers.push(a)}_getColumnSummary(e){const t=this.getColumnDataItems(e.dataField);return this.columnSummary&&t.length?" ("+t.length+")":""}_getColumnHeaderTemplate(e,t){const a=e.headerTemplate||this.columnHeaderTemplate;if(a){const s=document.createElement("div");let l;if("string"==typeof a&&a.startsWith("#")?l=document.querySelector(a):"string"==typeof a&&(l=a),"function"==typeof a){const s=a(e,t);return s||t}if(l instanceof HTMLTemplateElement){s.appendChild(l.content.cloneNode(!0));const t=/{{\w+}}/g;let a=s.innerHTML;const o=t.exec(a);for(let t=0;t<o.length;t++){const t=e[o[0].replace("{{","").replace("}}","")];a=a.replace(o[0],t)}return a}return l instanceof HTMLElement?s.appendChild(l):s.innerHTML=l,s.innerHTML}return null}_getColumnHeader(e,t,a=1){const s=this,l=s._tabindex,o=e.collapsed?s.localize("expand"):s.localize("collapse"),r=s.localize("addNewTask"),i=s.allowColumnEdit||s.allowColumnRemove||s.allowColumnHide?"settings":"",n=s.localize("customizeColumn");let d=e.label;""===d&&(d=" ");const c=s._getColumnSummary(e);let u=`<span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span>`,m="smart-kanban-column-header-label";if(void 0!==e.color){if(e.color){const t=new Smart.Color(e.color).getInvertedColor();u=`<div class="heading" style="background: ${e.color}; color: ${t};"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`}else u=`<div class="heading"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`;m+=" pill"}const p=null!==s.columnHeaderTemplate||e.headerTemplate?s._getColumnHeaderTemplate(e,u):u,h="bottom"===s.addNewButtonDisplayMode?"":"add-new-button";return`<div status="${e.dataField}" ${i} ${h} class="smart-kanban-column-header smart-unselectable"${l} role="heading" aria-level=${a}>\n <div title="${r}" class="smart-kanban-column-header-add ${h}"${l} role="button" aria-label="Add new task"></div>\n <div id="${s.id}ColumnHeaderLabel${e.dataField}" class="${m}">${p}</div>\n <div title="${o}" class="smart-kanban-column-header-toggle-button smart-arrow smart-arrow-${t?"left":"right"}" role="button" aria-hidden="true"></div>\n <div title="${n}" class="smart-kanban-column-actions smart-kanban-column-header-settings-button" role="button" aria-haspopup="menu" aria-label="Open actions list" aria-hidden="true"></div>\n </div>`}_hasSwimlane(e){const t=this;if(0===t.swimlanes.length)return!1;const a=t.swimlanesFrom;let s=t.swimlanesTo;return null===s&&(s=t.columns.length-1),e>=a&&e<=s}_updateColumnWidths(e,t){const a=this,s=t.fractions,l=[];let o=0,r=0;for(let t=0;t<e.length;t++){const i=e[t];!1!==i.visible&&(l.push(e[t].collapsed?"auto":s[o++]),!i.collapsed&&a.columnWidth&&(r+=i.width?i.width:a.columnWidth))}if(t===a.$.body&&a.addNewColumn)if(a.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(a.addNewColumnWidth?a.addNewColumnWidth:a.columnWidth),l.push(e)}else l.push("var(--smart-kanban-add-new-column-width)");r<a.offsetWidth&&a.columnWidth&&l.push("1fr"),t.style.gridTemplateColumns=l.join(" "),a.columnWidth&&a.$.scrollViewer.refresh()}_validateColumnArgument(e){if(!isNaN(e))return this.columns[e];const t=this._allColumns;return"string"==typeof e?t.find((t=>t.dataField===e)):"object"==typeof e?t.find((t=>t===e)):null}_resizeHandler(){this.$.scrollViewer&&(this.$.scrollViewer.scrollLeft=0),this.refresh("resize")}refresh(e){const t=this;"resize"===e?(clearTimeout(t._resizeTimeout),t._resizeTimeout=setTimeout((function(){t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}),50),t._handleSwimlanes(!0)):(t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t._closeList(t._priorityList,"_prioritySelectionFor"),t._resetFields=!0,t._render()),t.$.scrollViewer.refresh()}_refreshScrollViewer(e,t){const a=this,s=e instanceof HTMLElement?e:this._columnToElement.get(e);function l(l,o){if(!t&&l&&l.$.scrollViewerContentContainer&&""===l.$.scrollViewerContentContainer.innerHTML.trim())return a.virtualization&&a._refreshScrollHeight(l,e.dataField),void a._refreshEmptyColumnState(l);if(e.collapsed?l.toRefresh=!0:(delete l.toRefresh,requestAnimationFrame((()=>{if(l.refresh(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField);0===o&&"horizontal"===e.orientation&&(a.columnWidth||(l.$.content.offsetWidth<=2*a._kanbanTaskMinWidth+a._dataViewPadding?s.setAttribute("orientation","vertical"):"vertical"===s.getAttribute("orientation")&&s.setAttribute("orientation","horizontal")))}))),a._refreshButtonsAndSummaries(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField)}e instanceof Smart.ScrollViewer?l(e):this.swimlanes.length>0?Array.from(s.querySelectorAll("smart-scroll-viewer")).forEach(((e,t)=>l(e,t))):l(s.querySelector("smart-scroll-viewer"),0)}_containerDownHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,s=a.closest(".smart-kanban-task");if(delete t._preventSelection,t.allowColumnReorder){const l=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button");if(!s&&l&&!t._columnEditing){const s=a.closest(".smart-kanban-column");if(s){const a=e.originalEvent.composedPath();let l=0;for(let e=0;e<a.length;e++)a[e].classList&&a[e].classList.contains("smart-kanban-column")&&l++;s.column.reorder&&l<=1&&(t._columnDragDetails={x:e.pageX,y:e.pageY,event:e,kanbanColumn:s})}}}const l=a.closest(".smart-kanban-column"),o=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button"),r=l?l.column:null;if(r){if(o&&t.$.fireEvent("columnClick",{column:r}),new Date-t._clickTime<=300)return!s&&o&&!t._columnEditing&&t.allowColumnEdit&&(t._columnDragDetails=null,!1===r.collapsed&&r.editable&&"menu"!==t.columnEditMode&&t._handleColumnEditing(r.dataField)),void(o&&(r.collapsed?t.expand(r):(!t.allowColumnEdit||t.allowColumnEdit&&"menu"===t.columnEditMode)&&t.collapse(r),t.$.fireEvent("columnDoubleClick",{column:r})));t._clickTime=new Date}s&&(t.virtualization?(t.focusTask(s.data.id),t._refreshColumns()):t._focusTask(s),t._startDragging(s,e))}_containerKeydownHandler(e){const t=this;if(t._dragDetails)return;const a=e.key,s=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;function l(a=s){delete t._preventSelection,t._documentUpHandler({originalEvent:{target:a}}),t._containerClickHandler({target:a,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey}),e.preventDefault()}if(s.closest(".smart-kanban-column, .smart-kanban-add-new-column"))return s.classList.contains("smart-kanban-column-content-tasks")?void t._selectViaKeyboard(s.$.content,e,l):void("Enter"!==a&&" "!==a||s instanceof HTMLInputElement!=0||l());if(t.$.headerDropDown.contains(s))"Escape"===a&&(t.closePanel(),t.$[/\s?([a-z]+)-panel/g.exec(t.$.headerDropDown.className)[1]+"Button"].focus());else if(!(s.classList.contains("smart-data-view-header-button")||s.closest(".smart-data-view-search-box")||s.classList.contains("remove-button"))||"Enter"!==a&&" "!==a||l(),s.classList.contains("smart-kanban-list")){const o=s;switch(a){case"ArrowDown":t._selectListItem(t._getNextItem(o));break;case"ArrowUp":t._selectListItem(t._getPrevItem(o));break;case"Home":t._selectListItem(t._getFirstItem(o));break;case"End":t._selectListItem(t._getLastItem(o));break;case"Escape":o.openedFrom.focus(),t._closeList(o,o===t._actionsList?"_actionSelectionFor":o===t._commentsList?"_commentSelectionFor":"_userSelectionFor"),o===t._columnActionsList&&t._closeList(t._columnActionsList,"_columnActionSelectionFor");break;case"Enter":case" ":{const e=t._getSelectedItem(o);e&&l(e);break}default:return}e.preventDefault()}}getTaskIndex(e){const t=this,a=t.getTask(e);if(!a)return-1;const s=a[t.dataSourceMap.status];return t._getTasksByDataField(s).findIndex((t=>{if(t.id===e)return!0}))}_getNextPrevColumn(e,t){const a=this;let s=null;return a._allColumns.forEach(((l,o)=>{if(l.dataField===e)if(t){if(o<a._allColumns.length-1)return s=a._allColumns[o+1],!0}else if(o>0)return s=a._allColumns[o-1],!0})),s}focusTask(e){const t=this;t._focusedTask=e,t.ensureVisible(e),t._refreshColumns()}_selectViaKeyboard(e,t,a){const s=this;let l=t.key;s.rightToLeft&&("ArrowRight"===l?l="ArrowLeft":"ArrowLeft"===l&&(l="ArrowRight"));const o=s._focusedTask,r=s.getTask(o);if(!r)return;const i=r[s.dataSourceMap.status],n=s._getTasksByDataField(i),d=s.getTaskIndex(o);switch(l){case"ArrowRight":{const e=s._getNextPrevColumn(i,!0);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e),a=t.querySelector(".smart-kanban-task");s._focusTask(a),t.focus()}break}case"ArrowLeft":{const e=s._getNextPrevColumn(i,!1);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e).querySelector(".smart-kanban-task");s._focusTask(t)}break}case"ArrowDown":if(s.virtualization)d<n.length-1&&s.focusTask(n[d+1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getNextItem(t,!0))}break;case"ArrowUp":if(s.virtualization)d>0&&s.focusTask(n[d-1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getPrevItem(t,!0))}break;case"Home":s.virtualization?s.focusTask(n[0].id):s._focusTask(s._getFirstItem(e));break;case"End":s.virtualization?s.focusTask(n[n.length-1].id):s._focusTask(s._getLastItem(e));break;case"Enter":case" ":case"F2":case"Delete":{const e=s.querySelector("[focus]");e&&("F2"===l||"Enter"===l?s.beginEdit(e):"Delete"===l?s.removeTask(e,!0):a(e));break}default:return}t.preventDefault()}_getFirstItem(e){const t=e.children;for(let e=0;e<t.length;e++){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getLastItem(e){const t=e.children;for(let e=t.length-1;e>=0;e--){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getPrevItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.previousElementSibling:this._getLastItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.previousElementSibling}}_getNextItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.nextElementSibling:this._getFirstItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.nextElementSibling}}_getSelectedItem(e,t){return e?t?e.querySelector("[focus]"):e.querySelector(".selected"):null}_selectListItem(e){if(!e)return;const t=e.parentElement,a=t.querySelector(".selected");a&&(a.classList.remove("selected"),a.removeAttribute("aria-selected")),e.classList.add("selected"),e.setAttribute("aria-selected",!0),t.scrollTop=e.offsetTop}_focusTask(e){if(!e)return;const t=this;Array.from(t.querySelectorAll("[focus]")).forEach((e=>e.removeAttribute("focus"))),e.setAttribute("focus",""),this._focusedTask=e.data.id,t.virtualization?t.ensureVisible(t._focusedTask):this.ensureVisible(e)}_setFocusable(){const e=this,t=e.$.container,a=e.disabled||e.unfocusable;let s=[e.$.customizeButton,e.$.filterButton,e.$.sortButton,e.$.searchButton,e.$.searchPrev,e.$.searchNext,e.$.searchClose,e._actionsList,e._userList];if(s=s.concat(Array.from(t.querySelectorAll(".smart-kanban-column-header, .smart-kanban-column-header-add, .smart-kanban-tab, .smart-kanban-column-content-tasks, .smart-kanban-task-user, .smart-kanban-task-actions, .smart-kanban-task-comments, .smart-kanban-add-new-column"))),s.forEach((e=>{a?e.removeAttribute("tabindex"):(null===e.getAttribute("tabindex")||e.getAttribute("tabindex")<0)&&e.setAttribute("tabindex",0)})),e._dialog&&e._dialog.editPanelPopulated){const t=Array.from(e._dialog.$.container.querySelectorAll(".text-editor, .new-subtask"));a?t.forEach((e=>e.tabIndex=-1)):t.forEach((e=>e.removeAttribute("tabindex"))),Array.from(e._dialog.$.container.querySelectorAll(".smart-element.editor, smart-button.add, smart-button.ok, smart-button.cancel")).forEach((e=>e.unfocusable=a)),e._dialog.unfocusable=a}}_startDragging(e,t){const a=this;if(!a._currentUser.allowDrag)return;const s=e.closest("smart-scroll-viewer"),l=e.getBoundingClientRect();let o=e.hasAttribute("selected")?Array.from(e.parentElement.querySelectorAll("[selected]")):[e],r=o.map((e=>e.data));a._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:o,ItemsData:r,ItemData:e.data,Item:e,FeedbackShown:!1,OriginalEvent:t,Column:e.classList.contains("smart-kanban-column")?e:null,PointerOffset:[l.x-t.clientX,l.y-t.clientY],ScrollViewer:s,StartTime:new Date,Dragging:!0},Smart.Kanban.kanbanTaskDragged=!0,s&&s._scrollView&&(s._scrollView.disableSwipeScroll=!0),a.allowDrop&&(Smart.Kanban.hoveredKanban=a,Smart.Kanban.hoveredItem=e)}_documentMoveHandler(e){const t=this,a=t._dragDetails;function s(){delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,a.ScrollViewer._scrollView.disableSwipeScroll=!1}if(t.allowColumnReorder&&t._columnDragDetails&&(Math.abs(e.pageX-t._columnDragDetails.x)>=3||Math.abs(e.pageY-t._columnDragDetails.y)>=3)&&(t._startDragging(t._columnDragDetails.kanbanColumn,t._columnDragDetails.event),t._columnDragDetails=null),!a)return;if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,o=Math.abs(a.StartPosition.left-e.pageX)>5||Math.abs(a.StartPosition.top-e.pageY)>5;if(!o||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&o&&!l&&s());if(t.$.fireEvent("dragStart",{item:a.Item,items:a.Items,data:a,container:t,previousContainer:t,originalEvent:a.OriginalEvent}).defaultPrevented)return void s();t.closePanel(),t._hideBodyOverflow(),a.Feedback=t._addDragFeedback(),a.FeedbackShown=!0,a.Items.forEach((e=>e.classList.add("dragged")))}const l=a=>{a.scrollWidth&&(t._autoScrollDragInterval&&clearInterval(t._autoScrollDragInterval),t._autoScrollDragInterval=setInterval((function(){const t=a.getBoundingClientRect();e.clientX<=t.left+20?a.scrollLeft-=15:e.clientX>=t.left+t.width-20&&(a.scrollLeft+=15)}),25))};Smart.Kanban.hoveredKanban?l(Smart.Kanban.hoveredKanban.$.scrollViewer):l(t.$.scrollViewer);let o,r=t.dragOffset;if(r="auto"!==r&&Array.isArray(r)?r:a.PointerOffset,t.$.fireEvent("dragging",{item:a.Item,items:a.Items,data:a,originalEvent:e}),a.Feedback.style.left=e.pageX+(r[0]||0)+"px",a.Feedback.style.top=e.pageY+(r[1]||0)+"px",Smart.Kanban.hoveredKanban&&(clearInterval(Smart.Kanban.hoveredKanban._dragInterval),delete Smart.Kanban.hoveredKanban),Smart.Kanban.hoveredItem&&(Smart.Kanban.hoveredItem.classList.remove("drop-target"),Smart.Kanban.hoveredItem.classList.remove("before","after"),delete Smart.Kanban.hoveredItem),o=t._isMobile?(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY):t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,!o)return;const i=(t.shadowRoot?o.getRootNode().host:o).closest("smart-kanban");if(!i||!i.allowDrop)return;const n=o.closest(".smart-kanban-column-content-tasks");if(Smart.Kanban.hoveredKanban=i,a.Column)return void t._handleColumnDragging(e);if(!n)return;const d=n.parentElement.parentElement.getAttribute("orientation"),c=Array.from(n.$.content.children);let u=0;if(c.forEach((e=>e.filteredOut&&u++)),0===c.length||c.length===u)return Smart.Kanban.hoveredItem=n.$.scrollViewerContainer,void Smart.Kanban.hoveredItem.classList.add("drop-target");n.scrollHeight>0&&(i._dragInterval=setInterval((function(){const a=n.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientY>=a.top&&e.clientY<=a.top+20?n.scrollTop-=t._autoScrollCoefficient:e.clientY>=a.top+a.height-20&&e.clientY<=a.top+a.height?n.scrollTop+=t._autoScrollCoefficient:clearInterval(i._dragInterval):clearInterval(i._dragInterval)}),2));let m=o.closest(".smart-kanban-task");if(m&&-1===a.Items.indexOf(m)){const t=m.getBoundingClientRect();"vertical"===d&&e.clientY-t.top<=t.height/2||"horizontal"===d&&e.clientX-t.left<=t.width/2?m.classList.add("before"):m.classList.add("after")}else{if(m&&1===c.length)return;m=m&&1===a.Items.length?t[`_${d}ClosestTaskToHover`]([m.previousElementSibling,m.nextElementSibling],e,!0):t[`_${d}ClosestTaskToHover`](c,e,m||o===n.$.content)}m&&(m.classList.add("drop-target"),Smart.Kanban.hoveredItem=m)}_handleColumnDragging(e){const t=this.querySelectorAll(".smart-kanban-column");let a;for(let s=0;s<t.length;s++){const l=t[s],o=l.getBoundingClientRect();e.clientX>=o.left&&e.clientX<=o.right&&e.clientY>=o.top&&e.clientY<=o.bottom&&(a=l)}if(a){const s=a.getBoundingClientRect();e.clientX-s.left<=s.width&&(a.classList.add("before"),a.classList.add("drop-target")),e.clientX-s.left>=s.width/2&&a===t[t.length-1]&&(a.classList.remove("before"),a.classList.add("after"),a.classList.add("drop-target")),Smart.Kanban.hoveredItem=a}}_hideBodyOverflow(){const e=this,t=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,a=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth,s=e.isInShadowDOM?e.getRootNode().host:document.body;e._originalBodyOverflow={overflowX:s.style.overflowX,overflowY:s.style.overflowY,overflow:s.style.overflow},s.classList.add("smart-dragging"),s.style.overflow=s.style.overflowX=s.style.overflowY="",t&&!a?s.style.overflowX="hidden":a&&!t?s.style.overflowY="hidden":a||t||(s.style.overflow="hidden")}_verticalClosestTaskToHover(e,t,a){const s=this._dragDetails.Items,l=t.clientY;let o,r,i=1/0,n=0,d=e.length-1,c=1;for(a||(n=d,d=0,c=-1);n!==d+c;){const t=e[n];if(n+=c,!t||t.filteredOut||-1!==s.indexOf(t))continue;if(!a){o=t,r="after";break}const d=t.getBoundingClientRect(),u=d.top+d.height/2,m=Math.abs(l-u);if(!(m<i))break;i=m,o=t,r=l<=u?"before":"after"}return o&&o.classList.add(r),o}_horizontalClosestTaskToHover(e,t){const a=this._dragDetails.Items,s=t.clientY,l=t.clientX;let o,r,i;return e.forEach((e=>{if(!e||e.filteredOut||-1!==a.indexOf(e))return;const t=e.getBoundingClientRect(),n=Math.abs(s-t.top),d=Math.abs(s-t.bottom),c=Math.min(n,d),u=Math.abs(l-t.left),m=Math.abs(l-t.right),p=Math.min(u,m),h=Math.sqrt(Math.pow(p,2)+Math.pow(c,2));(void 0===r||h<r)&&(o=e,r=h,i=u<m?"before":"after")})),o&&o.classList.add(i),o}_scrollViewerTouchmoveHandler(e){const t=this;t._dragDetails&&(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target).closest("smart-scroll-viewer")&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_documentUpHandler(e){const t=this,a=t._dragDetails;if(t._columnDragDetails=null,t.$.container.hasAttribute("modal"))return;const s=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.header;if(t._userSelectionFor&&!t._userList.contains(s)&&t._closeList(t._userList,"_userSelectionFor"),t._prioritySelectionFor&&!t._priorityList.contains(s)&&t._closeList(t._priorityList,"_prioritySelectionFor"),t._actionSelectionFor&&!t._actionsList.contains(s)&&t._closeList(t._actionsList,"_actionSelectionFor"),t._columnActionSelectionFor&&!t._columnActionsList.contains(s)&&(t._columnActionsList.classList.contains("smart-visibility-hidden")||(t._closeList(t._columnActionsList,"_columnActionSelectionFor"),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),t._columnActionsListDate=new Date)),t._commentSelectionFor){const e=t._commentsList;(t.shadowRoot||t.getRootNode()).activeElement!==e.textarea&&(t._actionSelectionFor||e.contains(s)?!e.classList.contains("expanded")||s===e.textarea||e.button.contains(s)||s.classList.contains("remove-button")||e.classList.remove("expanded"):t._closeList(e,"_commentSelectionFor"))}if(!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||s!==l&&l.contains(s))){const e=s.closest("smart-scroll-viewer"),a=s.closest(".smart-drop-down");e&&l.contains(e.ownerElement)||a&&(!a.ownerElement||l.contains(a.ownerElement))||t.closePanel()}if(!a)return;const o=Smart.Kanban.hoveredKanban,r=Smart.Kanban.hoveredItem;if(delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,a.ScrollViewer&&a.ScrollViewer._scrollView&&(a.ScrollViewer._scrollView.disableSwipeScroll=!1),!a.FeedbackShown)return;const i=o||(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY);t._preventSelection=!0;const n=t.isInShadowDOM?t.getRootNode().host:document.body;n.classList.remove("smart-dragging"),n.style.overflow=t._originalBodyOverflow.overflow,n.style.eoverflowX=t._originalBodyOverflow.overflowX,n.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,a.Feedback.remove(),o&&clearInterval(o._dragInterval);const d=a.Item,c=a.Items;if(c.forEach((e=>e.classList.remove("dragged"))),!i)return;if(!r)return void t.$.fireEvent("dragEnd",{item:d,items:c,target:i,data:a,previousContainer:t,container:i,originalEvent:e});if(!o||!o.allowDrop||o.disabled)return;let u=!1;if(r.classList.remove("drop-target"),r.classList.contains("before")?r.classList.remove("before"):r.classList.contains("after")&&(r.classList.remove("after"),u=!0),a.DropDetails={item:r,after:u},t.$.fireEvent("dragEnd",{item:d,items:c,target:r,data:a,previousContainer:t,container:o,originalEvent:e}).defaultPrevented)return;function m(e,s){t._requestVirtualDataSource("update",Object.assign({},e.data,{status:s}),(function(s){return s&&t._moveDraggedItems(Object.assign({},a,{Item:e,Items:[e]})),s}))}const p=r.closest(".smart-kanban-column"),h=p.column.dataField;if(a.Column){const e=()=>Array.from(p.parentElement.querySelectorAll(".smart-kanban-column")).filter((e=>e.parentElement===p.parentElement)),s=e().indexOf(a.Column);a.DropDetails.after?p.parentElement.appendChild(a.Column):p.parentElement.insertBefore(a.Column,p);const l=e().indexOf(a.Column),o=[],r=e();for(let e=0;e<r.length;e++)r[e].column&&!r[e].classList.contains("smart-kanban-add-new-column")&&o.push(r[e].column);return t.columns=o,t.$.fireEvent("columnReorder",{column:a.Column.column,oldIndex:s,index:l}),t._reset(),void t._createAddNewButton()}if(d&&d.data&&h!==d.data[t.dataSourceMap.status]){const e=Object.assign({},d.data);e[t.dataSourceMap.status]=h;const a=t.getColumn(h);a&&(e.statusLabel=a.label);const s=t.getColumn(d.data[t.dataSourceMap.status]);s&&(d.data.statusLabel=s.label);const l=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(d.data));if(t.$.fireEvent("change",{task:d,id:l.id,value:l,oldValue:o}),t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:o}),t._currentUser.info){const e=t.dataSourceMap;d.data[e.updatedUserId]=t._currentUser.info.id,d.data[e.updatedDate]=new Date,t.addHistory(d.data,{action:"moved",user:t._currentUser.info.id,details:{id:d.data[e.id],oldValue:o[e.status],value:l[e.status]},label:d.data[e.text],date:d.data[e.updatedDate]})}}if(t.dataSource&&t.dataSource.virtualDataSource&&h!==d.data[t.dataSourceMap.status])if(u)for(let e=c.length-1;e>=0;e--)m(c[e],h);else for(const e of c)m(e,h);else if(t._moveDraggedItems(a),d&&d.data){const e=Object.assign({},d.data),a=JSON.parse(JSON.stringify(e));t.$.fireEvent("taskReorder",{id:a.id,value:a})}}_refreshButtonsAndSummaries(){const e=this;e._refreshColumnHeights(),e.addNewButtons&&(e.addNewButtons.forEach((e=>{e.refresh()})),e._refreshSummaries())}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=e._dragDetails.Items.length,s=document.createElement("div"),l=t.offsetWidth+"px",o=t.offsetHeight+"px";let r=t.cloneNode(!0);if(r.style.width=l,r.style.height=o,t.classList.contains("smart-kanban-column")){r=document.createElement("smart-kanban");const a=Object.assign({},t.column);a.collapsed=!1;const o=[a];r.columns=o,r.dataSource=e.dataSource,r.users=e.users,r.taskActions=e.taskActions,r.taskDue=e.taskDue,r.taskProgress=e.taskProgress,r.style.height="100%",r.style.width=l,r.style.minWidth="250px",s.setAttribute("column-drag","")}if(s.className="smart-kanban-feedback",s.setAttribute("parent-kanban-id",e.id),e.theme&&s.setAttribute("theme",e.theme),["rightToLeft","taskActions","taskComments","taskDue","taskPriority","taskProgress","taskTags","taskUserIcon"].forEach((t=>{e[t]&&s.setAttribute(Smart.Utilities.Core.toDash(t),"")})),s.appendChild(r),a>1){const e=document.createElement("div");e.style.width=l,e.style.height=o,e.className="smart-kanban-feedback-additional",s.insertBefore(e,r),r.setAttribute("num",a),a>2&&e.classList.add("multiple")}return e.getShadowRootOrBody().appendChild(s),s}_moveDraggedItems(e){const t=this,a=t.dataSourceMap;let s,l=e.DropDetails,o=l.item,r=o.closest(".smart-kanban-column"),i=e.Item.closest("smart-scroll-viewer"),n=r.column;if(o.classList.contains("smart-kanban-task")?(s=o.parentElement,l.after&&(o=o.nextElementSibling,o&&o.classList.contains("smart-hidden")&&(o=null)),e.Items.forEach(((l,r)=>{if(t.virtualization){const s=e.ItemsData[r],i=s[a.status],d=t._getTasksByDataField(i),c=d.findIndex((e=>e.id===s.id));if(o){if(o.data!==l.data){d.splice(c,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(o.data);e.splice(a,0,s)}}else c>=0&&(d.splice(c,1),t._getTasksByDataField(n.dataField).push(s))}else{s.insertBefore(l,o);const i=e.ItemsData[r],d=i[a.status],c=t._getTasksByDataField(d),u=c.findIndex((e=>e.id===i.id));if(o){if(o.data!==l.data){c.splice(u,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(o.data);e.splice(a,0,i)}}else u>=0&&(c.splice(u,1),t._getTasksByDataField(n.dataField).push(i))}l.data[a.status]=n.dataField,l.data.statusLabel=n.label,l.column=n}))):(s=o.firstElementChild,e.Items.forEach((e=>{if(t.virtualization){const s=e.data[a.status],l=t._getTasksByDataField(s),o=l.findIndex((t=>t.id===e.data.id));l.splice(o,1),t._getTasksByDataField(n.dataField).push(e.data)}else{s.appendChild(e);const l=e.data[a.status],o=t._getTasksByDataField(l),r=o.findIndex((t=>t.id===e.data.id));o.splice(r,1),t._getTasksByDataField(n.dataField).push(e.data)}e.data[a.status]=n.dataField,e.data.statusLabel=n.label,e.column=n}))),s=s.closest("smart-scroll-viewer"),t.swimlanes.length>0){const t=s.getAttribute("swimlane");t?e.Items.forEach((e=>e.data[a.swimlane]=t)):e.Items.forEach((e=>delete e.data[a.swimlane]))}t.virtualization?(t._refreshColumns(),t.focusTask(e.ItemData.id)):t._focusTask(e.Item),i!==s?(s.focus(),t.textTemplate&&e.Items.forEach((e=>t._renderTask(e))),e.Item.hasAttribute("selected")&&(e.Items.forEach((e=>e.removeAttribute("selected"))),t._selectedTasks=[],t._autoSaveState("selection")),t._refreshScrollViewer(i,!0),t._refreshScrollViewer(s,!0)):t.virtualization&&t._refreshScrollViewer(i,!0),t._refreshSummaries(),t._autoSaveState("dataSource")}_getCurrentDataSource(){const e=Array.from(this.$.container.getElementsByClassName("smart-kanban-task")),t=[],a=this;if(a.virtualization){const e=Object.keys(a.tasksByDataField);let t=[];for(let s=0;s<e.length;s++){const l=e[s];let o=a._getTasksByDataField(l);t=[...t,...o]}return t}for(let a=0;a<e.length;a++)t.push(e[a].data);return t}_validateTaskArgument(e){const t=this;return e instanceof HTMLElement&&t.$.container.contains(e)&&e.classList.contains("smart-kanban-task")?e:null===e||"number"!=typeof e&&"string"!=typeof e?void 0:t.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`)}_openDialog(e,t,a="task"){const s=this,l={purpose:t};if(l[a]=e,s.$.fireEvent("opening",l).defaultPrevented)return;if(s.disableDialog)return;s._dialog||s._createDialog();const o=s._dialog,r="prompt"===t;o.refreshFieldsDirty=!0,o.openedFrom=(s.shadowRoot||s.getRootNode()).activeElement,o.classList.toggle("prompt",r),o.classList.toggle("edit",!r),o.style.top="",o.style.left="",o.style.width="",o.style.height="auto","edit"!==t||!s.readonly&&s._currentUser.allowEdit?o.removeAttribute("readonly"):o.setAttribute("readonly",""),s.offsetWidth<600&&(o.style.top="0px",o.style.left="0px",o.style.width="100%",o.style.height="100%");const i=e=>{s.applyColumnColorToTasks&&(e&&e.color?(o.style.setProperty("--smart-primary",e.color),o.style.setProperty("--smart-ui-state-active",e.color)):(o.style.setProperty("--smart-primary",""),o.style.setProperty("--smart-ui-state-active","")))};if(e&&e.column?i(e.column):"add"===t&&i(e),o.taskOrComment=e,"edit"===t?s._currentUser&&s._currentUser.allowRemove&&o.querySelector(".delete").classList.remove("smart-hidden"):o.querySelector(".delete").classList.add("smart-hidden"),o.editPanelPopulated&&(o.selectTab(0),o.editors.historyTab&&o.editors.historyTab.classList.add("smart-hidden")),r){let t="task"===a?s.localize("promptTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("promptComment"),l="task"===a?s.localize("removeTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("removeComment");"column"===a&&(t=s.localize("promptColumn"),l=s.localize("removeColumn")),o.label=l,o.setAttribute("aria-label",t),o.$.container.querySelector(".prompt").innerHTML=t}else{let a=!0;o.removeAttribute("aria-label"),o.headerPosition="top",o.editPanelPopulated||(s._initEditPanel(),a=!1),"edit"===t?s._beginEdit(e):"add"===t&&(o.label=s.localize("addNewTask"),delete o.taskOrComment,a&&s._clearEditors(),s._showHideDialogEditors(),o.refreshTabs(!1),o.selectTab(0),o.editors.status.selectedValues=[e.dataField],0===s.swimlanes.length?(o.editors.swimlane.classList.add("smart-hidden"),o.editors.swimlaneLabel.classList.add("smart-hidden"),o.editors.swimlane.parentElement.classList.add("single-column")):(o.editors.swimlane.classList.remove("smart-hidden"),o.editors.swimlaneLabel.classList.remove("smart-hidden"),o.editors.swimlane.parentElement.classList.remove("single-column")),o.editors.created.parentElement.classList.add("smart-hidden"),o.editors.updated.parentElement.classList.add("smart-hidden"))}s.$.container.setAttribute("modal","");const n=s.offset(s);s.offsetWidth>600&&(o.offsetHeight>s.offsetHeight?o.style.top=s.getBoundingClientRect().top+"px":o.style.top=n.top+s.offsetHeight/2-o.offsetHeight/2+"px",o.offsetWidth>s.offsetWidth?o.style.left=s.getBoundingClientRect().left+"px":o.style.left=n.left+s.offsetWidth/2-o.offsetWidth/2+"px"),s.dialogCustomizationFunction&&s.dialogCustomizationFunction(o,e,o.editors,o.labels,t,a),o.open()}_createDialog(){const e=this,t=document.createElement("smart-window"),a=document.createElement("template"),s=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;a.innerHTML=`<smart-button class="ok primary"${s}><span class="smart-icon"></span>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${s}><span class="smart-icon"></span>${e.localize("cancel")}</smart-button><smart-button class="smart-hidden delete secondary"${s}><span class="smart-icon"></span>${e.localize("delete")}</smart-button>`,t.animation=e.animation,t.footerTemplate=a,t.headerButtons=["close"],t.rightToLeft=e.rightToLeft,t.resizeMode="both",t.liveResize=!0,t.theme=e.theme,t.className="smart-kanban-window",t.innerHTML='<div class="prompt"></div>\n<div class="edit"></div>',t.ownerElement=e,e._dialog=t,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(t)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("open",e._dialogEventHandler),t.addEventListener("closing",e._dialogEventHandler),t.addEventListener("close",e._dialogEventHandler),t.addEventListener("click",e._dialogClickHandler),t.addEventListener("keydown",(e=>{if("Enter"===e.key){const e=t.querySelector(".ok"),a=t.querySelector('.smart-kanban-tab[view="details"]');a&&a.classList.contains("selected")&&(e.disabled||e.click())}}))}_dialogEventHandler(e){const t=this,a=t.ownerElement,s=e.type,l=a.context;(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target)===t&&(a.context=a,"open"===s?(a.$.fireEvent("open"),t.classList.contains("edit")&&(a.hasAnimation?t.addEventListener("transitionend",(function(){setTimeout((()=>{!a.readonly&&a._currentUser.allowEdit&&t.editors.text.focus()}),100)}),{once:!0}):requestAnimationFrame((()=>t.editors.text.focus())))):"closing"===s?a.$.fireEvent("closing").defaultPrevented&&(e.preventDefault(),delete t.ok):"close"===s&&(a.$.fireEvent("close"),a._dialogCloseHandler(e)),a.context=l)}_dialogClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.closest(".ok"))t.ok=!0,t.close();else if(a.closest(".cancel"))t.close();else if(a.closest(".delete"))t.ownerElement.removeTask(t.taskOrComment),t.close();else if(a.closest(".add")){const e=t.editors.newSubtask,a=e.value;if(""===a)return;const s=t.editors.checklist;s.insert(s.items.length,{label:a}),e.value="",t.$.content.scrollTop=t.$.content.scrollHeight-t.$.content.offsetHeight,t.refreshTabs()}else if(a.classList.contains("remove-subtask"))t.editors.checklist.removeChild(a.closest("smart-list-item")),t.refreshTabs();else if(a.classList.contains("remove-button")){const e=t.ownerElement,s=t.ownerElement.dataSourceMap,l=t.taskOrComment.data[s.comments],o=a.closest(".smart-comment").comment,r=JSON.parse(JSON.stringify(t.taskOrComment.data));t.taskOrComment.comment=o,t.taskOrComment.data[s.comments]=l.filter((e=>e!==t.taskOrComment.comment)),t.refreshComments();const i=JSON.parse(JSON.stringify(t.taskOrComment.data));e.$.fireEvent("change",{task:t.taskOrComment,id:i.id,value:i,oldValue:r}),e.$.fireEvent("taskUpdate",{id:i.id,value:i,oldValue:r}),e.$.fireEvent("commentRemove",{id:i.id,value:t.taskOrComment.comment})}}_dialogCloseHandler(){const e=this,t=e.dataSourceMap,a=e._dialog;function s(s){const l=JSON.parse(JSON.stringify(s.data));a.taskOrComment.remove(),s.querySelector(".smart-kanban-task-comments").setAttribute("num",s.data[t.comments].length||""),e._commentsList.editing&&(e._commentsList.textarea.value="",delete e._commentsList.editing);const o=JSON.parse(JSON.stringify(s.data));e.$.fireEvent("change",{task:s,id:o.id,value:o,oldValue:l}),e.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:l}),e.$.fireEvent("commentRemove",{id:o.id,value:a.taskOrComment.comment})}if(e.$.container.removeAttribute("modal"),a.ok){if(a.classList.contains("prompt")){const l=e._commentSelectionFor;if(l){const o=l.data;if(e.dataSource&&e.dataSource.virtualDataSource){const r=Object.assign({},o);r[t.comments]=r[t.comments].filter((e=>e!==a.taskOrComment.comment)),e._requestVirtualDataSource("update",r,(function(e){return e&&(l.data=r,s(l)),e}))}else o[t.comments]=o[t.comments].filter((e=>e!==a.taskOrComment.comment)),s(l)}else e._columnActionSelectionFor&&a.taskOrComment.dataField?e.removeColumn(a.taskOrComment.dataField):e.removeTask(a.taskOrComment)}else e._endEdit();delete a.ok}a.openedFrom&&requestAnimationFrame((()=>{e.getRootNode().contains(a.openedFrom)&&a.openedFrom.focus&&a.openedFrom.focus(),delete a.openedFrom})),delete a.taskOrComment}_closeDialog(){const e=this;e._dialog&&e._dialog.close()}_getHistoryItemLabel(e){const t=this;let a;switch(e.action){case"created":a=t.localize("taskCreated");break;case"tags":a=t.localize("taskTagsChanged");break;case"description":a=t.localize("taskDescriptionChanged");break;case"progress":a=t.localize("taskProgressChanged");break;case"text":a=t.localize("taskNameChanged");break;case"color":a=t.localize("taskColorChanged");break;case"priority":a=t.localize("taskPriorityChanged");break;case"deadline":a=t.localize("taskDeadlineChanged");break;case"subtasks":a=t.localize("taskSubtasksChanged");break;case"user":a=e.details.value?t.localize("taskUserChanged"):t.localize("taskUserRemoved");break;case"moved":a=t.localize("taskMoved");break;case"status":a=t.localize("taskStatusChanged");break;default:a=t.localize("taskUpdated")}return a}_initEditPanel(){const e=this,t=e.id,a=e._dialog,s=a.$.container.querySelector(".edit"),l=[""].concat(e.users.map((e=>({label:e.name,value:e.id,color:e.color,image:e.image})))),o=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))),r=e._getPriority(),i=e.swimlanes.map((e=>({label:e.label,value:e.dataField}))),n=document.createElement("template"),d=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;n.innerHTML=`<div class="smart-kanban-sub-task"><span class="label">{{label}}</span><span class="remove-subtask" aria-label="Remove subtask" title="${e.localize("removeSubtask")}"></span></div>`,n.id=e.id+"ChecklistTemplate",a.$.container.appendChild(n),s.innerHTML=`\n <div tabindex="0" class="smart-kanban-tab-strip">\n <div tabindex="0" view="details" class="selected smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("detailsTab")}</div></div>\n <div tabindex="0" view="subtasks" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("subtasksTab")}</div></div>\n <div tabindex="0" view="comments" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("commentsTab")}</div></div>\n <div tabindex="0" view="history" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("historyTab")}</div></div>\n <div tabindex="0" view="fields" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("fieldsTab")}</div></div>\n </div>\n <div class="smart-kanban-tab-content details">\n <div class="layout">\n <div class="column">\n <div id="${t}LabelText" class="editor-label">${e.localize("text")}</div>\n <smart-input class="editor text-editor" aria-labelledby="${t}LabelText"></smart-input>\n <div id="${t}LabelDescription" class="editor-label">${e.localize("description")}</div>\n <textarea class="editor description-editor" aria-labelledby="${t}LabelDescription"></textarea> \n <div id="${t}LabelStatus" class="editor-label">${e.localize("status")}</div>\n <smart-multi-combo-input single-select pills color-items class="editor status-editor" drop-down-open-position="auto" data-source='${JSON.stringify(o)}' drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelStatus"></smart-multi-combo-input>\n <div id="${t}LabelSwimlane" class="editor-label swimlane-label">${e.localize("swimlane")}</div>\n <smart-input class="editor swimlane-editor" drop-down-open-position="auto" data-source='${JSON.stringify(i)}'${0===i.length?" disabled":""} drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelSwimlane"></smart-input>\n </div>\n <div class="column">\n <div class="editor-container">\n <div id="${t}LabelAssignedTo" class="editor-label">${e.localize("assignedTo")}</div>\n <div id="${t}LabelProgress" class="editor-label">${e.localize("progress")}</div>\n <smart-multi-combo-input readonly pills class="editor asignee-editor" single-select data-source='${JSON.stringify(l)}'${0===l.length?" disabled":""} drop-down-button-position="right"${d} aria-labelledby="${t}LabelAssignedTo"></smart-multi-combo-input>\n <smart-numeric-text-box class="editor progress-editor" input-format="floatingPoint" min="0" max="100" show-unit unit="%"${d} aria-labelledby="${t}LabelProgress"></smart-numeric-text-box>\n </div>\n <div class="editor-container">\n <div id="${t}LabelStartDate" class="editor-label">${e.localize("startDate")}</div>\n <div id="${t}LabelDueDate" class="editor-label">${e.localize("dueDate")}</div>\n <smart-date-time-picker auto-close auto-open class="editor start-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelStartDate"></smart-date-time-picker>\n <smart-date-time-picker auto-close auto-open class="editor due-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelDueDate"></smart-date-time-picker>\n </div>\n <div class="editor-error-container smart-hidden" style="color: var(--smart-error);">\n <label id="${t}LabelRange">${e.localize("invalidRange",{start:e.localize("startDate"),end:e.localize("dueDate")})}</label>\n <br/> <br/>\n </div>\n <div class="editor-container">\n <div id="${t}LabelPriority" class="editor-label">${e.localize("priority")}</div>\n <div id="${t}LabelColor" class="editor-label">${e.localize("color")}</div>\n <div style="display: flex;"><span class="priority-editor-icon"></span><smart-input class="editor priority-editor" data-source='${JSON.stringify(r)}' drop-down-height="auto" drop-down-open-position="auto" drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelPriority"></smart-input></div>\n <smart-color-input value-display-mode="colorBox" class="editor color-editor" drop-down-open-position="auto" drop-down-button-position="right"${d} aria-labelledby="${t}LabelColor"></smart-color-input>\n </div>\n <div id="${t}LabelTags" class="editor-label">${e.localize("tags")}</div>\n <smart-multi-combo-input color-items readonly pills class="editor tags-editor" drop-down-button-position="right" drop-down-open-position="auto" ${d} aria-labelledby="${t}LabelTags"></smart-multi-combo-input>\n </div>\n </div>\n </div>\n <div class="smart-kanban-tab-content smart-hidden subtasks">\n <div id="${t}LabelChecklist" class="editor-label">${e.localize("checklist")}</div>\n <div class="new-container">\n <input type="text" class="new-subtask" placeholder="${e.localize("newSubtask")}" />\n <smart-button class="add primary" title="${e.localize("addSubtask")}" aria-label="Add subtask"${d}>+</smart-button>\n </div>\n <smart-list-box class="editor checklist-editor" item-template="${n.id}" selection-mode="checkBox"${d} aria-labelledby="${t}LabelChecklist"></smart-list-box>\n <br/>\n </div>\n <div class="smart-kanban-tab-content comments">\n </div>\n <div class="smart-kanban-tab-content smart-hidden history">\n <div class="editor-container">\n <div id="${t}LabelCreatedBy" class="editor-label">${e.localize("createdBy")}</div>\n <div id="${t}LabelCreatedByDate" class="editor-label">${e.localize("createdByDate")}</div>\n <div class="editor created" aria-labelledby="${t}LabelCreatedBy"></div>\n <div class="editor created-date" aria-labelledby="${t}LabelCreatedByDate"></div>\n </div>\n <div class="editor-container">\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedBy")}</div>\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedByDate")}</div>\n <div class="editor updated" aria-labelledby="${t}LabelUpdatedBy"></div>\n <div class="editor updated-date" aria-labelledby="${t}LabelUpdatedByDate"></div>\n </div>\n <div class="history-table smart-hidden editor-container">\n </div>\n </div>\n <div class="smart-kanban-tab-content fields">\n </div> \n<div class="template-container">\n</div>\n`,a.layout=s.querySelector(".layout"),a.editors={text:s.querySelector(".text-editor"),description:s.querySelector(".description-editor"),tags:s.querySelector(".tags-editor"),userId:s.querySelector(".asignee-editor"),status:s.querySelector(".status-editor"),swimlane:s.querySelector(".swimlane-editor"),swimlaneLabel:s.querySelector(".swimlane-label"),startDate:s.querySelector(".start-date-editor"),dueDate:s.querySelector(".due-date-editor"),progress:s.querySelector(".progress-editor"),priority:s.querySelector(".priority-editor"),priorityIcon:s.querySelector(".priority-editor-icon"),color:s.querySelector(".color-editor"),newSubtask:s.querySelector(".new-subtask"),checklist:s.querySelector(".checklist-editor"),template:s.querySelector(".template-container"),created:s.querySelector(".created"),createdDate:s.querySelector(".created-date"),updated:s.querySelector(".updated"),updatedDate:s.querySelector(".updated-date"),tabs:s.querySelector(".smart-kanban-tab-strip"),detailsTab:s.querySelector('[view="details"]'),commentsTab:s.querySelector('[view="comments"]'),subtasksTab:s.querySelector('[view="subtasks"]'),historyTab:s.querySelector('[view="history"]'),fieldsTab:s.querySelector('[view="fields"]')},a.labels={};for(let e in a.editors){const t=a.editors[e].getAttribute("aria-labelledby"),l=s.querySelector("#"+t);l&&(a.labels[e]=l)}a.tabs={all:a.editors.tabs,detail:a.editors.detailsTab,comments:a.editors.commentsTab,history:a.editors.historyTab,subtasks:a.editors.subtasksTab,fields:a.editors.fieldsTab};const c=()=>{a.editors.status.classList.contains("smart-hidden")&&a.editors.text.classList.contains("smart-hidden")&&a.editors.description.classList.contains("smart-hidden")?(a.editors.description.closest(".column").classList.add("smart-hidden"),a.editors.description.closest(".layout").classList.add("single-column")):e.dialogEditors&&3===e.dialogEditors.length&&e.dialogEditors.indexOf("text")>=0&&e.dialogEditors.indexOf("description")>=0&&e.dialogEditors.indexOf("status")>=0?a.editors.description.closest(".layout").classList.add("single-column"):(a.editors.description.closest(".column").classList.remove("smart-hidden"),a.editors.description.closest(".column").classList.remove("single-column"),a.editors.description.closest(".layout").classList.remove("single-column"))};a.showEditor=e=>{const t=e=>{if(e){const t=[...e.children];let a=0;for(let e=0;e<t.length;e++)t[e].classList.contains("smart-hidden")||a++;a===t.length&&e.classList.remove("single-column")}};a.editors[e]&&(a.editors[e].classList.remove("smart-hidden"),t(a.editors[e].closest(".editor-container"))),a.labels[e]&&(a.labels[e].classList.remove("smart-hidden"),t(a.labels[e].closest(".editor-container"))),"checklist"===e&&a.tabs.subtasks.classList.remove("smart-hidden"),c()},a.hideEditor=e=>{if(a.editors[e]){a.editors[e].classList.add("smart-hidden");const t=a.editors[e].closest(".editor-container");t&&t.classList.add("single-column")}a.labels[e]&&a.labels[e].classList.add("smart-hidden"),"checklist"===e&&a.tabs.subtasks.classList.add("smart-hidden"),c()};const u=a.editors.tabs.querySelectorAll(".smart-kanban-tab");a.selectTab=e=>{if(u[e]&&!u[e].classList.contains("smart-hidden")&&u[e].click(),0===e){const e=[...a.tabs.all.children];for(let t=0;t<e.length;t++)if(e[t]&&!e[t].classList.contains("smart-hidden")){e[t].click();break}}},a.refreshTabs=t=>{const s=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.comments]:0,l=s&&s.length?'<span class="summary"> ('+s.length+")</span>":"";let o=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.checklist]:0,r=o&&o.length?'<span class="summary"> ('+o.length+")</span>":"";t||(o=a.editors.checklist.items.length,o&&(r=o?'<span class="summary"> ('+o+")</span>":"")),a.editors.commentsTab.innerHTML=`${e.localize("commentsTab")}${l}`,a.editors.subtasksTab.innerHTML=`${e.localize("subtasksTab")}${r}`,e._currentUser.allowComment&&a.taskOrComment?a.editors.commentsTab.classList.remove("smart-hidden"):a.editors.commentsTab.classList.add("smart-hidden"),e.readonly&&!o?a.editors.subtasksTab.classList.add("smart-hidden"):a.editors.checklist.classList.contains("smart-hidden")||a.editors.subtasksTab.classList.remove("smart-hidden"),e.taskCustomFields.length>0?a.editors.fieldsTab.classList.remove("smart-hidden"):a.editors.fieldsTab.classList.add("smart-hidden"),a.taskOrComment&&(a.taskOrComment.data[e.dataSourceMap.updatedDate]||a.taskOrComment.data[e.dataSourceMap.createdDate])?a.editors.historyTab.classList.remove("smart-hidden"):a.editors.historyTab.classList.add("smart-hidden");const i=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];let n=0;for(let e=0;e<i.length;e++){const t=i[e];a.editors[t].classList.contains("smart-hidden")&&n++}n===i.length?a.tabs.detail.classList.add("smart-hidden"):a.tabs.detail.classList.remove("smart-hidden")},a.refreshFields=()=>{const t=a.querySelector(".fields"),s=a.taskOrComment?a.taskOrComment.data:{},l=e.taskCustomFields.length,o=a.querySelectorAll(["[container-for]"]).length;if(e._resetFields&&(delete e._resetFields,a.refreshFieldsDirty=!0,t.innerHTML=""),!0===a.refreshFieldsDirty)if(a.refreshFieldsDirty=!1,t.firstElementChild&&l<=o)for(let t=0;t<e.taskCustomFields.length;t++){const l=e.taskCustomFields[t];let o=s[l.dataField];const r=a.querySelector("[container-for="+l.dataField+"]");if(!r)continue;e.dataSourceMap[l.dataField]?r.classList.add("smart-hidden"):r.classList.remove("smart-hidden"),null==o&&(o="");const i=r.lastElementChild.firstElementChild;i.removeAttribute("dirty"),o&&o instanceof Date&&"dateInput"===l.editor?i.value=o:i.value=""+o}else{const a=document.createDocumentFragment(),l=(t,a,s)=>{null==a&&(a="");const l=document.createElement("div"),o=document.createElement("div"),r=document.createElement("div");void 0===s.visible&&(s.visible=!0),void 0===s.allowHide&&(s.allowHide=!0),s.allowHide?o.innerHTML=t+'<span class="icon"></span>':o.innerHTML=t,o.classList.add("editor-label"),s.allowHide&&(!1===s.visible&&o.lastElementChild.classList.add("hide"),o.lastElementChild.onpointerdown=()=>{s.visible=!s.visible,o.lastElementChild.classList.toggle("hide")}),r.classList.add("editor");let i=document.createElement("input");if(i.classList.add("smart-input"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength),"textarea"===s.editor)i=document.createElement("smart-text-area"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength);else if("password"===s.editor)i.type="password";else if("phone"===s.editor||"tel"===s.editor)Smart.PhoneInput?i=document.createElement("smart-phone-input"):i.type="tel";else if("url"===s.editor)i.type="url";else if("email"===s.editor)i.type="email";else if("date"===s.dataType||"dateInput"===s.editor)i=document.createElement("smart-date-input"),i.autoClose=!0,""===a&&(a=new Date),void 0!==s.minDate&&(i.min=s.minDate),void 0!==s.maxDate&&(i.max=s.maxDate);else if("boolean"===s.dataType)i=document.createElement("smart-check-box"),""===a&&(a=!1);else if("number"===s.dataType||"numberInput"===s.editor)i=document.createElement("smart-number-input"),a||(a=0),void 0!==s.min&&(i.min=s.min),void 0!==s.max&&(i.max=s.max);else if("string"===s.dataType&&s.options)i=document.createElement("smart-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.options;else if("string"===s.dataType&&"multiComboInput"===s.editor)i=document.createElement("smart-multi-combo-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.dataSource,i.pills=!0,i.selectedValues=[""+a],s.singleSelect&&(i.singleSelect=!0),s.colorItems&&(i.colorItems=!0);else if("string"===s.dataType&&("image"===s.editor||"images"===s.editor)&&a.length>50)if(a.indexOf("base64")>=0){a=JSON.parse(a),window.Smart._createSmartImageModal=e._createImageModal;let t="";for(let e=0;e<a.length;e++){const s=a[e];t+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" width="20" height="20" src="${s.value}" title="${s.label}"/>`}i=document.createElement("div"),i.innerHTML=t}else a=a.substring(0,50)+"...";return i.setAttribute("data-field",s.dataField),i.classList.add("smart-kanban-task-field-editor"),i.value=""+a,i.onchange=()=>{i.setAttribute("dirty","")},r.appendChild(i),l.appendChild(o),l.appendChild(r),l.setAttribute("container-for",s.dataField),l},o=document.createElement("div");o.classList.add("editor-container"),a.appendChild(o);for(let t=0;t<e.taskCustomFields.length;t++){const a=e.taskCustomFields[t],r=l(a.label,s[a.dataField],a);o.appendChild(r),e.dataSourceMap[a.dataField]&&r.classList.add("smart-hidden")}t.innerHTML="",t.appendChild(a)}},a.refreshHistory=()=>{const t=a.querySelector(".history-table");if(!e.storeHistory)return void t.classList.add("smart-hidden");t.classList.remove("smart-hidden");const s=a.taskOrComment.data.history;let l=`<table><tr>\n <th>${e.localize("historyEvent")}</th>\n <th>${e.localize("historyAuthor")}</th>\n <th>${e.localize("historyDetails")}</th>\n <th>${e.localize("historyDate")}</th>\n </tr>\n `;for(let t=s.length-1;t>=0;t--){const a=s[t];if(l+=`<tr>\n <td>${e._getHistoryItemLabel(a)}</td>`,void 0!==a.user){const t=(t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser")}})(e.users.find((e=>e.id===a.user)));l+=`<td><div class="smart-kanban-task-user-history"><div class="icon smart-kanban-task-user" style="${t.image}"></div><div class="name">${t.label}</div></div></td>`}else l+="<td></td>";if("created"!==a.action){let t=a.details.oldValue,s=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t)),l=e.users.find((e=>e.id===s));t=a?a.name:e.localize("unassigned"),s=l?l.name:e.localize("unassigned")}if(t&&t instanceof Date&&(t=t.toLocaleString()),s&&s instanceof Date&&(s=s.toLocaleString()),"subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));l+=`<td><span class="smart-truncate">${e.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span></td>`}else l+=t?`<td><span class="smart-truncate">${e.localize("range",{oldValue:t,newValue:s})}</span></td>`:`<td><span class="smart-truncate">${e.localize("nullRange",{oldValue:t,newValue:s})}</span></td>`}else l+=`<td>${a.details.value}</td>`;l+=`\n <td>${a.date.toLocaleString()}</td>\n </tr>`}l+="</table>",t.innerHTML=l,a.refreshTabs()},a.refreshComments=()=>{if(!a.taskOrComment)return;const t=a.querySelector(".comments");t.classList.remove("smart-hidden");const s=e._getCommentsList(a.taskOrComment);s.classList.remove("dialog");const l=s.querySelector(".send");l&&(l.onclick=t=>{if(l.disabled)return;const s=JSON.parse(JSON.stringify(e._commentSelectionFor.data)),o=e._createComment();e._commentsList.textarea.value="",l.disabled=!0,a.refreshTabs();const r=JSON.parse(JSON.stringify(e._commentSelectionFor.data));e.$.fireEvent("change",{task:e._commentSelectionFor,id:r.id,value:r,oldValue:s}),e.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:s}),e.$.fireEvent("commentAdd",{id:r.id,value:o}),t.stopPropagation(),t.preventDefault()}),t.innerHTML="",t.appendChild(s),a.refreshTabs()},u.forEach((e=>{e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus")},e.onkeydown=t=>{"Enter"===t.key&&(e.click(),t.stopPropagation())},e.onclick=e=>{const t=e.target.closest(".smart-kanban-tab"),s=t.getAttribute("view");switch(u.forEach((e=>{e.classList.remove("selected")})),t.focus(),t.classList.add("selected"),a.querySelectorAll(".smart-kanban-tab-content").forEach((e=>{e.classList.add("smart-hidden")})),s){case"details":a.querySelector(".details").classList.remove("smart-hidden");break;case"subtasks":a.querySelector(".subtasks").classList.remove("smart-hidden");break;case"comments":a.refreshComments();break;case"history":a.querySelector(".history").classList.remove("smart-hidden"),a.refreshHistory();break;case"fields":a.querySelector(".fields").classList.remove("smart-hidden"),a.refreshFields()}}})),(()=>{const e=a.editors.color;e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.dropDownWidth=50;const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input"),e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")}})(),a.editors.newSubtask.onchange=()=>{a.editors.newSubtask.nextElementSibling.click()},a.editors.priority.onchange=()=>{e._setPriorityEditorIcon(!0)},e._setPriorityEditorIcon(),a.editPanelPopulated=!0,e.dialogRendered&&e.dialogRendered(a,a.editors,a.labels,a.tabs,a.layout,a.taskOrComment)}_setPriorityEditorIcon(e){const t=this,a=t._dialog;let s=a.editors.priority.selectedValues[0];e||a.taskOrComment&&a.taskOrComment.data&&void 0!==a.taskOrComment.data.priority&&(s=a.taskOrComment.data.priority);const l=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let e=0;e<t.priority.length;e++){const o=t.priority[e];if(o.value===s){a.editors.priorityIcon.innerHTML='<div class="smart-kanban-task-text">'+l(o)+"</div>";break}}}_showHideDialogEditors(){const e=this,t=e._dialog,a=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];for(let s=0;s<a.length;s++){const l=a[s];e.dialogEditors.indexOf(l)>=0?t.showEditor(l):t.hideEditor(l)}const s=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})));s.length<=1&&t.hideEditor("status"),t.editors.status.dataSource=s,0===e.users.length&&t.hideEditor("userId")}_unescapeValue(e){if(null==e)return e;const t=[{regex:"&",entity:"&"},{regex:">",entity:">"},{regex:"<",entity:"<"},{regex:'"',entity:"""},{regex:"'",entity:"'"},{regex:"=",entity:"="},{regex:"/",entity:"/"},{regex:"`",entity:"`"}];let a;for(let s in t)a=new RegExp(t[s].entity,"g"),e=e.replace(a,t[s].regex);return e}_escapeValue(e){return e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}_beginEdit(e){const t=this,a=t.dataSourceMap,s=e.data,l=t._dialog,o=l.editors,r=t.tags.length>0?t.tags:t._customTags,i=t._allColumns.find((e=>e.dataField===s[a.status]));if(l.label=t.localize("editTask",{taskId:s[a.id],text:s[a.text]}),o.text.value=t._unescapeValue(s[a.text]),o.description.value=t._unescapeValue(s[a.description]),o.tags.dataSource=r,t._showHideDialogEditors(),t.allowCustomTags,s[a.tags]){const e=e=>{let a=[];e.indexOf(",")>=0?a=e.split(","):Array.isArray(e)?a=a.concat(e):a.push(e);const s=[];for(let e=0;e<a.length;e++)"string"==typeof a[e]?(a[e]=t._unescapeValue(a[e].trim()),s.push(a[e])):(a[e].label=t._unescapeValue(a[e].label),s.push(a[e].value));return s};if(!t.allowCustomTags){const l=t.tags.length>0?t.tags:e(s[a.tags]);o.tags.dataSource=l}o.tags.selectedValues=e(s[a.tags])}else o.tags.selectedValues=[];l.editors.created.parentElement.classList.add("smart-hidden"),l.editors.updated.parentElement.classList.add("smart-hidden");const n=void 0!==s[a.createdUserId]?t.users.find((e=>e.id===s[a.createdUserId])):"",d=s[a.createdDate],c=void 0!==s[a.updatedUserId]?t.users.find((e=>e.id===s[a.updatedUserId])):"",u=s[a.updatedDate],m=e=>{const a=e?e.image:null;return{image:a?`background-image: url('${a}');`:"",label:e?e.name||e.id:t.localize("guestUser")}};if(n){const e=m(n);l.editors.created.parentElement.classList.remove("smart-hidden"),l.editors.created.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,d&&(l.editors.createdDate.innerHTML=d.toLocaleString())}if(c){const e=m(c);l.editors.updated.parentElement.classList.remove("smart-hidden"),l.editors.updated.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,u&&(l.editors.updatedDate.innerHTML=u.toLocaleString())}const p=null!==s[a.userId]?t.users.find((e=>e.id===s[a.userId])):"";p?o.userId.selectedItems=[{label:p.name,value:p.id,image:p.image?p.image:null}]:o.userId.value="",delete o.userId.$.input.dataValue,o.status.selectedValues=[i.dataField],t.readonly||!t._currentUser.allowEdit?(o.status.readonly=!1,o.priority.readonly=!1):(o.status.readonly=!0,o.priority.readonly=!0),delete o.status.$.input.dataValue,t._hasSwimlane(t.columns.indexOf(i))?o.swimlane.value=t.swimlanes.find((e=>e.dataField===s[a.swimlane])).label:o.swimlane.value="",delete o.swimlane.$.input.dataValue,o.startDate.value=s[a.startDate]||null,o.dueDate.value=s[a.dueDate]||null,o.progress.value=parseFloat(s[a.progress])||0;const h=t.localize(s[a.priority]);o.priority.value=null!=h?h:"",delete o.priority.$.input.dataValue,o.color.value=s[a.color]||"";const g=[],b=[];(s[a.checklist]||[]).forEach(((e,t)=>{e.completed&&g.push(t),b.push({label:e.text,selected:!0===e.completed})})),0===t.swimlanes.length?(l.editors.swimlane.classList.add("smart-hidden"),l.editors.swimlaneLabel.classList.add("smart-hidden"),l.editors.swimlane.parentElement.classList.add("single-column")):(l.editors.swimlane.classList.remove("smart-hidden"),l.editors.swimlaneLabel.classList.remove("smart-hidden"),l.editors.swimlane.parentElement.classList.remove("single-column")),o.dueDate.onchange=o.startDate.onchange=()=>{o.startDate.value>=o.dueDate.value&&o.dueDate.value?(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")):(l.$.footer.firstElementChild.disabled=!1,l.querySelector(".editor-error-container").classList.add("smart-hidden"))},o.startDate.value&&o.startDate.value>=o.dueDate.value&&o.dueDate.value&&(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")),o.newSubtask.value="",o.checklist.dataSource=b,o.checklist.selectedIndexes=g,t._setPriorityEditorIcon(),l.refreshTabs(!0),l.selectTab(0)}_endEdit(){const e=this,t=e.dataSourceMap,a=e._dialog,s=a.editors,l=a.taskOrComment,o=l?l.data:void 0,r=Object.assign({},o);let i=s.startDate.value,n=s.dueDate.value;r[t.text]=e._escapeValue(s.text.value),r[t.description]=e._escapeValue(s.description.value);const d=[];for(let t=0;t<s.tags.dataSource.length;t++){const a=s.tags.dataSource[t];"string"==typeof a?s.tags.selectedValues.indexOf(a)>=0&&d.push(e._escapeValue(a)):s.tags.selectedValues.indexOf(a.value)>=0&&(a.label=e._escapeValue(a.label),d.push(a))}if(r[t.tags]=d,r[t.progress]=parseFloat(s.progress.value),r[t.color]=s.color.value,e._currentUser.info&&(r[t.updatedUserId]=e._currentUser.info.id,r[t.updatedDate]=new Date),r[t.color]||""===r[t.color]||delete r[t.color],void 0!==s.userId.$.input.dataValue&&(r[t.userId]=parseFloat(s.userId.$.input.dataValue)),void 0!==s.status.$.input.dataValue&&(r[t.status]=s.status.$.input.dataValue),s.swimlane.$.input.dataValue&&(r[t.swimlane]=s.swimlane.$.input.dataValue),i&&(i=i.toDate()),n&&(n=n.toDate()),r[t.startDate]=i,r[t.dueDate]=n,void 0!==s.priority.$.input.dataValue&&(r[t.priority]=s.priority.$.input.dataValue),r[t.checklist]=s.checklist.items.map((e=>({text:e.label,completed:e.selected}))),e.taskCustomFields&&e.taskCustomFields.length>0)for(let t=0;t<e.taskCustomFields.length;t++){const s=e.taskCustomFields[t],l=a.querySelector("[data-field="+s.dataField+"]");if(l){let t=l.value;l.dataSource&&l.dataSource.length>0&&l.selectedValues.length>0&&(t=l.selectedValues.toString()),"smart-number-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),(l.hasAttribute("dirty")||e.dialogCustomizationFunction)&&(r[s.dataField]=t)}}l?e.updateTask(l,r):e.addTask(r),s.tags.close()}_clearEditors(){const e=this,t=e._dialog.editors,a=e.tags.length>0?e.tags:e._customTags;t.text.value="",t.description.value="",t.tags.dataSource=a,t.tags.selectedValues=[],t.status.selectedValues=[],delete t.status.$.input.dataValue,t.swimlane.value="",delete t.swimlane.$.input.dataValue,t.userId.value="",delete t.userId.$.input.dataValue,t.progress.value=0,t.startDate.value=null,t.dueDate.value=null,t.priority.value=e.localize("average"),t.priority.$.input.dataValue="average",t.color.value="",t.newSubtask.value="",t.created.innerHTML="",t.updated.innerHTML="",t.createdDate.innerHTML="",t.updatedDate.innerHTML="",t.checklist.dataSource=[],t.checklist.selectedIndexes=[]}_getCurrentUser(){const e=this,t=e.users;let a=e.currentUser,s=!0,l=!0,o=e.allowDrag,r=e.editable,i=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(s=!1!==a.allowAdd,l=!1!==a.allowComment,o=o&&!1!==a.allowDrag,r=r&&!1!==a.allowEdit,i=!1!==a.allowRemove)),e._currentUser={allowAdd:s,allowComment:l,allowDrag:o,allowEdit:r,allowRemove:i,info:a}}_autoSaveState(e){const t=this;if(t.autoSaveState)if("object"!=typeof e)if(e&&t._autoSavedState){switch(e){case"collapsed":t._allColumns.forEach((e=>t._autoSavedState.collapsed[e.dataField]=e.collapsed));break;case"dataSource":t._autoSavedState.dataSource=t._getCurrentDataSource();break;case"filtering":t._autoSavedState.filtering=t._appliedFiltering;break;case"selection":{const e=t.dataSourceMap;let a=null,s=null;t._selectionInView&&(a=t._selectionInView.closest(".smart-kanban-column").column.dataField,s=t._selectionInView.getAttribute("swimlane")),t._autoSavedState.selection={selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart.data[e.id]:null,selectionInColumn:a,swimlane:s};break}case"sorting":t._autoSaveState.sorting=t._appliedSorting;break;case"tabs":t._autoSaveState.tabs=t._selectedTabs;break;case"visibility":t._autoSavedState.visibility={taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}}window.localStorage.setItem("smartKanban"+t.id,JSON.stringify(t._autoSavedState))}else t._autoSavedState=t.saveState();else t._autoSavedState=e}_getCurrentDataFields(e){const t=this,a=[{name:"text",dataType:"string"},{name:"tags",dataType:"string"},{name:"priority",dataType:"string"},{name:"progress",dataType:"number"},{name:"startDate",dataType:"date"},{name:"dueDate",dataType:"date"},{name:"userId",dataType:"string"}],s=e&&e.length>0?e[0]:null;for(let e=0;e<t.taskCustomFields.length;e++)if(s){const l=typeof s[t.taskCustomFields[e].dataField];"number"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"number"}):"date"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"date"}):a.push({name:t.taskCustomFields[e].dataField,dataType:"string"})}else a.push({name:t.taskCustomFields[e].dataField,dataType:"string"});return a}_applyFilter(e,t){const a=this;if(a.dataSource&&a.dataSource.virtualDataSource)return a._requestVirtualDataSource("filter"),void a._autoSaveState("filtering");const s=a._getCurrentDataSource(),l=a._getCurrentDataFields(s),o=new Smart.DataAdapter({dataSource:s,dataFields:l,id:"id"});try{o._filter(e,t)}catch(e){return}if(a.virtualization){if(e&&e.length>0){const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered;let l=a._getTasksByDataField(s),r=[];for(let e=0;e<l.length;e++){const t=l[e],a=o.dataItemById[t.id];a&&a.$.filtered&&r.push(t)}a.tasksByDataField[s]._filtered=r}}else{const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered}}a._refreshColumns()}else{const e=Array.from(a.$.container.getElementsByClassName("smart-kanban-task"));for(let t=0;t<o.length;t++){const a=e[t],s=!o[t].$.filtered;a.classList.toggle("smart-hidden",s),a.filteredOut=s}a._allColumns.forEach((e=>a._refreshScrollViewer(e)))}a._autoSaveState("filtering")}_applyHandler(e,t){const a=this,s=a.isInShadowDOM||a.shadowRoot?e.composedPath()[0]:e.target,l=e.detail;a.$.customize.contains(s)||"customize"===t?(l.value.forEach((e=>a[e.dataField]=e.visible)),a._allColumns.forEach((e=>a._refreshScrollViewer(e))),a.virtualization&&(delete a._autoCardHeight,a._measureCardHeight(),a._refreshColumns()),a._autoSaveState("visibility")):a.$.filter.contains(s)||"filter"===t?a.addFilter(l.filters,l.operator,l.value):(a.$.sort.contains(s)||"sort"===t)&&a.addSort(l.sortByInfo),a.closePanel()}_applySort(){const e=this,t=e._appliedSorting;if(e._autoSaveState("sorting"),e.dataSource&&e.dataSource.virtualDataSource)e._requestVirtualDataSource("sort");else if(0!==t.dataFields.length)e._allColumns.forEach((a=>{const s=e._columnToElement.get(a).querySelector(".smart-scroll-viewer-content-container"),l=Array.from(s.children),o=[];if(l.length<2)return;let r;if(e.virtualization?e.tasksByDataField[a.dataField].forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t);"low"===l[s.priority]&&(l[s.priority]="z"),o.push(l)})):l.forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t.data);"low"===l[s.priority]&&(l[s.priority]="z"),o.push(l)})),e.taskCustomFields.length){const t=e._getCurrentDataFields(o);t.push({name:"taskIndex",dataType:"number"}),r=new Smart.DataAdapter({dataSource:o,observable:!1,dataFields:t,id:"id"})}else r=new Smart.DataAdapter({dataSource:o,observable:!1,dataFields:["taskIndex: number","text: string","tags: string","priority: string","progress: number","startDate: date","dueDate: date","userId: string"],id:"id"});if(r.sortBy(t.dataFields,t.dataTypes,t.orderBy),e.virtualization){if(e.tasksByDataField[a.dataField]._sorted=Smart.DataAdapter.Sort(e.tasksByDataField[a.dataField],t.dataFields,t.orderBy),e.tasksByDataField[a.dataField]._filtered){e.tasksByDataField[a.dataField]._originalFilteredData=JSON.parse(JSON.stringify(e.tasksByDataField[a.dataField]._filtered));const s=Smart.DataAdapter.Sort([...e.tasksByDataField[a.dataField]._filtered],t.dataFields,t.orderBy);e.tasksByDataField[a.dataField]._filtered=s||[]}e._refreshColumn(a.dataField)}else for(let e=0;e<r.length;e++)s.appendChild(l[r[e].taskIndex])}));else if(e.virtualization){const t=Object.keys(e.tasksByDataField);for(let a=0;a<t.length;a++){const s=t[a];delete e.tasksByDataField[s]._sorted,e.tasksByDataField[s]._filtered&&e.tasksByDataField[s]._originalFilteredData&&(e.tasksByDataField[s]._filtered=e.tasksByDataField[s]._originalFilteredData,delete e.tasksByDataField[s]._originalFilteredData),e._refreshColumn(s)}}}_closeSearchPanel(){const e=this;e._searchInfo&&(Array.from(e.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),delete e._searchInfo)}_constructFilterGroups(e){const t={text:"string",tags:"string",priority:"string",progress:"number",startDate:"date",dueDate:"date"},a={},s=[];e.filters.forEach((s=>{const l=s[0],o=t[l];let r=s[2],i=a[l];void 0===i&&(i=new Smart.Utilities.FilterGroup,a[l]=i),"date"===o&&"string"==typeof r&&(r=new Date(r));const n=i.createFilter(o,r,s[1]);i.addFilter(e.operator,n)}));for(let e in a)s.push([e,a[e]]);return s}_openSearchPanel(){const e=this;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._searchInfo={source:e._getCurrentDataSource(),stringDataFields:["text","tags"]},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(a._searchInfo.query=e,Array.from(a.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,void delete a._searchInfo.highlighted;const s=new Smart.DataAdapter({dataSource:a._searchInfo.source,dataFields:["text: string","tags: string"],id:"id"}),l=[],o=[],r={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,s=a.createFilter("string",e,"CONTAINS");a.addFilter("or",s),l.push([t,a])})),s._filter(l,"or");for(let e=0;e<s.length;e++){const t=s[e];!1!==t.$.filtered&&(o.push(t.$.id),r[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=o,a._searchInfo.foundIdsObject=r,Array.from(a.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>{const s=e.data[a.dataSourceMap.id];if(r[s]){if(e.filteredOut)return o.splice(o.indexOf(s),1),void delete r[s];t&&o[0]===s&&e.classList.add("smart-data-view-highlighted"),e.classList.add("smart-data-view-found")}})),o.length>0){if(t){let e=o[0];a._searchInfo.highlighted=e,a.ensureVisible(e)}return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),void(a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:o.length}))}a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_bodyFocusinHandler(e){const t=this;let a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.classList.contains("smart-kanban-column-content-tasks")&&(a=a.$.content,!t._getSelectedItem(a,!0))){if(t.virtualization){const e=t._focusedTask;return void t.focusTask(e)}if(void 0!==t._focusedTask)return void t.focusTask(t._focusedTask);t._focusTask(t._getFirstItem(a))}}get _rtlAttr(){return this.rightToLeft?" right-to-left":""}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}_appendAddNewColumn(e){const t=document.createElement("div");t.classList.add("smart-kanban-column","smart-kanban-add-new-column","smart-unselectable"),t.innerHTML=`<div class="smart-kanban-column-header smart-unselectable" > <div title="${this.localize("addNewColumn")}" class="smart-kanban-add-new-column-label smart-kanban-column-header-label"><span>+ ${this.localize("addNewStatus")}</span></div></div >\n <div class="smart-kanban-column-content no-sub-columns"><smart-scroll-viewer></smart-scroll-viewer></div>\n `,this.disabled||this.unfocusable||t.setAttribute("tabindex",0),t.column={dataField:"newStatus",label:"New Status"},e.appendChild(t)}selectTask(e){const t=this;t._selectedTasks.push(e),t._selectionStart=e,t._focusedTask=e,t._refreshSelection(),t.ensureVisible(e)}unselectTask(e){const t=this,a=t._selectedTasks.indexOf(e);a>=0&&t._selectedTasks.splice(a,1),t._refreshSelection()}clearSelection(){const e=this;e._selectionStart=null,e._selectedTasks=[],e._refreshSelection()}getSelectedTasks(){return this._selectedTasks||(this._selectedTasks=[]),this._selectedTasks}getTask(e){return this.dataSource?this.dataSource.find((t=>{if(t.id===e)return t})):null}getColumn(e){const t=this;let a=null;for(let s=0;s<t.columns.length;s++)if(t.columns[s].dataField===e){a=t.columns[s];break}return a}getColumnDataItems(e){const t=this;let a=[];if(!t.getColumn(e)||!t.dataSource)return[];for(let s=0;s<t.dataSource.length;s++){const l=t.dataSource[s];l[t.dataSourceMap.status]===e&&a.push(l)}return a}updateColumn(e,t){const a=this;let s=null;for(let t=0;t<a.columns.length;t++)if(a.columns[t].dataField===e){s=a.columns[t];break}if(s){const e=s.label;void 0!==t.label&&(s.label=t.label),void 0!==t.collapsed&&(s.collapsed=t.collapsed),void 0!==t.collapsible&&(s.collapsible=t.collapsible),void 0!==t.orientation&&(s.orientation=t.orientation),void 0!==t.width&&(s.width=t.width),a._reset(),a.$.fireEvent("columnUpdate",{columnData:t,oldValue:e,value:s.label})}}addColumn(e){const t=this;e?(t.columns.push(e),t._reset(),t._createAddNewButton(),t.$.fireEvent("columnAdd",{columnData:e})):t._addNewColumnDynamically()}removeColumn(e){const t=this;let a=null,s=-1;for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){a=t.columns[l],s=l;break}if(a&&t.columns.splice(s,1),t.dataSource)for(let a=0;a<t.dataSource.length;a++){const s=t.dataSource[a];if(s[t.dataSourceMap.status]===e){const e=JSON.parse(JSON.stringify(s));s[t.dataSourceMap.status]=t.columns[0].value;const a=JSON.parse(JSON.stringify(s));t.$.fireEvent("change",{task:s,id:a.id,value:a,oldValue:e}),t.$.fireEvent("taskUpdate",{id:a.id,value:a,oldValue:e})}}t._reset(),t._createAddNewButton(),t.$.fireEvent("columnRemove",{column:a})}_addNewColumnDynamically(){const e=this,t=e._dialog,a=Math.floor(9e4*Math.random()+1e4),s={label:e.localize("addNewStatus")+" "+a,dataField:"newStatus"+a,addNewButton:!0,collapsed:!1,collapsible:!0,orientation:"vertical"},l=e.$.body.querySelector(".smart-kanban-add-new-column").querySelector(".smart-kanban-add-new-column-label"),o=document.createElement("input");if(l.classList.add("pending"),l.appendChild(o),o.classList.add("smart-kanban-column-header-input"),e.columnColors){l.classList.add("colors");const t=e._getColorInput();l.appendChild(t)}function r(a){let r=o.value,i=l.querySelector("smart-color-input");i&&i.opened?e._columnAddTimer&&clearTimeout(e._columnAddTimer):(!1===/^\s*$/.test(r)?(r=r.trim(),s.label=r,s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)):""===r&&(r="",s.label="",s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),l.classList.contains("pending")&&(e._columnAddTimer&&clearTimeout(e._columnAddTimer),e._columnAddTimer=setTimeout((()=>{if(l.classList.remove("pending"),o.parentNode&&o.parentNode.removeChild(o),i){s.color=i.value;const e=l.querySelector(".heading");if(e){const t=new Smart.Color(s.color).getInvertedColor();e.style.backgroundColor=s.color,e.style.color=t}i.remove()}e.columns.push(s),e._reset(),e._createAddNewButton(),t&&t.editPanelPopulated&&(t.editors.status.dataSource=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})))),e.$.fireEvent("columnAdd",{newColumn:s}),delete e._columnAddTimer}),50),a.stopPropagation()))}o.focus(),o.onkeydown=e=>{"Escape"===e.key?(l.classList.remove("pending"),o&&o.parentElement&&(o.nextElementSibling&&"Smart-COLOR-INPUT"===o.nextElementSibling.nodeName&&o.nextElementSibling.remove(),o.parentElement.removeChild(o),e.stopPropagation(),e.preventDefault())):"Enter"===e.key&&r(e)},o.addEventListener("blur",r),o.addEventListener("change",r)}_handleColumnEditing(e){const t=this,a=t.columns.find((t=>t.dataField===e));if(t._columnEditing)return;const s=Array.from(t.$.body.getElementsByClassName("smart-kanban-column")).find((t=>t.column.dataField===e)).querySelector(".smart-kanban-column-header-label"),l=document.createElement("input");s.classList.add("pending"),s.appendChild(l);const o=a.label,r=a.color;if(l.value=a.label,l.classList.add("smart-kanban-column-header-input"),t.columnColors){s.classList.add("colors");const e=t._getColorInput();e.value=a.color||"transparent",s.appendChild(e)}function i(e){let i=l.value,n=s.querySelector("smart-color-input");if(!n||!n.opened){if(!1===/^\s*$/.test(i)?(i=i.trim(),a.label=i,s.querySelector(".smart-kanban-title").innerHTML=i):""===i&&(a.label="",s.querySelector(".smart-kanban-title").innerHTML=" "),n){a.color=n.value;const e=s.querySelector(".heading");if(e){const t=new Smart.Color(a.color).getInvertedColor();""===a.color?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=a.color,e.style.color=t)}t.applyColumnColorToTasks&&s.closest(".smart-kanban-column").style.setProperty("--smart-primary",a.color),n.remove()}s.classList.remove("pending");try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditTimer&&clearTimeout(t._columnEditTimer),t._columnEditing=!1,t._columnEditTimer=setTimeout((()=>{o===a.label&&r===a.color||t.$.fireEvent("columnUpdate",{column:a,oldValue:o,value:a.label}),delete t._columnEditTimer}),50),e.stopPropagation()}}t._columnEditing=!0,setTimeout((()=>{l.focus()}),50),l.onkeydown=e=>{if("Escape"===e.key){s.classList.remove("pending"),l.value=o;try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditing=!1}else"Enter"===e.key&&i(e)},l.addEventListener("blur",i),l.addEventListener("change",i)}_validateDataSourceMap(){this.dataSourceMap=Object.assign({},{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",userId:"userId"},this.dataSourceMap)}});
|
|
125
|
+
Smart("smart-kanban",class extends Smart.DataView{static get properties(){return{addNewButton:{value:!1,type:"boolean"},addNewButtonDisplayMode:{value:"top",allowedValues:["top","bottom","both"],type:"string"},addNewColumn:{value:!1,type:"boolean"},autoColumnHeight:{value:!1,type:"boolean"},applyColumnColorToTasks:{value:!1,type:"boolean"},addNewColumnWidth:{value:null,type:"any"},allowColumnEdit:{value:!1,type:"boolean"},allowColumnHide:{value:!0,type:"boolean"},allowColumnRemove:{value:!1,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowCustomTags:{value:!0,type:"boolean"},allowDrag:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDrop:{value:!0,type:"boolean",defaultReflectToAttribute:!0},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},cardHeight:{value:null,type:"number?"},currentUser:{value:null,type:"any"},columnColorEntireSurface:{value:!1,type:"boolean"},columnFooter:{value:!1,type:"boolean"},columnActions:{value:!1,type:"boolean"},columnColors:{value:!1,type:"boolean"},columnWidth:{value:null,type:"any"},columnSummary:{value:!1,type:"boolean"},columnEditMode:{value:"headerAndMenu",allowedValues:["header","menu","headerAndMenu"],type:"string"},columnHeaderTemplate:{value:null,type:"any"},disableDialog:{value:!1,type:"boolean"},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},editable:{value:!1,type:"boolean"},dragOffset:{value:"auto",type:"any"},formatStringDate:{value:"d",type:"string"},formatStringTime:{value:"MMM d, HH:mm",type:"string"},hierarchy:{value:"columns",allowedValues:["columns","tabs"],type:"string"},messages:{value:{en:{actionsIcon:"Actions icon",actionsList:"Open actions list",unassignedTask:"Unassigned task",unassigned:"unassigned",assignedTask:"Assigned to {{userName}}",addNewStatus:"New status",addNewColumn:"Add new status",addNewTask:"Add new task",addSubtask:"Add subtask",assignedTo:"Assigned to",createdBy:"Created by",updatedBy:"Updated by",createdByDate:"Created",updatedByDate:"Updated",checklist:"Sub tasks",color:"Color",commentsIcon:"Comments icon",copy:"Copy",customize:"Customize tasks",customizeColumn:"Customize column",dueDate:"Due date",days:"days",edit:"Edit",editTask:"ID: {{taskId}} {{text}}",expand:"Expand column",collapse:"Collapse column",high:"High",low:"Low",critical:"Critical",newComment:"New comment",newSubtask:"New subtask",overdue:"Overdue",average:"Average",priority:"Priority",priorityIcon:"Priority icon",progress:"Progress",promptComment:"Are you sure you want to remove this comment?",promptTask:'Are you sure you want to remove the task "{{taskText}}"?',promptColumn:"Are you sure you want to remove this column?",remove:"Remove",removeSubtask:"Remove subtask",removeColumn:"Remove column",hideColumn:"Hide column",removeComment:"Remove comment",removeTask:"Remove task",showAllColumns:"Show all columns",send:"Send",startDate:"Start date",status:"Status",swimlane:"Swimlane",tags:"Tags",text:"Name",description:"Description",taskProgress:"Task progress: {{value}}%",taskDescription:"Task description: {{value}}",taskCompleted:"Tasks completed: {{value}}/{{count}}",tasksSummary:"{{summary}} tasks",tasksSummaryOne:"1 task",userId:"User ID",userIcon:"User icon",guestUser:"Guest",detailsTab:"Details",commentsTab:"Comments",fieldsTab:"Fields",historyTab:"History",subtasksTab:"Subtasks",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'From "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed to "{{newValue}}"',invalidRange:'"{{start}}" should be less than "{{end}}"',historyDate:"Date",ok:"ok",cancel:"Cancel",delete:"Delete",taskDeadlineChanged:"Deadline changed",tagsChanged:"Tags changed",taskMoved:"Task moved",taskUpdated:"Task updated",taskCreated:"Task created",taskUserChanged:"Assignee changed",taskUserRemoved:"Assignee removed",taskDescriptionChanged:"Description changed",taskSubtasksChanged:"Subtasks changed",taskProgressChanged:"Progress changed",taskPriorityChanged:"Priority changed",taskSubtasksCompleted:"Completed {{value}}",taskStatusChanged:"Status changed",taskTagsChanged:"Tags changed",taskNameChanged:"Name changed",taskColorChanged:"Color changed",empty:"No tasks"}}},onColumnHeaderRender:{value:null,type:"any",reflectToAttribute:!1},onColumnFooterRender:{value:null,type:"any",reflectToAttribute:!1},onTaskRender:{value:null,type:"any",reflectToAttribute:!1},onSortPrepare:{value:null,type:"any",reflectToAttribute:!1},onFilterPrepare:{value:null,type:"any",reflectToAttribute:!1},priority:{value:[],type:"array",reflectToAttribute:!1},priorityList:{value:!0,type:"boolean"},readonly:{value:!1,type:"boolean"},selectionMode:{value:"zeroOrOne",allowedValues:["zeroOrOne","zeroOrManyExtended"],type:"string"},storeHistory:{value:!0,type:"boolean"},storeHistoryItems:{value:20,type:"number"},swimlanes:{value:[],type:"array",reflectToAttribute:!1},swimlanesFrom:{value:0,type:"number"},swimlanesTo:{value:null,type:"number?"},tags:{value:[],type:"array"},taskActions:{value:!1,type:"boolean"},taskActionsRendered:{value:null,type:"any"},taskComments:{value:!1,type:"boolean"},taskDue:{value:!1,type:"boolean"},taskPosition:{value:"all",allowedValues:["all","leaf"],type:"string"},taskPriority:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskProgress:{value:!1,type:"boolean"},taskTags:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskSubTasks:{allowedValues:["none","onePerRow","onlyUnfinished"],value:"none",type:"string"},taskSubTasksInput:{value:!0,type:"boolean"},taskUserIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskCustomFields:{value:[],type:"array",reflectToAttribute:!1},taskCustomFieldsHide:{value:!1,type:"boolean"},taskColor:{value:!0,type:"boolean"},taskColorEntireSurface:{value:!1,type:"boolean"},textTemplate:{value:null,type:"any"},userList:{value:!1,type:"boolean"},users:{value:[],type:"array",reflectToAttribute:!1},dialogCustomizationFunction:{value:null,type:"any"},dialogRendered:{value:null,type:"any"},dialogEditors:{value:["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"],type:"any"}}}static get listeners(){return{"body.focusin":"_bodyFocusinHandler",keyup:"_keyupHandler","container.click":"_containerClickHandler","container.down":"_containerDownHandler","container.keydown":"_containerKeydownHandler","container.touchmove":"_scrollViewerTouchmoveHandler"}}template(){const e=this._tabindex;return`<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize tasks"><div role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev"${e} role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next"${e} role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close"${e} role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n <smart-scroll-viewer auto-refresh vertical-scroll-bar-visibility="hidden" class="smart-kanban-scroll-viewer" id="scrollViewer">\n <div id="body" class="smart-kanban-body" role="presentation"></div>\n </smart-scroll-viewer>\n </div>`}_keyupHandler(e){const t=this;if("Escape"===e.key&&t._dragDetails){const e=t._dragDetails,a=Smart.Kanban.hoveredKanban,s=Smart.Kanban.hoveredItem;if(delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,e.ScrollViewer&&e.ScrollViewer._scrollView&&(e.ScrollViewer._scrollView.disableSwipeScroll=!1),!e.FeedbackShown)return;a&&clearInterval(a._dragInterval),t._preventSelection=!0;const l=t.isInShadowDOM?t.getRootNode().host:document.body;return l.classList.remove("smart-dragging"),l.style.overflow=t._originalBodyOverflow.overflow,l.style.eoverflowX=t._originalBodyOverflow.overflowX,l.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,e.Feedback.remove(),e.Items.forEach((e=>e.classList.remove("dragged"))),s.classList.remove("drop-target"),void(s.classList.contains("before")?s.classList.remove("before"):s.classList.contains("after")&&s.classList.remove("after"))}}render(){const e=this;Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getCurrentDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.isInitialized=!1,e._render(),super.render(),e.isInitialized=!0}_getPriority(){const e=this;if(!e.priority||e.priority&&0===e.priority.length)e.priority=[{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',label:"",value:""},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>',label:e.localize("low"),value:"low"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>',label:e.localize("average"),value:"average"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>',label:e.localize("high"),value:"high"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>',label:e.localize("critical"),value:"critical"}];else if(e.priority){const t=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let a=0;a<e.priority.length;a++){const s=e.priority[a];s.menuIcon=t(s)}}for(let t=0;t<e.priority.length;t++){const a=e.priority[t];a.menuLabel=`<div priority="${a.value}" class="smart-kanban-task-text">${a.menuIcon}${a.label}</div>`}return e.priority}_getTags(){const e=this,t=[];if(e.tags){for(let a=0;a<e.tags.length;a++){const s=e.tags[a];if(s&&"string"==typeof s)t.push({label:s.trim(),value:s.trim()});else{const e={};s.label&&(e.label=s.label),s.value?e.value=s.value:e.value=s.label,s.color&&(e.color=s.color),t.push(e)}}e.tags=t}}_render(){const e=this,t=getComputedStyle(e);if(e.columnColorEntireSurface?e.classList.add("smart-kanban-column-color"):e.classList.remove("smart-kanban-column-color"),e.$.body.innerHTML="",e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._kanbanTaskMinWidth=parseFloat(t.getPropertyValue("--smart-kanban-task-min-width")),e._dataViewPadding=parseFloat(t.getPropertyValue("--smart-data-view-padding")),e.uiTasksByDataField=[],e.tasksByDataField=[],e.taskById=[],e._allColumns=[],e._customTags=[],e._selectedTasks=[],e._dblclickObject={numberOfClicks:0},e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._sortPanelDataSource=[{label:e.localize("text"),dataField:"text",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("priority"),dataField:"priority",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowFilter:!0,allowSort:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowFilter:!0,allowSort:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowFilter:!0,allowSort:!0}],e.taskCustomFields){const t=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let a=0;a<e.taskCustomFields.length;a++){const s=e.taskCustomFields[a].label;if(t){const l=typeof t[e.taskCustomFields[a].dataField];"number"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"number"}):"date"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"date"}):e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}else e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}}const a={checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"};for(let t in a)e.dataSourceMap[t]||(e.dataSourceMap[t]=a[t]);e._getPriority(),e._getTags(),e._validateDataSourceMap(),e._getInnerElementMessages(),e._localizeHeader(),e._handleHeaderPosition(e.$.scrollViewer),e._validateSwimlanes(),e._renderColumns(),e._handleSwimlanes();let s=!1;e.autoLoadState&&(s=e.loadState()),e._getCurrentUser(),s||e._processDataSource(),e._setPriorityList(),e._setUserList(),e._setActionsList(),e._setColumnActionsList(),e._setCommentsList(),e._autoSaveState(),e._createAddNewButton(),e.$.scrollViewer.refresh()}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog))}detached(){const e=this;if(super.detached(),!e._dialog)return;const t=e._dialog;t.removeEventListener("open",e._dialogEventHandler),t.removeEventListener("closing",e._dialogEventHandler),t.removeEventListener("close",e._dialogEventHandler),t.removeEventListener("click",e._dialogClickHandler),t.remove()}addTask(e={}){const t=this,a=t.columns;if("object"!=typeof e||0===a.length||!t._currentUser.allowAdd)return;const s=t.dataSourceMap;void 0===e[s.status]&&(e[s.status]=a[0].dataField),t._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=t._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date));const l={value:e,id:e.id};t.$.fireEvent("taskBeforeAdd",l),t.dataSource&&t.dataSource.virtualDataSource?t._requestVirtualDataSource("add",e,(function(e){return e})):(t.dataSource||(t.dataSource=[]),t.dataSource.push(e),t._createTask(e,!0),t._autoSaveState("dataSource")),t.$.fireEvent("taskAdd",l),t._refreshButtonsAndSummaries(),t.virtualization&&t._refreshColumns()}addSort(e,t){const a=this,s=a.dataSource;let l;function o(e,s){const o=a._sortPanelDataSource.find((t=>t.dataField===e));if(o){let a=Array.isArray(t)?t[s]:"string"==typeof t?t:"ascending";l.dataFields.push(e),l.dataTypes.push(o.dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",l.orderBy.push(a)}}if(0!==arguments.length&&s&&0!==s.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)l=e;else if(l={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(o);else{if("string"!=typeof e)return;o(e,0)}super.addSort(l)}}beginEdit(e){const t=this;t.disabled||(e=t._validateTaskArgument(e))&&(t.editable||t.readonly)&&t._openDialog(e,"edit")}cancelEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&e.close()}hide(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!1!==e.visible&&(e.visible=!1,t.$.fireEvent("columnHide",{column:e}),t.refresh())}show(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!0!==e.visible&&(e.visible=!0,t.$.fireEvent("columnShow",{column:e}),t.refresh())}showAllColumns(){const e=this;for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0;e.refresh()}collapse(e){const t=this;if(!t.collapsible)return;if(!(e=t._validateColumnArgument(e))||e.collapsed||!e.collapsible)return;const a=t._columnToElement.get(e),s=a.siblingColumns;let l=0;e.collapsed=!0,a.classList.add("collapsed");const o=e.collapsed?t.localize("expand"):t.localize("collapse"),r=a.querySelector(".smart-kanban-column-header-toggle-button");if(r&&r.setAttribute("title",o),s.forEach((e=>e.collapsed&&l++)),l===s.length){const a=0!==s.indexOf(e)?0:1,l=s[a],o=t._columnToElement.get(l);l&&(l.collapsed=!1),o&&(o.classList.remove("collapsed"),t._updateColumnWidths(s,o.parentElement))}else t._updateColumnWidths(s,a.parentElement);t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t._doNotFireEvents||t.$.fireEvent("columnCollapse",{column:e})}copyTask(e){const t=this;if(!t._currentUser.allowAdd)return;if(!(e=t._validateTaskArgument(e)))return;const a=JSON.parse(JSON.stringify(e.data));a.history=[],t.dataSource&&t.dataSource.virtualDataSource?t._requestVirtualDataSource("add",a,(function(e){return t.$.fireEvent("taskAdd",{value:a}),e})):(a[t.dataSourceMap.id]=Math.floor(9e4*Math.random()+1e4),t._createTask(a,!0),t._autoSaveState("dataSource"),t.$.fireEvent("taskAdd",{value:a})),t.dataSource||(t.dataSource=[]),t.dataSource.push(a),t._refreshButtonsAndSummaries()}endEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&(e.ok=!0,e.close())}ensureVisible(e){const t=this;if(e&&"number"==typeof e){const a=t.getTask(e);if(!a)return;const s=a[t.dataSourceMap.status],l=t.querySelector('.smart-kanban-column[data-field="'+s+'"]');if(l){const e=l.querySelector("smart-scroll-viewer");e&&(a.top<e.scrollTop||a.top>e.scrollTop+e.offsetHeight?e.scrollTop=a.top:t._refreshScrollHeight(e,s))}return}if(!(e=t._validateTaskArgument(e))||e.filteredOut)return;const a=e.closest("smart-scroll-viewer");if(0===a.scrollHeight)return e;const s=a.scrollTop,l=e.offsetTop;return s<=l&&s+a.offsetHeight>=l+e.offsetHeight||(a.scrollTop=l),e}expand(e){const t=this;if(!(e=t._validateColumnArgument(e))||!e.collapsed)return;const a=t._columnToElement.get(e);e.collapsed=!1,a.classList.remove("collapsed");const s=e.collapsed?t.localize("expand"):t.localize("collapse"),l=a.querySelector(".smart-kanban-column-header-toggle-button");l&&l.setAttribute("title",s),t._updateColumnWidths(a.siblingColumns,a.parentElement),t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t.$.fireEvent("columnExpand",{column:e})}expandAll(){const e=this;e._allColumns.forEach((t=>{t.collapsed=!1,e._columnToElement.get(t).classList.remove("collapsed")})),e._allColumns.forEach((t=>e._refreshScrollViewer(t))),e._columnContainers.forEach((t=>e._updateColumnWidths(t.children,t))),e._autoSaveState("collapsed"),e._handleSwimlanes(!0)}exportData(e,t,a){const s=this,l=getComputedStyle(s),o=l.borderRightColor,r=s.swimlanes,i=new Smart.Utilities.DataExporter,n=s._getCurrentDataSource(),d=s.dataSourceMap,c=[{id:"Task ID",text:"Text",status:"Status",swimlane:"Swimlane",asignee:"Asignee",priority:"Priority",progress:"Progress",startDate:"Start date",dueDate:"Due date",subTasks:"Completed sub-tasks",tags:"Tags"}],u={},m={},p={};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)c[0][s.taskCustomFields[e].dataField]=s.taskCustomFields[e].label;i.style={border:"1px solid "+o,borderCollapse:"collapse",backgroundColor:l.backgroundColor,color:l.color,fontFamily:"Helvetica",header:{border:"1px solid "+o,fontWeight:"bold"},columns:{border:"1px solid "+o,progress:{format:"p0"},startDate:{format:s.formatStringDate},dueDate:{format:s.formatStringDate}},rows:{}},0===r.length&&delete c[0].swimlane;for(let e=0;e<n.length;e++){const t=n[e];let a=t[d.status],l=t[d.swimlane],o=t[d.userId],h=t[d.progress];u[a]?a=u[a]:(a=s._allColumns.find((e=>e.dataField===a)).label,u[t[d.status]]=a),null===o?o="":p[o]?o=p[o]:(o=s.users.find((e=>e.id===o)).name,p[t[d.userId]]=o),null===h?h="":h/=100;let g=t[d.tags];g&&"string"!=typeof g&&(g=g.map((e=>"string"==typeof e?e:e.label)));const b={id:t[d.id],text:t[d.text],description:t[d.description]||"",status:a,asignee:o,priority:t[d.priority]||"",progress:h,startDate:t[d.startDate]||"",dueDate:t[d.dueDate]||"",subTasks:s._getCompletedSubTasks(t[d.checklist]),tags:g};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)b[s.taskCustomFields[e].dataField]=`"${t[s.taskCustomFields[e].dataField]}"`.replaceAll(","," ");r.length&&(l?m[l]?l=m[l]:(l=r.find((e=>e.dataField===l)).label,m[t[d.swimlane]]=l):l="",b.swimlane=l),c.push(b),t[d.color]&&(i.style.rows[e]={backgroundColor:t[d.color]})}return i.exportData(c,e,t,a)}getState(e){const t=this,a={},s={collapsed:a,dataSource:t._getCurrentDataSource(),filtering:t._appliedFiltering,selection:{selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart:null},sorting:t._appliedSorting,tabs:t._selectedTabs,visibility:{taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}};let l=null,o=null;t._selectionInView&&(l=t._selectionInView.closest(".smart-kanban-column").column.dataField,o=t._selectionInView.getAttribute("swimlane")),s.selection.selectionInColumn=l,s.selection.swimlane=o;const r={};for(let e in t.tasksByDataField){r[e]=[];const a=t.tasksByDataField[e];for(let t=0;t<a.length;t++)r[e].push(a[t].id)}if(s.order=r,t._allColumns.forEach((e=>a[e.dataField]=e.collapsed)),e){const t={};for(let a in e){const l=e[a];s[l]&&(t[l]=s[l])}return t}return s}loadState(e,t){const a=this;if(!e&&!(e=window.localStorage.getItem("smartKanban"+a.id)))return!1;"string"==typeof e&&(e=JSON.parse(e,((e,t)=>t&&-1!==["startDate","dueDate","time"].indexOf(e)?new Date(t):t))),e.dataSource||(t=!1),a._doNotFireEvents=!0,a._selectedTasks=[],delete a._selectionStart,delete a._selectionInView,a.expandAll(),!1!==t&&Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),a._allColumns.forEach((t=>{e.collapsed&&e.collapsed[t.dataField]&&a.collapse(t)}));for(let t in e.visibility)a[t]=e.visibility[t];if(!1!==t&&(a.dataSource=e.dataSource,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource()),e.order){let t=!1,s=[];for(let s in e.order){const l=e.order[s];let o=a._getTasksByDataField(s);for(let e=0;e<l.length;e++){const r=l[e],i=a.taskById[r];if(i){const l=o.indexOf(i);if(l!==e&&l>=0)o.splice(e,0,o.splice(l,1)[0]),t=!0;else if(-1===l){let l=a._getTasksByDataField(i[a.dataSourceMap.status]);const r=l.indexOf(i);r>=0&&(l.splice(r,1),i[a.dataSourceMap.status]=s,o.splice(e,0,i),t=!0)}}}}if(t){const e=Object.keys(a.tasksByDataField);for(let t in e)s=s.concat(a.tasksByDataField[e[t]]);Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),a.dataSource=s,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource()}}if(e.filtering&&a.addFilter(a._constructFilterGroups(e.filtering),e.filtering.operator),e.sorting&&a.addSort(e.sorting),!1!==t&&a._autoSaveState(e),e.selection&&(e.selection.selected.forEach((e=>{const t=a.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`);t&&(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id))})),e.selection.selectionStart&&(a._selectionStart=a.$.container.querySelector(`.smart-kanban-task[data-id="${e.selection.selectionStart}"]`)),e.selection.selectionInColumn)){const t=a._columnToElement.get(a._allColumns.find((t=>t.dataField===e.selection.selectionInColumn)));e.selection.swimlane?a._selectionInView=t.querySelector(`smart-scroll-viewer[swimlane=${e.selection.swimlane}]`):a._selectionInView=t.querySelector("smart-scroll-viewer")}if(e.tabs){const t="tabs"===a.hierarchy;a._allColumns.forEach((s=>{if(void 0!==s.selected){const l=a._columnToElement.get(s),o=-1!==e.tabs.indexOf(s.dataField);s.selected=o,t&&(l.classList.toggle("smart-hidden",!o),l.tab.classList.toggle("selected",o),l.tab.setAttribute("aria-selected",o))}}))}return a._doNotFireEvents=!1,!0}moveTask(e,t){const a=this;if(a.disabled||""!==t&&!t)return;const s=a.dataSourceMap;if(!(e=a._validateTaskArgument(e))||!a._updateTaskInProgress&&e.data[s.status]===t)return;const l=a._allColumns.find((e=>e.dataField===t));function o(){const o=e.closest("smart-scroll-viewer"),r=a._columnToElement.get(l),i=e.data,n=a.getTaskScrollViewer(r,i);if(a.virtualization){const l=i,r=e.column.dataField,d=a._getTasksByDataField(r),c=d.findIndex((e=>e.id===l.id));return c>=0&&(d.splice(c,1),a._getTasksByDataField(t).push(l)),i[s.status]=t,a._refreshScrollViewer(o,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),void((a.shadowRoot||a.getRootNode()).activeElement===o&&a._focusTask(a._getFirstItem(o.$.content)))}i[s.status]=t,n.appendChild(e),a._dialog&&a._dialog.ok||(a.textTemplate&&a._renderTask(e),a._autoSaveState("dataSource")),a._refreshScrollViewer(o,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),(a.shadowRoot||a.getRootNode()).activeElement===o&&a._focusTask(a._getFirstItem(o.$.content))}l&&(a.dataSource&&a.dataSource.virtualDataSource&&!a._ignoreVirtualDataSource?a._requestVirtualDataSource("update",Object.assign({},e.data,{status:t}),(function(e){return e&&o(),e})):o())}_getCustomizeColumnPanelDataSource(){const e=this;return e._customizeColumns=[{label:e.localize("actionsIcon"),dataField:"taskActions",allowHide:!0,disableDrag:!0,visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",allowHide:!0,disableDrag:!0,visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",allowHide:!0,disableDrag:!0,visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",allowHide:!0,disableDrag:!0,visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",allowHide:!0,disableDrag:!0,visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",allowHide:!0,disableDrag:!0,visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",allowHide:!0,disableDrag:!0,visible:e.taskUserIcon}],e._customizeColumns}openCustomizePanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;const a=e.$.customize,s=[{label:e.localize("actionsIcon"),dataField:"taskActions",visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",visible:e.taskUserIcon}];let l;e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel"),a.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated?(l=a.firstElementChild,l.set("dataSource",s),l.propertyChangedHandler("dataSource",void 0,s),l.rightToLeft=e.rightToLeft):(l=document.createElement("smart-column-panel"),l.animation=e.animation,l.dataSource=s,l.locale=e.locale,l.messages=e._innerElementMessages.columnPanel,l.rightToLeft=e.rightToLeft,l.theme=e.theme,e.$.customize.appendChild(l),l.classList.add("smart-kanban-column-panel"),e._customizePartCreated=!0),e._openHeaderDropDown(e.$.customizeButton)}_getFilterPanelDataSource(){const e=this,t=[{label:e.localize("text"),dataField:"text",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("priority"),dataField:"priority",dataType:"enum",allowSort:!0,allowFilter:!0,options:e._getPriority()},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowSort:!0,allowFilter:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowSort:!0,allowFilter:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowSort:!0,allowFilter:!0}];if(e.taskCustomFields){const a=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let s=0;s<e.taskCustomFields.length;s++){const l=e.taskCustomFields[s].label;if(a){const o=typeof a[e.taskCustomFields[s].dataField];"number"===o?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"number"}):"date"===o?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"date"}):t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}else t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}}return e.onFilterPrepare&&e.onFilterPrepare(t),t}openFilterPanel(){const e=this,t=e._getFilterPanelDataSource();super.openFilterPanel(t,(function(t,a){"progress"===a.dataField?(t.min=0,t.max=100,t.showUnit=!0,t.unit="%"):"date"===a.dataType&&(t.formatString=e.formatStringDate)}))}_getSortPanelDataSource(){const e=this;return e.onSortPrepare&&e.onSortPrepare(this._sortPanelDataSource),this._sortPanelDataSource}openSortPanel(){const e=this,t=e._getSortPanelDataSource().map((t=>{const a=e._appliedSorting.dataFields.indexOf(t.dataField);return Object.assign({},t,{sortIndex:a,sortDirection:-1===a?"ascending":e._appliedSorting.orderBy[a]})}));super.openSortPanel(t)}removeTask(e,t){const a=this;function s(){const t=e.closest("smart-scroll-viewer"),s=e.data;if(a.virtualization||(e.remove(),a._refreshScrollViewer(t,!0)),a._autoSaveState("dataSource"),a.$.fireEvent("taskRemove",{value:s,id:e.data.id}),a.dataSource){const e=a.dataSource.findIndex((e=>e.id===s.id));if(e>-1){const t=s[a.dataSourceMap.status],l=a.tasksByDataField[t].findIndex((e=>e.id===s.id));l>=0&&a.tasksByDataField[t].splice(l,1),a.dataSource.splice(e,1)}}if(a._selectedTasks&&a._selectedTasks.indexOf(s.id)>=0){const e=a._selectedTasks.indexOf(s.id);a._selectedTasks.splice(e,1)}a._refreshSummaries(),a._refreshColumns()}a._currentUser.allowRemove&&(e=a._validateTaskArgument(e))&&(t?a._openDialog(e,"prompt"):a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("remove",e.data,(function(e){return e&&s(),e})):s())}saveState(e){const t=this.getState(e);return window.localStorage.setItem("smartKanban"+this.id,JSON.stringify(t)),t}addHistory(e,t){const a=this;if(!e||!t)return;const s=a.dataSourceMap;a.storeHistory?(void 0!==e[s.history]&&null!==e[s.history]||(e[s.history]=[]),e[s.history].length===a.storeHistoryItems&&e[s.history].splice(0,1),e[s.history].push(t)):e[s.history]=[]}clearHistory(e){e&&(e.history=[])}updateTask(e,t){const a=this;if(!a._currentUser.allowEdit||!t)return;if(!(e=a._validateTaskArgument(e)))return;const s=a.dataSourceMap,l=e.data;function o(){if(e.data=t,t[s.status]!==l[s.status]&&(a._updateTaskInProgress=!0,a.moveTask(e,t[s.status]),delete a._updateTaskInProgress),t[s.swimlane]!==l[s.swimlane]){const o=e.closest(".smart-kanban-column");a._hasSwimlane(o.index)?(o.querySelector(`smart-scroll-viewer[swimlane=${t[s.swimlane]}]`).appendChild(e),l[s.swimlane]&&a._refreshScrollViewer(o.querySelector(`smart-scroll-viewer[swimlane=${l[s.swimlane]}]`))):delete t[s.swimlane]}const o=()=>{if(!a._currentUser||a._currentUser&&!a._currentUser.info)return;const e=()=>({user:a._currentUser.info.id,date:t[s.updatedDate]});if(t[s.userId]!==l[s.userId]){const o=e();o.action="user";let r=!0;l[s.userId]||t[s.userId]||(r=!1),r&&(o.details={oldValue:l[s.userId],value:t[s.userId]},a.addHistory(t,o))}if(""+t[s.dueDate]!=""+l[s.dueDate]){const o=e();o.action="deadline",o.details={oldValue:l[s.dueDate]?l[s.dueDate].toLocaleDateString():"",value:t[s.dueDate]?t[s.dueDate].toLocaleDateString():""},a.addHistory(t,o)}if(""+t[s.startDate]!=""+l[s.startDate]){const o=e();o.action="deadline",o.details={oldValue:l[s.startDate]?l[s.startDate].toLocaleDateString():"",value:t[s.startDate]?t[s.startDate].toLocaleDateString():""},a.addHistory(t,o)}if(t[s.color]!==l[s.color]){const o=e();o.action="color",o.details={oldValue:l[s.color],value:t[s.color]},a.addHistory(t,o)}if(t[s.status]!==l[s.status]){const o=e();o.action="status",o.details={oldValue:l[s.status],value:t[s.status]},a.addHistory(t,o)}if(JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])){const o=e();o.action="subtasks",o.details={oldValue:l[s.checklist],value:t[s.checklist]},a.addHistory(t,o)}if(parseFloat(t[s.progress])!==parseFloat(l[s.progress])){let o=!0;if(null===l[s.progress]&&0===parseFloat(t[s.progress])&&(o=!1),o){const o=e();o.action="progress",o.details={oldValue:l[s.progress]?l[s.progress]+"%":"0%",value:t[s.progress]+"%"},a.addHistory(t,o)}}if(t[s.description]!==l[s.description]){const o=e();o.action="description",o.details={oldValue:l[s.description],value:t[s.description]},a.addHistory(t,o)}if(t[s.priority]!==l[s.priority]){const o=e();o.action="priority",o.details={oldValue:l[s.priority],value:t[s.priority]},a.addHistory(t,o)}if(t[s.tags]!==l[s.tags]){const o=e();o.action="tags",o.details={oldValue:l[s.tags],value:t[s.tags]},a.addHistory(t,o)}if(t[s.text]!==l[s.text]){const o=e();o.action="text",o.details={oldValue:l[s.text],value:t[s.text]},a.addHistory(t,o)}for(let s=0;s<a.taskCustomFields.length;s++){const o=a.taskCustomFields[s];let r=l[o.dataField],i=t[o.dataField];if(r!==i&&""+r!=""+i){const s=e();if(s.action=o.name?o.name:o.dataField,o.dataSource){const e=e=>{const t=o.dataSource.find((t=>t.value===e||t===e?t:void 0));return void 0!==t?t.label:""},t=t=>{if(void 0===t||t.length){if(void 0!==t&&t.length&&"string"!=typeof t){let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}if(t&&t.indexOf(",")>0){t=t.split(",");let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}return t}return e(t)};i=t(i),r=t(r)}s.details={oldValue:r,value:i},a.addHistory(t,s)}}};a.textTemplate||t[s.text]!==l[s.text]||t[s.tags]!==l[s.tags]||t[s.priority]!==l[s.priority]||t[s.description]!==l[s.description]?(a._renderTask(e),o()):(o(),t[s.userId]!==l[s.userId]&&a._updateUserIcon(e),t[s.dueDate]!==l[s.dueDate]&&a._updateTaskDueDate(e),t[s.color]!==l[s.color]&&a._updateTaskColor(e),JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])?(a._updateTaskChecked(e),a._updateTaskProgress(e)):parseFloat(t[s.progress])!==parseFloat(l[s.progress])&&a._updateTaskProgress(e),a._updateTaskSubtasks(e),a._updateTaskCustomFields(e));const r=a.getColumn(t.status);r&&(t.statusLabel=r.label);const i=a.getColumn(l.status);i&&(l.statusLabel=i.label);const n=JSON.parse(JSON.stringify(t)),d=JSON.parse(JSON.stringify(l));if(n.history=t.history,d.history=l.history,a.$.fireEvent("change",{task:e,id:n.id,value:n,oldValue:d}),a.virtualization){const t=e.data[s.status],l=a.tasksByDataField[t].findIndex((t=>t.id===e.data.id));if(l>=0){a.tasksByDataField[t][l]=e.data;const s=a._getTasksByDataField(t),o=s.findIndex((t=>t.id===e.data.id));o>=0&&(s[o]=e.data)}}a._refreshScrollViewer(e.closest("smart-scroll-viewer"));const c=a.dataSource.findIndex((t=>e.data.id===t.id));c>=0&&(a.dataSource[c]=e.data),a._refreshSummaries(),a._updateTaskComments(e),a._autoSaveState("dataSource"),a.$.fireEvent("taskUpdate",{id:n.id,value:n,oldValue:d})}(t=Object.assign({},l,t))[s.checklist]&&0===t[s.checklist].length&&(t[s.checklist]=null),JSON.stringify(t)!==JSON.stringify(l)&&(a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("update",t,(function(e){return e&&(a._ignoreVirtualDataSource=!0,o(),delete a._ignoreVirtualDataSource),e})):o())}_refreshSelection(){const e=this;if("zeroOrOne"===e.selectionMode){const t=e._selectionStart;e._selectedTasks.forEach((a=>{if(a!==t){e.getTask(a).selected=!1;const t=e.querySelector('[data-id="'+a+'"]');t&&t.removeAttribute("selected")}})),e._selectedTasks=[t]}e._selectedTasks.forEach((t=>{const a=e.querySelector('[data-id="'+t+'"]');a&&a.setAttribute("selected","")})),e._refreshColumns()}propertyChangedHandler(e,t,a){const s=this,l=s._dialog;function o(){if(s.cancelEdit(),l&&l.close(),s._closeList(s._commentsList,"_commentSelectionFor"),s._getCurrentUser(),s.taskSubTasks){const e=s.querySelectorAll(".smart-kanban-task-input");s._currentUser&&!s._currentUser.allowEdit||s.disabled||!s.taskSubTasksInput?e.forEach((e=>{e.classList.add("smart-hidden")})):e.forEach((e=>{e.classList.remove("smart-hidden")}))}}switch(super.propertyChangedHandler(e,t,a),e){case"columnColorEntireSurface":a?s.classList.add("smart-kanban-column-color"):s.classList.remove("smart-kanban-column-color");break;case"columnFooter":case"addNewButton":case"addNewButtonDisplayMode":s._reset(),s._createAddNewButton();break;case"taskTags":s._reset();break;case"taskCustomFields":s._resetFields=!0,s._reset();break;case"autoColumnHeight":case"applyColumnColorToTasks":case"columnWidth":case"addNewColumn":s._reset();break;case"allowDrag":s._getCurrentUser();break;case"animation":case"theme":{let t=Array.from(s.$.container.querySelectorAll("smart-column-panel, smart-multi-column-filter-panel, smart-sort-panel"));l&&(t.push(l),t=t.concat(Array.from(l.$.footer.children)),l.editPanelPopulated&&(t=t.concat(Array.from(l.$.container.querySelectorAll(".smart-element.editor"))))),t.forEach((t=>t[e]=a)),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskColor(e)));break}case"autoSaveState":s._autoSaveState();break;case"collapsible":a||s.expandAll();break;case"columnSummary":s._refreshSummaries();break;case"columns":s._render(),l&&l.editPanelPopulated&&(l.editors.status.dataSource=s._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))));break;case"currentUser":o();break;case"dataSource":case"dataSourceMap":if("dataSourceMap"===e&&s._validateDataSourceMap(),s._customTags=[],s._selectedTasks=[],s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),0===s.columns.length)return s._renderColumns(),s._handleSwimlanes(),void s._processDataSource();Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e.clearContent(),e.refresh(),s._refreshScrollViewer(e,!0)})),s._processDataSource(),s.dataSource||s._refresh(),s.columnSummary&&s._refreshSummaries();break;case"disabled":s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),s._setFocusable();break;case"formatStringDate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskDueDate(e))),l&&(l.editors.startDate.formatString=a,l.editors.dueDate.formatString=a);break;case"formatStringTime":s._closeList(s._commentsList,"_commentSelectionFor");break;case"editable":s.cancelEdit(),s._actionsList.classList.contains("edit-comment")||s._closeList(s._actionsList,"_actionSelectionFor"),s._getCurrentUser();break;case"headerPosition":s._handleHeaderPosition(s.$.body),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"hierarchy":0===s.swimlanes.length&&s.columns.length!==s._allColumns.length&&s._reset();break;case"locale":case"messages":s.closePanel(),s._localizeHeader(),s._getInnerElementMessages(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._setActionsList(),s._setColumnActionsList(),s._setCommentsList(),l&&(s.cancelEdit(),l.close(),l.$.footer.firstElementChild.innerHTML=s.localize("ok"),l.$.footer.children[1].innerHTML=s.localize("cancel"),l.$.footer.children[2].innerHTML=s.localize("delete"),l.editPanelPopulated&&(l.editors.priority.dataSource=s._getPriority(),l.$.container.querySelector(".new-subtask").placeholder=s.localize("newSubtask"),l.$.container.querySelector("smart-button.add").title=s.localize("addSubtask"),Array.from(l.$.container.getElementsByClassName("editor-label")).forEach((e=>{let t=e.id.slice(s.id.length+5);t=t.slice(0,1).toLowerCase()+t.slice(1),e.innerHTML=s.localize(t)})))),s._customizePartCreated&&(s.$.customize.firstElementChild.messages=s._innerElementMessages.columnPanel,s.$.customize.firstElementChild.locale=s.locale),s._filterPartCreated&&(s.$.filter.firstElementChild.messages=s._innerElementMessages.multiColumnFilterPanel,s.$.filter.firstElementChild.locale=s.locale,s.$.filter.firstElementChild.editorPlaceholder=s.localize("filterValuePlaceholder")),s._sortPartCreated&&(s.$.sort.firstElementChild.messages=s._innerElementMessages.sortPanel,s.$.sort.firstElementChild.locale=s.locale);break;case"rightToLeft":s._reset(!0);break;case"selectionMode":"zeroOrOne"===a&&s._selectedTasks.length>1&&s._refreshSelection();break;case"swimlanes":if(s._validateSwimlanes(),JSON.stringify(s.swimlanes)===JSON.stringify(t))return;s._reset(),l&&l.editPanelPopulated&&(l.editors.swimlane.dataSource=s.swimlanes.map((e=>({label:e.label,value:e.dataField}))));break;case"swimlanesFrom":case"swimlanesTo":{const e=s.swimlanesFrom,t=s.swimlanesTo;e<0&&(s.swimlanesFrom=0),null!==t&&e>t&&(s.swimlanesFrom=t),s.swimlanes.length>0&&s._reset();break}case"taskCustomFieldsHide":case"taskProgress":case"taskSubTasksInput":case"taskSubTasks":case"taskUserIcon":case"taskComments":case"taskDue":case"taskPriority":case"tags":case"taskColor":case"taskColorEntireSurface":case"textTemplate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._renderTask(e))),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"unfocusable":s._setFocusable();break;case"priority":s._closeList(s._priorityList,"_prioritySelectionFor"),s._setPriorityList();break;case"users":s._closeList(s._userList,"_userSelectionFor"),s._setUserList(),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateUserIcon(e))),l&&l.editPanelPopulated&&(l.editors.userId.dataSource=s.users.map((e=>({label:e.name,value:e.id})))),o()}}_reset(e){const t=this,a=t.getState();t._allColumns=[],t._customTags=[],t._selectedTasks=[],t._dialog&&(t.cancelEdit(),e&&(t._dialog.remove(),delete t._dialog)),t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t.$.body.innerHTML="",Array.from(t.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),t._renderColumns(),t._handleSwimlanes(),t._createAddNewButton(),t.loadState(a),t.$.scrollViewer.refresh()}_refresh(){const e=this;e._allColumns=[],e._customTags=[],e._selectedTasks=[],e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e.$.body.innerHTML="",Array.from(e.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),e._renderColumns(),e._handleSwimlanes(),e._createAddNewButton(),e.$.scrollViewer.refresh()}_closeAllLists(){const e=this;e.cancelEdit(),e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e._closeList(e._priorityList,"_prioritySelectionFor")}_containerClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(t.$.header.contains(a))return void t._headerClickHandler(a,t.$.body);const s=a.closest(".smart-kanban-column-header");if(s){const e=s.parentElement.column;if(a instanceof HTMLInputElement)return;if(t.columnActions&&a.classList.contains("smart-kanban-column-actions")){if(!t._columnActionsList.parentElement||t._columnActionsList.classList.contains("smart-visibility-hidden")){if(t._columnActionsListDate&&new Date-t._columnActionsListDate<300)return;t._openColumnActionsList(a,e)}return}if(a.closest(".smart-kanban-column-header-add")&&e)return void t._openDialog(e,"add","column");if(t.collapsible&&e&&e.collapsible&&a.closest(".smart-kanban-column-header-toggle-button"))return void t[e.collapsed?"expand":"collapse"](e)}const l=a.closest(".smart-kanban-tab");if(l){if(l.classList.contains("selected"))return;const e=l.parentElement.querySelector(".selected");return e.classList.remove("selected"),e.setAttribute("aria-selected",!1),e.columnElement.classList.add("smart-hidden"),e.columnElement.column.selected=!1,l.classList.add("selected"),l.setAttribute("aria-selected",!0),l.columnElement.classList.remove("smart-hidden"),l.columnElement.column.selected=!0,t._selectedTabs=t._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),t._autoSaveState("tabs"),void t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}if(t.addNewColumn){const e=a.closest(".smart-kanban-add-new-column"),s=a.closest(".smart-color-input"),l=a.closest(".smart-kanban-column-header");if(!s&&e&&!e.querySelector(".pending")&&l)return void t._addNewColumnDynamically()}const o=a.closest(".smart-kanban-list .item");if(o){const e=o.getAttribute("data-id"),a=t._userSelectionFor,s=t._prioritySelectionFor;if(a){const s=t.dataSourceMap,l=a.data[s.userId],o=JSON.parse(JSON.stringify(a.data));if(a.data[s.userId]=e,t._updateUserIcon(a),t._closeList(t._userList,"_userSelectionFor"),a.data[s.userId]!==l){t.dataSource&&t.dataSource.virtualDataSource&&t._requestVirtualDataSource("update",a.data,(function(e){return e||(a.data[s.userId]=l,t._updateUserIcon(a)),e}));const e=a.data;if(t._currentUser.info){a.data[s.updatedUserId]=t._currentUser.info.id,a.data[s.updatedDate]=new Date;const l={user:t._currentUser.info.id,label:e[s.text],date:e[s.updatedDate]};e[s.userId]!==o[s.userId]&&(l.action="user",l.details={oldValue:o[s.userId],value:e[s.userId]},t.addHistory(e,l))}const r=JSON.parse(JSON.stringify(e));t.$.fireEvent("change",{task:a,id:r.id,value:r,oldValue:o}),t.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:o}),t._autoSaveState("dataSource")}return}if(s){const e=t.dataSourceMap,a=s.data[e.priority],l=JSON.parse(JSON.stringify(s.data));if(s.data[e.priority]=o.getAttribute("priority"),t._closeList(t._priorityList,"_prioritySelectionFor"),s.data[e.priority]!==a){t._currentUser.info&&(s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date);const a=s.data,o=JSON.parse(JSON.stringify(a));if(t._currentUser.info){s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date;const o={user:t._currentUser.info.id,date:a[e.updatedDate]};a[e.priority]!==l[e.priority]&&(o.action="priority",o.details={oldValue:l[e.priority],value:a[e.priority]},t.addHistory(a,o))}t.$.fireEvent("change",{task:s,id:o.id,value:o,oldValue:l}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:l}),t._updateTaskPriority(s),t._autoSaveState("dataSource")}}const l=t._actionSelectionFor,r=t._columnActionSelectionFor;if(l){switch(parseFloat(e)){case 0:o.hasAttribute("edit")&&(t._actionsList.classList.contains("edit-comment")?(t._commentsList.textarea.value=l.comment.text,t._commentsList.textarea.focus(),t._commentsList.editing=l,l.parentElement.scrollTop=l.offsetTop):t.beginEdit(l));break;case 1:o.hasAttribute("copy")&&t.copyTask(l);break;case 2:o.hasAttribute("remove")&&(t._actionsList.classList.contains("edit-comment")?t._openDialog(l,"prompt","comment"):t.removeTask(l,!0))}return void t._closeList(t._actionsList,"_actionSelectionFor")}if(r){switch(parseFloat(e)){case 0:t._handleColumnEditing(r.dataField);break;case 1:t._openDialog(r,"add","column");break;case 2:t.collapse(r);break;case 3:t._openDialog(r,"prompt","column");break;case 4:t.hide(r);break;case 5:t.showAllColumns()}return void t._closeList(t._columnActionsList,"columnActionSelectionFor")}}if(a.closest(".smart-kanban-list.comments")){const e=a.closest(".send");if(e){if(e.disabled)return;const a=JSON.parse(JSON.stringify(t._commentSelectionFor.data)),s=t._createComment();t._commentsList.textarea.value="",e.disabled=!0;const l=JSON.parse(JSON.stringify(t._commentSelectionFor.data));t.$.fireEvent("change",{task:t._commentSelectionFor,id:l.id,value:l,oldValue:a}),t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:a}),t.$.fireEvent("commentAdd",{id:l.id,value:s})}else if(a.classList.contains("remove-button")&&a.classList.contains("enabled")){const e=a.closest(".smart-comment");t._actionSelectionFor&&(t._actionSelectionFor===e||t._actionSelectionFor.classList.contains("smart-kanban-task")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,void 0,e)}return}const r=a.closest(".smart-kanban-task");if(r)if(a.classList.contains("smart-kanban-task-user"))!t.userList||!t._currentUser.allowEdit||t._userSelectionFor&&(t._userSelectionFor===r||t._userList.parentElement&&!t._userList.classList.contains("smart-visibility-hidden"))||t._openUserList(a,r);else if(a.classList.contains("priority")&&t.priorityList)!t._priorityList||!t._currentUser.allowEdit||t._prioritySelectionFor&&(t._prioritySelectionFor===r||t._priorityList.parentElement&&!t._priorityList.classList.contains("smart-visibility-hidden"))||t._openPriorityList(a,r);else if(t.taskActions&&a.classList.contains("smart-kanban-task-actions"))t._actionSelectionFor&&(t._actionSelectionFor===r||t._actionSelectionFor.classList.contains("comment")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,r);else if(t.taskComments&&a.classList.contains("smart-kanban-task-comments"))t.users.length>0&&(!t._commentSelectionFor||t._commentSelectionFor!==r&&(!t._commentsList.parentElement||t._commentsList.classList.contains("smart-visibility-hidden")))&&t._openCommentsList(a,r);else if(t.$.fireEvent("taskClick",{id:r.data.id,value:r.data,element:r}),t._preventSelection||t._selectTask(e,r),e.type)if(clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks){if(t._dblclickObject.numberOfClicks=0,r.hasAttribute("selected")||t._selectTask(e,r),t.$.fireEvent("taskDoubleClick",{id:r.data.id,value:r.data,element:r}).defaultPrevented)return;t.beginEdit(r)}else t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300)}_selectTask(e,t){const a=this,s=a.selectionMode,l=()=>{a._selectedTasks.forEach((e=>{if(e!==t.data.id){const t=a.querySelector('[data-id="'+e+'"]');t&&t.removeAttribute("selected")}}))};function o(){l(),t.hasAttribute("selected")||(t.setAttribute("selected",""),a._selectedTasks=[t.data.id]),a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._autoSaveState("selection"),a._focusTask(t)}if("zeroOrOne"===s)l(),t.hasAttribute("selected")?(a._focusTask(t),t.removeAttribute("selected"),a._selectedTasks=[],delete a._selectionInView):(t.setAttribute("selected",""),a._selectedTasks=[t.data.id],a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._focusTask(t)),a.virtualization&&a._refreshColumns();else{if(!e.ctrlKey&&!e.shiftKey&&!e.metaKey||0===a._selectedTasks.length||t.closest("smart-scroll-viewer")!==a._selectionInView)return void o();if(e.ctrlKey||e.metaKey)t.hasAttribute("selected")?(t.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((e=>e!==t.data.id))):(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id),a._selectionStart=t.data.id);else if(e.shiftKey){if(t&&t.id===a._selectionStart)return a._selectedTasks.length>1&&o(),void(a.virtualization&&a._refreshColumns());const e=t[a.dataSourceMap.status],s=a._getTasksByDataField(e),l=a.getTask(a._selectionStart);let r=s.indexOf(l),i=s.indexOf(t.id);const n=r;r=Math.min(r,i),i=Math.max(n,i),a._selectedTasks=[],s.forEach(((e,t)=>{const s=a.querySelector('[data-id="'+e.id+'"]');t>=r&&t<=i&&!e.filteredOut?(s&&s.setAttribute("selected",""),a._selectedTasks.push(e.id)):s&&s.removeAttribute("selected")}))}a._focusTask(t)}a.virtualization&&a._refreshColumns(),a._autoSaveState("selection")}_processDataSource(){const e=this;let t=e.dataSource;if(0!==e.columns.length&&null!=t){if(t instanceof Smart.DataAdapter){if(t.virtualDataSource)return void e._requestVirtualDataSource("dataBind");t=t.dataSource}t.length>500&&(e.virtualization=!0),t.forEach((t=>{e._createTask(t)})),e.virtualization&&(e._measureCardHeight(),e._refreshColumns()),e.whenRendered((()=>e._allColumns.forEach((t=>e._refreshScrollViewer(t)))))}}_requestVirtualDataSource(e,t,a){const s=this,l=s.dataSourceMap,o=[],r=[],i={},n=s._appliedFiltering;let d=null;if(n&&n.filterGroups.length>0&&(n.filterGroups.forEach((e=>r[e[0]]=e[1])),r.length=n.filterGroups.length,d=n.operator),s._appliedSorting&&s._appliedSorting.dataFields.length>0&&(s._appliedSorting.dataFields.forEach(((e,t)=>{let a=s._appliedSorting.orderBy[t].replace("ending","");o[e]={sortOrder:a,sortIndex:t}})),o.length=s._appliedSorting.dataFields.length),void 0!==t){const e=Object.assign({},t);e[l.checklist]=JSON.stringify(e[l.checklist]),e[l.history]=JSON.stringify(e[l.history],(function(e,t){return"date"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.comments]=JSON.stringify(e[l.comments],(function(e,t){return"time"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.updatedDate]&&(e[l.updatedDate]=e[l.updatedDate].toISOString().slice(0,10)),e[l.createdDate]&&(e[l.createdDate]=e[l.createdDate].toISOString().slice(0,10)),e[l.dueDate]&&(e[l.dueDate]=e[l.dueDate].toISOString().slice(0,10)),e[l.startDate]&&(e[l.startDate]=e[l.startDate].toISOString().slice(0,10)),i.row=e}s.dataSource.onVirtualDataSourceRequested((function(t){let l=!0;-1!==["add","update","remove"].indexOf(e)&&a&&(l=a(t.result),"add"!==e)||l&&(Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),s.dataSource.dataSource.forEach((e=>{s._createTask(e)})),s._allColumns.forEach((e=>s._refreshScrollViewer(e))),s._autoSaveState("dataSource"))}),{first:0,last:0,sorting:o,filtering:r,filterOperator:d,grouping:[],edit:i,action:e})}_setUserList(){const e=this,t=document.createElement("div");t.id=e.id+"UserList",t.className="smart-kanban-list users smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e.users.forEach((e=>{const a=document.createElement("div"),s=e?e.image:null,l=s?`background-image: url('${s}');`:"";a.className="item",a.innerHTML=`<div class="icon" style="${l}"></div><div class="name">${e.name}</div>`,a.setAttribute("data-id",e.id),a.setAttribute("role","option"),t.appendChild(a)})),e._userList=t}_setPriorityList(){const e=this,t=document.createElement("div");t.id=e.id+"PriorityList",t.className="smart-kanban-list priority smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e._getPriority().forEach((e=>{const a=document.createElement("div");a.className="item",e.menuLabel?a.innerHTML=e.menuLabel:a.innerHTML=`<div priority="${e.value}" class="smart-kanban-task-text">${e.menuIcon}${e.label}</div>`,a.setAttribute("priority",e.value),a.setAttribute("role","option"),t.appendChild(a)})),e._priorityList=t;const a=e._dialog;a&&a.editPanelPopulated&&(a.editors.priority.dataSource=e._getPriority())}_openList(e,t,a){const s=this,l=e.getBoundingClientRect();let o,r,i=l.left,n=l.top+e.offsetHeight;a=s.rightToLeft?!a:a,1===window.devicePixelRatio?(o=document.documentElement.clientWidth,r=document.documentElement.clientHeight):(o=window.innerWidth,r=window.innerHeight),t.classList.add("dialog"),document.body.appendChild(t),a&&(i=l.right-t.offsetWidth),i+t.offsetWidth>o&&(i=o-t.offsetWidth),n+t.offsetHeight>r&&(n=r-t.offsetHeight),t.style.left=Math.max(0,i)+"px",t.style.top=n+"px",t.classList.remove("smart-visibility-hidden"),e.setAttribute("aria-expanded",!0),e.setAttribute("aria-controls",t.id),s.unfocusable||requestAnimationFrame((function e(){0===t.getBoundingClientRect().height?requestAnimationFrame(e):t.focus()})),t.openedFrom=e,t.onclick=e=>{s._containerClickHandler(e)}}_openUserList(e,t){const a=this;if(0===a.users.length)return;const s=t.data[a.dataSourceMap.userId],l=a._userList,o=l.querySelector(".selected");if(o&&(o.classList.remove("selected"),o.removeAttribute("aria-selected")),a._openList(e,l),null!==s){const e=Array.from(l.children).find((e=>e.getAttribute("data-id")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._userSelectionFor=t}_openPriorityList(e,t){const a=this,s=t.data[a.dataSourceMap.priority],l=a._priorityList,o=l.querySelector(".selected");if(o&&(o.classList.remove("selected"),o.removeAttribute("aria-selected")),a._openList(e,l),null!=s){const e=Array.from(l.children).find((e=>e.getAttribute("priority")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._prioritySelectionFor=t}_closeList(e,t){const a=this;if(!e||!e.parentElement)return;const s=a.$.container.querySelector(`[aria-expanded="true"][aria-controls="${e.id}"]`);e.classList.add("smart-visibility-hidden"),requestAnimationFrame((function s(){e.classList.contains("smart-visibility-hidden")&&(e.getBoundingClientRect().height>0?requestAnimationFrame(s):(e.remove(),delete e.openedFrom,delete a[t]))})),s&&(s.removeAttribute("aria-expanded"),s.removeAttribute("aria-controls"))}_setActionsList(){const e=this,t=document.createElement("div");if(t.id=e.id+"ActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" edit data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n<div class="item" copy data-id="1" role="menuitem"><div class="name">${e.localize("copy")}</div></div>\n<div class="item" remove data-id="2" role="menuitem"><div class="name">${e.localize("remove")}</div></div>`,e.taskActionsRendered){e.taskActionsRendered(t);const a=Array.from(t.children);for(let e=0;e<a.length;e++){const t=a[e];t.classList.add("item"),t.setAttribute("data-id",e),t.setAttribute("role","menuitem"),t.firstElementChild&&t.firstElementChild.classList.add("name")}}e._actionsList=t}_setColumnActionsList(){const e=this,t=document.createElement("div");t.id=e.id+"ColumnActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n <div class="item" data-id="1" role="menuitem"><div class="name">${e.localize("addNewTask")}</div></div>\n <div class="item" data-id="2" role="menuitem"><div class="name">${e.localize("collapse")}</div></div>\n <div class="item" data-id="3" role="menuitem"><div class="name">${e.localize("removeColumn")}</div></div>\n <div class="item" data-id="4" role="menuitem"><div class="name">${e.localize("hideColumn")}</div></div>\n <div class="item" data-id="5" role="menuitem"><div class="name">${e.localize("showAllColumns")}</div></div>`,e._columnActionsList=t}_openActionsList(e,t,a){const s=this,l=s._currentUser,o=s._actionsList;s._openList(e,o,a),o.classList.toggle("edit-comment",!!a),s._actionSelectionFor=t||a,o.children[0]&&o.children[0].hasAttribute("edit")&&(t&&!l.allowEdit?o.children[0].classList.add("smart-hidden"):o.children[0].classList.remove("smart-hidden")),o.children[1]&&o.children[1].hasAttribute("add")&&(t&&!l.allowAdd?o.children[1].classList.add("smart-hidden"):o.children[1].classList.remove("smart-hidden")),o.children[2]&&o.children[0].hasAttribute("remove")&&(t&&!l.allowRemove?o.children[2].classList.add("smart-hidden"):o.children[2].classList.remove("smart-hidden")),Array.from(o.children).forEach((e=>e.classList.remove("selected")))}_openColumnActionsList(e,t){const a=this,s=a._columnActionsList,l=s.children;a.allowColumnEdit&&t.editable&&"header"!==a.columnEditMode?l[0].classList.remove("smart-hidden"):l[0].classList.add("smart-hidden"),a.addNewButton&&t.addNewButton?l[1].classList.remove("smart-hidden"):l[1].classList.add("smart-hidden"),a.allowColumnRemove&&t.allowRemove&&a._allColumns.length>1?l[3].classList.remove("smart-hidden"):l[3].classList.add("smart-hidden"),a.collapsible&&t.collapsible?l[2].classList.remove("smart-hidden"):l[2].classList.add("smart-hidden"),a.allowColumnHide&&t.allowHide&&a._allColumns.length>1?(l[4].classList.remove("smart-hidden"),l[5].classList.remove("smart-hidden")):(l[4].classList.add("smart-hidden"),l[5].classList.add("smart-hidden")),a._openList(e,s),a._columnActionSelectionFor=t,Array.from(s.children).forEach((e=>e.classList.remove("selected")))}_setCommentsList(){const e=this,t=document.createElement("div");t.id=e.id+"CommentsList",t.className="smart-kanban-list comments smart-visibility-hidden",t.setAttribute("role","dialog"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="smart-kanban-comments" role="list"></div>\n<div class="smart-kanban-new-comment" role="presentation">\n <textarea placeholder="${e.localize("newComment")}"></textarea>\n <smart-button class="send primary" disabled${e._rtlAttr}>${e.localize("send")}</smart-button>\n</div>`;const a=t.querySelector("textarea"),s=t.querySelector("smart-button");s.tabIndex=0,a.onfocus=()=>{t.classList.add("expanded"),s.disabled=""===a.value},a.onblur=e=>{s.contains(e.relatedTarget)||t.classList.remove("expanded")},a.onkeyup=()=>{s.disabled=""===a.value},a.oncut=()=>{s.disabled=""===a.value},a.onpaste=()=>{s.disabled=""===a.value},t.textarea=a,t.button=s,e._commentsList=t}_openCommentsList(e,t){const a=this,s=a._commentsList;s.classList.remove("expanded"),s.firstElementChild.innerHTML="",s.textarea.value="",s.textarea.disabled=!a._currentUser.allowComment,a.unfocusable?s.textarea.tabIndex=-1:s.textarea.removeAttribute("tabindex"),delete s.editing,t.data[a.dataSourceMap.comments].forEach((e=>a._createComment(e))),a._openList(e,s),a._commentSelectionFor=t}_getCommentsList(e){const t=this,a=t._commentsList;return a.classList.remove("expanded"),a.firstElementChild.innerHTML="",a.textarea.value="",a.textarea.disabled=!t._currentUser.allowComment,t.unfocusable?a.textarea.tabIndex=-1:a.textarea.removeAttribute("tabindex"),delete a.editing,e.data[t.dataSourceMap.comments].forEach((e=>t._createComment(e))),t._commentSelectionFor=e,a.classList.remove("smart-visibility-hidden"),a}_createComment(e){const t=this,a=document.createElement("div");let s,l;function o(){const o=t._commentsList.firstElementChild,r=l?l.image:null,i=l?l.name||l.id:t.localize("guestUser"),n=l?l.name:t.localize("guestUser");a.classList="smart-comment",a.setAttribute("role","listitem");const d=r?`background-image: url('${r}');`:"";a.innerHTML=`<div class="comment-indent" role="presentation">\n <div class="user-icon" style="${d}" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n <div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&l.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}"${t._tabindex} role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n </div>\n <div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,a.comment=e,r||a.querySelector(".user-icon").classList.add("empty"),o.appendChild(a),s&&(o.scrollTop=o.scrollHeight-o.offsetHeight)}if(e)l=t.users.find((t=>t.id===e.userId));else{const a=t.dataSourceMap,r=t.dataSource&&t.dataSource.virtualDataSource,i=t._commentsList.textarea.value,n=t._commentsList.editing,d=t._commentSelectionFor.data,c=JSON.parse(JSON.stringify(d));if(n){if(r){const e=Object.assign({},d);e[a.comments]=e[a.comments].slice(0),e[a.comments][e[a.comments].indexOf(n.comment)]=Object.assign({},n.comment,{text:i}),t._requestVirtualDataSource("update",e,(function(a){return a&&(t._commentSelectionFor.data=e,n.querySelector(".comment-body").innerHTML=i),delete t._commentsList.editing,a}))}else n.querySelector(".comment-body").innerHTML=i,n.comment.text=i,delete t._commentsList.editing;return t.$.fireEvent("commentUpdate",{id:d.id,value:n.comment}),t.$.fireEvent("taskUpdate",{id:d.id,value:d,oldValue:c}),void t.$.fireEvent("change",{task:t._commentSelectionFor,id:d.id,value:d,oldValue:c})}if(s=!0,e={text:i,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:t._currentUser.info?t._currentUser.info.id:-1,time:new Date},l=t._currentUser.info,r){const s=Object.assign({},d);s[a.comments]=s[a.comments].slice(0),s[a.comments].push(e),t._requestVirtualDataSource("update",s,(function(e){return e&&(t._commentSelectionFor.data=s,t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",s[a.comments].length||""),o()),e}))}else d[a.comments].push(e),t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",d[a.comments].length||"")}return e.time instanceof Date==0&&(e.time=new Date(e.time),e.time.setTime(e.time.getTime()-1*e.time.getTimezoneOffset()*60*1e3)),o(),e}_getTaskIndexByPosition(e,t){const a=(e,t)=>{const a=e.top,s=e.top+e.height,l=a<=t&&s>t;return 0!==e.height&&l};return(t=>{let s=0,l=t.length-1;if(e<=0)return 0;const o=t[t.length-1];if(-1!==o.top&&o.top<=e)return t.length-1;for(;;){const o=Math.floor((s+l)/2),r=t[o];if(a(r,e))return o;r.top<e?s=o+1:r.top>e?l=o-1:s=o+1}})(t)}_refreshColumns(){const e=this;e.virtualization&&e._allColumns.forEach((t=>{e._refreshColumn(t.dataField)}))}_refreshColumn(e){const t=this.getColumn(e),a=this._columnToElement.get(t);if(!a)return;const s=a.querySelector("smart-scroll-viewer");this._refreshScrollHeight(s,e)}_getTasksByDataField(e){const t=this;let a=t.tasksByDataField[e];return a?a._filtered?a._filtered:a._sorted?a._sorted:a:(t.tasksByDataField[e]=[],t.tasksByDataField[e])}_refreshEmptyColumnState(e,t){const a=this;e&&(e.querySelector(".smart-kanban-task")||e.querySelector(".smart-kanban-task")&&!t?(e.removeAttribute("empty",a.localize("empty")),e.classList.remove("empty")):(e.setAttribute("empty",a.localize("empty")),e.classList.add("empty")))}_refreshScrollHeight(e,t){const a=this;if(a._refreshEmptyColumnState(e,t),!a.virtualization)return;const s=a._getTasksByDataField(t);if(!s)return;const l=a._autoCardHeight?a._autoCardHeight:a.cardHeight;e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight;for(let e=0;e<s.length;e++){const t=s[e];t.top=e*l,t.height=l}const o=e.querySelector(".smart-scroll-viewer-content-container"),r=e=>{const l=a._getTaskIndexByPosition(e,s),r=a.uiTasksByDataField[t].length;for(let e=0;e<r;e++){const r=s[l+e],i=a.uiTasksByDataField[t][e];i&&(a._dragDetails&&(i.classList.remove("dragged"),r&&a._dragDetails.ItemsData.forEach((e=>{e.id===r.id&&i.classList.add("dragged")}))),r?i.classList.remove("smart-hidden"):i.classList.add("smart-hidden"),0===e&&(o.style.marginTop=r?r.top+"px":"0px"),r)&&(i.hasAttribute("selected")&&i.removeAttribute("selected"),i.hasAttribute("focus")&&i.removeAttribute("focus"),JSON.stringify(r)!==JSON.stringify(i.data)&&(i.data=r,a._renderTask(i)),a._selectedTasks&&a._selectedTasks.indexOf(r.id)>=0&&i.setAttribute("selected",""),a._focusedTask===r.id&&i.setAttribute("focus",""))}};e.onVerticalChange=e=>{const t=e.detail.value;r(t)},a.uiTasksByDataField[t]||(a.uiTasksByDataField[t]=[]);const i=Math.round(e.offsetHeight/l)+2,n=a.uiTasksByDataField[t].length;if(0===n||n<i){const o=Math.round(e.offsetHeight/l)+2;for(let e=0;e<o;e++){const l=s[e];if(!l)continue;const o=a._createVirtualTask(l);a.uiTasksByDataField[t].push(o)}e.refresh(),e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight,r(e.scrollTop)}else r(e.scrollTop)}_createVirtualTask(e,t){const a=this,s=a.dataSourceMap,l=a._allColumns.find((t=>t.dataField===e[s.status]));if(!l)return;const o=document.createElement("div"),r=a._columnToElement.get(l),i=a.getTaskScrollViewer(r,e);return void 0===e[s.id]&&(e[s.id]=Math.floor(9e4*Math.random()+1e4)),o.className="smart-kanban-task smart-unselectable",o.setAttribute("role","listitem"),o.setAttribute("data-id",e[s.id]),a._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=a._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date),e[s.history]=[],a.addHistory(e,{action:"created",user:a._currentUser.info.id,details:{value:e[s.text]},date:e[s.createdDate]})),o.data=e,o.column=l,a._renderTask(o),e.class&&"string"==typeof e.class&&o.classList.add(e.class),i.appendChild(o),a._updateTaskColor(o),t&&(l.collapsed?i.toRefresh=!0:i.refresh()),o}_measureCardHeight(){const e=this,t=Object.keys(e.tasksByDataField);if(0===t.length||0===e.columns.length)return null;if(null===e.cardHeight&&!e._autoCardHeight){const a=e.tasksByDataField[t[0]],s=e._createVirtualTask(a[0]);e._renderTask(s),a.class&&"string"==typeof a.class&&s.classList.add(a.class);const l=e.columns[0],o=e._columnToElement.get(l),r=e.getTaskScrollViewer(o,a);r.appendChild(s);const i=r.querySelector(".smart-scroll-viewer-content-container"),n=getComputedStyle(i).rowGap;e._autoCardHeight=s.offsetHeight+parseInt(n),s.remove()}}_createTask(e,t){const a=this,s=a.dataSourceMap,l=a._allColumns.find((t=>t.dataField===e[s.status]));if(!l)return;const o=document.createElement("div"),r=a._columnToElement.get(l),i=a.getTaskScrollViewer(r,e);void 0===e[s.id]&&(e[s.id]=Math.floor(9e4*Math.random()+1e4)),o.className="smart-kanban-task smart-unselectable",o.setAttribute("role","listitem"),o.setAttribute("data-id",e[s.id]),a._currentUser&&a._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=a._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date),e[s.history]||(e[s.history]=[],a.addHistory(e,{action:"created",user:a._currentUser.info.id,details:{value:e[s.text]},date:e[s.createdDate]}))),o.data=e,o.column=l,a.tasksByDataField[l.dataField]||(a.tasksByDataField[l.dataField]=[]),a.tasksByDataField[l.dataField].push(e),a.taskById[e.id]=e,a.virtualization||(a._renderTask(o),e.class&&"string"==typeof e.class&&o.classList.add(e.class),i.appendChild(o),a._updateTaskColor(o),t&&(l.collapsed?i.toRefresh=!0:i.refresh()))}getTaskScrollViewer(e,t){const a=this,s=a.dataSourceMap;let l;return a._hasSwimlane(e.index)?void 0!==t[s.swimlane]&&a.swimlanes.find((e=>e.dataField===t[s.swimlane]))?l=e.querySelector(`smart-scroll-viewer[swimlane="${t[s.swimlane]}"]`):(l=e.querySelector("smart-scroll-viewer"),t[s.swimlane]=l.getAttribute("swimlane")):(l=e.querySelector("smart-scroll-viewer"),delete t[s.swimlane]),l}_renderTask(e){const t=this;t._applyTaskTemplate(e),t._updateUserIcon(e),t._updateTaskChecked(e),t._updateTaskProgress(e),t._updateTaskDueDate(e),e.parentElement&&t._updateTaskColor(e),t._updateTaskPriority(e),e.column&&t.columnSummary&&t._updateColumnSummary(e.column),t.onTaskRender&&t.onTaskRender(e,e.data)}_refreshSummaries(){const e=this,t=e.querySelectorAll(".smart-kanban-column");for(let a=0;a<t.length;a++){const s=t[a].column;e._updateColumnSummary(s)}}_updateColumnSummary(e){const t=this,a=t._columnToElement.get(e);if(!a||!t.columnSummary)return;const s=t._getColumnSummary(e),l=a.querySelector(".summary");if(l&&(l.innerHTML=s),t.columnFooter){const l=a.querySelector(".smart-kanban-column-footer");if(s.length){let e=parseInt(s.replace("(","").replace(")","").trim());l.innerHTML=1===e?t.localize("tasksSummaryOne"):t.localize("tasksSummary",{summary:e})}else l.innerHTML="";t.onColumnFooterRender&&t.onColumnFooterRender(l,e,e.dataField)}}_createImageModal(e,t){const a=this,s=document.createElement("smart-window");s.animation=a.animation,s.headerButtons=["close"],s.rightToLeft=a.rightToLeft,s.resizeMode="none",s.theme=a.theme,s.style.height="auto",s.style.width="auto",s.style.maxWidth="1200px",s.style.maxHeight="1200px",document.body.appendChild(s),s.onclose=()=>{document.body.removeChild(s)},s.innerHTML="",s.label=e.title;const l=e.cloneNode(!0);l.removeAttribute("onpointerdown"),l.removeAttribute("width"),l.removeAttribute("height"),l.style.maxWidth="1000px",l.style.maxHeight="1000px",s.appendChild(l),s.open(),t.stopPropagation(),t.preventDefault()}_applyTagsContent(e,t,a){const s=this;let l=s.tags;const o=s.dataSourceMap;l||(l=[]);let r="";if(e&&e.indexOf&&e.indexOf("{")>=0&&(e=JSON.parse(e)),e&&"string"==typeof e){e=e.split(",");for(let t=0;t<e.length;t++)e[t]=e[t].trim();l&&l.length>0?(e=e.filter((e=>{if(-1!==l.indexOf(e))return!0})),t[o.tags]=e.join(", ")):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=[],r=e.map((e=>`<span class="smart-kanban-task-tag" role="listitem">${e}</span>`)).join("")}else e&&"object"==typeof e?(Array.isArray(e)||(e=[e],t[o.tags]=e),l.length>0?(e=e.filter((e=>{if(-1!==l.indexOf(e))return!0;if(e.value){let t=!1;if(l.find((a=>{a===e.value&&(t=!0),a.value===e.value&&(t=!0)})),t)return!0}})),t[o.tags]=e):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=[],r=e.map((e=>{if(e.color){const t=e.color||"rgba(var(--smart-primary-rgb), 0.15)",a=document.createElement("div");document.body.appendChild(a),a.style.backgroundColor=t;const s=getComputedStyle(a).backgroundColor;return a.remove(),`<span style="color: ${new Smart.Color(s).getInvertedColor()}; background: ${t} " class="smart-kanban-task-tag" role="listitem">${e.label}</span>`}return`<span class="smart-kanban-task-tag" role="listitem">${"string"==typeof e?e:e.label}</span>`})).join("")):t[o.tags]="";return r}_applyTaskTemplate(e){const t=this,a=t.dataSourceMap,s=(t.tags,e.data),l=t._tabindex;let o=s[a.text],r=s[a.description],i=s[a.tags],n="",d=o;void 0===o&&(o="",s[a.text]="",d=o),void 0===r&&(r="",s[a.description]=""),o=t._applyTextTemplate(o,s,e),n=t._applyTagsContent(i,s,e),"string"==typeof s[a.priority]&&(s[a.priority]=s[a.priority].toLowerCase());const c=t._getPriority();let u=c.findIndex((e=>e.value===s[a.priority]));const m=c.length>0&&u>=0?c[u]:null;s[a.comments]&&Array.isArray(s[a.comments])||(s[a.comments]=[]);const p=t.localize(s[a.priority])+" "+t.localize("priority");let h=d?`${d}: ${p}`:`${p}`;t.taskPriority||(h=d);let g=`<div class="smart-kanban-task-cover"></div><div title="${h}" class="smart-kanban-task-content" role="presentation">\n <div class="smart-kanban-task-text">${o}`;g+=m?`${m.menuIcon}`:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',g+=`</div>\n <div class="smart-kanban-task-user"${l} role="button" aria-haspopup="listbox"></div>\n</div>\n<div class="smart-kanban-task-info" role="presentation">\n <div class="smart-kanban-task-progress-container">\n <div class="smart-kanban-task-progress" role="progressbar" aria-label="Task progress" aria-valuemin="0" aria-valuemax="100"></div>\n <div class="smart-kanban-task-checked" aria-label="Completed sub-tasks"></div>\n </div>\n <div class="smart-kanban-task-due" aria-label="Task due date"></div>\n</div>\n<div class="smart-kanban-task-fields"></div>\n<div class="smart-hidden smart-kanban-task-subtasks">\n <div class="smart-kanban-task-subtasks-container"></div>\n <div><input class="smart-kanban-task-input smart-input" placeholder="${t.localize("newSubtask")}"/></div>\n</div>\n<div class="smart-hidden smart-kanban-task-custom-fields"></div>\n<div class="smart-kanban-task-footer" role="toolbar" aria-label="Task footer">\n <div class="smart-kanban-task-tags" role="list" aria-label="Tags list">${n}</div>\n <div class="smart-kanban-task-edit smart-hidden"${l} title="${t.localize("edit")}" role="button" aria-label="Edit"></div>\n <div title="${t.localize("actionsList")}" class="smart-kanban-task-actions"${l} role="button" aria-haspopup="menu" aria-label="Open actions list"></div>\n <div class="smart-kanban-task-comments"${l} num="${s[a.comments].length||""}" role="button" aria-haspopup="dialog" aria-label="Open comments list"></div>\n <div class="smart-kanban-task-description smart-hidden"${l} title="${t.localize("taskDescription",{value:s[a.description]})}" num="${s[a.description].length||""}" role="button" aria-label="Show description"></div>\n</div>`,e.innerHTML=g,e.setAttribute("aria-label",s[a.text]);const b=e.querySelector(".smart-kanban-task-description");s[a.description]?b.classList.remove("smart-hidden"):b.classList.add("smart-hidden");const f=e.querySelector(".smart-kanban-task-edit");t.editable?f.classList.remove("smart-hidden"):f.classList.add("smart-hidden"),f.onpointerdown=a=>{t.beginEdit(e),a.preventDefault(),a.stopPropagation()},t._updateTaskCustomFields(e),t._updateTaskSubtasks(e)}_updateTaskCustomFields(e){const t=this,a=e.data;if(t.taskCustomFieldsHide){const t=e.querySelector(".smart-kanban-task-custom-fields");t&&t.classList.remove("smart-hidden")}else if(t.taskCustomFields.length>0&&!t.taskCustomFieldsHide){const s=e.querySelector(".smart-kanban-task-custom-fields");s.classList.remove("smart-hidden");for(let l=0;l<t.taskCustomFields.length;l++){const o=t.taskCustomFields[l];let r=a[o.dataField],i="";if(t.dataSourceMap[o.dataField])continue;if("password"===o.editor)continue;if(null==r||!1===o.visible){const t=e.querySelector("[data-field="+o.dataField+"]");t&&t.classList.add("smart-hidden");continue}if(void 0===o.visible&&(o.visible=!0),void 0===o.allowHide&&(o.allowHide=!0),"string"==typeof r&&(!o.dataSource||o.dataSource&&0===o.dataSource.length)){if(r.length>50)if(r.indexOf("base64")>=0){r=JSON.parse(r),window.Smart._createSmartImageModal=t._createImageModal;let e="";for(let t=0;t<r.length;t++){const a=r[t];e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${a.value}" title="${a.label}"/>`}r=e}else if(o.image&&r.indexOf("http")>=0){if(window.Smart._createSmartImageModal=t._createImageModal,r.indexOf(",")>=0){let e="";r=r.split(",");for(let t=0;t<r.length;t++)e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${r[t]}"/>`;r=e}else r=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${r}"/>`;if(o.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=r}}else i=r,r=r.substring(0,50)+"..."}else if(o.image){if(r=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${r}"/>`,o.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=r}}else if("dateInput"===o.editor)r=new Smart.Utilities.DateTime(r).toString(this.formatStringDate);else if(o.dataSource)if(r&&r.indexOf(",")>0&&(r=r.split(",")),void 0!==r&&Array.isArray(r)){let e=[];for(let t=0;t<r.length;t++){const a=o.dataSource.find((e=>{if(e.value===r[t])return e}));a&&e.push(a.label)}r=e.toString()}else{const e=o.dataSource.find((e=>{if(e.value===r)return e}));e&&e.label&&(r=e.label)}const n=e.querySelector("[data-field="+o.dataField+"]");if(n)n.innerHTML=`<div class="smart-kanban-task-field-label">${o.label}</div><div title="${i}" class="smart-kanban-task-field-value">${r}</div>`,n.classList.remove("smart-hidden");else{const e=document.createElement("div");e.classList.add("smart-kanban-task-field"),e.setAttribute("data-field",o.dataField),e.innerHTML=`<div class="smart-kanban-task-field-label">${o.label}</div><div title="${i}" class="smart-kanban-task-field-value">${r}</div>`,s.appendChild(e)}}}}_updateTaskSubtasks(e){const t=this;if("none"===t.taskSubTasks)return void e.querySelector(".smart-kanban-task-subtasks").classList.add("smart-hidden");const a=e.data,s=t.dataSourceMap,l=[],o=[];(a[s.checklist]||[]).forEach(((e,t)=>{e.completed&&l.push(t),o.push({label:e.text,selected:!0===e.completed})}));const r=e.querySelector(".smart-kanban-task-subtasks"),i=e.querySelector(".smart-kanban-task-subtasks-container");i.innerHTML="",r.classList.remove("smart-hidden");const n=e.querySelector(".smart-kanban-task-input");t._currentUser&&!t._currentUser.allowEdit||t.disabled||!t.taskSubTasksInput?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"),n.onchange=function(){a[s.checklist]||(a[s.checklist]=[]);const l=JSON.parse(JSON.stringify(a));a[s.checklist].push({text:n.value,completed:!1}),n.value="",t._updateTaskSubtasks(e);const o=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:o.id,value:o,oldValue:l}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:l})},o.length&&o.forEach(((l,r)=>{const n=document.createElement("div"),d=l.label;n.innerHTML=`<div data-index="${r}" class="smart-kanban-sub-task"><span title="${d}" class="smart-truncate label">${d}</span><span class="remove-subtask" aria-label="Remove subtask" title="${t.localize("removeSubtask")}"></span></div>`,l.selected&&n.firstChild.classList.add("selected"),"onlyUnfinished"===t.taskSubTasks&&l.selected&&n.classList.add("smart-hidden");let c=!0;(t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(c=!1),n.querySelector(".remove-subtask").style.opacity=c?1:0,n.onclick=l=>{let r=!0;if((t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(r=!1),!r)return;const i=JSON.parse(JSON.stringify(a)),d=parseInt(n.firstChild.getAttribute("data-index")),c=o[d];l.target.classList.contains("remove-subtask")?(o.splice(d,1),n.classList.add("smart-hidden"),a[s.checklist].splice(d,1)):(n.firstChild.classList.toggle("selected"),c.selected=!c.selected,a[s.checklist][d].completed=c.selected,"onlyUnfinished"===t.taskSubTasks&&c.selected&&n.classList.add("smart-hidden")),t._updateTaskChecked(e);const u=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:u.id,value:u,oldValue:i}),t.$.fireEvent("taskUpdate",{id:u.id,value:u,oldValue:i}),l.preventDefault(),l.stopPropagation()},i.appendChild(n)}))}_applyTextTemplate(e,t,a){const s=this;let l=this.textTemplate;if(!l)return e;let o="";if("function"==typeof l){const s={data:t,task:a,text:e,template:null};if(l(s),e=s.text,null===s.template)return e;l=s.template}if(l.startsWith("#")){const a=document.querySelector(l);if(a&&a instanceof HTMLTemplateElement){const l=a.content.cloneNode(!0),r=document.createElement("div");return r.appendChild(l),e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),o=r.innerHTML.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),o.indexOf("{{text=")>=0&&(e?(o=o.substring(0,o.indexOf("{{text="))+e+o.substring(o.indexOf("}")),o=o.replace(/}/gi,""),o=o.replace(/{/gi,"")):(o=o.replace(/{{text=/gi,""),o=o.replace(/}}/gi,""))),o}}return o=l.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),o}_updateUserIcon(e){const t=this,a=this.dataSourceMap,s=e.data,l=e.getElementsByClassName("smart-kanban-task-user")[0];if(void 0!==s[a.userId]&&null!==s[a.userId]){const e=this.users.find((e=>e.id.toString()===s[a.userId].toString()));if(e)return s[a.userId]!==e.id&&(s[a.userId]=e.id),l.classList.remove("empty"),l.style.backgroundImage='url("'+e.image+'")',l.setAttribute("title",t.localize("assignedTask",{userName:e.name||e.id})),void l.setAttribute("aria-label","Icon of user "+(e.name||e.id))}s[a.userId]=null,l.classList.add("empty"),l.style.backgroundImage=null,l.setAttribute("aria-label","Empty user icon"),l.setAttribute("title",t.localize("unassignedTask"))}_updateTaskComments(e){const t=this.dataSourceMap,a=e.data;e.querySelector(".smart-kanban-task-comments").setAttribute("num",a[t.comments].length||"")}_updateTaskProgress(e){const t=this.dataSourceMap,a=e.data,s=e.querySelector(".smart-kanban-task-progress");let l=a[t.progress];if(void 0===l){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}if(l=parseFloat(l),isNaN(l)){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}l=Math.max(0,Math.min(parseFloat(l),100)),a[t.progress]=l,s.style.width=l+"%",s.classList.toggle("bottom",null!==a[t.checklist]),s.setAttribute("aria-valuenow",l);const o=this.localize("taskProgress",{value:l});s.parentElement.setAttribute("title",o)}_updateTaskChecked(e){const t=this.dataSourceMap,a=e.data,s=a[t.checklist],l=e.querySelector(".smart-kanban-task-checked");if(s&&Array.isArray(s)&&s.length>0?l.innerHTML=this._getCompletedSubTasks(s):(a[t.checklist]=null,l.innerHTML=""),l.innerHTML.length>0){let e=0;s.forEach((t=>t.completed&&e++));const t=e,a=s.length,o=this.localize("taskCompleted",{value:t,count:a});l.setAttribute("title",o)}else l.removeAttribute("title")}_getCompletedSubTasks(e){if(null===e)return"";let t=0;return e.forEach((e=>e.completed&&t++)),t+"/"+e.length}_updateTaskDueDate(e){const t=this.dataSourceMap;let a=e.data,s=a[t.dueDate],l=e.querySelector(".smart-kanban-task-due");if(s&&"string"==typeof s&&(s=new Date(s),s.setTime(s.getTime()-1*s.getTimezoneOffset()*60*1e3),a[t.dueDate]=s),s)if(l.innerHTML=new Smart.Utilities.DateTime(s).toString(this.formatStringDate),l.classList.toggle("overdue",s.getTime()<(new Date).getTime()&&100!==a[t.progress]),l.classList.contains("overdue")){const e=Math.abs(new Date-s),t=Math.ceil(e/864e5);l.setAttribute("title",this.localize("overdue")+" "+t+" "+this.localize("days"))}else l.removeAttribute("title");else a[t.dueDate]=null,l.innerHTML="",l.classList.remove("overdue"),l.removeAttribute("title");a[t.startDate]?"string"==typeof a[t.startDate]&&(a[t.startDate]=new Date(a[t.startDate]),a[t.startDate].setTime(a[t.startDate].getTime()-1*a[t.startDate].getTimezoneOffset()*60*1e3)):a[t.startDate]=null}_updateTaskColor(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".smart-kanban-task-progress-container"),o=e.querySelector(".smart-kanban-task-progress"),r=t.rightToLeft?"borderRightColor":"borderLeftColor";function i(e){let t=parseFloat(e).toString(16);return t="0".repeat(2-t.length)+t,t.toUpperCase()}if(e.style.borderLeftColor=null,e.style.borderRightColor=null,e.style.borderLeftWidth="",e.style.borderRightWidth="",s[a.color]){e.style[r]=s[a.color];const d=getComputedStyle(e)[r],c="dark"===t.theme?.4:.1;t.taskColor?e.style[r]=s[a.color]:(e.style[r]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px"),s[a.color]=(n=(n=d).match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+i(n[1])+i(n[2])+i(n[3]):null,l&&(l.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`,o.style.backgroundColor=d),t.taskColorEntireSurface&&(e.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`)}else{if(s[a.color]=null,l&&(l.style.backgroundColor=null,o.style.backgroundColor=null),t.taskColorEntireSurface){const a=getComputedStyle(e)[r],s="dark"===t.theme?.4:.1;e.style.backgroundColor=`rgba(${a.slice(4,a.length-1)}, ${s})`}t.taskColor||(e.style[r]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px")}var n}_updateTaskPriority(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".priority");l.className="priority";let o="";s[a.priority]&&(l.className+=" "+s[a.priority],o=t.localize(s[a.priority])+" "+t.localize("priority"));const r=s[a.text],i=e.querySelector(".smart-kanban-task-content");t.taskPriority?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),i&&(r&&t.taskPriority&&o?i.setAttribute("title",`${r}: ${o}`):i.removeAttribute("title"))}_validateSwimlanes(){const e=this,t=e.swimlanesFrom,a=e.swimlanesTo,s=[];t<0&&(e.swimlanesFrom=0),null!==a&&t>a&&(e.swimlanesFrom=a),e.swimlanes.forEach((e=>{"string"==typeof e&&(e={dataField:e,label:e}),(e.dataField||e.label)&&(e.label||(e.label=e.dataField),e.dataField||(e.dataField=e.label),s.push(e))})),e.swimlanes=s}_handleSwimlanes(e){const t=this,a=t.swimlanes;if(0===a.length||0===t.columns.length)return;const s=t.columns,l=parseFloat(getComputedStyle(t).getPropertyValue("--smart-kanban-header-size")),o=t.$.container,r=t.$.container.getBoundingClientRect(),i=t.$.container.querySelectorAll(".smart-kanban-column.has-swimlane");let n=i[0],d=i[i.length-1];if(t.rightToLeft){let e=n;n=d,d=e}const c=n.getBoundingClientRect(),u=i.length>1?d.getBoundingClientRect():c,m=Array.from(n.getElementsByTagName("smart-scroll-viewer"));let p,h,g,b,f=!1,v=!0,k=t.swimlanesTo;null===k&&(k=s.length-1),e&&(p=o.getElementsByClassName("swimlane")),n.column.collapsed&&(n.classList.remove("collapsed"),f=!0);for(let e=t.swimlanesFrom;e<=k;e++)v=v&&s[e].collapsed;v||(h=u.right-c.left+"px",g=c.left-r.left+"px",b=m.map((e=>e.getBoundingClientRect().top-r.top-l-t._dataViewPadding+"px"))),a.forEach(((t,a)=>{let s;e?s=p[a]:(s=document.createElement("div"),s.innerHTML=`<div class="swimlane-label">${t.label}</div>`,s.className="swimlane",s.setAttribute("role","heading"),s.setAttribute("aria-level",2),t.color&&(s.style.backgroundColor=t.color)),s.classList.toggle("smart-visibility-hidden",v),v||(s.style.width=h,s.style.left=g,s.style.top=b[a]),e||o.appendChild(s)})),f&&n.classList.add("collapsed")}_renderColumns(){const e=this,t=e.collapsible,a=[],s=e.$.body,l=document.createDocumentFragment();let o=e.columns;const r=e.context;if(e.context=e,e._columnToElement=new Map,e._columnContainers=[],0===o.length){const t=e.dataSource;t&&0!==t.length&&(o=[],t.forEach((t=>{const a=t[e.dataSourceMap.status];a&&-1===o.indexOf(a)&&o.push(a)})))}!function e(a,s,l){const o=[];let r=0;if(a.forEach((a=>{"string"==typeof a&&(a={dataField:a,label:a}),void 0!==a.dataField&&(void 0===a.label&&(a.label=a.dataField),void 0===a.dataField&&(a.dataField=a.label),"horizontal"!==a.orientation&&(a.orientation="vertical"),!1!==a.collapsible&&(a.collapsible=!0),a.collapsed&&t&&a.collapsible?r++:a.collapsed=!1,!1!==a.addNewButton&&(a.addNewButton=!0),!1!==a.allowRemove&&(a.allowRemove=!0),!1!==a.allowHide&&(a.allowHide=!0),!1!==a.editable&&(a.editable=!0),!1!==a.reorder&&(a.reorder=!0),0===l?delete a.selected:!0===a.selected?o.push(a):a.selected=!1,a.columns&&(a.validColumns=[],e(a.columns,a.validColumns,l+1),a.columns=a.validColumns,delete a.validColumns),s.push(a))})),r&&r===s.length&&(s[0].collapsed=!1),o.length>1)for(let e=o.length-2;e>=0;e--)o[e].selected=!1;else l>0&&0===o.length&&s.length>0&&(s[0].selected=!0)}(o,a,0),0===e.swimlanes.length?"columns"===e.hierarchy?e._createColumnElements(a,l,s,1):e._createColumnElementsTabs(a,l,s):e._createColumnElementsSwimlanes(a,l,s),s.appendChild(l),e._selectedTabs=e._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),e._autoSaveState("tabs"),e.context=r}_createAddNewButton(){const e=this,t=e.querySelectorAll(".smart-kanban-add-new-button");t.length&&t.forEach((e=>{e.remove()})),e.addNewButton&&"top"!==e.addNewButtonDisplayMode&&(e.addNewButtons=[],e.querySelectorAll(".smart-kanban-column").forEach((t=>{const a=t.querySelector(".smart-scroll-viewer");if(a){const s=(()=>{const t=document.createElement("div");return t.setAttribute("add-new-button",""),t.classList.add("smart-kanban-add-new-button"),t.title=e.localize("addNewTask"),t.onclick=()=>{if(t.column){const e=t.column.querySelector(".smart-kanban-column-header-add");e&&e.click()}},t})(),l=t.column;if(!l||l&&l.collapsed||l&&!l.addNewButton)return;t.appendChild(s);const o=()=>{const l=a.getBoundingClientRect(),o=t.querySelectorAll(".smart-kanban-task"),r=e.offset(e);if(0===o.length){const a=t.querySelector(".smart-kanban-column-header"),l=e.offset(a).top-r.top,o=e.autoColumnHeight?60:0;s.style.top=l+o+a.offsetHeight+"px"}else{const t=o[o.length-1],i=e.offset(t),n=e.offsetHeight-2*s.offsetHeight,d=i.top-r.top+t.offsetHeight;if(a.computedVerticalScrollBarVisibility){const t=e.getBoundingClientRect();s.style.top=Math.min(l.top-t.top+a.offsetHeight,n)+"px"}else s.style.top=Math.min(d,n)+"px"}const i=t.offsetWidth-a.offsetWidth;s.style.left=l.left+a.offsetWidth/2-i-s.offsetWidth/2-r.left+e.$.scrollViewer.scrollLeft+"px"};s.refresh=o,s.column=t,t.addNewButton=s,s.refresh(),e.addNewButtons.push(s),requestAnimationFrame((()=>{s.classList.add("show")}))}})),e._refreshSummaries())}_refreshColumnHeights(){const e=this;e.autoColumnHeight&&e.querySelectorAll(".smart-kanban-column").forEach((t=>{const a=t.querySelector(".smart-scroll-viewer");if(a){const s=t.column;if(!s||s&&s.collapsed||s&&!s.addNewButton)return;const l=t.querySelectorAll(".smart-kanban-task"),o=t.querySelector(".smart-kanban-column-header"),r=t.querySelector(".smart-kanban-column-footer"),i=r?r.offsetHeight:0;if(0===l.length)t.style.height=100+i+o.offsetHeight+"px";else{const a=e.offset(e),s=l[l.length-1],r=e.offset(s),n=e.offsetHeight,d=o.offsetHeight+i+r.top-a.top+s.offsetHeight;t.style.height=n<d?"":d-i+"px"}a.refresh(),e._refreshEmptyColumnState(a)}}))}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")},e}_createColumnElements(e,t,a,s){const l=this,o=l.id,r=[],i=[];let n=0;const d=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;if(e.forEach(((a,c)=>{const u=document.createElement("div");let m=`${l._getColumnHeader(a,c<e.length-1,s)}\n <div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`,p=0;if(l.columnFooter&&(m+='<div class="smart-kanban-column-footer"></div>'),a.columns?(m=m.replace("AAA",""),m=m.replace("BBB",'<div class="smart-kanban-column-content-columns" role="presentation"></div>')):(m=m.replace("AAA"," no-sub-columns"),m=m.replace("BBB","")),u.className="smart-kanban-column",u.setAttribute("data-field",a.dataField),u.setAttribute("role","group"),u.setAttribute("aria-labelledby",`${o}ColumnHeaderLabel${a.dataField}`),u.setAttribute("orientation",a.orientation),a.color&&l.applyColumnColorToTasks&&u.style.setProperty("--smart-primary",a.color),a.collapsible&&u.setAttribute("collapsible",""),a.addNewButton&&u.setAttribute("add-new-button",""),u.innerHTML=m,u.siblingColumns=e,t.appendChild(u),u.column=a,u.index=c,l.onColumnHeaderRender&&l.onColumnHeaderRender(u.querySelector(".smart-kanban-column-header"),a,a.dataField),l._columnToElement.set(a,u),a.columns){const e=u.querySelector(".smart-kanban-column-content-columns");p=l._createColumnElements(a.columns,e,e,s+1),n+=p}else n+=1;let h=(p||1)+"fr";l.columnWidth?h=d(l.columnWidth):a.width&&(h=d(a.width)),!1!==a.visible?(a.collapsed?(u.classList.add("collapsed"),r.push("auto")):r.push(h),i.push(h)):u.classList.add("smart-hidden"),l._allColumns.push(a)})),1===s&&l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth;e=d(t),r.push(e)}else r.push("var(--smart-kanban-add-new-column-width)");return a.style.gridTemplateColumns=r.join(" "),a.fractions=i,l._columnContainers.push(a),n}_createColumnElementsTabs(e,t,a,s){const l=this,o=l.id,r=[],i=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`<div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`;if(a.columns?(c=c.replace("AAA",""),c=c.replace("BBB",'<div class="smart-kanban-column-content-columns has-tabs" role="presentation"></div>')):(c=c.replace("AAA"," no-sub-columns"),c=c.replace("BBB","")),d.className="smart-kanban-column",d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),s){const e=document.createElement("div"),t=`${o}Tab${a.dataField}`,r=`${o}Column${a.dataField}`;e.id=t,e.className="smart-kanban-tab smart-unselectable",l.disabled||l.unfocusable||(e.tabIndex=0),e.setAttribute("role","tab"),e.setAttribute("aria-controls",r),e.innerHTML=`<div class="smart-kanban-tab-label">${a.label}</div>`,e.columnElement=d,d.id=r,d.setAttribute("role","tabpanel"),d.setAttribute("aria-labelledby",t),d.tab=e,s.appendChild(e),a.selected?e.classList.add("selected"):d.classList.add("smart-hidden"),e.setAttribute("aria-selected",a.selected)}else c=l._getColumnHeader(a,n<e.length-1)+c,d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${o}ColumnHeaderLabel${a.dataField}`);if(d.innerHTML=c,d.siblingColumns=e,t.appendChild(d),d.column=a,d.index=n,l._columnToElement.set(a,d),a.columns){const e=d.querySelector(".smart-kanban-column-content-columns"),t=document.createElement("div");t.className="smart-kanban-tab-strip",t.setAttribute("role","tablist"),e.appendChild(t),l._createColumnElementsTabs(a.columns,e,e,t)}s||(a.collapsed?(d.classList.add("collapsed"),r.push("auto")):r.push("1fr"),i.push("1fr")),l._allColumns.push(a)})),!s){if(l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth),r.push(e)}else r.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=r.join(" "),a.fractions=i,l._columnContainers.push(a)}}_createColumnElementsSwimlanes(e,t,a){const s=this,l=s.id,o=s.swimlanes,r=[],i=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`${s._getColumnHeader(a,n<e.length-1)}\n <div class="smart-kanban-column-content no-sub-columns" role="presentation"></div>`;d.className="smart-kanban-column",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${l}ColumnHeaderLabel${a.dataField}`),d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),d.innerHTML=c,d.siblingColumns=e;const u=d.children[1];let m="";if(s._hasSwimlane(n)){let e=[];for(let t=0;t<o.length;t++)m+=`<smart-scroll-viewer class="smart-kanban-column-content-tasks" swimlane="${o[t].dataField}"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`,e.push("1fr");d.classList.add("has-swimlane"),u.classList.add("has-swimlane"),u.style.gridTemplateRows=e.join(" ")}else m=`<smart-scroll-viewer class="smart-kanban-column-content-tasks"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`;u.innerHTML=m,t.appendChild(d),d.column=a,d.index=n,s._columnToElement.set(a,d),a.collapsed?(d.classList.add("collapsed"),r.push("auto")):r.push("1fr"),i.push("1fr"),s._allColumns.push(a)})),s.addNewColumn)if(s._appendAddNewColumn(t),s.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(s.addNewColumnWidth?s.addNewColumnWidth:s.columnWidth),r.push(e)}else r.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=r.join(" "),a.fractions=i,s._columnContainers.push(a)}_getColumnSummary(e){const t=this.getColumnDataItems(e.dataField);return this.columnSummary&&t.length?" ("+t.length+")":""}_getColumnHeaderTemplate(e,t){const a=e.headerTemplate||this.columnHeaderTemplate;if(a){const s=document.createElement("div");let l;if("string"==typeof a&&a.startsWith("#")?l=document.querySelector(a):"string"==typeof a&&(l=a),"function"==typeof a){const s=a(e,t);return s||t}if(l instanceof HTMLTemplateElement){s.appendChild(l.content.cloneNode(!0));const t=/{{\w+}}/g;let a=s.innerHTML;const o=t.exec(a);for(let t=0;t<o.length;t++){const t=e[o[0].replace("{{","").replace("}}","")];a=a.replace(o[0],t)}return a}return l instanceof HTMLElement?s.appendChild(l):s.innerHTML=l,s.innerHTML}return null}_getColumnHeader(e,t,a=1){const s=this,l=s._tabindex,o=e.collapsed?s.localize("expand"):s.localize("collapse"),r=s.localize("addNewTask"),i=s.allowColumnEdit||s.allowColumnRemove||s.allowColumnHide?"settings":"",n=s.localize("customizeColumn");let d=e.label;""===d&&(d=" ");const c=s._getColumnSummary(e);let u=`<span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span>`,m="smart-kanban-column-header-label";if(void 0!==e.color){if(e.color){const t=new Smart.Color(e.color).getInvertedColor();u=`<div class="heading" style="background: ${e.color}; color: ${t};"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`}else u=`<div class="heading"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`;m+=" pill"}const p=null!==s.columnHeaderTemplate||e.headerTemplate?s._getColumnHeaderTemplate(e,u):u,h="bottom"===s.addNewButtonDisplayMode?"":"add-new-button";return`<div status="${e.dataField}" ${i} ${h} class="smart-kanban-column-header smart-unselectable"${l} role="heading" aria-level=${a}>\n <div title="${r}" class="smart-kanban-column-header-add ${h}"${l} role="button" aria-label="Add new task"></div>\n <div id="${s.id}ColumnHeaderLabel${e.dataField}" class="${m}">${p}</div>\n <div title="${o}" class="smart-kanban-column-header-toggle-button smart-arrow smart-arrow-${t?"left":"right"}" role="button" aria-hidden="true"></div>\n <div title="${n}" class="smart-kanban-column-actions smart-kanban-column-header-settings-button" role="button" aria-haspopup="menu" aria-label="Open actions list" aria-hidden="true"></div>\n </div>`}_hasSwimlane(e){const t=this;if(0===t.swimlanes.length)return!1;const a=t.swimlanesFrom;let s=t.swimlanesTo;return null===s&&(s=t.columns.length-1),e>=a&&e<=s}_updateColumnWidths(e,t){const a=this,s=t.fractions,l=[];let o=0,r=0;for(let t=0;t<e.length;t++){const i=e[t];!1!==i.visible&&(l.push(e[t].collapsed?"auto":s[o++]),!i.collapsed&&a.columnWidth&&(r+=i.width?i.width:a.columnWidth))}if(t===a.$.body&&a.addNewColumn)if(a.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(a.addNewColumnWidth?a.addNewColumnWidth:a.columnWidth),l.push(e)}else l.push("var(--smart-kanban-add-new-column-width)");r<a.offsetWidth&&a.columnWidth&&l.push("1fr"),t.style.gridTemplateColumns=l.join(" "),a.columnWidth&&a.$.scrollViewer.refresh()}_validateColumnArgument(e){if(!isNaN(e))return this.columns[e];const t=this._allColumns;return"string"==typeof e?t.find((t=>t.dataField===e)):"object"==typeof e?t.find((t=>t===e)):null}_resizeHandler(){this.$.scrollViewer&&(this.$.scrollViewer.scrollLeft=0),this.refresh("resize")}refresh(e){const t=this;"resize"===e?(clearTimeout(t._resizeTimeout),t._resizeTimeout=setTimeout((function(){t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}),50),t._handleSwimlanes(!0)):(t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t._closeList(t._priorityList,"_prioritySelectionFor"),t._resetFields=!0,t._render()),t.$.scrollViewer.refresh()}_refreshScrollViewer(e,t){const a=this,s=e instanceof HTMLElement?e:this._columnToElement.get(e);function l(l,o){if(!t&&l&&l.$.scrollViewerContentContainer&&""===l.$.scrollViewerContentContainer.innerHTML.trim())return a.virtualization&&a._refreshScrollHeight(l,e.dataField),void a._refreshEmptyColumnState(l);if(e.collapsed?l.toRefresh=!0:(delete l.toRefresh,requestAnimationFrame((()=>{if(l.refresh(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField);0===o&&"horizontal"===e.orientation&&(a.columnWidth||(l.$.content.offsetWidth<=2*a._kanbanTaskMinWidth+a._dataViewPadding?s.setAttribute("orientation","vertical"):"vertical"===s.getAttribute("orientation")&&s.setAttribute("orientation","horizontal")))}))),a._refreshButtonsAndSummaries(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField)}e instanceof Smart.ScrollViewer?l(e):this.swimlanes.length>0?Array.from(s.querySelectorAll("smart-scroll-viewer")).forEach(((e,t)=>l(e,t))):l(s.querySelector("smart-scroll-viewer"),0)}_containerDownHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,s=a.closest(".smart-kanban-task");if(delete t._preventSelection,t.allowColumnReorder){const l=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button");if(!s&&l&&!t._columnEditing){const s=a.closest(".smart-kanban-column");if(s){const a=e.originalEvent.composedPath();let l=0;for(let e=0;e<a.length;e++)a[e].classList&&a[e].classList.contains("smart-kanban-column")&&l++;s.column.reorder&&l<=1&&(t._columnDragDetails={x:e.pageX,y:e.pageY,event:e,kanbanColumn:s})}}}const l=a.closest(".smart-kanban-column"),o=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button"),r=l?l.column:null;if(r){if(o&&t.$.fireEvent("columnClick",{column:r}),new Date-t._clickTime<=300)return!s&&o&&!t._columnEditing&&t.allowColumnEdit&&(t._columnDragDetails=null,!1===r.collapsed&&r.editable&&"menu"!==t.columnEditMode&&t._handleColumnEditing(r.dataField)),void(o&&(r.collapsed?t.expand(r):(!t.allowColumnEdit||t.allowColumnEdit&&"menu"===t.columnEditMode)&&t.collapse(r),t.$.fireEvent("columnDoubleClick",{column:r})));t._clickTime=new Date}s&&(t.virtualization?(t.focusTask(s.data.id),t._refreshColumns()):t._focusTask(s),t._startDragging(s,e))}_containerKeydownHandler(e){const t=this;if(t._dragDetails)return;const a=e.key,s=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;function l(a=s){delete t._preventSelection,t._documentUpHandler({originalEvent:{target:a}}),t._containerClickHandler({target:a,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey}),e.preventDefault()}if(s.closest(".smart-kanban-column, .smart-kanban-add-new-column"))return s.classList.contains("smart-kanban-column-content-tasks")?void t._selectViaKeyboard(s.$.content,e,l):void("Enter"!==a&&" "!==a||s instanceof HTMLInputElement!=0||l());if(t.$.headerDropDown.contains(s))"Escape"===a&&(t.closePanel(),t.$[/\s?([a-z]+)-panel/g.exec(t.$.headerDropDown.className)[1]+"Button"].focus());else if(!(s.classList.contains("smart-data-view-header-button")||s.closest(".smart-data-view-search-box")||s.classList.contains("remove-button"))||"Enter"!==a&&" "!==a||l(),s.classList.contains("smart-kanban-list")){const o=s;switch(a){case"ArrowDown":t._selectListItem(t._getNextItem(o));break;case"ArrowUp":t._selectListItem(t._getPrevItem(o));break;case"Home":t._selectListItem(t._getFirstItem(o));break;case"End":t._selectListItem(t._getLastItem(o));break;case"Escape":o.openedFrom.focus(),t._closeList(o,o===t._actionsList?"_actionSelectionFor":o===t._commentsList?"_commentSelectionFor":"_userSelectionFor"),o===t._columnActionsList&&t._closeList(t._columnActionsList,"_columnActionSelectionFor");break;case"Enter":case" ":{const e=t._getSelectedItem(o);e&&l(e);break}default:return}e.preventDefault()}}getTaskIndex(e){const t=this,a=t.getTask(e);if(!a)return-1;const s=a[t.dataSourceMap.status];return t._getTasksByDataField(s).findIndex((t=>{if(t.id===e)return!0}))}_getNextPrevColumn(e,t){const a=this;let s=null;return a._allColumns.forEach(((l,o)=>{if(l.dataField===e)if(t){if(o<a._allColumns.length-1)return s=a._allColumns[o+1],!0}else if(o>0)return s=a._allColumns[o-1],!0})),s}focusTask(e){const t=this;t._focusedTask=e,t.ensureVisible(e),t._refreshColumns()}_selectViaKeyboard(e,t,a){const s=this;let l=t.key;s.rightToLeft&&("ArrowRight"===l?l="ArrowLeft":"ArrowLeft"===l&&(l="ArrowRight"));const o=s._focusedTask,r=s.getTask(o);if(!r)return;const i=r[s.dataSourceMap.status],n=s._getTasksByDataField(i),d=s.getTaskIndex(o);switch(l){case"ArrowRight":{const e=s._getNextPrevColumn(i,!0);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e),a=t.querySelector(".smart-kanban-task");s._focusTask(a),t.focus()}break}case"ArrowLeft":{const e=s._getNextPrevColumn(i,!1);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e).querySelector(".smart-kanban-task");s._focusTask(t)}break}case"ArrowDown":if(s.virtualization)d<n.length-1&&s.focusTask(n[d+1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getNextItem(t,!0))}break;case"ArrowUp":if(s.virtualization)d>0&&s.focusTask(n[d-1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getPrevItem(t,!0))}break;case"Home":s.virtualization?s.focusTask(n[0].id):s._focusTask(s._getFirstItem(e));break;case"End":s.virtualization?s.focusTask(n[n.length-1].id):s._focusTask(s._getLastItem(e));break;case"Enter":case" ":case"F2":case"Delete":{const e=s.querySelector("[focus]");e&&("F2"===l||"Enter"===l?s.beginEdit(e):"Delete"===l?s.removeTask(e,!0):a(e));break}default:return}t.preventDefault()}_getFirstItem(e){const t=e.children;for(let e=0;e<t.length;e++){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getLastItem(e){const t=e.children;for(let e=t.length-1;e>=0;e--){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getPrevItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.previousElementSibling:this._getLastItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.previousElementSibling}}_getNextItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.nextElementSibling:this._getFirstItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.nextElementSibling}}_getSelectedItem(e,t){return e?t?e.querySelector("[focus]"):e.querySelector(".selected"):null}_selectListItem(e){if(!e)return;const t=e.parentElement,a=t.querySelector(".selected");a&&(a.classList.remove("selected"),a.removeAttribute("aria-selected")),e.classList.add("selected"),e.setAttribute("aria-selected",!0),t.scrollTop=e.offsetTop}_focusTask(e){if(!e)return;const t=this;Array.from(t.querySelectorAll("[focus]")).forEach((e=>e.removeAttribute("focus"))),e.setAttribute("focus",""),this._focusedTask=e.data.id,t.virtualization?t.ensureVisible(t._focusedTask):this.ensureVisible(e)}_setFocusable(){const e=this,t=e.$.container,a=e.disabled||e.unfocusable;let s=[e.$.customizeButton,e.$.filterButton,e.$.sortButton,e.$.searchButton,e.$.searchPrev,e.$.searchNext,e.$.searchClose,e._actionsList,e._userList];if(s=s.concat(Array.from(t.querySelectorAll(".smart-kanban-column-header, .smart-kanban-column-header-add, .smart-kanban-tab, .smart-kanban-column-content-tasks, .smart-kanban-task-user, .smart-kanban-task-actions, .smart-kanban-task-comments, .smart-kanban-add-new-column"))),s.forEach((e=>{a?e.removeAttribute("tabindex"):(null===e.getAttribute("tabindex")||e.getAttribute("tabindex")<0)&&e.setAttribute("tabindex",0)})),e._dialog&&e._dialog.editPanelPopulated){const t=Array.from(e._dialog.$.container.querySelectorAll(".text-editor, .new-subtask"));a?t.forEach((e=>e.tabIndex=-1)):t.forEach((e=>e.removeAttribute("tabindex"))),Array.from(e._dialog.$.container.querySelectorAll(".smart-element.editor, smart-button.add, smart-button.ok, smart-button.cancel")).forEach((e=>e.unfocusable=a)),e._dialog.unfocusable=a}}_startDragging(e,t){const a=this;if(!a._currentUser.allowDrag)return;const s=e.closest("smart-scroll-viewer"),l=e.getBoundingClientRect();let o=e.hasAttribute("selected")?Array.from(e.parentElement.querySelectorAll("[selected]")):[e],r=o.map((e=>e.data));a._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:o,ItemsData:r,ItemData:e.data,Item:e,FeedbackShown:!1,OriginalEvent:t,Column:e.classList.contains("smart-kanban-column")?e:null,PointerOffset:[l.x-t.clientX,l.y-t.clientY],ScrollViewer:s,StartTime:new Date,Dragging:!0},Smart.Kanban.kanbanTaskDragged=!0,s&&s._scrollView&&(s._scrollView.disableSwipeScroll=!0),a.allowDrop&&(Smart.Kanban.hoveredKanban=a,Smart.Kanban.hoveredItem=e)}_documentMoveHandler(e){const t=this,a=t._dragDetails;function s(){delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,a.ScrollViewer._scrollView.disableSwipeScroll=!1}if(t.allowColumnReorder&&t._columnDragDetails&&(Math.abs(e.pageX-t._columnDragDetails.x)>=3||Math.abs(e.pageY-t._columnDragDetails.y)>=3)&&(t._startDragging(t._columnDragDetails.kanbanColumn,t._columnDragDetails.event),t._columnDragDetails=null),!a)return;if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,o=Math.abs(a.StartPosition.left-e.pageX)>5||Math.abs(a.StartPosition.top-e.pageY)>5;if(!o||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&o&&!l&&s());if(t.$.fireEvent("dragStart",{item:a.Item,items:a.Items,data:a,container:t,previousContainer:t,originalEvent:a.OriginalEvent}).defaultPrevented)return void s();t.closePanel(),t._hideBodyOverflow(),a.Feedback=t._addDragFeedback(),a.FeedbackShown=!0,a.Items.forEach((e=>e.classList.add("dragged")))}const l=a=>{a.scrollWidth&&(t._autoScrollDragInterval&&clearInterval(t._autoScrollDragInterval),t._autoScrollDragInterval=setInterval((function(){const t=a.getBoundingClientRect();e.clientX<=t.left+20?a.scrollLeft-=15:e.clientX>=t.left+t.width-20&&(a.scrollLeft+=15)}),25))};Smart.Kanban.hoveredKanban?l(Smart.Kanban.hoveredKanban.$.scrollViewer):l(t.$.scrollViewer);let o,r=t.dragOffset;if(r="auto"!==r&&Array.isArray(r)?r:a.PointerOffset,t.$.fireEvent("dragging",{item:a.Item,items:a.Items,data:a,originalEvent:e}),a.Feedback.style.left=e.pageX+(r[0]||0)+"px",a.Feedback.style.top=e.pageY+(r[1]||0)+"px",Smart.Kanban.hoveredKanban&&(clearInterval(Smart.Kanban.hoveredKanban._dragInterval),delete Smart.Kanban.hoveredKanban),Smart.Kanban.hoveredItem&&(Smart.Kanban.hoveredItem.classList.remove("drop-target"),Smart.Kanban.hoveredItem.classList.remove("before","after"),delete Smart.Kanban.hoveredItem),o=t._isMobile?(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY):t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,!o)return;const i=(t.shadowRoot?o.getRootNode().host:o).closest("smart-kanban");if(!i||!i.allowDrop)return;const n=o.closest(".smart-kanban-column-content-tasks");if(Smart.Kanban.hoveredKanban=i,a.Column)return void t._handleColumnDragging(e);if(!n)return;const d=n.parentElement.parentElement.getAttribute("orientation"),c=Array.from(n.$.content.children);let u=0;if(c.forEach((e=>e.filteredOut&&u++)),0===c.length||c.length===u)return Smart.Kanban.hoveredItem=n.$.scrollViewerContainer,void Smart.Kanban.hoveredItem.classList.add("drop-target");n.scrollHeight>0&&(i._dragInterval=setInterval((function(){const a=n.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientY>=a.top&&e.clientY<=a.top+20?n.scrollTop-=t._autoScrollCoefficient:e.clientY>=a.top+a.height-20&&e.clientY<=a.top+a.height?n.scrollTop+=t._autoScrollCoefficient:clearInterval(i._dragInterval):clearInterval(i._dragInterval)}),2));let m=o.closest(".smart-kanban-task");if(m&&-1===a.Items.indexOf(m)){const t=m.getBoundingClientRect();"vertical"===d&&e.clientY-t.top<=t.height/2||"horizontal"===d&&e.clientX-t.left<=t.width/2?m.classList.add("before"):m.classList.add("after")}else{if(m&&1===c.length)return;m=m&&1===a.Items.length?t[`_${d}ClosestTaskToHover`]([m.previousElementSibling,m.nextElementSibling],e,!0):t[`_${d}ClosestTaskToHover`](c,e,m||o===n.$.content)}m&&(m.classList.add("drop-target"),Smart.Kanban.hoveredItem=m)}_handleColumnDragging(e){const t=this.querySelectorAll(".smart-kanban-column");let a;for(let s=0;s<t.length;s++){const l=t[s],o=l.getBoundingClientRect();e.clientX>=o.left&&e.clientX<=o.right&&e.clientY>=o.top&&e.clientY<=o.bottom&&(a=l)}if(a){const s=a.getBoundingClientRect();e.clientX-s.left<=s.width&&(a.classList.add("before"),a.classList.add("drop-target")),e.clientX-s.left>=s.width/2&&a===t[t.length-1]&&(a.classList.remove("before"),a.classList.add("after"),a.classList.add("drop-target")),Smart.Kanban.hoveredItem=a}}_hideBodyOverflow(){const e=this,t=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,a=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth,s=e.isInShadowDOM?e.getRootNode().host:document.body;e._originalBodyOverflow={overflowX:s.style.overflowX,overflowY:s.style.overflowY,overflow:s.style.overflow},s.classList.add("smart-dragging"),s.style.overflow=s.style.overflowX=s.style.overflowY="",t&&!a?s.style.overflowX="hidden":a&&!t?s.style.overflowY="hidden":a||t||(s.style.overflow="hidden")}_verticalClosestTaskToHover(e,t,a){const s=this._dragDetails.Items,l=t.clientY;let o,r,i=1/0,n=0,d=e.length-1,c=1;for(a||(n=d,d=0,c=-1);n!==d+c;){const t=e[n];if(n+=c,!t||t.filteredOut||-1!==s.indexOf(t))continue;if(!a){o=t,r="after";break}const d=t.getBoundingClientRect(),u=d.top+d.height/2,m=Math.abs(l-u);if(!(m<i))break;i=m,o=t,r=l<=u?"before":"after"}return o&&o.classList.add(r),o}_horizontalClosestTaskToHover(e,t){const a=this._dragDetails.Items,s=t.clientY,l=t.clientX;let o,r,i;return e.forEach((e=>{if(!e||e.filteredOut||-1!==a.indexOf(e))return;const t=e.getBoundingClientRect(),n=Math.abs(s-t.top),d=Math.abs(s-t.bottom),c=Math.min(n,d),u=Math.abs(l-t.left),m=Math.abs(l-t.right),p=Math.min(u,m),h=Math.sqrt(Math.pow(p,2)+Math.pow(c,2));(void 0===r||h<r)&&(o=e,r=h,i=u<m?"before":"after")})),o&&o.classList.add(i),o}_scrollViewerTouchmoveHandler(e){const t=this;t._dragDetails&&(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target).closest("smart-scroll-viewer")&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_documentUpHandler(e){const t=this,a=t._dragDetails;if(t._columnDragDetails=null,t.$.container.hasAttribute("modal"))return;const s=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.header;if(t._userSelectionFor&&!t._userList.contains(s)&&t._closeList(t._userList,"_userSelectionFor"),t._prioritySelectionFor&&!t._priorityList.contains(s)&&t._closeList(t._priorityList,"_prioritySelectionFor"),t._actionSelectionFor&&!t._actionsList.contains(s)&&t._closeList(t._actionsList,"_actionSelectionFor"),t._columnActionSelectionFor&&!t._columnActionsList.contains(s)&&(t._columnActionsList.classList.contains("smart-visibility-hidden")||(t._closeList(t._columnActionsList,"_columnActionSelectionFor"),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),t._columnActionsListDate=new Date)),t._commentSelectionFor){const e=t._commentsList;(t.shadowRoot||t.getRootNode()).activeElement!==e.textarea&&(t._actionSelectionFor||e.contains(s)?!e.classList.contains("expanded")||s===e.textarea||e.button.contains(s)||s.classList.contains("remove-button")||e.classList.remove("expanded"):t._closeList(e,"_commentSelectionFor"))}if(!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||s!==l&&l.contains(s))){const e=s.closest("smart-scroll-viewer"),a=s.closest(".smart-drop-down");e&&l.contains(e.ownerElement)||a&&(!a.ownerElement||l.contains(a.ownerElement))||t.closePanel()}if(!a)return;const o=Smart.Kanban.hoveredKanban,r=Smart.Kanban.hoveredItem;if(delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,a.ScrollViewer&&a.ScrollViewer._scrollView&&(a.ScrollViewer._scrollView.disableSwipeScroll=!1),!a.FeedbackShown)return;const i=o||(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY);t._preventSelection=!0;const n=t.isInShadowDOM?t.getRootNode().host:document.body;n.classList.remove("smart-dragging"),n.style.overflow=t._originalBodyOverflow.overflow,n.style.eoverflowX=t._originalBodyOverflow.overflowX,n.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,a.Feedback.remove(),o&&clearInterval(o._dragInterval);const d=a.Item,c=a.Items;if(c.forEach((e=>e.classList.remove("dragged"))),!i)return;if(!r)return void t.$.fireEvent("dragEnd",{item:d,items:c,target:i,data:a,previousContainer:t,container:i,originalEvent:e});if(!o||!o.allowDrop||o.disabled)return;let u=!1;if(r.classList.remove("drop-target"),r.classList.contains("before")?r.classList.remove("before"):r.classList.contains("after")&&(r.classList.remove("after"),u=!0),a.DropDetails={item:r,after:u},t.$.fireEvent("dragEnd",{item:d,items:c,target:r,data:a,previousContainer:t,container:o,originalEvent:e}).defaultPrevented)return;function m(e,s){t._requestVirtualDataSource("update",Object.assign({},e.data,{status:s}),(function(s){return s&&t._moveDraggedItems(Object.assign({},a,{Item:e,Items:[e]})),s}))}const p=r.closest(".smart-kanban-column"),h=p.column.dataField;if(a.Column){const e=()=>Array.from(p.parentElement.querySelectorAll(".smart-kanban-column")).filter((e=>e.parentElement===p.parentElement)),s=e().indexOf(a.Column);a.DropDetails.after?p.parentElement.appendChild(a.Column):p.parentElement.insertBefore(a.Column,p);const l=e().indexOf(a.Column),o=[],r=e();for(let e=0;e<r.length;e++)r[e].column&&!r[e].classList.contains("smart-kanban-add-new-column")&&o.push(r[e].column);return t.columns=o,t.$.fireEvent("columnReorder",{column:a.Column.column,oldIndex:s,index:l}),t._reset(),void t._createAddNewButton()}if(d&&d.data&&h!==d.data[t.dataSourceMap.status]){const e=Object.assign({},d.data);e[t.dataSourceMap.status]=h;const a=t.getColumn(h);a&&(e.statusLabel=a.label);const s=t.getColumn(d.data[t.dataSourceMap.status]);s&&(d.data.statusLabel=s.label);const l=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(d.data));if(t.$.fireEvent("change",{task:d,id:l.id,value:l,oldValue:o}),t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:o}),t._currentUser.info){const e=t.dataSourceMap;d.data[e.updatedUserId]=t._currentUser.info.id,d.data[e.updatedDate]=new Date,t.addHistory(d.data,{action:"moved",user:t._currentUser.info.id,details:{id:d.data[e.id],oldValue:o[e.status],value:l[e.status]},label:d.data[e.text],date:d.data[e.updatedDate]})}}if(t.dataSource&&t.dataSource.virtualDataSource&&h!==d.data[t.dataSourceMap.status])if(u)for(let e=c.length-1;e>=0;e--)m(c[e],h);else for(const e of c)m(e,h);else if(t._moveDraggedItems(a),d&&d.data){const e=Object.assign({},d.data),a=JSON.parse(JSON.stringify(e));t.$.fireEvent("taskReorder",{id:a.id,value:a})}}_refreshButtonsAndSummaries(){const e=this;e._refreshColumnHeights(),e.addNewButtons&&(e.addNewButtons.forEach((e=>{e.refresh()})),e._refreshSummaries())}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=e._dragDetails.Items.length,s=document.createElement("div"),l=t.offsetWidth+"px",o=t.offsetHeight+"px";let r=t.cloneNode(!0);if(r.style.width=l,r.style.height=o,t.classList.contains("smart-kanban-column")){r=document.createElement("smart-kanban");const a=Object.assign({},t.column);a.collapsed=!1;const o=[a];r.columns=o,r.dataSource=e.dataSource,r.users=e.users,r.taskActions=e.taskActions,r.taskDue=e.taskDue,r.taskProgress=e.taskProgress,r.style.height="100%",r.style.width=l,r.style.minWidth="250px",s.setAttribute("column-drag","")}if(s.className="smart-kanban-feedback",s.setAttribute("parent-kanban-id",e.id),e.theme&&s.setAttribute("theme",e.theme),["rightToLeft","taskActions","taskComments","taskDue","taskPriority","taskProgress","taskTags","taskUserIcon"].forEach((t=>{e[t]&&s.setAttribute(Smart.Utilities.Core.toDash(t),"")})),s.appendChild(r),a>1){const e=document.createElement("div");e.style.width=l,e.style.height=o,e.className="smart-kanban-feedback-additional",s.insertBefore(e,r),r.setAttribute("num",a),a>2&&e.classList.add("multiple")}return e.getShadowRootOrBody().appendChild(s),s}_moveDraggedItems(e){const t=this,a=t.dataSourceMap;let s,l=e.DropDetails,o=l.item,r=o.closest(".smart-kanban-column"),i=e.Item.closest("smart-scroll-viewer"),n=r.column;if(o.classList.contains("smart-kanban-task")?(s=o.parentElement,l.after&&(o=o.nextElementSibling,o&&o.classList.contains("smart-hidden")&&(o=null)),e.Items.forEach(((l,r)=>{if(t.virtualization){const s=e.ItemsData[r],i=s[a.status],d=t._getTasksByDataField(i),c=d.findIndex((e=>e.id===s.id));if(o){if(o.data!==l.data){d.splice(c,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(o.data);e.splice(a,0,s)}}else c>=0&&(d.splice(c,1),t._getTasksByDataField(n.dataField).push(s))}else{s.insertBefore(l,o);const i=e.ItemsData[r],d=i[a.status],c=t._getTasksByDataField(d),u=c.findIndex((e=>e.id===i.id));if(o){if(o.data!==l.data){c.splice(u,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(o.data);e.splice(a,0,i)}}else u>=0&&(c.splice(u,1),t._getTasksByDataField(n.dataField).push(i))}l.data[a.status]=n.dataField,l.data.statusLabel=n.label,l.column=n}))):(s=o.firstElementChild,e.Items.forEach((e=>{if(t.virtualization){const s=e.data[a.status],l=t._getTasksByDataField(s),o=l.findIndex((t=>t.id===e.data.id));l.splice(o,1),t._getTasksByDataField(n.dataField).push(e.data)}else{s.appendChild(e);const l=e.data[a.status],o=t._getTasksByDataField(l),r=o.findIndex((t=>t.id===e.data.id));o.splice(r,1),t._getTasksByDataField(n.dataField).push(e.data)}e.data[a.status]=n.dataField,e.data.statusLabel=n.label,e.column=n}))),s=s.closest("smart-scroll-viewer"),t.swimlanes.length>0){const t=s.getAttribute("swimlane");t?e.Items.forEach((e=>e.data[a.swimlane]=t)):e.Items.forEach((e=>delete e.data[a.swimlane]))}t.virtualization?(t._refreshColumns(),t.focusTask(e.ItemData.id)):t._focusTask(e.Item),i!==s?(s.focus(),t.textTemplate&&e.Items.forEach((e=>t._renderTask(e))),e.Item.hasAttribute("selected")&&(e.Items.forEach((e=>e.removeAttribute("selected"))),t._selectedTasks=[],t._autoSaveState("selection")),t._refreshScrollViewer(i,!0),t._refreshScrollViewer(s,!0)):t.virtualization&&t._refreshScrollViewer(i,!0),t._refreshSummaries(),t._autoSaveState("dataSource")}_getCurrentDataSource(){const e=Array.from(this.$.container.getElementsByClassName("smart-kanban-task")),t=[],a=this;if(a.virtualization){const e=Object.keys(a.tasksByDataField);let t=[];for(let s=0;s<e.length;s++){const l=e[s];let o=a._getTasksByDataField(l);t=[...t,...o]}return t}for(let a=0;a<e.length;a++)t.push(e[a].data);return t}_validateTaskArgument(e){const t=this;return e instanceof HTMLElement&&t.$.container.contains(e)&&e.classList.contains("smart-kanban-task")?e:null===e||"number"!=typeof e&&"string"!=typeof e?void 0:t.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`)}_openDialog(e,t,a="task"){const s=this,l={purpose:t};if(l[a]=e,s.$.fireEvent("opening",l).defaultPrevented)return;if(s.disableDialog)return;s._dialog||s._createDialog();const o=s._dialog,r="prompt"===t;o.refreshFieldsDirty=!0,o.openedFrom=(s.shadowRoot||s.getRootNode()).activeElement,o.classList.toggle("prompt",r),o.classList.toggle("edit",!r),o.style.top="",o.style.left="",o.style.width="",o.style.height="auto","edit"!==t||!s.readonly&&s._currentUser.allowEdit?o.removeAttribute("readonly"):o.setAttribute("readonly",""),s.offsetWidth<600&&(o.style.top="0px",o.style.left="0px",o.style.width="100%",o.style.height="100%");const i=e=>{s.applyColumnColorToTasks&&(e&&e.color?(o.style.setProperty("--smart-primary",e.color),o.style.setProperty("--smart-ui-state-active",e.color)):(o.style.setProperty("--smart-primary",""),o.style.setProperty("--smart-ui-state-active","")))};if(e&&e.column?i(e.column):"add"===t&&i(e),o.taskOrComment=e,"edit"===t?s._currentUser&&s._currentUser.allowRemove&&o.querySelector(".delete").classList.remove("smart-hidden"):o.querySelector(".delete").classList.add("smart-hidden"),o.editPanelPopulated&&(o.selectTab(0),o.editors.historyTab&&o.editors.historyTab.classList.add("smart-hidden")),r){let t="task"===a?s.localize("promptTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("promptComment"),l="task"===a?s.localize("removeTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("removeComment");"column"===a&&(t=s.localize("promptColumn"),l=s.localize("removeColumn")),o.label=l,o.setAttribute("aria-label",t),o.$.container.querySelector(".prompt").innerHTML=t}else{let a=!0;o.removeAttribute("aria-label"),o.headerPosition="top",o.editPanelPopulated||(s._initEditPanel(),a=!1),"edit"===t?s._beginEdit(e):"add"===t&&(o.label=s.localize("addNewTask"),delete o.taskOrComment,a&&s._clearEditors(),s._showHideDialogEditors(),o.refreshTabs(!1),o.selectTab(0),o.editors.status.selectedValues=[e.dataField],0===s.swimlanes.length?(o.editors.swimlane.classList.add("smart-hidden"),o.editors.swimlaneLabel.classList.add("smart-hidden"),o.editors.swimlane.parentElement.classList.add("single-column")):(o.editors.swimlane.classList.remove("smart-hidden"),o.editors.swimlaneLabel.classList.remove("smart-hidden"),o.editors.swimlane.parentElement.classList.remove("single-column")),o.editors.created.parentElement.classList.add("smart-hidden"),o.editors.updated.parentElement.classList.add("smart-hidden"))}s.$.container.setAttribute("modal","");const n=s.offset(s);s.offsetWidth>600&&(o.offsetHeight>s.offsetHeight?o.style.top=s.getBoundingClientRect().top+"px":o.style.top=n.top+s.offsetHeight/2-o.offsetHeight/2+"px",o.offsetWidth>s.offsetWidth?o.style.left=s.getBoundingClientRect().left+"px":o.style.left=n.left+s.offsetWidth/2-o.offsetWidth/2+"px"),s.dialogCustomizationFunction&&s.dialogCustomizationFunction(o,e,o.editors,o.labels,t,a),o.open()}_createDialog(){const e=this,t=document.createElement("smart-window"),a=document.createElement("template"),s=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;a.innerHTML=`<smart-button class="ok primary"${s}><span class="smart-icon"></span>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${s}><span class="smart-icon"></span>${e.localize("cancel")}</smart-button><smart-button class="smart-hidden delete secondary"${s}><span class="smart-icon"></span>${e.localize("delete")}</smart-button>`,t.animation=e.animation,t.footerTemplate=a,t.headerButtons=["close"],t.rightToLeft=e.rightToLeft,t.resizeMode="both",t.liveResize=!0,t.theme=e.theme,t.className="smart-kanban-window",t.innerHTML='<div class="prompt"></div>\n<div class="edit"></div>',t.ownerElement=e,e._dialog=t,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(t)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("open",e._dialogEventHandler),t.addEventListener("closing",e._dialogEventHandler),t.addEventListener("close",e._dialogEventHandler),t.addEventListener("click",e._dialogClickHandler),t.addEventListener("keydown",(e=>{if("Enter"===e.key){const e=t.querySelector(".ok"),a=t.querySelector('.smart-kanban-tab[view="details"]');a&&a.classList.contains("selected")&&(e.disabled||e.click())}}))}_dialogEventHandler(e){const t=this,a=t.ownerElement,s=e.type,l=a.context;(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target)===t&&(a.context=a,"open"===s?(a.$.fireEvent("open"),t.classList.contains("edit")&&(a.hasAnimation?t.addEventListener("transitionend",(function(){setTimeout((()=>{!a.readonly&&a._currentUser.allowEdit&&t.editors.text.focus()}),100)}),{once:!0}):requestAnimationFrame((()=>t.editors.text.focus())))):"closing"===s?a.$.fireEvent("closing").defaultPrevented&&(e.preventDefault(),delete t.ok):"close"===s&&(a.$.fireEvent("close"),a._dialogCloseHandler(e)),a.context=l)}_dialogClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.closest(".ok"))t.ok=!0,t.close();else if(a.closest(".cancel"))t.close();else if(a.closest(".delete"))t.ownerElement.removeTask(t.taskOrComment),t.close();else if(a.closest(".add")){const e=t.editors.newSubtask,a=e.value;if(""===a)return;const s=t.editors.checklist;s.insert(s.items.length,{label:a}),e.value="",t.$.content.scrollTop=t.$.content.scrollHeight-t.$.content.offsetHeight,t.refreshTabs()}else if(a.classList.contains("remove-subtask"))t.editors.checklist.removeChild(a.closest("smart-list-item")),t.refreshTabs();else if(a.classList.contains("remove-button")){const e=t.ownerElement,s=t.ownerElement.dataSourceMap,l=t.taskOrComment.data[s.comments],o=a.closest(".smart-comment").comment,r=JSON.parse(JSON.stringify(t.taskOrComment.data));t.taskOrComment.comment=o,t.taskOrComment.data[s.comments]=l.filter((e=>e!==t.taskOrComment.comment)),t.refreshComments();const i=JSON.parse(JSON.stringify(t.taskOrComment.data));e.$.fireEvent("change",{task:t.taskOrComment,id:i.id,value:i,oldValue:r}),e.$.fireEvent("taskUpdate",{id:i.id,value:i,oldValue:r}),e.$.fireEvent("commentRemove",{id:i.id,value:t.taskOrComment.comment})}}_dialogCloseHandler(){const e=this,t=e.dataSourceMap,a=e._dialog;function s(s){const l=JSON.parse(JSON.stringify(s.data));a.taskOrComment.remove(),s.querySelector(".smart-kanban-task-comments").setAttribute("num",s.data[t.comments].length||""),e._commentsList.editing&&(e._commentsList.textarea.value="",delete e._commentsList.editing);const o=JSON.parse(JSON.stringify(s.data));e.$.fireEvent("change",{task:s,id:o.id,value:o,oldValue:l}),e.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:l}),e.$.fireEvent("commentRemove",{id:o.id,value:a.taskOrComment.comment})}if(e.$.container.removeAttribute("modal"),a.ok){if(a.classList.contains("prompt")){const l=e._commentSelectionFor;if(l){const o=l.data;if(e.dataSource&&e.dataSource.virtualDataSource){const r=Object.assign({},o);r[t.comments]=r[t.comments].filter((e=>e!==a.taskOrComment.comment)),e._requestVirtualDataSource("update",r,(function(e){return e&&(l.data=r,s(l)),e}))}else o[t.comments]=o[t.comments].filter((e=>e!==a.taskOrComment.comment)),s(l)}else e._columnActionSelectionFor&&a.taskOrComment.dataField?e.removeColumn(a.taskOrComment.dataField):e.removeTask(a.taskOrComment)}else e._endEdit();delete a.ok}a.openedFrom&&requestAnimationFrame((()=>{e.getRootNode().contains(a.openedFrom)&&a.openedFrom.focus&&a.openedFrom.focus(),delete a.openedFrom})),delete a.taskOrComment}_closeDialog(){const e=this;e._dialog&&e._dialog.close()}_getHistoryItemLabel(e){const t=this;let a;switch(e.action){case"created":a=t.localize("taskCreated");break;case"tags":a=t.localize("taskTagsChanged");break;case"description":a=t.localize("taskDescriptionChanged");break;case"progress":a=t.localize("taskProgressChanged");break;case"text":a=t.localize("taskNameChanged");break;case"color":a=t.localize("taskColorChanged");break;case"priority":a=t.localize("taskPriorityChanged");break;case"deadline":a=t.localize("taskDeadlineChanged");break;case"subtasks":a=t.localize("taskSubtasksChanged");break;case"user":a=e.details.value?t.localize("taskUserChanged"):t.localize("taskUserRemoved");break;case"moved":a=t.localize("taskMoved");break;case"status":a=t.localize("taskStatusChanged");break;default:a=t.localize("taskUpdated")}return a}_initEditPanel(){const e=this,t=e.id,a=e._dialog,s=a.$.container.querySelector(".edit"),l=[""].concat(e.users.map((e=>({label:e.name,value:e.id,color:e.color,image:e.image})))),o=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))),r=e._getPriority(),i=e.swimlanes.map((e=>({label:e.label,value:e.dataField}))),n=document.createElement("template"),d=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;n.innerHTML=`<div class="smart-kanban-sub-task"><span class="label">{{label}}</span><span class="remove-subtask" aria-label="Remove subtask" title="${e.localize("removeSubtask")}"></span></div>`,n.id=e.id+"ChecklistTemplate",a.$.container.appendChild(n),s.innerHTML=`\n <div tabindex="0" class="smart-kanban-tab-strip">\n <div tabindex="0" view="details" class="selected smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("detailsTab")}</div></div>\n <div tabindex="0" view="subtasks" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("subtasksTab")}</div></div>\n <div tabindex="0" view="comments" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("commentsTab")}</div></div>\n <div tabindex="0" view="history" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("historyTab")}</div></div>\n <div tabindex="0" view="fields" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("fieldsTab")}</div></div>\n </div>\n <div class="smart-kanban-tab-content details">\n <div class="layout">\n <div class="column">\n <div id="${t}LabelText" class="editor-label">${e.localize("text")}</div>\n <smart-input class="editor text-editor" aria-labelledby="${t}LabelText"></smart-input>\n <div id="${t}LabelDescription" class="editor-label">${e.localize("description")}</div>\n <textarea class="editor description-editor" aria-labelledby="${t}LabelDescription"></textarea> \n <div id="${t}LabelStatus" class="editor-label">${e.localize("status")}</div>\n <smart-multi-combo-input single-select pills color-items class="editor status-editor" drop-down-open-position="auto" data-source='${JSON.stringify(o)}' drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelStatus"></smart-multi-combo-input>\n <div id="${t}LabelSwimlane" class="editor-label swimlane-label">${e.localize("swimlane")}</div>\n <smart-input class="editor swimlane-editor" drop-down-open-position="auto" data-source='${JSON.stringify(i)}'${0===i.length?" disabled":""} drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelSwimlane"></smart-input>\n </div>\n <div class="column">\n <div class="editor-container">\n <div id="${t}LabelAssignedTo" class="editor-label">${e.localize("assignedTo")}</div>\n <div id="${t}LabelProgress" class="editor-label">${e.localize("progress")}</div>\n <smart-multi-combo-input readonly pills class="editor asignee-editor" single-select data-source='${JSON.stringify(l)}'${0===l.length?" disabled":""} drop-down-button-position="right"${d} aria-labelledby="${t}LabelAssignedTo"></smart-multi-combo-input>\n <smart-numeric-text-box class="editor progress-editor" input-format="floatingPoint" min="0" max="100" show-unit unit="%"${d} aria-labelledby="${t}LabelProgress"></smart-numeric-text-box>\n </div>\n <div class="editor-container">\n <div id="${t}LabelStartDate" class="editor-label">${e.localize("startDate")}</div>\n <div id="${t}LabelDueDate" class="editor-label">${e.localize("dueDate")}</div>\n <smart-date-time-picker auto-close auto-open class="editor start-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelStartDate"></smart-date-time-picker>\n <smart-date-time-picker auto-close auto-open class="editor due-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelDueDate"></smart-date-time-picker>\n </div>\n <div class="editor-error-container smart-hidden" style="color: var(--smart-error);">\n <label id="${t}LabelRange">${e.localize("invalidRange",{start:e.localize("startDate"),end:e.localize("dueDate")})}</label>\n <br/> <br/>\n </div>\n <div class="editor-container">\n <div id="${t}LabelPriority" class="editor-label">${e.localize("priority")}</div>\n <div id="${t}LabelColor" class="editor-label">${e.localize("color")}</div>\n <div style="display: flex;"><span class="priority-editor-icon"></span><smart-input class="editor priority-editor" data-source='${JSON.stringify(r)}' drop-down-height="auto" drop-down-open-position="auto" drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelPriority"></smart-input></div>\n <smart-color-input value-display-mode="colorBox" class="editor color-editor" drop-down-open-position="auto" drop-down-button-position="right"${d} aria-labelledby="${t}LabelColor"></smart-color-input>\n </div>\n <div id="${t}LabelTags" class="editor-label">${e.localize("tags")}</div>\n <smart-multi-combo-input color-items readonly pills class="editor tags-editor" drop-down-button-position="right" drop-down-open-position="auto" ${d} aria-labelledby="${t}LabelTags"></smart-multi-combo-input>\n </div>\n </div>\n </div>\n <div class="smart-kanban-tab-content smart-hidden subtasks">\n <div id="${t}LabelChecklist" class="editor-label">${e.localize("checklist")}</div>\n <div class="new-container">\n <input type="text" class="new-subtask" placeholder="${e.localize("newSubtask")}" />\n <smart-button class="add primary" title="${e.localize("addSubtask")}" aria-label="Add subtask"${d}>+</smart-button>\n </div>\n <smart-list-box class="editor checklist-editor" item-template="${n.id}" selection-mode="checkBox"${d} aria-labelledby="${t}LabelChecklist"></smart-list-box>\n <br/>\n </div>\n <div class="smart-kanban-tab-content comments">\n </div>\n <div class="smart-kanban-tab-content smart-hidden history">\n <div class="editor-container">\n <div id="${t}LabelCreatedBy" class="editor-label">${e.localize("createdBy")}</div>\n <div id="${t}LabelCreatedByDate" class="editor-label">${e.localize("createdByDate")}</div>\n <div class="editor created" aria-labelledby="${t}LabelCreatedBy"></div>\n <div class="editor created-date" aria-labelledby="${t}LabelCreatedByDate"></div>\n </div>\n <div class="editor-container">\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedBy")}</div>\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedByDate")}</div>\n <div class="editor updated" aria-labelledby="${t}LabelUpdatedBy"></div>\n <div class="editor updated-date" aria-labelledby="${t}LabelUpdatedByDate"></div>\n </div>\n <div class="history-table smart-hidden editor-container">\n </div>\n </div>\n <div class="smart-kanban-tab-content fields">\n </div> \n<div class="template-container">\n</div>\n`,a.layout=s.querySelector(".layout"),a.editors={text:s.querySelector(".text-editor"),description:s.querySelector(".description-editor"),tags:s.querySelector(".tags-editor"),userId:s.querySelector(".asignee-editor"),status:s.querySelector(".status-editor"),swimlane:s.querySelector(".swimlane-editor"),swimlaneLabel:s.querySelector(".swimlane-label"),startDate:s.querySelector(".start-date-editor"),dueDate:s.querySelector(".due-date-editor"),progress:s.querySelector(".progress-editor"),priority:s.querySelector(".priority-editor"),priorityIcon:s.querySelector(".priority-editor-icon"),color:s.querySelector(".color-editor"),newSubtask:s.querySelector(".new-subtask"),checklist:s.querySelector(".checklist-editor"),template:s.querySelector(".template-container"),created:s.querySelector(".created"),createdDate:s.querySelector(".created-date"),updated:s.querySelector(".updated"),updatedDate:s.querySelector(".updated-date"),tabs:s.querySelector(".smart-kanban-tab-strip"),detailsTab:s.querySelector('[view="details"]'),commentsTab:s.querySelector('[view="comments"]'),subtasksTab:s.querySelector('[view="subtasks"]'),historyTab:s.querySelector('[view="history"]'),fieldsTab:s.querySelector('[view="fields"]')},a.labels={};for(let e in a.editors){const t=a.editors[e].getAttribute("aria-labelledby"),l=s.querySelector("#"+t);l&&(a.labels[e]=l)}a.tabs={all:a.editors.tabs,detail:a.editors.detailsTab,comments:a.editors.commentsTab,history:a.editors.historyTab,subtasks:a.editors.subtasksTab,fields:a.editors.fieldsTab};const c=()=>{a.editors.status.classList.contains("smart-hidden")&&a.editors.text.classList.contains("smart-hidden")&&a.editors.description.classList.contains("smart-hidden")?(a.editors.description.closest(".column").classList.add("smart-hidden"),a.editors.description.closest(".layout").classList.add("single-column")):e.dialogEditors&&3===e.dialogEditors.length&&e.dialogEditors.indexOf("text")>=0&&e.dialogEditors.indexOf("description")>=0&&e.dialogEditors.indexOf("status")>=0?a.editors.description.closest(".layout").classList.add("single-column"):(a.editors.description.closest(".column").classList.remove("smart-hidden"),a.editors.description.closest(".column").classList.remove("single-column"),a.editors.description.closest(".layout").classList.remove("single-column"))};a.showEditor=e=>{const t=e=>{if(e){const t=[...e.children];let a=0;for(let e=0;e<t.length;e++)t[e].classList.contains("smart-hidden")||a++;a===t.length&&e.classList.remove("single-column")}};a.editors[e]&&(a.editors[e].classList.remove("smart-hidden"),t(a.editors[e].closest(".editor-container"))),a.labels[e]&&(a.labels[e].classList.remove("smart-hidden"),t(a.labels[e].closest(".editor-container"))),"checklist"===e&&a.tabs.subtasks.classList.remove("smart-hidden"),c()},a.hideEditor=e=>{if(a.editors[e]){a.editors[e].classList.add("smart-hidden");const t=a.editors[e].closest(".editor-container");t&&t.classList.add("single-column")}a.labels[e]&&a.labels[e].classList.add("smart-hidden"),"checklist"===e&&a.tabs.subtasks.classList.add("smart-hidden"),c()};const u=a.editors.tabs.querySelectorAll(".smart-kanban-tab");a.selectTab=e=>{if(u[e]&&!u[e].classList.contains("smart-hidden")&&u[e].click(),0===e){const e=[...a.tabs.all.children];for(let t=0;t<e.length;t++)if(e[t]&&!e[t].classList.contains("smart-hidden")){e[t].click();break}}},a.refreshTabs=t=>{const s=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.comments]:0,l=s&&s.length?'<span class="summary"> ('+s.length+")</span>":"";let o=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.checklist]:0,r=o&&o.length?'<span class="summary"> ('+o.length+")</span>":"";t||(o=a.editors.checklist.items.length,o&&(r=o?'<span class="summary"> ('+o+")</span>":"")),a.editors.commentsTab.innerHTML=`${e.localize("commentsTab")}${l}`,a.editors.subtasksTab.innerHTML=`${e.localize("subtasksTab")}${r}`,e._currentUser.allowComment&&a.taskOrComment?a.editors.commentsTab.classList.remove("smart-hidden"):a.editors.commentsTab.classList.add("smart-hidden"),e.readonly&&!o?a.editors.subtasksTab.classList.add("smart-hidden"):a.editors.checklist.classList.contains("smart-hidden")||a.editors.subtasksTab.classList.remove("smart-hidden"),e.taskCustomFields.length>0?a.editors.fieldsTab.classList.remove("smart-hidden"):a.editors.fieldsTab.classList.add("smart-hidden"),a.taskOrComment&&(a.taskOrComment.data[e.dataSourceMap.updatedDate]||a.taskOrComment.data[e.dataSourceMap.createdDate])?a.editors.historyTab.classList.remove("smart-hidden"):a.editors.historyTab.classList.add("smart-hidden");const i=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];let n=0;for(let e=0;e<i.length;e++){const t=i[e];a.editors[t].classList.contains("smart-hidden")&&n++}n===i.length?a.tabs.detail.classList.add("smart-hidden"):a.tabs.detail.classList.remove("smart-hidden")},a.refreshFields=()=>{const t=a.querySelector(".fields"),s=a.taskOrComment?a.taskOrComment.data:{},l=e.taskCustomFields.length,o=a.querySelectorAll(["[container-for]"]).length;if(e._resetFields&&(delete e._resetFields,a.refreshFieldsDirty=!0,t.innerHTML=""),!0===a.refreshFieldsDirty)if(a.refreshFieldsDirty=!1,t.firstElementChild&&l<=o)for(let t=0;t<e.taskCustomFields.length;t++){const l=e.taskCustomFields[t];let o=s[l.dataField];const r=a.querySelector("[container-for="+l.dataField+"]");if(!r)continue;e.dataSourceMap[l.dataField]?r.classList.add("smart-hidden"):r.classList.remove("smart-hidden"),null==o&&(o="");const i=r.lastElementChild.firstElementChild;i.removeAttribute("dirty"),o&&o instanceof Date&&"dateInput"===l.editor?i.value=o:i.value=""+o}else{const a=document.createDocumentFragment(),l=(t,a,s)=>{null==a&&(a="");const l=document.createElement("div"),o=document.createElement("div"),r=document.createElement("div");void 0===s.visible&&(s.visible=!0),void 0===s.allowHide&&(s.allowHide=!0),s.allowHide?o.innerHTML=t+'<span class="icon"></span>':o.innerHTML=t,o.classList.add("editor-label"),s.allowHide&&(!1===s.visible&&o.lastElementChild.classList.add("hide"),o.lastElementChild.onpointerdown=()=>{s.visible=!s.visible,o.lastElementChild.classList.toggle("hide")}),r.classList.add("editor");let i=document.createElement("input");if(i.classList.add("smart-input"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength),"textarea"===s.editor)i=document.createElement("smart-text-area"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength);else if("password"===s.editor)i.type="password";else if("phone"===s.editor||"tel"===s.editor)Smart.PhoneInput?i=document.createElement("smart-phone-input"):i.type="tel";else if("url"===s.editor)i.type="url";else if("email"===s.editor)i.type="email";else if("date"===s.dataType||"dateInput"===s.editor)i=document.createElement("smart-date-input"),i.autoClose=!0,""===a&&(a=new Date),void 0!==s.minDate&&(i.min=s.minDate),void 0!==s.maxDate&&(i.max=s.maxDate);else if("boolean"===s.dataType)i=document.createElement("smart-check-box"),""===a&&(a=!1);else if("number"===s.dataType||"numberInput"===s.editor)i=document.createElement("smart-number-input"),a||(a=0),void 0!==s.min&&(i.min=s.min),void 0!==s.max&&(i.max=s.max);else if("string"===s.dataType&&s.options)i=document.createElement("smart-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.options;else if("string"===s.dataType&&"multiComboInput"===s.editor)i=document.createElement("smart-multi-combo-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.dataSource,i.pills=!0,i.selectedValues=[""+a],s.singleSelect&&(i.singleSelect=!0),s.colorItems&&(i.colorItems=!0);else if("string"===s.dataType&&("image"===s.editor||"images"===s.editor)&&a.length>50)if(a.indexOf("base64")>=0){a=JSON.parse(a),window.Smart._createSmartImageModal=e._createImageModal;let t="";for(let e=0;e<a.length;e++){const s=a[e];t+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" width="20" height="20" src="${s.value}" title="${s.label}"/>`}i=document.createElement("div"),i.innerHTML=t}else a=a.substring(0,50)+"...";return i.setAttribute("data-field",s.dataField),i.classList.add("smart-kanban-task-field-editor"),i.value=""+a,i.onchange=()=>{i.setAttribute("dirty","")},r.appendChild(i),l.appendChild(o),l.appendChild(r),l.setAttribute("container-for",s.dataField),l},o=document.createElement("div");o.classList.add("editor-container"),a.appendChild(o);for(let t=0;t<e.taskCustomFields.length;t++){const a=e.taskCustomFields[t],r=l(a.label,s[a.dataField],a);o.appendChild(r),e.dataSourceMap[a.dataField]&&r.classList.add("smart-hidden")}t.innerHTML="",t.appendChild(a)}},a.refreshHistory=()=>{const t=a.querySelector(".history-table");if(!e.storeHistory)return void t.classList.add("smart-hidden");t.classList.remove("smart-hidden");const s=a.taskOrComment.data.history;let l=`<table><tr>\n <th>${e.localize("historyEvent")}</th>\n <th>${e.localize("historyAuthor")}</th>\n <th>${e.localize("historyDetails")}</th>\n <th>${e.localize("historyDate")}</th>\n </tr>\n `;for(let t=s.length-1;t>=0;t--){const a=s[t];if(l+=`<tr>\n <td>${e._getHistoryItemLabel(a)}</td>`,void 0!==a.user){const t=(t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser")}})(e.users.find((e=>e.id===a.user)));l+=`<td><div class="smart-kanban-task-user-history"><div class="icon smart-kanban-task-user" style="${t.image}"></div><div class="name">${t.label}</div></div></td>`}else l+="<td></td>";if("created"!==a.action){let t=a.details.oldValue,s=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t)),l=e.users.find((e=>e.id===s));t=a?a.name:e.localize("unassigned"),s=l?l.name:e.localize("unassigned")}if(t&&t instanceof Date&&(t=t.toLocaleString()),s&&s instanceof Date&&(s=s.toLocaleString()),"subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));l+=`<td><span class="smart-truncate">${e.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span></td>`}else l+=t?`<td><span class="smart-truncate">${e.localize("range",{oldValue:t,newValue:s})}</span></td>`:`<td><span class="smart-truncate">${e.localize("nullRange",{oldValue:t,newValue:s})}</span></td>`}else l+=`<td>${a.details.value}</td>`;l+=`\n <td>${a.date.toLocaleString()}</td>\n </tr>`}l+="</table>",t.innerHTML=l,a.refreshTabs()},a.refreshComments=()=>{if(!a.taskOrComment)return;const t=a.querySelector(".comments");t.classList.remove("smart-hidden");const s=e._getCommentsList(a.taskOrComment);s.classList.remove("dialog");const l=s.querySelector(".send");l&&(l.onclick=t=>{if(l.disabled)return;const s=JSON.parse(JSON.stringify(e._commentSelectionFor.data)),o=e._createComment();e._commentsList.textarea.value="",l.disabled=!0,a.refreshTabs();const r=JSON.parse(JSON.stringify(e._commentSelectionFor.data));e.$.fireEvent("change",{task:e._commentSelectionFor,id:r.id,value:r,oldValue:s}),e.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:s}),e.$.fireEvent("commentAdd",{id:r.id,value:o}),t.stopPropagation(),t.preventDefault()}),t.innerHTML="",t.appendChild(s),a.refreshTabs()},u.forEach((e=>{e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus")},e.onkeydown=t=>{"Enter"===t.key&&(e.click(),t.stopPropagation())},e.onclick=e=>{const t=e.target.closest(".smart-kanban-tab"),s=t.getAttribute("view");switch(u.forEach((e=>{e.classList.remove("selected")})),t.focus(),t.classList.add("selected"),a.querySelectorAll(".smart-kanban-tab-content").forEach((e=>{e.classList.add("smart-hidden")})),s){case"details":a.querySelector(".details").classList.remove("smart-hidden");break;case"subtasks":a.querySelector(".subtasks").classList.remove("smart-hidden");break;case"comments":a.refreshComments();break;case"history":a.querySelector(".history").classList.remove("smart-hidden"),a.refreshHistory();break;case"fields":a.querySelector(".fields").classList.remove("smart-hidden"),a.refreshFields()}}})),(()=>{const e=a.editors.color;e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.dropDownWidth=50;const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input"),e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")}})(),a.editors.newSubtask.onchange=()=>{a.editors.newSubtask.nextElementSibling.click()},a.editors.priority.onchange=()=>{e._setPriorityEditorIcon(!0)},e._setPriorityEditorIcon(),a.editPanelPopulated=!0,e.dialogRendered&&e.dialogRendered(a,a.editors,a.labels,a.tabs,a.layout,a.taskOrComment)}_setPriorityEditorIcon(e){const t=this,a=t._dialog;let s=a.editors.priority.selectedValues[0];e||a.taskOrComment&&a.taskOrComment.data&&void 0!==a.taskOrComment.data.priority&&(s=a.taskOrComment.data.priority);const l=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let e=0;e<t.priority.length;e++){const o=t.priority[e];if(o.value===s){a.editors.priorityIcon.innerHTML='<div class="smart-kanban-task-text">'+l(o)+"</div>";break}}}_showHideDialogEditors(){const e=this,t=e._dialog,a=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];for(let s=0;s<a.length;s++){const l=a[s];e.dialogEditors.indexOf(l)>=0?t.showEditor(l):t.hideEditor(l)}const s=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})));s.length<=1&&t.hideEditor("status"),t.editors.status.dataSource=s,0===e.users.length&&t.hideEditor("userId")}_unescapeValue(e){if(null==e)return e;const t=[{regex:"&",entity:"&"},{regex:">",entity:">"},{regex:"<",entity:"<"},{regex:'"',entity:"""},{regex:"'",entity:"'"},{regex:"=",entity:"="},{regex:"/",entity:"/"},{regex:"`",entity:"`"}];let a;for(let s in t)a=new RegExp(t[s].entity,"g"),e=e.replace(a,t[s].regex);return e}_escapeValue(e){return e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}_beginEdit(e){const t=this,a=t.dataSourceMap,s=e.data,l=t._dialog,o=l.editors,r=t.tags.length>0?t.tags:t._customTags,i=t._allColumns.find((e=>e.dataField===s[a.status]));if(l.label=t.localize("editTask",{taskId:s[a.id],text:s[a.text]}),o.text.value=t._unescapeValue(s[a.text]),o.description.value=t._unescapeValue(s[a.description]),o.tags.dataSource=r,t._showHideDialogEditors(),t.allowCustomTags,s[a.tags]){const e=e=>{let a=[];e.indexOf(",")>=0?a=e.split(","):Array.isArray(e)?a=a.concat(e):a.push(e);const s=[];for(let e=0;e<a.length;e++)"string"==typeof a[e]?(a[e]=t._unescapeValue(a[e].trim()),s.push(a[e])):(a[e].label=t._unescapeValue(a[e].label),s.push(a[e].value));return s};if(!t.allowCustomTags){const l=t.tags.length>0?t.tags:e(s[a.tags]);o.tags.dataSource=l}o.tags.selectedValues=e(s[a.tags])}else o.tags.selectedValues=[];l.editors.created.parentElement.classList.add("smart-hidden"),l.editors.updated.parentElement.classList.add("smart-hidden");const n=void 0!==s[a.createdUserId]?t.users.find((e=>e.id===s[a.createdUserId])):"",d=s[a.createdDate],c=void 0!==s[a.updatedUserId]?t.users.find((e=>e.id===s[a.updatedUserId])):"",u=s[a.updatedDate],m=e=>{const a=e?e.image:null;return{image:a?`background-image: url('${a}');`:"",label:e?e.name||e.id:t.localize("guestUser")}};if(n){const e=m(n);l.editors.created.parentElement.classList.remove("smart-hidden"),l.editors.created.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,d&&(l.editors.createdDate.innerHTML=d.toLocaleString())}if(c){const e=m(c);l.editors.updated.parentElement.classList.remove("smart-hidden"),l.editors.updated.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,u&&(l.editors.updatedDate.innerHTML=u.toLocaleString())}const p=null!==s[a.userId]?t.users.find((e=>e.id===s[a.userId])):"";p?o.userId.selectedItems=[{label:p.name,value:p.id,image:p.image?p.image:null}]:o.userId.value="",delete o.userId.$.input.dataValue,o.status.selectedValues=[i.dataField],t.readonly||!t._currentUser.allowEdit?(o.status.readonly=!1,o.priority.readonly=!1):(o.status.readonly=!0,o.priority.readonly=!0),delete o.status.$.input.dataValue,t._hasSwimlane(t.columns.indexOf(i))?o.swimlane.value=t.swimlanes.find((e=>e.dataField===s[a.swimlane])).label:o.swimlane.value="",delete o.swimlane.$.input.dataValue,o.startDate.value=s[a.startDate]||null,o.dueDate.value=s[a.dueDate]||null,o.progress.value=parseFloat(s[a.progress])||0;const h=t.localize(s[a.priority]);o.priority.value=null!=h?h:"",delete o.priority.$.input.dataValue,o.color.value=s[a.color]||"";const g=[],b=[];(s[a.checklist]||[]).forEach(((e,t)=>{e.completed&&g.push(t),b.push({label:e.text,selected:!0===e.completed})})),0===t.swimlanes.length?(l.editors.swimlane.classList.add("smart-hidden"),l.editors.swimlaneLabel.classList.add("smart-hidden"),l.editors.swimlane.parentElement.classList.add("single-column")):(l.editors.swimlane.classList.remove("smart-hidden"),l.editors.swimlaneLabel.classList.remove("smart-hidden"),l.editors.swimlane.parentElement.classList.remove("single-column")),o.dueDate.onchange=o.startDate.onchange=()=>{o.startDate.value>=o.dueDate.value&&o.dueDate.value?(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")):(l.$.footer.firstElementChild.disabled=!1,l.querySelector(".editor-error-container").classList.add("smart-hidden"))},o.startDate.value&&o.startDate.value>=o.dueDate.value&&o.dueDate.value&&(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")),o.newSubtask.value="",o.checklist.dataSource=b,o.checklist.selectedIndexes=g,t._setPriorityEditorIcon(),l.refreshTabs(!0),l.selectTab(0)}_endEdit(){const e=this,t=e.dataSourceMap,a=e._dialog,s=a.editors,l=a.taskOrComment,o=l?l.data:void 0,r=Object.assign({},o);let i=s.startDate.value,n=s.dueDate.value;r[t.text]=e._escapeValue(s.text.value),r[t.description]=e._escapeValue(s.description.value);const d=[];for(let t=0;t<s.tags.dataSource.length;t++){const a=s.tags.dataSource[t];"string"==typeof a?s.tags.selectedValues.indexOf(a)>=0&&d.push(e._escapeValue(a)):s.tags.selectedValues.indexOf(a.value)>=0&&(a.label=e._escapeValue(a.label),d.push(a))}if(r[t.tags]=d,r[t.progress]=parseFloat(s.progress.value),r[t.color]=s.color.value,e._currentUser.info&&(r[t.updatedUserId]=e._currentUser.info.id,r[t.updatedDate]=new Date),r[t.color]||""===r[t.color]||delete r[t.color],void 0!==s.userId.$.input.dataValue&&(r[t.userId]=parseFloat(s.userId.$.input.dataValue)),void 0!==s.status.$.input.dataValue&&(r[t.status]=s.status.$.input.dataValue),s.swimlane.$.input.dataValue&&(r[t.swimlane]=s.swimlane.$.input.dataValue),i&&(i=i.toDate()),n&&(n=n.toDate()),r[t.startDate]=i,r[t.dueDate]=n,void 0!==s.priority.$.input.dataValue&&(r[t.priority]=s.priority.$.input.dataValue),r[t.checklist]=s.checklist.items.map((e=>({text:e.label,completed:e.selected}))),e.taskCustomFields&&e.taskCustomFields.length>0)for(let t=0;t<e.taskCustomFields.length;t++){const s=e.taskCustomFields[t],l=a.querySelector("[data-field="+s.dataField+"]");if(l){let t=l.value;l.dataSource&&l.dataSource.length>0&&l.selectedValues.length>0&&(t=l.selectedValues.toString()),"smart-number-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),(l.hasAttribute("dirty")||e.dialogCustomizationFunction)&&(r[s.dataField]=t)}}l?e.updateTask(l,r):e.addTask(r),s.tags.close()}_clearEditors(){const e=this,t=e._dialog.editors,a=e.tags.length>0?e.tags:e._customTags;t.text.value="",t.description.value="",t.tags.dataSource=a,t.tags.selectedValues=[],t.status.selectedValues=[],delete t.status.$.input.dataValue,t.swimlane.value="",delete t.swimlane.$.input.dataValue,t.userId.value="",delete t.userId.$.input.dataValue,t.progress.value=0,t.startDate.value=null,t.dueDate.value=null,t.priority.value=e.localize("average"),t.priority.$.input.dataValue="average",t.color.value="",t.newSubtask.value="",t.created.innerHTML="",t.updated.innerHTML="",t.createdDate.innerHTML="",t.updatedDate.innerHTML="",t.checklist.dataSource=[],t.checklist.selectedIndexes=[]}_getCurrentUser(){const e=this,t=e.users;let a=e.currentUser,s=!0,l=!0,o=e.allowDrag,r=e.editable,i=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(s=!1!==a.allowAdd,l=!1!==a.allowComment,o=o&&!1!==a.allowDrag,r=r&&!1!==a.allowEdit,i=!1!==a.allowRemove)),e._currentUser={allowAdd:s,allowComment:l,allowDrag:o,allowEdit:r,allowRemove:i,info:a}}_autoSaveState(e){const t=this;if(t.autoSaveState)if("object"!=typeof e)if(e&&t._autoSavedState){switch(e){case"collapsed":t._allColumns.forEach((e=>t._autoSavedState.collapsed[e.dataField]=e.collapsed));break;case"dataSource":t._autoSavedState.dataSource=t._getCurrentDataSource();break;case"filtering":t._autoSavedState.filtering=t._appliedFiltering;break;case"selection":{const e=t.dataSourceMap;let a=null,s=null;t._selectionInView&&(a=t._selectionInView.closest(".smart-kanban-column").column.dataField,s=t._selectionInView.getAttribute("swimlane")),t._autoSavedState.selection={selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart.data[e.id]:null,selectionInColumn:a,swimlane:s};break}case"sorting":t._autoSaveState.sorting=t._appliedSorting;break;case"tabs":t._autoSaveState.tabs=t._selectedTabs;break;case"visibility":t._autoSavedState.visibility={taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}}window.localStorage.setItem("smartKanban"+t.id,JSON.stringify(t._autoSavedState))}else t._autoSavedState=t.saveState();else t._autoSavedState=e}_getCurrentDataFields(e){const t=this,a=[{name:"text",dataType:"string"},{name:"tags",dataType:"string"},{name:"priority",dataType:"string"},{name:"progress",dataType:"number"},{name:"startDate",dataType:"date"},{name:"dueDate",dataType:"date"},{name:"userId",dataType:"string"}],s=e&&e.length>0?e[0]:null;for(let e=0;e<t.taskCustomFields.length;e++)if(s){const l=typeof s[t.taskCustomFields[e].dataField];"number"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"number"}):"date"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"date"}):a.push({name:t.taskCustomFields[e].dataField,dataType:"string"})}else a.push({name:t.taskCustomFields[e].dataField,dataType:"string"});return a}_applyFilter(e,t){const a=this;if(a.dataSource&&a.dataSource.virtualDataSource)return a._requestVirtualDataSource("filter"),void a._autoSaveState("filtering");const s=a._getCurrentDataSource(),l=a._getCurrentDataFields(s),o=new Smart.DataAdapter({dataSource:s,dataFields:l,id:"id"});try{o._filter(e,t)}catch(e){return}if(a.virtualization){if(e&&e.length>0){const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered;let l=a._getTasksByDataField(s),r=[];for(let e=0;e<l.length;e++){const t=l[e],a=o.dataItemById[t.id];a&&a.$.filtered&&r.push(t)}a.tasksByDataField[s]._filtered=r}}else{const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered}}a._refreshColumns()}else{const e=Array.from(a.$.container.getElementsByClassName("smart-kanban-task"));for(let t=0;t<o.length;t++){const a=e[t],s=!o[t].$.filtered;a.classList.toggle("smart-hidden",s),a.filteredOut=s}a._allColumns.forEach((e=>a._refreshScrollViewer(e)))}a._autoSaveState("filtering")}_applyHandler(e,t){const a=this,s=a.isInShadowDOM||a.shadowRoot?e.composedPath()[0]:e.target,l=e.detail;a.$.customize.contains(s)||"customize"===t?(l.value.forEach((e=>a[e.dataField]=e.visible)),a._allColumns.forEach((e=>a._refreshScrollViewer(e))),a.virtualization&&(delete a._autoCardHeight,a._measureCardHeight(),a._refreshColumns()),a._autoSaveState("visibility")):a.$.filter.contains(s)||"filter"===t?a.addFilter(l.filters,l.operator,l.value):(a.$.sort.contains(s)||"sort"===t)&&a.addSort(l.sortByInfo),a.closePanel()}_applySort(){const e=this,t=e._appliedSorting;if(e._autoSaveState("sorting"),e.dataSource&&e.dataSource.virtualDataSource)e._requestVirtualDataSource("sort");else if(0!==t.dataFields.length)e._allColumns.forEach((a=>{const s=e._columnToElement.get(a).querySelector(".smart-scroll-viewer-content-container"),l=Array.from(s.children),o=[];if(l.length<2)return;let r;if(e.virtualization?e.tasksByDataField[a.dataField].forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t);"low"===l[s.priority]&&(l[s.priority]="z"),o.push(l)})):l.forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t.data);"low"===l[s.priority]&&(l[s.priority]="z"),o.push(l)})),e.taskCustomFields.length){const t=e._getCurrentDataFields(o);t.push({name:"taskIndex",dataType:"number"}),r=new Smart.DataAdapter({dataSource:o,observable:!1,dataFields:t,id:"id"})}else r=new Smart.DataAdapter({dataSource:o,observable:!1,dataFields:["taskIndex: number","text: string","tags: string","priority: string","progress: number","startDate: date","dueDate: date","userId: string"],id:"id"});if(r.sortBy(t.dataFields,t.dataTypes,t.orderBy),e.virtualization){if(e.tasksByDataField[a.dataField]._sorted=Smart.DataAdapter.Sort(e.tasksByDataField[a.dataField],t.dataFields,t.orderBy),e.tasksByDataField[a.dataField]._filtered){e.tasksByDataField[a.dataField]._originalFilteredData=JSON.parse(JSON.stringify(e.tasksByDataField[a.dataField]._filtered));const s=Smart.DataAdapter.Sort([...e.tasksByDataField[a.dataField]._filtered],t.dataFields,t.orderBy);e.tasksByDataField[a.dataField]._filtered=s||[]}e._refreshColumn(a.dataField)}else for(let e=0;e<r.length;e++)s.appendChild(l[r[e].taskIndex])}));else if(e.virtualization){const t=Object.keys(e.tasksByDataField);for(let a=0;a<t.length;a++){const s=t[a];delete e.tasksByDataField[s]._sorted,e.tasksByDataField[s]._filtered&&e.tasksByDataField[s]._originalFilteredData&&(e.tasksByDataField[s]._filtered=e.tasksByDataField[s]._originalFilteredData,delete e.tasksByDataField[s]._originalFilteredData),e._refreshColumn(s)}}}_closeSearchPanel(){const e=this;e._searchInfo&&(Array.from(e.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),delete e._searchInfo)}_constructFilterGroups(e){const t={text:"string",tags:"string",priority:"string",progress:"number",startDate:"date",dueDate:"date"},a={},s=[];e.filters.forEach((s=>{const l=s[0],o=t[l];let r=s[2],i=a[l];void 0===i&&(i=new Smart.Utilities.FilterGroup,a[l]=i),"date"===o&&"string"==typeof r&&(r=new Date(r));const n=i.createFilter(o,r,s[1]);i.addFilter(e.operator,n)}));for(let e in a)s.push([e,a[e]]);return s}_openSearchPanel(){const e=this;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._searchInfo={source:e._getCurrentDataSource(),stringDataFields:["text","tags"]},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(a._searchInfo.query=e,Array.from(a.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,void delete a._searchInfo.highlighted;const s=new Smart.DataAdapter({dataSource:a._searchInfo.source,dataFields:["text: string","tags: string"],id:"id"}),l=[],o=[],r={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,s=a.createFilter("string",e,"CONTAINS");a.addFilter("or",s),l.push([t,a])})),s._filter(l,"or");for(let e=0;e<s.length;e++){const t=s[e];!1!==t.$.filtered&&(o.push(t.$.id),r[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=o,a._searchInfo.foundIdsObject=r,Array.from(a.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>{const s=e.data[a.dataSourceMap.id];if(r[s]){if(e.filteredOut)return o.splice(o.indexOf(s),1),void delete r[s];t&&o[0]===s&&e.classList.add("smart-data-view-highlighted"),e.classList.add("smart-data-view-found")}})),o.length>0){if(t){let e=o[0];a._searchInfo.highlighted=e,a.ensureVisible(e)}return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),void(a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:o.length}))}a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_bodyFocusinHandler(e){const t=this;let a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.classList.contains("smart-kanban-column-content-tasks")&&(a=a.$.content,!t._getSelectedItem(a,!0))){if(t.virtualization){const e=t._focusedTask;return void t.focusTask(e)}if(void 0!==t._focusedTask)return void t.focusTask(t._focusedTask);t._focusTask(t._getFirstItem(a))}}get _rtlAttr(){return this.rightToLeft?" right-to-left":""}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}_appendAddNewColumn(e){const t=document.createElement("div");t.classList.add("smart-kanban-column","smart-kanban-add-new-column","smart-unselectable"),t.innerHTML=`<div class="smart-kanban-column-header smart-unselectable" > <div title="${this.localize("addNewColumn")}" class="smart-kanban-add-new-column-label smart-kanban-column-header-label"><span>+ ${this.localize("addNewStatus")}</span></div></div >\n <div class="smart-kanban-column-content no-sub-columns"><smart-scroll-viewer></smart-scroll-viewer></div>\n `,this.disabled||this.unfocusable||t.setAttribute("tabindex",0),t.column={dataField:"newStatus",label:"New Status"},e.appendChild(t)}selectTask(e){const t=this;t._selectedTasks.push(e),t._selectionStart=e,t._focusedTask=e,t._refreshSelection(),t.ensureVisible(e)}unselectTask(e){const t=this,a=t._selectedTasks.indexOf(e);a>=0&&t._selectedTasks.splice(a,1),t._refreshSelection()}clearSelection(){const e=this;e._selectionStart=null,e._selectedTasks=[],e._refreshSelection()}getSelectedTasks(){return this._selectedTasks||(this._selectedTasks=[]),this._selectedTasks}getTask(e){return this.dataSource?this.dataSource.find((t=>{if(t.id===e)return t})):null}getColumn(e){const t=this;let a=null;for(let s=0;s<t.columns.length;s++)if(t.columns[s].dataField===e){a=t.columns[s];break}return a}getColumnDataItems(e){const t=this;let a=[];if(!t.getColumn(e)||!t.dataSource)return[];for(let s=0;s<t.dataSource.length;s++){const l=t.dataSource[s];l[t.dataSourceMap.status]===e&&a.push(l)}return a}updateColumn(e,t){const a=this;let s=null;for(let t=0;t<a.columns.length;t++)if(a.columns[t].dataField===e){s=a.columns[t];break}if(s){const e=s.label;void 0!==t.label&&(s.label=t.label),void 0!==t.collapsed&&(s.collapsed=t.collapsed),void 0!==t.collapsible&&(s.collapsible=t.collapsible),void 0!==t.orientation&&(s.orientation=t.orientation),void 0!==t.width&&(s.width=t.width),a._reset(),a.$.fireEvent("columnUpdate",{columnData:t,oldValue:e,value:s.label})}}addColumn(e){const t=this;e?(t.columns.push(e),t._reset(),t._createAddNewButton(),t.$.fireEvent("columnAdd",{columnData:e})):t._addNewColumnDynamically()}removeColumn(e){const t=this;let a=null,s=-1;for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){a=t.columns[l],s=l;break}if(a&&t.columns.splice(s,1),t.dataSource)for(let a=0;a<t.dataSource.length;a++){const s=t.dataSource[a];if(s[t.dataSourceMap.status]===e){const e=JSON.parse(JSON.stringify(s));s[t.dataSourceMap.status]=t.columns[0].value;const a=JSON.parse(JSON.stringify(s));t.$.fireEvent("change",{task:s,id:a.id,value:a,oldValue:e}),t.$.fireEvent("taskUpdate",{id:a.id,value:a,oldValue:e})}}t._reset(),t._createAddNewButton(),t.$.fireEvent("columnRemove",{column:a})}_addNewColumnDynamically(){const e=this,t=e._dialog,a=Math.floor(9e4*Math.random()+1e4),s={label:e.localize("addNewStatus")+" "+a,dataField:"newStatus"+a,addNewButton:!0,collapsed:!1,collapsible:!0,orientation:"vertical"},l=e.$.body.querySelector(".smart-kanban-add-new-column").querySelector(".smart-kanban-add-new-column-label"),o=document.createElement("input");if(l.classList.add("pending"),l.appendChild(o),o.classList.add("smart-kanban-column-header-input"),e.columnColors){l.classList.add("colors");const t=e._getColorInput();l.appendChild(t)}function r(a){let r=o.value,i=l.querySelector("smart-color-input");i&&i.opened?e._columnAddTimer&&clearTimeout(e._columnAddTimer):(!1===/^\s*$/.test(r)?(r=r.trim(),s.label=r,s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)):""===r&&(r="",s.label="",s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),l.classList.contains("pending")&&(e._columnAddTimer&&clearTimeout(e._columnAddTimer),e._columnAddTimer=setTimeout((()=>{if(l.classList.remove("pending"),o.parentNode&&o.parentNode.removeChild(o),i){s.color=i.value;const e=l.querySelector(".heading");if(e){const t=new Smart.Color(s.color).getInvertedColor();e.style.backgroundColor=s.color,e.style.color=t}i.remove()}e.columns.push(s),e._reset(),e._createAddNewButton(),t&&t.editPanelPopulated&&(t.editors.status.dataSource=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})))),e.$.fireEvent("columnAdd",{newColumn:s}),delete e._columnAddTimer}),50),a.stopPropagation()))}o.focus(),o.onkeydown=e=>{"Escape"===e.key?(l.classList.remove("pending"),o&&o.parentElement&&(o.nextElementSibling&&"Smart-COLOR-INPUT"===o.nextElementSibling.nodeName&&o.nextElementSibling.remove(),o.parentElement.removeChild(o),e.stopPropagation(),e.preventDefault())):"Enter"===e.key&&r(e)},o.addEventListener("blur",r),o.addEventListener("change",r)}_handleColumnEditing(e){const t=this,a=t.columns.find((t=>t.dataField===e));if(t._columnEditing)return;const s=Array.from(t.$.body.getElementsByClassName("smart-kanban-column")).find((t=>t.column.dataField===e)).querySelector(".smart-kanban-column-header-label"),l=document.createElement("input");s.classList.add("pending"),s.appendChild(l);const o=a.label,r=a.color;if(l.value=a.label,l.classList.add("smart-kanban-column-header-input"),t.columnColors){s.classList.add("colors");const e=t._getColorInput();e.value=a.color||"transparent",s.appendChild(e)}function i(e){let i=l.value,n=s.querySelector("smart-color-input");if(!n||!n.opened){if(!1===/^\s*$/.test(i)?(i=i.trim(),a.label=i,s.querySelector(".smart-kanban-title").innerHTML=i):""===i&&(a.label="",s.querySelector(".smart-kanban-title").innerHTML=" "),n){a.color=n.value;const e=s.querySelector(".heading");if(e){const t=new Smart.Color(a.color).getInvertedColor();""===a.color?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=a.color,e.style.color=t)}t.applyColumnColorToTasks&&s.closest(".smart-kanban-column").style.setProperty("--smart-primary",a.color),n.remove()}s.classList.remove("pending");try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditTimer&&clearTimeout(t._columnEditTimer),t._columnEditing=!1,t._columnEditTimer=setTimeout((()=>{o===a.label&&r===a.color||t.$.fireEvent("columnUpdate",{column:a,oldValue:o,value:a.label}),delete t._columnEditTimer}),50),e.stopPropagation()}}t._columnEditing=!0,setTimeout((()=>{l.focus()}),50),l.onkeydown=e=>{if("Escape"===e.key){s.classList.remove("pending"),l.value=o;try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditing=!1}else"Enter"===e.key&&i(e)},l.addEventListener("blur",i),l.addEventListener("change",i)}_validateDataSourceMap(){this.dataSourceMap=Object.assign({},{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",userId:"userId"},this.dataSourceMap)}});
|
|
126
126
|
|
|
127
127
|
/***/ }),
|
|
128
128
|
|
|
@@ -199,7 +199,7 @@ Smart("smart-tooltip",class extends Smart.ContentElement{static get properties()
|
|
|
199
199
|
/***/ 8466:
|
|
200
200
|
/***/ (() => {
|
|
201
201
|
|
|
202
|
-
Smart("smart-window",class extends Smart.ContentElement{static get properties(){return{collapsed:{value:!1,type:"boolean"},closeOnMaskClick:{value:!1,type:"boolean"},disableEscape:{value:!1,type:"boolean"},disableSnap:{value:!1,type:"boolean"},footerPosition:{value:"bottom",allowedValues:["bottom","none"],type:"string"},footerTemplate:{value:null,type:"any"},headerButtons:{value:["close","maximize","minimize"],type:"array"},headerPosition:{value:"top",allowedValues:["top","bottom","left","right","none"],type:"string"},headerTemplate:{value:null,type:"any"},disableKeyboard:{value:!1,type:"boolean"},label:{value:"",type:"string"},liveResize:{value:!1,type:"boolean"},maximized:{value:!1,type:"boolean"},modal:{value:!1,type:"boolean"},minimized:{value:!1,type:"boolean"},opened:{value:!1,type:"boolean"},pinned:{value:!1,type:"boolean"},resizeIndicator:{value:!1,type:"boolean"},resizeMode:{allowedValues:["none","horizontal","vertical","both","top","bottom","left","right"],value:"none",type:"string"},windowParent:{value:null,type:"any"}}}static get listeners(){return{"document.dragstart":"_dragStartHandler","document.focusin":"_documentFocusInEventHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.wheel":"_mouseWheelHandler","document.selectstart":"_documentSelectStartHandler",down:"_downHandler",focus:"_focusHandler",blur:"_focusHandler",move:"_moveHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler"}}get hasStyleObserver(){return!1}static get styleUrls(){return["smart.button.css","smart.window.css"]}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header" role="presentation">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container" role="presentation">\n <button id="pinButton" class="smart-button smart-element smart-pin-button" aria-label="Pin"></button>\n <button id="collapseButton" class="smart-button smart-element smart-collapse-button" aria-label="Collapse"></button>\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button"aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content" inner-h-t-m-l="[[innerHTML]]"><content></content></div>\n <div id="footer" class="smart-footer"></div>\n </div>\n </div>'}propertyChangedHandler(e,t,a){const i=this;switch(e){case"collapsed":a?i.collapse(!0):i.expand(!0);break;case"disabled":case"unfocusable":i._setFocusable();break;case"headerTemplate":case"footerTemplate":i._applyLayoutTemplate(i.$[e.split(/[T]/)[0]],a);break;case"headerButtons":i._setHeaderButtons();break;case"headerPosition":{const e=i.minimized;i._preventEventFiring=!0,i.restore(),delete i._preventEventFiring,e&&i.minimize();break}case"label":i.$.header.innerHTML=i.label;break;case"maximized":a?i.maximize(!0):i.restore(e);break;case"modal":i._setModal(),i.setAttribute("aria-modal",a);break;case"minimized":a?i.minimize(!0):i.restore(e);break;case"opened":a?i.open(!0):i.close(!0);break;case"resizeMode":i.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right");break;case"windowParent":i._setElementParent(a);break;default:super.propertyChangedHandler(e,t,a)}}ready(){super.ready(),this._windowParent={initialParent:this.parentElement}}render(){const e=this,t=e.animation;e.$.header.id||(e.$.header.id=e.id+"Header"),e.$.content.id||(e.$.content.id=e.id+"Content"),e.opened||(e.animation="none"),e._windowParent={initialParent:e.parentElement},e.$.addClass("smart-window"),e._createElement(),e._setElementParent(e.windowParent),e._setHeaderButtons(),e.headerTemplate&&e._applyLayoutTemplate(e.$.header,e.headerTemplate),e.footerTemplate&&e._applyLayoutTemplate(e.$.footer,e.footerTemplate),e.opened?e.open():e.close(),e.maximized&&e.maximize(!0),e.minimized&&e.minimize(!0),e.collapsed&&e.collapse(!0),e.pinned?e.pin():e.unpin(),e._setFocusable(),e.animation=t,e.setAttribute("aria-modal",e.modal),e.setAttribute("aria-labelledby",e.$.header.id),e._setupDismissTargets(),super.render()}refresh(){const e=this;e.headerTemplate&&e._applyLayoutTemplate(e.$.header,e.headerTemplate),e.footerTemplate&&e._applyLayoutTemplate(e.$.footer,e.footerTemplate),e.opened?e.open():e.close(),e.maximized&&e.maximize(!0),e.minimized&&e.minimize(!0),e.collapsed&&e.collapse(!0),e.pinned?e.pin():e.unpin()}static get requires(){return{"Smart.Button":"smart.button.js"}}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)e.removeAttribute("tabindex");else{let t=e.tabIndex>0?e.tabIndex:0;e.setAttribute("tabindex",t)}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?t.$.content.appendChild(e):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}updateLabel(e){this.label=e}updateContent(e){this.content=e}move(e,t){const a=this,i=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;void 0!==e&&(a.style.left=i(e)),void 0!==t&&(a.style.top=i(t))}collapse(e){const t=this;!e&&t.collapsed||(t.collapsed=!0,t.$.fireEvent("collapse"),"left"===t.headerPosition||"right"===t.headerPosition?t.style.width="":t.style.height="")}close(e){const t=this;if(e||!t.$.hasClass("smart-visibility-hidden")){if(t.isCompleted){if(t.$.fireEvent("closing").defaultPrevented)return;t.$.addClass("smart-visibility-hidden"),t.opened=!1,t.isRendered&&t.$.fireEvent("close")}else t.$.addClass("smart-visibility-hidden"),t.opened=!1;t._setModal(),t.removeAttribute("ontop")}}attached(){super.attached();const e=this;e.isRendered,e._windowParent.parent&&e._windowParent.parent!==e.getShadowRootOrBody()&&e._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&"static"===window.getComputedStyle(e._windowParent.parent).getPropertyValue("position")&&(e._windowParent.parent.style.position="relative"),e.opened&&e._modal&&e.parentElement.insertBefore(e._modal,e)}bringToFront(){const e=this;if(!e.parentElement)return;const t=e.parentElement.closest(".smart-window");if(t)return void t.bringToFront();const a=document.body.getElementsByClassName("smart-window");let i=[];for(let e=0;e<a.length;e++){const t=a[e];t.removeAttribute("ontop"),t.opened&&i.push(t)}1===i.length&&i[0]===e||e.setAttribute("ontop","")}clear(){const e=this;e.isCompleted&&"Smart-WINDOW"===e.nodeName&&(e.innerHTML=e.$.content.innerHTML="")}detached(){super.detached();const e=this;e._windowParent.parent&&!e._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&(e._windowParent.parent.style.position=""),e._modal&&e._modal.parentElement&&e._modal.parentElement.removeChild(e._modal),e._resizeDummy&&e._resizeDummy.parentElement&&e._handleWindowResizeDummy(),e._refreshMinimizedWindowsPosition()}expand(e){const t=this;(e||t.collapsed)&&(t.collapsed=!1,t.$.fireEvent("expand"),t.maximized?"left"===t.headerPosition||"right"===t.headerPosition?t.style.width=Math.max(t._windowParent.scrollElement.scrollWidth,t._windowParent.element.clientWidth)-t._windowParent.borderWidth+"px":t.style.height=Math.max(t._windowParent.scrollElement.scrollHeight,t._windowParent.element.clientHeight)-t._windowParent.borderWidth+"px":"left"===t.headerPosition||"right"===t.headerPosition?t.style.width=t.className.indexOf("smart-window-snapped-")<0&&t._dragDetails?t._dragDetails.width+"px":"":t.style.height=t.className.indexOf("smart-window-snapped-")<0&&t._dragDetails?t._dragDetails.height+"px":"")}maximize(e){const t=this;if(!e&&t.maximized)return;t.minimized&&t._restoreFromMinimization(e),t._setDragDetails("minimize"),"none"!==t.resizeMode&&t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right"),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&t.classList.remove("smart-window-snapped-"+t._snapDummy._position),t.maximized=!0,t.$.fireEvent("maximize"),t.style.left=t.style.top=0,t.style.maxWidth=t.style.maxHeight="none";const a=t._windowParent.scrollElement.scrollHeight,i=t._windowParent.scrollElement.scrollWidth,n=t._windowParent.element.clientHeight,o=t._windowParent.element.clientWidth,s=Math.max(a,n),r=Math.max(i,o);"top"===t.headerPosition||"bottom"===t.headerPosition?(t.style.width=i>o?r-t._windowParent.borderWidth+"px":"100%",t.collapsed||(t.style.height=a>n?s-t._windowParent.borderWidth+"px":"100%")):(t.collapsed||(t.style.width=i>o?r-t._windowParent.borderWidth+"px":"100%"),t.style.height=a>n?s-t._windowParent.borderWidth+"px":"100%"),"100%"!==t.style.height&&t.addEventListener("transitionend",(function e(){if(!t.maximized||!t.hasAnimation)return;const a=t._windowParent.scrollElement.scrollHeight,i=t._windowParent.element.clientHeight,n=Math.max(a,i);("top"===t.headerPosition||"bottom"===t.headerPosition)&&t.collapsed||(t.style.height=a>i?n-t._windowParent.borderWidth+"px":"100%"),t.removeEventListener("transitionend",e)}))}minimize(e){const t=this;if(!e&&t.minimized)return;t.maximized&&(t._preventEventFiring=!0,t.restore(),delete t._preventEventFiring),t._setDragDetails(),t.minimized=!0,t.$.fireEvent("minimize"),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&(t.$.removeClass("smart-window-snapped-"+t._snapDummy._position),t.style.right=t.style.top=t.style.left="");const a=t._getAllMinimizedWindows(t._windowParent.element);if(a.length>0){const e=a[a.length-1];t.style.left=(e.offsetLeft+e.offsetWidth+t._dragDetails.minWidth+10>t._windowParent.element.clientWidth?e.offsetLeft:e.offsetLeft+e.offsetWidth+5)+"px",t.style.top=e.offsetTop+"px"}else t.style.left="5px",t.style.top=t._windowParent.element.clientHeight+t._windowParent.scrollElement.scrollTop-t.$.headerSection.offsetHeight-5+"px";t.style.width="",t.style.height=t.$.headerSection.offsetHeight+"px"}_createElement(){this.setAttribute("role","dialog")}removeChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?t.$.content.removeChild(e):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}restore(e){const t=this;if("maximized"===e||t.maximized?(t.maximized=!1,t.style.width=t.style.height=t.style.top=t.style.left=""):("minimized"===e||t.minimized)&&t._restoreFromMinimization(e),t._preventEventFiring||t.$.fireEvent("restore"),t.style.maxWidth=t.style.maxHeight="",t._dragDetails){if(t.style.left=Math.max(0,Math.min(t._dragDetails.windowX,t._windowParent.element.clientWidth-t._dragDetails.width))+"px",t.style.top=Math.max(0,Math.min(t._dragDetails.windowY,t._windowParent.scrollElement.scrollHeight-t._dragDetails.height))+"px",t.collapsed)return void("top"===t.headerPosition||"bottom"===t.headerPosition?t.style.width=t._dragDetails.width+"px":t.style.height=t._dragDetails.height+"px");t._dragDetails.resized&&(t.style.width=t._dragDetails.width+"px",t.style.height=t._dragDetails.height+"px")}}toggle(){const e=this;e.opened?e.close():e.open()}openModal(){this.modal=!0,this.open()}open(e){const t=this;if(e||t.$.hasClass("smart-visibility-hidden")){if(t.isCompleted){if(t.$.fireEvent("opening").defaultPrevented)return;t.$.removeClass("smart-visibility-hidden"),t.opened=!0,t.$.fireEvent("open")}else t.$.removeClass("smart-visibility-hidden"),t.opened=!0;t.bringToFront(),t._setModal(),t._handleActiveState(),t.hasAnimation?t.addEventListener("transitionend",a):a()}function a(e){if(!t.hasAnimation||e&&e.target===t){if(t.removeEventListener("transitionend",a),t._onOpenCallback)return void t._onOpenCallback();t.focus()}}}_setupDismissTargets(){const e=this;if(e.querySelector('[data-dismiss="modal"]')){const t=e.querySelectorAll('[data-dismiss="modal"]'),a=()=>{e.close()};for(let e=0;e<t.length;e++)t[e].removeEventListener("click",a,null),t[e].addEventListener("click",a)}}pin(){this.pinned=!0}unpin(){this.pinned=!1}_applyLayoutTemplate(e,t){const a=this;if(!t)return e.innerHTML="",void(e===a.$.header&&a.label&&(e.innerHTML=a.label));"content"in document.createElement("template")?(t instanceof HTMLTemplateElement||(t=document.getElementById(t)),null!==t&&"content"in t?(e.innerHTML="",e.appendChild(document.importNode(t.content,!0))):a.error(a.localize("invalidTemplate",{elementType:a.nodeName.toLowerCase(),property:e===a.$.footer?"footerTemplate":"headerTemplate"}))):a.error(a.localize("htmlTemplateNotSuported",{elementType:a.nodeName.toLowerCase()}))}_cancelDragging(e){const t=this;if(t._dragDetails&&t._dragDetails.started&&"drag"===t._dragDetails.type){if(!e){const a=t.getBoundingClientRect();e={pageX:a.left,pageY:a.top}}t.$.fireEvent("dragEnd",{left:e.pageX,top:e.pageY}),t.removeAttribute("dragged"),t._dragDetails.started=!1,delete t._mouseManipulation}}_documentFocusInEventHandler(e){const t=this;t._changingFocus&&(t.contains(e.target)||t.contains(e.composedPath()[0])||t.focus(),delete t._changingFocus)}_downHandler(e){const t=this;let a=Smart.Utilities.Core.isMobile?document.elementFromPoint(e.pageX-window.pageXOffset,e.pageY-window.pageYOffset):e.originalEvent.target;if((t.shadowRoot||t.isInShadowDOM)&&(a=e.originalEvent.composedPath()[0]),e.stopPropagation(),t.disabled||!Smart.Utilities.Core.isMobile&&1!==e.which)return;if(t._tabsWindow&&(t._tabsWindow._isAutoHideWindowClicked=!0),t.hasAttribute("ontop")||t.bringToFront(),a.closest&&a.closest(".smart-buttons-container")===t.$.buttonsContainer){if(t._buttonPressed=a.closest(".smart-button"),t._buttonPressed)return}else if(a.getRootNode()&&a.getRootNode().host&&(t._buttonPressed=a.getRootNode().host,t._buttonPressed.closest(".smart-buttons-container")===t.$.buttonsContainer))return;t._isWindowContentClicked=a.closest(".smart-content");let i=t.closest("smart-docking-layout");if(t.isInShadowDOM&&!i){let e=t.getRootNode().host;for(;e&&(i=e.closest("smart-docking-layout"),!i)&&e.getRootNode();)e=e.getRootNode().host}if(!(t instanceof Smart.TabsWindow&&i&&i.disabled)){if(t._handleActiveState(),!(t instanceof Smart.TabsWindow&&i))return a.closest(".smart-header-section")===t.$.headerSection&&(void 0===t._dblClickDetails&&(t._dblClickDetails={clicks:0}),clearTimeout(t._dblClickDetails.timeOut),t._dblClickDetails.clicks++,t._dblClickDetails.timeOut=setTimeout((function(){t._dblClickDetails&&(t._dblClickDetails.clicks=0)}),300),2===t._dblClickDetails.clicks)?(t._headerDblCickHandler(e),void(t._dblClickDetails.clicks=0)):void(t.maximized||(Smart.Utilities.Core.isMobile&&t._moveHandler(e),!t.pinned&&!t.minimized&&t.$.container.className.indexOf("smart-window-resizing")<0&&(a=a.closest(".smart-header-section"),a&&a===t.$.headerSection&&(t._mouseManipulation=!0,t._setDragDetails("drag",e))),"none"!==t.resizeMode&&t.$.container.className.indexOf("smart-window-resizing")>-1&&(t._mouseManipulation=!0,t._setDragDetails("resize",e))));t.$.hasClass("smart-docking-layout-auto-hide-window")&&(Smart.Utilities.Core.isMobile&&t._moveHandler(e),"none"!==t.resizeMode&&t.$.container.className.indexOf("smart-window-resizing")>-1&&(t._mouseManipulation=!0,t._setDragDetails("resize",e)))}}_documentMoveHandler(e){const t=this;!t._dragDetails||!t._dragDetails.started||t.minimized||!t._mouseManipulation||Math.abs(e.pageX-t._dragDetails.x)<=5&&Math.abs(e.pageY-t._dragDetails.y)<=5||(t.hasAttribute("dragged")||t.hasAttribute("resized")||t.$.fireEvent(t._dragDetails.type+"Start",{left:e.pageX,top:e.pageY,width:t.offsetWidth,height:t.offsetHeight}),e.stopPropagation(),"drag"!==t._dragDetails.type||t.pinned?(t._dragDetails.resized=!0,t._resize(t._dragDetails.side,e),t._dragDetails.x=Math.max(t._windowParent.offsetLeft+t._dragDetails.left,Math.min(t._windowParent.offsetLeft+t._dragDetails.left+(t._dragDetails.side.toLowerCase().indexOf("left")>-1?0:t._dragDetails.newWidth),e.pageX)),t._dragDetails.y=Math.max(t._windowParent.offsetTop+t._dragDetails.top,Math.min(t._windowParent.offsetTop+t._dragDetails.top+(t._dragDetails.side.toLowerCase().indexOf("top")>-1?0:t._dragDetails.newHeight),e.pageY))):(t.setAttribute("dragged",""),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&(t.$.removeClass("smart-window-snapped-"+t._snapDummy._position),t.style.right=t.style.top=t.style.left="",t.collapsed||(t.style.height=t._dragDetails.height+"px",t.style.width=t._dragDetails.width+"px")),t._drag(e,"both"),t._dragDetails.x=Math.max(t._windowParent.offsetLeft+t._dragDetails.offsetX-t._windowParent.scrollElement.scrollLeft,Math.min(t._windowParent.offsetLeft+t._windowParent.element.offsetWidth-(t._windowParent.element.offsetWidth-t.offsetLeft)+t._dragDetails.offsetX,e.pageX)),t._dragDetails.y=Math.max(t._windowParent.offsetTop+t._dragDetails.offsetY-t._windowParent.scrollElement.scrollTop,Math.min(t._windowParent.offsetTop+t._windowParent.element.offsetHeight-(t._windowParent.element.offsetHeight-t.offsetTop)+t._dragDetails.offsetY,e.pageY)),e.pageX>=t._windowParent.offsetLeft+t._windowParent.scrollElement.scrollWidth-1?t._handleSnapping("right"):e.pageY<=t._windowParent.offsetTop?t._handleSnapping("top"):e.pageX<=t._windowParent.offsetLeft?t._handleSnapping("left"):t._handleSnapping()))}_documentUpHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(t.disabled)return t.removeAttribute("active"),delete t._buttonPressed,void delete t._isWindowContentClicked;if(t._dragDetails&&t._dragDetails.started&&(t.hasAttribute("resized")&&(t.$.fireEvent(t._dragDetails.type+"End",{left:e.pageX,top:e.pageY,width:t._dragDetails.newWidth,height:t._dragDetails.newHeight}),t.removeAttribute("resized"),t._handleWindowResizeDummy(),t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right")),setTimeout((function(){t.$.removeClass("no-transition")}),20),t.hasAttribute("dragged")&&(t.$.fireEvent(t._dragDetails.type+"End",{left:e.pageX,top:e.pageY}),t.removeAttribute("dragged")),t._dragDetails.started=!1,delete t._mouseManipulation),t._snapDummy&&!t._snapDummy.classList.contains("smart-visibility-hidden")){switch(t._snapDummy._position){case"left":case"top":t.style.left=t.style.top="0",t.style.right="auto";break;case"right":t.style.left="auto",t.style.top=t.style.right="0"}t.style.width="top"===t._snapDummy._position?"100%":"50%",t.style.height="100%",t.$.addClass("smart-window-snapped-"+t._snapDummy._position),t._handleSnapping()}t._modal&&a===t._modal&&!t._isWindowContentClicked&&(t.closeOnMaskClick?t.close():t.focus()),t._isWindowButton(a)&&t.focus(),delete t._isWindowContentClicked,delete t._buttonPressed;const i=t.shadowRoot&&t._windowParent.element&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;if(!t.hasAttribute("active")||i===t)return;if(!a.closest)return;let n=a.closest(".smart-window");for(;n&&n!==t;)n=n.parentElement,n&&(n=n.closest(".smart-window"));t.opened&&n!==t&&t.removeAttribute("active")}_documentSelectStartHandler(e){this._dragDetails&&this._dragDetails.started&&e.preventDefault()}_drag(e,t){const a=this;if(!e||a.pinned||a.maximized)return;let i,n;a._dragDetails&&a._dragDetails.started||a._setDragDetails("drag",e),a.$.addClass("no-transition"),"object"==typeof e?(i=e.pageX-a._dragDetails.x,n=e.pageY-a._dragDetails.y):i=n=e;const o=Math.max(a._windowParent.element.clientHeight,a._windowParent.scrollElement.scrollHeight),s=Math.max(a._windowParent.element.clientWidth,a._windowParent.scrollElement.scrollWidth);switch(t){case"horizontal":a._dragDetails.windowX=Math.max(0,Math.min(a._dragDetails.windowX+i,s-a.offsetWidth)),a.style.left=a._dragDetails.windowX+"px";break;case"vertical":a._dragDetails.windowY=Math.max(0,Math.min(a._dragDetails.windowY+n,o-a.offsetHeight)),a.style.top=a._dragDetails.windowY+"px";break;case"both":a._dragDetails.windowX=Math.max(0,Math.min(a._dragDetails.windowX+i,s-a.offsetWidth)),a._dragDetails.windowY=Math.max(0,Math.min(a._dragDetails.windowY+n,o-a.offsetHeight)),a.style.left=a._dragDetails.windowX+"px",a.style.top=a._dragDetails.windowY+"px"}a._dragDetails.top=a.offsetTop,a._dragDetails.left=a.offsetLeft}_dragStartHandler(e){this._dragDetails&&this._dragDetails.started&&e.preventDefault()}_focusHandler(e){const t=this;"focus"===e.type?(t.setAttribute("focus",""),t.bringToFront()):t._buttonPressed||(t.removeAttribute("focus"),t._dragDetails&&t._dragDetails.started&&t._handleWindowResizeDummy())}_getAllMinimizedWindows(e){const t=this;let a=[];e||(e=t._windowParent.element);const i=e.querySelectorAll("smart-window");for(let e=0;e<i.length;e++)i[e]!==t&&i[e].hasAttribute("minimized")&&a.push(i[e]);return a.sort((function(e,t){let a=e.getBoundingClientRect(),i=t.getBoundingClientRect();return a.right-i.right})),a}_handleSnapping(e){const t=this;e?t.disableSnap||t.collapsed||(t._snapDummy||(t._snapDummy=document.createElement("div"),t._snapDummy.addEventListener("transitionend",(function(){t._snapDummy.classList.contains("smart-visibility-hidden")&&t._snapDummy.parentElement&&t._snapDummy.parentElement.removeChild(t._snapDummy)}))),t._snapDummy.className="smart-window-snap-"+e+"-feedback",t._snapDummy._position=e,t._snapDummy.parentElement||t._windowParent.element.appendChild(t._snapDummy)):t._snapDummy&&t._snapDummy.parentElement&&t._snapDummy.classList.add("smart-visibility-hidden")}_headerDblCickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;a!==t.$.headerSection&&a!==t.$.header||t.$.maximizeButton&&0===t.$.maximizeButton.offsetHeight||(t.maximized?t.restore():t.maximize())}_isWindowButton(e){const t=this;for(;e&&(e.closest&&e.closest(".smart-buttons-container"))!==t.$.buttonsContainer;)e=e.getRootNode().host;if(!e)return;const a=/smart-(\w+[-]*\w*)-button/gi;if((e=e.closest(".smart-button"))&&e===t._buttonPressed)switch(e){case t.$.closeButton:return t.close(),!0;case t.$.collapseButton:return t.collapsed?t.expand():t.collapse(),!0;case t.$.maximizeButton:return t.maximized?t.restore():t.maximize(),!0;case t.$.minimizeButton:return t.minimized?t.restore():t.minimize(),!0;case t.$.pinButton:return t.pinned?t.unpin():t.pin(),!0;default:if(!a.test(e.className))return;return t.$.fireEvent(Smart.Utilities.Core.toCamelCase(e.className.match(a).toString().replace("smart-","").replace("-button","")),{button:e}),!0}}_keyDownHandler(e){const t=this;if(delete t._changingFocus,t.disabled||(t.hasAttribute("dragged")||t.hasAttribute("resized"))&&t._mouseManipulation)return;const a="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,i=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;if(!t.disableKeyboard)switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":{if(t.minimized||i!==t)return;let n=e.key.indexOf("Right")>-1||e.key.indexOf("Left")>-1;e.preventDefault();const o=(t.isInShadowDOM?t.getRootNode().host:t).closest("smart-docking-layout");if(!n&&e.altKey&&!(t instanceof Smart.TabsWindow&&o))return void("ArrowUp"===e.key?t.maximize():t.restore());if(t.maximized)return;if(t.$.addClass("no-transition"),e.ctrlKey&&"none"!==t.resizeMode&&!t.collapsed)return n=-1===["horizontal","vertical","both"].indexOf(t.resizeMode)?t.resizeMode:n?"right":"bottom",t.hasAttribute("dragged")&&t._cancelDragging(e),t.hasAttribute("resized")||t.$.fireEvent("resizeStart",{position:{x:e.pageX,y:e.pageY}}),void t._resize(n,a);t.pinned||(t.hasAttribute("dragged")||(t.setAttribute("dragged",""),t.$.fireEvent("dragStart",{left:e.pageX,top:e.pageY})),t._drag(a,n?"horizontal":"vertical")),t.$.removeClass("no-transition");break}case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"p":e.altKey&&t.headerButtons.indexOf("pin")>-1&&(t.pinned?t.unpin():t.pin());break;case"c":e.altKey&&t.headerButtons.indexOf("collapse")>-1&&(t.collapsed?t.expand():t.collapse());break;case"m":e.altKey&&t.headerButtons.indexOf("minimize")>-1&&(t.minimized?t.restore():t.minimize());break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}}_keyUpHandler(e){const t=this;if(e.key&&!t.disableKeyboard){if("Control"===e.key&&t._dragDetails&&t.hasAttribute("resized")&&!t._mouseManipulation){if(!t._dragDetails.started)return;"drag"!==t._dragDetails.type&&(t.removeAttribute("resized"),t.$.fireEvent("resizeEnd",{left:e.pageX,top:e.pageY,width:t._dragDetails.newWidth,height:t._dragDetails.newHeight}),t._handleWindowResizeDummy()),t._dragDetails.started=!1}e.key.indexOf("Arrow")>-1&&t.hasAttribute("dragged")&&!t._mouseManipulation&&t._cancelDragging(e)}}_mouseWheelHandler(e){const t=this;!t.disabled&&t._dragDetails&&t._dragDetails.started&&(e.deltaY<0&&t._windowParent.scrollElement.scrollTop+e.deltaY<=0?t.style.top=Math.max(0,t._dragDetails.windowY)+"px":e.deltaY>0&&(t._dragDetails.windowY+t.offsetHeight+e.deltaY>=t._windowParent.scrollElement.scrollHeight||t._windowParent.scrollElement.scrollTop+t._windowParent.element.clientHeight===t._windowParent.scrollElement.scrollHeight)||("drag"===t._dragDetails.type?(t._dragDetails.windowY+=e.deltaY,t.style.top=t._dragDetails.windowY+"px"):(t._dragDetails.height+=e.deltaY,t.style.height=t._dragDetails.height+"px")))}_moveHandler(e){const t=this;if(!(t.disabled||t.collapsed||t.maximized||t.minimized||(Smart.Utilities.Core.isMobile&&navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&t.hasAttribute("dragged")&&e.originalEvent.preventDefault(),t._mouseManipulation||(t.$.container.className.indexOf("smart-window-resizing")>-1&&t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right"),"none"===t.resizeMode)))){const a=t.getBoundingClientRect(),i=e.clientY<a.top+10,n=e.clientY>a.bottom-10,o=e.clientX>a.right-10,s=e.clientX<a.left+10;switch(t.resizeMode){case"none":break;case"both":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-bottom-right"));if(s||o)return i?void t.$.container.classList.add("smart-window-resizing-top-"+(s?"left":"right")):n?void t.$.container.classList.add("smart-window-resizing-bottom-"+(s?"left":"right")):void t.$.container.classList.add("smart-window-resizing-"+(s?"left":"right"));if(i||n){if(o)return void t.$.container.classList.add("smart-window-resizing-"+(i?"top-right":"bottom-right"));if(s)return void t.$.container.classList.add("smart-window-resizing-"+(i?"top-left":"bottom-left"));t.$.container.classList.add("smart-window-resizing-"+(i?"top":"bottom"))}break;case"horizontal":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-right"));if(s)return void t.$.container.classList.add("smart-window-resizing-left");o&&t.$.container.classList.add("smart-window-resizing-right");break;case"vertical":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-bottom"));if(i)return void t.$.container.classList.add("smart-window-resizing-top");n&&t.$.container.classList.add("smart-window-resizing-bottom");break;case"top":if(i){if(t.resizeIndicator&&!s)return;t.$.container.classList.add("smart-window-resizing-top")}break;case"bottom":if(n){if(t.resizeIndicator&&!o)return;t.$.container.classList.add("smart-window-resizing-bottom")}break;case"left":if(s){if(t.resizeIndicator&&!i)return;t.$.container.classList.add("smart-window-resizing-left")}break;case"right":if(o){if(t.resizeIndicator&&!n)return;t.$.container.classList.add("smart-window-resizing-right")}}}}_handleActiveState(){const e=this,t=document.querySelectorAll(".smart-window");for(let a=0;a<t.length;a++)t[a].contains(e)||e.contains(t[a])||(t[a].removeAttribute("active"),t[a].removeAttribute("focus"));e.setAttribute("active","")}_handleWindowResizeDummy(){const e=this;if(e._resizeDummy||(e._resizeDummy=document.createElement("div"),e._resizeDummy.classList.add("smart-window-resize-feedback")),!e.hasAttribute("resized"))return e._resizeDummy&&e._resizeDummy.remove(),void(!e.liveResize&&"resize"===e._dragDetails.type&&e._dragDetails.started&&(e.style.top=e._dragDetails.top+"px",e.style.left=e._dragDetails.left+"px",e.style.width=e._dragDetails.newWidth+"px",e.style.height=e._dragDetails.newHeight+"px"));e._resizeDummy.parentElement||e._resizeDummy.getRootNode().host||(e._resizeDummy.style.width=e.offsetWidth+"px",e._resizeDummy.style.height=e.offsetHeight+"px",e._resizeDummy.style.top=e.offsetTop+"px",e._resizeDummy.style.left=e.offsetLeft+"px",e._windowParent.element.appendChild(e._resizeDummy))}_resize(e,t){const a=this;let i;if((!a._dragDetails||a._dragDetails&&"drag"===a._dragDetails.type)&&a._setDragDetails("resize"),!a._dragDetails)return;a._dragDetails.started=!0,a.hasAttribute("resized")||(a.setAttribute("resized",""),a.hasAnimation&&a.$.addClass("no-transition")),a.liveResize||a._handleWindowResizeDummy();const n=a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)?"snapWindowWidth":"width";switch(e){case"left":i="object"==typeof t?t.pageX-a._dragDetails.x:t,i=i>0?Math.min(i,a._dragDetails[n]-a._dragDetails.minWidth):-1*Math.min(a._dragDetails.maxWidth?a._dragDetails.maxWidth-a._dragDetails[n]:a._dragDetails.left,Math.abs(i)),a._dragDetails[n]=Math.min(a._dragDetails[n]+a._dragDetails.left-a._windowParent.scrollElement.scrollLeft,a._dragDetails[n]-i),a._dragDetails.windowX=Math.max(a._windowParent.scrollElement.scrollLeft,a._dragDetails.windowX+i),"object"!=typeof t&&(a._dragDetails[n]=Math.max(a._dragDetails[n],a._dragDetails.minWidth)),a._dragDetails[n]>=a._dragDetails.minWidth&&(a._dragDetails.left=a._dragDetails.windowX,a._dragDetails.newWidth=a._dragDetails[n]);break;case"right":{const e=a._windowParent.element.clientWidth!==a._windowParent.element.offsetWidth?a._windowParent.borderWidth:0,n=a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)?"snapWindowWidth":"width";i="object"==typeof t?t.pageX-a._dragDetails.x:t,i>0&&a._dragDetails.maxWidth&&(i=Math.min(a._dragDetails.maxWidth-a._dragDetails[n],i)),a._dragDetails[n]=Math.min(a._windowParent.element.clientWidth+a._windowParent.scrollElement.scrollLeft-a._dragDetails.left-e,Math.max(0,a._dragDetails[n]+i)),"object"!=typeof t&&(a._dragDetails[n]=Math.max(a._dragDetails[n],a._dragDetails.minWidth)),a._dragDetails.left=a.offsetLeft,a._dragDetails.newWidth=Math.max(a._dragDetails.minWidth,a._dragDetails[n]);break}case"top":a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)&&(a._dragDetails.height=a._dragDetails.snapWindowHeight),i="object"==typeof t?t.pageY-a._dragDetails.y:t,i=i>0?Math.min(i,a._dragDetails.height-a._dragDetails.minHeight):-1*Math.min(a._dragDetails.maxHeight?a._dragDetails.maxHeight-a._dragDetails.height:a._dragDetails.top,Math.abs(i)),a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.min(a._dragDetails.height+a._dragDetails.top-a._windowParent.scrollElement.scrollTop,a._dragDetails.height-i),a._dragDetails.windowY=Math.max(a._windowParent.scrollElement.scrollTop,a._dragDetails.windowY+i),"object"!=typeof t&&(a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.max(a._dragDetails.height,a._dragDetails.minHeight)),a._dragDetails.height>=a._dragDetails.minHeight&&(a._dragDetails.top=a._dragDetails.windowY,a._dragDetails.newHeight=a._dragDetails.height),a._dragDetails.newWidth=Math.max(a._dragDetails[n],a._dragDetails.newWidth);break;case"bottom":a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)&&(a._dragDetails.height=a._dragDetails.snapWindowHeight),i="object"==typeof t?t.pageY-a._dragDetails.y:t,i>0&&a._dragDetails.maxHeight&&(i=Math.min(a._dragDetails.maxHeight-a._dragDetails.height,i)),a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.min(a._windowParent.element.clientHeight+a._windowParent.scrollElement.scrollTop-a._dragDetails.top-a._windowParent.borderWidth,Math.max(0,a._dragDetails.height+i)),"object"!=typeof t&&(a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.max(a._dragDetails.height,a._dragDetails.minHeight)),a._dragDetails.newHeight=Math.max(a._dragDetails.minHeight,a._dragDetails.height),a._dragDetails.newWidth=Math.max(a._dragDetails[n],a._dragDetails.newWidth);break;case"bottomLeftCorner":a._resize("bottom",t),a._resize("left",t);break;case"bottomRightCorner":a._resize("bottom",t),a._resize("right",t);break;case"topLeftCorner":a._resize("top",t),a._resize("left",t);break;case"topRightCorner":a._resize("top",t),a._resize("right",t)}const o=a.liveResize?a:a._resizeDummy;a._dragDetails.newHeight=Math.max(a._dragDetails.snapWindowHeight,a._dragDetails.newHeight),o.style.top=a._dragDetails.top+"px",o.style.left=a._dragDetails.left+"px",o.style.width=a._dragDetails.newWidth+"px",o.style.height=a._dragDetails.newHeight+"px"}_restoreFromMinimization(){const e=this;e.minimized=!1,e.style.width=e.style.height=e.style.top=e.style.left="",e._refreshMinimizedWindowsPosition()}_refreshMinimizedWindowsPosition(){const e=this,t=e._getAllMinimizedWindows();if(0===t.length)return;let a;t[0].style.left="5px";for(let i=1;i<t.length;i++)parseFloat(t[i-1].style.left)+t[i-1].offsetWidth+t[i].offsetWidth+10<e._windowParent.element.clientWidth?(t[i].style.left=parseFloat(t[i-1].style.left)+t[i-1].offsetWidth+5+"px",t[i].style.top=t[i-1].offsetTop+"px",a=t[i]):(t[i].style.left=parseFloat(a.style.left)+"px",t[i].style.top=a.offsetTop+"px")}_setHeaderButtons(){const e=this,t=e.headerButtons,a=e.$.buttonsContainer.children,i=function(t){const a=e.$.buttonsContainer.getElementsByClassName("smart-"+(t+"").split(/(?=[A-Z])/).join("-").toLowerCase()+"-button")[0];return a&&a.classList.remove("smart-hidden"),a};for(let e=0;e<a.length;e++)a[e].classList.add("smart-hidden");if(t.length>0)for(let a=0;a<t.length;a++){let n=i(t[a]);if(!n){const e=(t[a]+"").split(/(?=[A-Z])/);n=document.createElement("button"),n.setAttribute("aria-label",e.map((e=>e.slice(0,1).toUpperCase()+e.slice(1))).join(" ")),n.classList.add("smart-"+e.join("-").toLowerCase()+"-button","smart-button","smart-element")}e.$.buttonsContainer.insertBefore(n,e.$.buttonsContainer.firstElementChild)}}_setDragDetails(e,t){const a=this;if(a._dragDetails||(a._dragDetails={}),void 0===a._dragDetails.minWidth||void 0===a._dragDetails.minHeight||void 0===a._dragDetails.maxWidth||void 0===a._dragDetails.maxHeight){const e=getComputedStyle(a);a._dragDetails.minWidth=parseFloat(e.getPropertyValue("min-width"))||0,a._dragDetails.minHeight=parseFloat(e.getPropertyValue("min-height"))||0,a._dragDetails.maxWidth=parseFloat(e.getPropertyValue("max-width"))||0,a._dragDetails.maxHeight=parseFloat(e.getPropertyValue("max-height"))||0}a._dragDetails.windowX=a.offsetLeft,a._dragDetails.windowY=a.offsetTop;const i=a.getBoundingClientRect();if(a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position))"right"===a.headerPosition&&a.collapsed&&(a._dragDetails.offsetX=i.left+a.offsetWidth-t.clientX);else{const n=a.parentElement===document.body?document.documentElement.getBoundingClientRect():a.parentElement?a.parentElement.getBoundingClientRect():document.documentElement.getBoundingClientRect(),o=window.scrollX||window.pageXOffset,s=window.scrollY||window.pageYOffset;a._windowParent.offsetLeft=n.left+o,a._windowParent.offsetTop=n.top+s,t&&"object"==typeof t&&(a._dragDetails.offsetX=t.clientX-i.left,a._dragDetails.offsetY=t.clientY-i.top),a.collapsed||(a.hasAnimation&&"minimize"===e?(a._dragDetails.width=a._dragDetails.width?a._dragDetails.width:a.offsetWidth,a._dragDetails.height=a._dragDetails.height?a._dragDetails.height:a.offsetHeight):(a._dragDetails.width=a.offsetWidth,a._dragDetails.height=a.offsetHeight),(a.style.width||a.style.height)&&(a._dragDetails.resized=!0))}if("minimize"!==e&&e&&(a._dragDetails.type=e,a._dragDetails.started=!0,a._dragDetails.snapWindowWidth=a.offsetWidth,a._dragDetails.snapWindowHeight=a.offsetHeight,t&&"object"==typeof t?(a._dragDetails.x=t.pageX,a._dragDetails.y=t.pageY):(a._dragDetails.x=a.offsetLeft,a._dragDetails.y=a.offsetTop),"resize"===e)){if("none"===a.resizeMode)return void delete a._dragDetails;a._dragDetails.top=a.offsetTop,a._dragDetails.left=a.offsetLeft,a._dragDetails.newWidth=a._dragDetails.width,a._dragDetails.newHeight=a._dragDetails.height,a.$container.hasClass("smart-window-resizing-right")?a._dragDetails.side="right":a.$container.hasClass("smart-window-resizing-left")?a._dragDetails.side="left":a.$container.hasClass("smart-window-resizing-top")?a._dragDetails.side="top":a.$container.hasClass("smart-window-resizing-bottom")?a._dragDetails.side="bottom":a.$container.hasClass("smart-window-resizing-top-left")?a._dragDetails.side="topLeftCorner":a.$container.hasClass("smart-window-resizing-bottom-left")?a._dragDetails.side="bottomLeftCorner":a.$container.hasClass("smart-window-resizing-top-right")?a._dragDetails.side="topRightCorner":a.$container.hasClass("smart-window-resizing-bottom-right")&&(a._dragDetails.side="bottomRightCorner")}}_setElementParent(e){const t=this;if(t._windowParent.element=void 0,t._windowParent.parent&&!t._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&(t._windowParent.parent.style.position=""),e instanceof HTMLElement)t._windowParent.element=e;else if("string"==typeof e)if("body"===e){const e=t.getRootNode();t._windowParent.element=e&&e.host?t.getShadowRootOrBody():document.body}else t._windowParent.element=document.getElementById(e);if(t._windowParent.element||(t._windowParent.initialParent?t._windowParent.element=t._windowParent.initialParent.parentElement?t._windowParent.initialParent:t.getShadowRootOrBody():t._windowParent.element=t.getShadowRootOrBody()),t.parentElement!==t._windowParent.element&&t._windowParent.element.appendChild(t),t._windowParent.element===document.body)t._windowParent.element=document.documentElement,t._windowParent.scrollElement=document.scrollingElement,t._windowParent.parent=document.body,t._windowParent.borderWidth=0;else{if(t.parentElement instanceof Smart.Window&&!t.parentElement.isCompleted)return void t.parentElement.whenRendered((function(){t.parentElement.appendChild(t),t._setElementParent(t.windowParent)}));t._windowParent.element instanceof Smart.Window&&(t._windowParent.element=t._windowParent.element.$.content);const e=getComputedStyle(t.parentElement),a=e.getPropertyValue("position");t._windowParent.borderWidth=2*parseInt(e.getPropertyValue("border-width")||0),t._windowParent.parent=t.parentElement,t._windowParent.scrollElement=t._windowParent.element,"static"===a&&(t.parentElement.style.position="relative")}t._setModal(),t.style.left&&t.offsetLeft>t._windowParent.scrollElement.scrollWidth&&(t.style.left=t._windowParent.scrollElement.scrollWidth-t.offsetWidth+"px"),t.style.top&&t.offsetTop>t._windowParent.scrollElement.scrollHeight&&(t.style.top=t._windowParent.scrollElement.scrollHeight-t.offsetHeight+"px")}_setModal(){const e=this;if(e._windowParent&&(delete e._changingFocus,e._windowParent.element))if(e.modal)if(e._modal||(e._modal=document.createElement("div"),e._modal.classList.add("smart-modal")),e._windowParent.parent!==document.body?e._modal.setAttribute("nested-modal",""):e._modal.removeAttribute("nested-modal"),e._modal._window=e,e.opened&&!e._modal.parentElement){const t=parseInt(getComputedStyle(e).getPropertyValue("z-index"));isNaN(t)||(e._modal.style.zIndex=t-1),e.parentElement.insertBefore(e._modal,e)}else e._modal.parentElement&&e._modal.parentElement.removeChild(e._modal);else e._modal&&e._modal.parentElement&&(e._modal.parentElement.removeChild(e._modal),delete e._modal)}}),Smart("smart-dialog-window",class extends Smart.Window{static get properties(){return{cancelLabel:{value:"Cancel",type:"string"},confirmLabel:{value:"Ok",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},headerButtons:{value:["close"],type:"array"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0}}}static get listeners(){return{"footer.click":"_footerClickHandler"}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="pinButton" class="smart-pin-button" aria-label="Pin"></button>\n <button id="collapseButton" class="smart-button smart-element smart-collapse-button" aria-label="Collapse"></button>\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button" aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}_createElement(){const e=this;e.setAttribute("role","alertdialog"),e.setAttribute("aria-describedby",e.$.content.id)}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm"):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel")}_keyDownHandler(e){const t=this;if(delete t._changingFocus,t.disabled||(t.hasAttribute("dragged")||t.hasAttribute("resized"))&&t._mouseManipulation)return;if(t.disableKeyboard)return;e.stopPropagation();const a="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,i=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":{if(t.minimized||i!==t)return;const n=e.key.indexOf("Right")>-1||e.key.indexOf("Left")>-1;if(e.preventDefault(),!n&&e.altKey)return void("ArrowUp"===e.key?t.maximize():t.restore());if(t.$.addClass("no-transition"),t.maximized)return;if(e.ctrlKey&&"none"!==t.resizeMode)return t.hasAttribute("dragged")&&t._cancelDragging(e),t.hasAttribute("resized")||t.$.fireEvent("resizeStart",{position:{x:e.pageX,y:e.pageY}}),void t._resize(n?"right":"bottom",a);t.pinned||(t.hasAttribute("dragged")||(t.setAttribute("dragged",""),t.$.fireEvent("dragStart",{left:e.pageX,top:e.pageY})),t._drag(a,n?"horizontal":"vertical")),t.$.removeClass("no-transition");break}case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}}}),Smart("smart-alert-window",class extends Smart.DialogWindow{static get properties(){return{headerButtons:{value:[],type:"array"}}}_createElement(){const e=this;e.setAttribute("role","alertdialog"),e.setAttribute("aria-describedby",e.$.content.id)}}),Smart("smart-prompt-window",class extends Smart.DialogWindow{static get properties(){return{autoComplete:{allowedValues:["none","manual","auto","inline"],type:"string",value:"manual"},confirmLabel:{value:"Ok",type:"string"},cancelLabel:{value:"Cancel",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},displayMode:{value:"default",allowedValues:["default","escaped"],type:"string"},headerButtons:{value:["close"],type:"array"},form:{value:"",type:"string"},hint:{value:null,type:"any?"},maxLength:{value:null,type:"number?"},minLength:{value:2,type:"number"},messages:{extend:!0,value:{en:{missingReference:"{{elementType}}: Missing reference to {{files}}."}},type:"object"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},name:{value:"",type:"string"},placeholder:{value:"",type:"string"},promptLabel:{value:"",type:"string?"},required:{value:!1,type:"boolean"},requiredMessage:{value:"",type:"string"},selectAllOnFocus:{value:!1,type:"boolean"},value:{value:"",type:"string"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-text-box id="textBox"\n animation="[[animation]]"\n auto-complete="[[autoComplete]]"\n max-length="[[maxLength]]"\n value="{{value}}"\n form="[[form]]"\n label="[[promptLabel]]"\n hint="[[hint]]"\n display-mode="[[displayMode]]"\n max-length="[[maxLength]]"\n placeholder="[[placeholder]]"\n required="[[required]]"\n required-message="[[requiredMessage]]"\n select-all-on-focus="[[selectAllOnFocus]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n </smart-text-box>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button flat">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button flat">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}static get listeners(){return{"footer.click":"_footerClickHandler"}}static get requires(){return{"Smart.TextBox":"smart.textbox.js"}}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm",{value:t.$.textBox.value}):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel",{value:t.$.textBox.value})}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;if(t.disableKeyboard)return;e.stopPropagation();const i="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,n=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(n!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",i),void a();t._drag(i,"vertical");break;case"ArrowLeft":case"ArrowRight":if(n!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",i),void a();t._drag(i,"horizontal"),t.$.removeClass("no-transition");break;case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}}),Smart("smart-multiline-prompt-window",class extends Smart.PromptWindow{static get properties(){return{autoCapitalize:{value:"none",allowedValues:["none","words","characters"],type:"string"},autoExpand:{value:!1,type:"boolean"},headerButtons:{value:["close"],type:"array"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},selectionDirection:{value:"none",allowedValues:["forward","backward","none"],type:"string"},selectionEnd:{value:0,reflectToAttribute:!1,type:"number"},selectionStart:{value:0,reflectToAttribute:!1,type:"number"},spellCheck:{value:!1,type:"boolean"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},wrap:{value:"soft",allowedValues:["hard","soft","off"],type:"string"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-multiline-text-box id="textBox"\n animation="[[animation]]"\n horizontal-scroll-bar-visibility= "[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility= "[[verticalScrollBarVisibility]]"\n auto-capitalize="[[autoCapitalize]]"\n auto-expand = "[[autoExpand]]"\n selection-direction= "[[selectionDirection]]"\n selection-end= "[[selectionEnd]]"\n selection-start="[[selectionStart]]"\n spell-check= "[[spellCheck]]"\n wrap="[[wrap]]"\n max-length="[[maxLength]]"\n value="{{value}}"\n form="[[form]]"\n label="[[promptLabel]]"\n hint="[[hint]]"\n display-mode="[[displayMode]]"\n max-length="[[maxLength]]"\n placeholder="[[placeholder]]"\n required="[[required]]"\n required-message="[[requiredMessage]]"\n select-all-on-focus="[[selectAllOnFocus]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n </smart-multiline-text-box>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button flat">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button flat">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}static get listeners(){return{"footer.click":"_footerClickHandler"}}static get requires(){return{"Smart.MultilineTextBox":"smart.multilinetextbox.js"}}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm",{value:t.$.textBox.value}):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel",{value:t.$.textBox.value})}}),Smart("smart-progress-window",class extends Smart.Window{static get properties(){return{completeLabel:{value:"Continue",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},headerButtons:{value:["close"],type:"array"},indeterminate:{value:!1,type:"boolean"},inverted:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function"},max:{value:100,type:"number"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},min:{value:0,type:"number"},showProgressValue:{value:!1,type:"boolean"},value:{value:0,type:"number?"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content" inner-h-t-m-l="[[innerHTML]]">\n <content></content>\n </div>\n <div id="footer" class="smart-footer">\n <smart-progress-bar id="progressBar"\n animation="[[animation]]"\n min="[[min]]"\n max="[[max]]"\n indeterminate="[[inditerminate]]"\n inverted="[[inverted]]"\n format-function="[[formatFunction]]"\n show-progress-value="[[showProgressValue]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]"\n value="{{value}}">\n </smart-progress-bar>\n <button id="completeButton" class="smart-button smart-element smart-complete-button smart-visibility-hidden">[[completeLabel]]</button>\n </div>\n </div>\n </div>'}static get requires(){return{"Smart.ProgressBar":"smart.progressbar.js"}}propertyChangedHandler(e,t,a){const i=this;switch(e){case"value":i._handleCompletion();break;default:super.propertyChangedHandler(e,t,a)}}_createElement(){this.setAttribute("role","dialog"),this._handleCompletion()}_handleCompletion(){const e=this;e.$.completeButton&&(e.value>=e.max?(e.$completeButton.removeClass("smart-visibility-hidden"),e.$progressBar.addClass("smart-visibility-hidden")):(e.$completeButton.addClass("smart-visibility-hidden"),e.$progressBar.removeClass("smart-visibility-hidden")))}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;if(t.disableKeyboard)return;e.stopPropagation();const i="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,n=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(n!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",i),void a();t._drag(i,"vertical"),t.$.removeClass("no-transition");break;case"ArrowLeft":case"ArrowRight":if(n!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",i),void a();t._drag(i,"horizontal"),t.$.removeClass("no-transition");break;case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}}),Smart("smart-tabs-window",class extends Smart.Window{static get properties(){return{disableSnap:{value:!0,readOnly:!0,type:"boolean"},dropPosition:{value:["all"],type:"array"},addNewTab:{value:!1,type:"boolean"},allowToggle:{value:!1,type:"boolean"},autoHide:{value:!1,type:"boolean"},autoHideWindow:{value:null,type:"any"},dataSource:{value:null,type:"array?",reflectToAttribute:!1},tabCloseButtonMode:{value:"default",allowedValues:["default","selected"],type:"string"},tabCloseButtons:{value:!1,type:"boolean"},messages:{value:{en:{ambiguousIndexes:"smart-tabs: Initially set smart-tab-item indexes are ambiguous and are ignored in favour of the HTML structure.",detailsObjectRequired:'smart-tabs: The method "insert" requires a details Object to be passed as a second argument.',invalidIndex:'smart-tabs: "{{method}}" method accepts an index of type number.',referenceNodeNotChild:"smart-tabs: Passed {{argument}} is not part of this smart-tabs element.",tabItemRequired:'smart-tabs: The method "{{method}}" requires a "smart-tab-item" element to be passed as an argument.'}},type:"object",extend:!0},tabOverflow:{value:"auto",allowedValues:["auto","hidden","scroll"],type:"string"},tabReorder:{value:!1,type:"boolean"},tabResize:{value:!1,type:"boolean"},tabScrollButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},selectedIndex:{value:null,type:"number?"},selectionMode:{value:"click",allowedValues:["click","dblclick","mouseenter","none"],type:"string"},collapsed:{value:!1,type:"boolean"},collapsible:{value:!1,type:"boolean"},locked:{value:!1,type:"boolean"},max:{value:"",type:"any"},min:{value:"",type:"any"},size:{value:"",type:"any"},tabLayout:{value:"scroll",allowedValues:["scroll","dropdown","wrap","shrink"],type:"string",defaultReflectToAttribute:!0},tabPosition:{value:"top",allowedValues:["top","bottom","left","right","hidden"],type:"string"},tabTextOrientation:{value:"horizontal",allowedValues:["horizontal","vertical"],type:"string"},layout:{value:null,type:"any"}}}static get listeners(){return{"tabsElement.blur":"_tabsFocusHandler","tabsElement.change":"_tabsChangeHandler","tabsElement.focus":"_tabsFocusHandler","autoHideWindow.close":"_autoHideWindowCloseHandler","autoHideWindow.open":"_autoHideWindowOpenHandler"}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button" aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div id="contentSection" class="smart-content">\n <smart-tabs id="tabsElement"\n animation="[[animation]]"\n add-new-tab="[[addNewTab]]"\n allow-toggle="[[allowToggle]]"\n close-button-mode="[[tabCloseButtonMode]]"\n close-buttons="[[tabCloseButtons]]"\n disabled="[[disabled]]"\n overflow="[[tabOverflow]]"\n reorder="[[tabReorder]]"\n resize="[[tabResize]]"\n scroll-buttons-position="[[tabScrollButtonsPosition]]"\n selected-index="{{selectedIndex}}"\n selection-mode="[[selectionMode]]"\n tab-layout="[[tabLayout]]"\n tab-position="[[tabPosition]]"\n tab-text-orientation="[[tabTextOrientation]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n <content></content>\n </smart-tabs>\n </div>\n <div id="footer" class="smart-footer smart-hidden"></div>\n </div>\n </div>'}static get requires(){return{"Smart.Tabs":"smart.tabs.js"}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(e instanceof Smart.TabItem||t.error(t.localize("tabItemRequired",{method:"removeChild"})),t.$.tabsElement.appendChild(e)):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}insert(e,t){this.$.tabsElement.insert(e,t);const a=this.$.tabsElement._tabs[e];a&&(a.draggable=void 0===t.draggable||t.draggable,a.floatable=void 0===t.floatable||t.floatable)}insertBefore(e,t){this.$.tabsElement.insertBefore(e,t)}removeAt(e){this.$.tabsElement.removeAt(e)}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(e instanceof Smart.TabItem||t.error(t.localize("tabItemRequired",{method:"removeChild"})),(t.shadowRoot||t).contains(e)||t.error(t.localize("referenceNodeNotChild",{argument:"node"})),t.$.tabsElement.removeChild(e)):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}refreshTabHeader(){const e=this;e.$.tabsElement&&e.$.tabsElement.isCompleted&&e.$.tabsElement.refreshTabHeader()}refreshTabs(){const e=this;e.$.tabsElement&&e.$.tabsElement.isCompleted&&e.$.tabsElement._applyTabOverflow()}select(e){this.$.tabsElement.select(e)}update(e,t,a){this.$.tabsElement.update(e,t,a)}get items(){return this.isCompleted&&this.$.tabsElement?this.$.tabsElement._tabs:null}get itemLabels(){return this.$?this.$.tabsElement._tabLabelContainers:null}get siblings(){const e=this;let t=[];if(!e.isCompleted)return t;const a=e.closest("smart-splitter");if(!a||!a.closest("smart-docking-layout"))return t;const i=a._items;if(!i||!i.length)return t;for(let n=0;n<i.length;n++){const o=i[n];o!==e.closest("smart-splitter-item")&&o.querySelector("smart-tabs-window").closest("smart-splitter")===a&&t.push(o.querySelector("smart-tabs-window"))}return t}propertyChangedHandler(e,t,a){const i=this;switch("collapsed"!==e&&super.propertyChangedHandler(e,t,a),e){case"theme":""!==t&&(i.$.closeButton.classList.remove(t),i.$.collapseButton.classList.remove(t),i.$.maximizeButton.classList.remove(t),i.$.pinButton.classList.remove(t)),i._applyTheme(a);break;case"autoHideWindow":i._handleAutoHideWindow();break;case"autoHide":a||(null!==i.$.tabsElement.selectedIndex&&(i.$.tabsElement._tabs[i.$.tabsElement.selectedIndex]._autoHideWindowSize=void 0),i._autoHideWindow&&i._autoHideWindow.close());break;case"dataSource":i.$.tabsElement.dataSource=a;break;case"layout":i._handleLayoutProperty();break;case"collapsible":case"collapsed":case"locked":case"max":case"min":case"size":{const n=i.getRootNode(),o=(n&&n.host?n.host:i).closest("smart-docking-layout"),s=i.closest("smart-splitter-item");if(!o)return void("collapsed"===e&&super.propertyChangedHandler(e,t,a));s&&(s[e]=a);break}}}_applyTheme(e){if(""!==e){const t=this.$.buttonsContainer.children;for(let a=0;a<t.length;a++)t[a].classList.add(e)}}_autoHideWindowCloseHandler(){const e=this;e.allowToggle&&null!==e.$.tabsElement.selectedIndex&&e.$.tabsElement.select(e.$.tabsElement.selectedIndex),e._autoHideWindow&&e._moveContent(e._autoHideWindow.items[0],e._autoHideWindow._tab)}_autoHideWindowOpenHandler(){const e=this;e.$.tabsElement.selectedIndex&&e._handleAutoHide(e.$.tabsElement.selectedIndex)}_createElement(){const e=this;e.setAttribute("role","dialog"),e.$.tabsElement.$.tabHeaderControls&&!e.$.tabsElement.$.tabHeaderControls.innerHTML&&e.$.tabsElement.$tabHeaderControls.addClass("smart-hidden"),e.$.tabsElement.dataSource=e.dataSource,e._applyTheme(e.theme),e._handleAutoHideWindow(),e.autoHide&&e._handleAutoHide(e.$.tabsElement.selectedIndex),e.allowToggle||e.selectedIndex||null===e.$.tabsElement.selectedIndex||(e.selectedIndex=e.$.tabsElement.selectedIndex,e.$.tabsElement.setAttribute("selected-index",e.selectedIndex)),e._handleLayoutProperty();const t=(e.isInShadowDOM?e.getRootNode().host:e||e).closest("smart-docking-layout"),a=e.closest("smart-splitter-item");t&&a&&(a.collapsible=e.collapsible,a.collapsed=e.collapsed,a.min=e.min,a.max=e.max,a.size=e.size,a.locked=e.locked)}attached(){super.attached();const e=this;e.classList.add("smart-window"),e.shadowRoot&&e.$.root.classList.add("smart-window")}_handleLayoutProperty(){const e=this;let t=e.closest("smart-docking-layout");if(Smart.DockingLayout){if(!e.ownerLayout&&e.getRootNode()){let a=e.getRootNode().host;for(;a;){if(!a.closest)return;if(a.closest("smart-docking-layout")){t=a.closest("smart-docking-layout");break}a=a.getRootNode()?a.getRootNode().host:void 0}}t?e.layout=t:e.layout instanceof Smart.DockingLayout||"string"==typeof e.layout&&(e.layout=document.getElementById(e.layout))}}_headerDblCickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;e.ctrlKey||a!==t.$.headerSection&&a!==t.$.header||t.$.maximizeButton&&0===t.$.maximizeButton.offsetHeight||(t.maximized?t.restore():t.maximize())}_documentUpHandler(e){const t=this;let a=e.originalEvent.target.closest?e.originalEvent.target.closest(".smart-window"):e.originalEvent.target,i=a===t||a===t._autoHideWindow||t._isAutoHideWindowClicked,n=t.closest("smart-docking-layout");(t.shadowRoot||t.isInShadowDOM)&&(a=e.originalEvent.composedPath()[0],i=a.getRootNode()===t.shadowRoot||a.closest(".smart-window")===t||a.closest(".smart-window")===t._autoHideWindow||t._isAutoHideWindowClicked),n=((t.isInShadowDOM?t.getRootNode().host:t)||t).closest("smart-docking-layout"),n&&n.disabled?delete t._isWindowContentClicked:(super._documentUpHandler(e),delete t._isAutoHideWindowClicked,t.autoHide&&t._autoHideWindow&&(i&&t._autoHideWindow.opened||(t.selectedIndex=null,t._autoHideWindow.parentElement&&t._autoHideWindow.parentElement.closest(".smart-window")===t&&t._autoHideWindow.close())))}_handleAutoHide(e){const t=this;if(!t.autoHide||null===e)return;if(t._autoHideWindow||t._handleAutoHideWindow(!0),!t._autoHideWindow)return;t._autoHideWindow._tabsWindow&&t._autoHideWindow._tabsWindow!==t&&(t._autoHideWindow._tabsWindow.selectedIndex=null);const a=t.$.tabsElement._tabs[e];t._autoHideWindow._tab!==a&&t._moveContent(t._autoHideWindow.items[0],t._autoHideWindow._tab),t._autoHideWindow.label=a.label,t._autoHideWindow.draggable=a.draggable,t._autoHideWindow.floatable=a.floatable,t._autoHideWindow._tab=a,t._autoHideWindow.headerButtons=t.headerButtons,t._moveContent(t._autoHideWindow._tab,t._autoHideWindow.items[0]),t._autoHideWindow.bringToFront(),t._setAutoHideWindowSize(e),t._autoHideWindow.open(),t._autoHideWindow._tabsWindow=t,t._autoHideWindow.controlledBy&&t._autoHideWindow.controlledBy.removeAttribute("aria-controls"),t._autoHideWindow.controlledBy=t.$.tabsElement._tabLabelContainers[e],t._autoHideWindow.controlledBy.setAttribute("aria-controls",t._autoHideWindow.id)}_moveHandler(e){const t=this,a=t.closest("smart-docking-layout");a&&a.items.indexOf(t)>-1||(Smart.Utilities.Core.isMobile&&navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&t.layout instanceof Smart.DockingLayout&&t.layout.hasAttribute("dragged")&&e.originalEvent.preventDefault(),super._moveHandler(e))}_setAutoHideWindowSize(e){const t=this;if(!t._autoHideWindow)return;t._autoHideWindow.$.addClass("no-transition"),t._autoHideWindow.style.maxWidth=t._autoHideWindow.style.maxHeight="";const a=t.$.tabsElement._tabs[e],i=(t._autoHideWindow.isInShadowDOM?t._autoHideWindow.getRootNode().host:t._autoHideWindow).closest("smart-docking-layout")||t._autoHideWindow.parentElement;let n,o;if(a){if("top"===t.tabPosition||"bottom"===t.tabPosition){t._autoHideWindow.resizeMode="top"===t.tabPosition?"bottom":"top",t._autoHideWindow.style.width=t.$.tabsElement.offsetWidth+"px",n=i.getBoundingClientRect(),o=t.$.tabsElement.getBoundingClientRect();let e=a._autoHideWindowSize&&parseFloat(a._autoHideWindowSize)||"";Smart.DockingLayout&&i instanceof Smart.DockingLayout&&(e&&(e=Math.min(i.$.itemsContainer.offsetHeight,e)+"px"),t._autoHideWindow.style.maxHeight=i.$.itemsContainer.offsetHeight+"px"),t._autoHideWindow.style.height=e,t._autoHideWindow.style.left=o.left-n.left+"px",t._autoHideWindow&&("top"===t.tabPosition?t._autoHideWindow.style.top=o.top+-n.top+o.height+"px":t._autoHideWindow.style.top=o.top-n.top-t._autoHideWindow.offsetHeight+"px")}else{t._autoHideWindow.resizeMode="left"===t.tabPosition?"right":"left",t._autoHideWindow.style.height=t.$.tabsElement.offsetHeight+"px";let e=a._autoHideWindowSize&&parseFloat(a._autoHideWindowSize)||"";i instanceof Smart.DockingLayout&&(e&&(e=Math.min(i.$.itemsContainer.offsetWidth,e)+"px"),t._autoHideWindow.style.maxWidth=i.$.itemsContainer.offsetWidth+"px"),t._autoHideWindow.style.width=e,n=i.getBoundingClientRect(),o=t.$.tabsElement.getBoundingClientRect(),t._autoHideWindow.style.top=o.top-n.top+"px","left"===t.tabPosition?t._autoHideWindow.style.left=o.left-n.left+t.$.tabsElement.offsetWidth+"px":t._autoHideWindow.style.left=o.left-n.left-t._autoHideWindow.offsetWidth+"px"}t._autoHideWindow._dragDetails&&(t._autoHideWindow._dragDetails.maxWidth=void 0),t._autoHideWindow._setDragDetails("resize"),t._autoHideWindow._dragDetails.started=!1,t._autoHideWindow.$.removeClass("no-transition")}}_handleAutoHideWindow(e){const t=this;if(t.autoHideWindow){if(t._autoHideWindow&&t._autoHideWindow.parentElement.removeChild(t._autoHideWindow),"string"==typeof t.autoHideWindow)return void(t._autoHideWindow=document.getElementById(t.autoHideWindow));if(t.autoHideWindow instanceof Smart.Window)return void(t._autoHideWindow=t.autoHideWindow)}if(!e||t._autoHideWindow||2===t.$.contentSection.children.length&&t.$.contentSection.children[1]instanceof Smart.Window)return;const a=document.createElement("smart-window");a.$=Smart.Utilities.Extend(a),a.disableSnap=a.pinned=!0,a.headerButtons=["close"],t.$.contentSection.appendChild(a),t._autoHideWindow=a}_moveContent(e,t){if(!e||!t)return;const a=[].slice.call(e.$.content.childNodes);for(let e=0;e<a.length;e++)t.appendChild(a[e])}_tabsChangeHandler(e){const t=this;if(e.target===t.$.tabsElement&&t.autoHide){if(t._autoHideWindow||t._handleAutoHideWindow(!0),null!==e.detail.oldIndex&&t._autoHideWindow.opened&&(t.$.tabsElement._tabs[e.detail.oldIndex]._autoHideWindowSize=t._autoHideWindow.style["right"===t.$.tabsElement.tabPosition||"left"===t.$.tabsElement.tabPosition?"width":"height"]),!t.autoHide||null===e.detail.index||void 0===e.detail.index)return t._autoHideWindow.setAttribute("active",""),void t._autoHideWindow.close();t._handleAutoHide(e.detail.index)}}_tabsFocusHandler(e){const t=this;"focus"===e.type?(t.bringToFront(),t.setAttribute("focus","")):t.removeAttribute("focus")}}),Smart("smart-wait-window",class extends Smart.ProgressWindow{static get properties(){return{headerButtons:{value:[],type:"array"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},pinned:{value:!0,type:"boolean",readOnly:!0}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-progress-bar id="progressBar" animation="[[animation]]" indeterminate theme="[[theme]]" right-to-left="[[rightToLeft]]"></smart-progress-bar>\n </div>\n <div id="footer" class="smart-footer"></div>\n </div>\n </div>'}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;const i=t.shadowRoot||t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;e.stopPropagation();const n="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(i!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",n),void a();t._drag(n,"vertical");break;case"ArrowLeft":case"ArrowRight":if(i!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",n),void a();t._drag(n,"horizontal");break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}});
|
|
202
|
+
Smart("smart-window",class extends Smart.ContentElement{static get properties(){return{collapsed:{value:!1,type:"boolean"},closeOnMaskClick:{value:!1,type:"boolean"},disableEscape:{value:!1,type:"boolean"},disableSnap:{value:!1,type:"boolean"},footerPosition:{value:"bottom",allowedValues:["bottom","none"],type:"string"},footerTemplate:{value:null,type:"any"},headerButtons:{value:["close","maximize","minimize"],type:"array"},headerPosition:{value:"top",allowedValues:["top","bottom","left","right","none"],type:"string"},headerTemplate:{value:null,type:"any"},disableKeyboard:{value:!1,type:"boolean"},label:{value:"",type:"string"},liveResize:{value:!1,type:"boolean"},maximized:{value:!1,type:"boolean"},modal:{value:!1,type:"boolean"},minimized:{value:!1,type:"boolean"},opened:{value:!1,type:"boolean"},pinned:{value:!1,type:"boolean"},resizeIndicator:{value:!1,type:"boolean"},resizeMode:{allowedValues:["none","horizontal","vertical","both","top","bottom","left","right"],value:"none",type:"string"},windowParent:{value:null,type:"any"}}}static get listeners(){return{"document.dragstart":"_dragStartHandler","document.focusin":"_documentFocusInEventHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.wheel":"_mouseWheelHandler","document.selectstart":"_documentSelectStartHandler",down:"_downHandler",focus:"_focusHandler",blur:"_focusHandler",move:"_moveHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler"}}get hasStyleObserver(){return!1}static get styleUrls(){return["smart.button.css","smart.window.css"]}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header" role="presentation">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container" role="presentation">\n <button id="pinButton" class="smart-button smart-element smart-pin-button" aria-label="Pin"></button>\n <button id="collapseButton" class="smart-button smart-element smart-collapse-button" aria-label="Collapse"></button>\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button"aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content" inner-h-t-m-l="[[innerHTML]]"><content></content></div>\n <div id="footer" class="smart-footer"></div>\n </div>\n </div>'}propertyChangedHandler(e,t,a){const i=this;switch(e){case"collapsed":a?i.collapse(!0):i.expand(!0);break;case"disabled":case"unfocusable":i._setFocusable();break;case"headerTemplate":case"footerTemplate":i._applyLayoutTemplate(i.$[e.split(/[T]/)[0]],a);break;case"headerButtons":i._setHeaderButtons();break;case"headerPosition":{const e=i.minimized;i._preventEventFiring=!0,i.restore(),delete i._preventEventFiring,e&&i.minimize();break}case"label":i.$.header.innerHTML=i.label;break;case"maximized":a?i.maximize(!0):i.restore(e);break;case"modal":i._setModal(),i.setAttribute("aria-modal",a);break;case"minimized":a?i.minimize(!0):i.restore(e);break;case"opened":a?i.open(!0):i.close(!0);break;case"resizeMode":i.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right");break;case"windowParent":i._setElementParent(a);break;default:super.propertyChangedHandler(e,t,a)}}ready(){super.ready(),this._windowParent={initialParent:this.parentElement}}render(){const e=this,t=e.animation;e.$.header.id||(e.$.header.id=e.id+"Header"),e.$.content.id||(e.$.content.id=e.id+"Content"),e.opened||(e.animation="none"),e._windowParent={initialParent:e.parentElement},e.$.addClass("smart-window"),e._createElement(),e._setElementParent(e.windowParent),e._setHeaderButtons(),e.headerTemplate&&e._applyLayoutTemplate(e.$.header,e.headerTemplate),e.footerTemplate&&e._applyLayoutTemplate(e.$.footer,e.footerTemplate),e.opened?e.open():e.close(),e.maximized&&e.maximize(!0),e.minimized&&e.minimize(!0),e.collapsed&&e.collapse(!0),e.pinned?e.pin():e.unpin(),e._setFocusable(),e.animation=t,e.setAttribute("aria-modal",e.modal),e.setAttribute("aria-labelledby",e.$.header.id),e._setupDismissTargets(),super.render()}refresh(){const e=this;e.headerTemplate&&e._applyLayoutTemplate(e.$.header,e.headerTemplate),e.footerTemplate&&e._applyLayoutTemplate(e.$.footer,e.footerTemplate),e.opened?e.open():e.close(),e.maximized&&e.maximize(!0),e.minimized&&e.minimize(!0),e.collapsed&&e.collapse(!0),e.pinned?e.pin():e.unpin()}static get requires(){return{"Smart.Button":"smart.button.js"}}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)e.removeAttribute("tabindex");else{let t=e.tabIndex>0?e.tabIndex:0;e.setAttribute("tabindex",t)}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?t.$.content.appendChild(e):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}updateLabel(e){this.label=e}updateContent(e){this.content=e}move(e,t){const a=this,i=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;void 0!==e&&(a.style.left=i(e)),void 0!==t&&(a.style.top=i(t))}collapse(e){const t=this;!e&&t.collapsed||(t.collapsed=!0,t.$.fireEvent("collapse"),"left"===t.headerPosition||"right"===t.headerPosition?t.style.width="":t.style.height="")}close(e){const t=this;if(e||!t.$.hasClass("smart-visibility-hidden")){if(t.isCompleted){if(t.$.fireEvent("closing").defaultPrevented)return;t.$.addClass("smart-visibility-hidden"),t.opened=!1,t.isRendered&&t.$.fireEvent("close")}else t.$.addClass("smart-visibility-hidden"),t.opened=!1;t._setModal(),t.removeAttribute("ontop")}}attached(){super.attached();const e=this;e.isRendered,e._windowParent.parent&&e._windowParent.parent!==e.getShadowRootOrBody()&&e._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&"static"===window.getComputedStyle(e._windowParent.parent).getPropertyValue("position")&&(e._windowParent.parent.style.position="relative"),e.opened&&e._modal&&e.parentElement.insertBefore(e._modal,e)}bringToFront(){const e=this;if(!e.parentElement)return;const t=e.parentElement.closest(".smart-window");if(t)return void t.bringToFront();const a=document.body.getElementsByClassName("smart-window");let i=[];for(let e=0;e<a.length;e++){const t=a[e];t.removeAttribute("ontop"),t.opened&&i.push(t)}1===i.length&&i[0]===e||e.setAttribute("ontop","")}clear(){const e=this;e.isCompleted&&"Smart-WINDOW"===e.nodeName&&(e.innerHTML=e.$.content.innerHTML="")}detached(){super.detached();const e=this;e._windowParent.parent&&!e._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&(e._windowParent.parent.style.position=""),e._modal&&e._modal.parentElement&&e._modal.parentElement.removeChild(e._modal),e._resizeDummy&&e._resizeDummy.parentElement&&e._handleWindowResizeDummy(),e._refreshMinimizedWindowsPosition()}expand(e){const t=this;(e||t.collapsed)&&(t.collapsed=!1,t.$.fireEvent("expand"),t.maximized?"left"===t.headerPosition||"right"===t.headerPosition?t.style.width=Math.max(t._windowParent.scrollElement.scrollWidth,t._windowParent.element.clientWidth)-t._windowParent.borderWidth+"px":t.style.height=Math.max(t._windowParent.scrollElement.scrollHeight,t._windowParent.element.clientHeight)-t._windowParent.borderWidth+"px":"left"===t.headerPosition||"right"===t.headerPosition?t.style.width=t.className.indexOf("smart-window-snapped-")<0&&t._dragDetails?t._dragDetails.width+"px":"":t.style.height=t.className.indexOf("smart-window-snapped-")<0&&t._dragDetails?t._dragDetails.height+"px":"")}maximize(e){const t=this;if(!e&&t.maximized)return;t.minimized&&t._restoreFromMinimization(e),t._setDragDetails("minimize"),"none"!==t.resizeMode&&t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right"),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&t.classList.remove("smart-window-snapped-"+t._snapDummy._position),t.maximized=!0,t.$.fireEvent("maximize"),t.style.left=t.style.top=0,t.style.maxWidth=t.style.maxHeight="none";const a=t._windowParent.scrollElement.scrollHeight,i=t._windowParent.scrollElement.scrollWidth,n=t._windowParent.element.clientHeight,o=t._windowParent.element.clientWidth,s=Math.max(a,n),r=Math.max(i,o);"top"===t.headerPosition||"bottom"===t.headerPosition?(t.style.width=i>o?r-t._windowParent.borderWidth+"px":"100%",t.collapsed||(t.style.height=a>n?s-t._windowParent.borderWidth+"px":"100%")):(t.collapsed||(t.style.width=i>o?r-t._windowParent.borderWidth+"px":"100%"),t.style.height=a>n?s-t._windowParent.borderWidth+"px":"100%"),"100%"!==t.style.height&&t.addEventListener("transitionend",(function e(){if(!t.maximized||!t.hasAnimation)return;const a=t._windowParent.scrollElement.scrollHeight,i=t._windowParent.element.clientHeight,n=Math.max(a,i);("top"===t.headerPosition||"bottom"===t.headerPosition)&&t.collapsed||(t.style.height=a>i?n-t._windowParent.borderWidth+"px":"100%"),t.removeEventListener("transitionend",e)}))}minimize(e){const t=this;if(!e&&t.minimized)return;t.maximized&&(t._preventEventFiring=!0,t.restore(),delete t._preventEventFiring),t._setDragDetails(),t.minimized=!0,t.$.fireEvent("minimize"),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&(t.$.removeClass("smart-window-snapped-"+t._snapDummy._position),t.style.right=t.style.top=t.style.left="");const a=t._getAllMinimizedWindows(t._windowParent.element);if(a.length>0){const e=a[a.length-1];t.style.left=(e.offsetLeft+e.offsetWidth+t._dragDetails.minWidth+10>t._windowParent.element.clientWidth?e.offsetLeft:e.offsetLeft+e.offsetWidth+5)+"px",t.style.top=e.offsetTop+"px"}else t.style.left="5px",t.style.top=t._windowParent.element.clientHeight+t._windowParent.scrollElement.scrollTop-t.$.headerSection.offsetHeight-5+"px";t.style.width="",t.style.height=t.$.headerSection.offsetHeight+"px"}_createElement(){this.setAttribute("role","dialog")}removeChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?t.$.content.removeChild(e):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}restore(e){const t=this;if("maximized"===e||t.maximized?(t.maximized=!1,t.style.width=t.style.height=t.style.top=t.style.left=""):("minimized"===e||t.minimized)&&t._restoreFromMinimization(e),t._preventEventFiring||t.$.fireEvent("restore"),t.style.maxWidth=t.style.maxHeight="",t._dragDetails){if(t.style.left=Math.max(0,Math.min(t._dragDetails.windowX,t._windowParent.element.clientWidth-t._dragDetails.width))+"px",t.style.top=Math.max(0,Math.min(t._dragDetails.windowY,t._windowParent.scrollElement.scrollHeight-t._dragDetails.height))+"px",t.collapsed)return void("top"===t.headerPosition||"bottom"===t.headerPosition?t.style.width=t._dragDetails.width+"px":t.style.height=t._dragDetails.height+"px");t._dragDetails.resized&&(t.style.width=t._dragDetails.width+"px",t.style.height=t._dragDetails.height+"px")}}toggle(){const e=this;e.opened?e.close():e.open()}openModal(){this.modal=!0,this.open()}open(e){const t=this;if(e||t.$.hasClass("smart-visibility-hidden")){if(t.isCompleted){if(t.$.fireEvent("opening").defaultPrevented)return;t.$.removeClass("smart-visibility-hidden"),t.opened=!0,t.$.fireEvent("open")}else t.$.removeClass("smart-visibility-hidden"),t.opened=!0;t.bringToFront(),t._setModal(),t._handleActiveState(),t.hasAnimation?t.addEventListener("transitionend",a):a()}function a(e){if(!t.hasAnimation||e&&e.target===t){if(t.removeEventListener("transitionend",a),t._onOpenCallback)return void t._onOpenCallback();t.focus()}}}_setupDismissTargets(){const e=this;if(e.querySelector('[data-dismiss="modal"]')){const t=e.querySelectorAll('[data-dismiss="modal"]'),a=()=>{e.close()};for(let e=0;e<t.length;e++)t[e].removeEventListener("click",a,null),t[e].addEventListener("click",a)}}pin(){this.pinned=!0}unpin(){this.pinned=!1}_applyLayoutTemplate(e,t){const a=this;if(!t)return e.innerHTML="",void(e===a.$.header&&a.label&&(e.innerHTML=a.label));"content"in document.createElement("template")?(t instanceof HTMLTemplateElement||(t=document.getElementById(t)),null!==t&&"content"in t?(e.innerHTML="",e.appendChild(document.importNode(t.content,!0))):a.error(a.localize("invalidTemplate",{elementType:a.nodeName.toLowerCase(),property:e===a.$.footer?"footerTemplate":"headerTemplate"}))):a.error(a.localize("htmlTemplateNotSuported",{elementType:a.nodeName.toLowerCase()}))}_cancelDragging(e){const t=this;if(t._dragDetails&&t._dragDetails.started&&"drag"===t._dragDetails.type){if(!e){const a=t.getBoundingClientRect();e={pageX:a.left,pageY:a.top}}t.$.fireEvent("dragEnd",{left:e.pageX,top:e.pageY}),t.removeAttribute("dragged"),t._dragDetails.started=!1,delete t._mouseManipulation}}_documentFocusInEventHandler(e){const t=this;t._changingFocus&&(t.contains(e.target)||t.contains(e.composedPath()[0])||t.focus(),delete t._changingFocus)}_downHandler(e){const t=this;let a=Smart.Utilities.Core.isMobile?document.elementFromPoint(e.pageX-window.pageXOffset,e.pageY-window.pageYOffset):e.originalEvent.target;if((t.shadowRoot||t.isInShadowDOM)&&(a=e.originalEvent.composedPath()[0]),e.stopPropagation(),t.disabled||!Smart.Utilities.Core.isMobile&&1!==e.which)return;if(t._tabsWindow&&(t._tabsWindow._isAutoHideWindowClicked=!0),t.hasAttribute("ontop")||t.bringToFront(),a.closest&&a.closest(".smart-buttons-container")===t.$.buttonsContainer){if(t._buttonPressed=a.closest(".smart-button"),t._buttonPressed)return}else if(a.getRootNode()&&a.getRootNode().host&&(t._buttonPressed=a.getRootNode().host,t._buttonPressed.closest(".smart-buttons-container")===t.$.buttonsContainer))return;t._isWindowContentClicked=a.closest(".smart-content");let i=t.closest("smart-docking-layout");if(t.isInShadowDOM&&!i){let e=t.getRootNode().host;for(;e&&(i=e.closest("smart-docking-layout"),!i)&&e.getRootNode();)e=e.getRootNode().host}if(!(t instanceof Smart.TabsWindow&&i&&i.disabled)){if(t._handleActiveState(),!(t instanceof Smart.TabsWindow&&i))return a.closest(".smart-header-section")===t.$.headerSection&&(void 0===t._dblClickDetails&&(t._dblClickDetails={clicks:0}),clearTimeout(t._dblClickDetails.timeOut),t._dblClickDetails.clicks++,t._dblClickDetails.timeOut=setTimeout((function(){t._dblClickDetails&&(t._dblClickDetails.clicks=0)}),300),2===t._dblClickDetails.clicks)?(t._headerDblCickHandler(e),void(t._dblClickDetails.clicks=0)):void(t.maximized||(Smart.Utilities.Core.isMobile&&t._moveHandler(e),!t.pinned&&!t.minimized&&t.$.container.className.indexOf("smart-window-resizing")<0&&(a=a.closest(".smart-header-section"),a&&a===t.$.headerSection&&(t._mouseManipulation=!0,t._setDragDetails("drag",e))),"none"!==t.resizeMode&&t.$.container.className.indexOf("smart-window-resizing")>-1&&(t._mouseManipulation=!0,t._setDragDetails("resize",e))));t.$.hasClass("smart-docking-layout-auto-hide-window")&&(Smart.Utilities.Core.isMobile&&t._moveHandler(e),"none"!==t.resizeMode&&t.$.container.className.indexOf("smart-window-resizing")>-1&&(t._mouseManipulation=!0,t._setDragDetails("resize",e)))}}_documentMoveHandler(e){const t=this;!t._dragDetails||!t._dragDetails.started||t.minimized||!t._mouseManipulation||Math.abs(e.pageX-t._dragDetails.x)<=5&&Math.abs(e.pageY-t._dragDetails.y)<=5||(t.hasAttribute("dragged")||t.hasAttribute("resized")||t.$.fireEvent(t._dragDetails.type+"Start",{left:e.pageX,top:e.pageY,width:t.offsetWidth,height:t.offsetHeight}),e.stopPropagation(),"drag"!==t._dragDetails.type||t.pinned?(t._dragDetails.resized=!0,t._resize(t._dragDetails.side,e),t._dragDetails.x=Math.max(t._windowParent.offsetLeft+t._dragDetails.left,Math.min(t._windowParent.offsetLeft+t._dragDetails.left+(t._dragDetails.side.toLowerCase().indexOf("left")>-1?0:t._dragDetails.newWidth),e.pageX)),t._dragDetails.y=Math.max(t._windowParent.offsetTop+t._dragDetails.top,Math.min(t._windowParent.offsetTop+t._dragDetails.top+(t._dragDetails.side.toLowerCase().indexOf("top")>-1?0:t._dragDetails.newHeight),e.pageY))):(t.setAttribute("dragged",""),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&(t.$.removeClass("smart-window-snapped-"+t._snapDummy._position),t.style.right=t.style.top=t.style.left="",t.collapsed||(t.style.height=t._dragDetails.height+"px",t.style.width=t._dragDetails.width+"px")),t._drag(e,"both"),t._dragDetails.x=Math.max(t._windowParent.offsetLeft+t._dragDetails.offsetX-t._windowParent.scrollElement.scrollLeft,Math.min(t._windowParent.offsetLeft+t._windowParent.element.offsetWidth-(t._windowParent.element.offsetWidth-t.offsetLeft)+t._dragDetails.offsetX,e.pageX)),t._dragDetails.y=Math.max(t._windowParent.offsetTop+t._dragDetails.offsetY-t._windowParent.scrollElement.scrollTop,Math.min(t._windowParent.offsetTop+t._windowParent.element.offsetHeight-(t._windowParent.element.offsetHeight-t.offsetTop)+t._dragDetails.offsetY,e.pageY)),e.pageX>=t._windowParent.offsetLeft+t._windowParent.scrollElement.scrollWidth-1?t._handleSnapping("right"):e.pageY<=t._windowParent.offsetTop?t._handleSnapping("top"):e.pageX<=t._windowParent.offsetLeft?t._handleSnapping("left"):t._handleSnapping()))}_documentUpHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(t.disabled)return t.removeAttribute("active"),delete t._buttonPressed,void delete t._isWindowContentClicked;if(t._dragDetails&&t._dragDetails.started&&(t.hasAttribute("resized")&&(t.$.fireEvent(t._dragDetails.type+"End",{left:e.pageX,top:e.pageY,width:t._dragDetails.newWidth,height:t._dragDetails.newHeight}),t.removeAttribute("resized"),t._handleWindowResizeDummy(),t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right")),setTimeout((function(){t.$.removeClass("no-transition")}),20),t.hasAttribute("dragged")&&(t.$.fireEvent(t._dragDetails.type+"End",{left:e.pageX,top:e.pageY}),t.removeAttribute("dragged")),t._dragDetails.started=!1,delete t._mouseManipulation),t._snapDummy&&!t._snapDummy.classList.contains("smart-visibility-hidden")){switch(t._snapDummy._position){case"left":case"top":t.style.left=t.style.top="0",t.style.right="auto";break;case"right":t.style.left="auto",t.style.top=t.style.right="0"}t.style.width="top"===t._snapDummy._position?"100%":"50%",t.style.height="100%",t.$.addClass("smart-window-snapped-"+t._snapDummy._position),t._handleSnapping()}t._modal&&a===t._modal&&!t._isWindowContentClicked&&(t.closeOnMaskClick?t.close():t.focus()),t._isWindowButton(a)&&t.focus(),delete t._isWindowContentClicked,delete t._buttonPressed;const i=t.shadowRoot&&t._windowParent.element&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;if(!t.hasAttribute("active")||i===t)return;if(!a.closest)return;let n=a.closest(".smart-window");for(;n&&n!==t;)n=n.parentElement,n&&(n=n.closest(".smart-window"));t.opened&&n!==t&&t.removeAttribute("active")}_documentSelectStartHandler(e){this._dragDetails&&this._dragDetails.started&&e.preventDefault()}_drag(e,t){const a=this;if(!e||a.pinned||a.maximized)return;let i,n;a._dragDetails&&a._dragDetails.started||a._setDragDetails("drag",e),a.$.addClass("no-transition"),"object"==typeof e?(i=e.pageX-a._dragDetails.x,n=e.pageY-a._dragDetails.y):i=n=e;const o=Math.max(a._windowParent.element.clientHeight,a._windowParent.scrollElement.scrollHeight),s=Math.max(a._windowParent.element.clientWidth,a._windowParent.scrollElement.scrollWidth);switch(t){case"horizontal":a._dragDetails.windowX=Math.max(0,Math.min(a._dragDetails.windowX+i,s-a.offsetWidth)),a.style.left=a._dragDetails.windowX+"px";break;case"vertical":a._dragDetails.windowY=Math.max(0,Math.min(a._dragDetails.windowY+n,o-a.offsetHeight)),a.style.top=a._dragDetails.windowY+"px";break;case"both":a._dragDetails.windowX=Math.max(0,Math.min(a._dragDetails.windowX+i,s-a.offsetWidth)),a._dragDetails.windowY=Math.max(0,Math.min(a._dragDetails.windowY+n,o-a.offsetHeight)),a.style.left=a._dragDetails.windowX+"px",a.style.top=a._dragDetails.windowY+"px"}a._dragDetails.top=a.offsetTop,a._dragDetails.left=a.offsetLeft}_dragStartHandler(e){this._dragDetails&&this._dragDetails.started&&e.preventDefault()}_focusHandler(e){const t=this;"focus"===e.type?(t.setAttribute("focus",""),t.bringToFront()):t._buttonPressed||(t.removeAttribute("focus"),t._dragDetails&&t._dragDetails.started&&t._handleWindowResizeDummy())}_getAllMinimizedWindows(e){const t=this;let a=[];e||(e=t._windowParent.element);const i=e.querySelectorAll("smart-window");for(let e=0;e<i.length;e++)i[e]!==t&&i[e].hasAttribute("minimized")&&a.push(i[e]);return a.sort((function(e,t){let a=e.getBoundingClientRect(),i=t.getBoundingClientRect();return a.right-i.right})),a}_handleSnapping(e){const t=this;e?t.disableSnap||t.collapsed||(t._snapDummy||(t._snapDummy=document.createElement("div"),t._snapDummy.addEventListener("transitionend",(function(){t._snapDummy.classList.contains("smart-visibility-hidden")&&t._snapDummy.parentElement&&t._snapDummy.parentElement.removeChild(t._snapDummy)}))),t._snapDummy.className="smart-window-snap-"+e+"-feedback",t._snapDummy._position=e,t._snapDummy.parentElement||t._windowParent.element.appendChild(t._snapDummy)):t._snapDummy&&t._snapDummy.parentElement&&t._snapDummy.classList.add("smart-visibility-hidden")}_headerDblCickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;a!==t.$.headerSection&&a!==t.$.header||t.$.maximizeButton&&0===t.$.maximizeButton.offsetHeight||(t.maximized?t.restore():t.maximize())}_isWindowButton(e){const t=this;for(;e&&(e.closest&&e.closest(".smart-buttons-container"))!==t.$.buttonsContainer;)e=e.getRootNode().host;if(!e)return;const a=/smart-(\w+[-]*\w*)-button/gi;if((e=e.closest(".smart-button"))&&e===t._buttonPressed)switch(e){case t.$.closeButton:return t.close(),!0;case t.$.collapseButton:return t.collapsed?t.expand():t.collapse(),!0;case t.$.maximizeButton:return t.maximized?t.restore():t.maximize(),!0;case t.$.minimizeButton:return t.minimized?t.restore():t.minimize(),!0;case t.$.pinButton:return t.pinned?t.unpin():t.pin(),!0;default:if(!a.test(e.className))return;return t.$.fireEvent(Smart.Utilities.Core.toCamelCase(e.className.match(a).toString().replace("smart-","").replace("-button","")),{button:e}),!0}}_keyDownHandler(e){const t=this;if(delete t._changingFocus,t.disabled||(t.hasAttribute("dragged")||t.hasAttribute("resized"))&&t._mouseManipulation)return;const a="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,i=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;if(!t.disableKeyboard)switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":{if(t.minimized||i!==t)return;let n=e.key.indexOf("Right")>-1||e.key.indexOf("Left")>-1;e.preventDefault();const o=(t.isInShadowDOM?t.getRootNode().host:t).closest("smart-docking-layout");if(!n&&e.altKey&&!(t instanceof Smart.TabsWindow&&o))return void("ArrowUp"===e.key?t.maximize():t.restore());if(t.maximized)return;if(t.$.addClass("no-transition"),e.ctrlKey&&"none"!==t.resizeMode&&!t.collapsed)return n=-1===["horizontal","vertical","both"].indexOf(t.resizeMode)?t.resizeMode:n?"right":"bottom",t.hasAttribute("dragged")&&t._cancelDragging(e),t.hasAttribute("resized")||t.$.fireEvent("resizeStart",{position:{x:e.pageX,y:e.pageY}}),void t._resize(n,a);t.pinned||(t.hasAttribute("dragged")||(t.setAttribute("dragged",""),t.$.fireEvent("dragStart",{left:e.pageX,top:e.pageY})),t._drag(a,n?"horizontal":"vertical")),t.$.removeClass("no-transition");break}case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"p":e.altKey&&t.headerButtons.indexOf("pin")>-1&&(t.pinned?t.unpin():t.pin());break;case"c":e.altKey&&t.headerButtons.indexOf("collapse")>-1&&(t.collapsed?t.expand():t.collapse());break;case"m":e.altKey&&t.headerButtons.indexOf("minimize")>-1&&(t.minimized?t.restore():t.minimize());break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}}_keyUpHandler(e){const t=this;if(e.key&&!t.disableKeyboard){if("Control"===e.key&&t._dragDetails&&t.hasAttribute("resized")&&!t._mouseManipulation){if(!t._dragDetails.started)return;"drag"!==t._dragDetails.type&&(t.removeAttribute("resized"),t.$.fireEvent("resizeEnd",{left:e.pageX,top:e.pageY,width:t._dragDetails.newWidth,height:t._dragDetails.newHeight}),t._handleWindowResizeDummy()),t._dragDetails.started=!1}e.key.indexOf("Arrow")>-1&&t.hasAttribute("dragged")&&!t._mouseManipulation&&t._cancelDragging(e)}}_mouseWheelHandler(e){const t=this;!t.disabled&&t._dragDetails&&t._dragDetails.started&&(e.deltaY<0&&t._windowParent.scrollElement.scrollTop+e.deltaY<=0?t.style.top=Math.max(0,t._dragDetails.windowY)+"px":e.deltaY>0&&(t._dragDetails.windowY+t.offsetHeight+e.deltaY>=t._windowParent.scrollElement.scrollHeight||t._windowParent.scrollElement.scrollTop+t._windowParent.element.clientHeight===t._windowParent.scrollElement.scrollHeight)||("drag"===t._dragDetails.type?(t._dragDetails.windowY+=e.deltaY,t.style.top=t._dragDetails.windowY+"px"):(t._dragDetails.height+=e.deltaY,t.style.height=t._dragDetails.height+"px")))}_moveHandler(e){const t=this;if(!(t.disabled||t.collapsed||t.maximized||t.minimized||(Smart.Utilities.Core.isMobile&&navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&t.hasAttribute("dragged")&&e.originalEvent.preventDefault(),t._mouseManipulation||(t.$.container.className.indexOf("smart-window-resizing")>-1&&t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right"),"none"===t.resizeMode)))){const a=t.getBoundingClientRect(),i=e.clientY<a.top+10,n=e.clientY>a.bottom-10,o=e.clientX>a.right-10,s=e.clientX<a.left+10;switch(t.resizeMode){case"none":break;case"both":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-bottom-right"));if(s||o)return i?void t.$.container.classList.add("smart-window-resizing-top-"+(s?"left":"right")):n?void t.$.container.classList.add("smart-window-resizing-bottom-"+(s?"left":"right")):void t.$.container.classList.add("smart-window-resizing-"+(s?"left":"right"));if(i||n){if(o)return void t.$.container.classList.add("smart-window-resizing-"+(i?"top-right":"bottom-right"));if(s)return void t.$.container.classList.add("smart-window-resizing-"+(i?"top-left":"bottom-left"));t.$.container.classList.add("smart-window-resizing-"+(i?"top":"bottom"))}break;case"horizontal":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-right"));if(s)return void t.$.container.classList.add("smart-window-resizing-left");o&&t.$.container.classList.add("smart-window-resizing-right");break;case"vertical":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-bottom"));if(i)return void t.$.container.classList.add("smart-window-resizing-top");n&&t.$.container.classList.add("smart-window-resizing-bottom");break;case"top":if(i){if(t.resizeIndicator&&!s)return;t.$.container.classList.add("smart-window-resizing-top")}break;case"bottom":if(n){if(t.resizeIndicator&&!o)return;t.$.container.classList.add("smart-window-resizing-bottom")}break;case"left":if(s){if(t.resizeIndicator&&!i)return;t.$.container.classList.add("smart-window-resizing-left")}break;case"right":if(o){if(t.resizeIndicator&&!n)return;t.$.container.classList.add("smart-window-resizing-right")}}}}_handleActiveState(){const e=this,t=document.querySelectorAll(".smart-window");for(let a=0;a<t.length;a++)t[a].contains(e)||e.contains(t[a])||(t[a].removeAttribute("active"),t[a].removeAttribute("focus"));e.setAttribute("active","")}_handleWindowResizeDummy(){const e=this;if(e._resizeDummy||(e._resizeDummy=document.createElement("div"),e._resizeDummy.classList.add("smart-window-resize-feedback")),!e.hasAttribute("resized"))return e._resizeDummy&&e._resizeDummy.remove(),void(!e.liveResize&&"resize"===e._dragDetails.type&&e._dragDetails.started&&(e.style.top=e._dragDetails.top+"px",e.style.left=e._dragDetails.left+"px",e.style.width=e._dragDetails.newWidth+"px",e.style.height=e._dragDetails.newHeight+"px"));e._resizeDummy.parentElement||e._resizeDummy.getRootNode().host||(e._resizeDummy.style.width=e.offsetWidth+"px",e._resizeDummy.style.height=e.offsetHeight+"px",e._resizeDummy.style.top=e.offsetTop+"px",e._resizeDummy.style.left=e.offsetLeft+"px",e._windowParent.element.appendChild(e._resizeDummy))}_resize(e,t){const a=this;let i;if((!a._dragDetails||a._dragDetails&&"drag"===a._dragDetails.type)&&a._setDragDetails("resize"),!a._dragDetails)return;a._dragDetails.started=!0,a.hasAttribute("resized")||(a.setAttribute("resized",""),a.hasAnimation&&a.$.addClass("no-transition")),a.liveResize||a._handleWindowResizeDummy();const n=a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)?"snapWindowWidth":"width";switch(e){case"left":i="object"==typeof t?t.pageX-a._dragDetails.x:t,i=i>0?Math.min(i,a._dragDetails[n]-a._dragDetails.minWidth):-1*Math.min(a._dragDetails.maxWidth?a._dragDetails.maxWidth-a._dragDetails[n]:a._dragDetails.left,Math.abs(i)),a._dragDetails[n]=Math.min(a._dragDetails[n]+a._dragDetails.left-a._windowParent.scrollElement.scrollLeft,a._dragDetails[n]-i),a._dragDetails.windowX=Math.max(a._windowParent.scrollElement.scrollLeft,a._dragDetails.windowX+i),"object"!=typeof t&&(a._dragDetails[n]=Math.max(a._dragDetails[n],a._dragDetails.minWidth)),a._dragDetails[n]>=a._dragDetails.minWidth&&(a._dragDetails.left=a._dragDetails.windowX,a._dragDetails.newWidth=a._dragDetails[n]);break;case"right":{const e=a._windowParent.element.clientWidth!==a._windowParent.element.offsetWidth?a._windowParent.borderWidth:0,n=a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)?"snapWindowWidth":"width";i="object"==typeof t?t.pageX-a._dragDetails.x:t,i>0&&a._dragDetails.maxWidth&&(i=Math.min(a._dragDetails.maxWidth-a._dragDetails[n],i)),a._dragDetails[n]=Math.min(a._windowParent.element.clientWidth+a._windowParent.scrollElement.scrollLeft-a._dragDetails.left-e,Math.max(0,a._dragDetails[n]+i)),"object"!=typeof t&&(a._dragDetails[n]=Math.max(a._dragDetails[n],a._dragDetails.minWidth)),a._dragDetails.left=a.offsetLeft,a._dragDetails.newWidth=Math.max(a._dragDetails.minWidth,a._dragDetails[n]);break}case"top":a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)&&(a._dragDetails.height=a._dragDetails.snapWindowHeight),i="object"==typeof t?t.pageY-a._dragDetails.y:t,i=i>0?Math.min(i,a._dragDetails.height-a._dragDetails.minHeight):-1*Math.min(a._dragDetails.maxHeight?a._dragDetails.maxHeight-a._dragDetails.height:a._dragDetails.top,Math.abs(i)),a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.min(a._dragDetails.height+a._dragDetails.top-a._windowParent.scrollElement.scrollTop,a._dragDetails.height-i),a._dragDetails.windowY=Math.max(a._windowParent.scrollElement.scrollTop,a._dragDetails.windowY+i),"object"!=typeof t&&(a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.max(a._dragDetails.height,a._dragDetails.minHeight)),a._dragDetails.height>=a._dragDetails.minHeight&&(a._dragDetails.top=a._dragDetails.windowY,a._dragDetails.newHeight=a._dragDetails.height),a._dragDetails.newWidth=Math.max(a._dragDetails[n],a._dragDetails.newWidth);break;case"bottom":a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)&&(a._dragDetails.height=a._dragDetails.snapWindowHeight),i="object"==typeof t?t.pageY-a._dragDetails.y:t,i>0&&a._dragDetails.maxHeight&&(i=Math.min(a._dragDetails.maxHeight-a._dragDetails.height,i)),a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.min(a._windowParent.element.clientHeight+a._windowParent.scrollElement.scrollTop-a._dragDetails.top-a._windowParent.borderWidth,Math.max(0,a._dragDetails.height+i)),"object"!=typeof t&&(a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.max(a._dragDetails.height,a._dragDetails.minHeight)),a._dragDetails.newHeight=Math.max(a._dragDetails.minHeight,a._dragDetails.height),a._dragDetails.newWidth=Math.max(a._dragDetails[n],a._dragDetails.newWidth);break;case"bottomLeftCorner":a._resize("bottom",t),a._resize("left",t);break;case"bottomRightCorner":a._resize("bottom",t),a._resize("right",t);break;case"topLeftCorner":a._resize("top",t),a._resize("left",t);break;case"topRightCorner":a._resize("top",t),a._resize("right",t)}const o=a.liveResize?a:a._resizeDummy;a._dragDetails.newHeight=Math.max(a._dragDetails.snapWindowHeight,a._dragDetails.newHeight),o.style.top=a._dragDetails.top+"px",o.style.left=a._dragDetails.left+"px",o.style.width=a._dragDetails.newWidth+"px",o.style.height=a._dragDetails.newHeight+"px"}_restoreFromMinimization(){const e=this;e.minimized=!1,e.style.width=e.style.height=e.style.top=e.style.left="",e._refreshMinimizedWindowsPosition()}_refreshMinimizedWindowsPosition(){const e=this,t=e._getAllMinimizedWindows();if(0===t.length)return;let a;t[0].style.left="5px";for(let i=1;i<t.length;i++)parseFloat(t[i-1].style.left)+t[i-1].offsetWidth+t[i].offsetWidth+10<e._windowParent.element.clientWidth?(t[i].style.left=parseFloat(t[i-1].style.left)+t[i-1].offsetWidth+5+"px",t[i].style.top=t[i-1].offsetTop+"px",a=t[i]):(t[i].style.left=parseFloat(a.style.left)+"px",t[i].style.top=a.offsetTop+"px")}_setHeaderButtons(){const e=this,t=e.headerButtons,a=e.$.buttonsContainer.children,i=function(t){const a=e.$.buttonsContainer.getElementsByClassName("smart-"+(t+"").split(/(?=[A-Z])/).join("-").toLowerCase()+"-button")[0];return a&&a.classList.remove("smart-hidden"),a};for(let e=0;e<a.length;e++)a[e].classList.add("smart-hidden");if(t.length>0)for(let a=0;a<t.length;a++){let n=i(t[a]);if(!n){const e=(t[a]+"").split(/(?=[A-Z])/);n=document.createElement("button"),n.setAttribute("aria-label",e.map((e=>e.slice(0,1).toUpperCase()+e.slice(1))).join(" ")),n.classList.add("smart-"+e.join("-").toLowerCase()+"-button","smart-button","smart-element")}e.$.buttonsContainer.insertBefore(n,e.$.buttonsContainer.firstElementChild)}}_setDragDetails(e,t){const a=this;if(a._dragDetails||(a._dragDetails={}),void 0===a._dragDetails.minWidth||void 0===a._dragDetails.minHeight||void 0===a._dragDetails.maxWidth||void 0===a._dragDetails.maxHeight){const e=getComputedStyle(a);a._dragDetails.minWidth=parseFloat(e.getPropertyValue("min-width"))||0,a._dragDetails.minHeight=parseFloat(e.getPropertyValue("min-height"))||0,a._dragDetails.maxWidth=parseFloat(e.getPropertyValue("max-width"))||0,a._dragDetails.maxHeight=parseFloat(e.getPropertyValue("max-height"))||0}a._dragDetails.windowX=a.offsetLeft,a._dragDetails.windowY=a.offsetTop;const i=a.getBoundingClientRect();if(a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position))"right"===a.headerPosition&&a.collapsed&&(a._dragDetails.offsetX=i.left+a.offsetWidth-t.clientX);else{const n=a.parentElement===document.body?document.documentElement.getBoundingClientRect():a.parentElement?a.parentElement.getBoundingClientRect():document.documentElement.getBoundingClientRect(),o=window.scrollX||window.pageXOffset,s=window.scrollY||window.pageYOffset;a._windowParent.offsetLeft=n.left+o,a._windowParent.offsetTop=n.top+s,t&&"object"==typeof t&&(a._dragDetails.offsetX=t.clientX-i.left,a._dragDetails.offsetY=t.clientY-i.top),a.collapsed||(a.hasAnimation&&"minimize"===e?(a._dragDetails.width=a._dragDetails.width?a._dragDetails.width:a.offsetWidth,a._dragDetails.height=a._dragDetails.height?a._dragDetails.height:a.offsetHeight):(a._dragDetails.width=a.offsetWidth,a._dragDetails.height=a.offsetHeight),(a.style.width||a.style.height)&&(a._dragDetails.resized=!0))}if("minimize"!==e&&e&&(a._dragDetails.type=e,a._dragDetails.started=!0,a._dragDetails.snapWindowWidth=a.offsetWidth,a._dragDetails.snapWindowHeight=a.offsetHeight,t&&"object"==typeof t?(a._dragDetails.x=t.pageX,a._dragDetails.y=t.pageY):(a._dragDetails.x=a.offsetLeft,a._dragDetails.y=a.offsetTop),"resize"===e)){if("none"===a.resizeMode)return void delete a._dragDetails;a._dragDetails.top=a.offsetTop,a._dragDetails.left=a.offsetLeft,a._dragDetails.newWidth=a._dragDetails.width,a._dragDetails.newHeight=a._dragDetails.height,a.$container.hasClass("smart-window-resizing-right")?a._dragDetails.side="right":a.$container.hasClass("smart-window-resizing-left")?a._dragDetails.side="left":a.$container.hasClass("smart-window-resizing-top")?a._dragDetails.side="top":a.$container.hasClass("smart-window-resizing-bottom")?a._dragDetails.side="bottom":a.$container.hasClass("smart-window-resizing-top-left")?a._dragDetails.side="topLeftCorner":a.$container.hasClass("smart-window-resizing-bottom-left")?a._dragDetails.side="bottomLeftCorner":a.$container.hasClass("smart-window-resizing-top-right")?a._dragDetails.side="topRightCorner":a.$container.hasClass("smart-window-resizing-bottom-right")&&(a._dragDetails.side="bottomRightCorner")}}_setElementParent(e){const t=this;if(t._windowParent.element=void 0,t._windowParent.parent&&!t._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&(t._windowParent.parent.style.position=""),e instanceof HTMLElement)t._windowParent.element=e;else if("string"==typeof e)if("body"===e){const e=t.getRootNode();t._windowParent.element=e&&e.host?t.getShadowRootOrBody():document.body}else t._windowParent.element=document.getElementById(e);if(t._windowParent.element||(t._windowParent.initialParent?t._windowParent.element=t._windowParent.initialParent.parentElement?t._windowParent.initialParent:t.getShadowRootOrBody():t._windowParent.element=t.getShadowRootOrBody()),t.parentElement!==t._windowParent.element&&t._windowParent.element.appendChild(t),t._windowParent.element===document.body)t._windowParent.element=document.documentElement,t._windowParent.scrollElement=document.scrollingElement,t._windowParent.parent=document.body,t._windowParent.borderWidth=0;else{if(t.parentElement instanceof Smart.Window&&!t.parentElement.isCompleted)return void t.parentElement.whenRendered((function(){t.parentElement.appendChild(t),t._setElementParent(t.windowParent)}));t._windowParent.element instanceof Smart.Window&&(t._windowParent.element=t._windowParent.element.$.content);const e=getComputedStyle(t.parentElement),a=e.getPropertyValue("position");t._windowParent.borderWidth=2*parseInt(e.getPropertyValue("border-width")||0),t._windowParent.parent=t.parentElement,t._windowParent.scrollElement=t._windowParent.element,"static"===a&&(t.parentElement.style.position="relative")}t._setModal(),t.style.left&&t.offsetLeft>t._windowParent.scrollElement.scrollWidth&&(t.style.left=t._windowParent.scrollElement.scrollWidth-t.offsetWidth+"px"),t.style.top&&t.offsetTop>t._windowParent.scrollElement.scrollHeight&&(t.style.top=t._windowParent.scrollElement.scrollHeight-t.offsetHeight+"px")}_setModal(){const e=this;if(e._windowParent&&(delete e._changingFocus,e._windowParent.element))if(e.modal)if(e._modal||(e._modal=document.createElement("div"),e._modal.classList.add("smart-modal")),e._windowParent.parent!==document.body?e._modal.setAttribute("nested-modal",""):e._modal.removeAttribute("nested-modal"),e._modal._window=e,e.opened&&!e._modal.parentElement){const t=parseInt(getComputedStyle(e).getPropertyValue("z-index"));isNaN(t)||(e._modal.style.zIndex=t-1),e.parentElement.insertBefore(e._modal,e)}else e._modal.parentElement&&e._modal.parentElement.removeChild(e._modal);else e._modal&&e._modal.parentElement&&(e._modal.parentElement.removeChild(e._modal),delete e._modal)}}),Smart("smart-dialog-window",class extends Smart.Window{static get properties(){return{cancelLabel:{value:"Cancel",type:"string"},confirmLabel:{value:"Ok",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},headerButtons:{value:["close"],type:"array"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0}}}static get listeners(){return{"footer.click":"_footerClickHandler"}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="pinButton" class="smart-pin-button" aria-label="Pin"></button>\n <button id="collapseButton" class="smart-button smart-element smart-collapse-button" aria-label="Collapse"></button>\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button" aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}_createElement(){const e=this;e.setAttribute("role","alertdialog"),e.setAttribute("aria-describedby",e.$.content.id)}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm"):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel")}_keyDownHandler(e){const t=this;if(delete t._changingFocus,t.disabled||(t.hasAttribute("dragged")||t.hasAttribute("resized"))&&t._mouseManipulation)return;if(t.disableKeyboard)return;e.stopPropagation();const a="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,i=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":{if(t.minimized||i!==t)return;const n=e.key.indexOf("Right")>-1||e.key.indexOf("Left")>-1;if(e.preventDefault(),!n&&e.altKey)return void("ArrowUp"===e.key?t.maximize():t.restore());if(t.$.addClass("no-transition"),t.maximized)return;if(e.ctrlKey&&"none"!==t.resizeMode)return t.hasAttribute("dragged")&&t._cancelDragging(e),t.hasAttribute("resized")||t.$.fireEvent("resizeStart",{position:{x:e.pageX,y:e.pageY}}),void t._resize(n?"right":"bottom",a);t.pinned||(t.hasAttribute("dragged")||(t.setAttribute("dragged",""),t.$.fireEvent("dragStart",{left:e.pageX,top:e.pageY})),t._drag(a,n?"horizontal":"vertical")),t.$.removeClass("no-transition");break}case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}}}),Smart("smart-alert-window",class extends Smart.DialogWindow{static get properties(){return{headerButtons:{value:[],type:"array"}}}_createElement(){const e=this;e.setAttribute("role","alertdialog"),e.setAttribute("aria-describedby",e.$.content.id)}}),Smart("smart-prompt-window",class extends Smart.DialogWindow{static get properties(){return{autoComplete:{allowedValues:["none","manual","auto","inline"],type:"string",value:"manual"},confirmLabel:{value:"Ok",type:"string"},cancelLabel:{value:"Cancel",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},displayMode:{value:"default",allowedValues:["default","escaped"],type:"string"},headerButtons:{value:["close"],type:"array"},form:{value:"",type:"string"},hint:{value:null,type:"any?"},maxLength:{value:null,type:"number?"},minLength:{value:2,type:"number"},messages:{extend:!0,value:{en:{missingReference:"{{elementType}}: Missing reference to {{files}}."}},type:"object"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},name:{value:"",type:"string"},placeholder:{value:"",type:"string"},promptLabel:{value:"",type:"string?"},required:{value:!1,type:"boolean"},requiredMessage:{value:"",type:"string"},selectAllOnFocus:{value:!1,type:"boolean"},value:{value:"",type:"string"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-text-box id="textBox"\n animation="[[animation]]"\n auto-complete="[[autoComplete]]"\n max-length="[[maxLength]]"\n value="{{value}}"\n form="[[form]]"\n label="[[promptLabel]]"\n hint="[[hint]]"\n display-mode="[[displayMode]]"\n max-length="[[maxLength]]"\n placeholder="[[placeholder]]"\n required="[[required]]"\n required-message="[[requiredMessage]]"\n select-all-on-focus="[[selectAllOnFocus]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n </smart-text-box>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button flat">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button flat">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}static get listeners(){return{"footer.click":"_footerClickHandler"}}static get requires(){return{"Smart.TextBox":"smart.textbox.js"}}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm",{value:t.$.textBox.value}):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel",{value:t.$.textBox.value})}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;if(t.disableKeyboard)return;e.stopPropagation();const i="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,n=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(n!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",i),void a();t._drag(i,"vertical");break;case"ArrowLeft":case"ArrowRight":if(n!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",i),void a();t._drag(i,"horizontal"),t.$.removeClass("no-transition");break;case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}}),Smart("smart-multiline-prompt-window",class extends Smart.PromptWindow{static get properties(){return{autoCapitalize:{value:"none",allowedValues:["none","words","characters"],type:"string"},autoExpand:{value:!1,type:"boolean"},headerButtons:{value:["close"],type:"array"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},selectionDirection:{value:"none",allowedValues:["forward","backward","none"],type:"string"},selectionEnd:{value:0,reflectToAttribute:!1,type:"number"},selectionStart:{value:0,reflectToAttribute:!1,type:"number"},spellCheck:{value:!1,type:"boolean"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},wrap:{value:"soft",allowedValues:["hard","soft","off"],type:"string"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-multiline-text-box id="textBox"\n animation="[[animation]]"\n horizontal-scroll-bar-visibility= "[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility= "[[verticalScrollBarVisibility]]"\n auto-capitalize="[[autoCapitalize]]"\n auto-expand = "[[autoExpand]]"\n selection-direction= "[[selectionDirection]]"\n selection-end= "[[selectionEnd]]"\n selection-start="[[selectionStart]]"\n spell-check= "[[spellCheck]]"\n wrap="[[wrap]]"\n max-length="[[maxLength]]"\n value="{{value}}"\n form="[[form]]"\n label="[[promptLabel]]"\n hint="[[hint]]"\n display-mode="[[displayMode]]"\n max-length="[[maxLength]]"\n placeholder="[[placeholder]]"\n required="[[required]]"\n required-message="[[requiredMessage]]"\n select-all-on-focus="[[selectAllOnFocus]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n </smart-multiline-text-box>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button flat">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button flat">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}static get listeners(){return{"footer.click":"_footerClickHandler"}}static get requires(){return{"Smart.MultilineTextBox":"smart.multilinetextbox.js"}}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm",{value:t.$.textBox.value}):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel",{value:t.$.textBox.value})}}),Smart("smart-progress-window",class extends Smart.Window{static get properties(){return{completeLabel:{value:"Continue",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},headerButtons:{value:["close"],type:"array"},indeterminate:{value:!1,type:"boolean"},inverted:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function"},max:{value:100,type:"number"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},min:{value:0,type:"number"},showProgressValue:{value:!1,type:"boolean"},value:{value:0,type:"number?"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content" inner-h-t-m-l="[[innerHTML]]">\n <content></content>\n </div>\n <div id="footer" class="smart-footer">\n <smart-progress-bar id="progressBar"\n animation="[[animation]]"\n min="[[min]]"\n max="[[max]]"\n indeterminate="[[inditerminate]]"\n inverted="[[inverted]]"\n format-function="[[formatFunction]]"\n show-progress-value="[[showProgressValue]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]"\n value="{{value}}">\n </smart-progress-bar>\n <button id="completeButton" class="smart-button smart-element smart-complete-button smart-visibility-hidden">[[completeLabel]]</button>\n </div>\n </div>\n </div>'}static get requires(){return{"Smart.ProgressBar":"smart.progressbar.js"}}propertyChangedHandler(e,t,a){const i=this;switch(e){case"value":i._handleCompletion();break;default:super.propertyChangedHandler(e,t,a)}}_createElement(){this.setAttribute("role","dialog"),this._handleCompletion()}_handleCompletion(){const e=this;e.$.completeButton&&(e.value>=e.max?(e.$completeButton.removeClass("smart-visibility-hidden"),e.$progressBar.addClass("smart-visibility-hidden")):(e.$completeButton.addClass("smart-visibility-hidden"),e.$progressBar.removeClass("smart-visibility-hidden")))}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;if(t.disableKeyboard)return;e.stopPropagation();const i="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,n=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(n!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",i),void a();t._drag(i,"vertical"),t.$.removeClass("no-transition");break;case"ArrowLeft":case"ArrowRight":if(n!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",i),void a();t._drag(i,"horizontal"),t.$.removeClass("no-transition");break;case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}}),Smart("smart-tabs-window",class extends Smart.Window{static get properties(){return{disableSnap:{value:!0,readOnly:!0,type:"boolean"},dropPosition:{value:["all"],type:"array"},addNewTab:{value:!1,type:"boolean"},allowToggle:{value:!1,type:"boolean"},autoHide:{value:!1,type:"boolean"},autoHideWindow:{value:null,type:"any"},dataSource:{value:null,type:"array?",reflectToAttribute:!1},tabCloseButtonMode:{value:"default",allowedValues:["default","selected"],type:"string"},tabCloseButtons:{value:!1,type:"boolean"},draggable:{value:!0,type:"boolean",reflectToAttribute:!1},messages:{value:{en:{ambiguousIndexes:"smart-tabs: Initially set smart-tab-item indexes are ambiguous and are ignored in favour of the HTML structure.",detailsObjectRequired:'smart-tabs: The method "insert" requires a details Object to be passed as a second argument.',invalidIndex:'smart-tabs: "{{method}}" method accepts an index of type number.',referenceNodeNotChild:"smart-tabs: Passed {{argument}} is not part of this smart-tabs element.",tabItemRequired:'smart-tabs: The method "{{method}}" requires a "smart-tab-item" element to be passed as an argument.'}},type:"object",extend:!0},tabOverflow:{value:"auto",allowedValues:["auto","hidden","scroll"],type:"string"},tabReorder:{value:!1,type:"boolean"},tabResize:{value:!1,type:"boolean"},tabScrollButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},selectedIndex:{value:null,type:"number?"},selectionMode:{value:"click",allowedValues:["click","dblclick","mouseenter","none"],type:"string"},collapsed:{value:!1,type:"boolean"},collapsible:{value:!1,type:"boolean"},locked:{value:!1,type:"boolean"},max:{value:"",type:"any"},min:{value:"",type:"any"},size:{value:"",type:"any"},tabLayout:{value:"scroll",allowedValues:["scroll","dropdown","wrap","shrink"],type:"string",defaultReflectToAttribute:!0},tabPosition:{value:"top",allowedValues:["top","bottom","left","right","hidden"],type:"string"},tabTextOrientation:{value:"horizontal",allowedValues:["horizontal","vertical"],type:"string"},layout:{value:null,type:"any"}}}static get listeners(){return{"tabsElement.blur":"_tabsFocusHandler","tabsElement.change":"_tabsChangeHandler","tabsElement.focus":"_tabsFocusHandler","autoHideWindow.close":"_autoHideWindowCloseHandler","autoHideWindow.open":"_autoHideWindowOpenHandler"}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button" aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div id="contentSection" class="smart-content">\n <smart-tabs id="tabsElement"\n animation="[[animation]]"\n add-new-tab="[[addNewTab]]"\n allow-toggle="[[allowToggle]]"\n close-button-mode="[[tabCloseButtonMode]]"\n close-buttons="[[tabCloseButtons]]"\n disabled="[[disabled]]"\n overflow="[[tabOverflow]]"\n reorder="[[tabReorder]]"\n resize="[[tabResize]]"\n scroll-buttons-position="[[tabScrollButtonsPosition]]"\n selected-index="{{selectedIndex}}"\n selection-mode="[[selectionMode]]"\n tab-layout="[[tabLayout]]"\n tab-position="[[tabPosition]]"\n tab-text-orientation="[[tabTextOrientation]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n <content></content>\n </smart-tabs>\n </div>\n <div id="footer" class="smart-footer smart-hidden"></div>\n </div>\n </div>'}static get requires(){return{"Smart.Tabs":"smart.tabs.js"}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(e instanceof Smart.TabItem||t.error(t.localize("tabItemRequired",{method:"removeChild"})),t.$.tabsElement.appendChild(e)):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}insert(e,t){this.$.tabsElement.insert(e,t);const a=this.$.tabsElement._tabs[e];a&&(a.draggable=void 0===t.draggable||t.draggable,a.floatable=void 0===t.floatable||t.floatable)}insertBefore(e,t){this.$.tabsElement.insertBefore(e,t)}removeAt(e){this.$.tabsElement.removeAt(e)}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(e instanceof Smart.TabItem||t.error(t.localize("tabItemRequired",{method:"removeChild"})),(t.shadowRoot||t).contains(e)||t.error(t.localize("referenceNodeNotChild",{argument:"node"})),t.$.tabsElement.removeChild(e)):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}refreshTabHeader(){const e=this;e.$.tabsElement&&e.$.tabsElement.isCompleted&&e.$.tabsElement.refreshTabHeader()}refreshTabs(){const e=this;e.$.tabsElement&&e.$.tabsElement.isCompleted&&e.$.tabsElement._applyTabOverflow()}select(e){this.$.tabsElement.select(e)}update(e,t,a){this.$.tabsElement.update(e,t,a)}get items(){return this.isCompleted&&this.$.tabsElement?this.$.tabsElement._tabs:null}get itemLabels(){return this.$?this.$.tabsElement._tabLabelContainers:null}get siblings(){const e=this;let t=[];if(!e.isCompleted)return t;const a=e.closest("smart-splitter");if(!a||!a.closest("smart-docking-layout"))return t;const i=a._items;if(!i||!i.length)return t;for(let n=0;n<i.length;n++){const o=i[n];o!==e.closest("smart-splitter-item")&&o.querySelector("smart-tabs-window").closest("smart-splitter")===a&&t.push(o.querySelector("smart-tabs-window"))}return t}propertyChangedHandler(e,t,a){const i=this;switch("collapsed"!==e&&super.propertyChangedHandler(e,t,a),e){case"theme":""!==t&&(i.$.closeButton.classList.remove(t),i.$.collapseButton.classList.remove(t),i.$.maximizeButton.classList.remove(t),i.$.pinButton.classList.remove(t)),i._applyTheme(a);break;case"autoHideWindow":i._handleAutoHideWindow();break;case"autoHide":a||(null!==i.$.tabsElement.selectedIndex&&(i.$.tabsElement._tabs[i.$.tabsElement.selectedIndex]._autoHideWindowSize=void 0),i._autoHideWindow&&i._autoHideWindow.close());break;case"dataSource":i.$.tabsElement.dataSource=a;break;case"layout":i._handleLayoutProperty();break;case"collapsible":case"collapsed":case"locked":case"max":case"min":case"size":{const n=i.getRootNode(),o=(n&&n.host?n.host:i).closest("smart-docking-layout"),s=i.closest("smart-splitter-item");if(!o)return void("collapsed"===e&&super.propertyChangedHandler(e,t,a));s&&(s[e]=a);break}}}_applyTheme(e){if(""!==e){const t=this.$.buttonsContainer.children;for(let a=0;a<t.length;a++)t[a].classList.add(e)}}_autoHideWindowCloseHandler(){const e=this;e.allowToggle&&null!==e.$.tabsElement.selectedIndex&&e.$.tabsElement.select(e.$.tabsElement.selectedIndex),e._autoHideWindow&&e._moveContent(e._autoHideWindow.items[0],e._autoHideWindow._tab)}_autoHideWindowOpenHandler(){const e=this;e.$.tabsElement.selectedIndex&&e._handleAutoHide(e.$.tabsElement.selectedIndex)}_createElement(){const e=this;e.setAttribute("role","dialog"),e.$.tabsElement.$.tabHeaderControls&&!e.$.tabsElement.$.tabHeaderControls.innerHTML&&e.$.tabsElement.$tabHeaderControls.addClass("smart-hidden"),e.$.tabsElement.dataSource=e.dataSource,e._applyTheme(e.theme),e._handleAutoHideWindow(),e.autoHide&&e._handleAutoHide(e.$.tabsElement.selectedIndex),e.allowToggle||e.selectedIndex||null===e.$.tabsElement.selectedIndex||(e.selectedIndex=e.$.tabsElement.selectedIndex,e.$.tabsElement.setAttribute("selected-index",e.selectedIndex)),e._handleLayoutProperty();const t=(e.isInShadowDOM?e.getRootNode().host:e||e).closest("smart-docking-layout"),a=e.closest("smart-splitter-item");t&&a&&(a.collapsible=e.collapsible,a.collapsed=e.collapsed,a.min=e.min,a.max=e.max,a.size=e.size,a.locked=e.locked)}attached(){super.attached();const e=this;e.classList.add("smart-window"),e.shadowRoot&&e.$.root.classList.add("smart-window")}_handleLayoutProperty(){const e=this;let t=e.closest("smart-docking-layout");if(Smart.DockingLayout){if(!e.ownerLayout&&e.getRootNode()){let a=e.getRootNode().host;for(;a;){if(!a.closest)return;if(a.closest("smart-docking-layout")){t=a.closest("smart-docking-layout");break}a=a.getRootNode()?a.getRootNode().host:void 0}}t?e.layout=t:e.layout instanceof Smart.DockingLayout||"string"==typeof e.layout&&(e.layout=document.getElementById(e.layout))}}_headerDblCickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;e.ctrlKey||a!==t.$.headerSection&&a!==t.$.header||t.$.maximizeButton&&0===t.$.maximizeButton.offsetHeight||(t.maximized?t.restore():t.maximize())}_documentUpHandler(e){const t=this;let a=e.originalEvent.target.closest?e.originalEvent.target.closest(".smart-window"):e.originalEvent.target,i=a===t||a===t._autoHideWindow||t._isAutoHideWindowClicked,n=t.closest("smart-docking-layout");(t.shadowRoot||t.isInShadowDOM)&&(a=e.originalEvent.composedPath()[0],i=a.getRootNode()===t.shadowRoot||a.closest(".smart-window")===t||a.closest(".smart-window")===t._autoHideWindow||t._isAutoHideWindowClicked),n=((t.isInShadowDOM?t.getRootNode().host:t)||t).closest("smart-docking-layout"),n&&n.disabled?delete t._isWindowContentClicked:(super._documentUpHandler(e),delete t._isAutoHideWindowClicked,t.autoHide&&t._autoHideWindow&&(i&&t._autoHideWindow.opened||(t.selectedIndex=null,t._autoHideWindow.parentElement&&t._autoHideWindow.parentElement.closest(".smart-window")===t&&t._autoHideWindow.close())))}_handleAutoHide(e){const t=this;if(!t.autoHide||null===e)return;if(t._autoHideWindow||t._handleAutoHideWindow(!0),!t._autoHideWindow)return;t._autoHideWindow._tabsWindow&&t._autoHideWindow._tabsWindow!==t&&(t._autoHideWindow._tabsWindow.selectedIndex=null);const a=t.$.tabsElement._tabs[e];t._autoHideWindow._tab!==a&&t._moveContent(t._autoHideWindow.items[0],t._autoHideWindow._tab),t._autoHideWindow.label=a.label,t._autoHideWindow.draggable=a.draggable,t._autoHideWindow.floatable=a.floatable,t._autoHideWindow._tab=a,t._autoHideWindow.headerButtons=t.headerButtons,t._moveContent(t._autoHideWindow._tab,t._autoHideWindow.items[0]),t._autoHideWindow.bringToFront(),t._setAutoHideWindowSize(e),t._autoHideWindow.open(),t._autoHideWindow._tabsWindow=t,t._autoHideWindow.controlledBy&&t._autoHideWindow.controlledBy.removeAttribute("aria-controls"),t._autoHideWindow.controlledBy=t.$.tabsElement._tabLabelContainers[e],t._autoHideWindow.controlledBy.setAttribute("aria-controls",t._autoHideWindow.id)}_moveHandler(e){const t=this,a=t.closest("smart-docking-layout");a&&a.items.indexOf(t)>-1||(Smart.Utilities.Core.isMobile&&navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&t.layout instanceof Smart.DockingLayout&&t.layout.hasAttribute("dragged")&&e.originalEvent.preventDefault(),super._moveHandler(e))}_setAutoHideWindowSize(e){const t=this;if(!t._autoHideWindow)return;t._autoHideWindow.$.addClass("no-transition"),t._autoHideWindow.style.maxWidth=t._autoHideWindow.style.maxHeight="";const a=t.$.tabsElement._tabs[e],i=(t._autoHideWindow.isInShadowDOM?t._autoHideWindow.getRootNode().host:t._autoHideWindow).closest("smart-docking-layout")||t._autoHideWindow.parentElement;let n,o;if(a){if("top"===t.tabPosition||"bottom"===t.tabPosition){t._autoHideWindow.resizeMode="top"===t.tabPosition?"bottom":"top",t._autoHideWindow.style.width=t.$.tabsElement.offsetWidth+"px",n=i.getBoundingClientRect(),o=t.$.tabsElement.getBoundingClientRect();let e=a._autoHideWindowSize&&parseFloat(a._autoHideWindowSize)||"";Smart.DockingLayout&&i instanceof Smart.DockingLayout&&(e&&(e=Math.min(i.$.itemsContainer.offsetHeight,e)+"px"),t._autoHideWindow.style.maxHeight=i.$.itemsContainer.offsetHeight+"px"),t._autoHideWindow.style.height=e,t._autoHideWindow.style.left=o.left-n.left+"px",t._autoHideWindow&&("top"===t.tabPosition?t._autoHideWindow.style.top=o.top+-n.top+o.height+"px":t._autoHideWindow.style.top=o.top-n.top-t._autoHideWindow.offsetHeight+"px")}else{t._autoHideWindow.resizeMode="left"===t.tabPosition?"right":"left",t._autoHideWindow.style.height=t.$.tabsElement.offsetHeight+"px";let e=a._autoHideWindowSize&&parseFloat(a._autoHideWindowSize)||"";i instanceof Smart.DockingLayout&&(e&&(e=Math.min(i.$.itemsContainer.offsetWidth,e)+"px"),t._autoHideWindow.style.maxWidth=i.$.itemsContainer.offsetWidth+"px"),t._autoHideWindow.style.width=e,n=i.getBoundingClientRect(),o=t.$.tabsElement.getBoundingClientRect(),t._autoHideWindow.style.top=o.top-n.top+"px","left"===t.tabPosition?t._autoHideWindow.style.left=o.left-n.left+t.$.tabsElement.offsetWidth+"px":t._autoHideWindow.style.left=o.left-n.left-t._autoHideWindow.offsetWidth+"px"}t._autoHideWindow._dragDetails&&(t._autoHideWindow._dragDetails.maxWidth=void 0),t._autoHideWindow._setDragDetails("resize"),t._autoHideWindow._dragDetails.started=!1,t._autoHideWindow.$.removeClass("no-transition")}}_handleAutoHideWindow(e){const t=this;if(t.autoHideWindow){if(t._autoHideWindow&&t._autoHideWindow.parentElement.removeChild(t._autoHideWindow),"string"==typeof t.autoHideWindow)return void(t._autoHideWindow=document.getElementById(t.autoHideWindow));if(t.autoHideWindow instanceof Smart.Window)return void(t._autoHideWindow=t.autoHideWindow)}if(!e||t._autoHideWindow||2===t.$.contentSection.children.length&&t.$.contentSection.children[1]instanceof Smart.Window)return;const a=document.createElement("smart-window");a.$=Smart.Utilities.Extend(a),a.disableSnap=a.pinned=!0,a.headerButtons=["close"],t.$.contentSection.appendChild(a),t._autoHideWindow=a}_moveContent(e,t){if(!e||!t)return;const a=[].slice.call(e.$.content.childNodes);for(let e=0;e<a.length;e++)t.appendChild(a[e])}_tabsChangeHandler(e){const t=this;if(e.target===t.$.tabsElement&&t.autoHide){if(t._autoHideWindow||t._handleAutoHideWindow(!0),null!==e.detail.oldIndex&&t._autoHideWindow.opened&&(t.$.tabsElement._tabs[e.detail.oldIndex]._autoHideWindowSize=t._autoHideWindow.style["right"===t.$.tabsElement.tabPosition||"left"===t.$.tabsElement.tabPosition?"width":"height"]),!t.autoHide||null===e.detail.index||void 0===e.detail.index)return t._autoHideWindow.setAttribute("active",""),void t._autoHideWindow.close();t._handleAutoHide(e.detail.index)}}_tabsFocusHandler(e){const t=this;"focus"===e.type?(t.bringToFront(),t.setAttribute("focus","")):t.removeAttribute("focus")}}),Smart("smart-wait-window",class extends Smart.ProgressWindow{static get properties(){return{headerButtons:{value:[],type:"array"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},pinned:{value:!0,type:"boolean",readOnly:!0}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-progress-bar id="progressBar" animation="[[animation]]" indeterminate theme="[[theme]]" right-to-left="[[rightToLeft]]"></smart-progress-bar>\n </div>\n <div id="footer" class="smart-footer"></div>\n </div>\n </div>'}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;const i=t.shadowRoot||t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;e.stopPropagation();const n="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(i!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",n),void a();t._drag(n,"vertical");break;case"ArrowLeft":case"ArrowRight":if(i!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",n),void a();t._drag(n,"horizontal");break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}});
|
|
203
203
|
|
|
204
204
|
/***/ })
|
|
205
205
|
|
|
@@ -322,7 +322,7 @@ var __webpack_exports__ = {};
|
|
|
322
322
|
/* harmony import */ var _smart_kanban_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(7498);
|
|
323
323
|
/* harmony import */ var _smart_kanban_js__WEBPACK_IMPORTED_MODULE_27___default = /*#__PURE__*/__webpack_require__.n(_smart_kanban_js__WEBPACK_IMPORTED_MODULE_27__);
|
|
324
324
|
|
|
325
|
-
/* Smart UI v15.2.
|
|
325
|
+
/* Smart UI v15.2.18 (2023-05-27)
|
|
326
326
|
Copyright (c) 2011-2023 jQWidgets.
|
|
327
327
|
License: https://htmlelements.com/license/ */ //
|
|
328
328
|
|