{"version":3,"file":"Carousel.BobbGjMo.mjs","names":["useRef","useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/Gq4WxJhNwkZTnoZs0TxA/lwKnRtAg2vxlYqqHBlVL/Carousel.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useMotionValue,motion,AnimatePresence,useAnimation}from\"framer\";import{useRef,useState,useEffect}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight fixed\n */export default function FluidCarousel(props){const{images=[],gap=24,dragElasticity=.8,backgroundColor=\"#FFFFFF\",style}=props;const containerRef=useRef(null);const[containerWidth,setContainerWidth]=useState(0);const[isDragging,setIsDragging]=useState(false);const[isHovering,setIsHovering]=useState(false);const[selectedImage,setSelectedImage]=useState(null);const mouseDownTime=useRef(0);const mouseDownPosition=useRef({x:0,y:0});// Track scroll position\nconst x=useMotionValue(0);const controls=useAnimation();// Calculate total content width\nconst contentWidth=images.reduce((total,img)=>{return total+containerWidth*img.width+gap;},0)-gap// Subtract last gap\n;// Calculate drag constraints\nconst maxDrag=0;const minDrag=Math.min(0,-(contentWidth-containerWidth));// Update container width on resize\nuseEffect(()=>{if(containerRef.current){const updateWidth=()=>{setContainerWidth(containerRef.current?.offsetWidth||0);};updateWidth();// Handle wheel events\nconst handleWheel=event=>{if(!isHovering)return;event.preventDefault();event.stopPropagation();// Simple, direct scrolling\nconst scrollMultiplier=3;const newPosition=x.get()-(event.deltaY+event.deltaX)*scrollMultiplier;// Clamp to bounds\nconst clampedPosition=Math.max(minDrag,Math.min(maxDrag,newPosition));x.set(clampedPosition);};const element=containerRef.current;element.addEventListener(\"wheel\",handleWheel,{passive:false});window.addEventListener(\"resize\",updateWidth);return()=>{element.removeEventListener(\"wheel\",handleWheel);window.removeEventListener(\"resize\",updateWidth);};}},[maxDrag,minDrag,controls,x,isHovering]);// Handle drag gestures\nconst handleDragStart=()=>{setIsDragging(true);controls.stop();};const handleDragEnd=(event,info)=>{setIsDragging(false);const velocity=info.velocity.x;const currentX=x.get();// Apply momentum scrolling\nif(Math.abs(velocity)>100){const projection=currentX+velocity*.2;const clampedProjection=Math.max(minDrag,Math.min(maxDrag,projection));controls.start({x:clampedProjection,transition:{type:\"spring\",velocity:velocity/1e3,stiffness:120,damping:20}});}};return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(AnimatePresence,{children:selectedImage&&/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},style:{position:\"fixed\",top:0,left:0,right:0,bottom:0,backgroundColor:\"rgba(0, 0, 0, 0.9)\",zIndex:1e3,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\"},onClick:()=>setSelectedImage(null),children:/*#__PURE__*/_jsx(motion.img,{src:selectedImage.src,alt:selectedImage.alt||\"\",initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{type:\"spring\",damping:25,stiffness:120},style:{maxWidth:\"90vw\",maxHeight:\"90vh\",objectFit:\"contain\",cursor:\"pointer\"},onClick:e=>{e.stopPropagation();setSelectedImage(null);}})})}),/*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,backgroundColor,overflow:\"hidden\",userSelect:\"none\",touchAction:\"pan-y\",position:\"relative\",height:style?.height||\"100%\",minHeight:\"100px\"},onMouseEnter:()=>setIsHovering(true),onMouseLeave:()=>setIsHovering(false),children:/*#__PURE__*/_jsx(motion.div,{style:{display:\"flex\",gap:`${gap}px`,x,cursor:isDragging?\"grabbing\":\"grab\",height:\"100%\"},drag:\"x\",dragElastic:dragElasticity,dragConstraints:{left:minDrag,right:maxDrag},onDragStart:handleDragStart,onDragEnd:handleDragEnd,animate:controls,children:images.map((image,index)=>/*#__PURE__*/_jsx(motion.div,{style:{width:`${image.width*100}%`,flexShrink:0,position:\"relative\",height:\"100%\"},whileHover:{boxShadow:\"0px 4px 12px rgba(0, 0, 0, 0.08)\"},initial:{boxShadow:\"0px 0px 0px rgba(0, 0, 0, 0)\"},transition:{duration:.2},onMouseDown:e=>{mouseDownTime.current=Date.now();mouseDownPosition.current={x:e.clientX,y:e.clientY};},onClick:e=>{const clickDuration=Date.now()-mouseDownTime.current;// Calculate distance moved\n    const deltaX=Math.abs(e.clientX-mouseDownPosition.current.x);const deltaY=Math.abs(e.clientY-mouseDownPosition.current.y);const distance=Math.sqrt(deltaX*deltaX+deltaY*deltaY);// Only trigger if it was both quick and minimal movement\n    if(clickDuration<150&&distance<5){setSelectedImage(image);}},children:/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||`Image ${index+1}`,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",borderRadius:\"0px\",display:\"block\",cursor:\"pointer\",userSelect:\"none\",WebkitUserDrag:\"none\"},draggable:false})},`${image.src}-${index}`))})})]});}addPropertyControls(FluidCarousel,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.Object,controls:{src:{type:ControlType.Image,title:\"Image\"},width:{type:ControlType.Number,title:\"Relative Width\",defaultValue:.8,min:.2,max:1,step:.1},alt:{type:ControlType.String,title:\"Alt Text\",optional:true}}},defaultValue:[{src:\"\",width:.8},{src:\"\",width:.6},{src:\"\",width:.8}]},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:24,min:0,max:100,step:1},dragElasticity:{type:ControlType.Number,title:\"Drag Elasticity\",defaultValue:.8,min:0,max:1,step:.1},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#FFFFFF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FluidCarousel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Carousel.map"],"mappings":"kbAGG,SAAwB,EAAc,EA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