{"version":3,"file":"ProjectVideo.Bb37i7wy.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","init_npm_react_dom_18_3_1","ce","p","J","init_jsx_runtime","_e","de","init_framer_DxfB3JJo","RenderTarget","ControlType","addPropertyControls","ProjectVideo","props","coverSrc","cover","DEFAULT_VIDEO","fullSrc","full","isCanvas","coverRef","fullRef","openRef","mounted","setMounted","v","c","doc","close","open","el","request","onFsChange","fsEl","onEnded","closeAtEnd","onKey","players","onClick","clickToPlay","media","fit","radius","style","poster","withPlayVideo","handle","Component","init_ProjectVideo"],"sources":["https:/framerusercontent.com/modules/E8SRaPuZafWUhcFYgnli/bs65lJ57fog32hdw5E6p/ProjectVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef,useState}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Project Video\n *\n * Shows a short looping, muted cover video. Play (a click on the video, or\n * a button with the withPlayVideo override) opens the full video in the\n * browser's own fullscreen player with native controls. Leaving fullscreen\n * stops it and the cover loops again. On iPhone the system player opens.\n * The full video lives at the end of <body>, above every other layer, so it\n * still covers the window where fullscreen is not allowed (e.g. in an\n * embedded preview); Esc closes it there.\n */const DEFAULT_VIDEO=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\";/** The players on the page, so a Play button can open one. */const players=new Set;/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ProjectVideo(props){const{cover,full,poster,fit=\"cover\",radius=0,clickToPlay=true,closeAtEnd=true,style}=props;const coverSrc=cover||DEFAULT_VIDEO;const fullSrc=full||cover||DEFAULT_VIDEO;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const coverRef=useRef(null);const fullRef=useRef(null);const openRef=useRef(false);const[mounted,setMounted]=useState(false);useEffect(()=>setMounted(true),[]);useEffect(()=>{if(isCanvas||!mounted)return;const v=fullRef.current;const c=coverRef.current;if(!v)return;const doc=document;const close=()=>{if(!openRef.current)return;openRef.current=false;v.pause();v.style.display=\"none\";try{v.currentTime=0;}catch{}c?.play().catch(()=>{});};const open=()=>{const el=v;openRef.current=true;v.style.display=\"block\";v.muted=false;try{v.currentTime=0;}catch{}c?.pause();const request=el.requestFullscreen||el.webkitRequestFullscreen;if(request){try{const p=request.call(el);if(p&&p.catch)p.catch(()=>{});}catch{}v.play().catch(()=>{});}else{// iPhone: a video without playsinline opens the system player.\nv.play().catch(()=>{});try{el.webkitEnterFullscreen?.();}catch{}}};const onFsChange=()=>{const fsEl=doc.fullscreenElement||doc.webkitFullscreenElement;if(openRef.current&&fsEl!==v)close();};const onEnded=()=>{if(!closeAtEnd)return;if(doc.fullscreenElement||doc.webkitFullscreenElement){(doc.exitFullscreen||doc.webkitExitFullscreen)?.call(doc);}else{try{v.webkitExitFullscreen?.();}catch{}close();}};const onKey=e=>{if(e.key===\"Escape\"&&openRef.current)close();};players.add(open);document.addEventListener(\"keydown\",onKey);document.addEventListener(\"fullscreenchange\",onFsChange);document.addEventListener(\"webkitfullscreenchange\",onFsChange);v.addEventListener(\"webkitendfullscreen\",close);v.addEventListener(\"ended\",onEnded);v.__openPlayer=open;return()=>{players.delete(open);document.removeEventListener(\"keydown\",onKey);close();document.removeEventListener(\"fullscreenchange\",onFsChange);document.removeEventListener(\"webkitfullscreenchange\",onFsChange);v.removeEventListener(\"webkitendfullscreen\",close);v.removeEventListener(\"ended\",onEnded);};},[isCanvas,mounted,closeAtEnd,fullSrc]);const onClick=()=>{if(!clickToPlay||isCanvas)return;fullRef.current?.__openPlayer?.();};const media={position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:fit,display:\"block\"};return /*#__PURE__*/_jsxs(\"div\",{onClick:onClick,style:{position:\"relative\",overflow:\"hidden\",borderRadius:radius,cursor:clickToPlay?\"pointer\":\"default\",width:\"100%\",height:\"100%\",...style},children:[/*#__PURE__*/_jsx(\"video\",{ref:coverRef,src:coverSrc,poster:poster?.src,muted:true,loop:true,playsInline:true,autoPlay:!isCanvas,preload:isCanvas?\"metadata\":\"auto\",\"aria-hidden\":true,style:media}),mounted&&!isCanvas&&/*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"video\",{ref:fullRef,src:fullSrc,controls:true,preload:\"none\",style:{position:\"fixed\",inset:0,width:\"100%\",height:\"100%\",zIndex:2147483e3,display:\"none\",objectFit:\"contain\",background:\"#000\"}}),document.body)]});}ProjectVideo.displayName=\"Project Video\";addPropertyControls(ProjectVideo,{cover:{type:ControlType.File,title:\"Cover Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},full:{type:ControlType.File,title:\"Full Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},poster:{type:ControlType.ResponsiveImage,title:\"Poster\"},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\"],optionTitles:[\"Fill\",\"Fit\"],defaultValue:\"cover\",displaySegmentedControl:true},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:200,unit:\"px\"},clickToPlay:{type:ControlType.Boolean,title:\"Click Video\",defaultValue:true,enabledTitle:\"Plays\",disabledTitle:\"Nothing\"},closeAtEnd:{type:ControlType.Boolean,title:\"At End\",defaultValue:true,enabledTitle:\"Close\",disabledTitle:\"Stay\"}});/** Put on a Play button: opens the Project Video on the page in fullscreen. */export function withPlayVideo(Component){return /*#__PURE__*/forwardRef(function PlayVideo(props,ref){const handle=e=>{props.onClick?.(e);players.forEach(open=>open());};return /*#__PURE__*/_jsx(Component,{...props,ref:ref,onClick:handle,style:{cursor:\"pointer\",...props.style}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withPlayVideo\":{\"type\":\"reactHoc\",\"name\":\"withPlayVideo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"ProjectVideo\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSup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