!function(e){const o=function(e,o){const n=e.attr("data-id");let t=o(".wcf--popup-video-wrapper").first();t.parent().is("body")||o("body > .wcf--popup-video-wrapper").length||t.appendTo("body");o(`.elementor-element-${n} .wcf-post-popup,.wcf-post-popup`).each(function(n){o(this).next(".wcf--popup-video-wrapper").remove(),o(this).off("click").on("click",function(){let n=o(this).attr("data-src");if(o(".wcf--popup-video-wrapper").find(".aae-popup-content-container").html(""),o(this).hasClass("audio")&&o(".wcf--popup-video-wrapper").find(".aae-popup-content-container").html(`<div class="audio wcf-audio-wrapper-clean">\n                        <audio controls>\n                            <source src="${n}" type="audio/mpeg">\n                        </audio>\n                    </div>`),o(this).hasClass("video")&&o(".wcf--popup-video-wrapper").find(".aae-popup-content-container").html(`<iframe  src="${n}" ></iframe>`),o(this).hasClass("gallery")){let n=e.find(".aae-post-gallery-wrapper").clone();o(".wcf--popup-video-wrapper").find(".aae-popup-content-container").html(n);new Swiper(".aae-popup-content-container .gallery-slider",{speed:"1500",navigation:{nextEl:".btn-next",prevEl:".btn-prev"}})}window.VideoAnimation=gsap.timeline({defaults:{ease:"power2.inOut"}}).to("body > .wcf--popup-video-wrapper",{scaleY:.01,x:1,opacity:1,visibility:"visible",duration:.4}).to("body > .wcf--popup-video-wrapper",{scaleY:1,duration:.6}).to("body > .wcf--popup-video-wrapper .wcf--popup-video",{scaleY:1,opacity:1,visibility:"visible",duration:.6},"-=0.4")})}),o(".audio-duration-wrapper",e).each(function(){const e=o(this),n=e.attr("data-link");if(n){const t=new Audio(n);t.addEventListener("loadedmetadata",function(){const o=Math.floor(t.duration),n=Math.floor(o/60),i=o%60;e.find(".audio-duration").text(`${n}:${i<10?"0":""}${i}`)}),e.find(".audio-icon").on("click",function(){if(t.paused){t.play(),o(this).find(".play-icon").hide(),o(this).find(".pause-icon").show();const n=setInterval(function(){const o=Math.floor(t.duration-t.currentTime),i=Math.floor(o/60),a=o%60;e.find(".audio-duration").text(`${i}:${a<10?"0":""}${a}`),o<=0&&(clearInterval(n),e.find(".play-icon").show())},1e3)}else t.pause(),o(this).find(".pause-icon").hide(),o(this).find(".play-icon").show()}),t.addEventListener("error",function(){console.error(`Could not load audio from: ${n}`),e.find(".audio-duration").text("Error")})}})};e(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/wcf--feature-posts.default",o),elementorFrontend.hooks.addAction("frontend/element_ready/wcf--posts-pro.default",o),elementorFrontend.hooks.addAction("frontend/element_ready/wcf--banner-posts.default",o),elementorFrontend.hooks.addAction("frontend/element_ready/wcf--filterable-gallery.default",o),elementorFrontend.hooks.addAction("frontend/element_ready/wcf--posts-filter.default",o),elementorFrontend.hooks.addAction("frontend/element_ready/wcf--posts-slider.default",o),elementorFrontend.hooks.addAction("frontend/element_ready/wcf--posts-timeline.default",o)})}(jQuery);