/* JqTree 1.6.0 Copyright 2021 Marco Braak Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. @license */ var jqtree=function(e,t){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var r=o(t),i=n(t),s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var l,d=function(){return(d=Object.assign||function(e){for(var t,o=1,n=arguments.length;o=0?this.parent.children[e]:null}return null},e.prototype.getNextSibling=function(){if(this.parent){var e=this.parent.getChildIndex(this)+1;return eo.right||t>o.bottom)return null;for(var n=0,r=this.hitAreas.length;n>1,s=this.hitAreas[i];if(ts.bottom))return s;n=i+1}}return null},e.prototype.mustOpenFolderTimer=function(e){var t=e.node;return t.isFolder()&&!t.is_open&&e.position===l.Inside},e.prototype.updateDropHint=function(){if(this.hoveredArea){this.removeDropHint();var e=this.treeWidget._getNodeElementForNode(this.hoveredArea.node);this.previousGhost=e.addDropHint(this.hoveredArea.position)}},e.prototype.startOpenFolderTimer=function(e){var t=this;this.stopOpenFolderTimer(),this.openFolderTimer=window.setTimeout((function(){t.treeWidget._openNode(e,t.treeWidget.options.slide,(function(){t.refresh(),t.updateDropHint()}))}),this.treeWidget.options.openFolderDelay)},e.prototype.stopOpenFolderTimer=function(){this.openFolderTimer&&(clearTimeout(this.openFolderTimer),this.openFolderTimer=null)},e.prototype.moveItem=function(e){var t=this;if(this.currentItem&&this.hoveredArea&&this.hoveredArea.position!==l.None&&this.canMoveToArea(this.hoveredArea)){var o=this.currentItem.node,n=this.hoveredArea.node,r=this.hoveredArea.position,i=o.parent;r===l.Inside&&(this.hoveredArea.node.is_open=!0);var s=function(){t.treeWidget.tree.moveNode(o,n,r),t.treeWidget.element.empty(),t.treeWidget._refreshElements(null)};this.treeWidget._triggerEvent("tree.move",{move_info:{moved_node:o,target_node:n,position:u(r),previous_parent:i,do_move:s,original_event:e.originalEvent}}).isDefaultPrevented()||s()}},e.prototype.getTreeDimensions=function(){var e=this.treeWidget.element.offset();if(e){var t=this.treeWidget.element,o=t.width()||0,n=t.height()||0,r=e.left+this.treeWidget._getScrollLeft();return{left:r,top:e.top,right:r+o,bottom:e.top+n+16}}return{left:0,top:0,right:0,bottom:0}},e}(),g=function(e){function t(t,o,n){var r=e.call(this,t)||this;return r.currentNode=o,r.treeBottom=n,r}return a(t,e),t.prototype.generate=function(){return this.positions=[],this.lastTop=0,this.iterate(),this.generateHitAreas(this.positions)},t.prototype.generateHitAreas=function(e){for(var t=-1,o=[],n=[],r=0,i=e;r").addClass("jqtree-title jqtree-dragging"),r?this.$element.text(e):this.$element.html(e),this.$element.css("position","absolute"),n.append(this.$element)}return e.prototype.move=function(e,t){this.$element.offset({left:e-this.offsetX,top:t-this.offsetY})},e.prototype.remove=function(){this.$element.remove()},e}(),m=function(e){return e?"true":"false"},y=function(){function e(e){this.treeWidget=e,this.openedIconElement=this.createButtonElement(e.options.openedIcon||"+"),this.closedIconElement=this.createButtonElement(e.options.closedIcon||"-")}return e.prototype.render=function(e){e&&e.parent?this.renderFromNode(e):this.renderFromRoot()},e.prototype.renderFromRoot=function(){var e=this.treeWidget.element;e.empty(),this.createDomElements(e[0],this.treeWidget.tree.children,!0,1)},e.prototype.renderFromNode=function(e){var t=jQuery(e.element),o=this.createLi(e,e.getLevel());this.attachNodeData(e,o),t.after(o),t.remove(),e.children&&this.createDomElements(o,e.children,!1,e.getLevel()+1)},e.prototype.createDomElements=function(e,t,o,n){var r=this.createUl(o);e.appendChild(r);for(var i=0,s=t;i1)){var o=e.changedTouches[0];t.handleMouseDown(C(o,e))}},t.touchMove=function(e){if(e&&!(e.touches.length>1)){var o=e.changedTouches[0];t.handleMouseMove(e,C(o,e))}},t.touchEnd=function(e){if(e&&!(e.touches.length>1)){var o=e.changedTouches[0];t.handleMouseUp(C(o,e))}},t}return a(t,e),t.prototype.init=function(){var e=this.$el.get(0);e.addEventListener("mousedown",this.mouseDown,{passive:!1}),e.addEventListener("touchstart",this.touchStart,{passive:!1}),this.isMouseStarted=!1,this.mouseDelayTimer=null,this.isMouseDelayMet=!1,this.mouseDownInfo=null},t.prototype.deinit=function(){var e=this.$el.get(0);e.removeEventListener("mousedown",this.mouseDown,{passive:!1}),e.removeEventListener("touchstart",this.touchStart,{passive:!1}),this.removeMouseMoveEventListeners()},t.prototype.handleMouseDown=function(e){return this.isMouseStarted&&this.handleMouseUp(e),this.mouseDownInfo=e,!!this.mouseCapture(e)&&(this.handleStartMouse(),!0)},t.prototype.handleStartMouse=function(){document.addEventListener("mousemove",this.mouseMove,{passive:!1}),document.addEventListener("touchmove",this.touchMove,{passive:!1}),document.addEventListener("mouseup",this.mouseUp,{passive:!1}),document.addEventListener("touchend",this.touchEnd,{passive:!1});var e=this.getMouseDelay();e?this.startMouseDelayTimer(e):this.isMouseDelayMet=!0},t.prototype.startMouseDelayTimer=function(e){var t=this;this.mouseDelayTimer&&clearTimeout(this.mouseDelayTimer),this.mouseDelayTimer=window.setTimeout((function(){t.mouseDownInfo&&(t.isMouseDelayMet=!0)}),e),this.isMouseDelayMet=!1},t.prototype.handleMouseMove=function(e,t){if(this.isMouseStarted)return this.mouseDrag(t),void(e.cancelable&&e.preventDefault());this.isMouseDelayMet&&(this.mouseDownInfo&&(this.isMouseStarted=!1!==this.mouseStart(this.mouseDownInfo)),this.isMouseStarted?(this.mouseDrag(t),e.cancelable&&e.preventDefault()):this.handleMouseUp(t))},t.prototype.handleMouseUp=function(e){this.removeMouseMoveEventListeners(),this.isMouseDelayMet=!1,this.mouseDownInfo=null,this.isMouseStarted&&(this.isMouseStarted=!1,this.mouseStop(e))},t.prototype.removeMouseMoveEventListeners=function(){document.removeEventListener("mousemove",this.mouseMove,{passive:!1}),document.removeEventListener("touchmove",this.touchMove,{passive:!1}),document.removeEventListener("mouseup",this.mouseUp,{passive:!1}),document.removeEventListener("touchend",this.touchEnd,{passive:!1})},t}(D),j=function(){function e(e){this.treeWidget=e}return e.prototype.saveState=function(){var e=JSON.stringify(this.getState());this.treeWidget.options.onSetStateFromStorage?this.treeWidget.options.onSetStateFromStorage(e):this.supportsLocalStorage()&&localStorage.setItem(this.getKeyName(),e)},e.prototype.getStateFromStorage=function(){var e=this.loadFromStorage();return e?this.parseState(e):null},e.prototype.getState=function(){var e,t,o=this;return{open_nodes:(t=[],o.treeWidget.tree.iterate((function(e){return e.is_open&&e.id&&e.hasChildren()&&t.push(e.id),!0})),t),selected_node:(e=[],o.treeWidget.getSelectedNodes().forEach((function(t){null!=t.id&&e.push(t.id)})),e)}},e.prototype.setInitialState=function(e){if(e){var t=!1;return e.open_nodes&&(t=this.openInitialNodes(e.open_nodes)),e.selected_node&&(this.resetSelection(),this.selectInitialNodes(e.selected_node)),t}return!1},e.prototype.setInitialStateOnDemand=function(e,t){e?this.doSetInitialStateOnDemand(e.open_nodes,e.selected_node,t):t()},e.prototype.getNodeIdToBeSelected=function(){var e=this.getStateFromStorage();return e&&e.selected_node?e.selected_node[0]:null},e.prototype.parseState=function(e){var t,o=JSON.parse(e);return o&&o.selected_node&&("number"==typeof(t=o.selected_node)&&t%1==0)&&(o.selected_node=[o.selected_node]),o},e.prototype.loadFromStorage=function(){return this.treeWidget.options.onGetStateFromStorage?this.treeWidget.options.onGetStateFromStorage():this.supportsLocalStorage()?localStorage.getItem(this.getKeyName()):null},e.prototype.openInitialNodes=function(e){for(var t=!1,o=0,n=e;o=r},e.prototype.getScrollLeft=function(){return this.$scrollParent&&this.$scrollParent.scrollLeft()||0},e.prototype.initScrollParent=function(){var e=this,t=function(){e.scrollParentTop=0,e.$scrollParent=null};"fixed"===this.treeWidget.$el.css("position")&&t();var o=function(){var t=["overflow","overflow-y"],o=function(e){for(var o=0,n=t;o0,s=o.left+n.clientWidth,a=o.left,l=e.pageX>s-20,d=e.pageX0,i=e.pageX>n-20,s=e.pageX-o<20;i?t.scrollLeft(o+20):s&&r&&t.scrollLeft(Math.max(o-20,0))}},e}(),W=function(){function e(e){this.treeWidget=e,this.selectedNodes=new Set,this.clear()}return e.prototype.getSelectedNode=function(){var e=this.getSelectedNodes();return!!e.length&&e[0]},e.prototype.getSelectedNodes=function(){var e=this;if(this.selectedSingleNode)return[this.selectedSingleNode];var t=[];return this.selectedNodes.forEach((function(o){var n=e.treeWidget.getNodeById(o);n&&t.push(n)})),t},e.prototype.getSelectedNodesUnder=function(e){if(this.selectedSingleNode)return e.isParentOf(this.selectedSingleNode)?[this.selectedSingleNode]:[];var t=[];for(var o in this.selectedNodes)if(Object.prototype.hasOwnProperty.call(this.selectedNodes,o)){var n=this.treeWidget.getNodeById(o);n&&e.isParentOf(n)&&t.push(n)}return t},e.prototype.isNodeSelected=function(e){return null!=e.id?this.selectedNodes.has(e.id):!!this.selectedSingleNode&&this.selectedSingleNode.element===e.element},e.prototype.clear=function(){this.selectedNodes.clear(),this.selectedSingleNode=null},e.prototype.removeFromSelection=function(e,t){var o=this;void 0===t&&(t=!1),null==e.id?this.selectedSingleNode&&e.element===this.selectedSingleNode.element&&(this.selectedSingleNode=null):(this.selectedNodes.delete(e.id),t&&e.iterate((function(){return null!=e.id&&o.selectedNodes.delete(e.id),!0})))},e.prototype.addToSelection=function(e){null!=e.id?this.selectedNodes.add(e.id):this.selectedSingleNode=e},e.prototype.isFocusOnTree=function(){var e=document.activeElement;return Boolean(e&&"SPAN"===e.tagName&&this.treeWidget._containsElement(e))},e}(),b=function(){function e(e,t){this.init(e,t)}return e.prototype.init=function(e,t){this.node=e,this.treeWidget=t,e.element||(e.element=this.treeWidget.element.get(0)),this.$element=jQuery(e.element)},e.prototype.addDropHint=function(e){return this.mustShowBorderDropHint(e)?new w(this.$element,this.treeWidget._getScrollLeft()):new L(this.node,this.$element,e)},e.prototype.select=function(e){var t,o=this.getLi();o.addClass("jqtree-selected"),o.attr("aria-selected","true");var n=this.getSpan();n.attr("tabindex",null!==(t=this.treeWidget.options.tabIndex)&&void 0!==t?t:null),e&&n.trigger("focus")},e.prototype.deselect=function(){var e=this.getLi();e.removeClass("jqtree-selected"),e.attr("aria-selected","false");var t=this.getSpan();t.removeAttr("tabindex"),t.blur()},e.prototype.getUl=function(){return this.$element.children("ul:first")},e.prototype.getSpan=function(){return this.$element.children(".jqtree-element").find("span.jqtree-title")},e.prototype.getLi=function(){return this.$element},e.prototype.mustShowBorderDropHint=function(e){return e===l.Inside},e}(),T=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.open=function(e,t,o){var n=this;if(void 0===t&&(t=!0),void 0===o&&(o="fast"),!this.node.is_open){this.node.is_open=!0;var r=this.getButton();r.removeClass("jqtree-closed"),r.html("");var i=r.get(0);if(i){var s=this.treeWidget.renderer.openedIconElement.cloneNode(!0);i.appendChild(s)}var a=function(){n.getLi().removeClass("jqtree-closed"),n.getSpan().attr("aria-expanded","true"),e&&e(n.node),n.treeWidget._triggerEvent("tree.open",{node:n.node})};t?this.getUl().slideDown(o,a):(this.getUl().show(),a())}},t.prototype.close=function(e,t){var o=this;if(void 0===e&&(e=!0),void 0===t&&(t="fast"),this.node.is_open){this.node.is_open=!1;var n=this.getButton();n.addClass("jqtree-closed"),n.html("");var r=n.get(0);if(r){var i=this.treeWidget.renderer.closedIconElement.cloneNode(!0);r.appendChild(i)}var s=function(){o.getLi().addClass("jqtree-closed"),o.getSpan().attr("aria-expanded","false"),o.treeWidget._triggerEvent("tree.close",{node:o.node})};e?this.getUl().slideUp(t,s):(this.getUl().hide(),s())}},t.prototype.mustShowBorderDropHint=function(e){return!this.node.is_open&&e===l.Inside},t.prototype.getButton=function(){return this.$element.children(".jqtree-element").find("a.jqtree-toggler")},t}(b),w=function(){function e(e,t){var o=e.children(".jqtree-element"),n=e.width()||0,r=Math.max(n+t-4,0),i=o.outerHeight()||0,s=Math.max(i-4,0);this.$hint=jQuery(''),o.append(this.$hint),this.$hint.css({width:r,height:s})}return e.prototype.remove=function(){this.$hint.remove()},e}(),L=function(){function e(e,t,o){this.$element=t,this.node=e,this.$ghost=jQuery('
  • \n
  • '),o===l.After?this.moveAfter():o===l.Before?this.moveBefore():o===l.Inside&&(e.isFolder()&&e.is_open?this.moveInsideOpenFolder():this.moveInside())}return e.prototype.remove=function(){this.$ghost.remove()},e.prototype.moveAfter=function(){this.$element.after(this.$ghost)},e.prototype.moveBefore=function(){this.$element.before(this.$ghost)},e.prototype.moveInsideOpenFolder=function(){jQuery(this.node.children[0].element).before(this.$ghost)},e.prototype.moveInside=function(){this.$element.after(this.$ghost),this.$ghost.addClass("jqtree-inside")},e}(),H=r.default||i,A="Node parameter is empty",M="Parameter is empty: ",P=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.handleClick=function(e){var o=t.getClickTarget(e.target);if(o)if("button"===o.type)t.toggle(o.node,t.options.slide),e.preventDefault(),e.stopPropagation();else if("label"===o.type){var n=o.node;t._triggerEvent("tree.click",{node:n,click_event:e}).isDefaultPrevented()||t.doSelectNode(n)}},t.handleDblclick=function(e){var o=t.getClickTarget(e.target);"label"===(null==o?void 0:o.type)&&t._triggerEvent("tree.dblclick",{node:o.node,click_event:e})},t.handleContextmenu=function(e){var o=H(e.target).closest("ul.jqtree-tree .jqtree-element");if(o.length){var n=t.getNode(o);if(n)return e.preventDefault(),e.stopPropagation(),t._triggerEvent("tree.contextmenu",{node:n,click_event:e}),!1}return null},t}return a(t,e),t.prototype.toggle=function(e,t){if(void 0===t&&(t=null),!e)throw Error(A);var o=null!=t?t:this.options.slide;return e.is_open?this.closeNode(e,o):this.openNode(e,o),this.element},t.prototype.getTree=function(){return this.tree},t.prototype.selectNode=function(e,t){return this.doSelectNode(e,t),this.element},t.prototype.getSelectedNode=function(){return this.selectNodeHandler.getSelectedNode()},t.prototype.toJson=function(){return JSON.stringify(this.tree.getData())},t.prototype.loadData=function(e,t){return this.doLoadData(e,t),this.element},t.prototype.loadDataFromUrl=function(e,t,o){return"string"==typeof e?this.doLoadDataFromUrl(e,t,null!=o?o:null):this.doLoadDataFromUrl(null,e,t),this.element},t.prototype.reload=function(e){return this.doLoadDataFromUrl(null,null,e),this.element},t.prototype.getNodeById=function(e){return this.tree.getNodeById(e)},t.prototype.getNodeByName=function(e){return this.tree.getNodeByName(e)},t.prototype.getNodeByNameMustExist=function(e){return this.tree.getNodeByNameMustExist(e)},t.prototype.getNodesByProperty=function(e,t){return this.tree.getNodesByProperty(e,t)},t.prototype.getNodeByHtmlElement=function(e){return this.getNode(H(e))},t.prototype.getNodeByCallback=function(e){return this.tree.getNodeByCallback(e)},t.prototype.openNode=function(e,t,o){var n=this;if(!e)throw Error(A);var r=function(){var e,r,i;return"function"==typeof t?(r=t,i=null):(i=t,r=o),null==i&&(i=null!==(e=n.options.slide)&&void 0!==e&&e),[i,r]}(),i=r[0],s=r[1];return this._openNode(e,i,s),this.element},t.prototype.closeNode=function(e,t){if(!e)throw Error(A);var o=null!=t?t:this.options.slide;return(e.isFolder()||e.isEmptyFolder)&&(new T(e,this).close(o,this.options.animationSpeed),this.saveState()),this.element},t.prototype.isDragging=function(){return this.dndHandler.isDragging},t.prototype.refreshHitAreas=function(){return this.dndHandler.refresh(),this.element},t.prototype.addNodeAfter=function(e,t){var o=t.addAfter(e);return o&&this._refreshElements(t.parent),o},t.prototype.addNodeBefore=function(e,t){if(!t)throw Error(M+"existingNode");var o=t.addBefore(e);return o&&this._refreshElements(t.parent),o},t.prototype.addParentNode=function(e,t){if(!t)throw Error(M+"existingNode");var o=t.addParent(e);return o&&this._refreshElements(o.parent),o},t.prototype.removeNode=function(e){if(!e)throw Error(A);if(!e.parent)throw Error("Node has no parent");this.selectNodeHandler.removeFromSelection(e,!0);var t=e.parent;return e.remove(),this._refreshElements(t),this.element},t.prototype.appendNode=function(e,t){var o=t||this.tree,n=o.append(e);return this._refreshElements(o),n},t.prototype.prependNode=function(e,t){var o=null!=t?t:this.tree,n=o.prepend(e);return this._refreshElements(o),n},t.prototype.updateNode=function(e,t){if(!e)throw Error(A);var o="object"==typeof t&&t.id&&t.id!==e.id;o&&this.tree.removeNodeFromIndex(e),e.setData(t),o&&this.tree.addNodeToIndex(e),"object"==typeof t&&t.children&&t.children instanceof Array&&(e.removeChildren(),t.children.length&&e.loadFromData(t.children));var n=this.selectNodeHandler.isFocusOnTree(),r=this.isSelectedNodeInSubtree(e);return this._refreshElements(e),r&&this.selectCurrentNode(n),this.element},t.prototype.isSelectedNodeInSubtree=function(e){var t=this.getSelectedNode();return!!t&&(e===t||e.isParentOf(t))},t.prototype.moveNode=function(e,t,o){if(!e)throw Error(A);if(!t)throw Error(M+"targetNode");var n=h[o];return void 0!==n&&(this.tree.moveNode(e,t,n),this._refreshElements(null)),this.element},t.prototype.getStateFromStorage=function(){return this.saveStateHandler.getStateFromStorage()},t.prototype.addToSelection=function(e,t){if(!e)throw Error(A);return this.selectNodeHandler.addToSelection(e),this._getNodeElementForNode(e).select(void 0===t||t),this.saveState(),this.element},t.prototype.getSelectedNodes=function(){return this.selectNodeHandler.getSelectedNodes()},t.prototype.isNodeSelected=function(e){if(!e)throw Error(A);return this.selectNodeHandler.isNodeSelected(e)},t.prototype.removeFromSelection=function(e){if(!e)throw Error(A);return this.selectNodeHandler.removeFromSelection(e),this._getNodeElementForNode(e).deselect(),this.saveState(),this.element},t.prototype.scrollToNode=function(e){if(!e)throw Error(A);var t=H(e.element).offset(),o=t?t.top:0,n=this.$el.offset(),r=o-(n?n.top:0);return this.scrollHandler.scrollToY(r),this.element},t.prototype.getState=function(){return this.saveStateHandler.getState()},t.prototype.setState=function(e){return this.saveStateHandler.setInitialState(e),this._refreshElements(null),this.element},t.prototype.setOption=function(e,t){return this.options[e]=t,this.element},t.prototype.moveDown=function(){var e=this.getSelectedNode();return e&&this.keyHandler.moveDown(e),this.element},t.prototype.moveUp=function(){var e=this.getSelectedNode();return e&&this.keyHandler.moveUp(e),this.element},t.prototype.getVersion=function(){return"1.6.0"},t.prototype._triggerEvent=function(e,t){var o=H.Event(e,t);return this.element.trigger(o),o},t.prototype._openNode=function(e,t,o){var n=this;void 0===t&&(t=!0);var r=function(e,t,o){new T(e,n).open(o,t,n.options.animationSpeed)};if(e.isFolder()||e.isEmptyFolder)if(e.load_on_demand)this.loadFolderOnDemand(e,t,o);else{for(var i=e.parent;i;)i.parent&&r(i,!1,null),i=i.parent;r(e,t,o),this.saveState()}},t.prototype._refreshElements=function(e){this.renderer.render(e),this._triggerEvent("tree.refresh")},t.prototype._getNodeElementForNode=function(e){return e.isFolder()?new T(e,this):new b(e,this)},t.prototype._getNodeElement=function(e){var t=this.getNode(e);return t?this._getNodeElementForNode(t):null},t.prototype._containsElement=function(e){var t=this.getNode(H(e));return null!=t&&t.tree===this.tree},t.prototype._getScrollLeft=function(){return this.scrollHandler.getScrollLeft()},t.prototype.init=function(){e.prototype.init.call(this),this.element=this.$el,this.isInitialized=!1,this.options.rtl=this.getRtlOption(),null==this.options.closedIcon&&(this.options.closedIcon=this.getDefaultClosedIcon()),this.renderer=new y(this),this.dataLoader=new N(this),this.saveStateHandler=new j(this),this.selectNodeHandler=new W(this),this.dndHandler=new f(this),this.scrollHandler=new F(this),this.keyHandler=new S(this),this.initData(),this.element.on("click",this.handleClick),this.element.on("dblclick",this.handleDblclick),this.options.useContextMenu&&this.element.on("contextmenu",this.handleContextmenu)},t.prototype.deinit=function(){this.element.empty(),this.element.off(),this.keyHandler.deinit(),this.tree=new p({},!0),e.prototype.deinit.call(this)},t.prototype.mouseCapture=function(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseCapture(e)},t.prototype.mouseStart=function(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseStart(e)},t.prototype.mouseDrag=function(e){if(this.options.dragAndDrop){var t=this.dndHandler.mouseDrag(e);return this.scrollHandler.checkScrolling(),t}return!1},t.prototype.mouseStop=function(e){return!!this.options.dragAndDrop&&this.dndHandler.mouseStop(e)},t.prototype.getMouseDelay=function(){var e;return null!==(e=this.options.startDndDelay)&&void 0!==e?e:0},t.prototype.initData=function(){this.options.data?this.doLoadData(this.options.data,null):this.getDataUrlInfo(null)?this.doLoadDataFromUrl(null,null,null):this.doLoadData([],null)},t.prototype.getDataUrlInfo=function(e){var t,o=this,n=this.options.dataUrl||this.element.data("url"),r=function(t){if(null==e?void 0:e.id){var n={node:e.id};t.data=n}else{var r=o.getNodeIdToBeSelected();if(r){n={selected_node:r};t.data=n}}};return"function"==typeof n?n(e):"string"==typeof n?(r(t={url:n}),t):n&&"object"==typeof n?(r(n),n):null},t.prototype.getNodeIdToBeSelected=function(){return this.options.saveState?this.saveStateHandler.getNodeIdToBeSelected():null},t.prototype.initTree=function(e){var t=this,o=function(){t.isInitialized||(t.isInitialized=!0,t._triggerEvent("tree.init"))};if(this.options.nodeClass){this.tree=new this.options.nodeClass(null,!0,this.options.nodeClass),this.selectNodeHandler.clear(),this.tree.loadFromData(e);var n=this.setInitialState();this._refreshElements(null),n?this.setInitialStateOnDemand(o):o()}},t.prototype.setInitialState=function(){var e=this,t=function(){if(e.options.saveState){var t=e.saveStateHandler.getStateFromStorage();return t?[!0,e.saveStateHandler.setInitialState(t)]:[!1,!1]}return[!1,!1]}(),o=t[0],n=t[1];return o||(n=function(){if(!1===e.options.autoOpen)return!1;var t=e.getAutoOpenMaxLevel(),o=!1;return e.tree.iterate((function(e,n){return e.load_on_demand?(o=!0,!1):!!e.hasChildren()&&(e.is_open=!0,n!==t)})),o}()),n},t.prototype.setInitialStateOnDemand=function(e){var t,o,n,r=this;(function(){if(r.options.saveState){var t=r.saveStateHandler.getStateFromStorage();return!!t&&(r.saveStateHandler.setInitialStateOnDemand(t,e),!0)}return!1})()||(t=r.getAutoOpenMaxLevel(),o=0,(n=function(){r.tree.iterate((function(e,i){return e.load_on_demand?(e.is_loading||function(e){o+=1,r._openNode(e,!1,(function(){o-=1,n()}))}(e),!1):(r._openNode(e,!1,null),i!==t)})),0===o&&e()})())},t.prototype.getAutoOpenMaxLevel=function(){return!0===this.options.autoOpen?-1:"number"==typeof this.options.autoOpen?this.options.autoOpen:"string"==typeof this.options.autoOpen?parseInt(this.options.autoOpen,10):0},t.prototype.getClickTarget=function(e){var t=H(e),o=t.closest(".jqtree-toggler");if(o.length){if(n=this.getNode(o))return{type:"button",node:n}}else{var n,r=t.closest(".jqtree-element");if(r.length)if(n=this.getNode(r))return{type:"label",node:n}}return null},t.prototype.getNode=function(e){var t=e.closest("li.jqtree_common");return 0===t.length?null:t.data("node")},t.prototype.saveState=function(){this.options.saveState&&this.saveStateHandler.saveState()},t.prototype.selectCurrentNode=function(e){var t=this.getSelectedNode();if(t){var o=this._getNodeElementForNode(t);o&&o.select(e)}},t.prototype.deselectCurrentNode=function(){var e=this.getSelectedNode();e&&this.removeFromSelection(e)},t.prototype.getDefaultClosedIcon=function(){return this.options.rtl?"◀":"►"},t.prototype.getRtlOption=function(){if(null!=this.options.rtl)return this.options.rtl;var e=this.element.data("rtl");return null!==e&&!1!==e&&void 0!==e},t.prototype.doSelectNode=function(e,t){var o=this,n=function(){o.options.saveState&&o.saveStateHandler.saveState()};if(!e)return this.deselectCurrentNode(),void n();var r=d(d({},{mustSetFocus:!0,mustToggle:!0}),t||{});if(o.options.onCanSelectNode?!0===o.options.selectable&&o.options.onCanSelectNode(e):!0===o.options.selectable){if(this.selectNodeHandler.isNodeSelected(e))r.mustToggle&&(this.deselectCurrentNode(),this._triggerEvent("tree.select",{node:null,previous_node:e}));else{var i=this.getSelectedNode()||null;this.deselectCurrentNode(),this.addToSelection(e,r.mustSetFocus),this._triggerEvent("tree.select",{node:e,deselected_node:i}),(s=e.parent)&&s.parent&&!s.is_open&&o.openNode(s,!1)}var s;n()}},t.prototype.doLoadData=function(e,t){e&&(this._triggerEvent("tree.load_data",{tree_data:e}),t?(this.deselectNodes(t),this.loadSubtree(e,t)):this.initTree(e),this.isDragging()&&this.dndHandler.refresh())},t.prototype.deselectNodes=function(e){for(var t=0,o=this.selectNodeHandler.getSelectedNodesUnder(e);t