{"version":3,"file":"Rive_v5.CWC1QdB3.mjs","names":["useMemo","useStateMachineInput","Rive","useRive","useRef"],"sources":["https:/framerusercontent.com/modules/zIrRZoIgteGH4KvNSVbF/D2qHCBehRtFnb90e8wcB/Rive_v5.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useMemo,useRef}from\"react\";import Rive,{useRive,useStateMachineInput}from\"@rive-app/react-canvas\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";// Mapping for fit options to Fit enum\nconst getFitValue=fit=>{switch(fit){case\"layout\":return Rive.Fit.Layout;case\"contain\":return Rive.Fit.Contain;case\"cover\":return Rive.Fit.Cover;case\"fill\":return Rive.Fit.Fill;case\"fitWidth\":return Rive.Fit.FitWidth;case\"fitHeight\":return Rive.Fit.FitHeight;case\"none\":return Rive.Fit.None;case\"scaleDown\":return Rive.Fit.ScaleDown;default:return Rive.Fit.Contain;}};// Mapping for alignment options to Alignment enum\nconst getAlignmentValue=alignment=>{switch(alignment){case\"center\":return Rive.Alignment.Center;case\"topLeft\":return Rive.Alignment.TopLeft;case\"topCenter\":return Rive.Alignment.TopCenter;case\"topRight\":return Rive.Alignment.TopRight;case\"centerLeft\":return Rive.Alignment.CenterLeft;case\"centerRight\":return Rive.Alignment.CenterRight;case\"bottomLeft\":return Rive.Alignment.BottomLeft;case\"bottomCenter\":return Rive.Alignment.BottomCenter;case\"bottomRight\":return Rive.Alignment.BottomRight;default:return Rive.Alignment.Center;}};function useRiveInputs(rive,stateMachines,inputsJSON){const inputConfigs=useMemo(()=>{try{return JSON.parse(inputsJSON||\"[]\");}catch(error){console.error(\"Error parsing inputsJSON:\",error);return[];}},[inputsJSON]);return inputConfigs.map(config=>{const handler=useStateMachineInput(rive,stateMachines,config.name,config.type===\"Trigger\"?true:config.value);return{...config,handler};});}/**\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerDisableUnlink\n */export default function RivePlayer_v5(props){const{src,artboard,stateMachines,autoplay,fit,alignment,play,playOnCanvas,onEventTriggered,inputsJSON,isTouchScrollEnabled,layoutScaleFactor}=props;const layout=useMemo(()=>new Rive.Layout({fit:getFitValue(fit),alignment:getAlignmentValue(alignment),...fit===\"layout\"&&{layoutScaleFactor}}),[fit,alignment,layoutScaleFactor]);const{rive,RiveComponent}=useRive({src,artboard,stateMachines,autoplay,layout,isTouchScrollEnabled:isTouchScrollEnabled});const inputs=useRiveInputs(rive,stateMachines,inputsJSON);const prevInputsRef=useRef(inputs);useEffect(()=>{if(rive&&inputs.length){inputs.forEach((input,index)=>{if(input.handler){const prevInput=prevInputsRef.current[index];if(input.type===\"Trigger\"&&input.value&&(!prevInput||!prevInput.value)){input.handler.fire();}else if(input.type!==\"Trigger\"&&\"value\"in input){input.handler.value=input.value;}}});}prevInputsRef.current=inputs;},[rive,inputs]);useEffect(()=>{if(rive){const handleEvent=event=>{console.log(\"Rive event triggered:\",event);if(onEventTriggered){onEventTriggered(event.data);console.log(\"Event data:\",event.data);}};rive.on(\"riveevent\",handleEvent);return()=>{rive.off(\"riveevent\",handleEvent);};}},[rive,onEventTriggered]);useEffect(()=>{if(rive){const shouldPlay=RenderTarget.current()===RenderTarget.canvas?playOnCanvas:play;shouldPlay?rive.play():rive.pause();}},[rive,play,playOnCanvas]);useEffect(()=>{if(rive){rive.layout=layout;}},[rive,layout]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\"},children:/*#__PURE__*/_jsx(RiveComponent,{style:{width:\"100%\",height:\"100%\"}})});}// Property controls\naddPropertyControls(RivePlayer_v5,{src:{title:\"Source\",type:ControlType.String},artboard:{title:\"Artboard\",type:ControlType.String},stateMachines:{title:\"State Machines\",type:ControlType.String},autoplay:{title:\"Autoplay\",type:ControlType.Boolean,hidden:()=>true},isTouchScrollEnabled:{title:\"Touch Screen Enabled\",type:ControlType.Boolean},fit:{title:\"Fit\",type:ControlType.Enum,options:[\"layout\",\"contain\",\"cover\",\"fill\",\"fitWidth\",\"fitHeight\",\"none\",\"scaleDown\"],optionTitles:[\"Layout\",\"Contain\",\"Cover\",\"Fill\",\"Fit Width\",\"Fit Height\",\"None\",\"Scale Down\"],defaultValue:\"contain\"},layoutScaleFactor:{title:\"Layout Scale Factor\",type:ControlType.Number,defaultValue:1,min:.25,max:10,displayStepper:true,step:.25,hidden:props=>props.fit!==\"layout\"},alignment:{title:\"Alignment\",type:ControlType.Enum,options:[\"center\",\"topLeft\",\"topCenter\",\"topRight\",\"centerLeft\",\"centerRight\",\"bottomLeft\",\"bottomCenter\",\"bottomRight\"],optionTitles:[\"Center\",\"Top Left\",\"Top Center\",\"Top Right\",\"Center Left\",\"Center Right\",\"Bottom Left\",\"Bottom Center\",\"Bottom Right\"],defaultValue:\"center\"},play:{title:\"Auto-Play\",type:ControlType.Boolean},playOnCanvas:{title:\"Play on Canvas\",type:ControlType.Boolean},onEventTriggered:{type:ControlType.EventHandler},inputsJSON:{title:\"Inputs JSON\",type:ControlType.String,hidden:()=>true}});// Default props\nRivePlayer_v5.defaultProps={src:\"https://public.rive.app/hosted/63978/135405/cRjq3a7l40ScM-l2peKfBQ.riv\",artboard:\"AB_BG\",stateMachines:\"SM_BG\",autoplay:true,fit:\"contain\",alignment:\"center\",play:true,playOnCanvas:true,onEventTriggered:eventData=>null,inputsJSON:\"[]\",isTouchScrollEnabled:false,layoutScaleFactor:1};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RivePlayer_v5\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Rive_v5.map"],"mappings":"4PAEohB,SAAS,EAAc,EAAK,EAAc,EAAW,CAAkK,OAA9IA,MAAY,CAAC,GAAG,CAAC,OAAO,KAA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