{"version":3,"file":"Scroll_Progress.b7Nc8Gv9.mjs","names":[],"sources":["https:/framerusercontent.com/modules/Lx8M6qSvkUvRMEeB2RFi/bOPt7BMI2qAM3HQHcYan/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){const sectionHeight=endEl.offsetTop-startEl.offsetTop;const scrollDistance=window.pageYOffset||document.documentElement.scrollTop;const sectionScrollDistance=scrollDistance-startEl.offsetTop;const sectionProgress=sectionScrollDistance/sectionHeight*100;setProgress(sectionProgress);}};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":"mNAAwF,SAAgB,EAAa,EAAU,CAAC,MAAO,CAAA,GAAO,CAAC,GAAK,CAAC,EAAS,EAAY,CAAC,EAAS,EAAE,CAAM,CAAC,EAAY,EAAe,CAAC,GAAS,EAAM,CAAO,EAAY,EAAO,EAAE,CAAs6B,MAAr6B,GAAU,IAAI,CAAC,IAAM,EAAkB,IAAI,CAAC,IAAM,EAAQ,SAAS,eAAe,QAAQ,CAAO,EAAM,SAAS,eAAe,MAAM,CAAC,GAAG,GAAS,EAAM,CAAC,IAAM,EAAc,EAAM,UAAU,EAAQ,UAAgB,EAAe,EAAO,aAAa,SAAS,gBAAgB,UAAgB,EAAsB,EAAe,EAAQ,UAAgB,EAAgB,EAAsB,EAAc,IAAI,EAAY,EAAgB,AAAE,CAAC,EAAO,EAAa,IAAI,CAAC,IAAM,EAAQ,EAAO,aAAa,SAAS,gBAAgB,UAAU,AAAG,IAAU,EAAY,UAAS,EAAY,QAAQ,EAAQ,GAAmB,CAAC,GAAe,EAAK,CAAG,EAAO,EAAgB,IAAI,CAAC,GAAe,EAAM,AAAE,EAAyH,MAAxH,IAAmB,CAAC,EAAO,iBAAiB,SAAS,EAAa,CAAC,EAAO,iBAAiB,YAAY,EAAgB,CAAO,IAAI,CAAmD,AAAlD,EAAO,oBAAoB,SAAS,EAAa,CAAC,EAAO,oBAAoB,YAAY,EAAgB,AAAE,CAAE,EAAC,CAAE,EAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,MAAM,CAAC,SAAS,EAAS,GAAG,WAAW,EAAY,OAAO,wBAAyB,CAAC,EAAC,AAAE,CAAE,kBAAhzC,GAA2C,IAA6C"}