{"version":3,"file":"TextANimate.CkTSO2Tq.mjs","names":["useRef","overflow","scrollEl","useMemo","p"],"sources":["https:/framerusercontent.com/modules/v2eWjm2ZYxfqa9jGG1YH/M2WuQ4wLzk79ug0dkWYg/TextANimate.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useMemo,useEffect,useRef}from\"react\";import{motion,useAnimation}from\"framer-motion\";import{useRouter,addPropertyControls,ControlType}from\"framer\";function parseRoute(routes,targetPath){if(!routes||!targetPath)return null;let cleanPath=targetPath;try{const url=new URL(targetPath,\"http://dummy.com\");cleanPath=url.pathname;}catch(e){}for(const[routeId,routeInfo]of Object.entries(routes)){const pattern=routeInfo.path;if(!pattern)continue;const paramNames=[];const regexPattern=pattern.replace(/:(\\w+)/g,(_,paramName)=>{paramNames.push(paramName);return\"([^/]+)\";});const regex=new RegExp(`^${regexPattern}$`);const match=cleanPath.match(regex);if(match){const params=paramNames.reduce((acc,name,index)=>({...acc,[name]:match[index+1]}),{});return{routeId,params};}}return null;}/**\n * ROLLING TEXT (SMART AUTO-STAGGER)\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function RollingText(props){const{text,link,enableScroll,scrollTrigger,repeat,enableHover,resetOnLeave,proximity,mode,staggerMode,smartTotalTime,manualStagger,transition,font,color,padding,style}=props;const controls=useAnimation();const router=useRouter();const containerRef=useRef(null);const hasTriggered=useRef(false);const scrollActive=useRef(false);const findScrollContainer=el=>{if(!el)return window;let parent=el.parentElement;while(parent){const{overflow,overflowY}=getComputedStyle(parent);if(/(auto|scroll)/.test(overflow+overflowY))return parent;parent=parent.parentElement;}return window;};useEffect(()=>{if(!enableScroll||scrollTrigger===\"none\"||!containerRef.current)return;hasTriggered.current=false;scrollActive.current=false;const check=()=>{if(!containerRef.current)return;const rect=containerRef.current.getBoundingClientRect();const scrollEl=findScrollContainer(containerRef.current);const vh=scrollEl===window?window.innerHeight:scrollEl.clientHeight;let inZone=false;if(scrollTrigger===\"enter\"){inZone=rect.top<vh&&rect.bottom>0;}else if(scrollTrigger===\"center\"){inZone=rect.top<vh*.5&&rect.bottom>0;}else if(scrollTrigger===\"top\"){inZone=rect.top<vh*.1&&rect.bottom>0;}if(inZone&&!hasTriggered.current){hasTriggered.current=true;scrollActive.current=true;controls.set(\"idle\");controls.start(\"hovered\");}else if(!inZone&&repeat&&hasTriggered.current){hasTriggered.current=false;scrollActive.current=false;controls.start(\"idle\");}};const scrollEl=findScrollContainer(containerRef.current);check();scrollEl.addEventListener(\"scroll\",check,{passive:true});if(scrollEl!==window)window.addEventListener(\"scroll\",check,{passive:true});return()=>{scrollEl.removeEventListener(\"scroll\",check);if(scrollEl!==window)window.removeEventListener(\"scroll\",check);};},[enableScroll,scrollTrigger,repeat,controls]);const segments=useMemo(()=>{if(mode===\"word\")return text.split(\" \");return text.split(\"\");},[text,mode]);const activeStagger=useMemo(()=>{if(staggerMode===\"smart\"){const calculated=smartTotalTime/Math.max(segments.length,1);return Math.min(calculated,.15);}return manualStagger;},[staggerMode,smartTotalTime,manualStagger,segments.length]);const handleLinkClick=(e,linkUrl)=>{if(!linkUrl)return;const route=parseRoute(router.routes,linkUrl);if(route){e.preventDefault();e.stopPropagation();router.navigate(route.routeId,\"\",route.params);}};const handleMouseEnter=()=>{controls.set(\"idle\");controls.start(\"hovered\");};const handleMouseLeave=()=>{if(!enableHover)return;if(!resetOnLeave)return;if(scrollActive.current)return;controls.start(\"idle\");};const variants={idle:{y:\"0%\"},hovered:i=>({y:\"-100%\",transition:{...transition,delay:(transition.delay||0)+i*activeStagger}})};const{width,height,overflow,...safeStyle}=style??{};const rootStyle={...safeStyle,// These must always win, never be overridden\ndisplay:\"inline-flex\",position:\"relative\",userSelect:\"none\",WebkitUserSelect:\"none\",textDecoration:\"none\"};const hitAreaStyle={position:\"absolute\",top:-(proximity?.vertical??0),bottom:-(proximity?.vertical??0),left:-(proximity?.horizontal??0),right:-(proximity?.horizontal??0),zIndex:0};const paddingWrapperStyle={...font,color,display:\"inline-flex\",flexDirection:\"row\",alignItems:\"baseline\",justifyContent:\"flex-start\",padding:padding??\"10px 20px\",whiteSpace:\"nowrap\",position:\"relative\",zIndex:1};const MotionComponent=link?motion.a:motion.div;return /*#__PURE__*/_jsxs(MotionComponent,{ref:containerRef,href:link,onClick:e=>handleLinkClick(e,link),style:rootStyle,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,initial:\"idle\",animate:controls,children:[/*#__PURE__*/_jsx(\"div\",{style:hitAreaStyle}),/*#__PURE__*/_jsx(\"div\",{style:paddingWrapperStyle,children:segments.map((segment,index)=>{const isSpace=segment===\" \";return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",overflow:\"hidden\",display:\"block\",minWidth:isSpace?\"0.25em\":\"auto\"},children:[/*#__PURE__*/_jsx(motion.div,{custom:index,variants:variants,children:isSpace?\"\\xa0\":segment}),/*#__PURE__*/_jsx(motion.div,{custom:index,variants:variants,style:{position:\"absolute\",top:\"100%\",left:0,width:\"100%\"},children:isSpace?\"\\xa0\":segment}),mode===\"word\"&&index!==segments.length-1&&/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",width:\"0.25em\"},children:\"\\xa0\"})]},index);})})]});}RollingText.defaultProps={text:\"Rolling\",link:\"\",enableScroll:true,scrollTrigger:\"center\",repeat:true,enableHover:true,resetOnLeave:true,proximity:{horizontal:20,vertical:20},mode:\"char\",staggerMode:\"smart\",smartTotalTime:.4,manualStagger:.05,transition:{type:\"spring\",duration:.4,bounce:.2},color:\"#000\",font:{fontSize:32,fontWeight:600},padding:\"10px 20px 10px 20px\"};addPropertyControls(RollingText,{text:{type:ControlType.String,title:\"Text\"},link:{type:ControlType.Link,title:\"Link\"},// ── SCROLL ──────────────────────────────────────────────\nenableScroll:{type:ControlType.Boolean,title:\"Scroll Trigger\",defaultValue:true},scrollTrigger:{type:ControlType.Enum,title:\"Trigger At\",options:[\"enter\",\"center\",\"top\"],optionTitles:[\"On Enter\",\"On Center\",\"On Top\"],hidden:p=>!p.enableScroll},repeat:{type:ControlType.Boolean,title:\"Repeat\",defaultValue:true,description:\"Re-trigger each time element re-enters zone.\",hidden:p=>!p.enableScroll},// ── HOVER ───────────────────────────────────────────────\nenableHover:{type:ControlType.Boolean,title:\"Hover Roll Back\",defaultValue:true,description:\"Roll back to idle on mouse leave.\"},resetOnLeave:{type:ControlType.Boolean,title:\"Roll Back\",defaultValue:true,hidden:p=>!p.enableHover},proximity:{type:ControlType.Object,title:\"Hit Area\",controls:{horizontal:{type:ControlType.Number,title:\"Sides\",unit:\"px\"},vertical:{type:ControlType.Number,title:\"Top/Btm\",unit:\"px\"}},hidden:p=>!p.enableHover},// ── ANIMATION ───────────────────────────────────────────\nmode:{type:ControlType.Enum,title:\"Mode\",options:[\"char\",\"word\"],optionTitles:[\"Letters\",\"Words\"],displaySegmentedControl:true},staggerMode:{type:ControlType.Enum,title:\"Stagger\",options:[\"smart\",\"manual\"],optionTitles:[\"Smart\",\"Manual\"],displaySegmentedControl:true},smartTotalTime:{type:ControlType.Number,title:\"Duration\",min:.1,max:2,step:.1,unit:\"s\",hidden:p=>p.staggerMode!==\"smart\"},manualStagger:{type:ControlType.Number,title:\"Delay\",min:0,max:.5,step:.01,unit:\"s\",hidden:p=>p.staggerMode!==\"manual\"},transition:{type:ControlType.Transition,title:\"Transition\"},// ── STYLE ────────────────────────────────────────────────\ncolor:{type:ControlType.Color,title:\"Color\"},font:{type:ControlType.Font,controls:\"extended\"},padding:{type:ControlType.Padding,title:\"Padding\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RollingText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextANimate.map"],"mappings":"6QAAkN,SAAS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