trilium/public/libraries/fancytree/jquery.fancytree-all.min.js
2017-12-16 00:19:15 -05:00

75 lines
107 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! jQuery Fancytree Plugin - 2.26.0 - 2017-11-04T17:52:53Z
* https://github.com/mar10/fancytree
* Copyright (c) 2017 Martin Wendt; Licensed MIT
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [
"jquery",
"jquery-ui/ui/widgets/mouse",
"jquery-ui/ui/widgets/draggable",
"jquery-ui/ui/widgets/droppable",
"jquery-ui/ui/effects/effect-blind",
"jquery-ui/ui/data",
"jquery-ui/ui/effect",
"jquery-ui/ui/focusable",
"jquery-ui/ui/keycode",
"jquery-ui/ui/position",
"jquery-ui/ui/scroll-parent",
"jquery-ui/ui/tabbable",
"jquery-ui/ui/unique-id",
"jquery-ui/ui/widget"
], factory );
} else if ( typeof module === "object" && module.exports ) {
// Node/CommonJS
module.exports = factory(require("jquery"));
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree.ui-deps"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree.ui-deps"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(b,c){b||(c=c?": "+c:"",a.error("Fancytree assertion failed"+c))}function c(a,b){var c,d,e=window.console?window.console[a]:null;if(e)try{e.apply(window.console,b)}catch(f){for(d="",c=0;c<b.length;c++)d+=b[c];e(d)}}function d(a){return!(!a.tree||void 0===a.statusNodeType)}function e(b,c,d,e){var f,g,h,i=a.map(a.trim(b).split("."),function(a){return parseInt(a,10)}),j=a.map(Array.prototype.slice.call(arguments,1),function(a){return parseInt(a,10)});for(f=0;f<j.length;f++)if(g=i[f]||0,h=j[f]||0,g!==h)return g>h;return!0}function f(a,b,c,d,e){var f=function(){var c=b[a],f=d[a],g=b.ext[e],h=function(){return c.apply(b,arguments)},i=function(a){return c.apply(b,a)};return function(){var a=b._local,c=b._super,d=b._superApply;try{return b._local=g,b._super=h,b._superApply=i,f.apply(b,arguments)}finally{b._local=a,b._super=c,b._superApply=d}}}();return f}function g(b,c,d,e){for(var g in d)"function"==typeof d[g]?"function"==typeof b[g]?b[g]=f(g,b,c,d,e):"_"===g.charAt(0)?b.ext[e][g]=f(g,b,c,d,e):a.error("Could not override tree."+g+". Use prefix '_' to create tree."+e+"._"+g):"options"!==g&&(b.ext[e][g]=d[g])}function h(b,c){return void 0===b?a.Deferred(function(){this.resolve()}).promise():a.Deferred(function(){this.resolveWith(b,c)}).promise()}function i(b,c){return void 0===b?a.Deferred(function(){this.reject()}).promise():a.Deferred(function(){this.rejectWith(b,c)}).promise()}function j(a,b){return function(){a.resolveWith(b)}}function k(b){var c=a.extend({},b.data()),d=c.json;return delete c.fancytree,delete c.uiFancytree,d&&(delete c.json,c=a.extend(c,d)),c}function l(a){return(""+a).replace(v,function(a){return x[a]})}function m(a){return a=a.toLowerCase(),function(b){return b.title.toLowerCase().indexOf(a)>=0}}function n(a){var b=new RegExp("^"+a,"i");return function(a){return b.test(a.title)}}function o(c,d){var e,f,g,h;for(this.parent=c,this.tree=c.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},e=0,f=D.length;e<f;e++)g=D[e],this[g]=d[g];null==this.unselectableIgnore&&null==this.unselectableStatus||(this.unselectable=!0),d.hideCheckbox&&a.error("'hideCheckbox' node option was removed in v2.23.0: use 'checkbox: false'"),d.data&&a.extend(this.data,d.data);for(g in d)E[g]||a.isFunction(d[g])||G[g]||(this.data[g]=d[g]);null==this.key?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),b(this.key,"defaultKey() must return a unique key")):this.key="_"+s._nextNodeKey++:this.key=""+this.key,d.active&&(b(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),d.selected&&(this.tree.lastSelectedNode=this),h=d.children,h?h.length?this._setChildren(h):this.children=this.lazy?[]:null:this.children=null,this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function p(b){this.widget=b,this.$div=b.element,this.options=b.options,this.options&&(a.isFunction(this.options.lazyload)&&!a.isFunction(this.options.lazyLoad)&&(this.options.lazyLoad=function(){return s.warn("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),b.options.lazyload.apply(this,arguments)}),a.isFunction(this.options.loaderror)&&a.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),void 0!==this.options.fx&&s.warn("The 'fx' option was replaced by 'toggleEffect' since 2014-11-30."),void 0!==this.options.removeNode&&a.error("The 'removeNode' event was replaced by 'modifyChild' since 2.20 (2016-09-10).")),this.ext={},this.data=k(this.$div),this._id=a.ui.fancytree._nextId++,this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this._hasFocus=null,this._tempCache={},this._lastMousedownNode=null,this._enableUpdate=!0,this.lastSelectedNode=null,this.systemFocusElement=null,this.lastQuicksearchTerm="",this.lastQuicksearchTime=0,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var c,d={tree:this};this.rootNode=new o(d,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,c=a("<ul>",{"class":"ui-fancytree fancytree-container fancytree-plain"}).appendTo(this.$div),this.$container=c,this.rootNode.ul=c[0],null==this.options.debugLevel&&(this.options.debugLevel=s.debugLevel)}if(a.ui&&a.ui.fancytree)return void a.ui.fancytree.warn("Fancytree: ignored duplicate include");var q,r,s=null,t=new RegExp(/\.|\//),u=/[&<>"'\/]/g,v=/[<>"'\/]/g,w="$recursive_request",x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},y={16:!0,17:!0,18:!0},z={8:"backspace",9:"tab",10:"return",13:"return",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},A={0:"",1:"left",2:"middle",3:"right"},B="active expanded focus folder lazy radiogroup selected unselectable unselectableIgnore".split(" "),C={},D="checkbox expanded extraClasses folder icon key lazy radiogroup refKey selected statusNodeType title tooltip unselectable unselectableIgnore unselectableStatus".split(" "),E={},F={},G={active:!0,children:!0,data:!0,focus:!0};for(q=0;q<B.length;q++)C[B[q]]=!0;for(q=0;q<D.length;q++)r=D[q],E[r]=!0,r!==r.toLowerCase()&&(F[r.toLowerCase()]=r);return b(a.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),o.prototype={_findDirectChild:function(a){var b,c,d=this.children;if(d)if("string"==typeof a){for(b=0,c=d.length;b<c;b++)if(d[b].key===a)return d[b]}else{if("number"==typeof a)return this.children[a];if(a.parent===this)return a}return null},_setChildren:function(a){b(a&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var c=0,d=a.length;c<d;c++)this.children.push(new o(this,a[c]))},addChildren:function(c,d){var e,f,g,h=this.getFirstChild(),i=this.getLastChild(),j=null,k=[];for(a.isPlainObject(c)&&(c=[c]),this.children||(this.children=[]),e=0,f=c.length;e<f;e++)k.push(new o(this,c[e]));if(j=k[0],null==d?this.children=this.children.concat(k):(d=this._findDirectChild(d),g=a.inArray(d,this.children),b(g>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[g,0].concat(k))),h&&!d){for(e=0,f=k.length;e<f;e++)k[e].render();h!==this.getFirstChild()&&h.renderStatus(),i!==this.getLastChild()&&i.renderStatus()}else(!this.parent||this.parent.ul||this.tr)&&this.render();return 3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),this.triggerModifyChild("add",1===k.length?k[0]:null),j},addClass:function(a){return this.toggleClass(a,!0)},addNode:function(a,c){switch(void 0!==c&&"over"!==c||(c="child"),c){case"after":return this.getParent().addChildren(a,this.getNextSibling());case"before":return this.getParent().addChildren(a,this);case"firstChild":var d=this.children?this.children[0]:null;return this.addChildren(a,d);case"child":case"over":return this.addChildren(a)}b(!1,"Invalid mode: "+c)},addPagingNode:function(b,c){var d,e;if(c=c||"child",b===!1){for(d=this.children.length-1;d>=0;d--)e=this.children[d],"paging"===e.statusNodeType&&this.removeChild(e);return void(this.partload=!1)}return b=a.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},b),this.partload=!0,this.addNode(b,c)},appendSibling:function(a){return this.addNode(a,"after")},applyPatch:function(b){if(null===b)return this.remove(),h(this);var c,d,e,f={children:!0,expanded:!0,parent:!0};for(c in b)e=b[c],f[c]||a.isFunction(e)||(E[c]?this[c]=e:this.data[c]=e);return b.hasOwnProperty("children")&&(this.removeChildren(),b.children&&this._setChildren(b.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),d=b.hasOwnProperty("expanded")?this.setExpanded(b.expanded):h(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(a,b,c){return a.addNode(this.toDict(!0,c),b)},countChildren:function(a){var b,c,d,e=this.children;if(!e)return 0;if(d=e.length,a!==!1)for(b=0,c=d;b<c;b++)d+=e[b].countChildren();return d},debug:function(a){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),c("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(a){var b=a?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(b,this)},findAll:function(b){b=a.isFunction(b)?b:m(b);var c=[];return this.visit(function(a){b(a)&&c.push(a)}),c},findFirst:function(b){b=a.isFunction(b)?b:m(b);var c=null;return this.visit(function(a){if(b(a))return c=a,!1}),c},_changeSelectStatusAttrs:function(a){var c=!1,d=this.tree.options,e=s.evalOption("unselectable",this,this,d,!1),f=s.evalOption("unselectableStatus",this,this,d,void 0);switch(e&&null!=f&&(a=f),a){case!1:c=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:c=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case void 0:c=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:b(!1,"invalid state: "+a)}return c&&this.renderStatus(),c},fixSelection3AfterClick:function(a){var b=this.isSelected();this.visit(function(a){a._changeSelectStatusAttrs(b)}),this.fixSelection3FromEndNodes(a)},fixSelection3FromEndNodes:function(a){function c(a){var b,e,f,g,h,i,j,k,l,m=a.children;if(m&&m.length){for(i=!0,j=!1,b=0,e=m.length;b<e;b++)f=m[b],g=c(f),k=s.evalOption("unselectableIgnore",f,f,d,!1),k||(g!==!1&&(j=!0),g!==!0&&(i=!1));h=!!i||!!j&&void 0}else l=s.evalOption("unselectableStatus",a,a,d,void 0),h=null==l?!!a.selected:!!l;return a._changeSelectStatusAttrs(h),h}var d=this.tree.options;b(3===d.selectMode,"expected selectMode 3"),c(this),this.visitParents(function(a){var b,c,e,f,g,h,i=a.children,j=!0,k=!1;for(b=0,c=i.length;b<c;b++)e=i[b],g=s.evalOption("unselectableIgnore",e,e,d,!1),g||(h=s.evalOption("unselectableStatus",e,e,d,void 0),f=null==h?!!e.selected:!!h,(f||e.partsel)&&(k=!0),f||(j=!1));f=!!j||!!k&&void 0,a._changeSelectStatusAttrs(f)})},fromDict:function(b){for(var c in b)E[c]?this[c]=b[c]:"data"===c?a.extend(this.data,b.data):a.isFunction(b[c])||G[c]||(this.data[c]=b[c]);b.children&&(this.removeChildren(),this.addChildren(b.children)),this.renderTitle()},getChildren:function(){if(void 0!==this.hasChildren())return this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return a.inArray(this,this.parent.children)},getIndexHier:function(b,c){b=b||".";var d,e=[];return a.each(this.getParentList(!1,!0),function(a,b){d=""+(b.getIndex()+1),c&&(d=("0000000"+d).substr(-c)),e.push(d)}),e.join(b)},getKeyPath:function(a){var b=[],c=this.tree.options.keyPathSeparator;return this.visitParents(function(a){a.parent&&b.unshift(a.key)},!a),c+b.join(c)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},getNextSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=0,b=c.length-1;a<b;a++)if(c[a]===this)return c[a+1]}return null},getParent:function(){return this.parent},getParentList:function(a,b){for(var c=[],d=b?this:this.parent;d;)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getPrevSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=1,b=c.length;a<b;a++)if(c[a]===this)return c[a-1]}return null},getSelectedNodes:function(a){var b=[];return this.visit(function(c){if(c.selected&&(b.push(c),a===!0))return"skip"}),b},hasChildren:function(){if(this.lazy){if(null==this.children)return;if(0===this.children.length)return!1;if(1===this.children.length&&this.children[0].isStatusNode())return;return!0}return!(!this.children||!this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(a){this.tree.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),c("info",arguments))},isActive:function(){return this.tree.activeNode===this},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(b){if(!b||b.tree!==this.tree)return!1;for(var c=this.parent;c;){if(c===b)return!0;c===c.parent&&a.error("Recursive parent link: "+c),c=c.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var a=this.parent;return!a||a.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var a=this.parent;return!a||a.children[a.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||void 0!==this.hasChildren()},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isPartsel:function(){return!this.selected&&!!this.partsel},isPartload:function(){return!!this.partload},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isPagingNode:function(){return"paging"===this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return void 0===this.hasChildren()},isVisible:function(){var a,b,c=this.getParentList(!1,!1);for(a=0,b=c.length;a<b;a++)if(!c[a].expanded)return!1;return!0},lazyLoad:function(a){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(a)},load:function(a){var c,d,e=this,f=this.isExpanded();return b(this.isLazy(),"load() requires a lazy node"),a||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),d=this.tree._triggerNodeEvent("lazyLoad",this),d===!1?h(this):(b("boolean"!=typeof d,"lazyLoad event must return source in data.result"),c=this.tree._callHook("nodeLoadChildren",this,d),f?(this.expanded=!0,c.always(function(){e.render()})):c.always(function(){e.renderStatus()}),c)):h(this)},makeVisible:function(b){var c,d=this,e=[],f=new a.Deferred,g=this.getParentList(!1,!1),h=g.length,i=!(b&&b.noAnimation===!0),j=!(b&&b.scrollIntoView===!1);for(c=h-1;c>=0;c--)e.push(g[c].setExpanded(!0,b));return a.when.apply(a,e).done(function(){j?d.scrollIntoView(i).done(function(){f.resolve()}):f.resolve()}),f.promise()},moveTo:function(c,d,e){void 0===d||"over"===d?d="child":"firstChild"===d&&(c.children&&c.children.length?(d="before",c=c.children[0]):d="child");var f,g=this.parent,h="child"===d?c:c.parent;if(this!==c){if(this.parent?h.isDescendantOf(this)&&a.error("Cannot move a node to its own descendant"):a.error("Cannot move system root"),h!==g&&g.triggerModifyChild("remove",this),1===this.parent.children.length){if(this.parent===h)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else f=a.inArray(this,this.parent.children),b(f>=0,"invalid source parent"),this.parent.children.splice(f,1);if(this.parent=h,h.hasChildren())switch(d){case"child":h.children.push(this);break;case"before":f=a.inArray(c,h.children),b(f>=0,"invalid target parent"),h.children.splice(f,0,this);break;case"after":f=a.inArray(c,h.children),b(f>=0,"invalid target parent"),h.children.splice(f+1,0,this);break;default:a.error("Invalid mode "+d)}else h.children=[this];e&&c.visit(e,!0),h===g?h.triggerModifyChild("move",this):h.triggerModifyChild("add",this),this.tree!==c.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(a){a.tree=c.tree},!0)),g.isDescendantOf(h)||g.render(),h.isDescendantOf(g)||h===g||h.render()}},navigate:function(b,c){function d(d){if(d){try{d.makeVisible({scrollIntoView:!1})}catch(e){}return a(d.span).is(":visible")?c===!1?d.setFocus():d.setActive():(d.debug("Navigate: skipping hidden node"),void d.navigate(b,c))}}var e,f,g,i=!0,j=a.ui.keyCode,k=null;switch(b){case j.BACKSPACE:this.parent&&this.parent.parent&&(g=d(this.parent));break;case j.HOME:this.tree.visit(function(b){if(a(b.span).is(":visible"))return g=d(b),!1});break;case j.END:this.tree.visit(function(b){a(b.span).is(":visible")&&(g=b)}),g&&(g=d(g));break;case j.LEFT:this.expanded?(this.setExpanded(!1),g=d(this)):this.parent&&this.parent.parent&&(g=d(this.parent));break;case j.RIGHT:this.expanded||!this.children&&!this.lazy?this.children&&this.children.length&&(g=d(this.children[0])):(this.setExpanded(),g=d(this));break;case j.UP:for(k=this.getPrevSibling();k&&!a(k.span).is(":visible");)k=k.getPrevSibling();for(;k&&k.expanded&&k.children&&k.children.length;)k=k.children[k.children.length-1];!k&&this.parent&&this.parent.parent&&(k=this.parent),g=d(k);break;case j.DOWN:if(this.expanded&&this.children&&this.children.length)k=this.children[0];else for(f=this.getParentList(!1,!0),e=f.length-1;e>=0;e--){for(k=f[e].getNextSibling();k&&!a(k.span).is(":visible");)k=k.getNextSibling();if(k)break}g=d(k);break;default:i=!1}return g||h()},remove:function(){return this.parent.removeChild(this)},removeChild:function(a){return this.tree._callHook("nodeRemoveChild",this,a)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},removeClass:function(a){return this.toggleClass(a,!1)},render:function(a,b){return this.tree._callHook("nodeRender",this,a,b)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},replaceWith:function(c){var d,e=this.parent,f=a.inArray(this,e.children),g=this;return b(this.isPagingNode(),"replaceWith() currently requires a paging status node"),d=this.tree._callHook("nodeLoadChildren",this,c),d.done(function(a){var b=g.children;for(q=0;q<b.length;q++)b[q].parent=e;e.children.splice.apply(e.children,[f+1,0].concat(b)),g.children=null,g.remove(),e.render()}).fail(function(){g.setExpanded()}),d},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=void 0,this.renderStatus()},scheduleAction:function(b,c){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var d=this;switch(b){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){d.tree.debug("setTimeout: trigger expand"),d.setExpanded(!0)},c);break;case"activate":this.tree.timer=setTimeout(function(){d.tree.debug("setTimeout: trigger activate"),d.setActive(!0)},c);break;default:a.error("Invalid mode "+b)}},scrollIntoView:function(c,e){void 0!==e&&d(e)&&(this.warn("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead."),e={topNode:e});var f,g,i,j,k=a.extend({effects:c===!0?{duration:200,queue:!1}:c,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent||this.tree.$container,topNode:null},e),l=new a.Deferred,m=this,n=a(this.span).height(),o=a(k.scrollParent),p=k.scrollOfs.top||0,q=k.scrollOfs.bottom||0,r=o.height(),s=o.scrollTop(),t=o,u=o[0]===window,v=k.topNode||null,w=null;return a(this.span).is(":visible")?(u?(g=a(this.span).offset().top,f=v&&v.span?a(v.span).offset().top:0,t=a("html,body")):(b(o[0]!==document&&o[0]!==document.body,"scrollParent should be a simple element or `window`, not document or body."),j=o.offset().top,g=a(this.span).offset().top-j+s,f=v?a(v.span).offset().top-j+s:0,i=Math.max(0,o.innerHeight()-o[0].clientHeight),r-=i),g<s+p?w=g-p:g+n>s+r-q&&(w=g+n-r+q,v&&(b(v.isRootNode()||a(v.span).is(":visible"),"topNode must be visible"),f<w&&(w=f-p))),null!==w?k.effects?(k.effects.complete=function(){l.resolveWith(m)},t.stop(!0).animate({scrollTop:w},k.effects)):(t[0].scrollTop=w,l.resolveWith(this)):l.resolveWith(this),l.promise()):(this.warn("scrollIntoView(): node is invisible."),h())},setActive:function(a,b){return this.tree._callHook("nodeSetActive",this,a,b)},setExpanded:function(a,b){return this.tree._callHook("nodeSetExpanded",this,a,b)},setFocus:function(a){return this.tree._callHook("nodeSetFocus",this,a)},setSelected:function(a,b){return this.tree._callHook("nodeSetSelected",this,a,b)},setStatus:function(a,b,c){return this.tree._callHook("nodeSetStatus",this,a,b,c)},setTitle:function(a){this.title=a,this.renderTitle(),this.triggerModify("rename")},sortChildren:function(a,b){var c,d,e=this.children;if(e){if(a=a||function(a,b){var c=a.title.toLowerCase(),d=b.title.toLowerCase();return c===d?0:c>d?1:-1},e.sort(a),b)for(c=0,d=e.length;c<d;c++)e[c].children&&e[c].sortChildren(a,"$norender$");"$norender$"!==b&&this.render(),this.triggerModifyChild("sort")}},toDict:function(b,c){var d,e,f,g={},h=this;if(a.each(D,function(a,b){(h[b]||h[b]===!1)&&(g[b]=h[b])}),a.isEmptyObject(this.data)||(g.data=a.extend({},this.data),a.isEmptyObject(g.data)&&delete g.data),c&&c(g,h),b&&this.hasChildren())for(g.children=[],d=0,e=this.children.length;d<e;d++)f=this.children[d],f.isStatusNode()||g.children.push(f.toDict(!0,c));return g},toggleClass:function(b,c){var d,e,f=/\S+/g,g=b.match(f)||[],h=0,i=!1,j=this[this.tree.statusClassPropName],k=" "+(this.extraClasses||"")+" ";for(j&&a(j).toggleClass(b,c);d=g[h++];)if(e=k.indexOf(" "+d+" ")>=0,c=void 0===c?!e:!!c)e||(k+=d+" ",i=!0);else for(;k.indexOf(" "+d+" ")>-1;)k=k.replace(" "+d+" "," ");return this.extraClasses=a.trim(k),i},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"<FancytreeNode(#"+this.key+", '"+this.title+"')>"},triggerModifyChild:function(b,c,d){var e,f=this.tree.options.modifyChild;f&&(c&&c.parent!==this&&a.error("childNode "+c+" is not a child of "+this),e={node:this,tree:this.tree,operation:b,childNode:c||null},d&&a.extend(e,d),f({type:"modifyChild"},e))},triggerModify:function(a,b){this.parent.triggerModifyChild(a,this,b)},visit:function(a,b){var c,d,e=!0,f=this.children;if(b===!0&&(e=a(this),e===!1||"skip"===e))return e;if(f)for(c=0,d=f.length;c<d&&(e=f[c].visit(a,!0),e!==!1);c++);return e},visitAndLoad:function(b,c,d){var e,f,g,i=this;return b&&c===!0&&(f=b(i),f===!1||"skip"===f)?d?f:h():i.children||i.lazy?(e=new a.Deferred,g=[],i.load().done(function(){for(var c=0,d=i.children.length;c<d;c++){if(f=i.children[c].visitAndLoad(b,!0,!0),f===!1){e.reject();break}"skip"!==f&&g.push(f)}a.when.apply(this,g).then(function(){e.resolve()})}),e.promise()):h()},visitParents:function(a,b){if(b&&a(this)===!1)return!1;for(var c=this.parent;c;){if(a(c)===!1)return!1;c=c.parent}return!0},visitSiblings:function(a,b){var c,d,e,f=this.parent.children;for(c=0,d=f.length;c<d;c++)if(e=f[c],(b||e!==this)&&a(e)===!1)return!1;return!0},warn:function(a){Array.prototype.unshift.call(arguments,this.toString()),c("warn",arguments)}},p.prototype={_makeHookContext:function(b,c,d){var e,f;return void 0!==b.node?(c&&b.originalEvent!==c&&a.error("invalid args"),e=b):b.tree?(f=b.tree,e={node:b,tree:f,widget:f.widget,options:f.widget.options,originalEvent:c}):b.widget?e={node:null,tree:b,widget:b.widget,options:b.widget.options,originalEvent:c}:a.error("invalid args"),d&&a.extend(e,d),e},_callHook:function(b,c,d){var e=this._makeHookContext(c),f=this[b],g=Array.prototype.slice.call(arguments,2);return a.isFunction(f)||a.error("_callHook('"+b+"') is not a function"),g.unshift(e),f.apply(this,g)},_setExpiringValue:function(a,b,c){this._tempCache[a]={value:b,expire:Date.now()+(+c||50)}},_getExpiringValue:function(a){var b=this._tempCache[a];return b&&b.expire<Date.now()?b.value:(delete this._tempCache[a],null)},_requireExtension:function(c,d,e,f){e=!!e;var g=this._local.name,h=this.options.extensions,i=a.inArray(c,h)<a.inArray(g,h),j=d&&null==this.ext[c],k=!j&&null!=e&&e!==i;return b(g&&g!==c,"invalid or same name"),!j&&!k||(f||(j||d?(f="'"+g+"' extension requires '"+c+"'",k&&(f+=" to be registered "+(e?"before":"after")+" itself")):f="If used together, `"+c+"` must be registered "+(e?"before":"after")+" `"+g+"`"),a.error(f),!1)},activateKey:function(a){var b=this.getNodeByKey(a);return b?b.setActive():this.activeNode&&this.activeNode.setActive(!1),b},addPagingNode:function(a,b){return this.rootNode.addPagingNode(a,b)},applyPatch:function(c){var d,e,f,g,h,i,k=c.length,l=[];for(e=0;e<k;e++)f=c[e],b(2===f.length,"patchList must be an array of length-2-arrays"),g=f[0],h=f[1],i=null===g?this.rootNode:this.getNodeByKey(g),i?(d=new a.Deferred,l.push(d),i.applyPatch(h).always(j(d,i))):this.warn("could not find node with key '"+g+"'");return a.when.apply(a,l).promise()},clear:function(a){this._callHook("treeClear",this)},count:function(){return this.rootNode.countChildren()},debug:function(a){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),c("log",arguments))},enableUpdate:function(a){return a=a!==!1,!!this._enableUpdate==!!a?a:(this._enableUpdate=a,a?(this.debug("enableUpdate(true): redraw "),this.render()):this.debug("enableUpdate(false)..."),!a)},findAll:function(a){return this.rootNode.findAll(a)},findFirst:function(a){return this.rootNode.findFirst(a)},findNextNode:function(b,c,d){var e=null,f=c.parent.children,g=null,h=function(a,b,c){var d,e,f=a.children,g=f.length,i=f[b];if(i&&c(i)===!1)return!1;if(i&&i.children&&i.expanded&&h(i,0,c)===!1)return!1;for(d=b+1;d<g;d++)if(h(a,d,c)===!1)return!1;return e=a.parent,e?h(e,e.children.indexOf(a)+1,c):h(a,0,c)};return b="string"==typeof b?n(b):b,c=c||this.getFirstChild(),h(c.parent,f.indexOf(c),function(d){return d!==e&&(e=e||d,a(d.span).is(":visible")?(!b(d)||(g=d,g===c))&&void 0:void d.debug("quicksearch: skipping hidden node"))}),g},generateFormElements:function(b,c,d){function e(b){j.append(a("<input>",{type:"checkbox",name:g,value:b.key,checked:!0}))}d=d||{};var f,g="string"==typeof b?b:"ft_"+this._id+"[]",h="string"==typeof c?c:"ft_"+this._id+"_active",i="fancytree_result_"+this._id,j=a("#"+i),k=3===this.options.selectMode&&d.stopOnParents!==!1;j.length?j.empty():j=a("<div>",{id:i}).hide().insertAfter(this.$container),c!==!1&&this.activeNode&&j.append(a("<input>",{type:"radio",name:h,value:this.activeNode.key,checked:!0})),d.filter?this.visit(function(a){var b=d.filter(a);return"skip"===b?b:void(b!==!1&&e(a))}):b!==!1&&(f=this.getSelectedNodes(k),a.each(f,function(a,b){e(b)}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(a,b){var c,d;return!b&&(c=document.getElementById(this.options.idPrefix+a))?c.ftnode?c.ftnode:null:(b=b||this.rootNode,d=null,b.visit(function(b){if(b.key===a)return d=b,!1},!0),d)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(a){return this.rootNode.getSelectedNodes(a)},hasFocus:function(){return!!this._hasFocus},info:function(a){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),c("info",arguments))},loadKeyPath:function(b,c,d){function e(a,b,d){c.call(q,b,"loading"),b.load().done(function(){q.loadKeyPath.call(q,l[a],c,b).always(j(d,q))}).fail(function(e){q.warn("loadKeyPath: error loading: "+a+" (parent: "+n+")"),c.call(q,b,"error"),d.reject()})}var f,g,h,i,k,l,m,n,o,p=this.options.keyPathSeparator,q=this;for(c=c||a.noop,a.isArray(b)||(b=[b]),l={},h=0;h<b.length;h++)for(n=d||this.rootNode,i=b[h],i.charAt(0)===p&&(i=i.substr(1)),o=i.split(p);o.length;){if(k=o.shift(),m=n._findDirectChild(k),!m){this.warn("loadKeyPath: key not found: "+k+" (parent: "+n+")"),c.call(this,k,"error");break}if(0===o.length){c.call(this,m,"ok");break}if(m.lazy&&void 0===m.hasChildren()){c.call(this,m,"loaded"),l[k]?l[k].push(o.join(p)):l[k]=[o.join(p)];break}c.call(this,m,"loaded"),n=m}f=[];for(k in l)m=n._findDirectChild(k),null==m&&(m=q.getNodeByKey(k)),g=new a.Deferred,f.push(g),e(k,m,g);return a.when.apply(a,f).promise()},reactivate:function(a){var b,c=this.activeNode;return c?(this.activeNode=null,b=c.setActive(!0,{noFocus:!0}),a&&c.setFocus(),b):h()},reload:function(a){return this._callHook("treeClear",this),this._callHook("treeLoad",this,a)},render:function(a,b){return this.rootNode.render(a,b)},setFocus:function(a){return this._callHook("treeSetFocus",this,a)},toDict:function(a,b){var c=this.rootNode.toDict(!0,b);return a?c:c.children},toString:function(){return"<Fancytree(#"+this._id+")>"},_triggerNodeEvent:function(a,b,c,d){var e=this._makeHookContext(b,c,d),f=this.widget._trigger(a,c,e);return f!==!1&&void 0!==e.result?e.result:f},_triggerTreeEvent:function(a,b,c){var d=this._makeHookContext(this,b,c),e=this.widget._trigger(a,b,d);return e!==!1&&void 0!==d.result?d.result:e},visit:function(a){return this.rootNode.visit(a,!1)},warn:function(a){Array.prototype.unshift.call(arguments,this.toString()),c("warn",arguments)}},a.extend(p.prototype,{nodeClick:function(a){var b,c,d=a.targetType,e=a.node;if("expander"===d){if(e.isLoading())return void e.debug("Got 2nd click while loading: ignored");this._callHook("nodeToggleExpanded",a)}else if("checkbox"===d)this._callHook("nodeToggleSelected",a),a.options.focusOnSelect&&this._callHook("nodeSetFocus",a,!0);else{if(c=!1,b=!0,e.folder)switch(a.options.clickFolderMode){case 2:c=!0,b=!1;break;case 3:b=!0,c=!0}b&&(this.nodeSetFocus(a),this._callHook("nodeSetActive",a,!0)),c&&this._callHook("nodeToggleExpanded",a)}},nodeCollapseSiblings:function(a,b){var c,d,e,f=a.node;if(f.parent)for(c=f.parent.children,d=0,e=c.length;d<e;d++)c[d]!==f&&c[d].expanded&&this._callHook("nodeSetExpanded",c[d],!1,b)},nodeDblclick:function(a){"title"===a.targetType&&4===a.options.clickFolderMode&&this._callHook("nodeToggleExpanded",a),"title"===a.targetType&&a.originalEvent.preventDefault()},nodeKeydown:function(b){var c,d,e,f,g=b.originalEvent,h=b.node,i=b.tree,j=b.options,k=g.which,l=String.fromCharCode(k),m=!(g.altKey||g.ctrlKey||g.metaKey||g.shiftKey),n=a(g.target),o=!0,p=!(g.ctrlKey||!j.autoActivate);if(h||(f=this.getActiveNode()||this.getFirstChild(),f&&(f.setFocus(),h=b.node=this.focusNode,h.debug("Keydown force focus on active node"))),j.quicksearch&&m&&/\w/.test(l)&&!z[k]&&!n.is(":input:enabled"))return d=(new Date).getTime(),d-i.lastQuicksearchTime>500&&(i.lastQuicksearchTerm=""),i.lastQuicksearchTime=d,i.lastQuicksearchTerm+=l,c=i.findNextNode(i.lastQuicksearchTerm,i.getActiveNode()),c&&c.setActive(),void g.preventDefault();switch(s.eventToString(g)){case"+":case"=":i.nodeSetExpanded(b,!0);break;case"-":i.nodeSetExpanded(b,!1);break;case"space":h.isPagingNode()?i._triggerNodeEvent("clickPaging",b,g):s.evalOption("checkbox",h,h,j,!1)?i.nodeToggleSelected(b):i.nodeSetActive(b,!0);break;case"return":i.nodeSetActive(b,!0);break;case"home":case"end":case"backspace":case"left":case"right":case"up":case"down":e=h.navigate(g.which,p,!0);break;default:o=!1}o&&g.preventDefault()},nodeLoadChildren:function(c,d){var e,f,g,h=c.tree,i=c.node,j=(new Date).getTime();return a.isFunction(d)&&(d=d.call(h,{type:"source"},c),b(!a.isFunction(d),"source callback must not return another function")),d.url&&(i._requestId&&i.warn("Recursive load request #"+j+" while #"+i._requestId+" is pending."),e=a.extend({},c.options.ajax,d),i._requestId=j,e.debugDelay?(f=e.debugDelay,a.isArray(f)&&(f=f[0]+Math.random()*(f[1]-f[0])),i.warn("nodeLoadChildren waiting debugDelay "+Math.round(f)+" ms ..."),e.debugDelay=!1,g=a.Deferred(function(b){setTimeout(function(){a.ajax(e).done(function(){b.resolveWith(this,arguments)}).fail(function(){b.rejectWith(this,arguments)})},f)})):g=a.ajax(e),d=new a.Deferred,g.done(function(b,e,f){var g,k;if("json"!==this.dataType&&"jsonp"!==this.dataType||"string"!=typeof b||a.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),i._requestId&&i._requestId>j)return void d.rejectWith(this,[w]);
if(c.options.postProcess){try{k=h._triggerNodeEvent("postProcess",c,c.originalEvent,{response:b,error:null,dataType:this.dataType})}catch(l){k={error:l,message:""+l,details:"postProcess failed"}}if(k.error)return g=a.isPlainObject(k.error)?k.error:{message:k.error},g=h._makeHookContext(i,null,g),void d.rejectWith(this,[g]);b=a.isArray(k)?k:b}else b&&b.hasOwnProperty("d")&&c.options.enableAspx&&(b="string"==typeof b.d?a.parseJSON(b.d):b.d);d.resolveWith(this,[b])}).fail(function(a,b,c){var e=h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:c,details:a.status+": "+c});d.rejectWith(this,[e])})),a.isFunction(d.then)&&a.isFunction(d["catch"])&&(g=d,d=new a.Deferred,g.then(function(a){d.resolve(a)},function(a){d.reject(a)})),a.isFunction(d.promise)?(h.nodeSetStatus(c,"loading"),d.done(function(a){h.nodeSetStatus(c,"ok"),i._requestId=null}).fail(function(a){var b;return a===w?void i.warn("Ignored response for obsolete load request #"+j+" (expected #"+i._requestId+")"):(a.node&&a.error&&a.message?b=a:(b=h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:a?a.message||a.toString():""}),"[object Object]"===b.message&&(b.message="")),i.warn("Load children failed ("+b.message+")",b),void(h._triggerNodeEvent("loadError",b,null)!==!1&&h.nodeSetStatus(c,"error",b.message,b.details)))})):c.options.postProcess&&h._triggerNodeEvent("postProcess",c,c.originalEvent,{response:d,error:null,dataType:typeof d}),a.when(d).done(function(c){var d;a.isPlainObject(c)&&(b(i.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),b(a.isArray(c.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),d=c,c=c.children,delete d.children,a.extend(h.data,d)),b(a.isArray(c),"expected array of children"),i._setChildren(c),h._triggerNodeEvent("loadChildren",i)})},nodeLoadKeyPath:function(a,b){},nodeRemoveChild:function(c,d){var e,f=c.node,g=a.extend({},c,{node:d}),h=f.children;return 1===h.length?(b(d===h[0],"invalid single child"),this.nodeRemoveChildren(c)):(this.activeNode&&(d===this.activeNode||this.activeNode.isDescendantOf(d))&&this.activeNode.setActive(!1),this.focusNode&&(d===this.focusNode||this.focusNode.isDescendantOf(d))&&(this.focusNode=null),this.nodeRemoveMarkup(g),this.nodeRemoveChildren(g),e=a.inArray(d,h),b(e>=0,"invalid child"),f.triggerModifyChild("remove",d),d.visit(function(a){a.parent=null},!0),this._callHook("treeRegisterNode",this,!1,d),void h.splice(e,1))},nodeRemoveChildMarkup:function(b){var c=b.node;c.ul&&(c.isRootNode()?a(c.ul).empty():(a(c.ul).remove(),c.ul=null),c.visit(function(a){a.li=a.ul=null}))},nodeRemoveChildren:function(b){var c,d=b.tree,e=b.node,f=e.children;f&&(this.activeNode&&this.activeNode.isDescendantOf(e)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(e)&&(this.focusNode=null),this.nodeRemoveChildMarkup(b),c=a.extend({},b),e.triggerModifyChild("remove",null),e.visit(function(a){a.parent=null,d._callHook("treeRegisterNode",d,!1,a)}),e.lazy?e.children=[]:e.children=null,e.isRootNode()||(e.expanded=!1),this.nodeRenderStatus(b))},nodeRemoveMarkup:function(b){var c=b.node;c.li&&(a(c.li).remove(),c.li=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(c,d,e,f,g){var h,i,j,k,l,m,n,o=c.node,p=c.tree,q=c.options,r=q.aria,s=!1,t=o.parent,u=!t,v=o.children,w=null;if(p._enableUpdate!==!1&&(u||t.ul)){if(b(u||t.ul,"parent UL must exist"),u||(o.li&&(d||o.li.parentNode!==o.parent.ul)&&(o.li.parentNode===o.parent.ul?w=o.li.nextSibling:this.debug("Unlinking "+o+" (must be child of "+o.parent+")"),this.nodeRemoveMarkup(c)),o.li?this.nodeRenderStatus(c):(s=!0,o.li=document.createElement("li"),o.li.ftnode=o,o.key&&q.generateIds&&(o.li.id=q.idPrefix+o.key),o.span=document.createElement("span"),o.span.className="fancytree-node",r&&!o.tr&&a(o.li).attr("role","treeitem"),o.li.appendChild(o.span),this.nodeRenderTitle(c),q.createNode&&q.createNode.call(p,{type:"createNode"},c)),q.renderNode&&q.renderNode.call(p,{type:"renderNode"},c)),v){if(u||o.expanded||e===!0){for(o.ul||(o.ul=document.createElement("ul"),(f!==!0||g)&&o.expanded||(o.ul.style.display="none"),r&&a(o.ul).attr("role","group"),o.li?o.li.appendChild(o.ul):o.tree.$div.append(o.ul)),k=0,l=v.length;k<l;k++)n=a.extend({},c,{node:v[k]}),this.nodeRender(n,d,e,!1,!0);for(h=o.ul.firstChild;h;)j=h.ftnode,j&&j.parent!==o?(o.debug("_fixParent: remove missing "+j,h),m=h.nextSibling,h.parentNode.removeChild(h),h=m):h=h.nextSibling;for(h=o.ul.firstChild,k=0,l=v.length-1;k<l;k++)i=v[k],j=h.ftnode,i!==j?o.ul.insertBefore(i.li,j.li):h=h.nextSibling}}else o.ul&&(this.warn("remove child markup for "+o),this.nodeRemoveChildMarkup(c));u||s&&t.ul.insertBefore(o.li,w)}},nodeRenderTitle:function(b,c){var d,e,f,g,h,i,j,k=b.node,m=b.tree,n=b.options,o=n.aria,p=k.getLevel(),q=[];void 0!==c&&(k.title=c),k.span&&m._enableUpdate!==!1&&(h=o&&k.hasChildren()!==!1?" role='button'":"",p<n.minExpandLevel?(k.lazy||(k.expanded=!0),p>1&&q.push("<span "+h+" class='fancytree-expander fancytree-expander-fixed'></span>")):q.push("<span "+h+" class='fancytree-expander'></span>"),d=s.evalOption("checkbox",k,k,n,!1),d&&!k.isStatusNode()&&(h=o?" role='checkbox'":"",e="fancytree-checkbox",("radio"===d||k.parent&&k.parent.radiogroup)&&(e+=" fancytree-radio"),q.push("<span "+h+" class='"+e+"'></span>")),void 0!==k.data.iconClass&&(k.icon?a.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(k.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),k.icon=k.data.iconClass)),f=s.evalOption("icon",k,k,n,!0),"boolean"!=typeof f&&(f=""+f),f!==!1&&(h=o?" role='presentation'":"","string"==typeof f?t.test(f)?(f="/"===f.charAt(0)?f:(n.imagePath||"")+f,q.push("<img src='"+f+"' class='fancytree-icon' alt='' />")):q.push("<span "+h+" class='fancytree-custom-icon "+f+"'></span>"):q.push("<span "+h+" class='fancytree-icon'></span>")),g="",n.renderTitle&&(g=n.renderTitle.call(m,{type:"renderTitle"},b)||""),g||(j=s.evalOption("tooltip",k,k,n,null),j===!0&&(j=k.title),j=j?" title='"+l(j)+"'":"",i=n.titlesTabbable?" tabindex='0'":"",g="<span class='fancytree-title'"+j+i+">"+(n.escapeTitles?s.escapeHtml(k.title):k.title)+"</span>"),q.push(g),k.span.innerHTML=q.join(""),this.nodeRenderStatus(b),n.enhanceTitle&&(b.$title=a(">span.fancytree-title",k.span),g=n.enhanceTitle.call(m,{type:"enhanceTitle"},b)||""))},nodeRenderStatus:function(b){var c,d=b.node,e=b.tree,f=b.options,g=d.hasChildren(),h=d.isLastSibling(),i=f.aria,j=f._classNames,k=[],l=d[e.statusClassPropName];l&&e._enableUpdate!==!1&&(i&&(c=a(d.tr||d.li)),k.push(j.node),e.activeNode===d&&k.push(j.active),e.focusNode===d&&k.push(j.focused),d.expanded&&k.push(j.expanded),i&&(g!==!1?c.attr("aria-expanded",Boolean(d.expanded)):c.removeAttr("aria-expanded")),d.folder&&k.push(j.folder),g!==!1&&k.push(j.hasChildren),h&&k.push(j.lastsib),d.lazy&&null==d.children&&k.push(j.lazy),d.partload&&k.push(j.partload),d.partsel&&k.push(j.partsel),s.evalOption("unselectable",d,d,f,!1)&&k.push(j.unselectable),d._isLoading&&k.push(j.loading),d._error&&k.push(j.error),d.statusNodeType&&k.push(j.statusNodePrefix+d.statusNodeType),d.selected?(k.push(j.selected),i&&c.attr("aria-selected",!0)):i&&c.attr("aria-selected",!1),d.extraClasses&&k.push(d.extraClasses),g===!1?k.push(j.combinedExpanderPrefix+"n"+(h?"l":"")):k.push(j.combinedExpanderPrefix+(d.expanded?"e":"c")+(d.lazy&&null==d.children?"d":"")+(h?"l":"")),k.push(j.combinedIconPrefix+(d.expanded?"e":"c")+(d.folder?"f":"")),l.className=k.join(" "),d.li&&a(d.li).toggleClass(j.lastsib,h))},nodeSetActive:function(c,d,e){e=e||{};var f,g=c.node,j=c.tree,k=c.options,l=e.noEvents===!0,m=e.noFocus===!0,n=g===j.activeNode;return d=d!==!1,n===d?h(g):d&&!l&&this._triggerNodeEvent("beforeActivate",g,c.originalEvent)===!1?i(g,["rejected"]):(d?(j.activeNode&&(b(j.activeNode!==g,"node was active (inconsistency)"),f=a.extend({},c,{node:j.activeNode}),j.nodeSetActive(f,!1),b(null===j.activeNode,"deactivate was out of sync?")),k.activeVisible&&g.makeVisible({scrollIntoView:m&&null==j.focusNode}),j.activeNode=g,j.nodeRenderStatus(c),m||j.nodeSetFocus(c),l||j._triggerNodeEvent("activate",g,c.originalEvent)):(b(j.activeNode===g,"node was not active (inconsistency)"),j.activeNode=null,this.nodeRenderStatus(c),l||c.tree._triggerNodeEvent("deactivate",g,c.originalEvent)),h(g))},nodeSetExpanded:function(b,c,d){d=d||{};var e,f,g,j,k,l,m=b.node,n=b.tree,o=b.options,p=d.noAnimation===!0,q=d.noEvents===!0;if(c=c!==!1,m.expanded&&c||!m.expanded&&!c)return h(m);if(c&&!m.lazy&&!m.hasChildren())return h(m);if(!c&&m.getLevel()<o.minExpandLevel)return i(m,["locked"]);if(!q&&this._triggerNodeEvent("beforeExpand",m,b.originalEvent)===!1)return i(m,["rejected"]);if(p||m.isVisible()||(p=d.noAnimation=!0),f=new a.Deferred,c&&!m.expanded&&o.autoCollapse){k=m.getParentList(!1,!0),l=o.autoCollapse;try{for(o.autoCollapse=!1,g=0,j=k.length;g<j;g++)this._callHook("nodeCollapseSiblings",k[g],d)}finally{o.autoCollapse=l}}return f.done(function(){var a=m.getLastChild();c&&o.autoScroll&&!p&&a?a.scrollIntoView(!0,{topNode:m}).always(function(){q||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}):q||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}),e=function(d){var e,f,g=o._classNames,h=o.toggleEffect;if(m.expanded=c,n._callHook("nodeRender",b,!1,!1,!0),m.ul)if(e="none"!==m.ul.style.display,f=!!m.expanded,e===f)m.warn("nodeSetExpanded: UL.style.display already set");else{if(h&&!p)return a(m.li).addClass(g.animating),void a(m.ul).addClass(g.animating).toggle(h.effect,h.options,h.duration,function(){a(this).removeClass(g.animating),a(m.li).removeClass(g.animating),d()});m.ul.style.display=m.expanded||!parent?"":"none"}d()},c&&m.lazy&&void 0===m.hasChildren()?m.load().done(function(){f.notifyWith&&f.notifyWith(m,["loaded"]),e(function(){f.resolveWith(m)})}).fail(function(a){e(function(){f.rejectWith(m,["load failed ("+a+")"])})}):e(function(){f.resolveWith(m)}),f.promise()},nodeSetFocus:function(b,c){var d,e=b.tree,f=b.node,g=e.options,h=!!b.originalEvent&&a(b.originalEvent.target).is(":input");if(c=c!==!1,e.focusNode){if(e.focusNode===f&&c)return;d=a.extend({},b,{node:e.focusNode}),e.focusNode=null,this._triggerNodeEvent("blur",d),this._callHook("nodeRenderStatus",d)}c&&(this.hasFocus()||(f.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",b,!0,{calledByNode:!0})),f.makeVisible({scrollIntoView:!1}),e.focusNode=f,g.titlesTabbable?h||a(f.span).find(".fancytree-title").focus():0===a(document.activeElement).closest(".fancytree-container").length&&a(e.$container).focus(),g.aria&&a(e.$container).attr("aria-activedescendant",a(f.tr||f.li).uniqueId().attr("id")),this._triggerNodeEvent("focus",b),g.autoScroll&&f.scrollIntoView(),this._callHook("nodeRenderStatus",b))},nodeSetSelected:function(a,b,c){c=c||{};var d=a.node,e=a.tree,f=a.options,g=c.noEvents===!0,h=d.parent;if(b=b!==!1,!s.evalOption("unselectable",d,d,f,!1)){if(d._lastSelectIntent=b,!!d.selected===b&&(3!==f.selectMode||!d.partsel||b))return b;if(!g&&this._triggerNodeEvent("beforeSelect",d,a.originalEvent)===!1)return!!d.selected;b&&1===f.selectMode?(e.lastSelectedNode&&e.lastSelectedNode.setSelected(!1),d.selected=b):3!==f.selectMode||!h||h.radiogroup||d.radiogroup?h&&h.radiogroup?d.visitSiblings(function(a){a._changeSelectStatusAttrs(b&&a===d)},!0):d.selected=b:(d.selected=b,d.fixSelection3AfterClick(c)),this.nodeRenderStatus(a),e.lastSelectedNode=b?d:null,g||e._triggerNodeEvent("select",a)}},nodeSetStatus:function(b,c,d,e){function f(){var a=h.children?h.children[0]:null;if(a&&a.isStatusNode()){try{h.ul&&(h.ul.removeChild(a.li),a.li=null)}catch(b){}1===h.children.length?h.children=[]:h.children.shift()}}function g(b,c){var d=h.children?h.children[0]:null;return d&&d.isStatusNode()?(a.extend(d,b),d.statusNodeType=c,i._callHook("nodeRenderTitle",d)):(h._setChildren([b]),h.children[0].statusNodeType=c,i.render()),h.children[0]}var h=b.node,i=b.tree;switch(c){case"ok":f(),h._isLoading=!1,h._error=null,h.renderStatus();break;case"loading":h.parent||g({title:i.options.strings.loading+(d?" ("+d+")":""),checkbox:!1,tooltip:e},c),h._isLoading=!0,h._error=null,h.renderStatus();break;case"error":g({title:i.options.strings.loadError+(d?" ("+d+")":""),checkbox:!1,tooltip:e},c),h._isLoading=!1,h._error={message:d,details:e},h.renderStatus();break;case"nodata":g({title:i.options.strings.noData,checkbox:!1,tooltip:e},c),h._isLoading=!1,h._error=null,h.renderStatus();break;default:a.error("invalid node status "+c)}},nodeToggleExpanded:function(a){return this.nodeSetExpanded(a,!a.node.expanded)},nodeToggleSelected:function(a){var b=a.node,c=!b.selected;return b.partsel&&!b.selected&&b._lastSelectIntent===!0&&(c=!1,b.selected=!0),b._lastSelectIntent=c,this.nodeSetSelected(a,c)},treeClear:function(a){var b=a.tree;b.activeNode=null,b.focusNode=null,b.$div.find(">ul.fancytree-container").empty(),b.rootNode.children=null},treeCreate:function(a){},treeDestroy:function(a){this.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("ui-helper-hidden")},treeInit:function(a){var b=a.tree,c=b.options;b.$container.attr("tabindex",c.tabindex),c.rtl?b.$container.attr("DIR","RTL").addClass("fancytree-rtl"):b.$container.removeAttr("DIR").removeClass("fancytree-rtl"),c.aria&&(b.$container.attr("role","tree"),1!==c.selectMode&&b.$container.attr("aria-multiselectable",!0)),this.treeLoad(a)},treeLoad:function(c,d){var e,f,g,h,i=c.tree,j=c.widget.element,l=a.extend({},c,{node:this.rootNode});if(i.rootNode.children&&this.treeClear(c),d=d||this.options.source)"string"==typeof d&&a.error("Not implemented");else switch(f=j.data("type")||"html"){case"html":g=j.find(">ul:first"),g.addClass("ui-fancytree-source ui-helper-hidden"),d=a.ui.fancytree.parseHtml(g),this.data=a.extend(this.data,k(g));break;case"json":d=a.parseJSON(j.text()),j.contents().filter(function(){return 3===this.nodeType}).remove(),a.isPlainObject(d)&&(b(a.isArray(d.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),e=d,d=d.children,delete e.children,a.extend(i.data,e));break;default:a.error("Invalid data-type: "+f)}return h=this.nodeLoadChildren(l,d).done(function(){i.render(),3===c.options.selectMode&&i.rootNode.fixSelection3FromEndNodes(),i.activeNode&&i.options.activeVisible&&i.activeNode.makeVisible(),i._triggerTreeEvent("init",null,{status:!0})}).fail(function(){i.render(),i._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(a,b,c){},treeSetFocus:function(b,c,d){var e;c=c!==!1,c!==this.hasFocus()&&(this._hasFocus=c,!c&&this.focusNode?this.focusNode.setFocus(!1):!c||d&&d.calledByNode||a(this.$container).focus(),this.$container.toggleClass("fancytree-treefocus",c),this._triggerTreeEvent(c?"focusTree":"blurTree"),c&&!this.activeNode&&(e=this._lastMousedownNode||this.getFirstChild(),e&&e.setFocus()))},treeSetOption:function(b,c,d){var e=b.tree,f=!0,g=!1,h=!1;switch(c){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":g=!0,h=!0;break;case"escapeTitles":case"tooltip":h=!0;break;case"rtl":d===!1?e.$container.removeAttr("DIR").removeClass("fancytree-rtl"):e.$container.attr("DIR","RTL").addClass("fancytree-rtl"),h=!0;break;case"source":f=!1,e._callHook("treeLoad",e,d),h=!0}e.debug("set option "+c+"="+d+" <"+typeof d+">"),f&&(this.widget._super?this.widget._super.call(this.widget,c,d):a.Widget.prototype._setOption.call(this.widget,c,d)),g&&e._callHook("treeCreate",e),h&&e.render(!0,!1)}}),a.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!0,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,escapeTitles:!1,extensions:[],toggleEffect:{effect:"blind",options:{direction:"vertical",scale:"box"},duration:200},generateIds:!1,icon:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,quicksearch:!1,rtl:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading...",loadError:"Load error!",moreData:"More...",noData:"No data."},tabindex:"0",titlesTabbable:!1,tooltip:!1,_classNames:{node:"fancytree-node",folder:"fancytree-folder",animating:"fancytree-animating",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partload:"fancytree-partload",partsel:"fancytree-partsel",radio:"fancytree-radio",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error",statusNodePrefix:"fancytree-statusnode-"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new p(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var c,d,e,f=this.options,h=f.extensions,i=this.tree;for(e=0;e<h.length;e++)d=h[e],c=a.ui.fancytree._extensions[d],c||a.error("Could not apply extension '"+d+"' (it is not registered, did you forget to include it?)"),this.tree.options[d]=a.extend(!0,{},c.options,this.tree.options[d]),b(void 0===this.tree.ext[d],"Extension name must not exist as Fancytree.ext attribute: '"+d+"'"),this.tree.ext[d]={},g(this.tree,i,c,d),i=c;void 0!==f.icons&&(f.icon!==!0?a.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),f.icon=f.icons)),void 0!==f.iconClass&&(f.icon?a.error("'iconClass' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'iconClass' tree option is deprecated since v2.14.0: use 'icon' instead"),f.icon=f.iconClass)),void 0!==f.tabbable&&(f.tabindex=f.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+f.tabindex+"' instead")),this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(a,b){return this.tree._callHook("treeSetOption",this.tree,a,b)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),a.Widget.prototype.destroy.call(this)},_unbind:function(){var b=this.tree._ns;this.element.off(b),this.tree.$container.off(b),a(document).off(b)},_bind:function(){var b=this,c=this.options,d=this.tree,e=d._ns;this._unbind(),d.$container.on("focusin"+e+" focusout"+e,function(b){var c=s.getNode(b),e="focusin"===b.type;return e&&d._getExpiringValue("focusin")?void s.info("Ignored double focusin."):(d._setExpiringValue("focusin",!0,50),e&&!c&&(c=d._getExpiringValue("mouseDownNode"),c&&s.info("Reconstruct mouse target for focusin from recent event.")),void(c?d._callHook("nodeSetFocus",d._makeHookContext(c,b),e):d.tbody&&a(b.target).parents("table.fancytree-container > thead").length?d.debug("Ignore focus event outside table body.",b):d._callHook("treeSetFocus",d,e)))}).on("selectstart"+e,"span.fancytree-title",function(a){a.preventDefault()}).on("keydown"+e,function(a){if(c.disabled||c.keyboard===!1)return!0;var b,e=d.focusNode,f=d._makeHookContext(e||d,a),g=d.phase;try{return d.phase="userEvent",b=e?d._triggerNodeEvent("keydown",e,a):d._triggerTreeEvent("keydown",a),"preventNav"===b?b=!0:b!==!1&&(b=d._callHook("nodeKeydown",f)),b}finally{d.phase=g}}).on("mousedown"+e,function(a){var b=s.getEventTarget(a);d._lastMousedownNode=b?b.node:null,d._setExpiringValue("mouseDownNode",d._lastMousedownNode)}).on("click"+e+" dblclick"+e,function(a){if(c.disabled)return!0;var d,e=s.getEventTarget(a),f=e.node,g=b.tree,h=g.phase;if(!f)return!0;d=g._makeHookContext(f,a);try{switch(g.phase="userEvent",a.type){case"click":return d.targetType=e.type,f.isPagingNode()?g._triggerNodeEvent("clickPaging",d,a)===!0:g._triggerNodeEvent("click",d,a)!==!1&&g._callHook("nodeClick",d);case"dblclick":return d.targetType=e.type,g._triggerNodeEvent("dblclick",d,a)!==!1&&g._callHook("nodeDblclick",d)}}finally{g.phase=h}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(a){return this.tree.getNodeByKey(a)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),s=a.ui.fancytree,a.extend(a.ui.fancytree,{version:"2.26.0",buildType: "production",debugLevel: 1,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:p,_FancytreeNodeClass:o,jquerySupports:{positionMyOfs:e(a.ui.version,1,9)},assert:function(a,c){return b(a,c)},createTree:function(b,c){var d=a(b).fancytree(c).fancytree("getTree");return d},debounce:function(a,b,c,d){var e;return 3===arguments.length&&"boolean"!=typeof c&&(d=c,c=!1),function(){var f=arguments;d=d||this,c&&!e&&b.apply(d,f),clearTimeout(e),e=setTimeout(function(){c||b.apply(d,f),e=null},a)}},debug:function(b){a.ui.fancytree.debugLevel>=2&&c("log",arguments)},error:function(a){c("error",arguments)},escapeHtml:function(a){return(""+a).replace(u,function(a){return x[a]})},fixPositionOptions:function(b){if((b.offset||(""+b.my+b.at).indexOf("%")>=0)&&a.error("expected new position syntax (but '%' is not supported)"),!a.ui.fancytree.jquerySupports.positionMyOfs){var c=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(b.my),d=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(b.at),e=(c[2]?+c[2]:0)+(d[2]?+d[2]:0),f=(c[4]?+c[4]:0)+(d[4]?+d[4]:0);b=a.extend({},b,{my:c[1]+" "+c[3],at:d[1]+" "+d[3]}),(e||f)&&(b.offset=""+e+" "+f)}return b},getEventTarget:function(b){var c=b&&b.target?b.target.className:"",d={node:this.getNode(b.target),type:void 0};return/\bfancytree-title\b/.test(c)?d.type="title":/\bfancytree-expander\b/.test(c)?d.type=d.node.hasChildren()===!1?"prefix":"expander":/\bfancytree-checkbox\b/.test(c)?d.type="checkbox":/\bfancytree(-custom)?-icon\b/.test(c)?d.type="icon":/\bfancytree-node\b/.test(c)?d.type="title":b&&a(b.target).is("ul[role=group]")?(s.info("Ignoring click on outer UL."),d.node=null):b&&b.target&&a(b.target).closest(".fancytree-title").length&&(d.type="title"),d},getEventTargetType:function(a){return this.getEventTarget(a).type},getNode:function(b){if(b instanceof o)return b;for(b instanceof a?b=b[0]:void 0!==b.originalEvent&&(b=b.target);b;){if(b.ftnode)return b.ftnode;b=b.parentNode}return null},getTree:function(b){var c;return b instanceof p?b:(void 0===b&&(b=0),"number"==typeof b?b=a(".fancytree-container").eq(b):"string"==typeof b?b=a(b).eq(0):void 0!==b.selector?b=b.eq(0):void 0!==b.originalEvent&&(b=a(b.target)),b=b.closest(":ui-fancytree"),c=b.data("ui-fancytree")||b.data("fancytree"),c?c.tree:null)},evalOption:function(b,c,d,e,f){var g,h,i=c.tree,j=e[b],k=d[b];return a.isFunction(j)?(g={node:c,tree:i,widget:i.widget,options:i.widget.options},h=j.call(i,{type:b},g),null==h&&(h=k)):h=null!=k?k:j,null==h&&(h=f),h},eventToString:function(a){var b=a.which,c=a.type,d=[];return a.altKey&&d.push("alt"),a.ctrlKey&&d.push("ctrl"),a.metaKey&&d.push("meta"),a.shiftKey&&d.push("shift"),"click"===c||"dblclick"===c?d.push(A[a.button]+c):y[b]||d.push(z[b]||String.fromCharCode(b).toLowerCase()),d.join("+")},info:function(b){a.ui.fancytree.debugLevel>=1&&c("info",arguments)},keyEventToString:function(a){return this.warn("keyEventToString() is deprecated: use eventToString()"),this.eventToString(a)},overrideMethod:function(b,c,d){var e,f=b[c]||a.noop;b[c]=function(){try{return e=this._super,this._super=f,d.apply(this,arguments)}finally{this._super=e}}},parseHtml:function(b){var c,d,e,f,g,h,i,j,l=b.find(">li"),m=[];return l.each(function(){var l,n,o=a(this),p=o.find(">span:first",this),q=p.length?null:o.find(">a:first"),r={tooltip:null,data:{}};for(p.length?r.title=p.html():q&&q.length?(r.title=q.html(),r.data.href=q.attr("href"),r.data.target=q.attr("target"),r.tooltip=q.attr("title")):(r.title=o.html(),g=r.title.search(/<ul/i),g>=0&&(r.title=r.title.substring(0,g))),r.title=a.trim(r.title),f=0,h=B.length;f<h;f++)r[B[f]]=void 0;for(c=this.className.split(" "),e=[],f=0,h=c.length;f<h;f++)d=c[f],C[d]?r[d]=!0:e.push(d);if(r.extraClasses=e.join(" "),i=o.attr("title"),i&&(r.tooltip=i),i=o.attr("id"),i&&(r.key=i),o.attr("hideCheckbox")&&(r.checkbox=!1),l=k(o),l&&!a.isEmptyObject(l)){for(n in F)l.hasOwnProperty(n)&&(l[F[n]]=l[n],delete l[n]);for(f=0,h=D.length;f<h;f++)i=D[f],j=l[i],null!=j&&(delete l[i],r[i]=j);a.extend(r.data,l)}b=o.find(">ul:first"),b.length?r.children=a.ui.fancytree.parseHtml(b):r.children=r.lazy?void 0:null,m.push(r)}),m},registerExtension:function(c){b(null!=c.name,"extensions must have a `name` property."),b(null!=c.version,"extensions must have a `version` property."),a.ui.fancytree._extensions[c.name]=c},unescapeHtml:function(a){var b=document.createElement("div");return b.innerHTML=a,0===b.childNodes.length?"":b.childNodes[0].nodeValue},warn:function(a){c("warn",arguments)}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.childcounter.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";return a.ui.fancytree._FancytreeClass.prototype.countSelected=function(a){var b=this;b.options;return b.getSelectedNodes(a).length},a.ui.fancytree._FancytreeNodeClass.prototype.updateCounters=function(){var b=this,c=a("span.fancytree-childcounter",b.span),d=b.tree.options.childcounter,e=b.countChildren(d.deep);b.data.childCounter=e,!e&&d.hideZeros||b.isExpanded()&&d.hideExpanded?c.remove():(c.length||(c=a("<span class='fancytree-childcounter'/>").appendTo(a("span.fancytree-icon",b.span))),c.text(e)),!d.deep||b.isTopLevel()||b.isRoot()||b.parent.updateCounters()},a.ui.fancytree.prototype.widgetMethod1=function(a){this.tree;return a},a.ui.fancytree.registerExtension({name:"childcounter",version:"2.26.0",options:{deep:!0,hideZeros:!0,hideExpanded:!1},foo:42,_appendCounter:function(a){},treeInit:function(a){a.options,a.options.childcounter;this._superApply(arguments),this.$container.addClass("fancytree-ext-childcounter")},treeDestroy:function(a){this._superApply(arguments)},nodeRenderTitle:function(b,c){var d=b.node,e=b.options.childcounter,f=null==d.data.childCounter?d.countChildren(e.deep):+d.data.childCounter;this._super(b,c),!f&&e.hideZeros||d.isExpanded()&&e.hideExpanded||a("span.fancytree-icon",d.span).append(a("<span class='fancytree-childcounter'/>").text(f))},nodeSetExpanded:function(a,b,c){var d=a.tree;a.node;return this._superApply(arguments).always(function(){d.nodeRenderTitle(a)})}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.clones.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(b,c){b||(c=c?": "+c:"",a.error("Assertion failed"+c))}function c(a,b){var c;for(c=a.length-1;c>=0;c--)if(a[c]===b)return a.splice(c,1),!0;return!1}function d(a,b,c){for(var d,e,f=3&a.length,g=a.length-f,h=c,i=3432918353,j=461845907,k=0;k<g;)e=255&a.charCodeAt(k)|(255&a.charCodeAt(++k))<<8|(255&a.charCodeAt(++k))<<16|(255&a.charCodeAt(++k))<<24,++k,e=(65535&e)*i+(((e>>>16)*i&65535)<<16)&4294967295,e=e<<15|e>>>17,e=(65535&e)*j+(((e>>>16)*j&65535)<<16)&4294967295,h^=e,h=h<<13|h>>>19,d=5*(65535&h)+((5*(h>>>16)&65535)<<16)&4294967295,h=(65535&d)+27492+(((d>>>16)+58964&65535)<<16);switch(e=0,f){case 3:e^=(255&a.charCodeAt(k+2))<<16;case 2:e^=(255&a.charCodeAt(k+1))<<8;case 1:e^=255&a.charCodeAt(k),e=(65535&e)*i+(((e>>>16)*i&65535)<<16)&4294967295,e=e<<15|e>>>17,e=(65535&e)*j+(((e>>>16)*j&65535)<<16)&4294967295,h^=e}return h^=a.length,h^=h>>>16,h=2246822507*(65535&h)+((2246822507*(h>>>16)&65535)<<16)&4294967295,h^=h>>>13,h=3266489909*(65535&h)+((3266489909*(h>>>16)&65535)<<16)&4294967295,h^=h>>>16,b?("0000000"+(h>>>0).toString(16)).substr(-8):h>>>0}function e(b){var c,e=a.map(b.getParentList(!1,!0),function(a){return a.refKey||a.key});return e=e.join("/"),c="id_"+d(e,!0)}return a.ui.fancytree._FancytreeNodeClass.prototype.getCloneList=function(b){var c,d=this.tree,e=d.refMap[this.refKey]||null,f=d.keyMap;return e&&(c=this.key,b?e=a.map(e,function(a){return f[a]}):(e=a.map(e,function(a){return a===c?null:f[a]}),e.length<1&&(e=null))),e},a.ui.fancytree._FancytreeNodeClass.prototype.isClone=function(){var a=this.refKey||null,b=a&&this.tree.refMap[a]||null;return!!(b&&b.length>1)},a.ui.fancytree._FancytreeNodeClass.prototype.reRegister=function(b,c){b=null==b?null:""+b,c=null==c?null:""+c;var d=this.tree,e=this.key,f=this.refKey,g=d.keyMap,h=d.refMap,i=h[f]||null,j=!1;return null!=b&&b!==this.key&&(g[b]&&a.error("[ext-clones] reRegister("+b+"): already exists: "+this),delete g[e],g[b]=this,i&&(h[f]=a.map(i,function(a){return a===e?b:a})),this.key=b,j=!0),null!=c&&c!==this.refKey&&(i&&(1===i.length?delete h[f]:h[f]=a.map(i,function(a){return a===e?null:a})),h[c]?h[c].append(b):h[c]=[this.key],this.refKey=c,j=!0),j},a.ui.fancytree._FancytreeNodeClass.prototype.setRefKey=function(a){return this.reRegister(null,a)},a.ui.fancytree._FancytreeClass.prototype.getNodesByRef=function(b,c){var d=this.keyMap,e=this.refMap[b]||null;return e&&(e=c?a.map(e,function(a){var b=d[a];return b.isDescendantOf(c)?b:null}):a.map(e,function(a){return d[a]}),e.length<1&&(e=null)),e},a.ui.fancytree._FancytreeClass.prototype.changeRefKey=function(a,b){var c,d,e=this.keyMap,f=this.refMap[a]||null;if(f){for(c=0;c<f.length;c++)d=e[f[c]],d.refKey=b;delete this.refMap[a],this.refMap[b]=f}},a.ui.fancytree.registerExtension({name:"clones",version:"2.26.0",options:{highlightActiveClones:!0,highlightClones:!1},treeCreate:function(a){this._superApply(arguments),a.tree.refMap={},a.tree.keyMap={}},treeInit:function(a){this.$container.addClass("fancytree-ext-clones"),b(null==a.options.defaultKey),a.options.defaultKey=function(a){return e(a)},this._superApply(arguments)},treeClear:function(a){return a.tree.refMap={},a.tree.keyMap={},this._superApply(arguments)},treeRegisterNode:function(d,e,f){var g,h,i=d.tree,j=i.keyMap,k=i.refMap,l=f.key,m=f&&null!=f.refKey?""+f.refKey:null;return f.isStatusNode()?this._super(d,e,f):(e?(null!=j[f.key]&&a.error("clones.treeRegisterNode: node.key already exists: "+f),j[l]=f,m&&(g=k[m],g?(g.push(l),2===g.length&&d.options.clones.highlightClones&&j[g[0]].renderStatus()):k[m]=[l])):(null==j[l]&&a.error("clones.treeRegisterNode: node.key not registered: "+f.key),delete j[l],m&&(g=k[m],g&&(h=g.length,h<=1?(b(1===h),b(g[0]===l),delete k[m]):(c(g,l),2===h&&d.options.clones.highlightClones&&j[g[0]].renderStatus())))),this._super(d,e,f))},nodeRenderStatus:function(b){var c,d,e=b.node;return d=this._super(b),b.options.clones.highlightClones&&(c=a(e[b.tree.statusClassPropName]),c.length&&e.isClone()&&c.addClass("fancytree-clone")),d},nodeSetActive:function(b,c,d){var e,f=b.tree.statusClassPropName,g=b.node;return e=this._superApply(arguments),b.options.clones.highlightActiveClones&&g.isClone()&&a.each(g.getCloneList(!0),function(b,d){a(d[f]).toggleClass("fancytree-active-clone",c!==!1)}),e}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.dnd.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","jquery-ui/ui/widgets/draggable","jquery-ui/ui/widgets/droppable","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(a){return 0===a?"":a>0?"+"+a:""+a}function c(){e||(a.ui.plugin.add("draggable","connectToFancytree",{start:function(b,c){var d=a(this).data("ui-draggable")||a(this).data("draggable"),e=c.helper.data("ftSourceNode")||null;if(e)return d.offset.click.top=-2,d.offset.click.left=16,e.tree.ext.dnd._onDragEvent("start",e,null,b,c,d)},drag:function(b,c){var d,e,f,g=a(this).data("ui-draggable")||a(this).data("draggable"),h=c.helper.data("ftSourceNode")||null,i=c.helper.data("ftTargetNode")||null,j=a.ui.fancytree.getNode(b.target),k=h&&h.tree.options.dnd;return b.target&&!j&&(e=a(b.target).closest("div.fancytree-drag-helper,#fancytree-drop-marker").length>0)?(f=h||i||a.ui.fancytree,void f.debug("Drag event over helper: ignored.")):(c.helper.data("ftTargetNode",j),k&&k.updateHelper&&(d=h.tree._makeHookContext(h,b,{otherNode:j,ui:c,draggable:g,dropMarker:a("#fancytree-drop-marker")}),k.updateHelper.call(h.tree,h,d)),i&&i!==j&&i.tree.ext.dnd._onDragEvent("leave",i,h,b,c,g),void(j&&j.tree.options.dnd.dragDrop&&(j===i?j.tree.ext.dnd._onDragEvent("over",j,h,b,c,g):(j.tree.ext.dnd._onDragEvent("enter",j,h,b,c,g),j.tree.ext.dnd._onDragEvent("over",j,h,b,c,g)))))},stop:function(b,c){var d,e=a(this).data("ui-draggable")||a(this).data("draggable"),f=c.helper.data("ftSourceNode")||null,g=c.helper.data("ftTargetNode")||null,h="mouseup"===b.type&&1===b.which;h||(d=f||g||a.ui.fancytree,d.debug("Drag was cancelled")),g&&(h&&g.tree.ext.dnd._onDragEvent("drop",g,f,b,c,e),g.tree.ext.dnd._onDragEvent("leave",g,f,b,c,e)),f&&f.tree.ext.dnd._onDragEvent("stop",f,null,b,c,e)}}),e=!0)}function d(b){var d=b.options.dnd||null,e=b.options.glyph||null;d&&c(),d&&d.dragStart&&b.widget.element.draggable(a.extend({addClasses:!1,appendTo:b.$container,containment:!1,delay:0,distance:4,revert:!1,scroll:!0,scrollSpeed:7,scrollSensitivity:10,connectToFancytree:!0,helper:function(b){var c,d,f,g=a.ui.fancytree.getNode(b.target);return g?(f=g.tree.options.dnd,d=a(g.span),c=a("<div class='fancytree-drag-helper'><span class='fancytree-drag-helper-img' /></div>").css({zIndex:3,position:"relative"}).append(d.find("span.fancytree-title").clone()),c.data("ftSourceNode",g),e&&c.find(".fancytree-drag-helper-img").addClass(e.map.dragHelper),f.initHelper&&f.initHelper.call(g.tree,g,{node:g,tree:g.tree,originalEvent:b,ui:{helper:c}}),c):"<div>ERROR?: helper requested but sourceNode not found</div>"},start:function(a,b){var c=b.helper.data("ftSourceNode");return!!c}},b.options.dnd.draggable)),d&&d.dragDrop&&b.widget.element.droppable(a.extend({addClasses:!1,tolerance:"intersect",greedy:!1},b.options.dnd.droppable))}var e=!1,f="fancytree-drop-accept",g="fancytree-drop-after",h="fancytree-drop-before",i="fancytree-drop-over",j="fancytree-drop-reject",k="fancytree-drop-target";return a.ui.fancytree.registerExtension({name:"dnd",version:"2.26.0",options:{autoExpandMS:1e3,draggable:null,droppable:null,focusOnClick:!1,preventVoidMoves:!0,preventRecursiveMoves:!0,smartRevert:!0,dropMarkerOffsetX:-24,dropMarkerInsertOffsetX:-16,dragStart:null,dragStop:null,initHelper:null,updateHelper:null,dragEnter:null,dragOver:null,dragExpand:null,dragDrop:null,dragLeave:null},treeInit:function(b){var c=b.tree;this._superApply(arguments),c.options.dnd.dragStart&&c.$container.on("mousedown",function(c){if(b.options.dnd.focusOnClick){var d=a.ui.fancytree.getNode(c);d&&d.debug("Re-enable focus that was prevented by jQuery UI draggable."),setTimeout(function(){a(c.target).closest(":tabbable").focus()},10)}}),d(c)},_setDndStatus:function(c,d,e,l,m){var n,o="center",p=this._local,q=this.options.dnd,r=this.options.glyph,s=c?a(c.span):null,t=a(d.span),u=t.find("span.fancytree-title");if(p.$dropMarker||(p.$dropMarker=a("<div id='fancytree-drop-marker'></div>").hide().css({"z-index":1e3}).prependTo(a(this.$div).parent()),r&&p.$dropMarker.addClass(r.map.dropMarker)),"after"===l||"before"===l||"over"===l){switch(n=q.dropMarkerOffsetX||0,l){case"before":o="top",n+=q.dropMarkerInsertOffsetX||0;break;case"after":o="bottom",n+=q.dropMarkerInsertOffsetX||0}p.$dropMarker.toggleClass(g,"after"===l).toggleClass(i,"over"===l).toggleClass(h,"before"===l).show().position(a.ui.fancytree.fixPositionOptions({my:"left"+b(n)+" center",at:"left "+o,of:u}))}else p.$dropMarker.hide();s&&s.toggleClass(f,m===!0).toggleClass(j,m===!1),t.toggleClass(k,"after"===l||"before"===l||"over"===l).toggleClass(g,"after"===l).toggleClass(h,"before"===l).toggleClass(f,m===!0).toggleClass(j,m===!1),e.toggleClass(f,m===!0).toggleClass(j,m===!1)},_onDragEvent:function(b,c,d,e,f,g){var h,i,j,k,l,m,n,o,p,q=this.options,r=q.dnd,s=this._makeHookContext(c,e,{otherNode:d,ui:f,draggable:g}),t=null,u=this,v=a(c.span);switch(r.smartRevert&&(g.options.revert="invalid"),b){case"start":c.isStatusNode()?t=!1:r.dragStart&&(t=r.dragStart(c,s)),t===!1?(this.debug("tree.dragStart() cancelled"),f.helper.trigger("mouseup").hide()):(r.smartRevert&&(k=c[s.tree.nodeContainerAttrName].getBoundingClientRect(),j=a(g.options.appendTo)[0].getBoundingClientRect(),g.originalPosition.left=Math.max(0,k.left-j.left),g.originalPosition.top=Math.max(0,k.top-j.top)),v.addClass("fancytree-drag-source"),a(document).on("keydown.fancytree-dnd,mousedown.fancytree-dnd",function(b){"keydown"===b.type&&b.which===a.ui.keyCode.ESCAPE?u.ext.dnd._cancelDrag():"mousedown"===b.type&&u.ext.dnd._cancelDrag()}));break;case"enter":p=(!r.preventRecursiveMoves||!c.isDescendantOf(d))&&(r.dragEnter?r.dragEnter(c,s):null),t=!!p&&(a.isArray(p)?{over:a.inArray("over",p)>=0,before:a.inArray("before",p)>=0,after:a.inArray("after",p)>=0}:{over:p===!0||"over"===p,before:p===!0||"before"===p,after:p===!0||"after"===p}),f.helper.data("enterResponse",t);break;case"over":n=f.helper.data("enterResponse"),o=null,n===!1||("string"==typeof n?o=n:(i=v.offset(),l={x:e.pageX-i.left,y:e.pageY-i.top},m={x:l.x/v.width(),y:l.y/v.height()},n.after&&m.y>.75?o="after":!n.over&&n.after&&m.y>.5?o="after":n.before&&m.y<=.25?o="before":!n.over&&n.before&&m.y<=.5?o="before":n.over&&(o="over"),r.preventVoidMoves&&(c===d?(this.debug(" drop over source node prevented"),o=null):"before"===o&&d&&c===d.getNextSibling()?(this.debug(" drop after source node prevented"),o=null):"after"===o&&d&&c===d.getPrevSibling()?(this.debug(" drop before source node prevented"),o=null):"over"===o&&d&&d.parent===c&&d.isLastSibling()&&(this.debug(" drop last child over own parent prevented"),o=null)),f.helper.data("hitMode",o))),"before"===o||"after"===o||!r.autoExpandMS||c.hasChildren()===!1||c.expanded||r.dragExpand&&r.dragExpand(c,s)===!1||c.scheduleAction("expand",r.autoExpandMS),o&&r.dragOver&&(s.hitMode=o,t=r.dragOver(c,s)),h=t!==!1&&null!==o,r.smartRevert&&(g.options.revert=!h),this._local._setDndStatus(d,c,f.helper,o,h);break;case"drop":o=f.helper.data("hitMode"),o&&r.dragDrop&&(s.hitMode=o,r.dragDrop(c,s));break;case"leave":c.scheduleAction("cancel"),f.helper.data("enterResponse",null),f.helper.data("hitMode",null),this._local._setDndStatus(d,c,f.helper,"out",void 0),r.dragLeave&&r.dragLeave(c,s);break;case"stop":v.removeClass("fancytree-drag-source"),a(document).off(".fancytree-dnd"),r.dragStop&&r.dragStop(c,s);break;default:a.error("Unsupported drag event: "+b)}return t},_cancelDrag:function(){var b=a.ui.ddmanager.current;b&&b.cancel()}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.dnd5.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(a){return 0===a?"":a>0?"+"+a:""+a}function c(b){var c;return!!b&&(c=a.isPlainObject(b)?{over:!!b.over,before:!!b.before,after:!!b.after}:a.isArray(b)?{over:a.inArray("over",b)>=0,before:a.inArray("before",b)>=0,after:a.inArray("after",b)>=0}:{over:b===!0||"over"===b,before:b===!0||"before"===b,after:b===!0||"after"===b},0!==Object.keys(c).length&&c)}function d(b,c){var d,e,f,g=b.options.dnd5,h=b.$scrollParent[0],i=g.scrollSensitivity,j=g.scrollSpeed,k=0;return h!==document&&"HTML"!==h.tagName?(d=b.$scrollParent.offset(),e=h.scrollTop,d.top+h.offsetHeight-c.pageY<i?(f=h.scrollHeight-b.$scrollParent.innerHeight()-e,f>0&&(h.scrollTop=k=e+j)):e>0&&c.pageY-d.top<i&&(h.scrollTop=k=e-j)):(e=a(document).scrollTop(),e>0&&c.pageY-e<i?(k=e-j,a(document).scrollTop(k)):a(window).height()-(c.pageY-e)<i&&(k=e+j,a(document).scrollTop(k))),k&&b.debug("autoScroll: "+k+"px"),k}function e(c,e){if(e.options.dnd5.scroll&&d(e.tree,c),!e.node)return e.tree.warn("Ignore dragover for non-node"),r;var f,g,n,p=null,s=e.tree,t=s.options,u=t.dnd5,v=e.node,w=e.otherNode,x="center",y=a(v.span),z=y.find("span.fancytree-title");if(q===!1)return s.info("Ignore dragover, since dragenter returned false"),!1;if("string"==typeof q?a.error("assert failed: dragenter returned string"):(g=y.offset(),n=(c.pageY-g.top)/y.height(),q.after&&n>.75?p="after":!q.over&&q.after&&n>.5?p="after":q.before&&n<=.25?p="before":!q.over&&q.before&&n<=.5?p="before":q.over&&(p="over"),u.preventVoidMoves&&(v===w?(v.debug("drop over source node prevented"),p=null):"before"===p&&w&&v===w.getNextSibling()?(v.debug("drop after source node prevented"),p=null):"after"===p&&w&&v===w.getPrevSibling()?(v.debug("drop before source node prevented"),p=null):"over"===p&&w&&w.parent===v&&w.isLastSibling()&&(v.debug("drop last child over own parent prevented"),p=null))),e.hitMode=p,p&&u.dragOver&&(u.dragOver(v,e),p=e.hitMode),r=p,"after"===p||"before"===p||"over"===p){switch(f=u.dropMarkerOffsetX||0,p){case"before":x="top",f+=u.dropMarkerInsertOffsetX||0;break;case"after":x="bottom",f+=u.dropMarkerInsertOffsetX||0}o.toggleClass(i,"after"===p).toggleClass(k,"over"===p).toggleClass(j,"before"===p).show().position(a.ui.fancytree.fixPositionOptions({my:"left"+b(f)+" center",at:"left "+x,of:z}))}else o.hide();return a(v.span).toggleClass(m,"after"===p||"before"===p||"over"===p).toggleClass(i,"after"===p).toggleClass(j,"before"===p).toggleClass(h,"over"===p).toggleClass(l,p===!1),p}var f="fancytree-drag-source",g="fancytree-drag-remove",h="fancytree-drop-accept",i="fancytree-drop-after",j="fancytree-drop-before",k="fancytree-drop-over",l="fancytree-drop-reject",m="fancytree-drop-target",n="application/x-fancytree-node",o=null,p=null,q=null,r=null;return a.ui.fancytree.registerExtension({name:"dnd5",version:"2.26.0",options:{autoExpandMS:1500,setTextTypeJson:!1,preventForeignNodes:!1,preventNonNodes:!1,preventRecursiveMoves:!0,preventVoidMoves:!0,scroll:!0,scrollSensitivity:20,scrollSpeed:5,dropMarkerOffsetX:-24,dropMarkerInsertOffsetX:-16,dragStart:null,dragDrag:a.noop,dragEnd:a.noop,dragEnter:null,dragOver:a.noop,dragExpand:a.noop,dragDrop:a.noop,dragLeave:a.noop},treeInit:function(b){var d,i=b.tree,j=b.options,m=j.glyph||null,s=j.dnd5,t=a.ui.fancytree.getNode;a.inArray("dnd",j.extensions)>=0&&a.error("Extensions 'dnd' and 'dnd5' are mutually exclusive."),s.dragStop&&a.error("dragStop is not used by ext-dnd5. Use dragEnd instead."),s.dragStart&&a.ui.fancytree.overrideMethod(b.options,"createNode",function(a,b){this._super.apply(this,arguments),b.node.span.draggable=!0}),this._superApply(arguments),this.$container.addClass("fancytree-ext-dnd5"),d=a("<span>").appendTo(this.$container),this.$scrollParent=d.scrollParent(),d.remove(),o=a("#fancytree-drop-marker"),o.length||(o=a("<div id='fancytree-drop-marker'></div>").hide().css({"z-index":1e3,"pointer-events":"none"}).prependTo("body"),m&&o.addClass(m.map.dropMarker)),s.dragStart&&i.$container.on("dragstart drag dragend",function(b){var c,d=t(b),e=b.dataTransfer||b.originalEvent.dataTransfer,h="move"===e.dropEffect,j=d?a(d.span):null,k={node:d,tree:i,options:i.options,originalEvent:b,dataTransfer:e,isCancelled:void 0};switch(b.type){case"dragstart":a(d.span).addClass(f),p=d,c=JSON.stringify(d.toDict());try{e.setData(n,c),e.setData("text/html",a(d.span).html()),e.setData("text/plain",d.title)}catch(l){i.warn("Could not set data (IE only accepts 'text') - "+l)}return s.setTextTypeJson?e.setData("text",c):e.setData("text",d.title),e.effectAllowed="all",e.setDragImage&&e.setDragImage(a(d.span).find(".fancytree-title")[0],-10,-10),s.dragStart(d,k)!==!1;case"drag":j.toggleClass(g,h),s.dragDrag(d,k);break;case"dragend":a(d.span).removeClass(f+" "+g),p=null,q=null,k.isCancelled="none"===e.dropEffect,o.hide(),s.dragEnd(d,k)}}),s.dragEnter&&i.$container.on("dragenter dragover dragleave drop",function(b){var d,f,g,j,m=null,u=t(b),v=b.dataTransfer||b.originalEvent.dataTransfer,w={node:u,tree:i,options:i.options,hitMode:q,originalEvent:b,dataTransfer:v,otherNode:p||null,otherNodeData:null,dropEffect:void 0,isCancelled:void 0};switch(b.type){case"dragenter":if(!u){i.debug("Ignore non-node "+b.type+": "+b.target.tagName+"."+b.target.className),q=!1;break}if(a(u.span).addClass(k).removeClass(h+" "+l),s.preventNonNodes&&!f){u.debug("Reject dropping a non-node"),q=!1;break}if(s.preventForeignNodes&&(!p||p.tree!==u.tree)){u.debug("Reject dropping a foreign node"),q=!1;break}setTimeout(function(){!s.autoExpandMS||u.hasChildren()===!1||u.expanded||s.dragExpand&&s.dragExpand(u,w)===!1||u.scheduleAction("expand",s.autoExpandMS)},0),o.show(),s.preventRecursiveMoves&&u.isDescendantOf(w.otherNode)?j=!1:(g=s.dragEnter(u,w),j=c(g)),q=j,m=j&&(j.over||j.before||j.after);break;case"dragover":r=e(b,w),m=!!r;break;case"dragleave":if(!u){i.debug("Ignore non-node "+b.type+": "+b.target.tagName+"."+b.target.className);break}if(!a(u.span).hasClass(k)){u.debug("Ignore dragleave (multi)");break}a(u.span).removeClass(k+" "+h+" "+l),u.scheduleAction("cancel"),s.dragLeave(u,w),o.hide();break;case"drop":if(a.inArray(n,v.types)>=0&&(f=v.getData(n),i.info(b.type+": getData('application/x-fancytree-node'): '"+f+"'")),f||(f=v.getData("text"),i.info(b.type+": getData('text'): '"+f+"'")),f)try{d=JSON.parse(f),void 0!==d.title&&(w.otherNodeData=d)}catch(x){}i.debug(b.type+": nodeData: '"+f+"', otherNodeData: ",w.otherNodeData),a(u.span).removeClass(k+" "+h+" "+l),o.hide(),w.hitMode=r,w.dropEffect=v.dropEffect,w.isCancelled="none"===w.dropEffect,s.dragDrop(u,w),b.preventDefault()}if(m)return b.preventDefault(),!1})}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.edit.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";var b=/Mac/.test(navigator.platform),c=a.ui.fancytree.escapeHtml,d=a.ui.fancytree.unescapeHtml;return a.ui.fancytree._FancytreeNodeClass.prototype.editStart=function(){var b,c=this,e=this.tree,f=e.ext.edit,g=e.options.edit,h=a(".fancytree-title",c.span),i={node:c,tree:e,options:e.options,isNew:a(c[e.statusClassPropName]).hasClass("fancytree-edit-new"),orgTitle:c.title,input:null,dirty:!1};return g.beforeEdit.call(c,{type:"beforeEdit"},i)!==!1&&(a.ui.fancytree.assert(!f.currentNode,"recursive edit"),f.currentNode=this,f.eventData=i,e.widget._unbind(),a(document).on("mousedown.fancytree-edit",function(b){a(b.target).hasClass("fancytree-edit-input")||c.editEnd(!0,b)}),b=a("<input />",{"class":"fancytree-edit-input",type:"text",value:e.options.escapeTitles?i.orgTitle:d(i.orgTitle)}),f.eventData.input=b,null!=g.adjustWidthOfs&&b.width(h.width()+g.adjustWidthOfs),null!=g.inputCss&&b.css(g.inputCss),h.html(b),b.focus().change(function(a){b.addClass("fancytree-edit-dirty")}).keydown(function(b){switch(b.which){case a.ui.keyCode.ESCAPE:c.editEnd(!1,b);break;case a.ui.keyCode.ENTER:return c.editEnd(!0,b),!1}b.stopPropagation()}).blur(function(a){return c.editEnd(!0,a)}),void g.edit.call(c,{type:"edit"},i))},a.ui.fancytree._FancytreeNodeClass.prototype.editEnd=function(b,d){var e,f=this,g=this.tree,h=g.ext.edit,i=h.eventData,j=g.options.edit,k=a(".fancytree-title",f.span),l=k.find("input.fancytree-edit-input");return j.trim&&l.val(a.trim(l.val())),e=l.val(),i.dirty=e!==f.title,i.originalEvent=d,b===!1?i.save=!1:i.isNew?i.save=""!==e:i.save=i.dirty&&""!==e,j.beforeClose.call(f,{type:"beforeClose"},i)!==!1&&((!i.save||j.save.call(f,{type:"save"},i)!==!1)&&(l.removeClass("fancytree-edit-dirty").off(),a(document).off(".fancytree-edit"),i.save?(f.setTitle(g.options.escapeTitles?e:c(e)),f.setFocus()):i.isNew?(f.remove(),f=i.node=null,h.relatedNode.setFocus()):(f.renderTitle(),f.setFocus()),h.eventData=null,h.currentNode=null,h.relatedNode=null,g.widget._bind(),a(g.$container).focus(),i.input=null,j.close.call(f,{type:"close"},i),!0))},a.ui.fancytree._FancytreeNodeClass.prototype.editCreateNode=function(b,c){var d,e=this.tree,f=this;return b=b||"child",null==c?c={title:""}:"string"==typeof c?c={title:c}:a.ui.fancytree.assert(a.isPlainObject(c)),"child"!==b||this.isExpanded()||this.hasChildren()===!1?(d=this.addNode(c,b),d.match=!0,a(d[e.statusClassPropName]).removeClass("fancytree-hide").addClass("fancytree-match"),void d.makeVisible().done(function(){a(d[e.statusClassPropName]).addClass("fancytree-edit-new"),f.tree.ext.edit.relatedNode=f,d.editStart()})):void this.setExpanded().done(function(){f.editCreateNode(b,c)})},a.ui.fancytree._FancytreeClass.prototype.isEditing=function(){return this.ext.edit?this.ext.edit.currentNode:null},a.ui.fancytree._FancytreeNodeClass.prototype.isEditing=function(){return!!this.tree.ext.edit&&this.tree.ext.edit.currentNode===this},a.ui.fancytree.registerExtension({name:"edit",version:"2.26.0",options:{adjustWidthOfs:4,allowEmpty:!1,inputCss:{minWidth:"3em"},triggerStart:["f2","shift+click","mac+enter"],trim:!0,beforeClose:a.noop,beforeEdit:a.noop,close:a.noop,edit:a.noop,save:a.noop},currentNode:null,treeInit:function(a){this._superApply(arguments),this.$container.addClass("fancytree-ext-edit")},nodeClick:function(b){return a.inArray("shift+click",b.options.edit.triggerStart)>=0&&b.originalEvent.shiftKey?(b.node.editStart(),!1):this._superApply(arguments)},nodeDblclick:function(b){return a.inArray("dblclick",b.options.edit.triggerStart)>=0?(b.node.editStart(),!1):this._superApply(arguments)},nodeKeydown:function(c){switch(c.originalEvent.which){case 113:if(a.inArray("f2",c.options.edit.triggerStart)>=0)return c.node.editStart(),!1;break;case a.ui.keyCode.ENTER:if(a.inArray("mac+enter",c.options.edit.triggerStart)>=0&&b)return c.node.editStart(),!1}return this._superApply(arguments)}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.filter.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(a){return(a+"").replace(/([.?*+\^\$\[\]\\(){}|-])/g,"\\$1")}function c(b){return b.indexOf(">")>=0?a("<div/>").html(b).text():b}var d="__not_found__",e=a.ui.fancytree.escapeHtml;return a.ui.fancytree._FancytreeClass.prototype._applyFilterImpl=function(f,g,h){var i,j,k,l,m,n=0,o=this.options,p=o.escapeTitles,q=o.autoCollapse,r=a.extend({},o.filter,h),s="hide"===r.mode,t=!!r.leavesOnly&&!g;if("string"==typeof f){if(""===f)return this.warn("Fancytree passing an empty string as a filter is handled as clearFilter()."),void this.clearFilter();i=r.fuzzy?f.split("").reduce(function(a,b){return a+"[^"+b+"]*"+b}):b(f),k=new RegExp(".*"+i+".*","i"),l=new RegExp(b(f),"gi"),f=function(a){var b=p?a.title:c(a.title),d=!!k.test(b);return d&&r.highlight&&(p?(m=b.replace(l,function(a){return""+a+""}),a.titleWithHighlight=e(m).replace(/\uFFF7/g,"<mark>").replace(/\uFFF8/g,"</mark>")):a.titleWithHighlight=b.replace(l,function(a){return"<mark>"+a+"</mark>"})),d}}return this.enableFilter=!0,this.lastFilterArgs=arguments,this.$div.addClass("fancytree-ext-filter"),s?this.$div.addClass("fancytree-ext-filter-hide"):this.$div.addClass("fancytree-ext-filter-dimm"),this.$div.toggleClass("fancytree-ext-filter-hide-expanders",!!r.hideExpanders),this.visit(function(a){delete a.match,delete a.titleWithHighlight,a.subMatchCount=0}),j=this.getRootNode()._findDirectChild(d),j&&j.remove(),o.autoCollapse=!1,this.visit(function(a){if(!t||null==a.children){var b=f(a),c=!1;if("skip"===b)return a.visit(function(a){a.match=!1},!0),"skip";b||!g&&"branch"!==b||!a.parent.match||(b=!0,c=!0),b&&(n++,a.match=!0,a.visitParents(function(a){a.subMatchCount+=1,!r.autoExpand||c||a.expanded||(a.setExpanded(!0,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),a._filterAutoExpanded=!0)}))}}),o.autoCollapse=q,0===n&&r.nodata&&s&&(j=r.nodata,a.isFunction(j)&&(j=j()),j===!0?j={}:"string"==typeof j&&(j={title:j}),j=a.extend({statusNodeType:"nodata",key:d,title:this.options.strings.noData},j),this.getRootNode().addNode(j).match=!0),this.render(),n},a.ui.fancytree._FancytreeClass.prototype.filterNodes=function(a,b){return"boolean"==typeof b&&(b={leavesOnly:b},this.warn("Fancytree.filterNodes() leavesOnly option is deprecated since 2.9.0 / 2015-04-19. Use opts.leavesOnly instead.")),this._applyFilterImpl(a,!1,b)},a.ui.fancytree._FancytreeClass.prototype.applyFilter=function(a){return this.warn("Fancytree.applyFilter() is deprecated since 2.1.0 / 2014-05-29. Use .filterNodes() instead."),this.filterNodes.apply(this,arguments)},a.ui.fancytree._FancytreeClass.prototype.filterBranches=function(a,b){return this._applyFilterImpl(a,!0,b)},a.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){var b,c=this.getRootNode()._findDirectChild(d),e=this.options.escapeTitles,f=this.options.enhanceTitle;c&&c.remove(),this.visit(function(c){c.match&&c.span&&(b=a(c.span).find(">span.fancytree-title"),e?b.text(c.title):b.html(c.title),f&&f({type:"enhanceTitle"},{node:c,$title:b})),delete c.match,delete c.subMatchCount,delete c.titleWithHighlight,c.$subMatchBadge&&(c.$subMatchBadge.remove(),delete c.$subMatchBadge),c._filterAutoExpanded&&c.expanded&&c.setExpanded(!1,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),delete c._filterAutoExpanded}),this.enableFilter=!1,this.lastFilterArgs=null,this.$div.removeClass("fancytree-ext-filter fancytree-ext-filter-dimm fancytree-ext-filter-hide"),this.render()},a.ui.fancytree._FancytreeClass.prototype.isFilterActive=function(){return!!this.enableFilter},a.ui.fancytree._FancytreeNodeClass.prototype.isMatched=function(){return!(this.tree.enableFilter&&!this.match)},a.ui.fancytree.registerExtension({name:"filter",version:"2.26.0",options:{autoApply:!0,autoExpand:!1,counter:!0,fuzzy:!1,hideExpandedCounter:!0,hideExpanders:!1,highlight:!0,leavesOnly:!1,nodata:!0,mode:"dimm"},nodeLoadChildren:function(a,b){return this._superApply(arguments).done(function(){a.tree.enableFilter&&a.tree.lastFilterArgs&&a.options.filter.autoApply&&a.tree._applyFilterImpl.apply(a.tree,a.tree.lastFilterArgs)})},nodeSetExpanded:function(a,b,c){return delete a.node._filterAutoExpanded,!b&&a.options.filter.hideExpandedCounter&&a.node.$subMatchBadge&&a.node.$subMatchBadge.show(),this._superApply(arguments)},nodeRenderStatus:function(b){var c,d=b.node,e=b.tree,f=b.options.filter,g=a(d.span).find("span.fancytree-title"),h=a(d[e.statusClassPropName]),i=b.options.enhanceTitle,j=b.options.escapeTitles;return c=this._super(b),h.length&&e.enableFilter?(h.toggleClass("fancytree-match",!!d.match).toggleClass("fancytree-submatch",!!d.subMatchCount).toggleClass("fancytree-hide",!(d.match||d.subMatchCount)),!f.counter||!d.subMatchCount||d.isExpanded()&&f.hideExpandedCounter?d.$subMatchBadge&&d.$subMatchBadge.hide():(d.$subMatchBadge||(d.$subMatchBadge=a("<span class='fancytree-childcounter'/>"),a("span.fancytree-icon, span.fancytree-custom-icon",d.span).append(d.$subMatchBadge)),d.$subMatchBadge.show().text(d.subMatchCount)),!d.span||d.isEditing&&d.isEditing.call(d)||(d.titleWithHighlight?g.html(d.titleWithHighlight):j?g.text(d.title):g.html(d.title),i&&i({type:"enhanceTitle"},{node:d,$title:g})),c):c}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.glyph.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(a,b){return a.map[b]}var c=a.ui.fancytree,d={awesome3:{checkbox:"icon-check-empty",checkboxSelected:"icon-check",checkboxUnknown:"icon-check icon-muted",radio:"icon-circle-blank",radioSelected:"icon-circle",radioUnknown:"icon-circle icon-muted",dragHelper:"icon-caret-right",dropMarker:"icon-caret-right",error:"icon-exclamation-sign",expanderClosed:"icon-caret-right",expanderLazy:"icon-angle-right",expanderOpen:"icon-caret-down",loading:"icon-refresh icon-spin",nodata:"icon-meh",noExpander:"",doc:"icon-file-alt",docOpen:"icon-file-alt",folder:"icon-folder-close-alt",folderOpen:"icon-folder-open-alt"},awesome4:{checkbox:"fa fa-square-o",checkboxSelected:"fa fa-check-square-o",checkboxUnknown:"fa fa-square",radio:"fa fa-circle-o",radioSelected:"fa fa-circle",radioUnknown:"fa fa-dot-circle-o",dragHelper:"fa fa-arrow-right",dropMarker:"fa fa-long-arrow-right",error:"fa fa-warning",expanderClosed:"fa fa-caret-right",expanderLazy:"fa fa-angle-right",expanderOpen:"fa fa-caret-down",loading:"fa fa-spinner fa-pulse",nodata:"fa fa-meh-o",noExpander:"",doc:"fa fa-file-o",docOpen:"fa fa-file-o",folder:"fa fa-folder-o",folderOpen:"fa fa-folder-open-o"},bootstrap3:{checkbox:"glyphicon glyphicon-unchecked",checkboxSelected:"glyphicon glyphicon-check",checkboxUnknown:"glyphicon glyphicon-expand",radio:"glyphicon glyphicon-remove-circle",radioSelected:"glyphicon glyphicon-ok-circle",radioUnknown:"glyphicon glyphicon-ban-circle",dragHelper:"glyphicon glyphicon-play",dropMarker:"glyphicon glyphicon-arrow-right",error:"glyphicon glyphicon-warning-sign",expanderClosed:"glyphicon glyphicon-menu-right",expanderLazy:"glyphicon glyphicon-menu-right",expanderOpen:"glyphicon glyphicon-menu-down",loading:"glyphicon glyphicon-refresh glyphicon-spin",nodata:"glyphicon glyphicon-info-sign",noExpander:"",doc:"glyphicon glyphicon-file",docOpen:"glyphicon glyphicon-file",folder:"glyphicon glyphicon-folder-close",folderOpen:"glyphicon glyphicon-folder-open"}};return a.ui.fancytree.registerExtension({name:"glyph",version:"2.26.0",options:{preset:null,map:{}},treeInit:function(b){var e=b.tree,f=b.options.glyph;f.preset?(c.assert(!!d[f.preset],"Invalid value for `options.glyph.preset`: "+f.preset),f.map=a.extend({},d[f.preset],f.map)):e.warn("ext-glyph: missing `preset` option."),this._superApply(arguments),e.$container.addClass("fancytree-ext-glyph")},nodeRenderStatus:function(d){var e,f,g,h,i,j=d.node,k=a(j.span),l=d.options.glyph,m=l.map;return h=this._super(d),j.isRoot()?h:(i=k.children("span.fancytree-expander").get(0),i&&(g=j.expanded&&j.hasChildren()?"expanderOpen":j.isUndefined()?"expanderLazy":j.hasChildren()?"expanderClosed":"noExpander",i.className="fancytree-expander "+m[g]),i=j.tr?a("td",j.tr).find("span.fancytree-checkbox").get(0):k.children("span.fancytree-checkbox").get(0),i&&(e=c.evalOption("checkbox",j,j,d.options,!1),e&&!j.isStatusNode()&&(f="fancytree-checkbox ","radio"===e||j.parent&&j.parent.radiogroup?(f+="fancytree-radio ",g=j.selected?"radioSelected":j.partsel?"radioUnknown":"radio"):g=j.selected?"checkboxSelected":j.partsel?"checkboxUnknown":"checkbox",i.className=f+m[g])),i=k.children("span.fancytree-icon").get(0),i&&(g=j.statusNodeType?b(l,j.statusNodeType):j.folder?j.expanded&&j.hasChildren()?b(l,"folderOpen"):b(l,"folder"):j.expanded?b(l,"docOpen"):b(l,"doc"),i.className="fancytree-icon "+g),h)},nodeSetStatus:function(c,d,e,f){var g,h,i=c.options.glyph,j=c.node;return g=this._superApply(arguments),"error"!==d&&"loading"!==d&&"nodata"!==d||(j.parent?(h=a("span.fancytree-expander",j.span).get(0),h&&(h.className="fancytree-expander "+b(i,d))):(h=a(".fancytree-statusnode-"+d,j[this.nodeContainerAttrName]).find("span.fancytree-icon").get(0),h&&(h.className="fancytree-icon "+b(i,d)))),g}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.gridnav.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree","./jquery.fancytree.table"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree.table"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(b,c){var d,e=c.get(0),f=0;return b.children().each(function(){return this!==e&&(d=a(this).prop("colspan"),void(f+=d?d:1))}),f}function c(b,c){var d,e=null,f=0;return b.children().each(function(){return f>=c?(e=a(this),!1):(d=a(this).prop("colspan"),void(f+=d?d:1))}),e}function d(a,d){var f,g,h=a.closest("td"),i=null;switch(d){case e.LEFT:i=h.prev();break;case e.RIGHT:i=h.next();break;case e.UP:case e.DOWN:for(f=h.parent(),g=b(f,h);;){if(f=d===e.UP?f.prev():f.next(),!f.length)break;if(!f.is(":hidden")&&(i=c(f,g),i&&i.find(":input,a").length))break}}return i}var e=a.ui.keyCode,f={text:[e.UP,e.DOWN],checkbox:[e.UP,e.DOWN,e.LEFT,e.RIGHT],link:[e.UP,e.DOWN,e.LEFT,e.RIGHT],radiobutton:[e.UP,e.DOWN,e.LEFT,e.RIGHT],"select-one":[e.LEFT,e.RIGHT],"select-multiple":[e.LEFT,e.RIGHT]};return a.ui.fancytree.registerExtension({name:"gridnav",version:"2.26.0",options:{autofocusInput:!1,handleCursorKeys:!0},treeInit:function(b){this._requireExtension("table",!0,!0),this._superApply(arguments),this.$container.addClass("fancytree-ext-gridnav"),this.$container.on("focusin",function(c){var d,e=a.ui.fancytree.getNode(c.target);e&&!e.isActive()&&(d=b.tree._makeHookContext(e,c),b.tree._callHook("nodeSetActive",d,!0))})},nodeSetActive:function(b,c,d){var e,f=b.options.gridnav,g=b.node,h=b.originalEvent||{},i=a(h.target).is(":input");c=c!==!1,this._superApply(arguments),c&&(b.options.titlesTabbable?(i||(a(g.span).find("span.fancytree-title").focus(),g.setFocus()),b.tree.$container.attr("tabindex","-1")):f.autofocusInput&&!i&&(e=a(g.tr||g.span),e.find(":input:enabled:first").focus()))},nodeKeydown:function(b){var c,e,g,h=b.options.gridnav,i=b.originalEvent,j=a(i.target);return j.is(":input:enabled")?c=j.prop("type"):j.is("a")&&(c="link"),c&&h.handleCursorKeys?(e=f[c],!(e&&a.inArray(i.which,e)>=0&&(g=d(j,i.which),g&&g.length))||(g.find(":input:enabled,a").focus(),!1)):this._superApply(arguments)}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.persist.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(c,d,e,f,g){var i,j,k,l,m=!1,n=c.options.persist.expandOpts,o=[],p=[];for(e=e||[],g=g||a.Deferred(),i=0,k=e.length;i<k;i++)j=e[i],l=c.getNodeByKey(j),l?f&&l.isUndefined()?(m=!0,c.debug("_loadLazyNodes: "+l+" is lazy: loading..."),"expand"===f?o.push(l.setExpanded(!0,n)):o.push(l.load())):(c.debug("_loadLazyNodes: "+l+" already loaded."),l.setExpanded(!0,n)):(p.push(j),c.debug("_loadLazyNodes: "+l+" was not yet found."));return a.when.apply(a,o).always(function(){if(m&&p.length>0)b(c,d,p,f,g);else{if(p.length)for(c.warn("_loadLazyNodes: could not load those keys: ",p),i=0,k=p.length;i<k;i++)j=e[i],d._appendKey(h,e[i],!1);g.resolve()}}),g}var c,d,e,f=a.ui.fancytree.assert,g="active",h="expanded",i="focus",j="selected";return"function"==typeof Cookies?(e=Cookies.set,c=Cookies.get,d=Cookies.remove):(e=c=a.cookie,d=a.removeCookie),a.ui.fancytree._FancytreeClass.prototype.clearCookies=function(a){var b=this.ext.persist,c=b.cookiePrefix;a=a||"active expanded focus selected",a.indexOf(g)>=0&&b._data(c+g,null),a.indexOf(h)>=0&&b._data(c+h,null),a.indexOf(i)>=0&&b._data(c+i,null),a.indexOf(j)>=0&&b._data(c+j,null)},a.ui.fancytree._FancytreeClass.prototype.getPersistData=function(){var a=this.ext.persist,b=a.cookiePrefix,c=a.cookieDelimiter,d={};return d[g]=a._data(b+g),d[h]=(a._data(b+h)||"").split(c),d[j]=(a._data(b+j)||"").split(c),d[i]=a._data(b+i),d},a.ui.fancytree.registerExtension({name:"persist",version:"2.26.0",options:{cookieDelimiter:"~",cookiePrefix:void 0,cookie:{raw:!1,expires:"",path:"",domain:"",secure:!1},expandLazy:!1,expandOpts:void 0,fireActivate:!0,overrideSource:!0,store:"auto",types:"active expanded focus selected"},_data:function(a,b){var f=this._local.localStorage;return void 0===b?f?f.getItem(a):c(a):void(null===b?f?f.removeItem(a):d(a):f?f.setItem(a,b):e(a,b,this.options.persist.cookie))},_appendKey:function(b,c,d){c=""+c;var e=this._local,f=this.options.persist,g=f.cookieDelimiter,h=e.cookiePrefix+b,i=e._data(h),j=i?i.split(g):[],k=a.inArray(c,j);k>=0&&j.splice(k,1),d&&j.push(c),e._data(h,j.join(g))},treeInit:function(d){var e=d.tree,k=d.options,l=this._local,m=this.options.persist;return f("auto"!==m.store&&"cookie"!==m.store||c,"Missing required plugin for 'persist' extension: js.cookie.js or jquery.cookie.js"),l.cookiePrefix=m.cookiePrefix||"fancytree-"+e._id+"-",l.storeActive=m.types.indexOf(g)>=0,l.storeExpanded=m.types.indexOf(h)>=0,l.storeSelected=m.types.indexOf(j)>=0,l.storeFocus=m.types.indexOf(i)>=0,"cookie"!==m.store&&window.localStorage?l.localStorage="local"===m.store?window.localStorage:window.sessionStorage:l.localStorage=null,e.$div.on("fancytreeinit",function(c){if(e._triggerTreeEvent("beforeRestore",null,{})!==!1){var d,f,n,o,p,q=l._data(l.cookiePrefix+i),r=m.fireActivate===!1;d=l._data(l.cookiePrefix+h),o=d&&d.split(m.cookieDelimiter),f=l.storeExpanded?b(e,l,o,!!m.expandLazy&&"expand",null):(new a.Deferred).resolve(),f.done(function(){if(l.storeSelected){if(d=l._data(l.cookiePrefix+j))for(o=d.split(m.cookieDelimiter),n=0;n<o.length;n++)p=e.getNodeByKey(o[n]),p?(void 0===p.selected||m.overrideSource&&p.selected===!1)&&(p.selected=!0,p.renderStatus()):l._appendKey(j,o[n],!1);3===e.options.selectMode&&e.visit(function(a){if(a.selected)return a.fixSelection3AfterClick(),"skip"})}l.storeActive&&(d=l._data(l.cookiePrefix+g),!d||!k.persist.overrideSource&&e.activeNode||(p=e.getNodeByKey(d),p&&(p.debug("persist: set active",d),p.setActive(!0,{noFocus:!0,noEvents:r})))),l.storeFocus&&q&&(p=e.getNodeByKey(q),p&&(e.options.titlesTabbable?a(p.span).find(".fancytree-title").focus():a(e.$container).focus())),e._triggerTreeEvent("restore",null,{})})}}),this._superApply(arguments)},nodeSetActive:function(a,b,c){var d,e=this._local;return b=b!==!1,d=this._superApply(arguments),e.storeActive&&e._data(e.cookiePrefix+g,this.activeNode?this.activeNode.key:null),d},nodeSetExpanded:function(a,b,c){var d,e=a.node,f=this._local;return b=b!==!1,d=this._superApply(arguments),f.storeExpanded&&f._appendKey(h,e.key,b),d},nodeSetFocus:function(a,b){var c,d=this._local;return b=b!==!1,c=this._superApply(arguments),d.storeFocus&&d._data(d.cookiePrefix+i,this.focusNode?this.focusNode.key:null),c},nodeSetSelected:function(b,c,d){var e,f,g=b.tree,h=b.node,i=this._local;return c=c!==!1,e=this._superApply(arguments),i.storeSelected&&(3===g.options.selectMode?(f=a.map(g.getSelectedNodes(!0),function(a){return a.key}),f=f.join(b.options.persist.cookieDelimiter),i._data(i.cookiePrefix+j,f)):i._appendKey(j,h.key,h.selected)),e}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.table.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(b,c){c=c||"",b||a.error("Assertion failed "+c)}function c(a,b){a.insertBefore(b,a.firstChild)}function d(a,b){a.parentNode.insertBefore(b,a.nextSibling)}function e(a,b){a.visit(function(a){var c=a.tr;if(c&&(c.style.display=a.hide||!b?"none":""),!a.expanded)return"skip"})}function f(c){var d,e,f,g=c.parent,h=g?g.children:null;if(h&&h.length>1&&h[0]!==c)for(d=a.inArray(c,h),f=h[d-1],b(f.tr);f.children&&f.children.length&&(e=f.children[f.children.length-1],e.tr);)f=e;else f=g;return f}return a.ui.fancytree.registerExtension({name:"table",version:"2.26.0",options:{checkboxColumnIdx:null,indentation:16,nodeColumnIdx:0},treeInit:function(c){var d,e,f,g,h,i=c.tree,j=c.options,k=j.table,l=i.widget.element;if(null!=k.customStatus&&(null!=j.renderStatusColumns?a.error("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' only instead."):(i.warn("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' instead."),j.renderStatusColumns=k.customStatus)),j.renderStatusColumns&&j.renderStatusColumns===!0&&(j.renderStatusColumns=j.renderColumns),l.addClass("fancytree-container fancytree-ext-table"),i.tbody=l.find(">tbody")[0],h=a(i.tbody),e=a("thead >tr:last >th",l).length,g=h.children("tr:first"),g.length)f=g.children("td").length,e&&f!==e&&(i.warn("Column count mismatch between thead ("+e+") and tbody ("+f+"): using tbody."),e=f),g=g.clone();else for(b(e>=1,"Need either <thead> or <tbody> with <td> elements to determine column count."),g=a("<tr />"),d=0;d<e;d++)g.append("<td />");g.find(">td").eq(k.nodeColumnIdx).html("<span class='fancytree-node' />"),j.aria&&(g.attr("role","row"),g.find("td").attr("role","gridcell")),i.rowFragment=document.createDocumentFragment(),i.rowFragment.appendChild(g.get(0)),h.empty(),i.statusClassPropName="tr",i.ariaPropName="tr",this.nodeContainerAttrName="tr",i.$container=l,this._superApply(arguments),a(i.rootNode.ul).remove(),i.rootNode.ul=null,this.$container.attr("tabindex",j.tabindex),j.aria&&i.$container.attr("role","treegrid").attr("aria-readonly",!0)},nodeRemoveChildMarkup:function(b){var c=b.node;c.visit(function(b){b.tr&&(a(b.tr).remove(),b.tr=null)})},nodeRemoveMarkup:function(b){var c=b.node;c.tr&&(a(c.tr).remove(),c.tr=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(g,h,i,j,k){var l,m,n,o,p,q,r,s,t=g.tree,u=g.node,v=g.options,w=!u.parent;if(t._enableUpdate!==!1){if(k||(g.hasCollapsedParents=u.parent&&!u.parent.expanded),!w)if(u.tr&&h&&this.nodeRemoveMarkup(g),u.tr)h?this.nodeRenderTitle(g):this.nodeRenderStatus(g);else{if(g.hasCollapsedParents&&!i)return;p=t.rowFragment.firstChild.cloneNode(!0),q=f(u),b(q),j===!0&&k?p.style.display="none":i&&g.hasCollapsedParents&&(p.style.display="none"),q.tr?d(q.tr,p):(b(!q.parent,"prev. row must have a tr, or be system root"),c(t.tbody,p)),u.tr=p,u.key&&v.generateIds&&(u.tr.id=v.idPrefix+u.key),u.tr.ftnode=u,u.span=a("span.fancytree-node",u.tr).get(0),this.nodeRenderTitle(g),v.createNode&&v.createNode.call(t,{type:"createNode"},g)}if(v.renderNode&&v.renderNode.call(t,{type:"renderNode"},g),l=u.children,l&&(w||i||u.expanded))for(n=0,o=l.length;n<o;n++)s=a.extend({},g,{node:l[n]}),s.hasCollapsedParents=s.hasCollapsedParents||!u.expanded,this.nodeRender(s,h,i,j,!0);l&&!k&&(r=u.tr||null,m=t.tbody.firstChild,u.visit(function(a){if(a.tr){if(a.parent.expanded||"none"===a.tr.style.display||(a.tr.style.display="none",e(a,!1)),a.tr.previousSibling!==r){u.debug("_fixOrder: mismatch at node: "+a);var b=r?r.nextSibling:m;t.tbody.insertBefore(a.tr,b)}r=a.tr}}))}},nodeRenderTitle:function(b,c){var d,e,f=b.node,g=b.options,h=f.isStatusNode();return e=this._super(b,c),f.isRootNode()?e:(g.checkbox&&!h&&null!=g.table.checkboxColumnIdx&&(d=a("span.fancytree-checkbox",f.span),a(f.tr).find("td").eq(+g.table.checkboxColumnIdx).html(d)),this.nodeRenderStatus(b),h?g.renderStatusColumns&&g.renderStatusColumns.call(b.tree,{type:"renderStatusColumns"},b):g.renderColumns&&g.renderColumns.call(b.tree,{type:"renderColumns"},b),e)},nodeRenderStatus:function(b){var c,d=b.node,e=b.options;this._super(b),a(d.tr).removeClass("fancytree-node"),c=(d.getLevel()-1)*e.table.indentation,a(d.span).css({paddingLeft:c+"px"})},nodeSetExpanded:function(b,c,d){function f(a){e(b.node,c),a?c&&b.options.autoScroll&&!d.noAnimation&&b.node.hasChildren()?b.node.getLastChild().scrollIntoView(!0,{topNode:b.node}).always(function(){d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),g.resolveWith(b.node)}):(d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),g.resolveWith(b.node)):(d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),g.rejectWith(b.node))}if(c=c!==!1,b.node.expanded&&c||!b.node.expanded&&!c)return this._superApply(arguments);var g=new a.Deferred,h=a.extend({},d,{noEvents:!0,noAnimation:!0});return d=d||{},this._super(b,c,h).done(function(){f(!0)}).fail(function(){f(!1)}),g.promise()},nodeSetStatus:function(b,c,d,e){if("ok"===c){var f=b.node,g=f.children?f.children[0]:null;g&&g.isStatusNode()&&a(g.tr).remove()}return this._superApply(arguments)},treeClear:function(a){return this.nodeRemoveChildMarkup(this._makeHookContext(this.rootNode)),this._superApply(arguments)},treeDestroy:function(a){return this.$container.find("tbody").empty(),this.$source&&this.$source.removeClass("ui-helper-hidden"),this._superApply(arguments)}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.themeroller.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";return a.ui.fancytree.registerExtension({name:"themeroller",version:"2.26.0",options:{activeClass:"ui-state-active",addClass:"ui-corner-all",focusClass:"ui-state-focus",hoverClass:"ui-state-hover",selectedClass:"ui-state-highlight"},treeInit:function(b){var c=b.widget.element,d=b.options.themeroller;this._superApply(arguments),"TABLE"===c[0].nodeName?(c.addClass("ui-widget ui-corner-all"),c.find(">thead tr").addClass("ui-widget-header"),c.find(">tbody").addClass("ui-widget-conent")):c.addClass("ui-widget ui-widget-content ui-corner-all"),c.delegate(".fancytree-node","mouseenter mouseleave",function(b){var c=a.ui.fancytree.getNode(b.target),e="mouseenter"===b.type;a(c.tr?c.tr:c.span).toggleClass(d.hoverClass+" "+d.addClass,e)})},treeDestroy:function(a){this._superApply(arguments),a.widget.element.removeClass("ui-widget ui-widget-content ui-corner-all")},nodeRenderStatus:function(b){var c={},d=b.node,e=a(d.tr?d.tr:d.span),f=b.options.themeroller;this._super(b),c[f.activeClass]=!1,c[f.focusClass]=!1,c[f.selectedClass]=!1,d.isActive()&&(c[f.activeClass]=!0),d.hasFocus()&&(c[f.focusClass]=!0),d.isSelected()&&!d.isActive()&&(c[f.selectedClass]=!0),e.toggleClass(f.activeClass,c[f.activeClass]),e.toggleClass(f.focusClass,c[f.focusClass]),e.toggleClass(f.selectedClass,c[f.selectedClass]),e.addClass(f.addClass)}}),a.ui.fancytree});
/*! Extension 'jquery.fancytree.wide.min.js' */
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],a):"object"==typeof module&&module.exports?(require("jquery.fancytree"),module.exports=a(require("jquery"))):a(jQuery)}(function(a){"use strict";function b(b,c){b="fancytree-style-"+b;var d=a("#"+b);if(!c)return d.remove(),null;d.length||(d=a("<style />").attr("id",b).addClass("fancytree-style").prop("type","text/css").appendTo("head"));try{d.html(c)}catch(e){d[0].styleSheet.cssText=c}return d}function c(a,b,c,d,e,f){var g,h="#"+a+" span.fancytree-level-",i=[];for(g=0;g<b;g++)i.push(h+(g+1)+" span.fancytree-title { padding-left: "+(g*c+d)+f+"; }");return i.push("#"+a+" div.ui-effects-wrapper ul li span.fancytree-title, #"+a+" ul.fancytree-animating span.fancytree-title { padding-left: "+e+f+"; position: static; width: auto; }"),i.join("\n")}var d=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;return a.ui.fancytree.registerExtension({name:"wide",version:"2.26.0",options:{iconWidth:null,iconSpacing:null,labelSpacing:null,levelOfs:null},treeCreate:function(e){this._superApply(arguments),this.$container.addClass("fancytree-ext-wide");var f,g,h,i,j,k,l=e.options.wide,m=a("<li id='fancytreeTemp'><span class='fancytree-node'><span class='fancytree-icon' /><span class='fancytree-title' /></span><ul />").appendTo(e.tree.$container),n=m.find(".fancytree-icon"),o=m.find("ul"),p=l.iconSpacing||n.css("margin-left"),q=l.iconWidth||n.css("width"),r=l.labelSpacing||"3px",s=l.levelOfs||o.css("padding-left");m.remove(),h=p.match(d)[2],p=parseFloat(p,10),i=r.match(d)[2],r=parseFloat(r,10),j=q.match(d)[2],q=parseFloat(q,10),k=s.match(d)[2],h===j&&k===j&&i===j||a.error("iconWidth, iconSpacing, and levelOfs must have the same css measure unit"),this._local.measureUnit=j,this._local.levelOfs=parseFloat(s),this._local.lineOfs=(1+(e.options.checkbox?1:0)+(e.options.icon===!1?0:1))*(q+p)+p,this._local.labelOfs=r,this._local.maxDepth=10,f=this.$container.uniqueId().attr("id"),g=c(f,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.labelOfs,this._local.measureUnit),b(f,g)},treeDestroy:function(a){return b(this.$container.attr("id"),null),this._superApply(arguments)},nodeRenderStatus:function(d){var e,f,g,h=d.node,i=h.getLevel();return g=this._super(d),i>this._local.maxDepth&&(e=this.$container.attr("id"),this._local.maxDepth*=2,h.debug("Define global ext-wide css up to level "+this._local.maxDepth),f=c(e,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.labelSpacing,this._local.measureUnit),b(e,f)),a(h.span).addClass("fancytree-level-"+i),g}}),a.ui.fancytree});
// Value returned by `require('jquery.fancytree')`
return $.ui.fancytree;
})); // End of closure