{"version":3,"file":"ScrollMemory.Caf22mEh.mjs","names":[],"sources":["https:/framerusercontent.com/modules/fks00bIZcMv1I3AEw0fE/OSDfXG6P9FNtIm8PKIys/ScrollMemory.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";function getScrollContainer(){return document.querySelector(\"[data-framer-page-optimized]\")||document.querySelector(\"[data-framer-scroll-container]\")||document.querySelector(\"main\")||document.scrollingElement||document.body;}export function withSaveScroll(Component){return props=>{const handleClick=()=>{const container=getScrollContainer();// שומרים גם את הסקול של הקונטיינר וגם של החלון לביטחון\nconst y=container.scrollTop||window.scrollY;if(y>0){sessionStorage.setItem(\"scrollY\",String(y));}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function withScrollRestore(Component){return props=>{useEffect(()=>{const saved=sessionStorage.getItem(\"scrollY\");if(!saved)return;const y=parseInt(saved);// אנחנו מחכים מעט (200ms) כדי לתת לאנימציית ה-Swipe של Framer להסתיים\nconst timeout=setTimeout(()=>{const container=getScrollContainer();// שימוש ב-scrollTo עם behavior smooth יכול לעזור,\n// אבל אם אתה רוצה שזה יראה כאילו הוא \"כבר שם\", נשאר עם הדיליי.\ncontainer.scrollTo({top:y,behavior:\"instant\"});// ניקוי ה-Session כדי שלא יקפוץ בביקורים עתידיים\nsessionStorage.removeItem(\"scrollY\");},300)// הדיליי הזה קריטי כדי לא לשבור את ה-Swipe\n;return()=>clearTimeout(timeout);},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withSaveScroll\":{\"type\":\"reactHoc\",\"name\":\"withSaveScroll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollRestore\":{\"type\":\"reactHoc\",\"name\":\"withScrollRestore\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollMemory.map"],"mappings":"2HAAwE,SAAS,GAAoB,CAAC,OAAO,SAAS,cAAc,+BAA+B,EAAE,SAAS,cAAc,iCAAiC,EAAE,SAAS,cAAc,OAAO,EAAE,SAAS,kBAAkB,SAAS,KAAM,SAAgB,EAAe,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,MAAgB,CACxX,IAAM,EADmY,GAAoB,CAC3Y,WAAW,EAAO,QAAW,EAAE,GAAG,eAAe,QAAQ,UAAU,OAAO,EAAE,CAAC,EAAI,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,QAAQ,EAAY,CAAC,EAAI,SAAgB,EAAkB,EAAU,CAAC,MAAO,KAAQ,MAAc,CAAC,IAAM,EAAM,eAAe,QAAQ,UAAU,CAAC,GAAG,CAAC,EAAM,OAAO,IAAM,EAAE,SAAS,EAAM,CACpU,EAAQ,eAAe,CAAiB,GAAoB,CAExD,SAAS,CAAC,IAAI,EAAE,SAAS,UAAU,CAAC,CAC9C,eAAe,WAAW,UAAU,EAAG,IAAI,CAC1C,UAAU,aAAa,EAAQ,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,uBAN1C,IAA6B"}