File: //usr/share/usermin/authentic-theme/unauthenticated/js/jquery.fancytree.min.js
/*! jQuery UI - v1.14.1 - 2025-08-23
* https://jqueryui.com
* Includes: widget.js, position.js, keycode.js, scroll-parent.js, unique-id.js
* Copyright OpenJS Foundation and other contributors; Licensed MIT */
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e){"use strict";e.ui=e.ui||{},e.ui.version="1.14.1";var t,i,n=0,r=Array.prototype.hasOwnProperty,o=Array.prototype.slice;t=e.cleanData,e.cleanData=function(i){var n,r,o;for(o=0;null!=(r=i[o]);o++)(n=e._data(r,"events"))&&n.remove&&e(r).triggerHandler("remove");t(i)},e.widget=function(t,i,n){var r,o,s,a={},l=t.split(".")[0];if("__proto__"===(t=t.split(".")[1])||"constructor"===t)return e.error("Invalid widget name: "+t);var d=l+"-"+t;return n||(n=i,i=e.Widget),Array.isArray(n)&&(n=e.extend.apply(null,[{}].concat(n))),e.expr.pseudos[d.toLowerCase()]=function(t){return!!e.data(t,d)},e[l]=e[l]||{},r=e[l][t],o=e[l][t]=function(e,t){if(!this||!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),(s=new i).options=e.widget.extend({},s.options),e.each(n,function(e,t){a[e]="function"==typeof t?function(){function n(){return i.prototype[e].apply(this,arguments)}function r(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=n,this._superApply=r,e=t.apply(this,arguments),this._super=i,this._superApply=o,e}}():t}),o.prototype=e.widget.extend(s,{widgetEventPrefix:r&&s.widgetEventPrefix||t},a,{constructor:o,namespace:l,widgetName:t,widgetFullName:d}),r?(e.each(r._childConstructors,function(t,i){var n=i.prototype;e.widget(n.namespace+"."+n.widgetName,o,i._proto)}),delete r._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,n,s=o.call(arguments,1),a=0,l=s.length;a<l;a++)for(i in s[a])n=s[a][i],r.call(s[a],i)&&void 0!==n&&(e.isPlainObject(n)?t[i]=e.isPlainObject(t[i])?e.widget.extend({},t[i],n):e.widget.extend({},n):t[i]=n);return t},e.widget.bridge=function(t,i){var n=i.prototype.widgetFullName||t;e.fn[t]=function(r){var s="string"==typeof r,a=o.call(arguments,1),l=this;return s?this.length||"instance"!==r?this.each(function(){var i,o=e.data(this,n);return"instance"===r?(l=o,!1):o?"function"!=typeof o[r]||"_"===r.charAt(0)?e.error("no such method '"+r+"' for "+t+" widget instance"):(i=o[r].apply(o,a))!==o&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0:e.error("cannot call methods on "+t+" prior to initialization; attempted to call method '"+r+"'")}):l=void 0:(a.length&&(r=e.widget.extend.apply(null,[r].concat(a))),this.each(function(){var t=e.data(this,n);t?(t.option(r||{}),t._init&&t._init()):e.data(this,n,new i(r,this))})),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),this.classesElementLookup={},i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){var t=this;this._destroy(),e.each(this.classesElementLookup,function(e,i){t._removeClass(i,e)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var n,r,o,s=t;if(0==arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(s={},t=(n=t.split(".")).shift(),n.length){for(o=0,r=s[t]=e.widget.extend({},this.options[t]);o<n.length-1;o++)r[n[o]]=r[n[o]]||{},r=r[n[o]];if(t=n.pop(),1==arguments.length)return void 0===r[t]?null:r[t];r[t]=i}else{if(1==arguments.length)return void 0===this.options[t]?null:this.options[t];s[t]=i}return this._setOptions(s),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(t){var i,n,r;for(i in t)r=this.classesElementLookup[i],t[i]!==this.options.classes[i]&&r&&r.length&&(n=e(r.get()),this._removeClass(r,i),n.addClass(this._classes({element:n,keys:i,classes:t,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(t){var i=[],n=this;function r(r,o){var s,a;for(a=0;a<r.length;a++)s=n.classesElementLookup[r[a]]||e(),t.add?(function(){var i=[];t.element.each(function(t,r){e.map(n.classesElementLookup,function(e){return e}).some(function(e){return e.is(r)})||i.push(r)}),n._on(e(i),{remove:"_untrackClassesElement"})}(),s=e(e.uniqueSort(s.get().concat(t.element.get())))):s=e(s.not(t.element).get()),n.classesElementLookup[r[a]]=s,i.push(r[a]),o&&t.classes[r[a]]&&i.push(t.classes[r[a]])}return(t=e.extend({element:this.element,classes:this.options.classes||{}},t)).keys&&r(t.keys.match(/\S+/g)||[],!0),t.extra&&r(t.extra.match(/\S+/g)||[]),i.join(" ")},_untrackClassesElement:function(t){var i=this;e.each(i.classesElementLookup,function(n,r){-1!==e.inArray(t.target,r)&&(i.classesElementLookup[n]=e(r.not(t.target).get()))}),this._off(e(t.target))},_removeClass:function(e,t,i){return this._toggleClass(e,t,i,!1)},_addClass:function(e,t,i){return this._toggleClass(e,t,i,!0)},_toggleClass:function(e,t,i,n){n="boolean"==typeof n?n:i;var r="string"==typeof e||null===e,o={extra:r?t:i,keys:r?e:t,element:r?this.element:e,add:n};return o.element.toggleClass(this._classes(o),n),this},_on:function(t,i,n){var r,o=this;"boolean"!=typeof t&&(n=i,i=t,t=!1),n?(i=r=e(i),this.bindings=this.bindings.add(i)):(n=i,i=this.element,r=this.widget()),e.each(n,function(n,s){function a(){if(t||!0!==o.options.disabled&&!e(this).hasClass("ui-state-disabled"))return("string"==typeof s?o[s]:s).apply(o,arguments)}"string"!=typeof s&&(a.guid=s.guid=s.guid||a.guid||e.guid++);var l=n.match(/^([\w:-]*)\s*(.*)$/),d=l[1]+o.eventNamespace,c=l[2];c?r.on(d,c,a):i.on(d,a)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){var i=this;return setTimeout(function(){return("string"==typeof e?i[e]:e).apply(i,arguments)},t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(e(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(e(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(e(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(e(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,i,n){var r,o,s=this.options[t];if(n=n||{},(i=e.Event(i)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(r in o)r in i||(i[r]=o[r]);return this.element.trigger(i,n),!("function"==typeof s&&!1===s.apply(this.element[0],[i].concat(n))||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(n,r,o){"string"==typeof r&&(r={effect:r});var s,a=r?!0===r||"number"==typeof r?i:r.effect||i:t;"number"==typeof(r=r||{})?r={duration:r}:!0===r&&(r={}),s=!e.isEmptyObject(r),r.complete=o,r.delay&&n.delay(r.delay),s&&e.effects&&e.effects.effect[a]?n[t](r):a!==t&&n[a]?n[a](r.duration,r.easing,o):n.queue(function(i){e(this)[t](),o&&o.call(n[0]),i()})}}),e.widget,function(){var t,i=Math.max,n=Math.abs,r=/left|center|right/,o=/top|center|bottom/,s=/[\+\-]\d+(\.[\d]+)?%?/,a=/^\w+/,l=/%$/,d=e.fn.position;function c(e,t,i){return[parseFloat(e[0])*(l.test(e[0])?t/100:1),parseFloat(e[1])*(l.test(e[1])?i/100:1)]}function u(t,i){return parseInt(e.css(t,i),10)||0}function h(e){return null!=e&&e===e.window}e.position={scrollbarWidth:function(){if(void 0!==t)return t;var i,n,r=e("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>"),o=r.children()[0];return e("body").append(r),i=o.offsetWidth,r.css("overflow","scroll"),i===(n=o.offsetWidth)&&(n=r[0].clientWidth),r.remove(),t=i-n},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),n=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),r="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth;return{width:"scroll"===n||"auto"===n&&t.height<t.element[0].scrollHeight?e.position.scrollbarWidth():0,height:r?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),n=h(i[0]),r=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:n,isDocument:r,offset:n||r?{left:0,top:0}:e(t).offset(),scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return d.apply(this,arguments);var l,f,p,g,v,y,m,b="string"==typeof(t=e.extend({},t)).of?e(document).find(t.of):e(t.of),x=e.position.getWithinInfo(t.within),_=e.position.getScrollInfo(x),w=(t.collision||"flip").split(" "),k={};return m=9===(l=b[0]).nodeType?{width:b.width(),height:b.height(),offset:{top:0,left:0}}:h(l)?{width:b.width(),height:b.height(),offset:{top:b.scrollTop(),left:b.scrollLeft()}}:l.preventDefault?{width:0,height:0,offset:{top:l.pageY,left:l.pageX}}:{width:b.outerWidth(),height:b.outerHeight(),offset:b.offset()},b[0].preventDefault&&(t.at="left top"),p=m.width,g=m.height,v=m.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,i,n=(t[this]||"").split(" ");1===n.length&&(n=r.test(n[0])?n.concat(["center"]):o.test(n[0])?["center"].concat(n):["center","center"]),n[0]=r.test(n[0])?n[0]:"center",n[1]=o.test(n[1])?n[1]:"center",e=s.exec(n[0]),i=s.exec(n[1]),k[this]=[e?e[0]:0,i?i[0]:0],t[this]=[a.exec(n[0])[0],a.exec(n[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===t.at[0]?y.left+=p:"center"===t.at[0]&&(y.left+=p/2),"bottom"===t.at[1]?y.top+=g:"center"===t.at[1]&&(y.top+=g/2),f=c(k.at,p,g),y.left+=f[0],y.top+=f[1],this.each(function(){var r,o,s=e(this),a=s.outerWidth(),l=s.outerHeight(),d=u(this,"marginLeft"),h=u(this,"marginTop"),m=a+d+u(this,"marginRight")+_.width,C=l+h+u(this,"marginBottom")+_.height,N=e.extend({},y),S=c(k.my,s.outerWidth(),s.outerHeight());"right"===t.my[0]?N.left-=a:"center"===t.my[0]&&(N.left-=a/2),"bottom"===t.my[1]?N.top-=l:"center"===t.my[1]&&(N.top-=l/2),N.left+=S[0],N.top+=S[1],r={marginLeft:d,marginTop:h},e.each(["left","top"],function(i,n){e.ui.position[w[i]]&&e.ui.position[w[i]][n](N,{targetWidth:p,targetHeight:g,elemWidth:a,elemHeight:l,collisionPosition:r,collisionWidth:m,collisionHeight:C,offset:[f[0]+S[0],f[1]+S[1]],my:t.my,at:t.at,within:x,elem:s})}),t.using&&(o=function(e){var r=v.left-N.left,o=r+p-a,d=v.top-N.top,c=d+g-l,u={target:{element:b,left:v.left,top:v.top,width:p,height:g},element:{element:s,left:N.left,top:N.top,width:a,height:l},horizontal:o<0?"left":r>0?"right":"center",vertical:c<0?"top":d>0?"bottom":"middle"};p<a&&n(r+o)<p&&(u.horizontal="center"),g<l&&n(d+c)<g&&(u.vertical="middle"),i(n(r),n(o))>i(n(d),n(c))?u.important="horizontal":u.important="vertical",t.using.call(this,e,u)}),s.offset(e.extend(N,{using:o}))})},e.ui.position={fit:{left:function(e,t){var n,r=t.within,o=r.isWindow?r.scrollLeft:r.offset.left,s=r.width,a=e.left-t.collisionPosition.marginLeft,l=o-a,d=a+t.collisionWidth-s-o;t.collisionWidth>s?l>0&&d<=0?(n=e.left+l+t.collisionWidth-s-o,e.left+=l-n):e.left=d>0&&l<=0?o:l>d?o+s-t.collisionWidth:o:l>0?e.left+=l:d>0?e.left-=d:e.left=i(e.left-a,e.left)},top:function(e,t){var n,r=t.within,o=r.isWindow?r.scrollTop:r.offset.top,s=t.within.height,a=e.top-t.collisionPosition.marginTop,l=o-a,d=a+t.collisionHeight-s-o;t.collisionHeight>s?l>0&&d<=0?(n=e.top+l+t.collisionHeight-s-o,e.top+=l-n):e.top=d>0&&l<=0?o:l>d?o+s-t.collisionHeight:o:l>0?e.top+=l:d>0?e.top-=d:e.top=i(e.top-a,e.top)}},flip:{left:function(e,t){var i,r,o=t.within,s=o.offset.left+o.scrollLeft,a=o.width,l=o.isWindow?o.scrollLeft:o.offset.left,d=e.left-t.collisionPosition.marginLeft,c=d-l,u=d+t.collisionWidth-a-l,h="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,f="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,p=-2*t.offset[0];c<0?((i=e.left+h+f+p+t.collisionWidth-a-s)<0||i<n(c))&&(e.left+=h+f+p):u>0&&((r=e.left-t.collisionPosition.marginLeft+h+f+p-l)>0||n(r)<u)&&(e.left+=h+f+p)},top:function(e,t){var i,r,o=t.within,s=o.offset.top+o.scrollTop,a=o.height,l=o.isWindow?o.scrollTop:o.offset.top,d=e.top-t.collisionPosition.marginTop,c=d-l,u=d+t.collisionHeight-a-l,h="top"===t.my[1]?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,p=-2*t.offset[1];c<0?((r=e.top+h+f+p+t.collisionHeight-a-s)<0||r<n(c))&&(e.top+=h+f+p):u>0&&((i=e.top-t.collisionPosition.marginTop+h+f+p-l)>0||n(i)<u)&&(e.top+=h+f+p)}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}}}(),e.ui.position,e.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},e.fn.scrollParent=function(t){var i=this.css("position"),n="absolute"===i,r=t?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var t=e(this);return(!n||"static"!==t.css("position"))&&r.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:e(this[0].ownerDocument||document)},e.fn.extend({uniqueId:(i=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++i)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}})}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree.ui-deps"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree.ui-deps"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";if(!e.ui||!e.ui.fancytree){for(var t,i=null,n=new RegExp(/\.|\//),r=/[&<>"'/]/g,o=/[<>"'/]/g,s="$recursive_request",a="$request_target_invalid",l={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},d={16:!0,17:!0,18:!0},c={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:"'"},u={16:"shift",17:"ctrl",18:"alt",91:"meta",93:"meta"},h={0:"",1:"left",2:"middle",3:"right"},f="active expanded focus folder lazy radiogroup selected unselectable unselectableIgnore".split(" "),p={},g="columns types".split(" "),v="checkbox expanded extraClasses folder icon iconTooltip key lazy partsel radiogroup refKey selected statusNodeType title tooltip type unselectable unselectableIgnore unselectableStatus".split(" "),y={},m={},b={active:!0,children:!0,data:!0,focus:!0},x=0;x<f.length;x++)p[f[x]]=!0;for(x=0;x<v.length;x++)t=v[x],y[t]=!0,t!==t.toLowerCase()&&(m[t.toLowerCase()]=t);var _=Array.isArray;return w(e.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),Date.now||(Date.now=function(){return(new Date).getTime()}),O.prototype={_findDirectChild:function(e){var t,i,n=this.children;if(n)if("string"==typeof e){for(t=0,i=n.length;t<i;t++)if(n[t].key===e)return n[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,i=e.length;t<i;t++)this.children.push(new O(this,e[t]));this.tree._callHook("treeStructureChanged",this.tree,"setChildren")},addChildren:function(t,i){var n,r,o,s,a=this.getFirstChild(),l=this.getLastChild(),d=[];for(e.isPlainObject(t)&&(t=[t]),this.children||(this.children=[]),n=0,r=t.length;n<r;n++)d.push(new O(this,t[n]));if(s=d[0],null==i?this.children=this.children.concat(d):(i=this._findDirectChild(i),w(0<=(o=e.inArray(i,this.children)),"insertBefore must be an existing child"),this.children.splice.apply(this.children,[o,0].concat(d))),a&&!i){for(n=0,r=d.length;n<r;n++)d[n].render();a!==this.getFirstChild()&&a.renderStatus(),l!==this.getLastChild()&&l.renderStatus()}else this.parent&&!this.parent.ul&&!this.tr||this.render();return 3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),this.triggerModifyChild("add",1===d.length?d[0]:null),s},addClass:function(e){return this.toggleClass(e,!0)},addNode:function(e,t){switch(t=void 0!==t&&"over"!==t?t:"child"){case"after":return this.getParent().addChildren(e,this.getNextSibling());case"before":return this.getParent().addChildren(e,this);case"firstChild":var i=this.children?this.children[0]:null;return this.addChildren(e,i);case"child":case"over":return this.addChildren(e)}w(!1,"Invalid mode: "+t)},addPagingNode:function(t,i){var n,r;if(i=i||"child",!1!==t)return t=e.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},t),this.partload=!0,this.addNode(t,i);for(n=this.children.length-1;0<=n;n--)"paging"===(r=this.children[n]).statusNodeType&&this.removeChild(r);this.partload=!1},appendSibling:function(e){return this.addNode(e,"after")},applyCommand:function(e,t){return this.tree.applyCommand(e,this,t)},applyPatch:function(e){if(null===e)return this.remove(),T(this);var t,i,n={children:!0,expanded:!0,parent:!0};for(t in e)k(e,t)&&(i=e[t],n[t]||C(i)||(y[t]?this[t]=i:this.data[t]=i));return k(e,"children")&&(this.removeChildren(),e.children)&&this._setChildren(e.children),this.isVisible()&&(this.renderTitle(),this.renderStatus()),k(e,"expanded")?this.setExpanded(e.expanded):T(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(e,t,i){return e.addNode(this.toDict(!0,i),t)},countChildren:function(e){var t,i,n,r=this.children;if(!r)return 0;if(n=r.length,!1!==e)for(t=0,i=n;t<i;t++)n+=r[t].countChildren();return n},debug:function(e){4<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),S("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(e){this.tree._callHook(e?"nodeRemoveMarkup":"nodeRemoveChildMarkup",this)},error:function(e){1<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),S("error",arguments))},findAll:function(e){e=C(e)?e:F(e);var t=[];return this.visit(function(i){e(i)&&t.push(i)}),t},findFirst:function(e){e=C(e)?e:F(e);var t=null;return this.visit(function(i){if(e(i))return t=i,!1}),t},findRelatedNode:function(e,t){return this.tree.findRelatedNode(this,e,t)},_changeSelectStatusAttrs:function(e){var t=!1,n=this.tree.options,r=i.evalOption("unselectable",this,this,n,!1);n=i.evalOption("unselectableStatus",this,this,n,void 0);switch(e=r&&null!=n?n: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 t=this.tree.options;w(3===t.selectMode,"expected selectMode 3"),function e(n){var r,o,s,a,l,d,c,u,h=n.children;if(h&&h.length){for(c=!(d=!0),r=0,o=h.length;r<o;r++)a=e(s=h[r]),i.evalOption("unselectableIgnore",s,s,t,!1)||(!1!==a&&(c=!0),!0!==a&&(d=!1));l=!!d||!!c&&void 0}else l=null==(u=i.evalOption("unselectableStatus",n,n,t,void 0))?!!n.selected:!!u;return n.partsel&&!n.selected&&n.lazy&&null==n.children&&(l=void 0),n._changeSelectStatusAttrs(l),l}(this),this.visitParents(function(e){for(var n,r,o,s=e.children,a=!0,l=!1,d=0,c=s.length;d<c;d++)n=s[d],i.evalOption("unselectableIgnore",n,n,t,!1)||(((r=null==(o=i.evalOption("unselectableStatus",n,n,t,void 0))?!!n.selected:!!o)||n.partsel)&&(l=!0),r)||(a=!1);e._changeSelectStatusAttrs(r=!!a||!!l&&void 0)})},fromDict:function(t){for(var i in t)y[i]?this[i]=t[i]:"data"===i?e.extend(this.data,t.data):C(t[i])||b[i]||(this.data[i]=t[i]);t.children&&(this.removeChildren(),this.addChildren(t.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 e.inArray(this,this.parent.children)},getIndexHier:function(t,i){t=t||".";var n,r=[];return e.each(this.getParentList(!1,!0),function(e,t){n=""+(t.getIndex()+1),i&&(n=("0000000"+n).substr(-i)),r.push(n)}),r.join(t)},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)for(var e=this.parent.children,t=0,i=e.length-1;t<i;t++)if(e[t]===this)return e[t+1];return null},getParent:function(){return this.parent},getParentList:function(e,t){for(var i=[],n=t?this:this.parent;n;)(e||n.parent)&&i.unshift(n),n=n.parent;return i},getPath:function(e,t,i){i=i||"/";var n,r=[],o=C(t=t||"title");return this.visitParents(function(e){e.parent&&(n=o?t(e):e[t],r.unshift(n))},e=!1!==e),r.join(i)},getPrevSibling:function(){if(this.parent)for(var e=this.parent.children,t=1,i=e.length;t<i;t++)if(e[t]===this)return e[t-1];return null},getSelectedNodes:function(e){var t=[];return this.visit(function(i){if(i.selected&&(t.push(i),!0===e))return"skip"}),t},hasChildren:function(){return this.lazy?null==this.children?void 0:0!==this.children.length&&(1!==this.children.length||!this.children[0].isStatusNode()||void 0):!(!this.children||!this.children.length)},hasClass:function(e){return 0<=(" "+(this.extraClasses||"")+" ").indexOf(" "+e+" ")},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()),S("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(t){if(t&&t.tree===this.tree)for(var i=this.parent;i;){if(i===t)return!0;i===i.parent&&e.error("Recursive parent link: "+i),i=i.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,i=this.tree.enableFilter,n=this.getParentList(!1,!1);if(i&&!this.match&&!this.subMatchCount)return!1;for(e=0,t=n.length;e<t;e++)if(!n[e].expanded)return!1;return!0},lazyLoad:function(t){e.error("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead.")},load:function(e){var t=this,i=this.isExpanded();return w(this.isLazy(),"load() requires a lazy node"),!e&&!this.isUndefined()||(this.isLoaded()&&this.resetLazy(),!1===(e=this.tree._triggerNodeEvent("lazyLoad",this)))?T(this):(w("boolean"!=typeof e,"lazyLoad event must return source in data.result"),e=this.tree._callHook("nodeLoadChildren",this,e),i?(this.expanded=!0,e.always(function(){t.render()})):e.always(function(){t.renderStatus()}),e)},makeVisible:function(t){for(var i=this,n=[],r=new e.Deferred,o=this.getParentList(!1,!1),s=o.length,a=!(t&&!0===t.noAnimation),l=!(t&&!1===t.scrollIntoView),d=s-1;0<=d;d--)n.push(o[d].setExpanded(!0,t));return e.when.apply(e,n).done(function(){l?i.scrollIntoView(a).done(function(){r.resolve()}):r.resolve()}),r.promise()},moveTo:function(t,i,n){void 0===i||"over"===i?i="child":"firstChild"===i&&(t.children&&t.children.length?(i="before",t=t.children[0]):i="child");var r,o=this.tree,s=this.parent,a="child"===i?t:t.parent;if(this!==t){if(this.parent?a.isDescendantOf(this)&&e.error("Cannot move a node to its own descendant"):e.error("Cannot move system root"),a!==s&&s.triggerModifyChild("remove",this),1===this.parent.children.length){if(this.parent===a)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else w(0<=(r=e.inArray(this,this.parent.children)),"invalid source parent"),this.parent.children.splice(r,1);if((this.parent=a).hasChildren())switch(i){case"child":a.children.push(this);break;case"before":w(0<=(r=e.inArray(t,a.children)),"invalid target parent"),a.children.splice(r,0,this);break;case"after":w(0<=(r=e.inArray(t,a.children)),"invalid target parent"),a.children.splice(r+1,0,this);break;default:e.error("Invalid mode "+i)}else a.children=[this];n&&t.visit(n,!0),a===s?a.triggerModifyChild("move",this):a.triggerModifyChild("add",this),o!==t.tree&&(this.warn("Cross-tree moveTo is experimental!"),this.visit(function(e){e.tree=t.tree},!0)),o._callHook("treeStructureChanged",o,"moveTo"),s.isDescendantOf(a)||s.render(),a.isDescendantOf(s)||a===s||a.render()}},navigate:function(t,i){var n=e.ui.keyCode;switch(t){case"left":case n.LEFT:if(this.expanded)return this.setExpanded(!1);break;case"right":case n.RIGHT:if(this.expanded||!this.children&&!this.lazy)break;return this.setExpanded()}if(n=this.findRelatedNode(t)){try{n.makeVisible({scrollIntoView:!1})}catch(t){}return!1===i?(n.setFocus(),T()):n.setActive()}return this.warn("Could not find related node '"+t+"'."),T()},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(t){var i=this.parent,n=e.inArray(this,i.children),r=this;return w(this.isPagingNode(),"replaceWith() currently requires a paging status node"),(t=this.tree._callHook("nodeLoadChildren",this,t)).done(function(e){var t=r.children;for(x=0;x<t.length;x++)t[x].parent=i;i.children.splice.apply(i.children,[n+1,0].concat(t)),r.children=null,r.remove(),i.render()}).fail(function(){r.setExpanded()}),t},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=void 0,this.renderStatus()},scheduleAction:function(t,i){this.tree.timer&&(clearTimeout(this.tree.timer),this.tree.debug("clearTimeout(%o)",this.tree.timer)),this.tree.timer=null;var n=this;switch(t){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){n.tree.debug("setTimeout: trigger expand"),n.setExpanded(!0)},i);break;case"activate":this.tree.timer=setTimeout(function(){n.tree.debug("setTimeout: trigger activate"),n.setActive(!0)},i);break;default:e.error("Invalid mode "+t)}},scrollIntoView:function(t,i){if(void 0!==i&&(n=i).tree&&void 0!==n.statusNodeType)throw Error("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead.");var n=e.extend({effects:!0===t?{duration:200,queue:!1}:t,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent,topNode:null},i),r=(t=n.scrollParent,(i=this.tree.$container).css("overflow-y"));t?t.jquery||(t=e(t)):t=this.tree.tbody||"scroll"!==r&&"auto"!==r?i.scrollParent():i,t[0]!==document&&t[0]!==document.body||(this.debug("scrollIntoView(): normalizing scrollParent to 'window':",t[0]),t=e(window));var o,s,a=new e.Deferred,l=this,d=(r=e(this.span).height(),i=n.scrollOfs.top||0,n.scrollOfs.bottom||0),c=t.height(),u=t.scrollTop(),h=t,f=t[0]===window,p=n.topNode||null,g=null;return this.isRootNode()||!this.isVisible()?(this.info("scrollIntoView(): node is invisible."),T()):(f?(s=e(this.span).offset().top,o=p&&p.span?e(p.span).offset().top:0,h=e("html,body")):(w(t[0]!==document&&t[0]!==document.body,"scrollParent should be a simple element or `window`, not document or body."),f=t.offset().top,s=e(this.span).offset().top-f+u,o=p?e(p.span).offset().top-f+u:0,c-=Math.max(0,t.innerHeight()-t[0].clientHeight)),s<u+i?g=s-i:u+c-d<s+r&&(g=s+r-c+d,p)&&(w(p.isRootNode()||p.isVisible(),"topNode must be visible"),o<g)&&(g=o-i),null===g?a.resolveWith(this):n.effects?(n.effects.complete=function(){a.resolveWith(l)},h.stop(!0).animate({scrollTop:g},n.effects)):(h[0].scrollTop=g,a.resolveWith(this)),a.promise())},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,i){return this.tree._callHook("nodeSetStatus",this,e,t,i)},setTitle:function(e){this.title=e,this.renderTitle(),this.triggerModify("rename")},sortChildren:function(e,t){var i,n,r=this.children;if(r){if(r.sort(e=e||function(e,t){return(e=e.title.toLowerCase())===(t=t.title.toLowerCase())?0:t<e?1:-1}),t)for(i=0,n=r.length;i<n;i++)r[i].children&&r[i].sortChildren(e,"$norender$");"$norender$"!==t&&this.render(),this.triggerModifyChild("sort")}},toDict:function(t,i){var n,r,o,s,a={},l=this;if(e.each(v,function(e,t){!l[t]&&!1!==l[t]||(a[t]=l[t])}),e.isEmptyObject(this.data)||(a.data=e.extend({},this.data),e.isEmptyObject(a.data)&&delete a.data),i){if(!1===(s=i(a,l)))return!1;"skip"===s&&(t=!1)}if(t&&_(this.children))for(a.children=[],n=0,r=this.children.length;n<r;n++)(o=this.children[n]).isStatusNode()||!1!==(s=o.toDict(!0,i))&&a.children.push(s);return a},toggleClass:function(t,i){var n,r,o=t.match(/\S+/g)||[],s=0,a=!1,l=this[this.tree.statusClassPropName],d=" "+(this.extraClasses||"")+" ";for(l&&e(l).toggleClass(t,i);n=o[s++];)if(r=0<=d.indexOf(" "+n+" "),i=void 0===i?!r:!!i)r||(d+=n+" ",a=!0);else for(;-1<d.indexOf(" "+n+" ");)d=d.replace(" "+n+" "," ");return this.extraClasses=N(d),a},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(t,i,n){var r=this.tree.options.modifyChild;r&&(i&&i.parent!==this&&e.error("childNode "+i+" is not a child of "+this),t={node:this,tree:this.tree,operation:t,childNode:i||null},n&&e.extend(t,n),r({type:"modifyChild"},t))},triggerModify:function(e,t){this.parent.triggerModifyChild(e,this,t)},visit:function(e,t){var i,n,r=!0,o=this.children;if((!0!==t||!1!==(r=e(this))&&"skip"!==r)&&o)for(i=0,n=o.length;i<n&&!1!==(r=o[i].visit(e,!0));i++);return r},visitAndLoad:function(t,i,n){var r,o,s,a=this;return!t||!0!==i||!1!==(o=t(a))&&"skip"!==o?a.children||a.lazy?(r=new e.Deferred,s=[],a.load().done(function(){for(var i=0,n=a.children.length;i<n;i++){if(!1===(o=a.children[i].visitAndLoad(t,!0,!0))){r.reject();break}"skip"!==o&&s.push(o)}e.when.apply(this,s).then(function(){r.resolve()})}),r.promise()):T():n?o:T()},visitParents:function(e,t){if(t&&!1===e(this))return!1;for(var i=this.parent;i;){if(!1===e(i))return!1;i=i.parent}return!0},visitSiblings:function(e,t){for(var i,n=this.parent.children,r=0,o=n.length;r<o;r++)if(i=n[r],(t||i!==this)&&!1===e(i))return!1;return!0},warn:function(e){2<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),S("warn",arguments))}},e.extend(I.prototype={_makeHookContext:function(t,i,n){var r,o;return void 0!==t.node?(i&&t.originalEvent!==i&&e.error("invalid args"),r=t):t.tree?r={node:t,tree:o=t.tree,widget:o.widget,options:o.widget.options,originalEvent:i,typeInfo:o.types[t.type]||{}}:t.widget?r={node:null,tree:t,widget:t.widget,options:t.widget.options,originalEvent:i}:e.error("invalid args"),n&&e.extend(r,n),r},_callHook:function(t,i,n){i=this._makeHookContext(i);var r=this[t],o=Array.prototype.slice.call(arguments,2);return C(r)||e.error("_callHook('"+t+"') is not a function"),o.unshift(i),r.apply(this,o)},_setExpiringValue:function(e,t,i){this._tempCache[e]={value:t,expire:Date.now()+(+i||50)}},_getExpiringValue:function(e){var t=this._tempCache[e];return t&&t.expire>Date.now()?t.value:(delete this._tempCache[e],null)},_usesExtension:function(t){return 0<=e.inArray(t,this.options.extensions)},_requireExtension:function(t,i,n,r){null!=n&&(n=!!n);var o=this._local.name,s=this.options.extensions,a=(s=e.inArray(t,s)<e.inArray(o,s),i&&null==this.ext[t]);s=!a&&null!=n&&n!==s;return w(o&&o!==t,"invalid or same name '"+o+"' (require yourself?)"),!a&&!s||(r||(a||i?(r="'"+o+"' extension requires '"+t+"'",s&&(r+=" to be registered "+(n?"before":"after")+" itself")):r="If used together, `"+t+"` must be registered "+(n?"before":"after")+" `"+o+"`"),e.error(r),!1)},activateKey:function(e,t){return(e=this.getNodeByKey(e))?e.setActive(!0,t):this.activeNode&&this.activeNode.setActive(!1,t),e},addPagingNode:function(e,t){return this.rootNode.addPagingNode(e,t)},applyCommand:function(t,i,n){var r;switch(i=i||this.getActiveNode(),t){case"moveUp":(r=i.getPrevSibling())&&(i.moveTo(r,"before"),i.setActive());break;case"moveDown":(r=i.getNextSibling())&&(i.moveTo(r,"after"),i.setActive());break;case"indent":(r=i.getPrevSibling())&&(i.moveTo(r,"child"),r.setExpanded(),i.setActive());break;case"outdent":i.isTopLevel()||(i.moveTo(i.getParent(),"after"),i.setActive());break;case"remove":r=i.getPrevSibling()||i.getParent(),i.remove(),r&&r.setActive();break;case"addChild":i.editCreateNode("child","");break;case"addSibling":i.editCreateNode("after","");break;case"rename":i.editStart();break;case"down":case"first":case"last":case"left":case"parent":case"right":case"up":return i.navigate(t);default:e.error("Unhandled command: '"+t+"'")}},applyPatch:function(t){for(var i,n,r,o,s=t.length,a=[],l=0;l<s;l++)w(2===(r=t[l]).length,"patchList must be an array of length-2-arrays"),n=r[0],r=r[1],(o=null===n?this.rootNode:this.getNodeByKey(n))?(i=new e.Deferred,a.push(i),o.applyPatch(r).always(L(i,o))):this.warn("could not find node with key '"+n+"'");return e.when.apply(e,a).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()),S("log",arguments))},destroy:function(){this.widget.destroy()},enable:function(e){!1===e?this.widget.disable():this.widget.enable()},enableUpdate:function(e){return!!this._enableUpdate==!!(e=!1!==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()),S("error",arguments))},expandAll:function(e,t){var i=this.enableUpdate(!1);e=!1!==e,this.visit(function(i){!1!==i.hasChildren()&&i.isExpanded()!==e&&i.setExpanded(e,t)}),this.enableUpdate(i)},findAll:function(e){return this.rootNode.findAll(e)},findFirst:function(e){return this.rootNode.findFirst(e)},findNextNode:function(e,t){var i,n=null,r=this.getFirstChild();function o(i){if((n=e(i)?i:n)||i===t)return!1}return e="string"==typeof e?(i=new RegExp("^"+e,"i"),function(e){return i.test(e.title)}):e,t=t||r,this.visitRows(o,{start:t,includeSelf:!1}),n||t===r||this.visitRows(o,{start:r,includeSelf:!0}),n},findRelatedNode:function(t,i,n){var r=null,o=e.ui.keyCode;switch(i){case"parent":case o.BACKSPACE:t.parent&&t.parent.parent&&(r=t.parent);break;case"first":case o.HOME:this.visit(function(e){if(e.isVisible())return r=e,!1});break;case"last":case o.END:this.visit(function(e){e.isVisible()&&(r=e)});break;case"left":case o.LEFT:t.expanded?t.setExpanded(!1):t.parent&&t.parent.parent&&(r=t.parent);break;case"right":case o.RIGHT:t.expanded||!t.children&&!t.lazy?t.children&&t.children.length&&(r=t.children[0]):(t.setExpanded(),r=t);break;case"up":case o.UP:this.visitRows(function(e){return r=e,!1},{start:t,reverse:!0,includeSelf:!1});break;case"down":case o.DOWN:this.visitRows(function(e){return r=e,!1},{start:t,includeSelf:!1});break;default:this.tree.warn("Unknown relation '"+i+"'.")}return r},generateFormElements:function(t,i,n){n=n||{};var r="string"==typeof t?t:"ft_"+this._id+"[]",o="string"==typeof i?i:"ft_"+this._id+"_active",s="fancytree_result_"+this._id,a=e("#"+s),l=3===this.options.selectMode&&!1!==n.stopOnParents;function d(t){a.append(e("<input>",{type:"checkbox",name:r,value:t.key,checked:!0}))}a.length?a.empty():a=e("<div>",{id:s}).hide().insertAfter(this.$container),!1!==i&&this.activeNode&&a.append(e("<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!==t&&(s=this.getSelectedNodes(l),e.each(s,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(e,t){var i,n;return!t&&(i=document.getElementById(this.options.idPrefix+e))?i.ftnode||null:(t=t||this.rootNode,n=null,e=""+e,t.visit(function(t){if(t.key===e)return n=t,!1},!0),n)},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()),S("info",arguments))},isLoading:function(){var e=!1;return this.rootNode.visit(function(t){if(t._isLoading||t._requestId)return!(e=!0)},!0),e},loadKeyPath:function(t,i){var n,r,o,s=this,a=new e.Deferred,l=this.getRootNode(),d=this.options.keyPathSeparator,c=[],u=e.extend({},i);for("function"==typeof i?n=i:i&&i.callback&&(n=i.callback),u.callback=function(e,t,i){n&&n.call(e,t,i),a.notifyWith(e,[{node:t,status:i}])},null==u.matchKey&&(u.matchKey=function(e,t){return e.key===t}),_(t)||(t=[t]),r=0;r<t.length;r++)(o=t[r]).charAt(0)===d&&(o=o.substr(1)),c.push(o.split(d));return setTimeout(function(){s._loadKeyPathImpl(a,u,l,c).done(function(){a.resolve()})},0),a.promise()},_loadKeyPathImpl:function(t,i,n,r){var o,s,a,l,d,c,u,h,f,p,g=this;for(u={},s=0;s<r.length;s++)for(f=r[s],h=n;f.length;){if(a=f.shift(),!(l=function(e,t){var n,r,o=e.children;if(o)for(n=0,r=o.length;n<r;n++)if(i.matchKey(o[n],t))return o[n];return null}(h,a))){this.warn("loadKeyPath: key not found: "+a+" (parent: "+h+")"),i.callback(this,a,"error");break}if(0===f.length){i.callback(this,l,"ok");break}if(l.lazy&&void 0===l.hasChildren()){i.callback(this,l,"loaded"),u[a=l.key]?u[a].pathSegList.push(f):u[a]={parent:l,pathSegList:[f]};break}i.callback(this,l,"loaded"),h=l}for(d in o=[],u)k(u,d)&&(c=u[d],p=new e.Deferred,o.push(p),function(e,t,n){i.callback(g,t,"loading"),t.load().done(function(){g._loadKeyPathImpl.call(g,e,i,t,n).always(L(e,g))}).fail(function(n){g.warn("loadKeyPath: error loading lazy "+t),i.callback(g,l,"error"),e.rejectWith(g)})}(p,c.parent,c.pathSegList));return e.when.apply(e,o).promise()},reactivate:function(e){var t,i=this.activeNode;return i?(this.activeNode=null,t=i.setActive(!0,{noFocus:!0}),e&&i.setFocus(),t):T()},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(e){this.visit(function(t){t.setSelected(e)})},setFocus:function(e){return this._callHook("treeSetFocus",this,e)},setOption:function(e,t){return this.widget.option(e,t)},debugTime:function(e){4<=this.options.debugLevel&&window.console.time(this+" - "+e)},debugTimeEnd:function(e){4<=this.options.debugLevel&&window.console.timeEnd(this+" - "+e)},toDict:function(e,t){return t=this.rootNode.toDict(!0,t),e?t:t.children},toString:function(){return"Fancytree@"+this._id},_triggerNodeEvent:function(e,t,i,n){return t=this._makeHookContext(t,i,n),!1!==(n=this.widget._trigger(e,i,t))&&void 0!==t.result?t.result:n},_triggerTreeEvent:function(e,t,i){return i=this._makeHookContext(this,t,i),!1!==(e=this.widget._trigger(e,t,i))&&void 0!==i.result?i.result:e},visit:function(e){return this.rootNode.visit(e,!1)},visitRows:function(e,t){if(!this.rootNode.hasChildren())return!1;if(t&&t.reverse)return delete t.reverse,this._visitRowsUp(e,t);for(var i,n,r,o=0,s=!1===(t=t||{}).includeSelf,a=!!t.includeHidden,l=!a&&this.enableFilter,d=t.start||this.rootNode.children[0],c=d.parent;c;){for(w(0<=(n=(r=c.children).indexOf(d)+o),"Could not find "+d+" in parent's children: "+c),i=n;i<r.length;i++)if(d=r[i],!l||d.match||d.subMatchCount){if(!s&&!1===e(d))return!1;if(s=!1,d.children&&d.children.length&&(a||d.expanded)&&!1===d.visit(function(t){return!l||t.match||t.subMatchCount?!1!==e(t)&&(a||!t.children||t.expanded?void 0:"skip"):"skip"},!1))return!1}c=(d=c).parent,o=1}return!0},_visitRowsUp:function(e,t){for(var i,n,r,o=!!t.includeHidden,s=t.start||this.rootNode.children[0];;){if((i=(r=s.parent).children)[0]===s){if(!(s=r).parent)break;i=r.children}else for(n=i.indexOf(s),s=i[n-1];(o||s.expanded)&&s.children&&s.children.length;)s=(i=(r=s).children)[i.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()),S("warn",arguments))}},{nodeClick:function(e){var t,i,n=e.targetType,r=e.node;if("expander"===n)r.isLoading()?r.debug("Got 2nd click while loading: ignored"):this._callHook("nodeToggleExpanded",e);else if("checkbox"===n)this._callHook("nodeToggleSelected",e),e.options.focusOnSelect&&this._callHook("nodeSetFocus",e,!0);else{if(t=!(i=!1),r.folder)switch(e.options.clickFolderMode){case 2:t=!(i=!0);break;case 3:i=t=!0}t&&(this.nodeSetFocus(e),this._callHook("nodeSetActive",e,!0)),i&&this._callHook("nodeToggleExpanded",e)}},nodeCollapseSiblings:function(e,t){var i,n,r,o=e.node;if(o.parent)for(n=0,r=(i=o.parent.children).length;n<r;n++)i[n]!==o&&i[n].expanded&&this._callHook("nodeSetExpanded",i[n],!1,t)},nodeDblclick:function(e){"title"===e.targetType&&4===e.options.clickFolderMode&&this._callHook("nodeToggleExpanded",e),"title"===e.targetType&&e.originalEvent.preventDefault()},nodeKeydown:function(t){var n,r=t.originalEvent,o=t.node,s=t.tree,a=t.options,l=r.which,d=r.key||String.fromCharCode(l),h=!!(r.altKey||r.ctrlKey||r.metaKey),f=(l=!u[l]&&!c[l]&&!h,h=e(r.target),!0),p=!(r.ctrlKey||!a.autoActivate);if(o||(n=this.getActiveNode()||this.getFirstChild())&&(n.setFocus(),(o=t.node=this.focusNode).debug("Keydown force focus on active node")),a.quicksearch&&l&&!h.is(":input:enabled"))500<(n=Date.now())-s.lastQuicksearchTime&&(s.lastQuicksearchTerm=""),s.lastQuicksearchTime=n,s.lastQuicksearchTerm+=d,(l=s.findNextNode(s.lastQuicksearchTerm,s.getActiveNode()))&&l.setActive(),r.preventDefault();else{switch(i.eventToString(r)){case"+":case"=":s.nodeSetExpanded(t,!0);break;case"-":s.nodeSetExpanded(t,!1);break;case"space":o.isPagingNode()?s._triggerNodeEvent("clickPaging",t,r):i.evalOption("checkbox",o,o,a,!1)?s.nodeToggleSelected(t):s.nodeSetActive(t,!0);break;case"return":s.nodeSetActive(t,!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(t,i){var n,r,o,l=null,d=!0,c=t.tree,u=t.node,h=u.parent,f="nodeLoadChildren",p=Date.now();return C(i)&&w(!C(i=i.call(c,{type:"source"},t)),"source callback must not return another function"),C(i.then)?l=i:i.url?l=(n=e.extend({},t.options.ajax,i)).debugDelay?(r=n.debugDelay,delete n.debugDelay,_(r)&&(r=r[0]+Math.random()*(r[1]-r[0])),u.warn("nodeLoadChildren waiting debugDelay "+Math.round(r)+" ms ..."),e.Deferred(function(t){setTimeout(function(){e.ajax(n).done(function(){t.resolveWith(this,arguments)}).fail(function(){t.rejectWith(this,arguments)})},r)})):e.ajax(n):e.isPlainObject(i)||_(i)?d=!(l={then:function(e,t){e(i,null,null)}}):e.error("Invalid source type: "+i),u._requestId&&(u.warn("Recursive load request #"+p+" while #"+u._requestId+" is pending."),u._requestId=p),d&&(c.debugTime(f),c.nodeSetStatus(t,"loading")),o=new e.Deferred,l.then(function(n,r,l){var d,f;if("json"!==i.dataType&&"jsonp"!==i.dataType||"string"!=typeof n||e.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),u._requestId&&u._requestId>p)o.rejectWith(this,[s]);else if(null===u.parent&&null!==h)o.rejectWith(this,[a]);else{if(t.options.postProcess){try{(f=c._triggerNodeEvent("postProcess",t,t.originalEvent,{response:n,error:null,dataType:i.dataType})).error&&c.warn("postProcess returned error:",f)}catch(n){f={error:n,message:""+n,details:"postProcess failed"}}if(f.error)return d=e.isPlainObject(f.error)?f.error:{message:f.error},d=c._makeHookContext(u,null,d),void o.rejectWith(this,[d]);(_(f)||e.isPlainObject(f)&&_(f.children))&&(n=f)}else n&&k(n,"d")&&t.options.enableAspx&&(42===t.options.enableAspx&&c.warn("The default for enableAspx will change to `false` in the fututure. Pass `enableAspx: true` or implement postProcess to silence this warning."),n="string"==typeof n.d?e.parseJSON(n.d):n.d);o.resolveWith(this,[n])}},function(e,t,i){e=c._makeHookContext(u,null,{error:e,args:Array.prototype.slice.call(arguments),message:i,details:e.status+": "+i}),o.rejectWith(this,[e])}),o.done(function(i){var n,r,o;c.nodeSetStatus(t,"ok"),e.isPlainObject(i)?(w(u.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),w(_(i.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),n=(r=i).children,delete r.children,e.each(g,function(e,t){void 0!==r[t]&&(c[t]=r[t],delete r[t])}),e.extend(c.data,r)):n=i,w(_(n),"expected array of children"),u._setChildren(n),c.options.nodata&&0===n.length&&(C(c.options.nodata)?o=c.options.nodata.call(c,{type:"nodata"},t):!0===c.options.nodata&&u.isRootNode()?o=c.options.strings.noData:"string"==typeof c.options.nodata&&u.isRootNode()&&(o=c.options.nodata),o)&&u.setStatus("nodata",o),c._triggerNodeEvent("loadChildren",u)}).fail(function(e){var i;e===s?u.warn("Ignored response for obsolete load request #"+p+" (expected #"+u._requestId+")"):e===a?u.warn("Lazy parent node was removed while loading: discarding response."):(e.node&&e.error&&e.message?i=e:"[object Object]"===(i=c._makeHookContext(u,null,{error:e,args:Array.prototype.slice.call(arguments),message:e?e.message||e.toString():""})).message&&(i.message=""),u.warn("Load children failed ("+i.message+")",i),!1!==c._triggerNodeEvent("loadError",i,null)&&c.nodeSetStatus(t,"error",i.message,i.details))}).always(function(){u._requestId=null,d&&c.debugTimeEnd(f)}),o.promise()},nodeLoadKeyPath:function(e,t){},nodeRemoveChild:function(t,i){var n=t.node,r=e.extend({},t,{node:i}),o=n.children;if(1===o.length)return w(i===o[0],"invalid single child"),this.nodeRemoveChildren(t);this.activeNode&&(i===this.activeNode||this.activeNode.isDescendantOf(i))&&this.activeNode.setActive(!1),this.focusNode&&(i===this.focusNode||this.focusNode.isDescendantOf(i))&&(this.focusNode=null),this.nodeRemoveMarkup(r),this.nodeRemoveChildren(r),w(0<=(t=e.inArray(i,o)),"invalid child"),n.triggerModifyChild("remove",i),i.visit(function(e){e.parent=null},!0),this._callHook("treeRegisterNode",this,!1,i),o.splice(t,1)},nodeRemoveChildMarkup:function(t){(t=t.node).ul&&(t.isRootNode()?e(t.ul).empty():(e(t.ul).remove(),t.ul=null),t.visit(function(e){e.li=e.ul=null}))},nodeRemoveChildren:function(e){var t=e.tree,i=e.node;i.children&&(this.activeNode&&this.activeNode.isDescendantOf(i)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(i)&&(this.focusNode=null),this.nodeRemoveChildMarkup(e),i.triggerModifyChild("remove",null),i.visit(function(e){e.parent=null,t._callHook("treeRegisterNode",t,!1,e)}),i.lazy?i.children=[]:i.children=null,i.isRootNode()||(i.expanded=!1),this.nodeRenderStatus(e))},nodeRemoveMarkup:function(t){var i=t.node;i.li&&(e(i.li).remove(),i.li=null),this.nodeRemoveChildMarkup(t)},nodeRender:function(t,i,n,r,o){var s,a,l,d,c,u,h,f=t.node,p=t.tree,g=t.options,v=g.aria,y=!1,m=f.parent,b=!m,x=f.children,_=null;if(!1!==p._enableUpdate&&(b||m.ul)){if(w(b||m.ul,"parent UL must exist"),b||(f.li&&(i||f.li.parentNode!==f.parent.ul)&&(f.li.parentNode===f.parent.ul?_=f.li.nextSibling:this.debug("Unlinking "+f+" (must be child of "+f.parent+")"),this.nodeRemoveMarkup(t)),f.li?this.nodeRenderStatus(t):(y=!0,f.li=document.createElement("li"),(f.li.ftnode=f).key&&g.generateIds&&(f.li.id=g.idPrefix+f.key),f.span=document.createElement("span"),f.span.className="fancytree-node",v&&!f.tr&&e(f.li).attr("role","treeitem"),f.li.appendChild(f.span),this.nodeRenderTitle(t),g.createNode&&g.createNode.call(p,{type:"createNode"},t)),g.renderNode&&g.renderNode.call(p,{type:"renderNode"},t)),x){if(b||f.expanded||!0===n){for(f.ul||(f.ul=document.createElement("ul"),(!0!==r||o)&&f.expanded||(f.ul.style.display="none"),v&&e(f.ul).attr("role","group"),f.li?f.li.appendChild(f.ul):f.tree.$div.append(f.ul)),d=0,c=x.length;d<c;d++)h=e.extend({},t,{node:x[d]}),this.nodeRender(h,i,n,!1,!0);for(s=f.ul.firstChild;s;)s=(l=s.ftnode)&&l.parent!==f?(f.debug("_fixParent: remove missing "+l,s),u=s.nextSibling,s.parentNode.removeChild(s),u):s.nextSibling;for(s=f.ul.firstChild,d=0,c=x.length-1;d<c;d++)(a=x[d])===(l=s.ftnode)?s=s.nextSibling:f.ul.insertBefore(a.li,l.li)}}else f.ul&&(this.warn("remove child markup for "+f),this.nodeRemoveChildMarkup(t));b||y&&m.ul.insertBefore(f.li,_)}},nodeRenderTitle:function(t,r){var o,s=t.node,a=t.tree,l=t.options,d=l.aria,c=s.getLevel(),u=[];void 0!==r&&(s.title=r),s.span&&!1!==a._enableUpdate&&(r=d&&!1!==s.hasChildren()?" role='button'":"",c<l.minExpandLevel?(s.lazy||(s.expanded=!0),1<c&&u.push("<span "+r+" class='fancytree-expander fancytree-expander-fixed'></span>")):u.push("<span "+r+" class='fancytree-expander'></span>"),(c=i.evalOption("checkbox",s,s,l,!1))&&!s.isStatusNode()&&(o="fancytree-checkbox",("radio"===c||s.parent&&s.parent.radiogroup)&&(o+=" fancytree-radio"),u.push("<span "+(r=d?" role='checkbox'":"")+" class='"+o+"'></span>")),void 0!==s.data.iconClass&&(s.icon?e.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(s.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),s.icon=s.data.iconClass)),!1!==(c=i.evalOption("icon",s,s,l,!0))&&(r=d?" role='presentation'":"",o=(o=i.evalOption("iconTooltip",s,s,l,null))?" title='"+P(o)+"'":"","string"==typeof c?n.test(c)?(c="/"===c.charAt(0)?c:(l.imagePath||"")+c,u.push("<img src='"+c+"' class='fancytree-icon'"+o+" alt='' />")):u.push("<span "+r+" class='fancytree-custom-icon "+c+"'"+o+"></span>"):c.text?u.push("<span "+r+" class='fancytree-custom-icon "+(c.addClass||"")+"'"+o+">"+i.escapeHtml(c.text)+"</span>"):c.html?u.push("<span "+r+" class='fancytree-custom-icon "+(c.addClass||"")+"'"+o+">"+c.html+"</span>"):u.push("<span "+r+" class='fancytree-icon'"+o+"></span>")),d="",d=(d=l.renderTitle?l.renderTitle.call(a,{type:"renderTitle"},t)||"":d)||"<span class='fancytree-title'"+(c=(c=!0===(c=i.evalOption("tooltip",s,s,l,null))?s.title:c)?" title='"+P(c)+"'":"")+(l.titlesTabbable?" tabindex='0'":"")+">"+(l.escapeTitles?i.escapeHtml(s.title):s.title)+"</span>",u.push(d),s.span.innerHTML=u.join(""),this.nodeRenderStatus(t),l.enhanceTitle)&&(t.$title=e(">span.fancytree-title",s.span),l.enhanceTitle.call(a,{type:"enhanceTitle"},t))},nodeRenderStatus:function(t){var n,r=t.node,o=t.tree,s=(t=t.options,r.hasChildren()),a=r.isLastSibling(),l=t.aria,d=t._classNames,c=[],u=r[o.statusClassPropName];u&&!1!==o._enableUpdate&&(l&&(n=e(r.tr||r.li)),c.push(d.node),o.activeNode===r&&c.push(d.active),o.focusNode===r&&c.push(d.focused),r.expanded&&c.push(d.expanded),l&&(!1===s?n.removeAttr("aria-expanded"):n.attr("aria-expanded",Boolean(r.expanded))),r.folder&&c.push(d.folder),!1!==s&&c.push(d.hasChildren),a&&c.push(d.lastsib),r.lazy&&null==r.children&&c.push(d.lazy),r.partload&&c.push(d.partload),r.partsel&&c.push(d.partsel),i.evalOption("unselectable",r,r,t,!1)&&c.push(d.unselectable),r._isLoading&&c.push(d.loading),r._error&&c.push(d.error),r.statusNodeType&&c.push(d.statusNodePrefix+r.statusNodeType),r.selected?(c.push(d.selected),l&&n.attr("aria-selected",!0)):l&&n.attr("aria-selected",!1),r.extraClasses&&c.push(r.extraClasses),c.push(!1===s?d.combinedExpanderPrefix+"n"+(a?"l":""):d.combinedExpanderPrefix+(r.expanded?"e":"c")+(r.lazy&&null==r.children?"d":"")+(a?"l":"")),c.push(d.combinedIconPrefix+(r.expanded?"e":"c")+(r.folder?"f":"")),u.className=c.join(" "),r.li)&&e(r.li).toggleClass(d.lastsib,a)},nodeSetActive:function(t,i,n){var r=t.node,o=t.tree,s=t.options,a=!0===(n=n||{}).noEvents,l=!0===n.noFocus,d=(n=!1!==n.scrollIntoView,r===o.activeNode);if(d!=(i=!1!==i)){if(n&&t.originalEvent&&e(t.originalEvent.target).is("a,:checkbox")&&(r.info("Not scrolling while clicking an embedded link."),n=!1),i&&!a&&!1===this._triggerNodeEvent("beforeActivate",r,t.originalEvent))return A(r,["rejected"]);i?(o.activeNode&&(w(o.activeNode!==r,"node was active (inconsistency)"),d=e.extend({},t,{node:o.activeNode}),o.nodeSetActive(d,!1),w(null===o.activeNode,"deactivate was out of sync?")),s.activeVisible&&r.makeVisible({scrollIntoView:n}),o.activeNode=r,o.nodeRenderStatus(t),l||o.nodeSetFocus(t),a||o._triggerNodeEvent("activate",r,t.originalEvent)):(w(o.activeNode===r,"node was not active (inconsistency)"),o.activeNode=null,this.nodeRenderStatus(t),a||t.tree._triggerNodeEvent("deactivate",r,t.originalEvent))}return T(r)},nodeSetExpanded:function(t,i,n){var r,o,s,a,l,d,c=t.node,u=t.tree,h=t.options,f=!0===(n=n||{}).noAnimation,p=!0===n.noEvents;if(i=!1!==i,e(c.li).hasClass(h._classNames.animating))return c.warn("setExpanded("+i+") while animating: ignored."),A(c,["recursion"]);if(c.expanded&&i||!c.expanded&&!i)return T(c);if(i&&!c.lazy&&!c.hasChildren())return T(c);if(!i&&c.getLevel()<h.minExpandLevel)return A(c,["locked"]);if(!p&&!1===this._triggerNodeEvent("beforeExpand",c,t.originalEvent))return A(c,["rejected"]);if(f||c.isVisible()||(f=n.noAnimation=!0),o=new e.Deferred,i&&!c.expanded&&h.autoCollapse){l=c.getParentList(!1,!0),d=h.autoCollapse;try{for(h.autoCollapse=!1,s=0,a=l.length;s<a;s++)this._callHook("nodeCollapseSiblings",l[s],n)}finally{h.autoCollapse=d}}return o.done(function(){var e=c.getLastChild();i&&h.autoScroll&&!f&&e&&u._enableUpdate?e.scrollIntoView(!0,{topNode:c}).always(function(){p||t.tree._triggerNodeEvent(i?"expand":"collapse",t)}):p||t.tree._triggerNodeEvent(i?"expand":"collapse",t)}),r=function(n){var r=h._classNames,o=h.toggleEffect;if(c.expanded=i,u._callHook("treeStructureChanged",t,i?"expand":"collapse"),u._callHook("nodeRender",t,!1,!1,!0),c.ul)if("none"!==c.ul.style.display==!!c.expanded)c.warn("nodeSetExpanded: UL.style.display already set");else{if(o&&!f)return e(c.li).addClass(r.animating),void(C(e(c.ul)[o.effect])?e(c.ul)[o.effect]({duration:o.duration,always:function(){e(this).removeClass(r.animating),e(c.li).removeClass(r.animating),n()}}):(e(c.ul).stop(!0,!0),e(c.ul).parent().find(".ui-effects-placeholder").remove(),e(c.ul).toggle(o.effect,o.options,o.duration,function(){e(this).removeClass(r.animating),e(c.li).removeClass(r.animating),n()})));c.ul.style.display=c.expanded||!parent?"":"none"}n()},i&&c.lazy&&void 0===c.hasChildren()?c.load().done(function(){o.notifyWith&&o.notifyWith(c,["loaded"]),r(function(){o.resolveWith(c)})}).fail(function(e){r(function(){o.rejectWith(c,["load failed ("+e+")"])})}):r(function(){o.resolveWith(c)}),o.promise()},nodeSetFocus:function(t,i){var n,r=t.tree,o=t.node,s=r.options,a=!!t.originalEvent&&e(t.originalEvent.target).is(":input");if(i=!1!==i,r.focusNode){if(r.focusNode===o&&i)return;n=e.extend({},t,{node:r.focusNode}),r.focusNode=null,this._triggerNodeEvent("blur",n),this._callHook("nodeRenderStatus",n)}i&&(this.hasFocus()||(o.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",t,!0,{calledByNode:!0})),o.makeVisible({scrollIntoView:!1}),r.focusNode=o,s.titlesTabbable&&!a&&e(o.span).find(".fancytree-title").trigger("focus"),s.aria&&e(r.$container).attr("aria-activedescendant",e(o.tr||o.li).uniqueId().attr("id")),this._triggerNodeEvent("focus",t),document.activeElement===r.$container.get(0)||1<=e(document.activeElement,r.$container).length||e(r.$container).trigger("focus"),s.autoScroll&&o.scrollIntoView(),this._callHook("nodeRenderStatus",t))},nodeSetSelected:function(e,t,n){var r=e.node,o=e.tree,s=e.options,a=!0===(n=n||{}).noEvents,l=r.parent;if(t=!1!==t,!i.evalOption("unselectable",r,r,s,!1))return r._lastSelectIntent=t,!!r.selected!==t||3===s.selectMode&&r.partsel&&!t?a||!1!==this._triggerNodeEvent("beforeSelect",r,e.originalEvent)?(t&&1===s.selectMode?(o.lastSelectedNode&&o.lastSelectedNode.setSelected(!1),r.selected=t):3!==s.selectMode||!l||l.radiogroup||r.radiogroup?l&&l.radiogroup?r.visitSiblings(function(e){e._changeSelectStatusAttrs(t&&e===r)},!0):r.selected=t:(r.selected=t,r.fixSelection3AfterClick(n)),this.nodeRenderStatus(e),o.lastSelectedNode=t?r:null,void(a||o._triggerNodeEvent("select",e))):!!r.selected:t},nodeSetStatus:function(t,i,n,r){var o=t.node,s=t.tree;function a(i,n){var r=o.children?o.children[0]:null;r&&r.isStatusNode()?(e.extend(r,i),r.statusNodeType=n,s._callHook("nodeRenderTitle",r)):(o._setChildren([i]),s._callHook("treeStructureChanged",t,"setStatusNode"),o.children[0].statusNodeType=n,s.render()),o.children[0]}switch(i){case"ok":var l=o.children?o.children[0]:null;if(l&&l.isStatusNode()){try{o.ul&&(o.ul.removeChild(l.li),l.li=null)}catch(i){}1===o.children.length?o.children=[]:o.children.shift(),s._callHook("treeStructureChanged",t,"clearStatusNode")}o._isLoading=!1,o._error=null,o.renderStatus();break;case"loading":o.parent||a({title:s.options.strings.loading+(n?" ("+n+")":""),checkbox:!1,tooltip:r},i),o._isLoading=!0,o._error=null,o.renderStatus();break;case"error":a({title:s.options.strings.loadError+(n?" ("+n+")":""),checkbox:!1,tooltip:r},i),o._isLoading=!1,o._error={message:n,details:r},o.renderStatus();break;case"nodata":a({title:n||s.options.strings.noData,checkbox:!1,tooltip:r},i),o._isLoading=!1,o._error=null,o.renderStatus();break;default:e.error("invalid node status "+i)}},nodeToggleExpanded:function(e){return this.nodeSetExpanded(e,!e.node.expanded)},nodeToggleSelected:function(e){var t=e.node,i=!t.selected;return t.partsel&&!t.selected&&!0===t._lastSelectIntent&&(t.selected=!(i=!1)),t._lastSelectIntent=i,this.nodeSetSelected(e,i)},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(t){var i=t.tree,n=i.options;i.$container.attr("tabindex",n.tabindex),e.each(g,function(e,t){void 0!==n[t]&&(i.info("Move option "+t+" to tree"),i[t]=n[t],delete n[t])}),n.checkboxAutoHide&&i.$container.addClass("fancytree-checkbox-auto-hide"),n.rtl?i.$container.attr("DIR","RTL").addClass("fancytree-rtl"):i.$container.removeAttr("DIR").removeClass("fancytree-rtl"),n.aria&&(i.$container.attr("role","tree"),1!==n.selectMode)&&i.$container.attr("aria-multiselectable",!0),this.treeLoad(t)},treeLoad:function(t,n){var r,o,s,a=t.tree,l=t.widget.element,d=e.extend({},t,{node:this.rootNode});if(a.rootNode.children&&this.treeClear(t),n=n||this.options.source)"string"==typeof n&&e.error("Not implemented");else switch(o=l.data("type")||"html"){case"html":(s=l.find(">ul").not(".fancytree-container").first()).length?(s.addClass("ui-fancytree-source fancytree-helper-hidden"),n=e.ui.fancytree.parseHtml(s),this.data=e.extend(this.data,H(s))):(i.warn("No `source` option was passed and container does not contain `<ul>`: assuming `source: []`."),n=[]);break;case"json":n=e.parseJSON(l.text()),l.contents().filter(function(){return 3===this.nodeType}).remove(),e.isPlainObject(n)&&(w(_(n.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),n=(r=n).children,delete r.children,e.each(g,function(e,t){void 0!==r[t]&&(a[t]=r[t],delete r[t])}),e.extend(a.data,r));break;default:e.error("Invalid data-type: "+o)}return a._triggerTreeEvent("preInit",null),this.nodeLoadChildren(d,n).done(function(){a._callHook("treeStructureChanged",t,"loadChildren"),a.render(),3===t.options.selectMode&&a.rootNode.fixSelection3FromEndNodes(),a.activeNode&&a.options.activeVisible&&a.activeNode.makeVisible(),a._triggerTreeEvent("init",null,{status:!0})}).fail(function(){a.render(),a._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(e,t,i){e.tree._callHook("treeStructureChanged",e,t?"addNode":"removeNode")},treeSetFocus:function(t,i,n){(i=!1!==i)!==this.hasFocus()&&(!(this._hasFocus=i)&&this.focusNode?this.focusNode.setFocus(!1):!i||n&&n.calledByNode||e(this.$container).trigger("focus"),this.$container.toggleClass("fancytree-treefocus",i),this._triggerTreeEvent(i?"focusTree":"blurTree"),i)&&!this.activeNode&&(n=this._lastMousedownNode||this.getFirstChild())&&n.setFocus()},treeSetOption:function(t,i,n){var r=t.tree,o=!0,s=!1,a=!1;switch(i){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":a=s=!0;break;case"checkboxAutoHide":r.$container.toggleClass("fancytree-checkbox-auto-hide",!!n);break;case"escapeTitles":case"tooltip":a=!0;break;case"rtl":!1===n?r.$container.removeAttr("DIR").removeClass("fancytree-rtl"):r.$container.attr("DIR","RTL").addClass("fancytree-rtl"),a=!0;break;case"source":o=!1,r._callHook("treeLoad",r,n),a=!0}r.debug("set option "+i+"="+n+" <"+typeof n+">"),o&&(this.widget._super||e.Widget.prototype._setOption).call(this.widget,i,n),s&&r._callHook("treeCreate",r),a&&r.render(!0,!1)},treeStructureChanged:function(e,t){}}),e.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,copyFunctionsToData:!1,debugLevel:null,disabled:!1,enableAspx:42,escapeTitles:!1,extensions:[],focusOnSelect:!1,generateIds:!1,icon:!0,idPrefix:"ft_",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,toggleEffect:{effect:"slideToggle",duration:200},tooltip:!1,treeId:null,_classNames:{active:"fancytree-active",animating:"fancytree-animating",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",error:"fancytree-error",expanded:"fancytree-expanded",focused:"fancytree-focused",folder:"fancytree-folder",hasChildren:"fancytree-has-children",lastsib:"fancytree-lastsib",lazy:"fancytree-lazy",loading:"fancytree-loading",node:"fancytree-node",partload:"fancytree-partload",partsel:"fancytree-partsel",radio:"fancytree-radio",selected:"fancytree-selected",statusNodePrefix:"fancytree-statusnode-",unselectable:"fancytree-unselectable"},lazyLoad:null,postProcess:null},_deprecationWarning:function(e){var t=this.tree;t&&3<=t.options.debugLevel&&t.warn("$().fancytree('"+e+"') is deprecated (see https://wwwendt.de/tech/fancytree/doc/jsdoc/Fancytree_Widget.html")},_create:function(){this.tree=new I(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul").first();for(var t,i,n=this.options,r=n.extensions,o=(this.tree,0);o<r.length;o++){i=r[o],(t=e.ui.fancytree._extensions[i])||e.error("Could not apply extension '"+i+"' (it is not registered, did you forget to include it?)"),this.tree.options[i]=function t(i){var n,r,o,s,a=i||{},l=1,d=arguments.length;if("object"==typeof a||C(a)||(a={}),l===d)throw Error("need at least two args");for(;l<d;l++)if(null!=(n=arguments[l]))for(r in n)k(n,r)&&(s=a[r],a!==(o=n[r]))&&(o&&e.isPlainObject(o)?(s=s&&e.isPlainObject(s)?s:{},a[r]=t(s,o)):void 0!==o&&(a[r]=o));return a}({},t.options,this.tree.options[i]),w(void 0===this.tree.ext[i],"Extension name must not exist as Fancytree.ext attribute: '"+i+"'"),this.tree.ext[i]={},s=a=void 0;var s,a=this.tree,l=t,d=i;for(s in l)"function"==typeof l[s]?"function"==typeof a[s]?a[s]=E(s,a,0,l,d):"_"===s.charAt(0)?a.ext[d][s]=E(s,a,0,l,d):e.error("Could not override tree."+s+". Use prefix '_' to create tree."+d+"._"+s):"options"!==s&&(a.ext[d][s]=l[s])}void 0!==n.icons&&(!0===n.icon?(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),n.icon=n.icons):e.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead")),void 0!==n.iconClass&&(n.icon?e.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"),n.icon=n.iconClass)),void 0!==n.tabbable&&(n.tabindex=n.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+n.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)},_unbind:function(){var t=this.tree._ns;this.element.off(t),this.tree.$container.off(t),e(document).off(t)},_bind:function(){var t=this,n=this.options,r=this.tree,o=r._ns;this._unbind(),r.$container.on("focusin"+o+" focusout"+o,function(t){var n=i.getNode(t),o="focusin"===t.type;if(!o&&n&&e(t.target).is("a"))n.debug("Ignored focusout on embedded <a> element.");else{if(o){if(r._getExpiringValue("focusin"))return void r.debug("Ignored double focusin.");r._setExpiringValue("focusin",!0,50),n||(n=r._getExpiringValue("mouseDownNode"))&&r.debug("Reconstruct mouse target for focusin from recent event.")}n?r._callHook("nodeSetFocus",r._makeHookContext(n,t),o):r.tbody&&e(t.target).parents("table.fancytree-container > thead").length?r.debug("Ignore focus event outside table body.",t):r._callHook("treeSetFocus",r,o)}}).on("selectstart"+o,"span.fancytree-title",function(e){e.preventDefault()}).on("keydown"+o,function(e){if(n.disabled||!1===n.keyboard)return!0;var t,i=r.focusNode,o=r._makeHookContext(i||r,e),s=r.phase;try{return r.phase="userEvent","preventNav"===(t=i?r._triggerNodeEvent("keydown",i,e):r._triggerTreeEvent("keydown",e))?t=!0:!1!==t&&(t=r._callHook("nodeKeydown",o)),t}finally{r.phase=s}}).on("mousedown"+o,function(e){e=i.getEventTarget(e),r._lastMousedownNode=e?e.node:null,r._setExpiringValue("mouseDownNode",r._lastMousedownNode)}).on("click"+o+" dblclick"+o,function(e){if(n.disabled)return!0;var r,o=i.getEventTarget(e),s=o.node,a=t.tree,l=a.phase;if(!s)return!0;r=a._makeHookContext(s,e);try{switch(a.phase="userEvent",e.type){case"click":return r.targetType=o.type,s.isPagingNode()?!0===a._triggerNodeEvent("clickPaging",r,e):!1!==a._triggerNodeEvent("click",r,e)&&a._callHook("nodeClick",r);case"dblclick":return r.targetType=o.type,!1!==a._triggerNodeEvent("dblclick",r,e)&&a._callHook("nodeDblclick",r)}}finally{a.phase=l}})},getActiveNode:function(){return this._deprecationWarning("getActiveNode"),this.tree.activeNode},getNodeByKey:function(e){return this._deprecationWarning("getNodeByKey"),this.tree.getNodeByKey(e)},getRootNode:function(){return this._deprecationWarning("getRootNode"),this.tree.rootNode},getTree:function(){return this._deprecationWarning("getTree"),this.tree}}),i=e.ui.fancytree,e.extend(e.ui.fancytree,{version:"2.38.5",buildType:"production",debugLevel:3,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:I,_FancytreeNodeClass:O,jquerySupports:{positionMyOfs:function(t){for(var i,n,r=e.map(N(t).split("."),function(e){return parseInt(e,10)}),o=e.map(Array.prototype.slice.call(arguments,1),function(e){return parseInt(e,10)}),s=0;s<o.length;s++)if((i=r[s]||0)!==(n=o[s]||0))return n<i;return!0}(e.ui.version,1,9)},assert:w,createTree:function(t,n){return t=e(t).fancytree(n),i.getTree(t)},debounce:function(e,t,i,n){var r;return 3===arguments.length&&"boolean"!=typeof i&&(n=i,i=!1),function(){var o=arguments;n=n||this,i&&!r&&t.apply(n,o),clearTimeout(r),r=setTimeout(function(){i||t.apply(n,o),r=null},e)}},debug:function(t){4<=e.ui.fancytree.debugLevel&&S("log",arguments)},error:function(t){1<=e.ui.fancytree.debugLevel&&S("error",arguments)},escapeHtml:function(e){return(""+e).replace(r,function(e){return l[e]})},fixPositionOptions:function(t){var i,n,r,o;return(t.offset||0<=(""+t.my+t.at).indexOf("%"))&&e.error("expected new position syntax (but '%' is not supported)"),!e.ui.fancytree.jquerySupports.positionMyOfs&&(i=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(t.my),n=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(t.at),r=(i[2]?+i[2]:0)+(n[2]?+n[2]:0),o=(i[4]?+i[4]:0)+(n[4]?+n[4]:0),t=e.extend({},t,{my:i[1]+" "+i[3],at:n[1]+" "+n[3]}),r||o)&&(t.offset=r+" "+o),t},getEventTarget:function(t){var n=t&&t.target?t.target.className:"",r={node:this.getNode(t.target),type:void 0};return/\bfancytree-title\b/.test(n)?r.type="title":/\bfancytree-expander\b/.test(n)?r.type=!1===r.node.hasChildren()?"prefix":"expander":/\bfancytree-checkbox\b/.test(n)?r.type="checkbox":/\bfancytree(-custom)?-icon\b/.test(n)?r.type="icon":/\bfancytree-node\b/.test(n)?r.type="title":t&&t.target&&((n=e(t.target)).is("ul[role=group]")?((r.node&&r.node.tree||i).debug("Ignoring click on outer UL."),r.node=null):n.closest(".fancytree-title").length?r.type="title":n.closest(".fancytree-checkbox").length?r.type="checkbox":n.closest(".fancytree-expander").length&&(r.type="expander")),r},getEventTargetType:function(e){return this.getEventTarget(e).type},getNode:function(t){if(t instanceof O)return t;for(t instanceof e?t=t[0]:void 0!==t.originalEvent&&(t=t.target);t;){if(t.ftnode)return t.ftnode;t=t.parentNode}return null},getTree:function(t){var i=t;return t instanceof I?t:("number"==typeof(t=void 0===t?0:t)?t=e(".fancytree-container").eq(t):"string"==typeof t?(t=e("#ft-id-"+i).eq(0)).length||(t=e(i).eq(0)):t instanceof Element||t instanceof HTMLDocument?t=e(t):t instanceof e?t=t.eq(0):void 0!==t.originalEvent&&(t=e(t.target)),(i=(t=t.closest(":ui-fancytree")).data("ui-fancytree")||t.data("fancytree"))?i.tree:null)},evalOption:function(e,t,i,n,r){var o,s=t.tree;n=n[e],i=i[e];return C(n)?(t={node:t,tree:s,widget:s.widget,options:s.widget.options,typeInfo:s.types[t.type]||{}},null==(o=n.call(s,{type:e},t))&&(o=i)):o=i??n,o??r},setSpanIcon:function(t,i,n){var r=e(t);"string"==typeof n?r.attr("class",i+" "+n):(n.text?r.text(""+n.text):n.html&&(t.innerHTML=n.html),r.attr("class",i+" "+(n.addClass||"")))},eventToString:function(e){var t=e.which,i=e.type,n=[];return e.altKey&&n.push("alt"),e.ctrlKey&&n.push("ctrl"),e.metaKey&&n.push("meta"),e.shiftKey&&n.push("shift"),"click"===i||"dblclick"===i?n.push(h[e.button]+i):"wheel"===i?n.push(i):d[t]||n.push(c[t]||String.fromCharCode(t).toLowerCase()),n.join("+")},info:function(t){3<=e.ui.fancytree.debugLevel&&S("info",arguments)},keyEventToString:function(e){return this.warn("keyEventToString() is deprecated: use eventToString()"),this.eventToString(e)},overrideMethod:function(t,i,n,r){var o,s=t[i]||e.noop;t[i]=function(){var e=r||this;try{return o=e._super,e._super=s,n.apply(e,arguments)}finally{e._super=o}}},parseHtml:function(t){var i,n,r,o,s,a,l,d,c=t.find(">li"),u=[];return c.each(function(){var c,h,g=e(this),y=g.find(">span",this).first(),b=y.length?null:g.find(">a").first(),x={tooltip:null,data:{}};for(y.length?x.title=y.html():b&&b.length?(x.title=b.html(),x.data.href=b.attr("href"),x.data.target=b.attr("target"),x.tooltip=b.attr("title")):(x.title=g.html(),0<=(s=x.title.search(/<ul/i))&&(x.title=x.title.substring(0,s))),x.title=N(x.title),o=0,a=f.length;o<a;o++)x[f[o]]=void 0;for(i=this.className.split(" "),r=[],o=0,a=i.length;o<a;o++)n=i[o],p[n]?x[n]=!0:r.push(n);if(x.extraClasses=r.join(" "),(l=g.attr("title"))&&(x.tooltip=l),(l=g.attr("id"))&&(x.key=l),g.attr("hideCheckbox")&&(x.checkbox=!1),(c=H(g))&&!e.isEmptyObject(c)){for(h in m)k(c,h)&&(c[m[h]]=c[h],delete c[h]);for(o=0,a=v.length;o<a;o++)l=v[o],null!=(d=c[l])&&(delete c[l],x[l]=d);e.extend(x.data,c)}(t=g.find(">ul").first()).length?x.children=e.ui.fancytree.parseHtml(t):x.children=x.lazy?void 0:null,u.push(x)}),u},registerExtension:function(t){w(null!=t.name,"extensions must have a `name` property."),w(null!=t.version,"extensions must have a `version` property."),e.ui.fancytree._extensions[t.name]=t},trim:N,unescapeHtml:function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue},warn:function(t){2<=e.ui.fancytree.debugLevel&&S("warn",arguments)}}),e.ui.fancytree}function w(t,i){t||(i="Fancytree assertion failed"+(i=i?": "+i:""),e.ui&&e.ui.fancytree&&e.ui.fancytree.error(i),e.error(i))}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return"function"==typeof e}function N(e){return null==e?"":e.trim()}function S(e,t){var i,n;if(e=window.console?window.console[e]:null)try{e.apply(window.console,t)}catch(r){for(n="",i=0;i<t.length;i++)n+=t[i];e(n)}}function E(e,t,i,n,r){var o,s,a;function l(){return o.apply(t,arguments)}function d(e){return o.apply(t,e)}return o=t[e],s=n[e],a=t.ext[r],function(){var e=t._local,i=t._super,n=t._superApply;try{return t._local=a,t._super=l,t._superApply=d,s.apply(t,arguments)}finally{t._local=e,t._super=i,t._superApply=n}}}function T(t,i){return(void 0===t?e.Deferred(function(){this.resolve()}):e.Deferred(function(){this.resolveWith(t,i)})).promise()}function A(t,i){return(void 0===t?e.Deferred(function(){this.reject()}):e.Deferred(function(){this.rejectWith(t,i)})).promise()}function L(e,t){return function(){e.resolveWith(t)}}function H(t){var i=(t=e.extend({},t.data())).json;return delete t.fancytree,delete t.uiFancytree,i&&(delete t.json,t=e.extend(t,i)),t}function P(e){return(""+e).replace(o,function(e){return l[e]})}function F(e){return e=e.toLowerCase(),function(t){return 0<=t.title.toLowerCase().indexOf(e)}}function O(t,n){var r,o,s;for(this.parent=t,this.tree=t.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},r=0,o=v.length;r<o;r++)this[s=v[r]]=n[s];for(s in null==this.unselectableIgnore&&null==this.unselectableStatus||(this.unselectable=!0),n.hideCheckbox&&e.error("'hideCheckbox' node option was removed in v2.23.0: use 'checkbox: false'"),n.data&&e.extend(this.data,n.data),n)y[s]||!this.tree.options.copyFunctionsToData&&C(n[s])||b[s]||(this.data[s]=n[s]);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="_"+i._nextNodeKey++:this.key=""+this.key,n.active&&(w(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),n.selected&&(this.tree.lastSelectedNode=this),(t=n.children)?t.length?this._setChildren(t):this.children=this.lazy?[]:null:this.children=null,this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function I(t){this.widget=t,this.$div=t.element,this.options=t.options,this.options&&(void 0!==this.options.lazyload&&e.error("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),void 0!==this.options.loaderror&&e.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),void 0!==this.options.fx&&e.error("The 'fx' option was replaced by 'toggleEffect' since 2014-11-30."),void 0!==this.options.removeNode)&&e.error("The 'removeNode' event was replaced by 'modifyChild' since 2.20 (2016-09-10)."),this.ext={},this.types={},this.columns={},this.data=H(this.$div),this._id=""+(this.options.treeId||e.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(),this.rootNode=new O({tree:this},{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,t=e("<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=i.debugLevel)}e.ui.fancytree.warn("Fancytree: ignored duplicate include")}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";var t="__not_found__",i=e.ui.fancytree.escapeHtml;function n(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function r(t){return t.indexOf(">")>=0?e("<div/>").html(t).text():t}function o(e,t,i){for(var n=[],r=1;r<t.length;r++){var o=t[r].length+(1===r?0:1)+(n[n.length-1]||0);n.push(o)}var s=e.split("");return i?n.forEach(function(e){s[e]=""+s[e]+""}):n.forEach(function(e){s[e]="<mark>"+s[e]+"</mark>"}),s.join("")}return e.ui.fancytree._FancytreeClass.prototype._applyFilterImpl=function(s,a,l){var d,c,u,h,f,p,g,v,y=0,m=this.options,b=m.escapeTitles,x=m.autoCollapse,_=e.extend({},m.filter,l),w="hide"===_.mode,k=!!_.leavesOnly&&!a;if("string"==typeof s){if(""===s)return this.warn("Fancytree passing an empty string as a filter is handled as clearFilter()."),void this.clearFilter();d=_.fuzzy?s.split("").map(n).reduce(function(e,t){return e+"([^"+t+"]*)"+t},""):n(s),u=new RegExp(d,"i"),h=new RegExp(n(s),"gi"),b&&(f=new RegExp(n(""),"g"),p=new RegExp(n(""),"g")),s=function(e){if(!e.title)return!1;var t=b?e.title:r(e.title),n=t.match(u);return n&&_.highlight&&(b?(g=_.fuzzy?o(t,n,b):t.replace(h,function(e){return""+e+""}),e.titleWithHighlight=i(g).replace(f,"<mark>").replace(p,"</mark>")):_.fuzzy?e.titleWithHighlight=o(t,n):e.titleWithHighlight=t.replace(h,function(e){return"<mark>"+e+"</mark>"})),!!n}}return this.enableFilter=!0,this.lastFilterArgs=arguments,v=this.enableUpdate(!1),this.$div.addClass("fancytree-ext-filter"),w?this.$div.addClass("fancytree-ext-filter-hide"):this.$div.addClass("fancytree-ext-filter-dimm"),this.$div.toggleClass("fancytree-ext-filter-hide-expanders",!!_.hideExpanders),this.rootNode.subMatchCount=0,this.visit(function(e){delete e.match,delete e.titleWithHighlight,e.subMatchCount=0}),(c=this.getRootNode()._findDirectChild(t))&&c.remove(),m.autoCollapse=!1,this.visit(function(e){if(!k||null==e.children){var t=s(e),i=!1;if("skip"===t)return e.visit(function(e){e.match=!1},!0),"skip";t||!a&&"branch"!==t||!e.parent.match||(t=!0,i=!0),t&&(y++,e.match=!0,e.visitParents(function(t){t!==e&&(t.subMatchCount+=1),!_.autoExpand||i||t.expanded||(t.setExpanded(!0,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),t._filterAutoExpanded=!0)},!0))}}),m.autoCollapse=x,0===y&&_.nodata&&w&&("function"==typeof(c=_.nodata)&&(c=c()),!0===c?c={}:"string"==typeof c&&(c={title:c}),c=e.extend({statusNodeType:"nodata",key:t,title:this.options.strings.noData},c),this.getRootNode().addNode(c).match=!0),this._callHook("treeStructureChanged",this,"applyFilter"),this.enableUpdate(v),y},e.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)},e.ui.fancytree._FancytreeClass.prototype.filterBranches=function(e,t){return this._applyFilterImpl(e,!0,t)},e.ui.fancytree._FancytreeClass.prototype.updateFilter=function(){this.enableFilter&&this.lastFilterArgs&&this.options.filter.autoApply?this._applyFilterImpl.apply(this,this.lastFilterArgs):this.warn("updateFilter(): no filter active.")},e.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){var i,n=this.getRootNode()._findDirectChild(t),r=this.options.escapeTitles,o=this.options.enhanceTitle,s=this.enableUpdate(!1);n&&n.remove(),delete this.rootNode.match,delete this.rootNode.subMatchCount,this.visit(function(t){t.match&&t.span&&(i=e(t.span).find(">span.fancytree-title"),r?i.text(t.title):i.html(t.title),o&&o({type:"enhanceTitle"},{node:t,$title:i})),delete t.match,delete t.subMatchCount,delete t.titleWithHighlight,t.$subMatchBadge&&(t.$subMatchBadge.remove(),delete t.$subMatchBadge),t._filterAutoExpanded&&t.expanded&&t.setExpanded(!1,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),delete t._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(s)},e.ui.fancytree._FancytreeClass.prototype.isFilterActive=function(){return!!this.enableFilter},e.ui.fancytree._FancytreeNodeClass.prototype.isMatched=function(){return!(this.tree.enableFilter&&!this.match)},e.ui.fancytree.registerExtension({name:"filter",version:"@VERSION",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 i=e.tree;return this._superApply(arguments).done(function(){i.enableFilter&&i.lastFilterArgs&&e.options.filter.autoApply&&i._applyFilterImpl.apply(i,i.lastFilterArgs)})},nodeSetExpanded:function(e,t,i){var n=e.node;return delete n._filterAutoExpanded,!t&&e.options.filter.hideExpandedCounter&&n.$subMatchBadge&&n.$subMatchBadge.show(),this._superApply(arguments)},nodeRenderStatus:function(t){var i,n=t.node,r=t.tree,o=t.options.filter,s=e(n.span).find("span.fancytree-title"),a=e(n[r.statusClassPropName]),l=t.options.enhanceTitle,d=t.options.escapeTitles;return i=this._super(t),a.length&&r.enableFilter?(a.toggleClass("fancytree-match",!!n.match).toggleClass("fancytree-submatch",!!n.subMatchCount).toggleClass("fancytree-hide",!(n.match||n.subMatchCount)),!o.counter||!n.subMatchCount||n.isExpanded()&&o.hideExpandedCounter?n.$subMatchBadge&&n.$subMatchBadge.hide():(n.$subMatchBadge||(n.$subMatchBadge=e("<span class='fancytree-childcounter'/>"),e("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?s.html(n.titleWithHighlight):d?s.text(n.title):s.html(n.title),l&&l({type:"enhanceTitle"},{node:n,$title:s})),i):i}}),e.ui.fancytree});