{"version":3,"file":"ScrollFade.CuzgJAMd.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","navigator","window","_e","ce","de","init_framer_CKT6jEEQ","ControlType","addPropertyControls","isTouchDevice","ScrollFade","ref","visible","setVisible","animationDone","setAnimationDone","skipAnim","setSkipAnim","io","e","entries","threshold","t","duration","delay","translateY","init_ScrollFade","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/u1sLmVasDBMTh4A0Lpn1/JCuElj3AM8mnlc6pRTIk/ScrollFade.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";function isTouchDevice(){if(typeof window===\"undefined\")return false;return\"ontouchstart\"in window||navigator.maxTouchPoints>0;}export default function ScrollFade({delay=0,duration=700,translateY=24,threshold=.12,children}){const ref=useRef(null);const[visible,setVisible]=useState(false);const[animationDone,setAnimationDone]=useState(false);const[skipAnim,setSkipAnim]=useState(false);useEffect(()=>{if(!ref.current)return;const reduced=typeof window!==\"undefined\"&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;// Skip the animation on touch devices or when the user prefers less motion.\nif(reduced||isTouchDevice()){setSkipAnim(true);setVisible(true);setAnimationDone(true);return;}const io=new IntersectionObserver(entries=>{for(const e of entries){if(e.isIntersecting){setVisible(true);io.disconnect();break;}}},{threshold,rootMargin:\"0px 0px -40px 0px\"});io.observe(ref.current);return()=>io.disconnect();},[threshold]);// After the transition finishes, drop will-change so the element is no\n// longer promoted to a compositor layer.\nuseEffect(()=>{if(skipAnim||!visible||animationDone)return;const t=window.setTimeout(()=>setAnimationDone(true),duration+delay+100);return()=>window.clearTimeout(t);},[visible,animationDone,duration,delay,skipAnim]);// Static render for touch/reduced-motion — no transition, no observer,\n// no will-change promotion.\nif(skipAnim){return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{width:\"100%\"},children:children});}return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{width:\"100%\",opacity:visible?1:0,transform:visible?\"translateY(0)\":`translateY(${translateY}px)`,transition:`opacity ${duration}ms cubic-bezier(0.16, 1, 0.3, 1) ${delay}ms, transform ${duration}ms cubic-bezier(0.16, 1, 0.3, 1) ${delay}ms`,willChange:animationDone?\"auto\":\"opacity, transform\"},children:children});}addPropertyControls(ScrollFade,{delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:2e3,step:50,unit:\"ms\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:700,min:200,max:2e3,step:50,unit:\"ms\"},translateY:{type:ControlType.Number,title:\"Translate Y\",defaultValue:24,min:0,max:120,step:2,unit:\"px\"},threshold:{type:ControlType.Number,title:\"Threshold\",defaultValue:.12,min:0,max:1,step:.05},children:{type:ControlType.ComponentInstance,title:\"Content\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollFade\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollFade.map"],"mappings":"A,mMAA4I,SAASa,GAAe,CAA6C,OAAlCP,IAAS,OAAmB,GAAY,iBAAiBA,GAAQD,EAAU,eAAe,CAAE,CAAC,SAAwBS,EAAW,CAAC,QAAM,EAAE,WAAS,IAAI,aAAW,GAAG,YAAU,IAAI,YAAU,CAAC,IAAMC,EAAIf,EAAO,IAAI,EAAO,CAACgB,EAAQC,GAAYhB,EAAS,EAAK,EAAO,CAACiB,EAAcC,GAAkBlB,EAAS,EAAK,EAAO,CAACmB,EAASC,GAAapB,EAAS,EAAK,EAK9a,OALgbO,MAAc,CAAC,GAAG,CAACO,EAAI,QAAQ,OAC9iB,GAD0kBT,IAAS,QAAaA,EAAO,WAAW,kCAAkC,CAAC,CAAC,SAC1oBO,EAAc,EAAE,CAACQ,EAAY,EAAI,EAAEJ,EAAW,EAAI,EAAEE,EAAiB,EAAI,EAAE,MA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