/*!
 * sidebarMenus 
 * A jQuery menu plugin
 */
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],n):(e=e||self).sidebarMenus=n(e.jQuery)}(this,function(e){"use strict";function n(){return(n=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var t,i,r,a=(i="transitionend",r={TRANSITION_END:"mmTransitionEnd",triggerTransitionEnd:function(e){t(e).trigger(i)},supportsTransitionEnd:function(){return Boolean(i)}},(t=e).fn.mmEmulateTransitionEnd=function(e){var n=this,i=!1;return t(this).one(r.TRANSITION_END,function(){i=!0}),setTimeout(function(){i||r.triggerTransitionEnd(n)},e),this},t.event.special[r.TRANSITION_END]={bindType:i,delegateType:i,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}},r);var s="sidebarMenus",o="sidebarMenus",g="."+o,l=e.fn[s],h={toggle:!0,preventDefault:!0,triggerElement:"a",parentTrigger:"li",subMenu:"ul"},f={SHOW:"show"+g,SHOWN:"shown"+g,HIDE:"hide"+g,HIDDEN:"hidden"+g,CLICK_DATA_API:"click"+g+".data-api"},d="mm-active",u="mm-show",c="mm-collapse",p="mm-collapsing",m=function(){function t(e,t){this.element=e,this.config=n({},h,{},t),this.transitioning=null,this.init()}var i=t.prototype;return i.init=function(){var n=this,t=this.config,i=e(this.element);i.addClass("sidebarMenus"),i.find(t.parentTrigger+"."+d).children(t.triggerElement).attr("aria-expanded","true"),i.find(t.parentTrigger+"."+d).parents(t.parentTrigger).addClass(d),i.find(t.parentTrigger+"."+d).parents(t.parentTrigger).children(t.triggerElement).attr("aria-expanded","true"),i.find(t.parentTrigger+"."+d).has(t.subMenu).children(t.subMenu).addClass(c+" "+u),i.find(t.parentTrigger).not("."+d).has(t.subMenu).children(t.subMenu).addClass(c),i.find(t.parentTrigger).children(t.triggerElement).on(f.CLICK_DATA_API,function(i){var r=e(this);if("true"!==r.attr("aria-disabled")){t.preventDefault&&"#"===r.attr("href")&&i.preventDefault();var a=r.parent(t.parentTrigger),s=a.siblings(t.parentTrigger),o=s.children(t.triggerElement);a.hasClass(d)?(r.attr("aria-expanded","false"),n.removeActive(a)):(r.attr("aria-expanded","true"),n.setActive(a),t.toggle&&(n.removeActive(s),o.attr("aria-expanded","false"))),t.onTransitionStart&&t.onTransitionStart(i)}})},i.setActive=function(n){e(n).addClass(d);var t=e(n).children(this.config.subMenu);0<t.length&&!t.hasClass(u)&&this.show(t)},i.removeActive=function(n){e(n).removeClass(d);var t=e(n).children(this.config.subMenu+"."+u);0<t.length&&this.hide(t)},i.show=function(n){var t=this;if(!this.transitioning&&!e(n).hasClass(p)){var i=e(n),r=e.Event(f.SHOW);if(i.trigger(r),!r.isDefaultPrevented()){if(i.parent(this.config.parentTrigger).addClass(d),this.config.toggle){var s=i.parent(this.config.parentTrigger).siblings().children(this.config.subMenu+"."+u);this.hide(s)}i.removeClass(c).addClass(p).height(0),this.setTransitioning(!0),i.height(n[0].scrollHeight).one(a.TRANSITION_END,function(){t.config&&t.element&&(i.removeClass(p).addClass(c+" "+u).height(""),t.setTransitioning(!1),i.trigger(f.SHOWN))}).mmEmulateTransitionEnd(350)}}},i.hide=function(n){var t=this;if(!this.transitioning&&e(n).hasClass(u)){var i=e(n),r=e.Event(f.HIDE);if(i.trigger(r),!r.isDefaultPrevented()){i.parent(this.config.parentTrigger).removeClass(d),i.height(i.height())[0].offsetHeight,i.addClass(p).removeClass(c).removeClass(u),this.setTransitioning(!0);var s=function(){t.config&&t.element&&(t.transitioning&&t.config.onTransitionEnd&&t.config.onTransitionEnd(),t.setTransitioning(!1),i.trigger(f.HIDDEN),i.removeClass(p).addClass(c))};0===i.height()||"none"===i.css("display")?s():i.height(0).one(a.TRANSITION_END,s).mmEmulateTransitionEnd(350)}}},i.setTransitioning=function(e){this.transitioning=e},i.dispose=function(){e.removeData(this.element,o),e(this.element).find(this.config.parentTrigger).children(this.config.triggerElement).off(f.CLICK_DATA_API),this.transitioning=null,this.config=null,this.element=null},t.jQueryInterface=function(i){return this.each(function(){var r=e(this),a=r.data(o),s=n({},h,{},r.data(),{},"object"==typeof i&&i?i:{});if(a||(a=new t(this,s),r.data(o,a)),"string"==typeof i){if(void 0===a[i])throw new Error('No method named "'+i+'"');a[i]()}})},t}();return e.fn[s]=m.jQueryInterface,e.fn[s].Constructor=m,e.fn[s].noConflict=function(){return e.fn[s]=l,m.jQueryInterface},m});