{"version":3,"file":"CarouselControls.lIOtyGyG.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/lJHiHW2QtrRCerUCWgu6/Gstv6mLm3x3DWYwzftRf/CarouselControls.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{Children,cloneElement,forwardRef,isValidElement,startTransition,useEffect,useMemo,useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const store=createStore({container:null});function getMetrics(container){const firstCard=container.firstElementChild;if(!firstCard)return null;let gap=0;if(typeof window!==\"undefined\"){const containerStyle=window.getComputedStyle(container);gap=parseFloat(containerStyle.gap)||0;}const cardWidth=firstCard.offsetWidth;const scrollAmount=cardWidth+gap;const totalCards=container.children.length;const currentIndex=scrollAmount>0?Math.round(container.scrollLeft/scrollAmount):0;return{scrollAmount,totalCards,currentIndex};}function scrollList(direction){const container=store.container;if(!container)return;const metrics=getMetrics(container);if(!metrics)return;if(direction===\"next\"){container.scrollBy({left:metrics.scrollAmount,behavior:\"smooth\"});}else{container.scrollBy({left:-metrics.scrollAmount,behavior:\"smooth\"});}}export function withScrollContainer(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                    .hidden-scrollbar::-webkit-scrollbar {\n                        display: none;\n                    }\n                `}),/*#__PURE__*/_jsx(Component,{...props,className:`${props.className||\"\"} hidden-scrollbar`,style:{...props.style,scrollbarWidth:\"none\",msOverflowStyle:\"none\"},ref:node=>{store.container=node;if(typeof ref===\"function\")ref(node);else if(ref&&typeof ref===\"object\")ref.current=node;}})]});});}export function withScrollNext(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:event=>{props.onClick?.(event);scrollList(\"next\");}});});}export function withScrollPrev(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:event=>{props.onClick?.(event);scrollList(\"prev\");}});});}export function withScrollBullets(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[activeIndex,setActiveIndex]=useState(0);const[itemCount,setItemCount]=useState(0);useEffect(()=>{const container=store.container;if(!container)return;const updateFromScroll=()=>{const metrics=getMetrics(container);if(!metrics)return;startTransition(()=>{setActiveIndex(Math.max(0,Math.min(metrics.currentIndex,metrics.totalCards-1)));setItemCount(metrics.totalCards);});};updateFromScroll();container.addEventListener(\"scroll\",updateFromScroll,{passive:true});if(typeof window!==\"undefined\"){window.addEventListener(\"resize\",updateFromScroll);}return()=>{container.removeEventListener(\"scroll\",updateFromScroll);if(typeof window!==\"undefined\"){window.removeEventListener(\"resize\",updateFromScroll);}};},[]);const childrenArray=Children.toArray(props.children);const styledChildren=useMemo(()=>{const total=childrenArray.length||itemCount;return childrenArray.map((child,index)=>{if(!/*#__PURE__*/isValidElement(child))return child;const isActive=index===activeIndex;return /*#__PURE__*/cloneElement(child,{style:{...child.props?.style,opacity:isActive?1:.35,transform:isActive?\"scale(1.15)\":\"scale(1)\",transition:\"opacity 0.2s ease, transform 0.2s ease\"},\"aria-current\":isActive?\"true\":undefined,\"aria-label\":`Slide ${index+1} of ${Math.max(total,1)}`});});},[activeIndex,childrenArray,itemCount]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,role:\"tablist\",\"aria-label\":\"Carousel pagination\",children:styledChildren});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withScrollPrev\":{\"type\":\"reactHoc\",\"name\":\"withScrollPrev\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollContainer\":{\"type\":\"reactHoc\",\"name\":\"withScrollContainer\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollBullets\":{\"type\":\"reactHoc\",\"name\":\"withScrollBullets\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollNext\":{\"type\":\"reactHoc\",\"name\":\"withScrollNext\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable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