{"version":3,"file":"Sticky_mover.BhxO2uLF.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/oSvMD46sPlhohOL8QC72/qocqANbdihn1sp8NsRdj/Sticky_mover.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";export function withStickyTracking(Component){return props=>{const ref=useRef(null);useEffect(()=>{const el=ref.current;if(!el)return;el.style.transition=\"none\";el.style.transformOrigin=\"right center\";const topSentinel=document.createElement(\"div\");topSentinel.style.cssText=\"height:1px; margin-bottom:-1px; pointer-events:none; visibility:hidden;\";el.parentElement?.insertBefore(topSentinel,el);let isStuck=false;let isInitialised=false;const getTranslateX=()=>{const elWidth=el.offsetWidth;const parentWidth=el.parentElement?.offsetWidth??0;console.log(\"[StickyTracking] elWidth:\",elWidth,\"parentWidth:\",parentWidth);return parentWidth-elWidth;};const applyTransform=()=>{el.style.transform=isStuck?`translateX(${getTranslateX()}px) scale(0.85)`:`translateX(0) scale(1)`;};const elResizeObserver=new ResizeObserver(()=>{if(!isStuck)return;applyTransform();});const viewportResizeObserver=new ResizeObserver(()=>{if(!isStuck)return;applyTransform();});elResizeObserver.observe(el);viewportResizeObserver.observe(document.documentElement);const topObserver=new IntersectionObserver(([entry])=>{if(!isInitialised){isInitialised=true;const sentinelTop=topSentinel.getBoundingClientRect().top;isStuck=!entry.isIntersecting&&sentinelTop<0;console.log(\"[StickyTracking] init — scrollY:\",window.scrollY,\"sentinelTop:\",sentinelTop,\"isStuck:\",isStuck);applyTransform();setTimeout(()=>{el.style.transition=\"transform 0.3s ease\";},100);return;}// Only trigger stuck when sentinel exits from the top (boundingRect.top < 0)\n// Ignore when it exits from the bottom (scrolling down into section)\nconst sentinelTop=entry.boundingClientRect.top;if(!entry.isIntersecting&&sentinelTop>0){// Sentinel is below viewport — we haven't reached it yet, ignore\nreturn;}isStuck=!entry.isIntersecting;applyTransform();},{threshold:[1]});topObserver.observe(topSentinel);return()=>{topObserver.disconnect();elResizeObserver.disconnect();viewportResizeObserver.disconnect();topSentinel.remove();};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withStickyTracking\":{\"type\":\"reactHoc\",\"name\":\"withStickyTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Sticky_mover.map"],"mappings":"uIAA+E,SAAgB,EAAmB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAIA,EAAO,IAAI,EAG6E,OAH3E,MAAc,CAAC,IAAM,EAAG,EAAI,QAAQ,GAAG,CAAC,EAAG,OAAO,EAAG,MAAM,WAAW,OAAO,EAAG,MAAM,gBAAgB,eAAe,IAAM,EAAY,SAAS,cAAc,KAAK,EAAE,EAAY,MAAM,QAAQ,0EAA0E,EAAG,eAAe,aAAa,EAAY,CAAE,EAAE,IAAI,EAAQ,GAAU,EAAc,GAAY,MAAkB,CAAC,IAAM,EAAQ,EAAG,YAAkB,EAAY,EAAG,eAAe,aAAa,EAA8E,OAA5E,QAAQ,IAAI,4BAA4B,EAAQ,eAAe,CAAW,EAAS,EAAY,CAAQ,EAAQ,MAAmB,CAAC,EAAG,MAAM,UAAU,EAAQ,cAAc,EAAc,EAAE,iBAAiB,wBAAyB,EAAQ,EAAiB,IAAI,mBAAmB,CAAK,GAAe,EAAe,CAAE,CAAC,EAAQ,EAAuB,IAAI,mBAAmB,CAAK,GAAe,EAAe,CAAE,CAAC,EAAE,EAAiB,QAAQ,CAAE,EAAE,EAAuB,QAAQ,SAAS,eAAe,EAAE,IAAM,EAAY,IAAI,sBAAsB,CAAC,KAAS,CAAC,GAAG,CAAC,EAAc,CAAC,EAAc,GAAK,IAAM,EAAY,EAAY,sBAAsB,CAAC,CAAC,IAAI,EAAQ,CAAC,EAAM,gBAAgB,EAAY,EAAE,QAAQ,IAAI,mCAAmC,EAAO,QAAQ,eAAe,EAAY,WAAW,CAAO,EAAE,EAA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