{"version":3,"file":"withInfiniteCarousel.DB8b71s1.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/cR85Kf2MVyOO89VctEDZ/LZjfZAwKTOKmY0RW3fVJ/withInfiniteCarousel.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";/**\n * Seamless looping for \"Testimonial Carousel\".\n *\n * The track carries a clone of card 4 before the first card and a clone of\n * card 1 after the last one. Going forward past slide 4 slides into the tail\n * clone, then snaps instantly back to the real slide 1. The two frames are\n * identical, so the snap is invisible and the motion reads as continuous.\n * Going backward past slide 1 does the same through the head clone.\n *\n * The snap has to fire the moment the slide animation ends, and Framer has no\n * animation-complete or delay trigger, which is why this cannot be done on the\n * canvas alone.\n *\n * The component carries a full set of slide states per breakpoint, named\n * \"Slide 1\", \"Tablet / Slide 1\", \"Mobile / Slide 1\" and so on. This picks the\n * right set from the viewport width, so the interaction is identical at every\n * size and only the layout changes.\n *\n * Apply to a Testimonial Carousel instance: select it, open Code Overrides in\n * the properties panel, pick this file and choose withInfiniteCarousel.\n */// The real slides, in order.\nconst SLIDES=[\"Slide 1\",\"Slide 2\",\"Slide 3\",\"Slide 4\"];// Variants that exist only to make the wrap seamless.\nconst TAIL=\"Tail clone\";const HEAD=\"Head clone\";const SNAP_FIRST=\"Slide 1 snap\";const SNAP_LAST=\"Slide 4 snap\";// Variant name prefixes per breakpoint. Desktop variants carry no prefix.\nconst TABLET_BELOW=1200;const MOBILE_BELOW=810;// Must match the Slides layer's transition duration inside the component,\n// which is 0.7s on every breakpoint. Raise both together if you slow it down.\nconst SLIDE_MS=700;export function withInfiniteCarousel(Component){return function InfiniteCarousel(props){const[index,setIndex]=useState(0);const[state,setState]=useState(SLIDES[0]);const[prefix,setPrefix]=useState(\"\");const timer=useRef(undefined);const wrapping=useRef(false);useEffect(()=>{function measure(){const w=window.innerWidth;setPrefix(w<MOBILE_BELOW?\"Mobile / \":w<TABLET_BELOW?\"Tablet / \":\"\");}measure();window.addEventListener(\"resize\",measure);return()=>{window.removeEventListener(\"resize\",measure);if(timer.current!==undefined)window.clearTimeout(timer.current);};},[]);function go(step){// Ignore clicks while a wrap is mid-flight, otherwise the snap\n// lands on the wrong slide.\nif(wrapping.current)return;const target=index+step;if(target>=0&&target<SLIDES.length){setIndex(target);setState(SLIDES[target]);return;}const forward=step>0;wrapping.current=true;setState(forward?TAIL:HEAD);timer.current=window.setTimeout(()=>{const landing=forward?0:SLIDES.length-1;setIndex(landing);setState(forward?SNAP_FIRST:SNAP_LAST);wrapping.current=false;},SLIDE_MS);}return /*#__PURE__*/_jsx(Component,{...props,variant:prefix+state,onNext:()=>go(1),onPrevious:()=>go(-1)});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withInfiniteCarousel\":{\"type\":\"reactHoc\",\"name\":\"withInfiniteCarousel\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./withInfiniteCarousel.map"],"mappings":"yIAyBmB,SAAgB,EAAqB,EAAU,CAAC,OAAO,SAA0B,EAAM,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,CAAC,EAAO,CAAC,EAAM,GAAUA,EAAS,EAAO,EAAE,EAAO,CAAC,EAAO,GAAWA,EAAS,EAAE,EAAQ,EAAMC,EAAO,IAAA,EAAS,EAAQ,EAASA,EAAO,EAAK,EAAE,MAAc,CAAC,SAAS,GAAS,CAAC,IAAM,EAAE,EAAO,WAAW,EAAU,EAAE,EAAa,YAAY,EAAE,EAAa,YAAY,EAAE,CAAE,CAAqD,OAApD,EAAQ,EAAE,EAAO,iBAAiB,SAAS,CAAO,MAAY,CAAC,EAAO,oBAAoB,SAAS,CAAO,EAAK,EAAM,UAAU,IAAA,IAAU,EAAO,aAAa,EAAM,OAAO,CAAE,CAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAG,EAAK,CAE7lB,GAAG,EAAS,QAAQ,OAAO,IAAM,EAAO,EA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