{"version":3,"file":"TextShuffle.MD88rHMj.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/Zcq3NndiwuLekL6WF6CL/uQSe7bImdouyr9zDM5cq/TextShuffle.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,motion}from\"framer\";/**\n * @framerSupportedLayoutWidth\n * @framerSupportedLayoutHeight\n * @framerDisableUnlink\n */export default function TextShuffle({text,duration,interval,font,color,HoverColor,style}){const[displayText,setDisplayText]=React.useState(text);const[hovered,setHovered]=React.useState(false);const[isAnimating,setIsAnimating]=React.useState(false);React.useEffect(()=>{let letters=text.split(\"\");let timeoutIds=[];if(hovered){setIsAnimating(true);// Shuffle animation\nfor(let i=0;i<duration/interval;i++){timeoutIds.push(setTimeout(()=>{const shuffled=[...letters].sort(()=>.5-Math.random());setDisplayText(shuffled.join(\"\"));},i*interval));}// Return to original at the end\ntimeoutIds.push(setTimeout(()=>{setDisplayText(text);setIsAnimating(false);},duration));}else{setIsAnimating(false);timeoutIds.push(setTimeout(()=>{setDisplayText(text);},100));}return()=>timeoutIds.forEach(clearTimeout);},[hovered,text,duration,interval]);// 🎨 Colore SOLO durante l'animazione\nconst currentColor=isAnimating?HoverColor:color;return /*#__PURE__*/_jsx(motion.div,{style:{...style,display:\"inline-block\",...font,color:currentColor,cursor:\"default\",transition:\"color 0.2s ease\"},onMouseEnter:()=>setHovered(true),onMouseLeave:()=>setHovered(false),children:displayText});}addPropertyControls(TextShuffle,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Hover to shuffle\"},duration:{type:ControlType.Number,title:\"Duration (ms)\",defaultValue:450,min:100,max:2e3,step:50},interval:{type:ControlType.Number,title:\"Speed (ms)\",defaultValue:50,min:10,max:200,step:10},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"monospace\",defaultValue:{fontSize:48,letterSpacing:0,textAlign:\"left\",lineHeight:1.2}},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000\"},HoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#FE5440\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextShuffle\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"* @framerSupportedLayoutHeight\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextShuffle.map"],"mappings":"2NAIG,SAAwB,EAAY,CAAC,OAAK,WAAS,WAAS,OAAK,QAAM,aAAW,SAAO,CAAC,GAAK,CAAC,EAAY,GAAgBA,EAAe,EAAK,CAAM,CAAC,EAAQ,GAAYA,EAAe,GAAM,CAAM,CAAC,EAAY,GAAgBA,EAAe,GAAM,CAAC,MAAoB,CAAC,IAAI,EAAQ,EAAK,MAAM,GAAG,CAAK,EAAW,EAAE,CAAC,GAAG,EAAQ,CAAC,EAAe,GAAK,CAC9V,IAAI,IAAI,EAAE,EAAE,EAAE,EAAS,EAAS,IAAK,EAAW,KAAK,eAAe,CAAwD,EAAxC,CAAC,GAAG,EAAQ,CAAC,SAAS,GAAG,KAAK,QAAQ,CAAC,CAAyB,KAAK,GAAG,CAAC,EAAG,EAAE,EAAS,CAAC,CAC5K,EAAW,KAAK,eAAe,CAAC,EAAe,EAAK,CAAC,EAAe,GAAM,EAAG,EAAS,CAAC,MAAO,EAAe,GAAM,CAAC,EAAW,KAAK,eAAe,CAAC,EAAe,EAAK,EAAG,IAAI,CAAC,CAAE,UAAU,EAAW,QAAQ,aAAa,EAAG,CAAC,EAAQ,EAAK,EAAS,EAAS,CAAC,CAChQ,IAAM,EAAa,EAAY,EAAW,EAAM,OAAoB,EAAK,EAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAM,QAAQ,eAAe,GAAG,EAAK,MAAM,EAAa,OAAO,UAAU,WAAW,kBAAkB,CAAC,iBAAiB,EAAW,GAAK,CAAC,iB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