{"version":3,"file":"VideoPlayer.CZhkshjs.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/zkuqkBiDGj8ySt9J81op/rxYLvKNH10hUSrcZYMTv/VideoPlayer.js"],"sourcesContent":["// VideoPlayer component with URL poster option - identical to native Framer video but allows poster as URL\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useRef,useState,useEffect,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function VideoPlayer(props){const{videoType=\"upload\",src=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",videoUrl=\"\",posterType=\"upload\",posterImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"VideoPlayer poster\"},posterUrl=\"\",autoPlay=false,loop=false,muted=false,controls=true,playsInline=true,objectFit=\"cover\",lazyLoad=true,borderRadius=0,style}=props;const videoSrc=videoType===\"url\"?videoUrl:src;const posterSrc=posterType===\"url\"?posterUrl:posterImage?.src;const videoRef=useRef(null);const[isInView,setIsInView]=useState(!lazyLoad);const hasLoadedRef=useRef(!lazyLoad);const observerRef=useRef(null);useEffect(()=>{if(!lazyLoad||typeof window===\"undefined\"){if(!hasLoadedRef.current){hasLoadedRef.current=true;startTransition(()=>setIsInView(true));}return;}const currentVideoRef=videoRef.current;if(!currentVideoRef)return;if(observerRef.current){observerRef.current.disconnect();}observerRef.current=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting){startTransition(()=>setIsInView(true));}else{startTransition(()=>setIsInView(false));}});},{rootMargin:\"50px\"});observerRef.current.observe(currentVideoRef);return()=>{if(observerRef.current){observerRef.current.disconnect();observerRef.current=null;}};},[lazyLoad]);// Unload video when it goes off-screen\nuseEffect(()=>{if(!lazyLoad)return;const video=videoRef.current;if(!video)return;if(!isInView){video.pause();video.removeAttribute(\"src\");video.load();}else if(videoSrc){// Reload video when it comes back into view\nvideo.src=videoSrc;video.load();}},[isInView,lazyLoad,videoSrc]);return /*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:isInView?videoSrc:undefined,poster:posterSrc,autoPlay:autoPlay,loop:loop,muted:muted,controls:controls,playsInline:playsInline,style:{width:\"100%\",height:\"100%\",objectFit,borderRadius:`${borderRadius}px`,transform:\"translateZ(0)\",WebkitTransform:\"translateZ(0)\",willChange:\"transform\",...style}});}addPropertyControls(VideoPlayer,{videoType:{type:ControlType.Enum,title:\"Video Type\",options:[\"upload\",\"url\"],optionTitles:[\"Upload\",\"URL\"],defaultValue:\"upload\",displaySegmentedControl:true},src:{type:ControlType.File,title:\"VideoPlayer\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\",\"ogg\"],hidden:({videoType})=>videoType===\"url\"},videoUrl:{type:ControlType.String,title:\"Video URL\",placeholder:\"https://example.com/video.mp4\",defaultValue:\"\",hidden:({videoType})=>videoType===\"upload\"},posterType:{type:ControlType.Enum,title:\"Poster Type\",options:[\"upload\",\"url\"],optionTitles:[\"Upload\",\"URL\"],defaultValue:\"upload\",displaySegmentedControl:true},posterImage:{type:ControlType.ResponsiveImage,title:\"Poster Image\",hidden:({posterType})=>posterType===\"url\"},posterUrl:{type:ControlType.String,title:\"Poster URL\",placeholder:\"https://example.com/poster.jpg\",defaultValue:\"\",hidden:({posterType})=>posterType===\"upload\"},lazyLoad:{type:ControlType.Boolean,title:\"Lazy Load\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},controls:{type:ControlType.Boolean,title:\"Controls\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},autoPlay:{type:ControlType.Boolean,title:\"Auto Play\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},playsInline:{type:ControlType.Boolean,title:\"Plays Inline\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},objectFit:{type:ControlType.Enum,title:\"Object Fit\",options:[\"contain\",\"cover\",\"fill\",\"none\",\"scale-down\"],optionTitles:[\"Contain\",\"Cover\",\"Fill\",\"None\",\"Scale Down\"],defaultValue:\"cover\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:0,min:0,max:100,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoPlayer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VideoPlayer.map"],"mappings":"6MAIG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,YAAU,SAAS,MAAI,uEAAuE,WAAS,GAAG,aAAW,SAAS,cAAY,CAAC,IAAI,sEAAsE,IAAI,qBAAqB,CAAC,YAAU,GAAG,WAAS,GAAM,OAAK,GAAM,QAAM,GAAM,WAAS,GAAK,cAAY,GAAK,YAAU,QAAQ,WAAS,GAAK,eAAa,EAAE,SAAO,EAAY,EAAS,IAAY,MAAM,EAAS,EAAU,EAAU,IAAa,MAAM,EAAU,GAAa,IAAU,EAASA,EAAO,KAAK,CAAM,CAAC,EAAS,GAAaC,EAAS,CAAC,EAAS,CAAO,EAAaD,EAAO,CAAC,EAAS,CAAO,EAAYA,EAAO,KAAK,CAE3mB,OAF4mB,MAAc,CAAC,GAAG,CAAC,GAAiB,IAAS,OAAY,CAAK,EAAa,UAAS,EAAa,QAAQ,GAAK,MAAoB,EAAY,GAAK,CAAC,EAAE,OAAQ,IAAM,EAAgB,EAAS,QAAY,KAAsV,OAA5T,EAAY,SAAS,EAAY,QAAQ,YAAY,CAAE,EAAY,QAAQ,IAAI,qBAAqB,GAAS,CAAC,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