{"version":3,"file":"TimelineProgressOverrides.RtebsMPW.mjs","names":["useRef","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/3uGEdCy4Eg3u5DiOkCoQ/XhcKYu4bnhQH3fV2dfEh/TimelineProgressOverrides.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef,useState,startTransition}from\"react\";function clamp01(value){return Math.max(0,Math.min(1,value));}function findSectionContainer(element){if(!element)return null;const closestSection=element.closest(\"section, main, article, [data-section], [data-scroll-section], [role='region']\");if(closestSection)return closestSection;return element.parentElement?.parentElement??null;}function getSectionProgress(section){const rect=section.getBoundingClientRect();const viewportHeight=window.innerHeight;const startLine=viewportHeight*.65;const endLine=viewportHeight*.35;const denominator=rect.height+(startLine-endLine);if(denominator<=0)return 0;return clamp01((startLine-rect.top)/denominator);}export function TimelineProgressFill(Component){return /*#__PURE__*/forwardRef(function TimelineProgressFillOverride(props,ref){const elementRef=useRef(null);const[progress,setProgress]=useState(0);const syncProgress=useCallback(()=>{if(typeof window===\"undefined\")return;const element=elementRef.current;const section=element?.parentElement??findSectionContainer(element);if(!section)return;const next=getSectionProgress(section);startTransition(()=>setProgress(next));},[]);useEffect(()=>{if(typeof window===\"undefined\")return;let rafId=0;const schedule=()=>{if(rafId)return;rafId=window.requestAnimationFrame(()=>{rafId=0;syncProgress();});};schedule();window.addEventListener(\"scroll\",schedule,{passive:true});window.addEventListener(\"resize\",schedule);return()=>{window.removeEventListener(\"scroll\",schedule);window.removeEventListener(\"resize\",schedule);if(rafId)window.cancelAnimationFrame(rafId);};},[syncProgress]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{elementRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},style:{...props.style,transformOrigin:\"50% 0%\"},animate:{scaleY:progress},transition:{duration:0}});});}export function TimelineProgressMarker(Component){return /*#__PURE__*/forwardRef(function TimelineProgressMarkerOverride(props,ref){const elementRef=useRef(null);const[progress,setProgress]=useState(0);const[travelDistance,setTravelDistance]=useState(0);const syncProgressAndDistance=useCallback(()=>{if(typeof window===\"undefined\")return;const element=elementRef.current;if(!element)return;const section=element.parentElement??findSectionContainer(element);if(!section)return;const parent=element.parentElement;const parentHeight=parent?.clientHeight??0;const markerHeight=element.clientHeight;const distance=Math.max(0,parentHeight-markerHeight);const next=getSectionProgress(section);startTransition(()=>{setTravelDistance(distance);setProgress(next);});},[]);useEffect(()=>{if(typeof window===\"undefined\")return;let rafId=0;const schedule=()=>{if(rafId)return;rafId=window.requestAnimationFrame(()=>{rafId=0;syncProgressAndDistance();});};schedule();window.addEventListener(\"scroll\",schedule,{passive:true});window.addEventListener(\"resize\",schedule);return()=>{window.removeEventListener(\"scroll\",schedule);window.removeEventListener(\"resize\",schedule);if(rafId)window.cancelAnimationFrame(rafId);};},[syncProgressAndDistance]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{elementRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},style:{...props.style},animate:{y:progress*travelDistance},transition:{duration:0}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"TimelineProgressFill\":{\"type\":\"reactHoc\",\"name\":\"TimelineProgressFill\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"TimelineProgressMarker\":{\"type\":\"reactHoc\",\"name\":\"TimelineProgressMarker\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TimelineProgressOverrides.map"],"mappings":"8JAA+H,SAAS,EAAQ,EAAM,CAAC,OAAO,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,CAAK,CAAC,CAAE,CAAC,SAAS,EAAqB,EAAQ,CAAwL,OAAnL,EAAyC,EAAQ,QAAQ,gFAAqF,IAA4C,EAAQ,eAAe,eAAe,MAAjN,IAAsN,CAAC,SAAS,EAAmB,EAAQ,CAAC,IAAM,EAAK,EAAQ,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