{"version":3,"file":"Examples.DsrPl2cY.mjs","names":["useState","p","useRef"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/XG5eOGGUUXOZCb2nrU9D/UhJXODXbs9IOHdEYgev8/Examples.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{forwardRef,useEffect,useRef}from\"react\";import{useInView}from\"framer-motion\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{Children}from\"react\";// Learn more: https://www.framer.com/developers/overrides/\nconst useStore=createStore({background:\"#0099FF\"});export function useUrlLinkToSetIsActivePage(Component){return props=>{const p=props;if(window&&p.link&&p.isActivePage!=undefined&&p.link==window.location.pathname){p.isActivePage=true;}return /*#__PURE__*/_jsx(Component,{...props});};}export function withRotate(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{rotate:90},transition:{duration:2}});});}export function withHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:{scale:1.05}});});}export function animateWhenInview(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const isInView=useInView(ref,{once:true});useEffect(()=>{console.log(\"Element is in view: \",isInView);},[isInView]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});}const applyStyleToProps=(props,style)=>{const firstChild=Children.toArray(props.children)[0].props;const applyStyle=e=>{e.props.style={...e.props.style,...style};};if(firstChild.children?.forEach){firstChild.children.forEach(applyStyle);}else if(firstChild.children?.props){applyStyle(firstChild.children);}};export function useCleave(){if(window){setTimeout(()=>(function(){function applyCleaveToPhoneInputs(){document.querySelectorAll('input[type=\"tel\"]').forEach(input=>{if(!input.dataset.cleaveAttached){new Cleave(input,{phone:true,phoneRegionCode:\"US\"});input.dataset.cleaveAttached=\"true\";}});}function loadScript(src){return new Promise((resolve,reject)=>{if(document.querySelector(`script[src=\"${src}\"]`)){resolve()// Already loaded\n    ;return;}const script=document.createElement(\"script\");script.src=src;script.onload=()=>resolve();script.onerror=()=>reject(new Error(`Failed to load ${src}`));document.head.appendChild(script);});}const cleaveSrc=\"https://cdnjs.cloudflare.com/ajax/libs/cleave.js/1.6.0/cleave.min.js\";const addonSrc=\"https://cdnjs.cloudflare.com/ajax/libs/cleave.js/1.6.0/addons/cleave-phone.us.js\";// Check if Cleave is already loaded\n    if(typeof Cleave!==\"undefined\"){applyCleaveToPhoneInputs();}else{loadScript(addonSrc).then(()=>loadScript(cleaveSrc)).then(()=>{setTimeout(applyCleaveToPhoneInputs,1e3);}).catch(err=>{console.error(\"Cleave.js failed to load:\",err);});}})(),1e3);}}export function withDetectScrolledToBottom(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const hasFiredRef=useRef(false);useEffect(()=>{if(typeof window===\"undefined\")return;const handleScroll=()=>{if(hasFiredRef.current)return;const el=document.scrollingElement||document.documentElement;const isAtBottom=el.scrollTop+el.clientHeight>=el.scrollHeight-1;if(isAtBottom){hasFiredRef.current=true;console.log(\"Reached bottom of document\");// Emit to parent if inside iframe\nif(window.parent&&window.parent!==window){window.parent.postMessage({type:\"SCROLLED_TO_BOTTOM\",payload:{url:window.location.href}},\"*\"//\n);}}};window.addEventListener(\"scroll\",handleScroll,{passive:true});// Run once in case already at bottom\nhandleScroll();return()=>{window.removeEventListener(\"scroll\",handleScroll);};},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"useUrlLinkToSetIsActivePage\":{\"type\":\"reactHoc\",\"name\":\"useUrlLinkToSetIsActivePage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useCleave\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"animateWhenInview\":{\"type\":\"reactHoc\",\"name\":\"animateWhenInview\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDetectScrolledToBottom\":{\"type\":\"reactHoc\",\"name\":\"withDetectScrolledToBottom\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"wPAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,CAAC,CAClD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,MAAM,EAAE,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,EAAS,CAAC,EAChI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAW,EAAE,EAAW,OAAO,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,EAAS,CAAC,CAAC,EACjJ,EAAa,QAAQ,GAAQ,EAAO,EAAW,CAAC,EAChD,SAAS,GAAU,CACnB,GAAK,CAAC,EAAM,GAAUA,EAAS,EAAW,CAK1C,OAHA,OACA,EAAa,IAAI,EAAS,KAAW,EAAa,OAAO,EAAS,EAAG,EAAE,CAAC,CACrE,GAAgB,GAAG,IAAM,GAAgB,CAAO,CAAC,EAAU,MAAM,EAAa,EAC3E,CAAC,EAAM,EAAc,CAAG,OAAO,mBAfC,IAAwC,qBEC3B,SAAgB,EAA4B,EAAU,CAAC,MAAO,IAAO,CAAC,IAAMC,EAAE,EAA2G,OAAlG,GAAQA,EAAE,MAAMA,EAAE,cAAc,MAAWA,EAAE,MAAM,EAAO,SAAS,WAAU,EAAE,aAAa,IAA0B,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,EAE/B,SAAgB,EAA2B,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAYC,EAAO,GAA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