"use strict";(globalThis.blocksyJsonP=globalThis.blocksyJsonP||[]).push([[957],{9948(e,t,n){n.d(t,{F:function(){return o}});const o=function(e){return e&&"[object Function]"==={}.toString.call(e)?e():e}},9680(e,t,n){n.d(t,{e:function(){return o}});const o=function(){return"undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1)}},6338(e,t,n){n.r(t),n.d(t,{fetchVideoBy:function(){return s},mount:function(){return m}});var o=n(9338),i=n(9680),a=n(6555),c=n(9948);const r={},s=function(e,t={}){t={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 r[e]?new Promise(function(t){t(r[e]),r[e]=r[e].clone()}):new Promise(function(t){return fetch(e).then(function(n){t(n),r[e]=n.clone()})})})(n).then(function(t){200===t.status&&t.json().then(function({success:t,data:n}){t&&e(n)})})})},d=function(e){e.querySelector(".ct-video-indicator").classList.add("loading");const t=e.dataset.state&&-1!==e.dataset.state.indexOf("hover")&&-1!==e.dataset.state.indexOf("revert");s(e.dataset.mediaId).then(function(n){const a=document.createElement("div");a.innerHTML=n.html;const c=a.firstChild;e.querySelector(".ct-dynamic-media-inner")?e.querySelector(".ct-dynamic-media-inner").insertAdjacentElement("beforeend",c):e.insertAdjacentElement("beforeend",c);const r=e.querySelector("video,iframe"),s=r.closest(".flexy-container[data-autoplay]"),d=s?.flexy;!function(e,t={}){t={onPause:function(){},onPlay:function(){},onReady:function(){},...t},e.isListeningForStateChanges||(e.isListeningForStateChanges=!0,(0,o.k7)(e,function(n){"pause"===n&&((0,o.Hl)(e),t.onPause()),"play"===n&&(t.onPlay(),(0,o.dP)(e)),"ready"===n&&t.onReady()}))}(r,{onPlay:function(){setTimeout(function(){e.querySelector(".ct-video-indicator").classList.remove("loading")},120),d&&(d.options={...d.options,autoplay:!1,_autoplay:!1})},onPause:function(){d&&(d.options={...d.options,autoplay:parseInt(s.dataset.autoplay),_autoplay:parseInt(s.dataset.autoplay)},d.state={...d.state,lastTimeAnimated:(new Date).getTime()}),t&&!e.classList.contains("ct-simplified-player")&&(e.dataset.state="hover:paused")},onReady:function(){(0,i.e)()&&(0,o.jw)(r),(0,o._b)(r)}})})},u=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});t&&(0,a.MK)(t.url).then(function(){d(e)})};ctEvents.on("blocksy:frontend:flexy:slide-change",function({instance:e,payload:t}){const n=(0,c.F)(e.sliderContainer);[...n.querySelectorAll("video,iframe")].map(function(e){return(0,o.WY)(e)});const i=n.children[t.currentIndex].querySelector(".ct-media-container[data-media-id], .ct-dynamic-media[data-media-id]");if(!i)return;const a=i.querySelector("video,iframe");a?(0,o.iY)(a):l(i,{performVisibilityCheck:!1})}),ctEvents.on("blocksy:ajax:filters:done",function(){[...document.querySelectorAll(".ct-media-container[data-media-id]")].map(function(e){l(e)})});const l=function(e,t={}){if(t={performVisibilityCheck:!0,...t},!e.matches('[data-state*="autoplay"]'))return;let n=!0;if(t.performVisibilityCheck&&e.closest(".flexy-items")){const t=e.getBoundingClientRect(),o=e.closest(".flexy-items").getBoundingClientRect();n=t.left>=o.left&&t.left<=o.left+o.width&&t.top>=o.top&&t.top<=o.top+o.height}n&&(e.removeAttribute("data-state"),u(e))};let f=!1;const m=function(e,{event:t}){if(!t||"scroll"===t.type){if(f)return;f=!0;const e=function(){[...document.querySelectorAll(".ct-media-container[data-media-id], .ct-dynamic-media[data-media-id]")].map(function(e){l(e)})};return ctEvents.on("blocksy:frontend:init",function(){e()}),void e()}t&&"mouseover"===t.type&&(e.hasMouseLeaveListener||(e.hasMouseLeaveListener=!0,e.addEventListener("mouseenter",function(){const t=e.querySelector("video,iframe");(0,o._b)(t)}),-1!==e.dataset.state.indexOf("revert")&&e.addEventListener("mouseleave",function(){const t=e.querySelector("video,iframe");(0,o.WY)(t,{shouldRevert:!0})})));if(e.querySelector("video")&&!e.closest(".ct-simplified-player"))return;const n=e.querySelector("video,iframe");n?e.matches('[data-state="playing"]')?(0,o.WY)(n):(0,o._b)(n):u(e)}}}]);