diff --git a/demo/main.js b/demo/main.js index c85ec3d6..a570871c 100644 --- a/demo/main.js +++ b/demo/main.js @@ -71,7 +71,6 @@ function generateMenu(type, structure, hover, container, options = {}) { const menu = new MenuClass({ menuElement: nav.querySelector("ul"), - submenuItemSelector: ".dropdown", containerElement: nav, controllerElement: nav.querySelector("button"), hoverType: hover, diff --git a/dist/accessible-menu.cjs.js b/dist/accessible-menu.cjs.js index 383c3bb8..86185fe1 100644 --- a/dist/accessible-menu.cjs.js +++ b/dist/accessible-menu.cjs.js @@ -1,3 +1,3 @@ -"use strict";var j=Object.defineProperty;var q=(r,t,e)=>t in r?j(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var u=(r,t,e)=>q(r,typeof t!="symbol"?t+"":t,e);function w(r,t){typeof r=="string"?t.classList.add(r):t.classList.add(...r)}function v(r,t){typeof r=="string"?t.classList.remove(r):t.classList.remove(...r)}function k(r,t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${e}" given.`)}for(const e in t)if(!(t[e]instanceof r)){const s=typeof t[e];throw new TypeError(`${e} must be an instance of ${r.name}. "${s}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(r,t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Values given to isValidType() must be inside of an object. "${e}" given.`)}for(const e in t){const s=typeof t[e];if(s!==r)throw new TypeError(`${e} must be a ${r}. "${s}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function D(r){try{if(typeof r!="object"){const t=typeof r;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${t}" given.`)}for(const t in r)try{if(r[t]===null)throw new Error;document.querySelector(r[t])}catch{throw new TypeError(`${t} must be a valid query selector. "${r[t]}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function S(r){try{if(typeof r!="object"||Array.isArray(r)){const t=typeof r;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${t}" given.`)}for(const t in r){const e=typeof r[t];if(e!=="string")if(Array.isArray(r[t]))r[t].forEach(s=>{if(typeof s!="string")throw new TypeError(`${t} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${t} must be a string or an array of strings. "${e}" given.`);else{const s={};s[t]=r[t],D(s)}}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function V(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidState() must be inside of an object. "${e}" given.`)}const t=["none","self","child"];for(const e in r)if(!t.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function R(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${e}" given.`)}const t=["none","mouse","keyboard","character"];for(const e in r)if(!t.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function z(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${e}" given.`)}const t=["off","on","dynamic"];for(const e in r)if(!t.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function H(r,t){if(p("string",{tagName:r}).status&&k(HTMLElement,t).status){const e=r.toLowerCase();let s=!0;for(const n in t)t[n].tagName.toLowerCase()!==e&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null}){u(this,"_dom",{toggle:null,parent:null});u(this,"_elements",{controlledMenu:null,parentMenu:null});u(this,"_open",!1);u(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));u(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=t,this._dom.parent=e,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(t){p("boolean",{value:t}),this._open=t}_setIds(){var t;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((t=this.dom.toggle.innerText)==null?void 0:t.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=e;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),H("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(t=!0){const{closeClass:e,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(w(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&v(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&w(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{v(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&w(s,this.elements.controlledMenu.dom.menu),e!==""&&v(e,this.elements.controlledMenu.dom.menu)),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:e,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(w(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&v(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&w(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{v(n,this.elements.controlledMenu.dom.menu)})})})):(e!==""&&w(e,this.elements.controlledMenu.dom.menu),s!==""&&v(s,this.elements.controlledMenu.dom.menu)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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(t=>{t!==this&&t.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(t=>t.close())}}class A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null}){u(this,"_dom",{item:null,link:null});u(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});u(this,"_submenu",!1);this._dom.item=t,this._dom.link=e,this._elements.parentMenu=s,this._elements.childMenu=i,this._elements.toggle=l,this._submenu=n}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 g(r){try{const t=r.key||r.keyCode,e={Enter:t==="Enter"||t===13,Space:t===" "||t==="Spacebar"||t===32,Escape:t==="Escape"||t==="Esc"||t===27,ArrowUp:t==="ArrowUp"||t==="Up"||t===38,ArrowRight:t==="ArrowRight"||t==="Right"||t===39,ArrowDown:t==="ArrowDown"||t==="Down"||t===40,ArrowLeft:t==="ArrowLeft"||t==="Left"||t===37,Home:t==="Home"||t===36,End:t==="End"||t===35,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:t==="Tab"||t===9,Asterisk:t==="*"||t===56};return Object.keys(e).find(s=>e[s]===!0)||""}catch{return""}}function o(r){r.preventDefault(),r.stopPropagation()}class I{constructor({menuElement:t,menuItemSelector:e="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:i="a",submenuSelector:l="ul",controllerElement:h=null,containerElement:c=null,openClass:m="show",closeClass:a="hide",transitionClass:d="transitioning",isTopLevel:f=!0,parentMenu:y=null,hoverType:M="off",hoverDelay:b=250,enterDelay:C=-1,leaveDelay:_=-1}){u(this,"_MenuType",I);u(this,"_MenuItemType",A);u(this,"_MenuToggleType",L);u(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});u(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});u(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});u(this,"_openClass","show");u(this,"_closeClass","hide");u(this,"_transitionClass","transitioning");u(this,"_root",!0);u(this,"_currentChild",0);u(this,"_focusState","none");u(this,"_currentEvent","none");u(this,"_hoverType","off");u(this,"_hoverDelay",250);u(this,"_enterDelay",-1);u(this,"_leaveDelay",-1);u(this,"_hoverTimeout",null);u(this,"_errors",[]);this._dom.menu=t,this._dom.controller=h,this._dom.container=c,this._selectors.menuItems=e,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=i,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=y,this._elements.rootMenu=f?this:null,this._openClass=m||"",this._closeClass=a||"",this._transitionClass=d||"",this._root=f,this._hoverType=M,this._hoverDelay=b,this._enterDelay=C,this._leaveDelay=_}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +"use strict";var j=Object.defineProperty;var q=(r,t,e)=>t in r?j(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var u=(r,t,e)=>q(r,typeof t!="symbol"?t+"":t,e);function I(r,t){typeof r=="string"?t.classList.add(r):t.classList.add(...r)}function w(r,t){typeof r=="string"?t.classList.remove(r):t.classList.remove(...r)}function k(r,t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${e}" given.`)}for(const e in t)if(!(t[e]instanceof r)){const s=typeof t[e];throw new TypeError(`${e} must be an instance of ${r.name}. "${s}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(r,t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Values given to isValidType() must be inside of an object. "${e}" given.`)}for(const e in t){const s=typeof t[e];if(s!==r)throw new TypeError(`${e} must be a ${r}. "${s}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function D(r){try{if(typeof r!="object"){const t=typeof r;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${t}" given.`)}for(const t in r)try{if(r[t]===null)throw new Error;document.querySelector(r[t])}catch{throw new TypeError(`${t} must be a valid query selector. "${r[t]}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function S(r){try{if(typeof r!="object"||Array.isArray(r)){const t=typeof r;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${t}" given.`)}for(const t in r){const e=typeof r[t];if(e!=="string")if(Array.isArray(r[t]))r[t].forEach(s=>{if(typeof s!="string")throw new TypeError(`${t} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${t} must be a string or an array of strings. "${e}" given.`);else{const s={};s[t]=r[t],D(s)}}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function V(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidState() must be inside of an object. "${e}" given.`)}const t=["none","self","child"];for(const e in r)if(!t.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function R(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${e}" given.`)}const t=["none","mouse","keyboard","character"];for(const e in r)if(!t.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function z(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${e}" given.`)}const t=["off","on","dynamic"];for(const e in r)if(!t.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function H(r,t){if(p("string",{tagName:r}).status&&k(HTMLElement,t).status){const e=r.toLowerCase();let s=!0;for(const n in t)t[n].tagName.toLowerCase()!==e&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null}){u(this,"_dom",{toggle:null,parent:null});u(this,"_elements",{controlledMenu:null,parentMenu:null});u(this,"_open",!1);u(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));u(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=t,this._dom.parent=e,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(t){p("boolean",{value:t}),this._open=t}_setIds(){var t;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((t=this.dom.toggle.innerText)==null?void 0:t.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=e;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),H("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(t=!0){const{closeClass:e,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(I(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&w(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&I(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{w(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&I(s,this.elements.controlledMenu.dom.menu),e!==""&&w(e,this.elements.controlledMenu.dom.menu)),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:e,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(I(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&w(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&I(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{w(n,this.elements.controlledMenu.dom.menu)})})})):(e!==""&&I(e,this.elements.controlledMenu.dom.menu),s!==""&&w(s,this.elements.controlledMenu.dom.menu)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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(t=>{t!==this&&t.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(t=>t.close())}}class A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null}){u(this,"_dom",{item:null,link:null});u(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});u(this,"_submenu",!1);this._dom.item=t,this._dom.link=e,this._elements.parentMenu=s,this._elements.childMenu=i,this._elements.toggle=l,this._submenu=n}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 g(r){try{const t=r.key||r.keyCode,e={Enter:t==="Enter"||t===13,Space:t===" "||t==="Spacebar"||t===32,Escape:t==="Escape"||t==="Esc"||t===27,ArrowUp:t==="ArrowUp"||t==="Up"||t===38,ArrowRight:t==="ArrowRight"||t==="Right"||t===39,ArrowDown:t==="ArrowDown"||t==="Down"||t===40,ArrowLeft:t==="ArrowLeft"||t==="Left"||t===37,Home:t==="Home"||t===36,End:t==="End"||t===35,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:t==="Tab"||t===9,Asterisk:t==="*"||t===56};return Object.keys(e).find(s=>e[s]===!0)||""}catch{return""}}function o(r){r.preventDefault(),r.stopPropagation()}class v{constructor({menuElement:t,menuItemSelector:e="li",menuLinkSelector:s="a",submenuItemSelector:n="li:has(ul)",submenuToggleSelector:i="a",submenuSelector:l="ul",controllerElement:h=null,containerElement:c=null,openClass:m="show",closeClass:a="hide",transitionClass:d="transitioning",isTopLevel:f=!0,parentMenu:y=null,hoverType:M="off",hoverDelay:b=250,enterDelay:C=-1,leaveDelay:_=-1}){u(this,"_MenuType",v);u(this,"_MenuItemType",A);u(this,"_MenuToggleType",L);u(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});u(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});u(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});u(this,"_openClass","show");u(this,"_closeClass","hide");u(this,"_transitionClass","transitioning");u(this,"_root",!0);u(this,"_currentChild",0);u(this,"_focusState","none");u(this,"_currentEvent","none");u(this,"_hoverType","off");u(this,"_hoverDelay",250);u(this,"_enterDelay",-1);u(this,"_leaveDelay",-1);u(this,"_hoverTimeout",null);u(this,"_errors",[]);this._dom.menu=t,this._dom.controller=h,this._dom.container=c,this._selectors.menuItems=e,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=i,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=y,this._elements.rootMenu=f?this:null,this._openClass=m||"",this._closeClass=a||"",this._transitionClass=d||"",this._root=f,this._hoverType=M,this._hoverDelay=b,this._enterDelay=C,this._leaveDelay=_}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const t=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=t}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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let t=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(t=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(t=!0),t}get errors(){return this._errors}set openClass(t){S({openClass:t}),this._openClass!==t&&(this._openClass=t)}set closeClass(t){S({closeClass:t}),this._closeClass!==t&&(this._closeClass=t)}set transitionClass(t){S({transitionClass:t}),this._transitionClass!==t&&(this._transitionClass=t)}set currentChild(t){p("number",{value:t});function e(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let i=0,l=!1;for(;!l&&i=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,e(this)):this.focusChild!==t&&(this._currentChild=t,e(this))}set focusState(t){V({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&(t==="self"||t==="none")&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(t==="self"||t==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(t){R({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.currentEvent=t}))}set hoverType(t){z({value:t}),this._hoverType!==t&&(this._hoverType=t)}set hoverDelay(t){p("number",{value:t}),this._hoverDelay!==t&&(this._hoverDelay=t)}set enterDelay(t){p("number",{value:t}),this._enterDelay!==t&&(this._enterDelay=t)}set leaveDelay(t){p("number",{value:t}),this._leaveDelay!==t&&(this._leaveDelay=t)}_validate(){let t=!0,e;this._dom.container!==null||this._dom.controller!==null?e=k(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):e=k(HTMLElement,{menuElement:this._dom.menu}),e.status||(this._errors.push(e.error.message),t=!1);let s;if(this._selectors.submenuItems!==""?s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),t=!1),this._openClass!==""){const m=S({openClass:this._openClass});m.status||(this._errors.push(m.error.message),t=!1)}if(this._closeClass!==""){const m=S({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),t=!1)}if(this._transitionClass!==""){const m=S({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),t=!1)}const n=p("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),t=!1),this._elements.parentMenu!==null){const m=k(I,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),t=!1)}const i=z({hoverType:this._hoverType});i.status||(this._errors.push(i.error.message),t=!1);const l=p("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),t=!1);const h=p("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),t=!1);const c=p("number",{leaveDelay:this._leaveDelay});return c.status||(this._errors.push(c.error.message),t=!1),t}_setDOMElementType(t,e=this.dom.menu,s=!0){if(typeof this.selectors[t]=="string"){if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);e!==this.dom.menu&&k(HTMLElement,{base:e});const i=Array.from(e.querySelectorAll(this.selectors[t])).filter(l=>l.parentElement===e);s?this._dom[t]=i:this._dom[t]=[...this._dom[t],...i]}else throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`)}_resetDOMElementType(t){if(typeof this.dom[t]<"u"){if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be reset through _resetDOMElementType.`);this._dom[t]=[]}else throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(t=>{this._setDOMElementType("submenuToggles",t,!1),this._setDOMElementType("submenus",t,!1)}))}_findRootMenu(t){if(t.isTopLevel)this._elements.rootMenu=t;else if(t.elements.parentMenu!==null)this._findRootMenu(t.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(t=>{let e;if(this.dom.submenuItems.includes(t)){const s=t.querySelector(this.selectors.submenuToggles),n=t.querySelector(this.selectors.submenus),i=new this._MenuType({menuElement:n,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:t,controlledMenu:i,parentMenu:this});this._elements.submenuToggles.push(l),e=new this._MenuItemType({menuItemElement:t,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:i,toggle:l})}else{const s=t.querySelector(this.selectors.menuLinks);e=new this._MenuItemType({menuItemElement:t,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(e)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(t,e){this._hoverTimeout=setTimeout(t,e)}_handleFocus(){this.elements.menuItems.forEach((t,e)=>{t.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=e})})}_handleClick(){function t(e,s,n){o(n),s.toggle(),s.isOpen&&(e.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),e.isSubmenuItem&&e.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",t(this,e.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",e=>{this.currentEvent="mouse",t(this,this.elements.controller,e)})}_handleHover(){this.elements.menuItems.forEach((t,e)=>{t.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(e),t.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(i=>i.isOpen);this.currentChild=e,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),t.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview())}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))}),t.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",t=>{this.currentEvent="keyboard";const e=g(t);(e==="Space"||e==="Enter")&&o(t)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",t=>{this.currentEvent="keyboard";const e=g(t);(e==="Space"||e==="Enter")&&(o(t),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(t){this.blurCurrentChild(),this.currentChild=t,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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(t=>t.close())}blurChildren(){this.elements.menuItems.forEach(t=>{t.blur(),t.isSubmenuItem&&t.elements.childMenu.blurChildren()})}}class P extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:l}),h&&this.initialize()}}class U extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class x extends I{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:l="button",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:b="off",hoverDelay:C=250,enterDelay:_=-1,leaveDelay:E=-1,optionalKeySupport:T=!1,initialize:O=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:l,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:y,parentMenu:M,hoverType:b,hoverDelay:C,enterDelay:_,leaveDelay:E});u(this,"_MenuType",x);u(this,"_MenuItemType",P);u(this,"_MenuToggleType",U);u(this,"_currentChild",-1);u(this,"_optionalSupport",!1);this._optionalSupport=T,O&&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){p("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_validate(){let e=super._validate();const s=p("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(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 s=g(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&o(e):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&i.includes(s)||this.elements.parentMenu&&l.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=g(e);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(o(e),this.closeChildren()):this.elements.parentMenu?(o(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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(o(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())))})}}class W extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:l}),h&&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 Z extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class K extends I{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:l="a",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:b="off",hoverDelay:C=250,enterDelay:_=-1,leaveDelay:E=-1,initialize:T=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:l,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:y,parentMenu:M,hoverType:b,hoverDelay:C,enterDelay:_,leaveDelay:E});u(this,"_MenuType",K);u(this,"_MenuItemType",W);u(this,"_MenuToggleType",Z);T&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),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=>{this.focusState!=="none"&&(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 s=g(e);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")o(e);else if(this.isTopLevel){if(this.focusState==="self"){const n=["ArrowRight","ArrowLeft","Home","End"],i=["Space","Enter","ArrowDown","ArrowUp"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&l.includes(s))&&o(e)}}else{const n=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],i=["Space","Enter"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=g(e),{altKey:n,crtlKey:i,metaKey:l}=e;if(s==="Character"&&!(n||i||l))o(e),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(e.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(o(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(s==="ArrowRight"){o(e);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){o(e);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(o(e),this.focusFirstChild()):s==="End"?(o(e),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(m=>m.isOpen)?(o(e),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(o(e),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(o(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(o(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(o(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()))):s==="ArrowDown"?(o(e),this.focusNextChild()):s==="ArrowUp"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(e){const s=e.toLowerCase();let n=this.currentChild+1,i=!1;for(;!i&&n{let s,n;const i=e.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(e)){const l=e.querySelector(this.selectors.submenuToggles),h=e.querySelector(this.selectors.submenus),c=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),m=new this._MenuToggleType({menuToggleElement:l,parentElement:e,controlledMenu:c,parentMenu:this});this._elements.submenuToggles.push(m),l!==i?(n=new this._MenuItemType({menuItemElement:e,menuLinkElement:l,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:m}),s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,submenuSibling:n})):s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:m})}else s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this});this._elements.menuItems.push(s),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let e=super._validate();const s=D({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),e=!1);const n=p("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(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()))})}_handleHover(){this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let i=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(i=e.elements.sibling.elements.toggle),i===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{i.preview()},this.enterDelay)):i.preview()}else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(l=>l.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||i){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let l=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(l=e.elements.sibling.elements.toggle),l===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{l.preview()},this.enterDelay)):l.preview()}}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",n=>{n.pointerType==="pen"||n.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const s=g(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&o(e):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&i.includes(s)||this.elements.parentMenu&&l.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=g(e);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(o(e),this.closeChildren()):this.elements.parentMenu?(o(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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(o(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())))})}}class G extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:l}),h&&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 J extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-expanded")==="true"?this.open():this._collapse(!1)}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.getAttribute("aria-expanded")!=="true"&&this.dom.toggle.setAttribute("aria-expanded","false"),H("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}}class $ extends I{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:l="a",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:b="off",hoverDelay:C=250,enterDelay:_=-1,leaveDelay:E=-1,initialize:T=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:l,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:y,parentMenu:M,hoverType:b,hoverDelay:C,enterDelay:_,leaveDelay:E});u(this,"_MenuType",$);u(this,"_MenuItemType",G);u(this,"_MenuToggleType",J);T&&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 s=g(e);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const n=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],i=["Enter","ArrowRight"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&l.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=g(e),{altKey:n,crtlKey:i,metaKey:l}=e;if(s==="Character"&&!(n||i||l))o(e),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(e.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")o(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(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")o(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.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){o(e);const c=this.elements.menuItems[this.currentChild-1];c&&c.isSubmenuItem&&c.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(o(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()):s==="ArrowLeft"?(o(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())):s==="Home"?(o(e),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(o(e),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(o(e),this.openChildren())})}focusLastNode(){const e=this.elements.menuItems.length-1,s=this.elements.menuItems[e];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=e,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(e=>e.preview())}focusNextNodeWithCharacter(e){function s(a){let d=[];return a.elements.menuItems.forEach(f=>{d.push(f),f.isSubmenuItem&&f.elements.toggle.isOpen&&(d=[...d,...s(f.elements.toggle.elements.controlledMenu)])}),d}const n=e.toLowerCase(),i=s(this.elements.rootMenu),l=i.indexOf(this.currentMenuItem)+1,h=[...i.slice(l),...i.slice(0,l)];let c=0,m=!1;for(;!m&&c=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,e(this)):this.focusChild!==t&&(this._currentChild=t,e(this))}set focusState(t){V({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&(t==="self"||t==="none")&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(t==="self"||t==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(t){R({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.currentEvent=t}))}set hoverType(t){z({value:t}),this._hoverType!==t&&(this._hoverType=t)}set hoverDelay(t){p("number",{value:t}),this._hoverDelay!==t&&(this._hoverDelay=t)}set enterDelay(t){p("number",{value:t}),this._enterDelay!==t&&(this._enterDelay=t)}set leaveDelay(t){p("number",{value:t}),this._leaveDelay!==t&&(this._leaveDelay=t)}_validate(){let t=!0,e;this._dom.container!==null||this._dom.controller!==null?e=k(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):e=k(HTMLElement,{menuElement:this._dom.menu}),e.status||(this._errors.push(e.error.message),t=!1);let s;if(this._selectors.submenuItems!==""?s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),t=!1),this._openClass!==""){const m=S({openClass:this._openClass});m.status||(this._errors.push(m.error.message),t=!1)}if(this._closeClass!==""){const m=S({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),t=!1)}if(this._transitionClass!==""){const m=S({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),t=!1)}const n=p("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),t=!1),this._elements.parentMenu!==null){const m=k(v,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),t=!1)}const i=z({hoverType:this._hoverType});i.status||(this._errors.push(i.error.message),t=!1);const l=p("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),t=!1);const h=p("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),t=!1);const c=p("number",{leaveDelay:this._leaveDelay});return c.status||(this._errors.push(c.error.message),t=!1),t}_setDOMElementType(t,e=this.dom.menu,s=!0){if(typeof this.selectors[t]=="string"){if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);e!==this.dom.menu&&k(HTMLElement,{base:e});const i=Array.from(e.querySelectorAll(this.selectors[t])).filter(l=>l.parentElement===e);s?this._dom[t]=i:this._dom[t]=[...this._dom[t],...i]}else throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`)}_resetDOMElementType(t){if(typeof this.dom[t]<"u"){if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be reset through _resetDOMElementType.`);this._dom[t]=[]}else throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(t=>{this._setDOMElementType("submenuToggles",t,!1),this._setDOMElementType("submenus",t,!1)}))}_findRootMenu(t){if(t.isTopLevel)this._elements.rootMenu=t;else if(t.elements.parentMenu!==null)this._findRootMenu(t.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(t=>{let e;if(this.dom.submenuItems.includes(t)){const s=t.querySelector(this.selectors.submenuToggles),n=t.querySelector(this.selectors.submenus),i=new this._MenuType({menuElement:n,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:t,controlledMenu:i,parentMenu:this});this._elements.submenuToggles.push(l),e=new this._MenuItemType({menuItemElement:t,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:i,toggle:l})}else{const s=t.querySelector(this.selectors.menuLinks);e=new this._MenuItemType({menuItemElement:t,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(e)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(t,e){p("function",{callback:t}),p("number",{delay:e}),this._hoverTimeout=setTimeout(t,e)}_handleFocus(){this.elements.menuItems.forEach((t,e)=>{t.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=e})})}_handleClick(){function t(e,s,n){o(n),s.toggle(),s.isOpen&&(e.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),e.isSubmenuItem&&e.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",t(this,e.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",e=>{this.currentEvent="mouse",t(this,this.elements.controller,e)})}_handleHover(){this.elements.menuItems.forEach((t,e)=>{t.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(e),t.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(i=>i.isOpen);this.currentChild=e,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),t.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview())}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))}),t.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",t=>{this.currentEvent="keyboard";const e=g(t);(e==="Space"||e==="Enter")&&o(t)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",t=>{this.currentEvent="keyboard";const e=g(t);(e==="Space"||e==="Enter")&&(o(t),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(t){this.blurCurrentChild(),this.currentChild=t,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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(t=>t.close())}blurChildren(){this.elements.menuItems.forEach(t=>{t.blur(),t.isSubmenuItem&&t.elements.childMenu.blurChildren()})}}class P extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:l}),h&&this.initialize()}}class U extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class x extends v{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:l="button",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:b="off",hoverDelay:C=250,enterDelay:_=-1,leaveDelay:E=-1,optionalKeySupport:T=!1,initialize:O=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:l,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:y,parentMenu:M,hoverType:b,hoverDelay:C,enterDelay:_,leaveDelay:E});u(this,"_MenuType",x);u(this,"_MenuItemType",P);u(this,"_MenuToggleType",U);u(this,"_currentChild",-1);u(this,"_optionalSupport",!1);this._optionalSupport=T,O&&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){p("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_validate(){let e=super._validate();const s=p("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(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 s=g(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&o(e):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&i.includes(s)||this.elements.parentMenu&&l.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=g(e);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(o(e),this.closeChildren()):this.elements.parentMenu?(o(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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(o(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())))})}}class W extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:l}),h&&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 Z extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class K extends v{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:l="a",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:b="off",hoverDelay:C=250,enterDelay:_=-1,leaveDelay:E=-1,initialize:T=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:l,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:y,parentMenu:M,hoverType:b,hoverDelay:C,enterDelay:_,leaveDelay:E});u(this,"_MenuType",K);u(this,"_MenuItemType",W);u(this,"_MenuToggleType",Z);T&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),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=>{this.focusState!=="none"&&(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 s=g(e);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")o(e);else if(this.isTopLevel){if(this.focusState==="self"){const n=["ArrowRight","ArrowLeft","Home","End"],i=["Space","Enter","ArrowDown","ArrowUp"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&l.includes(s))&&o(e)}}else{const n=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],i=["Space","Enter"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=g(e),{altKey:n,crtlKey:i,metaKey:l}=e;if(s==="Character"&&!(n||i||l))o(e),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(e.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(o(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(s==="ArrowRight"){o(e);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){o(e);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(o(e),this.focusFirstChild()):s==="End"?(o(e),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(m=>m.isOpen)?(o(e),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(o(e),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(o(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(o(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(o(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()))):s==="ArrowDown"?(o(e),this.focusNextChild()):s==="ArrowUp"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(e){const s=e.toLowerCase();let n=this.currentChild+1,i=!1;for(;!i&&n{let s,n;const i=e.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(e)){const l=e.querySelector(this.selectors.submenuToggles),h=e.querySelector(this.selectors.submenus),c=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),m=new this._MenuToggleType({menuToggleElement:l,parentElement:e,controlledMenu:c,parentMenu:this});this._elements.submenuToggles.push(m),l!==i?(n=new this._MenuItemType({menuItemElement:e,menuLinkElement:l,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:m}),s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,submenuSibling:n})):s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:m})}else s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this});this._elements.menuItems.push(s),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let e=super._validate();const s=D({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),e=!1);const n=p("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(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()))})}_handleHover(){this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let i=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(i=e.elements.sibling.elements.toggle),i===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{i.preview()},this.enterDelay)):i.preview()}else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(l=>l.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||i){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let l=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(l=e.elements.sibling.elements.toggle),l===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{l.preview()},this.enterDelay)):l.preview()}}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",n=>{n.pointerType==="pen"||n.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const s=g(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&o(e):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&i.includes(s)||this.elements.parentMenu&&l.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=g(e);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(o(e),this.closeChildren()):this.elements.parentMenu?(o(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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(o(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())))})}}class G extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:l}),h&&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 J extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-expanded")==="true"?this.open():this._collapse(!1)}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.getAttribute("aria-expanded")!=="true"&&this.dom.toggle.setAttribute("aria-expanded","false"),H("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}}class $ extends v{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:l="a",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:b="off",hoverDelay:C=250,enterDelay:_=-1,leaveDelay:E=-1,initialize:T=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:l,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:y,parentMenu:M,hoverType:b,hoverDelay:C,enterDelay:_,leaveDelay:E});u(this,"_MenuType",$);u(this,"_MenuItemType",G);u(this,"_MenuToggleType",J);T&&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)}}_handleHover(){this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(l=>l.isOpen);this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0&&this._clearTimeout():this.hoverType==="dynamic"&&(this.isTopLevel||this.leaveDelay>0&&this._clearTimeout()))}),e.dom.item.addEventListener("pointerenter",n=>{n.pointerType==="pen"||n.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()})),this.isTopLevel&&this.dom.menu.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||this.hoverType==="on"&&(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.closeChildren(),this.blur()},this.leaveDelay)):(this.closeChildren(),this.blur()))})})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const s=g(e);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const n=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],i=["Enter","ArrowRight"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&l.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=g(e),{altKey:n,crtlKey:i,metaKey:l}=e;if(s==="Character"&&!(n||i||l))o(e),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(e.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")o(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(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")o(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.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){o(e);const c=this.elements.menuItems[this.currentChild-1];c&&c.isSubmenuItem&&c.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(o(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()):s==="ArrowLeft"?(o(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())):s==="Home"?(o(e),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(o(e),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(o(e),this.openChildren())})}focusLastNode(){const e=this.elements.menuItems.length-1,s=this.elements.menuItems[e];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=e,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(e=>e.preview())}focusNextNodeWithCharacter(e){function s(a){let d=[];return a.elements.menuItems.forEach(f=>{d.push(f),f.isSubmenuItem&&f.elements.toggle.isOpen&&(d=[...d,...s(f.elements.toggle.elements.controlledMenu)])}),d}const n=e.toLowerCase(),i=s(this.elements.rootMenu),l=i.indexOf(this.currentMenuItem)+1,h=[...i.slice(l),...i.slice(0,l)];let c=0,m=!1;for(;!m&&c t in r ? j(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e; var u = (r, t, e) => q(r, typeof t != "symbol" ? t + "" : t, e); -function w(r, t) { +function I(r, t) { typeof r == "string" ? t.classList.add(r) : t.classList.add(...r); } -function v(r, t) { +function w(r, t) { typeof r == "string" ? t.classList.remove(r) : t.classList.remove(...r); } function k(r, t) { @@ -409,13 +409,13 @@ class L { */ _expand(t = !0) { const { closeClass: e, openClass: s, transitionClass: n } = this.elements.controlledMenu; - this.dom.toggle.setAttribute("aria-expanded", "true"), n !== "" ? (w(n, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - e !== "" && v(e, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - s !== "" && w(s, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - v(n, this.elements.controlledMenu.dom.menu); + this.dom.toggle.setAttribute("aria-expanded", "true"), n !== "" ? (I(n, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { + e !== "" && w(e, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { + s !== "" && I(s, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { + w(n, this.elements.controlledMenu.dom.menu); }); }); - })) : (s !== "" && w(s, this.elements.controlledMenu.dom.menu), e !== "" && v(e, this.elements.controlledMenu.dom.menu)), t && this.dom.toggle.dispatchEvent(this._expandEvent); + })) : (s !== "" && I(s, this.elements.controlledMenu.dom.menu), e !== "" && w(e, this.elements.controlledMenu.dom.menu)), t && this.dom.toggle.dispatchEvent(this._expandEvent); } /** * Collapses the controlled menu. @@ -436,13 +436,13 @@ class L { */ _collapse(t = !0) { const { closeClass: e, openClass: s, transitionClass: n } = this.elements.controlledMenu; - this.dom.toggle.setAttribute("aria-expanded", "false"), n !== "" ? (w(n, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - s !== "" && v(s, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - e !== "" && w(e, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - v(n, this.elements.controlledMenu.dom.menu); + this.dom.toggle.setAttribute("aria-expanded", "false"), n !== "" ? (I(n, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { + s !== "" && w(s, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { + e !== "" && I(e, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { + w(n, this.elements.controlledMenu.dom.menu); }); }); - })) : (e !== "" && w(e, this.elements.controlledMenu.dom.menu), s !== "" && v(s, this.elements.controlledMenu.dom.menu)), t && this.dom.toggle.dispatchEvent(this._collapseEvent); + })) : (e !== "" && I(e, this.elements.controlledMenu.dom.menu), s !== "" && w(s, this.elements.controlledMenu.dom.menu)), t && this.dom.toggle.dispatchEvent(this._collapseEvent); } /** * Opens the controlled menu. @@ -655,34 +655,34 @@ function g(r) { function o(r) { r.preventDefault(), r.stopPropagation(); } -class I { +class v { /** * Constructs a new `BaseMenu`. * - * @param {object} options - The options for generating the menu. - * @param {HTMLElement} options.menuElement - The menu element in the DOM. - * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. - * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. - * @param {string} [options.submenuItemSelector] - The query selector string for menu items containing submenus. - * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. - * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. - * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. - * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. - * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". - * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". - * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. - * @param {boolean} [options.isTopLevel = false] - A flag to mark the root menu. - * @param {?BaseMenu} [options.parentMenu = null] - The parent menu to this menu. - * @param {string} [options.hoverType = off] - The type of hoverability a menu has. - * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). - * @param {number} [options.enterDelay = -1] - The delay for opening menus if the menu is hoverable (in miliseconds). - * @param {number} [options.leaveDelay = -1] - The delay for closing menus if the menu is hoverable (in miliseconds). + * @param {object} options - The options for generating the menu. + * @param {HTMLElement} options.menuElement - The menu element in the DOM. + * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. + * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. + * @param {string} [options.submenuItemSelector = li:has(ul)] - The query selector string for menu items containing submenus. + * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. + * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. + * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. + * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. + * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". + * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". + * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. + * @param {boolean} [options.isTopLevel = false] - A flag to mark the root menu. + * @param {?BaseMenu} [options.parentMenu = null] - The parent menu to this menu. + * @param {string} [options.hoverType = off] - The type of hoverability a menu has. + * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). + * @param {number} [options.enterDelay = -1] - The delay for opening menus if the menu is hoverable (in miliseconds). + * @param {number} [options.leaveDelay = -1] - The delay for closing menus if the menu is hoverable (in miliseconds). */ constructor({ menuElement: t, menuItemSelector: e = "li", menuLinkSelector: s = "a", - submenuItemSelector: n = "", + submenuItemSelector: n = "li:has(ul)", submenuToggleSelector: i = "a", submenuSelector: l = "ul", controllerElement: h = null, @@ -704,7 +704,7 @@ class I { * * @type {typeof BaseMenu} */ - u(this, "_MenuType", I); + u(this, "_MenuType", v); // eslint-disable-line no-use-before-define /** * The class to use when generating menu items. @@ -1240,7 +1240,7 @@ class I { } const n = p("boolean", { isTopLevel: this._root }); if (n.status || (this._errors.push(n.error.message), t = !1), this._elements.parentMenu !== null) { - const m = k(I, { + const m = k(v, { parentMenu: this._elements.parentMenu }); m.status || (this._errors.push(m.error.message), t = !1); @@ -1400,7 +1400,7 @@ class I { clearTimeout(this._hoverTimeout); } /** - * A wrapper for setTimeout that stores the timeout in the menu. + * Sets the hover timeout. * * @protected * @@ -1408,7 +1408,7 @@ class I { * @param {number} delay - The delay time in milliseconds. */ _setTimeout(t, e) { - this._hoverTimeout = setTimeout(t, e); + p("function", { callback: t }), p("number", { delay: e }), this._hoverTimeout = setTimeout(t, e); } /** * Handles focus events throughout the menu for proper menu use. @@ -1778,36 +1778,36 @@ class U extends L { this.isOpen && this.closeChildren(), super.close(); } } -class x extends I { +class x extends v { /** * Constructs a new `DisclosureMenu`. * - * @param {object} options - The options for generating the menu. - * @param {HTMLElement} options.menuElement - The menu element in the DOM. - * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. - * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. - * @param {string} [options.submenuItemSelector] - The query selector string for menu items containing submenus. - * @param {string} [options.submenuToggleSelector = button] - The query selector string for submenu toggle buttons/links. - * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. - * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. - * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. - * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". - * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". - * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. - * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. - * @param {?DisclosureMenu} [options.parentMenu = null] - The parent menu to this menu. - * @param {string} [options.hoverType = off] - The type of hoverability a menu has. - * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). - * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). - * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). - * @param {boolean} [options.optionalKeySupport = false] - A flag to add optional keyboard support (Arrow keys, Home, and End) to the menu. - * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. + * @param {object} options - The options for generating the menu. + * @param {HTMLElement} options.menuElement - The menu element in the DOM. + * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. + * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. + * @param {string} [options.submenuItemSelector = li:has(ul)] - The query selector string for menu items containing submenus. + * @param {string} [options.submenuToggleSelector = button] - The query selector string for submenu toggle buttons/links. + * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. + * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. + * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. + * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". + * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". + * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. + * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. + * @param {?DisclosureMenu} [options.parentMenu = null] - The parent menu to this menu. + * @param {string} [options.hoverType = off] - The type of hoverability a menu has. + * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). + * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). + * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). + * @param {boolean} [options.optionalKeySupport = false] - A flag to add optional keyboard support (Arrow keys, Home, and End) to the menu. + * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. */ constructor({ menuElement: e, menuItemSelector: s = "li", menuLinkSelector: n = "a", - submenuItemSelector: i = "", + submenuItemSelector: i = "li:has(ul)", submenuToggleSelector: l = "button", submenuSelector: h = "ul", controllerElement: c = null, @@ -2141,35 +2141,35 @@ class Z extends L { this.isOpen && (this.closeChildren(), this.elements.parentMenu && this.elements.parentMenu.focusCurrentChild()), super.close(); } } -class K extends I { +class K extends v { /** * Constructs a new `Menubar`. * - * @param {object} options - The options for generating the menu. - * @param {HTMLElement} options.menuElement - The menu element in the DOM. - * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. - * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. - * @param {string} [options.submenuItemSelector] - The query selector string for menu items containing submenus. - * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. - * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. - * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. - * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. - * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". - * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". - * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. - * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. - * @param {?Menubar} [options.parentMenu = null] - The parent menu to this menu. - * @param {string} [options.hoverType = off] - The type of hoverability a menu has. - * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). - * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). - * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). - * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. + * @param {object} options - The options for generating the menu. + * @param {HTMLElement} options.menuElement - The menu element in the DOM. + * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. + * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. + * @param {string} [options.submenuItemSelector = li:has(ul)] - The query selector string for menu items containing submenus. + * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. + * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. + * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. + * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. + * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". + * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". + * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. + * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. + * @param {?Menubar} [options.parentMenu = null] - The parent menu to this menu. + * @param {string} [options.hoverType = off] - The type of hoverability a menu has. + * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). + * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). + * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). + * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. */ constructor({ menuElement: e, menuItemSelector: s = "li", menuLinkSelector: n = "a", - submenuItemSelector: i = "", + submenuItemSelector: i = "li:has(ul)", submenuToggleSelector: l = "a", submenuSelector: h = "ul", controllerElement: c = null, @@ -2525,37 +2525,37 @@ class B extends L { this.isOpen && this.closeChildren(), super.close(); } } -class F extends I { +class F extends v { /** * Constructs a new `TopLinkDisclosureMenu`. * - * @param {object} options - The options for generating the menu. - * @param {HTMLElement} options.menuElement - The menu element in the DOM. - * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. - * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. - * @param {string} [options.submenuItemSelector] - The query selector string for menu items containing submenus. - * @param {string} [options.submenuToggleSelector = button] - The query selector string for submenu toggle buttons/links. - * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. - * @param {string} [options.submenuSubtoggleSelector = a] - The query selector string for submenu toggle buttons/links below the top level. - * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. - * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. - * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". - * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". - * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. - * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. - * @param {?TopLinkDisclosureMenu} [options.parentMenu = null] - The parent menu to this menu. - * @param {string} [options.hoverType = off] - The type of hoverability a menu has. - * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). - * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). - * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). - * @param {boolean} [options.optionalKeySupport = false] - A flag to add optional keyboard support (Arrow keys, Home, and End) to the menu. - * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. + * @param {object} options - The options for generating the menu. + * @param {HTMLElement} options.menuElement - The menu element in the DOM. + * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. + * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. + * @param {string} [options.submenuItemSelector = li:has(ul)] - The query selector string for menu items containing submenus. + * @param {string} [options.submenuToggleSelector = button] - The query selector string for submenu toggle buttons/links. + * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. + * @param {string} [options.submenuSubtoggleSelector = a] - The query selector string for submenu toggle buttons/links below the top level. + * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. + * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. + * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". + * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". + * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. + * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. + * @param {?TopLinkDisclosureMenu} [options.parentMenu = null] - The parent menu to this menu. + * @param {string} [options.hoverType = off] - The type of hoverability a menu has. + * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). + * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). + * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). + * @param {boolean} [options.optionalKeySupport = false] - A flag to add optional keyboard support (Arrow keys, Home, and End) to the menu. + * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. */ constructor({ menuElement: e, menuItemSelector: s = "li", menuLinkSelector: n = "a", - submenuItemSelector: i = "", + submenuItemSelector: i = "li:has(ul)", submenuToggleSelector: l = "button", submenuSelector: h = "ul", submenuSubtoggleSelector: c = "a", @@ -3055,35 +3055,35 @@ class J extends L { ); } } -class $ extends I { +class $ extends v { /** * Constructs a new `Treeview`. * - * @param {object} options - The options for generating the menu. - * @param {HTMLElement} options.menuElement - The menu element in the DOM. - * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. - * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. - * @param {string} [options.submenuItemSelector] - The query selector string for menu items containing submenus. - * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. - * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. - * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. - * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. - * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". - * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". - * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. - * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. - * @param {?Treeview} [options.parentMenu = null] - The parent menu to this menu. - * @param {string} [options.hoverType = off] - The type of hoverability a menu has. - * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). - * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). - * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). - * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. + * @param {object} options - The options for generating the menu. + * @param {HTMLElement} options.menuElement - The menu element in the DOM. + * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. + * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. + * @param {string} [options.submenuItemSelector = li:has(ul)] - The query selector string for menu items containing submenus. + * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. + * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. + * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. + * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. + * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". + * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". + * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. + * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. + * @param {?Treeview} [options.parentMenu = null] - The parent menu to this menu. + * @param {string} [options.hoverType = off] - The type of hoverability a menu has. + * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). + * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). + * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). + * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. */ constructor({ menuElement: e, menuItemSelector: s = "li", menuLinkSelector: n = "a", - submenuItemSelector: i = "", + submenuItemSelector: i = "li:has(ul)", submenuToggleSelector: l = "a", submenuSelector: h = "ul", controllerElement: c = null, @@ -3170,6 +3170,71 @@ class $ extends I { console.error(e); } } + /** + * Handles hover events throughout the menu for proper use. + * + * Adds `pointerenter` listeners to all menu items and `pointerleave` listeners + * to all submenu items which function differently depending on + * the menu's hover type. + * + * Before executing anything, the event is checked to make sure the event wasn't + * triggered by a pen or touch. + * + * Hover Type "on" + * - When a `pointerenter` event triggers on any menu item the menu's + * current child value will change to that + * menu item. + * - When a `pointerenter` event triggers on a submenu item the + * preview method for the submenu item's + * toggle will be called. + * - When a `pointerleave` event triggers on the menu itself the + * closeChildren method will be called after a delay + * set by the menu's hover delay. + * + * Hover Type "dynamic" + * - When a `pointerenter` event triggers on any menu item the menu's + * current child value will change to that menu item. + * - When a `pointerenter` event triggers on any menu item, and the menu's + * focus state is not "none", the menu item + * will be focused. + * - When a `pointerenter` event triggers on a submenu item, and a submenu is + * already open, the preview method for the submenu item's toggle will be called. + * - When a `pointerenter` event triggers on a submenu item, and no submenu is + * open, no submenu-specific methods will be called. + * + * Hover Type "off" + * All `pointerenter` and `pointerleave` events are ignored. + * + * @protected + */ + _handleHover() { + this.elements.menuItems.forEach((e, s) => { + e.dom.link.addEventListener("pointerenter", (n) => { + if (!(n.pointerType === "pen" || n.pointerType === "touch")) { + if (this.hoverType === "on") + this.currentEvent = "mouse", this.elements.rootMenu.blurChildren(), this.focusChild(s), e.isSubmenuItem && (this.enterDelay > 0 ? (this._clearTimeout(), this._setTimeout(() => { + e.elements.toggle.preview(); + }, this.enterDelay)) : e.elements.toggle.preview()); + else if (this.hoverType === "dynamic") { + const i = this.elements.submenuToggles.some( + (l) => l.isOpen + ); + this.currentChild = s, (!this.isTopLevel || this.focusState !== "none") && (this.currentEvent = "mouse", this.elements.rootMenu.blurChildren(), this.focusCurrentChild()), e.isSubmenuItem && (!this.isTopLevel || i) && (this.currentEvent = "mouse", this.elements.rootMenu.blurChildren(), this.focusCurrentChild(), this.enterDelay > 0 ? (this._clearTimeout(), this._setTimeout(() => { + e.elements.toggle.preview(); + }, this.enterDelay)) : e.elements.toggle.preview()); + } + } + }), e.isSubmenuItem && (e.dom.item.addEventListener("pointerleave", (n) => { + n.pointerType === "pen" || n.pointerType === "touch" || (this.hoverType === "on" ? this.leaveDelay > 0 && this._clearTimeout() : this.hoverType === "dynamic" && (this.isTopLevel || this.leaveDelay > 0 && this._clearTimeout())); + }), e.dom.item.addEventListener("pointerenter", (n) => { + n.pointerType === "pen" || n.pointerType === "touch" || e.isSubmenuItem && (this.hoverType === "on" || this.hoverType === "dynamic") && this.leaveDelay > 0 && this._clearTimeout(); + })), this.isTopLevel && this.dom.menu.addEventListener("pointerleave", (n) => { + n.pointerType === "pen" || n.pointerType === "touch" || this.hoverType === "on" && (this.leaveDelay > 0 ? (this._clearTimeout(), this._setTimeout(() => { + this.closeChildren(), this.blur(); + }, this.leaveDelay)) : (this.closeChildren(), this.blur())); + }); + }); + } /** * Handles keydown events throughout the menu for proper menu use. * diff --git a/dist/accessible-menu.iife.js b/dist/accessible-menu.iife.js index 4a20d7e9..1cad8686 100644 --- a/dist/accessible-menu.iife.js +++ b/dist/accessible-menu.iife.js @@ -1,3 +1,3 @@ -var AccessibleMenu=function(){"use strict";var G=Object.defineProperty;var J=(y,p,M)=>p in y?G(y,p,{enumerable:!0,configurable:!0,writable:!0,value:M}):y[p]=M;var u=(y,p,M)=>J(y,typeof p!="symbol"?p+"":p,M);function y(r,t){typeof r=="string"?t.classList.add(r):t.classList.add(...r)}function p(r,t){typeof r=="string"?t.classList.remove(r):t.classList.remove(...r)}function M(r,t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${e}" given.`)}for(const e in t)if(!(t[e]instanceof r)){const s=typeof t[e];throw new TypeError(`${e} must be an instance of ${r.name}. "${s}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(r,t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Values given to isValidType() must be inside of an object. "${e}" given.`)}for(const e in t){const s=typeof t[e];if(s!==r)throw new TypeError(`${e} must be a ${r}. "${s}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function D(r){try{if(typeof r!="object"){const t=typeof r;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${t}" given.`)}for(const t in r)try{if(r[t]===null)throw new Error;document.querySelector(r[t])}catch{throw new TypeError(`${t} must be a valid query selector. "${r[t]}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function k(r){try{if(typeof r!="object"||Array.isArray(r)){const t=typeof r;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${t}" given.`)}for(const t in r){const e=typeof r[t];if(e!=="string")if(Array.isArray(r[t]))r[t].forEach(s=>{if(typeof s!="string")throw new TypeError(`${t} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${t} must be a string or an array of strings. "${e}" given.`);else{const s={};s[t]=r[t],D(s)}}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function N(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidState() must be inside of an object. "${e}" given.`)}const t=["none","self","child"];for(const e in r)if(!t.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function j(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${e}" given.`)}const t=["none","mouse","keyboard","character"];for(const e in r)if(!t.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function z(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${e}" given.`)}const t=["off","on","dynamic"];for(const e in r)if(!t.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function H(r,t){if(g("string",{tagName:r}).status&&M(HTMLElement,t).status){const e=r.toLowerCase();let s=!0;for(const n in t)t[n].tagName.toLowerCase()!==e&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null}){u(this,"_dom",{toggle:null,parent:null});u(this,"_elements",{controlledMenu:null,parentMenu:null});u(this,"_open",!1);u(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));u(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=t,this._dom.parent=e,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(t){g("boolean",{value:t}),this._open=t}_setIds(){var t;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((t=this.dom.toggle.innerText)==null?void 0:t.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=e;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),H("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(t=!0){const{closeClass:e,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(y(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&p(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&y(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{p(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&y(s,this.elements.controlledMenu.dom.menu),e!==""&&p(e,this.elements.controlledMenu.dom.menu)),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:e,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(y(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&p(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&y(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{p(n,this.elements.controlledMenu.dom.menu)})})})):(e!==""&&y(e,this.elements.controlledMenu.dom.menu),s!==""&&p(s,this.elements.controlledMenu.dom.menu)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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(t=>{t!==this&&t.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(t=>t.close())}}class A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null}){u(this,"_dom",{item:null,link:null});u(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});u(this,"_submenu",!1);this._dom.item=t,this._dom.link=e,this._elements.parentMenu=s,this._elements.childMenu=i,this._elements.toggle=l,this._submenu=n}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 b(r){try{const t=r.key||r.keyCode,e={Enter:t==="Enter"||t===13,Space:t===" "||t==="Spacebar"||t===32,Escape:t==="Escape"||t==="Esc"||t===27,ArrowUp:t==="ArrowUp"||t==="Up"||t===38,ArrowRight:t==="ArrowRight"||t==="Right"||t===39,ArrowDown:t==="ArrowDown"||t==="Down"||t===40,ArrowLeft:t==="ArrowLeft"||t==="Left"||t===37,Home:t==="Home"||t===36,End:t==="End"||t===35,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:t==="Tab"||t===9,Asterisk:t==="*"||t===56};return Object.keys(e).find(s=>e[s]===!0)||""}catch{return""}}function o(r){r.preventDefault(),r.stopPropagation()}class w{constructor({menuElement:t,menuItemSelector:e="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:i="a",submenuSelector:l="ul",controllerElement:h=null,containerElement:c=null,openClass:m="show",closeClass:a="hide",transitionClass:d="transitioning",isTopLevel:f=!0,parentMenu:C=null,hoverType:_="off",hoverDelay:E=250,enterDelay:T=-1,leaveDelay:I=-1}){u(this,"_MenuType",w);u(this,"_MenuItemType",A);u(this,"_MenuToggleType",L);u(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});u(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});u(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});u(this,"_openClass","show");u(this,"_closeClass","hide");u(this,"_transitionClass","transitioning");u(this,"_root",!0);u(this,"_currentChild",0);u(this,"_focusState","none");u(this,"_currentEvent","none");u(this,"_hoverType","off");u(this,"_hoverDelay",250);u(this,"_enterDelay",-1);u(this,"_leaveDelay",-1);u(this,"_hoverTimeout",null);u(this,"_errors",[]);this._dom.menu=t,this._dom.controller=h,this._dom.container=c,this._selectors.menuItems=e,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=i,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=C,this._elements.rootMenu=f?this:null,this._openClass=m||"",this._closeClass=a||"",this._transitionClass=d||"",this._root=f,this._hoverType=_,this._hoverDelay=E,this._enterDelay=T,this._leaveDelay=I}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +var AccessibleMenu=function(){"use strict";var G=Object.defineProperty;var J=(y,g,M)=>g in y?G(y,g,{enumerable:!0,configurable:!0,writable:!0,value:M}):y[g]=M;var u=(y,g,M)=>J(y,typeof g!="symbol"?g+"":g,M);function y(l,t){typeof l=="string"?t.classList.add(l):t.classList.add(...l)}function g(l,t){typeof l=="string"?t.classList.remove(l):t.classList.remove(...l)}function M(l,t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${e}" given.`)}for(const e in t)if(!(t[e]instanceof l)){const s=typeof t[e];throw new TypeError(`${e} must be an instance of ${l.name}. "${s}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(l,t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Values given to isValidType() must be inside of an object. "${e}" given.`)}for(const e in t){const s=typeof t[e];if(s!==l)throw new TypeError(`${e} must be a ${l}. "${s}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function D(l){try{if(typeof l!="object"){const t=typeof l;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${t}" given.`)}for(const t in l)try{if(l[t]===null)throw new Error;document.querySelector(l[t])}catch{throw new TypeError(`${t} must be a valid query selector. "${l[t]}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function k(l){try{if(typeof l!="object"||Array.isArray(l)){const t=typeof l;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${t}" given.`)}for(const t in l){const e=typeof l[t];if(e!=="string")if(Array.isArray(l[t]))l[t].forEach(s=>{if(typeof s!="string")throw new TypeError(`${t} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${t} must be a string or an array of strings. "${e}" given.`);else{const s={};s[t]=l[t],D(s)}}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function N(l){try{if(typeof l!="object"){const e=typeof l;throw new TypeError(`Values given to isValidState() must be inside of an object. "${e}" given.`)}const t=["none","self","child"];for(const e in l)if(!t.includes(l[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${l[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function j(l){try{if(typeof l!="object"){const e=typeof l;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${e}" given.`)}const t=["none","mouse","keyboard","character"];for(const e in l)if(!t.includes(l[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${l[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function z(l){try{if(typeof l!="object"){const e=typeof l;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${e}" given.`)}const t=["off","on","dynamic"];for(const e in l)if(!t.includes(l[e]))throw new TypeError(`${e} must be one of the following values: ${t.join(", ")}. "${l[e]}" given.`);return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function H(l,t){if(p("string",{tagName:l}).status&&M(HTMLElement,t).status){const e=l.toLowerCase();let s=!0;for(const n in t)t[n].tagName.toLowerCase()!==e&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null}){u(this,"_dom",{toggle:null,parent:null});u(this,"_elements",{controlledMenu:null,parentMenu:null});u(this,"_open",!1);u(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));u(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=t,this._dom.parent=e,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(t){p("boolean",{value:t}),this._open=t}_setIds(){var t;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((t=this.dom.toggle.innerText)==null?void 0:t.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=e;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),H("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(t=!0){const{closeClass:e,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(y(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&g(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&y(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{g(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&y(s,this.elements.controlledMenu.dom.menu),e!==""&&g(e,this.elements.controlledMenu.dom.menu)),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:e,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(y(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&g(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&y(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{g(n,this.elements.controlledMenu.dom.menu)})})})):(e!==""&&y(e,this.elements.controlledMenu.dom.menu),s!==""&&g(s,this.elements.controlledMenu.dom.menu)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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(t=>{t!==this&&t.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(t=>t.close())}}class A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:r=null}){u(this,"_dom",{item:null,link:null});u(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});u(this,"_submenu",!1);this._dom.item=t,this._dom.link=e,this._elements.parentMenu=s,this._elements.childMenu=i,this._elements.toggle=r,this._submenu=n}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 b(l){try{const t=l.key||l.keyCode,e={Enter:t==="Enter"||t===13,Space:t===" "||t==="Spacebar"||t===32,Escape:t==="Escape"||t==="Esc"||t===27,ArrowUp:t==="ArrowUp"||t==="Up"||t===38,ArrowRight:t==="ArrowRight"||t==="Right"||t===39,ArrowDown:t==="ArrowDown"||t==="Down"||t===40,ArrowLeft:t==="ArrowLeft"||t==="Left"||t===37,Home:t==="Home"||t===36,End:t==="End"||t===35,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),Tab:t==="Tab"||t===9,Asterisk:t==="*"||t===56};return Object.keys(e).find(s=>e[s]===!0)||""}catch{return""}}function o(l){l.preventDefault(),l.stopPropagation()}class I{constructor({menuElement:t,menuItemSelector:e="li",menuLinkSelector:s="a",submenuItemSelector:n="li:has(ul)",submenuToggleSelector:i="a",submenuSelector:r="ul",controllerElement:h=null,containerElement:c=null,openClass:m="show",closeClass:a="hide",transitionClass:d="transitioning",isTopLevel:f=!0,parentMenu:C=null,hoverType:_="off",hoverDelay:E=250,enterDelay:T=-1,leaveDelay:v=-1}){u(this,"_MenuType",I);u(this,"_MenuItemType",A);u(this,"_MenuToggleType",L);u(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});u(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});u(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});u(this,"_openClass","show");u(this,"_closeClass","hide");u(this,"_transitionClass","transitioning");u(this,"_root",!0);u(this,"_currentChild",0);u(this,"_focusState","none");u(this,"_currentEvent","none");u(this,"_hoverType","off");u(this,"_hoverDelay",250);u(this,"_enterDelay",-1);u(this,"_leaveDelay",-1);u(this,"_hoverTimeout",null);u(this,"_errors",[]);this._dom.menu=t,this._dom.controller=h,this._dom.container=c,this._selectors.menuItems=e,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=i,this._selectors.submenus=r,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=C,this._elements.rootMenu=f?this:null,this._openClass=m||"",this._closeClass=a||"",this._transitionClass=d||"",this._root=f,this._hoverType=_,this._hoverDelay=E,this._enterDelay=T,this._leaveDelay=v}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const t=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=t}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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let t=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(t=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(t=!0),t}get errors(){return this._errors}set openClass(t){k({openClass:t}),this._openClass!==t&&(this._openClass=t)}set closeClass(t){k({closeClass:t}),this._closeClass!==t&&(this._closeClass=t)}set transitionClass(t){k({transitionClass:t}),this._transitionClass!==t&&(this._transitionClass=t)}set currentChild(t){g("number",{value:t});function e(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let i=0,l=!1;for(;!l&&i=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,e(this)):this.focusChild!==t&&(this._currentChild=t,e(this))}set focusState(t){N({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&(t==="self"||t==="none")&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(t==="self"||t==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(t){j({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.currentEvent=t}))}set hoverType(t){z({value:t}),this._hoverType!==t&&(this._hoverType=t)}set hoverDelay(t){g("number",{value:t}),this._hoverDelay!==t&&(this._hoverDelay=t)}set enterDelay(t){g("number",{value:t}),this._enterDelay!==t&&(this._enterDelay=t)}set leaveDelay(t){g("number",{value:t}),this._leaveDelay!==t&&(this._leaveDelay=t)}_validate(){let t=!0,e;this._dom.container!==null||this._dom.controller!==null?e=M(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):e=M(HTMLElement,{menuElement:this._dom.menu}),e.status||(this._errors.push(e.error.message),t=!1);let s;if(this._selectors.submenuItems!==""?s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),t=!1),this._openClass!==""){const m=k({openClass:this._openClass});m.status||(this._errors.push(m.error.message),t=!1)}if(this._closeClass!==""){const m=k({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),t=!1)}if(this._transitionClass!==""){const m=k({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),t=!1)}const n=g("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),t=!1),this._elements.parentMenu!==null){const m=M(w,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),t=!1)}const i=z({hoverType:this._hoverType});i.status||(this._errors.push(i.error.message),t=!1);const l=g("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),t=!1);const h=g("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),t=!1);const c=g("number",{leaveDelay:this._leaveDelay});return c.status||(this._errors.push(c.error.message),t=!1),t}_setDOMElementType(t,e=this.dom.menu,s=!0){if(typeof this.selectors[t]=="string"){if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);e!==this.dom.menu&&M(HTMLElement,{base:e});const i=Array.from(e.querySelectorAll(this.selectors[t])).filter(l=>l.parentElement===e);s?this._dom[t]=i:this._dom[t]=[...this._dom[t],...i]}else throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`)}_resetDOMElementType(t){if(typeof this.dom[t]<"u"){if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be reset through _resetDOMElementType.`);this._dom[t]=[]}else throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(t=>{this._setDOMElementType("submenuToggles",t,!1),this._setDOMElementType("submenus",t,!1)}))}_findRootMenu(t){if(t.isTopLevel)this._elements.rootMenu=t;else if(t.elements.parentMenu!==null)this._findRootMenu(t.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(t=>{let e;if(this.dom.submenuItems.includes(t)){const s=t.querySelector(this.selectors.submenuToggles),n=t.querySelector(this.selectors.submenus),i=new this._MenuType({menuElement:n,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:t,controlledMenu:i,parentMenu:this});this._elements.submenuToggles.push(l),e=new this._MenuItemType({menuItemElement:t,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:i,toggle:l})}else{const s=t.querySelector(this.selectors.menuLinks);e=new this._MenuItemType({menuItemElement:t,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(e)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(t,e){this._hoverTimeout=setTimeout(t,e)}_handleFocus(){this.elements.menuItems.forEach((t,e)=>{t.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=e})})}_handleClick(){function t(e,s,n){o(n),s.toggle(),s.isOpen&&(e.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),e.isSubmenuItem&&e.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",t(this,e.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",e=>{this.currentEvent="mouse",t(this,this.elements.controller,e)})}_handleHover(){this.elements.menuItems.forEach((t,e)=>{t.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(e),t.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(i=>i.isOpen);this.currentChild=e,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),t.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview())}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))}),t.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",t=>{this.currentEvent="keyboard";const e=b(t);(e==="Space"||e==="Enter")&&o(t)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",t=>{this.currentEvent="keyboard";const e=b(t);(e==="Space"||e==="Enter")&&(o(t),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(t){this.blurCurrentChild(),this.currentChild=t,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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(t=>t.close())}blurChildren(){this.elements.menuItems.forEach(t=>{t.blur(),t.isSubmenuItem&&t.elements.childMenu.blurChildren()})}}class q extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:l}),h&&this.initialize()}}class V extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class O extends w{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:l="button",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:C=!0,parentMenu:_=null,hoverType:E="off",hoverDelay:T=250,enterDelay:I=-1,leaveDelay:v=-1,optionalKeySupport:S=!1,initialize:$=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:l,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:C,parentMenu:_,hoverType:E,hoverDelay:T,enterDelay:I,leaveDelay:v});u(this,"_MenuType",O);u(this,"_MenuItemType",q);u(this,"_MenuToggleType",V);u(this,"_currentChild",-1);u(this,"_optionalSupport",!1);this._optionalSupport=S,$&&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){g("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_validate(){let e=super._validate();const s=g("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(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 s=b(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&o(e):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&i.includes(s)||this.elements.parentMenu&&l.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=b(e);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(o(e),this.closeChildren()):this.elements.parentMenu?(o(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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(o(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())))})}}class R extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:l}),h&&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 L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class x extends w{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:l="a",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:C=!0,parentMenu:_=null,hoverType:E="off",hoverDelay:T=250,enterDelay:I=-1,leaveDelay:v=-1,initialize:S=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:l,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:C,parentMenu:_,hoverType:E,hoverDelay:T,enterDelay:I,leaveDelay:v});u(this,"_MenuType",x);u(this,"_MenuItemType",R);u(this,"_MenuToggleType",P);S&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),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=>{this.focusState!=="none"&&(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 s=b(e);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")o(e);else if(this.isTopLevel){if(this.focusState==="self"){const n=["ArrowRight","ArrowLeft","Home","End"],i=["Space","Enter","ArrowDown","ArrowUp"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&l.includes(s))&&o(e)}}else{const n=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],i=["Space","Enter"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=b(e),{altKey:n,crtlKey:i,metaKey:l}=e;if(s==="Character"&&!(n||i||l))o(e),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(e.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(o(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(s==="ArrowRight"){o(e);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){o(e);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(o(e),this.focusFirstChild()):s==="End"?(o(e),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(m=>m.isOpen)?(o(e),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(o(e),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(o(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(o(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(o(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()))):s==="ArrowDown"?(o(e),this.focusNextChild()):s==="ArrowUp"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(e){const s=e.toLowerCase();let n=this.currentChild+1,i=!1;for(;!i&&n{let s,n;const i=e.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(e)){const l=e.querySelector(this.selectors.submenuToggles),h=e.querySelector(this.selectors.submenus),c=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),m=new this._MenuToggleType({menuToggleElement:l,parentElement:e,controlledMenu:c,parentMenu:this});this._elements.submenuToggles.push(m),l!==i?(n=new this._MenuItemType({menuItemElement:e,menuLinkElement:l,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:m}),s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,submenuSibling:n})):s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:m})}else s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this});this._elements.menuItems.push(s),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let e=super._validate();const s=D({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),e=!1);const n=g("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(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()))})}_handleHover(){this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let i=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(i=e.elements.sibling.elements.toggle),i===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{i.preview()},this.enterDelay)):i.preview()}else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(l=>l.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||i){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let l=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(l=e.elements.sibling.elements.toggle),l===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{l.preview()},this.enterDelay)):l.preview()}}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",n=>{n.pointerType==="pen"||n.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const s=b(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&o(e):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&i.includes(s)||this.elements.parentMenu&&l.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=b(e);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(o(e),this.closeChildren()):this.elements.parentMenu?(o(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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(o(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())))})}}class Z extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:l=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:l}),h&&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 Q extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-expanded")==="true"?this.open():this._collapse(!1)}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.getAttribute("aria-expanded")!=="true"&&this.dom.toggle.setAttribute("aria-expanded","false"),H("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}}class F extends w{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:l="a",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:C=!0,parentMenu:_=null,hoverType:E="off",hoverDelay:T=250,enterDelay:I=-1,leaveDelay:v=-1,initialize:S=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:l,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:C,parentMenu:_,hoverType:E,hoverDelay:T,enterDelay:I,leaveDelay:v});u(this,"_MenuType",F);u(this,"_MenuItemType",Z);u(this,"_MenuToggleType",Q);S&&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 s=b(e);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const n=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],i=["Enter","ArrowRight"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&l.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=b(e),{altKey:n,crtlKey:i,metaKey:l}=e;if(s==="Character"&&!(n||i||l))o(e),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(e.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")o(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(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")o(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.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){o(e);const c=this.elements.menuItems[this.currentChild-1];c&&c.isSubmenuItem&&c.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(o(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()):s==="ArrowLeft"?(o(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())):s==="Home"?(o(e),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(o(e),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(o(e),this.openChildren())})}focusLastNode(){const e=this.elements.menuItems.length-1,s=this.elements.menuItems[e];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=e,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(e=>e.preview())}focusNextNodeWithCharacter(e){function s(a){let d=[];return a.elements.menuItems.forEach(f=>{d.push(f),f.isSubmenuItem&&f.elements.toggle.isOpen&&(d=[...d,...s(f.elements.toggle.elements.controlledMenu)])}),d}const n=e.toLowerCase(),i=s(this.elements.rootMenu),l=i.indexOf(this.currentMenuItem)+1,h=[...i.slice(l),...i.slice(0,l)];let c=0,m=!1;for(;!m&&c=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,e(this)):this.focusChild!==t&&(this._currentChild=t,e(this))}set focusState(t){N({value:t}),this._focusState!==t&&(this._focusState=t),this.elements.submenuToggles.length>0&&(t==="self"||t==="none")&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(t==="self"||t==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(t){j({value:t}),this._currentEvent!==t&&(this._currentEvent=t,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.currentEvent=t}))}set hoverType(t){z({value:t}),this._hoverType!==t&&(this._hoverType=t)}set hoverDelay(t){p("number",{value:t}),this._hoverDelay!==t&&(this._hoverDelay=t)}set enterDelay(t){p("number",{value:t}),this._enterDelay!==t&&(this._enterDelay=t)}set leaveDelay(t){p("number",{value:t}),this._leaveDelay!==t&&(this._leaveDelay=t)}_validate(){let t=!0,e;this._dom.container!==null||this._dom.controller!==null?e=M(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):e=M(HTMLElement,{menuElement:this._dom.menu}),e.status||(this._errors.push(e.error.message),t=!1);let s;if(this._selectors.submenuItems!==""?s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),t=!1),this._openClass!==""){const m=k({openClass:this._openClass});m.status||(this._errors.push(m.error.message),t=!1)}if(this._closeClass!==""){const m=k({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),t=!1)}if(this._transitionClass!==""){const m=k({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),t=!1)}const n=p("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),t=!1),this._elements.parentMenu!==null){const m=M(I,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),t=!1)}const i=z({hoverType:this._hoverType});i.status||(this._errors.push(i.error.message),t=!1);const r=p("number",{hoverDelay:this._hoverDelay});r.status||(this._errors.push(r.error.message),t=!1);const h=p("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),t=!1);const c=p("number",{leaveDelay:this._leaveDelay});return c.status||(this._errors.push(c.error.message),t=!1),t}_setDOMElementType(t,e=this.dom.menu,s=!0){if(typeof this.selectors[t]=="string"){if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be set through _setDOMElementType.`);e!==this.dom.menu&&M(HTMLElement,{base:e});const i=Array.from(e.querySelectorAll(this.selectors[t])).filter(r=>r.parentElement===e);s?this._dom[t]=i:this._dom[t]=[...this._dom[t],...i]}else throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`)}_resetDOMElementType(t){if(typeof this.dom[t]<"u"){if(!Array.isArray(this.dom[t]))throw new Error(`AccessibleMenu: The "${t}" element cannot be reset through _resetDOMElementType.`);this._dom[t]=[]}else throw new Error(`AccessibleMenu: "${t}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(t=>{this._setDOMElementType("submenuToggles",t,!1),this._setDOMElementType("submenus",t,!1)}))}_findRootMenu(t){if(t.isTopLevel)this._elements.rootMenu=t;else if(t.elements.parentMenu!==null)this._findRootMenu(t.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(t=>{let e;if(this.dom.submenuItems.includes(t)){const s=t.querySelector(this.selectors.submenuToggles),n=t.querySelector(this.selectors.submenus),i=new this._MenuType({menuElement:n,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),r=new this._MenuToggleType({menuToggleElement:s,parentElement:t,controlledMenu:i,parentMenu:this});this._elements.submenuToggles.push(r),e=new this._MenuItemType({menuItemElement:t,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:i,toggle:r})}else{const s=t.querySelector(this.selectors.menuLinks);e=new this._MenuItemType({menuItemElement:t,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(e)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(t,e){p("function",{callback:t}),p("number",{delay:e}),this._hoverTimeout=setTimeout(t,e)}_handleFocus(){this.elements.menuItems.forEach((t,e)=>{t.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=e})})}_handleClick(){function t(e,s,n){o(n),s.toggle(),s.isOpen&&(e.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),e.isSubmenuItem&&e.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",t(this,e.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",e=>{this.currentEvent="mouse",t(this,this.elements.controller,e)})}_handleHover(){this.elements.menuItems.forEach((t,e)=>{t.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(e),t.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(i=>i.isOpen);this.currentChild=e,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),t.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview())}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))}),t.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",t=>{this.currentEvent="keyboard";const e=b(t);(e==="Space"||e==="Enter")&&o(t)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",t=>{this.currentEvent="keyboard";const e=b(t);(e==="Space"||e==="Enter")&&(o(t),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(t){this.blurCurrentChild(),this.currentChild=t,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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(t=>t.close())}blurChildren(){this.elements.menuItems.forEach(t=>{t.blur(),t.isSubmenuItem&&t.elements.childMenu.blurChildren()})}}class q extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:r=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:r}),h&&this.initialize()}}class V extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class O extends I{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:r="button",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:C=!0,parentMenu:_=null,hoverType:E="off",hoverDelay:T=250,enterDelay:v=-1,leaveDelay:w=-1,optionalKeySupport:S=!1,initialize:$=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:r,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:C,parentMenu:_,hoverType:E,hoverDelay:T,enterDelay:v,leaveDelay:w});u(this,"_MenuType",O);u(this,"_MenuItemType",q);u(this,"_MenuToggleType",V);u(this,"_currentChild",-1);u(this,"_optionalSupport",!1);this._optionalSupport=S,$&&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){p("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_validate(){let e=super._validate();const s=p("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(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 s=b(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],r=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&o(e):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&i.includes(s)||this.elements.parentMenu&&r.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=b(e);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(o(e),this.closeChildren()):this.elements.parentMenu?(o(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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(o(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())))})}}class R extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:r=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:r}),h&&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 L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class x extends I{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:r="a",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:C=!0,parentMenu:_=null,hoverType:E="off",hoverDelay:T=250,enterDelay:v=-1,leaveDelay:w=-1,initialize:S=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:r,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:C,parentMenu:_,hoverType:E,hoverDelay:T,enterDelay:v,leaveDelay:w});u(this,"_MenuType",x);u(this,"_MenuItemType",R);u(this,"_MenuToggleType",P);S&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),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=>{this.focusState!=="none"&&(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 s=b(e);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")o(e);else if(this.isTopLevel){if(this.focusState==="self"){const n=["ArrowRight","ArrowLeft","Home","End"],i=["Space","Enter","ArrowDown","ArrowUp"],r=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&r.includes(s))&&o(e)}}else{const n=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],i=["Space","Enter"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=b(e),{altKey:n,crtlKey:i,metaKey:r}=e;if(s==="Character"&&!(n||i||r))o(e),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(e.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(o(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(s==="ArrowRight"){o(e);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){o(e);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(o(e),this.focusFirstChild()):s==="End"?(o(e),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(m=>m.isOpen)?(o(e),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(o(e),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(o(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(o(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(o(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()))):s==="ArrowDown"?(o(e),this.focusNextChild()):s==="ArrowUp"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(e){const s=e.toLowerCase();let n=this.currentChild+1,i=!1;for(;!i&&n{let s,n;const i=e.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(e)){const r=e.querySelector(this.selectors.submenuToggles),h=e.querySelector(this.selectors.submenus),c=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),m=new this._MenuToggleType({menuToggleElement:r,parentElement:e,controlledMenu:c,parentMenu:this});this._elements.submenuToggles.push(m),r!==i?(n=new this._MenuItemType({menuItemElement:e,menuLinkElement:r,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:m}),s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,submenuSibling:n})):s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:m})}else s=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this});this._elements.menuItems.push(s),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let e=super._validate();const s=D({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),e=!1);const n=p("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(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()))})}_handleHover(){this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let i=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(i=e.elements.sibling.elements.toggle),i===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{i.preview()},this.enterDelay)):i.preview()}else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||i){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let r=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(r=e.elements.sibling.elements.toggle),r===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{r.preview()},this.enterDelay)):r.preview()}}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",n=>{n.pointerType==="pen"||n.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const s=b(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],r=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&o(e):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&i.includes(s)||this.elements.parentMenu&&r.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=b(e);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(o(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(o(e),this.closeChildren()):this.elements.parentMenu?(o(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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(o(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(o(e),this.focusPreviousChild()):s==="Home"?(o(e),this.focusFirstChild()):s==="End"&&(o(e),this.focusLastChild())))})}}class Z extends A{constructor({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n=!1,childMenu:i=null,toggle:r=null,initialize:h=!0}){super({menuItemElement:t,menuLinkElement:e,parentMenu:s,isSubmenuItem:n,childMenu:i,toggle:r}),h&&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 Q extends L{constructor({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:t,parentElement:e,controlledMenu:s,parentMenu:n}),i&&this.initialize()}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-expanded")==="true"?this.open():this._collapse(!1)}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.getAttribute("aria-expanded")!=="true"&&this.dom.toggle.setAttribute("aria-expanded","false"),H("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}}class F extends I{constructor({menuElement:e,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:r="a",submenuSelector:h="ul",controllerElement:c=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:C=!0,parentMenu:_=null,hoverType:E="off",hoverDelay:T=250,enterDelay:v=-1,leaveDelay:w=-1,initialize:S=!0}){super({menuElement:e,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:r,submenuSelector:h,controllerElement:c,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:C,parentMenu:_,hoverType:E,hoverDelay:T,enterDelay:v,leaveDelay:w});u(this,"_MenuType",F);u(this,"_MenuItemType",Z);u(this,"_MenuToggleType",Q);S&&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)}}_handleHover(){this.elements.menuItems.forEach((e,s)=>{e.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0&&this._clearTimeout():this.hoverType==="dynamic"&&(this.isTopLevel||this.leaveDelay>0&&this._clearTimeout()))}),e.dom.item.addEventListener("pointerenter",n=>{n.pointerType==="pen"||n.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()})),this.isTopLevel&&this.dom.menu.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||this.hoverType==="on"&&(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.closeChildren(),this.blur()},this.leaveDelay)):(this.closeChildren(),this.blur()))})})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const s=b(e);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const n=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],i=["Enter","ArrowRight"],r=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&r.includes(s))&&o(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const s=b(e),{altKey:n,crtlKey:i,metaKey:r}=e;if(s==="Character"&&!(n||i||r))o(e),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(e.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")o(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(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")o(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.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){o(e);const c=this.elements.menuItems[this.currentChild-1];c&&c.isSubmenuItem&&c.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(o(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()):s==="ArrowLeft"?(o(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())):s==="Home"?(o(e),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(o(e),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(o(e),this.openChildren())})}focusLastNode(){const e=this.elements.menuItems.length-1,s=this.elements.menuItems[e];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=e,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(e=>e.preview())}focusNextNodeWithCharacter(e){function s(a){let d=[];return a.elements.menuItems.forEach(f=>{d.push(f),f.isSubmenuItem&&f.elements.toggle.isOpen&&(d=[...d,...s(f.elements.toggle.elements.controlledMenu)])}),d}const n=e.toLowerCase(),i=s(this.elements.rootMenu),r=i.indexOf(this.currentMenuItem)+1,h=[...i.slice(r),...i.slice(0,r)];let c=0,m=!1;for(;!m&&ce in n?F(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var r=(n,e,t)=>K(n,typeof e!="symbol"?e+"":e,t);function f(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function d(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function g(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function a(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function k(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],k(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function I(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(n,e){if(a("string",{tagName:n}).status&&g(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){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=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){a("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),q("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(f(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&d(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&f(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{d(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&f(s,this.elements.controlledMenu.dom.menu),t!==""&&d(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(f(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&d(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&f(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{d(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&f(t,this.elements.controlledMenu.dom.menu),s!==""&&d(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:o=null,toggle:l=null}){r(this,"_dom",{item:null,link:null});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});r(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=o,this._elements.toggle=l,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 y(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function h(n){n.preventDefault(),n.stopPropagation()}class b{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:o="a",submenuSelector:l="ul",controllerElement:c=null,containerElement:m=null,openClass:u="show",closeClass:C="hide",transitionClass:E="transitioning",isTopLevel:_=!0,parentMenu:M=null,hoverType:T="off",hoverDelay:v=250,enterDelay:w=-1,leaveDelay:S=-1}){r(this,"_MenuType",b);r(this,"_MenuItemType",A);r(this,"_MenuToggleType",L);r(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});r(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});r(this,"_openClass","show");r(this,"_closeClass","hide");r(this,"_transitionClass","transitioning");r(this,"_root",!0);r(this,"_currentChild",0);r(this,"_focusState","none");r(this,"_currentEvent","none");r(this,"_hoverType","off");r(this,"_hoverDelay",250);r(this,"_enterDelay",-1);r(this,"_leaveDelay",-1);r(this,"_hoverTimeout",null);r(this,"_errors",[]);this._dom.menu=e,this._dom.controller=c,this._dom.container=m,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=i,this._selectors.submenuToggles=o,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=M,this._elements.rootMenu=_?this:null,this._openClass=u||"",this._closeClass=C||"",this._transitionClass=E||"",this._root=_,this._hoverType=T,this._hoverDelay=v,this._enterDelay=w,this._leaveDelay=S}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +"use strict";var F=Object.defineProperty;var K=(n,e,t)=>e in n?F(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var r=(n,e,t)=>K(n,typeof e!="symbol"?e+"":e,t);function f(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function d(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function g(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function c(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function D(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],D(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function I(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(n,e){if(c("string",{tagName:n}).status&&g(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){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=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){c("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),q("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(f(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&d(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&f(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{d(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&f(s,this.elements.controlledMenu.dom.menu),t!==""&&d(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(f(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&d(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&f(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{d(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&f(t,this.elements.controlledMenu.dom.menu),s!==""&&d(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:o=null,toggle:l=null}){r(this,"_dom",{item:null,link:null});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});r(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=o,this._elements.toggle=l,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 y(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function h(n){n.preventDefault(),n.stopPropagation()}class b{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:o="a",submenuSelector:l="ul",controllerElement:a=null,containerElement:m=null,openClass:u="show",closeClass:C="hide",transitionClass:E="transitioning",isTopLevel:_=!0,parentMenu:M=null,hoverType:T="off",hoverDelay:v=250,enterDelay:w=-1,leaveDelay:S=-1}){r(this,"_MenuType",b);r(this,"_MenuItemType",A);r(this,"_MenuToggleType",L);r(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});r(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});r(this,"_openClass","show");r(this,"_closeClass","hide");r(this,"_transitionClass","transitioning");r(this,"_root",!0);r(this,"_currentChild",0);r(this,"_focusState","none");r(this,"_currentEvent","none");r(this,"_hoverType","off");r(this,"_hoverDelay",250);r(this,"_enterDelay",-1);r(this,"_leaveDelay",-1);r(this,"_hoverTimeout",null);r(this,"_errors",[]);this._dom.menu=e,this._dom.controller=a,this._dom.container=m,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=i,this._selectors.submenuToggles=o,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=M,this._elements.rootMenu=_?this:null,this._openClass=u||"",this._closeClass=C||"",this._transitionClass=E||"",this._root=_,this._hoverType=T,this._hoverDelay=v,this._enterDelay=w,this._leaveDelay=S}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){p({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){p({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){p({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){a("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let o=0,l=!1;for(;!l&&o=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){V({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){x({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){a("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){a("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){a("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=g(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=g(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=p({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=p({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=p({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const i=a("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const u=g(b,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const o=I({hoverType:this._hoverType});o.status||(this._errors.push(o.error.message),e=!1);const l=a("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const c=a("number",{enterDelay:this._enterDelay});c.status||(this._errors.push(c.error.message),e=!1);const m=a("number",{leaveDelay:this._leaveDelay});return m.status||(this._errors.push(m.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&g(HTMLElement,{base:t});const o=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=o:this._dom[e]=[...this._dom[e],...o]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){h(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(o=>o.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=y(e);(t==="Space"||t==="Enter")&&h(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=y(e);(t==="Space"||t==="Enter")&&(h(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 z extends A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:o=null,toggle:l=null,initialize:c=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:o,toggle:l}),c&&this.initialize()}}class H extends L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),o&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class D extends b{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:o="",submenuToggleSelector:l="button",submenuSelector:c="ul",controllerElement:m=null,containerElement:u=null,openClass:C="show",closeClass:E="hide",transitionClass:_="transitioning",isTopLevel:M=!0,parentMenu:T=null,hoverType:v="off",hoverDelay:w=250,enterDelay:S=-1,leaveDelay:$=-1,optionalKeySupport:O=!1,initialize:j=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:c,controllerElement:m,containerElement:u,openClass:C,closeClass:E,transitionClass:_,isTopLevel:M,parentMenu:T,hoverType:v,hoverDelay:w,enterDelay:S,leaveDelay:$});r(this,"_MenuType",D);r(this,"_MenuItemType",z);r(this,"_MenuToggleType",H);r(this,"_currentChild",-1);r(this,"_optionalSupport",!1);this._optionalSupport=O,j&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){a("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_validate(){let t=super._validate();const s=a("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=y(t);if(this.focusState==="self"){const i=["Space","Enter"],o=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&h(t):(this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&o.includes(s)||this.elements.parentMenu&&l.includes(s))&&h(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=y(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(h(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(o=>o.isOpen)?(h(t),this.closeChildren()):this.elements.parentMenu?(h(t),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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(h(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(h(t),this.focusPreviousChild()):s==="Home"?(h(t),this.focusFirstChild()):s==="End"&&(h(t),this.focusLastChild())))})}}module.exports=D; + - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){p({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){p({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){p({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){c("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let o=0,l=!1;for(;!l&&o=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){V({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){x({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){c("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){c("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){c("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=g(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=g(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=p({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=p({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=p({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const i=c("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const u=g(b,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const o=I({hoverType:this._hoverType});o.status||(this._errors.push(o.error.message),e=!1);const l=c("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const a=c("number",{enterDelay:this._enterDelay});a.status||(this._errors.push(a.error.message),e=!1);const m=c("number",{leaveDelay:this._leaveDelay});return m.status||(this._errors.push(m.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&g(HTMLElement,{base:t});const o=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=o:this._dom[e]=[...this._dom[e],...o]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){c("function",{callback:e}),c("number",{delay:t}),this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){h(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(o=>o.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=y(e);(t==="Space"||t==="Enter")&&h(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=y(e);(t==="Space"||t==="Enter")&&(h(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 z extends A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:o=null,toggle:l=null,initialize:a=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:o,toggle:l}),a&&this.initialize()}}class H extends L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),o&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class k extends b{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:o="li:has(ul)",submenuToggleSelector:l="button",submenuSelector:a="ul",controllerElement:m=null,containerElement:u=null,openClass:C="show",closeClass:E="hide",transitionClass:_="transitioning",isTopLevel:M=!0,parentMenu:T=null,hoverType:v="off",hoverDelay:w=250,enterDelay:S=-1,leaveDelay:$=-1,optionalKeySupport:O=!1,initialize:j=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:a,controllerElement:m,containerElement:u,openClass:C,closeClass:E,transitionClass:_,isTopLevel:M,parentMenu:T,hoverType:v,hoverDelay:w,enterDelay:S,leaveDelay:$});r(this,"_MenuType",k);r(this,"_MenuItemType",z);r(this,"_MenuToggleType",H);r(this,"_currentChild",-1);r(this,"_optionalSupport",!1);this._optionalSupport=O,j&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){c("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_validate(){let t=super._validate();const s=c("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=y(t);if(this.focusState==="self"){const i=["Space","Enter"],o=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&h(t):(this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&o.includes(s)||this.elements.parentMenu&&l.includes(s))&&h(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=y(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(h(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(o=>o.isOpen)?(h(t),this.closeChildren()):this.elements.parentMenu?(h(t),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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(h(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(h(t),this.focusPreviousChild()):s==="Home"?(h(t),this.focusFirstChild()):s==="End"&&(h(t),this.focusLastChild())))})}}module.exports=k; diff --git a/dist/disclosure-menu.es.js b/dist/disclosure-menu.es.js index 505a41ec..e01d3f88 100644 --- a/dist/disclosure-menu.es.js +++ b/dist/disclosure-menu.es.js @@ -33,7 +33,7 @@ function g(n, e) { }; } } -function a(n, e) { +function c(n, e) { try { if (typeof e != "object") { const t = typeof e; @@ -57,7 +57,7 @@ function a(n, e) { }; } } -function k(n) { +function D(n) { try { if (typeof n != "object") { const e = typeof n; @@ -110,7 +110,7 @@ function p(n) { ); else { const s = {}; - s[e] = n[e], k(s); + s[e] = n[e], D(s); } } return { @@ -178,7 +178,7 @@ function x(n) { }; } } -function D(n) { +function k(n) { try { if (typeof n != "object") { const t = typeof n; @@ -206,7 +206,7 @@ function D(n) { } } function q(n, e) { - if (a("string", { tagName: n }).status && g(HTMLElement, e).status) { + if (c("string", { tagName: n }).status && g(HTMLElement, e).status) { const t = n.toLowerCase(); let s = !0; for (const i in e) @@ -348,7 +348,7 @@ class I { return this._open; } set isOpen(e) { - a("boolean", { value: e }), this._open = e; + c("boolean", { value: e }), this._open = e; } /** * Sets unique IDs for the toggle and controlled menu. @@ -659,33 +659,33 @@ class b { /** * Constructs a new `BaseMenu`. * - * @param {object} options - The options for generating the menu. - * @param {HTMLElement} options.menuElement - The menu element in the DOM. - * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. - * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. - * @param {string} [options.submenuItemSelector] - The query selector string for menu items containing submenus. - * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. - * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. - * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. - * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. - * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". - * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". - * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. - * @param {boolean} [options.isTopLevel = false] - A flag to mark the root menu. - * @param {?BaseMenu} [options.parentMenu = null] - The parent menu to this menu. - * @param {string} [options.hoverType = off] - The type of hoverability a menu has. - * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). - * @param {number} [options.enterDelay = -1] - The delay for opening menus if the menu is hoverable (in miliseconds). - * @param {number} [options.leaveDelay = -1] - The delay for closing menus if the menu is hoverable (in miliseconds). + * @param {object} options - The options for generating the menu. + * @param {HTMLElement} options.menuElement - The menu element in the DOM. + * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. + * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. + * @param {string} [options.submenuItemSelector = li:has(ul)] - The query selector string for menu items containing submenus. + * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. + * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. + * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. + * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. + * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". + * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". + * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. + * @param {boolean} [options.isTopLevel = false] - A flag to mark the root menu. + * @param {?BaseMenu} [options.parentMenu = null] - The parent menu to this menu. + * @param {string} [options.hoverType = off] - The type of hoverability a menu has. + * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). + * @param {number} [options.enterDelay = -1] - The delay for opening menus if the menu is hoverable (in miliseconds). + * @param {number} [options.leaveDelay = -1] - The delay for closing menus if the menu is hoverable (in miliseconds). */ constructor({ menuElement: e, menuItemSelector: t = "li", menuLinkSelector: s = "a", - submenuItemSelector: i = "", + submenuItemSelector: i = "li:has(ul)", submenuToggleSelector: o = "a", submenuSelector: l = "ul", - controllerElement: c = null, + controllerElement: a = null, containerElement: m = null, openClass: u = "show", closeClass: C = "hide", @@ -890,7 +890,7 @@ class b { * @type {string[]} */ r(this, "_errors", []); - this._dom.menu = e, this._dom.controller = c, this._dom.container = m, this._selectors.menuItems = t, this._selectors.menuLinks = s, this._selectors.submenuItems = i, this._selectors.submenuToggles = o, this._selectors.submenus = l, this._elements.menuItems = [], this._elements.submenuToggles = [], this._elements.controller = null, this._elements.parentMenu = M, this._elements.rootMenu = _ ? this : null, this._openClass = u || "", this._closeClass = C || "", this._transitionClass = E || "", this._root = _, this._hoverType = T, this._hoverDelay = v, this._enterDelay = w, this._leaveDelay = S; + this._dom.menu = e, this._dom.controller = a, this._dom.container = m, this._selectors.menuItems = t, this._selectors.menuLinks = s, this._selectors.submenuItems = i, this._selectors.submenuToggles = o, this._selectors.submenus = l, this._elements.menuItems = [], this._elements.submenuToggles = [], this._elements.controller = null, this._elements.parentMenu = M, this._elements.rootMenu = _ ? this : null, this._openClass = u || "", this._closeClass = C || "", this._transitionClass = E || "", this._root = _, this._hoverType = T, this._hoverDelay = v, this._enterDelay = w, this._leaveDelay = S; } /** * Initializes the menu. @@ -1162,13 +1162,13 @@ class b { p({ transitionClass: e }), this._transitionClass !== e && (this._transitionClass = e); } set currentChild(e) { - a("number", { value: e }); + c("number", { value: e }); function t(s) { if (["mouse", "character"].includes(s.currentEvent) && s.elements.parentMenu) { let o = 0, l = !1; for (; !l && o < s.elements.parentMenu.elements.menuItems.length; ) { - const c = s.elements.parentMenu.elements.menuItems[o]; - c.isSubmenuItem && c.elements.toggle.elements.controlledMenu === s && (l = !0, s.elements.parentMenu.currentEvent = s.currentEvent, s.elements.parentMenu.currentChild = o), o++; + const a = s.elements.parentMenu.elements.menuItems[o]; + a.isSubmenuItem && a.elements.toggle.elements.controlledMenu === s && (l = !0, s.elements.parentMenu.currentEvent = s.currentEvent, s.elements.parentMenu.currentChild = o), o++; } } } @@ -1185,16 +1185,16 @@ class b { })); } set hoverType(e) { - D({ value: e }), this._hoverType !== e && (this._hoverType = e); + k({ value: e }), this._hoverType !== e && (this._hoverType = e); } set hoverDelay(e) { - a("number", { value: e }), this._hoverDelay !== e && (this._hoverDelay = e); + c("number", { value: e }), this._hoverDelay !== e && (this._hoverDelay = e); } set enterDelay(e) { - a("number", { value: e }), this._enterDelay !== e && (this._enterDelay = e); + c("number", { value: e }), this._enterDelay !== e && (this._enterDelay = e); } set leaveDelay(e) { - a("number", { value: e }), this._leaveDelay !== e && (this._leaveDelay = e); + c("number", { value: e }), this._leaveDelay !== e && (this._leaveDelay = e); } /** * Validates all aspects of the menu to ensure proper functionality. @@ -1213,13 +1213,13 @@ class b { menuElement: this._dom.menu }), t.status || (this._errors.push(t.error.message), e = !1); let s; - if (this._selectors.submenuItems !== "" ? s = k({ + if (this._selectors.submenuItems !== "" ? s = D({ menuItemSelector: this._selectors.menuItems, menuLinkSelector: this._selectors.menuLinks, submenuItemSelector: this._selectors.submenuItems, submenuToggleSelector: this._selectors.submenuToggles, submenuSelector: this._selectors.submenus - }) : s = k({ + }) : s = D({ menuItemSelector: this._selectors.menuItems, menuLinkSelector: this._selectors.menuLinks }), s.status || (this._errors.push(s.error.message), e = !1), this._openClass !== "") { @@ -1238,24 +1238,24 @@ class b { }); u.status || (this._errors.push(u.error.message), e = !1); } - const i = a("boolean", { isTopLevel: this._root }); + const i = c("boolean", { isTopLevel: this._root }); if (i.status || (this._errors.push(i.error.message), e = !1), this._elements.parentMenu !== null) { const u = g(b, { parentMenu: this._elements.parentMenu }); u.status || (this._errors.push(u.error.message), e = !1); } - const o = D({ hoverType: this._hoverType }); + const o = k({ hoverType: this._hoverType }); o.status || (this._errors.push(o.error.message), e = !1); - const l = a("number", { + const l = c("number", { hoverDelay: this._hoverDelay }); l.status || (this._errors.push(l.error.message), e = !1); - const c = a("number", { + const a = c("number", { enterDelay: this._enterDelay }); - c.status || (this._errors.push(c.error.message), e = !1); - const m = a("number", { + a.status || (this._errors.push(a.error.message), e = !1); + const m = c("number", { leaveDelay: this._leaveDelay }); return m.status || (this._errors.push(m.error.message), e = !1), e; @@ -1400,7 +1400,7 @@ class b { clearTimeout(this._hoverTimeout); } /** - * A wrapper for setTimeout that stores the timeout in the menu. + * Sets the hover timeout. * * @protected * @@ -1408,7 +1408,7 @@ class b { * @param {number} delay - The delay time in milliseconds. */ _setTimeout(e, t) { - this._hoverTimeout = setTimeout(e, t); + c("function", { callback: e }), c("number", { delay: t }), this._hoverTimeout = setTimeout(e, t); } /** * Handles focus events throughout the menu for proper menu use. @@ -1707,7 +1707,7 @@ class z extends L { isSubmenuItem: i = !1, childMenu: o = null, toggle: l = null, - initialize: c = !0 + initialize: a = !0 }) { super({ menuItemElement: e, @@ -1716,7 +1716,7 @@ class z extends L { isSubmenuItem: i, childMenu: o, toggle: l - }), c && this.initialize(); + }), a && this.initialize(); } } class H extends I { @@ -1782,34 +1782,34 @@ class A extends b { /** * Constructs a new `DisclosureMenu`. * - * @param {object} options - The options for generating the menu. - * @param {HTMLElement} options.menuElement - The menu element in the DOM. - * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. - * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. - * @param {string} [options.submenuItemSelector] - The query selector string for menu items containing submenus. - * @param {string} [options.submenuToggleSelector = button] - The query selector string for submenu toggle buttons/links. - * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. - * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. - * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. - * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". - * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". - * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. - * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. - * @param {?DisclosureMenu} [options.parentMenu = null] - The parent menu to this menu. - * @param {string} [options.hoverType = off] - The type of hoverability a menu has. - * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). - * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). - * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). - * @param {boolean} [options.optionalKeySupport = false] - A flag to add optional keyboard support (Arrow keys, Home, and End) to the menu. - * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. + * @param {object} options - The options for generating the menu. + * @param {HTMLElement} options.menuElement - The menu element in the DOM. + * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. + * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. + * @param {string} [options.submenuItemSelector = li:has(ul)] - The query selector string for menu items containing submenus. + * @param {string} [options.submenuToggleSelector = button] - The query selector string for submenu toggle buttons/links. + * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. + * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. + * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. + * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". + * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". + * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. + * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. + * @param {?DisclosureMenu} [options.parentMenu = null] - The parent menu to this menu. + * @param {string} [options.hoverType = off] - The type of hoverability a menu has. + * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). + * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). + * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). + * @param {boolean} [options.optionalKeySupport = false] - A flag to add optional keyboard support (Arrow keys, Home, and End) to the menu. + * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. */ constructor({ menuElement: t, menuItemSelector: s = "li", menuLinkSelector: i = "a", - submenuItemSelector: o = "", + submenuItemSelector: o = "li:has(ul)", submenuToggleSelector: l = "button", - submenuSelector: c = "ul", + submenuSelector: a = "ul", controllerElement: m = null, containerElement: u = null, openClass: C = "show", @@ -1830,7 +1830,7 @@ class A extends b { menuLinkSelector: i, submenuItemSelector: o, submenuToggleSelector: l, - submenuSelector: c, + submenuSelector: a, controllerElement: m, containerElement: u, openClass: C, @@ -1920,7 +1920,7 @@ class A extends b { return this.isTopLevel ? this._optionalSupport : this.elements.rootMenu.optionalKeySupport; } set optionalKeySupport(t) { - a("boolean", { optionalKeySupport: t }), this._optionalSupport = t; + c("boolean", { optionalKeySupport: t }), this._optionalSupport = t; } /** * Validates all aspects of the menu to ensure proper functionality. @@ -1931,7 +1931,7 @@ class A extends b { */ _validate() { let t = super._validate(); - const s = a("boolean", { + const s = c("boolean", { optionalKeySupport: this._optionalSupport }); return s.status || (this._errors.push(s.error.message), t = !1), t; diff --git a/dist/disclosure-menu.iife.js b/dist/disclosure-menu.iife.js index 20b66470..caca0442 100644 --- a/dist/disclosure-menu.iife.js +++ b/dist/disclosure-menu.iife.js @@ -1,3 +1,3 @@ -var DisclosureMenu=function(){"use strict";var z=Object.defineProperty;var H=(a,h,d)=>h in a?z(a,h,{enumerable:!0,configurable:!0,writable:!0,value:d}):a[h]=d;var r=(a,h,d)=>H(a,typeof h!="symbol"?h+"":h,d);function a(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function h(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function d(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function m(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function C(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],C(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function O(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function I(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(n,e){if(m("string",{tagName:n}).status&&d(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){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=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){m("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),j("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(a(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&h(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&a(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{h(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&a(s,this.elements.controlledMenu.dom.menu),t!==""&&h(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(a(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&h(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&a(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{h(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&a(t,this.elements.controlledMenu.dom.menu),s!==""&&h(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:o=null,toggle:l=null}){r(this,"_dom",{item:null,link:null});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});r(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=o,this._elements.toggle=l,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 _(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function c(n){n.preventDefault(),n.stopPropagation()}class y{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:o="a",submenuSelector:l="ul",controllerElement:f=null,containerElement:g=null,openClass:u="show",closeClass:M="hide",transitionClass:T="transitioning",isTopLevel:b=!0,parentMenu:v=null,hoverType:w="off",hoverDelay:S=250,enterDelay:D=-1,leaveDelay:k=-1}){r(this,"_MenuType",y);r(this,"_MenuItemType",A);r(this,"_MenuToggleType",L);r(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});r(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});r(this,"_openClass","show");r(this,"_closeClass","hide");r(this,"_transitionClass","transitioning");r(this,"_root",!0);r(this,"_currentChild",0);r(this,"_focusState","none");r(this,"_currentEvent","none");r(this,"_hoverType","off");r(this,"_hoverDelay",250);r(this,"_enterDelay",-1);r(this,"_leaveDelay",-1);r(this,"_hoverTimeout",null);r(this,"_errors",[]);this._dom.menu=e,this._dom.controller=f,this._dom.container=g,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=i,this._selectors.submenuToggles=o,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=v,this._elements.rootMenu=b?this:null,this._openClass=u||"",this._closeClass=M||"",this._transitionClass=T||"",this._root=b,this._hoverType=w,this._hoverDelay=S,this._enterDelay=D,this._leaveDelay=k}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +var DisclosureMenu=function(){"use strict";var z=Object.defineProperty;var H=(m,h,d)=>h in m?z(m,h,{enumerable:!0,configurable:!0,writable:!0,value:d}):m[h]=d;var r=(m,h,d)=>H(m,typeof h!="symbol"?h+"":h,d);function m(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function h(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function d(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function c(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function C(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],C(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function O(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function I(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(n,e){if(c("string",{tagName:n}).status&&d(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){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=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){c("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),j("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(m(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&h(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&m(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{h(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&m(s,this.elements.controlledMenu.dom.menu),t!==""&&h(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(m(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&h(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&m(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{h(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&m(t,this.elements.controlledMenu.dom.menu),s!==""&&h(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:o=null,toggle:l=null}){r(this,"_dom",{item:null,link:null});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});r(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=o,this._elements.toggle=l,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 _(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function a(n){n.preventDefault(),n.stopPropagation()}class y{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:o="a",submenuSelector:l="ul",controllerElement:f=null,containerElement:g=null,openClass:u="show",closeClass:M="hide",transitionClass:T="transitioning",isTopLevel:b=!0,parentMenu:v=null,hoverType:w="off",hoverDelay:S=250,enterDelay:D=-1,leaveDelay:k=-1}){r(this,"_MenuType",y);r(this,"_MenuItemType",A);r(this,"_MenuToggleType",L);r(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});r(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});r(this,"_openClass","show");r(this,"_closeClass","hide");r(this,"_transitionClass","transitioning");r(this,"_root",!0);r(this,"_currentChild",0);r(this,"_focusState","none");r(this,"_currentEvent","none");r(this,"_hoverType","off");r(this,"_hoverDelay",250);r(this,"_enterDelay",-1);r(this,"_leaveDelay",-1);r(this,"_hoverTimeout",null);r(this,"_errors",[]);this._dom.menu=e,this._dom.controller=f,this._dom.container=g,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=i,this._selectors.submenuToggles=o,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=v,this._elements.rootMenu=b?this:null,this._openClass=u||"",this._closeClass=M||"",this._transitionClass=T||"",this._root=b,this._hoverType=w,this._hoverDelay=S,this._enterDelay=D,this._leaveDelay=k}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){p({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){p({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){p({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){m("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let o=0,l=!1;for(;!l&&o=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){$({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){O({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){m("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){m("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){m("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=d(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=d(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=C({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=C({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=p({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=p({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=p({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const i=m("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const u=d(y,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const o=I({hoverType:this._hoverType});o.status||(this._errors.push(o.error.message),e=!1);const l=m("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const f=m("number",{enterDelay:this._enterDelay});f.status||(this._errors.push(f.error.message),e=!1);const g=m("number",{leaveDelay:this._leaveDelay});return g.status||(this._errors.push(g.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&d(HTMLElement,{base:t});const o=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=o:this._dom[e]=[...this._dom[e],...o]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){c(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(o=>o.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&c(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&(c(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 F extends A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:o=null,toggle:l=null,initialize:f=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:o,toggle:l}),f&&this.initialize()}}class K extends L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),o&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class E extends y{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:o="",submenuToggleSelector:l="button",submenuSelector:f="ul",controllerElement:g=null,containerElement:u=null,openClass:M="show",closeClass:T="hide",transitionClass:b="transitioning",isTopLevel:v=!0,parentMenu:w=null,hoverType:S="off",hoverDelay:D=250,enterDelay:k=-1,leaveDelay:V=-1,optionalKeySupport:x=!1,initialize:q=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:f,controllerElement:g,containerElement:u,openClass:M,closeClass:T,transitionClass:b,isTopLevel:v,parentMenu:w,hoverType:S,hoverDelay:D,enterDelay:k,leaveDelay:V});r(this,"_MenuType",E);r(this,"_MenuItemType",F);r(this,"_MenuToggleType",K);r(this,"_currentChild",-1);r(this,"_optionalSupport",!1);this._optionalSupport=x,q&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){m("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_validate(){let t=super._validate();const s=m("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=_(t);if(this.focusState==="self"){const i=["Space","Enter"],o=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&c(t):(this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&o.includes(s)||this.elements.parentMenu&&l.includes(s))&&c(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=_(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(c(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(o=>o.isOpen)?(c(t),this.closeChildren()):this.elements.parentMenu?(c(t),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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(c(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(c(t),this.focusPreviousChild()):s==="Home"?(c(t),this.focusFirstChild()):s==="End"&&(c(t),this.focusLastChild())))})}}return E}(); + - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){p({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){p({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){p({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){c("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let o=0,l=!1;for(;!l&&o=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){$({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){O({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){c("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){c("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){c("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=d(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=d(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=C({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=C({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=p({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=p({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=p({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const i=c("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const u=d(y,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const o=I({hoverType:this._hoverType});o.status||(this._errors.push(o.error.message),e=!1);const l=c("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const f=c("number",{enterDelay:this._enterDelay});f.status||(this._errors.push(f.error.message),e=!1);const g=c("number",{leaveDelay:this._leaveDelay});return g.status||(this._errors.push(g.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&d(HTMLElement,{base:t});const o=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=o:this._dom[e]=[...this._dom[e],...o]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){c("function",{callback:e}),c("number",{delay:t}),this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){a(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(o=>o.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&a(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&(a(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 F extends A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:o=null,toggle:l=null,initialize:f=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:o,toggle:l}),f&&this.initialize()}}class K extends L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),o&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class E extends y{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:o="li:has(ul)",submenuToggleSelector:l="button",submenuSelector:f="ul",controllerElement:g=null,containerElement:u=null,openClass:M="show",closeClass:T="hide",transitionClass:b="transitioning",isTopLevel:v=!0,parentMenu:w=null,hoverType:S="off",hoverDelay:D=250,enterDelay:k=-1,leaveDelay:V=-1,optionalKeySupport:x=!1,initialize:q=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:f,controllerElement:g,containerElement:u,openClass:M,closeClass:T,transitionClass:b,isTopLevel:v,parentMenu:w,hoverType:S,hoverDelay:D,enterDelay:k,leaveDelay:V});r(this,"_MenuType",E);r(this,"_MenuItemType",F);r(this,"_MenuToggleType",K);r(this,"_currentChild",-1);r(this,"_optionalSupport",!1);this._optionalSupport=x,q&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){c("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_validate(){let t=super._validate();const s=c("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=_(t);if(this.focusState==="self"){const i=["Space","Enter"],o=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&a(t):(this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&o.includes(s)||this.elements.parentMenu&&l.includes(s))&&a(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=_(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(a(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(o=>o.isOpen)?(a(t),this.closeChildren()):this.elements.parentMenu?(a(t),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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(a(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(a(t),this.focusPreviousChild()):s==="Home"?(a(t),this.focusFirstChild()):s==="End"&&(a(t),this.focusLastChild())))})}}return E}(); diff --git a/dist/menubar.cjs.js b/dist/menubar.cjs.js index 87dc00e4..48034826 100644 --- a/dist/menubar.cjs.js +++ b/dist/menubar.cjs.js @@ -1,3 +1,3 @@ -"use strict";var x=Object.defineProperty;var F=(n,e,t)=>e in n?x(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>F(n,typeof e!="symbol"?e+"":e,t);function d(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function f(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function g(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function a(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function k(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],k(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function A(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(n,e){if(a("string",{tagName:n}).status&&g(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class D{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){a("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),V("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(d(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&f(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&d(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{f(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&d(s,this.elements.controlledMenu.dom.menu),t!==""&&f(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(d(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&f(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&d(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{f(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&d(t,this.elements.controlledMenu.dom.menu),s!==""&&f(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class L{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,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 _(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function u(n){n.preventDefault(),n.stopPropagation()}class M{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:m=null,containerElement:c=null,openClass:h="show",closeClass:C="hide",transitionClass:b="transitioning",isTopLevel:y=!0,parentMenu:E=null,hoverType:T="off",hoverDelay:v=250,enterDelay:w=-1,leaveDelay:I=-1}){o(this,"_MenuType",M);o(this,"_MenuItemType",L);o(this,"_MenuToggleType",D);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=m,this._dom.container=c,this._selectors.menuItems=t,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=E,this._elements.rootMenu=y?this:null,this._openClass=h||"",this._closeClass=C||"",this._transitionClass=b||"",this._root=y,this._hoverType=T,this._hoverDelay=v,this._enterDelay=w,this._leaveDelay=I}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +"use strict";var x=Object.defineProperty;var F=(n,e,t)=>e in n?x(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>F(n,typeof e!="symbol"?e+"":e,t);function d(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function f(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function g(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function c(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function k(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function p(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],k(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function A(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(n,e){if(c("string",{tagName:n}).status&&g(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class D{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){c("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),V("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(d(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&f(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&d(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{f(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&d(s,this.elements.controlledMenu.dom.menu),t!==""&&f(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(d(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&f(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&d(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{f(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&d(t,this.elements.controlledMenu.dom.menu),s!==""&&f(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class L{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,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 _(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function u(n){n.preventDefault(),n.stopPropagation()}class M{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:m=null,containerElement:a=null,openClass:h="show",closeClass:C="hide",transitionClass:b="transitioning",isTopLevel:y=!0,parentMenu:E=null,hoverType:T="off",hoverDelay:v=250,enterDelay:w=-1,leaveDelay:I=-1}){o(this,"_MenuType",M);o(this,"_MenuItemType",L);o(this,"_MenuToggleType",D);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=m,this._dom.container=a,this._selectors.menuItems=t,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=E,this._elements.rootMenu=y?this:null,this._openClass=h||"",this._closeClass=C||"",this._transitionClass=b||"",this._root=y,this._hoverType=T,this._hoverDelay=v,this._enterDelay=w,this._leaveDelay=I}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){p({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){p({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){p({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){a("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){j({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){q({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){A({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){a("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){a("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){a("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=g(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=g(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const h=p({openClass:this._openClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._closeClass!==""){const h=p({closeClass:this._closeClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._transitionClass!==""){const h=p({transitionClass:this._transitionClass});h.status||(this._errors.push(h.error.message),e=!1)}const i=a("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const h=g(M,{parentMenu:this._elements.parentMenu});h.status||(this._errors.push(h.error.message),e=!1)}const r=A({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=a("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const m=a("number",{enterDelay:this._enterDelay});m.status||(this._errors.push(m.error.message),e=!1);const c=a("number",{leaveDelay:this._leaveDelay});return c.status||(this._errors.push(c.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&g(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){u(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&u(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&(u(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 z extends L{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null,initialize:m=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:l}),m&&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 H extends D{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class S extends M{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="",submenuToggleSelector:l="a",submenuSelector:m="ul",controllerElement:c=null,containerElement:h=null,openClass:C="show",closeClass:b="hide",transitionClass:y="transitioning",isTopLevel:E=!0,parentMenu:T=null,hoverType:v="off",hoverDelay:w=250,enterDelay:I=-1,leaveDelay:$=-1,initialize:O=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:m,controllerElement:c,containerElement:h,openClass:C,closeClass:b,transitionClass:y,isTopLevel:E,parentMenu:T,hoverType:v,hoverDelay:w,enterDelay:I,leaveDelay:$});o(this,"_MenuType",S);o(this,"_MenuItemType",z);o(this,"_MenuToggleType",H);O&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(t){console.error(t)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=_(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")u(t);else if(this.isTopLevel){if(this.focusState==="self"){const i=["ArrowRight","ArrowLeft","Home","End"],r=["Space","Enter","ArrowDown","ArrowUp"],l=["Escape"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&u(t)}}else{const i=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],r=["Space","Enter"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s))&&u(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=_(t),{altKey:i,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(i||r||l))u(t),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(t.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click();else if(s==="ArrowRight"){u(t);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){u(t);const c=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),c&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(u(t),this.focusFirstChild()):s==="End"?(u(t),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(h=>h.isOpen)?(u(t),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(u(t),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(u(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(u(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(u(t),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()))):s==="ArrowDown"?(u(t),this.focusNextChild()):s==="ArrowUp"?(u(t),this.focusPreviousChild()):s==="Home"?(u(t),this.focusFirstChild()):s==="End"&&(u(t),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(t){const s=t.toLowerCase();let i=this.currentChild+1,r=!1;for(;!r&&i=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){j({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){q({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){A({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){c("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){c("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){c("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=g(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=g(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const h=p({openClass:this._openClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._closeClass!==""){const h=p({closeClass:this._closeClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._transitionClass!==""){const h=p({transitionClass:this._transitionClass});h.status||(this._errors.push(h.error.message),e=!1)}const i=c("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const h=g(M,{parentMenu:this._elements.parentMenu});h.status||(this._errors.push(h.error.message),e=!1)}const r=A({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=c("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const m=c("number",{enterDelay:this._enterDelay});m.status||(this._errors.push(m.error.message),e=!1);const a=c("number",{leaveDelay:this._leaveDelay});return a.status||(this._errors.push(a.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&g(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){c("function",{callback:e}),c("number",{delay:t}),this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){u(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&u(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&(u(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 z extends L{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null,initialize:m=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:l}),m&&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 H extends D{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class S extends M{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="li:has(ul)",submenuToggleSelector:l="a",submenuSelector:m="ul",controllerElement:a=null,containerElement:h=null,openClass:C="show",closeClass:b="hide",transitionClass:y="transitioning",isTopLevel:E=!0,parentMenu:T=null,hoverType:v="off",hoverDelay:w=250,enterDelay:I=-1,leaveDelay:$=-1,initialize:O=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:m,controllerElement:a,containerElement:h,openClass:C,closeClass:b,transitionClass:y,isTopLevel:E,parentMenu:T,hoverType:v,hoverDelay:w,enterDelay:I,leaveDelay:$});o(this,"_MenuType",S);o(this,"_MenuItemType",z);o(this,"_MenuToggleType",H);O&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(t){console.error(t)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=_(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")u(t);else if(this.isTopLevel){if(this.focusState==="self"){const i=["ArrowRight","ArrowLeft","Home","End"],r=["Space","Enter","ArrowDown","ArrowUp"],l=["Escape"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&u(t)}}else{const i=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],r=["Space","Enter"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s))&&u(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=_(t),{altKey:i,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(i||r||l))u(t),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(t.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click();else if(s==="ArrowRight"){u(t);const a=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),a&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){u(t);const a=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),a&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(u(t),this.focusFirstChild()):s==="End"?(u(t),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(h=>h.isOpen)?(u(t),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(u(t),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(u(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(u(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(u(t),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()))):s==="ArrowDown"?(u(t),this.focusNextChild()):s==="ArrowUp"?(u(t),this.focusPreviousChild()):s==="Home"?(u(t),this.focusFirstChild()):s==="End"&&(u(t),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(t){const s=t.toLowerCase();let i=this.currentChild+1,r=!1;for(;!r&&i { this.currentMenuItem.elements.childMenu.focusFirstChild(); })) : s === "ArrowUp" ? this.currentMenuItem.isSubmenuItem && (u(t), this.currentMenuItem.elements.childMenu.currentEvent = "keyboard", this.currentMenuItem.elements.toggle.open(), requestAnimationFrame(() => { diff --git a/dist/menubar.iife.js b/dist/menubar.iife.js index 9fc53a77..c1cc2c54 100644 --- a/dist/menubar.iife.js +++ b/dist/menubar.iife.js @@ -1,3 +1,3 @@ -var Menubar=function(){"use strict";var z=Object.defineProperty;var H=(c,m,f)=>m in c?z(c,m,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[m]=f;var o=(c,m,f)=>H(c,typeof m!="symbol"?m+"":m,f);function c(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function m(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function f(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function p(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function C(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],C(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function O(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function A(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(n,e){if(p("string",{tagName:n}).status&&f(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class D{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){p("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),x("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(c(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&m(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&c(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&c(s,this.elements.controlledMenu.dom.menu),t!==""&&m(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&m(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&c(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&c(t,this.elements.controlledMenu.dom.menu),s!==""&&m(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class L{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:u=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=u,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 y(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function l(n){n.preventDefault(),n.stopPropagation()}class _{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:r="a",submenuSelector:u="ul",controllerElement:a=null,containerElement:d=null,openClass:h="show",closeClass:E="hide",transitionClass:T="transitioning",isTopLevel:M=!0,parentMenu:v=null,hoverType:w="off",hoverDelay:I=250,enterDelay:k=-1,leaveDelay:S=-1}){o(this,"_MenuType",_);o(this,"_MenuItemType",L);o(this,"_MenuToggleType",D);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=a,this._dom.container=d,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=i,this._selectors.submenuToggles=r,this._selectors.submenus=u,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=v,this._elements.rootMenu=M?this:null,this._openClass=h||"",this._closeClass=E||"",this._transitionClass=T||"",this._root=M,this._hoverType=w,this._hoverDelay=I,this._enterDelay=k,this._leaveDelay=S}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +var Menubar=function(){"use strict";var z=Object.defineProperty;var H=(c,m,p)=>m in c?z(c,m,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[m]=p;var o=(c,m,p)=>H(c,typeof m!="symbol"?m+"":m,p);function c(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function m(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function p(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function a(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function C(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],C(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function O(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function A(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(n,e){if(a("string",{tagName:n}).status&&p(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class D{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){a("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),x("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(c(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&m(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&c(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&c(s,this.elements.controlledMenu.dom.menu),t!==""&&m(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&m(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&c(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&c(t,this.elements.controlledMenu.dom.menu),s!==""&&m(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class L{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:u=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=u,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 y(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function l(n){n.preventDefault(),n.stopPropagation()}class _{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:r="a",submenuSelector:u="ul",controllerElement:f=null,containerElement:d=null,openClass:h="show",closeClass:E="hide",transitionClass:T="transitioning",isTopLevel:M=!0,parentMenu:v=null,hoverType:w="off",hoverDelay:I=250,enterDelay:k=-1,leaveDelay:S=-1}){o(this,"_MenuType",_);o(this,"_MenuItemType",L);o(this,"_MenuToggleType",D);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=f,this._dom.container=d,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=i,this._selectors.submenuToggles=r,this._selectors.submenus=u,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=v,this._elements.rootMenu=M?this:null,this._openClass=h||"",this._closeClass=E||"",this._transitionClass=T||"",this._root=M,this._hoverType=w,this._hoverDelay=I,this._enterDelay=k,this._leaveDelay=S}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){g({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){g({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){g({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){p("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,u=!1;for(;!u&&r=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){$({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){O({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){A({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){p("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){p("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){p("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=f(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=f(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=C({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=C({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const h=g({openClass:this._openClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._closeClass!==""){const h=g({closeClass:this._closeClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._transitionClass!==""){const h=g({transitionClass:this._transitionClass});h.status||(this._errors.push(h.error.message),e=!1)}const i=p("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const h=f(_,{parentMenu:this._elements.parentMenu});h.status||(this._errors.push(h.error.message),e=!1)}const r=A({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const u=p("number",{hoverDelay:this._hoverDelay});u.status||(this._errors.push(u.error.message),e=!1);const a=p("number",{enterDelay:this._enterDelay});a.status||(this._errors.push(a.error.message),e=!1);const d=p("number",{leaveDelay:this._leaveDelay});return d.status||(this._errors.push(d.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&f(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(u=>u.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),u=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(u),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:u})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){l(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=y(e);(t==="Space"||t==="Enter")&&l(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=y(e);(t==="Space"||t==="Enter")&&(l(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 F extends L{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:u=null,initialize:a=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:u}),a&&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 j extends D{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class b extends _{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="",submenuToggleSelector:u="a",submenuSelector:a="ul",controllerElement:d=null,containerElement:h=null,openClass:E="show",closeClass:T="hide",transitionClass:M="transitioning",isTopLevel:v=!0,parentMenu:w=null,hoverType:I="off",hoverDelay:k=250,enterDelay:S=-1,leaveDelay:q=-1,initialize:V=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuToggleSelector:u,submenuSelector:a,controllerElement:d,containerElement:h,openClass:E,closeClass:T,transitionClass:M,isTopLevel:v,parentMenu:w,hoverType:I,hoverDelay:k,enterDelay:S,leaveDelay:q});o(this,"_MenuType",b);o(this,"_MenuItemType",F);o(this,"_MenuToggleType",j);V&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(t){console.error(t)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=y(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")l(t);else if(this.isTopLevel){if(this.focusState==="self"){const i=["ArrowRight","ArrowLeft","Home","End"],r=["Space","Enter","ArrowDown","ArrowUp"],u=["Escape"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&u.includes(s))&&l(t)}}else{const i=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],r=["Space","Enter"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s))&&l(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=y(t),{altKey:i,crtlKey:r,metaKey:u}=t;if(s==="Character"&&!(i||r||u))l(t),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(t.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click();else if(s==="ArrowRight"){l(t);const d=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),d&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){l(t);const d=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),d&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(l(t),this.focusFirstChild()):s==="End"?(l(t),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(h=>h.isOpen)?(l(t),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(l(t),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(l(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(l(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(l(t),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()))):s==="ArrowDown"?(l(t),this.focusNextChild()):s==="ArrowUp"?(l(t),this.focusPreviousChild()):s==="Home"?(l(t),this.focusFirstChild()):s==="End"&&(l(t),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(t){const s=t.toLowerCase();let i=this.currentChild+1,r=!1;for(;!r&&i=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){$({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){O({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){A({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){a("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){a("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){a("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=p(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=p(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=C({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=C({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const h=g({openClass:this._openClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._closeClass!==""){const h=g({closeClass:this._closeClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._transitionClass!==""){const h=g({transitionClass:this._transitionClass});h.status||(this._errors.push(h.error.message),e=!1)}const i=a("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const h=p(_,{parentMenu:this._elements.parentMenu});h.status||(this._errors.push(h.error.message),e=!1)}const r=A({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const u=a("number",{hoverDelay:this._hoverDelay});u.status||(this._errors.push(u.error.message),e=!1);const f=a("number",{enterDelay:this._enterDelay});f.status||(this._errors.push(f.error.message),e=!1);const d=a("number",{leaveDelay:this._leaveDelay});return d.status||(this._errors.push(d.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&p(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(u=>u.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),u=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(u),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:u})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){a("function",{callback:e}),a("number",{delay:t}),this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){l(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=y(e);(t==="Space"||t==="Enter")&&l(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=y(e);(t==="Space"||t==="Enter")&&(l(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 F extends L{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:u=null,initialize:f=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:u}),f&&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 j extends D{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class b extends _{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="li:has(ul)",submenuToggleSelector:u="a",submenuSelector:f="ul",controllerElement:d=null,containerElement:h=null,openClass:E="show",closeClass:T="hide",transitionClass:M="transitioning",isTopLevel:v=!0,parentMenu:w=null,hoverType:I="off",hoverDelay:k=250,enterDelay:S=-1,leaveDelay:q=-1,initialize:V=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuToggleSelector:u,submenuSelector:f,controllerElement:d,containerElement:h,openClass:E,closeClass:T,transitionClass:M,isTopLevel:v,parentMenu:w,hoverType:I,hoverDelay:k,enterDelay:S,leaveDelay:q});o(this,"_MenuType",b);o(this,"_MenuItemType",F);o(this,"_MenuToggleType",j);V&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(t){console.error(t)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=y(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")l(t);else if(this.isTopLevel){if(this.focusState==="self"){const i=["ArrowRight","ArrowLeft","Home","End"],r=["Space","Enter","ArrowDown","ArrowUp"],u=["Escape"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&u.includes(s))&&l(t)}}else{const i=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],r=["Space","Enter"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s))&&l(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=y(t),{altKey:i,crtlKey:r,metaKey:u}=t;if(s==="Character"&&!(i||r||u))l(t),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(t.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click();else if(s==="ArrowRight"){l(t);const d=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),d&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){l(t);const d=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),d&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(l(t),this.focusFirstChild()):s==="End"?(l(t),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(h=>h.isOpen)?(l(t),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(l(t),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(l(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(l(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(l(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(l(t),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()))):s==="ArrowDown"?(l(t),this.focusNextChild()):s==="ArrowUp"?(l(t),this.focusPreviousChild()):s==="Home"?(l(t),this.focusFirstChild()):s==="End"&&(l(t),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(t){const s=t.toLowerCase();let i=this.currentChild+1,r=!1;for(;!r&&ie in n?K(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>V(n,typeof e!="symbol"?e+"":e,t);function f(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function p(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function g(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function a(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function _(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function d(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],_(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function L(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function z(n,e){if(a("string",{tagName:n}).status&&g(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class I{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){a("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),z("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(f(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&p(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&f(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{p(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&f(s,this.elements.controlledMenu.dom.menu),t!==""&&p(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(f(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&p(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&f(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{p(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&f(t,this.elements.controlledMenu.dom.menu),s!==""&&p(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,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 b(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function m(n){n.preventDefault(),n.stopPropagation()}class C{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:h=null,containerElement:c=null,openClass:u="show",closeClass:T="hide",transitionClass:E="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:v="off",hoverDelay:w=250,enterDelay:S=-1,leaveDelay:D=-1}){o(this,"_MenuType",C);o(this,"_MenuItemType",A);o(this,"_MenuToggleType",I);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=h,this._dom.container=c,this._selectors.menuItems=t,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=M,this._elements.rootMenu=y?this:null,this._openClass=u||"",this._closeClass=T||"",this._transitionClass=E||"",this._root=y,this._hoverType=v,this._hoverDelay=w,this._enterDelay=S,this._leaveDelay=D}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +"use strict";var K=Object.defineProperty;var V=(n,e,t)=>e in n?K(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>V(n,typeof e!="symbol"?e+"":e,t);function f(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function p(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function g(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function c(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function _(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function d(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],_(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function L(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function z(n,e){if(c("string",{tagName:n}).status&&g(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class I{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){c("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),z("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(f(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&p(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&f(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{p(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&f(s,this.elements.controlledMenu.dom.menu),t!==""&&p(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(f(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&p(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&f(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{p(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&f(t,this.elements.controlledMenu.dom.menu),s!==""&&p(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,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 b(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function m(n){n.preventDefault(),n.stopPropagation()}class C{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:h=null,containerElement:a=null,openClass:u="show",closeClass:T="hide",transitionClass:E="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:v="off",hoverDelay:w=250,enterDelay:S=-1,leaveDelay:D=-1}){o(this,"_MenuType",C);o(this,"_MenuItemType",A);o(this,"_MenuToggleType",I);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=h,this._dom.container=a,this._selectors.menuItems=t,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=M,this._elements.rootMenu=y?this:null,this._openClass=u||"",this._closeClass=T||"",this._transitionClass=E||"",this._root=y,this._hoverType=v,this._hoverDelay=w,this._enterDelay=S,this._leaveDelay=D}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){d({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){d({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){d({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){a("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){q({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){x({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){L({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){a("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){a("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){a("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=g(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=g(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=_({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=_({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=d({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=d({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=d({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const i=a("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const u=g(C,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const r=L({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=a("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const h=a("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),e=!1);const c=a("number",{leaveDelay:this._leaveDelay});return c.status||(this._errors.push(c.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&g(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){m(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=b(e);(t==="Space"||t==="Enter")&&m(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=b(e);(t==="Space"||t==="Enter")&&(m(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 H extends A{constructor({menuItemElement:t,menuLinkElement:s,parentMenu:i,isSubmenuItem:r=!1,childMenu:l=null,toggle:h=null,initialize:c=!0,submenuSibling:u=null}){super({menuItemElement:t,menuLinkElement:s,parentMenu:i,isSubmenuItem:r,childMenu:l,toggle:h});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null,sibling:null});this._elements.parentMenu=i,this._elements.childMenu=l,this._elements.toggle=h,this._elements.sibling=u,c&&this.initialize()}}class R extends I{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class k extends C{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="",submenuToggleSelector:l="button",submenuSelector:h="ul",submenuSubtoggleSelector:c="a",controllerElement:u=null,containerElement:T=null,openClass:E="show",closeClass:y="hide",transitionClass:M="transitioning",isTopLevel:v=!0,parentMenu:w=null,hoverType:S="off",hoverDelay:D=250,enterDelay:$=-1,leaveDelay:O=-1,optionalKeySupport:j=!1,initialize:F=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuSelector:h,submenuToggleSelector:l,controllerElement:u,containerElement:T,openClass:E,closeClass:y,transitionClass:M,isTopLevel:v,parentMenu:w,hoverType:S,hoverDelay:D,enterDelay:$,leaveDelay:O});o(this,"_MenuType",k);o(this,"_MenuItemType",H);o(this,"_MenuToggleType",R);o(this,"_currentChild",-1);o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:"",submenuSubtoggles:""});o(this,"_optionalSupport",!1);this._optionalSupport=j,this._selectors.menuItems=s,this._selectors.submenuItems=r,this._selectors.submenuToggles=l,this._selectors.submenus=h,this._selectors.submenuSubtoggles=c,this._selectors.menuLinks=[...new Set([i,l])].join(","),F&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){a("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_createChildElements(){this.dom.menuItems.forEach(t=>{let s,i;const r=t.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(t)){const l=t.querySelector(this.selectors.submenuToggles),h=t.querySelector(this.selectors.submenus),c=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),u=new this._MenuToggleType({menuToggleElement:l,parentElement:t,controlledMenu:c,parentMenu:this});this._elements.submenuToggles.push(u),l!==r?(i=new this._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:u}),s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this,submenuSibling:i})):s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:u})}else s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this});this._elements.menuItems.push(s),typeof i<"u"&&this._elements.menuItems.push(i)})}_validate(){let t=super._validate();const s=_({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),t=!1);const i=a("boolean",{optionalKeySupport:this._optionalSupport});return i.status||(this._errors.push(i.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleHover(){this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerenter",i=>{if(!(i.pointerType==="pen"||i.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let r=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(r=t.elements.sibling.elements.toggle),r===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{r.preview()},this.enterDelay)):r.preview()}else if(this.hoverType==="dynamic"){const r=this.elements.submenuToggles.some(l=>l.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||r){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let l=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(l=t.elements.sibling.elements.toggle),l===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{l.preview()},this.enterDelay)):l.preview()}}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",i=>{i.pointerType==="pen"||i.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))}),t.dom.item.addEventListener("pointerenter",i=>{i.pointerType==="pen"||i.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=b(t);if(this.focusState==="self"){const i=["Space","Enter"],r=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&m(t):(this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&r.includes(s)||this.elements.parentMenu&&l.includes(s))&&m(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=b(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(m(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(r=>r.isOpen)?(m(t),this.closeChildren()):this.elements.parentMenu?(m(t),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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(m(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(m(t),this.focusPreviousChild()):s==="Home"?(m(t),this.focusFirstChild()):s==="End"&&(m(t),this.focusLastChild())))})}}module.exports=k; + - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){d({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){d({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){d({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){c("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){q({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){x({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){L({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){c("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){c("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){c("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=g(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=g(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=_({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=_({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=d({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=d({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=d({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const i=c("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const u=g(C,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const r=L({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=c("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const h=c("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),e=!1);const a=c("number",{leaveDelay:this._leaveDelay});return a.status||(this._errors.push(a.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&g(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){c("function",{callback:e}),c("number",{delay:t}),this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){m(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=b(e);(t==="Space"||t==="Enter")&&m(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=b(e);(t==="Space"||t==="Enter")&&(m(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 H extends A{constructor({menuItemElement:t,menuLinkElement:s,parentMenu:i,isSubmenuItem:r=!1,childMenu:l=null,toggle:h=null,initialize:a=!0,submenuSibling:u=null}){super({menuItemElement:t,menuLinkElement:s,parentMenu:i,isSubmenuItem:r,childMenu:l,toggle:h});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null,sibling:null});this._elements.parentMenu=i,this._elements.childMenu=l,this._elements.toggle=h,this._elements.sibling=u,a&&this.initialize()}}class R extends I{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class k extends C{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="li:has(ul)",submenuToggleSelector:l="button",submenuSelector:h="ul",submenuSubtoggleSelector:a="a",controllerElement:u=null,containerElement:T=null,openClass:E="show",closeClass:y="hide",transitionClass:M="transitioning",isTopLevel:v=!0,parentMenu:w=null,hoverType:S="off",hoverDelay:D=250,enterDelay:$=-1,leaveDelay:O=-1,optionalKeySupport:j=!1,initialize:F=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuSelector:h,submenuToggleSelector:l,controllerElement:u,containerElement:T,openClass:E,closeClass:y,transitionClass:M,isTopLevel:v,parentMenu:w,hoverType:S,hoverDelay:D,enterDelay:$,leaveDelay:O});o(this,"_MenuType",k);o(this,"_MenuItemType",H);o(this,"_MenuToggleType",R);o(this,"_currentChild",-1);o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:"",submenuSubtoggles:""});o(this,"_optionalSupport",!1);this._optionalSupport=j,this._selectors.menuItems=s,this._selectors.submenuItems=r,this._selectors.submenuToggles=l,this._selectors.submenus=h,this._selectors.submenuSubtoggles=a,this._selectors.menuLinks=[...new Set([i,l])].join(","),F&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){c("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_createChildElements(){this.dom.menuItems.forEach(t=>{let s,i;const r=t.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(t)){const l=t.querySelector(this.selectors.submenuToggles),h=t.querySelector(this.selectors.submenus),a=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),u=new this._MenuToggleType({menuToggleElement:l,parentElement:t,controlledMenu:a,parentMenu:this});this._elements.submenuToggles.push(u),l!==r?(i=new this._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:this,isSubmenuItem:!0,childMenu:a,toggle:u}),s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this,submenuSibling:i})):s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this,isSubmenuItem:!0,childMenu:a,toggle:u})}else s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this});this._elements.menuItems.push(s),typeof i<"u"&&this._elements.menuItems.push(i)})}_validate(){let t=super._validate();const s=_({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),t=!1);const i=c("boolean",{optionalKeySupport:this._optionalSupport});return i.status||(this._errors.push(i.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleHover(){this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerenter",i=>{if(!(i.pointerType==="pen"||i.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let r=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(r=t.elements.sibling.elements.toggle),r===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{r.preview()},this.enterDelay)):r.preview()}else if(this.hoverType==="dynamic"){const r=this.elements.submenuToggles.some(l=>l.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||r){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let l=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(l=t.elements.sibling.elements.toggle),l===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{l.preview()},this.enterDelay)):l.preview()}}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",i=>{i.pointerType==="pen"||i.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))}),t.dom.item.addEventListener("pointerenter",i=>{i.pointerType==="pen"||i.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=b(t);if(this.focusState==="self"){const i=["Space","Enter"],r=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&m(t):(this.currentMenuItem.isSubmenuItem&&i.includes(s)||this.elements.controller&&r.includes(s)||this.elements.parentMenu&&l.includes(s))&&m(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=b(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(m(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(r=>r.isOpen)?(m(t),this.closeChildren()):this.elements.parentMenu?(m(t),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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(m(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(m(t),this.focusPreviousChild()):s==="Home"?(m(t),this.focusFirstChild()):s==="End"&&(m(t),this.focusLastChild())))})}}module.exports=k; diff --git a/dist/top-link-disclosure-menu.es.js b/dist/top-link-disclosure-menu.es.js index f52e23b5..7308f5b4 100644 --- a/dist/top-link-disclosure-menu.es.js +++ b/dist/top-link-disclosure-menu.es.js @@ -4,7 +4,7 @@ var o = (n, e, t) => V(n, typeof e != "symbol" ? e + "" : e, t); function f(n, e) { typeof n == "string" ? e.classList.add(n) : e.classList.add(...n); } -function d(n, e) { +function p(n, e) { typeof n == "string" ? e.classList.remove(n) : e.classList.remove(...n); } function g(n, e) { @@ -33,7 +33,7 @@ function g(n, e) { }; } } -function a(n, e) { +function c(n, e) { try { if (typeof e != "object") { const t = typeof e; @@ -86,7 +86,7 @@ function _(n) { }; } } -function p(n) { +function d(n) { try { if (typeof n != "object" || Array.isArray(n)) { const e = typeof n; @@ -206,7 +206,7 @@ function k(n) { } } function z(n, e) { - if (a("string", { tagName: n }).status && g(HTMLElement, e).status) { + if (c("string", { tagName: n }).status && g(HTMLElement, e).status) { const t = n.toLowerCase(); let s = !0; for (const i in e) @@ -348,7 +348,7 @@ class L { return this._open; } set isOpen(e) { - a("boolean", { value: e }), this._open = e; + c("boolean", { value: e }), this._open = e; } /** * Sets unique IDs for the toggle and controlled menu. @@ -410,12 +410,12 @@ class L { _expand(e = !0) { const { closeClass: t, openClass: s, transitionClass: i } = this.elements.controlledMenu; this.dom.toggle.setAttribute("aria-expanded", "true"), i !== "" ? (f(i, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - t !== "" && d(t, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { + t !== "" && p(t, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { s !== "" && f(s, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - d(i, this.elements.controlledMenu.dom.menu); + p(i, this.elements.controlledMenu.dom.menu); }); }); - })) : (s !== "" && f(s, this.elements.controlledMenu.dom.menu), t !== "" && d(t, this.elements.controlledMenu.dom.menu)), e && this.dom.toggle.dispatchEvent(this._expandEvent); + })) : (s !== "" && f(s, this.elements.controlledMenu.dom.menu), t !== "" && p(t, this.elements.controlledMenu.dom.menu)), e && this.dom.toggle.dispatchEvent(this._expandEvent); } /** * Collapses the controlled menu. @@ -437,12 +437,12 @@ class L { _collapse(e = !0) { const { closeClass: t, openClass: s, transitionClass: i } = this.elements.controlledMenu; this.dom.toggle.setAttribute("aria-expanded", "false"), i !== "" ? (f(i, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - s !== "" && d(s, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { + s !== "" && p(s, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { t !== "" && f(t, this.elements.controlledMenu.dom.menu), requestAnimationFrame(() => { - d(i, this.elements.controlledMenu.dom.menu); + p(i, this.elements.controlledMenu.dom.menu); }); }); - })) : (t !== "" && f(t, this.elements.controlledMenu.dom.menu), s !== "" && d(s, this.elements.controlledMenu.dom.menu)), e && this.dom.toggle.dispatchEvent(this._collapseEvent); + })) : (t !== "" && f(t, this.elements.controlledMenu.dom.menu), s !== "" && p(s, this.elements.controlledMenu.dom.menu)), e && this.dom.toggle.dispatchEvent(this._collapseEvent); } /** * Opens the controlled menu. @@ -659,34 +659,34 @@ class C { /** * Constructs a new `BaseMenu`. * - * @param {object} options - The options for generating the menu. - * @param {HTMLElement} options.menuElement - The menu element in the DOM. - * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. - * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. - * @param {string} [options.submenuItemSelector] - The query selector string for menu items containing submenus. - * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. - * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. - * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. - * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. - * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". - * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". - * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. - * @param {boolean} [options.isTopLevel = false] - A flag to mark the root menu. - * @param {?BaseMenu} [options.parentMenu = null] - The parent menu to this menu. - * @param {string} [options.hoverType = off] - The type of hoverability a menu has. - * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). - * @param {number} [options.enterDelay = -1] - The delay for opening menus if the menu is hoverable (in miliseconds). - * @param {number} [options.leaveDelay = -1] - The delay for closing menus if the menu is hoverable (in miliseconds). + * @param {object} options - The options for generating the menu. + * @param {HTMLElement} options.menuElement - The menu element in the DOM. + * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. + * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. + * @param {string} [options.submenuItemSelector = li:has(ul)] - The query selector string for menu items containing submenus. + * @param {string} [options.submenuToggleSelector = a] - The query selector string for submenu toggle buttons/links. + * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. + * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. + * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. + * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". + * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". + * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. + * @param {boolean} [options.isTopLevel = false] - A flag to mark the root menu. + * @param {?BaseMenu} [options.parentMenu = null] - The parent menu to this menu. + * @param {string} [options.hoverType = off] - The type of hoverability a menu has. + * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). + * @param {number} [options.enterDelay = -1] - The delay for opening menus if the menu is hoverable (in miliseconds). + * @param {number} [options.leaveDelay = -1] - The delay for closing menus if the menu is hoverable (in miliseconds). */ constructor({ menuElement: e, menuItemSelector: t = "li", menuLinkSelector: s = "a", - submenuItemSelector: i = "", + submenuItemSelector: i = "li:has(ul)", submenuToggleSelector: r = "a", submenuSelector: l = "ul", controllerElement: h = null, - containerElement: c = null, + containerElement: a = null, openClass: u = "show", closeClass: T = "hide", transitionClass: E = "transitioning", @@ -890,7 +890,7 @@ class C { * @type {string[]} */ o(this, "_errors", []); - this._dom.menu = e, this._dom.controller = h, this._dom.container = c, this._selectors.menuItems = t, 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 = M, this._elements.rootMenu = y ? this : null, this._openClass = u || "", this._closeClass = T || "", this._transitionClass = E || "", this._root = y, this._hoverType = v, this._hoverDelay = w, this._enterDelay = S, this._leaveDelay = D; + this._dom.menu = e, this._dom.controller = h, this._dom.container = a, this._selectors.menuItems = t, 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 = M, this._elements.rootMenu = y ? this : null, this._openClass = u || "", this._closeClass = T || "", this._transitionClass = E || "", this._root = y, this._hoverType = v, this._hoverDelay = w, this._enterDelay = S, this._leaveDelay = D; } /** * Initializes the menu. @@ -1153,16 +1153,16 @@ class C { return this._errors; } set openClass(e) { - p({ openClass: e }), this._openClass !== e && (this._openClass = e); + d({ openClass: e }), this._openClass !== e && (this._openClass = e); } set closeClass(e) { - p({ closeClass: e }), this._closeClass !== e && (this._closeClass = e); + d({ closeClass: e }), this._closeClass !== e && (this._closeClass = e); } set transitionClass(e) { - p({ transitionClass: e }), this._transitionClass !== e && (this._transitionClass = e); + d({ transitionClass: e }), this._transitionClass !== e && (this._transitionClass = e); } set currentChild(e) { - a("number", { value: e }); + c("number", { value: e }); function t(s) { if (["mouse", "character"].includes(s.currentEvent) && s.elements.parentMenu) { let r = 0, l = !1; @@ -1188,13 +1188,13 @@ class C { k({ value: e }), this._hoverType !== e && (this._hoverType = e); } set hoverDelay(e) { - a("number", { value: e }), this._hoverDelay !== e && (this._hoverDelay = e); + c("number", { value: e }), this._hoverDelay !== e && (this._hoverDelay = e); } set enterDelay(e) { - a("number", { value: e }), this._enterDelay !== e && (this._enterDelay = e); + c("number", { value: e }), this._enterDelay !== e && (this._enterDelay = e); } set leaveDelay(e) { - a("number", { value: e }), this._leaveDelay !== e && (this._leaveDelay = e); + c("number", { value: e }), this._leaveDelay !== e && (this._leaveDelay = e); } /** * Validates all aspects of the menu to ensure proper functionality. @@ -1223,22 +1223,22 @@ class C { menuItemSelector: this._selectors.menuItems, menuLinkSelector: this._selectors.menuLinks }), s.status || (this._errors.push(s.error.message), e = !1), this._openClass !== "") { - const u = p({ openClass: this._openClass }); + const u = d({ openClass: this._openClass }); u.status || (this._errors.push(u.error.message), e = !1); } if (this._closeClass !== "") { - const u = p({ + const u = d({ closeClass: this._closeClass }); u.status || (this._errors.push(u.error.message), e = !1); } if (this._transitionClass !== "") { - const u = p({ + const u = d({ transitionClass: this._transitionClass }); u.status || (this._errors.push(u.error.message), e = !1); } - const i = a("boolean", { isTopLevel: this._root }); + const i = c("boolean", { isTopLevel: this._root }); if (i.status || (this._errors.push(i.error.message), e = !1), this._elements.parentMenu !== null) { const u = g(C, { parentMenu: this._elements.parentMenu @@ -1247,18 +1247,18 @@ class C { } const r = k({ hoverType: this._hoverType }); r.status || (this._errors.push(r.error.message), e = !1); - const l = a("number", { + const l = c("number", { hoverDelay: this._hoverDelay }); l.status || (this._errors.push(l.error.message), e = !1); - const h = a("number", { + const h = c("number", { enterDelay: this._enterDelay }); h.status || (this._errors.push(h.error.message), e = !1); - const c = a("number", { + const a = c("number", { leaveDelay: this._leaveDelay }); - return c.status || (this._errors.push(c.error.message), e = !1), e; + return a.status || (this._errors.push(a.error.message), e = !1), e; } /** * Sets DOM elements within the menu. @@ -1400,7 +1400,7 @@ class C { clearTimeout(this._hoverTimeout); } /** - * A wrapper for setTimeout that stores the timeout in the menu. + * Sets the hover timeout. * * @protected * @@ -1408,7 +1408,7 @@ class C { * @param {number} delay - The delay time in milliseconds. */ _setTimeout(e, t) { - this._hoverTimeout = setTimeout(e, t); + c("function", { callback: e }), c("number", { delay: t }), this._hoverTimeout = setTimeout(e, t); } /** * Handles focus events throughout the menu for proper menu use. @@ -1708,7 +1708,7 @@ class H extends I { isSubmenuItem: r = !1, childMenu: l = null, toggle: h = null, - initialize: c = !0, + initialize: a = !0, submenuSibling: u = null }) { super({ @@ -1737,7 +1737,7 @@ class H extends I { toggle: null, sibling: null }); - this._elements.parentMenu = i, this._elements.childMenu = l, this._elements.toggle = h, this._elements.sibling = u, c && this.initialize(); + this._elements.parentMenu = i, this._elements.childMenu = l, this._elements.toggle = h, this._elements.sibling = u, a && this.initialize(); } } class R extends L { @@ -1797,36 +1797,36 @@ class A extends C { /** * Constructs a new `TopLinkDisclosureMenu`. * - * @param {object} options - The options for generating the menu. - * @param {HTMLElement} options.menuElement - The menu element in the DOM. - * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. - * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. - * @param {string} [options.submenuItemSelector] - The query selector string for menu items containing submenus. - * @param {string} [options.submenuToggleSelector = button] - The query selector string for submenu toggle buttons/links. - * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. - * @param {string} [options.submenuSubtoggleSelector = a] - The query selector string for submenu toggle buttons/links below the top level. - * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. - * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. - * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". - * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". - * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. - * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. - * @param {?TopLinkDisclosureMenu} [options.parentMenu = null] - The parent menu to this menu. - * @param {string} [options.hoverType = off] - The type of hoverability a menu has. - * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). - * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). - * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). - * @param {boolean} [options.optionalKeySupport = false] - A flag to add optional keyboard support (Arrow keys, Home, and End) to the menu. - * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. + * @param {object} options - The options for generating the menu. + * @param {HTMLElement} options.menuElement - The menu element in the DOM. + * @param {string} [options.menuItemSelector = li] - The query selector string for menu items. + * @param {string} [options.menuLinkSelector = a] - The query selector string for menu links. + * @param {string} [options.submenuItemSelector = li:has(ul)] - The query selector string for menu items containing submenus. + * @param {string} [options.submenuToggleSelector = button] - The query selector string for submenu toggle buttons/links. + * @param {string} [options.submenuSelector = ul] - The query selector string for submenus. + * @param {string} [options.submenuSubtoggleSelector = a] - The query selector string for submenu toggle buttons/links below the top level. + * @param {?HTMLElement} [options.controllerElement = null] - The element controlling the menu in the DOM. + * @param {?HTMLElement} [options.containerElement = null] - The element containing the menu in the DOM. + * @param {?(string|string[])} [options.openClass = show] - The class to apply when a menu is "open". + * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a menu is "closed". + * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a menu is transitioning between "open" and "closed" states. + * @param {boolean} [options.isTopLevel = true] - A flag to mark the root menu. + * @param {?TopLinkDisclosureMenu} [options.parentMenu = null] - The parent menu to this menu. + * @param {string} [options.hoverType = off] - The type of hoverability a menu has. + * @param {number} [options.hoverDelay = 250] - The delay for opening and closing menus if the menu is hoverable (in miliseconds). + * @param {number} [options.enterDelay = -1] - The delay for opening a menu if the menu is focusable (in miliseconds). + * @param {number} [options.leaveDelay = -1] - The delay for closing a menu if the menu is focusable (in miliseconds). + * @param {boolean} [options.optionalKeySupport = false] - A flag to add optional keyboard support (Arrow keys, Home, and End) to the menu. + * @param {boolean} [options.initialize = true] - A flag to initialize the menu immediately upon creation. */ constructor({ menuElement: t, menuItemSelector: s = "li", menuLinkSelector: i = "a", - submenuItemSelector: r = "", + submenuItemSelector: r = "li:has(ul)", submenuToggleSelector: l = "button", submenuSelector: h = "ul", - submenuSubtoggleSelector: c = "a", + submenuSubtoggleSelector: a = "a", controllerElement: u = null, containerElement: T = null, openClass: E = "show", @@ -1923,7 +1923,7 @@ class A extends C { * @type {boolean} */ o(this, "_optionalSupport", !1); - this._optionalSupport = j, this._selectors.menuItems = s, this._selectors.submenuItems = r, this._selectors.submenuToggles = l, this._selectors.submenus = h, this._selectors.submenuSubtoggles = c, this._selectors.menuLinks = [ + this._optionalSupport = j, this._selectors.menuItems = s, this._selectors.submenuItems = r, this._selectors.submenuToggles = l, this._selectors.submenus = h, this._selectors.submenuSubtoggles = a, this._selectors.menuLinks = [ .../* @__PURE__ */ new Set([i, l]) ].join(","), F && this.initialize(); } @@ -1961,7 +1961,7 @@ class A extends C { return this.isTopLevel ? this._optionalSupport : this.elements.rootMenu.optionalKeySupport; } set optionalKeySupport(t) { - a("boolean", { optionalKeySupport: t }), this._optionalSupport = t; + c("boolean", { optionalKeySupport: t }), this._optionalSupport = t; } /** * Creates and initializes all menu items and submenus. @@ -1973,7 +1973,7 @@ class A extends C { let s, i; const r = t.querySelector(this.selectors.menuLinks); if (this.dom.submenuItems.includes(t)) { - const l = t.querySelector(this.selectors.submenuToggles), h = t.querySelector(this.selectors.submenus), c = new this._MenuType({ + const l = t.querySelector(this.selectors.submenuToggles), h = t.querySelector(this.selectors.submenus), a = new this._MenuType({ menuElement: h, menuItemSelector: this.selectors.menuItems, menuLinkSelector: this.selectors.menuLinks, @@ -1993,7 +1993,7 @@ class A extends C { }), u = new this._MenuToggleType({ menuToggleElement: l, parentElement: t, - controlledMenu: c, + controlledMenu: a, parentMenu: this }); this._elements.submenuToggles.push(u), l !== r ? (i = new this._MenuItemType({ @@ -2001,7 +2001,7 @@ class A extends C { menuLinkElement: l, parentMenu: this, isSubmenuItem: !0, - childMenu: c, + childMenu: a, toggle: u }), s = new this._MenuItemType({ menuItemElement: t, @@ -2013,7 +2013,7 @@ class A extends C { menuLinkElement: r, parentMenu: this, isSubmenuItem: !0, - childMenu: c, + childMenu: a, toggle: u }); } else @@ -2038,7 +2038,7 @@ class A extends C { submenuSubtoggleSelector: this._selectors.submenuSubtoggles }); s.status || (this._errors.push(s.error.message), t = !1); - const i = a("boolean", { + const i = c("boolean", { optionalKeySupport: this._optionalSupport }); return i.status || (this._errors.push(i.error.message), t = !1), t; diff --git a/dist/top-link-disclosure-menu.iife.js b/dist/top-link-disclosure-menu.iife.js index 7ca74091..877e25d7 100644 --- a/dist/top-link-disclosure-menu.iife.js +++ b/dist/top-link-disclosure-menu.iife.js @@ -1,3 +1,3 @@ -var TopLinkDisclosureMenu=function(){"use strict";var H=Object.defineProperty;var R=(a,m,d)=>m in a?H(a,m,{enumerable:!0,configurable:!0,writable:!0,value:d}):a[m]=d;var o=(a,m,d)=>R(a,typeof m!="symbol"?m+"":m,d);function a(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function m(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function d(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function f(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function y(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],y(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function O(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function L(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(i,e){if(f("string",{tagName:i}).status&&d(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class I{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){f("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),j("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(a(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&m(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&a(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&a(s,this.elements.controlledMenu.dom.menu),t!==""&&m(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(a(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&m(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&a(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&a(t,this.elements.controlledMenu.dom.menu),s!==""&&m(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,this._submenu=n}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 _(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function c(i){i.preventDefault(),i.stopPropagation()}class b{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:h=null,containerElement:p=null,openClass:u="show",closeClass:E="hide",transitionClass:M="transitioning",isTopLevel:C=!0,parentMenu:v=null,hoverType:w="off",hoverDelay:S=250,enterDelay:D=-1,leaveDelay:k=-1}){o(this,"_MenuType",b);o(this,"_MenuItemType",A);o(this,"_MenuToggleType",I);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=h,this._dom.container=p,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=r,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=v,this._elements.rootMenu=C?this:null,this._openClass=u||"",this._closeClass=E||"",this._transitionClass=M||"",this._root=C,this._hoverType=w,this._hoverDelay=S,this._enterDelay=D,this._leaveDelay=k}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +var TopLinkDisclosureMenu=function(){"use strict";var H=Object.defineProperty;var R=(f,m,d)=>m in f?H(f,m,{enumerable:!0,configurable:!0,writable:!0,value:d}):f[m]=d;var o=(f,m,d)=>R(f,typeof m!="symbol"?m+"":m,d);function f(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function m(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function d(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function c(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function y(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],y(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function O(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function L(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(i,e){if(c("string",{tagName:i}).status&&d(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class I{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){c("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),j("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(f(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&m(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&f(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&f(s,this.elements.controlledMenu.dom.menu),t!==""&&m(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(f(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&m(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&f(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&f(t,this.elements.controlledMenu.dom.menu),s!==""&&m(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,this._submenu=n}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 _(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function a(i){i.preventDefault(),i.stopPropagation()}class b{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="li:has(ul)",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:h=null,containerElement:p=null,openClass:u="show",closeClass:E="hide",transitionClass:M="transitioning",isTopLevel:C=!0,parentMenu:v=null,hoverType:w="off",hoverDelay:S=250,enterDelay:D=-1,leaveDelay:k=-1}){o(this,"_MenuType",b);o(this,"_MenuItemType",A);o(this,"_MenuToggleType",I);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=h,this._dom.container=p,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=r,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=v,this._elements.rootMenu=C?this:null,this._openClass=u||"",this._closeClass=E||"",this._transitionClass=M||"",this._root=C,this._hoverType=w,this._hoverDelay=S,this._enterDelay=D,this._leaveDelay=k}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){g({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){g({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){g({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){f("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){$({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){O({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){L({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){f("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){f("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){f("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=d(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=d(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=y({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=y({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=g({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=g({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=g({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const n=f("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const u=d(b,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const r=L({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=f("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const h=f("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),e=!1);const p=f("number",{leaveDelay:this._leaveDelay});return p.status||(this._errors.push(p.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&d(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:n,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){c(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&c(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&(c(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 F extends A{constructor({menuItemElement:t,menuLinkElement:s,parentMenu:n,isSubmenuItem:r=!1,childMenu:l=null,toggle:h=null,initialize:p=!0,submenuSibling:u=null}){super({menuItemElement:t,menuLinkElement:s,parentMenu:n,isSubmenuItem:r,childMenu:l,toggle:h});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null,sibling:null});this._elements.parentMenu=n,this._elements.childMenu=l,this._elements.toggle=h,this._elements.sibling=u,p&&this.initialize()}}class K extends I{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class T extends b{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:r="",submenuToggleSelector:l="button",submenuSelector:h="ul",submenuSubtoggleSelector:p="a",controllerElement:u=null,containerElement:E=null,openClass:M="show",closeClass:C="hide",transitionClass:v="transitioning",isTopLevel:w=!0,parentMenu:S=null,hoverType:D="off",hoverDelay:k=250,enterDelay:V=-1,leaveDelay:q=-1,optionalKeySupport:x=!1,initialize:z=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuSelector:h,submenuToggleSelector:l,controllerElement:u,containerElement:E,openClass:M,closeClass:C,transitionClass:v,isTopLevel:w,parentMenu:S,hoverType:D,hoverDelay:k,enterDelay:V,leaveDelay:q});o(this,"_MenuType",T);o(this,"_MenuItemType",F);o(this,"_MenuToggleType",K);o(this,"_currentChild",-1);o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:"",submenuSubtoggles:""});o(this,"_optionalSupport",!1);this._optionalSupport=x,this._selectors.menuItems=s,this._selectors.submenuItems=r,this._selectors.submenuToggles=l,this._selectors.submenus=h,this._selectors.submenuSubtoggles=p,this._selectors.menuLinks=[...new Set([n,l])].join(","),z&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){f("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_createChildElements(){this.dom.menuItems.forEach(t=>{let s,n;const r=t.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(t)){const l=t.querySelector(this.selectors.submenuToggles),h=t.querySelector(this.selectors.submenus),p=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),u=new this._MenuToggleType({menuToggleElement:l,parentElement:t,controlledMenu:p,parentMenu:this});this._elements.submenuToggles.push(u),l!==r?(n=new this._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:this,isSubmenuItem:!0,childMenu:p,toggle:u}),s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this,submenuSibling:n})):s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this,isSubmenuItem:!0,childMenu:p,toggle:u})}else s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this});this._elements.menuItems.push(s),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let t=super._validate();const s=y({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),t=!1);const n=f("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleHover(){this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let r=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(r=t.elements.sibling.elements.toggle),r===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{r.preview()},this.enterDelay)):r.preview()}else if(this.hoverType==="dynamic"){const r=this.elements.submenuToggles.some(l=>l.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||r){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let l=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(l=t.elements.sibling.elements.toggle),l===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{l.preview()},this.enterDelay)):l.preview()}}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))}),t.dom.item.addEventListener("pointerenter",n=>{n.pointerType==="pen"||n.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=_(t);if(this.focusState==="self"){const n=["Space","Enter"],r=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&c(t):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&r.includes(s)||this.elements.parentMenu&&l.includes(s))&&c(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=_(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(c(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(r=>r.isOpen)?(c(t),this.closeChildren()):this.elements.parentMenu?(c(t),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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(c(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(c(t),this.focusPreviousChild()):s==="Home"?(c(t),this.focusFirstChild()):s==="End"&&(c(t),this.focusLastChild())))})}}return T}(); + - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){g({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){g({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){g({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){c("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){$({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){O({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){L({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){c("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){c("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){c("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=d(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=d(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=y({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=y({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=g({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=g({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=g({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const n=c("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const u=d(b,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const r=L({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=c("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const h=c("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),e=!1);const p=c("number",{leaveDelay:this._leaveDelay});return p.status||(this._errors.push(p.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&d(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:n,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){c("function",{callback:e}),c("number",{delay:t}),this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){a(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&a(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=_(e);(t==="Space"||t==="Enter")&&(a(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 F extends A{constructor({menuItemElement:t,menuLinkElement:s,parentMenu:n,isSubmenuItem:r=!1,childMenu:l=null,toggle:h=null,initialize:p=!0,submenuSibling:u=null}){super({menuItemElement:t,menuLinkElement:s,parentMenu:n,isSubmenuItem:r,childMenu:l,toggle:h});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null,sibling:null});this._elements.parentMenu=n,this._elements.childMenu=l,this._elements.toggle=h,this._elements.sibling=u,p&&this.initialize()}}class K extends I{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class T extends b{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:r="li:has(ul)",submenuToggleSelector:l="button",submenuSelector:h="ul",submenuSubtoggleSelector:p="a",controllerElement:u=null,containerElement:E=null,openClass:M="show",closeClass:C="hide",transitionClass:v="transitioning",isTopLevel:w=!0,parentMenu:S=null,hoverType:D="off",hoverDelay:k=250,enterDelay:V=-1,leaveDelay:q=-1,optionalKeySupport:x=!1,initialize:z=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuSelector:h,submenuToggleSelector:l,controllerElement:u,containerElement:E,openClass:M,closeClass:C,transitionClass:v,isTopLevel:w,parentMenu:S,hoverType:D,hoverDelay:k,enterDelay:V,leaveDelay:q});o(this,"_MenuType",T);o(this,"_MenuItemType",F);o(this,"_MenuToggleType",K);o(this,"_currentChild",-1);o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:"",submenuSubtoggles:""});o(this,"_optionalSupport",!1);this._optionalSupport=x,this._selectors.menuItems=s,this._selectors.submenuItems=r,this._selectors.submenuToggles=l,this._selectors.submenus=h,this._selectors.submenuSubtoggles=p,this._selectors.menuLinks=[...new Set([n,l])].join(","),z&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){c("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_createChildElements(){this.dom.menuItems.forEach(t=>{let s,n;const r=t.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(t)){const l=t.querySelector(this.selectors.submenuToggles),h=t.querySelector(this.selectors.submenus),p=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),u=new this._MenuToggleType({menuToggleElement:l,parentElement:t,controlledMenu:p,parentMenu:this});this._elements.submenuToggles.push(u),l!==r?(n=new this._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:this,isSubmenuItem:!0,childMenu:p,toggle:u}),s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this,submenuSibling:n})):s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this,isSubmenuItem:!0,childMenu:p,toggle:u})}else s=new this._MenuItemType({menuItemElement:t,menuLinkElement:r,parentMenu:this});this._elements.menuItems.push(s),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let t=super._validate();const s=y({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),t=!1);const n=c("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleHover(){this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let r=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(r=t.elements.sibling.elements.toggle),r===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{r.preview()},this.enterDelay)):r.preview()}else if(this.hoverType==="dynamic"){const r=this.elements.submenuToggles.some(l=>l.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||r){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let l=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(l=t.elements.sibling.elements.toggle),l===null)return;this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{l.preview()},this.enterDelay)):l.preview()}}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))}),t.dom.item.addEventListener("pointerenter",n=>{n.pointerType==="pen"||n.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=_(t);if(this.focusState==="self"){const n=["Space","Enter"],r=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&a(t):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&r.includes(s)||this.elements.parentMenu&&l.includes(s))&&a(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=_(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(a(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(r=>r.isOpen)?(a(t),this.closeChildren()):this.elements.parentMenu?(a(t),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()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(a(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(a(t),this.focusPreviousChild()):s==="Home"?(a(t),this.focusFirstChild()):s==="End"&&(a(t),this.focusLastChild())))})}}return T}(); diff --git a/dist/treeview.cjs.js b/dist/treeview.cjs.js index 29884050..9315c0f3 100644 --- a/dist/treeview.cjs.js +++ b/dist/treeview.cjs.js @@ -1,3 +1,3 @@ -"use strict";var j=Object.defineProperty;var F=(n,e,t)=>e in n?j(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>F(n,typeof e!="symbol"?e+"":e,t);function g(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function y(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function b(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function p(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function k(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function _(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],k(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function z(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function A(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function D(n,e){if(p("string",{tagName:n}).status&&b(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){p("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),D("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(g(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&y(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&g(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{y(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&g(s,this.elements.controlledMenu.dom.menu),t!==""&&y(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(g(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&y(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&g(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{y(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&g(t,this.elements.controlledMenu.dom.menu),s!==""&&y(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,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 C(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function c(n){n.preventDefault(),n.stopPropagation()}class M{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:u=null,containerElement:h=null,openClass:m="show",closeClass:a="hide",transitionClass:d="transitioning",isTopLevel:f=!0,parentMenu:E=null,hoverType:T="off",hoverDelay:v=250,enterDelay:w=-1,leaveDelay:I=-1}){o(this,"_MenuType",M);o(this,"_MenuItemType",O);o(this,"_MenuToggleType",L);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=u,this._dom.container=h,this._selectors.menuItems=t,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=E,this._elements.rootMenu=f?this:null,this._openClass=m||"",this._closeClass=a||"",this._transitionClass=d||"",this._root=f,this._hoverType=T,this._hoverDelay=v,this._enterDelay=w,this._leaveDelay=I}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +"use strict";var j=Object.defineProperty;var F=(n,e,t)=>e in n?j(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>F(n,typeof e!="symbol"?e+"":e,t);function g(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function y(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function b(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function a(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function D(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function _(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],D(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function z(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function L(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function k(n,e){if(a("string",{tagName:n}).status&&b(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class A{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){a("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),k("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(g(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&y(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&g(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{y(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&g(s,this.elements.controlledMenu.dom.menu),t!==""&&y(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(g(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&y(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&g(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{y(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&g(t,this.elements.controlledMenu.dom.menu),s!==""&&y(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,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 C(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function c(n){n.preventDefault(),n.stopPropagation()}class M{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:u=null,containerElement:h=null,openClass:m="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:p=!0,parentMenu:T=null,hoverType:E="off",hoverDelay:v=250,enterDelay:w=-1,leaveDelay:I=-1}){o(this,"_MenuType",M);o(this,"_MenuItemType",O);o(this,"_MenuToggleType",A);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=u,this._dom.container=h,this._selectors.menuItems=t,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=T,this._elements.rootMenu=p?this:null,this._openClass=m||"",this._closeClass=d||"",this._transitionClass=f||"",this._root=p,this._hoverType=E,this._hoverDelay=v,this._enterDelay=w,this._leaveDelay=I}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){_({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){_({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){_({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){p("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){V({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){z({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){A({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){p("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){p("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){p("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=b(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=b(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const m=_({openClass:this._openClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._closeClass!==""){const m=_({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._transitionClass!==""){const m=_({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),e=!1)}const i=p("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const m=b(M,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),e=!1)}const r=A({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=p("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const u=p("number",{enterDelay:this._enterDelay});u.status||(this._errors.push(u.error.message),e=!1);const h=p("number",{leaveDelay:this._leaveDelay});return h.status||(this._errors.push(h.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&b(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){c(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=C(e);(t==="Space"||t==="Enter")&&c(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=C(e);(t==="Space"||t==="Enter")&&(c(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 N extends O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null,initialize:u=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:l}),u&&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 q extends L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-expanded")==="true"?this.open():this._collapse(!1)}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.getAttribute("aria-expanded")!=="true"&&this.dom.toggle.setAttribute("aria-expanded","false"),D("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}}class S extends M{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="",submenuToggleSelector:l="a",submenuSelector:u="ul",controllerElement:h=null,containerElement:m=null,openClass:a="show",closeClass:d="hide",transitionClass:f="transitioning",isTopLevel:E=!0,parentMenu:T=null,hoverType:v="off",hoverDelay:w=250,enterDelay:I=-1,leaveDelay:$=-1,initialize:x=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:u,controllerElement:h,containerElement:m,openClass:a,closeClass:d,transitionClass:f,isTopLevel:E,parentMenu:T,hoverType:v,hoverDelay:w,enterDelay:I,leaveDelay:$});o(this,"_MenuType",S);o(this,"_MenuItemType",N);o(this,"_MenuToggleType",q);x&&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(t){console.error(t)}}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=C(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const i=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],r=["Enter","ArrowRight"],l=["Escape"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&c(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=C(t),{altKey:i,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(i||r||l))c(t),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(t.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")c(t),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(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")c(t),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.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){c(t);const h=this.elements.menuItems[this.currentChild-1];h&&h.isSubmenuItem&&h.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(c(t),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?(c(t),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())):s==="Home"?(c(t),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(c(t),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(c(t),this.openChildren())})}focusLastNode(){const t=this.elements.menuItems.length-1,s=this.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=t,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(t=>t.preview())}focusNextNodeWithCharacter(t){function s(a){let d=[];return a.elements.menuItems.forEach(f=>{d.push(f),f.isSubmenuItem&&f.elements.toggle.isOpen&&(d=[...d,...s(f.elements.toggle.elements.controlledMenu)])}),d}const i=t.toLowerCase(),r=s(this.elements.rootMenu),l=r.indexOf(this.currentMenuItem)+1,u=[...r.slice(l),...r.slice(0,l)];let h=0,m=!1;for(;!m&&h=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){V({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){z({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){L({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){a("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){a("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){a("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=b(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=b(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const m=_({openClass:this._openClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._closeClass!==""){const m=_({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._transitionClass!==""){const m=_({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),e=!1)}const i=a("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const m=b(M,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),e=!1)}const r=L({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=a("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const u=a("number",{enterDelay:this._enterDelay});u.status||(this._errors.push(u.error.message),e=!1);const h=a("number",{leaveDelay:this._leaveDelay});return h.status||(this._errors.push(h.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&b(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){a("function",{callback:e}),a("number",{delay:t}),this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){c(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=C(e);(t==="Space"||t==="Enter")&&c(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=C(e);(t==="Space"||t==="Enter")&&(c(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 N extends O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null,initialize:u=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:l}),u&&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 q extends A{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-expanded")==="true"?this.open():this._collapse(!1)}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.getAttribute("aria-expanded")!=="true"&&this.dom.toggle.setAttribute("aria-expanded","false"),k("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}}class S extends M{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="li:has(ul)",submenuToggleSelector:l="a",submenuSelector:u="ul",controllerElement:h=null,containerElement:m=null,openClass:d="show",closeClass:f="hide",transitionClass:p="transitioning",isTopLevel:T=!0,parentMenu:E=null,hoverType:v="off",hoverDelay:w=250,enterDelay:I=-1,leaveDelay:$=-1,initialize:x=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:u,controllerElement:h,containerElement:m,openClass:d,closeClass:f,transitionClass:p,isTopLevel:T,parentMenu:E,hoverType:v,hoverDelay:w,enterDelay:I,leaveDelay:$});o(this,"_MenuType",S);o(this,"_MenuItemType",N);o(this,"_MenuToggleType",q);x&&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(t){console.error(t)}}_handleHover(){this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerenter",i=>{if(!(i.pointerType==="pen"||i.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s),t.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview());else if(this.hoverType==="dynamic"){const r=this.elements.submenuToggles.some(l=>l.isOpen);this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),t.isSubmenuItem&&(!this.isTopLevel||r)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview())}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",i=>{i.pointerType==="pen"||i.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0&&this._clearTimeout():this.hoverType==="dynamic"&&(this.isTopLevel||this.leaveDelay>0&&this._clearTimeout()))}),t.dom.item.addEventListener("pointerenter",i=>{i.pointerType==="pen"||i.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()})),this.isTopLevel&&this.dom.menu.addEventListener("pointerleave",i=>{i.pointerType==="pen"||i.pointerType==="touch"||this.hoverType==="on"&&(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.closeChildren(),this.blur()},this.leaveDelay)):(this.closeChildren(),this.blur()))})})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=C(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const i=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],r=["Enter","ArrowRight"],l=["Escape"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&c(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=C(t),{altKey:i,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(i||r||l))c(t),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(t.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")c(t),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(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")c(t),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.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){c(t);const h=this.elements.menuItems[this.currentChild-1];h&&h.isSubmenuItem&&h.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(c(t),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?(c(t),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())):s==="Home"?(c(t),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(c(t),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(c(t),this.openChildren())})}focusLastNode(){const t=this.elements.menuItems.length-1,s=this.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=t,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(t=>t.preview())}focusNextNodeWithCharacter(t){function s(d){let f=[];return d.elements.menuItems.forEach(p=>{f.push(p),p.isSubmenuItem&&p.elements.toggle.isOpen&&(f=[...f,...s(p.elements.toggle.elements.controlledMenu)])}),f}const i=t.toLowerCase(),r=s(this.elements.rootMenu),l=r.indexOf(this.currentMenuItem)+1,u=[...r.slice(l),...r.slice(0,l)];let h=0,m=!1;for(;!m&&hHover Type "on" + * - When a `pointerenter` event triggers on any menu item the menu's + * current child value will change to that + * menu item. + * - When a `pointerenter` event triggers on a submenu item the + * preview method for the submenu item's + * toggle will be called. + * - When a `pointerleave` event triggers on the menu itself the + * closeChildren method will be called after a delay + * set by the menu's hover delay. + * + * Hover Type "dynamic" + * - When a `pointerenter` event triggers on any menu item the menu's + * current child value will change to that menu item. + * - When a `pointerenter` event triggers on any menu item, and the menu's + * focus state is not "none", the menu item + * will be focused. + * - When a `pointerenter` event triggers on a submenu item, and a submenu is + * already open, the preview method for the submenu item's toggle will be called. + * - When a `pointerenter` event triggers on a submenu item, and no submenu is + * open, no submenu-specific methods will be called. + * + * Hover Type "off" + * All `pointerenter` and `pointerleave` events are ignored. + * + * @protected + */ + _handleHover() { + this.elements.menuItems.forEach((t, s) => { + t.dom.link.addEventListener("pointerenter", (i) => { + if (!(i.pointerType === "pen" || i.pointerType === "touch")) { + if (this.hoverType === "on") + this.currentEvent = "mouse", this.elements.rootMenu.blurChildren(), this.focusChild(s), t.isSubmenuItem && (this.enterDelay > 0 ? (this._clearTimeout(), this._setTimeout(() => { + t.elements.toggle.preview(); + }, this.enterDelay)) : t.elements.toggle.preview()); + else if (this.hoverType === "dynamic") { + const r = this.elements.submenuToggles.some( + (l) => l.isOpen + ); + this.currentChild = s, (!this.isTopLevel || this.focusState !== "none") && (this.currentEvent = "mouse", this.elements.rootMenu.blurChildren(), this.focusCurrentChild()), t.isSubmenuItem && (!this.isTopLevel || r) && (this.currentEvent = "mouse", this.elements.rootMenu.blurChildren(), this.focusCurrentChild(), this.enterDelay > 0 ? (this._clearTimeout(), this._setTimeout(() => { + t.elements.toggle.preview(); + }, this.enterDelay)) : t.elements.toggle.preview()); + } + } + }), t.isSubmenuItem && (t.dom.item.addEventListener("pointerleave", (i) => { + i.pointerType === "pen" || i.pointerType === "touch" || (this.hoverType === "on" ? this.leaveDelay > 0 && this._clearTimeout() : this.hoverType === "dynamic" && (this.isTopLevel || this.leaveDelay > 0 && this._clearTimeout())); + }), t.dom.item.addEventListener("pointerenter", (i) => { + i.pointerType === "pen" || i.pointerType === "touch" || t.isSubmenuItem && (this.hoverType === "on" || this.hoverType === "dynamic") && this.leaveDelay > 0 && this._clearTimeout(); + })), this.isTopLevel && this.dom.menu.addEventListener("pointerleave", (i) => { + i.pointerType === "pen" || i.pointerType === "touch" || this.hoverType === "on" && (this.leaveDelay > 0 ? (this._clearTimeout(), this._setTimeout(() => { + this.closeChildren(), this.blur(); + }, this.leaveDelay)) : (this.closeChildren(), this.blur())); + }); + }); + } /** * Handles keydown events throughout the menu for proper menu use. * @@ -2031,16 +2096,16 @@ class O extends M { * @param {string} char - The character to look for. */ focusNextNodeWithCharacter(t) { - function s(a) { - let d = []; - return a.elements.menuItems.forEach((f) => { - d.push(f), f.isSubmenuItem && f.elements.toggle.isOpen && (d = [ - ...d, + function s(d) { + let f = []; + return d.elements.menuItems.forEach((p) => { + f.push(p), p.isSubmenuItem && p.elements.toggle.isOpen && (f = [ + ...f, ...s( - f.elements.toggle.elements.controlledMenu + p.elements.toggle.elements.controlledMenu ) ]); - }), d; + }), f; } const i = t.toLowerCase(), r = s(this.elements.rootMenu), l = r.indexOf(this.currentMenuItem) + 1, u = [ ...r.slice(l), @@ -2048,11 +2113,11 @@ class O extends M { ]; let h = 0, m = !1; for (; !m && h < u.length; ) { - let a = ""; - if (u[h].dom.item.innerText ? a = u[h].dom.item.innerText : a = u[h].dom.item.textContent, a = a.replace(/[\s]/g, "").toLowerCase().charAt(0), a === i) { + let d = ""; + if (u[h].dom.item.innerText ? d = u[h].dom.item.innerText : d = u[h].dom.item.textContent, d = d.replace(/[\s]/g, "").toLowerCase().charAt(0), d === i) { m = !0; - const d = u[h].elements.parentMenu, f = d.elements.menuItems.indexOf(u[h]); - this.elements.rootMenu.blurChildren(), d.focusChild(f); + const f = u[h].elements.parentMenu, p = f.elements.menuItems.indexOf(u[h]); + this.elements.rootMenu.blurChildren(), f.focusChild(p); } h++; } diff --git a/dist/treeview.iife.js b/dist/treeview.iife.js index 42ae1416..d97ccef0 100644 --- a/dist/treeview.iife.js +++ b/dist/treeview.iife.js @@ -1,3 +1,3 @@ -var Treeview=function(){"use strict";var N=Object.defineProperty;var q=(d,a,y)=>a in d?N(d,a,{enumerable:!0,configurable:!0,writable:!0,value:y}):d[a]=y;var o=(d,a,y)=>q(d,typeof a!="symbol"?a+"":a,y);function d(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function a(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function y(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function _(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function E(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function b(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],E(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function A(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function D(n,e){if(_("string",{tagName:n}).status&&y(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){_("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),D("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(d(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&a(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&d(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{a(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&d(s,this.elements.controlledMenu.dom.menu),t!==""&&a(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(d(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&a(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&d(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{a(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&d(t,this.elements.controlledMenu.dom.menu),s!==""&&a(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,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 C(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function c(n){n.preventDefault(),n.stopPropagation()}class M{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:u=null,containerElement:h=null,openClass:m="show",closeClass:f="hide",transitionClass:p="transitioning",isTopLevel:g=!0,parentMenu:v=null,hoverType:w="off",hoverDelay:I=250,enterDelay:k=-1,leaveDelay:S=-1}){o(this,"_MenuType",M);o(this,"_MenuItemType",O);o(this,"_MenuToggleType",L);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=u,this._dom.container=h,this._selectors.menuItems=t,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=v,this._elements.rootMenu=g?this:null,this._openClass=m||"",this._closeClass=f||"",this._transitionClass=p||"",this._root=g,this._hoverType=w,this._hoverDelay=I,this._enterDelay=k,this._leaveDelay=S}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: +var Treeview=function(){"use strict";var N=Object.defineProperty;var q=(d,a,_)=>a in d?N(d,a,{enumerable:!0,configurable:!0,writable:!0,value:_}):d[a]=_;var o=(d,a,_)=>q(d,typeof a!="symbol"?a+"":a,_);function d(n,e){typeof n=="string"?e.classList.add(n):e.classList.add(...n)}function a(n,e){typeof n=="string"?e.classList.remove(n):e.classList.remove(...n)}function _(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof n)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${n.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function f(n,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==n)throw new TypeError(`${t} must be a ${n}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function T(n){try{if(typeof n!="object"){const e=typeof n;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in n)try{if(n[e]===null)throw new Error;document.querySelector(n[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${n[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function b(n){try{if(typeof n!="object"||Array.isArray(n)){const e=typeof n;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in n){const t=typeof n[e];if(t!=="string")if(Array.isArray(n[e]))n[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=n[e],T(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function L(n){try{if(typeof n!="object"){const t=typeof n;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in n)if(!e.includes(n[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${n[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function k(n,e){if(f("string",{tagName:n}).status&&_(HTMLElement,e).status){const t=n.toLowerCase();let s=!0;for(const i in e)e[i].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class A{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=i}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){f("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",i=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),i=`${s}-${i}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${i}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${i}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),k("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),i!==""?(d(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&a(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&d(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{a(i,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&d(s,this.elements.controlledMenu.dom.menu),t!==""&&a(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(d(i,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&a(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&d(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{a(i,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&d(t,this.elements.controlledMenu.dom.menu),s!==""&&a(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this.isOpen||(this._expand(),this.isOpen=!0)}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this.isOpen||(this._expand(),this.isOpen=!0)}close(){this.isOpen&&(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())}}class O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,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 C(n){try{const e=n.key||n.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function c(n){n.preventDefault(),n.stopPropagation()}class M{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:i="li:has(ul)",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:u=null,containerElement:h=null,openClass:m="show",closeClass:p="hide",transitionClass:g="transitioning",isTopLevel:y=!0,parentMenu:v=null,hoverType:w="off",hoverDelay:I=250,enterDelay:D=-1,leaveDelay:S=-1}){o(this,"_MenuType",M);o(this,"_MenuItemType",O);o(this,"_MenuToggleType",A);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=u,this._dom.container=h,this._selectors.menuItems=t,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=v,this._elements.rootMenu=y?this:null,this._openClass=m||"",this._closeClass=p||"",this._transitionClass=g||"",this._root=y,this._hoverType=w,this._hoverDelay=I,this._enterDelay=D,this._leaveDelay=S}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found: - ${this.errors.join(` - - `)}`);if(this.elements.rootMenu===null&&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 transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}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 enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){b({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){b({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){b({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){_("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){$({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){x({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){A({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){_("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){_("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){_("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=y(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=y(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=E({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=E({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const m=b({openClass:this._openClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._closeClass!==""){const m=b({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._transitionClass!==""){const m=b({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),e=!1)}const i=_("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const m=y(M,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),e=!1)}const r=A({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=_("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const u=_("number",{enterDelay:this._enterDelay});u.status||(this._errors.push(u.error.message),e=!1);const h=_("number",{leaveDelay:this._leaveDelay});return h.status||(this._errors.push(h.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&y(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){c(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=C(e);(t==="Space"||t==="Enter")&&c(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=C(e);(t==="Space"||t==="Enter")&&(c(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 j extends O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null,initialize:u=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:l}),u&&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 F extends L{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-expanded")==="true"?this.open():this._collapse(!1)}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.getAttribute("aria-expanded")!=="true"&&this.dom.toggle.setAttribute("aria-expanded","false"),D("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}}class T extends M{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="",submenuToggleSelector:l="a",submenuSelector:u="ul",controllerElement:h=null,containerElement:m=null,openClass:f="show",closeClass:p="hide",transitionClass:g="transitioning",isTopLevel:v=!0,parentMenu:w=null,hoverType:I="off",hoverDelay:k=250,enterDelay:S=-1,leaveDelay:V=-1,initialize:z=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:u,controllerElement:h,containerElement:m,openClass:f,closeClass:p,transitionClass:g,isTopLevel:v,parentMenu:w,hoverType:I,hoverDelay:k,enterDelay:S,leaveDelay:V});o(this,"_MenuType",T);o(this,"_MenuItemType",j);o(this,"_MenuToggleType",F);z&&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(t){console.error(t)}}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=C(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const i=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],r=["Enter","ArrowRight"],l=["Escape"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&c(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=C(t),{altKey:i,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(i||r||l))c(t),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(t.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")c(t),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(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")c(t),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.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){c(t);const h=this.elements.menuItems[this.currentChild-1];h&&h.isSubmenuItem&&h.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(c(t),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?(c(t),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())):s==="Home"?(c(t),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(c(t),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(c(t),this.openChildren())})}focusLastNode(){const t=this.elements.menuItems.length-1,s=this.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=t,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(t=>t.preview())}focusNextNodeWithCharacter(t){function s(f){let p=[];return f.elements.menuItems.forEach(g=>{p.push(g),g.isSubmenuItem&&g.elements.toggle.isOpen&&(p=[...p,...s(g.elements.toggle.elements.controlledMenu)])}),p}const i=t.toLowerCase(),r=s(this.elements.rootMenu),l=r.indexOf(this.currentMenuItem)+1,u=[...r.slice(l),...r.slice(0,l)];let h=0,m=!1;for(;!m&&h=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){$({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){x({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){L({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){f("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){f("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){f("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=_(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=_(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=T({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=T({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const m=b({openClass:this._openClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._closeClass!==""){const m=b({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._transitionClass!==""){const m=b({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),e=!1)}const i=f("boolean",{isTopLevel:this._root});if(i.status||(this._errors.push(i.error.message),e=!1),this._elements.parentMenu!==null){const m=_(M,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),e=!1)}const r=L({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=f("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const u=f("number",{enterDelay:this._enterDelay});u.status||(this._errors.push(u.error.message),e=!1);const h=f("number",{leaveDelay:this._leaveDelay});return h.status||(this._errors.push(h.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&_(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_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(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),i=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:i,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,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_clearTimeout(){clearTimeout(this._hoverTimeout)}_setTimeout(e,t){f("function",{callback:e}),f("number",{delay:t}),this._hoverTimeout=setTimeout(e,t)}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,i){c(i),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this._clearTimeout(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",i=>{this.currentEvent="mouse",e(this,t.elements.toggle,i)})}),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",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||i)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay)):e.elements.toggle.preview())}}}),e.isSubmenuItem&&(e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))}),e.dom.item.addEventListener("pointerenter",s=>{s.pointerType==="pen"||s.pointerType==="touch"||e.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()}))})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=C(e);(t==="Space"||t==="Enter")&&c(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=C(e);(t==="Space"||t==="Enter")&&(c(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&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",this.currentChild!==-1&&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.currentChild0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&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 j extends O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i=!1,childMenu:r=null,toggle:l=null,initialize:u=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:i,childMenu:r,toggle:l}),u&&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 F extends A{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:i}),r&&this.initialize()}initialize(){this._setIds(),this._setAriaAttributes(),this.dom.toggle.getAttribute("aria-expanded")==="true"?this.open():this._collapse(!1)}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.getAttribute("aria-expanded")!=="true"&&this.dom.toggle.setAttribute("aria-expanded","false"),k("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}}class E extends M{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:i="a",submenuItemSelector:r="li:has(ul)",submenuToggleSelector:l="a",submenuSelector:u="ul",controllerElement:h=null,containerElement:m=null,openClass:p="show",closeClass:g="hide",transitionClass:y="transitioning",isTopLevel:v=!0,parentMenu:w=null,hoverType:I="off",hoverDelay:D=250,enterDelay:S=-1,leaveDelay:V=-1,initialize:z=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:i,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:u,controllerElement:h,containerElement:m,openClass:p,closeClass:g,transitionClass:y,isTopLevel:v,parentMenu:w,hoverType:I,hoverDelay:D,enterDelay:S,leaveDelay:V});o(this,"_MenuType",E);o(this,"_MenuItemType",j);o(this,"_MenuToggleType",F);z&&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(t){console.error(t)}}_handleHover(){this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerenter",i=>{if(!(i.pointerType==="pen"||i.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s),t.isSubmenuItem&&(this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview());else if(this.hoverType==="dynamic"){const r=this.elements.submenuToggles.some(l=>l.isOpen);this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),t.isSubmenuItem&&(!this.isTopLevel||r)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?(this._clearTimeout(),this._setTimeout(()=>{t.elements.toggle.preview()},this.enterDelay)):t.elements.toggle.preview())}}}),t.isSubmenuItem&&(t.dom.item.addEventListener("pointerleave",i=>{i.pointerType==="pen"||i.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0&&this._clearTimeout():this.hoverType==="dynamic"&&(this.isTopLevel||this.leaveDelay>0&&this._clearTimeout()))}),t.dom.item.addEventListener("pointerenter",i=>{i.pointerType==="pen"||i.pointerType==="touch"||t.isSubmenuItem&&(this.hoverType==="on"||this.hoverType==="dynamic")&&this.leaveDelay>0&&this._clearTimeout()})),this.isTopLevel&&this.dom.menu.addEventListener("pointerleave",i=>{i.pointerType==="pen"||i.pointerType==="touch"||this.hoverType==="on"&&(this.leaveDelay>0?(this._clearTimeout(),this._setTimeout(()=>{this.closeChildren(),this.blur()},this.leaveDelay)):(this.closeChildren(),this.blur()))})})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=C(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const i=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],r=["Enter","ArrowRight"],l=["Escape"];(i.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&c(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=C(t),{altKey:i,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(i||r||l))c(t),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(t.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")c(t),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(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")c(t),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.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){c(t);const h=this.elements.menuItems[this.currentChild-1];h&&h.isSubmenuItem&&h.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(c(t),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?(c(t),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())):s==="Home"?(c(t),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(c(t),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(c(t),this.openChildren())})}focusLastNode(){const t=this.elements.menuItems.length-1,s=this.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=t,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(t=>t.preview())}focusNextNodeWithCharacter(t){function s(p){let g=[];return p.elements.menuItems.forEach(y=>{g.push(y),y.isSubmenuItem&&y.elements.toggle.isOpen&&(g=[...g,...s(y.elements.toggle.elements.controlledMenu)])}),g}const i=t.toLowerCase(),r=s(this.elements.rootMenu),l=r.indexOf(this.currentMenuItem)+1,u=[...r.slice(l),...r.slice(0,l)];let h=0,m=!1;for(;!m&&h { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/DisclosureMenu/axe.test.js b/tests/menus/DisclosureMenu/axe.test.js index 3c574848..2762a665 100644 --- a/tests/menus/DisclosureMenu/axe.test.js +++ b/tests/menus/DisclosureMenu/axe.test.js @@ -18,7 +18,6 @@ describe("DisclosureMenu", () => { /* eslint-disable-next-line no-unused-vars */ const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/DisclosureMenu/click.test.js b/tests/menus/DisclosureMenu/click.test.js index 8f1e8590..3eeac40d 100644 --- a/tests/menus/DisclosureMenu/click.test.js +++ b/tests/menus/DisclosureMenu/click.test.js @@ -41,7 +41,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -57,7 +56,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -78,7 +76,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -104,7 +101,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -124,7 +120,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -146,7 +141,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -168,7 +162,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -184,7 +177,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -202,7 +194,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -222,7 +213,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -244,7 +234,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -263,7 +252,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -279,7 +267,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -295,7 +282,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -312,7 +298,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -328,7 +313,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -348,7 +332,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -367,7 +350,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -387,7 +369,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -406,7 +387,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -426,7 +406,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/DisclosureMenu/keyboard.test.js b/tests/menus/DisclosureMenu/keyboard.test.js index 3d2e4814..ca46776c 100644 --- a/tests/menus/DisclosureMenu/keyboard.test.js +++ b/tests/menus/DisclosureMenu/keyboard.test.js @@ -26,7 +26,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -51,7 +50,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -73,7 +71,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -95,7 +92,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -116,7 +112,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -138,7 +133,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -159,7 +153,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -184,7 +177,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -206,7 +198,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -227,7 +218,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -247,7 +237,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -272,7 +261,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -295,7 +283,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -319,7 +306,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -338,7 +324,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -359,7 +344,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -384,7 +368,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -410,7 +393,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -440,7 +422,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -462,7 +443,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -490,7 +470,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -516,7 +495,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -542,7 +520,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -571,7 +548,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -603,7 +579,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -628,7 +603,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -658,7 +632,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -680,7 +653,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: false, @@ -703,7 +675,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -728,7 +699,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -759,7 +729,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -789,7 +758,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -811,7 +779,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: false, @@ -833,7 +800,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -862,7 +828,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -884,7 +849,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: false, @@ -906,7 +870,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -935,7 +898,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -957,7 +919,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: false, @@ -979,7 +940,6 @@ describe("DisclosureMenu", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -1012,7 +972,6 @@ describe("DisclosureMenu Controller", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1030,7 +989,6 @@ describe("DisclosureMenu Controller", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1056,7 +1014,6 @@ describe("DisclosureMenu Controller", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1074,7 +1031,6 @@ describe("DisclosureMenu Controller", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1096,7 +1052,6 @@ describe("DisclosureMenu Controller", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1117,7 +1072,6 @@ describe("DisclosureMenu Controller", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/DisclosureMenuToggle/public.test.js b/tests/menus/DisclosureMenuToggle/public.test.js index 86b0dab2..b1a17ff7 100644 --- a/tests/menus/DisclosureMenuToggle/public.test.js +++ b/tests/menus/DisclosureMenuToggle/public.test.js @@ -27,7 +27,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -44,7 +43,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -64,7 +62,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -81,7 +78,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -104,7 +100,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -121,7 +116,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -141,7 +135,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -158,7 +151,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -181,7 +173,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -204,7 +195,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -226,7 +216,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -250,7 +239,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -271,7 +259,6 @@ describe("DisclosureMenuToggle public methods", () => { // Create a new DisclosureMenu instance for testing. const menu = new DisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/Menubar/aria.test.js b/tests/menus/Menubar/aria.test.js index e8eb855f..c7818455 100644 --- a/tests/menus/Menubar/aria.test.js +++ b/tests/menus/Menubar/aria.test.js @@ -13,7 +13,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/Menubar/axe.test.js b/tests/menus/Menubar/axe.test.js index a6ede197..2f250c8c 100644 --- a/tests/menus/Menubar/axe.test.js +++ b/tests/menus/Menubar/axe.test.js @@ -18,7 +18,6 @@ describe("Menubar", () => { /* eslint-disable-next-line no-unused-vars */ const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/Menubar/click.test.js b/tests/menus/Menubar/click.test.js index 275528bc..1a8cdb25 100644 --- a/tests/menus/Menubar/click.test.js +++ b/tests/menus/Menubar/click.test.js @@ -41,7 +41,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -57,7 +56,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -78,7 +76,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -104,7 +101,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -124,7 +120,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -146,7 +141,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -168,7 +162,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -184,7 +177,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -202,7 +194,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -222,7 +213,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -244,7 +234,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -263,7 +252,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -279,7 +267,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -295,7 +282,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -312,7 +298,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -328,7 +313,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -348,7 +332,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -367,7 +350,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -387,7 +369,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -406,7 +387,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -426,7 +406,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/Menubar/keyboard.test.js b/tests/menus/Menubar/keyboard.test.js index 2dea74fb..e78ed173 100644 --- a/tests/menus/Menubar/keyboard.test.js +++ b/tests/menus/Menubar/keyboard.test.js @@ -26,7 +26,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -44,7 +43,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -68,7 +66,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -89,7 +86,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -113,7 +109,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -134,7 +129,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -155,7 +149,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -182,7 +175,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -205,7 +197,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -226,7 +217,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -247,7 +237,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -269,7 +258,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -291,7 +279,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -315,7 +302,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -337,7 +323,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -358,7 +343,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -392,7 +376,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -421,7 +404,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -447,7 +429,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -478,7 +459,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -496,7 +476,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -513,7 +492,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -531,7 +509,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -548,7 +525,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -578,7 +554,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -599,7 +574,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -623,7 +597,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -654,7 +627,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -683,7 +655,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -704,7 +675,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -733,7 +703,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -754,7 +723,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -780,7 +748,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -805,7 +772,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -830,7 +796,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -860,7 +825,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -881,7 +845,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -907,7 +870,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -932,7 +894,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -957,7 +918,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -988,7 +948,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1009,7 +968,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1033,7 +991,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1064,7 +1021,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1093,7 +1049,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1120,7 +1075,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1141,7 +1095,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1165,7 +1118,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1196,7 +1148,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1225,7 +1176,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1251,7 +1201,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1272,7 +1221,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1300,7 +1248,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1321,7 +1268,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1350,7 +1296,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1372,7 +1317,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1400,7 +1344,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1422,7 +1365,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1447,7 +1389,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1481,7 +1422,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1507,7 +1447,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1536,7 +1475,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1569,7 +1507,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1604,7 +1541,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1626,7 +1562,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1664,7 +1599,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1690,7 +1624,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1719,7 +1652,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1753,7 +1685,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1779,7 +1710,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1808,7 +1738,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1841,7 +1770,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1876,7 +1804,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1902,7 +1829,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1931,7 +1857,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1960,7 +1885,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1995,7 +1919,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2022,7 +1945,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2051,7 +1973,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2082,7 +2003,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2111,7 +2031,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2142,7 +2061,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2172,7 +2090,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2208,7 +2125,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2234,7 +2150,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2270,7 +2185,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2296,7 +2210,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2332,7 +2245,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2358,7 +2270,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2394,7 +2305,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2420,7 +2330,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2460,7 +2369,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2478,7 +2386,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2504,7 +2411,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2522,7 +2428,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2544,7 +2449,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -2565,7 +2469,6 @@ describe("Menubar", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/Menubar/public.test.js b/tests/menus/Menubar/public.test.js index 96ee0aef..04379536 100644 --- a/tests/menus/Menubar/public.test.js +++ b/tests/menus/Menubar/public.test.js @@ -95,7 +95,6 @@ describe("Menubar public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -113,7 +112,6 @@ describe("Menubar public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -154,7 +152,6 @@ describe("Menubar public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -175,7 +172,6 @@ describe("Menubar public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -246,7 +242,6 @@ describe("Menubar public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -264,7 +259,6 @@ describe("Menubar public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -282,7 +276,6 @@ describe("Menubar public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/MenubarItem/public.test.js b/tests/menus/MenubarItem/public.test.js index c9dc9caa..713bd2ba 100644 --- a/tests/menus/MenubarItem/public.test.js +++ b/tests/menus/MenubarItem/public.test.js @@ -25,7 +25,6 @@ describe("MenubarItem public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -45,7 +44,6 @@ describe("MenubarItem public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -66,7 +64,6 @@ describe("MenubarItem public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -83,7 +80,6 @@ describe("MenubarItem public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -105,7 +101,6 @@ describe("MenubarItem public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -125,7 +120,6 @@ describe("MenubarItem public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -146,7 +140,6 @@ describe("MenubarItem public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/MenubarToggle/public.test.js b/tests/menus/MenubarToggle/public.test.js index 34a02cf1..878355b6 100644 --- a/tests/menus/MenubarToggle/public.test.js +++ b/tests/menus/MenubarToggle/public.test.js @@ -27,7 +27,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -44,7 +43,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -64,7 +62,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -81,7 +78,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -104,7 +100,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -121,7 +116,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -141,7 +135,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -158,7 +151,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -181,7 +173,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -204,7 +195,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -226,7 +216,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -250,7 +239,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -271,7 +259,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -294,7 +281,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -317,7 +303,6 @@ describe("MenubarToggle public methods", () => { // Create a new Menubar instance for testing. const menu = new Menubar({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/TopLinkDisclosureMenu/aria.test.js b/tests/menus/TopLinkDisclosureMenu/aria.test.js index a2454887..aefe72e6 100644 --- a/tests/menus/TopLinkDisclosureMenu/aria.test.js +++ b/tests/menus/TopLinkDisclosureMenu/aria.test.js @@ -13,7 +13,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/TopLinkDisclosureMenu/axe.test.js b/tests/menus/TopLinkDisclosureMenu/axe.test.js index 7a32327f..7bc523b2 100644 --- a/tests/menus/TopLinkDisclosureMenu/axe.test.js +++ b/tests/menus/TopLinkDisclosureMenu/axe.test.js @@ -18,7 +18,6 @@ describe("TopLinkDisclosureMenu", () => { /* eslint-disable-next-line no-unused-vars */ const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/TopLinkDisclosureMenu/click.test.js b/tests/menus/TopLinkDisclosureMenu/click.test.js index 014a2c0d..550fc8ab 100644 --- a/tests/menus/TopLinkDisclosureMenu/click.test.js +++ b/tests/menus/TopLinkDisclosureMenu/click.test.js @@ -41,7 +41,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -57,7 +56,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -78,7 +76,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -104,7 +101,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -124,7 +120,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -146,7 +141,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -168,7 +162,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -184,7 +177,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -202,7 +194,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -222,7 +213,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -244,7 +234,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -263,7 +252,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -279,7 +267,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -295,7 +282,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -312,7 +298,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -328,7 +313,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -348,7 +332,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -367,7 +350,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -387,7 +369,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -406,7 +387,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -426,7 +406,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/TopLinkDisclosureMenu/hover.test.js b/tests/menus/TopLinkDisclosureMenu/hover.test.js index e786e91c..bebeccab 100644 --- a/tests/menus/TopLinkDisclosureMenu/hover.test.js +++ b/tests/menus/TopLinkDisclosureMenu/hover.test.js @@ -48,7 +48,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -67,7 +66,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -91,7 +89,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -114,7 +111,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -139,7 +135,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -167,7 +162,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -192,7 +186,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -220,7 +213,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -243,7 +235,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -270,7 +261,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -292,7 +282,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -315,7 +304,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -340,7 +328,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -368,7 +355,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -388,7 +374,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -414,7 +399,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -452,7 +436,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -490,7 +473,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -546,7 +528,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -608,7 +589,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -633,7 +613,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -663,7 +642,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -694,7 +672,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -716,7 +693,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -741,7 +717,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -768,7 +743,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -787,7 +761,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -809,7 +782,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -833,7 +805,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -858,7 +829,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -888,7 +858,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -917,7 +886,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -949,7 +917,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -985,7 +952,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1018,7 +984,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1040,7 +1005,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1065,7 +1029,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1090,7 +1053,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1118,7 +1080,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1149,7 +1110,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1177,7 +1137,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1202,7 +1161,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1233,7 +1191,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1265,7 +1222,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1300,7 +1256,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1330,7 +1285,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1363,7 +1317,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1399,7 +1352,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1434,7 +1386,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1461,7 +1412,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1492,7 +1442,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1526,7 +1475,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1579,7 +1527,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", diff --git a/tests/menus/TopLinkDisclosureMenu/keyboard.test.js b/tests/menus/TopLinkDisclosureMenu/keyboard.test.js index 3f56230a..a3e76fdd 100644 --- a/tests/menus/TopLinkDisclosureMenu/keyboard.test.js +++ b/tests/menus/TopLinkDisclosureMenu/keyboard.test.js @@ -26,7 +26,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -51,7 +50,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -73,7 +71,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -95,7 +92,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -116,7 +112,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -138,7 +133,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -159,7 +153,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -184,7 +177,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -206,7 +198,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -227,7 +218,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -247,7 +237,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -272,7 +261,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -295,7 +283,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -319,7 +306,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -338,7 +324,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -359,7 +344,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -384,7 +368,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -410,7 +393,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -440,7 +422,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -462,7 +443,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -490,7 +470,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -516,7 +495,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -542,7 +520,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -571,7 +548,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -603,7 +579,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -628,7 +603,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -658,7 +632,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -680,7 +653,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: false, @@ -703,7 +675,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -728,7 +699,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -759,7 +729,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -789,7 +758,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -811,7 +779,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: false, @@ -833,7 +800,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -862,7 +828,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -884,7 +849,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: false, @@ -906,7 +870,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -935,7 +898,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -957,7 +919,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: false, @@ -979,7 +940,6 @@ describe("TopLinkDisclosureMenu", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), optionalKeySupport: true, @@ -1012,7 +972,6 @@ describe("TopLinkDisclosureMenu Controller", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1030,7 +989,6 @@ describe("TopLinkDisclosureMenu Controller", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1056,7 +1014,6 @@ describe("TopLinkDisclosureMenu Controller", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1074,7 +1031,6 @@ describe("TopLinkDisclosureMenu Controller", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1096,7 +1052,6 @@ describe("TopLinkDisclosureMenu Controller", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1117,7 +1072,6 @@ describe("TopLinkDisclosureMenu Controller", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/TopLinkDisclosureMenuToggle/public.test.js b/tests/menus/TopLinkDisclosureMenuToggle/public.test.js index ecc74eb6..0d56d0eb 100644 --- a/tests/menus/TopLinkDisclosureMenuToggle/public.test.js +++ b/tests/menus/TopLinkDisclosureMenuToggle/public.test.js @@ -27,7 +27,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -44,7 +43,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -64,7 +62,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -81,7 +78,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -104,7 +100,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -121,7 +116,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -141,7 +135,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -158,7 +151,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -181,7 +173,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -204,7 +195,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -226,7 +216,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -250,7 +239,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -271,7 +259,6 @@ describe("TopLinkDisclosureMenuToggle public methods", () => { // Create a new TopLinkDisclosureMenu instance for testing. const menu = new TopLinkDisclosureMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/Treeview/aria.test.js b/tests/menus/Treeview/aria.test.js index 5d2d9299..9df97c37 100644 --- a/tests/menus/Treeview/aria.test.js +++ b/tests/menus/Treeview/aria.test.js @@ -13,7 +13,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/Treeview/axe.test.js b/tests/menus/Treeview/axe.test.js index d2b0127b..287cfe19 100644 --- a/tests/menus/Treeview/axe.test.js +++ b/tests/menus/Treeview/axe.test.js @@ -18,7 +18,6 @@ describe("Treeview", () => { /* eslint-disable-next-line no-unused-vars */ const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/Treeview/hover.test.js b/tests/menus/Treeview/hover.test.js index b14e70fa..416f12ce 100644 --- a/tests/menus/Treeview/hover.test.js +++ b/tests/menus/Treeview/hover.test.js @@ -48,7 +48,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -67,7 +66,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -91,7 +89,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -114,7 +111,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -136,7 +132,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -164,7 +159,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -191,7 +185,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -216,7 +209,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -244,7 +236,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -266,7 +257,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -289,7 +279,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -317,7 +306,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -340,7 +328,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -368,7 +355,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -393,7 +379,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -432,7 +417,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -457,7 +441,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -487,7 +470,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -518,7 +500,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -540,7 +521,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -565,7 +545,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -592,7 +571,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -611,7 +589,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -633,7 +610,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -657,7 +633,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -682,7 +657,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -712,7 +686,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -741,7 +714,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -770,7 +742,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -806,7 +777,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -839,7 +809,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -861,7 +830,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -886,7 +854,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -911,7 +878,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -939,7 +905,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -970,7 +935,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1002,7 +966,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1037,7 +1000,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", diff --git a/tests/menus/Treeview/keyboard.test.js b/tests/menus/Treeview/keyboard.test.js index 7e2b58f9..97ed54ce 100644 --- a/tests/menus/Treeview/keyboard.test.js +++ b/tests/menus/Treeview/keyboard.test.js @@ -26,7 +26,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -44,7 +43,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -68,7 +66,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -89,7 +86,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -110,7 +106,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -145,7 +140,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -169,7 +163,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -191,7 +184,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -213,7 +205,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -238,7 +229,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -260,7 +250,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -281,7 +270,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); // Set up the menu. @@ -305,7 +293,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -323,7 +310,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -340,7 +326,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -358,7 +343,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -375,7 +359,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -402,7 +385,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -425,7 +407,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -450,7 +431,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -476,7 +456,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -506,7 +485,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -531,7 +509,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -561,7 +538,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -584,7 +560,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -609,7 +584,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -633,7 +607,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -664,7 +637,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -699,7 +671,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -726,7 +697,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -763,7 +733,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -786,7 +755,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -811,7 +779,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -833,7 +800,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -857,7 +823,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -885,7 +850,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -917,7 +881,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -943,7 +906,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -975,7 +937,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1002,7 +963,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1040,7 +1000,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1064,7 +1023,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1089,7 +1047,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1112,7 +1069,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1142,7 +1098,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1169,7 +1124,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1195,7 +1149,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1218,7 +1171,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1246,7 +1198,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1274,7 +1225,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1306,7 +1256,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1332,7 +1281,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1366,7 +1314,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1387,7 +1334,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1411,7 +1357,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1439,7 +1384,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1460,7 +1404,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1484,7 +1427,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1512,7 +1454,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1533,7 +1474,6 @@ describe("Treeview", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1565,7 +1505,6 @@ describe("Treeview Controller", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1583,7 +1522,6 @@ describe("Treeview Controller", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1609,7 +1547,6 @@ describe("Treeview Controller", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1627,7 +1564,6 @@ describe("Treeview Controller", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1649,7 +1585,6 @@ describe("Treeview Controller", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -1670,7 +1605,6 @@ describe("Treeview Controller", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/Treeview/public.test.js b/tests/menus/Treeview/public.test.js index 5d2fd520..5e5d98a8 100644 --- a/tests/menus/Treeview/public.test.js +++ b/tests/menus/Treeview/public.test.js @@ -148,7 +148,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -166,7 +165,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -189,7 +187,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -227,7 +224,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -266,7 +262,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -284,7 +279,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -302,7 +296,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -322,7 +315,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -346,7 +338,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -374,7 +365,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -397,7 +387,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -434,7 +423,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -460,7 +448,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -523,7 +510,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -550,7 +536,6 @@ describe("Treeview public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/TreeviewItem/public.test.js b/tests/menus/TreeviewItem/public.test.js index 55a356b7..14ba97fe 100644 --- a/tests/menus/TreeviewItem/public.test.js +++ b/tests/menus/TreeviewItem/public.test.js @@ -25,7 +25,6 @@ describe("TreeviewItem public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -45,7 +44,6 @@ describe("TreeviewItem public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -66,7 +64,6 @@ describe("TreeviewItem public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -86,7 +83,6 @@ describe("TreeviewItem public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -106,7 +102,6 @@ describe("TreeviewItem public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -127,7 +122,6 @@ describe("TreeviewItem public methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/TreeviewToggle/protected.test.js b/tests/menus/TreeviewToggle/protected.test.js index 9662254a..1b7f54e4 100644 --- a/tests/menus/TreeviewToggle/protected.test.js +++ b/tests/menus/TreeviewToggle/protected.test.js @@ -54,7 +54,6 @@ describe("TreeviewToggle protected methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -74,7 +73,6 @@ describe("TreeviewToggle protected methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -94,7 +92,6 @@ describe("TreeviewToggle protected methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -114,7 +111,6 @@ describe("TreeviewToggle protected methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -135,7 +131,6 @@ describe("TreeviewToggle protected methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -155,7 +150,6 @@ describe("TreeviewToggle protected methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -177,7 +171,6 @@ describe("TreeviewToggle protected methods", () => { // Create a new Treeview instance for testing. const menu = new Treeview({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenu/aria.test.js b/tests/menus/_baseMenu/aria.test.js index 11734601..6177584a 100644 --- a/tests/menus/_baseMenu/aria.test.js +++ b/tests/menus/_baseMenu/aria.test.js @@ -14,7 +14,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenu/click.test.js b/tests/menus/_baseMenu/click.test.js index 89078bf3..689fb983 100644 --- a/tests/menus/_baseMenu/click.test.js +++ b/tests/menus/_baseMenu/click.test.js @@ -45,7 +45,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -62,7 +61,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -84,7 +82,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -111,7 +108,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -132,7 +128,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -155,7 +150,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -178,7 +172,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -195,7 +188,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -214,7 +206,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -235,7 +226,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -258,7 +248,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -278,7 +267,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -295,7 +283,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenu/focus.test.js b/tests/menus/_baseMenu/focus.test.js index ef624a70..bff1f239 100644 --- a/tests/menus/_baseMenu/focus.test.js +++ b/tests/menus/_baseMenu/focus.test.js @@ -26,7 +26,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -45,7 +44,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenu/hover.test.js b/tests/menus/_baseMenu/hover.test.js index cb0e8d82..7a65486b 100644 --- a/tests/menus/_baseMenu/hover.test.js +++ b/tests/menus/_baseMenu/hover.test.js @@ -52,7 +52,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -72,7 +71,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -97,7 +95,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -121,7 +118,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -144,7 +140,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -173,7 +168,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -201,7 +195,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -224,7 +217,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -248,7 +240,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -274,7 +265,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -303,7 +293,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -324,7 +313,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -351,7 +339,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -390,7 +377,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "on", @@ -453,7 +439,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -479,7 +464,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -510,7 +494,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -542,7 +525,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -565,7 +547,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -591,7 +572,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -619,7 +599,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -639,7 +618,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -662,7 +640,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -687,7 +664,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -713,7 +689,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -744,7 +719,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -774,7 +748,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -804,7 +777,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -841,7 +813,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -875,7 +846,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -898,7 +868,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -924,7 +893,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -950,7 +918,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -979,7 +946,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1011,7 +977,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1044,7 +1009,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1080,7 +1044,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1111,7 +1074,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1145,7 +1107,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1182,7 +1143,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1218,7 +1178,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1246,7 +1205,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1278,7 +1236,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1313,7 +1270,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", @@ -1367,7 +1323,6 @@ describe("BaseMenu", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), hoverType: "dynamic", diff --git a/tests/menus/_baseMenu/keyboard.test.js b/tests/menus/_baseMenu/keyboard.test.js index 33cf744f..ee2d16be 100644 --- a/tests/menus/_baseMenu/keyboard.test.js +++ b/tests/menus/_baseMenu/keyboard.test.js @@ -26,7 +26,6 @@ describe("BaseMenu Controller", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -45,7 +44,6 @@ describe("BaseMenu Controller", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -72,7 +70,6 @@ describe("BaseMenu Controller", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -91,7 +88,6 @@ describe("BaseMenu Controller", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -114,7 +110,6 @@ describe("BaseMenu Controller", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -136,7 +131,6 @@ describe("BaseMenu Controller", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -158,7 +152,6 @@ describe("BaseMenu Controller", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenu/protected.test.js b/tests/menus/_baseMenu/protected.test.js index 33f3fdca..473c147d 100644 --- a/tests/menus/_baseMenu/protected.test.js +++ b/tests/menus/_baseMenu/protected.test.js @@ -36,7 +36,6 @@ describe("BaseMenu protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -54,7 +53,6 @@ describe("BaseMenu protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -73,7 +71,6 @@ describe("BaseMenu protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -100,7 +97,6 @@ describe("BaseMenu protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -118,7 +114,6 @@ describe("BaseMenu protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -137,7 +132,6 @@ describe("BaseMenu protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -156,7 +150,6 @@ describe("BaseMenu protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -178,7 +171,6 @@ describe("BaseMenu protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenu/public.test.js b/tests/menus/_baseMenu/public.test.js index 5e0fd71d..3458cdbb 100644 --- a/tests/menus/_baseMenu/public.test.js +++ b/tests/menus/_baseMenu/public.test.js @@ -24,7 +24,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -40,7 +39,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -59,7 +57,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -82,7 +79,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -98,7 +94,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -117,7 +112,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -140,7 +134,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -158,7 +151,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -181,7 +173,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -206,7 +197,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -222,7 +212,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -244,7 +233,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -269,7 +257,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -288,7 +275,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -304,7 +290,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -326,7 +311,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -348,7 +332,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -370,7 +353,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -389,7 +371,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -416,7 +397,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -438,7 +418,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -462,7 +441,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -478,7 +456,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -497,7 +474,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -517,7 +493,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); initializeMenu(menu); @@ -534,7 +509,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -550,7 +524,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -569,7 +542,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -589,7 +561,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", }); initializeMenu(menu); @@ -606,7 +577,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -638,7 +608,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -669,7 +638,6 @@ describe("BaseMenu public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenuItem/getterSetters.test.js b/tests/menus/_baseMenuItem/getterSetters.test.js index 9ba8f308..4c2061e2 100644 --- a/tests/menus/_baseMenuItem/getterSetters.test.js +++ b/tests/menus/_baseMenuItem/getterSetters.test.js @@ -26,7 +26,6 @@ describe("BaseMenuItem getter/setters", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -45,7 +44,6 @@ describe("BaseMenuItem getter/setters", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -64,7 +62,6 @@ describe("BaseMenuItem getter/setters", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenuItem/public.test.js b/tests/menus/_baseMenuItem/public.test.js index 9752fa61..20a0729c 100644 --- a/tests/menus/_baseMenuItem/public.test.js +++ b/tests/menus/_baseMenuItem/public.test.js @@ -26,7 +26,6 @@ describe("BaseMenuItem public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -47,7 +46,6 @@ describe("BaseMenuItem public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -72,7 +70,6 @@ describe("BaseMenuItem public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -93,7 +90,6 @@ describe("BaseMenuItem public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenuToggle/getterSetters.test.js b/tests/menus/_baseMenuToggle/getterSetters.test.js index bdafca40..986198e6 100644 --- a/tests/menus/_baseMenuToggle/getterSetters.test.js +++ b/tests/menus/_baseMenuToggle/getterSetters.test.js @@ -26,7 +26,6 @@ describe("BaseMenuToggle getter/setters", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -45,7 +44,6 @@ describe("BaseMenuToggle getter/setters", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -64,7 +62,6 @@ describe("BaseMenuToggle getter/setters", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -80,7 +77,6 @@ describe("BaseMenuToggle getter/setters", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenuToggle/protected.test.js b/tests/menus/_baseMenuToggle/protected.test.js index 1f7eedde..402f3360 100644 --- a/tests/menus/_baseMenuToggle/protected.test.js +++ b/tests/menus/_baseMenuToggle/protected.test.js @@ -27,7 +27,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -46,7 +45,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -68,7 +66,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -101,7 +98,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -136,7 +132,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -171,7 +166,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -206,7 +200,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), transitionDuration: 0, @@ -235,7 +228,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -257,7 +249,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -279,7 +270,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -312,7 +302,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -347,7 +336,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -382,7 +370,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -417,7 +404,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), transitionDuration: 0, @@ -444,7 +430,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -469,7 +454,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -490,7 +474,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -516,7 +499,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -541,7 +523,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -562,7 +543,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -584,7 +564,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -605,7 +584,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -628,7 +606,6 @@ describe("BaseMenuToggle protected methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); diff --git a/tests/menus/_baseMenuToggle/public.test.js b/tests/menus/_baseMenuToggle/public.test.js index 5da1cccf..ce0a1abd 100644 --- a/tests/menus/_baseMenuToggle/public.test.js +++ b/tests/menus/_baseMenuToggle/public.test.js @@ -26,7 +26,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -44,7 +43,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -65,7 +63,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -86,7 +83,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -104,7 +100,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -125,7 +120,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -146,7 +140,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -170,7 +163,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.querySelector("nav"), controllerElement: document.querySelector("button"), }); @@ -193,7 +185,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -218,7 +209,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -243,7 +233,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -264,7 +253,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -291,7 +279,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -318,7 +305,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), }); @@ -342,7 +328,6 @@ describe("BaseMenuToggle public methods", () => { // Create a new BaseMenu instance for testing. const menu = new BaseMenu({ menuElement: document.querySelector("ul"), - submenuItemSelector: "li.dropdown", containerElement: document.body, controllerElement: document.querySelector("button"), });