"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useArticleRectObserver = void 0;
const react_1 = require("react");
const ArticleRectObserver_1 = require("./ArticleRectObserver");
const useArticleRectObserver = (el) => {
    const [articleRectObserver, setArticleRectObserver] = (0, react_1.useState)(null);
    (0, react_1.useEffect)(() => {
        setArticleRectObserver(new ArticleRectObserver_1.ArticleRectObserver());
    }, []);
    (0, react_1.useEffect)(() => {
        if (!el || !articleRectObserver)
            return;
        return articleRectObserver.init(el);
    }, [el, articleRectObserver]);
    return articleRectObserver;
};
exports.useArticleRectObserver = useArticleRectObserver;
