{"version":3,"file":"LoopVideo.CBKHTn4p.mjs","names":["useRef","__esmMin","de","init_jsx_runtime","c","init_npm_react_18_3_1","ce","init_framer_DKtAEkcX","addPropertyControls","ControlType","useInViewPlay","v","ref","io","p","key","LoopVideo","props","src","video","poster","style","ratio","radius","init_LoopVideo"],"sources":["https:/framerusercontent.com/modules/3vlTdwpCI7SxRKxlnX4q/BZWSxqcntwHYWvLJX2UA/LoopVideo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Plays only while on or near the screen, and pauses when scrolled away, so a page\n// doesn't download every loop up front. iOS Safari only lets a video play by itself\n// when muted is set as a property, so it's set before play().\nfunction useInViewPlay(ref,key){useEffect(()=>{const v=ref.current;if(!v)return;v.muted=true;v.defaultMuted=true;const io=new IntersectionObserver(([e])=>{if(e.isIntersecting){const p=v.play();if(p&&p.catch)p.catch(()=>{});}else v.pause();},{rootMargin:\"400px 0px\"});io.observe(v);return()=>io.disconnect();},[key]);}// A looping, muted, autoplaying video, like the background videos on the old\n// Webflow case study pages. Its height follows the video's own proportions\n// (or Shape, width / height, when set, so the space is held before it loads).\n/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 800\n */export default function LoopVideo(props){const{poster,radius=0,ratio=0,style}=props;// a File control gives a URL string; an asset set through the API arrives as { url }\nconst src=typeof props.src===\"string\"?props.src:props.src?.url;const video=useRef(null);useInViewPlay(video,src);if(!src){return /*#__PURE__*/_jsx(\"div\",{style:{...style,aspectRatio:\"16 / 9\",width:\"100%\",background:\"rgba(0,0,0,0.06)\",borderRadius:radius,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",font:\"500 12px/1 sans-serif\",color:\"#888\"},children:\"Choose a video file\"});}return /*#__PURE__*/_jsx(\"video\",{ref:video,src:src,poster:poster?.src??poster,muted:true,loop:true,playsInline:true,preload:\"metadata\",style:{...style,display:\"block\",width:\"100%\",height:\"auto\",aspectRatio:ratio?String(ratio):undefined,objectFit:\"cover\",borderRadius:radius}});}addPropertyControls(LoopVideo,{src:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},poster:{type:ControlType.ResponsiveImage,title:\"Poster\"},ratio:{type:ControlType.Number,title:\"Shape (w/h)\",defaultValue:0,min:0,max:3,step:.01},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:100,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LoopVideo\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"800\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LoopVideo.map"],"mappings":"A,iLAGA,SAASU,EAAc,EAAI,EAAI,CAACJ,MAAc,CAAC,IAAMK,EAAEC,EAAI,QAAQ,GAAG,CAACD,EAAE,OAAO,EAAE,MAAM,GAAK,EAAE,aAAa,GAAK,IAAME,EAAG,IAAI,sBAAsB,CAAC,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC,IAAMC,EAAEH,EAAE,KAAK,EAAKG,GAAGA,EAAE,OAAMA,EAAE,UAAU,CAAC,CAAC,CAAE,MAAMH,EAAE,MAAM,CAAE,EAAE,CAAC,WAAW,WAAW,CAAC,EAAgB,OAAdE,EAAG,QAAQF,CAAC,MAAYE,EAAG,WAAW,CAAE,EAAE,CAACE,CAAG,CAAC,CAAE,CAOzT,SAAwBC,EAAU,EAAM,CAAC,GAAK,CAAC,SAAO,SAAO,EAAE,QAAM,EAAE,SAAOC,EAC3EC,EAAI,OAAOD,EAAM,KAAM,SAASA,EAAM,IAAIA,EAAM,KAAK,IAAUE,EAAMnB,EAAO,IAAI,EAAgT,OAA9SU,EAAcS,EAAMD,CAAG,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