{"version":3,"file":"ReadingTime.DteTrffw.mjs","names":["useState","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/KLq53MHntpb2DgLUmhVX/6zEnqZkgc0Aaa3RvdW2T/ReadingTime.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";export function ReadingTimeOfPage(){const[readingTimeText,setReadingTimeText]=useState(\"\");const[loading,setLoading]=useState(true);useEffect(()=>{// Set up a loading animation: update a random 3-digit number every 75ms\nconst loadingInterval=setInterval(()=>{const randomNum=Math.floor(Math.random()*1e3);const formatted=String(randomNum).padStart(3,\"0\");setReadingTimeText(`${formatted} min`);},75);// Function to calculate the reading time based on all text layers\nconst calculateReadingTime=()=>{const textElements=document.querySelectorAll(\".framer-text\");let combinedText=\"\";textElements.forEach(el=>{combinedText+=\" \"+el.innerText;});const words=combinedText.trim().split(/\\s+/).filter(Boolean);const wordCount=words.length;const minutes=Math.ceil(wordCount/200);// Stop loading and set the final reading time\nsetReadingTimeText(`${minutes} min`);setLoading(false);clearInterval(loadingInterval);};// Minimal delay to allow DOM text to render\nconst calcTimeout=setTimeout(calculateReadingTime,50);window.addEventListener(\"resize\",calculateReadingTime);return()=>{clearInterval(loadingInterval);clearTimeout(calcTimeout);window.removeEventListener(\"resize\",calculateReadingTime);};},[]);return{text:readingTimeText,// No extra styling for the ghost effect\nstyle:{}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withReadingTimeOfPage(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ReadingTimeOfPage(props)});};}withReadingTimeOfPage.displayName=\"ReadingTimeOfPage\";\nexport const __FramerMetadata__ = {\"exports\":{\"ReadingTimeOfPage\":{\"type\":\"override\",\"name\":\"ReadingTimeOfPage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withReadingTimeOfPage\":{\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