{"version":3,"file":"Scroll_Progress.CBblxcL0.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/3bKp8YHwsSB7Hxh2Ol4f/8Fq8AE3zNJBPhmhiEH92/Scroll_Progress.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";export function withProgress(Component){return props=>{const[progress,setProgress]=useState(0);const[isScrolling,setIsScrolling]=useState(false);const prevScrollY=useRef(0);useEffect(()=>{const calculateProgress=()=>{const startEl=document.getElementById(\"start\");const endEl=document.getElementById(\"end\");if(startEl&&endEl){// Get viewport height\nconst viewportHeight=window.innerHeight;// Get the scroll position\nconst scrollTop=window.pageYOffset||document.documentElement.scrollTop;// Start is when the top of #start is at the top of the viewport\nconst startPosition=startEl.offsetTop;// End is when the bottom of #end is at the bottom of the viewport\nconst endPosition=endEl.offsetTop+endEl.offsetHeight-viewportHeight;// Calculate the total scrollable distance\nconst totalScrollDistance=endPosition-startPosition;// Calculate how far we've scrolled within our target range\nconst currentScrollDistance=scrollTop-startPosition;// Calculate progress as a percentage (0-100)\nconst scrollProgress=Math.max(0,Math.min(100,currentScrollDistance/totalScrollDistance*100));setProgress(scrollProgress);}};const handleScroll=()=>{const scrollY=window.pageYOffset||document.documentElement.scrollTop;if(scrollY!==prevScrollY.current){prevScrollY.current=scrollY;calculateProgress();setIsScrolling(true);}};const handleScrollEnd=()=>{setIsScrolling(false);};calculateProgress();window.addEventListener(\"scroll\",handleScroll);window.addEventListener(\"scrollend\",handleScrollEnd);return()=>{window.removeEventListener(\"scroll\",handleScroll);window.removeEventListener(\"scrollend\",handleScrollEnd);};},[]);return /*#__PURE__*/_jsx(Component,{...props,style:{width:`${progress}%`,transition:isScrolling?\"none\":\"width 0.5s ease-in-out\"}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withProgress\":{\"type\":\"reactHoc\",\"name\":\"withProgress\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scroll_Progress.map"],"mappings":"8IAAwF,SAAgB,EAAa,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,EAAE,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAO,EAAYC,EAAO,EAAE,CAOuW,OAPtW,MAAc,CAAC,IAAM,MAAsB,CAAC,IAAM,EAAQ,SAAS,eAAe,QAAQ,CAAO,EAAM,SAAS,eAAe,MAAM,CAAC,GAAG,GAAS,EAAM,CAC7Z,IAAM,EAAe,EAAO,YACtB,EAAU,EAAO,aAAa,SAAS,gBAAgB,UACvD,EAAc,EAAQ,UAEtB,EADY,EAAM,UAAU,EAAM,aAAa,EACf,EAChC,EAAsB,EAAU,EACuD,EAAxE,KAAK,IAAI,EAAE,KAAK,IAAI,IAAI,EAAsB,EAAoB,IAAI,CAAC,CAA4B,GAAU,MAAiB,CAAC,IAAM,EAAQ,EAAO,aAAa,SAAS,gBAAgB,UAAa,IAAU,EAAY,UAAS,EAAY,QAAQ,EAAQ,GAAmB,CAAC,EAAe,GAAK,GAAU,MAAoB,CAAC,EAAe,GAAM,EAA2H,OAAxH,GAAmB,CAAC,EAAO,iBAAiB,SAAS,EAAa,CAAC,EAAO,iBAAiB,YAAY,EAAgB,KAAW,CAAC,EAAO,oBAAoB,SAAS,EAAa,CAAC,EAAO,oBAAoB,YAAY,EAAgB,GAAK,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,MAAM,CAAC,MAAM,GAAG,EAAS,GAAG,WAAW,EAAY,OAAO,yBAAyB,CAAC,CAAC,uBAPlsB,IAA6C"}