import { useEffect } from 'react';
const DESKTOP = 'width=1280';
const RESPONSIVE = 'width=device-width, initial-scale=1.0';
function setMetaViewport(content) {
    const meta = document.querySelector('meta[name="viewport"]');
    if (meta)
        meta.content = content;
}
export function useFrameViewport(mode) {
    useEffect(() => {
        setMetaViewport(mode === 'desktop' ? DESKTOP : RESPONSIVE);
        window.parent.postMessage({ type: 'hnf:viewport', mode }, '*');
        return () => {
            setMetaViewport(RESPONSIVE);
            window.parent.postMessage({ type: 'hnf:viewport', mode: 'responsive' }, '*');
        };
    }, [mode]);
}
