{"version":3,"file":"HeroVideo.CeY-R-CC.mjs","names":["React.useRef","React.useState","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","p","c","init_jsx_runtime","ce","de","window","addPropertyControls","ControlType","init_framer_DxfB3JJo","url","HeroVideo","props","ref","activeSrc","setActiveSrc","playing","setPlaying","posterSrc","posterEnabled","poster","mobileSrc","posterMobile","src","cancelled","start","v","muted","onMeta","startTime","onPlaying","fill","style","mobileMaxWidth","init_HeroVideo"],"sources":["https:/framerusercontent.com/modules/oP0c9OhvoLoV1pqCRKDf/5uCZ4agKnMgENk8U7w5b/HeroVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";function url(p){if(!p)return undefined;if(typeof p===\"string\")return p;return p.src;}/**\n * Lightweight autoplay video. The poster is a server-rendered <picture>\n * (a lighter center crop on phones) so it is the LCP element; the video file\n * is only requested after the page \"load\" event and fades in once playing.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 640\n * @framerIntrinsicHeight 360\n */export default function HeroVideo(props){const{src,poster,posterMobile,mobileMaxWidth=480,posterEnabled=true,objectFit=\"cover\",loop=false,muted=true,startTime=0,borderRadius=\"0px\",backgroundColor=\"rgba(0,0,0,0)\",title,style}=props;const ref=React.useRef(null);const[activeSrc,setActiveSrc]=React.useState(undefined);const[playing,setPlaying]=React.useState(false);const posterSrc=posterEnabled?url(poster):undefined;const mobileSrc=posterEnabled?url(posterMobile):undefined;React.useEffect(()=>{if(!src)return;let cancelled=false;const start=()=>{if(!cancelled)setActiveSrc(src);};if(document.readyState===\"complete\")start();else window.addEventListener(\"load\",start,{once:true});return()=>{cancelled=true;window.removeEventListener(\"load\",start);};},[src]);React.useEffect(()=>{const v=ref.current;if(!v||!activeSrc)return;v.muted=muted;v.defaultMuted=muted;const onMeta=()=>{if(startTime>0){try{v.currentTime=startTime;}catch(e){}}};const onPlaying=()=>setPlaying(true);v.addEventListener(\"loadedmetadata\",onMeta,{once:true});v.addEventListener(\"playing\",onPlaying,{once:true});const p=v.play();if(p&&typeof p.catch===\"function\")p.catch(()=>{});return()=>{v.removeEventListener(\"loadedmetadata\",onMeta);v.removeEventListener(\"playing\",onPlaying);};},[activeSrc,muted,startTime]);const fill={position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",display:\"block\",objectFit,borderRadius};return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius,backgroundColor,...style},children:[posterSrc?/*#__PURE__*/_jsxs(\"picture\",{children:[mobileSrc?/*#__PURE__*/_jsx(\"source\",{media:\"(max-width: \"+mobileMaxWidth+\"px)\",srcSet:mobileSrc}):null,/*#__PURE__*/_jsx(\"img\",{src:posterSrc,alt:\"\",\"aria-hidden\":true,decoding:\"async\",draggable:false,...{fetchpriority:\"high\"},style:fill})]}):null,/*#__PURE__*/_jsx(\"video\",{ref:ref,src:activeSrc,autoPlay:true,muted:muted,loop:loop,playsInline:true,preload:\"none\",\"aria-hidden\":title?undefined:true,title:title,style:{...fill,opacity:posterSrc?playing?1:0:1,transition:\"opacity 0.4s ease\"}})]});}addPropertyControls(HeroVideo,{src:{type:ControlType.File,title:\"File\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},posterEnabled:{type:ControlType.Boolean,title:\"Poster\",defaultValue:true},poster:{type:ControlType.ResponsiveImage,title:\"Image\",hidden:p=>!p.posterEnabled},posterMobile:{type:ControlType.ResponsiveImage,title:\"Mobile Image\",hidden:p=>!p.posterEnabled},mobileMaxWidth:{type:ControlType.Number,title:\"Mobile ≤\",min:200,max:1200,step:1,unit:\"px\",defaultValue:480,hidden:p=>!p.posterEnabled},objectFit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\",\"fill\",\"none\",\"scale-down\"],defaultValue:\"cover\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true},startTime:{type:ControlType.Number,title:\"Start\",min:0,step:.1,defaultValue:0},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"0px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgba(0,0,0,0)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HeroVideo\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"640\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"360\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HeroVideo.map"],"mappings":"A,6MAAyI,SAASe,EAAI,EAAE,CAAC,GAAIT,EAAmD,OAA7B,OAAOA,GAAI,SAAgBA,EAASA,EAAE,GAAI,CAS1N,SAAwBU,EAAU,EAAM,CAAC,GAAK,CAAC,MAAI,SAAO,eAAa,iBAAe,IAAI,gBAAc,GAAK,YAAU,QAAQ,OAAK,GAAM,QAAM,GAAK,YAAU,EAAE,eAAa,MAAM,kBAAgB,gBAAgB,QAAM,SAAOC,EAAYC,EAAIlB,EAAa,IAAI,EAAO,CAACmB,EAAUC,GAAcnB,EAAe,IAAA,EAAS,EAAO,CAACoB,EAAQC,GAAYrB,EAAe,EAAK,EAAQsB,EAAUC,EAAcT,EAAIU,CAAM,EAAE,IAAA,GAAgBC,EAAUF,EAAcT,EAAIY,CAAY,EAAE,IAAA,GAAUlB,MAAoB,CAAC,GAAG,CAACmB,EAAI,OAAO,IAAIC,EAAU,GAAYC,MAAU,CAAKD,GAAUT,EAAaQ,CAAG,CAAE,EAAqG,OAAhG,SAAS,aAAa,WAAWE,EAAM,EAAOnB,EAAO,iBAAiB,OAAOmB,EAAM,CAAC,KAAK,EAAI,CAAC,MAAY,C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