text: 
  /* Smart HTML Elements v7.4.0 (2020-Apr) 
  Copyright (c) 2011-2020 jQWidgets. 
  License: https://htmlelements.com/license/ */ //
  
  !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=96)}({96:function(e,t){Smart("smart-tree-item",class extends Smart.MenuItem{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){Object.defineProperty(this,"hasStyleObserver",{get:function(){return!1}}),super.ready(),this.setAttribute("role","treeitem"),this.setAttribute("aria-label",this.label)}propertyChangedHandler(e,t,r){const n=this,o=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!o)return;const l=o.context;switch(o.context=o,e){case"label":{const e=o.sorted&&o.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(o._unsortItems(o.$.mainContainer),o._applyGrouping(o.$.mainContainer)),o._state.filter&&o._applyFilter(o._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?o.select(n):o.unselect(n);break;case"shortcut":{let e=n.firstElementChild.children[1];e||(e=document.createElement("div"),e.className="smart-tree-item-shortcut",n.firstElementChild.appendChild(e)),e.innerHTML=r;break}case"value":o.sort&&o.sorted&&o.autoSort&&o._refreshSorting()}o.context=l}_setId(){}}),Smart("smart-tree-items-group",class extends Smart.MenuItemsGroup{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){Object.defineProperty(this,"hasStyleObserver",{get:function(){return!1}}),super.ready(),this.setAttribute("role","treeitem"),this.removeAttribute("aria-haspopup"),this.setAttribute("aria-label",this.label)}propertyChangedHandler(e,t,r){const n=this,o=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!o)return;const l=o.context;switch(o.context=o,e){case"expanded":n.expanded=t,r?o.expandItem(n):o.collapseItem(n);break;case"label":{const e=o.sorted&&o.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(o._unsortItems(o.$.mainContainer),o._applyGrouping(o.$.mainContainer)),o._state.filter&&o._applyFilter(o._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?o.select(n):o.unselect(n);break;case"value":o.sort&&o.sorted&&o.autoSort&&o._refreshSorting()}o.context=l}_setId(){}}),Smart("smart-tree",class extends Smart.Menu{static get properties(){return{allowDrag:{value:!1,type:"boolean"},allowDrop:{value:!1,type:"boolean"},autoHideToggleElement:{value:!1,type:"boolean"},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},autoSort:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},dragFeedbackFormatFunction:{value:null,type:"function?"},dragOffset:{value:[10,10],type:"array"},editable:{value:!1,type:"boolean"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},hasThreeStates:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{value:{en:{noId:"smart-tree: Saving and loading the element's state are not available if the element has no id."}},type:"object",extend:!0},scrollMode:{value:"scrollbar",allowedValues:["scrollbar","scrollButtons"],type:"string"},selectedIndexes:{value:[],type:"array"},selectionDisplayMode:{value:"row",allowedValues:["row","label"],type:"string"},selectionMode:{value:"one",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","one","checkBox","radioButton"],type:"string"},showLines:{value:!1,type:"boolean"},showRootLines:{value:!1,type:"boolean"},sort:{value:null,type:"function?"},sortDirection:{value:"asc",allowedValues:["asc","desc"],type:"string"},sorted:{value:!1,type:"boolean"},toggleElementPosition:{value:"near",allowedValues:["near","far"],type:"string"},toggleMode:{value:"dblclick",allowedValues:["click","dblclick","arrow"],type:"string"}}}static get listeners(){return{blur:"_blurHandler",focus:"_focusHandler",keydown:"_keydownHandler",mouseenter:"_mouseenterHandler",mouseleave:"_mouseleaveHandler",resize:"_checkOverflow",styleChanged:"_styleChangedHandler",transitionend:"_overriddenMenuHandler","container.click":"_overriddenMenuHandler","container.mouseout":"_overriddenMenuHandler","container.mouseover":"_overriddenMenuHandler","editInput.blur":"_editInputBlurHandler","filterInput.keydown":"_filterInputKeydownHandler","filterInput.keyup":"_filterInputKeyupHandler","mainContainer.click":"_overriddenMenuHandler","mainContainer.mouseleave":"_overriddenMenuHandler","mainContainer.mouseout":"_overriddenMenuHandler","mainContainer.mouseover":"_overriddenMenuHandler","mainContainer.swipeleft":"_mainContainerSwipeHandler","mainContainer.swiperight":"_mainContainerSwipeHandler","scrollButtonFar.click":"_scrollButtonFarClickHandler","scrollButtonNear.click":"_scrollButtonNearClickHandler","scrollViewer.down":"_scrollViewerDownHandler","scrollViewer.kineticScroll":"_scrollViewerWheelHandler","scrollViewer.touchmove":"_scrollViewerTouchmoveHandler","mainContainer.wheel":"_scrollViewerWheelHandler","document.move":"_moveHandler","document.selectstart":"_selectstartHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}static get styleUrls(){return["smart.scrollbar.css","smart.scrollviewer.css","smart.tree.css"]}template(){return'<div id="container" role="presentation">\n                    <div class="smart-tree-filter-input-container" role="presentation"><input id="filterInput" class="smart-filter-input" disabled="[[disabled]]" placeholder="[[filterInputPlaceholder]]" type="text" role="searchbox" aria-label="[[filterInputPlaceholder]]" /></div>\n                    <smart-repeat-button id="scrollButtonNear" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll up">\n                        <div id="arrowNear" class="smart-arrow smart-arrow-up"></div>\n                    </smart-repeat-button>\n                    <smart-scroll-viewer id="scrollViewer" animation="[[animation]]" horizontal-scroll-bar-visibility="hidden" right-to-left="[[rightToLeft]]">\n                        <div id="mainContainer" class="smart-tree-main-container" role="presentation">\n                            <content></content>\n                        </div>\n                        <input type="text" id="editInput" class="smart-tree-edit-input smart-hidden" />\n                    </smart-scroll-viewer>\n                    <smart-repeat-button id="scrollButtonFar" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll down">\n                        <div id="arrowFar" class="smart-arrow smart-arrow-down"></div>\n                    </smart-repeat-button>\n                    <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" role="presentation">\n                        <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n                        <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n                    </div>\n                </div>'}detached(){const e=this._dragDetails;if(super.detached(),!e)return;const t=Smart.Tree.hoveredTree,r=Smart.Tree.hoveredItem;delete this._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,this.$.scrollViewer._scrollView.disableSwipeScroll=!1,e.FeedbackShown&&(r.classList.remove("drop-target","top","bottom"),document.body.classList.remove("smart-dragging"),e.Feedback.remove(),t&&clearInterval(t._dragInterval))}addAfter(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t,!0)}addBefore(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t)}addTo(e,t){const r=this;if(!(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup))return;let n,o;if(void 0===t)n=1,o=t=r.$.mainContainer;else{if((t=r.getItem(t))instanceof Smart.TreeItemsGroup==!1)return;n=t.level+1,o=t.itemContainer}r._createItemHTMLStructure(e,n,t,o.childElementCount,0);const l=r.sorted&&r.autoSort,a=r._state.filter,s=r.selectedIndexes.slice(0);l&&r._unsortItems(r.$.mainContainer),e instanceof Smart.TreeItemsGroup&&r._processHTML(e,n+1,!1);let i=arguments[2];i&&arguments[3]&&(i=i.nextElementSibling),i?(o.insertBefore(e,i),r._menuItems={},r._refreshItemPaths(r.$.mainContainer,!0,void 0,r.sorted&&!r.autoSort)):o.appendChild(e),l&&r._applyGrouping(r.$.mainContainer),a&&r._applyFilter(a),r._checkOverflow(),r._expandItemsByDefault(),r.selectedIndexes=[],r._applySelection(!0,s)}clearSelection(){const e=this.selectedIndexes.slice(0);this.selectedIndexes=[],this._applySelection(!1,e)}collapseAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;n&&(t.animation="none"),t._collapseAll(!0),n&&(t.animation=r)}ensureVisible(e){const t=this;if(void 0===(e=t.getItem(e))||e.hidden)return;let r=!1;e.level>1&&!t._isBranchExpanded(e)&&(super.expandItem(e.parentItem,void 0,!1),r=t.hasAnimation,r&&(t._ensureVisibleOnTransitionend=e)),r||t._ensureVisible(e)}expandAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;let o=1,l=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="1"]');for(n&&(t.animation="none");l.length>0;){for(let e=0;e<l.length;e++){const r=l[e];r.expanded||t._menuItemsGroupSelectionHandler(r,{target:r,type:"expand"})}o++,l=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="'+o+'"]')}n&&(t.animation=r)}expandItem(e,t){const r=this;if(void 0===(e=r.getItem(e))||e instanceof Smart.TreeItemsGroup==!1||r._isContainerOpened(e.container.level,e.container))return;const n=!1===t&&r.hasAnimation,o=r.animation;n&&(r.animation="none"),r._discardKeyboardHover(),r._menuItemsGroupSelectionHandler(e,{target:e,type:"expand"},arguments[2]),n&&(r.animation=o)}filter(e){const t=this;t.filterable&&(t._applyFilter(e),t.$.filterInput.value=e)}getState(){return JSON.parse(JSON.stringify(this._state))}insert(e,t){const r=this;let n;if(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup){if(r.contains(e))return;n=e}else{if("object"!=typeof e||e.constructor!==Object)return;n=function e(t){const n=t[r.itemsMember],o="smart-tree-items-group"===t.tagName||Array.isArray(n)?"smart-tree-items-group":"smart-tree-item",l=document.createElement(o);if(t.disabled&&(l.disabled=!0),t[r.displayMember]&&(l.label=t[r.displayMember]),t.selected&&(l.selected=!0),t.separator&&(l.separator=!0),t[r.valueMember]&&(l.value=t[r.valueMember]),"smart-tree-items-group"===o){if(t.expanded&&(l.expanded=!0),n)for(let t=0;t<n.length;t++)l.appendChild(e(n[t]))}else t.shortcut&&(l.shortcut=t.shortcut);return l}(e)}if(void 0===t)return void r.addTo(n);if("number"==typeof t)t=t.toString();else if(t instanceof Smart.TreeItem||t instanceof Smart.TreeItemsGroup){if(!r.contains(t))return;t=t.path}else if("string"!=typeof t)return;const o=t.split(".");let l,a;1===o.length?(a=r._menuItems[o[0]],a?r.addBefore(n,a):r.addTo(n)):(a=r._menuItems[t],l=r._menuItems[o.slice(0,o.length-1).join(".")],a?r.addBefore(n,a):l&&l instanceof Smart.TreeItemsGroup&&r.addTo(n,l))}loadState(e){const t=this,r=t.selectedIndexes.slice(0),n=[];if(!e){if(!t.id)return void t.warn(t.localize("noId"));if(!(e=window.localStorage.getItem("smartTree"+t.id)))return}"string"==typeof e&&(e=JSON.parse(e)),e.filter&&!t.filterable&&(e.filter="");let o=e.filter!==t._state.filter;e.sorted!==t.sorted?(t.sorted=e.sorted,t._updateState("sorted",t.sorted),e.sorted?t._applyGrouping(t.$.mainContainer):t._unsortItems(t.$.mainContainer),(e.filter||o)&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter)):o&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter),t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t._expandItemsByDefault(!0);for(let r=0;r<e.selected.length;r++){const o=t.getItem(e.selected[r]);o&&n.push(o.path)}t.selectedIndexes=n,t._applySelection(!1,r)}moveDown(e){const t=this,r=(e=t.getItem(e)).nextElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,2,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}moveUp(e){const t=this,r=(e=t.getItem(e)).previousElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,0,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}refresh(){this._checkOverflow()}removeItem(e){const t=this;if(void 0===(e=t.getItem(e)))return;if(e instanceof Smart.TreeItemsGroup){const r=e.container;t._isContainerOpened(r.level,r)&&t._closeSubContainersTreeMode(r.level,r)}const r=t.sorted&&t.autoSort;r&&t._unsortItems(t.$.mainContainer),e.parentElement.removeChild(e),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),r&&t._applyGrouping(t.$.mainContainer);const n=t._state.filter,o=t.selectedIndexes.slice(0);n&&t._applyFilter(n),t._checkOverflow(),t.selectedIndexes=[],t._applySelection(!0,o),delete t._treeAnimationInProgress}saveState(){const e=this;return e.id?window.localStorage.setItem("smartTree"+e.id,JSON.stringify(e._state)):e.warn(e.localize("noId")),JSON.parse(JSON.stringify(e._state))}select(e){void 0===(e=this.getItem(e))||e.selected||e.templateApplied||this._handleSelection(e,{type:"programmatic"})}unselect(e){void 0!==(e=this.getItem(e))&&e.selected&&!e.templateApplied&&this._handleSelection(e,{type:"programmatic"})}updateItem(e,t){if(void 0===(e=this.getItem(e))||void 0===t)return;const r=e instanceof Smart.TreeItem;for(let n in t)if(t.hasOwnProperty(n)){if(r){if(-1===["disabled","label","level","selected","separator","shortcut","value"].indexOf(n))continue}else if(-1===["disabled","expanded","label","level","selected","separator","value"].indexOf(n))continue;e[n]=t[n]}}propertyChangedHandler(e,t,r){const n=this;switch(super.propertyChangedHandler(e,t,r),e){case"allowDrag":case"allowDrop":case"autoLoadState":case"autoSort":case"editable":case"filterInputPlaceholder":case"loadingIndicatorPlaceholder":case"selectionDisplayMode":case"showLines":case"showRootLines":case"toggleElementPosition":case"toggleMode":break;case"autoHideToggleElement":r?n.$mainContainer.addClass("hidden-arrows"):n.$mainContainer.removeClass("hidden-arrows");break;case"autoSaveState":if(!r)return;if(!n.id)return n.warn(n.localize("noId")),void(n.autoSaveState=!1);window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state));break;case"dataSource":{const e=n.selectedIndexes.slice(0);n.selectedIndexes=[],n._menuItems={},n._processDataSource(),n._checkOverflow(),n._expandItemsByDefault(),n._applySelection(!0,e);const t=n._state.filter;t&&n._applyFilter(t);break}case"disabled":n._setFocusable(),n.$.scrollButtonNear.disabled=r,n.$.scrollButtonFar.disabled=r,r||n._updateScrollButtonVisibility();break;case"displayLoadingIndicator":r?(n._discardKeyboardHover(!0),n.$loadingIndicatorContainer.removeClass("smart-hidden")):n.$loadingIndicatorContainer.addClass("smart-hidden");break;case"filterable":!1===r&&(n._applyFilter(""),n.$.filterInput.value=""),n._checkOverflow();break;case"filterMode":n.filterable&&n._state.filter&&n._applyFilter(n._state.filter);break;case"hasThreeStates":if("checkBox"!==n.selectionMode)return;if(r)n._applySelection(!1);else{const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}break;case"loadingIndicatorPosition":"center"===r?n.$loadingIndicatorPlaceHolder.addClass("smart-hidden"):n.$loadingIndicatorPlaceHolder.removeClass("smart-hidden");break;case"overflow":if("scrollbar"===n.scrollMode)return"hidden"===r?n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0):n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),void(n.$.scrollViewer.verticalScrollBarVisibility="scroll"===r?"visible":"auto");n.$.scrollViewer.scrollTop=0,"hidden"===r?(n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden")):(n.$.scrollButtonNear.disabled=n.disabled,n.$.scrollButtonFar.disabled=n.disabled,"auto"===r?(n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),n._checkOverflow()):(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden"),n._updateScrollButtonVisibility())),n.$.scrollViewer.refresh();break;case"rightToLeft":{let e,t;r?(e="paddingLeft",t="paddingRight"):(e="paddingRight",t="paddingLeft");for(let r in n._menuItems)if(n._menuItems.hasOwnProperty(r)){const o=n._menuItems[r],l=o.firstElementChild;l.style[e]="",n._setIndentation(l,o.level,t)}break}case"scrollMode":if("hidden"===n.overflow)return;if(n.$.scrollViewer.scrollTop=0,"scrollButtons"===r)return"scroll"===n.overflow&&(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden")),n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),n.$.scrollViewer.verticalScrollBarVisibility="auto",void n._checkOverflow();n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),"auto"===n.overflow?n.$.scrollViewer.verticalScrollBarVisibility="auto":n.$.scrollViewer.verticalScrollBarVisibility="visible";break;case"selectedIndexes":n._applySelection(!1,t);break;case"selectionMode":if(n.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(r)),void 0===n._menuItems[0])return;if("one"===t&&"none"!==r&&"checkBox"!==r&&"radioButton"!==r||-1!==t.indexOf("oneOrMany")&&-1!==r.indexOf("oneOrMany")||"none"===t&&(-1!==r.indexOf("zero")||"checkBox"===r)||"zeroOrMany"===r&&"checkBox"!==t||"radioButton"===t&&-1!==r.indexOf("Many")||!n.hasThreeStates&&("checkBox"===r||"checkBox"===t&&"zeroOrMany"===r))return n._lastSelectedItem="one"===r||"oneOrManyExtended"===r?n._menuItems[n.selectedIndexes[n.selectedIndexes.length-1]]:void 0,void n._applyAriaSelected();if(n.hasThreeStates&&"checkBox"===t){const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}n._applySelection(!1);break;case"sort":if(!n.sorted)return;n._refreshSorting();break;case"sortDirection":n.sorted&&!n.sort&&(n._unsortItems(n.$.mainContainer),n._applyGrouping(n.$.mainContainer));break;case"sorted":{if(!r&&!n.autoSort)return n._refreshItemPathsAndSelection(),void n._updateState("sorted",!1);r?n._applyGrouping(n.$.mainContainer):n._unsortItems(n.$.mainContainer);const e=n._state.filter;e&&n._applyFilter(e),n._updateState("sorted",r),n._checkOverflow();break}case"unfocusable":n._setFocusable()}}_addDragFeedback(){const e=this,t=document.createElement("div");return t.className="smart-tree-item-feedback",t.setAttribute("parent-tree-id",e.id),e.theme&&t.setAttribute("theme",e.theme),e.dragFeedbackFormatFunction?t.innerHTML=e.dragFeedbackFormatFunction(e._dragDetails.Items):1===e._dragDetails.Items.length?t.innerHTML=e._dragDetails.Item.label:(t.classList.add("multiple"),t.innerHTML="&#xf0c5;"),document.body.appendChild(t),t}_applyFilter(e){const t=this;function r(e,t){e?(t.hidden&&t.$.removeClass("smart-hidden"),t.hidden=!1):(t.hidden||t.$.addClass("smart-hidden"),t.hidden=!0)}if(""===e&&!t.hasAttribute("filter-applied"))return;const n=Array.from(t.$.mainContainer.getElementsByClassName("last-filtered-child"));for(let e=0;e<n.length;e++)n[e].$.removeClass("last-filtered-child");!function n(o,l){let a,s=!1,i=0;l=Array.from(l);for(let o=0;o<l.length;o++){const d=l[o];d instanceof Smart.TreeItem?r(t._findItem(d,e),d):n(d,d.itemContainer.children),d.hidden||(i++,a=d),s=s||!d.hidden}if(o!==t.$.mainContainer){const n=t._findItem(o,e);r(s||n,o),s&&null===n?o.$.addClass("filtered-child"):o.$.removeClass("filtered-child"),!s&&l.length>0?(o.hiddenChildren=!0,o.$.addClass("hidden-children"),t.collapseItem(o,void 0,!1)):(o.hiddenChildren=!1,o.$.removeClass("hidden-children"))}""!==e&&i>0&&a.$.addClass("last-filtered-child")}(t.$.mainContainer,t.$.mainContainer.children),""!==e?t.setAttribute("filter-applied",""):t.removeAttribute("filter-applied"),t._updateState("filter",e),t._checkOverflow()}_applyHierarchicalSelection(e,t){const r=this,n=e!==r.$.mainContainer,o=n?e.itemContainer.children:e.children;let l=0,a=0;for(let s=0;s<o.length;s++){const i=o[s];e.selected&&i.set("selected",!0),i instanceof Smart.TreeItemsGroup?r._applyHierarchicalSelection(i,t):i.selected&&t.push(i.path),n&&(i.selected?l++:i.hasAttribute("indeterminate")&&a++)}n&&(r._setThreeStateCheckbox(e,l,a),e.selected&&t.push(e.path))}_applyRadioButtonSelection(e,t,r){const n=this,o=e!==n.$.mainContainer?e.itemContainer.children:e.children,l=[];let a;for(let e=0;e<o.length;e++){const a=o[e];a instanceof Smart.TreeItemsGroup&&n._applyRadioButtonSelection(a,t,r),a.set("selected",!1),-1!==t.indexOf(a.path)&&l.push(a)}a=0===l.length?o[0]:l[l.length-1],a.set("selected",!0),r.push(a.path)}_applySelection(e,t){const r=this;let n=r.selectedIndexes.slice(0);if(void 0===t&&(t=n.slice(0)),void 0===r._menuItems[0])return r.selectedIndexes=[],r._lastSelectedItem=void 0,void(r.isRendered&&JSON.stringify(t)!==JSON.stringify([])&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}));const o=r.selectionMode,l=Array.from((r.shadowRoot||r).querySelectorAll("smart-tree-item[selected], smart-tree-items-group[selected]"));for(let e=n.length-1;e>=0;e--){void 0===r._menuItems[n[e]]&&n.splice(e,1)}if(e)for(let e=0;e<l.length;e++)-1===n.indexOf(l[e].path)&&n.push(l[e].path);else{for(let e=0;e<l.length;e++)l[e].set("selected",!1);l.length=0}switch(r._sortPathCollection(n),o){case"none":n.length=0;for(let e=0;e<l.length;e++)l[e].set("selected",!1);break;case"one":case"zeroOrOne":"zeroOrOne"!==o&&0===n.length&&n.push("0");for(let e=0;e<n.length;e++){const t=r._menuItems[n[e]];if(e===n.length-1){t.set("selected",!0),n=[n[e]];break}-1!==l.indexOf(t)&&t.set("selected",!1)}break;case"oneOrMany":case"oneOrManyExtended":0===n.length&&n.push("0");for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);break;case"zeroOrMany":case"checkBox":for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);if("checkBox"===o&&r.hasThreeStates){const e=[];r._applyHierarchicalSelection(r.$.mainContainer,e),r._sortPathCollection(e),n=e}break;case"radioButton":{const e=[];r._applyRadioButtonSelection(r.$.mainContainer,n,e),r._sortPathCollection(e),n=e;break}}r.selectedIndexes=n,r._updateState("selected"),r._lastSelectedItem="one"===o||"oneOrManyExtended"===o?r._menuItems[n[n.length-1]]:void 0,r.isRendered&&!1!==arguments[2]&&JSON.stringify(t)!==JSON.stringify(n)&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}),r._applyAriaSelected()}_applyAriaSelected(){const e=this,t=e.selectionMode;for(let r in e._menuItems){const n=e._menuItems[r];n.selected?n.setAttribute("aria-selected",!0):e._canItemBeSelected(n)&&-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(t)?n.setAttribute("aria-selected",!1):n.removeAttribute("aria-selected")}}_autoLoadState(e){const t=this,r=[];for(let e=0;e<t._menuItemsGroupsToExpand.length;e++)t._menuItemsGroupsToExpand[e].set("expanded",!1);t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t.filterable&&e.filter&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter);for(let n=0;n<e.selected.length;n++){const o=t.getItem(e.selected[n]);o&&r.push(o.path)}t.selectedIndexes=r}_blurHandler(){this._discardKeyboardHover(!0)}_canItemBeHovered(e){const t=e.level;return!1===e.disabled&&!0!==e.templateApplied&&!0!==e.hidden&&(1===t||t>1&&this._isContainerOpened(t,e.parentElement.container)&&e.getBoundingClientRect().height>0)}_canItemBeSelected(e){return!1===e.disabled&&!0!==e.templateApplied}_checkOverflow(){const e=this,t=e.$.scrollViewer,r=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===r)return void t.refresh();const n=t.scrollTop;"auto"===r&&(t.$.removeClass("scroll-buttons-shown"),t.$.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"));const o=Math.round(t.$.scrollViewerContentContainer.offsetHeight)>Math.round(t.$.scrollViewerContainer.offsetHeight),l=Math.round(t.scrollTop)>0,a=Math.round(t.$.scrollViewerContainer.offsetHeight+t.scrollTop)<Math.round(t.$.scrollViewerContentContainer.offsetHeight);o?"auto"===r?(t.$.addClass("scroll-buttons-shown"),l&&e.$scrollButtonNear.removeClass("smart-hidden"),a&&e.$scrollButtonFar.removeClass("smart-hidden"),!1===(l&&a)&&t.$.addClass("one-button-shown"),e.disabled||(e.$.scrollButtonNear.disabled=!1,e.$.scrollButtonFar.disabled=!1),t.scrollTop=n):(e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.disabled?(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0):(e.$.scrollButtonNear.disabled=!l,e.$.scrollButtonFar.disabled=!a)):"scroll"===r&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),t.refresh()}_createElement(){const e=this,t=window.getComputedStyle(e.$.scrollViewer);e.setAttribute("role","tree"),e.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(e.selectionMode)),e.setAttribute("aria-orientation","vertical"),e.$.scrollViewer.onVerticalChange=e._verticalScrollbarHandler,Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.id||!e.autoLoadState&&!e.autoSaveState||(e.warn(e.localize("noId")),e.autoLoadState=!1,e.autoSaveState=!1),e.mode="tree",e._element="tree",e._isMobile=Smart.Utilities.Core.isMobile,e._edgeMacFF=!1,e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._scrollViewerPadding=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)||0,e._state={expanded:[],filter:"",selected:[]},e._dblclickObject={numberOfClicks:0},e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),e.disabled&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),"scrollbar"===e.scrollMode&&"scroll"===e.overflow&&(e.$.scrollViewer.verticalScrollBarVisibility="visible"),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList();const r=(e.shadowRoot||e).querySelectorAll("smart-tree-item, smart-tree-items-group"),n=function(){let t;e.autoLoadState&&(t=window.localStorage.getItem("smartTree"+e.id),t&&(t=JSON.parse(t),e.sorted=t.sorted)),e._setFocusable(),e._menuItems={},null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource(),"scrollButtons"!==e.scrollMode&&"hidden"!==e.overflow||e.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),"scrollButtons"===e.scrollMode&&"scroll"===e.overflow&&(e.$scrollViewer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility()),e._checkOverflow(),t&&e._autoLoadState(t),e._expandItemsByDefault(),e._applySelection(!0),e._updateState("sorted",e.sorted),e.displayLoadingIndicator&&e.$loadingIndicatorContainer.removeClass("smart-hidden"),"center"!==e.loadingIndicatorPosition&&e.$loadingIndicatorPlaceHolder.removeClass("smart-hidden"),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===r.length||e.enableShadowDOM||e.isInShadowDOM?n():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(r,n)),e.checkLicense()}_dblclickHandler(e,t,r){"dblclick"!==this.toggleMode||e instanceof Smart.TreeItem||t||this._menuItemsGroupSelectionHandler(e,r)}_discardKeyboardHover(e,t){!t&&this._hoveredViaKeyboard&&(!e&&this._hoveredViaKeyboard instanceof Smart.MenuItemsGroup&&this._isContainerOpened(this._hoveredViaKeyboard.level+1,this._hoveredViaKeyboard.container)||(this._hoveredViaKeyboard.removeAttribute("focus"),this._hoveredViaKeyboard=void 0))}_documentUpHandler(e){if("pointercancel"===e.originalEvent.type)return;const t=this,r=t._downTimeoutInfo,n=t._dragDetails;!r||n&&n.FeedbackShown||(clearTimeout(r.timeout),t.$.scrollViewer.scrollTop!==r.scrollTop&&t.getBoundingClientRect().top===r.top||t._continueSelection(r.target,r.event)),delete t._downTimeoutInfo;const o=t._downItem,l=t.enableShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(delete t._downItem,t._editedItem&&!t._editInputDown&&(!t._isMobile&&l!==t.$.editInput||t._isMobile&&document.elementFromPoint(e.clientX,e.clientY)!==t.$.editInput))return void t._endEditing();if(delete t._editInputDown,o){const r=l.closest("smart-tree-item")||l.closest("smart-tree-items-group");!r||!r.selected||r!==o||t._dragDetails&&t._dragDetails.FeedbackShown||r instanceof Smart.TreeItemsGroup&&(l.closest(".smart-tree-items-group-arrow")||l===r.container||l===r.container.firstElementChild)||t._handleSelection(r,e)}if(!n)return;const a=Smart.Tree.hoveredTree,s=Smart.Tree.hoveredItem;if(delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,t.$.scrollViewer._scrollView.disableSwipeScroll=!1,!n.FeedbackShown)return;const i=a||document.elementFromPoint(e.clientX,e.clientY);let d;document.body.classList.remove("smart-dragging"),document.body.removeChild(n.Feedback),a&&clearInterval(a._dragInterval);const c=n.Item,m=n.Items,u=n.ValidItems;if(!i)return;if(!s||c.contains(s))return void t.$.fireEvent("dragEnd",{item:c,items:m,target:i,data:n,previousContainer:t,container:a||i,originalEvent:e});if(!a||!a.allowDrop||a.disabled)return;const p=[a];let h;if(s.classList.remove("drop-target"),s.classList.contains("top")?(s.classList.remove("top"),h="top",d=0):s.classList.contains("bottom")?(s.classList.remove("bottom"),h="bottom",d=2):(h="inside",d=1),n.DropDetails={item:s,position:h},a!==t)p.push(t);else if(n.ValidateOnDrop)for(let e=0;e<u.length;e++)if(u[e].contains(s))return;if(!t.$.fireEvent("dragEnd",{item:c,items:m,target:s,data:n,previousContainer:t,container:a,originalEvent:e}).defaultPrevented){a.sorted&&a.autoSort&&a._unsortItems(a.$.mainContainer);for(let e=0;e<u.length;e++)t._moveTreeItem(u[e],s,d,p);a.sorted&&a.autoSort&&a._applyGrouping(a.$.mainContainer),a!==t&&a._state.filter&&a._applyFilter(a._state.filter)}}_editInputBlurHandler(){this._endEditing()}_endEditing(e){const t=this,r=t._editedItem;if(!r)return;if(delete t._editedItem,t.$editInput.addClass("smart-hidden"),t.focus(),e)return;const n=t.$.editInput.value,o=t.sorted&&t.autoSort,l=t._state.filter;n!==r.label&&(r.set("label",n),r.setAttribute("aria-label",n),r.firstElementChild.firstElementChild.firstElementChild.innerHTML=n,o&&(t._unsortItems(t.$.mainContainer),t._applyGrouping(t.$.mainContainer)),l&&t._applyFilter(l))}_ensureVisible(e){const t=this;t._ensureVisibleTreeMode(e,e.getBoundingClientRect(),t.$.scrollViewer,t.$.scrollViewer.getBoundingClientRect(),t._scrollViewerPadding),t._ensureVisibleCallback&&t._ensureVisibleCallback(e)}_filterInputKeydownHandler(e){if("PageDown"!==e.key)return void("PageUp"===e.key&&(e.preventDefault(),e.stopPropagation()));const t=this;let r;if(e.preventDefault(),e.stopPropagation(),t.selectedIndexes.length>0){const e=t.selectedIndexes.slice(0);r=t._lastSelectedItem||t._menuItems[t.selectedIndexes[t.selectedIndexes.length-1]],"checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&(t.selectedIndexes=[r.path],t._applySelection(!1,e)),t.focus()}else r=t._getFirstEnabledChild(t.$.mainContainer),t.focus(),r&&t._hoverViaKeyboard(r);t._ensureVisible(r)}_focusHandler(){const e=this;e.selectedIndexes.length>0&&!e._hoveredViaKeyboard&&(e._lastSelectedItem?e._hoverViaKeyboard(e._lastSelectedItem,!1,void 0,!1):e._hoverViaKeyboard(e._menuItems[e.selectedIndexes[e.selectedIndexes.length-1]],!1,void 0,!1))}_getDataSource(){const e=[];return function e(t,r){for(let n=0;n<t.length;n++){const o=t[n],l={label:o.label};o.disabled&&(l.disabled=!0),o.selected&&(l.selected=!0),o.separator&&(l.separator=!0),null!==o.value&&(l.value=o.value),o instanceof Smart.TreeItem?o.shortcut&&(l.shortcut=o.shortcut):(o.expanded&&(l.expanded=!0),l.items=[],e(o.itemContainer.children,l.items)),r.push(l)}}(this.$.mainContainer.children,e),e}_handleHierarchicalSelection(e,t){const r=this;let n=e;for(e.selected?(e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.set("selected",!0),e.setAttribute("aria-selected",!0),e.removeAttribute("indeterminate"));n.parentItem;){const e=n.parentItem,t=e.itemContainer.children;let o=0,l=0;for(let e=0;e<t.length;e++)t[e].selected?o++:t[e].hasAttribute("indeterminate")&&l++;r._setThreeStateCheckbox(e,o,l),n=e}e instanceof Smart.TreeItemsGroup&&function e(t,r){const n=t.itemContainer.children;for(let t=0;t<n.length;t++){const o=n[t];o.set("selected",r),o.setAttribute("aria-selected",r),o.removeAttribute("indeterminate"),o instanceof Smart.TreeItemsGroup&&e(o,r)}}(e,e.selected),t.length=0;const o=Array.from((r.enableShadowDOM?r.shadowRoot:r).querySelectorAll("[selected]"));for(let e=0;e<o.length;e++)t.push(o[e].path);r._sortPathCollection(t)}_handleSelection(e,t){const r=this,n=r.selectionMode;if("none"===n||"programmatic"!==t.type&&!r._canItemBeSelected(e))return;const o=e.selected;if(o&&"down"===t.type)return;const l=r.selectedIndexes.slice(0);let a=l.slice(0);switch(n){case"one":if(o)return;r._menuItems[a[0]].set("selected",!1),r._menuItems[a[0]].removeAttribute("aria-selected"),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e;break;case"zeroOrOne":o?(r.selectedIndexes=[],e.set("selected",!1),e.removeAttribute("aria-selected")):(void 0!==a[0]&&(r._menuItems[a[0]].set("selected",!1),r._menuItems[a[0]].removeAttribute("aria-selected")),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0));break;case"oneOrMany":case"zeroOrMany":if(o){if(1===a.length&&"zeroOrMany"!==n)return;a.splice(a.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)}else a.push(e.path),r._sortPathCollection(a),e.set("selected",!0),e.setAttribute("aria-selected",!0);r.selectedIndexes=a;break;case"oneOrManyExtended":{const n=t.ctrlKey,o=t.shiftKey;if(!n&&!o||o&&e===r._lastSelectedItem){for(let e=0;e<a.length;e++)r._menuItems[a[e]].set("selected",!1),r._menuItems[a[e]].setAttribute("aria-selected",!1);a=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e}else if(n)e.selected&&a.length>1?(a.splice(a.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):e.selected||(a.push(e.path),r._sortPathCollection(a),e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e);else if(o){for(let e=0;e<a.length;e++)r._menuItems[a[e]].set("selected",!1),r._menuItems[a[e]].setAttribute("aria-selected",!1);a=r._selectItemRange(r._lastSelectedItem,e)}r.selectedIndexes=a;break}case"checkBox":r.hasThreeStates?r._handleHierarchicalSelection(e,a):o?(a.splice(a.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(a.push(e.path),r._sortPathCollection(a),e.set("selected",!0),e.setAttribute("aria-selected",!0)),r.selectedIndexes=a;break;case"radioButton":{if(e.selected)return;let t;for(let r=0;r<e.parentElement.children.length;r++){const n=e.parentElement.children[r];if(n.selected){t=n;break}}const n=a.indexOf(t.path);t.set("selected",!1),e.setAttribute("aria-selected",!1),e.set("selected",!0),e.setAttribute("aria-selected",!0),a.splice(n,1),a.push(e.path),r._sortPathCollection(a),r.selectedIndexes=a;break}}if(r._discardKeyboardHover(!0),r._hoverViaKeyboard(e,!1,void 0,!r._treeAnimationInProgress),r._updateState("selected"),JSON.stringify(l)!==JSON.stringify(r.selectedIndexes)){if(r.ownerElement&&!r.ownerElement.isRendered)return;r.$.fireEvent("change",{item:e,selectedIndexes:r.selectedIndexes,oldSelectedIndexes:l})}}_hoverViaKeyboard(e,t,r,n){if(!e)return;const o=this;e.setAttribute("focus",""),o._hoveredViaKeyboard=e,!1!==n&&o._ensureVisible(e),t&&o._handleSelection(e,r),o._hoverViaKeyboardCallback&&o._hoverViaKeyboardCallback(e)}_keydownHandler(e){const t=this,r=e.key;if(t._editedItem)return void("Enter"===r?t._endEditing():"Escape"===r&&t._endEditing(!0));if(t.getRootNode().activeElement!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","F2","Home","PageDown","PageUp"," "].indexOf(r)||t.disabled||t.displayLoadingIndicator)return;e.preventDefault();const n=Array.from(t.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),o="one"===t.selectionMode||"oneOrManyExtended"===t.selectionMode&&!e.ctrlKey,l=t.$.mainContainer.querySelector("[focus]");function a(r){for(let a=r;a<n.length;a++){const r=n[a];if(t._canItemBeHovered(r)){if(l){if(l===r)break;l.removeAttribute("focus")}t._hoverViaKeyboard(r,o,e);break}}}function s(r){for(let a=r;a>=0;a--){const r=n[a];if(t._canItemBeHovered(r)){if(l){if(l===r)break;l.removeAttribute("focus")}t._hoverViaKeyboard(r,o,e);break}}}function i(){l.level>1&&t._canItemBeSelected(l.parentItem)&&(l.removeAttribute("focus"),t._hoverViaKeyboard(l.parentItem,o,e))}let d;switch(r){case"ArrowDown":d=l?n.indexOf(l)+1:0,a(d);break;case"ArrowLeft":if(!l)return;if(l instanceof Smart.TreeItem)i();else{if(t._isContainerOpened(l.level+1,l.container))return void t._closeSubContainersTreeMode(l.level+1,l.container,!0,!0);i()}break;case"ArrowRight":if(!l||l instanceof Smart.TreeItem)return;if(t._isContainerOpened(l.level+1,l.container)){const r=t._getFirstEnabledChild(l.itemContainer);r&&(l.removeAttribute("focus"),t._hoverViaKeyboard(r,o,e))}else t._menuItemsGroupSelectionHandler(l,{target:l,type:"keydown"});break;case"ArrowUp":d=l?n.indexOf(l)-1:n.length-1,s(d);break;case"End":s(n.length-1);break;case"Enter":l&&l instanceof Smart.TreeItemsGroup&&t._menuItemsGroupSelectionHandler(l,{target:l,type:"keydown"});break;case"F2":t.editable&&t._startEditing(l);break;case"Home":a(0);break;case"PageDown":t._pageDownHandler(n,l,o,e);break;case"PageUp":t._pageUpHandler(n,l,o,e);break;case" ":l&&t._handleSelection(l,e)}}_mainContainerSwipeHandler(e){Smart.Tree.treeItemDragged&&e.stopPropagation()}_menuItemsGroupSelectionHandler(e,t,r){const n=this,o=n.toggleMode,l=!!t.originalEvent&&t.originalEvent.target.classList.contains("smart-tree-items-group-arrow"),a=e.container;if(n._waitAnimation&&n._treeAnimationInProgress)return;if("down"!==t.type||l||"dblclick"===o&&1!==n._dblclickObject.numberOfClicks||n._handleSelection(e,t),"down"===t.type&&!l&&("dblclick"===o&&2!==n._dblclickObject.numberOfClicks||"click"===o&&n._dblclickObject.numberOfClicks>1||"arrow"===o)||e.hiddenChildren)return;const s=a.level;let i=n.hasAnimation;if("keydown"===t.type&&n._discardKeyboardHover(),n._treeAnimationInProgress&&(a.removeEventListener("transitionend",n._transitionendHandlerExpand),a.removeEventListener("transitionend",n._transitionendHandlerCollapse)),n._isContainerOpened(s,a))n._closeSubContainersTreeMode(s,a,!0,!1!==r);else{if(n.$.fireEvent("expanding",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children}).defaultPrevented)return;if(i&&("expand"!==t.type&&(n._ensureVisibleOnTransitionend=e),n._expandSection(a)),a.$.removeClass("smart-visibility-hidden"),"keydown"===t.type&&(e.setAttribute("focus",""),n._hoveredViaKeyboard=e),e.$.addClass("smart-tree-items-group-opened"),e.$.addClass("smart-tree-items-group-expanded"),n._addOpenedContainer(s,a),void 0===t.type&&n._hoverViaKeyboard(n._getFirstEnabledChild(e.itemContainer)),!1!==r){const t={item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children};n.toggleCallback?(t.type="expand",n.toggleCallback(t)):n.$.fireEvent("expand",t)}}i||(n._checkOverflow(),"expand"!==t.type&&n._ensureVisible(e))}_mouseenterHandler(){const e=this;e.autoHideToggleElement&&e.$mainContainer.removeClass("hidden-arrows"),Smart.Tree.treeItemDragged&&e.allowDrop&&!e.disabled&&(Smart.Tree.hoveredTree=e)}_mouseleaveHandler(){const e=this;if(e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),Smart.Tree.treeItemDragged){Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree);const e=Smart.Tree.hoveredItem;e&&(e.classList.remove("drop-target"),e.classList.remove("top"),e.classList.remove("bottom"),delete Smart.Tree.hoveredItem)}}_moveHandler(e){const t=this,r=t._dragDetails;if(!r)return;if(!r.FeedbackShown){if(!(Math.abs(r.StartPosition.left-e.pageX)>5||Math.abs(r.StartPosition.top-e.pageY)>5))return;if(t.$.fireEvent("dragStart",{item:r.Item,items:r.Items,data:r,container:t,previousContainer:t,originalEvent:r.OriginalEvent}).defaultPrevented)return delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,void(t.$.scrollViewer._scrollView.disableSwipeScroll=!1);document.body.classList.add("smart-dragging"),r.Feedback=t._addDragFeedback(),r.FeedbackShown=!0}const n=t.dragOffset;let o,l,a;if(t.$.fireEvent("dragging",{item:r.Item,items:r.Items,data:r,originalEvent:e}),r.Feedback.style.left=e.pageX+n[0]+"px",r.Feedback.style.top=e.pageY+n[1]+"px",t._isMobile){const t=Smart.Tree.hoveredItem;t&&(t.classList.remove("drop-target"),t.classList.remove("top"),t.classList.remove("bottom"),delete Smart.Tree.hoveredItem);const r=document.elementFromPoint(e.clientX,e.clientY);Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree),r&&(o=r.closest("smart-tree"),o&&o.allowDrop&&(Smart.Tree.hoveredTree=o,l=r.closest("smart-tree-item")||r.closest("smart-tree-items-group"),l?a=l:l=r))}if(o=Smart.Tree.hoveredTree,!o)return;const s=o.filterable?o.$.filterInput.offsetHeight+10:0;if(clearInterval(o._dragInterval),o._dragInterval=setInterval((function(){const r=o.getBoundingClientRect();o.$.scrollViewer.scrollHeight>0&&r.left<=e.clientX&&r.left+r.width>=e.clientX?e.clientY>=r.top+s&&e.clientY<=r.top+20+s?(o.$.scrollViewer.scrollTop-=t._autoScrollCoefficient,"scrollButtons"===o.scrollMode&&o._updateScrollButtonVisibility()):e.clientY>=r.top+r.height-20&&e.clientY<=r.top+r.height?(o.$.scrollViewer.scrollTop+=t._autoScrollCoefficient,"scrollButtons"===o.scrollMode&&o._updateScrollButtonVisibility()):clearInterval(o._dragInterval):clearInterval(o._dragInterval)}),1),t._isMobile||(l=e.originalEvent.target,l&&l.enableShadowDOM&&(l=e.originalEvent.composedPath()[0]),l&&l.closest&&(a=l.closest("smart-tree-item")||l.closest("smart-tree-items-group"))),a){if(Smart.Tree.hoveredItem&&a!==Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),Smart.Tree.hoveredItem=a,r.Item.contains(a))return;const t=a.getBoundingClientRect();a instanceof Smart.TreeItem?e.clientY-t.top<=t.height/2?(a.classList.remove("bottom"),a.classList.add("top")):(a.classList.remove("top"),a.classList.add("bottom")):e.clientY-t.top<=10?(a.classList.remove("bottom"),a.classList.add("top")):!a.expanded&&t.bottom-e.clientY<=10?(a.classList.remove("top"),a.classList.add("bottom")):(a.classList.remove("top"),a.classList.remove("bottom")),a.classList.add("drop-target")}else if(Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),l===o.$.scrollViewer.$.scrollViewerContainer)if(o._menuItems[0]){let e=o.$.mainContainer.lastElementChild,t=o.$.mainContainer.childElementCount-1;for(;e.hidden&&(t--,e=o.$.mainContainer.children[t],e););e?(Smart.Tree.hoveredItem=e,Smart.Tree.hoveredItem.classList.add("bottom")):Smart.Tree.hoveredItem=o.$.container,Smart.Tree.hoveredItem.classList.add("drop-target")}else Smart.Tree.hoveredItem=o.$.container,Smart.Tree.hoveredItem.classList.add("drop-target");else delete Smart.Tree.hoveredItem}_moveSubItems(e,t,r){const n=this;for(let o=0;o<e.length;o++){const l=e[o];l.menu=t,l.set("level",l.parentItem.level+1),l.firstElementChild.style.paddingLeft="",l.firstElementChild.style.paddingRight="",n._setIndentation(l.firstElementChild,l.level,r),l.hidden=!1,l.$.removeClass("smart-hidden"),l.$.removeClass("filtered-child"),l.$.removeClass("last-filtered-child"),l instanceof Smart.TreeItemsGroup&&(l.$.removeClass("hidden-children"),l.container.level=l.level+1,n._moveSubItems(l.itemContainer.children,t,r),t!==n&&l.expanded&&(t._menuItemsGroupsToExpand.push(l),n._updateState("expanded",l.id,!1)))}}_moveTreeItem(e,t,r,n){const o=this,l=e.level;if(0===r){if(t.previousElementSibling===e)return;t.parentElement.insertBefore(e,t),e.set("level",t.level)}else if(2===r){if(t.nextElementSibling===e)return;t.parentElement.insertBefore(e,t.nextElementSibling||null),e.set("level",t.level)}else if(t===n[0].$.container)n[0].$.mainContainer.appendChild(e),e.set("level",1);else{if(t.itemContainer.lastElementChild===e)return;t.itemContainer.appendChild(e),e.set("level",t.level+1)}const a=n[0].rightToLeft?"paddingRight":"paddingLeft";if(e.menu=n[0],e.parentItem=e.parentElement.menuItemsGroup,e.firstElementChild.style.paddingLeft="",e.firstElementChild.style.paddingRight="",o._setIndentation(e.firstElementChild,e.level,a),e.hidden=!1,e.$.removeClass("smart-hidden"),e.$.removeClass("filtered-child"),e.$.removeClass("last-filtered-child"),e instanceof Smart.TreeItemsGroup&&(e.$.removeClass("hidden-children"),e.container.level=e.level+1,o._moveSubItems(e.itemContainer.children,n[0],a),e.expanded)){const t=o._openedContainers[l+1].indexOf(e.container);-1!==t&&o._openedContainers[l+1].splice(t,1),n[0]._menuItemsGroupsToExpand.push(e),2===n.length&&o._updateState("expanded",e.id,!1)}for(let e=0;e<n.length;e++){const t=n[e],r=t.context,o=t.selectedIndexes.slice(0);t.context=t,t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),t.selectedIndexes=[],t._applySelection(!0,o,!1),t._checkOverflow(),t.context=r}n[0]._expandItemsByDefault()}_overriddenMenuHandler(){}_pageDownHandler(e,t,r,n){const o=this,l=o.$.scrollViewer;function a(){for(let t=e.length-1;t>=0;t--){const r=e[t];if(o._canItemBeHovered(r)&&o._getOffsetTop(r)+r.firstElementChild.offsetHeight<=l.scrollTop+l.$.container.offsetHeight)return r}}if(!t)return;let s=a();s&&(t!==s?(t.removeAttribute("focus"),o._hoverViaKeyboard(s,r,n)):l.scrollTop+l.$.container.offsetHeight!==l.$.scrollViewerContentContainer.offsetHeight&&(o.$.scrollViewer.scrollTop+=l.$.container.offsetHeight,"scrollButtons"===o.scrollMode&&o._updateScrollButtonVisibility(),s=a(),t.removeAttribute("focus"),o._hoverViaKeyboard(s,r,n)))}_pageUpHandler(e,t,r,n){const o=this,l=o.$.scrollViewer;function a(){for(let t=0;t<e.length;t++){const r=e[t];if(o._canItemBeHovered(r)&&o._getOffsetTop(r)>=l.scrollTop)return r}}if(!t)return;let s=a();s&&(t!==s?(t.removeAttribute("focus"),o._hoverViaKeyboard(s,r,n)):0!==l.scrollTop?(o.$.scrollViewer.scrollTop-=l.$.container.offsetHeight,"scrollButtons"===o.scrollMode&&o._updateScrollButtonVisibility(),s=a(),t.removeAttribute("focus"),o._hoverViaKeyboard(s,r,n)):o.filterable&&o.$.filterInput.focus())}_refreshItemPathsAndSelection(){const e=this.selectedIndexes.slice(0);this._menuItems={},this._refreshItemPaths(this.$.mainContainer,!0),this.selectedIndexes=[],this._applySelection(!0,e)}_refreshSorting(){const e=this;e._unsortItems(e.$.mainContainer),e._applyGrouping(e.$.mainContainer);const t=e._state.filter;t&&e._applyFilter(t),e._checkOverflow()}_scroll(e){this.$.scrollViewer.scrollTop=this.$.scrollViewer.scrollTop+10*e,this._updateScrollButtonVisibility(),this.focus()}_scrollButtonFarClickHandler(){this.$.scrollButtonFar.disabled||this._scroll(1)}_scrollButtonNearClickHandler(){this.$.scrollButtonNear.disabled||this._scroll(-1)}_scrollViewerDownHandler(e){const t=this;if(e.target!==t.$.scrollViewer||t.disabled||t.displayLoadingIndicator||!t._isMobile&&1!==e.which)return;const r=e.originalEvent.target;if(r!==t.$.editInput)if(t._isMobile){const n=t.$.scrollViewer.scrollTop,o=t.getBoundingClientRect().top,l=setTimeout((function(){if(!t._dragDetails&&t.$.scrollViewer.scrollTop===n&&t.getBoundingClientRect().top===o){const n=t.context;t.context=t,t._continueSelection(r,e),t.context=n}}),250);t._downTimeoutInfo={target:r,event:e,scrollTop:n,top:o,timeout:l}}else t._continueSelection(r,e);else t._editInputDown=!0}_continueSelection(e,t){const r=this,n=e.closest("smart-tree-item")||e.closest("smart-tree-items-group");if(!(n&&n.parentElement&&r._canItemBeSelected(n)))return;const o=e.closest(".smart-tree-items-group-arrow");let l;if(n instanceof Smart.TreeItem)l="_handleSelection";else{if(e===n.container||e===n.container.firstElementChild)return;l="_menuItemsGroupSelectionHandler"}if(clearTimeout(r._dblclickTimeout),n!==r._dblclickObject.target&&(r._dblclickObject.numberOfClicks=0),r._dblclickObject.target=n,r._dblclickObject.numberOfClicks++,r._dblclickTimeout=setTimeout((function(){r._dblclickObject.numberOfClicks=0}),300),2===r._dblclickObject.numberOfClicks){if(r.editable)return void r._startEditing(n);r._dblclickHandler(n,o,t),r._dblclickObject.numberOfClicks=0}n.selected&&(r._downItem=n),r[l](n,t),r._discardKeyboardHover(!0),r._hoverViaKeyboard(n,!1,void 0,!1),o||r._startDragging(n,t)}_scrollViewerTouchmoveHandler(e){this._dragDetails&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_scrollViewerWheelHandler(){const e=this;"scrollButtons"===e.scrollMode&&"hidden"!==e.overflow&&e._updateScrollButtonVisibility()}_selectItemRange(e,t){const r=this,n=Array.from(r.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),o=n.indexOf(e),l=n.indexOf(t),a=[];for(let e=Math.min(o,l);e<=Math.max(o,l);e++){const t=n[e];r._canItemBeHovered(t)&&(a.push(t.path),t.set("selected",!0))}return a}_selectstartHandler(e){this._dragDetails&&e.preventDefault()}_setFocusable(){super._setFocusable();const e=this;e.disabled||e.unfocusable?e.$.filterInput.tabIndex=-1:e.$.filterInput.removeAttribute("tabindex")}_setIndentation(e,t,r){e.style[r]=20*t-10+"px"}_setThreeStateCheckbox(e,t,r){t===e.itemContainer.childElementCount?(e.removeAttribute("indeterminate"),e.set("selected",!0),e.setAttribute("aria-selected",!0)):0===t&&0===r?(e.removeAttribute("indeterminate"),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.setAttribute("indeterminate",""),e.set("selected",!1),e.setAttribute("aria-selected",!1))}_sortItems(e){const t=this;if(!t.sorted)return;let r;e instanceof Smart.TreeItemsGroup?r=e.container.firstElementChild:e===t.$.mainContainer&&(r=e);let n=Array.from(r.children);if(t.sort){const r=t.sort(n,e);Array.isArray(r)&&(n=r)}else"asc"===t.sortDirection?n.sort((function(e,t){return e.label.localeCompare(t.label)})):n.sort((function(e,t){return t.label.localeCompare(e.label)}));for(let e=n.length-1;e>=0;e--)r.insertBefore(n[e],r.firstElementChild)}_sortPathCollection(e){e.sort((function(e,t){const r=e.split("."),n=t.split("."),o=Math.max(r.length,n.length);for(let e=0;e<o;e++){const t=parseFloat(r[e]),o=parseFloat(n[e]);if(isNaN(t))return-1;if(isNaN(o))return 1;if(t<o)return-1;if(t>o)return 1}}))}_startDragging(e,t){const r=this,n=r.selectionMode;if(!r.allowDrag||r._editedItem||"none"===n)return;const o=[],l=[];let a;if(-1!==["one","zeroOrOne","checkBox","radioButton"].indexOf(n))a=!1,o.push(e),l.push(e);else{a=!0;for(let e=0;e<r.selectedIndexes.length;e++)o.push(r._menuItems[r.selectedIndexes[e]]),l.push(o[e]);for(let e=0;e<o.length;e++){const t=o[e];if(-1!==l.indexOf(t))for(let e=l.length-1;e>=0;e--){const r=l[e];if(r===t)break;t.contains(r)&&l.splice(e,1)}}}r._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:o,ValidItems:l,Item:e,FeedbackShown:!1,ValidateOnDrop:a,OriginalEvent:t,StartTime:new Date,Dragging:!0},Smart.Tree.treeItemDragged=!0,r.$.scrollViewer._scrollView.disableSwipeScroll=!0,r.allowDrop&&(Smart.Tree.hoveredTree=r,Smart.Tree.hoveredItem=e)}_startEditing(e){const t=this,r=t.$.editInput;let n,o;if(!t._canItemBeSelected(e))return;const l=e.firstElementChild,a=l.firstElementChild;t.rightToLeft?(n=function(){return l.offsetWidth-a.offsetLeft-a.offsetWidth},o="paddingRight"):(n=function(){return a.offsetLeft+parseFloat(window.getComputedStyle(l).borderLeftWidth)},o="paddingLeft"),e instanceof Smart.TreeItemsGroup?(r.style[o]=n()+(t.showLines?parseFloat(window.getComputedStyle(a.firstElementChild).paddingLeft):0)-1+"px",r.style.height=l.offsetHeight+"px"):(r.style[o]=e.offsetWidth+parseInt(l.style[o],10)-l.offsetWidth+parseFloat(window.getComputedStyle(a.firstElementChild).paddingLeft)-2+"px",r.style.height=e.offsetHeight+"px"),r.style.top=t._getOffsetTop(e)+"px",t.$editInput.removeClass("smart-hidden"),r.value=e.label,t._editedItem=e,r.setAttribute("aria-label","Edit item "+e.label),setTimeout((function(){r.focus()}),0)}_styleChangedHandler(e){e.detail.styleProperties&&e.detail.styleProperties["font-size"]&&this._checkOverflow()}_updateScrollButtonVisibility(){const e=this,t=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===t)return;let r=!0,n=!0;if(0===Math.round(e.$.scrollViewer.scrollTop)&&(r=!1),Math.round(e.$.scrollViewer.$.scrollViewerContainer.offsetHeight+e.$.scrollViewer.scrollTop)>=Math.round(e.$.scrollViewer.$.scrollViewerContentContainer.offsetHeight)&&(n=!1),"auto"===t){if(r&&n)return e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.$scrollViewer.removeClass("one-button-shown"),void e.$.scrollViewer.refresh();r?e.$scrollButtonNear.removeClass("smart-hidden"):e.$scrollButtonNear.addClass("smart-hidden"),n?e.$scrollButtonFar.removeClass("smart-hidden"):e.$scrollButtonFar.addClass("smart-hidden"),e.$scrollViewer.addClass("one-button-shown"),e.$.scrollViewer.refresh()}else"scroll"!==t||e.disabled||(e.$.scrollButtonNear.disabled=!r,e.$.scrollButtonFar.disabled=!n)}_updateState(e,t,r){const n=this;switch(e){case"expanded":{const e=n._state.expanded.indexOf(t);if(r&&-1===e)n._state.expanded.push(t);else{if(r||-1===e)return;n._state.expanded.splice(e,1)}break}case"filter":n._state.filter=void 0!==t?t:n.$.filterInput.value;break;case"selected":n._state.selected=[];for(let e=0;e<n.selectedIndexes.length;e++){const t=n._menuItems[n.selectedIndexes[e]];n._state.selected.push(t.id)}break;case"sorted":n._state.sorted=t}n.autoSaveState&&window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state))}_verticalScrollbarHandler(){const e=this,t=e.$.verticalScrollBar,r=t.value;e.disabled||(t.max!==r?t.min!==r?(delete e._topReached,delete e._bottomReached):e._topReached||(e.$.fireEvent("scrollTopReached"),delete e._bottomReached,e._topReached=!0):e._bottomReached||(e.$.fireEvent("scrollBottomReached"),delete e._topReached,e._bottomReached=!0))}})}});