"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useGetScrollableParent = void 0;
var react_1 = require("react");
var getScrollableParent_1 = require("powerhooks/getScrollableParent");
function useGetScrollableParent(params) {
    var _a;
    var ref = (_a = params === null || params === void 0 ? void 0 : params.ref) !== null && _a !== void 0 ? _a : (0, react_1.useRef)(null);
    var _b = __read((0, react_1.useState)(undefined), 2), scrollableParent = _b[0], setScrollableParent = _b[1];
    (0, react_1.useEffect)(function () {
        if (!ref.current)
            return;
        setScrollableParent((0, getScrollableParent_1.getScrollableParent)(ref.current));
    }, [ref.current]);
    return {
        scrollableParent: scrollableParent,
        ref: ref,
    };
}
exports.useGetScrollableParent = useGetScrollableParent;
//# sourceMappingURL=useGetScrollableParent.js.map