{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/vgp6zTtS87FDKhMCjMQp/D1dh1j8eshUlfqWsSsiN/Tickerfield.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function RichTextTicker(props){const{richText,speed,gap,direction,hover,cornerRadius,showAlt,altSpacing,altFont,altColor,draggable}=props;const containerRef=React.useRef(null);const contentRef=React.useRef(null);const[contentSize,setContentSize]=React.useState(0);const dragStartPos=React.useRef({x:0,y:0});const currentTranslate=React.useRef(0);const isDragging=React.useRef(false);const lastDragPosition=React.useRef(0);React.useEffect(()=>{const updateSize=()=>{if(contentRef.current&&containerRef.current){const items=Array.from(contentRef.current.children);const halfLength=items.length/2;let totalSize=0;for(let i=0;i<halfLength;i++){if(direction===\"top\"||direction===\"bottom\"){totalSize+=items[i].offsetHeight+gap;}else{totalSize+=items[i].offsetWidth+gap;}}setContentSize(totalSize);}};updateSize();window.addEventListener(\"resize\",updateSize);return()=>window.removeEventListener(\"resize\",updateSize);},[richText,gap,direction]);React.useEffect(()=>{let animationFrameId=null;const animate=()=>{if(!isDragging.current&&contentRef.current&&speed>0){const scrollSize=direction===\"left\"||direction===\"right\"?contentRef.current.scrollWidth/2:contentRef.current.scrollHeight/2;if(direction===\"left\"||direction===\"up\"){currentTranslate.current-=speed/10;if(Math.abs(currentTranslate.current)>=scrollSize){currentTranslate.current+=scrollSize;}}else{currentTranslate.current+=speed/10;if(currentTranslate.current>=0){currentTranslate.current-=scrollSize;}}const transform=direction===\"left\"||direction===\"right\"?`translateX(${currentTranslate.current}px)`:`translateY(${currentTranslate.current}px)`;contentRef.current.style.transform=transform;}animationFrameId=requestAnimationFrame(animate);};if(!isDragging.current){animate();}return()=>{if(animationFrameId){cancelAnimationFrame(animationFrameId);}};},[speed,direction,isDragging.current]);const handleMouseDown=e=>{if(!draggable)return;e.preventDefault();isDragging.current=true;dragStartPos.current={x:e.clientX,y:e.clientY};const computedStyle=window.getComputedStyle(contentRef.current);const transform=new DOMMatrix(computedStyle.transform);currentTranslate.current=direction===\"left\"||direction===\"right\"?transform.m41:transform.m42;lastDragPosition.current=direction===\"left\"||direction===\"right\"?e.clientX:e.clientY;contentRef.current.style.cursor=\"grabbing\";document.addEventListener(\"mousemove\",handleMouseMove);document.addEventListener(\"mouseup\",handleMouseUp);};const handleMouseMove=e=>{if(!isDragging.current)return;e.preventDefault();const currentPos=direction===\"left\"||direction===\"right\"?e.clientX:e.clientY;const delta=currentPos-lastDragPosition.current;currentTranslate.current+=delta;const transform=direction===\"left\"||direction===\"right\"?`translateX(${currentTranslate.current}px)`:`translateY(${currentTranslate.current}px)`;contentRef.current.style.transform=transform;lastDragPosition.current=currentPos;};const handleMouseUp=()=>{isDragging.current=false;contentRef.current.style.cursor=\"grab\";document.removeEventListener(\"mousemove\",handleMouseMove);document.removeEventListener(\"mouseup\",handleMouseUp);};const handleTouchStart=e=>{if(!draggable)return;e.preventDefault();isDragging.current=true;const touch=e.touches[0];dragStartPos.current={x:touch.clientX,y:touch.clientY};const computedStyle=window.getComputedStyle(contentRef.current);const transform=new DOMMatrix(computedStyle.transform);currentTranslate.current=direction===\"left\"||direction===\"right\"?transform.m41:transform.m42;lastDragPosition.current=direction===\"left\"||direction===\"right\"?touch.clientX:touch.clientY;};const handleTouchMove=e=>{if(!isDragging.current)return;e.preventDefault();const touch=e.touches[0];const currentPos=direction===\"left\"||direction===\"right\"?touch.clientX:touch.clientY;const delta=currentPos-lastDragPosition.current;currentTranslate.current+=delta;const transform=direction===\"left\"||direction===\"right\"?`translateX(${currentTranslate.current}px)`:`translateY(${currentTranslate.current}px)`;contentRef.current.style.transform=transform;lastDragPosition.current=currentPos;};const handleTouchEnd=()=>{isDragging.current=false;};const containerStyle={overflow:\"hidden\",width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:direction===\"top\"||direction===\"bottom\"?\"column\":\"row\"};const contentStyle={display:\"flex\",flexWrap:\"nowrap\",flexDirection:direction===\"top\"||direction===\"bottom\"?\"column\":\"row\",cursor:draggable?\"grab\":\"default\",userSelect:\"none\",WebkitUserSelect:\"none\",touchAction:\"none\",willChange:\"transform\"};const itemStyle={flexShrink:0,objectFit:\"contain\",marginRight:direction===\"left\"||direction===\"right\"?`${gap}px`:0,marginBottom:direction===\"top\"||direction===\"bottom\"?`${gap}px`:0,width:direction===\"top\"||direction===\"bottom\"?\"100%\":\"auto\",height:direction===\"top\"||direction===\"bottom\"?\"auto\":\"100%\"};const renderContent=()=>{if(!richText||!richText.props||!richText.props.children){return null;}const items=React.Children.toArray(richText.props.children);const allItems=[...items,...items];return allItems.map((child,index)=>/*#__PURE__*/_jsx(\"div\",{style:itemStyle,children:/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",height:\"100%\"},children:[/*#__PURE__*/React.cloneElement(child,{style:{...child.props.style,borderRadius:`${cornerRadius}px`,objectFit:\"cover\",width:\"100%\",height:showAlt?`calc(100% - ${altSpacing}px)`:\"100%\",pointerEvents:isDragging.current?\"none\":\"auto\"}}),showAlt&&child.props.alt&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",bottom:0,left:0,right:0,marginTop:altSpacing,textAlign:\"center\",color:altColor,...altFont},children:child.props.alt})]})},index));};if(RenderTarget.current()===RenderTarget.canvas){return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:/*#__PURE__*/_jsx(\"div\",{style:{...contentStyle,transform:\"none\"},children:renderContent()})});}return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:containerStyle,children:/*#__PURE__*/_jsx(\"div\",{ref:contentRef,style:contentStyle,onMouseDown:handleMouseDown,onTouchStart:handleTouchStart,onTouchMove:handleTouchMove,onTouchEnd:handleTouchEnd,children:renderContent()})});}RichTextTicker.defaultProps={richText:null,speed:50,gap:20,direction:\"left\",hover:1,cornerRadius:0,showAlt:false,altSpacing:8,altColor:\"#000000\",draggable:false};addPropertyControls(RichTextTicker,{richText:{type:ControlType.RichText,title:\"Content\"},speed:{type:ControlType.Number,title:\"Speed\",min:0,max:100,step:1},gap:{type:ControlType.Number,title:\"Gap\",min:0,max:500,step:1},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"left\",\"right\",\"top\",\"bottom\"],defaultValue:\"left\",displaySegmentedControl:true},hover:{type:ControlType.Number,title:\"Hover Speed\",min:0,max:1,step:.1,defaultValue:1},cornerRadius:{type:ControlType.Number,title:\"Corner Radius\",min:0,max:100,step:1,defaultValue:0},showAlt:{type:ControlType.Boolean,title:\"Show Alt Text\",defaultValue:false},altSpacing:{type:ControlType.Number,title:\"Alt Spacing\",min:0,max:100,step:1,defaultValue:8,hidden(props){return!props.showAlt;}},altColor:{type:ControlType.Color,title:\"Alt Color\",defaultValue:\"#000000\",hidden(props){return!props.showAlt;}},altFont:{type:ControlType.Font,controls:\"extended\",title:\"Alt Font\",hidden(props){return!props.showAlt;}},draggable:{type:ControlType.Boolean,title:\"Draggable\",defaultValue:false,description:\"v1.3 \\n[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RichTextTicker\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Tickerfield.map"],
  "mappings": "mLAKkB,SAARA,EAAgCC,EAAM,CAAC,GAAK,CAAC,SAAAC,EAAS,MAAAC,EAAM,IAAAC,EAAI,UAAAC,EAAU,MAAAC,EAAM,aAAAC,EAAa,QAAAC,EAAQ,WAAAC,EAAW,QAAAC,EAAQ,SAAAC,EAAS,UAAAC,CAAS,EAAEX,EAAYY,EAAmBC,EAAO,IAAI,EAAQC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QAAQ,MAAM,YAAY,aAAa,GAAM,YAAY;AAAA,2CAAmD,CAAC,CAAC",
  "names": ["RichTextTicker", "props", "richText", "speed", "gap", "direction", "hover", "cornerRadius", "showAlt", "altSpacing", "altFont", "altColor", "draggable", "containerRef", "pe", "contentRef", "contentSize", "setContentSize", "ye", "dragStartPos", "currentTranslate", "isDragging", "lastDragPosition", "ue", "updateSize", "items", "halfLength", "totalSize", "i", "window", "animationFrameId", "animate", "scrollSize", "transform", "handleMouseDown", "computedStyle", "handleMouseMove", "handleMouseUp", "currentPos", "delta", "handleTouchStart", "touch", "handleTouchMove", "handleTouchEnd", "containerStyle", "contentStyle", "itemStyle", "renderContent", "j", "child", "index", "p", "u", "q", "RenderTarget", "addPropertyControls", "ControlType"]
}
