{"version":3,"file":"ProjectsSliderOverrides.BDLqZORu.mjs","names":["useState","Children"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/2XeGboxCamvmQtZsFZsx/BaTT3gl3p8rH8TdxqHmv/ProjectsSliderOverrides.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}from\"react/jsx-runtime\";import{Children,cloneElement,forwardRef,isValidElement,useEffect}from\"react\";// @ts-expect-error Framer resolves this runtime module when previewing and publishing.\nimport{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const useProjects=createStore({index:0,count:3,direction:1});export function withPreviousProject(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[state,setState]=useProjects();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,\"aria-label\":\"Previous project\",onClick:event=>{if(typeof props.onClick===\"function\")props.onClick(event);const count=Math.max(1,state.count);setState({direction:-1,index:(state.index-1+count)%count});}});});}export function withNextProject(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[state,setState]=useProjects();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,\"aria-label\":\"Next project\",onClick:event=>{if(typeof props.onClick===\"function\")props.onClick(event);const count=Math.max(1,state.count);setState({direction:1,index:(state.index+1)%count});}});});}export function withProjectSwitcher(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[state,setState]=useProjects();const count=Math.max(1,Children.count(props.children));const activeIndex=Math.min(state.index,count-1);useEffect(()=>{if(state.count!==count||state.index!==activeIndex){setState({count,index:activeIndex});}},[activeIndex,count,setState,state.count,state.index]);const children=Children.map(props.children,(child,index)=>{if(!/*#__PURE__*/isValidElement(child))return child;const element=child;const isActive=index===activeIndex;const offset=isActive?0:36*state.direction;return /*#__PURE__*/cloneElement(element,{\"aria-hidden\":!isActive,animate:{...element.props.animate||{},opacity:isActive?1:0,x:offset},initial:false,style:{...element.props.style||{},position:index===0?\"relative\":\"absolute\",inset:index===0?undefined:0,width:\"100%\",pointerEvents:isActive?\"auto\":\"none\",visibility:isActive?\"visible\":\"hidden\"},transition:{duration:.45,ease:[.22,1,.36,1]}});});return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:{...props.style,position:\"relative\",overflow:\"hidden\"},children:children});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withProjectSwitcher\":{\"type\":\"reactHoc\",\"name\":\"withProjectSwitcher\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPreviousProject\":{\"type\":\"reactHoc\",\"name\":\"withPreviousProject\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withNextProject\":{\"type\":\"reactHoc\",\"name\":\"withNextProject\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProjectsSliderOverrides.map"],"mappings":"8MAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,CAAC,CAAC,EACjD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,KAAK,GAAG,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,CAAQ,CAAC,CAAE,EACjI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,EAAE,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,CAAU,GAAG,EAAW,OAAO,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,CAAQ,CAAC,EAAE,EACjJ,EAAa,QAAQ,GAAQ,EAAO,CAAU,CAAC,CAAE,EACjD,SAAS,GAAU,CACnB,GAAK,CAAC,EAAM,GAAUA,EAAS,CAAU,EAKzC,OAHA,OACA,EAAa,IAAI,CAAQ,MAAY,EAAa,OAAO,CAAQ,GAAI,CAAC,CAAC,EACpE,EAAe,IAAI,IAAM,EAAe,EAAQ,CAAC,EAAU,MAAM,CAAY,GAC1E,CAAC,EAAM,CAAa,CAAG,CAAC,OAAO,CAAS,iBAfT,IAAwC,sBECqD,SAAgB,EAA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