((t,e,i,s)=>{"use strict";let l=!1,o=!1;const r=new Map,c="m"===s.is_sticky&&~~themify_vars.breakpoints.tablet[1],f=e=>{!0!==l&&requestAnimationFrame((()=>{const s=i.scrollY,l=e||r;for(let[e,i]of l){if("disable"===i)continue;let l=e.classList.contains("tb_sticky_scroll_active");if(!0===i.isBottom&&s+t.h>=i.space||!0!==i.isBottom&&s>i.space){let s=e.style;if(!1===l&&(e.parentNode.style.height=i.h+"px",s.position="fixed",!0===i.isBottom?(s.top="",s.bottom=i.stick.v+(i.u||"px")):(e.style.bottom="",s.top=i.value),s.width=i.w+"px",e.classList.add("tb_sticky_scroll_active")),i.unstick&&i.unstick.item){let l,o=i.unstick,c=parseInt(i.value),f=o.item.getBoundingClientRect();"builder"===o.type?l=f.bottom-i.h-c:(l="passes"===o.r?f.bottom-c:f.top-i.h-c,"top"!==o.cur&&"bottom"!==o.cur||(l+=o.v,"bottom"===o.cur&&(l-=t.h))),l=l<0?l+c+"px":i.value,i.currentTop!==l?(i.currentTop=l,r.set(e,{...r.get(e),...i}),!0===i.isBottom&&(s.bottom=""),s.top=l):!0===i.isBottom&&(s.top="",s.bottom=i.stick.v+(i.u||"px"))}}else!0===l&&n(e)}}))},n=t=>{const e=t.style;e.width=e.top=e.bottom=e.position=t.parentNode.style.height="",t.classList.remove("tb_sticky_scroll_active")},_=(s,l)=>{const o=s.classList.contains("tb_sticky_scroll_active");if(!1===o||!0===l){let c=r.get(s);if(void 0===c||!0===l){if(c=(e=>{let i=!1,s=themify_vars?.breakpoints||{};for(let l=Object.keys(s),o=l.length-1;o>-1;--o){let r=l[o],c="tablet_landscape"===r?"tl":r[0];if(void 0!==e[c]&&("mobile"!==r?s[r][1]:s[r])>=t.w){i=e[c];break}}return!1===i&&(i=e.d),i})(JSON.parse(s.dataset.stickyActive)),!c)return r.set(s,"disable"),void n(s);const i=c.stick||{},l=i.v?parseInt(i.v):0,o=c.unstick,f=i.u||"px";if("px"!==f?c.u=f:c.value=l+f,c.v=l,"bottom"===i.p&&(c.isBottom=!0),o){let t,i=s.closest(".themify_builder_content");if("builder"===o.type){let s=i.closest("#tbp_header");s&&(s=e.tfId("tbp_content")?.tfClass("themify_builder_content")[0]||e.tfClass("themify_builder_content")[1],s&&(i=s)),t=i}else"row"===o.type&&(t=i.tfClass("tb_"+o.el)[0]),t??=i.tfClass("tb_"+o.el)[0],t&&(o.v=parseInt(o.v));t&&(o.item=t)}if(!s.parentNode.classList.contains("tb_sticky_wrapper")){const e=t.createElement("","tb_sticky_wrapper");s.before(e),e.appendChild(s)}}else if("disable"===c)return;let f="",_=c.v;!0===o&&(s.style.position="",f=s.style.top,s.style.top=""),s.style.width="";const b=s.getBoundingClientRect();c.w=b.width>0?b.width:s.offsetWidth,c.h=b.height>0?b.height:s.offsetHeight,"%"===c.u&&0!==_&&(_=_/100*t.h),!0===c.isBottom&&(_=t.h-_-c.h),c.value=_+"px",c.space=void 0!==c.isBottom?b.bottom+i.pageYOffset+_:b.top+i.pageYOffset-_,c.t=b.top,s.parentNode.style.height!==c.h+"px"&&(s.parentNode.style.height=c.h+"px"),!0===o&&(s.style.width=c.w+"px",s.style.position="fixed",!0===c.isBottom?(s.style.top="",s.style.bottom=c.stick.v+(c.u||"px")):(s.style.bottom="",s.style.top=f)),r.set(s,c)}},b=new ResizeObserver((t=>{for(let e=t.length-1;e>-1;--e)_(t[e].target)}));t.on("tb_sticky_init",(t=>{for(let e=t.length-1;e>-1;--e)b.observe(t[e]);if(!1===o){if(o=!0,i.scrollY>0){for(let e=t.length-1;e>-1;--e)_(t[e]);f()}i.tfOn("scroll",(()=>{f()}),{passive:!0})}})).on("tfsmartresize",(e=>{if(e){l=!!(c&&c>=t.w);for(let t of r)!0===l?n(t[0]):_(t[0],!0);!1===l&&f()}}))})(Themify,document,window,tbLocalScript);