{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/AVmzUgtD4c9KT8lr9nF0/Hy0afDWMUpCPJXewdkOr/VideoSwap.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{useEffect,useRef,useState}from\"react\";// Learn more: https://www.framer.com/developers/overrides/\n// Shared store between all components and the video\nexport const useVideoStore=createStore({currentVideoUrl:null,targetVideoUrl:null,isTransitioning:false});export function withSetBackgroundVideo(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const filepath=props.videoFile;const[store,setStore]=useVideoStore();const handleMouseEnter=()=>{if(filepath&&store.targetVideoUrl!==filepath){console.log(\"SETTOMG\",filepath);// Tell the video component to change to this video\nsetStore({targetVideoUrl:filepath});}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:handleMouseEnter});});}// Learn more: https://www.framer.com/developers/overrides/\nexport function withVideoTransitions(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useVideoStore();console.log(\"Video Component Props:\",props);console.log(\"Current Store State:\",store);const fadeTime=0// Fade duration in milliseconds\n;// Use state to track the current video URL\nconst[currentSrc,setCurrentSrc]=useState(props.srcFile??props.srcUrl);// Track if we're transitioning\nconst isTransitioning=useRef(false);// Setup a unique ID for our video\nconst videoId=\"framer-video-player\";// Function to get the video element\nconst getVideoElement=()=>{return document.querySelector(\"video\")||document.getElementById(videoId);};// Setup once on mount\nuseEffect(()=>{// Find our video element\nconst videoElement=getVideoElement();if(videoElement){console.log(\"Found video element:\",videoElement);// Add ID to video for easier finding\nif(!videoElement.id){videoElement.id=videoId;}// Setup fade transition\nif(!videoElement.style.transition){videoElement.style.transition=`opacity ${fadeTime}ms ease`;}}else{console.warn(\"Could not find video element on initial mount\");}},[]);// Watch for target URL changes\nuseEffect(()=>{console.log(\"Store changed, target URL:\",store.targetVideoUrl);// Get the video element\nconst video=getVideoElement();if(!video){console.warn(\"Could not find video element\");return;}console.log(store.targetVideoUrl,currentSrc,isTransitioning.current);// If there's a target URL and we're not transitioning\nif(store.targetVideoUrl&&store.targetVideoUrl!==currentSrc){console.log(\"Starting transition to:\",store.targetVideoUrl);isTransitioning.current=true;// Save video state\nconst wasPlaying=!video.paused;const currentVolume=video.volume;const playbackRate=video.playbackRate;// Fade out\n// video.style.opacity = \"0\"\n// Wait for fade out to complete\nsetTimeout(()=>{// Update our source state\nsetCurrentSrc(store.targetVideoUrl);// Clear target URL\nsetStore({...store,targetVideoUrl:null});// The srcUrl will be updated via props, then:\n// Wait for video to load new source\nconst onLoadedData=()=>{// Restore playback settings\nvideo.volume=currentVolume;video.playbackRate=playbackRate;// Play if it was playing before\nif(wasPlaying){video.play().catch(e=>console.log(\"Auto-play prevented:\",e));}// Fade back in\n// video.style.opacity = \"1\"\n// Clear transition flag\n// setTimeout(() => {\n//     isTransitioning.current = false\n//     console.log(\"Transition complete\")\n// }, fadeTime)\n// Remove event listener\nvideo.removeEventListener(\"loadeddata\",onLoadedData);};// Listen for the video to load\nvideo.addEventListener(\"loadeddata\",onLoadedData);},fadeTime);}else{console.log(\"burhs\");}},[store.targetVideoUrl]);console.log(props);// Return component with updated src\nreturn /*#__PURE__*/_jsx(Component,{id:videoId,ref:ref,...props,srcUrl:currentSrc,srcFile:currentSrc});});}\nexport const __FramerMetadata__ = {\"exports\":{\"useVideoStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSetBackgroundVideo\":{\"type\":\"reactHoc\",\"name\":\"withSetBackgroundVideo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withVideoTransitions\":{\"type\":\"reactHoc\",\"name\":\"withVideoTransitions\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VideoSwap.map"],
  "mappings": "gJAEO,IAAMA,EAAcC,EAAY,CAAC,gBAAgB,KAAK,eAAe,KAAK,g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AW,CAAC,QAAQ,IAAI,0BAA0BL,EAAM,cAAc,EAAEQ,EAAgB,QAAQ,GAChJ,IAAMO,EAAW,CAACD,EAAM,OAAaE,EAAcF,EAAM,OAAaG,EAAaH,EAAM,aAGzF,WAAW,IAAI,CACfR,EAAcN,EAAM,cAAc,EAClCC,EAAS,CAAC,GAAGD,EAAM,eAAe,IAAI,CAAC,EAEvC,IAAMkB,EAAa,IAAI,CACvBJ,EAAM,OAAOE,EAAcF,EAAM,aAAaG,EAC3CF,GAAYD,EAAM,KAAK,EAAE,MAAMK,GAAG,QAAQ,IAAI,uBAAuBA,CAAC,CAAC,EAQ1EL,EAAM,oBAAoB,aAAaI,CAAY,CAAE,EACrDJ,EAAM,iBAAiB,aAAaI,CAAY,CAAE,EAAEd,CAAQ,CAAE,MAAM,QAAQ,IAAI,OAAO,CAAG,EAAE,CAACJ,EAAM,cAAc,CAAC,EAAE,QAAQ,IAAIH,CAAK,EACjHK,EAAKP,EAAU,CAAC,GAAGe,EAAQ,IAAIZ,EAAI,GAAGD,EAAM,OAAOQ,EAAW,QAAQA,CAAU,CAAC,CAAE,CAAC,CAAE",
  "names": ["useVideoStore", "createStore", "withSetBackgroundVideo", "Component", "Y", "props", "ref", "filepath", "store", "setStore", "p", "withVideoTransitions", "fadeTime", "currentSrc", "setCurrentSrc", "ye", "isTransitioning", "pe", "videoId", "getVideoElement", "ue", "videoElement", "video", "wasPlaying", "currentVolume", "playbackRate", "onLoadedData", "e"]
}
