{"version":3,"file":"PositionMarker.BiC_xo9x.mjs","names":[],"sources":["https:/framerusercontent.com/modules/5OQsUC5TW6qWODqVnj7P/IvTYGkAFUERYVFvzlwoy/PositionMarker.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";export function withScrollRestore(Component){return props=>{useEffect(()=>{if(\"scrollRestoration\"in history)history.scrollRestoration=\"manual\";const target=parseInt(sessionStorage.getItem(\"listScrollY\")??\"0\");sessionStorage.removeItem(\"listScrollY\");let attempts=0;let lastScrollHeight=0;let stableCount=0;const tryScroll=()=>{const reachable=document.body.scrollHeight-window.innerHeight;const effective=Math.min(target,reachable);stableCount=document.body.scrollHeight>lastScrollHeight?0:stableCount+1;lastScrollHeight=document.body.scrollHeight;if(effective<target&&stableCount<5&&attempts++<50)return void setTimeout(tryScroll,100);window.scrollTo({top:effective,behavior:\"instant\"});if(Math.abs(window.scrollY-effective)>=5&&attempts++<50)setTimeout(tryScroll,100);};if(target>0)setTimeout(tryScroll,50);const clickHandler=e=>{const link=e.target.closest(\"a\");if(link?.href?.includes(\"/item/\"))sessionStorage.setItem(\"listScrollY\",String(window.scrollY));};document.addEventListener(\"click\",clickHandler);return()=>document.removeEventListener(\"click\",clickHandler);},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withScrollRestore\":{\"type\":\"reactHoc\",\"name\":\"withScrollRestore\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PositionMarker.map"],"mappings":"gIAAwE,SAAgB,EAAkB,EAAU,CAAC,MAAO,KAAQ,MAAc,CAAI,sBAAsB,UAAQ,QAAQ,kBAAkB,UAAS,IAAM,EAAO,SAAS,eAAe,QAAQ,cAAc,EAAE,IAAI,CAAC,eAAe,WAAW,cAAc,CAAC,IAAI,EAAS,EAAM,EAAiB,EAAM,EAAY,EAAQ,MAAc,CAAC,IAAM,EAAU,SAAS,KAAK,aAAa,EAAO,YAAkB,EAAU,KAAK,IAAI,EAAO,EAAU,CAAqH,GAApH,EAAY,SAAS,KAAK,aAAa,EAAiB,EAAE,EAAY,EAAE,EAAiB,SAAS,KAAK,aAAgB,EAAU,GAAQ,EAAY,GAAG,IAAW,GAAG,OAAO,KAAK,WAAW,EAAU,IAAI,CAAC,EAAO,SAAS,CAAC,IAAI,EAAU,SAAS,UAAU,CAAC,CAAI,KAAK,IAAI,EAAO,QAAQ,EAAU,EAAE,GAAG,IAAW,IAAG,WAAW,EAAU,IAAI,EAAM,EAAO,GAAE,WAAW,EAAU,GAAG,CAAC,IAAM,EAAa,GAAG,CAAY,EAAE,OAAO,QAAQ,IAAI,EAAU,MAAM,SAAS,SAAS,EAAC,eAAe,QAAQ,cAAc,OAAO,EAAO,QAAQ,CAAC,EAAmD,OAAhD,SAAS,iBAAiB,QAAQ,EAAa,KAAW,SAAS,oBAAoB,QAAQ,EAAa,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,uBAAhoC,IAA6B"}