import { jsx as _jsx } from "react/jsx-runtime";
import { useEffect, useRef } from "react";
import { BASE_PATH } from "./HistoryNavigator";
export function FixLinks({ basePath, children }) {
    const ref = useRef(null);
    useEffect(() => {
        if (ref.current) {
            const divElem = ref.current;
            const listener = (ev) => {
                const elem = ev.target;
                if (elem.tagName.toLowerCase() === 'a') {
                    ev[BASE_PATH] = basePath;
                }
            };
            divElem.addEventListener('click', listener);
            return () => {
                divElem.removeEventListener('click', listener);
            };
        }
    }, [ref.current]);
    return (_jsx("div", { ref: ref, className: "h-full w-full", children: children }));
}
//# sourceMappingURL=FixLinks.js.map