export class SoftScrollManager {
    static enableForSelector(selector, yOffsetInRem = 0) {
        const links = document.querySelectorAll(selector);
        const offsetPx = yOffsetInRem *
            parseFloat(getComputedStyle(document.documentElement).fontSize);
        links.forEach((link) => {
            if (!(link instanceof HTMLAnchorElement))
                return;
            const href = link.getAttribute("href");
            if (!href || !href.startsWith("#") || href === "#")
                return;
            const targetId = href.slice(1);
            link.addEventListener("click", (event) => {
                event.preventDefault();
                const targetElement = document.getElementById(targetId);
                if (!targetElement) {
                    console.warn(`SoftScroll: Element not found for ID "${targetId}"`);
                    return;
                }
                const scrollTargetY = targetElement.getBoundingClientRect().top +
                    window.pageYOffset -
                    offsetPx;
                window.scrollTo({ top: scrollTargetY, behavior: "smooth" });
            });
        });
    }
}
//# sourceMappingURL=SoftScrollManager.js.map