!function(t){"use strict";function e(t){this.$el=t,this.sections=[],this.sectionEls=[...this.$el[0].querySelectorAll(".nectar-post-grid-item")],this.usingFrontEndEditor=!(!window.nectarDOMInfo||!window.nectarDOMInfo.usingFrontEndEditor),this.gap=20,this.activeIndex=0,this.stackingEffect=!0,this.subtractNavHeight=this.$el[0].classList.contains("subtract-nav-height"),this.usingNavigation=!1,this.navigationButtons=[],this.startingIndex=0,this.effect="none",this.init()}e.prototype.init=function(){this.effectConfig(),"none"===this.effect||"overlapping"===this.effect||t("body").hasClass("using-mobile-browser")&&this.$el.hasClass("layout-stacked--disable-mobile")||(this.navigation(),this.calculateGap(),this.createTimelines(),this.calculateOffsets(),this.events(),this.raf(),this.setStartingIndex(),this.navHighlight())},e.prototype.setStartingIndex=function(){const t=window.nectarDOMInfo&&window.nectarDOMInfo.scrollTop?window.nectarDOMInfo.scrollTop:window.scrollY;this.sections.forEach((e,i)=>{e.offset-e.elementHeight/2<t&&e.offset+e.elementHeight/2>t&&(this.startingIndex=i)})},e.prototype.effectConfig=function(){this.calculateGap();const t=this.$el[0].getAttribute("data-stack-animation-effect");t&&(this.effect=t),this.effects={none:{},overlapping:{},scale:{scale:[1,.8]},blurred_scale:{scale:[1,.8],filter:["blur(0px)","blur(5px)"]}},"overlapping"===this.effect&&this.sectionEls.forEach((t,e)=>{const i=this.gap+16*e;t.style.top=i+"px"})},e.prototype.navigation=function(){if(this.$el[0].querySelector(".nectar-sticky-media-section__navigation")){this.usingNavigation=!0,this.navigationButtons=[...this.$el[0].querySelectorAll(".nectar-sticky-media-section__navigation button")];var t=this;this.$el[0].querySelectorAll(".nectar-sticky-media-section__navigation button").forEach(function(e,i){e.addEventListener("click",function(){t.scrollToSection(i)})})}},e.prototype.scrollToSection=function(t){var e=this.sections[t].offset;window.scrollTo({top:e,behavior:"smooth"})},e.prototype.events=function(){t(window).on("resize",()=>{this.calculateGap(),this.calculateOffsets()}),t(window).on("load",()=>{this.calculateGap(),this.createTimelines(),this.calculateOffsets()}),this.observe()},e.prototype.createTimelines=function(t){this.sectionEls.forEach((t,e)=>{const i=t.querySelector(":scope > .inner");this.sections[e]={element:t,innerElement:i,elementHeight:t.offsetHeight,timeline:anime.timeline({autoplay:!1})},this.sections[e].timeline.add({duration:1e3,easing:"linear",targets:t,...this.effects[this.effect]})})},e.prototype.navHighlight=function(){this.usingNavigation&&(this.navigationButtons.forEach(function(t,e){t.classList.remove("active")}),this.navigationButtons[this.activeIndex].classList.add("active"))},e.prototype.calculateGap=function(){const t=this.$el[0].getAttribute("data-grid-spacing");if(t){const e=window.nectarDOMInfo&&window.nectarDOMInfo.winW?window.nectarDOMInfo.winW:window.innerWidth;if(t.includes("vw")){const i=parseInt(t);this.gap=e*(i/100)}else this.gap="none"===t?0:parseInt(t)}},e.prototype.calculateOffsets=function(){const t=window.nectarDOMInfo&&window.nectarDOMInfo.scrollTop?window.nectarDOMInfo.scrollTop:window.scrollY,e=this.$el[0].getBoundingClientRect().top+t;this.sectionEls.forEach((t,i)=>{const n=this.gap;t.style.top=n+"px";const s=this.gap,o=e-this.gap+t.offsetHeight*i+s*i;this.sections[i].offset=o,this.sections[i].elementHeight=t.offsetHeight})},e.prototype.raf=function(){const t=window.nectarDOMInfo&&window.nectarDOMInfo.scrollTop?window.nectarDOMInfo.scrollTop:window.scrollY;this.sections.forEach((e,i)=>{if(e.offset-300<t&&i!==this.sections.length-1){const n=(t-e.offset)/e.elementHeight;0===this.startingIndex&&i!==this.activeIndex&&i!==this.activeIndex-1||e.timeline.seek(n*e.timeline.duration)}i<this.activeIndex-1?e.innerElement.style.visibility="hidden":e.innerElement.style.visibility="visible";const n=e.elementHeight/2;e.offset-n<t&&e.offset+n>t&&this.activeIndex!==i&&this.setActiveIndex(i)}),window.requestAnimationFrame(this.raf.bind(this))},e.prototype.setActiveIndex=function(t){this.activeIndex=t,this.navHighlight()},e.prototype.observe=function(){var t=this;this.observer=new IntersectionObserver(function(e){e.forEach(function(e){if(e.isIntersecting){var i=e.target.querySelector(".nectar-sticky-media-section__media video");i&&0==i.currentTime&&t.playSectionVideo(i),t.observer.unobserve(e.target)}})},{rootMargin:"-5% 0% -5% 0%",threshold:0}),this.sectionEls.forEach(e=>{t.observer.observe(e)})},e.prototype.playSectionVideo=function(t){var e=this;t.readyState>=2?(t.pause(),t.currentTime=0,t.play()):setTimeout(function(){e.playSectionVideo(t)},70)};var i=[];function n(){i=[],t(".nectar-post-grid.layout-stacked").each(function(n){i[n]=new e(t(this))})}t(document).ready(function(){n(),t(window).on("vc_reload",function(){setTimeout(n,200)})})}(jQuery);