{"version":3,"file":"LoopStill.CoG-7awF.mjs","names":["React.useState","React.useRef","__esmMin","_e","de","init_jsx_runtime","c","init_npm_react_18_3_1","ce","addPropertyControls","init_framer_Bf4_tcb2","RenderTarget","ControlType","LoopStill","ready","setReady","ref","isCanvas","v","on","src","play","io","e","entries","style","init_LoopStill"],"sources":["https:/framerusercontent.com/modules/N3STMjsQQXKLhdpnhmCa/cVOeXC20cAnlQ5dMJ7QJ/LoopStill.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * A loop video covering its parent. Paused on its first frame by default;\n * with Play on it loops silently while it is on screen (off screen it pauses\n * to save battery). Renders nothing without a loop, so the parent image shows.\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function LoopStill({src,play,style}){const[ready,setReady]=React.useState(false);const ref=React.useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas||RenderTarget.current()===RenderTarget.thumbnail;// The video can finish loading before the page is interactive, so the\n// loadeddata event is missed and it would stay invisible. Check directly too.\nReact.useEffect(()=>{const v=ref.current;if(!v)return;if(v.readyState>=2){setReady(true);return;}const on=()=>setReady(true);v.addEventListener(\"loadeddata\",on);v.addEventListener(\"canplay\",on);return()=>{v.removeEventListener(\"loadeddata\",on);v.removeEventListener(\"canplay\",on);};},[src,play]);React.useEffect(()=>{const v=ref.current;if(!v||!play||typeof IntersectionObserver===\"undefined\")return;const io=new IntersectionObserver(entries=>{for(const e of entries){if(e.isIntersecting)v.play().catch(()=>{});else v.pause();}},{threshold:.05});io.observe(v);return()=>io.disconnect();},[play,src]);if(!src||isCanvas)return null;return /*#__PURE__*/_jsx(\"video\",{ref:ref,src:play?src:src+\"#t=0.04\",muted:true,loop:play,playsInline:true,preload:\"auto\",\"aria-hidden\":\"true\",onLoadedData:()=>setReady(true),style:{...style,width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\",pointerEvents:\"none\",opacity:ready?1:0,transition:\"opacity 0.2s ease\"}});}LoopStill.defaultProps={src:\"\",play:false};addPropertyControls(LoopStill,{src:{type:ControlType.String,title:\"Loop URL\"},play:{type:ControlType.Boolean,title:\"Play\",defaultValue:false,description:\"Loop while on screen instead of showing the first frame.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LoopStill\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LoopStill.map"],"mappings":"A,gMAOG,SAAwBa,EAAU,CAAC,MAAI,OAAK,SAAO,CAAC,GAAK,CAACC,EAAMC,GAAUf,EAAe,EAAK,EAAQgB,EAAIf,EAAa,IAAI,EAAQgB,EAASN,EAAa,QAAQ,IAAIA,EAAa,QAAQA,EAAa,QAAQ,IAAIA,EAAa,UAEmZ,OAAtnBH,MAAoB,CAAC,IAAMU,EAAEF,EAAI,QAAQ,GAAG,CAACE,EAAE,OAAO,GAAGA,EAAE,YAAY,EAAE,CAACH,EAAS,EAAI,EAAE,MAAO,CAAC,IAAMI,MAAOJ,EAAS,EAAI,EAAuE,OAArEG,EAAE,iBAAiB,aAAaC,CAAE,EAAED,EAAE,iBAAiB,UAAUC,CAAE,MAAY,CAACD,EAAE,oBAAoB,aAAaC,CAAE,EAAED,EAAE,oBAAoB,UAAUC,CAAE,CAAE,CAAE,EAAE,CAACC,EAAIC,CAAI,CAAC,EAAEb,MAAoB,CAAC,IAAMU,EAAEF,EAAI,QAAQ,GAAG,CAACE,GAAG,CAACG,GAAM,OAAO,qBAAuB,IAAY,OAAO,IAAMC,EAAG,IAAI,qBAAqB,GAAS,CAAC,IAAI,IAAMC,KAAKC,EAAYD,EAAE,eAAeL,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,EAAOA,EAAE,MAAM,CAA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