{"version":3,"file":"ProjectCoverVideo.BNWrGe79.mjs","names":["useState","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/nBEDnVx2oiGT2QMU2iet/SYd4FuMDuQ91XZ0nlBVo/ProjectCoverVideo.js"],"sourcesContent":["// User instructions:\n// Create small new code component ProjectCoverVideo for optional background video overlay inside an existing linked project card cover. Controls video File mp4/webm, poster ResponsiveImage optional. If no video render transparent empty div filling bounds, not placeholder. Video muted autoplay loop playsInline preload metadata, no controls because entire card links to project; pointerEvents none. width height100% objectFit cover. Root style applied, overflow hidden. SSR safe, normalize file string or src/url object, image poster. On video load error hide video to reveal canvas cover image underneath. Preserve parent native cover/hover/rounding not bake into code. Return id controls.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{startTransition,useCallback,useEffect,useMemo,useState}from\"react\";function normalizeFileValue(value){let current=value;let depth=0;while(depth<6){depth+=1;if(typeof current===\"string\"){const trimmed=current.trim();return trimmed.length>0?trimmed:undefined;}if(!current||typeof current!==\"object\")return undefined;const objectValue=current;const candidate=[objectValue.src,objectValue.url,objectValue.href].find(item=>typeof item===\"string\"&&item.trim().length>0);if(candidate)return candidate;if(\"value\"in objectValue){current=objectValue.value;continue;}return undefined;}return undefined;}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ProjectCoverVideo(props){const{video=\"\",poster,style}=props;const[hasVideoError,setHasVideoError]=useState(false);const normalizedVideo=useMemo(()=>normalizeFileValue(video),[video]);const normalizedPoster=useMemo(()=>normalizeFileValue(poster),[poster]);useEffect(()=>{startTransition(()=>setHasVideoError(false));},[normalizedVideo]);const handleVideoError=useCallback(()=>{startTransition(()=>setHasVideoError(true));},[]);const rootStyle=useMemo(()=>({position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",pointerEvents:\"none\",background:\"transparent\",...style}),[style]);if(!normalizedVideo||hasVideoError){return /*#__PURE__*/_jsx(\"div\",{style:rootStyle});}return /*#__PURE__*/_jsx(\"div\",{style:rootStyle,children:/*#__PURE__*/_jsx(\"video\",{src:normalizedVideo,poster:normalizedPoster,muted:true,autoPlay:true,loop:true,playsInline:true,preload:\"metadata\",onError:handleVideoError,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\",pointerEvents:\"none\"}})});}addPropertyControls(ProjectCoverVideo,{video:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\"]},poster:{type:ControlType.ResponsiveImage,title:\"Poster\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProjectCoverVideo\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProjectCoverVideo.map"],"mappings":"sMAEyK,SAAS,EAAmB,EAAM,CAAC,IAAI,EAAQ,EAAU,EAAM,EAAE,KAAM,EAAM,GAAE,CAAU,GAAT,GAAO,EAAK,OAAO,GAAU,SAAS,CAAC,IAAM,EAAQ,EAAQ,KAAK,EAAE,OAAO,EAAQ,OAAO,EAAE,EAAQ,IAAA,EAAU,CAAC,GAAG,CAAC,GAAS,OAAO,GAAU,SAAS,OAAiB,IAAM,EAAY,EAAc,EAAU,CAAC,EAAY,IAAI,EAAY,IAAI,EAAY,IAAI,CAAC,CAAC,KAAK,GAAM,OAAO,GAAO,UAAU,EAAK,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAU,OAAO,EAAU,GAAG,UAAU,EAAY,CAAC,EAAQ,EAAY,MAAM,QAAS,CAAC,MAAiB,CAAkB,CAGlrB,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,GAAG,SAAO,SAAO,EAAW,CAAC,EAAc,GAAkBA,EAAS,EAAK,EAAQ,EAAgBC,MAAY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