Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accessible-menu-bootstrap-5

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accessible-menu-bootstrap-5 - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

dist/disclosure-menu-bs5.esm.min.js

@@ -1,2 +0,2 @@

function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n){try{if("object"!==e(n)){var o=e(n);throw new TypeError("AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ".concat(o," given."))}for(var r in n)if(!(n[r]instanceof t)){var i=e(n[r]);throw new TypeError("AccessibleMenu: ".concat(r," must be an instance of ").concat(t.name,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function n(t,n){try{if("object"!==e(n)){var o=e(n);throw new TypeError("AccessibleMenu: Values given to isValidType() must be inside of an object. ".concat(o," given."))}for(var r in n){var i=e(n[r]);if(i!==t)throw new TypeError("AccessibleMenu: ".concat(r," must be a ").concat(t,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function o(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ".concat(n," given."))}for(var o in t)try{if(null===t[o])throw new Error;document.querySelector(t[o])}catch(e){throw new TypeError("AccessibleMenu: ".concat(o,' must be a valid CSS selector. "').concat(t[o],'" given.'))}return!0}catch(e){return console.error(e),!1}}function r(t){try{if("object"!==e(t)||Array.isArray(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidClassList() must be inside of an object. ".concat(n," given."))}var r=function(n){var r=e(t[n]);if("string"!==r){if(!Array.isArray(t[n]))throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. ").concat(r," given."));t[n].forEach((function(e){if("string"!=typeof e)throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. An array containing non-strings given."))}))}else{var i={};i[n]=t[n],o(i)}};for(var i in t)r(i);return!0}catch(e){return console.error(e),!1}}function i(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ".concat(n," given."))}var o=["off","on","dynamic"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'));return!0}catch(e){return console.error(e),!1}}function u(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function s(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){function e(t){var n=t.menuToggleElement,o=t.parentElement,r=t.controlledMenu,i=t.parentMenu,u=void 0===i?null:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"_dom",{toggle:null,parent:null}),c(this,"_elements",{controlledMenu:null,parentMenu:null}),c(this,"_open",!1),c(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),c(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=n,this._dom.parent=o,this._elements.controlledMenu=r,this._elements.parentMenu=u}var o,r,i;return o=e,r=[{key:"initialize",value:function(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(e,o){if(n("string",{tagName:e})&&t(HTMLElement,o)){var r=e.toLowerCase(),i=!0;for(var u in o)o[u].tagName.toLowerCase()!==r&&(i=!1);return i}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){var e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10),o=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),r=e;!o.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(o=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),o.replace(/\s/g,"").length>0&&((o=o.toLowerCase().replace(/\s+/g,"-")).startsWith("-")&&(o=o.substring(1)),o.endsWith("-")&&(o=o.slice(0,-1)),r="".concat(o,"-").concat(r)),this.dom.toggle.id=this.dom.toggle.id||"".concat(r,"-menu-button"),this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||"".concat(r,"-menu")}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isOpen",get:function(){return this._open},set:function(e){n("boolean",{value:e}),this._open=e}},{key:"_expand",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.add(i):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(i))),""!==r&&("string"==typeof r?this.elements.controlledMenu.dom.menu.classList.remove(r):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(r))),n&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==r&&("string"==typeof r?this.elements.controlledMenu.dom.menu.classList.add(r):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(r))),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.remove(i):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}},{key:"open",value:function(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}},{key:"preview",value:function(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}},{key:"close",value:function(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}},{key:"toggle",value:function(){this.isOpen?this.close():this.open()}},{key:"closeSiblings",value:function(){var e=this;this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((function(t){t!==e&&t.close()}))}},{key:"closeChildren",value:function(){this.elements.controlledMenu.elements.submenuToggles.forEach((function(e){return e.close()}))}}],r&&s(o.prototype,r),i&&s(o,i),e}();function f(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(){function e(t){var n=t.menuItemElement,o=t.menuLinkElement,r=t.parentMenu,i=t.isSubmenuItem,u=void 0!==i&&i,l=t.childMenu,s=void 0===l?null:l,c=t.toggle,a=void 0===c?null:c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),m(this,"_dom",{item:null,link:null}),m(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),m(this,"_submenu",!1),this._dom.item=n,this._dom.link=o,this._elements.parentMenu=r,this._elements.childMenu=s,this._elements.toggle=a,this._submenu=u}var t,n,o;return t=e,(n=[{key:"initialize",value:function(){}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isSubmenuItem",get:function(){return this._submenu}},{key:"focus",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}},{key:"blur",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}])&&f(t.prototype,n),o&&f(t,o),e}();function p(e){try{var t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((function(e){return!0===n[e]}))||""}catch(e){return""}}function d(e){e.preventDefault(),e.stopPropagation()}function y(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function b(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _=function(){function u(e){var t=e.menuElement,n=e.menuItemSelector,o=void 0===n?"li":n,r=e.menuLinkSelector,i=void 0===r?"a":r,l=e.submenuItemSelector,s=void 0===l?"":l,c=e.submenuToggleSelector,f=void 0===c?"a":c,m=e.submenuSelector,p=void 0===m?"ul":m,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,_=e.openClass,E=void 0===_?"show":_,w=e.closeClass,M=void 0===w?"hide":w,S=e.isTopLevel,T=void 0===S||S,C=e.parentMenu,k=void 0===C?null:C,O=e.hoverType,I=void 0===O?"off":O,j=e.hoverDelay,A=void 0===j?250:j;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),g(this,"_MenuType",u),g(this,"_MenuItemType",h),g(this,"_MenuToggleType",a),g(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),g(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),g(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),g(this,"_openClass","show"),g(this,"_closeClass","hide"),g(this,"_root",!0),g(this,"_currentChild",0),g(this,"_focusState","none"),g(this,"_currentEvent","none"),g(this,"_hoverType","off"),g(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=y,this._dom.container=b,this._selectors.menuItems=o,this._selectors.menuLinks=i,this._selectors.submenuItems=s,this._selectors.submenuToggles=f,this._selectors.submenus=p,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=k,this._elements.rootMenu=T?this:null,this._openClass=E||"",this._closeClass=M||"",this._root=T,this._hoverType=I,this._hoverDelay=A}var l,s,c;return l=u,s=[{key:"initialize",value:function(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){var e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}},{key:"dom",get:function(){return this._dom}},{key:"selectors",get:function(){return this._selectors}},{key:"elements",get:function(){return this._elements}},{key:"isTopLevel",get:function(){return this._root}},{key:"openClass",get:function(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass},set:function(e){r({openClass:e}),this._openClass!==e&&(this._openClass=e)}},{key:"closeClass",get:function(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass},set:function(e){r({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}},{key:"currentChild",get:function(){return this._currentChild},set:function(e){function t(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu)for(var t=0,n=!1;!n&&t<e.elements.parentMenu.elements.menuItems.length;){var o=e.elements.parentMenu.elements.menuItems[t];o.isSubmenuItem&&o.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}n("number",{value:e}),e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}},{key:"focusState",get:function(){return this._focusState},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidState() must be inside of an object. ".concat(n," given."))}var o=["none","self","child"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&("self"===t||"none"===t)&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==t&&"child"!==t||(this.elements.parentMenu.focusState="child")}},{key:"currentEvent",get:function(){return this._currentEvent},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidEvent() must be inside of an object. ".concat(n," given."))}var o=["none","mouse","keyboard","character"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.currentEvent=t})))}},{key:"currentMenuItem",get:function(){return this.elements.menuItems[this.currentChild]}},{key:"hoverType",get:function(){return this._root?this._hoverType:this.elements.rootMenu.hoverType},set:function(e){i({value:e}),this._hoverType!==e&&(this._hoverType=e)}},{key:"hoverDelay",get:function(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay},set:function(e){n("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}},{key:"shouldFocus",get:function(){var e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}},{key:"_validate",value:function(){var e=!0;return null!==this._dom.container||null!==this._dom.controller?t(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(e=!1):t(HTMLElement,{menuElement:this._dom.menu})||(e=!1),""!==this._selectors.submenuItems?o({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(e=!1):o({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(e=!1),""===this._openClass||r({openClass:this._openClass})||(e=!1),""===this._closeClass||r({closeClass:this._closeClass})||(e=!1),n("boolean",{isTopLevel:this._root})||(e=!1),null===this._elements.parentMenu||t(u,{parentMenu:this._elements.parentMenu})||(e=!1),i({hoverType:this._hoverType})||(e=!1),n("number",{hoverDelay:this._hoverDelay})||(e=!1),e}},{key:"_setDOMElementType",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be set through _setDOMElementType.'));n!==this.dom.menu&&t(HTMLElement,{base:n});var r=Array.from(n.querySelectorAll(this.selectors[e])),i=r.filter((function(e){return e.parentElement===n}));this._dom[e]=o?i:[].concat(y(this._dom[e]),y(i))}},{key:"_resetDOMElementType",value:function(e){if(void 0===this.dom[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be reset through _resetDOMElementType.'));this._dom[e]=[]}},{key:"_setDOMElements",value:function(){var e=this;this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((function(t){e._setDOMElementType("submenuToggles",t,!1),e._setDOMElementType("submenus",t,!1)})))}},{key:"_findRootMenu",value:function(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}},{key:"_createChildElements",value:function(){var e=this;this.dom.menuItems.forEach((function(t){var n;if(e.dom.submenuItems.includes(t)){var o=t.querySelector(e.selectors.submenuToggles),r=t.querySelector(e.selectors.submenus),i=new e._MenuType({menuElement:r,menuItemSelector:e.selectors.menuItems,menuLinkSelector:e.selectors.menuLinks,submenuItemSelector:e.selectors.submenuItems,submenuToggleSelector:e.selectors.submenuToggles,submenuSelector:e.selectors.submenus,openClass:e.openClass,closeClass:e.closeClass,isTopLevel:!1,parentMenu:e,hoverType:e.hoverType,hoverDelay:e.hoverDelay}),u=new e._MenuToggleType({menuToggleElement:o,parentElement:t,controlledMenu:i,parentMenu:e});e._elements.submenuToggles.push(u),n=new e._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:e,isSubmenuItem:!0,childMenu:i,toggle:u})}else{var l=t.querySelector(e.selectors.menuLinks);n=new e._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:e})}e._elements.menuItems.push(n)}))}},{key:"_handleFocus",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("focus",(function(){e.focusState="self",e.currentChild=n}))}))}},{key:"_handleClick",value:function(){var e=this;function t(e,t,n){d(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((function(n,o){n.dom.link.addEventListener("pointerdown",(function(){e.currentEvent="mouse",e.elements.rootMenu.blurChildren(),e.focusChild(o)}),{passive:!0}),n.isSubmenuItem&&n.elements.toggle.dom.toggle.addEventListener("pointerup",(function(o){e.currentEvent="mouse",t(e,n.elements.toggle,o)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(function(n){e.currentEvent="mouse",t(e,e.elements.controller,n)}))}},{key:"_handleHover",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("pointerenter",(function(o){if("pen"!==o.pointerType&&"touch"!==o.pointerType)if("on"===e.hoverType)e.currentEvent="mouse",e.currentChild=n,t.isSubmenuItem&&t.elements.toggle.preview();else if("dynamic"===e.hoverType){var r=e.elements.submenuToggles.some((function(e){return e.isOpen}));e.currentChild=n,e.isTopLevel&&"none"===e.focusState||(e.currentEvent="mouse",e.focusCurrentChild()),!t.isSubmenuItem||e.isTopLevel&&!r||(e.currentEvent="mouse",t.elements.toggle.preview())}})),t.isSubmenuItem&&t.dom.item.addEventListener("pointerleave",(function(n){"pen"!==n.pointerType&&"touch"!==n.pointerType&&("on"===e.hoverType?e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close()):"dynamic"===e.hoverType&&(e.isTopLevel||(e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()))))}))}))}},{key:"_handleKeydown",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||(d(t),e.elements.controller.open(),e.focusFirstChild())}))}},{key:"focus",value:function(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}},{key:"blur",value:function(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}},{key:"focusCurrentChild",value:function(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}},{key:"focusChild",value:function(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}},{key:"focusFirstChild",value:function(){this.focusChild(0)}},{key:"focusLastChild",value:function(){this.focusChild(this.elements.menuItems.length-1)}},{key:"focusNextChild",value:function(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}},{key:"focusPreviousChild",value:function(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}},{key:"blurCurrentChild",value:function(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}},{key:"focusController",value:function(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}},{key:"focusContainer",value:function(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}},{key:"closeChildren",value:function(){this.elements.submenuToggles.forEach((function(e){return e.close()}))}},{key:"blurChildren",value:function(){this.elements.menuItems.forEach((function(e){e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}],s&&b(l.prototype,s),c&&b(l,c),u}();function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function w(e,t){return w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},w(e,t)}function M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=T(e);if(t){var r=T(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return S(this,n)}}function S(e,t){if(t&&("object"===E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}var C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}(n,h);var t=M(n);function n(e){var o,r=e.menuItemElement,i=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,f=e.toggle,m=void 0===f?null:f,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),o=t.call(this,{menuItemElement:r,menuLinkElement:i,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:m}),p&&o.initialize(),o}return n}();function k(e){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k(e)}function O(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function I(){return I="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=j(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},I.apply(this,arguments)}function j(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=P(e)););return e}function A(e,t){return A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},A(e,t)}function L(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=P(e);if(t){var r=P(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return R(this,n)}}function R(e,t){if(t&&("object"===k(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}var D=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(i,a);var t,n,o,r=L(i);function i(e){var t,n=e.menuToggleElement,o=e.parentElement,u=e.controlledMenu,l=e.parentMenu,s=void 0===l?null:l,c=e.initialize,a=void 0===c||c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuToggleElement:n,parentElement:o,controlledMenu:u,parentMenu:s}),a&&t.initialize(),t}return t=i,(n=[{key:"open",value:function(){this.closeSiblings(),I(P(i.prototype),"open",this).call(this)}},{key:"preview",value:function(){this.closeSiblings(),I(P(i.prototype),"preview",this).call(this)}},{key:"close",value:function(){this.isOpen&&this.closeChildren(),I(P(i.prototype),"close",this).call(this)}}])&&O(t.prototype,n),o&&O(t,o),i}();function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function z(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function K(){return K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=F(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},K.apply(this,arguments)}function F(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=N(e)););return e}function B(e,t){return B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},B(e,t)}function V(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=N(e);if(t){var r=N(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return H(this,n)}}function H(e,t){if(t&&("object"===x(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return U(e)}function U(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(u,_);var t,o,r,i=V(u);function u(e){var t,n=e.menuElement,o=e.menuItemSelector,r=void 0===o?"li":o,l=e.menuLinkSelector,s=void 0===l?"a":l,c=e.submenuItemSelector,a=void 0===c?"":c,f=e.submenuToggleSelector,m=void 0===f?"a":f,h=e.submenuSelector,p=void 0===h?"ul":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,_=void 0===g?"show":g,E=e.closeClass,w=void 0===E?"hide":E,M=e.isTopLevel,S=void 0===M||M,T=e.parentMenu,k=void 0===T?null:T,O=e.hoverType,I=void 0===O?"off":O,j=e.hoverDelay,A=void 0===j?250:j,L=e.optionalKeySupport,R=void 0!==L&&L,P=e.initialize,x=void 0===P||P;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),q(U(t=i.call(this,{menuElement:n,menuItemSelector:r,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:m,submenuSelector:p,controllerElement:y,containerElement:b,openClass:_,closeClass:w,isTopLevel:S,parentMenu:k,hoverType:I,hoverDelay:A})),"_MenuType",u),q(U(t),"_MenuItemType",C),q(U(t),"_MenuToggleType",D),q(U(t),"_currentChild",-1),q(U(t),"_optionalSupport",!1),t._optionalSupport=R,x&&t.initialize(),t}return t=u,(o=[{key:"initialize",value:function(){try{K(N(u.prototype),"initialize",this).call(this),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}},{key:"optionalKeySupport",get:function(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport},set:function(e){n("boolean",{optionalKeySupport:e}),this._optionalSupport=e}},{key:"_validate",value:function(){var e=K(N(u.prototype),"_validate",this).call(this);return n("boolean",{optionalKeySupport:this._optionalSupport})||(e=!1),e}},{key:"_handleClick",value:function(){var e=this;K(N(u.prototype),"_handleClick",this).call(this),document.addEventListener("pointerup",(function(t){"none"!==e.focusState&&(e.currentEvent="mouse",e.dom.menu.contains(t.target)||!e.dom.menu===t.target||(e.closeChildren(),e.blur(),e.elements.controller&&e.elements.controller.close()))}))}},{key:"_handleKeydown",value:function(){var e=this;K(N(u.prototype),"_handleKeydown",this).call(this),this.dom.menu.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"self"===e.focusState&&(e.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(n)&&d(t):(e.currentMenuItem.isSubmenuItem&&["Space","Enter"].includes(n)||e.elements.controller&&["Escape"].includes(n)||e.elements.parentMenu&&["Escape"].includes(n))&&d(t))}))}},{key:"_handleKeyup",value:function(){var e=this;K(N(u.prototype),"_handleKeyup",this).call(this),this.dom.menu.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t);"self"===e.focusState&&("Space"===n||"Enter"===n?e.currentMenuItem.isSubmenuItem?(d(t),e.currentMenuItem.elements.toggle.preview()):e.currentMenuItem.dom.link.click():"Escape"===n?e.elements.submenuToggles.some((function(e){return e.isOpen}))?(d(t),e.closeChildren()):e.elements.parentMenu?(d(t),e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.closeChildren(),e.elements.parentMenu.focusCurrentChild()):e.isTopLevel&&e.elements.controller&&e.elements.controller.isOpen&&(e.elements.controller.close(),e.focusController()):e.optionalKeySupport&&("ArrowDown"===n||"ArrowRight"===n?(d(t),e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen?(e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.childMenu.focusFirstChild()):e.focusNextChild()):"ArrowUp"===n||"ArrowLeft"===n?(d(t),e.focusPreviousChild()):"Home"===n?(d(t),e.focusFirstChild()):"End"===n&&(d(t),e.focusLastChild())))}))}}])&&z(t.prototype,o),r&&z(t,r),u}();function Z(e){return Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Z(e)}function W(e,t){return W=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},W(e,t)}function G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=Q(e);if(t){var r=Q(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return J(this,n)}}function J(e,t){if(t&&("object"===Z(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Q(e){return Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Q(e)}var X=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&W(e,t)}(n,C);var t=G(n);function n(e){var o,r=e.menuItemElement,i=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,f=e.toggle,m=void 0===f?null:f,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),o=t.call(this,{menuItemElement:r,menuLinkElement:i,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:m,initialize:!1}),p&&o.initialize(),o}return n}();function Y(e){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Y(e)}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ne(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function oe(){return oe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=re(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},oe.apply(this,arguments)}function re(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ce(e)););return e}function ie(e,t){return ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ie(e,t)}function ue(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ce(e);if(t){var r=ce(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return le(this,n)}}function le(e,t){if(t&&("object"===Y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return se(e)}function se(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e){return ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ce(e)}var ae=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ie(e,t)}(i,D);var t,n,o,r=ue(i);function i(e){var t,n,o,u,l=e.menuToggleElement,s=e.parentElement,c=e.controlledMenu,a=e.parentMenu,f=void 0===a?null:a,m=e.initialize,h=void 0===m||m;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuToggleElement:l,parentElement:s,controlledMenu:c,parentMenu:f,initialize:!1}),n=se(t),u={toggle:null,parent:null,container:null},(o="_dom")in n?Object.defineProperty(n,o,{value:u,enumerable:!0,configurable:!0,writable:!0}):n[o]=u,t._dom.toggle=l,t._dom.parent=s,t._dom.container=c.isTopLevel?c.dom.container:c.dom.menu,h&&t.initialize(),t}return t=i,n=[{key:"initialize",value:function(){oe(ce(i.prototype),"initialize",this).call(this),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}},{key:"_expand",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.elements.controlledMenu.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.dom.container.classList.add(n):(e=this.dom.container.classList).add.apply(e,ee(n))),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==r&&("string"==typeof r?this.dom.container.classList.add(r):(e=this.dom.container.classList).add.apply(e,ee(r))),""!==i&&("string"==typeof i?this.dom.container.classList.remove(i):(t=this.dom.container.classList).remove.apply(t,ee(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}],n&&ne(t.prototype,n),o&&ne(t,o),i}();function fe(e){return fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fe(e)}function me(e,t){return me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},me(e,t)}function he(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ye(e);if(t){var r=ye(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return pe(this,n)}}function pe(e,t){if(t&&("object"===fe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return de(e)}function de(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ye(e){return ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ye(e)}function ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var be=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(n,$);var t=he(n);function n(e){var o,r=e.menuElement,i=e.menuItemSelector,u=void 0===i?".nav-item":i,l=e.menuLinkSelector,s=void 0===l?".nav-link,.dropdown-item":l,c=e.submenuItemSelector,a=void 0===c?".dropdown":c,f=e.submenuToggleSelector,m=void 0===f?".dropdown-toggle":f,h=e.submenuSelector,p=void 0===h?".dropdown-menu":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,_=void 0===g?"show":g,E=e.closeClass,w=void 0===E?"collapse":E,M=e.isTopLevel,S=void 0===M||M,T=e.parentMenu,C=void 0===T?null:T,k=e.hoverType,O=void 0===k?"off":k,I=e.hoverDelay,j=void 0===I?250:I,A=e.optionalKeySupport,L=void 0!==A&&A,R=e.initialize,P=void 0===R||R;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),ve(de(o=t.call(this,{menuElement:r,menuItemSelector:u,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:m,submenuSelector:p,controllerElement:y,containerElement:b,openClass:_,closeClass:w,isTopLevel:S,parentMenu:C,hoverType:O,hoverDelay:j,optionalKeySupport:L,initialize:!1})),"_MenuType",n),ve(de(o),"_MenuItemType",X),ve(de(o),"_MenuToggleType",ae),P&&o.initialize(),o}return n}();export{be as default};
function e(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ${typeof t} given.`)}for(const n in t)if(!(t[n]instanceof e)){const s=typeof t[n];throw new TypeError(`AccessibleMenu: ${n} must be an instance of ${e.name}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function t(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Values given to isValidType() must be inside of an object. ${typeof t} given.`)}for(const n in t){const s=typeof t[n];if(s!==e)throw new TypeError(`AccessibleMenu: ${n} must be a ${e}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function n(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ${typeof e} given.`)}for(const t in e)try{if(null===e[t])throw new Error;document.querySelector(e[t])}catch(n){throw new TypeError(`AccessibleMenu: ${t} must be a valid CSS selector. "${e[t]}" given.`)}return!0}catch(e){return console.error(e),!1}}function s(e){try{if("object"!=typeof e||Array.isArray(e)){throw new TypeError(`AccessibleMenu: Values given to isValidClassList() must be inside of an object. ${typeof e} given.`)}for(const t in e){const s=typeof e[t];if("string"!==s){if(!Array.isArray(e[t]))throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. ${s} given.`);e[t].forEach((e=>{if("string"!=typeof e)throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. An array containing non-strings given.`)}))}else{const s={};s[t]=e[t],n(s)}}return!0}catch(e){return console.error(e),!1}}function o(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ${typeof e} given.`)}const t=["off","on","dynamic"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}function i(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class r{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o=null}=e;i(this,"_dom",{toggle:null,parent:null}),i(this,"_elements",{controlledMenu:null,parentMenu:null}),i(this,"_open",!1),i(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),i(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=t,this._dom.parent=n,this._elements.controlledMenu=s,this._elements.parentMenu=o}initialize(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(n,s){if(t("string",{tagName:n})&&e(HTMLElement,s)){const e=n.toLowerCase();let t=!0;for(const n in s)s[n].tagName.toLowerCase()!==e&&(t=!1);return t}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let t=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),n=e;!t.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(t=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),t.replace(/\s/g,"").length>0&&(t=t.toLowerCase().replace(/\s+/g,"-"),t.startsWith("-")&&(t=t.substring(1)),t.endsWith("-")&&(t=t.slice(0,-1)),n=`${t}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){t("boolean",{value:e}),this._open=e}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.add(n):this.elements.controlledMenu.dom.menu.classList.add(...n)),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.remove(t):this.elements.controlledMenu.dom.menu.classList.remove(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.add(t):this.elements.controlledMenu.dom.menu.classList.add(...t)),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.remove(n):this.elements.controlledMenu.dom.menu.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((e=>{e!==this&&e.close()}))}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach((e=>e.close()))}}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o=!1,childMenu:i=null,toggle:r=null}=e;l(this,"_dom",{item:null,link:null}),l(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),l(this,"_submenu",!1),this._dom.item=t,this._dom.link=n,this._elements.parentMenu=s,this._elements.childMenu=i,this._elements.toggle=r,this._submenu=o}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function m(e){try{const t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((e=>!0===n[e]))||""}catch(e){return""}}function h(e){e.preventDefault(),e.stopPropagation()}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:o="",submenuToggleSelector:i="a",submenuSelector:l="ul",controllerElement:m=null,containerElement:h=null,openClass:d="show",closeClass:p="hide",isTopLevel:g=!0,parentMenu:f=null,hoverType:b="off",hoverDelay:v=250}=e;c(this,"_MenuType",a),c(this,"_MenuItemType",u),c(this,"_MenuToggleType",r),c(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),c(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),c(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),c(this,"_openClass","show"),c(this,"_closeClass","hide"),c(this,"_root",!0),c(this,"_currentChild",0),c(this,"_focusState","none"),c(this,"_currentEvent","none"),c(this,"_hoverType","off"),c(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=m,this._dom.container=h,this._selectors.menuItems=n,this._selectors.menuLinks=s,this._selectors.submenuItems=o,this._selectors.submenuToggles=i,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=f,this._elements.rootMenu=g?this:null,this._openClass=d||"",this._closeClass=p||"",this._root=g,this._hoverType=b,this._hoverDelay=v}initialize(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get shouldFocus(){let e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}set openClass(e){s({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){s({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set currentChild(e){function n(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu){let t=0,n=!1;for(;!n&&t<e.elements.parentMenu.elements.menuItems.length;){const s=e.elements.parentMenu.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}}t("number",{value:e}),e<-1?(this._currentChild=-1,n(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,n(this)):this.focusChild!==e&&(this._currentChild=e,n(this))}set focusState(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidState() must be inside of an object. ${typeof e} given.`);const t=["none","self","child"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&("self"===e||"none"===e)&&this.elements.submenuToggles.forEach((e=>{e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==e&&"child"!==e||(this.elements.parentMenu.focusState="child")}set currentEvent(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidEvent() must be inside of an object. ${typeof e} given.`);const t=["none","mouse","keyboard","character"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((t=>{t.elements.controlledMenu.currentEvent=e})))}set hoverType(e){o({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){t("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}_validate(){let i=!0;return null!==this._dom.container||null!==this._dom.controller?e(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(i=!1):e(HTMLElement,{menuElement:this._dom.menu})||(i=!1),""!==this._selectors.submenuItems?n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(i=!1):n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(i=!1),""===this._openClass||s({openClass:this._openClass})||(i=!1),""===this._closeClass||s({closeClass:this._closeClass})||(i=!1),t("boolean",{isTopLevel:this._root})||(i=!1),null===this._elements.parentMenu||e(a,{parentMenu:this._elements.parentMenu})||(i=!1),o({hoverType:this._hoverType})||(i=!1),t("number",{hoverDelay:this._hoverDelay})||(i=!1),i}_setDOMElementType(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[t])throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`);{if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);n!==this.dom.menu&&e(HTMLElement,{base:n});const o=Array.from(n.querySelectorAll(this.selectors[t])).filter((e=>e.parentElement===n));this._dom[t]=s?o:[...this._dom[t],...o]}}_resetDOMElementType(e){if(void 0===this.dom[e])throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`);if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}_setDOMElements(){this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)})))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}_createChildElements(){this.dom.menuItems.forEach((e=>{let t;if(this.dom.submenuItems.includes(e)){const n=e.querySelector(this.selectors.submenuToggles),s=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:s,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay}),i=new this._MenuToggleType({menuToggleElement:n,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(i),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:i})}else{const n=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this})}this._elements.menuItems.push(t)}))}_handleFocus(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("focus",(()=>{this.focusState="self",this.currentChild=t}))}))}_handleClick(){function e(e,t,n){h(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach(((t,n)=>{t.dom.link.addEventListener("pointerdown",(()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(n)}),{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",(n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)}))}_handleHover(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("pointerenter",(n=>{if("pen"!==n.pointerType&&"touch"!==n.pointerType)if("on"===this.hoverType)this.currentEvent="mouse",this.currentChild=t,e.isSubmenuItem&&e.elements.toggle.preview();else if("dynamic"===this.hoverType){const n=this.elements.submenuToggles.some((e=>e.isOpen));this.currentChild=t,this.isTopLevel&&"none"===this.focusState||(this.currentEvent="mouse",this.focusCurrentChild()),!e.isSubmenuItem||this.isTopLevel&&!n||(this.currentEvent="mouse",e.elements.toggle.preview())}})),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",(t=>{"pen"!==t.pointerType&&"touch"!==t.pointerType&&("on"===this.hoverType?this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close()):"dynamic"===this.hoverType&&(this.isTopLevel||(this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}))}))}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||h(e)}))}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||(h(e),this.elements.controller.open(),this.focusFirstChild())}))}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach((e=>e.close()))}blurChildren(){this.elements.menuItems.forEach((e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}class d extends u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o=!1,childMenu:i=null,toggle:r=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o,childMenu:i,toggle:r}),l&&this.initialize()}}class p extends r{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o=null,initialize:i=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}function g(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class f extends a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:o="",submenuToggleSelector:i="a",submenuSelector:r="ul",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="hide",isTopLevel:c=!0,parentMenu:a=null,hoverType:b="off",hoverDelay:v=250,optionalKeySupport:y=!1,initialize:_=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:o,submenuToggleSelector:i,submenuSelector:r,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:b,hoverDelay:v}),g(this,"_MenuType",f),g(this,"_MenuItemType",d),g(this,"_MenuToggleType",p),g(this,"_currentChild",-1),g(this,"_optionalSupport",!1),this._optionalSupport=y,_&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(e){t("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_validate(){let e=super._validate();return t("boolean",{optionalKeySupport:this._optionalSupport})||(e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",(e=>{"none"!==this.focusState&&(this.currentEvent="mouse",this.dom.menu.contains(e.target)||!this.dom.menu===e.target||(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))}))}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);if("self"===this.focusState){const n=["Space","Enter"],s=["Escape"],o=["Escape"];if(this.optionalKeySupport){["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(t)&&h(e)}else(this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&s.includes(t)||this.elements.parentMenu&&o.includes(t))&&h(e)}}))}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e);if("self"===this.focusState)if("Space"===t||"Enter"===t)this.currentMenuItem.isSubmenuItem?(h(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click();else if("Escape"===t){this.elements.submenuToggles.some((e=>e.isOpen))?(h(e),this.closeChildren()):this.elements.parentMenu?(h(e),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController())}else this.optionalKeySupport&&("ArrowDown"===t||"ArrowRight"===t?(h(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):"ArrowUp"===t||"ArrowLeft"===t?(h(e),this.focusPreviousChild()):"Home"===t?(h(e),this.focusFirstChild()):"End"===t&&(h(e),this.focusLastChild()))}))}}class b extends d{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o=!1,childMenu:i=null,toggle:r=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o,childMenu:i,toggle:r,initialize:!1}),l&&this.initialize()}}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class y extends p{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o=null,initialize:i=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o,initialize:!1}),v(this,"_dom",{toggle:null,parent:null,container:null}),this._dom.toggle=t,this._dom.parent=n,this._dom.container=s.isTopLevel?s.dom.container:s.dom.menu,i&&this.initialize()}initialize(){super.initialize(),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{openClass:t}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),""!==n&&("string"==typeof n?this.dom.container.classList.remove(n):this.dom.container.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}function _(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends f{constructor(e){let{menuElement:t,menuItemSelector:n=".nav-item",menuLinkSelector:s=".nav-link,.dropdown-item",submenuItemSelector:o=".dropdown",submenuToggleSelector:i=".dropdown-toggle",submenuSelector:r=".dropdown-menu",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="collapse",isTopLevel:c=!0,parentMenu:a=null,hoverType:d="off",hoverDelay:p=250,optionalKeySupport:g=!1,initialize:f=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:o,submenuToggleSelector:i,submenuSelector:r,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:d,hoverDelay:p,optionalKeySupport:g,initialize:!1}),_(this,"_MenuType",E),_(this,"_MenuItemType",b),_(this,"_MenuToggleType",y),f&&this.initialize()}}export{E as default};
//# sourceMappingURL=disclosure-menu-bs5.esm.min.js.map

@@ -1,2 +0,2 @@

var Bootstrap5DisclosureMenu=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n){try{if("object"!==e(n)){var o=e(n);throw new TypeError("AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ".concat(o," given."))}for(var r in n)if(!(n[r]instanceof t)){var i=e(n[r]);throw new TypeError("AccessibleMenu: ".concat(r," must be an instance of ").concat(t.name,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function n(t,n){try{if("object"!==e(n)){var o=e(n);throw new TypeError("AccessibleMenu: Values given to isValidType() must be inside of an object. ".concat(o," given."))}for(var r in n){var i=e(n[r]);if(i!==t)throw new TypeError("AccessibleMenu: ".concat(r," must be a ").concat(t,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function o(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ".concat(n," given."))}for(var o in t)try{if(null===t[o])throw new Error;document.querySelector(t[o])}catch(e){throw new TypeError("AccessibleMenu: ".concat(o,' must be a valid CSS selector. "').concat(t[o],'" given.'))}return!0}catch(e){return console.error(e),!1}}function r(t){try{if("object"!==e(t)||Array.isArray(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidClassList() must be inside of an object. ".concat(n," given."))}var r=function(n){var r=e(t[n]);if("string"!==r){if(!Array.isArray(t[n]))throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. ").concat(r," given."));t[n].forEach((function(e){if("string"!=typeof e)throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. An array containing non-strings given."))}))}else{var i={};i[n]=t[n],o(i)}};for(var i in t)r(i);return!0}catch(e){return console.error(e),!1}}function i(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ".concat(n," given."))}var o=["off","on","dynamic"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'));return!0}catch(e){return console.error(e),!1}}function u(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function s(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){function e(t){var n=t.menuToggleElement,o=t.parentElement,r=t.controlledMenu,i=t.parentMenu,u=void 0===i?null:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"_dom",{toggle:null,parent:null}),c(this,"_elements",{controlledMenu:null,parentMenu:null}),c(this,"_open",!1),c(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),c(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=n,this._dom.parent=o,this._elements.controlledMenu=r,this._elements.parentMenu=u}var o,r,i;return o=e,r=[{key:"initialize",value:function(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(e,o){if(n("string",{tagName:e})&&t(HTMLElement,o)){var r=e.toLowerCase(),i=!0;for(var u in o)o[u].tagName.toLowerCase()!==r&&(i=!1);return i}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){var e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10),o=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),r=e;!o.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(o=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),o.replace(/\s/g,"").length>0&&((o=o.toLowerCase().replace(/\s+/g,"-")).startsWith("-")&&(o=o.substring(1)),o.endsWith("-")&&(o=o.slice(0,-1)),r="".concat(o,"-").concat(r)),this.dom.toggle.id=this.dom.toggle.id||"".concat(r,"-menu-button"),this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||"".concat(r,"-menu")}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isOpen",get:function(){return this._open},set:function(e){n("boolean",{value:e}),this._open=e}},{key:"_expand",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.add(i):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(i))),""!==r&&("string"==typeof r?this.elements.controlledMenu.dom.menu.classList.remove(r):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(r))),n&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==r&&("string"==typeof r?this.elements.controlledMenu.dom.menu.classList.add(r):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(r))),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.remove(i):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}},{key:"open",value:function(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}},{key:"preview",value:function(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}},{key:"close",value:function(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}},{key:"toggle",value:function(){this.isOpen?this.close():this.open()}},{key:"closeSiblings",value:function(){var e=this;this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((function(t){t!==e&&t.close()}))}},{key:"closeChildren",value:function(){this.elements.controlledMenu.elements.submenuToggles.forEach((function(e){return e.close()}))}}],r&&s(o.prototype,r),i&&s(o,i),e}();function f(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(){function e(t){var n=t.menuItemElement,o=t.menuLinkElement,r=t.parentMenu,i=t.isSubmenuItem,u=void 0!==i&&i,l=t.childMenu,s=void 0===l?null:l,c=t.toggle,a=void 0===c?null:c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),m(this,"_dom",{item:null,link:null}),m(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),m(this,"_submenu",!1),this._dom.item=n,this._dom.link=o,this._elements.parentMenu=r,this._elements.childMenu=s,this._elements.toggle=a,this._submenu=u}var t,n,o;return t=e,(n=[{key:"initialize",value:function(){}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isSubmenuItem",get:function(){return this._submenu}},{key:"focus",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}},{key:"blur",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}])&&f(t.prototype,n),o&&f(t,o),e}();function p(e){try{var t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((function(e){return!0===n[e]}))||""}catch(e){return""}}function d(e){e.preventDefault(),e.stopPropagation()}function y(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function b(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _=function(){function u(e){var t=e.menuElement,n=e.menuItemSelector,o=void 0===n?"li":n,r=e.menuLinkSelector,i=void 0===r?"a":r,l=e.submenuItemSelector,s=void 0===l?"":l,c=e.submenuToggleSelector,f=void 0===c?"a":c,m=e.submenuSelector,p=void 0===m?"ul":m,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,_=e.openClass,E=void 0===_?"show":_,w=e.closeClass,M=void 0===w?"hide":w,S=e.isTopLevel,T=void 0===S||S,C=e.parentMenu,k=void 0===C?null:C,O=e.hoverType,I=void 0===O?"off":O,j=e.hoverDelay,A=void 0===j?250:j;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),g(this,"_MenuType",u),g(this,"_MenuItemType",h),g(this,"_MenuToggleType",a),g(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),g(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),g(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),g(this,"_openClass","show"),g(this,"_closeClass","hide"),g(this,"_root",!0),g(this,"_currentChild",0),g(this,"_focusState","none"),g(this,"_currentEvent","none"),g(this,"_hoverType","off"),g(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=y,this._dom.container=b,this._selectors.menuItems=o,this._selectors.menuLinks=i,this._selectors.submenuItems=s,this._selectors.submenuToggles=f,this._selectors.submenus=p,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=k,this._elements.rootMenu=T?this:null,this._openClass=E||"",this._closeClass=M||"",this._root=T,this._hoverType=I,this._hoverDelay=A}var l,s,c;return l=u,s=[{key:"initialize",value:function(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){var e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}},{key:"dom",get:function(){return this._dom}},{key:"selectors",get:function(){return this._selectors}},{key:"elements",get:function(){return this._elements}},{key:"isTopLevel",get:function(){return this._root}},{key:"openClass",get:function(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass},set:function(e){r({openClass:e}),this._openClass!==e&&(this._openClass=e)}},{key:"closeClass",get:function(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass},set:function(e){r({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}},{key:"currentChild",get:function(){return this._currentChild},set:function(e){function t(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu)for(var t=0,n=!1;!n&&t<e.elements.parentMenu.elements.menuItems.length;){var o=e.elements.parentMenu.elements.menuItems[t];o.isSubmenuItem&&o.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}n("number",{value:e}),e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}},{key:"focusState",get:function(){return this._focusState},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidState() must be inside of an object. ".concat(n," given."))}var o=["none","self","child"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&("self"===t||"none"===t)&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==t&&"child"!==t||(this.elements.parentMenu.focusState="child")}},{key:"currentEvent",get:function(){return this._currentEvent},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidEvent() must be inside of an object. ".concat(n," given."))}var o=["none","mouse","keyboard","character"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.currentEvent=t})))}},{key:"currentMenuItem",get:function(){return this.elements.menuItems[this.currentChild]}},{key:"hoverType",get:function(){return this._root?this._hoverType:this.elements.rootMenu.hoverType},set:function(e){i({value:e}),this._hoverType!==e&&(this._hoverType=e)}},{key:"hoverDelay",get:function(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay},set:function(e){n("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}},{key:"shouldFocus",get:function(){var e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}},{key:"_validate",value:function(){var e=!0;return null!==this._dom.container||null!==this._dom.controller?t(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(e=!1):t(HTMLElement,{menuElement:this._dom.menu})||(e=!1),""!==this._selectors.submenuItems?o({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(e=!1):o({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(e=!1),""===this._openClass||r({openClass:this._openClass})||(e=!1),""===this._closeClass||r({closeClass:this._closeClass})||(e=!1),n("boolean",{isTopLevel:this._root})||(e=!1),null===this._elements.parentMenu||t(u,{parentMenu:this._elements.parentMenu})||(e=!1),i({hoverType:this._hoverType})||(e=!1),n("number",{hoverDelay:this._hoverDelay})||(e=!1),e}},{key:"_setDOMElementType",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be set through _setDOMElementType.'));n!==this.dom.menu&&t(HTMLElement,{base:n});var r=Array.from(n.querySelectorAll(this.selectors[e])),i=r.filter((function(e){return e.parentElement===n}));this._dom[e]=o?i:[].concat(y(this._dom[e]),y(i))}},{key:"_resetDOMElementType",value:function(e){if(void 0===this.dom[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be reset through _resetDOMElementType.'));this._dom[e]=[]}},{key:"_setDOMElements",value:function(){var e=this;this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((function(t){e._setDOMElementType("submenuToggles",t,!1),e._setDOMElementType("submenus",t,!1)})))}},{key:"_findRootMenu",value:function(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}},{key:"_createChildElements",value:function(){var e=this;this.dom.menuItems.forEach((function(t){var n;if(e.dom.submenuItems.includes(t)){var o=t.querySelector(e.selectors.submenuToggles),r=t.querySelector(e.selectors.submenus),i=new e._MenuType({menuElement:r,menuItemSelector:e.selectors.menuItems,menuLinkSelector:e.selectors.menuLinks,submenuItemSelector:e.selectors.submenuItems,submenuToggleSelector:e.selectors.submenuToggles,submenuSelector:e.selectors.submenus,openClass:e.openClass,closeClass:e.closeClass,isTopLevel:!1,parentMenu:e,hoverType:e.hoverType,hoverDelay:e.hoverDelay}),u=new e._MenuToggleType({menuToggleElement:o,parentElement:t,controlledMenu:i,parentMenu:e});e._elements.submenuToggles.push(u),n=new e._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:e,isSubmenuItem:!0,childMenu:i,toggle:u})}else{var l=t.querySelector(e.selectors.menuLinks);n=new e._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:e})}e._elements.menuItems.push(n)}))}},{key:"_handleFocus",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("focus",(function(){e.focusState="self",e.currentChild=n}))}))}},{key:"_handleClick",value:function(){var e=this;function t(e,t,n){d(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((function(n,o){n.dom.link.addEventListener("pointerdown",(function(){e.currentEvent="mouse",e.elements.rootMenu.blurChildren(),e.focusChild(o)}),{passive:!0}),n.isSubmenuItem&&n.elements.toggle.dom.toggle.addEventListener("pointerup",(function(o){e.currentEvent="mouse",t(e,n.elements.toggle,o)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(function(n){e.currentEvent="mouse",t(e,e.elements.controller,n)}))}},{key:"_handleHover",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("pointerenter",(function(o){if("pen"!==o.pointerType&&"touch"!==o.pointerType)if("on"===e.hoverType)e.currentEvent="mouse",e.currentChild=n,t.isSubmenuItem&&t.elements.toggle.preview();else if("dynamic"===e.hoverType){var r=e.elements.submenuToggles.some((function(e){return e.isOpen}));e.currentChild=n,e.isTopLevel&&"none"===e.focusState||(e.currentEvent="mouse",e.focusCurrentChild()),!t.isSubmenuItem||e.isTopLevel&&!r||(e.currentEvent="mouse",t.elements.toggle.preview())}})),t.isSubmenuItem&&t.dom.item.addEventListener("pointerleave",(function(n){"pen"!==n.pointerType&&"touch"!==n.pointerType&&("on"===e.hoverType?e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close()):"dynamic"===e.hoverType&&(e.isTopLevel||(e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()))))}))}))}},{key:"_handleKeydown",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||(d(t),e.elements.controller.open(),e.focusFirstChild())}))}},{key:"focus",value:function(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}},{key:"blur",value:function(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}},{key:"focusCurrentChild",value:function(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}},{key:"focusChild",value:function(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}},{key:"focusFirstChild",value:function(){this.focusChild(0)}},{key:"focusLastChild",value:function(){this.focusChild(this.elements.menuItems.length-1)}},{key:"focusNextChild",value:function(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}},{key:"focusPreviousChild",value:function(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}},{key:"blurCurrentChild",value:function(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}},{key:"focusController",value:function(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}},{key:"focusContainer",value:function(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}},{key:"closeChildren",value:function(){this.elements.submenuToggles.forEach((function(e){return e.close()}))}},{key:"blurChildren",value:function(){this.elements.menuItems.forEach((function(e){e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}],s&&b(l.prototype,s),c&&b(l,c),u}();function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function w(e,t){return w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},w(e,t)}function M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=T(e);if(t){var r=T(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return S(this,n)}}function S(e,t){if(t&&("object"===E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}var C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}(n,e);var t=M(n);function n(e){var o,r=e.menuItemElement,i=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,f=e.toggle,m=void 0===f?null:f,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),o=t.call(this,{menuItemElement:r,menuLinkElement:i,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:m}),p&&o.initialize(),o}return n}(h);function k(e){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k(e)}function O(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function I(){return I="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=j(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},I.apply(this,arguments)}function j(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=P(e)););return e}function A(e,t){return A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},A(e,t)}function L(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=P(e);if(t){var r=P(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return R(this,n)}}function R(e,t){if(t&&("object"===k(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}var D=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(i,e);var t,n,o,r=L(i);function i(e){var t,n=e.menuToggleElement,o=e.parentElement,u=e.controlledMenu,l=e.parentMenu,s=void 0===l?null:l,c=e.initialize,a=void 0===c||c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuToggleElement:n,parentElement:o,controlledMenu:u,parentMenu:s}),a&&t.initialize(),t}return t=i,(n=[{key:"open",value:function(){this.closeSiblings(),I(P(i.prototype),"open",this).call(this)}},{key:"preview",value:function(){this.closeSiblings(),I(P(i.prototype),"preview",this).call(this)}},{key:"close",value:function(){this.isOpen&&this.closeChildren(),I(P(i.prototype),"close",this).call(this)}}])&&O(t.prototype,n),o&&O(t,o),i}(a);function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function z(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function K(){return K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=B(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},K.apply(this,arguments)}function B(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=N(e)););return e}function F(e,t){return F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},F(e,t)}function V(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=N(e);if(t){var r=N(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return H(this,n)}}function H(e,t){if(t&&("object"===x(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return U(e)}function U(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&F(e,t)}(u,e);var t,o,r,i=V(u);function u(e){var t,n=e.menuElement,o=e.menuItemSelector,r=void 0===o?"li":o,l=e.menuLinkSelector,s=void 0===l?"a":l,c=e.submenuItemSelector,a=void 0===c?"":c,f=e.submenuToggleSelector,m=void 0===f?"a":f,h=e.submenuSelector,p=void 0===h?"ul":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,_=void 0===g?"show":g,E=e.closeClass,w=void 0===E?"hide":E,M=e.isTopLevel,S=void 0===M||M,T=e.parentMenu,k=void 0===T?null:T,O=e.hoverType,I=void 0===O?"off":O,j=e.hoverDelay,A=void 0===j?250:j,L=e.optionalKeySupport,R=void 0!==L&&L,P=e.initialize,x=void 0===P||P;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),q(U(t=i.call(this,{menuElement:n,menuItemSelector:r,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:m,submenuSelector:p,controllerElement:y,containerElement:b,openClass:_,closeClass:w,isTopLevel:S,parentMenu:k,hoverType:I,hoverDelay:A})),"_MenuType",u),q(U(t),"_MenuItemType",C),q(U(t),"_MenuToggleType",D),q(U(t),"_currentChild",-1),q(U(t),"_optionalSupport",!1),t._optionalSupport=R,x&&t.initialize(),t}return t=u,(o=[{key:"initialize",value:function(){try{K(N(u.prototype),"initialize",this).call(this),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}},{key:"optionalKeySupport",get:function(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport},set:function(e){n("boolean",{optionalKeySupport:e}),this._optionalSupport=e}},{key:"_validate",value:function(){var e=K(N(u.prototype),"_validate",this).call(this);return n("boolean",{optionalKeySupport:this._optionalSupport})||(e=!1),e}},{key:"_handleClick",value:function(){var e=this;K(N(u.prototype),"_handleClick",this).call(this),document.addEventListener("pointerup",(function(t){"none"!==e.focusState&&(e.currentEvent="mouse",e.dom.menu.contains(t.target)||!e.dom.menu===t.target||(e.closeChildren(),e.blur(),e.elements.controller&&e.elements.controller.close()))}))}},{key:"_handleKeydown",value:function(){var e=this;K(N(u.prototype),"_handleKeydown",this).call(this),this.dom.menu.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"self"===e.focusState&&(e.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(n)&&d(t):(e.currentMenuItem.isSubmenuItem&&["Space","Enter"].includes(n)||e.elements.controller&&["Escape"].includes(n)||e.elements.parentMenu&&["Escape"].includes(n))&&d(t))}))}},{key:"_handleKeyup",value:function(){var e=this;K(N(u.prototype),"_handleKeyup",this).call(this),this.dom.menu.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t);"self"===e.focusState&&("Space"===n||"Enter"===n?e.currentMenuItem.isSubmenuItem?(d(t),e.currentMenuItem.elements.toggle.preview()):e.currentMenuItem.dom.link.click():"Escape"===n?e.elements.submenuToggles.some((function(e){return e.isOpen}))?(d(t),e.closeChildren()):e.elements.parentMenu?(d(t),e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.closeChildren(),e.elements.parentMenu.focusCurrentChild()):e.isTopLevel&&e.elements.controller&&e.elements.controller.isOpen&&(e.elements.controller.close(),e.focusController()):e.optionalKeySupport&&("ArrowDown"===n||"ArrowRight"===n?(d(t),e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen?(e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.childMenu.focusFirstChild()):e.focusNextChild()):"ArrowUp"===n||"ArrowLeft"===n?(d(t),e.focusPreviousChild()):"Home"===n?(d(t),e.focusFirstChild()):"End"===n&&(d(t),e.focusLastChild())))}))}}])&&z(t.prototype,o),r&&z(t,r),u}(_);function Z(e){return Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Z(e)}function W(e,t){return W=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},W(e,t)}function G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=Q(e);if(t){var r=Q(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return J(this,n)}}function J(e,t){if(t&&("object"===Z(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Q(e){return Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Q(e)}var X=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&W(e,t)}(n,e);var t=G(n);function n(e){var o,r=e.menuItemElement,i=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,f=e.toggle,m=void 0===f?null:f,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),o=t.call(this,{menuItemElement:r,menuLinkElement:i,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:m,initialize:!1}),p&&o.initialize(),o}return n}(C);function Y(e){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Y(e)}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ne(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function oe(){return oe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=re(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},oe.apply(this,arguments)}function re(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ce(e)););return e}function ie(e,t){return ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ie(e,t)}function ue(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ce(e);if(t){var r=ce(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return le(this,n)}}function le(e,t){if(t&&("object"===Y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return se(e)}function se(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e){return ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ce(e)}var ae=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ie(e,t)}(i,e);var t,n,o,r=ue(i);function i(e){var t,n,o,u,l=e.menuToggleElement,s=e.parentElement,c=e.controlledMenu,a=e.parentMenu,f=void 0===a?null:a,m=e.initialize,h=void 0===m||m;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuToggleElement:l,parentElement:s,controlledMenu:c,parentMenu:f,initialize:!1}),n=se(t),u={toggle:null,parent:null,container:null},(o="_dom")in n?Object.defineProperty(n,o,{value:u,enumerable:!0,configurable:!0,writable:!0}):n[o]=u,t._dom.toggle=l,t._dom.parent=s,t._dom.container=c.isTopLevel?c.dom.container:c.dom.menu,h&&t.initialize(),t}return t=i,n=[{key:"initialize",value:function(){oe(ce(i.prototype),"initialize",this).call(this),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}},{key:"_expand",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.elements.controlledMenu.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.dom.container.classList.add(n):(e=this.dom.container.classList).add.apply(e,ee(n))),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==r&&("string"==typeof r?this.dom.container.classList.add(r):(e=this.dom.container.classList).add.apply(e,ee(r))),""!==i&&("string"==typeof i?this.dom.container.classList.remove(i):(t=this.dom.container.classList).remove.apply(t,ee(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}],n&&ne(t.prototype,n),o&&ne(t,o),i}(D);function fe(e){return fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fe(e)}function me(e,t){return me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},me(e,t)}function he(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ye(e);if(t){var r=ye(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return pe(this,n)}}function pe(e,t){if(t&&("object"===fe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return de(e)}function de(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ye(e){return ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ye(e)}function ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}return function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(n,e);var t=he(n);function n(e){var o,r=e.menuElement,i=e.menuItemSelector,u=void 0===i?".nav-item":i,l=e.menuLinkSelector,s=void 0===l?".nav-link,.dropdown-item":l,c=e.submenuItemSelector,a=void 0===c?".dropdown":c,f=e.submenuToggleSelector,m=void 0===f?".dropdown-toggle":f,h=e.submenuSelector,p=void 0===h?".dropdown-menu":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,_=void 0===g?"show":g,E=e.closeClass,w=void 0===E?"collapse":E,M=e.isTopLevel,S=void 0===M||M,T=e.parentMenu,C=void 0===T?null:T,k=e.hoverType,O=void 0===k?"off":k,I=e.hoverDelay,j=void 0===I?250:I,A=e.optionalKeySupport,L=void 0!==A&&A,R=e.initialize,P=void 0===R||R;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),ve(de(o=t.call(this,{menuElement:r,menuItemSelector:u,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:m,submenuSelector:p,controllerElement:y,containerElement:b,openClass:_,closeClass:w,isTopLevel:S,parentMenu:C,hoverType:O,hoverDelay:j,optionalKeySupport:L,initialize:!1})),"_MenuType",n),ve(de(o),"_MenuItemType",X),ve(de(o),"_MenuToggleType",ae),P&&o.initialize(),o}return n}($)}();
var Bootstrap5DisclosureMenu=function(){"use strict";function e(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ${typeof t} given.`)}for(const n in t)if(!(t[n]instanceof e)){const s=typeof t[n];throw new TypeError(`AccessibleMenu: ${n} must be an instance of ${e.name}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function t(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Values given to isValidType() must be inside of an object. ${typeof t} given.`)}for(const n in t){const s=typeof t[n];if(s!==e)throw new TypeError(`AccessibleMenu: ${n} must be a ${e}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function n(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ${typeof e} given.`)}for(const t in e)try{if(null===e[t])throw new Error;document.querySelector(e[t])}catch(n){throw new TypeError(`AccessibleMenu: ${t} must be a valid CSS selector. "${e[t]}" given.`)}return!0}catch(e){return console.error(e),!1}}function s(e){try{if("object"!=typeof e||Array.isArray(e)){throw new TypeError(`AccessibleMenu: Values given to isValidClassList() must be inside of an object. ${typeof e} given.`)}for(const t in e){const s=typeof e[t];if("string"!==s){if(!Array.isArray(e[t]))throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. ${s} given.`);e[t].forEach((e=>{if("string"!=typeof e)throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. An array containing non-strings given.`)}))}else{const s={};s[t]=e[t],n(s)}}return!0}catch(e){return console.error(e),!1}}function o(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ${typeof e} given.`)}const t=["off","on","dynamic"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}function i(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class r{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o=null}=e;i(this,"_dom",{toggle:null,parent:null}),i(this,"_elements",{controlledMenu:null,parentMenu:null}),i(this,"_open",!1),i(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),i(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=t,this._dom.parent=n,this._elements.controlledMenu=s,this._elements.parentMenu=o}initialize(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(n,s){if(t("string",{tagName:n})&&e(HTMLElement,s)){const e=n.toLowerCase();let t=!0;for(const n in s)s[n].tagName.toLowerCase()!==e&&(t=!1);return t}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let t=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),n=e;!t.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(t=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),t.replace(/\s/g,"").length>0&&(t=t.toLowerCase().replace(/\s+/g,"-"),t.startsWith("-")&&(t=t.substring(1)),t.endsWith("-")&&(t=t.slice(0,-1)),n=`${t}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){t("boolean",{value:e}),this._open=e}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.add(n):this.elements.controlledMenu.dom.menu.classList.add(...n)),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.remove(t):this.elements.controlledMenu.dom.menu.classList.remove(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.add(t):this.elements.controlledMenu.dom.menu.classList.add(...t)),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.remove(n):this.elements.controlledMenu.dom.menu.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((e=>{e!==this&&e.close()}))}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach((e=>e.close()))}}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o=!1,childMenu:i=null,toggle:r=null}=e;l(this,"_dom",{item:null,link:null}),l(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),l(this,"_submenu",!1),this._dom.item=t,this._dom.link=n,this._elements.parentMenu=s,this._elements.childMenu=i,this._elements.toggle=r,this._submenu=o}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function m(e){try{const t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((e=>!0===n[e]))||""}catch(e){return""}}function h(e){e.preventDefault(),e.stopPropagation()}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:o="",submenuToggleSelector:i="a",submenuSelector:l="ul",controllerElement:m=null,containerElement:h=null,openClass:d="show",closeClass:p="hide",isTopLevel:g=!0,parentMenu:f=null,hoverType:b="off",hoverDelay:v=250}=e;c(this,"_MenuType",a),c(this,"_MenuItemType",u),c(this,"_MenuToggleType",r),c(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),c(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),c(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),c(this,"_openClass","show"),c(this,"_closeClass","hide"),c(this,"_root",!0),c(this,"_currentChild",0),c(this,"_focusState","none"),c(this,"_currentEvent","none"),c(this,"_hoverType","off"),c(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=m,this._dom.container=h,this._selectors.menuItems=n,this._selectors.menuLinks=s,this._selectors.submenuItems=o,this._selectors.submenuToggles=i,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=f,this._elements.rootMenu=g?this:null,this._openClass=d||"",this._closeClass=p||"",this._root=g,this._hoverType=b,this._hoverDelay=v}initialize(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get shouldFocus(){let e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}set openClass(e){s({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){s({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set currentChild(e){function n(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu){let t=0,n=!1;for(;!n&&t<e.elements.parentMenu.elements.menuItems.length;){const s=e.elements.parentMenu.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}}t("number",{value:e}),e<-1?(this._currentChild=-1,n(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,n(this)):this.focusChild!==e&&(this._currentChild=e,n(this))}set focusState(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidState() must be inside of an object. ${typeof e} given.`);const t=["none","self","child"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&("self"===e||"none"===e)&&this.elements.submenuToggles.forEach((e=>{e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==e&&"child"!==e||(this.elements.parentMenu.focusState="child")}set currentEvent(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidEvent() must be inside of an object. ${typeof e} given.`);const t=["none","mouse","keyboard","character"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((t=>{t.elements.controlledMenu.currentEvent=e})))}set hoverType(e){o({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){t("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}_validate(){let i=!0;return null!==this._dom.container||null!==this._dom.controller?e(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(i=!1):e(HTMLElement,{menuElement:this._dom.menu})||(i=!1),""!==this._selectors.submenuItems?n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(i=!1):n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(i=!1),""===this._openClass||s({openClass:this._openClass})||(i=!1),""===this._closeClass||s({closeClass:this._closeClass})||(i=!1),t("boolean",{isTopLevel:this._root})||(i=!1),null===this._elements.parentMenu||e(a,{parentMenu:this._elements.parentMenu})||(i=!1),o({hoverType:this._hoverType})||(i=!1),t("number",{hoverDelay:this._hoverDelay})||(i=!1),i}_setDOMElementType(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[t])throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`);{if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);n!==this.dom.menu&&e(HTMLElement,{base:n});const o=Array.from(n.querySelectorAll(this.selectors[t])).filter((e=>e.parentElement===n));this._dom[t]=s?o:[...this._dom[t],...o]}}_resetDOMElementType(e){if(void 0===this.dom[e])throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`);if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}_setDOMElements(){this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)})))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}_createChildElements(){this.dom.menuItems.forEach((e=>{let t;if(this.dom.submenuItems.includes(e)){const n=e.querySelector(this.selectors.submenuToggles),s=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:s,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay}),i=new this._MenuToggleType({menuToggleElement:n,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(i),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:i})}else{const n=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this})}this._elements.menuItems.push(t)}))}_handleFocus(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("focus",(()=>{this.focusState="self",this.currentChild=t}))}))}_handleClick(){function e(e,t,n){h(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach(((t,n)=>{t.dom.link.addEventListener("pointerdown",(()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(n)}),{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",(n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)}))}_handleHover(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("pointerenter",(n=>{if("pen"!==n.pointerType&&"touch"!==n.pointerType)if("on"===this.hoverType)this.currentEvent="mouse",this.currentChild=t,e.isSubmenuItem&&e.elements.toggle.preview();else if("dynamic"===this.hoverType){const n=this.elements.submenuToggles.some((e=>e.isOpen));this.currentChild=t,this.isTopLevel&&"none"===this.focusState||(this.currentEvent="mouse",this.focusCurrentChild()),!e.isSubmenuItem||this.isTopLevel&&!n||(this.currentEvent="mouse",e.elements.toggle.preview())}})),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",(t=>{"pen"!==t.pointerType&&"touch"!==t.pointerType&&("on"===this.hoverType?this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close()):"dynamic"===this.hoverType&&(this.isTopLevel||(this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}))}))}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||h(e)}))}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||(h(e),this.elements.controller.open(),this.focusFirstChild())}))}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach((e=>e.close()))}blurChildren(){this.elements.menuItems.forEach((e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}class d extends u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o=!1,childMenu:i=null,toggle:r=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o,childMenu:i,toggle:r}),l&&this.initialize()}}class p extends r{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o=null,initialize:i=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}function g(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class f extends a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:o="",submenuToggleSelector:i="a",submenuSelector:r="ul",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="hide",isTopLevel:c=!0,parentMenu:a=null,hoverType:b="off",hoverDelay:v=250,optionalKeySupport:y=!1,initialize:_=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:o,submenuToggleSelector:i,submenuSelector:r,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:b,hoverDelay:v}),g(this,"_MenuType",f),g(this,"_MenuItemType",d),g(this,"_MenuToggleType",p),g(this,"_currentChild",-1),g(this,"_optionalSupport",!1),this._optionalSupport=y,_&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(e){t("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_validate(){let e=super._validate();return t("boolean",{optionalKeySupport:this._optionalSupport})||(e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",(e=>{"none"!==this.focusState&&(this.currentEvent="mouse",this.dom.menu.contains(e.target)||!this.dom.menu===e.target||(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))}))}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);if("self"===this.focusState){const n=["Space","Enter"],s=["Escape"],o=["Escape"];if(this.optionalKeySupport){["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(t)&&h(e)}else(this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&s.includes(t)||this.elements.parentMenu&&o.includes(t))&&h(e)}}))}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e);if("self"===this.focusState)if("Space"===t||"Enter"===t)this.currentMenuItem.isSubmenuItem?(h(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click();else if("Escape"===t){this.elements.submenuToggles.some((e=>e.isOpen))?(h(e),this.closeChildren()):this.elements.parentMenu?(h(e),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController())}else this.optionalKeySupport&&("ArrowDown"===t||"ArrowRight"===t?(h(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):"ArrowUp"===t||"ArrowLeft"===t?(h(e),this.focusPreviousChild()):"Home"===t?(h(e),this.focusFirstChild()):"End"===t&&(h(e),this.focusLastChild()))}))}}class b extends d{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o=!1,childMenu:i=null,toggle:r=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:o,childMenu:i,toggle:r,initialize:!1}),l&&this.initialize()}}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class y extends p{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o=null,initialize:i=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:o,initialize:!1}),v(this,"_dom",{toggle:null,parent:null,container:null}),this._dom.toggle=t,this._dom.parent=n,this._dom.container=s.isTopLevel?s.dom.container:s.dom.menu,i&&this.initialize()}initialize(){super.initialize(),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{openClass:t}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),""!==n&&("string"==typeof n?this.dom.container.classList.remove(n):this.dom.container.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}function _(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends f{constructor(e){let{menuElement:t,menuItemSelector:n=".nav-item",menuLinkSelector:s=".nav-link,.dropdown-item",submenuItemSelector:o=".dropdown",submenuToggleSelector:i=".dropdown-toggle",submenuSelector:r=".dropdown-menu",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="collapse",isTopLevel:c=!0,parentMenu:a=null,hoverType:d="off",hoverDelay:p=250,optionalKeySupport:g=!1,initialize:f=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:o,submenuToggleSelector:i,submenuSelector:r,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:d,hoverDelay:p,optionalKeySupport:g,initialize:!1}),_(this,"_MenuType",E),_(this,"_MenuItemType",b),_(this,"_MenuToggleType",y),f&&this.initialize()}}return E}();
//# sourceMappingURL=disclosure-menu-bs5.min.js.map

