import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
const useViewportMeta = ()=>{
    const contentRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)('initial-scale=0.1');
    const metaRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)();
    (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
        let meta = document.querySelector('meta[name="viewport"]');
        if (meta) contentRef.current = meta.content;
        else {
            meta = document.createElement('meta');
            meta.name = 'viewport';
        }
        if (meta) {
            meta.content = 'width=device-width, initial-scale=1, user-scalable=0';
            metaRef.current = meta;
        }
    }, []);
    const restore = ()=>{
        if (metaRef.current) metaRef.current.content = contentRef.current;
    };
    return {
        metaRef,
        restore
    };
};
function useViewport() {
    const { metaRef, restore } = useViewportMeta();
    (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
        if (!metaRef.current) return;
        document.head.insertBefore(metaRef.current, document.head.firstChild);
        return ()=>{
            restore();
        };
    }, []);
}
export { useViewport };
