"use strict";(self.blocksyJsonP=self.blocksyJsonP||[]).push([[806,87],{9679:function(e,t,n){n.d(t,{Kz:function(){return o},Vz:function(){return a},pF:function(){return s},r:function(){return c},v3:function(){return r},zT:function(){return i}});const i=function(e){e.closest(".ct-media-container, .ct-dynamic-media").dataset.state="playing"},o=function(e){e&&(e.matches("video")?e.play():e.matches('iframe[src*="youtu"]')?e.contentWindow.postMessage(JSON.stringify({event:"command",func:"playVideo"}),"*"):e.matches('iframe[src*="vimeo"]')&&e.contentWindow.postMessage(JSON.stringify({method:"play"}),"*"))},r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};e&&(e.matches("video[autoplay]")||e.matches('iframe[src*="youtu"][src*="autoplay=1"]')||e.matches('iframe[src*="vimeo"][src*="autoplay=1"]')?(t(),o(e)):n())},a=function(e){e.closest(".ct-media-container, .ct-dynamic-media").dataset.state="paused"},c=function(e){if(e)if(e.matches("video"))e.pause();else if(e.matches('iframe[src*="youtu"]'))e.contentWindow.postMessage(JSON.stringify({event:"command",func:"pauseVideo"}),"*");else if(e.matches('iframe[src*="vimeo"]'))e.contentWindow.postMessage(JSON.stringify({method:"pause"}),"*");else if(e.matches("iframe")){const t=e.src;e.src="",e.src=t}},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};if(e){if(e.matches("video")&&e.addEventListener("loadeddata",(function(){t("ready"),e.addEventListener("play",(function(){return t("play")})),e.addEventListener("pause",(function(){return t("pause")}))})),e.matches('iframe[src*="youtu"]'))return window.addEventListener("message",(function(n){if(n.data&&n.source===e.contentWindow)try{const e=JSON.parse(n.data);"onStateChange"===e.event&&(1===e.info&&t("play"),2===e.info&&t("pause"))}catch(n){}})),void e.addEventListener("load",(function(){e.contentWindow.postMessage(JSON.stringify({event:"listening",id:1,channel:"widget"}),"*"),e.contentWindow.postMessage(JSON.stringify({event:"command",func:"addEventListener",args:["onStateChange"],id:1,channel:"widget"}),"*"),t("ready")}));e.matches('iframe[src*="vimeo"]')&&window.addEventListener("message",(function(n){if(n.data&&n.source===e.contentWindow)try{const i=JSON.parse(n.data);"ready"===i.event&&(e.contentWindow.postMessage(JSON.stringify({method:"addEventListener",value:"pause"}),"*"),e.contentWindow.postMessage(JSON.stringify({method:"addEventListener",value:"play"}),"*"),t(i.event)),"pause"!==i.event&&"play"!==i.event||t(i.event)}catch(n){}}))}}},4087:function(e,t,n){n.r(t),n.d(t,{fetchVideoBy:function(){return u},mount:function(){return y}});var i=n(9679),o=n(2248);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};t=a({ignoreVideoOptions:!1},t);let n=ct_localizations.ajax_url+"?action=blocksy_get_image_video_component&media="+e;return t.ignoreVideoOptions&&(n+="&ignore_video_options=true"),new Promise((function(e){(function(e){return s[e]?new Promise((function(t){t(s[e]),s[e]=s[e].clone()})):new Promise((function(t){return fetch(e).then((function(n){t(n),s[e]=n.clone()}))}))})(n).then((function(t){200===t.status&&t.json().then((function(t){let{success:n,data:i}=t;n&&e(i)}))}))}))},d=function(e){e.querySelector(".ct-video-indicator").classList.add("loading"),u(e.dataset.mediaId).then((function(t){const n=document.createElement("div");n.innerHTML=t.html;const o=n.firstChild;e.insertAdjacentElement("beforeend",o);const r=e.querySelector("video,iframe");!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=a({onPause:function(){},onPlay:function(){},onReady:function(){}},t),e.isListeningForStateChanges||(e.isListeningForStateChanges=!0,(0,i.pF)(e,(function(n){"pause"===n&&((0,i.Vz)(e),t.onPause()),"play"===n&&(t.onPlay(),(0,i.zT)(e)),"ready"===n&&t.onReady()})))}(r,{onPlay:function(){setTimeout((function(){e.querySelector(".ct-video-indicator").classList.remove("loading")}),120)},onReady:function(){(0,i.Kz)(r)}})}))},f=function(e){const t=ct_localizations.dynamic_styles_selectors.find((function(e){return".ct-media-container[data-media-id], .ct-dynamic-media[data-media-id]"===e.selector}));(0,o.Xr)(t.url).then((function(){d(e)}))};ctEvents.on("blocksy:frontend:flexy:slide-change",(function(e){let{instance:t,payload:n}=e;[...t.sliderContainer.querySelectorAll("video,iframe")].map((function(e){return(0,i.r)(e)}));const o=t.sliderContainer.children[n.currentIndex].querySelector(".ct-media-container[data-media-id], .ct-dynamic-media[data-media-id]");if(!o)return;const r=o.querySelector("video,iframe");r?(0,i.v3)(r):l(o,{performVisibilityCheck:!1})}));const l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t=a({performVisibilityCheck:!0},t),!e.matches('[data-state*="autoplay"]'))return;let n=!0;if(t.performVisibilityCheck&&e.closest(".flexy-items")){const t=e.getBoundingClientRect(),i=e.closest(".flexy-items").getBoundingClientRect();n=t.left>=i.left&&t.left<=i.left+i.width&&t.top>=i.top&&t.top<=i.top+i.height}n&&(e.removeAttribute("data-state"),f(e))};let m=!1;const y=function(e,t){let{event:n}=t;if(!n||"scroll"===n.type){if(m)return;return m=!0,void[...document.querySelectorAll(".ct-media-container[data-media-id]")].map((function(e){l(e)}))}const o=e.querySelector("video,iframe");o?e.matches('[data-state="playing"]')?(0,i.r)(o):(0,i.Kz)(o):f(e)}}}]);