trilium/libraries/fancytree/jquery.fancytree-all-deps.min.js
2019-05-31 18:50:41 +02:00

2 lines
124 KiB
JavaScript

!function(S){S.ui=S.ui||{};S.ui.version="1.12.1";var r,n=0,a=Array.prototype.slice;S.cleanData=(r=S.cleanData,function(e){var t,n,i;for(i=0;null!=(n=e[i]);i++)try{(t=S._data(n,"events"))&&t.remove&&S(n).triggerHandler("remove")}catch(e){}r(e)}),S.widget=function(e,n,t){var i,r,o,s={},a=e.split(".")[0],l=a+"-"+(e=e.split(".")[1]);return t||(t=n,n=S.Widget),S.isArray(t)&&(t=S.extend.apply(null,[{}].concat(t))),S.expr[":"][l.toLowerCase()]=function(e){return!!S.data(e,l)},S[a]=S[a]||{},i=S[a][e],r=S[a][e]=function(e,t){if(!this._createWidget)return new r(e,t);arguments.length&&this._createWidget(e,t)},S.extend(r,i,{version:t.version,_proto:S.extend({},t),_childConstructors:[]}),(o=new n).options=S.widget.extend({},o.options),S.each(t,function(t,o){S.isFunction(o)?s[t]=function(){function i(){return n.prototype[t].apply(this,arguments)}function r(e){return n.prototype[t].apply(this,e)}return function(){var e,t=this._super,n=this._superApply;return this._super=i,this._superApply=r,e=o.apply(this,arguments),this._super=t,this._superApply=n,e}}():s[t]=o}),r.prototype=S.widget.extend(o,{widgetEventPrefix:i&&o.widgetEventPrefix||e},s,{constructor:r,namespace:a,widgetName:e,widgetFullName:l}),i?(S.each(i._childConstructors,function(e,t){var n=t.prototype;S.widget(n.namespace+"."+n.widgetName,r,t._proto)}),delete i._childConstructors):n._childConstructors.push(r),S.widget.bridge(e,r),r},S.widget.extend=function(e){for(var t,n,i=a.call(arguments,1),r=0,o=i.length;r<o;r++)for(t in i[r])n=i[r][t],i[r].hasOwnProperty(t)&&void 0!==n&&(S.isPlainObject(n)?e[t]=S.isPlainObject(e[t])?S.widget.extend({},e[t],n):S.widget.extend({},n):e[t]=n);return e},S.widget.bridge=function(o,t){var s=t.prototype.widgetFullName||o;S.fn[o]=function(n){var e="string"==typeof n,i=a.call(arguments,1),r=this;return e?this.length||"instance"!==n?this.each(function(){var e,t=S.data(this,s);return"instance"===n?(r=t,!1):t?S.isFunction(t[n])&&"_"!==n.charAt(0)?(e=t[n].apply(t,i))!==t&&void 0!==e?(r=e&&e.jquery?r.pushStack(e.get()):e,!1):void 0:S.error("no such method '"+n+"' for "+o+" widget instance"):S.error("cannot call methods on "+o+" prior to initialization; attempted to call method '"+n+"'")}):r=void 0:(i.length&&(n=S.widget.extend.apply(null,[n].concat(i))),this.each(function(){var e=S.data(this,s);e?(e.option(n||{}),e._init&&e._init()):S.data(this,s,new t(n,this))})),r}},S.Widget=function(){},S.Widget._childConstructors=[],S.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,t){t=S(t||this.defaultElement||this)[0],this.element=S(t),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=S(),this.hoverable=S(),this.focusable=S(),this.classesElementLookup={},t!==this&&(S.data(t,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===t&&this.destroy()}}),this.document=S(t.style?t.ownerDocument:t.document||t),this.window=S(this.document[0].defaultView||this.document[0].parentWindow)),this.options=S.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:S.noop,_create:S.noop,_init:S.noop,destroy:function(){var n=this;this._destroy(),S.each(this.classesElementLookup,function(e,t){n._removeClass(t,e)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:S.noop,widget:function(){return this.element},option:function(e,t){var n,i,r,o=e;if(0===arguments.length)return S.widget.extend({},this.options);if("string"==typeof e)if(o={},e=(n=e.split(".")).shift(),n.length){for(i=o[e]=S.widget.extend({},this.options[e]),r=0;r<n.length-1;r++)i[n[r]]=i[n[r]]||{},i=i[n[r]];if(e=n.pop(),1===arguments.length)return void 0===i[e]?null:i[e];i[e]=t}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];o[e]=t}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return"classes"===e&&this._setOptionClasses(t),this.options[e]=t,"disabled"===e&&this._setOptionDisabled(t),this},_setOptionClasses:function(e){var t,n,i;for(t in e)i=this.classesElementLookup[t],e[t]!==this.options.classes[t]&&i&&i.length&&(n=S(i.get()),this._removeClass(i,t),n.addClass(this._classes({element:n,keys:t,classes:e,add:!0})))},_setOptionDisabled:function(e){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!e),e&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(r){var o=[],s=this;function e(e,t){var n,i;for(i=0;i<e.length;i++)n=s.classesElementLookup[e[i]]||S(),n=r.add?S(S.unique(n.get().concat(r.element.get()))):S(n.not(r.element).get()),s.classesElementLookup[e[i]]=n,o.push(e[i]),t&&r.classes[e[i]]&&o.push(r.classes[e[i]])}return r=S.extend({element:this.element,classes:this.options.classes||{}},r),this._on(r.element,{remove:"_untrackClassesElement"}),r.keys&&e(r.keys.match(/\S+/g)||[],!0),r.extra&&e(r.extra.match(/\S+/g)||[]),o.join(" ")},_untrackClassesElement:function(n){var i=this;S.each(i.classesElementLookup,function(e,t){-1!==S.inArray(n.target,t)&&(i.classesElementLookup[e]=S(t.not(n.target).get()))})},_removeClass:function(e,t,n){return this._toggleClass(e,t,n,!1)},_addClass:function(e,t,n){return this._toggleClass(e,t,n,!0)},_toggleClass:function(e,t,n,i){i="boolean"==typeof i?i:n;var r="string"==typeof e||null===e,o={extra:r?t:n,keys:r?e:t,element:r?this.element:e,add:i};return o.element.toggleClass(this._classes(o),i),this},_on:function(s,a,e){var l,d=this;"boolean"!=typeof s&&(e=a,a=s,s=!1),e?(a=l=S(a),this.bindings=this.bindings.add(a)):(e=a,a=this.element,l=this.widget()),S.each(e,function(e,t){function n(){if(s||!0!==d.options.disabled&&!S(this).hasClass("ui-state-disabled"))return("string"==typeof t?d[t]:t).apply(d,arguments)}"string"!=typeof t&&(n.guid=t.guid=t.guid||n.guid||S.guid++);var i=e.match(/^([\w:-]*)\s*(.*)$/),r=i[1]+d.eventNamespace,o=i[2];o?l.on(r,o,n):a.on(r,n)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(t).off(t),this.bindings=S(this.bindings.not(e).get()),this.focusable=S(this.focusable.not(e).get()),this.hoverable=S(this.hoverable.not(e).get())},_delay:function(e,t){var n=this;return setTimeout(function(){return("string"==typeof e?n[e]:e).apply(n,arguments)},t||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(S(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(S(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(S(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(S(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,t,n){var i,r,o=this.options[e];if(n=n||{},(t=S.Event(t)).type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),t.target=this.element[0],r=t.originalEvent)for(i in r)i in t||(t[i]=r[i]);return this.element.trigger(t,n),!(S.isFunction(o)&&!1===o.apply(this.element[0],[t].concat(n))||t.isDefaultPrevented())}},S.each({show:"fadeIn",hide:"fadeOut"},function(o,s){S.Widget.prototype["_"+o]=function(t,e,n){var i;"string"==typeof e&&(e={effect:e});var r=e?!0===e||"number"==typeof e?s:e.effect||s:o;"number"==typeof(e=e||{})&&(e={duration:e}),i=!S.isEmptyObject(e),e.complete=n,e.delay&&t.delay(e.delay),i&&S.effects&&S.effects.effect[r]?t[o](e):r!==o&&t[r]?t[r](e.duration,e.easing,n):t.queue(function(e){S(this)[o](),n&&n.call(t[0]),e()})}});S.widget;!function(){var r,_=Math.max,k=Math.abs,i=/left|center|right/,o=/top|center|bottom/,s=/[\+\-]\d+(\.[\d]+)?%?/,a=/^\w+/,l=/%$/,d=S.fn.position;function w(e,t,n){return[parseFloat(e[0])*(l.test(e[0])?t/100:1),parseFloat(e[1])*(l.test(e[1])?n/100:1)]}function N(e,t){return parseInt(S.css(e,t),10)||0}S.position={scrollbarWidth:function(){if(void 0!==r)return r;var e,t,n=S("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),i=n.children()[0];return S("body").append(n),e=i.offsetWidth,n.css("overflow","scroll"),e===(t=i.offsetWidth)&&(t=n[0].clientWidth),n.remove(),r=e-t},getScrollInfo:function(e){var t=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),n=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),i="scroll"===t||"auto"===t&&e.width<e.element[0].scrollWidth;return{width:"scroll"===n||"auto"===n&&e.height<e.element[0].scrollHeight?S.position.scrollbarWidth():0,height:i?S.position.scrollbarWidth():0}},getWithinInfo:function(e){var t=S(e||window),n=S.isWindow(t[0]),i=!!t[0]&&9===t[0].nodeType;return{element:t,isWindow:n,isDocument:i,offset:!n&&!i?S(e).offset():{left:0,top:0},scrollLeft:t.scrollLeft(),scrollTop:t.scrollTop(),width:t.outerWidth(),height:t.outerHeight()}}},S.fn.position=function(u){if(!u||!u.of)return d.apply(this,arguments);u=S.extend({},u);var h,f,p,g,y,e,t,n,v=S(u.of),m=S.position.getWithinInfo(u.within),b=S.position.getScrollInfo(m),x=(u.collision||"flip").split(" "),C={};return e=9===(n=(t=v)[0]).nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:S.isWindow(n)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:n.preventDefault?{width:0,height:0,offset:{top:n.pageY,left:n.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()},v[0].preventDefault&&(u.at="left top"),f=e.width,p=e.height,g=e.offset,y=S.extend({},g),S.each(["my","at"],function(){var e,t,n=(u[this]||"").split(" ");1===n.length&&(n=i.test(n[0])?n.concat(["center"]):o.test(n[0])?["center"].concat(n):["center","center"]),n[0]=i.test(n[0])?n[0]:"center",n[1]=o.test(n[1])?n[1]:"center",e=s.exec(n[0]),t=s.exec(n[1]),C[this]=[e?e[0]:0,t?t[0]:0],u[this]=[a.exec(n[0])[0],a.exec(n[1])[0]]}),1===x.length&&(x[1]=x[0]),"right"===u.at[0]?y.left+=f:"center"===u.at[0]&&(y.left+=f/2),"bottom"===u.at[1]?y.top+=p:"center"===u.at[1]&&(y.top+=p/2),h=w(C.at,f,p),y.left+=h[0],y.top+=h[1],this.each(function(){var n,e,s=S(this),a=s.outerWidth(),l=s.outerHeight(),t=N(this,"marginLeft"),i=N(this,"marginTop"),r=a+t+N(this,"marginRight")+b.width,o=l+i+N(this,"marginBottom")+b.height,d=S.extend({},y),c=w(C.my,s.outerWidth(),s.outerHeight());"right"===u.my[0]?d.left-=a:"center"===u.my[0]&&(d.left-=a/2),"bottom"===u.my[1]?d.top-=l:"center"===u.my[1]&&(d.top-=l/2),d.left+=c[0],d.top+=c[1],n={marginLeft:t,marginTop:i},S.each(["left","top"],function(e,t){S.ui.position[x[e]]&&S.ui.position[x[e]][t](d,{targetWidth:f,targetHeight:p,elemWidth:a,elemHeight:l,collisionPosition:n,collisionWidth:r,collisionHeight:o,offset:[h[0]+c[0],h[1]+c[1]],my:u.my,at:u.at,within:m,elem:s})}),u.using&&(e=function(e){var t=g.left-d.left,n=t+f-a,i=g.top-d.top,r=i+p-l,o={target:{element:v,left:g.left,top:g.top,width:f,height:p},element:{element:s,left:d.left,top:d.top,width:a,height:l},horizontal:n<0?"left":0<t?"right":"center",vertical:r<0?"top":0<i?"bottom":"middle"};f<a&&k(t+n)<f&&(o.horizontal="center"),p<l&&k(i+r)<p&&(o.vertical="middle"),_(k(t),k(n))>_(k(i),k(r))?o.important="horizontal":o.important="vertical",u.using.call(this,e,o)}),s.offset(S.extend(d,{using:e}))})},S.ui.position={fit:{left:function(e,t){var n,i=t.within,r=i.isWindow?i.scrollLeft:i.offset.left,o=i.width,s=e.left-t.collisionPosition.marginLeft,a=r-s,l=s+t.collisionWidth-o-r;t.collisionWidth>o?0<a&&l<=0?(n=e.left+a+t.collisionWidth-o-r,e.left+=a-n):e.left=0<l&&a<=0?r:l<a?r+o-t.collisionWidth:r:0<a?e.left+=a:0<l?e.left-=l:e.left=_(e.left-s,e.left)},top:function(e,t){var n,i=t.within,r=i.isWindow?i.scrollTop:i.offset.top,o=t.within.height,s=e.top-t.collisionPosition.marginTop,a=r-s,l=s+t.collisionHeight-o-r;t.collisionHeight>o?0<a&&l<=0?(n=e.top+a+t.collisionHeight-o-r,e.top+=a-n):e.top=0<l&&a<=0?r:l<a?r+o-t.collisionHeight:r:0<a?e.top+=a:0<l?e.top-=l:e.top=_(e.top-s,e.top)}},flip:{left:function(e,t){var n,i,r=t.within,o=r.offset.left+r.scrollLeft,s=r.width,a=r.isWindow?r.scrollLeft:r.offset.left,l=e.left-t.collisionPosition.marginLeft,d=l-a,c=l+t.collisionWidth-s-a,u="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,h="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];d<0?((n=e.left+u+h+f+t.collisionWidth-s-o)<0||n<k(d))&&(e.left+=u+h+f):0<c&&(0<(i=e.left-t.collisionPosition.marginLeft+u+h+f-a)||k(i)<c)&&(e.left+=u+h+f)},top:function(e,t){var n,i,r=t.within,o=r.offset.top+r.scrollTop,s=r.height,a=r.isWindow?r.scrollTop:r.offset.top,l=e.top-t.collisionPosition.marginTop,d=l-a,c=l+t.collisionHeight-s-a,u="top"===t.my[1]?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,h="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,f=-2*t.offset[1];d<0?((i=e.top+u+h+f+t.collisionHeight-s-o)<0||i<k(d))&&(e.top+=u+h+f):0<c&&(0<(n=e.top-t.collisionPosition.marginTop+u+h+f-a)||k(n)<c)&&(e.top+=u+h+f)}},flipfit:{left:function(){S.ui.position.flip.left.apply(this,arguments),S.ui.position.fit.left.apply(this,arguments)},top:function(){S.ui.position.flip.top.apply(this,arguments),S.ui.position.fit.top.apply(this,arguments)}}}}();var e;S.ui.position,S.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},S.fn.scrollParent=function(e){var t=this.css("position"),n="absolute"===t,i=e?/(auto|scroll|hidden)/:/(auto|scroll)/,r=this.parents().filter(function(){var e=S(this);return(!n||"static"!==e.css("position"))&&i.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==t&&r.length?r:S(this[0].ownerDocument||document)},S.fn.extend({uniqueId:(e=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&S(this).removeAttr("id")})}})}(jQuery),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){var t,n,i,r,o,s,a,l,d,c,u,h,f;return t=function(C){"use strict";if(!C.ui||!C.ui.fancytree){var o,e,g=null,y=new RegExp(/\.|\//),t=/[&<>"'/]/g,n=/[<>"'/]/g,c="$recursive_request",i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},r={16:!0,17:!0,18:!0},v={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:"'"},m={16:"shift",17:"ctrl",18:"alt",91:"meta",93:"meta"},s={0:"",1:"left",2:"middle",3:"right"},b="active expanded focus folder lazy radiogroup selected unselectable unselectableIgnore".split(" "),x={},u="columns types".split(" "),_="checkbox expanded extraClasses folder icon iconTooltip key lazy partsel radiogroup refKey selected statusNodeType title tooltip type unselectable unselectableIgnore unselectableStatus".split(" "),a={},k={},l={active:!0,children:!0,data:!0,focus:!0};for(o=0;o<b.length;o++)x[b[o]]=!0;for(o=0;o<_.length;o++)e=_[o],a[e]=!0,e!==e.toLowerCase()&&(k[e.toLowerCase()]=e);return w(C.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),Date.now||(Date.now=function(){return(new Date).getTime()}),F.prototype={_findDirectChild:function(e){var t,n,i=this.children;if(i)if("string"==typeof e){for(t=0,n=i.length;t<n;t++)if(i[t].key===e)return i[t]}else{if("number"==typeof e)return this.children[e];if(e.parent===this)return e}return null},_setChildren:function(e){w(e&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var t=0,n=e.length;t<n;t++)this.children.push(new F(this,e[t]));this.tree._callHook("treeStructureChanged",this.tree,"setChildren")},addChildren:function(e,t){var n,i,r,o,s=this.getFirstChild(),a=this.getLastChild(),l=[];for(C.isPlainObject(e)&&(e=[e]),this.children||(this.children=[]),n=0,i=e.length;n<i;n++)l.push(new F(this,e[n]));if(o=l[0],null==t?this.children=this.children.concat(l):(t=this._findDirectChild(t),w(0<=(r=C.inArray(t,this.children)),"insertBefore must be an existing child"),this.children.splice.apply(this.children,[r,0].concat(l))),s&&!t){for(n=0,i=l.length;n<i;n++)l[n].render();s!==this.getFirstChild()&&s.renderStatus(),a!==this.getLastChild()&&a.renderStatus()}else(!this.parent||this.parent.ul||this.tr)&&this.render();return 3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),this.triggerModifyChild("add",1===l.length?l[0]:null),o},addClass:function(e){return this.toggleClass(e,!0)},addNode:function(e,t){switch(void 0!==t&&"over"!==t||(t="child"),t){case"after":return this.getParent().addChildren(e,this.getNextSibling());case"before":return this.getParent().addChildren(e,this);case"firstChild":var n=this.children?this.children[0]:null;return this.addChildren(e,n);case"child":case"over":return this.addChildren(e)}w(!1,"Invalid mode: "+t)},addPagingNode:function(e,t){var n,i;if(t=t||"child",!1!==e)return e=C.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},e),this.partload=!0,this.addNode(e,t);for(n=this.children.length-1;0<=n;n--)"paging"===(i=this.children[n]).statusNodeType&&this.removeChild(i);this.partload=!1},appendSibling:function(e){return this.addNode(e,"after")},applyPatch:function(e){if(null===e)return this.remove(),N(this);var t,n,i={children:!0,expanded:!0,parent:!0};for(t in e)e.hasOwnProperty(t)&&(n=e[t],i[t]||C.isFunction(n)||(a[t]?this[t]=n:this.data[t]=n));return e.hasOwnProperty("children")&&(this.removeChildren(),e.children&&this._setChildren(e.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),e.hasOwnProperty("expanded")?this.setExpanded(e.expanded):N(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(e,t,n){return e.addNode(this.toDict(!0,n),t)},countChildren:function(e){var t,n,i,r=this.children;if(!r)return 0;if(i=r.length,!1!==e)for(t=0,n=i;t<n;t++)i+=r[t].countChildren();return i},debug:function(e){4<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(e){var t=e?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(t,this)},error:function(e){1<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("error",arguments))},findAll:function(t){t=C.isFunction(t)?t:O(t);var n=[];return this.visit(function(e){t(e)&&n.push(e)}),n},findFirst:function(t){t=C.isFunction(t)?t:O(t);var n=null;return this.visit(function(e){if(t(e))return n=e,!1}),n},findRelatedNode:function(e,t){return this.tree.findRelatedNode(this,e,t)},_changeSelectStatusAttrs:function(e){var t=!1,n=this.tree.options,i=g.evalOption("unselectable",this,this,n,!1),r=g.evalOption("unselectableStatus",this,this,n,void 0);switch(i&&null!=r&&(e=r),e){case!1:t=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:t=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case void 0:t=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:w(!1,"invalid state: "+e)}return t&&this.renderStatus(),t},fixSelection3AfterClick:function(e){var t=this.isSelected();this.visit(function(e){if(e._changeSelectStatusAttrs(t),e.radiogroup)return"skip"}),this.fixSelection3FromEndNodes(e)},fixSelection3FromEndNodes:function(e){var u=this.tree.options;w(3===u.selectMode,"expected selectMode 3"),function e(t){var n,i,r,o,s,a,l,d,c=t.children;if(c&&c.length){for(l=!(a=!0),n=0,i=c.length;n<i;n++)o=e(r=c[n]),g.evalOption("unselectableIgnore",r,r,u,!1)||(!1!==o&&(l=!0),!0!==o&&(a=!1));s=!!a||!!l&&void 0}else s=null==(d=g.evalOption("unselectableStatus",t,t,u,void 0))?!!t.selected:!!d;return t.partsel&&!t.selected&&t.lazy&&null==t.children&&(s=void 0),t._changeSelectStatusAttrs(s),s}(this),this.visitParents(function(e){var t,n,i,r,o,s=e.children,a=!0,l=!1;for(t=0,n=s.length;t<n;t++)i=s[t],g.evalOption("unselectableIgnore",i,i,u,!1)||(((r=null==(o=g.evalOption("unselectableStatus",i,i,u,void 0))?!!i.selected:!!o)||i.partsel)&&(l=!0),r||(a=!1));r=!!a||!!l&&void 0,e._changeSelectStatusAttrs(r)})},fromDict:function(e){for(var t in e)a[t]?this[t]=e[t]:"data"===t?C.extend(this.data,e.data):C.isFunction(e[t])||l[t]||(this.data[t]=e[t]);e.children&&(this.removeChildren(),this.addChildren(e.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 C.inArray(this,this.parent.children)},getIndexHier:function(e,n){e=e||".";var i,r=[];return C.each(this.getParentList(!1,!0),function(e,t){i=""+(t.getIndex()+1),n&&(i=("0000000"+i).substr(-n)),r.push(i)}),r.join(e)},getKeyPath:function(e){var t=this.tree.options.keyPathSeparator;return t+this.getPath(!e,"key",t)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e},getNextSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=0,t=n.length-1;e<t;e++)if(n[e]===this)return n[e+1]}return null},getParent:function(){return this.parent},getParentList:function(e,t){for(var n=[],i=t?this:this.parent;i;)(e||i.parent)&&n.unshift(i),i=i.parent;return n},getPath:function(e,t,n){e=!1!==e,t=t||"title",n=n||"/";var i,r=[],o=C.isFunction(t);return this.visitParents(function(e){e.parent&&(i=o?t(e):e[t],r.unshift(i))},e),r.join(n)},getPrevSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=1,t=n.length;e<t;e++)if(n[e]===this)return n[e-1]}return null},getSelectedNodes:function(t){var n=[];return this.visit(function(e){if(e.selected&&(n.push(e),!0===t))return"skip"}),n},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(e){3<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("info",arguments))},isActive:function(){return this.tree.activeNode===this},isBelowOf:function(e){return this.getIndexHier(".",5)>e.getIndexHier(".",5)},isChildOf:function(e){return this.parent&&this.parent===e},isDescendantOf:function(e){if(!e||e.tree!==this.tree)return!1;for(var t=this.parent;t;){if(t===e)return!0;t===t.parent&&C.error("Recursive parent link: "+t),t=t.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var e=this.parent;return!e||e.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var e=this.parent;return!e||e.children[e.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 e,t,n=this.tree.enableFilter,i=this.getParentList(!1,!1);if(n&&!this.match&&!this.subMatchCount)return this.debug("isVisible: HIDDEN ("+n+", "+this.match+", "+this.match+")"),!1;for(e=0,t=i.length;e<t;e++)if(!i[e].expanded)return this.debug("isVisible: HIDDEN (parent collapsed)"),!1;return this.debug("isVisible: VISIBLE"),!0},lazyLoad:function(e){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(e)},load:function(e){var t,n,i=this,r=this.isExpanded();return w(this.isLazy(),"load() requires a lazy node"),e||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),!1===(n=this.tree._triggerNodeEvent("lazyLoad",this))?N(this):(w("boolean"!=typeof n,"lazyLoad event must return source in data.result"),t=this.tree._callHook("nodeLoadChildren",this,n),r?(this.expanded=!0,t.always(function(){i.render()})):t.always(function(){i.renderStatus()}),t)):N(this)},makeVisible:function(e){var t,n=this,i=[],r=new C.Deferred,o=this.getParentList(!1,!1),s=o.length,a=!(e&&!0===e.noAnimation),l=!(e&&!1===e.scrollIntoView);for(t=s-1;0<=t;t--)i.push(o[t].setExpanded(!0,e));return C.when.apply(C,i).done(function(){l?n.scrollIntoView(a).done(function(){r.resolve()}):r.resolve()}),r.promise()},moveTo:function(t,e,n){void 0===e||"over"===e?e="child":"firstChild"===e&&(t.children&&t.children.length?(e="before",t=t.children[0]):e="child");var i,r=this.tree,o=this.parent,s="child"===e?t:t.parent;if(this!==t){if(this.parent?s.isDescendantOf(this)&&C.error("Cannot move a node to its own descendant"):C.error("Cannot move system root"),s!==o&&o.triggerModifyChild("remove",this),1===this.parent.children.length){if(this.parent===s)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else w(0<=(i=C.inArray(this,this.parent.children)),"invalid source parent"),this.parent.children.splice(i,1);if((this.parent=s).hasChildren())switch(e){case"child":s.children.push(this);break;case"before":w(0<=(i=C.inArray(t,s.children)),"invalid target parent"),s.children.splice(i,0,this);break;case"after":w(0<=(i=C.inArray(t,s.children)),"invalid target parent"),s.children.splice(i+1,0,this);break;default:C.error("Invalid mode "+e)}else s.children=[this];n&&t.visit(n,!0),s===o?s.triggerModifyChild("move",this):s.triggerModifyChild("add",this),r!==t.tree&&(this.warn("Cross-tree moveTo is experimental!"),this.visit(function(e){e.tree=t.tree},!0)),r._callHook("treeStructureChanged",r,"moveTo"),o.isDescendantOf(s)||o.render(),s.isDescendantOf(o)||s===o||s.render()}},navigate:function(e,t){var n,i=C.ui.keyCode;switch(e){case"left":case i.LEFT:if(this.expanded)return this.setExpanded(!1);break;case"right":case i.RIGHT:if(!this.expanded&&(this.children||this.lazy))return this.setExpanded()}if(n=this.findRelatedNode(e)){try{n.makeVisible({scrollIntoView:!1})}catch(e){}return!1===t?n.setFocus():n.setActive()}return this.warn("Could not find related node '"+e+"'."),N()},remove:function(){return this.parent.removeChild(this)},removeChild:function(e){return this.tree._callHook("nodeRemoveChild",this,e)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},removeClass:function(e){return this.toggleClass(e,!1)},render:function(e,t){return this.tree._callHook("nodeRender",this,e,t)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},replaceWith:function(e){var t,n=this.parent,i=C.inArray(this,n.children),r=this;return w(this.isPagingNode(),"replaceWith() currently requires a paging status node"),(t=this.tree._callHook("nodeLoadChildren",this,e)).done(function(e){var t=r.children;for(o=0;o<t.length;o++)t[o].parent=n;n.children.splice.apply(n.children,[i+1,0].concat(t)),r.children=null,r.remove(),n.render()}).fail(function(){r.setExpanded()}),t},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=void 0,this.renderStatus()},scheduleAction:function(e,t){this.tree.timer&&(clearTimeout(this.tree.timer),this.tree.debug("clearTimeout(%o)",this.tree.timer)),this.tree.timer=null;var n=this;switch(e){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){n.tree.debug("setTimeout: trigger expand"),n.setExpanded(!0)},t);break;case"activate":this.tree.timer=setTimeout(function(){n.tree.debug("setTimeout: trigger activate"),n.setActive(!0)},t);break;default:C.error("Invalid mode "+e)}},scrollIntoView:function(e,t){if(void 0!==t&&((n=t).tree&&void 0!==n.statusNodeType))throw Error("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead.");var n,i=C.extend({effects:!0===e?{duration:200,queue:!1}:e,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent,topNode:null},t),r=i.scrollParent,o=this.tree.$container,s=o.css("overflow-y");r?r.jquery||(r=C(r)):r=this.tree.tbody?o.scrollParent():"scroll"===s||"auto"===s?o:o.scrollParent(),r[0]!==document&&r[0]!==document.body||(this.debug("scrollIntoView(): normalizing scrollParent to 'window':",r[0]),r=C(window));var a,l,d,c=new C.Deferred,u=this,h=C(this.span).height(),f=i.scrollOfs.top||0,p=i.scrollOfs.bottom||0,g=r.height(),y=r.scrollTop(),v=r,m=r[0]===window,b=i.topNode||null,x=null;return this.isVisible()?(m?(l=C(this.span).offset().top,a=b&&b.span?C(b.span).offset().top:0,v=C("html,body")):(w(r[0]!==document&&r[0]!==document.body,"scrollParent should be a simple element or `window`, not document or body."),d=r.offset().top,l=C(this.span).offset().top-d+y,a=b?C(b.span).offset().top-d+y:0,g-=Math.max(0,r.innerHeight()-r[0].clientHeight)),l<y+f?x=l-f:y+g-p<l+h&&(x=l+h-g+p,b&&(w(b.isRootNode()||b.isVisible(),"topNode must be visible"),a<x&&(x=a-f))),null===x?c.resolveWith(this):i.effects?(i.effects.complete=function(){c.resolveWith(u)},v.stop(!0).animate({scrollTop:x},i.effects)):(v[0].scrollTop=x,c.resolveWith(this)),c.promise()):(this.warn("scrollIntoView(): node is invisible."),N())},setActive:function(e,t){return this.tree._callHook("nodeSetActive",this,e,t)},setExpanded:function(e,t){return this.tree._callHook("nodeSetExpanded",this,e,t)},setFocus:function(e){return this.tree._callHook("nodeSetFocus",this,e)},setSelected:function(e,t){return this.tree._callHook("nodeSetSelected",this,e,t)},setStatus:function(e,t,n){return this.tree._callHook("nodeSetStatus",this,e,t,n)},setTitle:function(e){this.title=e,this.renderTitle(),this.triggerModify("rename")},sortChildren:function(e,t){var n,i,r=this.children;if(r){if(e=e||function(e,t){var n=e.title.toLowerCase(),i=t.title.toLowerCase();return n===i?0:i<n?1:-1},r.sort(e),t)for(n=0,i=r.length;n<i;n++)r[n].children&&r[n].sortChildren(e,"$norender$");"$norender$"!==t&&this.render(),this.triggerModifyChild("sort")}},toDict:function(e,t){var n,i,r,o={},s=this;if(C.each(_,function(e,t){(s[t]||!1===s[t])&&(o[t]=s[t])}),C.isEmptyObject(this.data)||(o.data=C.extend({},this.data),C.isEmptyObject(o.data)&&delete o.data),t&&t(o,s),e&&this.hasChildren())for(o.children=[],n=0,i=this.children.length;n<i;n++)(r=this.children[n]).isStatusNode()||o.children.push(r.toDict(!0,t));return o},toggleClass:function(e,t){var n,i,r=e.match(/\S+/g)||[],o=0,s=!1,a=this[this.tree.statusClassPropName],l=" "+(this.extraClasses||"")+" ";for(a&&C(a).toggleClass(e,t);n=r[o++];)if(i=0<=l.indexOf(" "+n+" "),t=void 0===t?!i:!!t)i||(l+=n+" ",s=!0);else for(;-1<l.indexOf(" "+n+" ");)l=l.replace(" "+n+" "," ");return this.extraClasses=C.trim(l),s},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"FancytreeNode@"+this.key+"[title='"+this.title+"']"},triggerModifyChild:function(e,t,n){var i,r=this.tree.options.modifyChild;r&&(t&&t.parent!==this&&C.error("childNode "+t+" is not a child of "+this),i={node:this,tree:this.tree,operation:e,childNode:t||null},n&&C.extend(i,n),r({type:"modifyChild"},i))},triggerModify:function(e,t){this.parent.triggerModifyChild(e,this,t)},visit:function(e,t){var n,i,r=!0,o=this.children;if(!0===t&&(!1===(r=e(this))||"skip"===r))return r;if(o)for(n=0,i=o.length;n<i&&!1!==(r=o[n].visit(e,!0));n++);return r},visitAndLoad:function(n,e,t){var i,r,o,s=this;return!n||!0!==e||!1!==(r=n(s))&&"skip"!==r?s.children||s.lazy?(i=new C.Deferred,o=[],s.load().done(function(){for(var e=0,t=s.children.length;e<t;e++){if(!1===(r=s.children[e].visitAndLoad(n,!0,!0))){i.reject();break}"skip"!==r&&o.push(r)}C.when.apply(this,o).then(function(){i.resolve()})}),i.promise()):N():t?r:N()},visitParents:function(e,t){if(t&&!1===e(this))return!1;for(var n=this.parent;n;){if(!1===e(n))return!1;n=n.parent}return!0},visitSiblings:function(e,t){var n,i,r,o=this.parent.children;for(n=0,i=o.length;n<i;n++)if(r=o[n],(t||r!==this)&&!1===e(r))return!1;return!0},warn:function(e){2<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("warn",arguments))}},D.prototype={_makeHookContext:function(e,t,n){var i,r;return void 0!==e.node?(t&&e.originalEvent!==t&&C.error("invalid args"),i=e):e.tree?i={node:e,tree:r=e.tree,widget:r.widget,options:r.widget.options,originalEvent:t,typeInfo:r.types[e.type]||{}}:e.widget?i={node:null,tree:e,widget:e.widget,options:e.widget.options,originalEvent:t}:C.error("invalid args"),n&&C.extend(i,n),i},_callHook:function(e,t,n){var i=this._makeHookContext(t),r=this[e],o=Array.prototype.slice.call(arguments,2);return C.isFunction(r)||C.error("_callHook('"+e+"') is not a function"),o.unshift(i),r.apply(this,o)},_setExpiringValue:function(e,t,n){this._tempCache[e]={value:t,expire:Date.now()+(+n||50)}},_getExpiringValue:function(e){var t=this._tempCache[e];return t&&t.expire>Date.now()?t.value:(delete this._tempCache[e],null)},_requireExtension:function(e,t,n,i){null!=n&&(n=!!n);var r=this._local.name,o=this.options.extensions,s=C.inArray(e,o)<C.inArray(r,o),a=t&&null==this.ext[e],l=!a&&null!=n&&n!==s;return w(r&&r!==e,"invalid or same name '"+r+"' (require yourself?)"),!a&&!l||(i||(a||t?(i="'"+r+"' extension requires '"+e+"'",l&&(i+=" to be registered "+(n?"before":"after")+" itself")):i="If used together, `"+e+"` must be registered "+(n?"before":"after")+" `"+r+"`"),C.error(i),!1)},activateKey:function(e,t){var n=this.getNodeByKey(e);return n?n.setActive(!0,t):this.activeNode&&this.activeNode.setActive(!1,t),n},addPagingNode:function(e,t){return this.rootNode.addPagingNode(e,t)},applyPatch:function(e){var t,n,i,r,o,s,a=e.length,l=[];for(n=0;n<a;n++)w(2===(i=e[n]).length,"patchList must be an array of length-2-arrays"),r=i[0],o=i[1],(s=null===r?this.rootNode:this.getNodeByKey(r))?(t=new C.Deferred,l.push(t),s.applyPatch(o).always(E(t,s))):this.warn("could not find node with key '"+r+"'");return C.when.apply(C,l).promise()},clear:function(e){this._callHook("treeClear",this)},count:function(){return this.rootNode.countChildren()},debug:function(e){4<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("log",arguments))},enable:function(e){!1===e?this.widget.disable():this.widget.enable()},enableUpdate:function(e){return e=!1!==e,!!this._enableUpdate==!!e?e:((this._enableUpdate=e)?(this.debug("enableUpdate(true): redraw "),this._callHook("treeStructureChanged",this,"enableUpdate"),this.render()):this.debug("enableUpdate(false)..."),!e)},error:function(e){1<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("error",arguments))},expandAll:function(t,n){var e=this.enableUpdate(!1);t=!1!==t,this.visit(function(e){!1!==e.hasChildren()&&e.isExpanded()!==t&&e.setExpanded(t,n)}),this.enableUpdate(e)},findAll:function(e){return this.rootNode.findAll(e)},findFirst:function(e){return this.rootNode.findFirst(e)},findNextNode:function(t,n){var i,r=null,e=this.getFirstChild();function o(e){if(t(e)&&(r=e),r||e===n)return!1}return t="string"==typeof t?(i=new RegExp("^"+t,"i"),function(e){return i.test(e.title)}):t,n=n||e,this.visitRows(o,{start:n,includeSelf:!1}),r||n===e||this.visitRows(o,{start:e,includeSelf:!0}),r},findRelatedNode:function(e,t,n){var i=null,r=C.ui.keyCode;switch(t){case"parent":case r.BACKSPACE:e.parent&&e.parent.parent&&(i=e.parent);break;case"first":case r.HOME:this.visit(function(e){if(e.isVisible())return i=e,!1});break;case"last":case r.END:this.visit(function(e){e.isVisible()&&(i=e)});break;case"left":case r.LEFT:e.expanded?e.setExpanded(!1):e.parent&&e.parent.parent&&(i=e.parent);break;case"right":case r.RIGHT:e.expanded||!e.children&&!e.lazy?e.children&&e.children.length&&(i=e.children[0]):(e.setExpanded(),i=e);break;case"up":case r.UP:this.visitRows(function(e){return i=e,!1},{start:e,reverse:!0,includeSelf:!1});break;case"down":case r.DOWN:this.visitRows(function(e){return i=e,!1},{start:e,includeSelf:!1});break;default:this.tree.warn("Unknown relation '"+t+"'.")}return i},generateFormElements:function(e,t,n){n=n||{};var i,r="string"==typeof e?e:"ft_"+this._id+"[]",o="string"==typeof t?t:"ft_"+this._id+"_active",s="fancytree_result_"+this._id,a=C("#"+s),l=3===this.options.selectMode&&!1!==n.stopOnParents;function d(e){a.append(C("<input>",{type:"checkbox",name:r,value:e.key,checked:!0}))}a.length?a.empty():a=C("<div>",{id:s}).hide().insertAfter(this.$container),!1!==t&&this.activeNode&&a.append(C("<input>",{type:"radio",name:o,value:this.activeNode.key,checked:!0})),n.filter?this.visit(function(e){var t=n.filter(e);if("skip"===t)return t;!1!==t&&d(e)}):!1!==e&&(i=this.getSelectedNodes(l),C.each(i,function(e,t){d(t)}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getOption:function(e){return this.widget.option(e)},getNodeByKey:function(t,e){var n,i;return!e&&(n=document.getElementById(this.options.idPrefix+t))?n.ftnode?n.ftnode:null:(e=e||this.rootNode,i=null,e.visit(function(e){if(e.key===t)return i=e,!1},!0),i)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(e){return this.rootNode.getSelectedNodes(e)},hasFocus:function(){return!!this._hasFocus},info:function(e){3<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("info",arguments))},loadKeyPath:function(e,t){var i,n,r,o=this,s=new C.Deferred,a=this.getRootNode(),l=this.options.keyPathSeparator,d=[],c=C.extend({},t);for("function"==typeof t?i=t:t&&t.callback&&(i=t.callback),c.callback=function(e,t,n){i&&i.call(e,t,n),s.notifyWith(e,[{node:t,status:n}])},null==c.matchKey&&(c.matchKey=function(e,t){return e.key===t}),C.isArray(e)||(e=[e]),n=0;n<e.length;n++)(r=e[n]).charAt(0)===l&&(r=r.substr(1)),d.push(r.split(l));return setTimeout(function(){o._loadKeyPathImpl(s,c,a,d).done(function(){s.resolve()})},0),s.promise()},_loadKeyPathImpl:function(e,o,t,n){var i,r,s,a,l,d,c,u,h,f,p=this;function g(e,t){var n,i,r=e.children;if(r)for(n=0,i=r.length;n<i;n++)if(o.matchKey(r[n],t))return r[n];return null}for(c={},r=0;r<n.length;r++)for(h=n[r],u=t;h.length;){if(s=h.shift(),!(a=g(u,s))){this.warn("loadKeyPath: key not found: "+s+" (parent: "+u+")"),o.callback(this,s,"error");break}if(0===h.length){o.callback(this,a,"ok");break}if(a.lazy&&void 0===a.hasChildren()){o.callback(this,a,"loaded"),c[s=a.key]?c[s].pathSegList.push(h):c[s]={parent:a,pathSegList:[h]};break}o.callback(this,a,"loaded"),u=a}function y(t,n,e){o.callback(p,n,"loading"),n.load().done(function(){p._loadKeyPathImpl.call(p,t,o,n,e).always(E(t,p))}).fail(function(e){p.warn("loadKeyPath: error loading lazy "+n),o.callback(p,a,"error"),t.rejectWith(p)})}for(l in i=[],c)c.hasOwnProperty(l)&&(d=c[l],f=new C.Deferred,i.push(f),y(f,d.parent,d.pathSegList));return C.when.apply(C,i).promise()},reactivate:function(e){var t,n=this.activeNode;return n?(this.activeNode=null,t=n.setActive(!0,{noFocus:!0}),e&&n.setFocus(),t):N()},reload:function(e){return this._callHook("treeClear",this),this._callHook("treeLoad",this,e)},render:function(e,t){return this.rootNode.render(e,t)},selectAll:function(t){this.visit(function(e){e.setSelected(t)})},setFocus:function(e){return this._callHook("treeSetFocus",this,e)},setOption:function(e,t){return this.widget.option(e,t)},toDict:function(e,t){var n=this.rootNode.toDict(!0,t);return e?n:n.children},toString:function(){return"Fancytree@"+this._id},_triggerNodeEvent:function(e,t,n,i){var r=this._makeHookContext(t,n,i),o=this.widget._trigger(e,n,r);return!1!==o&&void 0!==r.result?r.result:o},_triggerTreeEvent:function(e,t,n){var i=this._makeHookContext(this,t,n),r=this.widget._trigger(e,t,i);return!1!==r&&void 0!==i.result?i.result:r},visit:function(e){return this.rootNode.visit(e,!1)},visitRows:function(t,e){if(!this.rootNode.children)return!1;if(e&&e.reverse)return delete e.reverse,this._visitRowsUp(t,e);var n,i,r,o=0,s=!1===(e=e||{}).includeSelf,a=!!e.includeHidden,l=!a&&this.enableFilter,d=e.start||this.rootNode.children[0];for(i=d.parent;i;){for(n=(r=i.children).indexOf(d)+o;n<r.length;n++)if(d=r[n],!l||d.match||d.subMatchCount){if(!s&&!1===t(d))return!1;if(s=!1,d.children&&d.children.length&&(a||d.expanded)&&!1===d.visit(function(e){return!l||e.match||e.subMatchCount?!1!==t(e)&&(a||!e.children||e.expanded?void 0:"skip"):"skip"},!1))return!1}i=(d=i).parent,o=1}return!0},_visitRowsUp:function(e,t){for(var n,i,r,o=!!t.includeHidden,s=t.start||this.rootNode.children[0];;){if((n=(r=s.parent).children)[0]===s){if(!(s=r).parent)break;n=r.children}else for(i=n.indexOf(s),s=n[i-1];(o||s.expanded)&&s.children&&s.children.length;)s=(n=(r=s).children)[n.length-1];if((o||s.isVisible())&&!1===e(s))return!1}},warn:function(e){2<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("warn",arguments))}},C.extend(D.prototype,{nodeClick:function(e){var t,n,i=e.targetType,r=e.node;if("expander"===i){if(r.isLoading())return void r.debug("Got 2nd click while loading: ignored");this._callHook("nodeToggleExpanded",e)}else if("checkbox"===i)this._callHook("nodeToggleSelected",e),e.options.focusOnSelect&&this._callHook("nodeSetFocus",e,!0);else{if(t=!(n=!1),r.folder)switch(e.options.clickFolderMode){case 2:t=!(n=!0);break;case 3:n=t=!0}t&&(this.nodeSetFocus(e),this._callHook("nodeSetActive",e,!0)),n&&this._callHook("nodeToggleExpanded",e)}},nodeCollapseSiblings:function(e,t){var n,i,r,o=e.node;if(o.parent)for(i=0,r=(n=o.parent.children).length;i<r;i++)n[i]!==o&&n[i].expanded&&this._callHook("nodeSetExpanded",n[i],!1,t)},nodeDblclick:function(e){"title"===e.targetType&&4===e.options.clickFolderMode&&this._callHook("nodeToggleExpanded",e),"title"===e.targetType&&e.originalEvent.preventDefault()},nodeKeydown:function(e){var t,n,i,r=e.originalEvent,o=e.node,s=e.tree,a=e.options,l=r.which,d=r.key||String.fromCharCode(l),c=!!(r.altKey||r.ctrlKey||r.metaKey),u=!m[l]&&!v[l]&&!c,h=C(r.target),f=!0,p=!(r.ctrlKey||!a.autoActivate);if(o||(i=this.getActiveNode()||this.getFirstChild())&&(i.setFocus(),(o=e.node=this.focusNode).debug("Keydown force focus on active node")),a.quicksearch&&u&&!h.is(":input:enabled"))return 500<(n=Date.now())-s.lastQuicksearchTime&&(s.lastQuicksearchTerm=""),s.lastQuicksearchTime=n,s.lastQuicksearchTerm+=d,(t=s.findNextNode(s.lastQuicksearchTerm,s.getActiveNode()))&&t.setActive(),void r.preventDefault();switch(g.eventToString(r)){case"+":case"=":s.nodeSetExpanded(e,!0);break;case"-":s.nodeSetExpanded(e,!1);break;case"space":o.isPagingNode()?s._triggerNodeEvent("clickPaging",e,r):g.evalOption("checkbox",o,o,a,!1)?s.nodeToggleSelected(e):s.nodeSetActive(e,!0);break;case"return":s.nodeSetActive(e,!0);break;case"home":case"end":case"backspace":case"left":case"right":case"up":case"down":o.navigate(r.which,p);break;default:f=!1}f&&r.preventDefault()},nodeLoadChildren:function(o,s){var t,n,e,i,a=o.tree,l=o.node,d=Date.now();return C.isFunction(s)&&(s=s.call(a,{type:"source"},o),w(!C.isFunction(s),"source callback must not return another function")),s.url&&(l._requestId&&l.warn("Recursive load request #"+d+" while #"+l._requestId+" is pending."),t=C.extend({},o.options.ajax,s),l._requestId=d,e=t.debugDelay?(n=t.debugDelay,delete t.debugDelay,C.isArray(n)&&(n=n[0]+Math.random()*(n[1]-n[0])),l.warn("nodeLoadChildren waiting debugDelay "+Math.round(n)+" ms ..."),C.Deferred(function(e){setTimeout(function(){C.ajax(t).done(function(){e.resolveWith(this,arguments)}).fail(function(){e.rejectWith(this,arguments)})},n)})):C.ajax(t),s=new C.Deferred,e.done(function(e,t,n){var i,r;if("json"!==this.dataType&&"jsonp"!==this.dataType||"string"!=typeof e||C.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),l._requestId&&l._requestId>d)s.rejectWith(this,[c]);else{if(o.options.postProcess){try{r=a._triggerNodeEvent("postProcess",o,o.originalEvent,{response:e,error:null,dataType:this.dataType})}catch(e){r={error:e,message:""+e,details:"postProcess failed"}}if(r.error)return i=C.isPlainObject(r.error)?r.error:{message:r.error},i=a._makeHookContext(l,null,i),void s.rejectWith(this,[i]);(C.isArray(r)||C.isPlainObject(r)&&C.isArray(r.children))&&(e=r)}else e&&e.hasOwnProperty("d")&&o.options.enableAspx&&(e="string"==typeof e.d?C.parseJSON(e.d):e.d);s.resolveWith(this,[e])}}).fail(function(e,t,n){var i=a._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:n,details:e.status+": "+n});s.rejectWith(this,[i])})),C.isFunction(s.then)&&C.isFunction(s.catch)&&(e=s,s=new C.Deferred,e.then(function(e){s.resolve(e)},function(e){s.reject(e)})),C.isFunction(s.promise)?(a.nodeSetStatus(o,"loading"),s.done(function(e){a.nodeSetStatus(o,"ok"),l._requestId=null}).fail(function(e){var t;e!==c?(e.node&&e.error&&e.message?t=e:"[object Object]"===(t=a._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:e?e.message||e.toString():""})).message&&(t.message=""),l.warn("Load children failed ("+t.message+")",t),!1!==a._triggerNodeEvent("loadError",t,null)&&a.nodeSetStatus(o,"error",t.message,t.details)):l.warn("Ignored response for obsolete load request #"+d+" (expected #"+l._requestId+")")})):o.options.postProcess&&(i=a._triggerNodeEvent("postProcess",o,o.originalEvent,{response:s,error:null,dataType:typeof s}),(C.isArray(i)||C.isPlainObject(i)&&C.isArray(i.children))&&(s=i)),C.when(s).done(function(e){var n,t;C.isPlainObject(e)&&(w(l.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),w(C.isArray(e.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),e=(n=e).children,delete n.children,C.each(u,function(e,t){void 0!==n[t]&&(a[t]=n[t],delete n[t])}),C.extend(a.data,n)),w(C.isArray(e),"expected array of children"),l._setChildren(e),a.options.nodata&&0===e.length&&(C.isFunction(a.options.nodata)?t=a.options.nodata.call(a,{type:"nodata"},o):!0===a.options.nodata&&l.isRootNode()?t=a.options.strings.nodata:"string"==typeof a.options.nodata&&l.isRootNode()&&(t=a.options.nodata),t&&l.setStatus("nodata",t)),a._triggerNodeEvent("loadChildren",l)})},nodeLoadKeyPath:function(e,t){},nodeRemoveChild:function(e,t){var n,i=e.node,r=C.extend({},e,{node:t}),o=i.children;if(1===o.length)return w(t===o[0],"invalid single child"),this.nodeRemoveChildren(e);this.activeNode&&(t===this.activeNode||this.activeNode.isDescendantOf(t))&&this.activeNode.setActive(!1),this.focusNode&&(t===this.focusNode||this.focusNode.isDescendantOf(t))&&(this.focusNode=null),this.nodeRemoveMarkup(r),this.nodeRemoveChildren(r),w(0<=(n=C.inArray(t,o)),"invalid child"),i.triggerModifyChild("remove",t),t.visit(function(e){e.parent=null},!0),this._callHook("treeRegisterNode",this,!1,t),o.splice(n,1)},nodeRemoveChildMarkup:function(e){var t=e.node;t.ul&&(t.isRootNode()?C(t.ul).empty():(C(t.ul).remove(),t.ul=null),t.visit(function(e){e.li=e.ul=null}))},nodeRemoveChildren:function(e){var t=e.tree,n=e.node;n.children&&(this.activeNode&&this.activeNode.isDescendantOf(n)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(n)&&(this.focusNode=null),this.nodeRemoveChildMarkup(e),n.triggerModifyChild("remove",null),n.visit(function(e){e.parent=null,t._callHook("treeRegisterNode",t,!1,e)}),n.lazy?n.children=[]:n.children=null,n.isRootNode()||(n.expanded=!1),this.nodeRenderStatus(e))},nodeRemoveMarkup:function(e){var t=e.node;t.li&&(C(t.li).remove(),t.li=null),this.nodeRemoveChildMarkup(e)},nodeRender:function(e,t,n,i,r){var o,s,a,l,d,c,u,h=e.node,f=e.tree,p=e.options,g=p.aria,y=!1,v=h.parent,m=!v,b=h.children,x=null;if(!1!==f._enableUpdate&&(m||v.ul)){if(w(m||v.ul,"parent UL must exist"),m||(h.li&&(t||h.li.parentNode!==h.parent.ul)&&(h.li.parentNode===h.parent.ul?x=h.li.nextSibling:this.debug("Unlinking "+h+" (must be child of "+h.parent+")"),this.nodeRemoveMarkup(e)),h.li?this.nodeRenderStatus(e):(y=!0,h.li=document.createElement("li"),(h.li.ftnode=h).key&&p.generateIds&&(h.li.id=p.idPrefix+h.key),h.span=document.createElement("span"),h.span.className="fancytree-node",g&&!h.tr&&C(h.li).attr("role","treeitem"),h.li.appendChild(h.span),this.nodeRenderTitle(e),p.createNode&&p.createNode.call(f,{type:"createNode"},e)),p.renderNode&&p.renderNode.call(f,{type:"renderNode"},e)),b){if(m||h.expanded||!0===n){for(h.ul||(h.ul=document.createElement("ul"),(!0!==i||r)&&h.expanded||(h.ul.style.display="none"),g&&C(h.ul).attr("role","group"),h.li?h.li.appendChild(h.ul):h.tree.$div.append(h.ul)),l=0,d=b.length;l<d;l++)u=C.extend({},e,{node:b[l]}),this.nodeRender(u,t,n,!1,!0);for(o=h.ul.firstChild;o;)o=(a=o.ftnode)&&a.parent!==h?(h.debug("_fixParent: remove missing "+a,o),c=o.nextSibling,o.parentNode.removeChild(o),c):o.nextSibling;for(o=h.ul.firstChild,l=0,d=b.length-1;l<d;l++)(s=b[l])===(a=o.ftnode)?o=o.nextSibling:h.ul.insertBefore(s.li,a.li)}}else h.ul&&(this.warn("remove child markup for "+h),this.nodeRemoveChildMarkup(e));m||y&&v.ul.insertBefore(h.li,x)}},nodeRenderTitle:function(e,t){var n,i,r,o,s,a,l,d=e.node,c=e.tree,u=e.options,h=u.aria,f=d.getLevel(),p=[];void 0!==t&&(d.title=t),d.span&&!1!==c._enableUpdate&&(s=h&&!1!==d.hasChildren()?" role='button'":"",f<u.minExpandLevel?(d.lazy||(d.expanded=!0),1<f&&p.push("<span "+s+" class='fancytree-expander fancytree-expander-fixed'></span>")):p.push("<span "+s+" class='fancytree-expander'></span>"),(n=g.evalOption("checkbox",d,d,u,!1))&&!d.isStatusNode()&&(s=h?" role='checkbox'":"",i="fancytree-checkbox",("radio"===n||d.parent&&d.parent.radiogroup)&&(i+=" fancytree-radio"),p.push("<span "+s+" class='"+i+"'></span>")),void 0!==d.data.iconClass&&(d.icon?C.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(d.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),d.icon=d.data.iconClass)),!1!==(r=g.evalOption("icon",d,d,u,!0))&&(s=h?" role='presentation'":"",l=(l=g.evalOption("iconTooltip",d,d,u,null))?" title='"+T(l)+"'":"","string"==typeof r?y.test(r)?(r="/"===r.charAt(0)?r:(u.imagePath||"")+r,p.push("<img src='"+r+"' class='fancytree-icon'"+l+" alt='' />")):p.push("<span "+s+" class='fancytree-custom-icon "+r+"'"+l+"></span>"):r.text?p.push("<span "+s+" class='fancytree-custom-icon "+(r.addClass||"")+"'"+l+">"+g.escapeHtml(r.text)+"</span>"):r.html?p.push("<span "+s+" class='fancytree-custom-icon "+(r.addClass||"")+"'"+l+">"+r.html+"</span>"):p.push("<span "+s+" class='fancytree-icon'"+l+"></span>")),o="",u.renderTitle&&(o=u.renderTitle.call(c,{type:"renderTitle"},e)||""),o||(!0===(a=g.evalOption("tooltip",d,d,u,null))&&(a=d.title),o="<span class='fancytree-title'"+(a=a?" title='"+T(a)+"'":"")+(u.titlesTabbable?" tabindex='0'":"")+">"+(u.escapeTitles?g.escapeHtml(d.title):d.title)+"</span>"),p.push(o),d.span.innerHTML=p.join(""),this.nodeRenderStatus(e),u.enhanceTitle&&(e.$title=C(">span.fancytree-title",d.span),o=u.enhanceTitle.call(c,{type:"enhanceTitle"},e)||""))},nodeRenderStatus:function(e){var t,n=e.node,i=e.tree,r=e.options,o=n.hasChildren(),s=n.isLastSibling(),a=r.aria,l=r._classNames,d=[],c=n[i.statusClassPropName];c&&!1!==i._enableUpdate&&(a&&(t=C(n.tr||n.li)),d.push(l.node),i.activeNode===n&&d.push(l.active),i.focusNode===n&&d.push(l.focused),n.expanded&&d.push(l.expanded),a&&(!1===o?t.removeAttr("aria-expanded"):t.attr("aria-expanded",Boolean(n.expanded))),n.folder&&d.push(l.folder),!1!==o&&d.push(l.hasChildren),s&&d.push(l.lastsib),n.lazy&&null==n.children&&d.push(l.lazy),n.partload&&d.push(l.partload),n.partsel&&d.push(l.partsel),g.evalOption("unselectable",n,n,r,!1)&&d.push(l.unselectable),n._isLoading&&d.push(l.loading),n._error&&d.push(l.error),n.statusNodeType&&d.push(l.statusNodePrefix+n.statusNodeType),n.selected?(d.push(l.selected),a&&t.attr("aria-selected",!0)):a&&t.attr("aria-selected",!1),n.extraClasses&&d.push(n.extraClasses),!1===o?d.push(l.combinedExpanderPrefix+"n"+(s?"l":"")):d.push(l.combinedExpanderPrefix+(n.expanded?"e":"c")+(n.lazy&&null==n.children?"d":"")+(s?"l":"")),d.push(l.combinedIconPrefix+(n.expanded?"e":"c")+(n.folder?"f":"")),c.className=d.join(" "),n.li&&C(n.li).toggleClass(l.lastsib,s))},nodeSetActive:function(e,t,n){n=n||{};var i,r=e.node,o=e.tree,s=e.options,a=!0===n.noEvents,l=!0===n.noFocus,d=!1!==n.scrollIntoView;return r===o.activeNode===(t=!1!==t)?N(r):t&&!a&&!1===this._triggerNodeEvent("beforeActivate",r,e.originalEvent)?S(r,["rejected"]):(t?(o.activeNode&&(w(o.activeNode!==r,"node was active (inconsistency)"),i=C.extend({},e,{node:o.activeNode}),o.nodeSetActive(i,!1),w(null===o.activeNode,"deactivate was out of sync?")),s.activeVisible&&r.makeVisible({scrollIntoView:d}),o.activeNode=r,o.nodeRenderStatus(e),l||o.nodeSetFocus(e),a||o._triggerNodeEvent("activate",r,e.originalEvent)):(w(o.activeNode===r,"node was not active (inconsistency)"),o.activeNode=null,this.nodeRenderStatus(e),a||e.tree._triggerNodeEvent("deactivate",r,e.originalEvent)),N(r))},nodeSetExpanded:function(i,r,e){e=e||{};var t,n,o,s,a,l,d=i.node,c=i.tree,u=i.options,h=!0===e.noAnimation,f=!0===e.noEvents;if(r=!1!==r,d.expanded&&r||!d.expanded&&!r)return N(d);if(r&&!d.lazy&&!d.hasChildren())return N(d);if(!r&&d.getLevel()<u.minExpandLevel)return S(d,["locked"]);if(!f&&!1===this._triggerNodeEvent("beforeExpand",d,i.originalEvent))return S(d,["rejected"]);if(h||d.isVisible()||(h=e.noAnimation=!0),n=new C.Deferred,r&&!d.expanded&&u.autoCollapse){a=d.getParentList(!1,!0),l=u.autoCollapse;try{for(u.autoCollapse=!1,o=0,s=a.length;o<s;o++)this._callHook("nodeCollapseSiblings",a[o],e)}finally{u.autoCollapse=l}}return n.done(function(){var e=d.getLastChild();r&&u.autoScroll&&!h&&e?e.scrollIntoView(!0,{topNode:d}).always(function(){f||i.tree._triggerNodeEvent(r?"expand":"collapse",i)}):f||i.tree._triggerNodeEvent(r?"expand":"collapse",i)}),t=function(e){var t=u._classNames,n=u.toggleEffect;if(d.expanded=r,c._callHook("treeStructureChanged",i,r?"expand":"collapse"),c._callHook("nodeRender",i,!1,!1,!0),d.ul)if("none"!==d.ul.style.display===!!d.expanded)d.warn("nodeSetExpanded: UL.style.display already set");else{if(n&&!h)return C(d.li).addClass(t.animating),void(C.isFunction(C(d.ul)[n.effect])?(c.debug("use jquery."+n.effect+" method"),C(d.ul)[n.effect]({duration:n.duration,always:function(){C(this).removeClass(t.animating),C(d.li).removeClass(t.animating),e()}})):(C(d.ul).stop(!0,!0),C(d.ul).parent().find(".ui-effects-placeholder").remove(),C(d.ul).toggle(n.effect,n.options,n.duration,function(){C(this).removeClass(t.animating),C(d.li).removeClass(t.animating),e()})));d.ul.style.display=d.expanded||!parent?"":"none"}e()},r&&d.lazy&&void 0===d.hasChildren()?d.load().done(function(){n.notifyWith&&n.notifyWith(d,["loaded"]),t(function(){n.resolveWith(d)})}).fail(function(e){t(function(){n.rejectWith(d,["load failed ("+e+")"])})}):t(function(){n.resolveWith(d)}),n.promise()},nodeSetFocus:function(e,t){var n,i=e.tree,r=e.node,o=i.options,s=!!e.originalEvent&&C(e.originalEvent.target).is(":input");if(t=!1!==t,i.focusNode){if(i.focusNode===r&&t)return;n=C.extend({},e,{node:i.focusNode}),i.focusNode=null,this._triggerNodeEvent("blur",n),this._callHook("nodeRenderStatus",n)}t&&(this.hasFocus()||(r.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",e,!0,{calledByNode:!0})),r.makeVisible({scrollIntoView:!1}),i.focusNode=r,o.titlesTabbable&&(s||C(r.span).find(".fancytree-title").focus()),o.aria&&C(i.$container).attr("aria-activedescendant",C(r.tr||r.li).uniqueId().attr("id")),this._triggerNodeEvent("focus",e),document.activeElement===i.$container.get(0)||1<=C(document.activeElement,i.$container).length||C(i.$container).focus(),o.autoScroll&&r.scrollIntoView(),this._callHook("nodeRenderStatus",e))},nodeSetSelected:function(e,t,n){n=n||{};var i=e.node,r=e.tree,o=e.options,s=!0===n.noEvents,a=i.parent;if(t=!1!==t,!g.evalOption("unselectable",i,i,o,!1)){if(i._lastSelectIntent=t,!!i.selected===t&&(3!==o.selectMode||!i.partsel||t))return t;if(!s&&!1===this._triggerNodeEvent("beforeSelect",i,e.originalEvent))return!!i.selected;t&&1===o.selectMode?(r.lastSelectedNode&&r.lastSelectedNode.setSelected(!1),i.selected=t):3!==o.selectMode||!a||a.radiogroup||i.radiogroup?a&&a.radiogroup?i.visitSiblings(function(e){e._changeSelectStatusAttrs(t&&e===i)},!0):i.selected=t:(i.selected=t,i.fixSelection3AfterClick(n)),this.nodeRenderStatus(e),r.lastSelectedNode=t?i:null,s||r._triggerNodeEvent("select",e)}},nodeSetStatus:function(i,e,t,n){var r=i.node,o=i.tree;function s(e,t){var n=r.children?r.children[0]:null;return n&&n.isStatusNode()?(C.extend(n,e),n.statusNodeType=t,o._callHook("nodeRenderTitle",n)):(r._setChildren([e]),o._callHook("treeStructureChanged",i,"setStatusNode"),r.children[0].statusNodeType=t,o.render()),r.children[0]}switch(e){case"ok":!function(){var e=r.children?r.children[0]:null;if(e&&e.isStatusNode()){try{r.ul&&(r.ul.removeChild(e.li),e.li=null)}catch(e){}1===r.children.length?r.children=[]:r.children.shift(),o._callHook("treeStructureChanged",i,"clearStatusNode")}}(),r._isLoading=!1,r._error=null,r.renderStatus();break;case"loading":r.parent||s({title:o.options.strings.loading+(t?" ("+t+")":""),checkbox:!1,tooltip:n},e),r._isLoading=!0,r._error=null,r.renderStatus();break;case"error":s({title:o.options.strings.loadError+(t?" ("+t+")":""),checkbox:!1,tooltip:n},e),r._isLoading=!1,r._error={message:t,details:n},r.renderStatus();break;case"nodata":s({title:t||o.options.strings.noData,checkbox:!1,tooltip:n},e),r._isLoading=!1,r._error=null,r.renderStatus();break;default:C.error("invalid node status "+e)}},nodeToggleExpanded:function(e){return this.nodeSetExpanded(e,!e.node.expanded)},nodeToggleSelected:function(e){var t=e.node,n=!t.selected;return t.partsel&&!t.selected&&!0===t._lastSelectIntent&&(n=!1,t.selected=!0),t._lastSelectIntent=n,this.nodeSetSelected(e,n)},treeClear:function(e){var t=e.tree;t.activeNode=null,t.focusNode=null,t.$div.find(">ul.fancytree-container").empty(),t.rootNode.children=null,t._callHook("treeStructureChanged",e,"clear")},treeCreate:function(e){},treeDestroy:function(e){this.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("fancytree-helper-hidden")},treeInit:function(e){var n=e.tree,i=n.options;n.$container.attr("tabindex",i.tabindex),C.each(u,function(e,t){void 0!==i[t]&&(n.info("Move option "+t+" to tree"),n[t]=i[t],delete i[t])}),i.checkboxAutoHide&&n.$container.addClass("fancytree-checkbox-auto-hide"),i.rtl?n.$container.attr("DIR","RTL").addClass("fancytree-rtl"):n.$container.removeAttr("DIR").removeClass("fancytree-rtl"),i.aria&&(n.$container.attr("role","tree"),1!==i.selectMode&&n.$container.attr("aria-multiselectable",!0)),this.treeLoad(e)},treeLoad:function(e,t){var n,i,r,o=e.tree,s=e.widget.element,a=C.extend({},e,{node:this.rootNode});if(o.rootNode.children&&this.treeClear(e),t=t||this.options.source)"string"==typeof t&&C.error("Not implemented");else switch(i=s.data("type")||"html"){case"html":(r=s.find(">ul").first()).addClass("ui-fancytree-source fancytree-helper-hidden"),t=C.ui.fancytree.parseHtml(r),this.data=C.extend(this.data,A(r));break;case"json":t=C.parseJSON(s.text()),s.contents().filter(function(){return 3===this.nodeType}).remove(),C.isPlainObject(t)&&(w(C.isArray(t.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),t=(n=t).children,delete n.children,C.each(u,function(e,t){void 0!==n[t]&&(o[t]=n[t],delete n[t])}),C.extend(o.data,n));break;default:C.error("Invalid data-type: "+i)}return this.nodeLoadChildren(a,t).done(function(){o._callHook("treeStructureChanged",e,"loadChildren"),o.render(),3===e.options.selectMode&&o.rootNode.fixSelection3FromEndNodes(),o.activeNode&&o.options.activeVisible&&o.activeNode.makeVisible(),o._triggerTreeEvent("init",null,{status:!0})}).fail(function(){o.render(),o._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(e,t,n){e.tree._callHook("treeStructureChanged",e,t?"addNode":"removeNode")},treeSetFocus:function(e,t,n){var i;(t=!1!==t)!==this.hasFocus()&&(!(this._hasFocus=t)&&this.focusNode?this.focusNode.setFocus(!1):!t||n&&n.calledByNode||C(this.$container).focus(),this.$container.toggleClass("fancytree-treefocus",t),this._triggerTreeEvent(t?"focusTree":"blurTree"),t&&!this.activeNode&&(i=this._lastMousedownNode||this.getFirstChild())&&i.setFocus())},treeSetOption:function(e,t,n){var i=e.tree,r=!0,o=!1,s=!1;switch(t){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":s=o=!0;break;case"checkboxAutoHide":i.$container.toggleClass("fancytree-checkbox-auto-hide",!!n);break;case"escapeTitles":case"tooltip":s=!0;break;case"rtl":!1===n?i.$container.removeAttr("DIR").removeClass("fancytree-rtl"):i.$container.attr("DIR","RTL").addClass("fancytree-rtl"),s=!0;break;case"source":r=!1,i._callHook("treeLoad",i,n),s=!0}i.debug("set option "+t+"="+n+" <"+typeof n+">"),r&&(this.widget._super?this.widget._super.call(this.widget,t,n):C.Widget.prototype._setOption.call(this.widget,t,n)),o&&i._callHook("treeCreate",i),s&&i.render(!0,!1)},treeStructureChanged:function(e,t){}}),C.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:"slideToggle",duration:200},generateIds:!1,icon:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,nodata:!0,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,treeId:null,_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 D(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul").first();var e,t,n,i=this.options,r=i.extensions;this.tree;for(n=0;n<r.length;n++)t=r[n],(e=C.ui.fancytree._extensions[t])||C.error("Could not apply extension '"+t+"' (it is not registered, did you forget to include it?)"),this.tree.options[t]=h({},e.options,this.tree.options[t]),w(void 0===this.tree.ext[t],"Extension name must not exist as Fancytree.ext attribute: '"+t+"'"),this.tree.ext[t]={},p(this.tree,0,e,t),e;void 0!==i.icons&&(!0===i.icon?(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),i.icon=i.icons):C.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead")),void 0!==i.iconClass&&(i.icon?C.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"),i.icon=i.iconClass)),void 0!==i.tabbable&&(i.tabindex=i.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+i.tabindex+"' instead")),this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(e,t){return this.tree._callHook("treeSetOption",this.tree,e,t)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),C.Widget.prototype.destroy.call(this)},_unbind:function(){var e=this.tree._ns;this.element.off(e),this.tree.$container.off(e),C(document).off(e)},_bind:function(){var s=this,a=this.options,o=this.tree,e=o._ns;this._unbind(),o.$container.on("focusin"+e+" focusout"+e,function(e){var t=g.getNode(e),n="focusin"===e.type;if(!n&&t&&C(e.target).is("a"))t.debug("Ignored focusout on embedded <a> element.");else{if(n){if(o._getExpiringValue("focusin"))return void o.debug("Ignored double focusin.");o._setExpiringValue("focusin",!0,50),t||(t=o._getExpiringValue("mouseDownNode"))&&o.debug("Reconstruct mouse target for focusin from recent event.")}t?o._callHook("nodeSetFocus",o._makeHookContext(t,e),n):o.tbody&&C(e.target).parents("table.fancytree-container > thead").length?o.debug("Ignore focus event outside table body.",e):o._callHook("treeSetFocus",o,n)}}).on("selectstart"+e,"span.fancytree-title",function(e){e.preventDefault()}).on("keydown"+e,function(e){if(a.disabled||!1===a.keyboard)return!0;var t,n=o.focusNode,i=o._makeHookContext(n||o,e),r=o.phase;try{return o.phase="userEvent","preventNav"===(t=n?o._triggerNodeEvent("keydown",n,e):o._triggerTreeEvent("keydown",e))?t=!0:!1!==t&&(t=o._callHook("nodeKeydown",i)),t}finally{o.phase=r}}).on("mousedown"+e,function(e){var t=g.getEventTarget(e);o._lastMousedownNode=t?t.node:null,o._setExpiringValue("mouseDownNode",o._lastMousedownNode)}).on("click"+e+" dblclick"+e,function(e){if(a.disabled)return!0;var t,n=g.getEventTarget(e),i=n.node,r=s.tree,o=r.phase;if(!i)return!0;t=r._makeHookContext(i,e);try{switch(r.phase="userEvent",e.type){case"click":return t.targetType=n.type,i.isPagingNode()?!0===r._triggerNodeEvent("clickPaging",t,e):!1!==r._triggerNodeEvent("click",t,e)&&r._callHook("nodeClick",t);case"dblclick":return t.targetType=n.type,!1!==r._triggerNodeEvent("dblclick",t,e)&&r._callHook("nodeDblclick",t)}}finally{r.phase=o}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(e){return this.tree.getNodeByKey(e)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),g=C.ui.fancytree,C.extend(C.ui.fancytree,{version:"2.31.0",buildType: "production",debugLevel: 3,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:D,_FancytreeNodeClass:F,jquerySupports:{positionMyOfs:function(e,t,n,i){var r,o,s,a=C.map(C.trim(e).split("."),function(e){return parseInt(e,10)}),l=C.map(Array.prototype.slice.call(arguments,1),function(e){return parseInt(e,10)});for(r=0;r<l.length;r++)if((o=a[r]||0)!==(s=l[r]||0))return s<o;return!0}(C.ui.version,1,9)},assert:function(e,t){return w(e,t)},createTree:function(e,t){return C(e).fancytree(t).fancytree("getTree")},debounce:function(t,n,i,r){var o;return 3===arguments.length&&"boolean"!=typeof i&&(r=i,i=!1),function(){var e=arguments;r=r||this,i&&!o&&n.apply(r,e),clearTimeout(o),o=setTimeout(function(){i||n.apply(r,e),o=null},t)}},debug:function(e){4<=C.ui.fancytree.debugLevel&&d("log",arguments)},error:function(e){1<=C.ui.fancytree.debugLevel&&d("error",arguments)},escapeHtml:function(e){return(""+e).replace(t,function(e){return i[e]})},fixPositionOptions:function(e){if((e.offset||0<=(""+e.my+e.at).indexOf("%"))&&C.error("expected new position syntax (but '%' is not supported)"),!C.ui.fancytree.jquerySupports.positionMyOfs){var t=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(e.my),n=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(e.at),i=(t[2]?+t[2]:0)+(n[2]?+n[2]:0),r=(t[4]?+t[4]:0)+(n[4]?+n[4]:0);e=C.extend({},e,{my:t[1]+" "+t[3],at:n[1]+" "+n[3]}),(i||r)&&(e.offset=i+" "+r)}return e},getEventTarget:function(e){var t,n=e&&e.target?e.target.className:"",i={node:this.getNode(e.target),type:void 0};return/\bfancytree-title\b/.test(n)?i.type="title":/\bfancytree-expander\b/.test(n)?i.type=!1===i.node.hasChildren()?"prefix":"expander":/\bfancytree-checkbox\b/.test(n)?i.type="checkbox":/\bfancytree(-custom)?-icon\b/.test(n)?i.type="icon":/\bfancytree-node\b/.test(n)?i.type="title":e&&e.target&&((t=C(e.target)).is("ul[role=group]")?((i.node&&i.node.tree||g).debug("Ignoring click on outer UL."),i.node=null):t.closest(".fancytree-title").length?i.type="title":t.closest(".fancytree-checkbox").length?i.type="checkbox":t.closest(".fancytree-expander").length&&(i.type="expander")),i},getEventTargetType:function(e){return this.getEventTarget(e).type},getNode:function(e){if(e instanceof F)return e;for(e instanceof C?e=e[0]:void 0!==e.originalEvent&&(e=e.target);e;){if(e.ftnode)return e.ftnode;e=e.parentNode}return null},getTree:function(e){var t,n=e;return e instanceof D?e:(void 0===e&&(e=0),"number"==typeof e?e=C(".fancytree-container").eq(e):"string"==typeof e?(e=C("#ft-id-"+n).eq(0)).length||(e=C(n).eq(0)):e instanceof C?e=e.eq(0):void 0!==e.originalEvent&&(e=C(e.target)),(t=(e=e.closest(":ui-fancytree")).data("ui-fancytree")||e.data("fancytree"))?t.tree:null)},evalOption:function(e,t,n,i,r){var o,s,a=t.tree,l=i[e],d=n[e];return C.isFunction(l)?(o={node:t,tree:a,widget:a.widget,options:a.widget.options,typeInfo:a.types[t.type]||{}},null==(s=l.call(a,{type:e},o))&&(s=d)):s=null==d?l:d,null==s&&(s=r),s},setSpanIcon:function(e,t,n){var i=C(e);"string"==typeof n?i.attr("class",t+" "+n):(n.text?i.text(""+n.text):n.html&&(e.innerHTML=n.html),i.attr("class",t+" "+(n.addClass||"")))},eventToString:function(e){var t=e.which,n=e.type,i=[];return e.altKey&&i.push("alt"),e.ctrlKey&&i.push("ctrl"),e.metaKey&&i.push("meta"),e.shiftKey&&i.push("shift"),"click"===n||"dblclick"===n?i.push(s[e.button]+n):"wheel"===n?i.push(n):r[t]||i.push(v[t]||String.fromCharCode(t).toLowerCase()),i.join("+")},info:function(e){3<=C.ui.fancytree.debugLevel&&d("info",arguments)},keyEventToString:function(e){return this.warn("keyEventToString() is deprecated: use eventToString()"),this.eventToString(e)},overrideMethod:function(e,t,n,i){var r,o=e[t]||C.noop;e[t]=function(){var e=i||this;try{return r=e._super,e._super=o,n.apply(e,arguments)}finally{e._super=r}}},parseHtml:function(s){var a,l,d,c,u,h,f,p,e=s.find(">li"),g=[];return e.each(function(){var e,t,n=C(this),i=n.find(">span",this).first(),r=i.length?null:n.find(">a").first(),o={tooltip:null,data:{}};for(i.length?o.title=i.html():r&&r.length?(o.title=r.html(),o.data.href=r.attr("href"),o.data.target=r.attr("target"),o.tooltip=r.attr("title")):(o.title=n.html(),0<=(u=o.title.search(/<ul/i))&&(o.title=o.title.substring(0,u))),o.title=C.trim(o.title),c=0,h=b.length;c<h;c++)o[b[c]]=void 0;for(a=this.className.split(" "),d=[],c=0,h=a.length;c<h;c++)l=a[c],x[l]?o[l]=!0:d.push(l);if(o.extraClasses=d.join(" "),(f=n.attr("title"))&&(o.tooltip=f),(f=n.attr("id"))&&(o.key=f),n.attr("hideCheckbox")&&(o.checkbox=!1),(e=A(n))&&!C.isEmptyObject(e)){for(t in k)e.hasOwnProperty(t)&&(e[k[t]]=e[t],delete e[t]);for(c=0,h=_.length;c<h;c++)f=_[c],null!=(p=e[f])&&(delete e[f],o[f]=p);C.extend(o.data,e)}(s=n.find(">ul").first()).length?o.children=C.ui.fancytree.parseHtml(s):o.children=o.lazy?void 0:null,g.push(o)}),g},registerExtension:function(e){w(null!=e.name,"extensions must have a `name` property."),w(null!=e.version,"extensions must have a `version` property."),C.ui.fancytree._extensions[e.name]=e},unescapeHtml:function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue},warn:function(e){2<=C.ui.fancytree.debugLevel&&d("warn",arguments)}}),C.ui.fancytree}function w(e,t){e||(t=t?": "+t:"",C.error("Fancytree assertion failed"+t))}function d(e,t){var n,i,r=window.console?window.console[e]:null;if(r)try{r.apply(window.console,t)}catch(e){for(i="",n=0;n<t.length;n++)i+=t[n];r(i)}}function h(){var e,t,n,i,r,o=arguments[0]||{},s=1,a=arguments.length;if("object"==typeof o||C.isFunction(o)||(o={}),s===a)throw Error("need at least two args");for(;s<a;s++)if(null!=(e=arguments[s]))for(t in e)if(e.hasOwnProperty(t)){if(n=o[t],o===(i=e[t]))continue;i&&C.isPlainObject(i)?(r=n&&C.isPlainObject(n)?n:{},o[t]=h(r,i)):void 0!==i&&(o[t]=i)}return o}function f(e,i,t,n,r){var o,s,a,l,d;return o=i[e],s=n[e],a=i.ext[r],l=function(){return o.apply(i,arguments)},d=function(e){return o.apply(i,e)},function(){var e=i._local,t=i._super,n=i._superApply;try{return i._local=a,i._super=l,i._superApply=d,s.apply(i,arguments)}finally{i._local=e,i._super=t,i._superApply=n}}}function p(e,t,n,i){for(var r in n)"function"==typeof n[r]?"function"==typeof e[r]?e[r]=f(r,e,0,n,i):"_"===r.charAt(0)?e.ext[i][r]=f(r,e,0,n,i):C.error("Could not override tree."+r+". Use prefix '_' to create tree."+i+"._"+r):"options"!==r&&(e.ext[i][r]=n[r])}function N(e,t){return void 0===e?C.Deferred(function(){this.resolve()}).promise():C.Deferred(function(){this.resolveWith(e,t)}).promise()}function S(e,t){return void 0===e?C.Deferred(function(){this.reject()}).promise():C.Deferred(function(){this.rejectWith(e,t)}).promise()}function E(e,t){return function(){e.resolveWith(t)}}function A(e){var t=C.extend({},e.data()),n=t.json;return delete t.fancytree,delete t.uiFancytree,n&&(delete t.json,t=C.extend(t,n)),t}function T(e){return(""+e).replace(n,function(e){return i[e]})}function O(t){return t=t.toLowerCase(),function(e){return 0<=e.title.toLowerCase().indexOf(t)}}function F(e,t){var n,i,r,o;for(this.parent=e,this.tree=e.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},n=0,i=_.length;n<i;n++)this[r=_[n]]=t[r];for(r in null==this.unselectableIgnore&&null==this.unselectableStatus||(this.unselectable=!0),t.hideCheckbox&&C.error("'hideCheckbox' node option was removed in v2.23.0: use 'checkbox: false'"),t.data&&C.extend(this.data,t.data),t)a[r]||C.isFunction(t[r])||l[r]||(this.data[r]=t[r]);null==this.key?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),w(this.key,"defaultKey() must return a unique key")):this.key="_"+g._nextNodeKey++:this.key=""+this.key,t.active&&(w(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),t.selected&&(this.tree.lastSelectedNode=this),(o=t.children)?o.length?this._setChildren(o):this.children=this.lazy?[]:null:this.children=null,this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function D(e){this.widget=e,this.$div=e.element,this.options=e.options,this.options&&(void 0!==this.options.lazyload&&C.error("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),void 0!==this.options.loaderror&&C.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),void 0!==this.options.fx&&C.error("The 'fx' option was replaced by 'toggleEffect' since 2014-11-30."),void 0!==this.options.removeNode&&C.error("The 'removeNode' event was replaced by 'modifyChild' since 2.20 (2016-09-10).")),this.ext={},this.types={},this.columns={},this.data=A(this.$div),this._id=""+(this.options.treeId||C.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.viewport=null,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var t,n={tree:this};this.rootNode=new F(n,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,t=C("<ul>",{id:"ft-id-"+this._id,class:"ui-fancytree fancytree-container fancytree-plain"}).appendTo(this.$div),this.$container=t,this.rootNode.ul=t[0],null==this.options.debugLevel&&(this.options.debugLevel=g.debugLevel)}C.ui.fancytree.warn("Fancytree: ignored duplicate include")},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree.ui-deps"],t):"object"==typeof module&&module.exports?(require("./jquery.fancytree.ui-deps"),module.exports=t(require("jquery"))):t(jQuery),n=function(o){"use strict";return o.ui.fancytree._FancytreeClass.prototype.countSelected=function(e){this.options;return this.getSelectedNodes(e).length},o.ui.fancytree._FancytreeNodeClass.prototype.updateCounters=function(){var e=this,t=o("span.fancytree-childcounter",e.span),n=e.tree.options.childcounter,i=e.countChildren(n.deep);!(e.data.childCounter=i)&&n.hideZeros||e.isExpanded()&&n.hideExpanded?t.remove():(t.length||(t=o("<span class='fancytree-childcounter'/>").appendTo(o("span.fancytree-icon,span.fancytree-custom-icon",e.span))),t.text(i)),!n.deep||e.isTopLevel()||e.isRoot()||e.parent.updateCounters()},o.ui.fancytree.prototype.widgetMethod1=function(e){this.tree;return e},o.ui.fancytree.registerExtension({name:"childcounter",version:"2.31.0",options:{deep:!0,hideZeros:!0,hideExpanded:!1},foo:42,_appendCounter:function(e){},treeInit:function(e){e.options,e.options.childcounter;this._superApply(arguments),this.$container.addClass("fancytree-ext-childcounter")},treeDestroy:function(e){this._superApply(arguments)},nodeRenderTitle:function(e,t){var n=e.node,i=e.options.childcounter,r=null==n.data.childCounter?n.countChildren(i.deep):+n.data.childCounter;this._super(e,t),!r&&i.hideZeros||n.isExpanded()&&i.hideExpanded||o("span.fancytree-icon,span.fancytree-custom-icon",n.span).append(o("<span class='fancytree-childcounter'/>").text(r))},nodeSetExpanded:function(e,t,n){var i=e.tree;e.node;return this._superApply(arguments).always(function(){i.nodeRenderTitle(e)})}}),o.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],n):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=n(require("jquery"))):n(jQuery),i=function(h){"use strict";function f(e,t){e||(t=t?": "+t:"",h.error("Assertion failed"+t))}function r(e,t,n){for(var i,r,o=3&e.length,s=e.length-o,a=n,l=3432918353,d=461845907,c=0;c<s;)r=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,a=27492+(65535&(i=5*(65535&(a=(a^=r=(65535&(r=(r=(65535&r)*l+(((r>>>16)*l&65535)<<16)&4294967295)<<15|r>>>17))*d+(((r>>>16)*d&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(i>>>16)&65535)<<16);switch(r=0,o){case 3:r^=(255&e.charCodeAt(c+2))<<16;case 2:r^=(255&e.charCodeAt(c+1))<<8;case 1:a^=r=(65535&(r=(r=(65535&(r^=255&e.charCodeAt(c)))*l+(((r>>>16)*l&65535)<<16)&4294967295)<<15|r>>>17))*d+(((r>>>16)*d&65535)<<16)&4294967295}return a^=e.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,a^=a>>>16,t?("0000000"+(a>>>0).toString(16)).substr(-8):a>>>0}return h.ui.fancytree._FancytreeNodeClass.prototype.getCloneList=function(e){var t,n=this.tree,i=n.refMap[this.refKey]||null,r=n.keyMap;return i&&(t=this.key,e?i=h.map(i,function(e){return r[e]}):(i=h.map(i,function(e){return e===t?null:r[e]})).length<1&&(i=null)),i},h.ui.fancytree._FancytreeNodeClass.prototype.isClone=function(){var e=this.refKey||null,t=e&&this.tree.refMap[e]||null;return!!(t&&1<t.length)},h.ui.fancytree._FancytreeNodeClass.prototype.reRegister=function(t,e){t=null==t?null:""+t,e=null==e?null:""+e;var n=this.tree,i=this.key,r=this.refKey,o=n.keyMap,s=n.refMap,a=s[r]||null,l=!1;return null!=t&&t!==this.key&&(o[t]&&h.error("[ext-clones] reRegister("+t+"): already exists: "+this),delete o[i],o[t]=this,a&&(s[r]=h.map(a,function(e){return e===i?t:e})),this.key=t,l=!0),null!=e&&e!==this.refKey&&(a&&(1===a.length?delete s[r]:s[r]=h.map(a,function(e){return e===i?null:e})),s[e]?s[e].append(t):s[e]=[this.key],this.refKey=e,l=!0),l},h.ui.fancytree._FancytreeNodeClass.prototype.setRefKey=function(e){return this.reRegister(null,e)},h.ui.fancytree._FancytreeClass.prototype.getNodesByRef=function(e,n){var i=this.keyMap,t=this.refMap[e]||null;return t&&(t=n?h.map(t,function(e){var t=i[e];return t.isDescendantOf(n)?t:null}):h.map(t,function(e){return i[e]})).length<1&&(t=null),t},h.ui.fancytree._FancytreeClass.prototype.changeRefKey=function(e,t){var n,i=this.keyMap,r=this.refMap[e]||null;if(r){for(n=0;n<r.length;n++)i[r[n]].refKey=t;delete this.refMap[e],this.refMap[t]=r}},h.ui.fancytree.registerExtension({name:"clones",version:"2.31.0",options:{highlightActiveClones:!0,highlightClones:!1},treeCreate:function(e){this._superApply(arguments),e.tree.refMap={},e.tree.keyMap={}},treeInit:function(e){this.$container.addClass("fancytree-ext-clones"),f(null==e.options.defaultKey),e.options.defaultKey=function(e){return t=e,i=h.map(t.getParentList(!1,!0),function(e){return e.refKey||e.key}),"id_"+(n=r(i=i.join("/"),!0))+r(n+i,!0);var t,n,i},this._superApply(arguments)},treeClear:function(e){return e.tree.refMap={},e.tree.keyMap={},this._superApply(arguments)},treeRegisterNode:function(e,t,n){var i,r,o=e.tree,s=o.keyMap,a=o.refMap,l=n.key,d=n&&null!=n.refKey?""+n.refKey:null;if(n.isStatusNode())return this._super(e,t,n);if(t){if(null!=s[n.key]){var c=s[n.key],u="clones.treeRegisterNode: duplicate key '"+n.key+"': /"+n.getPath(!0)+" => "+c.getPath(!0);o.error(u),h.error(u)}s[l]=n,d&&((i=a[d])?(i.push(l),2===i.length&&e.options.clones.highlightClones&&s[i[0]].renderStatus()):a[d]=[l])}else null==s[l]&&h.error("clones.treeRegisterNode: node.key not registered: "+n.key),delete s[l],d&&(i=a[d])&&((r=i.length)<=1?(f(1===r),f(i[0]===l),delete a[d]):(!function(e,t){var n;for(n=e.length-1;0<=n;n--)if(e[n]===t)return e.splice(n,1)}(i,l),2===r&&e.options.clones.highlightClones&&s[i[0]].renderStatus()));return this._super(e,t,n)},nodeRenderStatus:function(e){var t,n,i=e.node;return n=this._super(e),e.options.clones.highlightClones&&(t=h(i[e.tree.statusClassPropName])).length&&i.isClone()&&t.addClass("fancytree-clone"),n},nodeSetActive:function(e,n,t){var i,r=e.tree.statusClassPropName,o=e.node;return i=this._superApply(arguments),e.options.clones.highlightActiveClones&&o.isClone()&&h.each(o.getCloneList(!0),function(e,t){h(t[r]).toggleClass("fancytree-active-clone",!1!==n)}),i}}),h.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],i):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=i(require("jquery"))):i(jQuery),r=function(w){"use strict";var l,d,N=w.ui.fancytree,c=/Mac/.test(navigator.platform),u="fancytree-drag-source",h="fancytree-drag-remove",S="fancytree-drop-accept",E="fancytree-drop-after",A="fancytree-drop-before",T="fancytree-drop-over",O="fancytree-drop-reject",F="fancytree-drop-target",y="application/x-fancytree-node",D=null,v=null,m=null,f=null,P=null,p=null,g=null,b=null,j=null,x=null;function C(){m=v=p=b=g=x=P=null,f&&f.removeClass(u+" "+h),f=null,D&&D.hide(),d&&(d.remove(),d=null)}function L(e){return 0===e?"":0<e?"+"+e:""+e}function I(e,t){var n,i,r,o,s=t.tree,a=t.dataTransfer;"dragstart"===e.type?(t.effectAllowed=s.options.dnd5.effectAllowed,t.dropEffect=s.options.dnd5.dropEffectDefault):(t.effectAllowed=b,t.dropEffect=g),t.dropEffectSuggested=(i=e,r=(n=s).options.dnd5.dropEffectDefault,o=r,c?i.metaKey&&i.altKey?o="link":i.ctrlKey?o="link":i.metaKey?o="move":i.altKey&&(o="copy"):i.ctrlKey?o="copy":i.shiftKey?o="move":i.altKey&&(o="link"),o!==p&&n.info("evalEffectModifiers: "+i.type+" - evalEffectModifiers(): "+p+" -> "+o),p=o),t.isMove="move"===t.dropEffect,t.files=a.files||[]}function R(e,t,n){var i=t.tree,r=t.dataTransfer;return"dragstart"!==e.type&&b!==t.effectAllowed&&i.warn("effectAllowed should only be changed in dragstart event: "+e.type+": data.effectAllowed changed from "+b+" -> "+t.effectAllowed),!1===n&&(i.info("applyDropEffectCallback: allowDrop === false"),t.effectAllowed="none",t.dropEffect="none"),t.isMove="move"===t.dropEffect,b=t.effectAllowed,g=t.dropEffect,r.effectAllowed=b,r.dropEffect=g}function _(e,t){var n,i,r,o,s,a,l,d,c;if(t.options.dnd5.scroll&&(n=t.tree,i=e,s=n.options.dnd5,a=n.$scrollParent[0],l=s.scrollSensitivity,d=s.scrollSpeed,c=0,a!==document&&"HTML"!==a.tagName?(r=n.$scrollParent.offset(),o=a.scrollTop,r.top+a.offsetHeight-i.pageY<l?0<a.scrollHeight-n.$scrollParent.innerHeight()-o&&(a.scrollTop=c=o+d):0<o&&i.pageY-r.top<l&&(a.scrollTop=c=o-d)):0<(o=w(document).scrollTop())&&i.pageY-o<l?(c=o-d,w(document).scrollTop(c)):w(window).height()-(i.pageY-o)<l&&(c=o+d,w(document).scrollTop(c)),c&&n.debug("autoScroll: "+c+"px")),!t.node)return t.tree.warn("Ignored dragover for non-node"),j;var u,h,f,p,g=null,y=t.tree,v=y.options,m=v.dnd5,b=t.node,x=t.otherNode,C="center",_=w(b.span),k=_.find("span.fancytree-title");if(!1===P)return y.debug("Ignored dragover, since dragenter returned false."),!1;("string"==typeof P&&w.error("assert failed: dragenter returned string"),h=_.offset(),p=(e.pageY-h.top)/_.height(),P.after&&.75<p?g="after":!P.over&&P.after&&.5<p?g="after":P.before&&p<=.25?g="before":!P.over&&P.before&&p<=.5?g="before":P.over&&(g="over"),m.preventVoidMoves&&"move"===t.dropEffect&&(b===x?(b.debug("Drop over source node prevented."),g=null):"before"===g&&x&&b===x.getNextSibling()?(b.debug("Drop after source node prevented."),g=null):"after"===g&&x&&b===x.getPrevSibling()?(b.debug("Drop before source node prevented."),g=null):"over"===g&&x&&x.parent===b&&x.isLastSibling()&&(b.debug("Drop last child over own parent prevented."),g=null)),(t.hitMode=g)&&m.dragOver)&&(I(e,t),m.dragOver(b,t),R(e,t,!!g),g=t.hitMode);if("after"===(j=g)||"before"===g||"over"===g){switch(u=m.dropMarkerOffsetX||0,g){case"before":C="top",u+=m.dropMarkerInsertOffsetX||0;break;case"after":C="bottom",u+=m.dropMarkerInsertOffsetX||0}f={my:"left"+L(u)+" center",at:"left "+C,of:k},v.rtl&&(f.my="right"+L(-u)+" center",f.at="right "+C),D.toggleClass(E,"after"===g).toggleClass(T,"over"===g).toggleClass(A,"before"===g).show().position(N.fixPositionOptions(f))}else D.hide();return w(b.span).toggleClass(F,"after"===g||"before"===g||"over"===g).toggleClass(E,"after"===g).toggleClass(A,"before"===g).toggleClass(S,"over"===g).toggleClass(O,!1===g),g}function s(e){var t,n,i,r,o,s,a,l=this,d=l.options.dnd5,c=null,u=N.getNode(e),h=e.dataTransfer||e.originalEvent.dataTransfer,f={tree:l,node:u,options:l.options,originalEvent:e.originalEvent,widget:l.widget,hitMode:P,dataTransfer:h,otherNode:v||null,otherNodeList:m||null,otherNodeData:null,useDefaultImage:!0,dropEffect:void 0,dropEffectSuggested:void 0,effectAllowed:void 0,files:null,isCancelled:void 0,isMove:void 0};switch(e.type){case"dragenter":if(x=null,!u){l.debug("Ignore non-node "+e.type+": "+e.target.tagName+"."+e.target.className),P=!1;break}if(w(u.span).addClass(T).removeClass(S+" "+O),i=0<=w.inArray(y,h.types),d.preventNonNodes&&!i){u.debug("Reject dropping a non-node."),P=!1;break}if(d.preventForeignNodes&&(!v||v.tree!==u.tree)){u.debug("Reject dropping a foreign node."),P=!1;break}if(d.preventSameParent&&f.otherNode&&f.otherNode.tree===u.tree&&u.parent===f.otherNode.parent){u.debug("Reject dropping as sibling (same parent)."),P=!1;break}if(d.preventRecursion&&f.otherNode&&f.otherNode.tree===u.tree&&u.isDescendantOf(f.otherNode)){u.debug("Reject dropping below own ancestor."),P=!1;break}D.show(),I(e,f),r=d.dragEnter(u,f),o=!!(s=r)&&(a=w.isPlainObject(s)?{over:!!s.over,before:!!s.before,after:!!s.after}:w.isArray(s)?{over:0<=w.inArray("over",s),before:0<=w.inArray("before",s),after:0<=w.inArray("after",s)}:{over:!0===s||"over"===s,before:!0===s||"before"===s,after:!0===s||"after"===s},0!==Object.keys(a).length&&a),R(e,f,c=(P=o)&&(o.over||o.before||o.after));break;case"dragover":if(!u){l.debug("Ignore non-node "+e.type+": "+e.target.tagName+"."+e.target.className);break}c=!!(j=_(e,f)),"over"!==j||u.expanded||!1===u.hasChildren()?x=null:x?d.autoExpandMS&&Date.now()-x>d.autoExpandMS&&(!d.dragExpand||!1!==d.dragExpand(u,f))&&u.setExpanded():x=Date.now();break;case"dragleave":if(!u){l.debug("Ignore non-node "+e.type+": "+e.target.tagName+"."+e.target.className);break}if(!w(u.span).hasClass(T)){u.debug("Ignore dragleave (multi).");break}w(u.span).removeClass(T+" "+S+" "+O),u.scheduleAction("cancel"),d.dragLeave(u,f),D.hide();break;case"drop":if(0<=w.inArray(y,h.types)&&(n=h.getData(y),l.info(e.type+": getData('application/x-fancytree-node'): '"+n+"'")),n||(n=h.getData("text"),l.info(e.type+": getData('text'): '"+n+"'")),n)try{void 0!==(t=JSON.parse(n)).title&&(f.otherNodeData=t)}catch(e){}l.debug(e.type+": nodeData: '"+n+"', otherNodeData: ",f.otherNodeData),w(u.span).removeClass(T+" "+S+" "+O),f.hitMode=j,I(e,f),f.isCancelled=!j;var p=v&&v.span,g=v&&v.tree;d.dragDrop(u,f),e.preventDefault(),p&&!document.body.contains(p)&&(g===l?(l.debug("Drop handler removed source element: generating dragEnd."),d.dragEnd(v,f)):l.warn("Drop handler removed source element: dragend event may be lost.")),C()}if(c)return e.preventDefault(),!1}return w.ui.fancytree.getDragNodeList=function(){return m||[]},w.ui.fancytree.getDragNode=function(){return v},w.ui.fancytree.registerExtension({name:"dnd5",version:"2.31.0",options:{autoExpandMS:1500,dropMarkerInsertOffsetX:-16,dropMarkerOffsetX:-24,multiSource:!1,effectAllowed:"all",dropEffectDefault:"move",preventForeignNodes:!1,preventNonNodes:!1,preventRecursion:!0,preventSameParent:!1,preventVoidMoves:!0,scroll:!0,scrollSensitivity:20,scrollSpeed:5,setTextTypeJson:!1,dragStart:null,dragDrag:w.noop,dragEnd:w.noop,dragEnter:null,dragOver:w.noop,dragExpand:w.noop,dragDrop:w.noop,dragLeave:w.noop},treeInit:function(e){var t,n=e.tree,i=e.options,r=i.glyph||null,o=i.dnd5;0<=w.inArray("dnd",i.extensions)&&w.error("Extensions 'dnd' and 'dnd5' are mutually exclusive."),o.dragStop&&w.error("dragStop is not used by ext-dnd5. Use dragEnd instead."),null!=o.preventRecursiveMoves&&w.error("preventRecursiveMoves was renamed to preventRecursion."),o.dragStart&&N.overrideMethod(e.options,"createNode",function(e,t){this._super.apply(this,arguments),t.node.span?t.node.span.draggable=!0:t.node.warn("Cannot add `draggable`: no span tag")}),this._superApply(arguments),this.$container.addClass("fancytree-ext-dnd5"),t=w("<span>").appendTo(this.$container),this.$scrollParent=t.scrollParent(),t.remove(),(D=w("#fancytree-drop-marker")).length||(D=w("<div id='fancytree-drop-marker'></div>").hide().css({"z-index":1e3,"pointer-events":"none"}).prependTo("body"),r&&N.setSpanIcon(D[0],r.map._addClass,r.map.dropMarker)),D.toggleClass("fancytree-rtl",!!i.rtl),o.dragStart&&n.$container.on("dragstart drag dragend",function(e){var t,n=this,i=n.options.dnd5,r=N.getNode(e),o=e.dataTransfer||e.originalEvent.dataTransfer,s={tree:n,node:r,options:n.options,originalEvent:e.originalEvent,widget:n.widget,dataTransfer:o,useDefaultImage:!0,dropEffect:void 0,dropEffectSuggested:void 0,effectAllowed:void 0,files:void 0,isCancelled:void 0,isMove:void 0};switch(e.type){case"dragstart":if(!r)return n.info("Ignored dragstart on a non-node."),!1;v=r,!1===i.multiSource?m=[r]:!0===i.multiSource?(m=n.getSelectedNodes(),r.isSelected()||m.unshift(r)):m=i.multiSource(r,s),(f=w(w.map(m,function(e){return e.span}))).addClass(u);var a=r.toDict();a.treeId=r.tree._id,t=JSON.stringify(a);try{o.setData(y,t),o.setData("text/html",w(r.span).html()),o.setData("text/plain",r.title)}catch(e){n.warn("Could not set data (IE only accepts 'text') - "+e)}return i.setTextTypeJson?o.setData("text",t):o.setData("text",r.title),I(e,s),!1===i.dragStart(r,s)?(C(),!1):(R(e,s),d=null,s.useDefaultImage&&(l=w(r.span).find(".fancytree-title"),m&&1<m.length&&(d=w("<span class='fancytree-childcounter'/>").text("+"+(m.length-1)).appendTo(l)),o.setDragImage&&o.setDragImage(l[0],-10,-10)),!0);case"drag":I(e,s),i.dragDrag(r,s),R(e,s),f.toggleClass(h,s.isMove);break;case"dragend":I(e,s),C(),s.isCancelled=!j,i.dragEnd(r,s,!j)}}.bind(n)),o.dragEnter&&n.$container.on("dragenter dragover dragleave drop",s.bind(n))}}),w.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],r):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=r(require("jquery"))):r(jQuery),o=function(d){"use strict";var t=/Mac/.test(navigator.platform),c=d.ui.fancytree.escapeHtml,a=d.ui.fancytree.unescapeHtml;return d.ui.fancytree._FancytreeNodeClass.prototype.editStart=function(){var t,n=this,e=this.tree,i=e.ext.edit,r=e.options.edit,o=d(".fancytree-title",n.span),s={node:n,tree:e,options:e.options,isNew:d(n[e.statusClassPropName]).hasClass("fancytree-edit-new"),orgTitle:n.title,input:null,dirty:!1};if(!1===r.beforeEdit.call(n,{type:"beforeEdit"},s))return!1;d.ui.fancytree.assert(!i.currentNode,"recursive edit"),i.currentNode=this,i.eventData=s,e.widget._unbind(),i.lastDraggableAttrValue=n.span.draggable,i.lastDraggableAttrValue&&(n.span.draggable=!1),d(document).on("mousedown.fancytree-edit",function(e){d(e.target).hasClass("fancytree-edit-input")||n.editEnd(!0,e)}),t=d("<input />",{class:"fancytree-edit-input",type:"text",value:e.options.escapeTitles?s.orgTitle:a(s.orgTitle)}),i.eventData.input=t,null!=r.adjustWidthOfs&&t.width(o.width()+r.adjustWidthOfs),null!=r.inputCss&&t.css(r.inputCss),o.html(t),t.focus().change(function(e){t.addClass("fancytree-edit-dirty")}).on("keydown",function(e){switch(e.which){case d.ui.keyCode.ESCAPE:n.editEnd(!1,e);break;case d.ui.keyCode.ENTER:return n.editEnd(!0,e),!1}e.stopPropagation()}).blur(function(e){return n.editEnd(!0,e)}),r.edit.call(n,{type:"edit"},s)},d.ui.fancytree._FancytreeNodeClass.prototype.editEnd=function(e,t){var n,i=this,r=this.tree,o=r.ext.edit,s=o.eventData,a=r.options.edit,l=d(".fancytree-title",i.span).find("input.fancytree-edit-input");return a.trim&&l.val(d.trim(l.val())),n=l.val(),s.dirty=n!==i.title,s.originalEvent=t,!1===e?s.save=!1:s.isNew?s.save=""!==n:s.save=s.dirty&&""!==n,!1!==a.beforeClose.call(i,{type:"beforeClose"},s)&&((!s.save||!1!==a.save.call(i,{type:"save"},s))&&(l.removeClass("fancytree-edit-dirty").off(),d(document).off(".fancytree-edit"),s.save?(i.setTitle(r.options.escapeTitles?n:c(n)),i.setFocus()):s.isNew?(i.remove(),i=s.node=null,o.relatedNode.setFocus()):(i.renderTitle(),i.setFocus()),o.eventData=null,o.currentNode=null,o.relatedNode=null,r.widget._bind(),o.lastDraggableAttrValue&&(i.span.draggable=!0),d(r.$container).focus(),s.input=null,a.close.call(i,{type:"close"},s),!0))},d.ui.fancytree._FancytreeNodeClass.prototype.editCreateNode=function(e,t){var n,i=this.tree,r=this;e=e||"child",null==t?t={title:""}:"string"==typeof t?t={title:t}:d.ui.fancytree.assert(d.isPlainObject(t)),"child"!==e||this.isExpanded()||!1===this.hasChildren()?((n=this.addNode(t,e)).match=!0,d(n[i.statusClassPropName]).removeClass("fancytree-hide").addClass("fancytree-match"),n.makeVisible().done(function(){d(n[i.statusClassPropName]).addClass("fancytree-edit-new"),r.tree.ext.edit.relatedNode=r,n.editStart()})):this.setExpanded().done(function(){r.editCreateNode(e,t)})},d.ui.fancytree._FancytreeClass.prototype.isEditing=function(){return this.ext.edit?this.ext.edit.currentNode:null},d.ui.fancytree._FancytreeNodeClass.prototype.isEditing=function(){return!!this.tree.ext.edit&&this.tree.ext.edit.currentNode===this},d.ui.fancytree.registerExtension({name:"edit",version:"2.31.0",options:{adjustWidthOfs:4,allowEmpty:!1,inputCss:{minWidth:"3em"},triggerStart:["f2","mac+enter","shift+click"],trim:!0,beforeClose:d.noop,beforeEdit:d.noop,close:d.noop,edit:d.noop,save:d.noop},currentNode:null,treeInit:function(e){var i=e.tree;this._superApply(arguments),this.$container.addClass("fancytree-ext-edit").on("fancytreebeforeupdateviewport",function(e,t){var n=i.isEditing();n&&(n.info("Cancel edit due to scroll event."),n.editEnd(!1,e))})},nodeClick:function(e){var t=d.ui.fancytree.eventToString(e.originalEvent),n=e.options.edit.triggerStart;return"shift+click"===t&&0<=d.inArray("shift+click",n)&&e.originalEvent.shiftKey?(e.node.editStart(),!1):"click"===t&&0<=d.inArray("clickActive",n)&&e.node.isActive()&&!e.node.isEditing()&&d(e.originalEvent.target).hasClass("fancytree-title")?(e.node.editStart(),!1):this._superApply(arguments)},nodeDblclick:function(e){return 0<=d.inArray("dblclick",e.options.edit.triggerStart)?(e.node.editStart(),!1):this._superApply(arguments)},nodeKeydown:function(e){switch(e.originalEvent.which){case 113:if(0<=d.inArray("f2",e.options.edit.triggerStart))return e.node.editStart(),!1;break;case d.ui.keyCode.ENTER:if(0<=d.inArray("mac+enter",e.options.edit.triggerStart)&&t)return e.node.editStart(),!1}return this._superApply(arguments)}}),d.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],o):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=o(require("jquery"))):o(jQuery),s=function(y){"use strict";var v="__not_found__",m=y.ui.fancytree.escapeHtml;function b(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return y.ui.fancytree._FancytreeClass.prototype._applyFilterImpl=function(i,r,e){var t,n,o,s,a,l,d=0,c=this.options,u=c.escapeTitles,h=c.autoCollapse,f=y.extend({},c.filter,e),p="hide"===f.mode,g=!!f.leavesOnly&&!r;if("string"==typeof i){if(""===i)return this.warn("Fancytree passing an empty string as a filter is handled as clearFilter()."),void this.clearFilter();t=f.fuzzy?i.split("").reduce(function(e,t){return e+"[^"+t+"]*"+t}):b(i),o=new RegExp(".*"+t+".*","i"),s=new RegExp(b(i),"gi"),i=function(e){if(!e.title)return!1;var t,n=u?e.title:0<=(t=e.title).indexOf(">")?y("<div/>").html(t).text():t,i=!!o.test(n);return i&&f.highlight&&(e.titleWithHighlight=u?(a=n.replace(s,function(e){return"\ufff7"+e+"\ufff8"}),m(a).replace(/\uFFF7/g,"<mark>").replace(/\uFFF8/g,"</mark>")):n.replace(s,function(e){return"<mark>"+e+"</mark>"})),i}}return this.enableFilter=!0,this.lastFilterArgs=arguments,l=this.enableUpdate(!1),this.$div.addClass("fancytree-ext-filter"),p?this.$div.addClass("fancytree-ext-filter-hide"):this.$div.addClass("fancytree-ext-filter-dimm"),this.$div.toggleClass("fancytree-ext-filter-hide-expanders",!!f.hideExpanders),this.visit(function(e){delete e.match,delete e.titleWithHighlight,e.subMatchCount=0}),(n=this.getRootNode()._findDirectChild(v))&&n.remove(),c.autoCollapse=!1,this.visit(function(e){if(!g||null==e.children){var t=i(e),n=!1;if("skip"===t)return e.visit(function(e){e.match=!1},!0),"skip";t||!r&&"branch"!==t||!e.parent.match||(n=t=!0),t&&(d++,e.match=!0,e.visitParents(function(e){e.subMatchCount+=1,!f.autoExpand||n||e.expanded||(e.setExpanded(!0,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),e._filterAutoExpanded=!0)}))}}),c.autoCollapse=h,0===d&&f.nodata&&p&&(n=f.nodata,y.isFunction(n)&&(n=n()),!0===n?n={}:"string"==typeof n&&(n={title:n}),n=y.extend({statusNodeType:"nodata",key:v,title:this.options.strings.noData},n),this.getRootNode().addNode(n).match=!0),this._callHook("treeStructureChanged",this,"applyFilter"),this.enableUpdate(l),d},y.ui.fancytree._FancytreeClass.prototype.filterNodes=function(e,t){return"boolean"==typeof t&&(t={leavesOnly:t},this.warn("Fancytree.filterNodes() leavesOnly option is deprecated since 2.9.0 / 2015-04-19. Use opts.leavesOnly instead.")),this._applyFilterImpl(e,!1,t)},y.ui.fancytree._FancytreeClass.prototype.filterBranches=function(e,t){return this._applyFilterImpl(e,!0,t)},y.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){var t,e=this.getRootNode()._findDirectChild(v),n=this.options.escapeTitles,i=this.options.enhanceTitle,r=this.enableUpdate(!1);e&&e.remove(),this.visit(function(e){e.match&&e.span&&(t=y(e.span).find(">span.fancytree-title"),n?t.text(e.title):t.html(e.title),i&&i({type:"enhanceTitle"},{node:e,$title:t})),delete e.match,delete e.subMatchCount,delete e.titleWithHighlight,e.$subMatchBadge&&(e.$subMatchBadge.remove(),delete e.$subMatchBadge),e._filterAutoExpanded&&e.expanded&&e.setExpanded(!1,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),delete e._filterAutoExpanded}),this.enableFilter=!1,this.lastFilterArgs=null,this.$div.removeClass("fancytree-ext-filter fancytree-ext-filter-dimm fancytree-ext-filter-hide"),this._callHook("treeStructureChanged",this,"clearFilter"),this.enableUpdate(r)},y.ui.fancytree._FancytreeClass.prototype.isFilterActive=function(){return!!this.enableFilter},y.ui.fancytree._FancytreeNodeClass.prototype.isMatched=function(){return!(this.tree.enableFilter&&!this.match)},y.ui.fancytree.registerExtension({name:"filter",version:"2.31.0",options:{autoApply:!0,autoExpand:!1,counter:!0,fuzzy:!1,hideExpandedCounter:!0,hideExpanders:!1,highlight:!0,leavesOnly:!1,nodata:!0,mode:"dimm"},nodeLoadChildren:function(e,t){var n=e.tree;return this._superApply(arguments).done(function(){n.enableFilter&&n.lastFilterArgs&&e.options.filter.autoApply&&n._applyFilterImpl.apply(n,n.lastFilterArgs)})},nodeSetExpanded:function(e,t,n){var i=e.node;return delete i._filterAutoExpanded,!t&&e.options.filter.hideExpandedCounter&&i.$subMatchBadge&&i.$subMatchBadge.show(),this._superApply(arguments)},nodeRenderStatus:function(e){var t,n=e.node,i=e.tree,r=e.options.filter,o=y(n.span).find("span.fancytree-title"),s=y(n[i.statusClassPropName]),a=e.options.enhanceTitle,l=e.options.escapeTitles;return t=this._super(e),s.length&&i.enableFilter&&(s.toggleClass("fancytree-match",!!n.match).toggleClass("fancytree-submatch",!!n.subMatchCount).toggleClass("fancytree-hide",!(n.match||n.subMatchCount)),!r.counter||!n.subMatchCount||n.isExpanded()&&r.hideExpandedCounter?n.$subMatchBadge&&n.$subMatchBadge.hide():(n.$subMatchBadge||(n.$subMatchBadge=y("<span class='fancytree-childcounter'/>"),y("span.fancytree-icon, span.fancytree-custom-icon",n.span).append(n.$subMatchBadge)),n.$subMatchBadge.show().text(n.subMatchCount)),!n.span||n.isEditing&&n.isEditing.call(n)||(n.titleWithHighlight?o.html(n.titleWithHighlight):l?o.text(n.title):o.html(n.title),a&&a({type:"enhanceTitle"},{node:n,$title:o}))),t}}),y.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],s):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=s(require("jquery"))):s(jQuery),a=function(d){"use strict";var a=d.ui.fancytree,i={awesome3:{_addClass:"",checkbox:"icon-check-empty",checkboxSelected:"icon-check",checkboxUnknown:"icon-check 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:"",radio:"icon-circle-blank",radioSelected:"icon-circle",doc:"icon-file-alt",docOpen:"icon-file-alt",folder:"icon-folder-close-alt",folderOpen:"icon-folder-open-alt"},awesome4:{_addClass:"fa",checkbox:"fa-square-o",checkboxSelected:"fa-check-square-o",checkboxUnknown:"fa-square fancytree-helper-indeterminate-cb",dragHelper:"fa-arrow-right",dropMarker:"fa-long-arrow-right",error:"fa-warning",expanderClosed:"fa-caret-right",expanderLazy:"fa-angle-right",expanderOpen:"fa-caret-down",loading:{html:"<span class='fa fa-spinner fa-pulse' />"},nodata:"fa-meh-o",noExpander:"",radio:"fa-circle-thin",radioSelected:"fa-circle",doc:"fa-file-o",docOpen:"fa-file-o",folder:"fa-folder-o",folderOpen:"fa-folder-open-o"},awesome5:{_addClass:"",checkbox:"far fa-square",checkboxSelected:"far fa-check-square",checkboxUnknown:"fas fa-square fancytree-helper-indeterminate-cb",radio:"far fa-circle",radioSelected:"fas fa-circle",radioUnknown:"far fa-dot-circle",dragHelper:"fas fa-arrow-right",dropMarker:"fas fa-long-arrow-alt-right",error:"fas fa-exclamation-triangle",expanderClosed:"fas fa-caret-right",expanderLazy:"fas fa-angle-right",expanderOpen:"fas fa-caret-down",loading:"fas fa-spinner fa-pulse",nodata:"far fa-meh",noExpander:"",doc:"far fa-file",docOpen:"far fa-file",folder:"far fa-folder",folderOpen:"far fa-folder-open"},bootstrap3:{_addClass:"glyphicon",checkbox:"glyphicon-unchecked",checkboxSelected:"glyphicon-check",checkboxUnknown:"glyphicon-expand fancytree-helper-indeterminate-cb",dragHelper:"glyphicon-play",dropMarker:"glyphicon-arrow-right",error:"glyphicon-warning-sign",expanderClosed:"glyphicon-menu-right",expanderLazy:"glyphicon-menu-right",expanderOpen:"glyphicon-menu-down",loading:"glyphicon-refresh fancytree-helper-spin",nodata:"glyphicon-info-sign",noExpander:"",radio:"glyphicon-remove-circle",radioSelected:"glyphicon-ok-circle",doc:"glyphicon-file",docOpen:"glyphicon-file",folder:"glyphicon-folder-close",folderOpen:"glyphicon-folder-open"},material:{_addClass:"material-icons",checkbox:{text:"check_box_outline_blank"},checkboxSelected:{text:"check_box"},checkboxUnknown:{text:"indeterminate_check_box"},dragHelper:{text:"play_arrow"},dropMarker:{text:"arrow-forward"},error:{text:"warning"},expanderClosed:{text:"chevron_right"},expanderLazy:{text:"last_page"},expanderOpen:{text:"expand_more"},loading:{text:"autorenew",addClass:"fancytree-helper-spin"},nodata:{text:"info"},noExpander:{text:""},radio:{text:"radio_button_unchecked"},radioSelected:{text:"radio_button_checked"},doc:{text:"insert_drive_file"},docOpen:{text:"insert_drive_file"},folder:{text:"folder"},folderOpen:{text:"folder_open"}}};function l(e,t,n,i){var r=n.map,o=r[i],s=d(e),a=s.find(".fancytree-childcounter"),l=t+" "+(r._addClass||"");"string"==typeof o?(e.innerHTML="",s.attr("class",l+" "+o).append(a)):o&&(o.text?e.textContent=""+o.text:o.html?e.innerHTML=o.html:e.innerHTML="",s.attr("class",l+" "+(o.addClass||"")).append(a))}return d.ui.fancytree.registerExtension({name:"glyph",version:"2.31.0",options:{preset:null,map:{}},treeInit:function(e){var t=e.tree,n=e.options.glyph;n.preset?(a.assert(!!i[n.preset],"Invalid value for `options.glyph.preset`: "+n.preset),n.map=d.extend({},i[n.preset],n.map)):t.warn("ext-glyph: missing `preset` option."),this._superApply(arguments),t.$container.addClass("fancytree-ext-glyph")},nodeRenderStatus:function(e){var t,n,i,r=e.node,o=d(r.span),s=e.options.glyph;return n=this._super(e),r.isRoot()||((i=o.children("span.fancytree-expander").get(0))&&l(i,"fancytree-expander",s,r.expanded&&r.hasChildren()?"expanderOpen":r.isUndefined()?"expanderLazy":r.hasChildren()?"expanderClosed":"noExpander"),(i=r.tr?d("td",r.tr).find("span.fancytree-checkbox").get(0):o.children("span.fancytree-checkbox").get(0))&&(t=a.evalOption("checkbox",r,r,s,!1),r.parent&&r.parent.radiogroup||"radio"===t?l(i,"fancytree-checkbox fancytree-radio",s,r.selected?"radioSelected":"radio"):l(i,"fancytree-checkbox",s,r.selected?"checkboxSelected":r.partsel?"checkboxUnknown":"checkbox")),(i=o.children("span.fancytree-icon").get(0))&&l(i,"fancytree-icon",s,r.statusNodeType?r.statusNodeType:r.folder?r.expanded&&r.hasChildren()?"folderOpen":"folder":r.expanded?"docOpen":"doc")),n},nodeSetStatus:function(e,t,n,i){var r,o,s=e.options.glyph,a=e.node;return r=this._superApply(arguments),"error"!==t&&"loading"!==t&&"nodata"!==t||(a.parent?(o=d("span.fancytree-expander",a.span).get(0))&&l(o,"fancytree-expander",s,t):(o=d(".fancytree-statusnode-"+t,a[this.nodeContainerAttrName]).find("span.fancytree-icon").get(0))&&l(o,"fancytree-icon",s,t)),r}}),d.ui.fancytree},"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),l=function(c){"use strict";var u=c.ui.keyCode,a={text:[u.UP,u.DOWN],checkbox:[u.UP,u.DOWN,u.LEFT,u.RIGHT],link:[u.UP,u.DOWN,u.LEFT,u.RIGHT],radiobutton:[u.UP,u.DOWN,u.LEFT,u.RIGHT],"select-one":[u.LEFT,u.RIGHT],"select-multiple":[u.LEFT,u.RIGHT]};function h(e,t){var n,i=null,r=0;return e.children().each(function(){if(t<=r)return i=c(this),!1;n=c(this).prop("colspan"),r+=n||1}),i}function l(e,t){var n,i,r,o,s,a,l=e.closest("td"),d=null;switch(t){case u.LEFT:d=l.prev();break;case u.RIGHT:d=l.next();break;case u.UP:case u.DOWN:for(n=l.parent(),r=n,s=l.get(0),a=0,r.children().each(function(){if(this===s)return!1;o=c(this).prop("colspan"),a+=o||1}),i=a;(n=t===u.UP?n.prev():n.next()).length&&(n.is(":hidden")||!(d=h(n,i))||!d.find(":input,a").length););}return d}return c.ui.fancytree.registerExtension({name:"gridnav",version:"2.31.0",options:{autofocusInput:!1,handleCursorKeys:!0},treeInit:function(i){this._requireExtension("table",!0,!0),this._superApply(arguments),this.$container.addClass("fancytree-ext-gridnav"),this.$container.on("focusin",function(e){var t,n=c.ui.fancytree.getNode(e.target);n&&!n.isActive()&&(t=i.tree._makeHookContext(n,e),i.tree._callHook("nodeSetActive",t,!0))})},nodeSetActive:function(e,t,n){var i=e.options.gridnav,r=e.node,o=e.originalEvent||{},s=c(o.target).is(":input");t=!1!==t,this._superApply(arguments),t&&(e.options.titlesTabbable?(s||(c(r.span).find("span.fancytree-title").focus(),r.setFocus()),e.tree.$container.attr("tabindex","-1")):i.autofocusInput&&!s&&c(r.tr||r.span).find(":input:enabled").first().focus())},nodeKeydown:function(e){var t,n,i,r=e.options.gridnav,o=e.originalEvent,s=c(o.target);return s.is(":input:enabled")?t=s.prop("type"):s.is("a")&&(t="link"),t&&r.handleCursorKeys?!((n=a[t])&&0<=c.inArray(o.which,n)&&(i=l(s,o.which))&&i.length)||(i.find(":input:enabled,a").focus(),!1):this._superApply(arguments)}}),c.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree","./jquery.fancytree.table"],l):"object"==typeof module&&module.exports?(require("./jquery.fancytree.table"),module.exports=l(require("jquery"))):l(jQuery),d=function(s){"use strict";return s.ui.fancytree.registerExtension({name:"multi",version:"2.31.0",options:{allowNoSelect:!1,mode:"sameParent"},treeInit:function(e){this._superApply(arguments),this.$container.addClass("fancytree-ext-multi"),1===e.options.selectMode&&s.error("Fancytree ext-multi: selectMode: 1 (single) is not compatible.")},nodeClick:function(e){var t=e.tree,n=e.node,i=t.getActiveNode()||t.getFirstChild(),r="checkbox"===e.targetType,o="expander"===e.targetType;switch(s.ui.fancytree.eventToString(e.originalEvent)){case"click":if(o)break;r||(t.selectAll(!1),n.setSelected());break;case"shift+click":t.visitRows(function(e){if(e.setSelected(),e===n)return!1},{start:i,reverse:i.isBelowOf(n)});break;case"ctrl+click":case"meta+click":return void n.toggleSelected()}return this._superApply(arguments)},nodeKeydown:function(e){var t=e.tree,n=e.node,i=e.originalEvent;switch(s.ui.fancytree.eventToString(i)){case"up":case"down":t.selectAll(!1),n.navigate(i.which,!0),t.getActiveNode().setSelected();break;case"shift+up":case"shift+down":n.navigate(i.which,!0),t.getActiveNode().setSelected()}return this._superApply(arguments)}}),s.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],d):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=d(require("jquery"))):d(jQuery),c=function(p){"use strict";var t=null,n=window.localStorage?{get:function(e){return window.localStorage.getItem(e)},set:function(e,t){window.localStorage.setItem(e,t)},remove:function(e){window.localStorage.removeItem(e)}}:null,i=window.sessionStorage?{get:function(e){return window.sessionStorage.getItem(e)},set:function(e,t){window.sessionStorage.setItem(e,t)},remove:function(e){window.sessionStorage.removeItem(e)}}:null,r=p.ui.fancytree.assert,u="active",g="expanded",h="focus",f="selected";return"function"==typeof Cookies?t={get:Cookies.get,set:function(e,t){Cookies.set(e,t,this.options.persist.cookie)},remove:Cookies.remove}:p&&"function"==typeof p.cookie&&(t={get:p.cookie,set:function(e,t){p.cookie.set(e,t,this.options.persist.cookie)},remove:p.removeCookie}),p.ui.fancytree._FancytreeClass.prototype.clearPersistData=function(e){var t=this.ext.persist,n=t.cookiePrefix;0<=(e=e||"active expanded focus selected").indexOf(u)&&t._data(n+u,null),0<=e.indexOf(g)&&t._data(n+g,null),0<=e.indexOf(h)&&t._data(n+h,null),0<=e.indexOf(f)&&t._data(n+f,null)},p.ui.fancytree._FancytreeClass.prototype.clearCookies=function(e){return this.warn("'tree.clearCookies()' is deprecated since v2.27.0: use 'clearPersistData()' instead."),this.clearPersistData(e)},p.ui.fancytree._FancytreeClass.prototype.getPersistData=function(){var e=this.ext.persist,t=e.cookiePrefix,n=e.cookieDelimiter,i={};return i[u]=e._data(t+u),i[g]=(e._data(t+g)||"").split(n),i[f]=(e._data(t+f)||"").split(n),i[h]=e._data(t+h),i},p.ui.fancytree.registerExtension({name:"persist",version:"2.31.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(e,t){var n=this._local.store;if(void 0===t)return n.get.call(this,e);null===t?n.remove.call(this,e):n.set.call(this,e,t)},_appendKey:function(e,t,n){t=""+t;var i=this._local,r=this.options.persist.cookieDelimiter,o=i.cookiePrefix+e,s=i._data(o),a=s?s.split(r):[],l=p.inArray(t,a);0<=l&&a.splice(l,1),n&&a.push(t),i._data(o,a.join(r))},treeInit:function(e){var a=e.tree,l=e.options,d=this._local,c=this.options.persist;return d.cookiePrefix=c.cookiePrefix||"fancytree-"+a._id+"-",d.storeActive=0<=c.types.indexOf(u),d.storeExpanded=0<=c.types.indexOf(g),d.storeSelected=0<=c.types.indexOf(f),d.storeFocus=0<=c.types.indexOf(h),d.store=null,"auto"===c.store&&(c.store=n?"local":"cookie"),p.isPlainObject(c.store)?d.store=c.store:"cookie"===c.store?d.store=t:"local"===c.store?d.store="local"===c.store?n:i:"session"===c.store&&(d.store="local"===c.store?n:i),r(d.store,"Need a valid store."),a.$div.on("fancytreeinit",function(e){if(!1!==a._triggerTreeEvent("beforeRestore",null,{})){var t,n,i,r,o=d._data(d.cookiePrefix+h),s=!1===c.fireActivate;t=d._data(d.cookiePrefix+g),i=t&&t.split(c.cookieDelimiter),(d.storeExpanded?function e(t,n,i,r,o){var s,a,l,d,c=!1,u=t.options.persist.expandOpts,h=[],f=[];for(i=i||[],o=o||p.Deferred(),s=0,l=i.length;s<l;s++)a=i[s],(d=t.getNodeByKey(a))?r&&d.isUndefined()?(c=!0,t.debug("_loadLazyNodes: "+d+" is lazy: loading..."),"expand"===r?h.push(d.setExpanded(!0,u)):h.push(d.load())):(t.debug("_loadLazyNodes: "+d+" already loaded."),d.setExpanded(!0,u)):(f.push(a),t.debug("_loadLazyNodes: "+d+" was not yet found."));return p.when.apply(p,h).always(function(){if(c&&0<f.length)e(t,n,f,r,o);else{if(f.length)for(t.warn("_loadLazyNodes: could not load those keys: ",f),s=0,l=f.length;s<l;s++)a=i[s],n._appendKey(g,i[s],!1);o.resolve()}}),o}(a,d,i,!!c.expandLazy&&"expand",null):(new p.Deferred).resolve()).done(function(){if(d.storeSelected){if(t=d._data(d.cookiePrefix+f))for(i=t.split(c.cookieDelimiter),n=0;n<i.length;n++)(r=a.getNodeByKey(i[n]))?(void 0===r.selected||c.overrideSource&&!1===r.selected)&&(r.selected=!0,r.renderStatus()):d._appendKey(f,i[n],!1);3===a.options.selectMode&&a.visit(function(e){if(e.selected)return e.fixSelection3AfterClick(),"skip"})}d.storeActive&&(!(t=d._data(d.cookiePrefix+u))||!l.persist.overrideSource&&a.activeNode||(r=a.getNodeByKey(t))&&(r.debug("persist: set active",t),r.setActive(!0,{noFocus:!0,noEvents:s}))),d.storeFocus&&o&&(r=a.getNodeByKey(o))&&(a.options.titlesTabbable?p(r.span).find(".fancytree-title").focus():p(a.$container).focus()),a._triggerTreeEvent("restore",null,{})})}}),this._superApply(arguments)},nodeSetActive:function(e,t,n){var i,r=this._local;return t=!1!==t,i=this._superApply(arguments),r.storeActive&&r._data(r.cookiePrefix+u,this.activeNode?this.activeNode.key:null),i},nodeSetExpanded:function(e,t,n){var i,r=e.node,o=this._local;return t=!1!==t,i=this._superApply(arguments),o.storeExpanded&&o._appendKey(g,r.key,t),i},nodeSetFocus:function(e,t){var n,i=this._local;return t=!1!==t,n=this._superApply(arguments),i.storeFocus&&i._data(i.cookiePrefix+h,this.focusNode?this.focusNode.key:null),n},nodeSetSelected:function(e,t,n){var i,r,o=e.tree,s=e.node,a=this._local;return t=!1!==t,i=this._superApply(arguments),a.storeSelected&&(3===o.options.selectMode?(r=(r=p.map(o.getSelectedNodes(!0),function(e){return e.key})).join(e.options.persist.cookieDelimiter),a._data(a.cookiePrefix+f,r)):a._appendKey(f,s.key,s.selected)),i}}),p.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],c):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=c(require("jquery"))):c(jQuery),u=function(C){"use strict";function _(e,t){t=t||"",e||C.error("Assertion failed "+t)}function k(e,n){e.visit(function(e){var t=e.tr;if(t&&(t.style.display=e.hide||!n?"none":""),!e.expanded)return"skip"})}return C.ui.fancytree.registerExtension({name:"table",version:"2.31.0",options:{checkboxColumnIdx:null,indentation:16,mergeStatusColumns:!0,nodeColumnIdx:0},treeInit:function(e){var t,n,i,r,o=e.tree,s=e.options,a=s.table,l=o.widget.element;if(null!=a.customStatus&&(null==s.renderStatusColumns?(o.warn("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' instead."),s.renderStatusColumns=a.customStatus):C.error("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' only instead.")),s.renderStatusColumns&&!0===s.renderStatusColumns&&(s.renderStatusColumns=s.renderColumns),l.addClass("fancytree-container fancytree-ext-table"),(r=l.find(">tbody")).length||(l.find(">tr").length&&C.error("Expected table > tbody > tr. If you see this please open an issue."),r=C("<tbody>").appendTo(l)),o.tbody=r[0],o.columnCount=C("thead >tr",l).last().find(">th",l).length,(i=r.children("tr").first()).length)n=i.children("td").length,o.columnCount&&n!==o.columnCount&&(o.warn("Column count mismatch between thead ("+o.columnCount+") and tbody ("+n+"): using tbody."),o.columnCount=n),i=i.clone();else for(_(1<=o.columnCount,"Need either <thead> or <tbody> with <td> elements to determine column count."),i=C("<tr />"),t=0;t<o.columnCount;t++)i.append("<td />");i.find(">td").eq(a.nodeColumnIdx).html("<span class='fancytree-node' />"),s.aria&&(i.attr("role","row"),i.find("td").attr("role","gridcell")),o.rowFragment=document.createDocumentFragment(),o.rowFragment.appendChild(i.get(0)),r.empty(),o.statusClassPropName="tr",o.ariaPropName="tr",this.nodeContainerAttrName="tr",o.$container=l,this._superApply(arguments),C(o.rootNode.ul).remove(),o.rootNode.ul=null,this.$container.attr("tabindex",s.tabindex),s.aria&&o.$container.attr("role","treegrid").attr("aria-readonly",!0)},nodeRemoveChildMarkup:function(e){e.node.visit(function(e){e.tr&&(C(e.tr).remove(),e.tr=null)})},nodeRemoveMarkup:function(e){var t=e.node;t.tr&&(C(t.tr).remove(),t.tr=null),this.nodeRemoveChildMarkup(e)},nodeRender:function(e,t,n,i,r){var o,s,a,l,d,c,u,h,f=e.tree,p=e.node,g=e.options,y=!p.parent;if(!1!==f._enableUpdate){if(r||(e.hasCollapsedParents=p.parent&&!p.parent.expanded),!y)if(p.tr&&t&&this.nodeRemoveMarkup(e),p.tr)t?this.nodeRenderTitle(e):this.nodeRenderStatus(e);else{if(e.hasCollapsedParents&&!n)return;d=f.rowFragment.firstChild.cloneNode(!0),_(c=function(e){var t,n,i=e.parent,r=i?i.children:null;if(r&&1<r.length&&r[0]!==e)for(_((n=r[C.inArray(e,r)-1]).tr);n.children&&n.children.length&&(t=n.children[n.children.length-1]).tr;)n=t;else n=i;return n}(p)),!0===i&&r?d.style.display="none":n&&e.hasCollapsedParents&&(d.style.display="none"),c.tr?(b=c.tr,x=d,b.parentNode.insertBefore(x,b.nextSibling)):(_(!c.parent,"prev. row must have a tr, or be system root"),v=f.tbody,m=d,v.insertBefore(m,v.firstChild)),p.tr=d,p.key&&g.generateIds&&(p.tr.id=g.idPrefix+p.key),(p.tr.ftnode=p).span=C("span.fancytree-node",p.tr).get(0),this.nodeRenderTitle(e),g.createNode&&g.createNode.call(f,{type:"createNode"},e)}var v,m,b,x;if(g.renderNode&&g.renderNode.call(f,{type:"renderNode"},e),(o=p.children)&&(y||n||p.expanded))for(a=0,l=o.length;a<l;a++)(h=C.extend({},e,{node:o[a]})).hasCollapsedParents=h.hasCollapsedParents||!p.expanded,this.nodeRender(h,t,n,i,!0);o&&!r&&(u=p.tr||null,s=f.tbody.firstChild,p.visit(function(e){if(e.tr){if(e.parent.expanded||"none"===e.tr.style.display||(e.tr.style.display="none",k(e,!1)),e.tr.previousSibling!==u){p.debug("_fixOrder: mismatch at node: "+e);var t=u?u.nextSibling:s;f.tbody.insertBefore(e.tr,t)}u=e.tr}}))}},nodeRenderTitle:function(e,t){var n,i,r=e.tree,o=e.node,s=e.options,a=o.isStatusNode();return i=this._super(e,t),o.isRootNode()||(s.checkbox&&!a&&null!=s.table.checkboxColumnIdx&&(n=C("span.fancytree-checkbox",o.span),C(o.tr).find("td").eq(+s.table.checkboxColumnIdx).html(n)),this.nodeRenderStatus(e),a?s.renderStatusColumns?s.renderStatusColumns.call(r,{type:"renderStatusColumns"},e):s.table.mergeStatusColumns&&o.isTopLevel()&&C(o.tr).find(">td").eq(0).prop("colspan",r.columnCount).text(o.title).addClass("fancytree-status-merged").nextAll().remove():s.renderColumns&&s.renderColumns.call(r,{type:"renderColumns"},e)),i},nodeRenderStatus:function(e){var t,n=e.node,i=e.options;this._super(e),C(n.tr).removeClass("fancytree-node"),t=(n.getLevel()-1)*i.table.indentation,i.rtl?C(n.span).css({paddingRight:t+"px"}):C(n.span).css({paddingLeft:t+"px"})},nodeSetExpanded:function(t,n,i){if(n=!1!==n,t.node.expanded&&n||!t.node.expanded&&!n)return this._superApply(arguments);var r=new C.Deferred,e=C.extend({},i,{noEvents:!0,noAnimation:!0});function o(e){k(t.node,n),e?n&&t.options.autoScroll&&!i.noAnimation&&t.node.hasChildren()?t.node.getLastChild().scrollIntoView(!0,{topNode:t.node}).always(function(){i.noEvents||t.tree._triggerNodeEvent(n?"expand":"collapse",t),r.resolveWith(t.node)}):(i.noEvents||t.tree._triggerNodeEvent(n?"expand":"collapse",t),r.resolveWith(t.node)):(i.noEvents||t.tree._triggerNodeEvent(n?"expand":"collapse",t),r.rejectWith(t.node))}return i=i||{},this._super(t,n,e).done(function(){o(!0)}).fail(function(){o(!1)}),r.promise()},nodeSetStatus:function(e,t,n,i){if("ok"===t){var r=e.node,o=r.children?r.children[0]:null;o&&o.isStatusNode()&&C(o.tr).remove()}return this._superApply(arguments)},treeClear:function(e){return this.nodeRemoveChildMarkup(this._makeHookContext(this.rootNode)),this._superApply(arguments)},treeDestroy:function(e){return this.$container.find("tbody").empty(),this.$source&&this.$source.removeClass("fancytree-helper-hidden"),this._superApply(arguments)}}),C.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],u):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=u(require("jquery"))):u(jQuery),h=function(o){"use strict";return o.ui.fancytree.registerExtension({name:"themeroller",version:"2.31.0",options:{activeClass:"ui-state-active",addClass:"ui-corner-all",focusClass:"ui-state-focus",hoverClass:"ui-state-hover",selectedClass:"ui-state-highlight"},treeInit:function(e){var t=e.widget.element,i=e.options.themeroller;this._superApply(arguments),"TABLE"===t[0].nodeName?(t.addClass("ui-widget ui-corner-all"),t.find(">thead tr").addClass("ui-widget-header"),t.find(">tbody").addClass("ui-widget-conent")):t.addClass("ui-widget ui-widget-content ui-corner-all"),t.on("mouseenter mouseleave",".fancytree-node",function(e){var t=o.ui.fancytree.getNode(e.target),n="mouseenter"===e.type;o(t.tr?t.tr:t.span).toggleClass(i.hoverClass+" "+i.addClass,n)})},treeDestroy:function(e){this._superApply(arguments),e.widget.element.removeClass("ui-widget ui-widget-content ui-corner-all")},nodeRenderStatus:function(e){var t={},n=e.node,i=o(n.tr?n.tr:n.span),r=e.options.themeroller;this._super(e),t[r.activeClass]=!1,t[r.focusClass]=!1,t[r.selectedClass]=!1,n.isActive()&&(t[r.activeClass]=!0),n.hasFocus()&&(t[r.focusClass]=!0),n.isSelected()&&!n.isActive()&&(t[r.selectedClass]=!0),i.toggleClass(r.activeClass,t[r.activeClass]),i.toggleClass(r.focusClass,t[r.focusClass]),i.toggleClass(r.selectedClass,t[r.selectedClass]),i.addClass(r.addClass)}}),o.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],h):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=h(require("jquery"))):h(jQuery),f=function(p){"use strict";var g=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function y(e,t){var n=p("#"+(e="fancytree-style-"+e));if(!t)return n.remove(),null;n.length||(n=p("<style />").attr("id",e).addClass("fancytree-style").prop("type","text/css").appendTo("head"));try{n.html(t)}catch(e){n[0].styleSheet.cssText=t}return n}function v(e,t,n,i,r,o){var s,a="#"+e+" span.fancytree-level-",l=[];for(s=0;s<t;s++)l.push(a+(s+1)+" span.fancytree-title { padding-left: "+(s*n+i)+o+"; }");return l.push("#"+e+" div.ui-effects-wrapper ul li span.fancytree-title, #"+e+" li.fancytree-animating span.fancytree-title { padding-left: "+r+o+"; position: static; width: auto; }"),l.join("\n")}return p.ui.fancytree.registerExtension({name:"wide",version:"2.31.0",options:{iconWidth:null,iconSpacing:null,labelSpacing:null,levelOfs:null},treeCreate:function(e){this._superApply(arguments),this.$container.addClass("fancytree-ext-wide");var t,n,i,r,o,s=e.options.wide,a=p("<li id='fancytreeTemp'><span class='fancytree-node'><span class='fancytree-icon' /><span class='fancytree-title' /></span><ul />").appendTo(e.tree.$container),l=a.find(".fancytree-icon"),d=a.find("ul"),c=s.iconSpacing||l.css("margin-left"),u=s.iconWidth||l.css("width"),h=s.labelSpacing||"3px",f=s.levelOfs||d.css("padding-left");a.remove(),n=c.match(g)[2],c=parseFloat(c,10),i=h.match(g)[2],h=parseFloat(h,10),r=u.match(g)[2],u=parseFloat(u,10),o=f.match(g)[2],n===r&&o===r&&i===r||p.error("iconWidth, iconSpacing, and levelOfs must have the same css measure unit"),this._local.measureUnit=r,this._local.levelOfs=parseFloat(f),this._local.lineOfs=(1+(e.options.checkbox?1:0)+(!1===e.options.icon?0:1))*(u+c)+c,this._local.labelOfs=h,this._local.maxDepth=10,y(t=this.$container.uniqueId().attr("id"),v(t,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.labelOfs,this._local.measureUnit))},treeDestroy:function(e){return y(this.$container.attr("id"),null),this._superApply(arguments)},nodeRenderStatus:function(e){var t,n,i=e.node,r=i.getLevel();return n=this._super(e),r>this._local.maxDepth&&(t=this.$container.attr("id"),this._local.maxDepth*=2,i.debug("Define global ext-wide css up to level "+this._local.maxDepth),y(t,v(t,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.labelSpacing,this._local.measureUnit))),p(i.span).addClass("fancytree-level-"+r),n}}),p.ui.fancytree},"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],f):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=f(require("jquery"))):f(jQuery),e.ui.fancytree});
//# sourceMappingURL=jquery.fancytree-all-deps.min.js.map