!function(e){function i(s,d){var i,o,m=s.find(".premium-video-box-container"),e=s.find(".premium-video-box-playlist-container"),t=m.find(".premium-video-box-video-container"),l=m.find(".premium-video-box-inner-wrap"),c=l.find(".premium-video-box-image-container"),a=m.data("type"),r=m.data("thumbnail"),n=m.data("sticky"),p=m.data("sticky-play"),f=m.data("hover"),v=e.length?e:m,u=!!v.data("lightbox")&&v.data("lightbox");if(u)"prettyphoto"===u.type&&v.find(".premium-vid-lightbox-container[data-rel^='prettyPhoto']").prettyPhoto({theme:u.theme,hook:"data-rel",opacity:.7,show_title:!1,deeplinking:!1,overlay_gallery:!0,custom_markup:"",default_width:900,default_height:506,social_tools:""}),v.find(".premium-video-box-image-container, .premium-video-box-play-icon-container").on("click",function(e){var i;i=d(this).closest(".premium-video-box-container"),"elementor"===u.type?i.find(".premium-video-box-video-container").trigger("click"):i.find(".premium-vid-lightbox-container[data-rel^='prettyPhoto']").trigger("click")});else{if(e.length){if(!t.length)return;return void t.each(function(e,i){var o,t=d(i),a=t.closest(".premium-video-box-container"),r=t.closest(".premium-video-box-trigger");o=t.data("src"),o+="&autoplay=1",r.on("click",function(){var e=d("<iframe/>");e.attr({src:o,frameborder:"0",allowfullscreen:"1",allow:"autoplay;encrypted-media;"}),t.css("background","#000"),t.html(e),a.find(".premium-video-box-image-container, .premium-video-box-play-icon-container").remove()})})}if("self"===a){if(i=t.find("video"),o=i.attr("src"),m.data("play-viewport"))new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(m.data("play-reset")&&"up"===window.paDirection?(m.removeClass("playing"),d(i).get(0).currentTime=0):b())})}).observe(m[0])}else if(o=t.data("src"),r&&-1===o.indexOf("autoplay=1"))o+="&autoplay=1";else if(m.data("play-viewport"))new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&b()})},{threshold:"0.5"}).observe(m[0]);else b();if(m.on("click",function(){b()}),"yes"!==n||"yes"===p)return;y()}function b(){if(!m.hasClass("playing")){if(m.addClass("playing"),"yes"===p&&y(),"self"===a)d(i).get(0).play(),t.css({opacity:"1",visibility:"visible"});else{var e=d("<iframe/>");e.attr({src:o,frameborder:"0",allowfullscreen:"1",allow:"autoplay;encrypted-media;"}),t.css("background","#000"),t.html(e)}m.find(".premium-video-box-image-container, .premium-video-box-play-icon-container, .premium-video-box-description-container").remove(),"vimeo"===a&&m.find(".premium-video-box-vimeo-wrap").remove()}}function y(){var o=m.data("hide-desktop"),t=m.data("hide-tablet"),a=m.data("hide-mobile"),r=m.data("sticky-margin");m.off("click").on("click",function(e){var i=e.target.className;if(0<=i.toString().indexOf("premium-video-box-sticky-close")||0<=i.toString().indexOf("premium-video-box-sticky-close"))return!1;b()});var i=new IntersectionObserver(function(e){e.forEach(function(e){if(e.isIntersecting)if("down"===window.paDirection){if(m.removeClass("premium-video-box-sticky-hide").addClass("premium-video-box-sticky-apply premium-video-box-filter-sticky"),s.hasClass("elementor-motion-effects-parent")&&s.removeClass("elementor-motion-effects-perspective").find(".elementor-widget-container").addClass("premium-video-box-transform"),m.data("mask")&&(s.find(".premium-video-box-mask-filter").removeClass("premium-video-box-mask-filter"),m.find(":first-child").removeClass("premium-video-box-mask-media"),c.removeClass(f).removeClass("premium-video-box-mask-media").css({transition:"width 0.2s, height 0.2s","-webkit-transition":"width 0.2s, height 0.2s"})),d(document).trigger("premium_after_sticky_applied",[s]),l.data("video-animation")&&" "!=l.data("video-animation")){l.css("opacity","0");var i=l.data("delay-animation");setTimeout(function(){l.css("opacity","1").addClass("animated "+l.data("video-animation"))},1e3*i)}}else m.removeClass("premium-video-box-sticky-apply  premium-video-box-filter-sticky").addClass("premium-video-box-sticky-hide"),s.hasClass("elementor-motion-effects-parent")&&s.addClass("elementor-motion-effects-perspective").find(".elementor-widget-container").removeClass("premium-video-box-transform"),m.data("mask")&&(m.parent().addClass("premium-video-box-mask-filter"),m.find(":first-child").eq(0).addClass("premium-video-box-mask-media"),c.addClass("premium-video-box-mask-media")),c.addClass(f).css({transition:"all 0.2s","-webkit-transition":"all 0.2s"}),l.removeClass("animated "+l.data("video-animation"))})},{threshold:1});function n(e){var i=elementorFrontend.getCurrentDeviceMode();[o,t,a].includes(i)?(e.unobserve(m[0]),m.removeClass("premium-video-box-sticky-apply premium-video-box-sticky-hide")):e.observe(m[0])}function e(){m.hasClass("premium-video-box-sticky-apply")&&l.draggable({start:function(){d(this).css({transform:"none",top:d(this).offset().top+"px",left:d(this).offset().left+"px"})},containment:"window"})}i.observe(m[0]),s.find(".premium-video-box-sticky-close").off("click.closetrigger").on("click.closetrigger",function(e){e.stopPropagation(),i.unobserve(m[0]),m.removeClass("premium-video-box-sticky-apply premium-video-box-sticky-hide"),s.hasClass("elementor-motion-effects-parent")&&s.addClass("elementor-motion-effects-perspective").find(".elementor-widget-container").removeClass("premium-video-box-transform"),m.data("mask")&&(m.parent().addClass("premium-video-box-mask-filter"),m.find(":first-child").eq(0).addClass("premium-video-box-mask-media"),c.addClass("premium-video-box-mask-media"))}),n(i),e(),window.addEventListener("scroll",e),d(window).resize(function(e){n(i)}),d(document).on("premium_after_sticky_applied",function(e,i){var o=i.find(".premium-video-box-sticky-infobar");if(0!==o.length){var t=o.outerHeight();if((i.hasClass("premium-video-sticky-center-left")||i.hasClass("premium-video-sticky-center-right"))&&(t=Math.ceil(t/2),l.css("top","calc( 50% - "+t+"px )")),(i.hasClass("premium-video-sticky-bottom-left")||i.hasClass("premium-video-sticky-bottom-right"))&&""!==r){var a=(t=Math.ceil(t))+r;l.css("bottom",a)}}})}}e(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/premium-addon-video-box.default",i)})}(jQuery);