!function(t,e){"use strict";ElementsKit_Helper.registerWidget("elementskit-stacked-cards.default",(function(t){window.onbeforeunload=function(){window.scrollTo({top:0,behavior:"smooth",duration:400})},gsap.registerPlugin(ScrollTrigger);const r=t.find(".ekit-stacked-cards__container"),a=r.data("cardStyle"),i=JSON.parse(r.attr("data-scrolltrigger")),o={verticalCards:gsap.utils.toArray(t.find(".ekit-stacked-cards__item")),horizontalCards:gsap.utils.toArray(t.find(".ekit-stacked-cards__item_horizontal")),container:r},n=t=>{const e=gsap.timeline();return t&&t.length?(t.forEach(((r,a)=>{const i=jQuery(r),o=i.data("startForm"),n=i.data("leftFrom"),d=i.data("stackedCard"),s=1.1===d?.opacity?0:d?.opacity;gsap.set(r,{position:"absolute",top:0,left:0,filter:"blur(0px)",y:0===a?0:o*(a+1),x:window.innerWidth>=1150&&n?0===a?0:n*a:0,opacity:0===a?1:s,rotation:0});const c=parseInt(r.getAttribute("data-yaxis")),l=t[a-1],g=a===t.length-1;if(a>0){window.addEventListener("resize",(()=>{ScrollTrigger.refresh()}));const t=d?.y&&d?.scaleX;e.to(r,{opacity:1,y:d?.y?(d.y||0)+(t&&g?c:0):g?0+c:0,duration:1,ease:"Power2.out"},a),l&&(d?.y&&!t||e.to(l,{...d},a))}else window.addEventListener("load",(()=>{window.addEventListener("resize",(()=>{ScrollTrigger.refresh()})),e.to(r,{opacity:1,y:0,duration:1,ease:"Power2.out"},a),l&&e.to(l,{...d},a)}))})),e):e},d=(t,r,a,i)=>{const n=Math.abs(jQuery(o.verticalCards[1]).data("startForm")||0)*(i-1),d="default"===a.end?n:a.end;ScrollTrigger.create({trigger:t,invalidateOnRefresh:!0,animation:r,start:`top ${a.start}`,end:`+=${d}`,scrub:.5,pin:!0,markers:!!e.isEditMode()&&a.marker})},s=(t,r)=>gsap.timeline({scrollTrigger:{trigger:t,pin:!0,scrub:.5,start:`top ${r.start}`,end:`bottom -${r.end}`,markers:!!e.isEditMode()&&r.marker,invalidateOnRefresh:!0}}),c=(t,e)=>{let r=gsap.matchMedia();r.add("(min-width: 1000px)",(()=>{t.forEach(((t,r)=>{let a=jQuery(t).data("stackedCardHr");gsap.set(t,{}),r>0&&(window.addEventListener("resize",(()=>{ScrollTrigger.refresh()})),e.fromTo(t,{y:0,x:window.innerWidth/1.125+0*r,stagger:.5,zIndex:r+1},{y:0,...a,stagger:.5}))}))})),r.add("(min-width: 800px) and (max-width: 999px)",(()=>{t.forEach(((t,r)=>{let a=jQuery(t).data("stackedCardHr");gsap.set(t,{}),r>0&&(window.addEventListener("resize",(()=>{ScrollTrigger.refresh()})),e.fromTo(t,{x:0,y:window.innerWidth/1.125+0*r,stagger:.5,opacity:0,zIndex:r+1},{x:0,y:a.x,opacity:1,rotation:a.rotation,stagger:.5}))}))})),r.add("(max-width: 799px)",(()=>{t.forEach(((t,r)=>{let a=jQuery(t).data("stackedCardHr");gsap.set(t,{}),r>0&&(window.addEventListener("resize",(()=>{ScrollTrigger.refresh()})),e.fromTo(t,{x:0,y:window.innerWidth/1.125+0*r,stagger:.5,opacity:0,zIndex:r+1},{x:0,y:a.x,opacity:1,rotation:a.rotation,stagger:.5}))}))}))};"vertical"===a?((t,e)=>{const r=n(t.verticalCards);d(t.container,r,e,t.verticalCards.length)})(o,i):"horizontal"===a&&(document.body.style.overflowX="hidden",((t,e)=>{const r=s(t.container,e);c(t.horizontalCards,r)})(o,i)),ScrollTrigger.refresh()}))}(jQuery,window.elementorFrontend);