document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".wp-block-zolo-video").forEach(e=>{const t=e.querySelector?e.querySelector("video"):e.getElementsByTagName("video")[0],o=JSON.parse(e?.getAttribute("data-settings")),n=e.querySelector(".zolo-video-play"),r=o?.startTime,i=o?.endTime,a=o?.hoverPlayPause,u=o?.autoPlay,s=e.querySelector(".popup-trigger-button"),l=e.querySelector(".video-player-popup-content");if(s&&l&&"undefined"!=typeof FsLightbox&&(!s.hasAttribute("target")||"_blank"!==s.getAttribute("target"))){const e=new FsLightbox;e.props.sources=[l],s.addEventListener("click",function(t){t.preventDefault(),e.open()})}const c=e.querySelector(".zolo-inline-thumbnail-overlay");if(c){e.querySelector(".default-video-message");const o=e.querySelector("iframe.video-iframe");c.addEventListener("click",function(){if(c.style.transition="opacity 0.3s ease",c.style.opacity="0",c.style.pointerEvents="none",setTimeout(function(){c.style.display="none"},320),t&&t.play().catch(function(e){console.error("Video play error:",e)}),o){var e,n=o.getAttribute("src")||"";n&&(-1===(e=-1!==n.indexOf("autoplay=")?n.replace(/autoplay=\d/,"autoplay=1"):n+(-1!==n.indexOf("?")?"&":"?")+"autoplay=1").indexOf("mute=")&&-1===e.indexOf("muted=")&&(-1===e.indexOf("youtube")&&-1===e.indexOf("youtu.be")||(e+="&mute=1")),o.setAttribute("src",e))}})}if(t){if(u&&t.play().catch(e=>{console.error("Error Playing video:",e)}),r&&r>0&&(t.currentTime=r),i&&i>0&&(t.ontimeupdate=function(){t.currentTime>i&&t.pause()}),a){const e=()=>t.play(),o=()=>t.pause();return t.addEventListener("mouseenter",e),t.addEventListener("mouseleave",o),()=>{t.removeEventListener("mouseenter",e),t.removeEventListener("mouseleave",o)}}n&&n.addEventListener("click",()=>{t.paused?(t.play(),n.textContent="Pause"):(t.pause(),n.textContent="Play")})}})});