(function(){"use strict";const n={selectors:{transitionCard:"[r-transition-card]",sourceImg:'[r-transition-img="source"]',sourceImgElement:'[r-card-hover-effect="target-img"]',sourceHide:"[r-transition-card-hide]",targetImg:'[r-transition-img="target"]',targetFade:'[r-transition-hero="fade-in"]',targetBlock:'[r-transition-hero="block"]'},animation:{imageDuration:.8,imageEase:"power3.inOut",fadeDuration:.5,fadeEase:"ease",blockReveal:{duration:.6,ease:"power2.inOut"},fadeIn:{duration:.3,ease:"ease",yOffset:40,stagger:.1}},classes:{transitioning:"cc-is-transitioning"}};let s=null;function f(r){const t=r.querySelectorAll(n.selectors.sourceHide);t.length&&gsap.to(t,{opacity:0,duration:.2,ease:n.animation.fadeEase})}function p(r){const t=r.getBoundingClientRect(),a=r.cloneNode(!0),e=window.getComputedStyle(r);return a.classList.add("floating-image"),gsap.set(a,{position:"fixed",top:t.top,left:t.left,width:t.width,height:t.height,margin:0,zIndex:1100,objectFit:e.objectFit||"cover",objectPosition:e.objectPosition||"center"}),gsap.set(a.querySelector(n.selectors.sourceImgElement),{scale:1}),document.body.appendChild(a),a}function y(r,t){return gsap.to(r,{borderRadius:0,top:0,left:t.x,width:t.width,height:t.height,duration:n.animation.imageDuration,ease:n.animation.imageEase})}function c(r,t){return gsap.fromTo(r,{opacity:1},{opacity:0,delay:t||0,duration:n.animation.fadeDuration,ease:n.animation.fadeEase,overwrite:!0})}function l(r,t){return gsap.fromTo(r,{opacity:0},{opacity:1,delay:0,duration:n.animation.fadeDuration,ease:n.animation.fadeEase,overwrite:!0})}function u(r){const t=r.querySelector(n.selectors.targetBlock),a=r.querySelectorAll(n.selectors.targetFade),e=r.querySelector(n.selectors.targetImg),o=gsap.timeline();return t&&(gsap.set(t,{clipPath:"inset(0 0 0 100%)"}),o.to(t,{clipPath:"inset(0 0 0 0%)",duration:n.animation.blockReveal.duration,ease:n.animation.blockReveal.ease}),o.to(e,{maxWidth:"calc(100% - 42.625rem)",duration:n.animation.blockReveal.duration,ease:n.animation.blockReveal.ease},"<")),a.length>0&&(gsap.set(a,{opacity:0,y:n.animation.fadeIn.yOffset}),o.to(a,{opacity:1,y:0,duration:n.animation.fadeIn.duration,ease:n.animation.fadeIn.ease,stagger:n.animation.fadeIn.stagger,onComplete:()=>{gsap.set(a,{opacity:1,y:0,overwrite:!1})}})),o}function d(){if(!document.querySelector("[data-barba='wrapper']"))return;let t=null;barba.init({cacheIgnore:!0,transitions:[{name:"card-to-hero",from:{namespace:["list"]},to:{namespace:["detail"]},leave(e){return s?(t=p(s.element),f(t),c(e.current.container,.2)):c(e.current.container)},enter(e){const o=e.next.container.querySelector(n.selectors.targetImg);if(gsap.set(e.next.container,{opacity:0}),!s||!o||!t){t&&(t.remove(),t=null),l(e.next.container),u(e.next.container);return}gsap.set(o,{visibility:"hidden"});const i=o.getBoundingClientRect();return y(t,i).then(()=>{gsap.set(o,{visibility:"visible"}),l(e.next.container).then(()=>{t.remove(),t=null,u(e.next.container)})})}},{name:"to-card",from:{},to:{namespace:["detail"]},leave(e){return c(e.current.container)},enter(e){l(e.next.container).then(()=>{u(e.next.container)})}},{name:"default-fade",leave(e){return c(e.current.container)},enter(e){l(e.next.container)}}]}),barba.hooks.before(e=>{if(document.body.classList.add(n.classes.transitioning),s=null,!e.trigger||!e.trigger.closest)return;const o=e.trigger.closest(n.selectors.transitionCard);if(!o)return;const i=o.querySelector(n.selectors.sourceImg);i&&(s={element:i,rect:i.getBoundingClientRect()})}),barba.hooks.after(e=>{if(document.body.classList.remove(n.classes.transitioning),b(),e.next.container.querySelectorAll("[data-eloqua-formid]").length>0){const i="https://cdn.haufe.de/content/eloqua/forms/eloqua-common.js",m=document.querySelector(`script[src="${i}"]`);m&&m.remove();const g=document.createElement("script");g.src=i,document.body.appendChild(g)}window.scrollTo(0,0)});let a;window.addEventListener("resize",()=>{clearTimeout(a),a=setTimeout(()=>{const e=document.querySelector('[data-barba-namespace="detail"]');if(!e)return;const o=e.querySelectorAll(n.selectors.targetFade);o.length>0&&gsap.set(o,{opacity:1,y:0,overwrite:!1})},250)}),h()}function h(){const r=document.querySelector('[data-barba-namespace="detail"]');r&&u(r)}function b(){document.body.querySelectorAll("script[refresh]").forEach(r=>{const t=r.src;r.remove();const a=document.createElement("script");a.src=t,a.setAttribute("refresh","true"),document.body.appendChild(a)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",d):d()})();