{"version":3,"file":"ImageFlowMarquee.CdOOZCXW.mjs","names":["useState","useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/YiqSxzKF1diLkIJg21TJ/Kza39VrcbvjzTPe1f9SX/ImageFlowMarquee.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,useMemo}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useAnimationFrame}from\"framer-motion\";/**\n * @framerIntrinsicWidth 800\n * @framerIntrinsicHeight 500\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ImageFlowMarquee(props){const{cards=[{image:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Fashion 1\"}},{image:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Fashion 2\"}},{image:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Fashion 3\"}}],speed=1.5,gap=20,backgroundColor=\"#000000\",direction=\"left\",cardRadius=12}=props;const isStatic=useIsStaticRenderer();const[offset,setOffset]=useState(0);const setRef=useRef(null);const[singleSetWidth,setSingleSetWidth]=useState(0);// Normalize cards safely\nconst normalizedCards=useMemo(()=>{if(!cards||cards.length===0)return[];return cards.map(card=>({...card,image:card.image||{src:\"\",alt:\"\"}}));},[cards]);// Measure the width of one unique sequence set dynamically (accounting for aspect ratios)\nuseEffect(()=>{if(!setRef.current)return;const observer=new ResizeObserver(entries=>{for(const entry of entries){setSingleSetWidth(entry.contentRect.width);}});observer.observe(setRef.current);return()=>observer.disconnect();},[normalizedCards,gap]);// Total looping threshold includes the flex gap separating the sets\nconst loopWidth=useMemo(()=>{return singleSetWidth+gap;},[singleSetWidth,gap]);// Animation Loop\nuseAnimationFrame((time,delta)=>{if(isStatic||loopWidth===0)return;setOffset(prev=>{const step=speed*(delta/16);let newOffset=direction===\"left\"?prev+step:prev-step;if(direction===\"left\"){if(newOffset>=loopWidth)newOffset-=loopWidth;}else{if(newOffset<=0)newOffset+=loopWidth;}return newOffset;});});// Modular card column loop\nconst renderCardSet=(isMasterSet=false)=>/*#__PURE__*/_jsx(\"div\",{ref:isMasterSet?setRef:null,style:{display:\"flex\",gap:gap,height:\"100%\",flexShrink:0},children:normalizedCards.map((card,index)=>/*#__PURE__*/_jsx(\"div\",{style:{height:\"100%\",flexShrink:0,borderRadius:cardRadius,overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"img\",{src:card.image.src,alt:card.image.alt||`Marquee dynamic image ${index}`,style:{height:\"100%\",width:\"auto\",objectFit:\"cover\",display:\"block\"}})},index))});// Static Canvas Preview\nif(isStatic||normalizedCards.length===0){return /*#__PURE__*/_jsx(\"div\",{style:{...containerStyle,backgroundColor},children:renderCardSet()});}return /*#__PURE__*/_jsx(\"div\",{style:{...containerStyle,backgroundColor},children:/*#__PURE__*/_jsxs(motion.div,{style:{display:\"flex\",gap:gap,height:\"100%\",x:-offset},children:[renderCardSet(true),renderCardSet(),renderCardSet(),renderCardSet()]})});}// -- Layout Container Styling --\nconst containerStyle={width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",overflow:\"hidden\",position:\"relative\"};// -- Property Controls Configuration --\naddPropertyControls(ImageFlowMarquee,{cards:{type:ControlType.Array,title:\"Cards\",control:{type:ControlType.Object,controls:{image:{type:ControlType.ResponsiveImage,title:\"Image\"}}},defaultValue:[{image:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\"}},{image:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\"}},{image:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\"}}]},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\"},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:1.5,min:0,max:10,step:.1},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:20,min:0,max:100},cardRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:12,min:0,max:200},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageFlowMarquee\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"500\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"800\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageFlowMarquee.map"],"mappings":"sQAKG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,CAAC,MAAM,CAAC,IAAI,sEAAsE,IAAI,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,oEAAoE,IAAI,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,uEAAuE,IAAI,WAAW,CAAC,CAAC,EAAE,QAAM,IAAI,MAAI,GAAG,kBAAgB,UAAU,YAAU,OAAO,aAAW,IAAI,EAAY,EAAS,EAAoB,EAAO,CAAC,EAAO,GAAWA,EAAS,CAAC,EAAQ,EAAOC,EAAO,IAAI,EAAO,CAAC,EAAe,GAAmBD,EAAS,CAAC,EAC5kB,EAAgBE,MAAgB,CAAC,GAAO,EAAM,SAAS,EAAQ,CAAC,EAAS,EAAM,IAAI,IAAO,CAAC,GAAG,EAAK,MAAM,EAAK,OAAO,CAAC,IAAI,GAAG,IAAI,EAAE,CAAC,EAAE,EAAI,CAAC,CAAK,CAAC,EACvJ,MAAc,CAAC,GAAG,CAAC,EAAO,QAAQ,OAAO,IAAM,EAAS,IAAI,eAAe,GAAS,CAAC,IAAI,IAAM,KAAS,EAAS,EAAkB,EAAM,YAAY,KAAK,CAAG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