document.addEventListener("DOMContentLoaded",()=>{const n="is-open",a=window.matchMedia("(prefers-reduced-motion: reduce)").matches;function i(e){const t=e.nextElementSibling;var r=e.querySelector('[accordion="toggle"]');t&&(e.setAttribute("aria-expanded","true"),e.classList.add(n),t.setAttribute("aria-hidden","false"),r?.classList.add(n),a?t.style.maxHeight="none":(t.style.maxHeight=t.scrollHeight+"px",t.addEventListener("transitionend",()=>{"true"===e.getAttribute("aria-expanded")&&(t.style.maxHeight="none")},{once:!0})))}function o(e){const t=e.nextElementSibling;var r=e.querySelector('[accordion="toggle"]');t&&(e.setAttribute("aria-expanded","false"),e.classList.remove(n),t.setAttribute("aria-hidden","true"),r?.classList.remove(n),a?t.style.maxHeight=null:(t.style.maxHeight=t.scrollHeight+"px",requestAnimationFrame(()=>{t.style.maxHeight=null})))}document.querySelectorAll('[accordion="group"]').forEach(e=>{const a=Array.from(e.querySelectorAll('[accordion="header"]')),r="true"===e.getAttribute("accordion-multiopen");a.forEach(e=>{"true"===e.getAttribute("aria-expanded")&&i(e)}),e.addEventListener("click",e=>{const t=e.target.closest('[accordion="header"]');t&&(e="true"===t.getAttribute("aria-expanded"),r||a.forEach(e=>{e!==t&&o(e)}),(e?o:i)(t))}),a.forEach((r,n)=>{r.addEventListener("keydown",e=>{let t=null;"ArrowDown"===e.key?t=a[(n+1)%a.length]:"ArrowUp"===e.key?t=a[(n-1+a.length)%a.length]:"Home"===e.key?t=a[0]:"End"===e.key?t=a[a.length-1]:"Enter"!==e.key&&" "!==e.key||r.click(),t?(t.focus(),e.preventDefault()):"Enter"!==e.key&&" "!==e.key||e.preventDefault()})})})});