import { useRef } from "react";
import { useEditContext } from "../client/editContext";
export function usePinnedHoveredComponentId(pageViewContext) {
    const editContext = useEditContext();
    const hoveredComponentId = pageViewContext?.bridgeInteraction?.kind === "hover"
        ? pageViewContext.bridgeInteraction.componentId
        : undefined;
    const lastHoveredComponentIdRef = useRef(undefined);
    if (hoveredComponentId) {
        lastHoveredComponentIdRef.current = hoveredComponentId;
    }
    const keepPlaceholderInsertHover = editContext?.currentOverlay === "context-menu" &&
        editContext.contextMenuSource === "placeholder-insert";
    return hoveredComponentId || keepPlaceholderInsertHover
        ? (hoveredComponentId ?? lastHoveredComponentIdRef.current)
        : undefined;
}
//# sourceMappingURL=usePinnedHoveredComponentId.js.map