export class ActiveLinkHighlighter {
    constructor(activeClass = "active") {
        this.activeClass = activeClass;
        this.highlightAllLinks();
    }
    normalizeUrl(url) {
        const a = document.createElement("a");
        a.href = url;
        return a.pathname.replace(/\/+$/, "");
    }
    highlightAllLinks() {
        const currentPath = this.normalizeUrl(window.location.href);
        const links = document.querySelectorAll("a");
        links.forEach((link) => {
            if (link.closest(".ribbon__title")) {
                return;
            }
            const linkPath = this.normalizeUrl(link.href);
            if (linkPath === currentPath) {
                link.classList.add(this.activeClass);
            }
        });
    }
}
//# sourceMappingURL=ActiveLinkHighlighter.js.map