/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./src/templates/site-layout/component/site-layout.js":
/***/ (() => {

eval("{function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nDrupal.behaviors.siteLayout = {\n  attach: function attach(context) {\n    var HTML = document.documentElement;\n    var MENU_TOGGLE = context.querySelector('[data-js=\"menu-toggle\"]');\n    if (!MENU_TOGGLE) return;\n    var SITE_HEADER = context.querySelector('[data-js=\"site-header\"]');\n    if (!SITE_HEADER) return;\n    var SITE_HEADER_CONTENT = SITE_HEADER.querySelector('.site-header__content');\n    if (!SITE_HEADER_CONTENT) return;\n    var SITE_HEADER_MENU_CONTENT = SITE_HEADER.querySelector('.site-header__menu-content');\n    if (!SITE_HEADER_MENU_CONTENT) return;\n    var FOCUSABLE_SELECTORS = \"\\n      a[href]:not([disabled]),\\n      button:not([disabled]),\\n      [tabindex]:not([tabindex=\\\"-1\\\"])\\n    \";\n    var focusableHeaderElements = _toConsumableArray(SITE_HEADER_CONTENT.querySelectorAll(FOCUSABLE_SELECTORS));\n    var focusableMenuElements = _toConsumableArray(SITE_HEADER_MENU_CONTENT.querySelectorAll(FOCUSABLE_SELECTORS));\n    var focusableElements = [].concat(_toConsumableArray(focusableHeaderElements), _toConsumableArray(focusableMenuElements));\n    var firstFocusableElement = focusableElements[0];\n    var lastFocusableElement = focusableElements[focusableElements.length - 1];\n    var closeMenu = function closeMenu() {\n      document.removeEventListener('keydown', handleKeyDown);\n      window.dispatchEvent(new CustomEvent('main-menu:animate-out:start'));\n      window.addEventListener('main-menu:animate-out:complete', _handleMainMenuAnimateOutComplete);\n    };\n    var openMenu = function openMenu() {\n      MENU_TOGGLE.setAttribute('aria-expanded', true);\n      SITE_HEADER.setAttribute('data-menu-opened', true);\n      SITE_HEADER_MENU_CONTENT.addEventListener('transitionend', _handleSiteHeaderMenuContentTransitionEnd);\n      window.addEventListener('main-menu:animate-in:complete', _handleMainMenuAnimateInComplete);\n    };\n    MENU_TOGGLE.addEventListener('click', function () {\n      // Prevent the toggle button from trigger multiple open / close events.\n      MENU_TOGGLE.setAttribute('disabled', true);\n\n      // Open the menu.\n      if (MENU_TOGGLE.getAttribute('aria-expanded') === 'false') {\n        openMenu();\n      }\n      // Close the menu.\n      else {\n        closeMenu();\n      }\n    });\n\n    /**\n     * Handles the completion of the main menu animate-in sequence.\n     * Re-enables the menu toggle button and cleans up event listeners.\n     */\n    var _handleMainMenuAnimateInComplete = function handleMainMenuAnimateInComplete() {\n      MENU_TOGGLE.removeAttribute('disabled');\n      document.addEventListener('keydown', handleKeyDown);\n      window.removeEventListener('main-menu:animate-in:complete', _handleMainMenuAnimateInComplete);\n      focusableMenuElements[0].focus();\n    };\n\n    /**\n     * Handles the completion of the main menu animate-out sequence.\n     * Resets menu state, updates ARIA attributes, and cleans up event listeners.\n     */\n    var _handleMainMenuAnimateOutComplete = function handleMainMenuAnimateOutComplete() {\n      HTML.style.overflow = 'auto';\n      MENU_TOGGLE.removeAttribute('disabled');\n      MENU_TOGGLE.setAttribute('aria-expanded', false);\n      SITE_HEADER.removeAttribute('data-menu-opened');\n      window.removeEventListener('main-menu:animate-out:complete', _handleMainMenuAnimateOutComplete);\n      document.activeElement = MENU_TOGGLE;\n    };\n\n    /**\n     * Handles the CSS transition end event for the site header menu content.\n     * Triggers the main menu animation start when the transform transition\n     * completes and cleans up event listeners.\n     *\n     * @param {TransitionEvent} event\n     * @listens transitionend\n     * @fires main-menu:animate-in:start\n     */\n    var _handleSiteHeaderMenuContentTransitionEnd = function handleSiteHeaderMenuContentTransitionEnd(event) {\n      if (event.propertyName === 'transform') {\n        HTML.style.overflow = 'hidden';\n        window.dispatchEvent(new CustomEvent('main-menu:animate-in:start'));\n        SITE_HEADER_MENU_CONTENT.removeEventListener('transitionend', _handleSiteHeaderMenuContentTransitionEnd);\n      }\n    };\n\n    /**\n     *\n     * @param {KeyboardEvent} event\n     */\n    var handleKeyDown = function handleKeyDown(event) {\n      switch (event.key) {\n        case 'Escape':\n          closeMenu();\n          break;\n        case 'Tab':\n          if (focusableElements.length === 0) {\n            event.preventDefault();\n            return;\n          }\n          if (event.shiftKey) {\n            if (document.activeElement === firstFocusableElement) {\n              lastFocusableElement.focus();\n              event.preventDefault();\n            }\n          } else if (document.activeElement === lastFocusableElement) {\n            firstFocusableElement.focus();\n            event.preventDefault();\n          }\n          break;\n      }\n    };\n  }\n};\n\n//# sourceURL=webpack://@naomi-2025/ui/./src/templates/site-layout/component/site-layout.js?\n}");

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module can't be inlined because the eval devtool is used.
/******/ 	var __webpack_exports__ = {};
/******/ 	__webpack_modules__["./src/templates/site-layout/component/site-layout.js"]();
/******/ 	
/******/ })()
;