!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(e,r),delete n[r]),r.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(e,t){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return t(e,i)}):"object"==typeof module&&module.exports?module.exports=t(e,require("ev-emitter")):e.imagesLoaded=t(e,e.EvEmitter)}("undefined"!=typeof window?window:this,function(e,t){function i(e,t){for(var i in t)e[i]=t[i];return e}function n(e){if(Array.isArray(e))return e;var t="object"==typeof e&&"number"==typeof e.length;return t?d.call(e):[e]}function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);var s=e;return"string"==typeof e&&(s=document.querySelectorAll(e)),s?(this.elements=n(s),this.options=i({},this.options),"function"==typeof t?r=t:i(this.options,t),r&&this.on("always",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(this.check.bind(this))):void a.error("Bad element for imagesLoaded "+(s||e))}function r(e){this.img=e}function s(e,t){this.url=e,this.element=t,this.img=new Image}var h=e.jQuery,a=e.console,d=Array.prototype.slice;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),this.options.background===!0&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&u[t]){for(var i=e.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=e.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var u={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(t.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,e),n=i.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new r(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var i=new s(e,t);this.images.push(i)},o.prototype.check=function(){function e(e,i,n){setTimeout(function(){t.progress(e,i,n)})}var t=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(t){t.once("progress",e),t.check()}):void this.complete()},o.prototype.progress=function(e,t,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log("progress: "+i,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred){var t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},r.prototype=Object.create(t.prototype),r.prototype.check=function(){var e=this.getIsImageComplete();return e?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},r.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.img,t])},r.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},r.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var e=this.getIsImageComplete();e&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},s.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.element,t])},o.makeJQueryPlugin=function(t){t=t||e.jQuery,t&&(h=t,h.fn.imagesLoaded=function(e,t){var i=new o(this,e,t);return i.jqDeferred.promise(h(this))})},o.makeJQueryPlugin(),o});
(function (){
const {
mergeObjects,
onResize,
matchMedia,
prefersReducedMotion,
isBuilder
}=BreakdanceFrontend.utils;
class BreakdanceEntrance {
enabledClass='breakdance-animation-enabled';
beforeClass='is-before';
animatingClass='is-animating';
completedClass='is-animated';
defaultOptions={
animation_type: null,
duration: { number: 500, unit: 'ms', style: '500ms' },
delay: { number: 0, unit: 'ms', style: '0ms' },
advanced: {
distance: { number: 100, unit: "px", style: "100px" },
offset: { number: 0, unit: 'px', style: '0px' },
ease: 'power1.out',
anchorPlacement: 'top bottom',
once: false,
disable_at: null
}};
delay=0;
initialized=false;
constructor(selector, options){
gsap.registerPlugin(ScrollTrigger);
this.cleanup=this.cleanup.bind(this);
this.reset=this.reset.bind(this);
this.selector=selector;
this.options=mergeObjects(this.defaultOptions, options);
this.rootEl=document.documentElement;
this.init();
}
getAnimations(){
const distance=this.options.advanced.distance.style;
const unit=this.options.advanced.distance.unit;
return {
fade: [
{ autoAlpha: 0 },
{ autoAlpha: 1 }
],
slideUp: [
{ y: distance },
{ y: `0${unit}` }
],
slideDown: [
{ y: `-=${distance}` },
{ y: `0${unit}` }
],
slideLeft: [
{ x: `-=${distance}` },
{ x: `0${unit}` }
],
slideRight: [
{ x: distance },
{ x: `0${unit}` }
],
flipUp: [
{ perspective: 2500, rotateX: `-=${distance}` },
{ rotateX: `0${unit}` }
],
flipDown: [
{ perspective: 2500, rotateX: distance },
{ rotateX: `0${unit}` }
],
flipLeft: [
{ perspective: 2500, rotateY: `-=${distance}` },
{ rotateY: `0${unit}` }
],
flipRight: [
{ perspective: 2500, rotateY: distance },
{ rotateY: `0${unit}` }
],
zoomIn: [
{ scale: 0.6 },
{ scale: 1 }
],
zoomOut: [
{ scale: 1.2 },
{ scale: 1 }
],
};}
canAnimate(){
const breakpoint=this.options.advanced.disable_at;
if(!breakpoint) return true;
return !matchMedia(breakpoint);
}
getDuration(value){
if(!value) return value;
if(value.unit==='s') return value.number;
return value.number / 1000;
}
cleanup(){
gsap.set(this.element, { clearProps: 'all' });
}
reset(element){
const el=element||this.element;
el.classList.add(this.beforeClass);
el.classList.remove(this.completedClass);
el.classList.remove(this.animatingClass);
}
getOffset(offset, anchor){
const defaultOffset=120;
if(anchor==='top bottom'&&offset.number===0){
return defaultOffset;
}
return offset.number;
}
createTween(){
const type=this.options.animation_type;
const animations=this.getAnimations();
if(!animations[type]){
console.error(`[ENTRANCE] The selected ${type} animation is invalid.`);
return;
}
const [from, to]=animations[type];
const { ease, once, anchorPlacement }=this.options.advanced;
const duration=this.getDuration(this.options.duration);
const delay=this.getDuration(this.options.delay) + this.delay;
const offset=this.getOffset(this.options.advanced.offset, anchorPlacement);
const [elementStart, viewportStart]=anchorPlacement.split(' ');
const anim=gsap.timeline({
delay,
paused: true
});
this.element.classList.add(this.beforeClass);
if(isBuilder()){
this.hideEl();
}
this.startTrigger=ScrollTrigger.create({
trigger: this.element,
start: `${elementStart}+=${offset} ${viewportStart}`,
toggleActions: "play none none none",
once,
onEnter: ()=> anim.play()
});
anim.fromTo(this.element, {
...from,
autoAlpha: 0,
},
{
...to,
duration,
delay,
ease,
autoAlpha: 1,
clearProps: 'all',
immediateRender: false,
onStart: ()=> {
this.element.classList.add(this.animatingClass);
this.element.classList.remove(this.beforeClass);
},
onComplete: ()=> {
this.element.classList.remove(this.animatingClass);
this.element.classList.add(this.completedClass);
},
onReverseComplete: ()=> {
this.element.classList.add(this.beforeClass);
this.element.classList.remove(this.animatingClass);
},
});
if(!once){
this.goToBeginningOnReverse(anim);
}
return anim;
}
goToBeginningOnReverse(animation){
this.endTrigger=ScrollTrigger.create({
trigger: this.element,
start: `top-=10 bottom`,
onLeaveBack: ()=> {
animation.pause(0);
this.cleanup();
if(isBuilder()){
this.hideEl();
}
this.reset();
}});
}
hideEl(){
gsap.set(this.element, { autoAlpha: 0 });
}
update(options){
this.options=mergeObjects(this.defaultOptions, options);
this.destroy();
this.init();
}
replay(delay=0){
this.destroy();
this.reset();
this.delay=delay;
this.init();
}
destroy(){
this.initialized=false;
if(!this.element) return;
this.element.classList.add(this.completedClass);
if(!this.tween) return;
this.tween.kill();
this.tween=null;
this.startTrigger?.kill();
this.endTrigger?.kill();
gsap.set(this.element, { clearProps: 'all' });
}
refresh(){
ScrollTrigger.refresh();
}
initTween(){
if(this.initialized) return;
this.initialized=true;
this.element.classList.remove(this.completedClass);
this.tween=this.createTween();
}
initOrDestroy(){
if(this.canAnimate()){
this.initTween();
}else{
this.destroy();
}}
init(){
if(!this.options.animation_type) return;
this.element=document.querySelector(this.selector);
this.element.bdAnim=this;
if(prefersReducedMotion()){
this.element.classList.add(this.completedClass);
return;
}
onResize(()=> this.initOrDestroy());
this.rootEl.classList.add(this.enabledClass);
}
static autoload(){
const loaded=imagesLoaded(document.body);
loaded.on("always", ()=> {
const event=new Event("breakdance_refresh_animations", { bubbles: true });
document.dispatchEvent(event);
ScrollTrigger.refresh(true);
});
addEventListener("breakdance_play_animations", (event)=> {
const target=event.target===window ? document.body:event.target;
const nodes=[
target,
...target.querySelectorAll("[data-entrance]")
];
nodes.forEach((el)=> el.bdAnim?.replay(event?.detail?.delay));
});
addEventListener("breakdance_refresh_animations", (event)=> {
const target=event.target===window ? document.body:event.target;
const nodes=[
target,
...target.querySelectorAll("[data-entrance]")
];
nodes.forEach((el)=> el.bdAnim?.cleanup());
});
addEventListener("breakdance_reset_animations", (event)=> {
const target=event.target===window ? document.body:event.target;
const nodes=[
target,
...target.querySelectorAll("[data-entrance]")
];
nodes.forEach((el)=> el.bdAnim?.reset(el));
});
}
static dontLetScrollTriggerMutateScrollPosition(){
window.addEventListener("load", ()=> {
if(!location.hash) return;
if(window.bdeAnimationScrolled) return;
const scrollElem=document.querySelector(location.hash);
if(!scrollElem) return;
requestAnimationFrame(()=> {
scrollElem.scrollIntoView({
behavior: "smooth",
});
});
window.bdeAnimationScrolled=true;
});
}}
window.BreakdanceEntrance=BreakdanceEntrance;
BreakdanceEntrance.autoload();
BreakdanceEntrance.dontLetScrollTriggerMutateScrollPosition();
}());
(function (){
const { mergeObjects }=BreakdanceFrontend.utils;
class BreakdanceFaq {
options={
accordion: false,
openFirst: false,
};
constructor(selector, options){
this.selector=selector;
this.options=mergeObjects(this.options, options||{});
this.init();
}
toggleItem(event, item){
const targetEl=item ? item:event.target;
const faqEl=targetEl.closest(".bde-faq__item");
const isActive=faqEl.classList.contains("is-active");
if(this.options.accordion){
this.closeAllItemsExcept(targetEl);
}
if(isActive){
this.closeItem(targetEl);
}else{
this.showItem(targetEl);
}}
closeAllItems(){
this.elements.forEach((item)=> this.closeItem(item));
}
closeAllItemsExcept(item){
this.elements
.filter((el)=> el!==item)
.forEach((el)=> this.closeItem(el));
}
isTransitioning(item){
return item.classList.contains("is-collapsing");
}
isActive(item){
return item.classList.contains("is-active");
}
async closeItem(item){
const faqEl=item.closest(".bde-faq__item");
if(this.isTransitioning(faqEl)) return;
if(!this.isActive(faqEl)) return;
const faqButton=faqEl.querySelector(".bde-faq__question");
const faqContent=faqEl.querySelector(".bde-faq__answer");
const endHeight=this.getEndHeight(faqContent);
faqContent.style.height=`${endHeight}px`;
this.reflow(faqContent);
faqEl.classList.add("is-collapsing");
faqEl.classList.remove("is-active");
faqContent.style.height="";
faqButton.setAttribute("aria-expanded", false);
await this.onTransitionEnd(faqContent);
faqEl.classList.remove("is-collapsing");
}
async showItem(item, instant=false){
const faqEl=item.closest(".bde-faq__item");
if(this.isTransitioning(faqEl)) return;
if(this.isActive(faqEl)) return;
const faqButton=faqEl.querySelector(".bde-faq__question");
const faqContent=faqEl.querySelector(".bde-faq__answer");
const complete=()=> {
faqEl.classList.add("is-active");
faqEl.classList.remove("is-collapsing");
faqContent.style.height="";
};
if(instant){
complete();
faqButton.setAttribute("aria-expanded", true);
return;
}
faqEl.classList.add("is-collapsing");
faqContent.style.height="0px";
const endHeight=this.getEndHeight(faqContent);
faqContent.style.height=`${endHeight}px`;
faqButton.setAttribute("aria-expanded", true);
await this.onTransitionEnd(faqContent);
complete();
}
getEndHeight(element){
const height=element.getBoundingClientRect().height;
return Math.max(element.scrollHeight, height);
}
reflow(element){
element.offsetHeight;
}
update(options={}){
this.options=mergeObjects(this.options, options);
this.destroy();
this.init();
}
openFirst(){
if(!this.elements[0]) return;
this.showItem(this.elements[0], true);
}
onTransitionEnd(item){
const duration=window.getComputedStyle(item)
.getPropertyValue("transition-duration");
if(duration==="0s"){
return Promise.resolve();
}
return new Promise((resolve)=> {
item.addEventListener("transitionend", resolve, { once: true });
});
}
destroy(){
this.elements=Array.from(document.querySelectorAll(`${this.selector} .js-faq-item`
));
if(!this.elements) return;
this.closeAllItems();
this.elements.forEach((item)=>
item.removeEventListener("click", this.onClick)
);
}
bindClickListeners(){
this.onClick=this.toggleItem.bind(this);
this.elements.forEach((item)=> {
item.addEventListener("click", this.onClick);
});
}
init(){
this.elements=Array.from(document.querySelectorAll(`${this.selector} .js-faq-item`
));
if(this.options.openFirst===true){
this.openFirst();
}
this.bindClickListeners();
}}
window.BreakdanceFaq=BreakdanceFaq;
})();