{"version":3,"file":"Examples.C39FQUWP.mjs","names":["useStore","useState","useRef","useState"],"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/XHjySjipAfUZFSiGjpYw/O2RyYQkLxmVNoucB6J3H/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,jsxs as _jsxs}from\"react/jsx-runtime\";import{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\";const useStore=createStore({background:\"#0099FF\"});const TURNSTILE_SITEKEY=\"0x4AAAAAACHyjrvI714oJrGP\";function TurnstileWidget({onSuccess,onError,onExpire}){const widgetRef=useRef(null);const[scriptLoaded,setScriptLoaded]=useState(false);const callbackId=useRef({onSuccess,onError,onExpire});useEffect(()=>{callbackId.current={onSuccess,onError,onExpire};},[onSuccess,onError,onExpire]);useEffect(()=>{if(window.turnstile){setScriptLoaded(true);return;}const script=document.createElement(\"script\");script.src=\"https://challenges.cloudflare.com/turnstile/v0/api.js\";script.async=true;script.defer=true;script.onload=()=>setScriptLoaded(true);document.body.appendChild(script);return()=>{document.body.removeChild(script);};},[]);useEffect(()=>{if(!scriptLoaded||typeof window.turnstile===\"undefined\"||!widgetRef.current||widgetRef.current.hasChildNodes()){return;}const widgetId=window.turnstile.render(widgetRef.current,{sitekey:String(TURNSTILE_SITEKEY),callback:token=>callbackId.current.onSuccess&&callbackId.current.onSuccess(token),\"error-callback\":()=>callbackId.current.onError&&callbackId.current.onError(\"error\"),\"expired-callback\":()=>callbackId.current.onExpire&&callbackId.current.onExpire()});return()=>{if(window.turnstile&&widgetId){window.turnstile.remove(widgetId);}};},[scriptLoaded]);return /*#__PURE__*/_jsx(\"div\",{ref:widgetRef,className:\"cf-turnstile\",\"data-sitekey\":TURNSTILE_SITEKEY});}async function generateUserHash(identifier){const encoder=new TextEncoder;const data=encoder.encode(identifier.toLowerCase().trim());const hashBuffer=await crypto.subtle.digest(\"SHA-256\",data);const hashArray=Array.from(new Uint8Array(hashBuffer));return hashArray.map(b=>b.toString(16).padStart(2,\"0\")).join(\"\").slice(0,32);}export function customForm(Component){return props=>{const[verificationNeeded,setVerificationNeeded]=useState(true);const[verificationFailed,setVerificationFailed]=useState(false);const[turnstileToken,setTurnstileToken]=useState(\"\");const formContainerRef=useRef(null);const listenerAttached=useRef(false);const handleTurnstileSuccess=token=>{setVerificationNeeded(false);setVerificationFailed(false);setTurnstileToken(token);};const handleTurnstileError=()=>{setVerificationNeeded(true);setVerificationFailed(true);setTurnstileToken(\"\");};const handleTurnstileExpired=()=>{setVerificationNeeded(true);setVerificationFailed(true);setTurnstileToken(\"\");};useEffect(()=>{if(!formContainerRef.current||listenerAttached.current)return;const form=formContainerRef.current.querySelector(\"form\");if(!form)return;const handleSubmit=async()=>{const formData=new FormData(form);const email=formData.get(\"email\")||formData.get(\"Email\")||formData.get(\"EMAIL\")||formData.get(\"e-mail\");if(typeof window.umami!==\"undefined\"){try{if(email){const hash=await generateUserHash(email);window.umami.identify(hash);}window.umami.track(\"Submitted Form\");}catch(err){console.error(\"Failed to track:\",err);}}};form.addEventListener(\"submit\",handleSubmit);listenerAttached.current=true;return()=>{form.removeEventListener(\"submit\",handleSubmit);listenerAttached.current=false;};},[]);useEffect(()=>{if(listenerAttached.current)return;const interval=setInterval(()=>{if(!formContainerRef.current)return;const form=formContainerRef.current.querySelector(\"form\");if(form&&!listenerAttached.current){const handleSubmit=async()=>{const formData=new FormData(form);const email=formData.get(\"email\")||formData.get(\"Email\")||formData.get(\"EMAIL\")||formData.get(\"e-mail\");if(typeof window.umami!==\"undefined\"){try{if(email){const hash=await generateUserHash(email);window.umami.identify(hash);}window.umami.track(\"Submitted Form\");}catch(err){console.error(\"Failed to track:\",err);}}};form.addEventListener(\"submit\",handleSubmit);listenerAttached.current=true;clearInterval(interval);}},100);return()=>clearInterval(interval);},[]);const disableStyle=verificationFailed?{pointerEvents:\"none\",opacity:.5,userSelect:\"none\",filter:\"grayscale(60%) brightness(90%)\"}:{};return /*#__PURE__*/_jsxs(\"div\",{ref:formContainerRef,children:[/*#__PURE__*/_jsx(\"div\",{style:disableStyle,children:/*#__PURE__*/_jsx(Component,{...props,action:\"https://portal.ivesmd.com/api/webhook/lead\",turnstileToken:turnstileToken})}),(verificationNeeded||verificationFailed)&&/*#__PURE__*/_jsx(\"div\",{children:verificationFailed?/*#__PURE__*/_jsx(\"div\",{style:{marginBottom:\"16px\",textAlign:\"center\",fontSize:\"1rem\",color:\"#c00\",border:\"1px solid #ecc\",borderRadius:6,padding:\"10px 14px\",marginTop:\"16px\"},children:\"We couldn't verify you're a human and not a bot. Please try again using the question below the form.\"}):null}),/*#__PURE__*/_jsx(\"div\",{style:{textAlign:\"center\"},children:/*#__PURE__*/_jsx(TurnstileWidget,{onSuccess:handleTurnstileSuccess,onError:handleTurnstileError,onExpire:handleTurnstileExpired})})]});};}export function withVerticalOverlap(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,marginTop:\"-50px\"});};}export function withRotate(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,animate:{rotate:90},transition:{duration:2}});};}export function wrapId(Component){return props=>{return /*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"a\",{id:props.id,className:\"anchor\"}),/*#__PURE__*/_jsx(Component,{...props})]});};}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()});}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withVerticalOverlap\":{\"type\":\"reactHoc\",\"name\":\"withVerticalOverlap\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"wrapId\":{\"type\":\"reactHoc\",\"name\":\"wrapId\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"customForm\":{\"type\":\"reactHoc\",\"name\":\"customForm\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"8MAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,C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