{"version":3,"file":"FilmFrame.B63Dsqeu.mjs","names":["useRef","useState","__esmMin","init_ssg_sandbox_shims","window","_e","de","c","init_jsx_runtime","init_npm_react_18_3_1","ce","init_framer_DxfB3JJo","ControlType","addPropertyControls","FilmFrame","props","ref","ok","setOk","v","done","io","e","loop","near","src","style","init_FilmFrame"],"sources":["https:/framerusercontent.com/modules/Y4vTYwP4Gi20JPn6fb75/mOIGQtXsmoXCGEzTG1Uo/FilmFrame.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// A quiet silent film over a photo frame. Plays muted once the frame is on screen, then holds on its last\n// frame (or loops, for films made to loop). Anyone with reduced motion keeps the photo underneath.\n/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function FilmFrame(props){const{src,poster,loop=false,style}=props;const ref=useRef(null);const[ok,setOk]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;if(window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches)return;setOk(true);},[]);useEffect(()=>{const v=ref.current;if(!ok||!v||!(\"IntersectionObserver\"in window))return;let done=false;v.addEventListener(\"ended\",()=>{done=true;});const io=new IntersectionObserver(([e])=>{if(e.isIntersecting&&e.intersectionRatio>=.4){v.preload=\"auto\";if(!done||loop)v.play().catch(()=>{});}else v.pause();},{threshold:[0,.4,.8]});// start fetching about a screen before the film arrives, so it is ready without loading every film up front\nconst near=new IntersectionObserver(([e])=>{if(e.isIntersecting){if(v.preload!==\"auto\"){v.preload=\"auto\";if(v.paused&&v.currentTime===0)v.load();}near.disconnect();}},{rootMargin:\"100% 0px 100% 0px\"});near.observe(v);io.observe(v);return()=>{io.disconnect();near.disconnect();};},[ok,loop]);if(!ok||!src)return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{...style,width:\"100%\",height:\"100%\"}});return /*#__PURE__*/_jsx(\"video\",{ref:ref,src:src,poster:poster,muted:true,playsInline:true,loop:loop,preload:\"none\",\"aria-hidden\":\"true\",disablePictureInPicture:true,style:{...style,width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\",pointerEvents:\"none\"}});}FilmFrame.defaultProps={src:\"\",poster:\"\",loop:false};addPropertyControls(FilmFrame,{src:{type:ControlType.String,title:\"Film URL\"},poster:{type:ControlType.String,title:\"Poster URL\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FilmFrame\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FilmFrame.map"],"mappings":"A,sMAKG,SAAwBc,EAAU,EAAM,CAAC,GAAK,CAAC,MAAI,SAAO,OAAK,GAAM,SAAOC,EAAYC,EAAIhB,EAAO,IAAI,EAAO,CAACiB,EAAGC,GAAOjB,EAAS,EAAK,EACyQ,OADvQS,MAAc,CAAWN,IAAS,SAAsBA,EAAO,WAAW,kCAAkC,CAAC,CAAC,SAAec,EAAM,EAAI,EAAE,EAAE,CAAC,CAAC,EAAER,MAAc,CAAC,IAAMS,EAAEH,EAAI,QAAQ,GAAG,CAACC,GAAI,CAACE,GAAG,EAAE,yBAAyBf,GAAQ,OAAO,IAAIgB,EAAK,GAAMD,EAAE,iBAAiB,YAAY,CAAC,EAAK,EAAK,CAAC,EAAE,IAAME,EAAG,IAAI,sBAAsB,CAACC,KAAK,CAAIA,EAAE,gBAAgBA,EAAE,mBAAmB,IAAI,EAAE,QAAQ,QAAU,CAACF,GAAMG,IAAKJ,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,GAAQA,EAAE,MAAM,CAAE,EAAE,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAChmBK,EAAK,IAAI,s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