{"version":3,"file":"VideoSection.CKMW-nF6.mjs","names":["useRef","useCallback","useState","startTransition"],"sources":["https:/framerusercontent.com/modules/a6FZTONVImHDqnEkemYA/QsnL8zZBduDCrvYKqVkH/VideoSection.js"],"sourcesContent":["// Section with video player\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{startTransition,useCallback,useEffect,useRef,useState}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight fixed\n */export default function VideoSection(props){const{videoFile=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",backgroundColor,padding,borderRadius,showControls,autoplay,loop,muted,focalX,focalY,text,textColor,textFont,textPosition,style}=props;const videoRef=useRef(null);const tryPlay=useCallback(()=>{const el=videoRef.current;if(!el)return;const result=el.play();// Avoid unhandled promise rejections in browsers that block autoplay\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nif(result&&typeof result.catch===\"function\")result.catch(()=>{});},[]);const[isMobile,setIsMobile]=useState(()=>{if(typeof window===\"undefined\")return false;const mqWidth=window.matchMedia(\"(max-width: 767px)\");const mqCoarse=window.matchMedia(\"(hover: none) and (pointer: coarse)\");return Boolean(mqWidth.matches||mqCoarse.matches);});useEffect(()=>{if(typeof window===\"undefined\")return;const mqWidth=window.matchMedia(\"(max-width: 767px)\");const mqCoarse=window.matchMedia(\"(hover: none) and (pointer: coarse)\");const update=()=>startTransition(()=>setIsMobile(Boolean(mqWidth.matches||mqCoarse.matches)));update();if(mqWidth.addEventListener)mqWidth.addEventListener(\"change\",update);else mqWidth.addListener(update);if(mqCoarse.addEventListener)mqCoarse.addEventListener(\"change\",update);else mqCoarse.addListener(update);return()=>{if(mqWidth.removeEventListener)mqWidth.removeEventListener(\"change\",update);else mqWidth.removeListener(update);if(mqCoarse.removeEventListener)mqCoarse.removeEventListener(\"change\",update);else mqCoarse.removeListener(update);};},[]);// Watchdog: some mobile browsers pause/freeze videos after a while.\n// We periodically check if playback is progressing and try to resume if it isn't.\nuseEffect(()=>{if(typeof window===\"undefined\")return;if(typeof document===\"undefined\")return;const el=videoRef.current;if(!el)return;let lastTime=-1;let lastChangeAt=Date.now();const tick=()=>{const v=videoRef.current;if(!v)return;if(!v.paused&&!v.ended){if(v.currentTime===lastTime){if(Date.now()-lastChangeAt>1500){try{// Nudge the playhead slightly to unstick decoding\nv.currentTime=Math.max(0,v.currentTime-.1);}catch{}tryPlay();lastChangeAt=Date.now();}}else{lastTime=v.currentTime;lastChangeAt=Date.now();}}};const id=window.setInterval(tick,1e3);const onVis=()=>{if(!document.hidden)tryPlay();};document.addEventListener(\"visibilitychange\",onVis);return()=>{window.clearInterval(id);document.removeEventListener(\"visibilitychange\",onVis);};},[tryPlay]);return /*#__PURE__*/_jsxs(\"div\",{style:{...style,width:\"100%\",height:\"100%\",backgroundColor,padding,borderRadius,boxSizing:\"border-box\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"hidden\",overflowX:\"hidden\",maxWidth:\"100vw\",position:\"relative\"},children:[/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoFile,controls:showControls&&!isMobile,controlsList:\"nodownload noremoteplayback\",preload:\"auto\",playsInline:true,disablePictureInPicture:true,disableRemotePlayback:true,// @ts-ignore\n\"webkit-playsinline\":\"true\",autoPlay:autoplay,loop:loop,muted:muted,onEnded:()=>{// If loop is off but autoplay is on, restart to avoid freezing on last frame\nconst v=videoRef.current;if(!v)return;if(autoplay&&!loop){try{v.currentTime=0;}catch{}tryPlay();}},onStalled:()=>tryPlay(),onSuspend:()=>tryPlay(),onWaiting:()=>tryPlay(),onPause:()=>{// If autoplay is enabled, keep it playing\nif(autoplay)tryPlay();},style:{width:\"100%\",height:\"100%\",maxWidth:\"100%\",display:\"block\",objectFit:\"cover\",objectPosition:`${focalX}% ${focalY}%`,borderRadius:borderRadius*.5}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:textPosition===\"top\"?0:textPosition===\"center\"?\"50%\":\"auto\",bottom:textPosition===\"bottom\"?0:\"auto\",left:0,right:0,transform:textPosition===\"center\"?\"translateY(-50%)\":\"none\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:textColor,textAlign:\"center\",padding:30,boxSizing:\"border-box\",textTransform:\"uppercase\",...textFont},children:text})]});}addPropertyControls(VideoSection,{videoFile:{type:ControlType.File,allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},text:{type:ControlType.String,defaultValue:\"PANAMA\",displayTextArea:true},textColor:{type:ControlType.Color,defaultValue:\"#FFFFFF\"},textFont:{type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"80px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},textPosition:{type:ControlType.Enum,options:[\"top\",\"center\",\"bottom\"],optionTitles:[\"Top\",\"Center\",\"Bottom\"],defaultValue:\"bottom\",displaySegmentedControl:true},backgroundColor:{type:ControlType.Color,defaultValue:\"#000000\"},padding:{type:ControlType.Number,defaultValue:0,min:0,max:100,step:1,unit:\"px\"},borderRadius:{type:ControlType.Number,defaultValue:0,min:0,max:50,step:1,unit:\"px\"},showControls:{type:ControlType.Boolean,defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},autoplay:{type:ControlType.Boolean,defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},loop:{type:ControlType.Boolean,defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},muted:{type:ControlType.Boolean,defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},focalX:{type:ControlType.Number,title:\"Focal X\",defaultValue:50,min:0,max:100,step:1,unit:\"%\"},focalY:{type:ControlType.Number,title:\"Focal Y\",defaultValue:50,min:0,max:100,step:1,unit:\"%\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoSection\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"fram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