!function(){const e=[...document.querySelectorAll(".purdue-home-tabs")];function t(e){if(e){const t=e.substring(1),s=document.querySelectorAll(".purdue-home-tabs__panel"),a=document.querySelectorAll(".purdue-home-tabs__header"),r=document.querySelector(`.purdue-home-tabs__panel[data-name="${t}"]`);let c=null;if(s.forEach(e=>e.classList.remove("active")),a.forEach(e=>e.classList.remove("active")),r){r.classList.add("active");const e=r.getAttribute("id");if(c=Array.from(a).find(t=>t.getAttribute("aria-controls")===e),c){c.classList.add("active"),c.setAttribute("aria-selected","true");const e=c.closest(".purdue-home-tabs").querySelector(".arrow");e&&(e.style.top=c.offsetTop+c.offsetHeight/2+"px")}let t=r;for(;t;){if(t&&t.classList.contains("purdue-home-tabs")){t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"});break}t=t.parentElement}}}}function s(e){const t=e.querySelector(".arrow"),s=e.querySelector(".purdue-home-tabs__header.active");t&&s&&(t.style.top=s.offsetTop+s.offsetHeight/2+"px")}e&&e.length>0&&e.forEach(e=>{const t=[...e.querySelectorAll(".purdue-home-tabs__header")],s=[...e.querySelectorAll(".purdue-home-tabs__panel")],a=s[0].parentElement,r=e.querySelector(".arrow"),c=e.querySelector(".purdue-home-tabs__header.active");r&&(r.style.top=c.offsetTop+c.offsetHeight/2+"px"),t.forEach((e,t)=>{let r=e.cloneNode(!0);r.id="accrdion-"+r.id,r.classList.remove("purdue-home-tabs__header"),r.classList.add("purdue-home-tabs__header-mobile"),r.setAttribute("role","button"),a.insertBefore(r,s[t])});let o=[...e.querySelectorAll(".purdue-home-tabs__header-mobile")];t.forEach((e,a)=>{e.addEventListener("click",()=>{s.forEach((e,t)=>{a===t?e.classList.add("active"):e.classList.remove("active")}),t.forEach((e,t)=>{a===t?(e.classList.add("active"),e.setAttribute("aria-selected","true")):(e.classList.remove("active"),e.setAttribute("aria-selected","false"))}),o.forEach((e,t)=>{a===t?(e.classList.add("active"),e.setAttribute("aria-selected","true")):(e.classList.remove("active"),e.setAttribute("aria-selected","false"))}),r&&(r.style.top=e.offsetTop+e.offsetHeight/2+"px")})}),o.forEach((e,a)=>{e.addEventListener("click",c=>{s.forEach((e,t)=>{a===t?e.classList.contains("active")?e.classList.remove("active"):e.classList.add("active"):e.classList.remove("active")}),o.forEach((t,s)=>{a===s?e.classList.contains("active")?(e.classList.remove("active"),e.setAttribute("aria-selected","false")):(e.classList.add("active"),e.setAttribute("aria-selected","true")):(t.classList.remove("active"),t.setAttribute("aria-selected","false"))}),t.forEach((e,t)=>{a===t?(e.classList.add("active"),e.setAttribute("aria-selected","true")):(e.classList.remove("active"),e.setAttribute("aria-selected","false"))}),r&&t[a]&&(r.style.top=t[a].offsetTop+t[a].offsetHeight/2+"px")})})}),window.onload=function(){location.hash?t(location.hash):e.forEach(e=>{const t=e.querySelectorAll(".purdue-home-tabs__header"),a=e.querySelectorAll(".purdue-home-tabs__panel"),r=e.querySelectorAll(".purdue-home-tabs__header-mobile");if(t.forEach(e=>e.classList.remove("active")),a.forEach(e=>e.classList.remove("active")),r.forEach(e=>e.classList.remove("active")),t.length>0&&a.length>0){const s=t[0];s.classList.add("active"),s.setAttribute("aria-selected","true"),a[0].classList.add("active");const r=e.querySelector(".arrow");r&&s&&(r.style.top=s.offsetTop+s.offsetHeight/2+"px")}r.length>0&&(r[0].classList.add("active"),r[0].setAttribute("aria-selected","true")),s(e)})},window.addEventListener("popstate",function(){t(location.hash)}),window.addEventListener("resize",function(){const t=window.innerWidth>=768;e.forEach(e=>{const a=e.querySelectorAll(".purdue-home-tabs__header"),r=e.querySelectorAll(".purdue-home-tabs__panel"),c=e.querySelectorAll(".purdue-home-tabs__header-mobile"),o=e.querySelector(".purdue-home-tabs__header.active");if(t)if(!o&&a.length>0&&r.length>0)a.forEach(e=>e.classList.remove("active")),r.forEach(e=>e.classList.remove("active")),c.forEach(e=>e.classList.remove("active")),a[0].classList.add("active"),a[0].setAttribute("aria-selected","true"),r[0].classList.add("active");else if(o){r.forEach(e=>e.classList.remove("active"));const t=o.getAttribute("aria-controls");let s=null;t&&(s=e.querySelector(`.purdue-home-tabs__panel#${CSS.escape(t)}`)),s?s.classList.add("active"):r.length>0&&r[0].classList.add("active")}s(e)})})}();