{"version":3,"file":"Text.DROBFJ2S.mjs","names":["node","data"],"sources":["https:/framerusercontent.com/modules/Y13YoEj318OILTZWv99m/dqJqAVplbYaEp83Xt8bS/Text.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,forwardRef}from\"react\";// Get personalization data with better error handling\nfunction getPersonalizationData(){try{// Check global first (for immediate updates)\nif(window.framerPersonalization){return window.framerPersonalization;}// Check localStorage as fallback\nconst stored=localStorage.getItem(\"framer_personalization\");if(stored){const parsed=JSON.parse(stored);// Validate the data structure\nif(parsed&&typeof parsed.userName===\"string\"){return parsed;}}}catch(e){console.log(\"No valid personalization data found\");}return{userName:\"\",mood:\"creative\",theme:\"vibrant\",isPersonalized:false};}// 🔥 IMPROVED SOLUTION - Only hides {name} placeholder, not entire text\nexport const withAutoPersonalization=Component=>{return /*#__PURE__*/forwardRef((props,ref)=>{useEffect(()=>{console.log(\"🚀 Enhanced auto-personalization started\");// Function to replace {name} with invisible placeholder initially\nconst setupNamePlaceholders=()=>{const walker=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:node=>{if(node.textContent&&node.textContent.includes(\"{name}\")){return NodeFilter.FILTER_ACCEPT;}return NodeFilter.FILTER_REJECT;}});const textNodes=[];let node;while(node=walker.nextNode()){textNodes.push(node);}// Replace {name} with invisible spans\ntextNodes.forEach(textNode=>{const parent=textNode.parentNode;if(!parent)return;const originalText=textNode.textContent||\"\";// Split text around {name} placeholders\nconst parts=originalText.split(/{name}/gi);if(parts.length>1){// Create document fragment to replace the text node\nconst fragment=document.createDocumentFragment();parts.forEach((part,index)=>{// Add the text part\nif(part){fragment.appendChild(document.createTextNode(part));}// Add invisible placeholder span (except after last part)\nif(index<parts.length-1){const placeholder=document.createElement(\"span\");placeholder.className=\"framer-name-placeholder\";placeholder.style.opacity=\"0\";placeholder.style.transition=\"opacity 0.3s ease-in-out\";placeholder.textContent=\"{name}\"// Keep as fallback\n;fragment.appendChild(placeholder);}});// Replace the original text node\nparent.replaceChild(fragment,textNode);}});console.log(\"🎭 Set up invisible name placeholders\");};// Function to replace placeholders with actual names\nconst replaceNamePlaceholders=()=>{const data=getPersonalizationData();if(!data.userName||!data.isPersonalized){console.log(\"❌ No valid user data found\");return 0;}console.log(\"🎯 Replacing placeholders with:\",data.userName);// Find all placeholder spans\nconst placeholders=document.querySelectorAll(\".framer-name-placeholder\");let count=0;placeholders.forEach(placeholder=>{if(placeholder.textContent===\"{name}\"){// Replace with actual name and make visible\nplaceholder.textContent=data.userName;placeholder.style.opacity=\"1\";count++;}});// Also handle any remaining text nodes with {name} (fallback)\nconst walker=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:node=>{if(node.textContent&&node.textContent.includes(\"{name}\")){return NodeFilter.FILTER_ACCEPT;}return NodeFilter.FILTER_REJECT;}});let node;while(node=walker.nextNode()){const textNode=node;const original=textNode.textContent||\"\";const updated=original.replace(/{name}/gi,data.userName);if(original!==updated){textNode.textContent=updated;count++;}}console.log(`🎉 Replaced ${count} name placeholders`);return count;};// Initial setup - run immediately and after short delay\nsetupNamePlaceholders();// Check if we already have data and can replace immediately\nconst data=getPersonalizationData();if(data.isPersonalized&&data.userName){// Replace immediately if data exists\nsetTimeout(replaceNamePlaceholders,50);}else{// Setup placeholders with a small delay to catch dynamic content\nsetTimeout(setupNamePlaceholders,200);}// Listen for personalization updates\nconst handleUpdate=event=>{console.log(\"📡 Received personalization update:\",event.detail);// Small delay to ensure data is saved\nsetTimeout(()=>{replaceNamePlaceholders();},100);};// Mutation observer to handle dynamically added content\nconst observer=new MutationObserver(mutations=>{let shouldCheck=false;mutations.forEach(mutation=>{if(mutation.type===\"childList\"){mutation.addedNodes.forEach(node=>{if(node.nodeType===Node.TEXT_NODE&&node.textContent&&node.textContent.includes(\"{name}\")){shouldCheck=true;}else if(node.nodeType===Node.ELEMENT_NODE){const element=node;const walker=document.createTreeWalker(element,NodeFilter.SHOW_TEXT,null);let textNode;while(textNode=walker.nextNode()){if(textNode.textContent&&textNode.textContent.includes(\"{name}\")){shouldCheck=true;break;}}}});}});if(shouldCheck){setTimeout(()=>{setupNamePlaceholders();const data=getPersonalizationData();if(data.isPersonalized&&data.userName){replaceNamePlaceholders();}},100);}});// Start observing\nobserver.observe(document.body,{childList:true,subtree:true});// Reduced polling for edge cases\nconst pollForUpdates=()=>{const data=getPersonalizationData();if(data.isPersonalized&&data.userName){replaceNamePlaceholders();}};// Set up event listeners\nwindow.addEventListener(\"personalizationUpdated\",handleUpdate);// Light polling as fallback\nconst pollInterval=setInterval(pollForUpdates,3e3);// Cleanup function\nreturn()=>{observer.disconnect();clearInterval(pollInterval);window.removeEventListener(\"personalizationUpdated\",handleUpdate);console.log(\"🧹 Enhanced personalization cleanup completed\");};},[])// Remove ref dependency to prevent re-runs\n;// Return component unchanged - we're not modifying its opacity anymore\nreturn /*#__PURE__*/_jsx(Component,{...props,ref:ref});});};// 🎨 ENHANCED THEME OVERRIDE - Now with forwardRef support\nexport const withAutoTheme=Component=>{return /*#__PURE__*/forwardRef((props,ref)=>{const[appliedTheme,setAppliedTheme]=useState(\"\");useEffect(()=>{const personalizationData=getPersonalizationData();if(!personalizationData.isPersonalized){return;}// Theme configurations\nconst themes={vibrant:{\"--text-color\":\"#FF6B6B\",\"--accent-color\":\"#4ECDC4\",\"--bg-color\":\"#000000\"},minimal:{\"--text-color\":\"#2C3E50\",\"--accent-color\":\"#3498DB\",\"--bg-color\":\"#FFFFFF\"},warm:{\"--text-color\":\"#E67E22\",\"--accent-color\":\"#F39C12\",\"--bg-color\":\"#FEF7F0\"},creative:{\"--text-color\":\"#9B59B6\",\"--accent-color\":\"#E74C3C\",\"--bg-color\":\"#F8F9FA\"}};const selectedTheme=personalizationData.theme||\"vibrant\";const currentTheme=themes[selectedTheme]||themes.vibrant;if(appliedTheme!==selectedTheme){const root=document.documentElement;Object.entries(currentTheme).forEach(([property,value])=>{root.style.setProperty(property,value);});setAppliedTheme(selectedTheme);console.log(`🎨 Applied ${selectedTheme} theme`);}},[appliedTheme]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref,style:{...props.style,color:\"var(--text-color, inherit)\"}});});};// 🚀 INSTANT REPLACEMENT - For immediate name replacement on page load\nexport const withInstantPersonalization=Component=>{return /*#__PURE__*/forwardRef((props,ref)=>{useEffect(()=>{// Immediate replacement for faster page loads\nconst immediateReplace=()=>{const data=getPersonalizationData();if(data.isPersonalized&&data.userName){const walker=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:node=>{if(node.textContent&&node.textContent.includes(\"{name}\")){return NodeFilter.FILTER_ACCEPT;}return NodeFilter.FILTER_REJECT;}});let node;while(node=walker.nextNode()){const textNode=node;const original=textNode.textContent||\"\";const updated=original.replace(/{name}/gi,data.userName);if(original!==updated){textNode.textContent=updated;}}console.log(\"⚡ Instant name replacement completed\");}};// Run immediately\nimmediateReplace();// Also run after a tiny delay to catch late-loading content\nsetTimeout(immediateReplace,50);},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});};// 🔍 DEBUG OVERRIDE - For troubleshooting (remove in production)\nexport const withPersonalizationDebug=Component=>{return /*#__PURE__*/forwardRef((props,ref)=>{useEffect(()=>{const data=getPersonalizationData();console.log(\"🔍 Debug - Current personalization data:\",data);// Log all text containing {name}\nconst walker=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null);const placeholders=[];let node;while(node=walker.nextNode()){if(node.textContent&&node.textContent.includes(\"{name}\")){placeholders.push(node.textContent);}}if(placeholders.length>0){console.log(\"🔍 Found {name} placeholders:\",placeholders);}// Log placeholder spans\nconst spans=document.querySelectorAll(\".framer-name-placeholder\");console.log(\"🔍 Found placeholder spans:\",spans.length);},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});};\nexport const __FramerMetadata__ = {\"exports\":{\"withAutoTheme\":{\"type\":\"reactHoc\",\"name\":\"withAutoTheme\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAutoPersonalization\":{\"type\":\"reactHoc\",\"name\":\"withAutoPersonalization\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withInstantPersonalization\":{\"type\":\"reactHoc\",\"name\":\"withInstantPersonalization\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPersonalizationDebug\":{\"type\":\"reactHoc\",\"name\":\"withPersonalizationDebug\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text.map"],"mappings":"uIACA,SAAS,GAAwB,CAAC,GAAG,CACrC,GAAG,EAAO,sBAAuB,OAAO,EAAO,sBAC/C,IAAM,EAAO,aAAa,QAAQ,yBAAyB,CAAC,GAAG,EAAO,CAAC,IAAM,EAAO,KAAK,MAAM,EAAO,CACtG,GAAG,GAAQ,OAAO,EAAO,UAAW,SAAU,OAAO,QAAkB,CAAC,QAAQ,IAAI,sCAAsC,CAAE,MAAM,CAAC,SAAS,GAAG,KAAK,WAAW,MAAM,UAAU,eAAe,GAAM,wBAJzJ,IAAiD,CAK/E,EAAwB,GAAgC,GAAY,EAAM,KAAO,MAAc,CAAC,QAAQ,IAAI,2CAA2C,CACpK,IAAM,MAA0B,CAAC,IAAM,EAAO,SAAS,iBAAiB,SAAS,KAAK,WAAW,UAAU,CAAC,WAAW,GAAUA,EAAK,aAAaA,EAAK,YAAY,SAAS,SAAS,CAAS,WAAW,cAAsB,WAAW,cAAgB,CAAC,CAAO,EAAU,EAAE,CAAK,EAAK,KAAM,EAAK,EAAO,UAAU,EAAE,EAAU,KAAK,EAAK,CAC3U,EAAU,QAAQ,GAAU,CAAC,IAAM,EAAO,EAAS,WAAW,GAAG,CAAC,EAAO,OACzE,IAAM,GAD6F,EAAS,aAAa,IAChG,MAAM,WAAW,CAAC,GAAG,EAAM,OAAO,EAAE,CAC7D,IAAM,EAAS,SAAS,wBAAwB,CAAC,EAAM,SAAS,EAAK,IAAQ,CAE7E,GADG,GAAM,EAAS,YAAY,SAAS,eAAe,EAAK,CAAC,CACzD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