{"version":3,"file":"MediaFrame_1.B1axCYuP.mjs","names":["useState","useRef","useCallback","startTransition","useMemo"],"sources":["https:/framerusercontent.com/modules/2ZxCNgvNDpK6z4b5AJey/k5SlO31zD38TFzjw9qdK/MediaFrame_1.js"],"sourcesContent":["// Video/Image Frame component with play/pause buttons, controllers, editable variants\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,startTransition,useCallback,useMemo}from\"react\";import{addPropertyControls,ControlType,RenderTarget,useIsStaticRenderer}from\"framer\";/**\n * MediaFrame\n *\n * Frame for video or image with customizable controllers and play/pause button, hover interactions, style variants.\n *\n * @framerIntrinsicWidth 480\n * @framerIntrinsicHeight 320\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function MediaFrame(props){const{sourceType,image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Image\"},videoFile=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",posterImage={src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Poster\"},showControls,autoPlay,loop,muted,showPlayPause,frameColor,frameRadius,frameShadow,framePadding,buttonColor,buttonHoverColor,buttonIconColor,buttonSize,style}=props;const isStatic=useIsStaticRenderer();const[isPlaying,setIsPlaying]=useState(autoPlay);const[hover,setHover]=useState(false);const[btnHover,setBtnHover]=useState(false)// NEW: captures button hover separately\n;const videoRef=useRef(null);const handlePlayPause=useCallback(()=>{if(sourceType!==\"video\"||!videoRef.current)return;if(isPlaying){videoRef.current.pause();startTransition(()=>setIsPlaying(false));}else{videoRef.current.play();startTransition(()=>setIsPlaying(true));}},[isPlaying,sourceType]);// Sync playing state on video events\nconst onPlay=useCallback(()=>startTransition(()=>setIsPlaying(true)),[]);const onPause=useCallback(()=>startTransition(()=>setIsPlaying(false)),[]);// Button render\nconst playPauseBtn=useMemo(()=>showPlayPause&&sourceType===\"video\"&&// Only show button when:\n    // - paused (always)\n    // - playing, but hovered (and show pause btn)\n    (!isPlaying||isPlaying&&hover)&&/*#__PURE__*/_jsx(\"button\",{onClick:handlePlayPause,style:{position:\"absolute\",left:\"50%\",top:\"50%\",transform:btnHover?\"translate(-50%,-50%) scale(1.08) rotate(-7deg)\":\"translate(-50%,-50%) scale(1)\",zIndex:10,border:\"none\",outline:\"none\",background:btnHover?buttonHoverColor:buttonColor,borderRadius:\"50%\",width:buttonSize,height:buttonSize,minWidth:buttonSize,minHeight:buttonSize,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:btnHover?\"0 8px 32px 0 rgba(0,0,0,0.22)\":\"0 2px 8px 0 rgba(0,0,0,0.18)\",cursor:\"pointer\",transition:\"background 0.18s, transform 0.22s cubic-bezier(.39,.31,.64,1.54), box-shadow 0.21s cubic-bezier(.39,.31,.64,1.54)\",pointerEvents:RenderTarget.current()===RenderTarget.thumbnail?\"none\":\"auto\",opacity:1,visibility:\"visible\"},\"aria-label\":isPlaying?\"Pause\":\"Play\",tabIndex:0,onMouseEnter:()=>startTransition(()=>setBtnHover(true)),onMouseLeave:()=>startTransition(()=>setBtnHover(false)),children:!isPlaying?/*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 32 32\",width:buttonSize*.56,height:buttonSize*.56,\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"polygon\",{points:\"9,6 27,16 9,26\",fill:buttonIconColor})}):/*#__PURE__*/_jsxs(\"svg\",{viewBox:\"0 0 32 32\",width:buttonSize*.5,height:buttonSize*.5,\"aria-hidden\":\"true\",children:[/*#__PURE__*/_jsx(\"rect\",{x:\"7\",y:\"7\",width:\"6\",height:\"18\",rx:\"2\",fill:buttonIconColor}),/*#__PURE__*/_jsx(\"rect\",{x:\"19\",y:\"7\",width:\"6\",height:\"18\",rx:\"2\",fill:buttonIconColor})]})}),[showPlayPause,handlePlayPause,isPlaying,btnHover,buttonColor,buttonHoverColor,buttonIconColor,buttonSize,sourceType,hover]);// Main content\nreturn /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",background:frameColor,borderRadius:frameRadius,boxShadow:frameShadow?\"0 2px 18px rgba(0,0,0,0.11)\":undefined,padding:framePadding,width:\"100%\",height:\"100%\",overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},onMouseEnter:()=>startTransition(()=>setHover(true)),onMouseLeave:()=>{startTransition(()=>setHover(false));startTransition(()=>setBtnHover(false));},children:[sourceType===\"image\"?/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"Image\",style:{borderRadius:frameRadius,display:\"block\",width:\"100%\",height:\"100%\",objectFit:props.imageFillMode||\"cover\"}}):/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoFile,poster:posterImage?.src,controls:showControls,autoPlay:autoPlay&&!isStatic,loop:loop,muted:muted,onPlay:onPlay,onPause:onPause,style:{borderRadius:frameRadius,width:\"100%\",height:\"100%\",display:\"block\",objectFit:\"cover\",background:frameColor}}),!isStatic&&playPauseBtn]});}addPropertyControls(MediaFrame,{sourceType:{type:ControlType.Enum,title:\"Source\",options:[\"image\",\"video\"],optionTitles:[\"Image\",\"Video\"],defaultValue:\"image\",displaySegmentedControl:true},image:{type:ControlType.ResponsiveImage,title:\"Image\"},imageFillMode:{type:ControlType.Enum,title:\"Image Fill\",options:[\"cover\",\"contain\",\"fill\",\"scale-down\",\"none\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\",\"Scale Down\",\"None\"],defaultValue:\"cover\",hidden:({sourceType})=>sourceType!==\"image\",displaySegmentedControl:false},videoFile:{type:ControlType.File,allowedFileTypes:[\"mp4\",\"webm\",\"mov\"],title:\"Video File\"},posterImage:{type:ControlType.ResponsiveImage,title:\"Poster Image\"},showControls:{type:ControlType.Boolean,title:\"Show Native Ctrl\",defaultValue:true,hidden:({sourceType})=>sourceType!==\"video\",enabledTitle:\"Show\",disabledTitle:\"Hide\"},autoPlay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:false,hidden:({sourceType})=>sourceType!==\"video\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,hidden:({sourceType})=>sourceType!==\"video\"},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true,hidden:({sourceType})=>sourceType!==\"video\"},showPlayPause:{type:ControlType.Boolean,title:\"Play/Pause Btn\",defaultValue:true,hidden:({sourceType})=>sourceType!==\"video\",enabledTitle:\"Show\",disabledTitle:\"Hide\"},frameColor:{type:ControlType.Color,title:\"Frame Color\",defaultValue:\"#FFFFFF\"},frameRadius:{type:ControlType.Number,title:\"Frame Radius\",defaultValue:16,min:0,max:48,unit:\"px\",step:1},frameShadow:{type:ControlType.Boolean,title:\"Frame Shadow\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},framePadding:{type:ControlType.Number,title:\"Frame Padding\",defaultValue:0,min:0,max:40,unit:\"px\",step:1},buttonColor:{type:ControlType.Color,title:\"Btn Bg\",defaultValue:\"#222831\",hidden:({sourceType})=>sourceType!==\"video\"},buttonHoverColor:{type:ControlType.Color,title:\"Btn Hover\",defaultValue:\"#11151A\",hidden:({sourceType})=>sourceType!==\"video\"},buttonIconColor:{type:ControlType.Color,title:\"Btn Icon\",defaultValue:\"#ffffff\",hidden:({sourceType})=>sourceType!==\"video\"},buttonSize:{type:ControlType.Number,title:\"Btn Size\",defaultValue:64,min:32,max:112,step:1,unit:\"px\",hidden:({sourceType})=>sourceType!==\"video\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MediaFrame\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"480\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"320\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MediaFrame_1.map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