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esContent":["(function ($, Drupal) {\n\n const onEscapeClose = (event) => {\n event.stopPropagation();\n if (event.code !== 'Escape') {\n return;\n }\n\n const expandedItem = $('.sfHover');\n const expandedItemLink = $('a:first-child.sf-with-ul', expandedItem);\n\n expandedItemLink.focus();\n setTimeout(function () {\n expandedItem.superfish('hide');\n }, 100);\n }\n\n const onElementHide = () => {\n $('a.sf-with-ul').attr('aria-expanded', 'false')\n document.removeEventListener('keydown', onEscapeClose, true);\n }\n\n const initTraversableMenu = () => {\n new TraversableMenu(\n {\n panel_slide_animation_duration: false,\n selectors: {\n 'menu_item': '.menu-item'\n },\n callbacks: {\n panels: {\n initialize: {\n after: function( traversable_menu_obj ) {\n const languageContainer = document.createElement('div');\n\n if (!traversable_menu_obj.traversable_menu.panels_container) {\n return;\n }\n\n const languageParentElement = traversable_menu_obj.traversable_menu.panels_container.querySelector('.menu-item .menu-item__language').parentElement;\n languageContainer.innerHTML = languageParentElement.innerHTML;\n languageContainer.classList.add('language-container');\n languageParentElement.remove();\n\n languageContainer.querySelector('button.menu-item__language').addEventListener('click', (e) => {\n e.stopPropagation();\n const menuOpened = document.querySelector('.open-mobile-menu[aria-expanded=\"true\"]');\n\n if (menuOpened) {\n menuOpened.click();\n }\n\n if (e.target.getAttribute('aria-expanded') === 'true') {\n e.target.setAttribute('aria-expanded', 'false');\n } else {\n e.target.setAttribute('aria-expanded', 'true');\n }\n });\n\n document.querySelector('.region--header__inner').appendChild(languageContainer);\n }\n }\n },\n trigger: {\n on: (traversable_menu_obj, event) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (event.type != 'mouseup') {\n return;\n }\n\n if (event.target.getAttribute('aria-expanded') === 'false') {\n $('.menu__panel__trigger--child[aria-expanded=\"true\"]').attr('aria-expanded', 'false');\n $('.menu__panel.open').removeClass('open');\n $('.menu-item--open').removeClass('menu-item--open');\n event.target.parentElement.classList.add('menu-item--open');\n event.target.setAttribute('aria-expanded', 'true');\n event.target.nextElementSibling.classList.add('open');\n }\n else {\n event.target.setAttribute('aria-expanded', 'false');\n event.target.nextElementSibling.classList.remove('open');\n event.target.parentElement.classList.remove('menu-item--open');\n }\n }\n }\n }\n }\n );\n\n const openMenu = document.querySelector(\".open-mobile-menu\");\n openMenu.addEventListener(\"click\", (event) => {\n let timeout = 0;\n\n if (document.querySelector('.language-container .menu-item__language[aria-expanded=\"true\"]')) {\n document.querySelector('.language-container .menu-item__language[aria-expanded=\"true\"]').click();\n timeout = 500;\n }\n\n setTimeout(() => {\n if (openMenu.getAttribute('aria-expanded') === 'false') {\n openMenu.setAttribute('aria-expanded', 'true');\n document.querySelector('#block-mainnavigation-mobile').style.top = document.querySelector('.region--header').scrollHeight + 'px';\n document.querySelector('#block-mainnavigation-mobile').classList.add('open');\n document.body.classList.add('mobile-open');\n document.querySelector('html').classList.add('mobile-open');\n }\n else {\n openMenu.setAttribute('aria-expanded', 'false');\n document.querySelector('#block-mainnavigation-mobile').classList.remove('open');\n document.body.classList.remove('mobile-open');\n document.querySelector('html').classList.remove('mobile-open');\n }\n }, timeout);\n });\n }\n\n Drupal.behaviors.header = {\n attach: function (context, settings) {\n const $navContainer = $('#block-bop-main-menu ul.menu');\n $navContainer.superfish({\n delay: 400,\n onBeforeShow: () => {\n $('.sfHover a:first-child.sf-with-ul').attr('aria-expanded', 'true')\n },\n onShow: () => {\n document.addEventListener('keydown', onEscapeClose, true);\n },\n onHide: onElementHide,\n onIdle: onElementHide\n });\n }\n }\n\n Drupal.behaviors.mobile_header = {\n attach: function (context, settings) {\n initTraversableMenu();\n }\n }\n\n})(jQuery, Drupal);\n"],"names":["$","Drupal","onEscapeClose","event","stopPropagation","code","expandedItem","focus","setTimeout","superfish","onElementHide","attr","document","removeEventListener","behaviors","header","attach","context","settings","delay","onBeforeShow","onShow","addEventListener","onHide","onIdle","mobile_header","TraversableMenu","panel_slide_animation_duration","selectors","callbacks","panels","initialize","after","traversable_menu_obj","languageContainer","createElement","traversable_menu","panels_container","languageParentElement","querySelector","parentElement","innerHTML","classList","add","remove","e","menuOpened","click","target","getAttribute","setAttribute","appendChild","trigger","on","preventDefault","type","removeClass","nextElementSibling","openMenu","timeout","style","top","scrollHeight","body","initTraversableMenu","jQuery"],"sourceRoot":""}