{"version":3,"file":"PlayVideoInViewport.BWZ1vDFj.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/Ltg70c1RWbyIeCF2b7ee/oZEo0wN3Rw2oglTC9xOE/PlayVideoInViewport.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";export function PlayVideoInViewport(Component){return function ViewportVideo(props){const ref=useRef(null);useEffect(()=>{const video=ref.current;if(!video)return;// Important: prevent eager loading\nvideo.preload=\"none\";video.muted=true;video.playsInline=true;const observer=new IntersectionObserver(([entry])=>{if(entry.isIntersecting){video.play().catch(()=>{});}else{video.pause();}},{threshold:.5});observer.observe(video);return()=>{observer.disconnect();};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}\nexport const __FramerMetadata__ = {\"exports\":{\"PlayVideoInViewport\":{\"type\":\"reactHoc\",\"name\":\"PlayVideoInViewport\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PlayVideoInViewport.map"],"mappings":"yHAA+E,SAAgB,EAAoB,EAAU,CAAC,OAAO,SAAuB,EAAM,CAAC,IAAM,EAAIA,EAAO,IAAI,EACqF,OADnF,MAAc,CAAC,IAAM,EAAM,EAAI,QAAQ,GAAG,CAAC,EAAM,OAC3O,EAAM,QAAQ,OAAO,EAAM,MAAM,GAAK,EAAM,YAAY,GAAK,IAAM,EAAS,IAAI,sBAAsB,CAAC,KAAS,CAAI,EAAM,eAAgB,EAAM,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,EAAQ,EAAM,MAAM,CAAG,EAAE,CAAC,UAAU,EAAE,CAAC,EAA0B,OAAxB,EAAS,QAAQ,CAAK,MAAY,CAAC,EAAS,WAAW,CAAE,CAAE,EAAE,CAAC,CAAC,EAAsB,EAAK,EAAU,CAAC,GAAG,EAAU,KAAG,CAAC,CAAE,CAAE,iBAD5R,IAAoC"}