{"version":3,"file":"SectionHandoff.EPqD5ONT.mjs","names":["useRef","__esmMin","init_ssg_sandbox_shims","window","de","c","J","init_jsx_runtime","init_npm_react_18_3_1","ce","useScroll","useMotionValue","useTransform","init_framer_motion_DhsWWWsN","useReducedMotion","withSectionHandoff","local","reduce","range","measure","el","top","h","vh","start","end","y","scrollY","v","setRef","ref","rest","props","touch","Component","style","init_SectionHandoff"],"sources":["https:/framerusercontent.com/modules/vuHgjZj16JnopDbS7uS2/7JDVWOO95XVupSGYzKxf/SectionHandoff.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";import{useScroll,useTransform,useReducedMotion,useMotionValue}from\"framer-motion\";/**\n * Section handoff: once a section has been fully read (its bottom reaches the\n * bottom of the viewport, and never before the page has scrolled past its top),\n * it lags slightly behind while the next section (higher z-index, opaque fill)\n * slides over it. At rest it is never offset.\n */export function withSectionHandoff(Component){return /*#__PURE__*/forwardRef(function SectionHandoff(props,ref){const local=useRef(null);const reduce=useReducedMotion();const{scrollY}=useScroll();const range=useMotionValue({start:0,end:1});useEffect(()=>{const measure=()=>{const el=local.current;if(!el)return;const top=el.offsetTop;const h=el.offsetHeight;const vh=window.innerHeight;const start=Math.max(top+h-vh,top,1);const end=Math.max(start+1,top+h);range.set({start,end});};measure();window.addEventListener(\"resize\",measure);const t=setTimeout(measure,600);return()=>{window.removeEventListener(\"resize\",measure);clearTimeout(t);};},[]);const y=useTransform(scrollY,v=>{const{start,end}=range.get();const p=Math.min(1,Math.max(0,(v-start)/(end-start)));return p*140;});const setRef=el=>{local.current=el;if(typeof ref===\"function\")ref(el);else if(ref)ref.current=el;};const{style,...rest}=props;const touch=typeof window!==\"undefined\"&&window.matchMedia(\"(hover: none), (pointer: coarse)\").matches;// Touch devices scroll natively, with no per-frame transforms.\nif(reduce||touch)return /*#__PURE__*/_jsx(Component,{...rest,ref:setRef,style:style});return /*#__PURE__*/_jsx(Component,{...rest,ref:setRef,style:{...style,y}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withSectionHandoff\":{\"type\":\"reactHoc\",\"name\":\"withSectionHandoff\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SectionHandoff.map"],"mappings":"A,oNAKG,SAAgBe,EAAmB,EAAU,CAAC,MAAoB,gBAAW,SAAwB,EAAM,EAAI,CAAC,IAAMC,EAAMhB,EAAO,IAAI,EAAQiB,EAAOH,EAAiB,EAAO,CAAC,WAASJ,EAAU,EAAQQ,EAAMP,EAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,EAAEF,MAAc,CAAC,IAAMU,MAAY,CAAC,IAAMC,EAAGJ,EAAM,QAAQ,GAAG,CAACI,EAAG,OAAO,IAAMC,EAAID,EAAG,UAAgBE,EAAEF,EAAG,aAAmBG,EAAGpB,EAAO,YAAkBqB,EAAM,KAAK,IAAIH,EAAIC,EAAEC,EAAGF,EAAI,CAAC,EAAQI,EAAI,KAAK,IAAID,EAAM,EAAEH,EAAIC,CAAC,EAAEJ,EAAM,IAAI,CAAC,QAAM,KAAG,CAAC,CAAE,EAAEC,EAAQ,EAAEhB,EAAO,iBAAiB,SAASgB,CAAO,EAAE,IAAM,EAAE,WAAWA,EAAQ,GAAG,EAAE,UAAU,CAAChB,EAAO,oBAAoB,SAASgB,CAAO,EAAE,aAAa,CAAC,CAAE,CAAE,EAAE,CAAC,CAAC,EAAE,IAAMO,EAAEd,EAAae,EAAQ,GAAG,CAAC,GAAK,CAAC,QAAM,OAAKT,EAAM,IAAI,EAAwD,OAA9C,KAAK,IAAI,EAAE,KAAK,IAAI,GAAGU,EAAEJ,IAAQC,EAAID,EAAM,CAAU,EAAE,GAAI,CAAC,EAAQK,EAAO,GAAI,CAAC,EAAM,QAAQT,EAAM,OAAOU,GAAM,WAAWA,EAAIV,CAAE,EAAUU,IAAI,EAAI,QAAQV,EAAG,EAAO,CAAC,QAAM,GAAGW,GA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