@@ -1,2 +0,2 @@

function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n){try{if("object"!==e(n)){var o=e(n);throw new TypeError("AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ".concat(o," given."))}for(var r in n)if(!(n[r]instanceof t)){var i=e(n[r]);throw new TypeError("AccessibleMenu: ".concat(r," must be an instance of ").concat(t.name,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function n(t,n){try{if("object"!==e(n)){var o=e(n);throw new TypeError("AccessibleMenu: Values given to isValidType() must be inside of an object. ".concat(o," given."))}for(var r in n){var i=e(n[r]);if(i!==t)throw new TypeError("AccessibleMenu: ".concat(r," must be a ").concat(t,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function o(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ".concat(n," given."))}for(var o in t)try{if(null===t[o])throw new Error;document.querySelector(t[o])}catch(e){throw new TypeError("AccessibleMenu: ".concat(o,' must be a valid CSS selector. "').concat(t[o],'" given.'))}return!0}catch(e){return console.error(e),!1}}function r(t){try{if("object"!==e(t)||Array.isArray(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidClassList() must be inside of an object. ".concat(n," given."))}var r=function(n){var r=e(t[n]);if("string"!==r){if(!Array.isArray(t[n]))throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. ").concat(r," given."));t[n].forEach((function(e){if("string"!=typeof e)throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. An array containing non-strings given."))}))}else{var i={};i[n]=t[n],o(i)}};for(var i in t)r(i);return!0}catch(e){return console.error(e),!1}}function i(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ".concat(n," given."))}var o=["off","on","dynamic"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'));return!0}catch(e){return console.error(e),!1}}function u(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function s(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){function e(t){var n=t.menuToggleElement,o=t.parentElement,r=t.controlledMenu,i=t.parentMenu,u=void 0===i?null:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"_dom",{toggle:null,parent:null}),c(this,"_elements",{controlledMenu:null,parentMenu:null}),c(this,"_open",!1),c(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),c(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=n,this._dom.parent=o,this._elements.controlledMenu=r,this._elements.parentMenu=u}var o,r,i;return o=e,r=[{key:"initialize",value:function(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(e,o){if(n("string",{tagName:e})&&t(HTMLElement,o)){var r=e.toLowerCase(),i=!0;for(var u in o)o[u].tagName.toLowerCase()!==r&&(i=!1);return i}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){var e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10),o=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),r=e;!o.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(o=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),o.replace(/\s/g,"").length>0&&((o=o.toLowerCase().replace(/\s+/g,"-")).startsWith("-")&&(o=o.substring(1)),o.endsWith("-")&&(o=o.slice(0,-1)),r="".concat(o,"-").concat(r)),this.dom.toggle.id=this.dom.toggle.id||"".concat(r,"-menu-button"),this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||"".concat(r,"-menu")}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isOpen",get:function(){return this._open},set:function(e){n("boolean",{value:e}),this._open=e}},{key:"_expand",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.add(i):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(i))),""!==r&&("string"==typeof r?this.elements.controlledMenu.dom.menu.classList.remove(r):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(r))),n&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==r&&("string"==typeof r?this.elements.controlledMenu.dom.menu.classList.add(r):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(r))),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.remove(i):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}},{key:"open",value:function(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}},{key:"preview",value:function(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}},{key:"close",value:function(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}},{key:"toggle",value:function(){this.isOpen?this.close():this.open()}},{key:"closeSiblings",value:function(){var e=this;this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((function(t){t!==e&&t.close()}))}},{key:"closeChildren",value:function(){this.elements.controlledMenu.elements.submenuToggles.forEach((function(e){return e.close()}))}}],r&&s(o.prototype,r),i&&s(o,i),e}();function m(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(){function e(t){var n=t.menuItemElement,o=t.menuLinkElement,r=t.parentMenu,i=t.isSubmenuItem,u=void 0!==i&&i,l=t.childMenu,s=void 0===l?null:l,c=t.toggle,a=void 0===c?null:c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"_dom",{item:null,link:null}),f(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),f(this,"_submenu",!1),this._dom.item=n,this._dom.link=o,this._elements.parentMenu=r,this._elements.childMenu=s,this._elements.toggle=a,this._submenu=u}var t,n,o;return t=e,(n=[{key:"initialize",value:function(){}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isSubmenuItem",get:function(){return this._submenu}},{key:"focus",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}},{key:"blur",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}])&&m(t.prototype,n),o&&m(t,o),e}();function p(e){try{var t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((function(e){return!0===n[e]}))||""}catch(e){return""}}function d(e){e.preventDefault(),e.stopPropagation()}function y(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function b(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var M=function(){function u(e){var t=e.menuElement,n=e.menuItemSelector,o=void 0===n?"li":n,r=e.menuLinkSelector,i=void 0===r?"a":r,l=e.submenuItemSelector,s=void 0===l?"":l,c=e.submenuToggleSelector,m=void 0===c?"a":c,f=e.submenuSelector,p=void 0===f?"ul":f,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,M=e.openClass,_=void 0===M?"show":M,E=e.closeClass,w=void 0===E?"hide":E,C=e.isTopLevel,S=void 0===C||C,T=e.parentMenu,I=void 0===T?null:T,k=e.hoverType,O=void 0===k?"off":k,A=e.hoverDelay,L=void 0===A?250:A;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),g(this,"_MenuType",u),g(this,"_MenuItemType",h),g(this,"_MenuToggleType",a),g(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),g(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),g(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),g(this,"_openClass","show"),g(this,"_closeClass","hide"),g(this,"_root",!0),g(this,"_currentChild",0),g(this,"_focusState","none"),g(this,"_currentEvent","none"),g(this,"_hoverType","off"),g(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=y,this._dom.container=b,this._selectors.menuItems=o,this._selectors.menuLinks=i,this._selectors.submenuItems=s,this._selectors.submenuToggles=m,this._selectors.submenus=p,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=I,this._elements.rootMenu=S?this:null,this._openClass=_||"",this._closeClass=w||"",this._root=S,this._hoverType=O,this._hoverDelay=L}var l,s,c;return l=u,s=[{key:"initialize",value:function(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){var e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}},{key:"dom",get:function(){return this._dom}},{key:"selectors",get:function(){return this._selectors}},{key:"elements",get:function(){return this._elements}},{key:"isTopLevel",get:function(){return this._root}},{key:"openClass",get:function(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass},set:function(e){r({openClass:e}),this._openClass!==e&&(this._openClass=e)}},{key:"closeClass",get:function(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass},set:function(e){r({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}},{key:"currentChild",get:function(){return this._currentChild},set:function(e){function t(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu)for(var t=0,n=!1;!n&&t<e.elements.parentMenu.elements.menuItems.length;){var o=e.elements.parentMenu.elements.menuItems[t];o.isSubmenuItem&&o.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}n("number",{value:e}),e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}},{key:"focusState",get:function(){return this._focusState},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidState() must be inside of an object. ".concat(n," given."))}var o=["none","self","child"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&("self"===t||"none"===t)&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==t&&"child"!==t||(this.elements.parentMenu.focusState="child")}},{key:"currentEvent",get:function(){return this._currentEvent},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidEvent() must be inside of an object. ".concat(n," given."))}var o=["none","mouse","keyboard","character"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.currentEvent=t})))}},{key:"currentMenuItem",get:function(){return this.elements.menuItems[this.currentChild]}},{key:"hoverType",get:function(){return this._root?this._hoverType:this.elements.rootMenu.hoverType},set:function(e){i({value:e}),this._hoverType!==e&&(this._hoverType=e)}},{key:"hoverDelay",get:function(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay},set:function(e){n("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}},{key:"shouldFocus",get:function(){var e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}},{key:"_validate",value:function(){var e=!0;return null!==this._dom.container||null!==this._dom.controller?t(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(e=!1):t(HTMLElement,{menuElement:this._dom.menu})||(e=!1),""!==this._selectors.submenuItems?o({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(e=!1):o({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(e=!1),""===this._openClass||r({openClass:this._openClass})||(e=!1),""===this._closeClass||r({closeClass:this._closeClass})||(e=!1),n("boolean",{isTopLevel:this._root})||(e=!1),null===this._elements.parentMenu||t(u,{parentMenu:this._elements.parentMenu})||(e=!1),i({hoverType:this._hoverType})||(e=!1),n("number",{hoverDelay:this._hoverDelay})||(e=!1),e}},{key:"_setDOMElementType",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be set through _setDOMElementType.'));n!==this.dom.menu&&t(HTMLElement,{base:n});var r=Array.from(n.querySelectorAll(this.selectors[e])),i=r.filter((function(e){return e.parentElement===n}));this._dom[e]=o?i:[].concat(y(this._dom[e]),y(i))}},{key:"_resetDOMElementType",value:function(e){if(void 0===this.dom[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be reset through _resetDOMElementType.'));this._dom[e]=[]}},{key:"_setDOMElements",value:function(){var e=this;this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((function(t){e._setDOMElementType("submenuToggles",t,!1),e._setDOMElementType("submenus",t,!1)})))}},{key:"_findRootMenu",value:function(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}},{key:"_createChildElements",value:function(){var e=this;this.dom.menuItems.forEach((function(t){var n;if(e.dom.submenuItems.includes(t)){var o=t.querySelector(e.selectors.submenuToggles),r=t.querySelector(e.selectors.submenus),i=new e._MenuType({menuElement:r,menuItemSelector:e.selectors.menuItems,menuLinkSelector:e.selectors.menuLinks,submenuItemSelector:e.selectors.submenuItems,submenuToggleSelector:e.selectors.submenuToggles,submenuSelector:e.selectors.submenus,openClass:e.openClass,closeClass:e.closeClass,isTopLevel:!1,parentMenu:e,hoverType:e.hoverType,hoverDelay:e.hoverDelay}),u=new e._MenuToggleType({menuToggleElement:o,parentElement:t,controlledMenu:i,parentMenu:e});e._elements.submenuToggles.push(u),n=new e._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:e,isSubmenuItem:!0,childMenu:i,toggle:u})}else{var l=t.querySelector(e.selectors.menuLinks);n=new e._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:e})}e._elements.menuItems.push(n)}))}},{key:"_handleFocus",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("focus",(function(){e.focusState="self",e.currentChild=n}))}))}},{key:"_handleClick",value:function(){var e=this;function t(e,t,n){d(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((function(n,o){n.dom.link.addEventListener("pointerdown",(function(){e.currentEvent="mouse",e.elements.rootMenu.blurChildren(),e.focusChild(o)}),{passive:!0}),n.isSubmenuItem&&n.elements.toggle.dom.toggle.addEventListener("pointerup",(function(o){e.currentEvent="mouse",t(e,n.elements.toggle,o)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(function(n){e.currentEvent="mouse",t(e,e.elements.controller,n)}))}},{key:"_handleHover",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("pointerenter",(function(o){if("pen"!==o.pointerType&&"touch"!==o.pointerType)if("on"===e.hoverType)e.currentEvent="mouse",e.currentChild=n,t.isSubmenuItem&&t.elements.toggle.preview();else if("dynamic"===e.hoverType){var r=e.elements.submenuToggles.some((function(e){return e.isOpen}));e.currentChild=n,e.isTopLevel&&"none"===e.focusState||(e.currentEvent="mouse",e.focusCurrentChild()),!t.isSubmenuItem||e.isTopLevel&&!r||(e.currentEvent="mouse",t.elements.toggle.preview())}})),t.isSubmenuItem&&t.dom.item.addEventListener("pointerleave",(function(n){"pen"!==n.pointerType&&"touch"!==n.pointerType&&("on"===e.hoverType?e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close()):"dynamic"===e.hoverType&&(e.isTopLevel||(e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()))))}))}))}},{key:"_handleKeydown",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||(d(t),e.elements.controller.open(),e.focusFirstChild())}))}},{key:"focus",value:function(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}},{key:"blur",value:function(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}},{key:"focusCurrentChild",value:function(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}},{key:"focusChild",value:function(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}},{key:"focusFirstChild",value:function(){this.focusChild(0)}},{key:"focusLastChild",value:function(){this.focusChild(this.elements.menuItems.length-1)}},{key:"focusNextChild",value:function(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}},{key:"focusPreviousChild",value:function(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}},{key:"blurCurrentChild",value:function(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}},{key:"focusController",value:function(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}},{key:"focusContainer",value:function(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}},{key:"closeChildren",value:function(){this.elements.submenuToggles.forEach((function(e){return e.close()}))}},{key:"blurChildren",value:function(){this.elements.menuItems.forEach((function(e){e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}],s&&b(l.prototype,s),c&&b(l,c),u}();function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function E(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function w(){return w="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=C(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},w.apply(this,arguments)}function C(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}function S(e,t){return S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},S(e,t)}function T(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=k(e);if(t){var r=k(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return I(this,n)}}function I(e,t){if(t&&("object"===_(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}var O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(i,h);var t,n,o,r=T(i);function i(e){var t,n=e.menuItemElement,o=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,m=e.toggle,f=void 0===m?null:m,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuItemElement:n,menuLinkElement:o,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:f}),p&&t.initialize(),t}return t=i,(n=[{key:"initialize",value:function(){w(k(i.prototype),"initialize",this).call(this),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","menuitem"),this.dom.link.tabIndex=-1}},{key:"focus",value:function(){w(k(i.prototype),"focus",this).call(this),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=0)}},{key:"blur",value:function(){w(k(i.prototype),"blur",this).call(this),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=-1)}}])&&E(t.prototype,n),o&&E(t,o),i}();function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function L(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function j(){return j="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=R(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},j.apply(this,arguments)}function R(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=z(e)););return e}function P(e,t){return P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},P(e,t)}function D(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=z(e);if(t){var r=z(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return x(this,n)}}function x(e,t){if(t&&("object"===A(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function z(e){return z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},z(e)}var F=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&P(e,t)}(i,a);var t,n,o,r=D(i);function i(e){var t,n=e.menuToggleElement,o=e.parentElement,u=e.controlledMenu,l=e.parentMenu,s=void 0===l?null:l,c=e.initialize,a=void 0===c||c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuToggleElement:n,parentElement:o,controlledMenu:u,parentMenu:s}),a&&t.initialize(),t}return t=i,(n=[{key:"open",value:function(){this.closeSiblings(),j(z(i.prototype),"open",this).call(this)}},{key:"preview",value:function(){this.closeSiblings(),j(z(i.prototype),"preview",this).call(this)}},{key:"close",value:function(){this.isOpen&&this.closeChildren(),j(z(i.prototype),"close",this).call(this)}}])&&L(t.prototype,n),o&&L(t,o),i}();function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}function B(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function V(){return V="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=K(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},V.apply(this,arguments)}function K(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=$(e)););return e}function N(e,t){return N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},N(e,t)}function q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=$(e);if(t){var r=$(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return U(this,n)}}function U(e,t){if(t&&("object"===H(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return W(e)}function W(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$(e)}function Z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&N(e,t)}(i,M);var t,n,o,r=q(i);function i(e){var t,n=e.menuElement,o=e.menuItemSelector,u=void 0===o?"li":o,l=e.menuLinkSelector,s=void 0===l?"a":l,c=e.submenuItemSelector,a=void 0===c?"":c,m=e.submenuToggleSelector,f=void 0===m?"a":m,h=e.submenuSelector,p=void 0===h?"ul":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,M=void 0===g?"show":g,_=e.closeClass,E=void 0===_?"hide":_,w=e.isTopLevel,C=void 0===w||w,S=e.parentMenu,T=void 0===S?null:S,I=e.hoverType,k=void 0===I?"off":I,A=e.hoverDelay,L=void 0===A?250:A,j=e.initialize,R=void 0===j||j;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),Z(W(t=r.call(this,{menuElement:n,menuItemSelector:u,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:f,submenuSelector:p,controllerElement:y,containerElement:b,openClass:M,closeClass:E,isTopLevel:C,parentMenu:T,hoverType:k,hoverDelay:L})),"_MenuType",i),Z(W(t),"_MenuItemType",O),Z(W(t),"_MenuToggleType",F),R&&t.initialize(),t}return t=i,(n=[{key:"initialize",value:function(){try{V($(i.prototype),"initialize",this).call(this),this.dom.menu.setAttribute("role","menubar"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(e){console.error(e)}}},{key:"_handleClick",value:function(){var e=this;V($(i.prototype),"_handleClick",this).call(this),document.addEventListener("pointerup",(function(t){"none"!==e.focusState&&(e.currentEvent="mouse",e.dom.menu.contains(t.target)||!e.dom.menu===t.target||(e.closeChildren(),e.blur(),e.elements.controller&&e.elements.controller.close()))}))}},{key:"_handleKeydown",value:function(){var e=this;V($(i.prototype),"_handleKeydown",this).call(this),this.dom.menu.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Tab"===n&&("none"!==e.elements.rootMenu.focusState?(e.elements.rootMenu.blur(),e.elements.rootMenu.closeChildren()):e.elements.rootMenu.focus()),"Character"===n?d(t):e.isTopLevel?"self"===e.focusState&&(["ArrowRight","ArrowLeft","Home","End"].includes(n)||e.currentMenuItem.isSubmenuItem&&["Space","Enter","ArrowDown","ArrowUp"].includes(n)||e.elements.controller&&["Escape"].includes(n))&&d(t):(["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"].includes(n)||e.currentMenuItem.isSubmenuItem&&["Space","Enter"].includes(n))&&d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;V($(i.prototype),"_handleKeyup",this).call(this),this.dom.menu.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t),o=t.altKey,r=t.crtlKey,i=t.metaKey;if("Character"!==n||o||r||i)if(e.isTopLevel){if("self"===e.focusState)if("Space"===n||"Enter"===n)e.currentMenuItem.isSubmenuItem?(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusFirstChild()}))):e.currentMenuItem.dom.link.click();else if("ArrowRight"===n){d(t);var u=e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen;e.focusNextChild(),u&&(e.currentMenuItem.isSubmenuItem?(e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.preview()):e.closeChildren())}else if("ArrowLeft"===n){d(t);var l=e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen;e.focusPreviousChild(),l&&(e.currentMenuItem.isSubmenuItem?(e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.preview()):e.closeChildren())}else"ArrowDown"===n?e.currentMenuItem.isSubmenuItem&&(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusFirstChild()}))):"ArrowUp"===n?e.currentMenuItem.isSubmenuItem&&(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusLastChild()}))):"Home"===n?(d(t),e.focusFirstChild()):"End"===n?(d(t),e.focusLastChild()):"Escape"===n&&(e.elements.submenuToggles.some((function(e){return e.isOpen}))?(d(t),e.closeChildren()):e.isTopLevel&&e.elements.controller&&e.elements.controller.isOpen&&(d(t),e.elements.controller.close(),e.focusController()))}else"Space"===n||"Enter"===n?e.currentMenuItem.isSubmenuItem?(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusFirstChild()}))):e.currentMenuItem.dom.link.click():"Escape"===n?(d(t),e.elements.rootMenu.closeChildren(),e.elements.rootMenu.focusCurrentChild()):"ArrowRight"===n?e.currentMenuItem.isSubmenuItem?(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusFirstChild()}))):(d(t),e.elements.rootMenu.closeChildren(),e.elements.rootMenu.focusNextChild(),e.elements.rootMenu.currentMenuItem.isSubmenuItem&&e.elements.rootMenu.currentMenuItem.elements.toggle.preview()):"ArrowLeft"===n?e.elements.parentMenu.currentMenuItem.isSubmenuItem&&(d(t),e.elements.parentMenu.currentMenuItem.elements.toggle.close(),e.elements.parentMenu.focusCurrentChild(),e.elements.parentMenu===e.elements.rootMenu&&(e.elements.rootMenu.closeChildren(),e.elements.rootMenu.focusPreviousChild(),e.elements.rootMenu.currentMenuItem.isSubmenuItem&&(e.elements.rootMenu.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.elements.rootMenu.currentMenuItem.elements.toggle.preview()))):"ArrowDown"===n?(d(t),e.focusNextChild()):"ArrowUp"===n?(d(t),e.focusPreviousChild()):"Home"===n?(d(t),e.focusFirstChild()):"End"===n&&(d(t),e.focusLastChild());else d(t),e.elements.rootMenu.currentEvent="character",e.focusNextChildWithCharacter(t.key)}))}},{key:"focusNextChild",value:function(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}},{key:"focusPreviousChild",value:function(){0===this.currentChild?this.focusLastChild():this.focusChild(this.currentChild-1)}},{key:"focusNextChildWithCharacter",value:function(e){for(var t=e.toLowerCase(),n=this.currentChild+1,o=!1;!o&&n<this.elements.menuItems.length;)(this.elements.menuItems[n].dom.item.innerText?this.elements.menuItems[n].dom.item.innerText:this.elements.menuItems[n].dom.item.textContent).replace(/[\s]/g,"").toLowerCase().charAt(0)===t&&(o=!0,this.focusChild(n)),n++}}])&&B(t.prototype,n),o&&B(t,o),i}();function J(e){return J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},J(e)}function Q(e,t){return Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Q(e,t)}function X(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ee(e);if(t){var r=ee(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return Y(this,n)}}function Y(e,t){if(t&&("object"===J(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ee(e){return ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ee(e)}var te=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Q(e,t)}(n,O);var t=X(n);function n(e){var o,r=e.menuItemElement,i=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,m=e.toggle,f=void 0===m?null:m,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),o=t.call(this,{menuItemElement:r,menuLinkElement:i,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:f,initialize:!1}),p&&o.initialize(),o}return n}();function ne(e){return ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ne(e)}function oe(e){return function(e){if(Array.isArray(e))return re(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return re(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ie(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ue(){return ue="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=le(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},ue.apply(this,arguments)}function le(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=fe(e)););return e}function se(e,t){return se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},se(e,t)}function ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=fe(e);if(t){var r=fe(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ae(this,n)}}function ae(e,t){if(t&&("object"===ne(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return me(e)}function me(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},fe(e)}var he=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&se(e,t)}(i,F);var t,n,o,r=ce(i);function i(e){var t,n,o,u,l=e.menuToggleElement,s=e.parentElement,c=e.controlledMenu,a=e.parentMenu,m=void 0===a?null:a,f=e.initialize,h=void 0===f||f;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuToggleElement:l,parentElement:s,controlledMenu:c,parentMenu:m,initialize:!1}),n=me(t),u={toggle:null,parent:null,container:null},(o="_dom")in n?Object.defineProperty(n,o,{value:u,enumerable:!0,configurable:!0,writable:!0}):n[o]=u,t._dom.toggle=l,t._dom.parent=s,t._dom.container=c.isTopLevel?c.dom.container:c.dom.menu,h&&t.initialize(),t}return t=i,n=[{key:"initialize",value:function(){ue(fe(i.prototype),"initialize",this).call(this),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}},{key:"_expand",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.elements.controlledMenu.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.dom.container.classList.add(n):(e=this.dom.container.classList).add.apply(e,oe(n))),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==r&&("string"==typeof r?this.dom.container.classList.add(r):(e=this.dom.container.classList).add.apply(e,oe(r))),""!==i&&("string"==typeof i?this.dom.container.classList.remove(i):(t=this.dom.container.classList).remove.apply(t,oe(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}],n&&ie(t.prototype,n),o&&ie(t,o),i}();function pe(e){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pe(e)}function de(e,t){return de=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},de(e,t)}function ye(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ge(e);if(t){var r=ge(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ve(this,n)}}function ve(e,t){if(t&&("object"===pe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return be(e)}function be(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ge(e){return ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ge(e)}function Me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _e=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&de(e,t)}(n,G);var t=ye(n);function n(e){var o,r=e.menuElement,i=e.menuItemSelector,u=void 0===i?".nav-item":i,l=e.menuLinkSelector,s=void 0===l?".nav-link,.dropdown-item":l,c=e.submenuItemSelector,a=void 0===c?".dropdown":c,m=e.submenuToggleSelector,f=void 0===m?".dropdown-toggle":m,h=e.submenuSelector,p=void 0===h?".dropdown-menu":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,M=void 0===g?"show":g,_=e.closeClass,E=void 0===_?"collapse":_,w=e.isTopLevel,C=void 0===w||w,S=e.parentMenu,T=void 0===S?null:S,I=e.hoverType,k=void 0===I?"off":I,O=e.hoverDelay,A=void 0===O?250:O,L=e.initialize,j=void 0===L||L;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),Me(be(o=t.call(this,{menuElement:r,menuItemSelector:u,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:f,submenuSelector:p,controllerElement:y,containerElement:b,openClass:M,closeClass:E,isTopLevel:C,parentMenu:T,hoverType:k,hoverDelay:A,initialize:!1})),"_MenuType",n),Me(be(o),"_MenuItemType",te),Me(be(o),"_MenuToggleType",he),j&&o.initialize(),o}return n}();export{_e as default};
function e(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ${typeof t} given.`)}for(const n in t)if(!(t[n]instanceof e)){const s=typeof t[n];throw new TypeError(`AccessibleMenu: ${n} must be an instance of ${e.name}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function t(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Values given to isValidType() must be inside of an object. ${typeof t} given.`)}for(const n in t){const s=typeof t[n];if(s!==e)throw new TypeError(`AccessibleMenu: ${n} must be a ${e}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function n(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ${typeof e} given.`)}for(const t in e)try{if(null===e[t])throw new Error;document.querySelector(e[t])}catch(n){throw new TypeError(`AccessibleMenu: ${t} must be a valid CSS selector. "${e[t]}" given.`)}return!0}catch(e){return console.error(e),!1}}function s(e){try{if("object"!=typeof e||Array.isArray(e)){throw new TypeError(`AccessibleMenu: Values given to isValidClassList() must be inside of an object. ${typeof e} given.`)}for(const t in e){const s=typeof e[t];if("string"!==s){if(!Array.isArray(e[t]))throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. ${s} given.`);e[t].forEach((e=>{if("string"!=typeof e)throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. An array containing non-strings given.`)}))}else{const s={};s[t]=e[t],n(s)}}return!0}catch(e){return console.error(e),!1}}function i(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ${typeof e} given.`)}const t=["off","on","dynamic"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}function r(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class o{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i=null}=e;r(this,"_dom",{toggle:null,parent:null}),r(this,"_elements",{controlledMenu:null,parentMenu:null}),r(this,"_open",!1),r(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),r(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=t,this._dom.parent=n,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(n,s){if(t("string",{tagName:n})&&e(HTMLElement,s)){const e=n.toLowerCase();let t=!0;for(const n in s)s[n].tagName.toLowerCase()!==e&&(t=!1);return t}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let t=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),n=e;!t.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(t=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),t.replace(/\s/g,"").length>0&&(t=t.toLowerCase().replace(/\s+/g,"-"),t.startsWith("-")&&(t=t.substring(1)),t.endsWith("-")&&(t=t.slice(0,-1)),n=`${t}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){t("boolean",{value:e}),this._open=e}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.add(n):this.elements.controlledMenu.dom.menu.classList.add(...n)),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.remove(t):this.elements.controlledMenu.dom.menu.classList.remove(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.add(t):this.elements.controlledMenu.dom.menu.classList.add(...t)),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.remove(n):this.elements.controlledMenu.dom.menu.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((e=>{e!==this&&e.close()}))}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach((e=>e.close()))}}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:o=null}=e;l(this,"_dom",{item:null,link:null}),l(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),l(this,"_submenu",!1),this._dom.item=t,this._dom.link=n,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=o,this._submenu=i}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function m(e){try{const t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((e=>!0===n[e]))||""}catch(e){return""}}function h(e){e.preventDefault(),e.stopPropagation()}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:m=null,containerElement:h=null,openClass:d="show",closeClass:p="hide",isTopLevel:g=!0,parentMenu:f=null,hoverType:b="off",hoverDelay:v=250}=e;c(this,"_MenuType",a),c(this,"_MenuItemType",u),c(this,"_MenuToggleType",o),c(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),c(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),c(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),c(this,"_openClass","show"),c(this,"_closeClass","hide"),c(this,"_root",!0),c(this,"_currentChild",0),c(this,"_focusState","none"),c(this,"_currentEvent","none"),c(this,"_hoverType","off"),c(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=m,this._dom.container=h,this._selectors.menuItems=n,this._selectors.menuLinks=s,this._selectors.submenuItems=i,this._selectors.submenuToggles=r,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=f,this._elements.rootMenu=g?this:null,this._openClass=d||"",this._closeClass=p||"",this._root=g,this._hoverType=b,this._hoverDelay=v}initialize(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get shouldFocus(){let e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}set openClass(e){s({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){s({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set currentChild(e){function n(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu){let t=0,n=!1;for(;!n&&t<e.elements.parentMenu.elements.menuItems.length;){const s=e.elements.parentMenu.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}}t("number",{value:e}),e<-1?(this._currentChild=-1,n(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,n(this)):this.focusChild!==e&&(this._currentChild=e,n(this))}set focusState(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidState() must be inside of an object. ${typeof e} given.`);const t=["none","self","child"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&("self"===e||"none"===e)&&this.elements.submenuToggles.forEach((e=>{e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==e&&"child"!==e||(this.elements.parentMenu.focusState="child")}set currentEvent(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidEvent() must be inside of an object. ${typeof e} given.`);const t=["none","mouse","keyboard","character"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((t=>{t.elements.controlledMenu.currentEvent=e})))}set hoverType(e){i({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){t("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}_validate(){let r=!0;return null!==this._dom.container||null!==this._dom.controller?e(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(r=!1):e(HTMLElement,{menuElement:this._dom.menu})||(r=!1),""!==this._selectors.submenuItems?n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(r=!1):n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(r=!1),""===this._openClass||s({openClass:this._openClass})||(r=!1),""===this._closeClass||s({closeClass:this._closeClass})||(r=!1),t("boolean",{isTopLevel:this._root})||(r=!1),null===this._elements.parentMenu||e(a,{parentMenu:this._elements.parentMenu})||(r=!1),i({hoverType:this._hoverType})||(r=!1),t("number",{hoverDelay:this._hoverDelay})||(r=!1),r}_setDOMElementType(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[t])throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`);{if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);n!==this.dom.menu&&e(HTMLElement,{base:n});const i=Array.from(n.querySelectorAll(this.selectors[t])).filter((e=>e.parentElement===n));this._dom[t]=s?i:[...this._dom[t],...i]}}_resetDOMElementType(e){if(void 0===this.dom[e])throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`);if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}_setDOMElements(){this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)})))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}_createChildElements(){this.dom.menuItems.forEach((e=>{let t;if(this.dom.submenuItems.includes(e)){const n=e.querySelector(this.selectors.submenuToggles),s=e.querySelector(this.selectors.submenus),i=new this._MenuType({menuElement:s,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay}),r=new this._MenuToggleType({menuToggleElement:n,parentElement:e,controlledMenu:i,parentMenu:this});this._elements.submenuToggles.push(r),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this,isSubmenuItem:!0,childMenu:i,toggle:r})}else{const n=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this})}this._elements.menuItems.push(t)}))}_handleFocus(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("focus",(()=>{this.focusState="self",this.currentChild=t}))}))}_handleClick(){function e(e,t,n){h(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach(((t,n)=>{t.dom.link.addEventListener("pointerdown",(()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(n)}),{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",(n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)}))}_handleHover(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("pointerenter",(n=>{if("pen"!==n.pointerType&&"touch"!==n.pointerType)if("on"===this.hoverType)this.currentEvent="mouse",this.currentChild=t,e.isSubmenuItem&&e.elements.toggle.preview();else if("dynamic"===this.hoverType){const n=this.elements.submenuToggles.some((e=>e.isOpen));this.currentChild=t,this.isTopLevel&&"none"===this.focusState||(this.currentEvent="mouse",this.focusCurrentChild()),!e.isSubmenuItem||this.isTopLevel&&!n||(this.currentEvent="mouse",e.elements.toggle.preview())}})),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",(t=>{"pen"!==t.pointerType&&"touch"!==t.pointerType&&("on"===this.hoverType?this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close()):"dynamic"===this.hoverType&&(this.isTopLevel||(this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}))}))}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||h(e)}))}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||(h(e),this.elements.controller.open(),this.focusFirstChild())}))}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach((e=>e.close()))}blurChildren(){this.elements.menuItems.forEach((e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}class d extends u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:o=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:o}),l&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","menuitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=0)}blur(){super.blur(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=-1)}}class p extends o{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i=null,initialize:r=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}function g(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class f extends a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:r="a",submenuSelector:o="ul",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="hide",isTopLevel:c=!0,parentMenu:a=null,hoverType:b="off",hoverDelay:v=250,initialize:M=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:i,submenuToggleSelector:r,submenuSelector:o,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:b,hoverDelay:v}),g(this,"_MenuType",f),g(this,"_MenuItemType",d),g(this,"_MenuToggleType",p),M&&this.initialize()}initialize(){try{super.initialize(),this.dom.menu.setAttribute("role","menubar"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(e){console.error(e)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",(e=>{"none"!==this.focusState&&(this.currentEvent="mouse",this.dom.menu.contains(e.target)||!this.dom.menu===e.target||(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))}))}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);if("Tab"===t&&("none"!==this.elements.rootMenu.focusState?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),"Character"===t)h(e);else if(this.isTopLevel){if("self"===this.focusState){const n=["Space","Enter","ArrowDown","ArrowUp"],s=["Escape"];(["ArrowRight","ArrowLeft","Home","End"].includes(t)||this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&s.includes(t))&&h(e)}}else{const n=["Space","Enter"];(["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"].includes(t)||this.currentMenuItem.isSubmenuItem&&n.includes(t))&&h(e)}}))}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e),{altKey:n,crtlKey:s,metaKey:i}=e;if("Character"!==t||(n||s||i))if(this.isTopLevel){if("self"===this.focusState)if("Space"===t||"Enter"===t)this.currentMenuItem.isSubmenuItem?(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()}))):this.currentMenuItem.dom.link.click();else if("ArrowRight"===t){h(e);const t=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),t&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if("ArrowLeft"===t){h(e);const t=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),t&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if("ArrowDown"===t)this.currentMenuItem.isSubmenuItem&&(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})));else if("ArrowUp"===t)this.currentMenuItem.isSubmenuItem&&(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})));else if("Home"===t)h(e),this.focusFirstChild();else if("End"===t)h(e),this.focusLastChild();else if("Escape"===t){this.elements.submenuToggles.some((e=>e.isOpen))?(h(e),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(h(e),this.elements.controller.close(),this.focusController())}}else"Space"===t||"Enter"===t?this.currentMenuItem.isSubmenuItem?(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()}))):this.currentMenuItem.dom.link.click():"Escape"===t?(h(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):"ArrowRight"===t?this.currentMenuItem.isSubmenuItem?(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()}))):(h(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):"ArrowLeft"===t?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(h(e),this.elements.parentMenu.currentMenuItem.elements.toggle.close(),this.elements.parentMenu.focusCurrentChild(),this.elements.parentMenu===this.elements.rootMenu&&(this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusPreviousChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&(this.elements.rootMenu.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.elements.rootMenu.currentMenuItem.elements.toggle.preview()))):"ArrowDown"===t?(h(e),this.focusNextChild()):"ArrowUp"===t?(h(e),this.focusPreviousChild()):"Home"===t?(h(e),this.focusFirstChild()):"End"===t&&(h(e),this.focusLastChild());else h(e),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(e.key)}))}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){0===this.currentChild?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(e){const t=e.toLowerCase();let n=this.currentChild+1,s=!1;for(;!s&&n<this.elements.menuItems.length;){let e="";e=this.elements.menuItems[n].dom.item.innerText?this.elements.menuItems[n].dom.item.innerText:this.elements.menuItems[n].dom.item.textContent,e=e.replace(/[\s]/g,"").toLowerCase().charAt(0),e===t&&(s=!0,this.focusChild(n)),n++}}}class b extends d{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:o=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:o,initialize:!1}),l&&this.initialize()}}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class M extends p{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i=null,initialize:r=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i,initialize:!1}),v(this,"_dom",{toggle:null,parent:null,container:null}),this._dom.toggle=t,this._dom.parent=n,this._dom.container=s.isTopLevel?s.dom.container:s.dom.menu,r&&this.initialize()}initialize(){super.initialize(),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{openClass:t}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),""!==n&&("string"==typeof n?this.dom.container.classList.remove(n):this.dom.container.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}function y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends f{constructor(e){let{menuElement:t,menuItemSelector:n=".nav-item",menuLinkSelector:s=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:r=".dropdown-toggle",submenuSelector:o=".dropdown-menu",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="collapse",isTopLevel:c=!0,parentMenu:a=null,hoverType:d="off",hoverDelay:p=250,initialize:g=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:i,submenuToggleSelector:r,submenuSelector:o,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:d,hoverDelay:p,initialize:!1}),y(this,"_MenuType",E),y(this,"_MenuItemType",b),y(this,"_MenuToggleType",M),g&&this.initialize()}}export{E as default};
//# sourceMappingURL=menubar-bs5.esm.min.js.map

@@ -1,2 +0,2 @@

var Bootstrap5Menubar=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n){try{if("object"!==e(n)){var o=e(n);throw new TypeError("AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ".concat(o," given."))}for(var r in n)if(!(n[r]instanceof t)){var i=e(n[r]);throw new TypeError("AccessibleMenu: ".concat(r," must be an instance of ").concat(t.name,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function n(t,n){try{if("object"!==e(n)){var o=e(n);throw new TypeError("AccessibleMenu: Values given to isValidType() must be inside of an object. ".concat(o," given."))}for(var r in n){var i=e(n[r]);if(i!==t)throw new TypeError("AccessibleMenu: ".concat(r," must be a ").concat(t,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function o(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ".concat(n," given."))}for(var o in t)try{if(null===t[o])throw new Error;document.querySelector(t[o])}catch(e){throw new TypeError("AccessibleMenu: ".concat(o,' must be a valid CSS selector. "').concat(t[o],'" given.'))}return!0}catch(e){return console.error(e),!1}}function r(t){try{if("object"!==e(t)||Array.isArray(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidClassList() must be inside of an object. ".concat(n," given."))}var r=function(n){var r=e(t[n]);if("string"!==r){if(!Array.isArray(t[n]))throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. ").concat(r," given."));t[n].forEach((function(e){if("string"!=typeof e)throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. An array containing non-strings given."))}))}else{var i={};i[n]=t[n],o(i)}};for(var i in t)r(i);return!0}catch(e){return console.error(e),!1}}function i(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ".concat(n," given."))}var o=["off","on","dynamic"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'));return!0}catch(e){return console.error(e),!1}}function u(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function s(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){function e(t){var n=t.menuToggleElement,o=t.parentElement,r=t.controlledMenu,i=t.parentMenu,u=void 0===i?null:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"_dom",{toggle:null,parent:null}),c(this,"_elements",{controlledMenu:null,parentMenu:null}),c(this,"_open",!1),c(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),c(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=n,this._dom.parent=o,this._elements.controlledMenu=r,this._elements.parentMenu=u}var o,r,i;return o=e,r=[{key:"initialize",value:function(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(e,o){if(n("string",{tagName:e})&&t(HTMLElement,o)){var r=e.toLowerCase(),i=!0;for(var u in o)o[u].tagName.toLowerCase()!==r&&(i=!1);return i}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){var e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10),o=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),r=e;!o.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(o=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),o.replace(/\s/g,"").length>0&&((o=o.toLowerCase().replace(/\s+/g,"-")).startsWith("-")&&(o=o.substring(1)),o.endsWith("-")&&(o=o.slice(0,-1)),r="".concat(o,"-").concat(r)),this.dom.toggle.id=this.dom.toggle.id||"".concat(r,"-menu-button"),this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||"".concat(r,"-menu")}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isOpen",get:function(){return this._open},set:function(e){n("boolean",{value:e}),this._open=e}},{key:"_expand",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.add(i):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(i))),""!==r&&("string"==typeof r?this.elements.controlledMenu.dom.menu.classList.remove(r):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(r))),n&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==r&&("string"==typeof r?this.elements.controlledMenu.dom.menu.classList.add(r):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(r))),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.remove(i):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}},{key:"open",value:function(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}},{key:"preview",value:function(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}},{key:"close",value:function(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}},{key:"toggle",value:function(){this.isOpen?this.close():this.open()}},{key:"closeSiblings",value:function(){var e=this;this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((function(t){t!==e&&t.close()}))}},{key:"closeChildren",value:function(){this.elements.controlledMenu.elements.submenuToggles.forEach((function(e){return e.close()}))}}],r&&s(o.prototype,r),i&&s(o,i),e}();function m(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(){function e(t){var n=t.menuItemElement,o=t.menuLinkElement,r=t.parentMenu,i=t.isSubmenuItem,u=void 0!==i&&i,l=t.childMenu,s=void 0===l?null:l,c=t.toggle,a=void 0===c?null:c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"_dom",{item:null,link:null}),f(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),f(this,"_submenu",!1),this._dom.item=n,this._dom.link=o,this._elements.parentMenu=r,this._elements.childMenu=s,this._elements.toggle=a,this._submenu=u}var t,n,o;return t=e,(n=[{key:"initialize",value:function(){}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isSubmenuItem",get:function(){return this._submenu}},{key:"focus",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}},{key:"blur",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}])&&m(t.prototype,n),o&&m(t,o),e}();function p(e){try{var t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((function(e){return!0===n[e]}))||""}catch(e){return""}}function d(e){e.preventDefault(),e.stopPropagation()}function y(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function b(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var M=function(){function u(e){var t=e.menuElement,n=e.menuItemSelector,o=void 0===n?"li":n,r=e.menuLinkSelector,i=void 0===r?"a":r,l=e.submenuItemSelector,s=void 0===l?"":l,c=e.submenuToggleSelector,m=void 0===c?"a":c,f=e.submenuSelector,p=void 0===f?"ul":f,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,M=e.openClass,_=void 0===M?"show":M,E=e.closeClass,w=void 0===E?"hide":E,C=e.isTopLevel,S=void 0===C||C,T=e.parentMenu,I=void 0===T?null:T,k=e.hoverType,O=void 0===k?"off":k,A=e.hoverDelay,L=void 0===A?250:A;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),g(this,"_MenuType",u),g(this,"_MenuItemType",h),g(this,"_MenuToggleType",a),g(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),g(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),g(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),g(this,"_openClass","show"),g(this,"_closeClass","hide"),g(this,"_root",!0),g(this,"_currentChild",0),g(this,"_focusState","none"),g(this,"_currentEvent","none"),g(this,"_hoverType","off"),g(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=y,this._dom.container=b,this._selectors.menuItems=o,this._selectors.menuLinks=i,this._selectors.submenuItems=s,this._selectors.submenuToggles=m,this._selectors.submenus=p,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=I,this._elements.rootMenu=S?this:null,this._openClass=_||"",this._closeClass=w||"",this._root=S,this._hoverType=O,this._hoverDelay=L}var l,s,c;return l=u,s=[{key:"initialize",value:function(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){var e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}},{key:"dom",get:function(){return this._dom}},{key:"selectors",get:function(){return this._selectors}},{key:"elements",get:function(){return this._elements}},{key:"isTopLevel",get:function(){return this._root}},{key:"openClass",get:function(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass},set:function(e){r({openClass:e}),this._openClass!==e&&(this._openClass=e)}},{key:"closeClass",get:function(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass},set:function(e){r({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}},{key:"currentChild",get:function(){return this._currentChild},set:function(e){function t(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu)for(var t=0,n=!1;!n&&t<e.elements.parentMenu.elements.menuItems.length;){var o=e.elements.parentMenu.elements.menuItems[t];o.isSubmenuItem&&o.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}n("number",{value:e}),e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}},{key:"focusState",get:function(){return this._focusState},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidState() must be inside of an object. ".concat(n," given."))}var o=["none","self","child"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&("self"===t||"none"===t)&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==t&&"child"!==t||(this.elements.parentMenu.focusState="child")}},{key:"currentEvent",get:function(){return this._currentEvent},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidEvent() must be inside of an object. ".concat(n," given."))}var o=["none","mouse","keyboard","character"];for(var r in t)if(!o.includes(t[r]))throw new TypeError("AccessibleMenu: ".concat(r," must be one of the following values: ").concat(o.join(", "),'. "').concat(t[r],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.currentEvent=t})))}},{key:"currentMenuItem",get:function(){return this.elements.menuItems[this.currentChild]}},{key:"hoverType",get:function(){return this._root?this._hoverType:this.elements.rootMenu.hoverType},set:function(e){i({value:e}),this._hoverType!==e&&(this._hoverType=e)}},{key:"hoverDelay",get:function(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay},set:function(e){n("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}},{key:"shouldFocus",get:function(){var e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}},{key:"_validate",value:function(){var e=!0;return null!==this._dom.container||null!==this._dom.controller?t(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(e=!1):t(HTMLElement,{menuElement:this._dom.menu})||(e=!1),""!==this._selectors.submenuItems?o({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(e=!1):o({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(e=!1),""===this._openClass||r({openClass:this._openClass})||(e=!1),""===this._closeClass||r({closeClass:this._closeClass})||(e=!1),n("boolean",{isTopLevel:this._root})||(e=!1),null===this._elements.parentMenu||t(u,{parentMenu:this._elements.parentMenu})||(e=!1),i({hoverType:this._hoverType})||(e=!1),n("number",{hoverDelay:this._hoverDelay})||(e=!1),e}},{key:"_setDOMElementType",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be set through _setDOMElementType.'));n!==this.dom.menu&&t(HTMLElement,{base:n});var r=Array.from(n.querySelectorAll(this.selectors[e])),i=r.filter((function(e){return e.parentElement===n}));this._dom[e]=o?i:[].concat(y(this._dom[e]),y(i))}},{key:"_resetDOMElementType",value:function(e){if(void 0===this.dom[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be reset through _resetDOMElementType.'));this._dom[e]=[]}},{key:"_setDOMElements",value:function(){var e=this;this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((function(t){e._setDOMElementType("submenuToggles",t,!1),e._setDOMElementType("submenus",t,!1)})))}},{key:"_findRootMenu",value:function(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}},{key:"_createChildElements",value:function(){var e=this;this.dom.menuItems.forEach((function(t){var n;if(e.dom.submenuItems.includes(t)){var o=t.querySelector(e.selectors.submenuToggles),r=t.querySelector(e.selectors.submenus),i=new e._MenuType({menuElement:r,menuItemSelector:e.selectors.menuItems,menuLinkSelector:e.selectors.menuLinks,submenuItemSelector:e.selectors.submenuItems,submenuToggleSelector:e.selectors.submenuToggles,submenuSelector:e.selectors.submenus,openClass:e.openClass,closeClass:e.closeClass,isTopLevel:!1,parentMenu:e,hoverType:e.hoverType,hoverDelay:e.hoverDelay}),u=new e._MenuToggleType({menuToggleElement:o,parentElement:t,controlledMenu:i,parentMenu:e});e._elements.submenuToggles.push(u),n=new e._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:e,isSubmenuItem:!0,childMenu:i,toggle:u})}else{var l=t.querySelector(e.selectors.menuLinks);n=new e._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:e})}e._elements.menuItems.push(n)}))}},{key:"_handleFocus",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("focus",(function(){e.focusState="self",e.currentChild=n}))}))}},{key:"_handleClick",value:function(){var e=this;function t(e,t,n){d(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((function(n,o){n.dom.link.addEventListener("pointerdown",(function(){e.currentEvent="mouse",e.elements.rootMenu.blurChildren(),e.focusChild(o)}),{passive:!0}),n.isSubmenuItem&&n.elements.toggle.dom.toggle.addEventListener("pointerup",(function(o){e.currentEvent="mouse",t(e,n.elements.toggle,o)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(function(n){e.currentEvent="mouse",t(e,e.elements.controller,n)}))}},{key:"_handleHover",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("pointerenter",(function(o){if("pen"!==o.pointerType&&"touch"!==o.pointerType)if("on"===e.hoverType)e.currentEvent="mouse",e.currentChild=n,t.isSubmenuItem&&t.elements.toggle.preview();else if("dynamic"===e.hoverType){var r=e.elements.submenuToggles.some((function(e){return e.isOpen}));e.currentChild=n,e.isTopLevel&&"none"===e.focusState||(e.currentEvent="mouse",e.focusCurrentChild()),!t.isSubmenuItem||e.isTopLevel&&!r||(e.currentEvent="mouse",t.elements.toggle.preview())}})),t.isSubmenuItem&&t.dom.item.addEventListener("pointerleave",(function(n){"pen"!==n.pointerType&&"touch"!==n.pointerType&&("on"===e.hoverType?e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close()):"dynamic"===e.hoverType&&(e.isTopLevel||(e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()))))}))}))}},{key:"_handleKeydown",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||(d(t),e.elements.controller.open(),e.focusFirstChild())}))}},{key:"focus",value:function(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}},{key:"blur",value:function(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}},{key:"focusCurrentChild",value:function(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}},{key:"focusChild",value:function(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}},{key:"focusFirstChild",value:function(){this.focusChild(0)}},{key:"focusLastChild",value:function(){this.focusChild(this.elements.menuItems.length-1)}},{key:"focusNextChild",value:function(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}},{key:"focusPreviousChild",value:function(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}},{key:"blurCurrentChild",value:function(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}},{key:"focusController",value:function(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}},{key:"focusContainer",value:function(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}},{key:"closeChildren",value:function(){this.elements.submenuToggles.forEach((function(e){return e.close()}))}},{key:"blurChildren",value:function(){this.elements.menuItems.forEach((function(e){e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}],s&&b(l.prototype,s),c&&b(l,c),u}();function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function E(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function w(){return w="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=C(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},w.apply(this,arguments)}function C(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}function S(e,t){return S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},S(e,t)}function T(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=k(e);if(t){var r=k(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return I(this,n)}}function I(e,t){if(t&&("object"===_(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}var O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(i,e);var t,n,o,r=T(i);function i(e){var t,n=e.menuItemElement,o=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,m=e.toggle,f=void 0===m?null:m,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuItemElement:n,menuLinkElement:o,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:f}),p&&t.initialize(),t}return t=i,(n=[{key:"initialize",value:function(){w(k(i.prototype),"initialize",this).call(this),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","menuitem"),this.dom.link.tabIndex=-1}},{key:"focus",value:function(){w(k(i.prototype),"focus",this).call(this),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=0)}},{key:"blur",value:function(){w(k(i.prototype),"blur",this).call(this),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=-1)}}])&&E(t.prototype,n),o&&E(t,o),i}(h);function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function L(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function j(){return j="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=R(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},j.apply(this,arguments)}function R(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=z(e)););return e}function P(e,t){return P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},P(e,t)}function D(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=z(e);if(t){var r=z(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return x(this,n)}}function x(e,t){if(t&&("object"===A(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function z(e){return z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},z(e)}var F=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&P(e,t)}(i,e);var t,n,o,r=D(i);function i(e){var t,n=e.menuToggleElement,o=e.parentElement,u=e.controlledMenu,l=e.parentMenu,s=void 0===l?null:l,c=e.initialize,a=void 0===c||c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuToggleElement:n,parentElement:o,controlledMenu:u,parentMenu:s}),a&&t.initialize(),t}return t=i,(n=[{key:"open",value:function(){this.closeSiblings(),j(z(i.prototype),"open",this).call(this)}},{key:"preview",value:function(){this.closeSiblings(),j(z(i.prototype),"preview",this).call(this)}},{key:"close",value:function(){this.isOpen&&this.closeChildren(),j(z(i.prototype),"close",this).call(this)}}])&&L(t.prototype,n),o&&L(t,o),i}(a);function B(e){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B(e)}function H(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function V(){return V="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=K(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},V.apply(this,arguments)}function K(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=$(e)););return e}function N(e,t){return N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},N(e,t)}function q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=$(e);if(t){var r=$(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return U(this,n)}}function U(e,t){if(t&&("object"===B(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return W(e)}function W(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$(e)}function Z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&N(e,t)}(i,e);var t,n,o,r=q(i);function i(e){var t,n=e.menuElement,o=e.menuItemSelector,u=void 0===o?"li":o,l=e.menuLinkSelector,s=void 0===l?"a":l,c=e.submenuItemSelector,a=void 0===c?"":c,m=e.submenuToggleSelector,f=void 0===m?"a":m,h=e.submenuSelector,p=void 0===h?"ul":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,M=void 0===g?"show":g,_=e.closeClass,E=void 0===_?"hide":_,w=e.isTopLevel,C=void 0===w||w,S=e.parentMenu,T=void 0===S?null:S,I=e.hoverType,k=void 0===I?"off":I,A=e.hoverDelay,L=void 0===A?250:A,j=e.initialize,R=void 0===j||j;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),Z(W(t=r.call(this,{menuElement:n,menuItemSelector:u,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:f,submenuSelector:p,controllerElement:y,containerElement:b,openClass:M,closeClass:E,isTopLevel:C,parentMenu:T,hoverType:k,hoverDelay:L})),"_MenuType",i),Z(W(t),"_MenuItemType",O),Z(W(t),"_MenuToggleType",F),R&&t.initialize(),t}return t=i,(n=[{key:"initialize",value:function(){try{V($(i.prototype),"initialize",this).call(this),this.dom.menu.setAttribute("role","menubar"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(e){console.error(e)}}},{key:"_handleClick",value:function(){var e=this;V($(i.prototype),"_handleClick",this).call(this),document.addEventListener("pointerup",(function(t){"none"!==e.focusState&&(e.currentEvent="mouse",e.dom.menu.contains(t.target)||!e.dom.menu===t.target||(e.closeChildren(),e.blur(),e.elements.controller&&e.elements.controller.close()))}))}},{key:"_handleKeydown",value:function(){var e=this;V($(i.prototype),"_handleKeydown",this).call(this),this.dom.menu.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Tab"===n&&("none"!==e.elements.rootMenu.focusState?(e.elements.rootMenu.blur(),e.elements.rootMenu.closeChildren()):e.elements.rootMenu.focus()),"Character"===n?d(t):e.isTopLevel?"self"===e.focusState&&(["ArrowRight","ArrowLeft","Home","End"].includes(n)||e.currentMenuItem.isSubmenuItem&&["Space","Enter","ArrowDown","ArrowUp"].includes(n)||e.elements.controller&&["Escape"].includes(n))&&d(t):(["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"].includes(n)||e.currentMenuItem.isSubmenuItem&&["Space","Enter"].includes(n))&&d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;V($(i.prototype),"_handleKeyup",this).call(this),this.dom.menu.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t),o=t.altKey,r=t.crtlKey,i=t.metaKey;if("Character"!==n||o||r||i)if(e.isTopLevel){if("self"===e.focusState)if("Space"===n||"Enter"===n)e.currentMenuItem.isSubmenuItem?(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusFirstChild()}))):e.currentMenuItem.dom.link.click();else if("ArrowRight"===n){d(t);var u=e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen;e.focusNextChild(),u&&(e.currentMenuItem.isSubmenuItem?(e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.preview()):e.closeChildren())}else if("ArrowLeft"===n){d(t);var l=e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen;e.focusPreviousChild(),l&&(e.currentMenuItem.isSubmenuItem?(e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.preview()):e.closeChildren())}else"ArrowDown"===n?e.currentMenuItem.isSubmenuItem&&(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusFirstChild()}))):"ArrowUp"===n?e.currentMenuItem.isSubmenuItem&&(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusLastChild()}))):"Home"===n?(d(t),e.focusFirstChild()):"End"===n?(d(t),e.focusLastChild()):"Escape"===n&&(e.elements.submenuToggles.some((function(e){return e.isOpen}))?(d(t),e.closeChildren()):e.isTopLevel&&e.elements.controller&&e.elements.controller.isOpen&&(d(t),e.elements.controller.close(),e.focusController()))}else"Space"===n||"Enter"===n?e.currentMenuItem.isSubmenuItem?(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusFirstChild()}))):e.currentMenuItem.dom.link.click():"Escape"===n?(d(t),e.elements.rootMenu.closeChildren(),e.elements.rootMenu.focusCurrentChild()):"ArrowRight"===n?e.currentMenuItem.isSubmenuItem?(d(t),e.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.currentMenuItem.elements.toggle.open(),requestAnimationFrame((function(){e.currentMenuItem.elements.childMenu.focusFirstChild()}))):(d(t),e.elements.rootMenu.closeChildren(),e.elements.rootMenu.focusNextChild(),e.elements.rootMenu.currentMenuItem.isSubmenuItem&&e.elements.rootMenu.currentMenuItem.elements.toggle.preview()):"ArrowLeft"===n?e.elements.parentMenu.currentMenuItem.isSubmenuItem&&(d(t),e.elements.parentMenu.currentMenuItem.elements.toggle.close(),e.elements.parentMenu.focusCurrentChild(),e.elements.parentMenu===e.elements.rootMenu&&(e.elements.rootMenu.closeChildren(),e.elements.rootMenu.focusPreviousChild(),e.elements.rootMenu.currentMenuItem.isSubmenuItem&&(e.elements.rootMenu.currentMenuItem.elements.childMenu.currentEvent="keyboard",e.elements.rootMenu.currentMenuItem.elements.toggle.preview()))):"ArrowDown"===n?(d(t),e.focusNextChild()):"ArrowUp"===n?(d(t),e.focusPreviousChild()):"Home"===n?(d(t),e.focusFirstChild()):"End"===n&&(d(t),e.focusLastChild());else d(t),e.elements.rootMenu.currentEvent="character",e.focusNextChildWithCharacter(t.key)}))}},{key:"focusNextChild",value:function(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}},{key:"focusPreviousChild",value:function(){0===this.currentChild?this.focusLastChild():this.focusChild(this.currentChild-1)}},{key:"focusNextChildWithCharacter",value:function(e){for(var t=e.toLowerCase(),n=this.currentChild+1,o=!1;!o&&n<this.elements.menuItems.length;)(this.elements.menuItems[n].dom.item.innerText?this.elements.menuItems[n].dom.item.innerText:this.elements.menuItems[n].dom.item.textContent).replace(/[\s]/g,"").toLowerCase().charAt(0)===t&&(o=!0,this.focusChild(n)),n++}}])&&H(t.prototype,n),o&&H(t,o),i}(M);function J(e){return J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},J(e)}function Q(e,t){return Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Q(e,t)}function X(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ee(e);if(t){var r=ee(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return Y(this,n)}}function Y(e,t){if(t&&("object"===J(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ee(e){return ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ee(e)}var te=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Q(e,t)}(n,e);var t=X(n);function n(e){var o,r=e.menuItemElement,i=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,m=e.toggle,f=void 0===m?null:m,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),o=t.call(this,{menuItemElement:r,menuLinkElement:i,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:f,initialize:!1}),p&&o.initialize(),o}return n}(O);function ne(e){return ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ne(e)}function oe(e){return function(e){if(Array.isArray(e))return re(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return re(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ie(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ue(){return ue="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=le(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},ue.apply(this,arguments)}function le(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=fe(e)););return e}function se(e,t){return se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},se(e,t)}function ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=fe(e);if(t){var r=fe(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ae(this,n)}}function ae(e,t){if(t&&("object"===ne(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return me(e)}function me(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},fe(e)}var he=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&se(e,t)}(i,e);var t,n,o,r=ce(i);function i(e){var t,n,o,u,l=e.menuToggleElement,s=e.parentElement,c=e.controlledMenu,a=e.parentMenu,m=void 0===a?null:a,f=e.initialize,h=void 0===f||f;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=r.call(this,{menuToggleElement:l,parentElement:s,controlledMenu:c,parentMenu:m,initialize:!1}),n=me(t),u={toggle:null,parent:null,container:null},(o="_dom")in n?Object.defineProperty(n,o,{value:u,enumerable:!0,configurable:!0,writable:!0}):n[o]=u,t._dom.toggle=l,t._dom.parent=s,t._dom.container=c.isTopLevel?c.dom.container:c.dom.menu,h&&t.initialize(),t}return t=i,n=[{key:"initialize",value:function(){ue(fe(i.prototype),"initialize",this).call(this),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}},{key:"_expand",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.elements.controlledMenu.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.dom.container.classList.add(n):(e=this.dom.container.classList).add.apply(e,oe(n))),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=this.elements.controlledMenu,r=o.closeClass,i=o.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==r&&("string"==typeof r?this.dom.container.classList.add(r):(e=this.dom.container.classList).add.apply(e,oe(r))),""!==i&&("string"==typeof i?this.dom.container.classList.remove(i):(t=this.dom.container.classList).remove.apply(t,oe(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}],n&&ie(t.prototype,n),o&&ie(t,o),i}(F);function pe(e){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pe(e)}function de(e,t){return de=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},de(e,t)}function ye(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ge(e);if(t){var r=ge(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ve(this,n)}}function ve(e,t){if(t&&("object"===pe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return be(e)}function be(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ge(e){return ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ge(e)}function Me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}return function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&de(e,t)}(n,e);var t=ye(n);function n(e){var o,r=e.menuElement,i=e.menuItemSelector,u=void 0===i?".nav-item":i,l=e.menuLinkSelector,s=void 0===l?".nav-link,.dropdown-item":l,c=e.submenuItemSelector,a=void 0===c?".dropdown":c,m=e.submenuToggleSelector,f=void 0===m?".dropdown-toggle":m,h=e.submenuSelector,p=void 0===h?".dropdown-menu":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,M=void 0===g?"show":g,_=e.closeClass,E=void 0===_?"collapse":_,w=e.isTopLevel,C=void 0===w||w,S=e.parentMenu,T=void 0===S?null:S,I=e.hoverType,k=void 0===I?"off":I,O=e.hoverDelay,A=void 0===O?250:O,L=e.initialize,j=void 0===L||L;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),Me(be(o=t.call(this,{menuElement:r,menuItemSelector:u,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:f,submenuSelector:p,controllerElement:y,containerElement:b,openClass:M,closeClass:E,isTopLevel:C,parentMenu:T,hoverType:k,hoverDelay:A,initialize:!1})),"_MenuType",n),Me(be(o),"_MenuItemType",te),Me(be(o),"_MenuToggleType",he),j&&o.initialize(),o}return n}(G)}();
var Bootstrap5Menubar=function(){"use strict";function e(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ${typeof t} given.`)}for(const n in t)if(!(t[n]instanceof e)){const s=typeof t[n];throw new TypeError(`AccessibleMenu: ${n} must be an instance of ${e.name}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function t(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Values given to isValidType() must be inside of an object. ${typeof t} given.`)}for(const n in t){const s=typeof t[n];if(s!==e)throw new TypeError(`AccessibleMenu: ${n} must be a ${e}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function n(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ${typeof e} given.`)}for(const t in e)try{if(null===e[t])throw new Error;document.querySelector(e[t])}catch(n){throw new TypeError(`AccessibleMenu: ${t} must be a valid CSS selector. "${e[t]}" given.`)}return!0}catch(e){return console.error(e),!1}}function s(e){try{if("object"!=typeof e||Array.isArray(e)){throw new TypeError(`AccessibleMenu: Values given to isValidClassList() must be inside of an object. ${typeof e} given.`)}for(const t in e){const s=typeof e[t];if("string"!==s){if(!Array.isArray(e[t]))throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. ${s} given.`);e[t].forEach((e=>{if("string"!=typeof e)throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. An array containing non-strings given.`)}))}else{const s={};s[t]=e[t],n(s)}}return!0}catch(e){return console.error(e),!1}}function i(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ${typeof e} given.`)}const t=["off","on","dynamic"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}function r(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class o{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i=null}=e;r(this,"_dom",{toggle:null,parent:null}),r(this,"_elements",{controlledMenu:null,parentMenu:null}),r(this,"_open",!1),r(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),r(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=t,this._dom.parent=n,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(n,s){if(t("string",{tagName:n})&&e(HTMLElement,s)){const e=n.toLowerCase();let t=!0;for(const n in s)s[n].tagName.toLowerCase()!==e&&(t=!1);return t}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let t=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),n=e;!t.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(t=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),t.replace(/\s/g,"").length>0&&(t=t.toLowerCase().replace(/\s+/g,"-"),t.startsWith("-")&&(t=t.substring(1)),t.endsWith("-")&&(t=t.slice(0,-1)),n=`${t}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){t("boolean",{value:e}),this._open=e}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.add(n):this.elements.controlledMenu.dom.menu.classList.add(...n)),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.remove(t):this.elements.controlledMenu.dom.menu.classList.remove(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.add(t):this.elements.controlledMenu.dom.menu.classList.add(...t)),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.remove(n):this.elements.controlledMenu.dom.menu.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((e=>{e!==this&&e.close()}))}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach((e=>e.close()))}}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:o=null}=e;l(this,"_dom",{item:null,link:null}),l(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),l(this,"_submenu",!1),this._dom.item=t,this._dom.link=n,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=o,this._submenu=i}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function m(e){try{const t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((e=>!0===n[e]))||""}catch(e){return""}}function h(e){e.preventDefault(),e.stopPropagation()}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:m=null,containerElement:h=null,openClass:d="show",closeClass:p="hide",isTopLevel:g=!0,parentMenu:f=null,hoverType:b="off",hoverDelay:v=250}=e;c(this,"_MenuType",a),c(this,"_MenuItemType",u),c(this,"_MenuToggleType",o),c(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),c(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),c(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),c(this,"_openClass","show"),c(this,"_closeClass","hide"),c(this,"_root",!0),c(this,"_currentChild",0),c(this,"_focusState","none"),c(this,"_currentEvent","none"),c(this,"_hoverType","off"),c(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=m,this._dom.container=h,this._selectors.menuItems=n,this._selectors.menuLinks=s,this._selectors.submenuItems=i,this._selectors.submenuToggles=r,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=f,this._elements.rootMenu=g?this:null,this._openClass=d||"",this._closeClass=p||"",this._root=g,this._hoverType=b,this._hoverDelay=v}initialize(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get shouldFocus(){let e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}set openClass(e){s({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){s({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set currentChild(e){function n(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu){let t=0,n=!1;for(;!n&&t<e.elements.parentMenu.elements.menuItems.length;){const s=e.elements.parentMenu.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}}t("number",{value:e}),e<-1?(this._currentChild=-1,n(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,n(this)):this.focusChild!==e&&(this._currentChild=e,n(this))}set focusState(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidState() must be inside of an object. ${typeof e} given.`);const t=["none","self","child"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&("self"===e||"none"===e)&&this.elements.submenuToggles.forEach((e=>{e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==e&&"child"!==e||(this.elements.parentMenu.focusState="child")}set currentEvent(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidEvent() must be inside of an object. ${typeof e} given.`);const t=["none","mouse","keyboard","character"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((t=>{t.elements.controlledMenu.currentEvent=e})))}set hoverType(e){i({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){t("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}_validate(){let r=!0;return null!==this._dom.container||null!==this._dom.controller?e(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(r=!1):e(HTMLElement,{menuElement:this._dom.menu})||(r=!1),""!==this._selectors.submenuItems?n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(r=!1):n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(r=!1),""===this._openClass||s({openClass:this._openClass})||(r=!1),""===this._closeClass||s({closeClass:this._closeClass})||(r=!1),t("boolean",{isTopLevel:this._root})||(r=!1),null===this._elements.parentMenu||e(a,{parentMenu:this._elements.parentMenu})||(r=!1),i({hoverType:this._hoverType})||(r=!1),t("number",{hoverDelay:this._hoverDelay})||(r=!1),r}_setDOMElementType(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[t])throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`);{if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);n!==this.dom.menu&&e(HTMLElement,{base:n});const i=Array.from(n.querySelectorAll(this.selectors[t])).filter((e=>e.parentElement===n));this._dom[t]=s?i:[...this._dom[t],...i]}}_resetDOMElementType(e){if(void 0===this.dom[e])throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`);if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}_setDOMElements(){this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)})))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}_createChildElements(){this.dom.menuItems.forEach((e=>{let t;if(this.dom.submenuItems.includes(e)){const n=e.querySelector(this.selectors.submenuToggles),s=e.querySelector(this.selectors.submenus),i=new this._MenuType({menuElement:s,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay}),r=new this._MenuToggleType({menuToggleElement:n,parentElement:e,controlledMenu:i,parentMenu:this});this._elements.submenuToggles.push(r),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this,isSubmenuItem:!0,childMenu:i,toggle:r})}else{const n=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this})}this._elements.menuItems.push(t)}))}_handleFocus(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("focus",(()=>{this.focusState="self",this.currentChild=t}))}))}_handleClick(){function e(e,t,n){h(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach(((t,n)=>{t.dom.link.addEventListener("pointerdown",(()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(n)}),{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",(n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)}))}_handleHover(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("pointerenter",(n=>{if("pen"!==n.pointerType&&"touch"!==n.pointerType)if("on"===this.hoverType)this.currentEvent="mouse",this.currentChild=t,e.isSubmenuItem&&e.elements.toggle.preview();else if("dynamic"===this.hoverType){const n=this.elements.submenuToggles.some((e=>e.isOpen));this.currentChild=t,this.isTopLevel&&"none"===this.focusState||(this.currentEvent="mouse",this.focusCurrentChild()),!e.isSubmenuItem||this.isTopLevel&&!n||(this.currentEvent="mouse",e.elements.toggle.preview())}})),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",(t=>{"pen"!==t.pointerType&&"touch"!==t.pointerType&&("on"===this.hoverType?this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close()):"dynamic"===this.hoverType&&(this.isTopLevel||(this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}))}))}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||h(e)}))}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||(h(e),this.elements.controller.open(),this.focusFirstChild())}))}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach((e=>e.close()))}blurChildren(){this.elements.menuItems.forEach((e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}class d extends u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:o=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:o}),l&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","menuitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=0)}blur(){super.blur(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=-1)}}class p extends o{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i=null,initialize:r=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}function g(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class f extends a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:r="a",submenuSelector:o="ul",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="hide",isTopLevel:c=!0,parentMenu:a=null,hoverType:b="off",hoverDelay:v=250,initialize:M=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:i,submenuToggleSelector:r,submenuSelector:o,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:b,hoverDelay:v}),g(this,"_MenuType",f),g(this,"_MenuItemType",d),g(this,"_MenuToggleType",p),M&&this.initialize()}initialize(){try{super.initialize(),this.dom.menu.setAttribute("role","menubar"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(e){console.error(e)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",(e=>{"none"!==this.focusState&&(this.currentEvent="mouse",this.dom.menu.contains(e.target)||!this.dom.menu===e.target||(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))}))}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);if("Tab"===t&&("none"!==this.elements.rootMenu.focusState?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),"Character"===t)h(e);else if(this.isTopLevel){if("self"===this.focusState){const n=["Space","Enter","ArrowDown","ArrowUp"],s=["Escape"];(["ArrowRight","ArrowLeft","Home","End"].includes(t)||this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&s.includes(t))&&h(e)}}else{const n=["Space","Enter"];(["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"].includes(t)||this.currentMenuItem.isSubmenuItem&&n.includes(t))&&h(e)}}))}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e),{altKey:n,crtlKey:s,metaKey:i}=e;if("Character"!==t||(n||s||i))if(this.isTopLevel){if("self"===this.focusState)if("Space"===t||"Enter"===t)this.currentMenuItem.isSubmenuItem?(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()}))):this.currentMenuItem.dom.link.click();else if("ArrowRight"===t){h(e);const t=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),t&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if("ArrowLeft"===t){h(e);const t=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),t&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if("ArrowDown"===t)this.currentMenuItem.isSubmenuItem&&(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})));else if("ArrowUp"===t)this.currentMenuItem.isSubmenuItem&&(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})));else if("Home"===t)h(e),this.focusFirstChild();else if("End"===t)h(e),this.focusLastChild();else if("Escape"===t){this.elements.submenuToggles.some((e=>e.isOpen))?(h(e),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(h(e),this.elements.controller.close(),this.focusController())}}else"Space"===t||"Enter"===t?this.currentMenuItem.isSubmenuItem?(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()}))):this.currentMenuItem.dom.link.click():"Escape"===t?(h(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):"ArrowRight"===t?this.currentMenuItem.isSubmenuItem?(h(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame((()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()}))):(h(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):"ArrowLeft"===t?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(h(e),this.elements.parentMenu.currentMenuItem.elements.toggle.close(),this.elements.parentMenu.focusCurrentChild(),this.elements.parentMenu===this.elements.rootMenu&&(this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusPreviousChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&(this.elements.rootMenu.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.elements.rootMenu.currentMenuItem.elements.toggle.preview()))):"ArrowDown"===t?(h(e),this.focusNextChild()):"ArrowUp"===t?(h(e),this.focusPreviousChild()):"Home"===t?(h(e),this.focusFirstChild()):"End"===t&&(h(e),this.focusLastChild());else h(e),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(e.key)}))}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){0===this.currentChild?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(e){const t=e.toLowerCase();let n=this.currentChild+1,s=!1;for(;!s&&n<this.elements.menuItems.length;){let e="";e=this.elements.menuItems[n].dom.item.innerText?this.elements.menuItems[n].dom.item.innerText:this.elements.menuItems[n].dom.item.textContent,e=e.replace(/[\s]/g,"").toLowerCase().charAt(0),e===t&&(s=!0,this.focusChild(n)),n++}}}class b extends d{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:o=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:o,initialize:!1}),l&&this.initialize()}}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class M extends p{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i=null,initialize:r=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:i,initialize:!1}),v(this,"_dom",{toggle:null,parent:null,container:null}),this._dom.toggle=t,this._dom.parent=n,this._dom.container=s.isTopLevel?s.dom.container:s.dom.menu,r&&this.initialize()}initialize(){super.initialize(),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{openClass:t}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),""!==n&&("string"==typeof n?this.dom.container.classList.remove(n):this.dom.container.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}function y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends f{constructor(e){let{menuElement:t,menuItemSelector:n=".nav-item",menuLinkSelector:s=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:r=".dropdown-toggle",submenuSelector:o=".dropdown-menu",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="collapse",isTopLevel:c=!0,parentMenu:a=null,hoverType:d="off",hoverDelay:p=250,initialize:g=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:i,submenuToggleSelector:r,submenuSelector:o,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:d,hoverDelay:p,initialize:!1}),y(this,"_MenuType",E),y(this,"_MenuItemType",b),y(this,"_MenuToggleType",M),g&&this.initialize()}}return E}();
//# sourceMappingURL=menubar-bs5.min.js.map

