{"version":3,"file":"Examples.4K1Gam06.mjs","names":["useState","useRef","useCallback","useState","__esmMin","init_ssg_sandbox_shims","te","ne","_e","de","J","init_jsx_runtime","init_npm_react_18_3_1","ce","window","init_framer_BWFVvmND","useObserveData","Data","createStore","dataStore","state1","setDataStore","newState","storeState","storeSetters","setStoreState","setter","useStore","state","setState","init_createStore","init_store_js__1_0","centerContent","init_Utils","init_utils_js__0_9","withStrictEmailValidation","rootRef","setMergedRef","node","ref","root","form","emailInput","isValidEmailSyntax","email","value","local","domain","labels","label","tld","isAlphabeticTld","isPunycodeTld","applyValidity","onInput","onChange","onBlur","onSubmitCapture","event","Component","props","withCloseMobileMenuOnScroll","epoch","setEpoch","baselineYRef","isExpandedRef","isPhoneViewportRef","rafRef","resizeObserverRef","wasExpandedRef","mobileQuery","updateViewportMatch","readHeight","updateExpansionState","expandedNow","onScroll","init_Examples"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/28rXvpPsrum7FH6cMELS/1jCAazZw1EGHjrG5Nu5D/Utils.js","https:/framer.com/m/framer/utils.js@^0.9.0","https:/framerusercontent.com/modules/gOl3MRklfmcgMt1HhkSZ/i2zLeTemyECIDn0QQakO/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","export const centerContent = {\n    display: \"flex\",\n    justifyContent: \"center\",\n    alignItems: \"center\"\n};\nexport const autoSizingText = {\n    width: \"max-content\",\n    wordBreak: \"break-word\",\n    overflowWrap: \"break-word\",\n    overflow: \"hidden\",\n    whiteSpace: \"pre-wrap\",\n    flexShrink: 0\n};\nexport const defaultContainerStyles = {\n    ...centerContent,\n    overflow: \"hidden\"\n};\nexport const containerStyles = defaultContainerStyles;\nexport const randomColor = ()=>\"#\" + Math.floor(Math.random() * 16777215).toString(16)\n;\n\nexport const __FramerMetadata__ = {\"exports\":{\"centerContent\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"containerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"autoSizingText\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"defaultContainerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"randomColor\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}}}}\n//# sourceMappingURL=./Utils.map","/*\n * Utils (framer/utils@0.9.0)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/28rXvpPsrum7FH6cMELS/1jCAazZw1EGHjrG5Nu5D/Utils.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useRef,useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";// Learn more: https://www.framer.com/developers/overrides/\nconst useStore=createStore({background:\"#0099FF\"});export function withRotate(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,animate:{rotate:90},transition:{duration:2}});};}export function withHover(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,whileHover:{scale:1.05}});};}export function withRandomColor(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,animate:{background:store.background},onClick:()=>{setStore({background:randomColor()});}});};}export function withStrictEmailValidation(Component){return /*#__PURE__*/forwardRef(function WithStrictEmailValidation(props,ref){const rootRef=useRef(null);const message=\"Please enter a valid email address, such as name@example.com.\";const setMergedRef=useCallback(node=>{rootRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref){ref.current=node;}},[ref]);useEffect(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return;const root=rootRef.current;if(!root)return;const form=root instanceof HTMLFormElement?root:root.querySelector(\"form\")??root.closest(\"form\");if(!form)return;const emailInput=form.querySelector('input[type=\"email\"][name=\"Email\"]');if(!emailInput)return;const isValidEmailSyntax=value=>{const email=value.trim();if(!email||email.length>254||/\\s/.test(email))return false;if((email.match(/@/g)||[]).length!==1)return false;if(email.includes(\"..\"))return false;const[local,domain]=email.split(\"@\");if(!local||!domain)return false;if(local.length>64)return false;if(local.startsWith(\".\")||local.endsWith(\".\"))return false;if(!domain.includes(\".\"))return false;if(domain.startsWith(\".\")||domain.endsWith(\".\"))return false;const labels=domain.split(\".\");if(labels.some(label=>label.length===0))return false;for(const label of labels){if(label.length>63)return false;if(!/^[a-z0-9-]+$/i.test(label))return false;if(label.startsWith(\"-\")||label.endsWith(\"-\"))return false;}const tld=labels[labels.length-1];const isAlphabeticTld=/^[a-z]{2,63}$/i.test(tld);const isPunycodeTld=/^xn--[a-z0-9-]{2,59}$/i.test(tld);return isAlphabeticTld||isPunycodeTld;};const applyValidity=()=>{if(emailInput.value.length===0){emailInput.setCustomValidity(\"\");return;}emailInput.setCustomValidity(isValidEmailSyntax(emailInput.value)?\"\":message);};const onInput=()=>applyValidity();const onChange=()=>applyValidity();const onBlur=()=>applyValidity();const onSubmitCapture=event=>{applyValidity();if(!emailInput.checkValidity()){event.preventDefault();event.stopImmediatePropagation();emailInput.reportValidity();emailInput.focus();}};emailInput.addEventListener(\"input\",onInput);emailInput.addEventListener(\"change\",onChange);emailInput.addEventListener(\"blur\",onBlur);form.addEventListener(\"submit\",onSubmitCapture,true);return()=>{emailInput.removeEventListener(\"input\",onInput);emailInput.removeEventListener(\"change\",onChange);emailInput.removeEventListener(\"blur\",onBlur);form.removeEventListener(\"submit\",onSubmitCapture,true);};},[]);return /*#__PURE__*/_jsx(Component,{ref:setMergedRef,...props});});}export function withCloseMobileMenuOnScroll(Component){return /*#__PURE__*/forwardRef(function WithCloseMobileMenuOnScroll(props,ref){const[epoch,setEpoch]=useState(0);const rootRef=useRef(null);const baselineYRef=useRef(0);const isExpandedRef=useRef(false);const isPhoneViewportRef=useRef(false);const rafRef=useRef(null);const resizeObserverRef=useRef(null);const wasExpandedRef=useRef(false);const setMergedRef=useCallback(node=>{rootRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref){ref.current=node;}},[ref]);useEffect(()=>{if(typeof window===\"undefined\")return;const node=rootRef.current;if(!node)return;const mobileQuery=window.matchMedia(\"(max-width: 809px)\");const updateViewportMatch=()=>{isPhoneViewportRef.current=mobileQuery.matches;};updateViewportMatch();const readHeight=()=>node.getBoundingClientRect().height;const updateExpansionState=()=>{const expandedNow=readHeight()>100;if(expandedNow&&!wasExpandedRef.current){baselineYRef.current=window.scrollY;}wasExpandedRef.current=expandedNow;isExpandedRef.current=expandedNow;};updateExpansionState();const onScroll=()=>{if(rafRef.current!==null)return;rafRef.current=window.requestAnimationFrame(()=>{rafRef.current=null;if(!isPhoneViewportRef.current)return;if(!isExpandedRef.current)return;const displacement=Math.abs(window.scrollY-baselineYRef.current);if(displacement>12){baselineYRef.current=window.scrollY;wasExpandedRef.current=false;isExpandedRef.current=false;startTransition(()=>{setEpoch(value=>value+1);});}});};window.addEventListener(\"scroll\",onScroll,{passive:true});if(mobileQuery.addEventListener){mobileQuery.addEventListener(\"change\",updateViewportMatch);}else{mobileQuery.addListener(updateViewportMatch);}if(typeof ResizeObserver!==\"undefined\"){resizeObserverRef.current=new ResizeObserver(()=>{updateExpansionState();});resizeObserverRef.current.observe(node);}return()=>{window.removeEventListener(\"scroll\",onScroll);if(rafRef.current!==null){window.cancelAnimationFrame(rafRef.current);rafRef.current=null;}if(mobileQuery.addEventListener){mobileQuery.removeEventListener(\"change\",updateViewportMatch);}else{mobileQuery.removeListener(updateViewportMatch);}resizeObserverRef.current?.disconnect();resizeObserverRef.current=null;};},[epoch]);return /*#__PURE__*/_jsx(Component,{ref:setMergedRef,...props},epoch);});}\nexport const __FramerMetadata__ = {\"exports\":{\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCloseMobileMenuOnScroll\":{\"type\":\"reactHoc\",\"name\":\"withCloseMobileMenuOnScroll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withStrictEmailValidation\":{\"type\":\"reactHoc\",\"name\":\"withStrictEmailValidation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"A,uNAA8E,SAAgBkB,EAAY,EAAO,CACjH,IAAMC,EAAUF,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAGG,CAAM,CAAC,CAAC,CAAC,EACjDC,EAAa,GAAU,CAC1B,OAAOC,GAAW,aAAY,EAASA,EAASH,EAAU,KAAK,GAAG,EAAU,MAAM,OAAO,OAAO,CAAC,GAAGA,EAAU,MAAM,GAAGG,CAAQ,CAAC,CAAE,EACjIC,EAAW,OAAOH,GAAS,SAAS,OAAO,OAAO,CAAC,GAAGA,CAAM,CAAC,EAAEA,EAC7DI,kBAAa,IAAI,IACjBC,EAAc,GAAU,CAC3B,OAAOH,GAAW,aAAY,EAASA,EAASC,CAAU,GAAG,EAAW,OAAOD,GAAW,SAAS,OAAO,OAAO,CAAC,GAAGC,EAAW,GAAGD,CAAQ,CAAC,EAAEA,EACjJE,EAAa,QAAQ,GAAQE,EAAOH,CAAU,CAAC,CAAE,EACjD,SAASI,GAAU,CACnB,GAAK,CAACC,EAAMC,GAAU7B,EAASuB,CAAU,EAKzC,OAHAV,OACAW,EAAa,IAAIK,CAAQ,MAAYL,EAAa,OAAOK,CAAQ,GAAI,CAAC,CAAC,EACpEb,EAAe,IAAI,IAAMA,EAAe,EAAQ,CAACG,EAAU,MAAME,CAAY,GAC1E,CAACO,EAAMH,CAAa,CAAG,CAAC,OAAOE,CAAS,C,wHEfjC,EAAgB,CACzB,QAAS,OACT,eAAgB,SAChB,WAAY,QAChB,EAWI,CADA,GAAGK,CACO,C,+CEd6hB,SAAgBG,EAA0B,EAAU,CAAC,MAAoB,gBAAW,SAAmC,EAAM,EAAI,CAAC,IAAMC,EAAQnC,EAAO,IAAI,EAA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