(()=>{"use strict";const t=(t,e)=>{if("string"==typeof t&&t.startsWith(`var:${e}`)){const i=t.split("|");if(3===i.length)return{source:i[0],color:i[1]||"",..."preset"===e?{slug:i[2]}:{id:i[2]}}}return!1},e=e=>{if(e){const i=t(e,"preset"),n=t(e,"global");return i?`var(--wp--preset--color--${i?.slug})`:n?`var(--ablocks-${n?.id})`:e}return""};class i{constructor(t,e=!1){this.contentTimeline=t,this.timelineElement=t.querySelector(".ablocks-block-content-timeline"),this.blockTopHeight=this.contentTimeline.getBoundingClientRect().top+window.scrollY,this.editor=e,this.arrowAlignment=this.timelineElement.getAttribute("data-arrow-alignment"),this.animationColor=this.timelineElement.getAttribute("data-animation-color"),this.showAnimation=this.timelineElement.getAttribute("data-show-animation"),this.lineElement=this.contentTimeline.querySelector(".ablocks-block-content-timeline__line"),this.lineInnerElement=this.contentTimeline.querySelector(".ablocks-block-content-timeline__line__inner"),this.childBlocks=Array.from(this.contentTimeline.querySelectorAll(".ablocks-block-content-timeline-child")),this.handleScroll=this.handleScroll.bind(this),this.updateTimeline=this.updateTimeline.bind(this);const i=document.querySelector(".interface-navigable-region.interface-interface-skeleton__content");this.editorDiv=i,this.init()}init(){this.updateTimeline(),this.handleScroll(),window.addEventListener("scroll",this.handleScroll)}updateTimeline(){if(0===this.childBlocks.length||!this.lineElement)return;const[t,e]=[this.childBlocks[0],this.childBlocks[this.childBlocks.length-1]],[i,n]=[t.getBoundingClientRect().height,e.getBoundingClientRect().height];switch(this.arrowAlignment){case"center":this.lineElement.style.top=i/2+"px",this.lineElement.style.bottom=n/2+"px";break;case"bottom":this.lineElement.style.top=`${i}px`,this.lineElement.style.bottom=n/n+"px";break;case"top":this.lineElement.style.top=i/i+"px",this.lineElement.style.bottom=`${n}px`}this.lineInnerElement.style.height="0px"}handleScroll(){var t;t=()=>{let t=0;const i=window.scrollY;this.childBlocks.forEach(n=>{t+=n.getBoundingClientRect().height;const l=n.querySelector(".ablocks-icon-wrap");i-this.blockTopHeight>t-n.getBoundingClientRect().height?"true"===this.showAnimation&&!1===this.editor&&(l.style.backgroundColor=e(this.animationColor)):l.style.backgroundColor=""}),this.lineInnerElement&&("true"===this.showAnimation&&(this.lineInnerElement.style.backgroundColor=e(this.animationColor)),this.editor||(this.lineInnerElement.style.height=i-this.blockTopHeight+"px"))},"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,16)}destroy(){window.removeEventListener("scroll",this.handleScroll)}}document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".ablocks-block--content-timeline").forEach(t=>{new i(t,!1)})})})();