{"version":3,"file":"TextTicker.CFrJExdf.mjs","names":["useRef","useState","__esmMin","init_ssg_sandbox_shims","te","_e","de","p","init_npm_react_18_3_1","ce","window","init_framer_BpuvUAiZ","useIsStaticRenderer","addPropertyControls","ControlType","TextTicker","props","isStatic","containerRef","textRef","textWidth","setTextWidth","containerWidth","setContainerWidth","offset","setOffset","direction","setDirection","repeatCount","setRepeatCount","tw","cw","minRepeats","gap","text","font","reverseOnScroll","lastScrollX","handleScroll","currentScrollX","frame","last","tick","dt","now","next","prev","speed","stripWidth","style","i","textColor","init_TextTicker","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/vJsrs08ioWdlFeCsCORF/iSBd4WRVpCLuAOKyQT9q/TextTicker.js"],"sourcesContent":["// Simple horizontal text ticker that scrolls text continuously\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Simple Text Ticker\n *\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 50\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function TextTicker(props){const{text=\"Breaking News\",speed=40,gap=40,textColor=\"#000000\",font,style,reverseOnScroll=true}=props;const isStatic=useIsStaticRenderer();const containerRef=useRef(null);const textRef=useRef(null);const[textWidth,setTextWidth]=useState(0);const[containerWidth,setContainerWidth]=useState(0);const[offset,setOffset]=useState(0);const[direction,setDirection]=useState(1);const[repeatCount,setRepeatCount]=useState(10);useEffect(()=>{if(typeof window===\"undefined\"||!containerRef.current||!textRef.current)return;const tw=textRef.current.offsetWidth;const cw=containerRef.current.offsetWidth;setTextWidth(tw);setContainerWidth(cw);if(tw>0&&cw>0){const minRepeats=Math.ceil(cw*3/(tw+gap));setRepeatCount(Math.max(minRepeats,10));}},[text,font,gap]);useEffect(()=>{if(!reverseOnScroll||isStatic)return;let lastScrollX=window.scrollX;const handleScroll=()=>{const currentScrollX=window.scrollX;if(currentScrollX>lastScrollX){// Scrolling right\nstartTransition(()=>setDirection(1));}else if(currentScrollX<lastScrollX){// Scrolling left\nstartTransition(()=>setDirection(-1));}lastScrollX=currentScrollX;};window.addEventListener(\"scroll\",handleScroll,{passive:true});return()=>window.removeEventListener(\"scroll\",handleScroll);},[reverseOnScroll,isStatic]);useEffect(()=>{if(isStatic)return;if(textWidth===0)return;let frame;let last=performance.now();function tick(now){const dt=(now-last)/1e3;last=now;startTransition(()=>{setOffset(prev=>{let next=prev-speed*direction*dt;const stripWidth=textWidth+gap;if(next<=-stripWidth){next+=stripWidth;}else if(next>0){next-=stripWidth;}return next;});});frame=requestAnimationFrame(tick);}frame=requestAnimationFrame(tick);return()=>cancelAnimationFrame(frame);},[speed,textWidth,gap,repeatCount,isStatic,direction]);useEffect(()=>{setOffset(0);},[text,textWidth,gap]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",...style},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexDirection:\"row\",alignItems:\"center\",position:\"absolute\",left:0,top:0,height:\"100%\",willChange:\"transform\",transform:isStatic?undefined:`translateX(${offset}px)`},children:Array.from({length:repeatCount}).map((_,i)=>/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\"},children:[/*#__PURE__*/_jsx(\"div\",{ref:i===0?textRef:undefined,style:{color:textColor,whiteSpace:\"nowrap\",...font},children:text}),/*#__PURE__*/_jsx(\"div\",{style:{width:gap}})]},i))})});}addPropertyControls(TextTicker,{reverseOnScroll:{type:ControlType.Boolean,title:\"Direction with Scroll\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},text:{type:ControlType.String,title:\"Text\",defaultValue:\"Breaking News\"},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:40,min:10,max:200,step:1},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:40,min:0,max:200,step:1},textColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:18,lineHeight:1.3,letterSpacing:0,textAlign:\"left\",variant:\"Medium\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextTicker\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"50\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextTicker.map"],"mappings":"A,kNAQG,SAAwBe,EAAW,EAAM,CAAC,GAAK,CAAC,OAAK,gBAAgB,QAAM,GAAG,MAAI,GAAG,YAAU,UAAU,OAAK,QAAM,kBAAgB,IAAMC,EAAYC,EAASL,EAAoB,EAAQM,EAAalB,EAAO,IAAI,EAAQmB,EAAQnB,EAAO,IAAI,EAAO,CAACoB,EAAUC,GAAcpB,EAAS,CAAC,EAAO,CAACqB,EAAeC,GAAmBtB,EAAS,CAAC,EAAO,CAACuB,EAAOC,GAAWxB,EAAS,CAAC,EAAO,CAACyB,EAAUC,GAAc1B,EAAS,CAAC,EAAO,CAAC2B,EAAYC,GAAgB5B,EAAS,EAAE,EAE4T,OAF1TQ,MAAc,CAAC,GAAUC,IAAS,QAAa,CAACQ,EAAa,SAAS,CAACC,EAAQ,QAAQ,OAAO,IAAMW,EAAGX,EAAQ,QAAQ,YAAkBY,EAAGb,EAAa,QAAQ,YAAmD,GAAvCG,EAAaS,CAAE,EAAEP,EAAkBQ,CAAE,EAAKD,EAAG,GAAGC,EAAG,EAAE,CAAC,IAAMC,EAAW,KAAK,KAAKD,EAAG,GAAGD,EAAGG,EAAI,EAAEJ,EAAe,KAAK,IAAIG,EAAW,EAAE,CAAC,CAAE,CAAC,EAAE,CAACE,EAAKC,EAAKF,CAAG,CAAC,EAA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