"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
const react_router_dom_1 = require("react-router-dom");
function ScrollToTop() {
    const location = (0, react_router_dom_1.useLocation)();
    (0, react_1.useEffect)(() => {
        var _a, _b, _c;
        const preventScroll = ((_a = location.state) === null || _a === void 0 ? void 0 : _a.preventScrollTop) === true || // Handle state passed down via Tabs
            ((_c = (_b = location.state) === null || _b === void 0 ? void 0 : _b.preventScrollTop) === null || _c === void 0 ? void 0 : _c[location.pathname]); // Handle state passed down via HistoryConsistentPush hook
        if (preventScroll) {
            return;
        }
        window.scrollTo(0, 0);
    }, [location.pathname]);
    return null;
}
exports.default = ScrollToTop;
//# sourceMappingURL=ScrollToTop.js.map