{"version":3,"file":"ToltHubspot.RO1L5tym.mjs","names":["__esmMin","init_npm_react_18_3_1","window","init_ssg_sandbox_shims","init_jsx_runtime","J","c","init_store_js__1_0","createStore","init_utils_js__0_9","shouldSignUp","td","resolveIdentifier","explicit","signUpVisitor","identifier","err","status","msg","withToltSignup","originalOnClick","props","onClick","result","event","Component","init_ToltHubspot"],"sources":["https:/framerusercontent.com/modules/zKCWt4H7a6VgMEQZ8gK6/rNFpUjHSbdQnxmVPHfKv/ToltHubspot.js"],"sourcesContent":["// overrides.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}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\"});// --- tolt helpers (per docs) ---\nfunction shouldSignUp(){// Only sign up if visitor came via affiliate and is not already signed up\nconst td=window.tolt_data;return Boolean(td)&&!td?.customer_id;}function resolveIdentifier(explicit){const trimmed=explicit?.trim();if(trimmed)return trimmed;// Try to read an email input commonly present on landing pages\nconst emailInput=document.querySelector('input[name=\"email\"]')||document.querySelector('input[type=\"email\"]');const email=emailInput?.value?.trim();if(email)return email;// Fallback to generated ID so the click still produces a unique identifier\nif(window.crypto?.randomUUID){return`anon-${window.crypto.randomUUID()}`;}return`anon-${Date.now()}`;}async function signUpVisitor(identifier){if(!shouldSignUp())return;// Check if tolt is available\nif(!window.tolt?.signup){console.warn(\"[tolt] tolt.signup not available\");return;}try{await window.tolt.signup(identifier);// On success, window.tolt_data.customer_id is auto-updated\n}catch(err){// Swallow duplicates (409 \"Customer already exists\")\nconst status=err?.status;const msg=err?.message||\"\";if(status===409||msg.includes(\"Customer already exists\"))return;console.warn(\"[tolt] signup failed\",err);}}// --- Reusable HOC: attach tolt signup on click, preserving original onClick ---\nexport function withToltSignup(Component,identifier){return /*#__PURE__*/forwardRef((props,ref)=>{const originalOnClick=props.onClick;const onClick=async event=>{try{// First run tolt signup (keeps signup close to the click)\nconst id=resolveIdentifier(identifier);await signUpVisitor(id);}catch(err){console.warn(\"[tolt] signup error:\",err);}// Then run the original click behavior if present\nif(typeof originalOnClick===\"function\"){try{const result=originalOnClick(event);if(result instanceof Promise){await result;}}catch(err){console.error(\"[onClick] error:\",err);}}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:onClick});});}// --- Your original overrides ---\nexport 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}});});}// Compose random color + tolt signup so one click does both\nexport function withRandomColor(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();// Combine both behaviors in one onClick\nconst onClick=async event=>{// 1. Change background color\nsetStore({background:randomColor()});// 2. Handle tolt signup\ntry{const id=resolveIdentifier();await signUpVisitor(id);}catch(err){console.warn(\"[tolt] signup error:\",err);}// 3. Call original onClick if exists\nif(typeof props.onClick===\"function\"){try{const result=props.onClick(event);if(result instanceof Promise){await result;}}catch(err){console.error(\"[onClick] error:\",err);}}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{background:store.background},onClick:onClick});});}// --- Optional: If you want a standalone export to use without randomColor ---\nexport function withToltOnly(Component,identifier){return withToltSignup(Component,identifier);}\nexport const __FramerMetadata__ = {\"exports\":{\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withToltSignup\":{\"type\":\"reactHoc\",\"name\":\"withToltSignup\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"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