alrdy-animate
Version:
A library to handle animations on scroll with GSAP integration.
1 lines • 37.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AlrdyAnimate=t():e.AlrdyAnimate=t()}(this,()=>(()=>{var e,t,a={543(e,t,a){"use strict";a.d(t,{I:()=>n,l:()=>r});let i={duration:1,delay:0};function r(e){i={...i,...e}}function n(e,t){const a="reverse"===t?2:1;e.forEach(e=>{const r=parseFloat(e.getAttribute("aa-delay"))||i.delay,n=parseFloat(e.getAttribute("aa-duration"))||i.duration,o=r/a,s=n/a;e.timeline||(e.style.setProperty("--aa-duration",`${s}s`),e.style.setProperty("--aa-delay",`${o}s`)),e.dispatchEvent(new CustomEvent("aa-event-trigger",{detail:{action:t}}))})}},181(e,t,a){var i=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,l="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=Object.prototype.toString,p=Math.max,m=Math.min,g=function(){return u.Date.now()};function b(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(b(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=b(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var a=n.test(e);return a||o.test(e)?s(e.slice(2),a?2:8):r.test(e)?NaN:+e}e.exports=function(e,t,a){var i,r,n,o,s,l,c=0,u=!1,d=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var a=i,n=r;return i=r=void 0,c=t,o=e.apply(n,a)}function A(e){var a=e-l;return void 0===l||a>=t||a<0||d&&e-c>=n}function v(){var e=g();if(A(e))return w(e);s=setTimeout(v,function(e){var a=t-(e-l);return d?m(a,n-(e-c)):a}(e))}function w(e){return s=void 0,y&&i?h(e):(i=r=void 0,o)}function T(){var e=g(),a=A(e);if(i=arguments,r=this,l=e,a){if(void 0===s)return function(e){return c=e,s=setTimeout(v,t),u?h(e):o}(l);if(d)return s=setTimeout(v,t),h(l)}return void 0===s&&(s=setTimeout(v,t)),o}return t=f(t)||0,b(a)&&(u=!!a.leading,n=(d="maxWait"in a)?p(f(a.maxWait)||0,t):n,y="trailing"in a?!!a.trailing:y),T.cancel=function(){void 0!==s&&clearTimeout(s),c=0,i=l=r=s=void 0},T.flush=function(){return void 0===s?o:w(g())},T}}},i={};function r(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return a[e](n,n.exports,r),n.exports}r.m=a,r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,a)=>(r.f[a](e,t),t),[])),r.u=e=>"chunks/"+({151:"gsap-accordion",267:"gsap-hover",297:"gsap-modal",298:"gsap-nav",332:"lenis",336:"gsap-appear",478:"gsap-text",525:"gsap-marquee",638:"gsap-flip",678:"gsap-core",704:"gsap-draggable",890:"gsap-parallax",955:"gsap-section"}[e]||e)+"."+{151:"8dbddc18f55186218ade",267:"c6584e54e4cc818a2429",297:"66d1a48ad92781f996d0",298:"eb778e4e9f9db91fc8d6",332:"abc80d9b64f5e2e4105a",336:"50176c7be0b00037575e",357:"7cabadf7059139d82d53",478:"6a4ca86efe36f5be98a9",525:"97e05d8fa10b423c01ba",638:"2a4286eb89dcb87f51e7",678:"7a0cddbd4b8868a6252c",704:"8854a54fdc9cbfdf9eb0",890:"4071da93b44bd8321cf8",955:"b0ac94f8596881af7348"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="AlrdyAnimate:",r.l=(a,i,n,o)=>{if(e[a])e[a].push(i);else{var s,l;if(void 0!==n)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var d=c[u];if(d.getAttribute("src")==a||d.getAttribute("data-webpack")==t+n){s=d;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",r.nc&&s.setAttribute("nonce",r.nc),s.setAttribute("data-webpack",t+n),s.src=a),e[a]=[i];var p=(t,i)=>{s.onerror=s.onload=null,clearTimeout(m);var r=e[a];if(delete e[a],s.parentNode&&s.parentNode.removeChild(s),r&&r.forEach(e=>e(i)),t)return t(i)},m=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var a=t.getElementsByTagName("script");if(a.length)for(var i=a.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=a[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{var e={792:0};r.f.j=(t,a)=>{var i=r.o(e,t)?e[t]:void 0;if(0!==i)if(i)a.push(i[2]);else{var n=new Promise((a,r)=>i=e[t]=[a,r]);a.push(i[2]=n);var o=r.p+r.u(t),s=new Error;r.l(o,a=>{if(r.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var n=a&&("load"===a.type?"missing":a.type),o=a&&a.target&&a.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",s.name="ChunkLoadError",s.type=n,s.request=o,i[1](s)}},"chunk-"+t,t)}};var t=(t,a)=>{var i,n,[o,s,l]=a,c=0;if(o.some(t=>0!==e[t])){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);l&&l(r)}for(t&&t(a);c<o.length;c++)n=o[c],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0},a=this.webpackChunkAlrdyAnimate=this.webpackChunkAlrdyAnimate||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var n={};return(()=>{"use strict";r.d(n,{AlrdyAnimate:()=>q});var e=r(181),t=r.n(e);function a(e){if(!e)return null;const t=e.split("&");for(const e of t)if(e.startsWith("bg-")){const t=e.split("-");if(t.length>=3){const e=t.slice(2).join("-");if(["all","vertical","horizontal","top","bottom","left","right","up","down","up-right","up-left","down-right","down-left"].includes(e))return e}}return null}function i(e){return e?e.split(" ").reduce((e,t)=>{const[a,i]=t.split(":").map(e=>e.trim());if(a&&i){const t={bg:"backgroundColor",text:"color",border:"borderColor"};t[a]&&(e[t[a]]=i)}return e},{}):{}}function o(e,t,a){if(!e)return t;if(e.includes("|")){const[t,i]=e.split("|");return a?i.trim():t.trim()}return e.trim()}function s(e,t,a,i,r){const n={},s=e.getAttribute("aa-animate-original")||e.getAttribute("aa-animate");if(s&&s.includes("|")&&(e.hasAttribute("aa-animate-original")||e.setAttribute("aa-animate-original",s),n.animationType=o(s,null,i),e.setAttribute("aa-animate",n.animationType)),r?.isSlider&&(n.sliderType=o(e.getAttribute("aa-slider"),"basic",i)),r?.isAccordion&&(n.accordionType=o(e.getAttribute("aa-accordion"),"basic",i)),r?.isMarquee&&(n.marqueeType=o(e.getAttribute("aa-marquee"),null,i)),n.scrollStart=o(e.getAttribute("aa-scroll-start"),a.scrollStart||"top 80%",i),n.scrollEnd=o(e.getAttribute("aa-scroll-end"),a.scrollEnd||"bottom 70%",i),e.hasAttribute("aa-viewport")&&!e.hasAttribute("aa-scroll-start")){const t=parseFloat(e.getAttribute("aa-viewport"));n.scrollStart=`top ${100*t}%`}return{...t,...n}}function l(e,t,a){const{duration:i,delay:r,distance:n,delayMobile:o,color:s,opacity:l,pseudoColor:c}=t;if(e.hasAttribute("aa-duration")&&e.style.setProperty("--aa-duration",`${i}s`),e.hasAttribute("aa-delay")||e.hasAttribute("aa-load")&&e.hasAttribute("aa-animate")){const t=a&&void 0!==o?o:r;e.style.setProperty("--aa-delay",`${t}s`)}e.hasAttribute("aa-distance")&&e.style.setProperty("--aa-distance",`${n}`),e.hasAttribute("aa-opacity")&&e.style.setProperty("--aa-opacity",`${l}`),c&&e.style.setProperty("--aa-pseudo-color",c)}const c={blur:{"heading-style-h2":{animationType:"text-blur",split:"chars|3",ease:"power1.out",duration:.8,stagger:.1},"heading-style-h3":{animationType:"text-blur",split:"words",ease:"power1.out",duration:.6,stagger:.08},"text-size-medium":{animationType:"text-fade",split:"lines&words",ease:"power2.out",duration:1,stagger:.02}},tilt:{"heading-style-h2":{animationType:"text-tilt-up-lines",split:"lines",ease:"power4.out",duration:.9,stagger:.1},"heading-style-h3":{animationType:"text-tilt-up-lines",split:"lines",ease:"power4.out",duration:.7,stagger:.1},"text-size-medium":{animationType:"text-slide-up-lines",split:"lines",ease:"power4.out",duration:.5,stagger:.02}}};let u={},d=null;const p=["fade","fade-up","fade-down","fade-left","fade-right","zoom-in","zoom-in-up","zoom-in-down","zoom-out","zoom-out-up","zoom-out-down","slide-up","slide-down","slide-left","slide-right","blur-in","flip-left","flip-right","flip-up","flip-down","pseudo-reveal-up","pseudo-reveal-down","pseudo-reveal-left","pseudo-reveal-right","float-up","float-down","float-left","float-right","swing-fwd","swing-bwd","turn-3d-soft","turn-3d-soft-3em","turn-3d-elliptic","rotate-br-cw","rotate-br-ccw","rotate-bl-cw","rotate-bl-ccw","rotate-tr-cw","rotate-tr-ccw","rotate-tl-cw","rotate-tl-ccw","rotate-c-cw","rotate-c-ccw"];function m(e){if(!e.templates)return null;const{theme:t,custom:a}=e.templates;let i={};if(t){const e=u[r=t]||c[r]||null;e&&(i={...e})}var r;return a&&(i={...i,...a}),d=i,i}function g(e){if(!d)return null;const t="string"==typeof e.className?e.className:e.className?.baseVal||"";if(!t)return null;const a=t.trim().split(/\s+/);for(const e of a)if(d[e])return d[e];return null}function b(){"fetch"in window&&document.querySelectorAll("[aa-submit-button]").forEach((e,t)=>{const a=e.closest("form");if(!a)return void console.warn("[AlrdyAnimate] Submit button is not inside a <form>.",e);const i=e.tagName.toLowerCase(),r="a"===i,n="button"===i;if(r)e.removeAttribute("href"),e.setAttribute("role","button"),e.hasAttribute("tabindex")||e.setAttribute("tabindex","0");else{if(!n)return void console.warn("[AlrdyAnimate] Unsupported element type for form submit:",i);e.hasAttribute("type")||e.setAttribute("type","button")}const o=e.hasAttribute("aa-submit-loading-duration")?parseFloat(e.getAttribute("aa-submit-loading-duration")):.3,s=e.hasAttribute("aa-submit-success-duration")?parseFloat(e.getAttribute("aa-submit-success-duration")):1.2,l=e.hasAttribute("aa-submit-error-duration")?parseFloat(e.getAttribute("aa-submit-error-duration")):1.2,c=e.getAttribute("aa-submit-logic")||"default",u=e.hasAttribute("aa-submit-debug");u&&console.log("[AlrdyAnimate] Button configuration:",{loadingDuration:o,successDuration:s,errorDuration:l,submitLogic:c});const d="is-loading",p="is-success",m="is-error",g=a.closest(".w-form"),b=g?.querySelector(".w-form-done"),f=g?.querySelector(".w-form-fail");function y(){e.classList.remove(p,m),r?(e.style.pointerEvents="auto",e.removeAttribute("aria-disabled")):e.disabled=!1}function h(e){return u&&console.log("[AlrdyAnimate] Form response:",{status:e.status,statusText:e.statusText,contentType:e.headers.get("content-type")||"unknown"}),e.ok?e.json().catch(()=>(u&&console.log("[AlrdyAnimate] Non-JSON response, treating as success"),{success:!0})):e.json().catch(()=>({success:!1})).then(t=>{throw u&&console.log("[AlrdyAnimate] Error response:",t),{networkError:!0,data:t,statusText:e.statusText}})}function A(t){if(!a.checkValidity())return t.preventDefault(),void a.reportValidity();const i=a.getAttribute("action");if(!i||""===i.trim()){u&&console.log("[AlrdyAnimate] No form action - delegating to Webflow native submission"),e.classList.add(d),r?(e.style.pointerEvents="none",e.setAttribute("aria-disabled","true")):e.disabled=!0;let t=a.querySelector('input[type="submit"]');return t||(t=document.createElement("input"),t.type="submit",t.style.display="none",a.appendChild(t)),void t.click()}t.preventDefault(),"default"===c?(a.style.display="block",b?.style.setProperty("display","none"),f?.style.setProperty("display","none")):(g?.classList.remove(d,p,m),b?.classList.remove(p),f?.classList.remove(m)),y(),r?(e.style.pointerEvents="none",e.setAttribute("aria-disabled","true")):e.disabled=!0,e.classList.add(d),e.setAttribute("aria-busy","true"),g&&g.classList.add(d),function(){const t=a.getAttribute("action"),i=(a.getAttribute("method")||"POST").toUpperCase();u&&console.log("[AlrdyAnimate] Form submission:",{action:t,method:i});const r=new FormData(a),n={method:i,headers:{Accept:"application/json"}};let A=t;if("GET"===i){const e=new URLSearchParams;for(let[t,a]of r.entries())e.append(t,a);const a=t.includes("?")?"&":"?";A=`${t}${a}${e.toString()}`}else n.body=r;let v=!1,w=!1,T=null;const S=()=>{v&&w&&(e.classList.remove(d),e.removeAttribute("aria-busy"),g&&g.classList.remove(d),T?(e.classList.add(p),"default"===c?(a.style.display="none",b?.style.setProperty("display","block")):(g?.classList.remove(d,m),g?.classList.add(p),b?.classList.add(p)),setTimeout(()=>y(),1e3*s)):(e.classList.add(m),"default"===c?f?.style.setProperty("display","block"):(g?.classList.remove(d,p),g?.classList.add(m),f?.classList.add(m)),setTimeout(()=>y(),1e3*l)))};fetch(A,n).then(h).then(e=>{v=!0,T=e,S()}).catch(e=>{v=!0,T=null,S()}),setTimeout(()=>{w=!0,S()},1e3*o)}()}u&&console.log("[AlrdyAnimate] Webflow elements found:",{formWrapper:!!g,successMessage:!!b,errorMessage:!!f}),r?(e.addEventListener("click",A),e.addEventListener("keydown",function(e){!r||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),A(e))})):n&&(e.addEventListener("click",A),a.addEventListener("submit",t=>{t.submitter===e&&A(t)}))})}var f=r(543);let y=null,h=!1,A=!1,v=null,w=!1;const T={ease:"ease-in-out",again:!0,scrollStart:"top 80%",scrollEnd:"bottom 70%",duration:1,delay:0,distance:1,hoverDuration:.3,hoverDelay:0,hoverEase:"power3.out",hoverDistance:.1,gsapFeatures:[],includeGSAP:!1,smoothScroll:{enabled:!0,options:{}},lazyLoadHandler:!1,debug:!1,templates:null,initTimeout:3,reducedMotionDuration:.5,reducedMotionEase:"ease",optimizePageSpeed:!1},S={text:"fade",parallax:"zoom-out",clip:"fade",stack:"fade",appear:"fade",reveal:"fade",grow:"zoom-in",background:"fade",pin:"fade",counter:"fade"};function E(e,t,r,n){const s=[],c=[];e.forEach(e=>{const n=e._aaAttributeType,l=function(e,t,a){if(e.hasAttribute("aa-animate")||e.hasAttribute("aa-slider")||e.hasAttribute("aa-accordion")||e.hasAttribute("aa-marquee"))return null;const r=function(e,t){if(!d)return null;const a=g(e);if(!a)return null;const r={...a};if(r.animationType&&r.animationType.includes("|")){const[e,a]=r.animationType.split("|");r.animationType=t?a:e}var n;return r.color&&("string"==typeof r.color?r.colors=i(r.color):"object"==typeof r.color&&(r.colors=r.color),delete r.color),r.animationType&&(n=r.animationType)&&p.includes(n)&&(e.setAttribute("aa-animate",r.animationType),e._aaAttributeType&&(e._aaAttributeType.isAnimate=!0),r.duration&&e.style.setProperty("--aa-duration",`${r.duration}s`),r.delay&&e.style.setProperty("--aa-delay",`${r.delay}s`),r.distance&&e.style.setProperty("--aa-distance",r.distance),void 0!==r.opacity&&e.style.setProperty("--aa-opacity",r.opacity)),r.anchorElement=e,r}(e,a);return r?{...t,...r,anchorElement:e,anchorSelector:null}:null}(e,t,r),u=l||function(e,t,r,n=0,s=null){const l=e.getAttribute("aa-animate-original")||e.getAttribute("aa-animate");let c=l;l&&l.includes("|")&&(e.hasAttribute("aa-animate-original")||e.setAttribute("aa-animate-original",l),c=o(l,null,r),e.setAttribute("aa-animate",c));const u=e.getAttribute("aa-hover"),d=s?.isSlider?o(e.getAttribute("aa-slider"),"basic",r):null,p=s?.isAccordion?o(e.getAttribute("aa-accordion"),"basic",r):null,m=s?.isMarquee?o(e.getAttribute("aa-marquee"),null,r):null,g=e.getAttribute("aa-anchor"),b=g?document.querySelector(g):e,f=i(e.getAttribute("aa-color")),y=f.backgroundColor,h=o(e.getAttribute("aa-scroll-start"),t.scrollStart||"top 80%",r),A=o(e.getAttribute("aa-scroll-end"),t.scrollEnd||"bottom 70%",r);let v=h;return e.hasAttribute("aa-viewport")&&!e.hasAttribute("aa-scroll-start")&&(v=`top ${100*parseFloat(e.getAttribute("aa-viewport"))}%`),{animationType:c,ease:e.hasAttribute("aa-ease")?e.getAttribute("aa-ease"):t.ease,split:e.getAttribute("aa-split"),scrub:e.getAttribute("aa-scrub"),distance:e.hasAttribute("aa-distance")?parseFloat(e.getAttribute("aa-distance")):t.distance,...s?.isHover?{hoverType:u,hoverDirection:u&&(a(u)||e.getAttribute("aa-hover-direction"))||"all",isReverse:!!u&&u.includes("reverse"),hoverDuration:e.hasAttribute("aa-duration")?parseFloat(e.getAttribute("aa-duration")):t.hoverDuration,hoverDelay:e.hasAttribute("aa-delay")?parseFloat(e.getAttribute("aa-delay")):t.hoverDelay,hoverEase:e.hasAttribute("aa-ease")?e.getAttribute("aa-ease"):t.hoverEase,hoverDistance:e.hasAttribute("aa-distance")?parseFloat(e.getAttribute("aa-distance")):t.hoverDistance,hoverStagger:e.hasAttribute("aa-stagger")?parseFloat(e.getAttribute("aa-stagger")):.03,bg:e.querySelector("[aa-hover-bg]")}:{},sliderType:d,accordionType:p,marqueeType:m,duration:e.hasAttribute("aa-duration")?parseFloat(e.getAttribute("aa-duration")):t.duration,delay:(()=>{const a=e.hasAttribute("aa-delay")?parseFloat(e.getAttribute("aa-delay")):t.delay;if(e.hasAttribute("aa-load")&&e.hasAttribute("aa-animate")&&n>0){const e=performance.now()/1e3;return Math.max(0,n-e)+a}return a})(),delayMobile:e.hasAttribute("aa-delay-mobile")?parseFloat(e.getAttribute("aa-delay-mobile")):void 0,stagger:e.hasAttribute("aa-stagger")?parseFloat(e.getAttribute("aa-stagger")):void 0,opacity:e.hasAttribute("aa-opacity")?parseFloat(e.getAttribute("aa-opacity")):1,colors:f,pseudoColor:y,scrollStart:v,scrollEnd:A,anchorSelector:g,anchorElement:b}}(e,t,r,t.loadBaseDelay,n);u&&(e.settings=u,"text"!==(u.animationType?.includes("-")?u.animationType.split("-")[0]:u.animationType)||!n.isAnimate&&!l||n.isHybrid?c.push({element:e,settings:u,aaAttributeType:n}):s.push({element:e,settings:u,aaAttributeType:n}))}),c.forEach(({element:e,settings:a,aaAttributeType:i})=>{l(e,a,r),i.isHover&&window.matchMedia("(hover: hover)").matches&&A&&t.gsapFeatures.includes("hover")&&function(e,t,a){const{hoverType:i}=t;i.split("&").forEach(i=>{const[r,...n]=i.split("-");switch(r){case"text":a.animations.initializeTextHover(e,{...t,hoverType:i});break;case"bg":const r=n[0];a.animations.initializeBackgroundHover(e,{...t,hoverType:i},r);break;case"icon":a.animations.initializeIconHover(e,{...t,hoverType:i})}})}(e,a,n),(i.isSlider||i.isAccordion||i.isMarquee)&&A&&function(e,t,a,i,r){const{sliderType:n,accordionType:o,marqueeType:s}=t;if(r.isSlider){if("none"===n)return;if(i.gsapFeatures.includes("slider")){const{duration:i,ease:r,delay:o}=t;a.animations.slider(e,n,i,r,o)}}if(r.isAccordion){if("none"===o)return;i.gsapFeatures.includes("accordion")&&a.animations.accordion(e,o)}if(r.isMarquee){if("none"===s)return;if(i.gsapFeatures.includes("marquee")){const{duration:i,scrub:r}=t;a.animations.marquee(e,i,r,s)}}}(e,a,n,t,i),i.isAnimate&&(A?x(e,a,t,0,n):(e.style.visibility="visible",F(e,a,t)))}),A&&!document.documentElement.hasAttribute("aa-load-css-fallback")&&document.documentElement.setAttribute("aa-load-js-ready",""),function(e,t,a,i,r){let n=0;e.length>0?requestAnimationFrame(function o(){e.slice(n,n+5).forEach(({element:e,settings:r,aaAttributeType:n})=>{l(e,r,a),A?x(e,r,t,0,i):(e.style.visibility="visible",F(e,r,t))}),n+=5,n<e.length?requestAnimationFrame(o):r&&r()}):r&&r()}(s,t,r,n,async()=>{if(document.dispatchEvent(new CustomEvent("aa-text-splitting-complete")),n.ScrollTrigger){try{document.fonts?.ready&&await document.fonts.ready}catch(e){}n.ScrollTrigger.refresh(!0)}})}const k=new Map;function x(e,t,a,i,r){const{animationType:n,split:o,scrub:s,duration:l,stagger:c,delay:u,ease:d,opacity:p,distance:m,anchorElement:g,anchorSelector:b,scrollStart:f,scrollEnd:y}=t;if(e._aaAttributeType?.isHybrid&&document.documentElement.hasAttribute("aa-load-css-fallback"))return void(a.debug&&console.log("AlrdyAnimate: aa-load-css-fallback is set, CSS load animations run instead of GSAP"));const h=n.includes("-")?n.split("-")[0]:n,A=["appear","reveal","counter","grow","text","background","parallax","glide","clip","stack","pin"].includes(h);if(A){if(!k.has(h)){const t={appear:{feature:"appear",check:()=>r.animations.appear},reveal:{feature:"appear",check:()=>r.animations.reveal},counter:{feature:"appear",check:()=>r.animations.counter},grow:{feature:"appear",check:()=>r.animations.grow},text:{feature:"text",check:()=>r.splitText&&r.animations.text},clip:{feature:"section",check:()=>r.animations.clip},stack:{feature:"section",check:()=>r.animations.stack},pin:{feature:"section",check:()=>r.animations.pin||r.animations.pinStack},background:{feature:"section",check:()=>r.animations.backgroundColor},parallax:{feature:"parallax",check:()=>r.animations.parallax},glide:{feature:"parallax",check:()=>r.animations.glide}};if(t[h]){const{feature:a,check:i}=t[h],r=i();k.set(h,{available:r,feature:a}),r||console.warn(`AlrdyAnimate: '${h}' animation requires '${a}' feature in gsapFeatures. Skipping animation for element:`,e)}}const t=k.get(h);if(t&&!t.available)return}const v=["clip","stack","background","parallax","glide","pin"].includes(h);e.timeline&&e.timeline.kill(),e.splitInstance&&e.splitInstance.revert(),e.scrollTriggers&&(e.scrollTriggers.forEach(e=>e.kill()),e.scrollTriggers=[]);let w=null;if(A&&!v&&(w=r.gsap.timeline({paused:!s}),e.timeline=w),!v)if(e.hasAttribute("aa-event-trigger"))e.timeline&&e.timeline.pause(),e.scrollTriggers=[],e.addEventListener("aa-event-trigger",t=>{const{action:a}=t.detail;"play"===a?(e.classList.add("in-view"),e.style.visibility="visible",e.timeline&&e.timeline.timeScale(1).play()):"reverse"===a&&(e.classList.remove("in-view"),e.timeline&&e.timeline.timeScale(2).reverse())});else{const t=e.getAttribute("aa-pinned-container"),i=t?document.getElementById(t):null,n=r.ScrollTrigger.create({trigger:g,...i?{pinnedContainer:i}:{},...s?{start:f,end:y,stagger:c,scrub:!!s&&(parseFloat(s)||!0),invalidateOnRefresh:!s}:{start:f},...w?{animation:w}:{},onEnter:()=>{e.classList.add("in-view"),s||(r.gsap.set(e,{visibility:"visible"}),w&&w.play())},markers:a.debug}),o=r.ScrollTrigger.create({trigger:g,...i?{pinnedContainer:i}:{},start:"top 100%",onLeaveBack:()=>{(a.again||b)&&(e.classList.remove("in-view"),w&&w.progress(0).pause())}});e.scrollTriggers=[n,o]}if(!A)return;if(v)switch(h){case"clip":return void r.animations.clip(e);case"stack":return void r.animations.stack(e,s,m);case"pin":const t=e.getAttribute("aa-pin-start")||"top 10%",i=e.getAttribute("aa-pin-end")||"+=100%";if("pin-stack"===n){const n=e.getAttribute("aa-pin-in")||null,o=e.getAttribute("aa-pin-out")||null;r.animations.pinStack(e,t,i,a.debug,n,o)}else r.animations.pin(e,t,i,a.debug);return;case"background":return void r.animations.backgroundColor(e,l,d,f,y,a.debug,s);case"parallax":return void r.animations.parallax(e,s,n);case"glide":return void r.animations.glide(e,u,m,a.debug)}const T=()=>{switch(h){case"appear":w.add(r.animations.appear(e,l,d,u,m,n,p));break;case"reveal":n.startsWith("reveal-slices")?w.add(r.animations.revealSlices(e,l,d,u,n,p,c,m)):w.add(r.animations.reveal(e,l,d,u,n,p));break;case"counter":w.add(r.animations.counter(e,l,d,u,n));break;case"grow":w.add(r.animations.grow(e,l,d,u,n));break;case"text":const{splitInstance:t}=r.splitText(e,o,!1,t=>{const a=n.replace(/-clip|-lines|-words|-chars$/,""),i=r.animations.text[a];if(i){const a=i(e,o,l,c,u,d).onSplit(t);return a&&w.add(a),a}return null},n);e.splitInstance=t;break;default:console.warn(`Unknown animation type: ${h}`)}};s?T():requestAnimationFrame(T)}function F(e,t,a){const{anchorElement:i,anchorSelector:r,scrollStart:n}=t;let o=20;const s=n.match(/top\s+(\d+)%/);s&&(o=100-parseFloat(s[1]));const l=new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting&&e.classList.add("in-view")})},{threshold:[0,1],rootMargin:`0px 0px -${o}% 0px`}),c=new IntersectionObserver(t=>{t.forEach(t=>{const i=t.target.getBoundingClientRect();!t.isIntersecting&&i.top>=window.innerHeight&&(a.again||r)&&e.classList.remove("in-view")})},{threshold:0,rootMargin:"0px"});l.observe(i),c.observe(i)}function P(e,t){e&&console.error("Error initializing AlrdyAnimate:",e),t.forEach(e=>{e.classList.add("in-view")})}const q={init:async function(e={}){const a={...T,...e};let i=null;var n,l,c;if(w=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,w&&(console.log("AlrdyAnimate: Reduced motion detected, replacing animations with fade-only"),n=a.reducedMotionDuration,l=a.reducedMotionEase,document.querySelectorAll("[aa-animate], [aa-children], [aa-hover]").forEach(e=>{if(e.hasAttribute("aa-accordion-content")||e.hasAttribute("aa-accordion"))return;const t=e.getAttribute("aa-animate");t&&["background","clip","stack"].includes(t)||(e.hasAttribute("aa-load")&&e.hasAttribute("aa-animate")&&e.removeAttribute("aa-animate"),e.hasAttribute("aa-animate")&&e.setAttribute("aa-animate","fade"),e.hasAttribute("aa-children")&&e.setAttribute("aa-children","fade"),e.hasAttribute("aa-hover")&&e.setAttribute("aa-hover","none"),e.setAttribute("aa-duration",String(n)),e.setAttribute("aa-ease",l))}),a.templates=null),h=window.innerWidth<768,a.optimizePageSpeed&&h){const e="object"==typeof a.optimizePageSpeed?a.optimizePageSpeed:S;if(console.log("AlrdyAnimate: Page speed optimization enabled, replacing expensive animations on mobile"),c=e,document.querySelectorAll("[aa-animate], [aa-children], [aa-hover]").forEach(e=>{if(!(e.hasAttribute("aa-slider")||e.hasAttribute("aa-accordion")||e.hasAttribute("aa-marquee")))if(e.hasAttribute("aa-load")&&e.hasAttribute("aa-animate"))e.removeAttribute("aa-animate");else{if(e.hasAttribute("aa-hover")&&e.setAttribute("aa-hover","none"),e.hasAttribute("aa-animate")){const t=e.getAttribute("aa-animate");for(const[a,i]of Object.entries(c))if(t.startsWith(a)){e.setAttribute("aa-animate",i);break}}if(e.hasAttribute("aa-children")){const t=e.getAttribute("aa-children");for(const[a,i]of Object.entries(c))if(t.startsWith(a)){e.setAttribute("aa-children",i);break}}}}),!0===a.optimizePageSpeed){const e=["text","section","appear","hover"];a.gsapFeatures=a.gsapFeatures.filter(t=>!e.includes(t)),console.log("AlrdyAnimate: Removed expensive GSAP features on mobile:",e.join(", "))}}window.alrdyInitialized=!1,a.loadBaseDelay=(()=>{const e=getComputedStyle(document.documentElement).getPropertyValue("--load-base-delay").trim(),t=parseFloat(e);return Number.isFinite(t)?t:.5})(),v=setTimeout(()=>{window.alrdyInitialized||(console.warn("AlrdyAnimate initialization taking longer than expected - showing elements temporarily"),P(null,y))},1e3*a.initTimeout);try{!function(){let e=0,t=null,a=null,i=!1;requestAnimationFrame(()=>{document.body.hasAttribute("data-scroll-direction")?t=document.body.getAttribute("data-scroll-direction"):(document.body.setAttribute("data-scroll-direction","down"),t="down");const e=window.scrollY>50?"true":"false";document.body.setAttribute("data-scroll-started",e),a=e}),window.addEventListener("scroll",()=>{i||(requestAnimationFrame(()=>{const r=window.scrollY;if(Math.abs(r-e)>=5){const i=r>e?"down":"up",n=r>50?"true":"false";i!==t&&(document.body.setAttribute("data-scroll-direction",i),t=i),n!==a&&(document.body.setAttribute("data-scroll-started",n),a=n),e=r}i=!1}),i=!0)},{passive:!0})}(),function(){const e=new IntersectionObserver(e=>{e.forEach(e=>{const t=e.target.children;Array.from(t).forEach(t=>{const a=t.getAnimations();a.length>0&&a.forEach(t=>{e.isIntersecting?t.play():t.pause()})})})});document.querySelectorAll("[aa-toggle-playstate]").forEach(t=>{e.observe(t)})}(),b(),(0,f.l)({duration:a.duration,delay:a.delay});const e=m(a);document.querySelectorAll("[aa-children]").forEach(e=>{!function(e){const t=Array.from(e.children),a=e.hasAttribute("aa-delay")?parseFloat(e.getAttribute("aa-delay")):0,i=e.hasAttribute("aa-stagger")?parseFloat(e.getAttribute("aa-stagger")):0,r=e.getAttribute("aa-children");t.forEach((t,n)=>{if(t.hasAttribute("aa-animate"))return;r&&"true"!==r&&t.setAttribute("aa-animate",r),Array.from(e.attributes).filter(e=>e.name.startsWith("aa-")&&!["aa-children","aa-stagger","aa-delay","aa-accordion","aa-modal","aa-hover","aa-slider","aa-marquee","aa-nav"].includes(e.name)).forEach(e=>{t.setAttribute(e.name,e.value)});const o=a+n*i;t.setAttribute("aa-delay",o.toString())}),e.style.opacity="1"}(e)});let n=[...document.querySelectorAll("[aa-animate], [aa-hover], [aa-slider], [aa-accordion], [aa-marquee]")];if(e){const t=Object.keys(e).map(e=>`.${e}:not([aa-animate]):not([aa-load]):not([aa-slider]):not([aa-accordion]):not([aa-marquee])`).join(","),a=document.querySelectorAll(t);n=[...n,...a]}if(n.forEach(e=>{e._aaAttributeType={isAnimate:e.hasAttribute("aa-animate"),isHover:e.hasAttribute("aa-hover"),isSlider:e.hasAttribute("aa-slider"),isAccordion:e.hasAttribute("aa-accordion"),isMarquee:e.hasAttribute("aa-marquee"),isHybrid:e.hasAttribute("aa-load")&&e.hasAttribute("aa-animate")}}),y=n,A=a.gsapFeatures.length>0,!("IntersectionObserver"in window)&&!A)return void P("No IntersectionObserver support found",y);document.body.style.setProperty("--aa-default-duration",`${a.duration}s`),document.body.style.setProperty("--aa-default-delay",`${a.delay}s`),document.body.style.setProperty("--aa-default-distance",`${a.distance}`),document.body.style.setProperty("--aa-default-hover-duration",`${a.hoverDuration}s`),document.body.style.setProperty("--aa-default-hover-delay",`${a.hoverDelay}s`),document.body.style.setProperty("--aa-default-hover-distance",`${a.distance}`),document.body.setAttribute("aa-ease",a.ease);let l=null,c=null;return A&&(l=(async()=>{try{const{getGSAPModules:e,gsapBundles:t}=await r.e(357).then(r.bind(r,357)),{gsap:n,ScrollTrigger:o}=await e(a.includeGSAP),s={gsap:n,ScrollTrigger:o},l={};n.registerPlugin(o),window.gsap=n,window.ScrollTrigger=o;try{const e=a.gsapFeatures.map(async e=>{try{const i=t[e];if(!i)return{feature:e,success:!1};const[r,n,o]=await Promise.all([i.plugins?i.plugins(a.includeGSAP).catch(t=>(console.warn(`Failed to load plugins for ${e}:`,t),null)):Promise.resolve(null),i.dependencies?i.dependencies().catch(t=>(console.warn(`Failed to load dependencies for ${e}:`,t),null)):Promise.resolve(null),i.animations?i.animations().catch(t=>(console.warn(`Failed to load animations for ${e}:`,t),null)):Promise.resolve(null)]);return{feature:e,plugins:r,deps:n,animModule:o,success:!0}}catch(t){return console.warn(`Failed to load feature ${e}:`,t),{feature:e,success:!1}}});(await Promise.all(e)).forEach(({feature:e,plugins:t,deps:i,animModule:r,success:o})=>{if(o&&(t&&t.forEach(t=>{try{Object.entries(t).forEach(([e,t])=>{t?(n.registerPlugin(t),window[e]=t):console.warn(`Plugin ${e} not available from ${a.includeGSAP?"bundle":"Webflow"}`)}),Object.assign(s,t)}catch(t){console.warn(`Failed to register plugin for feature ${e}:`,t)}}),i&&(Object.assign(s,i),i.splitText&&(window.splitText=i.splitText)),r)){let t={};switch(e){case"text":t=r.createTextAnimations(s.gsap);break;case"section":t=r.createSectionAnimations(s.gsap,s.ScrollTrigger);break;case"parallax":t=r.createParallaxAnimations(s.gsap,s.ScrollTrigger);break;case"appear":t=r.createAppearAnimations(s.gsap,s.ScrollTrigger);break;case"marquee":t=r.createMarqueeAnimations(s.gsap,s.ScrollTrigger);break;case"slider":t=r.createSliderAnimations(s.gsap,s.Draggable);break;case"hover":t=r.createHoverAnimations(s.gsap,s.splitText);break;case"nav":t=r.createNavAnimations(s.gsap);break;case"accordion":t=r.createAccordionAnimations(s.gsap,a.duration)}Object.assign(l,t)}})}catch(e){console.warn("Failed to load some GSAP features:",e)}if(s.animations=l,a.smoothScroll?.enabled)try{const{coreBundles:e}=await r.e(357).then(r.bind(r,357)),t=e.smoothScroll,[{default:n},{initializeSmoothScroll:o}]=await Promise.all([t.plugins(),t.setup()]);i=o(n,s.gsap,s.ScrollTrigger,a.smoothScroll.options),window.lenis=i}catch(e){console.warn("Failed to initialize smooth scroll:",e)}if(a.gsapFeatures.includes("modal"))try{const e=(await t.modal.animations()).createModalAnimations(s.gsap,i,a.duration);s.animations.modal=t=>{if(e?.modal&&"function"==typeof e.modal)return e.modal(t)}}catch(e){console.warn("Failed to initialize modal animations:",e)}return s}catch(e){return console.warn("Failed to load GSAP core:",e),null}})()),new Promise(e=>{window.addEventListener("load",async()=>{if(A)if(c=await l,c){if(a.gsapFeatures.includes("modal")){const e=document.querySelectorAll("[aa-modal-group]");e.length>0&&e.forEach(e=>{c.animations.modal(e)})}if(E(y,a,h,c),function(e,a,i,r){let n=window.innerWidth,l=window.innerHeight;const c=t()(()=>{const t=window.innerWidth,c=window.innerHeight,u=t!==n,p=t<768;if(!p||u){if(!u&&c!==l)return a.gsapFeatures.includes("section")&&document.querySelectorAll('[aa-animate="pin-stack"]').forEach(t=>{e.animations?.updatePinStackOnResize&&e.animations.updatePinStackOnResize(t)}),e.animations?.cleanupRevealSlices&&document.querySelectorAll("[aa-animate*='reveal-slices']").forEach(t=>{const n=t.getAttribute("aa-animate");if(n&&n.includes("reveal-slices")){e.animations.cleanupRevealSlices(t);const n=t._aaAttributeType,o=s(t,t.settings,a,i,n);t.settings=o,r(t,o,a,i,e)}}),e.ScrollTrigger&&e.ScrollTrigger.refresh(!0),void(l=c);if(u){if(i=p,e.animations?.slider&&e.animations.cleanupSliders(),e.animations?.cleanupRevealSlices&&document.querySelectorAll("[aa-animate*='reveal-slices']").forEach(t=>{const n=t.getAttribute("aa-animate");if(n&&n.includes("reveal-slices")){e.animations.cleanupRevealSlices(t);const n=t._aaAttributeType,o=s(t,t.settings,a,i,n);t.settings=o,r(t,o,a,i,e)}}),document.querySelectorAll("[aa-animate], [aa-animate-original]").forEach(t=>{const n=t.getAttribute("aa-animate"),o=t.getAttribute("aa-animate-original");if((!n||!n.includes("reveal-slices"))&&(n&&n.includes("|")||o)){const n=t._aaAttributeType,o=s(t,t.settings,a,i,n);e.gsap&&(e.gsap.killTweensOf(t),e.gsap.set(t,{clearProps:"all"})),t.settings=o,r(t,o,a,i,e)}}),document.querySelectorAll("[aa-slider]").forEach(t=>{const r=t._aaAttributeType,n=s(t,t.settings,a,i,r);t.settings=n,e.animations?.slider&&n.sliderType&&"none"!==n.sliderType&&e.animations.slider(t,n.sliderType,n.duration,n.ease,n.delay)}),a.templates){const t=m(a);if(t){const n=Object.keys(t).map(e=>`.${e}:not([aa-animate]):not([aa-load])`).join(",");document.querySelectorAll(n).forEach(t=>{if(t.settings){const n=function(e,t,a){if(!d)return null;const i=g(e);if(!i)return null;const r={};i.animationType&&i.animationType.includes("|")&&(r.animationType=o(i.animationType,null,a));const n=i.animationType?.startsWith("text-");return n||Object.keys(r).length>0?{...t,...r}:t}(t,t.settings,i);if(n){const o=n.animationType?.startsWith("text-"),s=n.animationType?.includes("|");(o||s)&&(e.gsap&&(e.gsap.killTweensOf(t),e.gsap.set(t,{clearProps:"all"})),t.settings=n,r(t,t.settings,a,i,e))}}})}}if(e.Flip){const t=document.querySelector("[aa-nav]");if(t){const a=t.querySelector("[aa-nav-current-indicator]"),i=t.querySelector("[aa-nav-hover-indicator]"),r=t.querySelectorAll("[aa-scroll-target]");if(r.length>0){const n=t.querySelector("[aa-scroll-target].is-current")||r[0];n&&(a&&e.Flip.fit(a,n,{duration:0,absolute:!0,simple:!0}),i&&e.Flip.fit(i,n,{duration:0,absolute:!0,simple:!0}))}}}e.ScrollTrigger&&e.ScrollTrigger.refresh(!0),n=t,l=c}}else l=c},250);window.matchMedia("(hover: none)").matches?window.addEventListener("orientationchange",()=>{setTimeout(()=>{c()},100)}):window.addEventListener("resize",c)}(c,a,h,x),a.gsapFeatures.includes("nav")&&(c.animations.nav(c.ScrollTrigger),c.animations.initNavigationTracking(c.ScrollTrigger),c.animations.initNavSectionClasses(c.ScrollTrigger),c.Flip&&(c.animations.initCurrentIndicator(c.Flip),c.animations.initHoverIndicator(c.Flip))),c.ScrollTrigger&&c.ScrollTrigger.refresh(!0),a.lazyLoadHandler){const e="object"==typeof a.lazyLoadHandler?a.lazyLoadHandler:{};!function(e,t={}){const{lazy:a=!0,timeout:i=.5,maxWait:r=2,forceEagerAboveViewport:n=!0,forceEagerAfterDelay:o=3,excludeNavTriggers:s=!0,debug:l=!1}=t,c=()=>{requestAnimationFrame(()=>{s?e.getAll().forEach(e=>{const t=e.vars.trigger;t&&"function"==typeof t.hasAttribute&&t.hasAttribute("aa-nav")||e.refresh()}):e.refresh(!0)})},u=gsap.utils.toArray("img[loading='lazy']");if(!u.length)return;if(n&&window.scrollY>0){const e=window.scrollY;u.forEach(t=>{t.getBoundingClientRect().top+e<e&&(t.loading="eager")})}let d=u.length,p=null;const m=gsap.delayedCall(i,()=>{c(),p=null}).pause(),g=()=>{if(a){const e=Date.now();p||(p=e),(e-p)/1e3>=r?(c(),p=null):m.restart(!0)}else--d||c()},b=u.map(e=>({img:e,isLoaded:e.naturalWidth>0}));a||b.forEach(({img:e})=>{e.loading="eager"}),b.forEach(({img:e,isLoaded:t})=>{t?g():e.addEventListener("load",g,{once:!0})}),o&&o>0&&gsap.delayedCall(o,()=>{const e=gsap.utils.toArray("img[loading='lazy']");if(e.length>0){l&&console.log(`AlrdyAnimate: Converting ${e.length} remaining lazy images to eager after ${o}s`);let t=e.length;const a=()=>{0===--t&&c()},i=e.map(e=>({img:e,isLoaded:e.naturalWidth>0}));i.forEach(({img:e})=>{e.loading="eager"}),i.forEach(({img:e,isLoaded:t})=>{t?a():e.addEventListener("load",a,{once:!0})})}})}(c.ScrollTrigger,{...e,debug:a.debug})}}else A=!1,y.forEach(e=>{e.style.visibility="visible",e.style.opacity=1}),E(y,a,h,{gsap:null,ScrollTrigger:null});else E(y,a,h,{gsap:null,ScrollTrigger:null});d=null,clearTimeout(v),window.alrdyInitialized=!0,document.dispatchEvent(new Event("alrdy-init-complete")),e({gsap:c?.gsap||null,ScrollTrigger:c?.ScrollTrigger||null,lenis:i})})})}catch(e){throw window.alrdyInitialized||(P(e,y),document.dispatchEvent(new Event("alrdy-init-failed"))),e}},initPageAnimations:function(e){window.alrdyInitialized?e&&"function"==typeof e&&e():document.addEventListener("alrdy-init-complete",()=>{e&&"function"==typeof e&&e()})},gsap:window.gsap,ScrollTrigger:window.ScrollTrigger,Draggable:window.Draggable,splitText:window.splitText,lenis:window.lenis};"undefined"!=typeof window&&(window.AlrdyAnimate=q)})(),n.AlrdyAnimate})());