{"version":3,"file":"Examples.CzAfMTry.mjs","names":["useRef","useState","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/lSaWOjGVUw7fDuFICXnG/dqih1cuzP3KPoilRiarO/Examples.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useMemo,useRef,useState}from\"react\";import{useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";// Learn more: https://www.framer.com/developers/overrides/\nfunction randomColor(){const value=Math.floor(Math.random()*16777215);return`#${value.toString(16).padStart(6,\"0\")}`;}export function withRotate(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{rotate:90},transition:{duration:2}});});}export function withHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:{scale:1.05}});});}export function withRandomColor(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[background,setBackground]=useState(\"#0099FF\");return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{background},onClick:()=>{startTransition(()=>{setBackground(randomColor());});}});});}export function withScrollFocusShift(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const{direction=\"Left\",distance=420,speedMultiplier=1.35,opacityFade=false}=props;const isStatic=useIsStaticRenderer();const localRef=useRef(null);const isInView=useInView(localRef,{amount:0,once:false,margin:\"200px 0px 200px 0px\"});const rafRef=useRef(null);const[progress,setProgress]=useState(0);const assignRefs=useCallback(node=>{localRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&\"current\"in ref){ref.current=node;}},[ref]);const computeProgress=useCallback(()=>{if(typeof window===\"undefined\")return 0;if(!localRef.current)return 0;const rect=localRef.current.getBoundingClientRect();const viewportHeight=window.innerHeight;const travel=viewportHeight+rect.height;if(travel<=0)return 0;const rawProgress=(viewportHeight-rect.top)/travel;return Math.min(Math.max(rawProgress,0),1);},[]);const updateFrame=useCallback(()=>{rafRef.current=null;const nextProgress=computeProgress();startTransition(()=>{setProgress(nextProgress);});},[computeProgress]);const onScroll=useCallback(()=>{if(rafRef.current!==null)return;if(typeof window===\"undefined\")return;rafRef.current=window.requestAnimationFrame(updateFrame);},[updateFrame]);useEffect(()=>{if(isStatic||!isInView)return;if(typeof window===\"undefined\")return;onScroll();window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onScroll);return()=>{window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onScroll);if(rafRef.current!==null){window.cancelAnimationFrame(rafRef.current);rafRef.current=null;}};},[isStatic,isInView,onScroll]);const prefersReducedMotion=useMemo(()=>{if(typeof window===\"undefined\")return false;return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;},[]);const motionStyle=useMemo(()=>{if(isStatic||prefersReducedMotion)return{};const signedDistance=direction===\"Left\"?-distance:distance;const x=signedDistance*progress*speedMultiplier;const opacity=opacityFade?1-progress*.35:undefined;return{transform:`translate3d(${x}px, 0, 0)`,opacity};},[direction,distance,isStatic,opacityFade,prefersReducedMotion,progress,speedMultiplier]);return /*#__PURE__*/_jsx(Component,{ref:assignRefs,...props,style:{...props.style,...motionStyle}});});}export function withCountUp275k(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const targetValue=275e3;const durationMs=1800;const localRef=useRef(null);const rafRef=useRef(null);const startTimeRef=useRef(null);const hasStartedRef=useRef(false);const[displayValue,setDisplayValue]=useState(0);const isStatic=useIsStaticRenderer();const isInView=useInView(localRef,{amount:.25,once:true});const assignRefs=useCallback(node=>{localRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&\"current\"in ref){ref.current=node;}},[ref]);const prefersReducedMotion=useMemo(()=>{if(typeof window===\"undefined\")return false;return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;},[]);const formatNumber=useCallback(value=>{return value.toLocaleString(\"en-US\");},[]);const animate=useCallback(timestamp=>{if(startTimeRef.current===null){startTimeRef.current=timestamp;}const elapsed=timestamp-startTimeRef.current;const linear=Math.min(elapsed/durationMs,1);const eased=1-Math.pow(1-linear,3);const next=Math.round(targetValue*eased);startTransition(()=>{setDisplayValue(next);});if(linear<1){if(typeof window!==\"undefined\"){rafRef.current=window.requestAnimationFrame(animate);}}else{rafRef.current=null;startTransition(()=>{setDisplayValue(targetValue);});}},[targetValue]);useEffect(()=>{if(typeof window===\"undefined\")return;if(isStatic||prefersReducedMotion){startTransition(()=>{setDisplayValue(targetValue);});return;}if(!isInView||hasStartedRef.current)return;hasStartedRef.current=true;rafRef.current=window.requestAnimationFrame(animate);return()=>{if(rafRef.current!==null){window.cancelAnimationFrame(rafRef.current);rafRef.current=null;}};},[animate,isInView,isStatic,prefersReducedMotion,targetValue]);const text=useMemo(()=>formatNumber(displayValue),[displayValue,formatNumber]);return /*#__PURE__*/_jsx(Component,{ref:assignRefs,...props,text:text,children:text});});}export function withRevealWidthLeft(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const localRef=useRef(null);const isStatic=useIsStaticRenderer();const isInView=useInView(localRef,{amount:.15,once:true});const[revealed,setRevealed]=useState(false);const assignRefs=useCallback(node=>{localRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&\"current\"in ref){ref.current=node;}},[ref]);const prefersReducedMotion=useMemo(()=>{if(typeof window===\"undefined\")return false;return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;},[]);useEffect(()=>{if(isStatic||prefersReducedMotion){startTransition(()=>{setRevealed(true);});return;}if(!isInView||revealed)return;startTransition(()=>{setRevealed(true);});},[isInView,isStatic,prefersReducedMotion,revealed]);const mergedStyle=useMemo(()=>{const baseTransform=props.style?.transform??\"\";const revealTransform=`scaleX(${revealed?1:0})`;const transform=`${baseTransform} ${revealTransform}`.trim();return{...props.style,transformOrigin:\"left center\",transform,transition:isStatic||prefersReducedMotion?props.style?.transition:`transform 800ms cubic-bezier(0.22, 1, 0.36, 1)`};},[isStatic,prefersReducedMotion,props.style,revealed]);return /*#__PURE__*/_jsx(Component,{ref:assignRefs,...props,style:mergedStyle});});}export function withCountUpMetric275k(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const targetValue=275e3;const durationMs=1800;const fallbackText=\"3,000 → 275,000 FOLLOWERS\";const localRef=useRef(null);const rafRef=useRef(null);const startTimeRef=useRef(null);const hasStartedRef=useRef(false);const[displayValue,setDisplayValue]=useState(0);const isStatic=useIsStaticRenderer();const isInView=useInView(localRef,{amount:.25,once:true});const assignRefs=useCallback(node=>{localRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&\"current\"in ref){ref.current=node;}},[ref]);const prefersReducedMotion=useMemo(()=>{if(typeof window===\"undefined\")return false;return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;},[]);const baseText=useMemo(()=>{if(typeof props.text===\"string\"&&props.text.length>0){return props.text;}if(typeof props.children===\"string\"&&props.children.length>0){return props.children;}if(typeof props.children===\"number\"){return String(props.children);}return fallbackText;},[props.children,props.text]);const formatNumber=useCallback(value=>{return value.toLocaleString(\"en-US\");},[]);const buildText=useCallback(value=>{const nextFormatted=formatNumber(value);if(baseText.includes(\"275,000\")){return baseText.replace(\"275,000\",nextFormatted);}const matches=[...baseText.matchAll(/\\d{1,3}(?:,\\d{3})*/g)];if(matches.length>0){const lastMatch=matches[matches.length-1];if(typeof lastMatch.index===\"number\"){const start=lastMatch.index;const end=start+lastMatch[0].length;return`${baseText.slice(0,start)}${nextFormatted}${baseText.slice(end)}`;}}return`${baseText} ${nextFormatted}`;},[baseText,formatNumber]);const animate=useCallback(timestamp=>{if(startTimeRef.current===null){startTimeRef.current=timestamp;}const elapsed=timestamp-startTimeRef.current;const linear=Math.min(elapsed/durationMs,1);const eased=1-Math.pow(1-linear,3);const next=Math.round(targetValue*eased);startTransition(()=>{setDisplayValue(next);});if(linear<1){if(typeof window!==\"undefined\"){rafRef.current=window.requestAnimationFrame(animate);}}else{rafRef.current=null;startTransition(()=>{setDisplayValue(targetValue);});}},[targetValue]);useEffect(()=>{if(typeof window===\"undefined\")return;if(isStatic||prefersReducedMotion){startTransition(()=>{setDisplayValue(targetValue);});return;}if(!isInView||hasStartedRef.current)return;hasStartedRef.current=true;rafRef.current=window.requestAnimationFrame(animate);return()=>{if(rafRef.current!==null){window.cancelAnimationFrame(rafRef.current);rafRef.current=null;}};},[animate,isInView,isStatic,prefersReducedMotion,targetValue]);const text=useMemo(()=>buildText(displayValue),[buildText,displayValue]);return /*#__PURE__*/_jsx(Component,{ref:assignRefs,...props,text:text,children:text});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCountUpMetric275k\":{\"type\":\"reactHoc\",\"name\":\"withCountUpMetric275k\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollFocusShift\":{\"type\":\"reactHoc\",\"name\":\"withScrollFocusShift\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRevealWidthLeft\":{\"type\":\"reactHoc\",\"name\":\"withRevealWidthLeft\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCountUp275k\":{\"type\":\"reactHoc\",\"name\":\"withCountUp275k\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"8QACk3J,SAAgB,EAAoB,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAASA,EAAO,IAAI,EAAQ,EAAS,EAAoB,EAAQ,EAAS,EAAU,EAAS,CAAC,OAAO,IAAI,KAAK,EAAI,CAAC,EAAO,CAAC,EAAS,GAAaC,EAAS,EAAK,EAAQ,EAAWC,EAAY,GAAM,CAAC,EAAS,QAAQ,EAAQ,OAAO,GAAM,WAAY,EAAI,CAAI,EAAW,GAAK,YAAY,IAAK,EAAI,QAAQ,EAAM,EAAE,CAAC,CAAG,CAAC,EAAQ,EAAqBC,MAAuB,IAAS,QAAgC,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAU,CAAC,CAAC,EAAE,MAAc,CAAC,GAAG,GAAU,EAAqB,CAAC,MAAoB,CAAC,EAAY,EAAI,CAAE,CAAC,EAAE,MAAO,CAAI,CAAC,GAAU,GAAgB,MAAoB,CAAC,EAAY,EAAI,CAAE,CAAC,CAAE,EAAE,CAAC,EAAS,EAAS,EAAqB,CAAQ,CAAC,EAAE,IAAM,EAAYA,MAAY,CAAgG,IAAM,EAAU,GAA3F,EAAM,OAAO,WAAW,GAAoF,GAAG,UAApD,KAAa,KAAyD,KAAK,EAAE,MAAM,CAAC,GAAG,EAAM,MAAM,gBAAgB,cAAc,YAAU,WAAW,GAAU,EAAqB,EAAM,OAAO,WAAW,gDAAgD,CAAE,EAAE,CAAC,EAAS,EAAqB,EAAM,MAAM,CAAQ,CAAC,EAAE,OAAoB,EAAK,EAAU,CAAC,IAAI,EAAW,GAAG,EAAM,MAAM,CAAW,CAAC,CAAE,CAAC,CAAE,qBAD7lM,IAA4F,IAAwC,IAAqC"}