{"version":3,"file":"Text_Highlight_Effect.Dv1RWITP.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/4DdHOw1ojBtaxIQySCkz/geqWiLcM9X4TW1mAO5DI/Text_Highlight_Effect.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";export function withHighlightColor1(Component){return props=>{const[isVisible,setIsVisible]=useState(false);useEffect(()=>{const elements=document.querySelectorAll(`.${props.className} [style*=\"--framer-text-decoration\"]`);// Now, let's add a parent <mark> tag to the selected elements\nelements.forEach(element=>{element.style.removeProperty(\"--framer-text-decoration\");const markElement=document.createElement(\"mark\");const spanElement=document.createElement(\"span\");// Wrap the element with mark\nelement.parentNode.insertBefore(markElement,element);markElement.appendChild(element);// Wrap the content of the element with span\nwhile(element.firstChild){spanElement.appendChild(element.firstChild);}element.appendChild(spanElement);setIsVisible(true);});const handle=entries=>{entries.forEach(entry=>{const highlightedValue=entry.target.style.getPropertyValue(\"--highlighted\");console.log(\"handle\");if(!highlightedValue||parseInt(highlightedValue)===0){entry.target.style.setProperty(\"--highlighted\",entry.isIntersecting?\"1\":\"0\");}});};const observer=new IntersectionObserver(handle,{threshold:1});elements.forEach(M=>observer.observe(M));},[props]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`\n.${props.className} mark {\n--highlighted: 0;\n--highlight: rgba(0, 128, 255, 0.5);\nbackground: transparent;\n}\n\n.${props.className} mark span {\nbackground: linear-gradient(120deg, var(--highlight) 50%, transparent 50%) 110% 0 / 200% 100% no-repeat;\nbackground-position: calc((1 - var(--highlighted)) * 110%) 0;\ntransition: background-position 1s;\ncolor: white;\n}\n`}),/*#__PURE__*/_jsx(Component,{...props,style:!isVisible?{opacity:0}:{}})]});};}export function withHighlightColor2(Component){return props=>{const[isVisible,setIsVisible]=useState(false);useEffect(()=>{const elements=document.querySelectorAll(`.${props.className} [style*=\"--framer-text-decoration\"]`);// Now, let's add a parent <mark> tag to the selected elements\nelements.forEach(element=>{element.style.removeProperty(\"--framer-text-decoration\");const markElement=document.createElement(\"mark\");const spanElement=document.createElement(\"span\");// Wrap the element with mark\nelement.parentNode.insertBefore(markElement,element);markElement.appendChild(element);// Wrap the content of the element with span\nwhile(element.firstChild){spanElement.appendChild(element.firstChild);}element.appendChild(spanElement);setIsVisible(true);});const handle=entries=>{entries.forEach(entry=>{const highlightedValue=entry.target.style.getPropertyValue(\"--highlighted\");if(!highlightedValue||parseInt(highlightedValue)===0){entry.target.style.setProperty(\"--highlighted\",entry.isIntersecting?\"1\":\"0\");}});};const observer=new IntersectionObserver(handle,{threshold:1});elements.forEach(M=>observer.observe(M));},[props]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`\n.${props.className} mark {\n--highlighted: 0;\n--highlight: rgba(255, 195, 0, 0.8);\nbackground: transparent;\n}\n\n.${props.className} mark span {\nbackground: linear-gradient(120deg, var(--highlight) 50%, transparent 50%) 110% 0 / 200% 100% no-repeat;\nbackground-position: calc((1 - var(--highlighted)) * 110%) 0;\ntransition: background-position 1s;\ncolor: black;\n}\n`}),/*#__PURE__*/_jsx(Component,{...props,style:!isVisible?{opacity:0}:{}})]});};}export function withHighlightColor3(Component){return props=>{const[isVisible,setIsVisible]=useState(false);useEffect(()=>{const elements=document.querySelectorAll(`.${props.className} [style*=\"--framer-text-decoration\"]`);// Now, let's add a parent <mark> tag to the selected elements\nelements.forEach(element=>{element.style.removeProperty(\"--framer-text-decoration\");const markElement=document.createElement(\"mark\");const spanElement=document.createElement(\"span\");// Wrap the element with mark\nelement.parentNode.insertBefore(markElement,element);markElement.appendChild(element);// Wrap the content of the element with span\nwhile(element.firstChild){spanElement.appendChild(element.firstChild);}element.appendChild(spanElement);setIsVisible(true);});const handle=entries=>{entries.forEach(entry=>{const highlightedValue=entry.target.style.getPropertyValue(\"--highlighted\");if(!highlightedValue||parseInt(highlightedValue)===0){entry.target.style.setProperty(\"--highlighted\",entry.isIntersecting?\"1\":\"0\");}});};const observer=new IntersectionObserver(handle,{threshold:1});elements.forEach(M=>observer.observe(M));},[props]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`\n.${props.className} mark {\n--highlighted: 0;\n--highlight: rgba(140, 0, 255, 0.5);\nbackground: transparent;\n}\n\n.${props.className} mark span {\nbackground: linear-gradient(120deg, var(--highlight) 50%, transparent 50%) 110% 0 / 200% 100% no-repeat;\nbackground-position: calc((1 - var(--highlighted)) * 110%) 0;\ntransition: background-position 1s;\ncolor: white;\n}\n`}),/*#__PURE__*/_jsx(Component,{...props,style:!isVisible?{opacity:0}:{}})]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withHighlightColor3\":{\"type\":\"reactHoc\",\"name\":\"withHighlightColor3\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHighlightColor2\":{\"type\":\"reactHoc\",\"name\":\"withHighlightColor2\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHighlightColor1\":{\"type\":\"reactHoc\",\"name\":\"withHighlightColor1\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_Highlight_Effect.map"],"mappings":"iLAgBkF,SAAgB,EAAoB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAU,EAAa,CAACA,EAAS,IAG6T,OAHtT,MAAc,CAAC,IAAM,EAAS,SAAS,iBAAiB,IAAI,EAAM,UAAU,uCAC1Q,EAAS,QAAQ,GAAS,CAAC,EAAQ,MAAM,eAAe,4BAA4B,IAAM,EAAY,SAAS,cAAc,QAAc,EAAY,SAAS,cAAc,QAE9K,IADA,EAAQ,WAAW,aAAa,EAAY,GAAS,EAAY,YAAY,GACvE,EAAQ,YAAY,EAAY,YAAY,EAAQ,YAAa,EAAQ,YAAY,GAAa,EAAa,GAAO,GAAE,IAAM,EAAO,GAAS,CAAC,EAAQ,QAAQ,GAAO,CAAC,IAAM,EAAiB,EAAM,OAAO,MAAM,iBAAiB,kBAAoB,CAAC,GAAkB,SAAS,KAAoB,IAAG,EAAM,OAAO,MAAM,YAAY,gBAAgB,EAAM,eAAe,IAAI,IAAO,EAAG,EAAO,EAAS,IAAI,qBAAqB,EAAO,CAAC,UAAU,EAAE,EAAE,EAAS,QAAQ,GAAG,EAAS,QAAQ,GAAK,EAAC,CAAC,EAAM,EAAsB,EAAMC,EAAU,CAAC,SAAS,CAAc,EAAK,QAAQ,CAAC,SAAS;GACpkB,EAAM,UAAU;;;;;;GAMhB,EAAM,UAAU;;;;;;EAMjB,EAAe,EAAK,EAAU,CAAC,GAAG,EAAM,MAAO,EAAsB,EAAE,CAAd,CAAC,QAAQ,EAAE,CAAI,EAAE,CAAC,CAAG,CAAE"}