{"version":3,"file":"shared-lib.C4oaunRx.mjs","names":["React.useRef"],"sources":["https:/framerusercontent.com/modules/IejNR27FkQQQ1aIrDred/V96NgeFt6fMTurIbSIjU/Scrub_video_pro.js","https:/framerusercontent.com/modules/5ykLAaPLb7Rf1H9vsnoY/gQCJDWPuUIMMASzwa8zX/siteMetadata.js"],"sourcesContent":["/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n */import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";function clamp(v,a=0,b=1){return Math.min(b,Math.max(a,v));}// Ultra-light smoothing - minimal calculations\nconst SMOOTHING=.1;export default function VideoScrubber(props){const{videoUrl,animation=\"sectionsinview\",sections=[{id:\"one\",start:0,end:15},{id:\"two\",start:16,end:77}],videoDirection=\"forward\",// REMOVED: viewportTrigger and customPercentage\n// NEW: Container visibility range (replaces the old triggers)\ncontainerStart=0,containerEnd=100,// Video range\nvideoStart=0,videoEnd=100,easing=\"linear\",muted=true,fit=\"cover\"}=props;const videoRef=React.useRef(null);const durationRef=React.useRef(null);const rafRef=React.useRef(null);const containerRef=React.useRef(null);// Minimal state\nconst currentVideoTimeRef=React.useRef(0);const targetTimeRef=React.useRef(0);const lastScrollYRef=React.useRef(0);const sectionElementsRef=React.useRef(new Map);const currentSectionRef=React.useRef(null);const videoSrc=videoUrl&&typeof videoUrl===\"object\"?videoUrl.src:videoUrl;// Simple lerp - fastest possible\nconst fastLerp=(a,b,t)=>a+(b-a)*t;// Initialize sections once\nReact.useEffect(()=>{sections.forEach(section=>{const el=document.getElementById(section.id);if(el){sectionElementsRef.current.set(section.id,{element:el,section:section});}});},[sections]);// Simple scroll handler\nReact.useEffect(()=>{const handleScroll=()=>{lastScrollYRef.current=window.scrollY;};window.addEventListener(\"scroll\",handleScroll,{passive:true});return()=>window.removeEventListener(\"scroll\",handleScroll);},[]);// Fast progress calculations\nconst computeHtmlScrollProgress=()=>{const scrollY=window.scrollY;const docHeight=document.documentElement.scrollHeight-window.innerHeight;return docHeight>0?clamp(scrollY/docHeight,0,1):0;};// UPDATED: Only uses containerStart/containerEnd (no more trigger point)\nconst computeVideoInViewProgress=()=>{if(!containerRef.current)return 0;const rect=containerRef.current.getBoundingClientRect();const vh=window.innerHeight;const containerHeight=rect.height;// Calculate raw visibility (0 to 1)\nconst rawProgress=(vh-rect.top)/(vh+containerHeight);// Apply container start/end thresholds\nconst startThreshold=containerStart/100;const endThreshold=containerEnd/100;if(rawProgress<startThreshold){return 0;}else if(rawProgress>endThreshold){return 1;}else{return(rawProgress-startThreshold)/(endThreshold-startThreshold);}};// Find active section - optimized\nconst findActiveSection=()=>{const scrollY=window.scrollY;const vh=window.innerHeight;let activeSection=null;let highestVisibility=0;sectionElementsRef.current.forEach(data=>{const el=data.element;const rect=el.getBoundingClientRect();const visibleHeight=Math.min(rect.bottom,vh)-Math.max(rect.top,0);const visibility=visibleHeight/Math.min(rect.height,vh);if(visibility>highestVisibility&&visibility>.1){highestVisibility=visibility;activeSection=data.section;}});return activeSection;};// Calculate section progress - fast\nconst calculateSectionProgress=section=>{const el=sectionElementsRef.current.get(section.id)?.element;if(!el)return 0;const rect=el.getBoundingClientRect();const vh=window.innerHeight;return clamp((vh-rect.top)/(vh+rect.height),0,1);};// Target calculation\nconst calculateTargetTime=()=>{const dur=durationRef.current;if(!dur)return currentVideoTimeRef.current;let targetTime=currentVideoTimeRef.current;switch(animation){case\"sectionsinview\":const activeSection=findActiveSection();if(activeSection){currentSectionRef.current=activeSection;const progress=calculateSectionProgress(activeSection);const startTime=activeSection.start/100*dur;const endTime=activeSection.end/100*dur;if(videoDirection===\"forward\"){targetTime=startTime+progress*(endTime-startTime);}else{targetTime=endTime-progress*(endTime-startTime);}}break;case\"onscroll\":const scrollProgress=computeHtmlScrollProgress();targetTime=videoDirection===\"forward\"?scrollProgress*dur:dur-scrollProgress*dur;break;case\"videoinview\":const viewProgress=computeVideoInViewProgress();if(viewProgress>0||viewProgress===0&&containerStart===0){const rangeStart=videoStart/100*dur;const rangeEnd=videoEnd/100*dur;const rangeDuration=rangeEnd-rangeStart;if(videoDirection===\"forward\"){targetTime=rangeStart+viewProgress*rangeDuration;}else{targetTime=rangeEnd-viewProgress*rangeDuration;}}break;}return clamp(targetTime,0,dur);};// Ultra-light animation loop\nReact.useEffect(()=>{let rafActive=true;const tick=()=>{if(!rafActive)return;const video=videoRef.current;const dur=durationRef.current;if(!video||!dur){rafRef.current=requestAnimationFrame(tick);return;}const rawTarget=calculateTargetTime();const currentTime=currentVideoTimeRef.current;const smoothedTime=fastLerp(currentTime,rawTarget,SMOOTHING);if(Math.abs(smoothedTime-currentTime)>.001){video.currentTime=smoothedTime;currentVideoTimeRef.current=smoothedTime;}rafRef.current=requestAnimationFrame(tick);};rafRef.current=requestAnimationFrame(tick);return()=>{rafActive=false;if(rafRef.current){cancelAnimationFrame(rafRef.current);}};},[animation,videoDirection,containerStart,containerEnd,videoStart,videoEnd]);const handleLoadedMetadata=e=>{const video=e.currentTarget;if(video&&video.duration&&!isNaN(video.duration)){durationRef.current=video.duration;currentVideoTimeRef.current=video.currentTime;}};const handleTimeUpdate=e=>{currentVideoTimeRef.current=e.currentTarget.currentTime;};const handleError=e=>{console.error(\"Video loading error:\",e);};return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoSrc,muted:muted,playsInline:true,preload:\"auto\",onLoadedMetadata:handleLoadedMetadata,onTimeUpdate:handleTimeUpdate,onError:handleError,style:{width:\"100%\",height:\"100%\",objectFit:fit||\"cover\"}})});}// CLEANED UP: Removed redundant trigger options\naddPropertyControls(VideoScrubber,{videoUrl:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\",\"ogg\",\"mov\"]},animation:{type:ControlType.Enum,title:\"Animation\",options:[\"onscroll\",\"videoinview\",\"sectionsinview\"],optionTitles:[\"On Scroll\",\"Video in View\",\"Sections in View\"],defaultValue:\"sectionsinview\"},videoDirection:{type:ControlType.Enum,title:\"Video Direction\",options:[\"forward\",\"backwards\"],optionTitles:[\"Forward\",\"Backwards\"],defaultValue:\"forward\"},// NEW: Container visibility range (replaces old triggers)\ncontainerStart:{type:ControlType.Number,title:\"Start When\",min:0,max:100,step:1,defaultValue:0,displayStepper:true,hidden:props=>props.animation!==\"videoinview\"},containerEnd:{type:ControlType.Number,title:\"End When\",min:0,max:100,step:1,defaultValue:100,displayStepper:true,hidden:props=>props.animation!==\"videoinview\"},// Video range\nvideoStart:{type:ControlType.Number,title:\"Video Start %\",min:0,max:100,step:1,defaultValue:0,hidden:props=>props.animation!==\"videoinview\"},videoEnd:{type:ControlType.Number,title:\"Video End %\",min:0,max:100,step:1,defaultValue:100,hidden:props=>props.animation!==\"videoinview\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\"],defaultValue:\"linear\"},// REMOVED: viewportTrigger and customPercentage (redundant)\nsections:{title:\"Sections\",type:ControlType.Array,propertyControl:{type:ControlType.Object,controls:{id:{type:ControlType.String,title:\"Section ID\",defaultValue:\"one\"},start:{type:ControlType.Number,title:\"Start %\",min:0,max:100,step:1,defaultValue:0},end:{type:ControlType.Number,title:\"End %\",min:0,max:100,step:1,defaultValue:100}}},defaultValue:[{id:\"one\",start:0,end:15},{id:\"two\",start:16,end:77}],hidden:props=>props.animation!==\"sectionsinview\"},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\",\"fill\",\"scale-down\",\"none\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\",\"Scale Down\",\"None\"],defaultValue:\"cover\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoScrubber\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scrub_video_pro.map","// Generated by Framer (e0ec254)\nexport default function metadata(params,activeLocale){return{description:\"Made with Framer\",robots:\"max-image-preview:large\",title:\"My Framer Site\"};}export const metadataVersion=1;\nexport const __FramerMetadata__ = {\"exports\":{\"metadataVersion\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"kTAI8H,SAAS,EAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,EAAE,CAAC,CACrK,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,WAAS,YAAU,iBAAiB,WAAS,CAAC,CAAC,GAAG,MAAM,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAe,UAEzL,iBAAe,EAAE,eAAa,IAC9B,aAAW,EAAE,WAAS,IAAI,SAAO,SAAS,QAAM,GAAK,MAAI,SAAS,EAAY,EAASA,EAAa,KAAK,CAAO,EAAYA,EAAa,KAAK,CAAO,EAAOA,EAAa,KAAK,CAAO,EAAaA,EAAa,KAAK,CAC9M,EAAoBA,EAAa,EAAE,CAAqB,EAAa,EAAE,CAAC,IAAM,EAAeA,EAAa,EAAE,CAAO,EAAmBA,EAAa,IAAI,IAAI,CAAO,EAAkBA,EAAa,KAAK,CAAO,EAAS,GAAU,OAAO,GAAW,SAAS,EAAS,IAAI,EACxQ,GAAU,EAAE,EAAE,IAAI,GAAG,EAAE,GAAG,EAChC,MAAoB,CAAC,EAAS,QAAQ,GAAS,CAAC,IAAM,EAAG,SAAS,eAAe,EAAQ,GAAG,CAAI,GAAI,EAAmB,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