(()=>{function t(t){if(!t)return"horizontal";const e=window.getComputedStyle(t).flexDirection;let n;return n="column"===e||"column-reverse"===e?"vertical":"horizontal",t.setAttribute("aria-orientation",n),n}const e=t=>{const e=t.closest(".gb-tabs");if(!e)return;const n=e.querySelector(".gb-tabs__items");if(!n)return;const s=[...t.parentElement.children].filter((t=>t.classList.contains("gb-tabs__button")||t.classList.contains("gb-tabs__menu-item"))).indexOf(t),r=n.querySelectorAll(":scope > .gb-tabs__item"),o=r[s];if(!o||o.classList.contains("gb-tabs__item-open"))return;const i=e.querySelector(".gb-tabs__menu")||e.querySelector(".gb-tabs__buttons");if(!i)return;const a=i.querySelectorAll(".gb-tabs__menu-item").length?i.querySelectorAll(".gb-tabs__menu-item"):i.querySelectorAll(".gb-tabs__button");r.forEach((t=>{t.classList.remove("gb-tabs__item-open")})),a.forEach((t=>{t.setAttribute("aria-selected",!1),t.classList.remove("gb-block-is-current"),t.setAttribute("tabindex","-1")}));const b=a[s];o.classList.add("gb-tabs__item-open"),o.classList.add("gb-tabs__item-transition"),setTimeout((()=>o.classList.remove("gb-tabs__item-transition")),100),e.setAttribute("data-opened-tab",s+1),b.setAttribute("aria-selected",!0),b.classList.add("gb-block-is-current"),b.setAttribute("tabindex","0")};function n(){const t=window.location.hash;if(t){const e=document.getElementById(String(t).replace("#",""));if(e&&e.classList.contains("gb-tabs__item")){const t=e.closest(".gb-tabs");if(!t||!e.parentElement)return;const n=t.querySelector(".gb-tabs__menu")||t.querySelector(".gb-tabs__buttons"),s=[...e.parentElement.children].indexOf(e);n&&n.children&&n.children[s]&&(n.children[s].click(),n.scrollIntoView())}}}function s(){document.querySelectorAll(".gb-tabs__menu, .gb-tabs__buttons").forEach((e=>{const n=t(e);e.setAttribute("aria-orientation",n)}))}let r;document.addEventListener("click",(t=>{const n=t.target.closest(".gb-tabs__menu-item")||t.target.closest(".gb-tabs__button");n&&e(n)})),document.addEventListener("keydown",(n=>{const s=n.target.closest(".gb-tabs__menu-item")||n.target.closest(".gb-tabs__button");if(!s)return;const r=s.closest(".gb-tabs");if(!r)return;const o=r.querySelector(".gb-tabs__menu")||r.querySelector(".gb-tabs__buttons");if(!o)return;if("BUTTON"!==s.tagName.toUpperCase()&&(" "===n.key||"Enter"===n.key||"Spacebar"===n.key))return n.preventDefault(),void e(s);const i=[...o.children].filter((t=>t.classList.contains("gb-tabs__menu-item")||t.classList.contains("gb-tabs__button"))),a=i.indexOf(s),b=t(o);let l=-1;"horizontal"===b?"ArrowLeft"===n.key?(n.preventDefault(),l=a>0?a-1:i.length-1):"ArrowRight"===n.key&&(n.preventDefault(),l=a<i.length-1?a+1:0):"vertical"===b&&("ArrowUp"===n.key?(n.preventDefault(),l=a>0?a-1:i.length-1):"ArrowDown"===n.key&&(n.preventDefault(),l=a<i.length-1?a+1:0)),"Home"===n.key?(n.preventDefault(),l=0):"End"===n.key&&(n.preventDefault(),l=i.length-1),-1!==l&&i[l]&&(i[l].focus(),e(i[l]))})),document.addEventListener("DOMContentLoaded",n),window.addEventListener("hashchange",n),document.addEventListener("DOMContentLoaded",(function(){!function(){const t=document.querySelectorAll(".gb-tabs__item");t&&0!==t.length&&t.forEach((t=>{const e=t.closest(".gb-tabs");if(!e)return;const n=e.querySelector(".gb-tabs__menu")||e.querySelector(".gb-tabs__buttons");if(!n)return;const s=(n.querySelectorAll(".gb-tabs__menu-item").length?n.querySelectorAll(".gb-tabs__menu-item"):n.querySelectorAll(".gb-tabs__button"))[[...t.parentElement.children].indexOf(t)];if(!s)return;const r=s.getAttribute("id");r&&t.setAttribute("aria-labelledby",r);const o=t.getAttribute("id");o&&s.setAttribute("aria-controls",o),t.classList.contains("gb-tabs__item-open")&&s?(s.setAttribute("aria-selected",!0),s.setAttribute("tabindex","0")):s&&(s.setAttribute("aria-selected",!1),s.setAttribute("tabindex","-1"))}))}(),document.querySelectorAll(".gb-tabs").forEach((t=>{const e=t.querySelector(".gb-tabs__menu")||t.querySelector(".gb-tabs__buttons");if(!e)return;const n=e.querySelectorAll(".gb-tabs__menu-item").length?e.querySelectorAll(".gb-tabs__menu-item"):e.querySelectorAll(".gb-tabs__button");let s=!1;n.forEach((t=>{"true"===t.getAttribute("aria-selected")?(t.setAttribute("tabindex","0"),s=!0):t.setAttribute("tabindex","-1")})),!s&&n.length>0&&n[0].setAttribute("tabindex","0")})),s()})),window.addEventListener("resize",(()=>{clearTimeout(r),r=setTimeout(s,150)}))})();