{"version":3,"file":"Scramble_on_hover_component.Buu_NFgO.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/0cFsIndAhvuXf83iLb78/eqacz9oF8PWmhDbYuytm/Scramble_on_hover_component.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Utility function to shuffle array\nfunction shuffleArray(arr){return arr.reduce(([a,b])=>(b.push(...a.splice(Math.random()*a.length|0,1)),[a,b]),[[...arr],[]])[1];}export function ShuffleText({text,shuffleWord,linkUrl,fontFamily,fontSize,fontWeight,letterSpacing,lineHeight,textAlign,textColor,backgroundColor,linkBackgroundColor,linkBackgroundColorHover,linkFontFamily,linkFontSize,linkFontWeight,linkTextColor,linkTextDecoration,linkTarget}){const shuffleRef=useRef(null);useEffect(()=>{const shuffledEl=shuffleRef.current;const duration=50// Speed of shuffle\n;const framesMax=7// Max frames for shuffle\n;let textOrig=shuffledEl.textContent// Original text\n;let inter;const onMouseOver=e=>{let text=e.currentTarget.textContent;let charArr=text.split(\"\");let frame=0;inter=setInterval(()=>{if(frame<framesMax){let charArrShuff=shuffleArray(charArr);shuffledEl.textContent=charArrShuff.join(\"\");frame++;}else{clearInterval(inter);shuffledEl.textContent=textOrig;}},duration);};const onMouseLeave=e=>{e.currentTarget.textContent=textOrig;clearInterval(inter);};shuffledEl.addEventListener(\"mouseover\",onMouseOver);shuffledEl.addEventListener(\"mouseleave\",onMouseLeave);// Cleanup event listeners on unmount\nreturn()=>{shuffledEl.removeEventListener(\"mouseover\",onMouseOver);shuffledEl.removeEventListener(\"mouseleave\",onMouseLeave);};},[]);// Split the text and wrap the shuffle word in an <a> tag\nconst formattedText=text.split(\" \").map((word,index)=>word===shuffleWord?/*#__PURE__*/_jsx(\"a\",{ref:shuffleRef,href:linkUrl||\"#\",target:linkTarget||\"_self\",style:{fontFamily:linkFontFamily||fontFamily,fontSize:`${linkFontSize||fontSize}px`,fontWeight:linkFontWeight||fontWeight,color:linkTextColor||textColor,textDecoration:\"none\",cursor:\"pointer\",fontKerning:\"none\",fontFeatureSettings:'\"liga\" 0',fontVariantLigatures:\"none\",padding:\"2px 4px\",backgroundColor:linkBackgroundColor,borderRadius:\"4px\",transition:\"background-color 0.3s ease\"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=linkBackgroundColorHover// Change background on hover\n    ;},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=linkBackgroundColor// Revert background on leave\n    ;},children:word},index):/*#__PURE__*/_jsxs(\"span\",{children:[word,\" \"]},index));return /*#__PURE__*/_jsx(\"div\",{style:{fontFamily:fontFamily,fontSize:`${fontSize}px`,fontWeight:fontWeight,letterSpacing:`${letterSpacing}px`,lineHeight:lineHeight,textAlign:textAlign,color:textColor,backgroundColor:backgroundColor,fontKerning:\"none\",fontFeatureSettings:'\"liga\" 0',cursor:\"default\"},children:formattedText});}// Add Property Controls for customization\naddPropertyControls(ShuffleText,{// Main Text Controls\ntext:{type:ControlType.String,title:\"Text\",defaultValue:\"I spend my days crafting unique websites optimized for SEO and conversions to help businesses shine online.\"},shuffleWord:{type:ControlType.String,title:\"Shuffle Word\",defaultValue:\"websites\"},linkUrl:{type:ControlType.Link,title:\"Link URL\",defaultValue:\"#\"},linkTarget:{type:ControlType.Enum,title:\"Target\",options:[\"_self\",\"_blank\"],optionTitles:[\"Same Tab (_self)\",\"New Tab (_blank)\"],defaultValue:\"_self\"},// Grouped Styling Controls for Main Text\nfontFamily:{type:ControlType.String,title:\"Font Family\",defaultValue:\"Britti Sans Regular\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:14,min:10,max:100,step:1},fontWeight:{type:ControlType.Enum,title:\"Font Weight\",options:[\"100\",\"200\",\"300\",\"400\",\"500\",\"600\",\"700\",\"800\",\"900\"],optionTitles:[\"Thin (100)\",\"Extra Light (200)\",\"Light (300)\",\"Regular (400)\",\"Medium (500)\",\"Semi Bold (600)\",\"Bold (700)\",\"Extra Bold (800)\",\"Black (900)\"],defaultValue:\"400\"},letterSpacing:{type:ControlType.Number,title:\"Letter Spacing\",defaultValue:0,min:-5,max:20,step:.1},lineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:1.2,min:.5,max:3,step:.1},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\",\"justify\"],optionTitles:[\"Left\",\"Center\",\"Right\",\"Justify\"],defaultValue:\"left\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#FFFFFF\"},linkBackgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#e5e5e5\"},linkBackgroundColorHover:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#d4d4d4\"},// Grouped Link Styling Controls\nlinkFontFamily:{type:ControlType.String,title:\"Link Font Family\",defaultValue:\"Britti Sans Medium\"},linkFontSize:{type:ControlType.Number,title:\"Link Font Size\",defaultValue:14,min:10,max:100,step:1},linkFontWeight:{type:ControlType.Enum,title:\"Link Font Weight\",options:[\"100\",\"200\",\"300\",\"400\",\"500\",\"600\",\"700\",\"800\",\"900\"],optionTitles:[\"Thin (100)\",\"Extra Light (200)\",\"Light (300)\",\"Regular (400)\",\"Medium (500)\",\"Semi Bold (600)\",\"Bold (700)\",\"Extra Bold (800)\",\"Black (900)\"],defaultValue:\"\"},linkTextColor:{type:ControlType.Color,title:\"Link Color\",defaultValue:\"#007BFF\"},linkTextDecoration:{type:ControlType.Enum,title:\"Link Decoration\",options:[\"underline\",\"none\"]}});\nexport const __FramerMetadata__ = {\"exports\":{\"ShuffleText\":{\"type\":\"reactComponent\",\"name\":\"ShuffleText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scramble_on_hover_component.map"],"mappings":"mLACA,SAAS,EAAa,EAAI,CAAC,OAAO,EAAI,QAA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