text: 
  /* Smart HTML Elements v7.4.0 (2020-Apr) 
  Copyright (c) 2011-2020 jQWidgets. 
  License: https://htmlelements.com/license/ */ //
  
  !function(e){var t={};function a(s){if(t[s])return t[s].exports;var l=t[s]={i:s,l:!1,exports:{}};return e[s].call(l.exports,l,l.exports,a),l.l=!0,l.exports}a.m=e,a.c=t,a.d=function(e,t,s){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)a.d(s,l,function(t){return e[t]}.bind(null,l));return s},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=62)}({62:function(e,t){Smart("smart-kanban",class extends Smart.DataView{static get properties(){return{allowDrag:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDrop:{value:!0,type:"boolean",defaultReflectToAttribute:!0},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},currentUser:{value:null,type:"any"},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",addSubtask:"Add subtask",assignedTo:"Assigned to",checklist:"Checklist",color:"Color",commentsIcon:"Comments icon",copy:"Copy",customize:"Customize tasks",dueDate:"Due date",edit:"Edit",editTask:'Edit task "{{taskId}}"',high:"High",low:"Low",newComment:"New comment",newSubtask:"New subtask",normal:"Normal",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}}"?',remove:"Remove",removeSubtask:"Remove subtask",send:"Send",startDate:"Start date",status:"Status",swimlane:"Swimlane",tags:"Tags",text:"Text",userId:"User ID",userIcon:"User icon"}}},selectionMode:{value:"zeroOrOne",allowedValues:["zeroOrOne","zeroOrManyExtended"],type:"string"},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"},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},taskUserIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},textTemplate:{value:null,type:"any"},userList:{value:!1,type:"boolean"},users:{value:[],type:"array",reflectToAttribute:!1}}}static get listeners(){return{"body.focusin":"_bodyFocusinHandler","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                    <div id="body" class="smart-kanban-body" role="presentation"></div>\n                </div>`}render(){const e=this,t=getComputedStyle(e);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._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._allColumns=[],e._customTags=[],e._selectedTasks=[],e._dblclickObject={numberOfClicks:0},e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._sortPanelDataSource=[{label:e.localize("text"),dataField:"text",dataType:"string"},{label:e.localize("userId"),dataField:"userId",dataType:"string"},{label:e.localize("tags"),dataField:"tags",dataType:"string"},{label:e.localize("priority"),dataField:"priority",dataType:"string"},{label:e.localize("progress"),dataField:"progress",dataType:"number"},{label:e.localize("startDate"),dataField:"startDate",dataType:"date"},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date"}],e._getInnerElementMessages(),e._localizeHeader(),e._handleHeaderPosition(e.$.body),e._validateSwimlanes(),e._renderColumns(),e._handleSwimlanes();let a=!1;e.autoLoadState&&(a=e.loadState()),a||e._processDataSource(),e._getCurrentUser(),e._setUserList(),e._setActionsList(),e._setCommentsList(),e._autoSaveState(),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),document.body.appendChild(e._dialog))}detached(){if(super.detached(),!this._dialog)return;const e=this._dialog;e.removeEventListener("open",this._dialogEventHandler),e.removeEventListener("closing",this._dialogEventHandler),e.removeEventListener("close",this._dialogEventHandler),e.removeEventListener("click",this._dialogClickHandler),e.remove()}addTask(e={}){const t=this.columns;"object"==typeof e&&0!==t.length&&this._currentUser.allowAdd&&(void 0===e.status&&(e.status=t[0].dataField),this._createTask(e,!0),this._autoSaveState("dataSource"))}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){this._currentUser.allowEdit&&!this.disabled&&(e=this._validateTaskArgument(e))&&this._openDialog(e,"edit")}cancelEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&e.close()}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;if(e.collapsed=!0,a.classList.add("collapsed"),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.collapsed=!1,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)}copyTask(e){if(!this._currentUser.allowAdd)return;if(!(e=this._validateTaskArgument(e)))return;const t=Object.assign({},e.data);t.id=Math.floor(9e4*Math.random()+1e4),this._createTask(t,!0),this._autoSaveState("dataSource")}endEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&(e.ok=!0,e.close())}ensureVisible(e){if(!(e=this._validateTaskArgument(e))||e.filteredOut)return;const t=e.closest("smart-scroll-viewer");if(0===t.scrollHeight)return e;const a=t.scrollTop,s=e.offsetTop;return a<=s&&a+t.offsetHeight>=s+e.offsetHeight||(t.scrollTop=s),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"),t._updateColumnWidths(a.siblingColumns,a.parentElement),t._allColumns.forEach(e=>t._refreshScrollViewer(e)),t._autoSaveState("collapsed"),t._handleSwimlanes(!0)}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(),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"}],d={},m={},u={};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.status,l=t.swimlane,o=t.userId,h=t.progress;d[a]?a=d[a]:(a=s._allColumns.find(e=>e.dataField===a).label,d[t.status]=a),null===o?o="":u[o]?o=u[o]:(o=s.users.find(e=>e.id===o).name,u[t.userId]=o),null===h?h="":h/=100;const b={id:t.id,text:t.text,status:a,asignee:o,priority:t.priority,progress:h,startDate:t.startDate||"",dueDate:t.dueDate||"",subTasks:s._getCompletedSubTasks(t.checklist),tags:t.tags};r.length&&(l?m[l]?l=m[l]:(l=r.find(e=>e.dataField===l).label,m[t.swimlane]=l):l="",b.swimlane=l),c.push(b),t.color&&(i.style.rows[e]={backgroundColor:t.color})}return i.exportData(c,e,t,a)}getState(){const e=this,t={},a={collapsed:t,dataSource:e._getCurrentDataSource(),filtering:e._appliedFiltering,selection:{selected:e._selectedTasks.map(e=>e.data.id),selectionStart:e._selectionStart?e._selectionStart.data.id:null},sorting:e._appliedSorting,tabs:e._selectedTabs,visibility:{taskActions:e.taskActions,taskComments:e.taskComments,taskDue:e.taskDue,taskPriority:e.taskPriority,taskProgress:e.taskProgress,taskTags:e.taskTags,taskUserIcon:e.taskUserIcon}};let s=null,l=null;return e._selectionInView&&(s=e._selectionInView.closest(".smart-kanban-column").column.dataField,l=e._selectionInView.getAttribute("swimlane")),a.selection.selectionInColumn=s,a.selection.swimlane=l,e._allColumns.forEach(e=>t[e.dataField]=e.collapsed),a}loadState(e){const t=this;if(!e&&!(e=window.localStorage.getItem("smartKanban"+t.id)))return!1;"string"==typeof e&&(e=JSON.parse(e,(e,t)=>t&&-1!==["startDate","dueDate","time"].indexOf(e)?new Date(t):t)),t._selectedTasks=[],delete t._selectionStart,delete t._selectionInView,t.expandAll(),Array.from(t.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach(e=>e.clearContent()),t._allColumns.forEach(a=>{e.collapsed[a.dataField]&&t.collapse(a)});for(let a in e.visibility)t[a]=e.visibility[a];if(t.dataSource=e.dataSource,t._processDataSource(),t.addFilter(t._constructFilterGroups(e.filtering),e.filtering.operator),t.addSort(e.sorting),t._autoSaveState(e),e.selection.selected.forEach(e=>{const a=t.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`);a&&(a.setAttribute("selected",""),t._selectedTasks.push(a))}),e.selection.selectionStart&&(t._selectionStart=t.$.container.querySelector(`.smart-kanban-task[data-id="${e.selection.selectionStart}"]`)),e.selection.selectionInColumn){const a=t._columnToElement.get(t._allColumns.find(t=>t.dataField===e.selection.selectionInColumn));e.selection.swimlane?t._selectionInView=a.querySelector(`smart-scroll-viewer[swimlane=${e.selection.swimlane}]`):t._selectionInView=a.querySelector("smart-scroll-viewer")}if(e.tabs){const a="tabs"===t.hierarchy;t._allColumns.forEach(s=>{if(void 0!==s.selected){const l=t._columnToElement.get(s),o=-1!==e.tabs.indexOf(s.dataField);s.selected=o,a&&(l.classList.toggle("smart-hidden",!o),l.tab.classList.toggle("selected",o),l.tab.setAttribute("aria-selected",o))}})}return!0}moveTask(e,t){const a=this;if(a.disabled||!t)return;if(!(e=a._validateTaskArgument(e))||e.status===t)return;const s=a._allColumns.find(e=>e.dataField===t);if(!s)return;const l=e.closest("smart-scroll-viewer"),o=a._columnToElement.get(s),r=e.data,i=a.getTaskScrollViewer(o,r);r.status=t,i.appendChild(e),a._dialog&&a._dialog.ok||(a.textTemplate&&a._renderTask(e),a._autoSaveState("dataSource")),a._refreshScrollViewer(l,!0),a._refreshScrollViewer(i,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter(t=>t!==e),a._autoSaveState("selection")),e.removeAttribute("focus"),(a.shadowRoot||a.getRootNode()).activeElement===l&&a._focusTask(a._getFirstItem(l.$.content))}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.$.sortable.disabled=!0,e._customizePartCreated=!0),e._openHeaderDropDown(e.$.customizeButton)}openFilterPanel(){const e=this,t=[{label:e.localize("text"),dataField:"text",dataType:"string"},{label:e.localize("userId"),dataField:"userId",dataType:"string"},{label:e.localize("tags"),dataField:"tags",dataType:"string"},{label:e.localize("priority"),dataField:"priority",dataType:"enum",options:[{label:e.localize("high"),value:"high"},{label:e.localize("normal"),value:"normal"},{label:e.localize("low"),value:"low"}]},{label:e.localize("progress"),dataField:"progress",dataType:"number"},{label:e.localize("startDate"),dataField:"startDate",dataType:"date"},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date"}];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)}))}openSortPanel(){const e=this,t=e._sortPanelDataSource.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;if(a._currentUser.allowRemove&&(e=a._validateTaskArgument(e)))if(t)a._openDialog(e,"prompt");else{const t=e.closest("smart-scroll-viewer");e.remove(),a._refreshScrollViewer(t,!0),a._autoSaveState("dataSource")}}saveState(){const e=this.getState();return window.localStorage.setItem("smartKanban"+this.id,JSON.stringify(e)),e}updateTask(e,t){const a=this;if(!a._currentUser.allowEdit||!t)return;if(!(e=a._validateTaskArgument(e)))return;const s=e.data;if((t=Object.assign({},s,t)).checklist&&0===t.checklist.length&&(t.checklist=null),JSON.stringify(t)!==JSON.stringify(s)){if(e.data=t,t.status!==s.status&&a.moveTask(e,t.status),t.swimlane!==s.swimlane){const l=e.closest(".smart-kanban-column");a._hasSwimlane(l.index)?(l.querySelector(`smart-scroll-viewer[swimlane=${t.swimlane}]`).appendChild(e),s.swimlane&&a._refreshScrollViewer(l.querySelector(`smart-scroll-viewer[swimlane=${s.swimlane}]`))):delete t.swimlane}a.textTemplate||t.text!==s.text||t.tags!==s.tags||t.priority!==s.priority?a._renderTask(e):(t.userId!==s.userId&&a._updateUserIcon(e),t.dueDate!==s.dueDate&&a._updateTaskDueDate(e),t.color!==s.color&&a._updateTaskColor(e),JSON.stringify(t.checklist)!==JSON.stringify(s.checklist)?(a._updateTaskProgress(e),a._updateTaskChecked(e)):parseFloat(t.progress)!==parseFloat(s.progress)&&a._updateTaskProgress(e)),a.$.fireEvent("change",{task:e,value:t,oldValue:s}),a._refreshScrollViewer(e.closest("smart-scroll-viewer")),a._autoSaveState("dataSource")}}propertyChangedHandler(e,t,a){const s=this,l=s._dialog;function o(){s.cancelEdit(),l&&l.close(),s._closeList(s._commentsList,"_commentSelectionFor"),s._getCurrentUser()}switch(super.propertyChangedHandler(e,t,a),e){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),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"columns":s.dataSource=s._getCurrentDataSource(),s._reset(),l&&l.editPanelPopulated&&(l.editors.status.dataSource=s._allColumns.map(e=>({label:e.label,value:e.dataField})));break;case"currentUser":o();break;case"dataSource":if(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()),s._processDataSource();break;case"disabled":s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),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._commentsList,"_commentSelectionFor"),s._setActionsList(),s._setCommentsList(),l&&(s.cancelEdit(),l.close(),l.$.footer.firstElementChild.innerHTML=s.localize("ok"),l.$.footer.children[1].innerHTML=s.localize("cancel"),l.editPanelPopulated&&(l.editors.priority.dataSource=[{label:s.localize("low"),value:"low"},{label:s.localize("normal"),value:"normal"},{label:s.localize("high"),value:"high"}],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":if("zeroOrOne"===a&&s._selectedTasks.length>1){const e=s._selectionStart;s._selectedTasks.forEach(t=>t!==e&&t.removeAttribute("selected")),s._selectedTasks=[e]}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 r=s.swimlanesFrom,i=s.swimlanesTo;r<0&&(s.swimlanesFrom=0),null!==i&&r>i&&(s.swimlanesFrom=i),s.swimlanes.length>0&&s._reset();break;case"tags":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"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._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.loadState(a)}_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.closest(".smart-kanban-column-header-add"))return void t.addTask({status:e.dataField});if(t.collapsible&&e.collapsible)return void t[e.collapsed?"expand":"collapse"](e)}const l=a.closest(".smart-kanban-tab");if(l&&!l.classList.contains("selected")){const e=l.parentElement.querySelector(".selected");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")}const o=a.closest(".smart-kanban-list .item");if(o){const e=parseFloat(o.getAttribute("data-id")),a=t._userSelectionFor;if(a)return a.data.userId=e,t._updateUserIcon(a),void t._closeList(t._userList,"_userSelectionFor");const s=t._actionSelectionFor;if(s){switch(e){case 0:t._actionsList.classList.contains("edit-comment")?(t._commentsList.textarea.value=s.comment.text,t._commentsList.textarea.focus(),t._commentsList.editing=s,s.parentElement.scrollTop=s.offsetTop):t.beginEdit(s);break;case 1:t.copyTask(s);break;case 2:t._actionsList.classList.contains("edit-comment")?t._openDialog(s,"prompt","comment"):t.removeTask(s,!0)}return void t._closeList(t._actionsList,"_actionSelectionFor")}}if(a.closest(".smart-kanban-list.comments")){const e=a.closest(".send");if(e){if(e.disabled)return;t._createComment(),t._commentsList.textarea.value="",e.disabled=!0}else if(a.classList.contains("remove-button")&&a.classList.contains("enabled")){const e=a.closest(".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");r&&(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):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):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):(t._preventSelection||t._selectTask(e,r),t._currentUser.allowEdit&&e.type&&(clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks?(t._dblclickObject.numberOfClicks=0,t.beginEdit(r)):t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300))))}_selectTask(e,t){const a=this;function s(){a._selectedTasks.forEach(e=>e!==t&&e.removeAttribute("selected")),t.hasAttribute("selected")||(t.setAttribute("selected",""),a._selectedTasks=[t]),a._selectionStart=t,a._selectionInView=t.closest("smart-scroll-viewer"),a._autoSaveState("selection"),a._focusTask(t)}if("zeroOrOne"===a.selectionMode)a._selectedTasks.forEach(e=>e!==t&&e.removeAttribute("selected")),t.hasAttribute("selected")?(a._focusTask(t),t.removeAttribute("selected"),a._selectedTasks=[],delete a._selectionInView):(t.setAttribute("selected",""),a._selectedTasks=[t],a._selectionStart=t,a._selectionInView=t.closest("smart-scroll-viewer"),a._focusTask(t));else{if(!e.ctrlKey&&!e.shiftKey||0===a._selectedTasks.length||t.closest("smart-scroll-viewer")!==a._selectionInView)return void s();if(e.ctrlKey)t.hasAttribute("selected")?(t.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter(e=>e!==t)):(t.setAttribute("selected",""),a._selectedTasks.push(t),a._selectionStart=t);else if(e.shiftKey){if(t===a._selectionStart)return void(a._selectedTasks.length>1&&s());const e=Array.from(t.parentElement.children);let l=e.indexOf(a._selectionStart),o=e.indexOf(t);const r=l;l=Math.min(l,o),o=Math.max(r,o),a._selectedTasks=[],e.forEach((e,t)=>{t>=l&&t<=o&&!e.filteredOut?(e.setAttribute("selected",""),a._selectedTasks.push(e)):e.removeAttribute("selected")})}a._focusTask(t)}a._autoSaveState("selection")}_processDataSource(){const e=this,t=e.dataSource;0!==e.columns.length&&null!==t&&(t.forEach(t=>{e._createTask(t)}),e.whenRendered(()=>e._allColumns.forEach(t=>e._refreshScrollViewer(t))))}_setUserList(){const e=document.createElement("div");e.id=this.id+"UserList",e.className="smart-kanban-list users smart-visibility-hidden",e.setAttribute("role","listbox"),this.disabled||this.unfocusable||(e.tabIndex=0),this.users.forEach(t=>{const a=document.createElement("div");a.className="item",a.innerHTML=`<div class="icon" style="background-image: url('${t.image}')"></div><div class="name">${t.name}</div>`,a.setAttribute("data-id",t.id),a.setAttribute("role","option"),e.appendChild(a)}),this._userList=e}_openList(e,t,a){const s=this.$.container.getBoundingClientRect(),l=e.getBoundingClientRect();let o,r,i=l.left,n=l.top+e.offsetHeight;a=this.rightToLeft?!a:a,1===window.devicePixelRatio?(o=document.documentElement.clientWidth,r=document.documentElement.clientHeight):(o=window.innerWidth,r=window.innerHeight),this.$.container.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)-s.left+"px",t.style.top=n-s.top+"px",t.classList.remove("smart-visibility-hidden"),e.setAttribute("aria-expanded",!0),e.setAttribute("aria-controls",t.id),this.unfocusable||requestAnimationFrame((function e(){0===t.getBoundingClientRect().height?requestAnimationFrame(e):t.focus()})),t.openedFrom=e}_openUserList(e,t){if(0===this.users.length)return;const a=t.data.userId,s=this._userList,l=s.querySelector(".selected");if(l&&(l.classList.remove("selected"),l.removeAttribute("aria-selected")),this._openList(e,s),null!==a){const e=Array.from(s.children).find(e=>e.getAttribute("data-id")===a.toString());e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),s.scrollTop=e.offsetTop)}this._userSelectionFor=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=document.createElement("div");e.id=this.id+"ActionsList",e.className="smart-kanban-list actions smart-visibility-hidden",e.setAttribute("role","menu"),this.disabled||this.unfocusable||(e.tabIndex=0),e.innerHTML=`<div class="item" data-id="0" role="menuitem"><div class="name">${this.localize("edit")}</div></div>\n<div class="item" data-id="1" role="menuitem"><div class="name">${this.localize("copy")}</div></div>\n<div class="item" data-id="2" role="menuitem"><div class="name">${this.localize("remove")}</div></div>`,this._actionsList=e}_openActionsList(e,t,a){const s=this._currentUser,l=this._actionsList;this._openList(e,l,a),l.classList.toggle("edit-comment",!!a),this._actionSelectionFor=t||a,l.firstElementChild.toggleAttribute("disabled",!(!t||s.allowEdit)),l.children[1].toggleAttribute("disabled",!(!t||s.allowAdd)),l.children[2].toggleAttribute("disabled",!(!t||s.allowRemove)),Array.from(l.children).forEach(e=>e.classList.remove("selected"))}_setCommentsList(){const e=document.createElement("div");e.id=this.id+"CommentsList",e.className="smart-kanban-list comments smart-visibility-hidden",e.setAttribute("role","dialog"),this.disabled||this.unfocusable||(e.tabIndex=0),e.innerHTML=`<div class="smart-kanban-comments" role="list"></div>\n<div class="smart-kanban-new-comment" role="presentation">\n    <textarea placeholder="${this.localize("newComment")}"></textarea>\n    <smart-button class="send primary" disabled${this._rtlAttr}>${this.localize("send")}</smart-button>\n</div>`;const t=e.querySelector("textarea"),a=e.querySelector("smart-button");t.onfocus=()=>{e.classList.add("expanded"),a.disabled=""===t.value},t.onblur=t=>{a.contains(t.relatedTarget)||e.classList.remove("expanded")},t.onkeyup=()=>{a.disabled=""===t.value},t.oncut=()=>{a.disabled=""===t.value},t.onpaste=()=>{a.disabled=""===t.value},e.textarea=t,e.button=a,this._commentsList=e}_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.comments.forEach(e=>a._createComment(e)),a._openList(e,s),a._commentSelectionFor=t}_createComment(e){const t=this,a=document.createElement("div");let s,l;if(e)l=t.users.find(t=>t.id===e.userId);else{const a=t._commentsList.textarea.value,o=t._commentsList.editing;if(o)return o.querySelector(".comment-body").innerHTML=a,o.comment.text=a,void delete t._commentsList.editing;const r=t._commentSelectionFor.data;s=!0,e={text:a,userId:t._currentUser.info.id,time:new Date},l=t._currentUser.info,r.comments.push(e),t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",r.comments.length||"")}if(!l)return;const o=t._commentsList.firstElementChild;a.classList="comment",a.setAttribute("role","listitem"),a.innerHTML=`<div class="comment-indent" role="presentation">\n    <div class="user-icon" style="background-image: url('${l.image}');" role="img" aria-label="Icon of user ${l.name||l.id}"></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">${l.name}</div>\n        <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n        <div class="remove-button${t._currentUser.info&&l.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}"${t._tabindex} role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n    </div>\n    <div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,a.comment=e,o.appendChild(a),s&&(o.scrollTop=o.scrollHeight-o.offsetHeight)}_createTask(e,t){const a=this._allColumns.find(t=>t.dataField===e.status);if(!a)return;const s=document.createElement("div"),l=this._columnToElement.get(a),o=this.getTaskScrollViewer(l,e);void 0===e.id&&(e.id=Math.floor(9e4*Math.random()+1e4)),s.className="smart-kanban-task smart-unselectable",s.setAttribute("role","listitem"),s.setAttribute("data-id",e.id),s.data=e,this._renderTask(s),e.class&&"string"==typeof e.class&&s.classList.add(e.class),o.appendChild(s),this._updateTaskColor(s),t&&(a.collapsed?o.toRefresh=!0:o.refresh())}getTaskScrollViewer(e,t){const a=this;let s;return a._hasSwimlane(e.index)?void 0!==t.swimlane&&a.swimlanes.find(e=>e.dataField===t.swimlane)?s=e.querySelector(`smart-scroll-viewer[swimlane="${t.swimlane}"]`):(s=e.querySelector("smart-scroll-viewer"),t.swimlane=s.getAttribute("swimlane")):(s=e.querySelector("smart-scroll-viewer"),delete t.swimlane),s}_renderTask(e){const t=this;t._applyTaskTemplate(e),t._updateUserIcon(e),t._updateTaskProgress(e),t._updateTaskChecked(e),t._updateTaskDueDate(e),e.parentElement&&t._updateTaskColor(e)}_applyTaskTemplate(e){const t=this,a=t.tags,s=e.data,l=t._tabindex;let o=s.text,r=s.tags,i="";void 0===o&&(o="",s.text=""),o=t._applyTextTemplate(o,s,e),r&&"string"==typeof r?(r=r.replace(/\s+/g,"").split(","),a.length>0?(r=r.filter(e=>-1!==a.indexOf(e)),s.tags=r.join(", ")):r.forEach(e=>{-1===t._customTags.indexOf(e)&&t._customTags.push(e)}),i=r.map(e=>`<span class="smart-kanban-task-tag" role="listitem">${e}</span>`).join("")):s.tags="","string"==typeof s.priority&&(s.priority=s.priority.toLowerCase()),"high"!==s.priority&&"low"!==s.priority&&(s.priority="normal"),s.comments&&Array.isArray(s.comments)||(s.comments=[]),e.innerHTML=`<div class="smart-kanban-task-content" role="presentation">\n    <div class="smart-kanban-task-text ${s.priority}">${o}</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-footer" role="toolbar" aria-label="Task footer">\n    <div class="smart-kanban-task-tags" role="list" aria-label="Tags list">${i}</div>\n    <div 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.comments.length||""}" role="button" aria-haspopup="dialog" aria-label="Open comments list"></div>\n</div>`,e.setAttribute("aria-label",s.text)}_applyTextTemplate(e,t,a){let s=this.textTemplate;if(!s)return e;let l="";if("function"==typeof s){const l={data:t,task:a,text:e,template:null};if(s(l),e=l.text,null===l.template)return e;s=l.template}if(s.startsWith("#")){const a=document.querySelector(s);if(a&&a instanceof HTMLTemplateElement){const s=a.content.cloneNode(!0),o=document.createElement("div");return o.appendChild(s),e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),l=o.innerHTML.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t.id),l.indexOf("{{text=")>=0&&(e?(l=l.substring(0,l.indexOf("{{text="))+e+l.substring(l.indexOf("}")),l=l.replace(/}/gi,""),l=l.replace(/{/gi,"")):(l=l.replace(/{{text=/gi,""),l=l.replace(/}}/gi,""))),l}}return l=s.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t.id),l}_updateUserIcon(e){const t=e.data,a=e.getElementsByClassName("smart-kanban-task-user")[0];if(void 0!==t.userId&&null!==t.userId){const e=this.users.find(e=>e.id===t.userId);if(e)return a.classList.remove("empty"),a.style.backgroundImage='url("'+e.image+'")',void a.setAttribute("aria-label","Icon of user "+(e.name||e.id))}t.userId=null,a.classList.add("empty"),a.style.backgroundImage=null,a.setAttribute("aria-label","Empty user icon")}_updateTaskProgress(e){const t=e.data,a=e.querySelector(".smart-kanban-task-progress");let s=t.progress;return void 0===s?(t.progress=null,void a.setAttribute("aria-valuenow",0)):(s=parseFloat(s),isNaN(s)?(t.progress=null,void a.setAttribute("aria-valuenow",0)):(s=Math.max(0,Math.min(parseFloat(s),100)),t.progress=s,a.style.width=s+"%",a.classList.toggle("bottom",void 0!==t.checklist),void a.setAttribute("aria-valuenow",s)))}_updateTaskChecked(e){const t=e.data,a=t.checklist,s=e.querySelector(".smart-kanban-task-checked");a&&Array.isArray(a)&&a.length>0?s.innerHTML=this._getCompletedSubTasks(a):(t.checklist=null,s.innerHTML="")}_getCompletedSubTasks(e){if(null===e)return"";let t=0;return e.forEach(e=>e.completed&&t++),t+"/"+e.length}_updateTaskDueDate(e){const t=e.data,a=t.dueDate,s=e.querySelector(".smart-kanban-task-due");a?(s.innerHTML=new Smart.Utilities.DateTime(a).toString(this.formatStringDate),s.classList.toggle("overdue",a.getTime()<(new Date).getTime()&&100!==t.progress)):(t.dueDate=null,s.innerHTML="",s.classList.remove("overdue")),t.startDate||(t.startDate=null)}_updateTaskColor(e){const t=this,a=e.data,s=e.querySelector(".smart-kanban-task-progress-container"),l=e.querySelector(".smart-kanban-task-progress"),o=t.rightToLeft?"borderRightColor":"borderLeftColor";function r(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,a.color){e.style[o]=a.color;const n=getComputedStyle(e)[o],c="dark"===t.theme?.4:.1;a.color=(i=(i=n).match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+r(i[1])+r(i[2])+r(i[3]):null,s.style.backgroundColor=`rgba(${n.slice(4,n.length-1)}, ${c})`,l.style.backgroundColor=n}else a.color=null,s.style.backgroundColor=null,l.style.backgroundColor=null;var i}_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],c=i[i.length-1];if(t.rightToLeft){let e=n;n=c,c=e}const d=n.getBoundingClientRect(),m=i.length>1?c.getBoundingClientRect():d,u=Array.from(n.getElementsByTagName("smart-scroll-viewer"));let h,b,p,g,f=!1,_=!0,v=t.swimlanesTo;null===v&&(v=s.length-1),e&&(h=o.getElementsByClassName("swimlane")),n.column.collapsed&&(n.classList.remove("collapsed"),f=!0);for(let e=t.swimlanesFrom;e<=v;e++)_=_&&s[e].collapsed;_||(b=m.right-d.left+"px",p=d.left-r.left+"px",g=u.map(e=>e.getBoundingClientRect().top-r.top-l-t._dataViewPadding+"px")),a.forEach((t,a)=>{let s;e?s=h[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",_),_||(s.style.width=b,s.style.left=p,s.style.top=g[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;if(e._columnToElement=new Map,e._columnContainers=[],0===o.length){const t=e.dataSource;t&&0!==t.length&&(o=[],t.forEach(e=>{const t=e.status;t&&-1===o.indexOf(t)&&o.push(t)}))}!function e(a,s,l){const o=[];let r=0;if(a.forEach(a=>{"string"==typeof a&&(a={dataField:a,label:a}),(a.dataField||a.label)&&(a.label||(a.label=a.dataField),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),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),e.columns=a,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")}_createColumnElements(e,t,a,s){const l=this,o=l.id,r=[],i=[];let n=0;return e.forEach((a,c)=>{const d=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>`,u=0;if(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","")),d.className="smart-kanban-column",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${o}ColumnHeaderLabel${a.dataField}`),d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),d.innerHTML=m,d.siblingColumns=e,t.appendChild(d),d.column=a,d.index=c,l._columnToElement.set(a,d),a.columns){const e=d.querySelector(".smart-kanban-column-content-columns");u=l._createColumnElements(a.columns,e,e,s+1),n+=u}else n+=1;const h=(u||1)+"fr";a.collapsed?(d.classList.add("collapsed"),r.push("auto")):r.push(h),i.push(h),l._allColumns.push(a)}),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=[];e.forEach((a,n)=>{const c=document.createElement("div");let d=`<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?(d=d.replace("AAA",""),d=d.replace("BBB",'<div class="smart-kanban-column-content-columns has-tabs" role="presentation"></div>')):(d=d.replace("AAA"," no-sub-columns"),d=d.replace("BBB","")),c.className="smart-kanban-column",c.setAttribute("orientation",a.orientation),a.collapsible&&c.setAttribute("collapsible",""),a.addNewButton&&c.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",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=c,c.id=r,c.setAttribute("role","tabpanel"),c.setAttribute("aria-labelledby",t),c.tab=e,s.appendChild(e),a.selected?e.classList.add("selected"):c.classList.add("smart-hidden"),e.setAttribute("aria-selected",a.selected)}else d=l._getColumnHeader(a,n<e.length-1)+d,c.setAttribute("role","group"),c.setAttribute("aria-labelledby",`${o}ColumnHeaderLabel${a.dataField}`);if(c.innerHTML=d,c.siblingColumns=e,t.appendChild(c),c.column=a,c.index=n,l._columnToElement.set(a,c),a.columns){const e=c.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?(c.classList.add("collapsed"),r.push("auto")):r.push("1fr"),i.push("1fr")),l._allColumns.push(a)}),s||(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=[];e.forEach((a,n)=>{const c=document.createElement("div");let d=`${s._getColumnHeader(a,n<e.length-1)}\n                <div class="smart-kanban-column-content no-sub-columns" role="presentation"></div>`;c.className="smart-kanban-column",c.setAttribute("role","group"),c.setAttribute("aria-labelledby",`${l}ColumnHeaderLabel${a.dataField}`),c.setAttribute("orientation",a.orientation),a.collapsible&&c.setAttribute("collapsible",""),a.addNewButton&&c.setAttribute("add-new-button",""),c.innerHTML=d,c.siblingColumns=e;const m=c.children[1];let u="";if(s._hasSwimlane(n)){let e=[];for(let t=0;t<o.length;t++)u+=`<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");c.classList.add("has-swimlane"),m.classList.add("has-swimlane"),m.style.gridTemplateRows=e.join(" ")}else u=`<smart-scroll-viewer class="smart-kanban-column-content-tasks"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`;m.innerHTML=u,t.appendChild(c),c.column=a,c.index=n,s._columnToElement.set(a,c),a.collapsed?(c.classList.add("collapsed"),r.push("auto")):r.push("1fr"),i.push("1fr"),s._allColumns.push(a)}),a.style.gridTemplateColumns=r.join(" "),a.fractions=i,s._columnContainers.push(a)}_getColumnHeader(e,t,a=1){const s=this._tabindex;return`<div class="smart-kanban-column-header smart-unselectable"${s} role="heading" aria-level=${a}>\n                    <div class="smart-kanban-column-header-add"${s} role="button" aria-label="Add new task"></div>\n                    <div id="${this.id}ColumnHeaderLabel${e.dataField}" class="smart-kanban-column-header-label">${e.label}</div>\n                    <div class="smart-arrow smart-arrow-${t?"left":"right"}" 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=t.fractions,s=[];for(let t=0;t<e.length;t++)s.push(e[t].collapsed?"auto":a[t]);t.style.gridTemplateColumns=s.join(" ")}_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(){const e=this;clearTimeout(e._resizeTimeout),e._resizeTimeout=setTimeout((function(){e._allColumns.forEach(t=>e._refreshScrollViewer(t))}),50),e._handleSwimlanes(!0)}_refreshScrollViewer(e,t){const a=this,s=e instanceof HTMLElement?e:this._columnToElement.get(e);function l(l,o){(t||""!==l.$.scrollViewerContentContainer.innerHTML.trim())&&(e.collapsed?l.toRefresh=!0:(delete l.toRefresh,requestAnimationFrame(()=>l.refresh()),0===o&&"horizontal"===e.orientation&&(l.$.content.offsetWidth<=2*a._kanbanTaskMinWidth+a._dataViewPadding?s.setAttribute("orientation","vertical"):"vertical"===s.getAttribute("orientation")&&s.setAttribute("orientation","horizontal"))))}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).closest(".smart-kanban-task");delete t._preventSelection,a&&(t._focusTask(a),t._startDragging(a,e))}_containerKeydownHandler(e){const t=this;if(t._dragDetails)return;const a=e.key,s=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target,l=s.closest(".smart-kanban-column");function o(a=s){delete t._preventSelection,t._documentUpHandler({originalEvent:{target:a}}),t._containerClickHandler({target:a,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey}),e.preventDefault()}if(l){l.column;return s.classList.contains("smart-kanban-column-content-tasks")?void t._selectViaKeyboard(s.$.content,e,o):void("Enter"!==a&&" "!==a||o())}if(t.$.headerDropDown.contains(s))"Escape"===a&&(t.closePanel(),t.$[/\s?([a-z]+)-panel/g.exec(kanbanHeaderDropDown.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||o(),s.classList.contains("smart-kanban-list")){const l=s;switch(a){case"ArrowDown":t._selectListItem(t._getNextItem(l));break;case"ArrowUp":t._selectListItem(t._getPrevItem(l));break;case"Home":t._selectListItem(t._getFirstItem(l));break;case"End":t._selectListItem(t._getLastItem(l));break;case"Escape":l.openedFrom.focus(),t._closeList(l,l===t._actionsList?"_actionSelectionFor":l===t._commentsList?"_commentSelectionFor":"_userSelectionFor");break;case"Enter":case" ":const e=t._getSelectedItem(l);e&&o(e);break;default:return}e.preventDefault()}else;}_selectViaKeyboard(e,t,a){const s=this,l=t.key;switch(s.rightToLeft&&("ArrowRight"===l?l="ArrowLeft":"ArrowLeft"===l&&(l="ArrowRight")),l){case"ArrowDown":case"ArrowRight":s._focusTask(s._getNextItem(e,!0));break;case"ArrowUp":case"ArrowLeft":s._focusTask(s._getPrevItem(e,!0));break;case"Home":s._focusTask(s._getFirstItem(e));break;case"End":s._focusTask(s._getLastItem(e));break;case"Enter":case" ":case"F2":case"Delete":const t=s._getSelectedItem(e,!0);t&&("F2"===l?s.beginEdit(t):"Delete"===l?s.removeTask(t,!0):a(t));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 t?e.querySelector("[focus]"):e.querySelector(".selected")}_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;Array.from(e.parentElement.querySelectorAll("[focus]")).forEach(e=>e.removeAttribute("focus")),e.setAttribute("focus",""),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"))),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];a._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:o,Item:e,FeedbackShown:!1,OriginalEvent:t,PointerOffset:[l.x-t.clientX,l.y-t.clientY],ScrollViewer:s,StartTime:new Date,Dragging:!0},Smart.Kanban.kanbanTaskDragged=!0,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(!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"))}let l,o=t.dragOffset;if(o="auto"!==o&&Array.isArray(o)?o:a.PointerOffset,t.$.fireEvent("dragging",{item:a.Item,items:a.Items,data:a,originalEvent:e}),a.Feedback.style.left=e.pageX+(o[0]||0)+"px",a.Feedback.style.top=e.pageY+(o[1]||0)+"px",Smart.Kanban.hoveredKanban&&(clearInterval(Smart.Kanban.hoveredKanban._dragInterval),delete Smart.Kanban.hoveredKanban),Smart.Kanban.hoveredItem&&(Smart.Kanban.hoveredItem.classList.remove("drop-target"),Smart.Kanban.hoveredItem.classList.remove("before","after"),delete Smart.Kanban.hoveredItem),l=t._isMobile?(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY):t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,!l)return;const r=(t.shadowRoot?l.getRootNode().host:l).closest("smart-kanban");if(!r||!r.allowDrop)return;const i=l.closest(".smart-kanban-column-content-tasks");if(Smart.Kanban.hoveredKanban=r,!i)return;const n=i.parentElement.parentElement.getAttribute("orientation"),c=Array.from(i.$.content.children);let d=0;if(c.forEach(e=>e.filteredOut&&d++),0===c.length||c.length===d)return Smart.Kanban.hoveredItem=i.$.scrollViewerContainer,void Smart.Kanban.hoveredItem.classList.add("drop-target");i.scrollHeight>0&&(r._dragInterval=setInterval((function(){const a=i.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientY>=a.top&&e.clientY<=a.top+20?i.scrollTop-=t._autoScrollCoefficient:e.clientY>=a.top+a.height-20&&e.clientY<=a.top+a.height?i.scrollTop+=t._autoScrollCoefficient:clearInterval(r._dragInterval):clearInterval(r._dragInterval)}),2));let m=l.closest(".smart-kanban-task");if(m&&-1===a.Items.indexOf(m)){const t=m.getBoundingClientRect();"vertical"===n&&e.clientY-t.top<=t.height/2||"horizontal"===n&&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[`_${n}ClosestTaskToHover`]([m.previousElementSibling,m.nextElementSibling],e,!0):t[`_${n}ClosestTaskToHover`](c,e,m||l===i.$.content)}m&&(m.classList.add("drop-target"),Smart.Kanban.hoveredItem=m)}_hideBodyOverflow(){const e=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,t=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth;this._originalBodyOverflow={overflowX:document.body.style.overflowX,overflowY:document.body.style.overflowY,overflow:document.body.style.overflow},document.body.classList.add("smart-dragging"),document.body.style.overflow=document.body.style.overflowX=document.body.style.overflowY="",e&&!t?document.body.style.overflowX="hidden":t&&!e?document.body.style.overflowY="hidden":t||e||(document.body.style.overflow="hidden")}_verticalClosestTaskToHover(e,t,a){const s=this._dragDetails.Items,l=t.clientY;let o,r,i=1/0,n=0,c=e.length-1,d=1;for(a||(n=c,c=0,d=-1);n!==c+d;){const t=e[n];if(n+=d,!t||t.filteredOut||-1!==s.indexOf(t))continue;if(!a){o=t,r="after";break}const c=t.getBoundingClientRect(),m=c.top+c.height/2,u=Math.abs(l-m);if(!(u<i))break;i=u,o=t,r=l<=m?"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),c=Math.abs(s-t.bottom),d=Math.min(n,c),m=Math.abs(l-t.left),u=Math.abs(l-t.right),h=Math.min(m,u),b=Math.sqrt(Math.pow(h,2)+Math.pow(d,2));(void 0===r||b<r)&&(o=e,r=b,i=m<u?"before":"after")}),o&&o.classList.add(i),o}_scrollViewerTouchmoveHandler(e){this._dragDetails&&(this.isInShadowDOM||this.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.$.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._actionSelectionFor&&!t._actionsList.contains(s)&&t._closeList(t._actionsList,"_actionSelectionFor"),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._scrollView.disableSwipeScroll=!1,!a.FeedbackShown)return;const i=o||(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY);t._preventSelection=!0,document.body.classList.remove("smart-dragging"),document.body.style.overflow=t._originalBodyOverflow.overflow,document.body.style.eoverflowX=t._originalBodyOverflow.overflowX,document.body.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,document.body.removeChild(a.Feedback),o&&clearInterval(o._dragInterval);const n=a.Item,c=a.Items;if(c.forEach(e=>e.classList.remove("dragged")),!i)return;if(!r)return void t.$.fireEvent("dragEnd",{item:n,items:c,target:i,data:a,previousContainer:t,container:i,originalEvent:e});if(!o||!o.allowDrop||o.disabled)return;let d=!1;r.classList.remove("drop-target"),r.classList.contains("before")?r.classList.remove("before"):r.classList.contains("after")&&(r.classList.remove("after"),d=!0),a.DropDetails={item:r,after:d},t.$.fireEvent("dragEnd",{item:n,items:c,target:r,data:a,previousContainer:t,container:o,originalEvent:e}).defaultPrevented||t._moveDraggedItems(a)}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=e._dragDetails.Items.length,s=document.createElement("div"),l=t.cloneNode(!0),o=t.offsetWidth+"px",r=t.offsetHeight+"px";if(l.style.width=o,l.style.height=r,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(l),a>1){const e=document.createElement("div");e.style.width=o,e.style.height=r,e.className="smart-kanban-feedback-additional",s.insertBefore(e,l),l.setAttribute("num",a),a>2&&e.classList.add("multiple")}return document.body.appendChild(s),s}_moveDraggedItems(e){const t=this;let a,s=e.DropDetails,l=s.item,o=l.closest(".smart-kanban-column"),r=e.Item.closest("smart-scroll-viewer"),i=o.column;if(l.classList.contains("smart-kanban-task")?(a=l.parentElement,s.after&&(l=l.nextElementSibling),e.Items.forEach(e=>{a.insertBefore(e,l),e.data.status=i.dataField})):(a=l.firstElementChild,e.Items.forEach(e=>{a.appendChild(e),e.data.status=i.dataField})),a=a.closest("smart-scroll-viewer"),t.swimlanes.length>0){const t=a.getAttribute("swimlane");t?e.Items.forEach(e=>e.data.swimlane=t):e.Items.forEach(e=>delete e.data.swimlane)}t._focusTask(e.Item),r!==a&&(a.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(r,!0),t._refreshScrollViewer(a,!0)),t._autoSaveState("dataSource")}_getCurrentDataSource(){const e=Array.from(this.$.container.getElementsByClassName("smart-kanban-task")),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;s._dialog||s._createDialog();const o=s._dialog,r="prompt"===t;if(o.openedFrom=(s.shadowRoot||s.getRootNode()).activeElement,o.classList.toggle("prompt",r),o.classList.toggle("edit",!r),o.taskOrComment=e,r){const t="task"===a?s.localize("promptTask",{taskText:e.data.text}):s.localize("promptComment");o.setAttribute("aria-label",t),o.headerPosition="none",o.$.container.querySelector(".prompt").innerHTML=t}else o.removeAttribute("aria-label"),o.headerPosition="top",o.label=s.localize("editTask",{taskId:e.id}),o.editPanelPopulated||s._populateEditPanel(),s._beginEdit(e);s.$.container.setAttribute("modal",""),o.open()}_createDialog(){const e=document.createElement("smart-window"),t=document.createElement("template");t.innerHTML=`<smart-button class="ok primary"${this._rtlAttr}>${this.localize("ok")}</smart-button>\n<smart-button class="cancel"${this._rtlAttr}>${this.localize("cancel")}</smart-button>`,e.animation=this.animation,e.footerTemplate=t,e.headerButtons=["close"],e.rightToLeft=this.rightToLeft,e.theme=this.theme,e.className="smart-kanban-window",e.innerHTML='<div class="prompt"></div>\n<div class="edit"></div>',e.ownerElement=this,this._dialog=e,this._addDialogHandlers(),document.body.appendChild(e)}_addDialogHandlers(){const e=this._dialog;e.addEventListener("open",this._dialogEventHandler),e.addEventListener("closing",this._dialogEventHandler),e.addEventListener("close",this._dialogEventHandler),e.addEventListener("click",this._dialogClickHandler)}_dialogEventHandler(e){const t=this,a=t.ownerElement,s=e.type,l=a.context;if((t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target)===t){if(a.context=a,"open"===s)a.$.fireEvent("open");else if("closing"===s){a.$.fireEvent("closing").defaultPrevented&&(e.preventDefault(),delete t.ok)}else"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(".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}else a.classList.contains("remove-subtask")&&t.editors.checklist.removeChild(a.closest("smart-list-item"))}_dialogCloseHandler(){const e=this,t=e._dialog;if(e.$.container.removeAttribute("modal"),t.ok){if(t.classList.contains("prompt")){const a=e._commentSelectionFor;if(a){const s=a.data;s.comments=s.comments.filter(e=>e!==t.taskOrComment.comment),t.taskOrComment.remove(),a.querySelector(".smart-kanban-task-comments").setAttribute("num",s.comments.length||""),e._commentsList.editing&&(e._commentsList.textarea.value="",delete e._commentsList.editing)}else e.removeTask(t.taskOrComment)}else e._endEdit();delete t.ok}t.openedFrom&&requestAnimationFrame(()=>{e.getRootNode().contains(t.openedFrom)&&t.openedFrom.focus&&t.openedFrom.focus(),delete t.openedFrom}),delete t.taskOrComment}_closeDialog(){const e=this;e._dialog&&e._dialog.close()}_populateEditPanel(){const e=this.id,t=this._dialog,a=t.$.container.querySelector(".edit"),s=this.users.map(e=>({label:e.name,value:e.id})),l=this._allColumns.map(e=>({label:e.label,value:e.dataField})),o=[{label:this.localize("low"),value:"low"},{label:this.localize("normal"),value:"normal"},{label:this.localize("high"),value:"high"}],r=this.swimlanes.map(e=>({label:e.label,value:e.dataField})),i=document.createElement("template"),n=` animation="${this.animation}"${this._rtlAttr} theme="${this.theme}"${this.unfocusable?" unfocusable":""}`;i.innerHTML=`<div class="smart-kanban-sub-task"><span class="label">{{label}}</span><span class="remove-subtask" aria-label="Remove subtask" title="${this.localize("removeSubtask")}"></span></div>`,i.id=this.id+"ChecklistTemplate",t.$.container.appendChild(i),a.innerHTML=`<div id="${e}LabelText" class="editor-label">${this.localize("text")}</div>\n<textarea class="editor text-editor" aria-labelledby="${e}LabelText"></textarea>\n<div id="${e}LabelTags" class="editor-label">${this.localize("tags")}</div>\n<smart-combo-box class="editor tags-editor" selection-mode="zeroOrMany" selection-display-mode="tokens"${n} aria-labelledby="${e}LabelTags"></smart-combo-box>\n<div class="editor-container">\n    <div id="${e}LabelStatus" class="editor-label">${this.localize("status")}</div>\n    <div id="${e}LabelSwimlane" class="editor-label">${this.localize("swimlane")}</div>\n    <smart-input class="editor status-editor" data-source='${JSON.stringify(l)}' drop-down-button-position="right" readonly${n} aria-labelledby="${e}LabelStatus"></smart-input>\n    <smart-input class="editor swimlane-editor" data-source='${JSON.stringify(r)}'${0===r.length?" disabled":""} drop-down-button-position="right" readonly${n} aria-labelledby="${e}LabelSwimlane"></smart-input>\n</div>\n<div class="editor-container">\n    <div id="${e}LabelAssignedTo" class="editor-label">${this.localize("assignedTo")}</div>\n    <div id="${e}LabelProgress" class="editor-label">${this.localize("progress")}</div>\n    <smart-input class="editor asignee-editor" data-source='${JSON.stringify(s)}'${0===s.length?" disabled":""} drop-down-button-position="right"${n} aria-labelledby="${e}LabelAssignedTo"></smart-input>\n    <smart-numeric-text-box class="editor progress-editor" input-format="floatingPoint" min="0" max="100" show-unit unit="%"${n} aria-labelledby="${e}LabelProgress"></smart-numeric-text-box> \n</div>\n<div class="editor-container">\n    <div id="${e}LabelStartDate" class="editor-label">${this.localize("startDate")}</div>\n    <div id="${e}LabelDueDate" class="editor-label">${this.localize("dueDate")}</div>\n    <smart-date-time-picker class="editor start-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${this.formatStringDate}" nullable${n} aria-labelledby="${e}LabelStartDate"></smart-date-time-picker>\n    <smart-date-time-picker class="editor due-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${this.formatStringDate}" nullable${n} aria-labelledby="${e}LabelDueDate"></smart-date-time-picker>\n</div>\n<div class="editor-container">\n    <div id="${e}LabelPriority" class="editor-label">${this.localize("priority")}</div>\n    <div id="${e}LabelColor" class="editor-label">${this.localize("color")}</div>\n    <smart-input class="editor priority-editor" data-source='${JSON.stringify(o)}' drop-down-button-position="right" readonly${n} aria-labelledby="${e}LabelPriority"></smart-input>\n    <smart-color-input class="editor color-editor" drop-down-button-position="right"${n} aria-labelledby="${e}LabelColor"></smart-color-input>\n</div>\n<div id="${e}LabelChecklist" class="editor-label">${this.localize("checklist")}</div>\n<div class="new-container">\n    <input type="text" class="new-subtask" placeholder="${this.localize("newSubtask")}" />\n    <smart-button class="add primary" title="${this.localize("addSubtask")}" aria-label="Add subtask"${n}>+</smart-button>\n</div>\n<smart-list-box class="editor checklist-editor" item-template="${i.id}" selection-mode="checkBox"${n} aria-labelledby="${e}LabelChecklist"></smart-list-box>`,t.editors={text:a.querySelector(".text-editor"),tags:a.querySelector(".tags-editor"),userId:a.querySelector(".asignee-editor"),status:a.querySelector(".status-editor"),swimlane:a.querySelector(".swimlane-editor"),startDate:a.querySelector(".start-date-editor"),dueDate:a.querySelector(".due-date-editor"),progress:a.querySelector(".progress-editor"),priority:a.querySelector(".priority-editor"),color:a.querySelector(".color-editor"),newSubtask:a.querySelector(".new-subtask"),checklist:a.querySelector(".checklist-editor")},t.editPanelPopulated=!0}_beginEdit(e){const t=this,a=e.data,s=t._dialog,l=s.editors,o=t.tags.length>0?t.tags:t._customTags,r=t._allColumns.find(e=>e.dataField===a.status);s.label=t.localize("editTask",{taskId:a.id}),l.text.value=a.text,l.tags.dataSource=o,l.tags.disabled=0===o.length,a.tags?l.tags.selectedValues=a.tags.replace(/\s+/g,"").split(","):l.tags.selectedValues=[],l.userId.value=null!==a.userId?t.users.find(e=>e.id===a.userId).name:"",delete l.userId.$.input.dataValue,l.status.value=r.label,delete l.status.$.input.dataValue,t._hasSwimlane(t.columns.indexOf(r))?l.swimlane.value=t.swimlanes.find(e=>e.dataField===a.swimlane).label:l.swimlane.value="",delete l.swimlane.$.input.dataValue,l.startDate.value=a.startDate||null,l.dueDate.value=a.dueDate||null,l.progress.value=parseFloat(a.progress)||0,l.priority.value=t.localize(a.priority),delete l.priority.$.input.dataValue,l.color.value=a.color||"";const i=[],n=[];(a.checklist||[]).forEach((e,t)=>{e.completed&&i.push(t),n.push({label:e.text,selected:!0===e.completed})}),l.newSubtask.value="",l.checklist.dataSource=n,l.checklist.selectedIndexes=i}_endEdit(){const e=this._dialog,t=e.editors,a=e.taskOrComment,s=a.data,l=Object.assign({},s);let o,r=t.startDate.value,i=t.dueDate.value;l.text=t.text.value,l.tags=t.tags.selectedValues.join(", "),l.progress=parseFloat(t.progress.value),l.color=t.color.value,l.color||delete l.color,void 0!==t.userId.$.input.dataValue&&(l.userId=parseFloat(t.userId.$.input.dataValue)),t.status.$.input.dataValue&&(o=t.status.$.input.dataValue),t.swimlane.$.input.dataValue&&(l.swimlane=t.swimlane.$.input.dataValue),r&&(r=r.toDate()),i&&(i=i.toDate()),l.startDate=r,l.dueDate=i,t.priority.$.input.dataValue&&(l.priority=t.priority.$.input.dataValue),l.checklist=t.checklist.items.map(e=>({text:e.label,completed:e.selected})),this.updateTask(a,l)}_getCurrentUser(){const e=this.users;let t=this.currentUser,a=!0,s=!1,l=this.allowDrag,o=this.editable,r=!0;e&&null!==t&&(t=e.find(e=>e.id===t),t&&(a=!1!==t.allowAdd,s=!1!==t.allowComment,l=l&&!1!==t.allowDrag,o=o&&!1!==t.allowEdit,r=!1!==t.allowRemove)),this._currentUser={allowAdd:a,allowComment:s,allowDrag:l,allowEdit:o,allowRemove:r,info:t}}_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;case"selection":{let e=null,a=null;t._selectionInView&&(e=t._selectionInView.closest(".smart-kanban-column").column.dataField,a=t._selectionInView.getAttribute("swimlane")),t._autoSavedState.selection={selected:t._selectedTasks.map(e=>e.data.id),selectionStart:t._selectionStart?t._selectionStart.data.id:null,selectionInColumn:e,swimlane:a};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}_applyFilter(e,t){const a=this,s=new Smart.DataAdapter({dataSource:a._getCurrentDataSource(),dataFields:["text: string","tags: string","priority: string","progress: number","startDate: date","dueDate: date","userId: string"],id:"id"});try{s._filter(e,t)}catch(e){return}const l=Array.from(a.$.container.getElementsByClassName("smart-kanban-task"));for(let e=0;e<s.length;e++){const t=l[e],a=!s[e].$.filtered;t.classList.toggle("smart-hidden",a),t.filteredOut=a}a._allColumns.forEach(e=>a._refreshScrollViewer(e)),a._autoSaveState("filtering")}_applyHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target,s=e.detail;t.$.customize.contains(a)?(s.value.forEach(e=>t[e.dataField]=e.visible),t._allColumns.forEach(e=>t._refreshScrollViewer(e)),t._autoSaveState("visibility")):t.$.filter.contains(a)?t.addFilter(s.filters,s.operator,s.value):t.$.sort.contains(a)&&t.addSort(s.sortByInfo),t.closePanel()}_applySort(){const e=this,t=e._appliedSorting;e._autoSaveState("sorting"),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;l.forEach((e,t)=>{const a=Object.assign({taskIndex:t},e.data);"low"===a.priority&&(a.priority="z"),o.push(a)});const r=new Smart.DataAdapter({dataSource:o,dataFields:["taskIndex: number","text: string","tags: string","priority: string","progress: number","startDate: date","dueDate: date","userId: string"],id:"id"});r.sortBy(t.dataFields,t.dataTypes,t.orderBy);for(let e=0;e<r.length;e++)s.appendChild(l[r[e].taskIndex])})}_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 a=e.data.id;if(r[a]){if(e.filteredOut)return o.splice(o.indexOf(a),1),void delete r[a];t&&o[0]===a&&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"))return;a=a.$.content,t._getSelectedItem(a,!0)||t._focusTask(t._getFirstItem(a))}get _rtlAttr(){return this.rightToLeft?" right-to-left":""}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}})}});