@@ -1,2 +0,2 @@

function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n){try{if("object"!==e(n)){var r=e(n);throw new TypeError("AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ".concat(r," given."))}for(var o in n)if(!(n[o]instanceof t)){var i=e(n[o]);throw new TypeError("AccessibleMenu: ".concat(o," must be an instance of ").concat(t.name,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function n(t,n){try{if("object"!==e(n)){var r=e(n);throw new TypeError("AccessibleMenu: Values given to isValidType() must be inside of an object. ".concat(r," given."))}for(var o in n){var i=e(n[o]);if(i!==t)throw new TypeError("AccessibleMenu: ".concat(o," must be a ").concat(t,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function r(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ".concat(n," given."))}for(var r in t)try{if(null===t[r])throw new Error;document.querySelector(t[r])}catch(e){throw new TypeError("AccessibleMenu: ".concat(r,' must be a valid CSS selector. "').concat(t[r],'" given.'))}return!0}catch(e){return console.error(e),!1}}function o(t){try{if("object"!==e(t)||Array.isArray(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidClassList() must be inside of an object. ".concat(n," given."))}var o=function(n){var o=e(t[n]);if("string"!==o){if(!Array.isArray(t[n]))throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. ").concat(o," given."));t[n].forEach((function(e){if("string"!=typeof e)throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. An array containing non-strings given."))}))}else{var i={};i[n]=t[n],r(i)}};for(var i in t)o(i);return!0}catch(e){return console.error(e),!1}}function i(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ".concat(n," given."))}var r=["off","on","dynamic"];for(var o in t)if(!r.includes(t[o]))throw new TypeError("AccessibleMenu: ".concat(o," must be one of the following values: ").concat(r.join(", "),'. "').concat(t[o],'" given.'));return!0}catch(e){return console.error(e),!1}}function u(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){function e(t){var n=t.menuToggleElement,r=t.parentElement,o=t.controlledMenu,i=t.parentMenu,u=void 0===i?null:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"_dom",{toggle:null,parent:null}),c(this,"_elements",{controlledMenu:null,parentMenu:null}),c(this,"_open",!1),c(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),c(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=n,this._dom.parent=r,this._elements.controlledMenu=o,this._elements.parentMenu=u}var r,o,i;return r=e,o=[{key:"initialize",value:function(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(e,r){if(n("string",{tagName:e})&&t(HTMLElement,r)){var o=e.toLowerCase(),i=!0;for(var u in r)r[u].tagName.toLowerCase()!==o&&(i=!1);return i}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){var e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10),r=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),o=e;!r.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(r=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),r.replace(/\s/g,"").length>0&&((r=r.toLowerCase().replace(/\s+/g,"-")).startsWith("-")&&(r=r.substring(1)),r.endsWith("-")&&(r=r.slice(0,-1)),o="".concat(r,"-").concat(o)),this.dom.toggle.id=this.dom.toggle.id||"".concat(o,"-menu-button"),this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||"".concat(o,"-menu")}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isOpen",get:function(){return this._open},set:function(e){n("boolean",{value:e}),this._open=e}},{key:"_expand",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=this.elements.controlledMenu,o=r.closeClass,i=r.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.add(i):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(i))),""!==o&&("string"==typeof o?this.elements.controlledMenu.dom.menu.classList.remove(o):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(o))),n&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=this.elements.controlledMenu,o=r.closeClass,i=r.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==o&&("string"==typeof o?this.elements.controlledMenu.dom.menu.classList.add(o):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(o))),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.remove(i):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}},{key:"open",value:function(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}},{key:"preview",value:function(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}},{key:"close",value:function(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}},{key:"toggle",value:function(){this.isOpen?this.close():this.open()}},{key:"closeSiblings",value:function(){var e=this;this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((function(t){t!==e&&t.close()}))}},{key:"closeChildren",value:function(){this.elements.controlledMenu.elements.submenuToggles.forEach((function(e){return e.close()}))}}],o&&s(r.prototype,o),i&&s(r,i),e}();function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(){function e(t){var n=t.menuItemElement,r=t.menuLinkElement,o=t.parentMenu,i=t.isSubmenuItem,u=void 0!==i&&i,l=t.childMenu,s=void 0===l?null:l,c=t.toggle,a=void 0===c?null:c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"_dom",{item:null,link:null}),f(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),f(this,"_submenu",!1),this._dom.item=n,this._dom.link=r,this._elements.parentMenu=o,this._elements.childMenu=s,this._elements.toggle=a,this._submenu=u}var t,n,r;return t=e,(n=[{key:"initialize",value:function(){}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isSubmenuItem",get:function(){return this._submenu}},{key:"focus",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}},{key:"blur",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}])&&m(t.prototype,n),r&&m(t,r),e}();function p(e){try{var t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((function(e){return!0===n[e]}))||""}catch(e){return""}}function d(e){e.preventDefault(),e.stopPropagation()}function y(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var M=function(){function u(e){var t=e.menuElement,n=e.menuItemSelector,r=void 0===n?"li":n,o=e.menuLinkSelector,i=void 0===o?"a":o,l=e.submenuItemSelector,s=void 0===l?"":l,c=e.submenuToggleSelector,m=void 0===c?"a":c,f=e.submenuSelector,p=void 0===f?"ul":f,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,M=e.openClass,_=void 0===M?"show":M,E=e.closeClass,w=void 0===E?"hide":E,C=e.isTopLevel,T=void 0===C||C,S=e.parentMenu,I=void 0===S?null:S,k=e.hoverType,O=void 0===k?"off":k,A=e.hoverDelay,L=void 0===A?250:A;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),g(this,"_MenuType",u),g(this,"_MenuItemType",h),g(this,"_MenuToggleType",a),g(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),g(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),g(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),g(this,"_openClass","show"),g(this,"_closeClass","hide"),g(this,"_root",!0),g(this,"_currentChild",0),g(this,"_focusState","none"),g(this,"_currentEvent","none"),g(this,"_hoverType","off"),g(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=y,this._dom.container=b,this._selectors.menuItems=r,this._selectors.menuLinks=i,this._selectors.submenuItems=s,this._selectors.submenuToggles=m,this._selectors.submenus=p,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=I,this._elements.rootMenu=T?this:null,this._openClass=_||"",this._closeClass=w||"",this._root=T,this._hoverType=O,this._hoverDelay=L}var l,s,c;return l=u,s=[{key:"initialize",value:function(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){var e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}},{key:"dom",get:function(){return this._dom}},{key:"selectors",get:function(){return this._selectors}},{key:"elements",get:function(){return this._elements}},{key:"isTopLevel",get:function(){return this._root}},{key:"openClass",get:function(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass},set:function(e){o({openClass:e}),this._openClass!==e&&(this._openClass=e)}},{key:"closeClass",get:function(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass},set:function(e){o({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}},{key:"currentChild",get:function(){return this._currentChild},set:function(e){function t(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu)for(var t=0,n=!1;!n&&t<e.elements.parentMenu.elements.menuItems.length;){var r=e.elements.parentMenu.elements.menuItems[t];r.isSubmenuItem&&r.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}n("number",{value:e}),e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}},{key:"focusState",get:function(){return this._focusState},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidState() must be inside of an object. ".concat(n," given."))}var r=["none","self","child"];for(var o in t)if(!r.includes(t[o]))throw new TypeError("AccessibleMenu: ".concat(o," must be one of the following values: ").concat(r.join(", "),'. "').concat(t[o],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&("self"===t||"none"===t)&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==t&&"child"!==t||(this.elements.parentMenu.focusState="child")}},{key:"currentEvent",get:function(){return this._currentEvent},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidEvent() must be inside of an object. ".concat(n," given."))}var r=["none","mouse","keyboard","character"];for(var o in t)if(!r.includes(t[o]))throw new TypeError("AccessibleMenu: ".concat(o," must be one of the following values: ").concat(r.join(", "),'. "').concat(t[o],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.currentEvent=t})))}},{key:"currentMenuItem",get:function(){return this.elements.menuItems[this.currentChild]}},{key:"hoverType",get:function(){return this._root?this._hoverType:this.elements.rootMenu.hoverType},set:function(e){i({value:e}),this._hoverType!==e&&(this._hoverType=e)}},{key:"hoverDelay",get:function(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay},set:function(e){n("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}},{key:"shouldFocus",get:function(){var e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}},{key:"_validate",value:function(){var e=!0;return null!==this._dom.container||null!==this._dom.controller?t(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(e=!1):t(HTMLElement,{menuElement:this._dom.menu})||(e=!1),""!==this._selectors.submenuItems?r({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(e=!1):r({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(e=!1),""===this._openClass||o({openClass:this._openClass})||(e=!1),""===this._closeClass||o({closeClass:this._closeClass})||(e=!1),n("boolean",{isTopLevel:this._root})||(e=!1),null===this._elements.parentMenu||t(u,{parentMenu:this._elements.parentMenu})||(e=!1),i({hoverType:this._hoverType})||(e=!1),n("number",{hoverDelay:this._hoverDelay})||(e=!1),e}},{key:"_setDOMElementType",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be set through _setDOMElementType.'));n!==this.dom.menu&&t(HTMLElement,{base:n});var o=Array.from(n.querySelectorAll(this.selectors[e])),i=o.filter((function(e){return e.parentElement===n}));this._dom[e]=r?i:[].concat(y(this._dom[e]),y(i))}},{key:"_resetDOMElementType",value:function(e){if(void 0===this.dom[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be reset through _resetDOMElementType.'));this._dom[e]=[]}},{key:"_setDOMElements",value:function(){var e=this;this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((function(t){e._setDOMElementType("submenuToggles",t,!1),e._setDOMElementType("submenus",t,!1)})))}},{key:"_findRootMenu",value:function(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}},{key:"_createChildElements",value:function(){var e=this;this.dom.menuItems.forEach((function(t){var n;if(e.dom.submenuItems.includes(t)){var r=t.querySelector(e.selectors.submenuToggles),o=t.querySelector(e.selectors.submenus),i=new e._MenuType({menuElement:o,menuItemSelector:e.selectors.menuItems,menuLinkSelector:e.selectors.menuLinks,submenuItemSelector:e.selectors.submenuItems,submenuToggleSelector:e.selectors.submenuToggles,submenuSelector:e.selectors.submenus,openClass:e.openClass,closeClass:e.closeClass,isTopLevel:!1,parentMenu:e,hoverType:e.hoverType,hoverDelay:e.hoverDelay}),u=new e._MenuToggleType({menuToggleElement:r,parentElement:t,controlledMenu:i,parentMenu:e});e._elements.submenuToggles.push(u),n=new e._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:e,isSubmenuItem:!0,childMenu:i,toggle:u})}else{var l=t.querySelector(e.selectors.menuLinks);n=new e._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:e})}e._elements.menuItems.push(n)}))}},{key:"_handleFocus",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("focus",(function(){e.focusState="self",e.currentChild=n}))}))}},{key:"_handleClick",value:function(){var e=this;function t(e,t,n){d(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((function(n,r){n.dom.link.addEventListener("pointerdown",(function(){e.currentEvent="mouse",e.elements.rootMenu.blurChildren(),e.focusChild(r)}),{passive:!0}),n.isSubmenuItem&&n.elements.toggle.dom.toggle.addEventListener("pointerup",(function(r){e.currentEvent="mouse",t(e,n.elements.toggle,r)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(function(n){e.currentEvent="mouse",t(e,e.elements.controller,n)}))}},{key:"_handleHover",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("pointerenter",(function(r){if("pen"!==r.pointerType&&"touch"!==r.pointerType)if("on"===e.hoverType)e.currentEvent="mouse",e.currentChild=n,t.isSubmenuItem&&t.elements.toggle.preview();else if("dynamic"===e.hoverType){var o=e.elements.submenuToggles.some((function(e){return e.isOpen}));e.currentChild=n,e.isTopLevel&&"none"===e.focusState||(e.currentEvent="mouse",e.focusCurrentChild()),!t.isSubmenuItem||e.isTopLevel&&!o||(e.currentEvent="mouse",t.elements.toggle.preview())}})),t.isSubmenuItem&&t.dom.item.addEventListener("pointerleave",(function(n){"pen"!==n.pointerType&&"touch"!==n.pointerType&&("on"===e.hoverType?e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close()):"dynamic"===e.hoverType&&(e.isTopLevel||(e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()))))}))}))}},{key:"_handleKeydown",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||(d(t),e.elements.controller.open(),e.focusFirstChild())}))}},{key:"focus",value:function(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}},{key:"blur",value:function(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}},{key:"focusCurrentChild",value:function(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}},{key:"focusChild",value:function(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}},{key:"focusFirstChild",value:function(){this.focusChild(0)}},{key:"focusLastChild",value:function(){this.focusChild(this.elements.menuItems.length-1)}},{key:"focusNextChild",value:function(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}},{key:"focusPreviousChild",value:function(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}},{key:"blurCurrentChild",value:function(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}},{key:"focusController",value:function(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}},{key:"focusContainer",value:function(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}},{key:"closeChildren",value:function(){this.elements.submenuToggles.forEach((function(e){return e.close()}))}},{key:"blurChildren",value:function(){this.elements.menuItems.forEach((function(e){e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}],s&&b(l.prototype,s),c&&b(l,c),u}();function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w(){return w="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=C(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},w.apply(this,arguments)}function C(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}function T(e,t){return T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},T(e,t)}function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=k(e);if(t){var o=k(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){if(t&&("object"===_(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}var O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&T(e,t)}(i,h);var t,n,r,o=S(i);function i(e){var t,n=e.menuItemElement,r=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,m=e.toggle,f=void 0===m?null:m,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=o.call(this,{menuItemElement:n,menuLinkElement:r,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:f}),p&&t.initialize(),t}return t=i,(n=[{key:"initialize",value:function(){w(k(i.prototype),"initialize",this).call(this),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","treeitem"),this.dom.link.tabIndex=-1}},{key:"focus",value:function(){w(k(i.prototype),"focus",this).call(this),this.dom.link.tabIndex=0}},{key:"blur",value:function(){w(k(i.prototype),"blur",this).call(this),this.dom.link.tabIndex=-1}}])&&E(t.prototype,n),r&&E(t,r),i}();function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function L(e,t){return L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},L(e,t)}function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var o=R(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return P(this,n)}}function P(e,t){if(t&&("object"===A(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var D=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}(n,a);var t=j(n);function n(e){var r,o=e.menuToggleElement,i=e.parentElement,u=e.controlledMenu,l=e.parentMenu,s=void 0===l?null:l,c=e.initialize,a=void 0===c||c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r=t.call(this,{menuToggleElement:o,parentElement:i,controlledMenu:u,parentMenu:s}),a&&r.initialize(),r}return n}();function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function z(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return N(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return N(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(){return B="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=V(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},B.apply(this,arguments)}function V(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=$(e)););return e}function H(e,t){return H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},H(e,t)}function K(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=$(e);if(t){var o=$(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return U(this,n)}}function U(e,t){if(t&&("object"===x(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return q(e)}function q(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$(e)}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(i,M);var t,n,r,o=K(i);function i(e){var t,n=e.menuElement,r=e.menuItemSelector,u=void 0===r?"li":r,l=e.menuLinkSelector,s=void 0===l?"a":l,c=e.submenuItemSelector,a=void 0===c?"":c,m=e.submenuToggleSelector,f=void 0===m?"a":m,h=e.submenuSelector,p=void 0===h?"ul":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,M=void 0===g?"show":g,_=e.closeClass,E=void 0===_?"hide":_,w=e.isTopLevel,C=void 0===w||w,T=e.parentMenu,S=void 0===T?null:T,I=e.hoverType,k=void 0===I?"off":I,A=e.hoverDelay,L=void 0===A?250:A,j=e.initialize,P=void 0===j||j;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),W(q(t=o.call(this,{menuElement:n,menuItemSelector:u,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:f,submenuSelector:p,controllerElement:y,containerElement:b,openClass:M,closeClass:E,isTopLevel:C,parentMenu:S,hoverType:k,hoverDelay:L})),"_MenuType",i),W(q(t),"_MenuItemType",O),W(q(t),"_MenuToggleType",D),P&&t.initialize(),t}return t=i,(n=[{key:"initialize",value:function(){try{B($(i.prototype),"initialize",this).call(this),this.isTopLevel?(this.dom.menu.setAttribute("role","tree"),this.elements.menuItems[0].dom.link.tabIndex=0):this.dom.menu.setAttribute("role","group"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}},{key:"_handleKeydown",value:function(){var e=this;B($(i.prototype),"_handleKeydown",this).call(this),this.dom.menu.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Tab"===n&&("none"!==e.elements.rootMenu.focusState?e.elements.rootMenu.blur():e.elements.rootMenu.focus()),"self"===e.focusState&&(["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"].includes(n)||e.currentMenuItem.isSubmenuItem&&["Enter","ArrowRight"].includes(n)||e.elements.controller&&["Escape"].includes(n))&&d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;B($(i.prototype),"_handleKeyup",this).call(this),this.dom.menu.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t),r=t.altKey,o=t.crtlKey,i=t.metaKey;if("Character"!==n||r||o||i){if("self"===e.focusState)if("Enter"===n||"Space"===n)d(t),e.currentMenuItem.isSubmenuItem?e.currentMenuItem.elements.toggle.isOpen?e.currentMenuItem.elements.toggle.close():e.currentMenuItem.elements.toggle.preview():e.currentMenuItem.dom.link.click();else if("Escape"===n)e.isTopLevel&&e.elements.controller&&e.elements.controller.isOpen&&(e.elements.controller.close(),e.focusController());else if("ArrowDown"===n)d(t),e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen?(e.blurCurrentChild(),e.currentMenuItem.elements.childMenu.currentEvent=e.currentEvent,e.currentMenuItem.elements.childMenu.focusFirstChild()):e.isTopLevel||e.currentChild!==e.elements.menuItems.length-1?e.focusNextChild():e.focusParentsNextChild();else if("ArrowUp"===n){d(t);var u=e.elements.menuItems[e.currentChild-1];u&&u.isSubmenuItem&&u.elements.toggle.isOpen?(e.blurCurrentChild(),e.currentChild=e.currentChild-1,e.currentMenuItem.elements.childMenu.currentEvent=e.currentEvent,e.focusChildsLastNode()):e.isTopLevel||0!==e.currentChild?e.focusPreviousChild():(e.blurCurrentChild(),e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.focusCurrentChild())}else"ArrowRight"===n?e.currentMenuItem.isSubmenuItem&&(d(t),e.currentMenuItem.elements.toggle.isOpen?(e.blurCurrentChild(),e.currentMenuItem.elements.childMenu.currentEvent=e.currentEvent,e.currentMenuItem.elements.childMenu.focusFirstChild()):e.currentMenuItem.elements.toggle.preview()):"ArrowLeft"===n?(d(t),e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen?(e.currentMenuItem.elements.childMenu.blurCurrentChild(),e.currentMenuItem.elements.toggle.close()):e.isTopLevel||(e.blurCurrentChild(),e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.focusCurrentChild())):"Home"===n?(d(t),e.blurCurrentChild(),e.elements.rootMenu.focusFirstChild()):"End"===n?(d(t),e.blurCurrentChild(),e.elements.rootMenu.focusLastNode()):"Asterisk"===n&&(d(t),e.openChildren())}else d(t),e.elements.rootMenu.currentEvent="character",e.focusNextNodeWithCharacter(t.key)}))}},{key:"focusLastNode",value:function(){var e=this.elements.menuItems.length-1,t=this.elements.menuItems[e];t.isSubmenuItem&&t.elements.toggle.isOpen?(this.currentChild=e,t.elements.childMenu.currentEvent=this.currentEvent,t.elements.childMenu.focusLastNode()):this.focusLastChild()}},{key:"openChildren",value:function(){this.elements.submenuToggles.forEach((function(e){return e.preview()}))}},{key:"focusNextNodeWithCharacter",value:function(e){for(var t=e.toLowerCase(),n=function e(t){var n=[];return t.elements.menuItems.forEach((function(t){n.push(t),t.isSubmenuItem&&t.elements.toggle.isOpen&&(n=[].concat(z(n),z(e(t.elements.toggle.elements.controlledMenu))))})),n}(this.elements.rootMenu),r=n.indexOf(this.currentMenuItem)+1,o=[].concat(z(n.slice(r)),z(n.slice(0,r))),i=0,u=!1;!u&&i<o.length;){if((o[i].dom.item.innerText?o[i].dom.item.innerText:o[i].dom.item.textContent).replace(/[\s]/g,"").toLowerCase().charAt(0)===t){u=!0;var l=o[i].elements.parentMenu,s=l.elements.menuItems.indexOf(o[i]);this.elements.rootMenu.blurChildren(),l.focusChild(s)}i++}}},{key:"focusParentsNextChild",value:function(){this.elements.parentMenu&&(this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.currentChild===this.elements.parentMenu.elements.menuItems.length-1?(this.elements.parentMenu.blurCurrentChild(),this.elements.parentMenu.focusParentsNextChild()):(this.blurChildren(),this.elements.parentMenu.focusNextChild()))}},{key:"focusChildsLastNode",value:function(){this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusLastChild(),this.currentMenuItem.elements.childMenu.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.childMenu.currentMenuItem.elements.toggle.isOpen&&(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.childMenu.focusChildsLastNode())}}])&&F(t.prototype,n),r&&F(t,r),i}();function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function J(e,t){return J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},J(e,t)}function Q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Y(e);if(t){var o=Y(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return X(this,n)}}function X(e,t){if(t&&("object"===G(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(e)}var ee=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(n,O);var t=Q(n);function n(e){var r,o=e.menuItemElement,i=e.menuLinkElement,u=e.parentMenu,l=e.isSubmenuItem,s=void 0!==l&&l,c=e.childMenu,a=void 0===c?null:c,m=e.toggle,f=void 0===m?null:m,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r=t.call(this,{menuItemElement:o,menuLinkElement:i,parentMenu:u,isSubmenuItem:s,childMenu:a,toggle:f,initialize:!1}),p&&r.initialize(),r}return n}();function te(e){return te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},te(e)}function ne(e){return function(e){if(Array.isArray(e))return re(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return re(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ie(){return ie="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=ue(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},ie.apply(this,arguments)}function ue(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=me(e)););return e}function le(e,t){return le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},le(e,t)}function se(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=me(e);if(t){var o=me(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ce(this,n)}}function ce(e,t){if(t&&("object"===te(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ae(e)}function ae(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function me(e){return me=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},me(e)}var fe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(i,D);var t,n,r,o=se(i);function i(e){var t,n,r,u,l=e.menuToggleElement,s=e.parentElement,c=e.controlledMenu,a=e.parentMenu,m=void 0===a?null:a,f=e.initialize,h=void 0===f||f;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=o.call(this,{menuToggleElement:l,parentElement:s,controlledMenu:c,parentMenu:m,initialize:!1}),n=ae(t),u={toggle:null,parent:null,container:null},(r="_dom")in n?Object.defineProperty(n,r,{value:u,enumerable:!0,configurable:!0,writable:!0}):n[r]=u,t._dom.toggle=l,t._dom.parent=s,t._dom.container=c.isTopLevel?c.dom.container:c.dom.menu,h&&t.initialize(),t}return t=i,n=[{key:"initialize",value:function(){ie(me(i.prototype),"initialize",this).call(this),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}},{key:"_expand",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.elements.controlledMenu.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.dom.container.classList.add(n):(e=this.dom.container.classList).add.apply(e,ne(n))),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=this.elements.controlledMenu,o=r.closeClass,i=r.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==o&&("string"==typeof o?this.dom.container.classList.add(o):(e=this.dom.container.classList).add.apply(e,ne(o))),""!==i&&("string"==typeof i?this.dom.container.classList.remove(i):(t=this.dom.container.classList).remove.apply(t,ne(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}],n&&oe(t.prototype,n),r&&oe(t,r),i}();function he(e){return he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},he(e)}function pe(e,t){return pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},pe(e,t)}function de(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=be(e);if(t){var o=be(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}function ye(e,t){if(t&&("object"===he(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ve(e)}function ve(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function be(e){return be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},be(e)}function ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Me=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pe(e,t)}(n,Z);var t=de(n);function n(e){var r,o=e.menuElement,i=e.menuItemSelector,u=void 0===i?".nav-item":i,l=e.menuLinkSelector,s=void 0===l?".nav-link,.dropdown-item":l,c=e.submenuItemSelector,a=void 0===c?".dropdown":c,m=e.submenuToggleSelector,f=void 0===m?".dropdown-toggle":m,h=e.submenuSelector,p=void 0===h?".dropdown-menu":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,M=void 0===g?"show":g,_=e.closeClass,E=void 0===_?"collapse":_,w=e.isTopLevel,C=void 0===w||w,T=e.parentMenu,S=void 0===T?null:T,I=e.hoverType,k=void 0===I?"off":I,O=e.hoverDelay,A=void 0===O?250:O,L=e.initialize,j=void 0===L||L;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),ge(ve(r=t.call(this,{menuElement:o,menuItemSelector:u,menuLinkSelector:s,submenuItemSelector:a,submenuToggleSelector:f,submenuSelector:p,controllerElement:y,containerElement:b,openClass:M,closeClass:E,isTopLevel:C,parentMenu:S,hoverType:k,hoverDelay:A,initialize:!1})),"_MenuType",n),ge(ve(r),"_MenuItemType",ee),ge(ve(r),"_MenuToggleType",fe),j&&r.initialize(),r}return n}();export{Me as default};
function e(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ${typeof t} given.`)}for(const n in t)if(!(t[n]instanceof e)){const s=typeof t[n];throw new TypeError(`AccessibleMenu: ${n} must be an instance of ${e.name}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function t(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Values given to isValidType() must be inside of an object. ${typeof t} given.`)}for(const n in t){const s=typeof t[n];if(s!==e)throw new TypeError(`AccessibleMenu: ${n} must be a ${e}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function n(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ${typeof e} given.`)}for(const t in e)try{if(null===e[t])throw new Error;document.querySelector(e[t])}catch(n){throw new TypeError(`AccessibleMenu: ${t} must be a valid CSS selector. "${e[t]}" given.`)}return!0}catch(e){return console.error(e),!1}}function s(e){try{if("object"!=typeof e||Array.isArray(e)){throw new TypeError(`AccessibleMenu: Values given to isValidClassList() must be inside of an object. ${typeof e} given.`)}for(const t in e){const s=typeof e[t];if("string"!==s){if(!Array.isArray(e[t]))throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. ${s} given.`);e[t].forEach((e=>{if("string"!=typeof e)throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. An array containing non-strings given.`)}))}else{const s={};s[t]=e[t],n(s)}}return!0}catch(e){return console.error(e),!1}}function r(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ${typeof e} given.`)}const t=["off","on","dynamic"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}function i(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class l{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r=null}=e;i(this,"_dom",{toggle:null,parent:null}),i(this,"_elements",{controlledMenu:null,parentMenu:null}),i(this,"_open",!1),i(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),i(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=t,this._dom.parent=n,this._elements.controlledMenu=s,this._elements.parentMenu=r}initialize(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(n,s){if(t("string",{tagName:n})&&e(HTMLElement,s)){const e=n.toLowerCase();let t=!0;for(const n in s)s[n].tagName.toLowerCase()!==e&&(t=!1);return t}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let t=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),n=e;!t.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(t=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),t.replace(/\s/g,"").length>0&&(t=t.toLowerCase().replace(/\s+/g,"-"),t.startsWith("-")&&(t=t.substring(1)),t.endsWith("-")&&(t=t.slice(0,-1)),n=`${t}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){t("boolean",{value:e}),this._open=e}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.add(n):this.elements.controlledMenu.dom.menu.classList.add(...n)),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.remove(t):this.elements.controlledMenu.dom.menu.classList.remove(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.add(t):this.elements.controlledMenu.dom.menu.classList.add(...t)),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.remove(n):this.elements.controlledMenu.dom.menu.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((e=>{e!==this&&e.close()}))}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach((e=>e.close()))}}function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r=!1,childMenu:i=null,toggle:l=null}=e;o(this,"_dom",{item:null,link:null}),o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),o(this,"_submenu",!1),this._dom.item=t,this._dom.link=n,this._elements.parentMenu=s,this._elements.childMenu=i,this._elements.toggle=l,this._submenu=r}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function m(e){try{const t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((e=>!0===n[e]))||""}catch(e){return""}}function h(e){e.preventDefault(),e.stopPropagation()}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:r="",submenuToggleSelector:i="a",submenuSelector:o="ul",controllerElement:m=null,containerElement:h=null,openClass:d="show",closeClass:p="hide",isTopLevel:g=!0,parentMenu:f=null,hoverType:b="off",hoverDelay:v=250}=e;c(this,"_MenuType",a),c(this,"_MenuItemType",u),c(this,"_MenuToggleType",l),c(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),c(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),c(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),c(this,"_openClass","show"),c(this,"_closeClass","hide"),c(this,"_root",!0),c(this,"_currentChild",0),c(this,"_focusState","none"),c(this,"_currentEvent","none"),c(this,"_hoverType","off"),c(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=m,this._dom.container=h,this._selectors.menuItems=n,this._selectors.menuLinks=s,this._selectors.submenuItems=r,this._selectors.submenuToggles=i,this._selectors.submenus=o,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=f,this._elements.rootMenu=g?this:null,this._openClass=d||"",this._closeClass=p||"",this._root=g,this._hoverType=b,this._hoverDelay=v}initialize(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get shouldFocus(){let e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}set openClass(e){s({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){s({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set currentChild(e){function n(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu){let t=0,n=!1;for(;!n&&t<e.elements.parentMenu.elements.menuItems.length;){const s=e.elements.parentMenu.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}}t("number",{value:e}),e<-1?(this._currentChild=-1,n(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,n(this)):this.focusChild!==e&&(this._currentChild=e,n(this))}set focusState(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidState() must be inside of an object. ${typeof e} given.`);const t=["none","self","child"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&("self"===e||"none"===e)&&this.elements.submenuToggles.forEach((e=>{e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==e&&"child"!==e||(this.elements.parentMenu.focusState="child")}set currentEvent(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidEvent() must be inside of an object. ${typeof e} given.`);const t=["none","mouse","keyboard","character"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((t=>{t.elements.controlledMenu.currentEvent=e})))}set hoverType(e){r({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){t("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}_validate(){let i=!0;return null!==this._dom.container||null!==this._dom.controller?e(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(i=!1):e(HTMLElement,{menuElement:this._dom.menu})||(i=!1),""!==this._selectors.submenuItems?n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(i=!1):n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(i=!1),""===this._openClass||s({openClass:this._openClass})||(i=!1),""===this._closeClass||s({closeClass:this._closeClass})||(i=!1),t("boolean",{isTopLevel:this._root})||(i=!1),null===this._elements.parentMenu||e(a,{parentMenu:this._elements.parentMenu})||(i=!1),r({hoverType:this._hoverType})||(i=!1),t("number",{hoverDelay:this._hoverDelay})||(i=!1),i}_setDOMElementType(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[t])throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`);{if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);n!==this.dom.menu&&e(HTMLElement,{base:n});const r=Array.from(n.querySelectorAll(this.selectors[t])).filter((e=>e.parentElement===n));this._dom[t]=s?r:[...this._dom[t],...r]}}_resetDOMElementType(e){if(void 0===this.dom[e])throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`);if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}_setDOMElements(){this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)})))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}_createChildElements(){this.dom.menuItems.forEach((e=>{let t;if(this.dom.submenuItems.includes(e)){const n=e.querySelector(this.selectors.submenuToggles),s=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:s,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay}),i=new this._MenuToggleType({menuToggleElement:n,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(i),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:i})}else{const n=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this})}this._elements.menuItems.push(t)}))}_handleFocus(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("focus",(()=>{this.focusState="self",this.currentChild=t}))}))}_handleClick(){function e(e,t,n){h(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach(((t,n)=>{t.dom.link.addEventListener("pointerdown",(()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(n)}),{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",(n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)}))}_handleHover(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("pointerenter",(n=>{if("pen"!==n.pointerType&&"touch"!==n.pointerType)if("on"===this.hoverType)this.currentEvent="mouse",this.currentChild=t,e.isSubmenuItem&&e.elements.toggle.preview();else if("dynamic"===this.hoverType){const n=this.elements.submenuToggles.some((e=>e.isOpen));this.currentChild=t,this.isTopLevel&&"none"===this.focusState||(this.currentEvent="mouse",this.focusCurrentChild()),!e.isSubmenuItem||this.isTopLevel&&!n||(this.currentEvent="mouse",e.elements.toggle.preview())}})),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",(t=>{"pen"!==t.pointerType&&"touch"!==t.pointerType&&("on"===this.hoverType?this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close()):"dynamic"===this.hoverType&&(this.isTopLevel||(this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}))}))}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||h(e)}))}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||(h(e),this.elements.controller.open(),this.focusFirstChild())}))}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach((e=>e.close()))}blurChildren(){this.elements.menuItems.forEach((e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}class d extends u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r=!1,childMenu:i=null,toggle:l=null,initialize:o=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r,childMenu:i,toggle:l}),o&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","treeitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.dom.link.tabIndex=0}blur(){super.blur(),this.dom.link.tabIndex=-1}}class p extends l{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r=null,initialize:i=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r}),i&&this.initialize()}}function g(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class f extends a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:r="",submenuToggleSelector:i="a",submenuSelector:l="ul",controllerElement:o=null,containerElement:u=null,openClass:m="show",closeClass:h="hide",isTopLevel:c=!0,parentMenu:a=null,hoverType:b="off",hoverDelay:v=250,initialize:M=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:r,submenuToggleSelector:i,submenuSelector:l,controllerElement:o,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:b,hoverDelay:v}),g(this,"_MenuType",f),g(this,"_MenuItemType",d),g(this,"_MenuToggleType",p),M&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?(this.dom.menu.setAttribute("role","tree"),this.elements.menuItems[0].dom.link.tabIndex=0):this.dom.menu.setAttribute("role","group"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);if("Tab"===t&&("none"!==this.elements.rootMenu.focusState?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),"self"===this.focusState){const n=["Enter","ArrowRight"],s=["Escape"];(["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"].includes(t)||this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&s.includes(t))&&h(e)}}))}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e),{altKey:n,crtlKey:s,metaKey:r}=e;if("Character"!==t||(n||s||r)){if("self"===this.focusState)if("Enter"===t||"Space"===t)h(e),this.currentMenuItem.isSubmenuItem?this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview():this.currentMenuItem.dom.link.click();else if("Escape"===t)this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if("ArrowDown"===t)h(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.isTopLevel||this.currentChild!==this.elements.menuItems.length-1?this.focusNextChild():this.focusParentsNextChild();else if("ArrowUp"===t){h(e);const t=this.elements.menuItems[this.currentChild-1];t&&t.isSubmenuItem&&t.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):this.isTopLevel||0!==this.currentChild?this.focusPreviousChild():(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild())}else"ArrowRight"===t?this.currentMenuItem.isSubmenuItem&&(h(e),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):"ArrowLeft"===t?(h(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.toggle.close()):this.isTopLevel||(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild())):"Home"===t?(h(e),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):"End"===t?(h(e),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):"Asterisk"===t&&(h(e),this.openChildren())}else h(e),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(e.key)}))}focusLastNode(){const e=this.elements.menuItems.length-1,t=this.elements.menuItems[e];t.isSubmenuItem&&t.elements.toggle.isOpen?(this.currentChild=e,t.elements.childMenu.currentEvent=this.currentEvent,t.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach((e=>e.preview()))}focusNextNodeWithCharacter(e){const t=e.toLowerCase(),n=function e(t){let n=[];return t.elements.menuItems.forEach((t=>{n.push(t),t.isSubmenuItem&&t.elements.toggle.isOpen&&(n=[...n,...e(t.elements.toggle.elements.controlledMenu)])})),n}(this.elements.rootMenu),s=n.indexOf(this.currentMenuItem)+1,r=[...n.slice(s),...n.slice(0,s)];let i=0,l=!1;for(;!l&&i<r.length;){let e="";if(e=r[i].dom.item.innerText?r[i].dom.item.innerText:r[i].dom.item.textContent,e=e.replace(/[\s]/g,"").toLowerCase().charAt(0),e===t){l=!0;const e=r[i].elements.parentMenu,t=e.elements.menuItems.indexOf(r[i]);this.elements.rootMenu.blurChildren(),e.focusChild(t)}i++}}focusParentsNextChild(){this.elements.parentMenu&&(this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.currentChild===this.elements.parentMenu.elements.menuItems.length-1?(this.elements.parentMenu.blurCurrentChild(),this.elements.parentMenu.focusParentsNextChild()):(this.blurChildren(),this.elements.parentMenu.focusNextChild()))}focusChildsLastNode(){this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusLastChild(),this.currentMenuItem.elements.childMenu.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.childMenu.currentMenuItem.elements.toggle.isOpen&&(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.childMenu.focusChildsLastNode())}}class b extends d{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r=!1,childMenu:i=null,toggle:l=null,initialize:o=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r,childMenu:i,toggle:l,initialize:!1}),o&&this.initialize()}}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class M extends p{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r=null,initialize:i=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r,initialize:!1}),v(this,"_dom",{toggle:null,parent:null,container:null}),this._dom.toggle=t,this._dom.parent=n,this._dom.container=s.isTopLevel?s.dom.container:s.dom.menu,i&&this.initialize()}initialize(){super.initialize(),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{openClass:t}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),""!==n&&("string"==typeof n?this.dom.container.classList.remove(n):this.dom.container.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}function y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends f{constructor(e){let{menuElement:t,menuItemSelector:n=".nav-item",menuLinkSelector:s=".nav-link,.dropdown-item",submenuItemSelector:r=".dropdown",submenuToggleSelector:i=".dropdown-toggle",submenuSelector:l=".dropdown-menu",controllerElement:o=null,containerElement:u=null,openClass:m="show",closeClass:h="collapse",isTopLevel:c=!0,parentMenu:a=null,hoverType:d="off",hoverDelay:p=250,initialize:g=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:r,submenuToggleSelector:i,submenuSelector:l,controllerElement:o,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:d,hoverDelay:p,initialize:!1}),y(this,"_MenuType",E),y(this,"_MenuItemType",b),y(this,"_MenuToggleType",M),g&&this.initialize()}}export{E as default};
//# sourceMappingURL=treeview-bs5.esm.min.js.map

@@ -1,2 +0,2 @@

var Bootstrap5Treeview=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n){try{if("object"!==e(n)){var r=e(n);throw new TypeError("AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ".concat(r," given."))}for(var o in n)if(!(n[o]instanceof t)){var i=e(n[o]);throw new TypeError("AccessibleMenu: ".concat(o," must be an instance of ").concat(t.name,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function n(t,n){try{if("object"!==e(n)){var r=e(n);throw new TypeError("AccessibleMenu: Values given to isValidType() must be inside of an object. ".concat(r," given."))}for(var o in n){var i=e(n[o]);if(i!==t)throw new TypeError("AccessibleMenu: ".concat(o," must be a ").concat(t,". ").concat(i," given."))}return!0}catch(e){return console.error(e),!1}}function r(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ".concat(n," given."))}for(var r in t)try{if(null===t[r])throw new Error;document.querySelector(t[r])}catch(e){throw new TypeError("AccessibleMenu: ".concat(r,' must be a valid CSS selector. "').concat(t[r],'" given.'))}return!0}catch(e){return console.error(e),!1}}function o(t){try{if("object"!==e(t)||Array.isArray(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidClassList() must be inside of an object. ".concat(n," given."))}var o=function(n){var o=e(t[n]);if("string"!==o){if(!Array.isArray(t[n]))throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. ").concat(o," given."));t[n].forEach((function(e){if("string"!=typeof e)throw new TypeError("AccessibleMenu: ".concat(n," must be a string or an array of strings. An array containing non-strings given."))}))}else{var i={};i[n]=t[n],r(i)}};for(var i in t)o(i);return!0}catch(e){return console.error(e),!1}}function i(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ".concat(n," given."))}var r=["off","on","dynamic"];for(var o in t)if(!r.includes(t[o]))throw new TypeError("AccessibleMenu: ".concat(o," must be one of the following values: ").concat(r.join(", "),'. "').concat(t[o],'" given.'));return!0}catch(e){return console.error(e),!1}}function u(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){function e(t){var n=t.menuToggleElement,r=t.parentElement,o=t.controlledMenu,i=t.parentMenu,u=void 0===i?null:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"_dom",{toggle:null,parent:null}),c(this,"_elements",{controlledMenu:null,parentMenu:null}),c(this,"_open",!1),c(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),c(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=n,this._dom.parent=r,this._elements.controlledMenu=o,this._elements.parentMenu=u}var r,o,i;return r=e,o=[{key:"initialize",value:function(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(e,r){if(n("string",{tagName:e})&&t(HTMLElement,r)){var o=e.toLowerCase(),i=!0;for(var u in r)r[u].tagName.toLowerCase()!==o&&(i=!1);return i}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){var e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10),r=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),o=e;!r.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(r=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),r.replace(/\s/g,"").length>0&&((r=r.toLowerCase().replace(/\s+/g,"-")).startsWith("-")&&(r=r.substring(1)),r.endsWith("-")&&(r=r.slice(0,-1)),o="".concat(r,"-").concat(o)),this.dom.toggle.id=this.dom.toggle.id||"".concat(o,"-menu-button"),this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||"".concat(o,"-menu")}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isOpen",get:function(){return this._open},set:function(e){n("boolean",{value:e}),this._open=e}},{key:"_expand",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=this.elements.controlledMenu,o=r.closeClass,i=r.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.add(i):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(i))),""!==o&&("string"==typeof o?this.elements.controlledMenu.dom.menu.classList.remove(o):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(o))),n&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=this.elements.controlledMenu,o=r.closeClass,i=r.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==o&&("string"==typeof o?this.elements.controlledMenu.dom.menu.classList.add(o):(e=this.elements.controlledMenu.dom.menu.classList).add.apply(e,u(o))),""!==i&&("string"==typeof i?this.elements.controlledMenu.dom.menu.classList.remove(i):(t=this.elements.controlledMenu.dom.menu.classList).remove.apply(t,u(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}},{key:"open",value:function(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}},{key:"preview",value:function(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}},{key:"close",value:function(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}},{key:"toggle",value:function(){this.isOpen?this.close():this.open()}},{key:"closeSiblings",value:function(){var e=this;this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((function(t){t!==e&&t.close()}))}},{key:"closeChildren",value:function(){this.elements.controlledMenu.elements.submenuToggles.forEach((function(e){return e.close()}))}}],o&&l(r.prototype,o),i&&l(r,i),e}();function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(){function e(t){var n=t.menuItemElement,r=t.menuLinkElement,o=t.parentMenu,i=t.isSubmenuItem,u=void 0!==i&&i,s=t.childMenu,l=void 0===s?null:s,c=t.toggle,a=void 0===c?null:c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"_dom",{item:null,link:null}),f(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),f(this,"_submenu",!1),this._dom.item=n,this._dom.link=r,this._elements.parentMenu=o,this._elements.childMenu=l,this._elements.toggle=a,this._submenu=u}var t,n,r;return t=e,(n=[{key:"initialize",value:function(){}},{key:"dom",get:function(){return this._dom}},{key:"elements",get:function(){return this._elements}},{key:"isSubmenuItem",get:function(){return this._submenu}},{key:"focus",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}},{key:"blur",value:function(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}])&&m(t.prototype,n),r&&m(t,r),e}();function p(e){try{var t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((function(e){return!0===n[e]}))||""}catch(e){return""}}function d(e){e.preventDefault(),e.stopPropagation()}function y(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var M=function(){function u(e){var t=e.menuElement,n=e.menuItemSelector,r=void 0===n?"li":n,o=e.menuLinkSelector,i=void 0===o?"a":o,s=e.submenuItemSelector,l=void 0===s?"":s,c=e.submenuToggleSelector,m=void 0===c?"a":c,f=e.submenuSelector,p=void 0===f?"ul":f,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,M=e.openClass,_=void 0===M?"show":M,E=e.closeClass,w=void 0===E?"hide":E,C=e.isTopLevel,T=void 0===C||C,S=e.parentMenu,I=void 0===S?null:S,k=e.hoverType,O=void 0===k?"off":k,A=e.hoverDelay,L=void 0===A?250:A;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),g(this,"_MenuType",u),g(this,"_MenuItemType",h),g(this,"_MenuToggleType",a),g(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),g(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),g(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),g(this,"_openClass","show"),g(this,"_closeClass","hide"),g(this,"_root",!0),g(this,"_currentChild",0),g(this,"_focusState","none"),g(this,"_currentEvent","none"),g(this,"_hoverType","off"),g(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=y,this._dom.container=b,this._selectors.menuItems=r,this._selectors.menuLinks=i,this._selectors.submenuItems=l,this._selectors.submenuToggles=m,this._selectors.submenus=p,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=I,this._elements.rootMenu=T?this:null,this._openClass=_||"",this._closeClass=w||"",this._root=T,this._hoverType=O,this._hoverDelay=L}var s,l,c;return s=u,l=[{key:"initialize",value:function(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){var e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}},{key:"dom",get:function(){return this._dom}},{key:"selectors",get:function(){return this._selectors}},{key:"elements",get:function(){return this._elements}},{key:"isTopLevel",get:function(){return this._root}},{key:"openClass",get:function(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass},set:function(e){o({openClass:e}),this._openClass!==e&&(this._openClass=e)}},{key:"closeClass",get:function(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass},set:function(e){o({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}},{key:"currentChild",get:function(){return this._currentChild},set:function(e){function t(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu)for(var t=0,n=!1;!n&&t<e.elements.parentMenu.elements.menuItems.length;){var r=e.elements.parentMenu.elements.menuItems[t];r.isSubmenuItem&&r.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}n("number",{value:e}),e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}},{key:"focusState",get:function(){return this._focusState},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidState() must be inside of an object. ".concat(n," given."))}var r=["none","self","child"];for(var o in t)if(!r.includes(t[o]))throw new TypeError("AccessibleMenu: ".concat(o," must be one of the following values: ").concat(r.join(", "),'. "').concat(t[o],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&("self"===t||"none"===t)&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==t&&"child"!==t||(this.elements.parentMenu.focusState="child")}},{key:"currentEvent",get:function(){return this._currentEvent},set:function(t){!function(t){try{if("object"!==e(t)){var n=e(t);throw new TypeError("AccessibleMenu: Values given to isValidEvent() must be inside of an object. ".concat(n," given."))}var r=["none","mouse","keyboard","character"];for(var o in t)if(!r.includes(t[o]))throw new TypeError("AccessibleMenu: ".concat(o," must be one of the following values: ").concat(r.join(", "),'. "').concat(t[o],'" given.'))}catch(e){return console.error(e),!1}}({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((function(e){e.elements.controlledMenu.currentEvent=t})))}},{key:"currentMenuItem",get:function(){return this.elements.menuItems[this.currentChild]}},{key:"hoverType",get:function(){return this._root?this._hoverType:this.elements.rootMenu.hoverType},set:function(e){i({value:e}),this._hoverType!==e&&(this._hoverType=e)}},{key:"hoverDelay",get:function(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay},set:function(e){n("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}},{key:"shouldFocus",get:function(){var e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}},{key:"_validate",value:function(){var e=!0;return null!==this._dom.container||null!==this._dom.controller?t(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(e=!1):t(HTMLElement,{menuElement:this._dom.menu})||(e=!1),""!==this._selectors.submenuItems?r({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(e=!1):r({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(e=!1),""===this._openClass||o({openClass:this._openClass})||(e=!1),""===this._closeClass||o({closeClass:this._closeClass})||(e=!1),n("boolean",{isTopLevel:this._root})||(e=!1),null===this._elements.parentMenu||t(u,{parentMenu:this._elements.parentMenu})||(e=!1),i({hoverType:this._hoverType})||(e=!1),n("number",{hoverDelay:this._hoverDelay})||(e=!1),e}},{key:"_setDOMElementType",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be set through _setDOMElementType.'));n!==this.dom.menu&&t(HTMLElement,{base:n});var o=Array.from(n.querySelectorAll(this.selectors[e])),i=o.filter((function(e){return e.parentElement===n}));this._dom[e]=r?i:[].concat(y(this._dom[e]),y(i))}},{key:"_resetDOMElementType",value:function(e){if(void 0===this.dom[e])throw new Error('AccessibleMenu: "'.concat(e,'" is not a valid element type within the menu.'));if(!Array.isArray(this.dom[e]))throw new Error('AccessibleMenu: The "'.concat(e,'" element cannot be reset through _resetDOMElementType.'));this._dom[e]=[]}},{key:"_setDOMElements",value:function(){var e=this;this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((function(t){e._setDOMElementType("submenuToggles",t,!1),e._setDOMElementType("submenus",t,!1)})))}},{key:"_findRootMenu",value:function(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}},{key:"_createChildElements",value:function(){var e=this;this.dom.menuItems.forEach((function(t){var n;if(e.dom.submenuItems.includes(t)){var r=t.querySelector(e.selectors.submenuToggles),o=t.querySelector(e.selectors.submenus),i=new e._MenuType({menuElement:o,menuItemSelector:e.selectors.menuItems,menuLinkSelector:e.selectors.menuLinks,submenuItemSelector:e.selectors.submenuItems,submenuToggleSelector:e.selectors.submenuToggles,submenuSelector:e.selectors.submenus,openClass:e.openClass,closeClass:e.closeClass,isTopLevel:!1,parentMenu:e,hoverType:e.hoverType,hoverDelay:e.hoverDelay}),u=new e._MenuToggleType({menuToggleElement:r,parentElement:t,controlledMenu:i,parentMenu:e});e._elements.submenuToggles.push(u),n=new e._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:e,isSubmenuItem:!0,childMenu:i,toggle:u})}else{var s=t.querySelector(e.selectors.menuLinks);n=new e._MenuItemType({menuItemElement:t,menuLinkElement:s,parentMenu:e})}e._elements.menuItems.push(n)}))}},{key:"_handleFocus",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("focus",(function(){e.focusState="self",e.currentChild=n}))}))}},{key:"_handleClick",value:function(){var e=this;function t(e,t,n){d(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((function(n,r){n.dom.link.addEventListener("pointerdown",(function(){e.currentEvent="mouse",e.elements.rootMenu.blurChildren(),e.focusChild(r)}),{passive:!0}),n.isSubmenuItem&&n.elements.toggle.dom.toggle.addEventListener("pointerup",(function(r){e.currentEvent="mouse",t(e,n.elements.toggle,r)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(function(n){e.currentEvent="mouse",t(e,e.elements.controller,n)}))}},{key:"_handleHover",value:function(){var e=this;this.elements.menuItems.forEach((function(t,n){t.dom.link.addEventListener("pointerenter",(function(r){if("pen"!==r.pointerType&&"touch"!==r.pointerType)if("on"===e.hoverType)e.currentEvent="mouse",e.currentChild=n,t.isSubmenuItem&&t.elements.toggle.preview();else if("dynamic"===e.hoverType){var o=e.elements.submenuToggles.some((function(e){return e.isOpen}));e.currentChild=n,e.isTopLevel&&"none"===e.focusState||(e.currentEvent="mouse",e.focusCurrentChild()),!t.isSubmenuItem||e.isTopLevel&&!o||(e.currentEvent="mouse",t.elements.toggle.preview())}})),t.isSubmenuItem&&t.dom.item.addEventListener("pointerleave",(function(n){"pen"!==n.pointerType&&"touch"!==n.pointerType&&("on"===e.hoverType?e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close()):"dynamic"===e.hoverType&&(e.isTopLevel||(e.hoverDelay>0?setTimeout((function(){e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()}),e.hoverDelay):(e.currentEvent="mouse",t.elements.toggle.close(),e.focusCurrentChild()))))}))}))}},{key:"_handleKeydown",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t);"Space"!==n&&"Enter"!==n||(d(t),e.elements.controller.open(),e.focusFirstChild())}))}},{key:"focus",value:function(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}},{key:"blur",value:function(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}},{key:"focusCurrentChild",value:function(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}},{key:"focusChild",value:function(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}},{key:"focusFirstChild",value:function(){this.focusChild(0)}},{key:"focusLastChild",value:function(){this.focusChild(this.elements.menuItems.length-1)}},{key:"focusNextChild",value:function(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}},{key:"focusPreviousChild",value:function(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}},{key:"blurCurrentChild",value:function(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}},{key:"focusController",value:function(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}},{key:"focusContainer",value:function(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}},{key:"closeChildren",value:function(){this.elements.submenuToggles.forEach((function(e){return e.close()}))}},{key:"blurChildren",value:function(){this.elements.menuItems.forEach((function(e){e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}],l&&b(s.prototype,l),c&&b(s,c),u}();function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w(){return w="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=C(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},w.apply(this,arguments)}function C(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}function T(e,t){return T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},T(e,t)}function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=k(e);if(t){var o=k(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){if(t&&("object"===_(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}var O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&T(e,t)}(i,e);var t,n,r,o=S(i);function i(e){var t,n=e.menuItemElement,r=e.menuLinkElement,u=e.parentMenu,s=e.isSubmenuItem,l=void 0!==s&&s,c=e.childMenu,a=void 0===c?null:c,m=e.toggle,f=void 0===m?null:m,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=o.call(this,{menuItemElement:n,menuLinkElement:r,parentMenu:u,isSubmenuItem:l,childMenu:a,toggle:f}),p&&t.initialize(),t}return t=i,(n=[{key:"initialize",value:function(){w(k(i.prototype),"initialize",this).call(this),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","treeitem"),this.dom.link.tabIndex=-1}},{key:"focus",value:function(){w(k(i.prototype),"focus",this).call(this),this.dom.link.tabIndex=0}},{key:"blur",value:function(){w(k(i.prototype),"blur",this).call(this),this.dom.link.tabIndex=-1}}])&&E(t.prototype,n),r&&E(t,r),i}(h);function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function L(e,t){return L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},L(e,t)}function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var o=R(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return P(this,n)}}function P(e,t){if(t&&("object"===A(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var D=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}(n,e);var t=j(n);function n(e){var r,o=e.menuToggleElement,i=e.parentElement,u=e.controlledMenu,s=e.parentMenu,l=void 0===s?null:s,c=e.initialize,a=void 0===c||c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r=t.call(this,{menuToggleElement:o,parentElement:i,controlledMenu:u,parentMenu:l}),a&&r.initialize(),r}return n}(a);function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function z(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return N(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return N(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(){return B="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=V(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},B.apply(this,arguments)}function V(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=$(e)););return e}function H(e,t){return H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},H(e,t)}function K(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=$(e);if(t){var o=$(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return U(this,n)}}function U(e,t){if(t&&("object"===x(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return q(e)}function q(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$(e)}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(i,e);var t,n,r,o=K(i);function i(e){var t,n=e.menuElement,r=e.menuItemSelector,u=void 0===r?"li":r,s=e.menuLinkSelector,l=void 0===s?"a":s,c=e.submenuItemSelector,a=void 0===c?"":c,m=e.submenuToggleSelector,f=void 0===m?"a":m,h=e.submenuSelector,p=void 0===h?"ul":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,M=void 0===g?"show":g,_=e.closeClass,E=void 0===_?"hide":_,w=e.isTopLevel,C=void 0===w||w,T=e.parentMenu,S=void 0===T?null:T,I=e.hoverType,k=void 0===I?"off":I,A=e.hoverDelay,L=void 0===A?250:A,j=e.initialize,P=void 0===j||j;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),W(q(t=o.call(this,{menuElement:n,menuItemSelector:u,menuLinkSelector:l,submenuItemSelector:a,submenuToggleSelector:f,submenuSelector:p,controllerElement:y,containerElement:b,openClass:M,closeClass:E,isTopLevel:C,parentMenu:S,hoverType:k,hoverDelay:L})),"_MenuType",i),W(q(t),"_MenuItemType",O),W(q(t),"_MenuToggleType",D),P&&t.initialize(),t}return t=i,(n=[{key:"initialize",value:function(){try{B($(i.prototype),"initialize",this).call(this),this.isTopLevel?(this.dom.menu.setAttribute("role","tree"),this.elements.menuItems[0].dom.link.tabIndex=0):this.dom.menu.setAttribute("role","group"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}},{key:"_handleKeydown",value:function(){var e=this;B($(i.prototype),"_handleKeydown",this).call(this),this.dom.menu.addEventListener("keydown",(function(t){e.currentEvent="keyboard";var n=p(t);"Tab"===n&&("none"!==e.elements.rootMenu.focusState?e.elements.rootMenu.blur():e.elements.rootMenu.focus()),"self"===e.focusState&&(["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"].includes(n)||e.currentMenuItem.isSubmenuItem&&["Enter","ArrowRight"].includes(n)||e.elements.controller&&["Escape"].includes(n))&&d(t)}))}},{key:"_handleKeyup",value:function(){var e=this;B($(i.prototype),"_handleKeyup",this).call(this),this.dom.menu.addEventListener("keyup",(function(t){e.currentEvent="keyboard";var n=p(t),r=t.altKey,o=t.crtlKey,i=t.metaKey;if("Character"!==n||r||o||i){if("self"===e.focusState)if("Enter"===n||"Space"===n)d(t),e.currentMenuItem.isSubmenuItem?e.currentMenuItem.elements.toggle.isOpen?e.currentMenuItem.elements.toggle.close():e.currentMenuItem.elements.toggle.preview():e.currentMenuItem.dom.link.click();else if("Escape"===n)e.isTopLevel&&e.elements.controller&&e.elements.controller.isOpen&&(e.elements.controller.close(),e.focusController());else if("ArrowDown"===n)d(t),e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen?(e.blurCurrentChild(),e.currentMenuItem.elements.childMenu.currentEvent=e.currentEvent,e.currentMenuItem.elements.childMenu.focusFirstChild()):e.isTopLevel||e.currentChild!==e.elements.menuItems.length-1?e.focusNextChild():e.focusParentsNextChild();else if("ArrowUp"===n){d(t);var u=e.elements.menuItems[e.currentChild-1];u&&u.isSubmenuItem&&u.elements.toggle.isOpen?(e.blurCurrentChild(),e.currentChild=e.currentChild-1,e.currentMenuItem.elements.childMenu.currentEvent=e.currentEvent,e.focusChildsLastNode()):e.isTopLevel||0!==e.currentChild?e.focusPreviousChild():(e.blurCurrentChild(),e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.focusCurrentChild())}else"ArrowRight"===n?e.currentMenuItem.isSubmenuItem&&(d(t),e.currentMenuItem.elements.toggle.isOpen?(e.blurCurrentChild(),e.currentMenuItem.elements.childMenu.currentEvent=e.currentEvent,e.currentMenuItem.elements.childMenu.focusFirstChild()):e.currentMenuItem.elements.toggle.preview()):"ArrowLeft"===n?(d(t),e.currentMenuItem.isSubmenuItem&&e.currentMenuItem.elements.toggle.isOpen?(e.currentMenuItem.elements.childMenu.blurCurrentChild(),e.currentMenuItem.elements.toggle.close()):e.isTopLevel||(e.blurCurrentChild(),e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.focusCurrentChild())):"Home"===n?(d(t),e.blurCurrentChild(),e.elements.rootMenu.focusFirstChild()):"End"===n?(d(t),e.blurCurrentChild(),e.elements.rootMenu.focusLastNode()):"Asterisk"===n&&(d(t),e.openChildren())}else d(t),e.elements.rootMenu.currentEvent="character",e.focusNextNodeWithCharacter(t.key)}))}},{key:"focusLastNode",value:function(){var e=this.elements.menuItems.length-1,t=this.elements.menuItems[e];t.isSubmenuItem&&t.elements.toggle.isOpen?(this.currentChild=e,t.elements.childMenu.currentEvent=this.currentEvent,t.elements.childMenu.focusLastNode()):this.focusLastChild()}},{key:"openChildren",value:function(){this.elements.submenuToggles.forEach((function(e){return e.preview()}))}},{key:"focusNextNodeWithCharacter",value:function(e){for(var t=e.toLowerCase(),n=function e(t){var n=[];return t.elements.menuItems.forEach((function(t){n.push(t),t.isSubmenuItem&&t.elements.toggle.isOpen&&(n=[].concat(z(n),z(e(t.elements.toggle.elements.controlledMenu))))})),n}(this.elements.rootMenu),r=n.indexOf(this.currentMenuItem)+1,o=[].concat(z(n.slice(r)),z(n.slice(0,r))),i=0,u=!1;!u&&i<o.length;){if((o[i].dom.item.innerText?o[i].dom.item.innerText:o[i].dom.item.textContent).replace(/[\s]/g,"").toLowerCase().charAt(0)===t){u=!0;var s=o[i].elements.parentMenu,l=s.elements.menuItems.indexOf(o[i]);this.elements.rootMenu.blurChildren(),s.focusChild(l)}i++}}},{key:"focusParentsNextChild",value:function(){this.elements.parentMenu&&(this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.currentChild===this.elements.parentMenu.elements.menuItems.length-1?(this.elements.parentMenu.blurCurrentChild(),this.elements.parentMenu.focusParentsNextChild()):(this.blurChildren(),this.elements.parentMenu.focusNextChild()))}},{key:"focusChildsLastNode",value:function(){this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusLastChild(),this.currentMenuItem.elements.childMenu.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.childMenu.currentMenuItem.elements.toggle.isOpen&&(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.childMenu.focusChildsLastNode())}}])&&F(t.prototype,n),r&&F(t,r),i}(M);function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function J(e,t){return J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},J(e,t)}function Q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Y(e);if(t){var o=Y(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return X(this,n)}}function X(e,t){if(t&&("object"===G(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(e)}var ee=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(n,e);var t=Q(n);function n(e){var r,o=e.menuItemElement,i=e.menuLinkElement,u=e.parentMenu,s=e.isSubmenuItem,l=void 0!==s&&s,c=e.childMenu,a=void 0===c?null:c,m=e.toggle,f=void 0===m?null:m,h=e.initialize,p=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r=t.call(this,{menuItemElement:o,menuLinkElement:i,parentMenu:u,isSubmenuItem:l,childMenu:a,toggle:f,initialize:!1}),p&&r.initialize(),r}return n}(O);function te(e){return te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},te(e)}function ne(e){return function(e){if(Array.isArray(e))return re(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return re(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ie(){return ie="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=ue(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},ie.apply(this,arguments)}function ue(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=me(e)););return e}function se(e,t){return se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},se(e,t)}function le(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=me(e);if(t){var o=me(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ce(this,n)}}function ce(e,t){if(t&&("object"===te(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ae(e)}function ae(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function me(e){return me=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},me(e)}var fe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&se(e,t)}(i,e);var t,n,r,o=le(i);function i(e){var t,n,r,u,s=e.menuToggleElement,l=e.parentElement,c=e.controlledMenu,a=e.parentMenu,m=void 0===a?null:a,f=e.initialize,h=void 0===f||f;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=o.call(this,{menuToggleElement:s,parentElement:l,controlledMenu:c,parentMenu:m,initialize:!1}),n=ae(t),u={toggle:null,parent:null,container:null},(r="_dom")in n?Object.defineProperty(n,r,{value:u,enumerable:!0,configurable:!0,writable:!0}):n[r]=u,t._dom.toggle=s,t._dom.parent=l,t._dom.container=c.isTopLevel?c.dom.container:c.dom.menu,h&&t.initialize(),t}return t=i,n=[{key:"initialize",value:function(){ie(me(i.prototype),"initialize",this).call(this),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}},{key:"_expand",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.elements.controlledMenu.openClass;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.dom.container.classList.add(n):(e=this.dom.container.classList).add.apply(e,ne(n))),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}},{key:"_collapse",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=this.elements.controlledMenu,o=r.closeClass,i=r.openClass;this.dom.toggle.setAttribute("aria-expanded","false"),""!==o&&("string"==typeof o?this.dom.container.classList.add(o):(e=this.dom.container.classList).add.apply(e,ne(o))),""!==i&&("string"==typeof i?this.dom.container.classList.remove(i):(t=this.dom.container.classList).remove.apply(t,ne(i))),n&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}],n&&oe(t.prototype,n),r&&oe(t,r),i}(D);function he(e){return he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},he(e)}function pe(e,t){return pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},pe(e,t)}function de(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=be(e);if(t){var o=be(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}function ye(e,t){if(t&&("object"===he(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ve(e)}function ve(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function be(e){return be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},be(e)}function ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}return function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pe(e,t)}(n,e);var t=de(n);function n(e){var r,o=e.menuElement,i=e.menuItemSelector,u=void 0===i?".nav-item":i,s=e.menuLinkSelector,l=void 0===s?".nav-link,.dropdown-item":s,c=e.submenuItemSelector,a=void 0===c?".dropdown":c,m=e.submenuToggleSelector,f=void 0===m?".dropdown-toggle":m,h=e.submenuSelector,p=void 0===h?".dropdown-menu":h,d=e.controllerElement,y=void 0===d?null:d,v=e.containerElement,b=void 0===v?null:v,g=e.openClass,M=void 0===g?"show":g,_=e.closeClass,E=void 0===_?"collapse":_,w=e.isTopLevel,C=void 0===w||w,T=e.parentMenu,S=void 0===T?null:T,I=e.hoverType,k=void 0===I?"off":I,O=e.hoverDelay,A=void 0===O?250:O,L=e.initialize,j=void 0===L||L;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),ge(ve(r=t.call(this,{menuElement:o,menuItemSelector:u,menuLinkSelector:l,submenuItemSelector:a,submenuToggleSelector:f,submenuSelector:p,controllerElement:y,containerElement:b,openClass:M,closeClass:E,isTopLevel:C,parentMenu:S,hoverType:k,hoverDelay:A,initialize:!1})),"_MenuType",n),ge(ve(r),"_MenuItemType",ee),ge(ve(r),"_MenuToggleType",fe),j&&r.initialize(),r}return n}(Z)}();
var Bootstrap5Treeview=function(){"use strict";function e(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Elements given to isValidInstance() must be inside of an object. ${typeof t} given.`)}for(const n in t)if(!(t[n]instanceof e)){const s=typeof t[n];throw new TypeError(`AccessibleMenu: ${n} must be an instance of ${e.name}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function t(e,t){try{if("object"!=typeof t){throw new TypeError(`AccessibleMenu: Values given to isValidType() must be inside of an object. ${typeof t} given.`)}for(const n in t){const s=typeof t[n];if(s!==e)throw new TypeError(`AccessibleMenu: ${n} must be a ${e}. ${s} given.`)}return!0}catch(e){return console.error(e),!1}}function n(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isCSSSelector() must be inside of an object. ${typeof e} given.`)}for(const t in e)try{if(null===e[t])throw new Error;document.querySelector(e[t])}catch(n){throw new TypeError(`AccessibleMenu: ${t} must be a valid CSS selector. "${e[t]}" given.`)}return!0}catch(e){return console.error(e),!1}}function s(e){try{if("object"!=typeof e||Array.isArray(e)){throw new TypeError(`AccessibleMenu: Values given to isValidClassList() must be inside of an object. ${typeof e} given.`)}for(const t in e){const s=typeof e[t];if("string"!==s){if(!Array.isArray(e[t]))throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. ${s} given.`);e[t].forEach((e=>{if("string"!=typeof e)throw new TypeError(`AccessibleMenu: ${t} must be a string or an array of strings. An array containing non-strings given.`)}))}else{const s={};s[t]=e[t],n(s)}}return!0}catch(e){return console.error(e),!1}}function r(e){try{if("object"!=typeof e){throw new TypeError(`AccessibleMenu: Values given to isValidHoverType() must be inside of an object. ${typeof e} given.`)}const t=["off","on","dynamic"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}function i(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class o{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r=null}=e;i(this,"_dom",{toggle:null,parent:null}),i(this,"_elements",{controlledMenu:null,parentMenu:null}),i(this,"_open",!1),i(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}})),i(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}})),this._dom.toggle=t,this._dom.parent=n,this._elements.controlledMenu=s,this._elements.parentMenu=r}initialize(){if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),function(n,s){if(t("string",{tagName:n})&&e(HTMLElement,s)){const e=n.toLowerCase();let t=!0;for(const n in s)s[n].tagName.toLowerCase()!==e&&(t=!1);return t}return!1}("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),""===this.dom.toggle.id||""===this.elements.controlledMenu.dom.menu.id){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let t=this.dom.toggle.innerText.replace(/[^a-zA-Z0-9\s]/g,""),n=e;!t.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(t=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),t.replace(/\s/g,"").length>0&&(t=t.toLowerCase().replace(/\s+/g,"-"),t.startsWith("-")&&(t=t.substring(1)),t.endsWith("-")&&(t=t.slice(0,-1)),n=`${t}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){t("boolean",{value:e}),this._open=e}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.add(n):this.elements.controlledMenu.dom.menu.classList.add(...n)),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.remove(t):this.elements.controlledMenu.dom.menu.classList.remove(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.elements.controlledMenu.dom.menu.classList.add(t):this.elements.controlledMenu.dom.menu.classList.add(...t)),""!==n&&("string"==typeof n?this.elements.controlledMenu.dom.menu.classList.remove(n):this.elements.controlledMenu.dom.menu.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.currentChild=0,this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach((e=>{e!==this&&e.close()}))}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach((e=>e.close()))}}function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r=!1,childMenu:i=null,toggle:o=null}=e;l(this,"_dom",{item:null,link:null}),l(this,"_elements",{parentMenu:null,childMenu:null,toggle:null}),l(this,"_submenu",!1),this._dom.item=t,this._dom.link=n,this._elements.parentMenu=s,this._elements.childMenu=i,this._elements.toggle=o,this._submenu=r}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function m(e){try{const t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find((e=>!0===n[e]))||""}catch(e){return""}}function h(e){e.preventDefault(),e.stopPropagation()}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:r="",submenuToggleSelector:i="a",submenuSelector:l="ul",controllerElement:m=null,containerElement:h=null,openClass:d="show",closeClass:p="hide",isTopLevel:g=!0,parentMenu:f=null,hoverType:b="off",hoverDelay:v=250}=e;c(this,"_MenuType",a),c(this,"_MenuItemType",u),c(this,"_MenuToggleType",o),c(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null}),c(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""}),c(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null}),c(this,"_openClass","show"),c(this,"_closeClass","hide"),c(this,"_root",!0),c(this,"_currentChild",0),c(this,"_focusState","none"),c(this,"_currentEvent","none"),c(this,"_hoverType","off"),c(this,"_hoverDelay",250),this._dom.menu=t,this._dom.controller=m,this._dom.container=h,this._selectors.menuItems=n,this._selectors.menuLinks=s,this._selectors.submenuItems=r,this._selectors.submenuToggles=i,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=f,this._elements.rootMenu=g?this:null,this._openClass=d||"",this._closeClass=p||"",this._root=g,this._hoverType=b,this._hoverDelay=v}initialize(){if(!this._validate())throw new Error("AccesibleMenu: cannot initialize menu. See other error messages for more information.");if(null===this.elements.rootMenu&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get shouldFocus(){let e=!1;return"keyboard"!==this.currentEvent&&"character"!==this.currentEvent||(e=!0),"mouse"===this.currentEvent&&"dynamic"===this.hoverType&&(e=!0),e}set openClass(e){s({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){s({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set currentChild(e){function n(e){if(["mouse","character"].includes(e.currentEvent)&&e.elements.parentMenu){let t=0,n=!1;for(;!n&&t<e.elements.parentMenu.elements.menuItems.length;){const s=e.elements.parentMenu.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.elements.controlledMenu===e&&(n=!0,e.elements.parentMenu.currentEvent=e.currentEvent,e.elements.parentMenu.currentChild=t),t++}}}t("number",{value:e}),e<-1?(this._currentChild=-1,n(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,n(this)):this.focusChild!==e&&(this._currentChild=e,n(this))}set focusState(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidState() must be inside of an object. ${typeof e} given.`);const t=["none","self","child"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&("self"===e||"none"===e)&&this.elements.submenuToggles.forEach((e=>{e.elements.controlledMenu.focusState="none"})),!this.elements.parentMenu||"self"!==e&&"child"!==e||(this.elements.parentMenu.focusState="child")}set currentEvent(e){!function(e){try{if("object"!=typeof e)throw new TypeError(`AccessibleMenu: Values given to isValidEvent() must be inside of an object. ${typeof e} given.`);const t=["none","mouse","keyboard","character"];for(const n in e)if(!t.includes(e[n]))throw new TypeError(`AccessibleMenu: ${n} must be one of the following values: ${t.join(", ")}. "${e[n]}" given.`);return!0}catch(e){return console.error(e),!1}}({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach((t=>{t.elements.controlledMenu.currentEvent=e})))}set hoverType(e){r({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){t("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}_validate(){let i=!0;return null!==this._dom.container||null!==this._dom.controller?e(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container})||(i=!1):e(HTMLElement,{menuElement:this._dom.menu})||(i=!1),""!==this._selectors.submenuItems?n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus})||(i=!1):n({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks})||(i=!1),""===this._openClass||s({openClass:this._openClass})||(i=!1),""===this._closeClass||s({closeClass:this._closeClass})||(i=!1),t("boolean",{isTopLevel:this._root})||(i=!1),null===this._elements.parentMenu||e(a,{parentMenu:this._elements.parentMenu})||(i=!1),r({hoverType:this._hoverType})||(i=!1),t("number",{hoverDelay:this._hoverDelay})||(i=!1),i}_setDOMElementType(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dom.menu,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"!=typeof this.selectors[t])throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`);{if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);n!==this.dom.menu&&e(HTMLElement,{base:n});const r=Array.from(n.querySelectorAll(this.selectors[t])).filter((e=>e.parentElement===n));this._dom[t]=s?r:[...this._dom[t],...r]}}_resetDOMElementType(e){if(void 0===this.dom[e])throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`);if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}_setDOMElements(){this._setDOMElementType("menuItems"),""!==this.selectors.submenuItems&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach((e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)})))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else{if(null===e.elements.parentMenu)throw new Error("Cannot find root menu.");this._findRootMenu(e.elements.parentMenu)}}_createChildElements(){this.dom.menuItems.forEach((e=>{let t;if(this.dom.submenuItems.includes(e)){const n=e.querySelector(this.selectors.submenuToggles),s=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:s,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay}),i=new this._MenuToggleType({menuToggleElement:n,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(i),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:i})}else{const n=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:n,parentMenu:this})}this._elements.menuItems.push(t)}))}_handleFocus(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("focus",(()=>{this.focusState="self",this.currentChild=t}))}))}_handleClick(){function e(e,t,n){h(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach(((t,n)=>{t.dom.link.addEventListener("pointerdown",(()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(n)}),{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",(n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)}))})),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",(t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)}))}_handleHover(){this.elements.menuItems.forEach(((e,t)=>{e.dom.link.addEventListener("pointerenter",(n=>{if("pen"!==n.pointerType&&"touch"!==n.pointerType)if("on"===this.hoverType)this.currentEvent="mouse",this.currentChild=t,e.isSubmenuItem&&e.elements.toggle.preview();else if("dynamic"===this.hoverType){const n=this.elements.submenuToggles.some((e=>e.isOpen));this.currentChild=t,this.isTopLevel&&"none"===this.focusState||(this.currentEvent="mouse",this.focusCurrentChild()),!e.isSubmenuItem||this.isTopLevel&&!n||(this.currentEvent="mouse",e.elements.toggle.preview())}})),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",(t=>{"pen"!==t.pointerType&&"touch"!==t.pointerType&&("on"===this.hoverType?this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close()):"dynamic"===this.hoverType&&(this.isTopLevel||(this.hoverDelay>0?setTimeout((()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()}),this.hoverDelay):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}))}))}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||h(e)}))}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e);"Space"!==t&&"Enter"!==t||(h(e),this.elements.controller.open(),this.focusFirstChild())}))}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",-1!==this.currentChild&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",-1!==this.currentChild&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach((e=>e.close()))}blurChildren(){this.elements.menuItems.forEach((e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()}))}}class d extends u{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r=!1,childMenu:i=null,toggle:o=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r,childMenu:i,toggle:o}),l&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","treeitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.dom.link.tabIndex=0}blur(){super.blur(),this.dom.link.tabIndex=-1}}class p extends o{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r=null,initialize:i=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r}),i&&this.initialize()}}function g(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class f extends a{constructor(e){let{menuElement:t,menuItemSelector:n="li",menuLinkSelector:s="a",submenuItemSelector:r="",submenuToggleSelector:i="a",submenuSelector:o="ul",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="hide",isTopLevel:c=!0,parentMenu:a=null,hoverType:b="off",hoverDelay:v=250,initialize:M=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:r,submenuToggleSelector:i,submenuSelector:o,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:b,hoverDelay:v}),g(this,"_MenuType",f),g(this,"_MenuItemType",d),g(this,"_MenuToggleType",p),M&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?(this.dom.menu.setAttribute("role","tree"),this.elements.menuItems[0].dom.link.tabIndex=0):this.dom.menu.setAttribute("role","group"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",(e=>{this.currentEvent="keyboard";const t=m(e);if("Tab"===t&&("none"!==this.elements.rootMenu.focusState?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),"self"===this.focusState){const n=["Enter","ArrowRight"],s=["Escape"];(["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"].includes(t)||this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&s.includes(t))&&h(e)}}))}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",(e=>{this.currentEvent="keyboard";const t=m(e),{altKey:n,crtlKey:s,metaKey:r}=e;if("Character"!==t||(n||s||r)){if("self"===this.focusState)if("Enter"===t||"Space"===t)h(e),this.currentMenuItem.isSubmenuItem?this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview():this.currentMenuItem.dom.link.click();else if("Escape"===t)this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if("ArrowDown"===t)h(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.isTopLevel||this.currentChild!==this.elements.menuItems.length-1?this.focusNextChild():this.focusParentsNextChild();else if("ArrowUp"===t){h(e);const t=this.elements.menuItems[this.currentChild-1];t&&t.isSubmenuItem&&t.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):this.isTopLevel||0!==this.currentChild?this.focusPreviousChild():(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild())}else"ArrowRight"===t?this.currentMenuItem.isSubmenuItem&&(h(e),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):"ArrowLeft"===t?(h(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.toggle.close()):this.isTopLevel||(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild())):"Home"===t?(h(e),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):"End"===t?(h(e),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):"Asterisk"===t&&(h(e),this.openChildren())}else h(e),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(e.key)}))}focusLastNode(){const e=this.elements.menuItems.length-1,t=this.elements.menuItems[e];t.isSubmenuItem&&t.elements.toggle.isOpen?(this.currentChild=e,t.elements.childMenu.currentEvent=this.currentEvent,t.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach((e=>e.preview()))}focusNextNodeWithCharacter(e){const t=e.toLowerCase(),n=function e(t){let n=[];return t.elements.menuItems.forEach((t=>{n.push(t),t.isSubmenuItem&&t.elements.toggle.isOpen&&(n=[...n,...e(t.elements.toggle.elements.controlledMenu)])})),n}(this.elements.rootMenu),s=n.indexOf(this.currentMenuItem)+1,r=[...n.slice(s),...n.slice(0,s)];let i=0,o=!1;for(;!o&&i<r.length;){let e="";if(e=r[i].dom.item.innerText?r[i].dom.item.innerText:r[i].dom.item.textContent,e=e.replace(/[\s]/g,"").toLowerCase().charAt(0),e===t){o=!0;const e=r[i].elements.parentMenu,t=e.elements.menuItems.indexOf(r[i]);this.elements.rootMenu.blurChildren(),e.focusChild(t)}i++}}focusParentsNextChild(){this.elements.parentMenu&&(this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.currentChild===this.elements.parentMenu.elements.menuItems.length-1?(this.elements.parentMenu.blurCurrentChild(),this.elements.parentMenu.focusParentsNextChild()):(this.blurChildren(),this.elements.parentMenu.focusNextChild()))}focusChildsLastNode(){this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusLastChild(),this.currentMenuItem.elements.childMenu.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.childMenu.currentMenuItem.elements.toggle.isOpen&&(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.childMenu.focusChildsLastNode())}}class b extends d{constructor(e){let{menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r=!1,childMenu:i=null,toggle:o=null,initialize:l=!0}=e;super({menuItemElement:t,menuLinkElement:n,parentMenu:s,isSubmenuItem:r,childMenu:i,toggle:o,initialize:!1}),l&&this.initialize()}}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class M extends p{constructor(e){let{menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r=null,initialize:i=!0}=e;super({menuToggleElement:t,parentElement:n,controlledMenu:s,parentMenu:r,initialize:!1}),v(this,"_dom",{toggle:null,parent:null,container:null}),this._dom.toggle=t,this._dom.parent=n,this._dom.container=s.isTopLevel?s.dom.container:s.dom.menu,i&&this.initialize()}initialize(){super.initialize(),this.dom.toggle.hasAttribute("data-bs-toggle")&&this.dom.toggle.removeAttribute("data-bs-toggle"),this.dom.toggle.hasAttribute("data-bs-target")&&this.dom.toggle.removeAttribute("data-bs-target")}_expand(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{openClass:t}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{closeClass:t,openClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),""!==t&&("string"==typeof t?this.dom.container.classList.add(t):this.dom.container.classList.add(...t)),""!==n&&("string"==typeof n?this.dom.container.classList.remove(n):this.dom.container.classList.remove(...n)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}function y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends f{constructor(e){let{menuElement:t,menuItemSelector:n=".nav-item",menuLinkSelector:s=".nav-link,.dropdown-item",submenuItemSelector:r=".dropdown",submenuToggleSelector:i=".dropdown-toggle",submenuSelector:o=".dropdown-menu",controllerElement:l=null,containerElement:u=null,openClass:m="show",closeClass:h="collapse",isTopLevel:c=!0,parentMenu:a=null,hoverType:d="off",hoverDelay:p=250,initialize:g=!0}=e;super({menuElement:t,menuItemSelector:n,menuLinkSelector:s,submenuItemSelector:r,submenuToggleSelector:i,submenuSelector:o,controllerElement:l,containerElement:u,openClass:m,closeClass:h,isTopLevel:c,parentMenu:a,hoverType:d,hoverDelay:p,initialize:!1}),y(this,"_MenuType",E),y(this,"_MenuItemType",b),y(this,"_MenuToggleType",M),g&&this.initialize()}}return E}();
//# sourceMappingURL=treeview-bs5.min.js.map
{
"name": "accessible-menu-bootstrap-5",
"version": "1.0.0",
"version": "1.0.1",
"description": "A JavaScript library to help you generate WAI-ARIA accessible menus with in the DOM using Bootstrap 5.",

@@ -55,6 +55,6 @@ "main": "index.js",

"@babel/preset-env": "^7.12.1",
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^15.0.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^13.0.2",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"commitizen": "^4.2.2",

@@ -66,12 +66,12 @@ "cz-conventional-changelog": "^3.3.0",

"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsdoc": "^37.0.3",
"eslint-plugin-jsdoc": "^40.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"husky": "^7.0.2",
"jest": "^27.0.4",
"jest-environment-jsdom-latest": "^26.6.2",
"jest-extended": "^1.1.0",
"jsdoc": "^3.6.7",
"husky": "^8.0.1",
"jest": "^29.0.0",
"jest-environment-jsdom": "^29.0.0",
"jest-extended": "^3.0.0",
"jsdoc": "^4.0.0",
"jsdoc-typeof-plugin": "^1.0.0",
"lint-staged": "^12.0.3",
"lint-staged": "^13.0.1",
"prettier": "^2.1.2",

@@ -78,0 +78,0 @@ "rollup": "^2.33.1",

@@ -5,4 +5,4 @@ # accessible-menu-bootstrap-5

[![License](https://img.shields.io/github/license/NickDJM/accessible-menu-bootstrap-5?style=for-the-badge)](/LICENSE)
[![Jest tests](https://img.shields.io/github/workflow/status/nickdjm/accessible-menu-bootstrap-5/Tests/1.x?label=Tests&style=for-the-badge)](https://github.com/NickDJM/accessible-menu-bootstrap-5/actions/workflows/test.yml)
[![GitHub CodeQL](https://img.shields.io/github/workflow/status/nickdjm/accessible-menu-bootstrap-5/CodeQL/1.x?label=CodeQL&style=for-the-badge)](https://github.com/NickDJM/accessible-menu-bootstrap-5/actions/workflows/codeql-analysis.yml)
[![Jest tests](https://img.shields.io/github/actions/workflow/status/nickdjm/accessible-menu-bootstrap-5/test.yml?branch=1.x&label=Tests&style=for-the-badge)](https://github.com/NickDJM/accessible-menu-bootstrap-5/actions/workflows/test.yml)
[![GitHub CodeQL](https://img.shields.io/github/actions/workflow/status/nickdjm/accessible-menu-bootstrap-5/codeql-analysis.yml?branch=1.x&label=CodeQL&style=for-the-badge)](https://github.com/NickDJM/accessible-menu-bootstrap-5/actions/workflows/codeql-analysis.yml)

@@ -15,5 +15,5 @@ A JavaScript library to help you generate WAI-ARIA accessible menus with in the DOM using Bootstrap 5.

- [Disclosure Navigation Menus](https://www.w3.org/TR/wai-aria-practices-1.2/examples/disclosure/disclosure-navigation.html)
- [Navigation Menubar](https://www.w3.org/TR/wai-aria-practices-1.2/examples/menubar/menubar-1/menubar-1.html), and
- [Navigation Treeview](https://www.w3.org/TR/wai-aria-practices-1.2/examples/treeview/treeview-2/treeview-2a.html)
- [Disclosure Navigation Menus](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/),
- [Navigation Menubar](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/), and
- [Navigation Treeview](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/examples/treeview-navigation/)

@@ -50,3 +50,3 @@ ## Browser Support

```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.0/dist/accessible-menu-bs5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.1/dist/accessible-menu-bs5.min.js"></script>
```

@@ -81,3 +81,3 @@

```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.0/dist/accessible-menu-bs5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.1/dist/accessible-menu-bs5.min.js"></script>
```

@@ -110,3 +110,3 @@

```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.0/dist/disclosure-menu-bs5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.1/dist/disclosure-menu-bs5.min.js"></script>
```

@@ -131,3 +131,3 @@

```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.0/dist/menubar-bs5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.1/dist/menubar-bs5.min.js"></script>
```

@@ -152,3 +152,3 @@

```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.0/dist/treeview-bs5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@1.0.1/dist/treeview-bs5.min.js"></script>
```

@@ -171,2 +171,3 @@

- [Two-level menu with toggle](docs/basics/two-level-menu-with-toggle.md)
- [Live examples](https://mandrasch.github.io/accessible-menu-bootstrap-examples/)

@@ -192,1 +193,9 @@ ### Conflict with Bootstrap's own navbar toggle

If you're interested in contributing to the project, please read the [Contribution Guidelines](.github/CONTRIBUTING.md). Any and all contributions _must_ follow these guidelines or they will not be accepted.
## Sponsors
<p align="center">
<a href="https://coldfrontlabs.ca">
<img src="https://coldfrontlabs.ca/themes/custom/frosty/images/coldfrontlabs-flakkon-logo.png" alt="Coldfront Labs Inc." width="300px"/>
</a>
</p>

@@ -12,3 +12,3 @@ /* eslint-disable jsdoc/no-undefined-types */

*
* @type {object.<HTMLElement>}
* @type {Object<HTMLElement>}
* @property {HTMLElement} toggle - The menu toggle.

@@ -15,0 +15,0 @@ * @property {HTMLElement} parent - The menu containing this toggle.

@@ -12,3 +12,3 @@ /* eslint-disable jsdoc/no-undefined-types */

*
* @type {object.<HTMLElement>}
* @type {Object<HTMLElement>}
* @property {HTMLElement} toggle - The menu toggle.

@@ -15,0 +15,0 @@ * @property {HTMLElement} parent - The menu containing this toggle.

@@ -12,3 +12,3 @@ /* eslint-disable jsdoc/no-undefined-types */

*
* @type {object.<HTMLElement>}
* @type {Object<HTMLElement>}
* @property {HTMLElement} toggle - The menu toggle.

@@ -15,0 +15,0 @@ * @property {HTMLElement} parent - The menu containing this toggle.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc