{"version":3,"file":"AdaptiveVideoPlayer.BTiLlVT3.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/kGE6wgXHmKEa3H3TNX76/Pgl5oiwPBzr4zNIv8Tue/AdaptiveVideoPlayer.js"],"sourcesContent":["// Rebuild component using provided ViewportVideo implementation\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useInView}from\"framer-motion\";/**\n * Viewport-triggered video player that auto plays/pauses based on visibility.\n *\n * @framerIntrinsicWidth 640\n * @framerIntrinsicHeight 360\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ViewportVideo(props){const{video=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",muted,loop,fit,radius,glowEnabled,glowSize,glowColor,playOnHover}=props;const containerRef=useRef(null);const videoRef=useRef(null);const inView=useInView(containerRef,{amount:.4});const[hovered,setHovered]=useState(false);useEffect(()=>{const el=videoRef.current;if(!el)return;// Reduce bandwidth by only setting src while in view and using lighter preloading.\nel.preload=\"metadata\";if(typeof window===\"undefined\")return;if(inView){el.loop=loop;if(el.getAttribute(\"src\")!==video){el.setAttribute(\"src\",video);el.load();}const shouldPlay=playOnHover?hovered:true;if(shouldPlay){const playPromise=el.play();if(playPromise&&typeof playPromise.then===\"function\"){playPromise.catch(()=>{});}}else{el.pause();}}else{el.pause();// Stop network activity and free buffer when out of view.\nel.removeAttribute(\"src\");el.load();}},[inView,video,loop,playOnHover,hovered]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,onMouseEnter:playOnHover?()=>{startTransition(()=>setHovered(true));}:undefined,onMouseLeave:playOnHover?()=>{startTransition(()=>setHovered(false));}:undefined,style:{width:\"100%\",height:\"100%\",position:\"relative\",borderRadius:radius,overflow:\"hidden\",boxShadow:glowEnabled?`0 0 ${glowSize}px ${glowColor}`:\"none\"},children:/*#__PURE__*/_jsx(\"video\",{ref:videoRef,muted:muted,loop:loop,playsInline:true,preload:\"metadata\",style:{width:\"100%\",height:\"100%\",objectFit:fit,background:\"transparent\"}})});}addPropertyControls(ViewportVideo,{video:{type:ControlType.File,allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},fit:{type:ControlType.Enum,options:[\"cover\",\"contain\",\"fill\"],defaultValue:\"cover\"},radius:{type:ControlType.Number,defaultValue:24,min:0,max:100,unit:\"px\"},glowEnabled:{type:ControlType.Boolean,defaultValue:true},glowColor:{type:ControlType.Color,defaultValue:\"rgba(0, 150, 255, 0.35)\",hidden:props=>!props.glowEnabled},glowSize:{type:ControlType.Number,defaultValue:60,min:0,max:300,unit:\"px\",hidden:props=>!props.glowEnabled},loop:{type:ControlType.Boolean,defaultValue:true},muted:{type:ControlType.Boolean,defaultValue:true},playOnHover:{type:ControlType.Boolean,title:\"Play on Hover\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ViewportVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"360\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"640\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AdaptiveVideoPlayer.map"],"mappings":"8PASG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,uEAAuE,QAAM,OAAK,MAAI,SAAO,cAAY,WAAS,YAAU,eAAa,EAAY,EAAaA,EAAO,KAAK,CAAO,EAASA,EAAO,KAAK,CAAO,EAAO,EAAU,EAAa,CAAC,OAAO,GAAG,CAAC,CAAM,CAAC,EAAQ,GAAYC,EAAS,GAAM,CAEjR,OAFkR,MAAc,CAAC,IAAM,EAAG,EAAS,QAAY,OAC/Y,EAAG,QAAQ,WA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