{"version":3,"file":"LoopVideo.Cql-S1gC.mjs","names":["useRef","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","c","init_jsx_runtime","ce","de","init_framer_D1IzEvwH","addPropertyControls","useIsStaticRenderer","ControlType","LoopVideo","props","ref","isStatic","v","onScreen","tryPlay","io","e","onVisibility","onStalled","src","poster","fit","init_LoopVideo"],"sources":["https:/framerusercontent.com/modules/8NVynaBDsGbRx2jqqtP6/LVm6qR5ZWiAh7ZQjCu6C/LoopVideo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Loop Video\n *\n * A muted, looping clip that always starts. Framer's Video waits until it is\n * on screen to fetch anything (preload none) and makes a single play attempt,\n * so a clip could sit on its poster. This one preloads the file and retries\n * play on load, when it can play, when it scrolls into view and when the tab\n * comes back, and pauses off screen to save battery.\n *\n * @framerIntrinsicWidth 640\n * @framerIntrinsicHeight 360\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function LoopVideo(props){const{src,poster,fit=\"contain\"}=props;const ref=useRef(null);const isStatic=useIsStaticRenderer();useEffect(()=>{const v=ref.current;if(!v||isStatic)return;let onScreen=false;// Muted must be set as a property too, or some browsers refuse autoplay\nv.muted=true;const tryPlay=()=>{if(!onScreen||document.hidden||!v.paused)return;v.play().catch(()=>window.setTimeout(tryPlay,600));};const io=new IntersectionObserver(([e])=>{onScreen=e.isIntersecting;if(onScreen)tryPlay();else v.pause();},{rootMargin:\"200px 0px\"});io.observe(v);const onVisibility=()=>document.hidden?v.pause():tryPlay();v.addEventListener(\"canplay\",tryPlay);v.addEventListener(\"loadeddata\",tryPlay);document.addEventListener(\"visibilitychange\",onVisibility);// A stalled download gets one fresh start\nconst onStalled=()=>{if(v.readyState<2){v.load();tryPlay();}};v.addEventListener(\"stalled\",onStalled);return()=>{io.disconnect();v.removeEventListener(\"canplay\",tryPlay);v.removeEventListener(\"loadeddata\",tryPlay);v.removeEventListener(\"stalled\",onStalled);document.removeEventListener(\"visibilitychange\",onVisibility);};},[src,isStatic]);return /*#__PURE__*/_jsx(\"video\",{ref:ref,src:src,poster:poster?.src,\"aria-label\":poster?.alt||undefined,muted:true,loop:true,playsInline:true,autoPlay:!isStatic,preload:\"auto\",disablePictureInPicture:true,style:{...props.style,display:\"block\",width:\"100%\",height:\"100%\",objectFit:fit,background:\"transparent\"}});}addPropertyControls(LoopVideo,{src:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},poster:{type:ControlType.ResponsiveImage,title:\"Poster\"},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"contain\",\"cover\"],optionTitles:[\"Contain\",\"Cover\"],defaultValue:\"contain\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LoopVideo\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"640\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicHeight\":\"360\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LoopVideo.map"],"mappings":"A,uMAcG,SAAwBa,EAAU,EAAM,CAAC,GAAK,CAAC,MAAI,SAAO,MAAI,WAAWC,EAAYC,EAAIf,EAAO,IAAI,EAAQgB,EAASL,EAAoB,EAEuM,OAFrMJ,MAAc,CAAC,IAAMU,EAAEF,EAAI,QAAQ,GAAG,CAACE,GAAGD,EAAS,OAAO,IAAIE,EAAS,GACrN,EAAE,MAAM,GAAK,IAAMC,MAAY,CAAKD,GAAU,UAAS,QAASD,EAAE,QAAcA,EAAE,KAAK,CAAC,CAAC,UAAUb,EAAO,WAAWe,EAAQ,GAAG,CAAC,CAAE,EAAQC,EAAG,IAAI,sBAAsB,CAACC,KAAK,CAAC,EAASA,EAAE,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