{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/QZcobI21bAefEyOwJBLf/9FTltZOdhfwO2Z0nspit/ColorWaveText.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Color Wave Configuration & Helpers\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nconst defaultColors=[\"#FFB592\",\"#FABA17\",\"#60E21B\",\"#24E0AF\",\"#6CD5FD\",\"#A7ABFF\",\"#F6AFFF\",\"#FFB0CD\"];let activeColors=[...defaultColors];const config={frequency:{min:2e3,max:6e3},startPoints:4,propagationLimit:6,waveSpeed:200,propagationDelay:250};function randomBetween(min,max){return Math.floor(Math.random()*(max-min+1))+min;}function isSameLine(span1,span2){const rect1=span1.getBoundingClientRect();const rect2=span2.getBoundingClientRect();return Math.abs(rect1.top-rect2.top)<2;}// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Recursively wrap text nodes without altering existing HTML structure\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nfunction wrapTextNodes(node){if(node.nodeType===Node.TEXT_NODE){const text=node.textContent;if(text&&text.length>0){const fragment=document.createDocumentFragment();// Wrap every character\u2014even spaces\u2014to preserve the layout\nfor(const char of text){const span=document.createElement(\"span\");span.textContent=char;// Add only the color transition (do not override other styles)\nspan.style.transition=`color ${config.waveSpeed}ms ease`;// Mark this span so we can target it later\nspan.setAttribute(\"data-color-wave-char\",\"true\");fragment.appendChild(span);}node.parentNode?.replaceChild(fragment,node);}}else if(node.nodeType===Node.ELEMENT_NODE){// Skip nodes that are already marked as a color-wave span.\nif(node.getAttribute(\"data-color-wave-char\")===\"true\"){return;}// Process child nodes recursively.\nconst childNodes=Array.from(node.childNodes);for(const child of childNodes){wrapTextNodes(child);}}}// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// ColorWaveText Override\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport function ColorWaveText(){const ref=React.useRef(null);const timers=React.useRef([]);React.useEffect(()=>{const element=ref.current;if(!element)return;// Only wrap text nodes once so we don't interfere with any custom styling.\nif(!element.getAttribute(\"data-color-wave-initialized\")){wrapTextNodes(element);element.setAttribute(\"data-color-wave-initialized\",\"true\");}// Query only the spans that we inserted.\nconst spans=element.querySelectorAll(\"span[data-color-wave-char='true']\");// Helper: Clear any active timers.\nfunction clearTimers(){timers.current.forEach(timerId=>clearTimeout(timerId));timers.current=[];}// Function to start a wave effect from a given starting index.\nfunction startColorWave(spans,startIndex,colorCycle){const targetColors=[...colorCycle];const totalStages=targetColors.length+1;let propagationCount=0;function applyWave(index,stage){if(index<0||index>=spans.length||stage>=totalStages)return;const span=spans[index];if(stage<targetColors.length){span.style.color=targetColors[stage];}else{// Reset to inherit the original color from the parent styling.\nspan.style.color=\"\";}const timerId=window.setTimeout(()=>applyWave(index,stage+1),config.waveSpeed);timers.current.push(timerId);// Propagate to the next character only if on stage 0 and within our propagation limit.\nif(stage===0&&propagationCount<config.propagationLimit){propagationCount++;const nextIndex=index+1;if(nextIndex<spans.length&&isSameLine(spans[index],spans[nextIndex])){const timerId2=window.setTimeout(()=>applyWave(nextIndex,0),config.propagationDelay);timers.current.push(timerId2);}}}applyWave(startIndex,0);}// Function to trigger color wave effects periodically.\nfunction triggerColorEffect(){for(let i=0;i<config.startPoints;i++){const randomIndex=Math.floor(Math.random()*spans.length);const firstColorIndex=Math.floor(Math.random()*activeColors.length);const firstColor=activeColors[firstColorIndex];const secondColorIndex=(firstColorIndex+1)%activeColors.length;const secondColor=activeColors[secondColorIndex];startColorWave(spans,randomIndex,[firstColor,secondColor]);}const nextTriggerDelay=randomBetween(config.frequency.min,config.frequency.max);const timerId=window.setTimeout(triggerColorEffect,nextTriggerDelay);timers.current.push(timerId);}clearTimers();triggerColorEffect();// Cleanup on unmount.\nreturn()=>{clearTimers();};},[]);return{ref};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withColorWaveText(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ColorWaveText(props)});};}withColorWaveText.displayName=\"ColorWaveText\";\nexport const __FramerMetadata__ = {\"exports\":{\"withColorWaveText\":{\"type\":\"reactHoc\",\"name\":\"withColorWaveText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ColorWaveText\":{\"type\":\"override\",\"name\":\"ColorWaveText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ColorWaveText.map"],
  "mappings": "4JAAAA,IAGA,IAAMC,EAAc,CAAC,UAAU,UAAU,UAAU,UAAU,UAAU,UAAU,UAAU,SAAS,EAAMC,EAAa,CAAC,GAAGD,CAAa,EAAQE,EAAO,CAAC,UAAU,CAAC,IAAI,IAAI,IAAI,GAAG,EAAE,YAAY,EAAE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B3C,EAAcD,EAAO,UAAU,IAAIA,EAAO,UAAU,GAAG,EAAQyB,EAAQ,OAAO,WAAWY,EAAmBO,CAAgB,EAAExB,EAAO,QAAQ,KAAKK,CAAO,CAAE,CAAC,OAAAD,EAAY,EAAEa,EAAmB,EAC1mB,IAAI,CAACb,EAAY,CAAE,CAAE,EAAE,CAAC,CAAC,EAAQ,CAAC,IAAAN,CAAG,CAAE,CAA2J,SAAS2B,EAAkBC,EAAE,CAAC,OAAOC,IAAQC,EAA+BC,CAAuC,EAASC,EAAKJ,EAAE,CAAC,GAAGC,EAAM,GAAG9B,EAAc8B,CAAK,CAAC,CAAC,EAAI,CAACF,EAAkB,YAAY",
  "names": ["init_ssg_sandbox_shims", "defaultColors", "activeColors", "config", "randomBetween", "min", "max", "isSameLine", "span1", "span2", "rect1", "rect2", "wrapTextNodes", "node", "text", "fragment", "char", "span", "childNodes", "child", "ColorWaveText", "ref", "pe", "timers", "ue", "element", "spans", "clearTimers", "timerId", "startColorWave", "startIndex", "colorCycle", "targetColors", "totalStages", "propagationCount", "applyWave", "index", "stage", "nextIndex", "timerId2", "triggerColorEffect", "i", "randomIndex", "firstColorIndex", "firstColor", "secondColorIndex", "secondColor", "nextTriggerDelay", "withColorWaveText", "C", "props", "re", "DataObserverContext", "p"]
}
