import{useEffect,useRef}from"react";import{useLocation}from"react-router-dom";import{removeLeadingSlash}from"@redocly/theme";import{getElementById}from"../Content/useAutoScroll";function useScrollOnRender(e,o){const r=useRef(null),t=useLocation(),n=removeLeadingSlash(t.pathname.replace(o,""));return useEffect((()=>{var o;if(r.current&&e.href&&removeLeadingSlash(e.href)===n&&("function"==typeof(null===(o=null==r?void 0:r.current)||void 0===o?void 0:o.scrollIntoView)&&r.current.scrollIntoView(),t.hash)){const e=getElementById(t.hash.replace("#","").toLowerCase());e&&e.scrollIntoView()}}),[]),r}export default useScrollOnRender;
//# sourceMappingURL=useScrollOnRender.js.map