var t={615:(t,e,s)=>{s.d(e,{A:()=>o});class o{constructor(t,e,s){this.el=t,this.options=e,this.events=s,this.el=t,this.options=e,this.events={}}createCollection(t,e){var s;t.push({id:(null===(s=null==e?void 0:e.el)||void 0===s?void 0:s.id)||t.length+1,element:e})}fireEvent(t,e=null){if(this.events.hasOwnProperty(t))return this.events[t](e)}on(t,e){this.events[t]=e}}},926:(t,e,s)=>{s.d(e,{JD:()=>l,gj:()=>o});
/*
 * @version: 2.5.0
 * @author: Preline Labs Ltd.
 * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
 * Copyright 2024 Preline Labs Ltd.
 */
const o=(t,e,s="")=>(window.getComputedStyle(t).getPropertyValue(e)||s).replace(" ","");const l=(t,e,s=null)=>{const o=new CustomEvent(t,{detail:{payload:s},bubbles:!0,cancelable:!0,composed:!1});e.dispatchEvent(o)}}},e={};function s(o){var l=e[o];if(void 0!==l)return l.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,s),i.exports}s.d=(t,e)=>{for(var o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o={};s.d(o,{A:()=>n});var l=s(926),i=s(615);
/*
 * HSScrollspy
 * @version: 2.5.0
 * @author: Preline Labs Ltd.
 * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
 * Copyright 2024 Preline Labs Ltd.
 */
class r extends i.A{constructor(t,e={}){super(t,e),this.activeSection=null,this.contentId=this.el.getAttribute("data-hs-scrollspy"),this.content=document.querySelector(this.contentId),this.links=this.el.querySelectorAll("[href]"),this.sections=[],this.scrollableId=this.el.getAttribute("data-hs-scrollspy-scrollable-parent"),this.scrollable=this.scrollableId?document.querySelector(this.scrollableId):document,this.init()}init(){this.createCollection(window.$hsScrollspyCollection,this),this.links.forEach((t=>{this.sections.push(this.scrollable.querySelector(t.getAttribute("href")))})),Array.from(this.sections).forEach((t=>{if(!t.getAttribute("id"))return!1;this.scrollable.addEventListener("scroll",(e=>this.update(e,t)))})),this.links.forEach((t=>{t.addEventListener("click",(e=>{if(e.preventDefault(),"javascript:;"===t.getAttribute("href"))return!1;this.scrollTo(t)}))}))}update(t,e){const s=parseInt((0,l.gj)(this.el,"--scrollspy-offset","0")),o=parseInt((0,l.gj)(e,"--scrollspy-offset"))||s,i=t.target===document?0:parseInt(String(t.target.getBoundingClientRect().top)),r=parseInt(String(e.getBoundingClientRect().top))-o-i,n=e.offsetHeight;if(r<=0&&r+n>0){if(this.activeSection===e)return!1;this.links.forEach((t=>{t.classList.remove("active")}));const t=this.el.querySelector(`[href="#${e.getAttribute("id")}"]`);if(t){t.classList.add("active");const e=t.closest("[data-hs-scrollspy-group]");if(e){const t=e.querySelector("[href]");t&&t.classList.add("active")}}this.activeSection=e}}scrollTo(t){const e=t.getAttribute("href"),s=document.querySelector(e),o=parseInt((0,l.gj)(this.el,"--scrollspy-offset","0")),i=parseInt((0,l.gj)(s,"--scrollspy-offset"))||o,r=this.scrollable===document?0:this.scrollable.offsetTop,n=s.offsetTop-i-r,c=this.scrollable===document?window:this.scrollable,a=()=>{window.history.replaceState(null,null,t.getAttribute("href")),"scrollTo"in c&&c.scrollTo({top:n,left:0,behavior:"smooth"})},h=this.fireEvent("beforeScroll",this.el);(0,l.JD)("beforeScroll.hs.scrollspy",this.el,this.el),h instanceof Promise?h.then((()=>a())):a()}static getInstance(t,e=!1){const s=window.$hsScrollspyCollection.find((e=>e.element.el===("string"==typeof t?document.querySelector(t):t)));return s?e?s:s.element.el:null}static autoInit(){window.$hsScrollspyCollection||(window.$hsScrollspyCollection=[]),document.querySelectorAll("[data-hs-scrollspy]:not(.--prevent-on-load-init)").forEach((t=>{window.$hsScrollspyCollection.find((e=>{var s;return(null===(s=null==e?void 0:e.element)||void 0===s?void 0:s.el)===t}))||new r(t)}))}}window.addEventListener("load",(()=>{r.autoInit()})),"undefined"!=typeof window&&(window.HSScrollspy=r);const n=r;var c=o.A;export{c as default};