const initRiveAnimation=(e=document)=>{let a=(a=e)=>{a.querySelectorAll("canvas[data-canvas-type='rive']").forEach(e=>{let a=e.getAttribute("data-canvas-src"),t=e.getAttribute("data-canvas-alt"),n=e.getAttribute("data-canvas-controllers"),r=e.getAttribute("data-canvas-id"),s=new rive.Rive({src:a,canvas:e,autoplay:!0,stateMachines:t,onLoad(a){if(s.resizeDrawingSurfaceToCanvas(),window[r]=s,e.classList.add("loaded"),t){let o=s.stateMachineInputs(t);o&&o.length>0&&o.forEach(e=>{let a=[];try{(a=JSON.parse(n||"[]"))&&a.length>0&&a.forEach(a=>{a.name==e.name&&(e.value=a.value)})}catch(t){console.error("Error parsing data-canvas-controllers. It should be a valid JSON array string.",{error:t,value:n})}})}}})})},t=()=>{let e=document.getElementById("rive-js");if(e)e.onload=()=>{a()};else{let t=document.createElement("script");t.src="https://unpkg.com/@rive-app/canvas/rive.js",t.id="rive-js",document.body.appendChild(t),t.onload=()=>{a()}}},n=e.querySelectorAll("canvas[data-canvas-type='rive']");if(n&&n.length>0){let r=!1;n.forEach(e=>{e.getAttribute("data-canvas-smart-lazy-load")&&(r=!0)}),r?(document.body.addEventListener("mouseover",t,{once:!0}),document.body.addEventListener("touchmove",t,{once:!0}),window.addEventListener("scroll",t,{once:!0}),document.body.addEventListener("keydown",t,{once:!0})):t()}};initRiveAnimation();