animotionjs-plus 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animotion.min.js +1 -1
- package/package.json +1 -1
package/dist/animotion.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Animotion=e():t.Animotion=e()}(this,function(){return function(){"use strict";var t={d:function(e,s){for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{AnimationContext:function(){return Ae},AnimationCore:function(){return fe},AudioAnimation:function(){return Jt},DomUtils:function(){return n},DotLottieSupport:function(){return ie},Draggable:function(){return Xt},Easing:function(){return i},EnvironmentUtils:function(){return r},Interactions:function(){return ye},Logger:function(){return f},LottieSupport:function(){return ee},MathUtils:function(){return s},ParallaxEffect:function(){return Ht},ParserUtils:function(){return o},SceneSequence:function(){return Qt},ScrollTrigger:function(){return Wt},SplitText:function(){return jt},SpringPhysics:function(){return Vt},TextEffects:function(){return a},ThreeJsSupport:function(){return Le},Timeline:function(){return $t},Tween:function(){return Bt},VideoAnimation:function(){return Kt},WebGLSupport:function(){return he},animotionAttrs:function(){return Me},default:function(){return Ce},keyframes:function(){return le},motionPath:function(){return Zt}});var s={};t.r(s),t.d(s,{angle:function(){return m},clamp:function(){return h},distance:function(){return d},lerp:function(){return l},map:function(){return u},random:function(){return c},randomInt:function(){return p},round:function(){return g}});var i={};t.r(i),t.d(i,{easeInBack:function(){return B},easeInBounce:function(){return X},easeInCirc:function(){return N},easeInCubic:function(){return T},easeInElastic:function(){return U},easeInExpo:function(){return O},easeInOutBack:function(){return j},easeInOutBounce:function(){return H},easeInOutCirc:function(){return D},easeInOutCubic:function(){return w},easeInOutElastic:function(){return Y},easeInOutExpo:function(){return q},easeInOutQuad:function(){return b},easeInOutQuart:function(){return L},easeInOutQuint:function(){return k},easeInOutSine:function(){return I},easeInQuad:function(){return y},easeInQuart:function(){return E},easeInQuint:function(){return M},easeInSine:function(){return F},easeOutBack:function(){return $},easeOutBounce:function(){return W},easeOutCirc:function(){return R},easeOutCubic:function(){return S},easeOutElastic:function(){return z},easeOutExpo:function(){return _},easeOutQuad:function(){return A},easeOutQuart:function(){return x},easeOutQuint:function(){return C},easeOutSine:function(){return P},getAvailableEasings:function(){return G},getEaseFunction:function(){return V},linear:function(){return v}});var r={};t.r(r),t.d(r,{getDocument:function(){return at},getWindow:function(){return ot},isBrowser:function(){return nt},isElement:function(){return ht},isNodeList:function(){return lt}});var n={};t.r(n),t.d(n,{addClass:function(){return _t},getData:function(){return Dt},getElement:function(){return kt},getElementByIdOrSelector:function(){return Pt},getElements:function(){return Ft},hasClass:function(){return Ot},placeElementInContainer:function(){return It},removeClass:function(){return qt},setData:function(){return Rt},toggleClass:function(){return Nt}});var o={};t.r(o),t.d(o,{parseBoolean:function(){return pe},parseCSS:function(){return de},parseJSON:function(){return ue},parseNumber:function(){return ce}});var a={};t.r(a),t.d(a,{blurEffect:function(){return we},counterAnimation:function(){return Se},morphText:function(){return xe},scrambleText:function(){return Te},typeText:function(){return be},waveEffect:function(){return Ee}});const h=(t,e,s)=>Math.max(e,Math.min(s,t)),l=(t,e,s)=>t+(e-t)*h(s,0,1),u=(t,e,s,i,r)=>i+(t-e)*(r-i)/(s-e),c=(t,e)=>Math.random()*(e-t)+t,p=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,d=(t,e,s,i)=>Math.sqrt(Math.pow(s-t,2)+Math.pow(i-e,2)),m=(t,e,s,i)=>Math.atan2(i-e,s-t),g=(t,e=0)=>Number(Math.round(t+"e"+e)+"e-"+e);var f=new class{constructor(){this.level="warn",this.levels={debug:0,info:1,warn:2,error:3}}setLevel(t){this.level=t}debug(t){this.levels[this.level]<=0&&console.log("[Animotion Debug]",t)}info(t){this.levels[this.level]<=1&&console.log("[Animotion Info]",t)}warn(t){this.levels[this.level]<=2&&console.warn("[Animotion Warn]",t)}error(t){this.levels[this.level]<=3&&console.error("[Animotion Error]",t)}};const v=t=>t,y=t=>t*t,A=t=>t*(2-t),b=t=>t<.5?2*t*t:(4-2*t)*t-1,T=t=>t*t*t,S=t=>--t*t*t+1,w=t=>t<.5?4*t*t*t:2*(t-2)*(t-1)*(2*(t-2))+1,E=t=>t*t*t*t,x=t=>1- --t*t*t*t,L=t=>t<.5?8*t*t*t*t:1-8*--t*t*t*t,M=t=>t*t*t*t*t,C=t=>1+--t*t*t*t*t,k=t=>t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t,F=t=>1-Math.cos(t*Math.PI/2),P=t=>Math.sin(t*Math.PI/2),I=t=>-(Math.cos(Math.PI*t)-1)/2,O=t=>0===t?0:Math.pow(2,10*t-10),_=t=>1===t?1:1-Math.pow(2,-10*t),q=t=>0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2,N=t=>1-Math.sqrt(1-Math.pow(t,2)),R=t=>Math.sqrt(1-Math.pow(t-1,2)),D=t=>t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2,B=t=>{const e=1.70158;return 2.70158*t*t*t-e*t*t},$=t=>{const e=1.70158;return 1+2.70158*Math.pow(t-1,3)+e*Math.pow(t-1,2)},j=t=>{const e=2.5949095;return t<.5?Math.pow(2*t,2)*(7.189819*t-e)/2:(Math.pow(2*t-2,2)*((e+1)*(2*t-2)+e)+2)/2},U=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:-Math.pow(2,10*t-10)*Math.sin((10*t-10.75)*e)},z=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Y=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1},W=t=>{const e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-=1.5/s)*t+.75:t<2.5/s?e*(t-=2.25/s)*t+.9375:e*(t-=2.625/s)*t+.984375},X=t=>1-W(1-t),H=t=>t<.5?(1-W(1-2*t))/2:(1+W(2*t-1))/2,V=(t="linear")=>({linear:v,"ease-in":y,"ease-out":A,"ease-in-out":b,none:v,"quad-in":y,"quad-out":A,"quad-in-out":b,"cubic-in":T,"cubic-out":S,"cubic-in-out":w,"quart-in":E,"quart-out":x,"quart-in-out":L,"quint-in":M,"quint-out":C,"quint-in-out":k,"sine-in":F,"sine-out":P,"sine-in-out":I,"expo-in":O,"expo-out":_,"expo-in-out":q,"circ-in":N,"circ-out":R,"circ-in-out":D,"back-in":B,"back-out":$,"back-in-out":j,"elastic-in":U,"elastic-out":z,"elastic-in-out":Y,"bounce-in":X,"bounce-out":W,"bounce-in-out":H}[t.toLowerCase()]||v),G=()=>["linear","ease-in","ease-out","ease-in-out","quad-in","quad-out","quad-in-out","cubic-in","cubic-out","cubic-in-out","quart-in","quart-out","quart-in-out","quint-in","quint-out","quint-in-out","sine-in","sine-out","sine-in-out","expo-in","expo-out","expo-in-out","circ-in","circ-out","circ-in-out","back-in","back-out","back-in-out","elastic-in","elastic-out","elastic-in-out","bounce-in","bounce-out","bounce-in-out"],Z=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Q=t=>"[object Object]"===Object.prototype.toString.call(t),K=t=>{const e=Number(t);return Number.isFinite(e)?e:null},J=(t,e=255)=>Math.round(h(t,0,e)),tt=t=>{const e=t.match(/hsla?\(([^)]+)\)/i);if(!e)return null;const s=e[1].split(",").map(t=>t.trim().replace("%",""));if(s.length<3)return null;const i=((t,e,s)=>{const i=(t%360+360)%360/360,r=h(e/100,0,1),n=h(s/100,0,1);if(0===r){const t=255*n;return{r:t,g:t,b:t}}const o=n<.5?n*(1+r):n+r-n*r,a=2*n-o,l=t=>{let e=t;return e<0&&(e+=1),e>1&&(e-=1),e<1/6?a+6*(o-a)*e:e<.5?o:e<2/3?a+(o-a)*(2/3-e)*6:a};return{r:255*l(i+1/3),g:255*l(i),b:255*l(i-1/3)}})(K(s[0])??0,K(s[1])??0,K(s[2])??0);return{...i,a:K(s[3])??1}},et=t=>{if("string"!=typeof t)return null;const e=t.trim();return(t=>{const e=t.replace("#","").trim();if(![3,4,6,8].includes(e.length))return null;const s=e.length<=4?e.split("").map(t=>t+t).join(""):e,i=8===s.length?parseInt(s.slice(6,8),16)/255:1;return{r:parseInt(s.slice(0,2),16),g:parseInt(s.slice(2,4),16),b:parseInt(s.slice(4,6),16),a:i}})(e)||(t=>{const e=t.match(/rgba?\(([^)]+)\)/i);if(!e)return null;const s=e[1].split(",").map(t=>t.trim());return s.length<3?null:{r:K(s[0])??0,g:K(s[1])??0,b:K(s[2])??0,a:K(s[3])??1}})(e)||tt(e)},st=(t,e)=>{const s=et(t),i=et(e);return s&&i?t=>(t=>{const e=Math.round(1e3*h(t.a,0,1))/1e3;return`rgba(${J(t.r)}, ${J(t.g)}, ${J(t.b)}, ${e})`})({r:s.r+(i.r-s.r)*t,g:s.g+(i.g-s.g)*t,b:s.b+(i.b-s.b)*t,a:s.a+(i.a-s.a)*t}):null},it=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)return null;const s=t.match(Z),i=e.match(Z);if(!s||!i||s.length!==i.length)return null;const r=e.split(Z);if(r.length!==i.length+1)return null;const n=s.map(t=>Number(t)),o=i.map(t=>Number(t));return n.some(t=>!Number.isFinite(t))||o.some(t=>!Number.isFinite(t))?null:t=>{let e=r[0]||"";return o.forEach((s,i)=>{const o=n[i]+(s-n[i])*t;e+=(t=>{if(!Number.isFinite(t))return 0;const e=Math.round(1e4*t)/1e4;return String(e).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")})(o),e+=r[i+1]||""}),e}},rt=(t,e)=>{const s=K(t),i=K(e);if(null!==s&&null!==i)return t=>s+(i-s)*t;const r=st(t,e);if(r)return r;const n=it(t,e);if(n)return n;const o=((t,e)=>{if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return null;const s=t.map((t,s)=>rt(t,e[s]));return t=>s.map(e=>e(t))})(t,e);if(o)return o;if(Q(t)&&Q(e)){const s=Object.keys(e),i=s.reduce((s,i)=>(s[i]=rt(t[i],e[i]),s),{});return t=>s.reduce((e,s)=>(e[s]=i[s](t),e),{})}return s=>s<1?t:e},nt=()=>"undefined"!=typeof window&&"undefined"!=typeof document,ot=()=>"undefined"!=typeof window?window:null,at=()=>"undefined"!=typeof document?document:null,ht=t=>!(!nt()||"undefined"==typeof Element)&&t instanceof Element,lt=t=>"undefined"!=typeof NodeList&&t instanceof NodeList,ut=new WeakMap,ct=new WeakMap,pt={x:"0px",y:"0px",z:"0px",scale:1,scaleX:1,scaleY:1,scaleZ:1,rotate:"0deg",rotateX:"0deg",rotateY:"0deg",rotateZ:"0deg",skewX:"0deg",skewY:"0deg"},dt={blur:"0px",brightness:1,contrast:1,grayscale:0,hueRotate:"0deg",invert:0,saturate:1,sepia:0},mt=Object.keys(pt),gt=Object.keys(dt),ft=t=>t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase()),vt=t=>t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),yt=t=>String(t).split(".").filter(Boolean),At=(t,e)=>yt(e).reduce((t,e)=>{if(null!=t)return t[e]},t),bt=(t,e,s)=>{const i=yt(e);if(0===i.length)return;const r=i.pop(),n=i.reduce((t,e)=>null==t?null:t[e],t);if(!n||!r)return;const o=n[r];!o||"function"!=typeof o.set||"string"!=typeof s&&"number"!=typeof s?o&&"function"==typeof o.copy&&s&&"object"==typeof s?o.copy(s):n[r]=s:o.set(s)},Tt=t=>{if(ut.has(t))return ut.get(t);const e=ot(),s=e?.getComputedStyle?.(t).transform,i={base:s&&"none"!==s?s:"",values:{...pt}};return ut.set(t,i),i},St=t=>{if(ct.has(t))return ct.get(t);const e=ot(),s=e?.getComputedStyle?.(t).filter,i={base:s&&"none"!==s?s:"",values:{...dt}};return ct.set(t,i),i},wt=(t,e,s)=>{if(mt.includes(e)){const i=Tt(t);return"scale"===e?(i.values.scaleX=s,i.values.scaleY=s,i.values.scaleZ=s):i.values[e]=s,void(t=>{const e=Tt(t),s=[e.base,`translate3d(${e.values.x}, ${e.values.y}, ${e.values.z})`,`rotate(${e.values.rotate})`,`rotateX(${e.values.rotateX})`,`rotateY(${e.values.rotateY})`,`rotateZ(${e.values.rotateZ})`,`skewX(${e.values.skewX})`,`skewY(${e.values.skewY})`,`scale3d(${e.values.scaleX}, ${e.values.scaleY}, ${e.values.scaleZ})`].filter(Boolean);t.style.transform=s.join(" ").trim()})(t)}if(gt.includes(e))return St(t).values[e]=s,void(t=>{const e=St(t),s=[e.base,`blur(${e.values.blur})`,`brightness(${e.values.brightness})`,`contrast(${e.values.contrast})`,`grayscale(${e.values.grayscale})`,`hue-rotate(${e.values.hueRotate})`,`invert(${e.values.invert})`,`saturate(${e.values.saturate})`,`sepia(${e.values.sepia})`].filter(Boolean);t.style.filter=s.join(" ").trim()})(t);if(e.startsWith("--"))return void t.style.setProperty(e,s);if(e.startsWith("attr."))return void t.setAttribute(e.slice(5),s);if("scrollTop"===e||"scrollLeft"===e)return void(t[e]=Number(s));if(e.startsWith("style.")){const i=ft(e.slice(6));return void(t.style[i]=s)}if(e.includes("."))return void bt(t,e,s);const i=ft(e);i in t.style?t.style[i]=s:e in t&&"function"!=typeof t[e]?t[e]=s:bt(t,e,s)},Et=t=>ht(t),xt=(t,e={})=>{if(null==t)return[];if("string"==typeof t){if(!nt())return[];const s=e.scope&&ht(e.scope)?e.scope:document;return Array.from(s.querySelectorAll(t))}return Array.isArray(t)?t.flatMap(t=>xt(t,e)):lt(t)?Array.from(t):[t]},Lt=(t,e="")=>Object.entries(t||{}).reduce((t,[s,i])=>{const r=e?`${e}.${s}`:s;return!(t=>"[object Object]"===Object.prototype.toString.call(t))(i)||Array.isArray(i)||r.startsWith("attr.")||r.startsWith("style.")?(t[r]=i,t):(Object.assign(t,Lt(i,r)),t)},{}),Mt=(t,e)=>{if(Et(t))return((t,e)=>{const s=ot(),i=s?.getComputedStyle?.(t);if(mt.includes(e))return Tt(t).values[e];if(gt.includes(e))return St(t).values[e];if(e.startsWith("--"))return i?.getPropertyValue(e).trim()||t.style.getPropertyValue(e).trim()||"0";if(e.startsWith("attr."))return t.getAttribute(e.slice(5));if("scrollTop"===e||"scrollLeft"===e)return t[e];if(e.startsWith("style.")){const s=ft(e.slice(6));return t.style[s]||i?.[s]||""}if(e.includes(".")&&!e.startsWith("style."))return At(t,e);if(e in t&&"function"!=typeof t[e])return t[e];const r=ft(e);return r in t.style||i?.getPropertyValue(vt(r))?t.style[r]||i?.getPropertyValue(vt(r)).trim()||i?.[r]||"":At(t,e)})(t,e);const s=At(t,e);if(s&&"object"==typeof s&&"function"==typeof s.getStyle)return s.getStyle();if(s&&"object"==typeof s&&"number"==typeof s.r&&"number"==typeof s.g&&"number"==typeof s.b){const t="number"==typeof s.a?s.a:1;return`rgba(${Math.round(255*s.r)}, ${Math.round(255*s.g)}, ${Math.round(255*s.b)}, ${t})`}return s},Ct=(t,e,s)=>{Et(t)?wt(t,e,s):bt(t,e,s)},kt=(t,e=null)=>{if(!t)return e;if("string"==typeof t)try{return document.querySelector(t)||e}catch(t){return e}return t},Ft=(t,e=[])=>{if(!t)return e;if("string"==typeof t)try{return Array.from(document.querySelectorAll(t))}catch(t){return e}return t instanceof Element?[t]:Array.isArray(t)?t:e},Pt=(t,e=null)=>{if(!t)return e;if("string"==typeof t){const s=t.trim();return s?s.startsWith("#")?document.getElementById(s.slice(1))||e:document.querySelector(s)||document.getElementById(s)||e:e}return t instanceof Element?t:e},It=(t,e)=>{if(!(t&&e&&e.appendChild&&t.getBoundingClientRect))return;if(t===e||e.contains(t))return;const s=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=window.getComputedStyle(e);"static"===r.position&&(e.style.position="relative");const n=parseFloat(r.paddingLeft||"0"),o=parseFloat(r.paddingTop||"0"),a=i.left-s.left-parseFloat(r.borderLeftWidth||"0")-n,h=i.top-s.top-parseFloat(r.borderTopWidth||"0")-o;t.style.position="absolute",t.style.left=`${a}px`,t.style.top=`${h}px`,t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,t.style.margin="0",e.appendChild(t)},Ot=(t,e)=>t.classList.contains(e),_t=(t,e)=>t.classList.add(e),qt=(t,e)=>t.classList.remove(e),Nt=(t,e)=>t.classList.toggle(e),Rt=(t,e,s)=>{t.dataset[e]=s},Dt=(t,e,s=null)=>t.dataset[e]||s;var Bt=class{constructor(t,e,s={}){this.originalTarget=t,this.targets=xt(t,s),this.props=Lt(e),this.fromProps=s.fromTo?Lt(s.fromTo):null,this.duration=Math.max(s.duration||1,0),this.ease=s.ease||"ease-out",this.delay=s.delay||0,this.repeat=s.repeat||0,this.yoyo=!1!==s.yoyo,this.stagger=s.stagger||0,this.from=!0===s.from,this.place=s.place||s.stick||null,this.placed=!1,this.render=s.render||null,this.onStart=s.onStart||null,this.onUpdate=s.onUpdate||null,this.onComplete=s.onComplete||null,this.onRepeat=s.onRepeat||null,this.paused=!0===s.paused,this.frameId=null,this.startTime=null,this.currentTime=0,this.currentRepeat=0,this.isReverse=!1,this.hasStarted=!1,this.totalDuration=this.duration+Math.max(this.targets.length-1,0)*this.stagger,this.targetStates=this.targets.map((t,e)=>({target:t,offset:e*this.stagger,properties:this.createPropertyAnimations(t,e)})),this.delay>0?setTimeout(()=>this.play(),1e3*this.delay):this.paused||this.play()}createPropertyAnimations(t,e){return Object.entries(this.props).map(([s,i])=>{const r=Mt(t,s),n=this.resolveValue(i,t,e,r),o=this.from?this.resolveValue(i,t,e,r):this.resolveValue(this.fromProps?.[s],t,e,r);let a=this.from||this.fromProps?o:r,h=this.from?r:n;return[a,h]=this.normalizeValueTypes(a,h),{path:s,startValue:a,endValue:h,interpolator:rt(a,h)}})}normalizeValueTypes(t,e){if("number"==typeof t&&"string"==typeof e){const s=e.match(/(px|deg|%|em|rem|vh|vw|vmin|vmax|cm|mm|in|pt|pc|s|ms)$/);s&&(t+=s[1])}else if("string"==typeof t&&"number"==typeof e){const s=t.match(/(px|deg|%|em|rem|vh|vw|vmin|vmax|cm|mm|in|pt|pc|s|ms)$/);s&&(e+=s[1])}return[t,e]}resolveValue(t,e,s,i){return"function"==typeof t?t(e,s,i):void 0===t?i:t}play(){if(this.paused||!this.frameId){if(this.paused=!1,0===this.totalDuration)return this.seek(1),this.placeIntoDestination(),void this.onComplete?.(this);this.startTime=performance.now()-this.currentTime*this.totalDuration*1e3,this.animate()}}pause(){this.paused=!0,this.frameId&&(cancelAnimationFrame(this.frameId),this.frameId=null)}reverse(){this.isReverse=!this.isReverse,this.seek(this.currentTime),this.paused||this.play()}restart(){this.currentTime=0,this.currentRepeat=0,this.hasStarted=!1,this.play()}seek(t){return this.currentTime=h(t,0,1),this.applyFrame(this.currentTime),this.currentTime>=1&&this.placeIntoDestination(),this}progress(t){return void 0!==t&&this.seek(t),this.currentTime}kill(){this.pause(),this.targets=[],this.targetStates=[],this.props=null,this.place=null,this.placed=!1}placeIntoDestination(){if(this.placed||!this.place)return;const t="string"==typeof this.place?Pt(this.place):this.place;t&&ht(t)&&(this.targets.forEach(e=>{ht(e)&&e!==t&&!t.contains(e)&&It(e,t)}),this.placed=!0)}animate=()=>{if(this.paused)return;this.startTime||(this.startTime=performance.now());const t=(performance.now()-this.startTime)/1e3;this.currentTime=0===this.totalDuration?1:h(t/this.totalDuration,0,1),this.applyFrame(this.currentTime),this.currentTime>=1?(this.currentRepeat++,this.repeat>0&&this.currentRepeat<=this.repeat?(this.yoyo&&(this.isReverse=!this.isReverse),this.startTime=performance.now(),this.onRepeat?.(this),this.frameId=requestAnimationFrame(this.animate)):(this.pause(),this.placeIntoDestination(),this.onComplete?.(this))):this.frameId=requestAnimationFrame(this.animate)};applyFrame(t){const e=h(t,0,1)*this.totalDuration,s=this.isReverse?this.totalDuration-e:e,i=V(this.ease);this.hasStarted||(this.hasStarted=!0,this.onStart?.(this)),this.targetStates.forEach(t=>{const e=this.getTargetProgress(s,t.offset),r=i(e);t.properties.forEach(e=>{const s=e.interpolator(r);Ct(t.target,e.path,s)})}),this.render?.(this),this.onUpdate?.(this)}getTargetProgress(t,e){if(0===this.duration)return t>=e?1:0;const s=h(t-e,0,this.duration);return h(s/this.duration,0,1)}};var $t=class{constructor(t={}){this.id=t.id||`timeline-${Date.now()}`,this.items=[],this.labels=new Map,this.duration=0,this.currentTime=0,this.autoplay=!1!==t.autoplay,this.paused=!0===t.paused,this.autoplayPending=this.autoplay&&!this.paused,this.isPlaying=!1,this.repeat=t.repeat||0,this.yoyo=!1!==t.yoyo,this.isReverse=!1,this.currentRepeat=0,this.frameId=null,this.startTime=null,this.onComplete=t.onComplete||null,this.scope=t.scope||null,f.debug(`Timeline created: ${this.id}`)}to(t,e,s=1,i="ease-out",r=">"){return this.addTween(t,e,{duration:s,ease:i,paused:!0,scope:this.scope},r)}from(t,e,s=1,i="ease-out",r=">"){return this.addTween(t,e,{duration:s,ease:i,from:!0,paused:!0,scope:this.scope},r)}fromTo(t,e,s,i=1,r="ease-out",n=">"){return this.addTween(t,s,{duration:i,ease:r,fromTo:e,paused:!0,scope:this.scope},n)}set(t,e,s=">"){return this.addTween(t,e,{duration:0,paused:!0,scope:this.scope},s)}call(t,e=">"){return this.addItem({type:"call",callback:t,startTime:this.resolvePosition(e),hasApplied:!1})}addLabel(t,e=">"){return this.labels.set(t,this.resolvePosition(e)),this}addTween(t,e,s,i){const r=new Bt(t,e,s);return r.pause(),this.addItem({type:"tween",tween:r,startTime:this.resolvePosition(i),duration:r.totalDuration})}addItem(t){return this.items.push(t),this.calculateDuration(),this.scheduleAutoplay(),this}scheduleAutoplay(){this.autoplayPending&&!this.isPlaying&&queueMicrotask(()=>{this.autoplayPending&&!this.isPlaying&&0!==this.items.length&&(this.autoplayPending=!1,this.play())})}resolvePosition(t){if("number"==typeof t)return t;if("<"===t){const t=this.items[this.items.length-1];return t?t.startTime:0}if(">"===t||null==t)return this.duration;if("string"==typeof t){const e=t.match(/^([a-zA-Z0-9_-]+)?([+-]=)(\d*\.?\d+)$/);if(e){const[,t,s,i]=e,r=t?this.labels.get(t)??this.duration:this.duration,n=Number(i);return"+="===s?r+n:Math.max(0,r-n)}if(this.labels.has(t))return this.labels.get(t)}return this.duration}calculateDuration(){this.duration=this.items.reduce((t,e)=>{const s="tween"===e.type?e.duration:0;return Math.max(t,e.startTime+s)},0)}play(){if(!this.isPlaying||this.paused){if(this.paused=!1,this.isPlaying=!0,0===this.duration)return this.currentTime=1,this.applyFrame(),this.pause(),void this.onComplete?.();this.startTime=performance.now()-this.currentTime*this.duration*1e3,this.animate()}}pause(){this.paused=!0,this.isPlaying=!1,this.frameId&&(cancelAnimationFrame(this.frameId),this.frameId=null)}reverse(){this.isReverse=!this.isReverse,this.applyFrame()}restart(){this.currentTime=0,this.isReverse=!1,this.currentRepeat=0,this.items.forEach(t=>{"call"===t.type&&(t.hasApplied=!1)}),this.play()}seek(t){return this.currentTime=h(t,0,1),this.applyFrame(),this}progress(t){return void 0!==t&&this.seek(t),this.currentTime}animate=()=>{if(this.paused)return;this.startTime||(this.startTime=performance.now());const t=(performance.now()-this.startTime)/1e3,e=0===this.duration?1:h(t/this.duration,0,1);this.currentTime=this.isReverse?1-e:e,this.applyFrame();(this.isReverse?this.currentTime<=0:this.currentTime>=1)?(this.currentRepeat++,this.repeat>0&&this.currentRepeat<this.repeat?(this.startTime=performance.now(),this.yoyo&&(this.isReverse=!this.isReverse),this.frameId=requestAnimationFrame(this.animate)):(this.pause(),this.onComplete?.())):this.frameId=requestAnimationFrame(this.animate)};applyFrame(){const t=this.currentTime*this.duration;this.items.forEach(e=>{if("call"===e.type)return void(t>=e.startTime&&!e.hasApplied?(e.callback?.(this),e.hasApplied=!0):t<e.startTime&&(e.hasApplied=!1));const s=e.startTime+e.duration;if(t<=e.startTime)return void e.tween.seek(0);if(t>=s)return void e.tween.seek(1);const i=t-e.startTime,r=0===e.duration?1:h(i/e.duration,0,1);e.tween.seek(r)})}kill(){this.pause(),this.items.forEach(t=>{t.tween?.kill?.()}),this.items=[],this.duration=0}};var jt=class{constructor(t,e={}){this.element=t,this.type=e.type||"chars",this.id=e.id||`split-${Date.now()}`,this.spans=[],this.groups={chars:[],words:[],lines:[]},this.split(),f.debug(`SplitText created: ${this.id}`)}split(){const t=this.element.textContent||"";this.element.innerHTML="";const e=document.createDocumentFragment();if("words"===this.type){(t.match(/\s+|\S+/g)||[]).forEach(t=>{const s=document.createElement("span");s.textContent=t,s.style.display="inline-block",e.appendChild(s),this.spans.push(s),this.groups.words.push(s)})}else if("lines"===this.type){const s=t.split(/\r?\n/);s.forEach((t,i)=>{const r=document.createElement("span");r.textContent=t+(i<s.length-1?"\n":""),r.style.display="block",e.appendChild(r),this.spans.push(r),this.groups.lines.push(r)})}else for(let s=0;s<t.length;s++){const i=document.createElement("span");i.textContent=t[s],i.style.display="inline-block",e.appendChild(i),this.spans.push(i),this.groups.chars.push(i)}this.element.appendChild(e)}getSpans(t){if(!t||"all"===t)return this.spans;if("chars"===t)return this.groups.chars;if("words"===t)return this.groups.words;if("lines"===t)return this.groups.lines;if("first"===t)return[this.spans[0]];if("last"===t)return[this.spans[this.spans.length-1]];if(t.startsWith("index:")){const e=parseInt(t.split(":")[1]);return[this.spans[e]]}return this.spans}revert(){const t=this.spans.map(t=>t.textContent).join("");this.element.textContent=t}};const Ut=()=>window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,zt=(t,e,s,i)=>{if("number"==typeof t)return t;const[r="top",n="bottom"]=String(t||"top bottom").trim().split(/\s+/);return e+((t,e)=>{if("number"==typeof t)return t;if(!t)return 0;const s=String(t).trim();return"top"===s?0:"center"===s?e.height/2:"bottom"===s?e.height:s.endsWith("%")?e.height*(parseFloat(s)/100):s.endsWith("px")?parseFloat(s):Number(s)||0})(r,s)-((t,e)=>{if("number"==typeof t)return t;if(!t)return 0;const s=String(t).trim();return"top"===s?0:"center"===s?e/2:"bottom"===s?e:s.endsWith("%")?e*(parseFloat(s)/100):s.endsWith("px")?parseFloat(s):Number(s)||0})(n,i)},Yt=(t,e,s,i)=>{if("number"==typeof t)return t;if(!t)return i;const r=String(t).trim();if(r.startsWith("+="))return Yt(r.slice(2),e,s,i);if(r.endsWith("vh"))return s*(parseFloat(r)/100);if(r.endsWith("%"))return e.height*(parseFloat(r)/100);if(r.endsWith("px"))return parseFloat(r);const n=Number(r);return Number.isFinite(n)?n:i};var Wt=class{constructor(t={}){this.trigger=t.trigger,this.start=t.start||"top center",this.end=t.end||(t.pin?"+=100vh":"bottom center"),this.scrub=t.scrub||!1,this.pin=t.pin||!1,this.pinTarget=t.pinTarget||this.trigger,this.pinSpacing=!1!==t.pinSpacing,this.pinClass=t.pinClass||"am-pinned",this.pinZIndex=t.pinZIndex||10,this.anticipatePin=t.anticipatePin||0,this.duration=t.duration||t.scrollDistance||null,this.animation=t.animation||null,this.reverse=!0===t.reverse,this.once=!0===t.once,this.markers=t.markers||!1,this.onEnter=t.onEnter||null,this.onLeave=t.onLeave||null,this.onEnterBack=t.onEnterBack||null,this.onLeaveBack=t.onLeaveBack||null,this.onUpdate=t.onUpdate||null,this.progress=0,this.isActive=!1,this.direction=1,this.previousScrollY=Ut(),this.startY=0,this.endY=0,this.pinOffset=0,this.pinActive=!1,this.spacer=null,this.originalPinStyles=null,this.handleScroll=this.handleScroll.bind(this),this.refresh=this.refresh.bind(this),window.addEventListener("scroll",this.handleScroll,{passive:!0}),window.addEventListener("resize",this.refresh),this.refresh(),f.debug("ScrollTrigger created for element")}calculateBounds(){const t=this.trigger.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,s=this.trigger.getBoundingClientRect().top+Ut();const i=this.duration?Number(this.duration):Math.max(t.height,e);this.startY=zt(this.start,s,t,e)-this.anticipatePin,"string"==typeof this.end&&this.end.trim().startsWith("+=")?this.endY=this.startY+Yt(this.end,t,e,i):(this.endY=zt(this.end,s,t,e),this.endY<=this.startY&&(this.endY=this.startY+i))}handleScroll(){const t=Ut(),e=this.isActive,s=this.progress,i=Math.max(this.endY-this.startY,1);this.direction=t>=this.previousScrollY?1:-1,this.previousScrollY=t,this.progress=h((t-this.startY)/i,0,1),this.isActive=t>=this.startY&&t<=this.endY,this.updatePin(t),this.updateAnimation(),this.isActive&&!e?this.direction>=0?this.onEnter?.(this):this.onEnterBack?.(this):!this.isActive&&e&&(this.direction>=0?this.onLeave?.(this):this.onLeaveBack?.(this)),this.reverse&&this.direction<0&&s>0&&0===this.progress&&this.animation?.reverse?.(),this.onUpdate?.({progress:this.progress,isActive:this.isActive,direction:this.direction,trigger:this}),this.once&&this.progress>=1&&this.kill()}updateAnimation(){if(this.animation)return this.scrub?(this.animation.seek?.(this.progress),this.animation.progress?.(this.progress),void this.animation.scrubToProgress?.(this.progress)):void(this.isActive&&this.direction>=0?this.animation.play?.():this.reverse&&this.direction<0&&this.animation.reverse?.())}setupPin(){if(!this.pin||this.spacer||!this.pinTarget?.parentNode)return;const t=this.pinTarget.getBoundingClientRect();this.spacer=document.createElement("div"),this.spacer.className="am-pin-spacer",this.spacer.style.position="relative",this.spacer.style.width=`${t.width}px`,this.spacer.style.height=this.pinSpacing?`${t.height+Math.max(this.endY-this.startY,0)}px`:`${t.height}px`,this.originalPinStyles={position:this.pinTarget.style.position,top:this.pinTarget.style.top,left:this.pinTarget.style.left,width:this.pinTarget.style.width,zIndex:this.pinTarget.style.zIndex,transform:this.pinTarget.style.transform},this.pinTarget.parentNode.insertBefore(this.spacer,this.pinTarget),this.spacer.appendChild(this.pinTarget)}updatePin(t){if(!this.pin)return;if(this.setupPin(),!this.spacer)return;const e=this.spacer.getBoundingClientRect(),s=t>=this.startY&&t<=this.endY;s&&!this.pinActive?(this.pinOffset=t-this.startY,this.pinTarget.classList.add(this.pinClass),this.pinTarget.style.position="fixed",this.pinTarget.style.top="0px",this.pinTarget.style.left=`${e.left}px`,this.pinTarget.style.width=`${e.width}px`,this.pinTarget.style.zIndex=String(this.pinZIndex),this.pinActive=!0):!s&&this.pinActive&&(this.pinTarget.classList.remove(this.pinClass),Object.assign(this.pinTarget.style,this.originalPinStyles),this.pinActive=!1),this.pinActive?(this.pinTarget.style.left=`${e.left}px`,this.pinTarget.style.width=`${e.width}px`):t>this.endY&&this.pinSpacing?this.pinTarget.style.transform=`translateY(${Math.max(this.endY-this.startY,0)}px)`:!this.pinActive&&this.originalPinStyles&&(this.pinTarget.style.transform=this.originalPinStyles.transform)}refresh(){if(this.pinActive&&(Object.assign(this.pinTarget.style,this.originalPinStyles),this.pinTarget.classList.remove(this.pinClass),this.pinActive=!1),this.spacer){const t=this.spacer.parentNode;t?.insertBefore(this.pinTarget,this.spacer),this.spacer.remove(),this.spacer=null}this.calculateBounds(),this.setupPin(),this.handleScroll()}kill(){if(window.removeEventListener("scroll",this.handleScroll),window.removeEventListener("resize",this.refresh),this.pinActive&&this.originalPinStyles&&(Object.assign(this.pinTarget.style,this.originalPinStyles),this.pinTarget.classList.remove(this.pinClass)),this.spacer){const t=this.spacer.parentNode;t?.insertBefore(this.pinTarget,this.spacer),this.spacer.remove(),this.spacer=null}}};var Xt=class{constructor(t,e={}){this.element=t,this.isDragging=!1,this.startX=0,this.startY=0,this.currentX=0,this.currentY=0,this.bounds=e.bounds||null,this.lockAxis=e.lockAxis||null,this.cursor=e.cursor||"grab",this.activeCursor=e.activeCursor||"grabbing",this.onDragStart=e.onDragStart||null,this.onDrag=e.onDrag||null,this.onDragEnd=e.onDragEnd||null,this.handleMouseDown=this.onMouseDown.bind(this),this.handleMouseMove=this.onMouseMove.bind(this),this.handleMouseUp=this.onMouseUp.bind(this),this.element.style.cursor=this.cursor,this.element.style.userSelect="none",this.bindEvents()}bindEvents(){this.element.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseDown(t){this.isDragging=!0,this.startX=t.clientX,this.startY=t.clientY,this.element.style.cursor=this.activeCursor,this.onDragStart?.()}onMouseMove(t){if(!this.isDragging)return;let e=t.clientX-this.startX,s=t.clientY-this.startY;"x"===this.lockAxis&&(s=0),"y"===this.lockAxis&&(e=0),this.currentX+=e,this.currentY+=s,this.element.style.transform=`translate(${this.currentX}px, ${this.currentY}px)`,this.startX=t.clientX,this.startY=t.clientY,this.onDrag?.({x:this.currentX,y:this.currentY})}onMouseUp(){this.isDragging&&(this.isDragging=!1,this.element.style.cursor=this.cursor,this.onDragEnd?.({x:this.currentX,y:this.currentY}))}destroy(){this.element.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}};var Ht=class{constructor(t,e={}){this.element=t,this.speed=e.speed||.5,this.axis=e.axis||"y",this.handleScroll=this.handleScroll.bind(this),window.addEventListener("scroll",this.handleScroll),this.handleScroll()}handleScroll(){const t=-this.element.getBoundingClientRect().top*this.speed;"y"===this.axis?this.element.style.transform=`translateY(${t}px)`:"x"===this.axis&&(this.element.style.transform=`translateX(${t}px)`)}destroy(){window.removeEventListener("scroll",this.handleScroll)}};var Vt=class{constructor(t,e={},s={}){this.targets=xt(t,s),this.props=e,this.stiffness=s.stiffness||170,this.damping=s.damping||26,this.mass=s.mass||1,this.precision=s.precision||.01,this.maxDuration=s.maxDuration||8,this.ease=s.ease?V(s.ease):null,this.onUpdate=s.onUpdate||null,this.onComplete=s.onComplete||null,this.paused=!0===s.paused,this.frameId=null,this.startTime=null,this.states=this.createStates(),this.paused||this.play()}createStates(){return this.targets.map(t=>({target:t,properties:Object.entries(this.props).map(([e,s])=>({path:e,value:Number(Mt(t,e))||0,velocity:0,target:Number(s)||0}))}))}play(){return this.frameId||(this.paused=!1,this.startTime=this.startTime||performance.now(),this.frameId=requestAnimationFrame(this.tick)),this}pause(){return this.paused=!0,this.frameId&&(cancelAnimationFrame(this.frameId),this.frameId=null),this}seek(t){const e=this.ease?this.ease(h(t,0,1)):h(t,0,1);return this.states.forEach(t=>{t.properties.forEach(s=>{const i=s.value+(s.target-s.value)*e;Ct(t.target,s.path,i)})}),this}tick=t=>{if(this.paused)return;const e=(t-this.startTime)/1e3,s=1/60;let i=!0;if(this.states.forEach(t=>{t.properties.forEach(e=>{const r=e.value-e.target,n=(-this.stiffness*r+-this.damping*e.velocity)/this.mass;e.velocity+=n*s,e.value+=e.velocity*s,(Math.abs(e.velocity)>this.precision||Math.abs(e.target-e.value)>this.precision)&&(i=!1),Ct(t.target,e.path,e.value)})}),this.onUpdate?.(this),i||e>=this.maxDuration)return this.states.forEach(t=>{t.properties.forEach(e=>{Ct(t.target,e.path,e.target)})}),this.pause(),void this.onComplete?.(this);this.frameId=requestAnimationFrame(this.tick)};kill(){this.pause(),this.states=[]}};const Gt=(t,e)=>{if(t&&"function"==typeof t.getTotalLength){const s=t.getTotalLength();return t.getPointAtLength(s*h(e,0,1))}return((t,e)=>{if(!t.length)return{x:0,y:0};if(1===t.length)return t[0];const s=h(e,0,1)*(t.length-1),i=Math.floor(s),r=Math.min(i+1,t.length-1),n=s-i,o=t[i],a=t[r];return{x:o.x+(a.x-o.x)*n,y:o.y+(a.y-o.y)*n}})(t||[],e)};var Zt=(t,e={})=>{const s=xt(t,e),i={progress:e.from||0},r=e.path||e.points||[],n=!0===e.rotate||!0===e.autoRotate,o=e.x||"x",a=e.y||"y";let h=null;return new Bt(i,{progress:void 0===e.to?1:e.to},{duration:e.duration||1,ease:e.ease||"linear",delay:e.delay||0,repeat:e.repeat||0,yoyo:e.yoyo,paused:!0===e.paused,render:t=>{const l=Gt(r,i.progress);s.forEach(t=>{if(Ct(t,o,`${l.x}px`),Ct(t,a,`${l.y}px`),n&&h){const s=Math.atan2(l.y-h.y,l.x-h.x);Ct(t,e.rotatePath||"rotate",`${s}rad`)}}),h=l,e.onUpdate?.(t,l)},onComplete:e.onComplete})};var Qt=class{constructor(t=[],e={}){this.scenes=t,this.currentIndex=0,this.timeline=new $t({autoplay:!1!==e.autoplay,paused:!0===e.paused,repeat:e.repeat||0,yoyo:e.yoyo,onComplete:e.onComplete}),this.build(e)}build(t={}){this.scenes.forEach((e,s)=>{const i=e.at??e.position??(0===s?0:">");if((e.label||e.id)&&this.timeline.addLabel(e.label||e.id,i),e.enter){(Array.isArray(e.enter)?e.enter:[e.enter]).forEach(s=>{this.timeline.to(s.target||e.target||t.target,s.to||s.props||{},s.duration||e.duration||1,s.ease||e.ease||"ease-out",s.position||i)})}e.call&&this.timeline.call(()=>{this.currentIndex=s,e.call(this,e)},i)})}play(){return this.timeline.play(),this}pause(){return this.timeline.pause(),this}restart(){return this.currentIndex=0,this.timeline.restart(),this}seek(t){return this.timeline.seek(t),this}progress(t){return this.timeline.progress(t)}kill(){this.timeline.kill()}};var Kt=class{constructor(t,e={}){this.element="string"==typeof t?document.querySelector(t):t,this.url=e.src||this.element.dataset.animVideoUrl||this.element.getAttribute("src"),this.autoplay=!0===e.autoplay||"load"===e.autoplay,this.muted=!1!==e.muted,this.loop=!0===e.loop,this.controls=!0===e.controls,this.objectFit=e.objectFit||"cover",this.frameRate=e.frameRate||30,this.sections=e.sections||{},this.defaultSegment=e.segment||e.frames||null,this.video=e.video||null,this.segmentTimer=null,this.video?this.configureVideo():this.createVideo(),this.defaultSegment&&this.seekSegment(this.defaultSegment)}createVideo(){this.video=document.createElement("video"),this.video.src=this.url,this.configureVideo(),this.element.style.position="relative",this.element.style.overflow="hidden",this.element.prepend(this.video)}configureVideo(){this.url&&!this.video.src&&(this.video.src=this.url),this.video.muted=this.muted,this.video.loop=this.loop,this.video.controls=this.controls,this.video.playsInline=!0,this.video.preload="auto",this.video.style.position="absolute",this.video.style.top="0",this.video.style.left="0",this.video.style.width="100%",this.video.style.height="100%",this.video.style.objectFit=this.objectFit,this.video.style.zIndex="-1",this.autoplay&&this.play()}scrubToProgress(t){if(!this.video||!this.video.duration)return;const e=this.normalizeSegment(this.activeSegment||this.defaultSegment);this.video.currentTime=e?e.start+t*(e.end-e.start):t*this.video.duration}normalizeSegment(t){if(!t)return null;if("string"==typeof t&&this.sections[t])return this.normalizeSegment(this.sections[t]);if("string"==typeof t){const e=t.split(",").map(t=>Number(t.trim()));return e.length>=2&&e.every(Number.isFinite)?{start:e[0],end:e[1]}:null}return Array.isArray(t)&&t.length>=2?{start:Number(t[0]),end:Number(t[1])}:t.frames?this.normalizeFrames(t.frames[0],t.frames[1],t.frameRate||this.frameRate):void 0!==t.startFrame||void 0!==t.endFrame?this.normalizeFrames(t.startFrame||0,t.endFrame||0,t.frameRate||this.frameRate):void 0!==t.start||void 0!==t.end?{start:Number(t.start)||0,end:Number(t.end)||0}:null}normalizeFrames(t,e,s=this.frameRate){return{start:Number(t||0)/s,end:Number(e||0)/s}}seekSegment(t){const e=this.normalizeSegment(t);return e&&this.video?(this.activeSegment=e,this.video.currentTime=e.start,this):this}playSegment(t,e={}){const s=this.normalizeSegment(t);if(!s||!this.video)return this;this.clearSegmentTimer(),this.activeSegment=s,this.video.currentTime=s.start,this.video.play().catch(()=>{f.warn("Video playback failed")});const i=!0===e.loop,r=()=>{if(this.video){if(this.video.currentTime>=s.end){if(!i)return this.video.pause(),void e.onComplete?.(this);this.video.currentTime=s.start,this.video.play()}this.segmentTimer=requestAnimationFrame(r)}};return this.segmentTimer=requestAnimationFrame(r),this}playFrames(t,e,s={}){return this.playSegment(this.normalizeFrames(t,e,s.frameRate||this.frameRate),s)}clearSegmentTimer(){this.segmentTimer&&(cancelAnimationFrame(this.segmentTimer),this.segmentTimer=null)}play(){return this.video?.play()?.catch?.(()=>{f.warn("Video autoplay/play failed")}),this}pause(){return this.video?.pause(),this}destroy(){this.clearSegmentTimer(),this.video?.remove()}};var Jt=class{constructor(t,e={}){const s="string"==typeof t||"undefined"!=typeof Element&&t instanceof Element?{...e,target:t}:{...t,...e};this.target="string"==typeof s.target?document.querySelector(s.target):s.target,this.ownsAudio=!("undefined"!=typeof HTMLAudioElement&&this.target instanceof HTMLAudioElement||s.audio),this.audio=s.audio||this.resolveAudio(s),this.frameRate=s.frameRate||60,this.defaultSegment=s.segment||null,this.segmentTimer=null,this.audio.loop=!0===s.loop,this.audio.muted=!0===s.muted,this.audio.volume=void 0===s.volume?this.audio.volume:Number(s.volume),this.audio.preload=s.preload||"auto",!0!==s.autoplay&&"load"!==s.autoplay||this.play()}resolveAudio(t){if("undefined"!=typeof HTMLAudioElement&&this.target instanceof HTMLAudioElement)return t.src&&!this.target.src&&(this.target.src=t.src),this.target;const e=document.createElement("audio");return e.src=t.src||this.target?.getAttribute?.("src")||"",this.target&&this.target.appendChild(e),e}normalizeSegment(t=this.defaultSegment){if(!t)return null;if("string"==typeof t){const e=t.split(",").map(t=>Number(t.trim()));return e.length>=2&&e.every(Number.isFinite)?{start:e[0],end:e[1]}:null}return Array.isArray(t)&&t.length>=2?{start:Number(t[0])||0,end:Number(t[1])||0}:void 0!==t.start||void 0!==t.end?{start:Number(t.start)||0,end:Number(t.end)||0}:null}play(){return this.audio?.play?.()?.catch?.(()=>f.warn("Audio playback failed")),this}pause(){return this.audio?.pause?.(),this}stop(){return this.pause(),this.seek(0),this}seek(t){return this.audio&&(this.audio.currentTime=Math.max(0,Number(t)||0)),this}setVolume(t){return this.audio&&(this.audio.volume=Math.max(0,Math.min(1,Number(t)))),this}scrubToProgress(t){if(!this.audio)return this;const e=this.normalizeSegment(),s=Math.max(0,Math.min(1,Number(t)||0));return e?this.audio.currentTime=e.start+s*(e.end-e.start):this.audio.duration&&(this.audio.currentTime=s*this.audio.duration),this}playSegment(t=this.defaultSegment,e={}){const s=this.normalizeSegment(t);if(!s||!this.audio)return this;this.clearSegmentTimer(),this.audio.currentTime=s.start,this.play();const i=()=>{if(this.audio){if(this.audio.currentTime>=s.end){if(!e.loop)return this.pause(),void e.onComplete?.(this);this.audio.currentTime=s.start}this.segmentTimer=requestAnimationFrame(i)}};return this.segmentTimer=requestAnimationFrame(i),this}clearSegmentTimer(){this.segmentTimer&&(cancelAnimationFrame(this.segmentTimer),this.segmentTimer=null)}destroy(){this.clearSegmentTimer(),this.pause(),this.ownsAudio&&this.audio?.remove?.()}};class te{constructor(t){this.instance=t}play(){return this.instance?.play?.(),this}pause(){return this.instance?.pause?.(),this}stop(){return this.instance?.stop?.(),this}destroy(){this.instance?.destroy?.()}setSpeed(t){return this.instance?.setSpeed?.(t),this}setDirection(t){return this.instance?.setDirection?.(t),this}playSegments(t,e=!0){return this.instance?.playSegments?.(t,e),this}goToAndPlay(t,e=!0){return this.instance?.goToAndPlay?.(t,e),this}goToAndStop(t,e=!0){return this.instance?.goToAndStop?.(t,e),this}setFrame(t){return this.goToAndStop(t,!0),this}setProgress(t){const e=this.instance?.totalFrames||0;return this.setFrame(e*t),this}tweenToFrame(t,e={}){const s={frame:this.instance?.currentFrame||0};return new Bt(s,{frame:t},{duration:e.duration||1,ease:e.ease||"ease-in-out",paused:!1,onUpdate:()=>{this.goToAndStop(s.frame,!0),e.onUpdate?.(s.frame,this.instance)},onComplete:()=>{e.onComplete?.(this.instance)}})}tweenToProgress(t,e={}){const s=this.instance?.totalFrames||0;return this.tweenToFrame(s*t,e)}on(t,e){return this.instance?.addEventListener?.(t,e),()=>this.instance?.removeEventListener?.(t,e)}}var ee=class{static resolveLibrary(t){if(t)return t;const e=ot();if(e?.lottie)return e.lottie;throw new Error("Lottie is not loaded")}static isLoaded(){const t=ot();return void 0!==t?.lottie}static get lottie(){return this.resolveLibrary()}static load(t={},e){return this.resolveLibrary(e).loadAnimation(t)}static createController(t,e={},s){if(t&&"function"==typeof t.play)return new te(t);const i=ht(t)?{...e,container:t}:{...t},r=this.load(i,s);return new te(r)}};class se{constructor(t){this.instance=t}play(){return this.instance?.play?.(),this}pause(){return this.instance?.pause?.(),this}stop(){return this.instance?.stop?.(),this}destroy(){this.instance?.destroy?.()}setLoop(t){return"function"==typeof this.instance?.setLoop?this.instance.setLoop(t):this.instance.loop=t,this}setMode(t){return this.instance?.setMode?.(t),this}setSpeed(t){return this.instance?.setSpeed?.(t),this}setSegment(t,e){return this.instance?.setSegment?.(t,e),this}setFrame(t){return"function"==typeof this.instance?.setFrame&&this.instance.setFrame(t),this}setProgress(t){return"function"==typeof this.instance?.setProgress?(this.instance.setProgress(t),this):("number"==typeof this.instance?.totalFrames&&this.setFrame(this.instance.totalFrames*t),this)}tweenToFrame(t,e={}){const s={frame:this.instance?.currentFrame||0};return new Bt(s,{frame:t},{duration:e.duration||1,ease:e.ease||"ease-in-out",paused:!1,onUpdate:()=>{this.setFrame(s.frame),e.onUpdate?.(s.frame,this.instance)},onComplete:()=>{e.onComplete?.(this.instance)}})}on(t,e){return this.instance?.addEventListener?.(t,e),()=>this.instance?.removeEventListener?.(t,e)}}var ie=class{static resolveConstructor(t){if(t)return t;const e=ot();if(e?.DotLottie)return e.DotLottie;throw new Error("dotLottie is not loaded")}static isLoaded(){const t=ot();return void 0!==t?.DotLottie}static createController(t,e={},s){if(t&&"function"==typeof t.play)return new se(t);const i=new(this.resolveConstructor(s))(ht(t)?{...e,canvas:t}:{...t});return new se(i)}};const re=new Uint8Array([255,255,255,255]),ne=t=>Array.isArray(t)?t:t&&"object"==typeof t&&"value"in t?ne(t.value):t;class oe{constructor(t,e={}){const s=(i=t,"undefined"!=typeof Element&&i instanceof Element||"string"==typeof t?{...e,target:t}:{...t,...e});var i,r;this.options={background:!0,fit:"cover",autoplay:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),uniforms:{},...s},this.target="string"==typeof(r=this.options.target||this.options.element||this.options.container)?document.querySelector(r):r,this.canvas=this.options.canvas||document.createElement("canvas"),this.gl=null,this.program=null,this.uniformLocations=new Map,this.uniforms={u_time:0,u_progress:0,u_mouse:[0,0],u_resolution:[1,1],u_hasTexture:0,...this.options.uniforms},this.textures=new Map,this.frameId=null,this.startedAt=null,this.paused=!0,this.boundResize=()=>this.resize(),this.boundPointerMove=t=>this.handlePointerMove(t),this.mount(),this.initGL(),this.createMediaTexture(),this.resize(),this.addEventListeners(),!1!==this.options.autoplay?this.play():this.render(0)}mount(){if(!this.target&&!this.options.canvas)throw new Error("WebGL shader requires a target element or canvas");!this.canvas.parentNode&&this.target&&("static"===getComputedStyle(this.target).position&&(this.target.style.position="relative"),!1!==this.options.background?(this.canvas.style.position="absolute",this.canvas.style.inset="0",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.pointerEvents="none",this.canvas.style.zIndex=String(this.options.zIndex??-1),this.target.prepend(this.canvas)):this.target.appendChild(this.canvas)),this.canvas.classList.add("am-shader-canvas")}initGL(){if(this.gl=ae.createContext(this.canvas,this.options),!this.gl)throw new Error("WebGL is not supported in this browser");const t=this.createShader(this.gl.VERTEX_SHADER,this.options.vertex||"\nattribute vec2 a_position;\nattribute vec2 a_uv;\nvarying vec2 v_uv;\n\nvoid main() {\n v_uv = a_uv;\n gl_Position = vec4(a_position, 0.0, 1.0);\n}\n"),e=this.createShader(this.gl.FRAGMENT_SHADER,this.options.fragment||"\nprecision mediump float;\n\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform vec2 u_mouse;\nuniform float u_progress;\nuniform sampler2D u_texture;\nuniform float u_hasTexture;\nvarying vec2 v_uv;\n\nvoid main() {\n vec2 uv = v_uv;\n vec3 base = 0.5 + 0.5 * cos(u_time + uv.xyx * 5.0 + vec3(0.0, 2.0, 4.0));\n vec4 textureColor = texture2D(u_texture, uv);\n vec3 color = mix(base, textureColor.rgb, u_hasTexture);\n color += vec3(u_mouse.x / max(u_resolution.x, 1.0), u_mouse.y / max(u_resolution.y, 1.0), u_progress) * 0.18;\n gl_FragColor = vec4(color, 1.0);\n}\n");this.program=this.createProgram(t,e),this.gl.useProgram(this.program),this.createQuad(),this.cacheUniformLocations()}createShader(t,e){const s=this.gl.createShader(t);if(this.gl.shaderSource(s,e),this.gl.compileShader(s),!this.gl.getShaderParameter(s,this.gl.COMPILE_STATUS)){const t=this.gl.getShaderInfoLog(s);throw this.gl.deleteShader(s),new Error(`Shader compile failed: ${t}`)}return s}createProgram(t,e){const s=this.gl.createProgram();if(this.gl.attachShader(s,t),this.gl.attachShader(s,e),this.gl.linkProgram(s),!this.gl.getProgramParameter(s,this.gl.LINK_STATUS))throw new Error(`Shader link failed: ${this.gl.getProgramInfoLog(s)}`);return s}createQuad(){const t=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,-1,1,0,1,1,-1,1,0,1,1,1,1]),e=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW);const s=this.gl.getAttribLocation(this.program,"a_position"),i=this.gl.getAttribLocation(this.program,"a_uv");this.gl.enableVertexAttribArray(s),this.gl.vertexAttribPointer(s,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(i),this.gl.vertexAttribPointer(i,2,this.gl.FLOAT,!1,16,8)}cacheUniformLocations(){Object.keys(this.uniforms).forEach(t=>{this.uniformLocations.set(t,this.gl.getUniformLocation(this.program,t))}),this.uniformLocations.set("u_texture",this.gl.getUniformLocation(this.program,"u_texture"))}createMediaTexture(){const t=this.createMediaSource(this.options.texture||this.options.image||this.options.video)||this.resolveTargetMedia(),e=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,1,1,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,re),this.textures.set("u_texture",{texture:e,source:t}),t&&(this.uniforms.u_hasTexture=1,t instanceof HTMLImageElement&&!t.complete?t.addEventListener("load",()=>this.updateTexture("u_texture"),{once:!0}):t instanceof HTMLVideoElement&&t.readyState<2?t.addEventListener("loadeddata",()=>this.updateTexture("u_texture"),{once:!0}):this.updateTexture("u_texture"))}createMediaSource(t){if(!t||"string"!=typeof t)return t||null;if(/\.(mp4|webm|ogg|mov)(\?|#|$)/i.test(t)){const e=document.createElement("video");return e.src=t,e.muted=!0,e.loop=!0,e.playsInline=!0,e.crossOrigin=this.options.crossOrigin||"anonymous",e.play?.().catch?.(()=>{}),e}const e=new Image;return e.crossOrigin=this.options.crossOrigin||"anonymous",e.src=t,e}resolveTargetMedia(){return this.target instanceof HTMLImageElement||this.target instanceof HTMLVideoElement||this.target instanceof HTMLCanvasElement?this.target:this.target?.querySelector?.("img, video, canvas")||null}updateTexture(t){const e=this.textures.get(t);if(e?.source)try{this.gl.bindTexture(this.gl.TEXTURE_2D,e.texture),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!0),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e.source)}catch(t){this.uniforms.u_hasTexture=0}}addEventListeners(){window.addEventListener("resize",this.boundResize),(this.target||this.canvas).addEventListener("pointermove",this.boundPointerMove)}handlePointerMove(t){const e=this.canvas.getBoundingClientRect();this.setUniform("u_mouse",[t.clientX-e.left,e.height-(t.clientY-e.top)])}resize(){const t=(this.target||this.canvas).getBoundingClientRect(),e=Math.max(1,Math.round(t.width*this.options.pixelRatio)),s=Math.max(1,Math.round(t.height*this.options.pixelRatio));return this.canvas.width===e&&this.canvas.height===s||(this.canvas.width=e,this.canvas.height=s),this.gl?.viewport(0,0,e,s),this.setUniform("u_resolution",[e,s]),this}setUniform(t,e){return this.uniforms[t]=e,!this.uniformLocations.has(t)&&this.gl&&this.program&&this.uniformLocations.set(t,this.gl.getUniformLocation(this.program,t)),this}tweenUniforms(t,e={}){return new Bt(this.uniforms,t,{duration:e.duration||1,ease:e.ease||"ease-out",paused:!0===e.paused,onUpdate:()=>this.render(),onComplete:e.onComplete})}scrubToProgress(t){return this.setUniform("u_progress",t),this.render(),this}play(){return this.paused?(this.paused=!1,this.startedAt=performance.now()-1e3*(this.uniforms.u_time||0),this.tick(),this):this}pause(){return this.paused=!0,this.frameId&&(cancelAnimationFrame(this.frameId),this.frameId=null),this}tick=(t=performance.now())=>{this.paused||(this.uniforms.u_time=(t-this.startedAt)/1e3,this.render(),this.frameId=requestAnimationFrame(this.tick))};render(){return this.resize(),this.updateTexture("u_texture"),this.gl.useProgram(this.program),this.applyUniforms(),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.options.onRender?.(this),this}applyUniforms(){let t=0;Object.entries(this.uniforms).forEach(([t,e])=>{const s=this.uniformLocations.get(t);if(!s)return;const i=ne(e);Array.isArray(i)?2===i.length?this.gl.uniform2f(s,Number(i[0])||0,Number(i[1])||0):3===i.length?this.gl.uniform3f(s,Number(i[0])||0,Number(i[1])||0,Number(i[2])||0):4===i.length&&this.gl.uniform4f(s,Number(i[0])||0,Number(i[1])||0,Number(i[2])||0,Number(i[3])||0):Number.isInteger(i)?this.gl.uniform1i(s,i):this.gl.uniform1f(s,Number(i)||0)}),this.textures.forEach((e,s)=>{const i=this.uniformLocations.get(s);i&&(this.gl.activeTexture(this.gl.TEXTURE0+t),this.gl.bindTexture(this.gl.TEXTURE_2D,e.texture),this.gl.uniform1i(i,t),t+=1)})}destroy(){this.pause(),window.removeEventListener("resize",this.boundResize),(this.target||this.canvas)?.removeEventListener?.("pointermove",this.boundPointerMove),this.options.canvas||this.canvas.remove()}}class ae{static isSupported(){try{const t=document.createElement("canvas");return!!t.getContext("webgl")||!!t.getContext("webgl2")}catch{return!1}}static createContext(t,e={}){return t.getContext("webgl2",e.contextAttributes)||t.getContext("webgl",e.contextAttributes)||t.getContext("experimental-webgl",e.contextAttributes)}static createShader(t,e={}){return new oe(t,e)}static shader(t,e={}){return this.createShader(t,e)}}var he=ae;var le=(t,e=[],s={})=>{const i=new $t({autoplay:!1!==s.autoplay,paused:!0===s.paused,repeat:s.repeat||0,yoyo:s.yoyo,scope:s.scope||null,onComplete:s.onComplete});return e.forEach((e,r)=>{const n=e.at??e.position??(0===r?0:">"),o=e.duration??s.duration??1,a=e.ease||s.ease||"ease-out",h=e.props||e.to||e,l=e.from||null;e.label&&i.addLabel(e.label,n),e.call?i.call(e.call,n):l?i.fromTo(e.target||t,l,h,o,a,n):e.fromOnly?i.from(e.target||t,h,o,a,n):i.to(e.target||t,h,o,a,n)}),i};const ue=t=>{if(!t||!String(t).trim())return{};const e=String(t).trim().replace(/;$/,"");try{return JSON.parse(e)}catch(s){try{let t=e;"{"!==t[0]&&t.includes(":")&&(t="{"+t+"}");try{return new Function("return ("+t+")")()}catch(e){const s=t.replace(/:(\s*)(-?\d+(?:\.\d+)?(?:px|deg|%|em|rem|vh|vw|s|ms))/gi,':$1"$2"');return new Function("return ("+s+")")()}}catch(e){return f.warn(`Invalid JSON/Object: ${t}`),{}}}},ce=(t,e=0)=>{const s=Number(t);return isNaN(s)?e:s},pe=(t,e=!1)=>{if(null==t||""===t)return e;if("boolean"==typeof t)return t;const s=String(t).toLowerCase();return!!["true","1","yes","on"].includes(s)||!["false","0","no","off"].includes(s)&&e},de=t=>{const e={};return t.split(";").forEach(t=>{const[s,i]=t.split(":");s&&i&&(e[s.trim()]=i.trim())}),e},me={root:"data-anim",scroll:"data-anim-scroll-trigger",split:"data-anim-split-text"},ge={enter:"mouseenter",leave:"mouseleave",press:"pointerdown",release:"pointerup",tap:"click"};var fe=class{constructor(t={}){this.options={debug:!1,autoInit:!0,attributePrefix:"am",root:null,observeMutations:!1,legacyAttributes:!0,...t},this.root=null,this.timelines=new Map,this.tweens=new Map,this.splitTexts=new Map,this.scrollTriggers=new Map,this.draggables=new Map,this.parallaxEffects=new Map,this.springAnimations=new Map,this.motionPathAnimations=new Map,this.keyframeTimelines=new Map,this.sceneSequences=new Map,this.lottieControllers=new Map,this.dotLottieControllers=new Map,this.videoAnimations=new Map,this.audioAnimations=new Map,this.shaderControllers=new Map,this.observers=new Map,this.cleanups=[],this.initialized=!1,this.mutationObserver=null,this.options.debug&&f.setLevel("debug"),f.info("AnimationCore initialized")}init(){nt()?this.initialized?f.warn("AnimationCore already initialized"):(this.root=this.resolveRoot(),this.initialized=!0,f.info("Initializing AnimationCore..."),this.initSplitTexts(),this.initTimelines(),this.initControls(),this.initDeclarativeAnimations(),this.initEventAnimations(),this.initScrollAnimations(),this.initMouseAnimations(),this.initParallaxEffects(),this.initDraggables(),this.initSpringAnimations(),this.initKeyframeAnimations(),this.initMotionPathAnimations(),this.initSceneSequences(),this.initThreeStateControls(),this.initShaderAnimations(),this.initVideoAnimations(),this.initAudioAnimations(),this.initLottieAnimations(),this.initDotLottieAnimations(),this.observeMutations(),this.exposeGlobalState(),this.refreshScrollTriggers()):f.warn("AnimationCore.init() requires a browser environment")}destroy(){this.killAll(),this.cleanups.splice(0).forEach(t=>t()),this.mutationObserver?.disconnect(),this.mutationObserver=null,this.initialized=!1}resolveRoot(){if(ht(this.options.root))return this.options.root;if("string"==typeof this.options.root){const t=at();return t?.querySelector(this.options.root)||t}return at()}exposeGlobalState(){const t=ot();if(!t)return;const e=t.__ANIMOTION__||{};t.__ANIMOTION__={...e,core:this,timelines:this.timelines,tweens:this.tweens,splitTexts:this.splitTexts,scrollTriggers:this.scrollTriggers,draggables:this.draggables,parallaxEffects:this.parallaxEffects,springAnimations:this.springAnimations,motionPathAnimations:this.motionPathAnimations,keyframeTimelines:this.keyframeTimelines,sceneSequences:this.sceneSequences,lottieControllers:this.lottieControllers,dotLottieControllers:this.dotLottieControllers,videoAnimations:this.videoAnimations,audioAnimations:this.audioAnimations,shaderControllers:this.shaderControllers,threeStateMachines:e.threeStateMachines||new Map,version:"1.1.0"}}observeMutations(){this.options.observeMutations&&this.root&&"undefined"!=typeof MutationObserver&&(this.mutationObserver=new MutationObserver(()=>{this.refresh()}),this.mutationObserver.observe(this.root,{childList:!0,subtree:!0}))}refresh(){this.destroy(),this.init()}registerCleanup(t){"function"==typeof t&&this.cleanups.push(t)}getAttrName(t){return"root"===t?this.options.attributePrefix:t?`${this.options.attributePrefix}-${t}`:this.options.attributePrefix}getLegacyAttrNames(t){return"root"===t?[me.root]:Array.from(new Set([me[t],`data-anim-${t}`].filter(Boolean)))}getAttrCandidates(t){const e=[this.getAttrName(t)],s=this.options.legacyAttributes?this.getLegacyAttrNames(t):[];return s.length&&e.push(...s),Array.from(new Set(e.filter(Boolean)))}getSelectorForAttr(t){return this.getAttrCandidates(t).map(t=>`[${t}]`).join(", ")}getAttr(t,e){const s=this.getAttrCandidates(e).find(e=>t.hasAttribute(e));return s?t.getAttribute(s):null}hasAttr(t,e){return this.getAttrCandidates(e).some(e=>t.hasAttribute(e))}queryAllByAttr(t){const e=this.getSelectorForAttr(t);return e?Array.from(this.root.querySelectorAll(e)):[]}queryAll(t){return Array.from(this.root.querySelectorAll(t))}parseAttrObject(t,e,s=null){const i=this.getAttr(t,e);return null===i||""===i?s:ue(i)}parseAttrString(t,e,s=""){const i=this.getAttr(t,e);return null===i||""===i?s:i}parseAttrNumber(t,e,s=0){const i=this.getAttr(t,e);return null===i||""===i?s:ce(i,s)}parseAttrBoolean(t,e,s=!1){const i=this.getAttr(t,e);return null===i||""===i?s:pe(i,s)}getAnimationMode(t){return this.hasAttr(t,"set")?"set":this.hasAttr(t,"from")&&(this.hasAttr(t,"to")||this.hasAttr(t,"props"))?"fromTo":this.hasAttr(t,"from")&&!this.hasAttr(t,"to")?"from":"to"}resolveAnimationTarget(t){const e=this.parseAttrString(t,"target"),s=this.parseAttrString(t,"split-target",""),i=this.splitTexts.get(t);return i?i.getSpans(s||"all"):e?Array.from(this.root.querySelectorAll(e)):t}buildTweenOptions(t,e={}){const s=this.parseAttrObject(t,"options",{}),i=this.parseAttrString(t,"place","")||this.parseAttrString(t,"stick","");return{duration:this.parseAttrNumber(t,"duration",e.duration??1),ease:this.parseAttrString(t,"ease",e.ease||"ease-out"),delay:this.parseAttrNumber(t,"delay",e.delay??0),repeat:this.parseAttrNumber(t,"repeat",e.repeat??0),yoyo:this.parseAttrBoolean(t,"yoyo",e.yoyo??!0),stagger:this.parseAttrNumber(t,"stagger",e.stagger??0),place:i||s.place||s.stick||e.place||e.stick||null,paused:e.paused??!1,scope:this.root,...s,...e}}buildTweenConfig(t){const e=this.getAnimationMode(t),s=this.parseAttrObject(t,"to")||this.parseAttrObject(t,"props")||this.parseAttrObject(t,"set")||this.parseAttrObject(t,"from")||{};return{target:this.resolveAnimationTarget(t),mode:e,fromProps:this.parseAttrObject(t,"from",{}),toProps:s,options:this.buildTweenOptions(t)}}createTweenFromElement(t,e={}){const s=this.buildTweenConfig(t),i=e.target||s.target,r={...s.options,...e.options};let n=null;return n="set"===s.mode?new Bt(i,s.toProps,{...r,duration:0}):"fromTo"===s.mode?new Bt(i,s.toProps,{...r,fromTo:s.fromProps}):"from"===s.mode?new Bt(i,s.fromProps,{...r,from:!0}):new Bt(i,s.toProps,r),this.hasAttr(t,"id")?this.tweens.set(this.parseAttrString(t,"id"),n):this.tweens.set(`${Date.now()}-${this.tweens.size}`,n),n}shouldHandleAsImmediate(t){if(t.closest(this.getSelectorForAttr("timeline")))return!1;const e=t.closest(this.getSelectorForAttr("scroll"));return(!e||e===t)&&(!this.hasAttr(t,"on")&&(!this.hasAttr(t,"scroll")&&(!(this.hasAttr(t,"pin")||this.hasAttr(t,"scrub")||this.hasAttr(t,"in")||this.hasAttr(t,"out"))&&(!this.hasAttr(t,"parallax")&&(!this.hasAttr(t,"mouse")&&(!this.hasAttr(t,"draggable")&&(!this.hasAttr(t,"spring")&&(!this.hasAttr(t,"keyframes")&&(!this.hasAttr(t,"motion-path")&&(!this.hasAttr(t,"path")&&(!this.hasAttr(t,"sequence")&&(!this.hasAttr(t,"three-state")&&(!this.hasAttr(t,"lottie")&&!this.hasAttr(t,"dotlottie")&&(!this.hasAttr(t,"video")&&(!this.hasAttr(t,"audio")&&!this.hasAttr(t,"sound")&&(!this.hasAttr(t,"shader")&&!this.hasAttr(t,"webgl")&&(this.hasAttr(t,"root")||this.hasAttr(t,"to")||this.hasAttr(t,"from")||this.hasAttr(t,"set"))))))))))))))))))}getChildAnimationElements(t){const e=[this.getSelectorForAttr("root"),this.getSelectorForAttr("to"),this.getSelectorForAttr("from"),this.getSelectorForAttr("set")].filter(Boolean).join(", ");return Array.from(t.querySelectorAll(e)).filter(e=>e!==t&&e.closest(this.getSelectorForAttr("scroll"))===t)}createTimelineFromChildren(t,e={}){const s=this.getChildAnimationElements(t);if(!s.length)return null;const i=new $t({id:e.id||this.parseAttrString(t,"id",`scroll-timeline-${this.timelines.size+1}`),autoplay:!1,paused:!0,scope:this.root});return s.forEach(t=>{const e=this.parseAttrString(t,"label");e&&i.addLabel(e,this.parseAttrString(t,"position",">"));const s=this.buildTweenConfig(t),r=this.parseAttrString(t,"position",">");"set"===s.mode?i.set(s.target,s.toProps,r):"fromTo"===s.mode?i.fromTo(s.target,s.fromProps,s.toProps,s.options.duration,s.options.ease,r):"from"===s.mode?i.from(s.target,s.fromProps,s.options.duration,s.options.ease,r):i.to(s.target,s.toProps,s.options.duration,s.options.ease,r)}),this.timelines.set(i.id,i),i}initSplitTexts(){this.queryAllByAttr("split").forEach(t=>{if(this.splitTexts.has(t))return;const e=this.parseAttrString(t,"split","chars"),s="string"==typeof e&&e.trim().startsWith("{")?ue(e):{type:e||"chars"},i=new jt(t,{...s,...this.parseAttrObject(t,"split-options",{})});this.splitTexts.set(t,i)})}initTimelines(){this.queryAllByAttr("timeline").forEach(t=>{const e=this.parseAttrString(t,"timeline",`timeline-${this.timelines.size+1}`),s=new $t({id:e,autoplay:this.parseAttrBoolean(t,"timeline-auto",!0),...this.parseAttrObject(t,"timeline-options",{}),scope:this.root});this.timelines.set(e,s);const i=[this.getSelectorForAttr("root"),this.getSelectorForAttr("to"),this.getSelectorForAttr("from"),this.getSelectorForAttr("set")].filter(Boolean).join(", ");Array.from(t.querySelectorAll(i)).forEach(e=>{if(e.closest(this.getSelectorForAttr("timeline"))!==t)return;const i=this.parseAttrString(e,"label");i&&s.addLabel(i,this.parseAttrString(e,"position",">"));const r=this.buildTweenConfig(e),n=this.parseAttrString(e,"position",">");"set"===r.mode?s.set(r.target,r.toProps,n):"fromTo"===r.mode?s.fromTo(r.target,r.fromProps,r.toProps,r.options.duration,r.options.ease,n):"from"===r.mode?s.from(r.target,r.fromProps,r.options.duration,r.options.ease,n):s.to(r.target,r.toProps,r.options.duration,r.options.ease,n)})})}initControls(){this.queryAll(`${this.getSelectorForAttr("control")}, ${this.getSelectorForAttr("action")}`).forEach(t=>{const e=this.parseAttrString(t,"control"),s=e.includes("|")?e:null;if(s){const[e,i="click",r,n="play"]=s.split("|").map(t=>t.trim());return void this.bindTimelineControl(e?Array.from(this.root.querySelectorAll(e)):[t],i,r,n)}const i=this.parseAttrString(t,"control")||this.parseAttrString(t,"timeline-target"),r=this.parseAttrString(t,"action","play"),n=ge[this.parseAttrString(t,"on","click")]||this.parseAttrString(t,"on","click");i&&this.bindTimelineControl([t],n,i,r)})}bindTimelineControl(t,e,s,i){t.forEach(t=>{const r=e=>{this.parseAttrBoolean(t,"prevent-default",!0)&&e.preventDefault?.(),this.runTimelineCommand(s,i)};t.addEventListener(e,r),this.registerCleanup(()=>t.removeEventListener(e,r))})}runTimelineCommand(t,e){const s=this.timelines.get(t);s?"play"===e?s.play():"pause"===e?s.pause():"reverse"===e?s.reverse():"restart"===e?s.restart():e.startsWith("seek:")?s.seek(parseFloat(e.split(":")[1])):e.startsWith("progress:")&&s.progress(parseFloat(e.split(":")[1])):f.warn(`Timeline not found: ${t}`)}initDeclarativeAnimations(){const t=[this.getSelectorForAttr("root"),this.getSelectorForAttr("to"),this.getSelectorForAttr("from"),this.getSelectorForAttr("set")].filter(Boolean).join(", ");this.queryAll(t).forEach(t=>{this.shouldHandleAsImmediate(t)&&this.createTweenFromElement(t)})}initEventAnimations(){this.queryAllByAttr("on").forEach(t=>{const e=this.parseAttrString(t,"on").split(",").map(t=>t.trim()).filter(Boolean),s=this.parseAttrBoolean(t,"once",!1),i=this.parseAttrBoolean(t,"prevent-default",!0);e.forEach(e=>{const r=ge[e]||e;if("load"===r||"init"===r)return void this.createTweenFromElement(t);if("inview"===r){const e=new Wt({trigger:t,...this.parseAttrObject(t,"scroll-options",{}),onEnter:()=>{this.createTweenFromElement(t),s&&e.kill()}});return void this.scrollTriggers.set(t,e)}const n=e=>{i&&e.preventDefault?.(),this.createTweenFromElement(t),s&&t.removeEventListener(r,n)};t.addEventListener(r,n),this.registerCleanup(()=>t.removeEventListener(r,n))})})}initScrollAnimations(){Array.from(new Set([...this.queryAllByAttr("scroll"),...this.queryAllByAttr("pin"),...this.queryAllByAttr("scrub"),...this.queryAllByAttr("in"),...this.queryAllByAttr("out")])).forEach(t=>{const e=this.parseAttrObject(t,"scroll",{}),s=this.parseAttrBoolean(t,"pin",!0===e.pin),i=this.getAttr(t,"scrub"),r=null===i?!0===e.scrub:pe(i,!0===e.scrub),n=this.parseAttrBoolean(t,"reverse",!0===e.reverse),o=this.parseAttrBoolean(t,"once",!0===e.once),a=this.parseAttrObject(t,"in",null)||e.in||e.enter||null,h=this.parseAttrObject(t,"out",null)||e.out||e.leave||null,l=this.getFeatureTarget(t,e),u=s||r||!0===e.children||this.parseAttrBoolean(t,"scroll-children",!1)?this.createTimelineFromChildren(t,{id:e.timeline||this.parseAttrString(t,"timeline","")}):null;let c=u,p=null,d=null;const m=t=>{t&&(t.seek?.(1),t.isReverse=!0,t.currentTime=0,t.startTime=null,t.paused=!1,t.play?.())};!c&&(this.hasAttr(t,"to")||this.hasAttr(t,"from")||this.hasAttr(t,"set")||this.hasAttr(t,"root"))&&(c=this.createTweenFromElement(t,{options:{paused:!0,duration:this.parseAttrNumber(t,"duration",e.duration||1)}}),c.pause(),"from"===this.getAnimationMode(t)&&c.seek(0)),a&&(p=new Bt(l,a,{...this.buildTweenOptions(t,{paused:!0,duration:e.inDuration||e.enterDuration||e.duration||1})}),p.pause(),p.seek(0)),h&&(d=new Bt(l,h,{...this.buildTweenOptions(t,{paused:!0,duration:e.outDuration||e.leaveDuration||e.duration||1})}),d.pause());const g=new Wt({trigger:t,...e,pin:s,scrub:r,reverse:n,once:o,animation:c,duration:e.pinDuration||e.scrollDistance||(u?.duration?Math.max(1,u.duration)*(e.pixelsPerSecond||1e3):e.duration),onEnter:s=>{"function"==typeof e.onEnter&&e.onEnter(t,s),r||(p?p.restart():c?.play?.(),o&&s.kill())},onLeave:s=>{"function"==typeof e.onLeave&&e.onLeave(t,s),d?d.restart():n&&m(c)},onEnterBack:s=>{"function"==typeof e.onEnterBack&&e.onEnterBack(t,s),n&&m(d||c)},onLeaveBack:s=>{"function"==typeof e.onLeaveBack&&e.onLeaveBack(t,s),n&&(p?m(p):c?.seek?.(0))},onUpdate:({progress:s,direction:i})=>{if("function"==typeof e.onUpdate&&e.onUpdate({progress:s,direction:i,element:t}),r){const t=n?1-s:s;c?.seek?.(t)}r&&p&&!d?p.seek(s):r&&p&&d&&(s<.5?p.seek(2*s):d.seek(2*(s-.5)))}});this.scrollTriggers.set(t,g)})}initMouseAnimations(){this.queryAllByAttr("mouse").forEach(t=>{const e=this.parseAttrObject(t,"mouse",{}),s=e.movement||30,i=e.duration||.5,r=e.axis||"both",n=this.resolveAnimationTarget(t),o=t=>{const{innerWidth:o,innerHeight:a}=ot(),h=100*(t.clientX/o-.5),l=100*(t.clientY/a-.5),u={};"both"!==r&&"x"!==r||(u.x=h*s/100+"px"),"both"!==r&&"y"!==r||(u.y=l*s/100+"px"),new Bt(n,u,{duration:i,ease:e.ease||"ease-out",paused:!1,scope:this.root})};at().addEventListener("mousemove",o),this.registerCleanup(()=>at().removeEventListener("mousemove",o))})}initParallaxEffects(){this.queryAllByAttr("parallax").forEach(t=>{const e=this.parseAttrString(t,"parallax","0.5"),s=e.trim().startsWith("{")?ue(e):{speed:ce(e,.5)},i=new Ht(t,{...s,...this.parseAttrObject(t,"parallax-options",{})});this.parallaxEffects.set(t,i)})}initDraggables(){this.queryAllByAttr("draggable").forEach(t=>{const e=this.parseAttrObject(t,"draggable",{}),s=new Xt(t,e);this.draggables.set(t,s)})}getFeatureTarget(t,e={}){return e.target?"string"==typeof e.target?Array.from(this.root.querySelectorAll(e.target)):e.target:this.resolveAnimationTarget(t)}bindFeatureRun(t,e,s,i={}){const r=this.parseAttrString(t,`${e}-on`,i.eventName||"load"),n=this.parseAttrBoolean(t,`${e}-once`,i.once||!1);if("load"===r||"init"===r)return s();if("inview"===r){let r=null;const o=new Wt({trigger:t,...this.parseAttrObject(t,`${e}-scroll-options`,{}),onEnter:()=>{r=s(),n&&o.kill()},onUpdate:({progress:t})=>{!0===i.scrub&&r?.seek?.(t)}});return this.scrollTriggers.set(t,o),r}const o=ge[r]||r,a=()=>{s(),n&&t.removeEventListener(o,a)};return t.addEventListener(o,a),this.registerCleanup(()=>t.removeEventListener(o,a)),null}initSpringAnimations(){this.queryAllByAttr("spring").forEach(t=>{const e=this.parseAttrObject(t,"spring",{}),s=e.props||e.to||this.parseAttrObject(t,"to",{})||this.parseAttrObject(t,"props",{}),i={...this.buildTweenOptions(t,{paused:!0}),...e,...this.parseAttrObject(t,"spring-options",{})};this.bindFeatureRun(t,"spring",()=>{const r=new Vt(this.getFeatureTarget(t,e),s,{...i,paused:!1});return this.springAnimations.set(t,r),r},{eventName:e.on||this.parseAttrString(t,"on","load")})})}initKeyframeAnimations(){this.queryAllByAttr("keyframes").forEach(t=>{const e=this.parseAttrObject(t,"keyframes",[]),s=Array.isArray(e)?{frames:e}:e,i=s.frames||[],r=this.getFeatureTarget(t,s),n={...this.buildTweenOptions(t,{paused:!0}),...s,...this.parseAttrObject(t,"keyframes-options",{})};this.bindFeatureRun(t,"keyframes",()=>{const e=le(r,i,{...n,autoplay:!1!==n.autoplay,paused:!1,scope:this.root});return this.keyframeTimelines.set(t,e),e},{eventName:s.on||this.parseAttrString(t,"on","load")})})}initMotionPathAnimations(){Array.from(new Set([...this.queryAllByAttr("motion-path"),...this.queryAllByAttr("path")])).forEach(t=>{const e=this.parseAttrObject(t,"motion-path",null)||this.parseAttrObject(t,"path",{}),s=e.pathSelector||this.parseAttrString(t,"motion-path-selector","")||this.parseAttrString(t,"path-selector",""),i=s?this.root.querySelector(s):null,r={...this.buildTweenOptions(t,{paused:!0}),...e,...this.parseAttrObject(t,"motion-path-options",{}),...this.parseAttrObject(t,"path-options",{})};i&&(r.path=i);this.bindFeatureRun(t,this.hasAttr(t,"motion-path")?"motion-path":"path",()=>{const s=Zt(this.getFeatureTarget(t,e),{...r,paused:!1,scope:this.root});return this.motionPathAnimations.set(t,s),s},{eventName:e.on||this.parseAttrString(t,"on","load"),scrub:!0===e.scrub})})}initSceneSequences(){this.queryAllByAttr("sequence").forEach(t=>{const e=this.parseAttrObject(t,"sequence",[]),s=Array.isArray(e)?{scenes:e}:e,i={...s,...this.parseAttrObject(t,"sequence-options",{}),target:s.target||t};this.bindFeatureRun(t,"sequence",()=>{const e=new Qt(s.scenes||[],{...i,autoplay:!1!==i.autoplay,paused:!1});return this.sceneSequences.set(t,e),e},{eventName:s.on||this.parseAttrString(t,"on","load")})})}initThreeStateControls(){this.queryAllByAttr("three-state").forEach(t=>{const e=this.parseAttrString(t,"three-state",""),s=e.trim().startsWith("{")?ue(e):{state:e},i=s.machine||this.parseAttrString(t,"three-machine",""),r=s.state||this.parseAttrString(t,"three-state",""),n=s.action||this.parseAttrString(t,"three-action","play"),o=s.on||this.parseAttrString(t,"three-on",this.parseAttrString(t,"on","click"));this.bindFeatureRun(t,"three",()=>{const t=ot()?.__ANIMOTION__?.threeStateMachines?.get?.(i);return t?("pause"===n?t.pause?.(r||void 0):"stop"===n?t.stop?.(r||void 0):r&&t.play?.(r,s),t):(f.warn(`Three.js state machine not found: ${i}`),null)},{eventName:o})})}initVideoAnimations(){this.queryAllByAttr("video").forEach(t=>{const e=this.parseAttrString(t,"video"),s=e&&e.trim().startsWith("{")?ue(e):{src:e},i=new Kt(t,{muted:this.parseAttrBoolean(t,"video-muted",!0),loop:this.parseAttrBoolean(t,"video-loop",!1),controls:this.parseAttrBoolean(t,"video-controls",!1),objectFit:this.parseAttrString(t,"video-fit","cover"),frameRate:this.parseAttrNumber(t,"video-frame-rate",30),segment:this.parseAttrString(t,"video-segment","")||this.parseAttrString(t,"video-frames",""),...s,...this.parseAttrObject(t,"video-options",{}),autoplay:"load"===this.parseAttrString(t,"video-autoplay","")}),r=this.parseAttrString(t,"video-on",this.parseAttrString(t,"video-autoplay","load")),n=this.parseAttrString(t,"video-action","play"),o=this.parseAttrString(t,"video-segment","")||this.parseAttrString(t,"video-section",""),a=this.parseAttrString(t,"video-frames",""),h=()=>{if("pause"===n)i.pause();else if("scrub"===n)i.seekSegment(o||a);else if(a){const[t,e]=a.split(",").map(t=>Number(t.trim()));i.playFrames(t,e)}else o?i.playSegment(o):i.play()};if("load"===r||"init"===r)h();else if("inview"===r){const e=new Wt({trigger:t,scrub:"scrub"===n,onEnter:()=>{"scrub"!==n&&h()},onLeave:()=>{this.parseAttrBoolean(t,"video-pause-on-leave",!0)&&i.pause()},onUpdate:({progress:t})=>{"scrub"===n&&i.scrubToProgress(t)}});this.scrollTriggers.set(t,e)}else{const e=ge[r]||r,s=()=>h();t.addEventListener(e,s),this.registerCleanup(()=>t.removeEventListener(e,s))}this.videoAnimations.set(t,i)})}initAudioAnimations(){Array.from(new Set([...this.queryAllByAttr("audio"),...this.queryAllByAttr("sound")])).forEach(t=>{const e=this.parseAttrString(t,"audio","")||this.parseAttrString(t,"sound",""),s=e&&e.trim().startsWith("{")?ue(e):{src:e},i=new Jt(t,{volume:this.parseAttrNumber(t,"audio-volume",s.volume??1),loop:this.parseAttrBoolean(t,"audio-loop",!0===s.loop),muted:this.parseAttrBoolean(t,"audio-muted",!0===s.muted),segment:this.parseAttrString(t,"audio-segment","")||s.segment,...s,...this.parseAttrObject(t,"audio-options",{}),autoplay:"load"===this.parseAttrString(t,"audio-autoplay","")}),r=this.parseAttrString(t,"audio-on",this.parseAttrString(t,"audio-autoplay","load")),n=this.parseAttrString(t,"audio-action","play"),o=this.parseAttrString(t,"audio-segment","")||s.segment,a=()=>{"pause"===n?i.pause():"stop"===n?i.stop():"scrub"===n?i.scrubToProgress(0):o?i.playSegment(o):i.play()};if("load"===r||"init"===r)a();else if("inview"===r){const e=new Wt({trigger:t,scrub:"scrub"===n,...this.parseAttrObject(t,"audio-scroll",{}),onEnter:()=>{"scrub"!==n&&a()},onLeave:()=>{this.parseAttrBoolean(t,"audio-pause-on-leave",!0)&&i.pause()},onUpdate:({progress:e})=>{"scrub"===n&&i.scrubToProgress(e);const s=this.parseAttrObject(t,"audio-volume-scroll",null);if(s){const t=Number(s.from??0),r=Number(s.to??1);i.setVolume(t+(r-t)*e)}}});this.scrollTriggers.set(t,e)}else{const e=ge[r]||r,s=()=>a();t.addEventListener(e,s),this.registerCleanup(()=>t.removeEventListener(e,s))}this.audioAnimations.set(t,i)})}initShaderAnimations(){Array.from(new Set([...this.queryAllByAttr("shader"),...this.queryAllByAttr("webgl")])).forEach(t=>{const e=this.parseAttrString(t,"shader","")||this.parseAttrString(t,"webgl",""),s=e&&e.trim().startsWith("{")?ue(e):{fragment:e},i={...this.parseAttrObject(t,"shader-uniforms",{}),...this.parseAttrObject(t,"webgl-uniforms",{})},r=he.createShader(t,{...s,fragment:this.parseAttrString(t,"shader-fragment",s.fragment||""),vertex:this.parseAttrString(t,"shader-vertex",s.vertex||""),texture:this.parseAttrString(t,"shader-texture","")||s.texture,background:this.parseAttrBoolean(t,"shader-background",!1!==s.background),uniforms:i,autoplay:!1,...this.parseAttrObject(t,"shader-options",{}),...this.parseAttrObject(t,"webgl-options",{})}),n=s.on||this.parseAttrString(t,"shader-on",this.parseAttrString(t,"webgl-on",this.parseAttrString(t,"on","load"))),o=s.action||this.parseAttrString(t,"shader-action",this.parseAttrString(t,"webgl-action","play")),a=this.parseAttrObject(t,"shader-to",null)||this.parseAttrObject(t,"webgl-to",null),h=this.parseAttrNumber(t,"shader-duration",this.parseAttrNumber(t,"duration",1)),l=this.parseAttrString(t,"shader-ease",this.parseAttrString(t,"ease","ease-out")),u=()=>{a&&r.tweenUniforms(a,{duration:h,ease:l}),"pause"===o?r.pause():"scrub"===o?r.scrubToProgress(0):r.play()};if("load"===n||"init"===n)u();else if("inview"===n){const e=new Wt({trigger:t,scrub:"scrub"===o,...this.parseAttrObject(t,"shader-scroll",{}),onEnter:()=>{"scrub"!==o&&u()},onLeave:()=>{this.parseAttrBoolean(t,"shader-pause-on-leave",!1)&&r.pause()},onUpdate:({progress:t})=>{"scrub"===o&&r.scrubToProgress(t)}});this.scrollTriggers.set(t,e)}else{const e=ge[n]||n,s=()=>u();t.addEventListener(e,s),this.registerCleanup(()=>t.removeEventListener(e,s))}this.shaderControllers.set(t,r)})}initLottieAnimations(){this.queryAllByAttr("lottie").forEach(t=>{const e=this.parseAttrString(t,"lottie"),s=e&&e.trim().startsWith("{")?ue(e):{path:e,container:t},i=ee.createController({container:t,renderer:"svg",autoplay:!1,loop:!1,...s,...this.parseAttrObject(t,"lottie-options",{})});this.lottieControllers.set(t,i),this.bindPlaybackController(t,i,"lottie")})}initDotLottieAnimations(){this.queryAllByAttr("dotlottie").forEach(t=>{const e=this.parseAttrString(t,"dotlottie"),s=e&&e.trim().startsWith("{")?ue(e):{src:e,canvas:t},i=ie.createController({canvas:t,autoplay:!1,loop:!1,...s,...this.parseAttrObject(t,"dotlottie-options",{})});this.dotLottieControllers.set(t,i),this.bindPlaybackController(t,i,"dotlottie")})}bindPlaybackController(t,e,s){const i=this.parseAttrString(t,`${s}-on`,"load"),r=this.parseAttrString(t,`${s}-action`,"play"),n=this.getAttr(t,`${s}-progress`),o=this.getAttr(t,`${s}-frame`),a=this.parseAttrString(t,`${s}-segment`,""),h=()=>{if(a){const[t,s]=a.split(",").map(t=>Number(t.trim()));Number.isFinite(t)&&Number.isFinite(s)&&(e.setSegment?.(t,s),e.playSegments?.([t,s],!0))}null!==n&&e.setProgress(ce(n,0)),null!==o&&e.setFrame(ce(o,0)),"play"===r?e.play():"pause"===r?e.pause():"stop"===r&&e.stop()};if("load"===i||"init"===i)return void h();if("inview"===i){const e=new Wt({trigger:t,onEnter:()=>h()});return void this.scrollTriggers.set(t,e)}const l=ge[i]||i,u=()=>h();t.addEventListener(l,u),this.registerCleanup(()=>t.removeEventListener(l,u))}refreshScrollTriggers(){this.scrollTriggers.forEach(t=>{t.refresh?.()})}killAll(){this.timelines.forEach(t=>t.kill()),this.tweens.forEach(t=>t.kill()),this.scrollTriggers.forEach(t=>t.kill?.()),this.draggables.forEach(t=>t.destroy?.()),this.parallaxEffects.forEach(t=>t.destroy?.()),this.springAnimations.forEach(t=>t.kill?.()),this.motionPathAnimations.forEach(t=>t.kill?.()),this.keyframeTimelines.forEach(t=>t.kill?.()),this.sceneSequences.forEach(t=>t.kill?.()),this.splitTexts.forEach(t=>t.revert?.()),this.lottieControllers.forEach(t=>t.destroy?.()),this.dotLottieControllers.forEach(t=>t.destroy?.()),this.videoAnimations.forEach(t=>t.destroy?.()),this.audioAnimations.forEach(t=>t.destroy?.()),this.shaderControllers.forEach(t=>t.destroy?.())}getStats(){return{timelines:this.timelines.size,tweens:this.tweens.size,splitTexts:this.splitTexts.size,scrollTriggers:this.scrollTriggers.size,draggables:this.draggables.size,parallaxEffects:this.parallaxEffects.size,springAnimations:this.springAnimations.size,motionPathAnimations:this.motionPathAnimations.size,keyframeTimelines:this.keyframeTimelines.size,sceneSequences:this.sceneSequences.size,lottieControllers:this.lottieControllers.size,dotLottieControllers:this.dotLottieControllers.size,videoAnimations:this.videoAnimations.size,audioAnimations:this.audioAnimations.size,shaderControllers:this.shaderControllers.size}}};class ve{constructor(t={}){this.interactions=new Map,this.activeInteractions=new Set,this.eventListeners=new Map,this.options={debug:!1,preventDefault:!0,globalEvents:!0,scope:null,...t},this.boundHandlers=new Map}on(t,e,s={}){return this.resolveTarget(t).forEach(t=>{const i=`${t.id||Math.random()}_${e}`,r={element:t,eventType:e,config:{animation:s.animation||{},duration:s.duration||.5,ease:s.ease||"ease-out",delay:s.delay||0,target:s.target||t,onStart:s.onStart||null,onComplete:s.onComplete||null,autoReverse:s.autoReverse||!1,reverseDelay:s.reverseDelay||0,...s}};this.interactions.set(i,r),this.attachListener(t,e,r)}),this}resolveTarget(t){if("string"==typeof t){const e=this.options.scope||document;return Array.from(e.querySelectorAll(t))}return[t]}attachListener(t,e,s){this.eventListeners.has(t)||this.eventListeners.set(t,new Map);const i=this.eventListeners.get(t);let r;switch(e){case"click":r=t=>{t.preventDefault?.(),this.executeAnimation(s,t)},t.addEventListener("click",r);break;case"hover":{const e=t=>this.executeAnimation(s,t),r=t=>{s.config.autoReverse&&this.reverseAnimation(s,t)};return t.addEventListener("mouseenter",e),t.addEventListener("mouseleave",r),i.set("hoverIn",e),void i.set("hoverOut",r)}case"focus":{r=t=>this.executeAnimation(s,t);const e=t=>{s.config.autoReverse&&this.reverseAnimation(s,t)};return t.addEventListener("focus",r),t.addEventListener("blur",e),i.set("focus",r),void i.set("blur",e)}case"touch":{r=t=>this.executeAnimation(s,t);const e=t=>{s.config.autoReverse&&this.reverseAnimation(s,t)};return t.addEventListener("touchstart",r),t.addEventListener("touchend",e),i.set("touchstart",r),void i.set("touchend",e)}case"pointer":{r=t=>this.executeAnimation(s,t);const e=t=>{s.config.autoReverse&&this.reverseAnimation(s,t)};return t.addEventListener("pointerdown",r),t.addEventListener("pointerup",e),i.set("pointerdown",r),void i.set("pointerup",e)}case"keyboard":return void this.attachKeyboardListener(t,s);case"doubletap":return void this.attachDoubleTapListener(t,s);case"longpress":return void this.attachLongPressListener(t,s);case"swipe":return void this.attachSwipeListener(t,s);case"wheel":r=t=>{t.preventDefault?.(),this.executeAnimation(s,t)},t.addEventListener("wheel",r,{passive:!1});break;default:r=t=>this.executeAnimation(s,t),t.addEventListener(e,r)}r&&i.set(e,r)}attachKeyboardListener(t,e){const s=t=>{const s=e.config.key;(!s||t.key===s||t.code===s)&&(t.preventDefault?.(),this.executeAnimation(e,t))};document.addEventListener("keydown",s),this.eventListeners.has(t)||this.eventListeners.set(t,new Map),this.eventListeners.get(t).set("keyboard",s)}attachDoubleTapListener(t,e){let s=0;const i=t=>{const i=(new Date).getTime(),r=i-s;r<300&&r>0&&this.executeAnimation(e,t),s=i};t.addEventListener("touchend",i),this.eventListeners.has(t)||this.eventListeners.set(t,new Map),this.eventListeners.get(t).set("doubletap",i)}attachLongPressListener(t,e){let s=null;const i=e.config.pressDuration||500,r=()=>{s=setTimeout(()=>{this.executeAnimation(e)},i)},n=()=>clearTimeout(s);t.addEventListener("mousedown",r),t.addEventListener("mouseup",n),t.addEventListener("mouseleave",n),this.eventListeners.has(t)||this.eventListeners.set(t,new Map),this.eventListeners.get(t).set("longpress",{onMouseDown:r,onMouseUp:n})}attachSwipeListener(t,e){let s,i;const r=t=>{s=t.changedTouches[0].screenX},n=t=>{i=t.changedTouches[0].screenX;const r=i-s,n=e.config.swipeThreshold||50;if(Math.abs(r)>n){const t=r>0?"right":"left";e.config.direction!==t&&e.config.direction||this.executeAnimation(e)}};t.addEventListener("touchstart",r),t.addEventListener("touchend",n),this.eventListeners.has(t)||this.eventListeners.set(t,new Map),this.eventListeners.get(t).set("swipe",{onTouchStart:r,onTouchEnd:n})}executeAnimation(t,e=null){const s=t.config,i=s.target||t.element;s.onStart?.(e,i);const r=new Bt(i,s.animation,{duration:s.duration,ease:s.ease,delay:s.delay,onComplete:()=>{s.onComplete?.(e,i)}});this.activeInteractions.add(r),this.options.debug&&f.debug(`Animation executed on ${i.tagName||"object"}`)}reverseAnimation(t){const e=t.config,s=e.target||t.element,i=this.reverseProps(e.animation),r=new Bt(s,i,{duration:e.duration,ease:e.ease,delay:e.reverseDelay});this.activeInteractions.add(r)}reverseProps(t){const e={};for(const[s,i]of Object.entries(t))e[s]="number"==typeof i?-i:"opacity"===s?1:"transform"===s?"none":i;return e}static initFromDOM(){const t=new ve;return document.querySelectorAll("[data-anim-click]").forEach(e=>{const s=ue(e.dataset.animClick||"{}");t.on(e,"click",s)}),document.querySelectorAll("[data-anim-hover]").forEach(e=>{const s=ue(e.dataset.animHover||"{}");t.on(e,"hover",s)}),document.querySelectorAll("[data-anim-focus]").forEach(e=>{const s=ue(e.dataset.animFocus||"{}");t.on(e,"focus",s)}),document.querySelectorAll("[data-anim-touch]").forEach(e=>{const s=ue(e.dataset.animTouch||"{}");t.on(e,"touch",s)}),document.querySelectorAll("[data-anim-keyboard]").forEach(e=>{const s=ue(e.dataset.animKeyboard||"{}");t.on(e,"keyboard",s)}),document.querySelectorAll("[data-anim-pointer]").forEach(e=>{const s=ue(e.dataset.animPointer||"{}");t.on(e,"pointer",s)}),t}off(t,e){return this.resolveTarget(t).forEach(t=>{if(!this.eventListeners.has(t))return;const s=this.eventListeners.get(t);this.getHandlerKeys(e,s).forEach(e=>{this.removeStoredHandler(t,s,e)}),0===s.size&&this.eventListeners.delete(t)}),this}offAll(){return this.eventListeners.forEach((t,e)=>{Array.from(t.keys()).forEach(s=>{this.removeStoredHandler(e,t,s)})}),this.interactions.clear(),this.activeInteractions.clear(),this.eventListeners.clear(),this.boundHandlers.clear(),this}getHandlerKeys(t,e){if(!t)return Array.from(e.keys());return{hover:["hoverIn","hoverOut"],focus:["focus","blur"],touch:["touchstart","touchend"],pointer:["pointerdown","pointerup"],longpress:["longpress"],swipe:["swipe"]}[t]||[t]}removeStoredHandler(t,e,s){const i=e.get(s);i&&("keyboard"===s?document.removeEventListener("keydown",i):"hoverIn"===s?t.removeEventListener("mouseenter",i):"hoverOut"===s?t.removeEventListener("mouseleave",i):"touchstart"===s?t.removeEventListener("touchstart",i):"touchend"===s?t.removeEventListener("touchend",i):"pointerdown"===s?t.removeEventListener("pointerdown",i):"pointerup"===s?t.removeEventListener("pointerup",i):"longpress"===s?(t.removeEventListener("mousedown",i.onMouseDown),t.removeEventListener("mouseup",i.onMouseUp),t.removeEventListener("mouseleave",i.onMouseUp)):"swipe"===s?(t.removeEventListener("touchstart",i.onTouchStart),t.removeEventListener("touchend",i.onTouchEnd)):"wheel"===s?t.removeEventListener("wheel",i):t.removeEventListener(s,i),e.delete(s))}getStats(){return{totalInteractions:this.interactions.size,activeAnimations:this.activeInteractions.size,registeredElements:this.eventListeners.size}}}var ye=ve;var Ae=class{constructor(t={}){this.scope=t.scope||null,this.instances=new Set,this.cleanups=[]}add(t){return t?(this.instances.add(t),t):t}addCleanup(t){return"function"==typeof t&&this.cleanups.push(t),t}resolveScopeTarget(t){return"string"==typeof t&&ht(this.scope)?Array.from(this.scope.querySelectorAll(t)):t}tween(t,e,s={}){return this.add(new Bt(this.resolveScopeTarget(t),e,{...s,scope:this.scope,paused:!1}))}to(t,e,s={}){return this.tween(t,e,s)}from(t,e,s={}){return this.add(new Bt(this.resolveScopeTarget(t),e,{...s,from:!0,scope:this.scope,paused:!1}))}fromTo(t,e,s,i={}){return this.add(new Bt(this.resolveScopeTarget(t),s,{...i,fromTo:e,scope:this.scope,paused:!1}))}set(t,e,s={}){return this.add(new Bt(this.resolveScopeTarget(t),e,{...s,duration:0,scope:this.scope,paused:!1}))}timeline(t={}){return this.add(new $t({...t,scope:t.scope||this.scope}))}spring(t,e,s={}){return this.add(new Vt(this.resolveScopeTarget(t),e,{...s,scope:this.scope}))}keyframes(t,e,s={}){return this.add(le(this.resolveScopeTarget(t),e,{...s,scope:this.scope}))}motionPath(t,e={}){return this.add(Zt(this.resolveScopeTarget(t),{...e,scope:this.scope}))}sequence(t=[],e={}){return this.add(new Qt(t,{...e,scope:this.scope}))}interactions(t={}){return this.add(new ye({...t,scope:t.scope||this.scope}))}initAttributes(t={}){const e=new fe({...t,root:t.root||this.scope,autoInit:!1});return e.init(),this.add(e)}query(t){return ht(this.scope)?Array.from(this.scope.querySelectorAll(t)):[]}revert(){this.cleanups.slice().reverse().forEach(t=>t()),this.cleanups=[],this.instances.forEach(t=>{"function"==typeof t.revert?t.revert():"function"==typeof t.kill?t.kill():"function"==typeof t.destroy&&t.destroy()}),this.instances.clear()}};const be=(t,e,s={})=>{const i=s.speed||50,r=s.startDelay||0;let n=0;t.textContent="";const o=()=>{const r=setInterval(()=>{n<e.length?(t.textContent+=e[n],n++):(clearInterval(r),s.onComplete?.())},i)};r>0?setTimeout(o,1e3*r):o()},Te=(t,e={})=>{const s=e.chars||"0123456789!@#$%^&*()_+-=[]{}|;:,.<>?/",i=t.textContent,r=e.duration||1,n=e.revealDelay||.05,o=performance.now(),a=h=>{const l=(h-o)/1e3,u=Math.min(l/r,1);let c="";for(let t=0;t<i.length;t++){c+=Math.max(0,u-t*n)>=1?i[t]:s[Math.floor(Math.random()*s.length)]}t.textContent=c,u<1?requestAnimationFrame(a):(t.textContent=i,e.onComplete?.())};requestAnimationFrame(a)},Se=(t,e={})=>{const s=e.from||0,i=e.to||100,r=e.duration||1,n=e.ease||(t=>t),o=e.prefix||"",a=e.suffix||"",h=performance.now(),l=u=>{const c=(u-h)/1e3,p=Math.min(c/r,1),d=n(p),m=s+(i-s)*d;t.textContent=o+Math.floor(m)+a,p<1?requestAnimationFrame(l):e.onComplete?.()};requestAnimationFrame(l)},we=(t,e={})=>{const s=e.duration||1,i=performance.now(),r=n=>{const o=(n-i)/1e3,a=Math.min(o/s,1),h=10*(1-a);t.style.filter=`blur(${h}px)`,a<1?requestAnimationFrame(r):(t.style.filter="blur(0px)",e.onComplete?.())};requestAnimationFrame(r)},Ee=(t,e={})=>{const s=e.duration||1,i=e.wave||10,r=e.speed||1,n=t.textContent;t.innerHTML="";const o=n.split("").map(e=>{const s=document.createElement("span");return s.textContent=e,s.style.display="inline-block",t.appendChild(s),s}),a=performance.now(),h=t=>{const n=(t-a)/1e3;o.forEach((t,e)=>{const s=Math.sin((n*r+.1*e)*Math.PI)*i;t.style.transform=`translateY(${s}px)`}),n<s?requestAnimationFrame(h):e.onComplete?.()};requestAnimationFrame(h)},xe=(t,e,s={})=>{const i=s.from??t.textContent??"",r=e??s.to??"",n=s.duration||.8,o=s.ease||(t=>t),a=Math.max(i.length,r.length),h=performance.now();t.textContent=i;const l=e=>{const u=(e-h)/1e3,c=Math.min(u/n,1),p=o(c),d=Math.round(p*a);let m="";for(let t=0;t<a;t++)m+=t<d?r[t]||"":i[t]||"";t.textContent=m,c<1?requestAnimationFrame(l):(t.textContent=r,s.onComplete?.())};requestAnimationFrame(l)};var Le=class{static resolveLibrary(t){if(t)return t;const e=ot();if(e?.THREE)return e.THREE;throw new Error("Three.js is not loaded")}static isLoaded(){const t=ot();return void 0!==t?.THREE}static get THREE(){return this.resolveLibrary()}static tween(t,e,s={}){return new Bt(t,e,{...s,paused:!0===s.paused,render:e=>{s.renderer?.render?.(s.scene,s.camera),s.onRender?.(e,t)}})}static orbit(t,e={}){const s={angle:e.fromAngle||0},i=e.radius||5,r=e.center||{x:0,y:0,z:0};return new Bt(s,{angle:void 0===e.toAngle?2*Math.PI:e.toAngle},{duration:e.duration||2,ease:e.ease||"linear",paused:!0===e.paused,repeat:e.repeat||0,render:()=>{t.position.x=r.x+Math.cos(s.angle)*i,t.position.z=r.z+Math.sin(s.angle)*i,t.position.y=r.y,"function"==typeof t.lookAt&&t.lookAt(r.x,r.y,r.z),e.renderer?.render?.(e.scene,e.camera)}})}static createAnimationStateMachine(t,e={}){const s=this.resolveLibrary(e.THREE||e.library),i=t.scene||t,r=e.clips||t.animations||[],n=e.mixer||new s.AnimationMixer(i),o=new Map;let a=null,h=null,l=null;r.forEach(t=>{const e=n.clipAction(t,i);o.set(t.name,e)});const u=()=>{e.renderer?.render?.(e.scene||i,e.camera),e.onRender?.(p)},c=t=>{null===l&&(l=t),n.update((t-l)/1e3),l=t,u(),h=requestAnimationFrame(c)},p={root:i,mixer:n,actions:o,states:o,get current(){return a},has(t){return o.has(t)},getAction(t){return o.get(t)||null},play(t,i={}){const r=o.get(t);if(!r)throw new Error(`GLTF animation action not found: ${t}`);const n=a?o.get(a):null,h=i.fade??e.fade??.25;return r.enabled=!0,r.paused=!1,r.timeScale=i.timeScale??1,r.clampWhenFinished=i.clampWhenFinished??e.clampWhenFinished??!0,void 0!==i.loop&&s[i.loop]&&r.setLoop(s[i.loop],i.repetitions??1/0),!1!==i.reset&&r.reset(),n&&n!==r&&h>0&&n.crossFadeTo(r,h,!1!==i.warp),r.play(),a=t,e.onStateChange?.(t,n,p),p},stop(t=a){return o.get(t)?.stop(),t===a&&(a=null),p},pause(t=a){const e=o.get(t);return e&&(e.paused=!0),p},update(t){return n.update(t),u(),p},start(){return h||(l=null,h=requestAnimationFrame(c)),p},stopLoop(){return h&&(cancelAnimationFrame(h),h=null),p},dispose(){p.stopLoop(),o.forEach(t=>t.stop()),n.stopAllAction()}};return p.setState=p.play,(e.initialState||e.initial)&&p.play(e.initialState||e.initial,{fade:0,reset:!0}),!1!==e.autoplay&&p.start(),p}static gltfStateMachine(t,e={}){return this.createAnimationStateMachine(t,e)}};const Me=(t={},e="am")=>Object.entries(t).reduce((t,[s,i])=>{if(null==i||!1===i)return t;const r=`${e}-${s.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`,n=(t=>{if(null!=t&&!1!==t)return"string"==typeof t?t:"number"==typeof t||"boolean"==typeof t?String(t):JSON.stringify(t)})(i);return void 0===n||(t[r]=n),t},{[e]:""});var Ce={version:"1.1.0",AnimationCore:fe,AnimationContext:Ae,Timeline:$t,Tween:Bt,Keyframes:le,Easing:i,SplitText:jt,ScrollTrigger:Wt,Draggable:Xt,ParallaxEffect:Ht,SpringPhysics:Vt,MotionPath:Zt,SceneSequence:Qt,TextEffects:a,VideoAnimation:Kt,AudioAnimation:Jt,Interactions:ye,WebGLSupport:he,ThreeJsSupport:Le,LottieSupport:ee,DotLottieSupport:ie,animotionAttrs:Me,DomUtils:n,EnvironmentUtils:r,MathUtils:s,ParserUtils:o,Logger:f,init(t={}){const e=new fe(t);return e.init(),e},initAttributes(t={}){return this.init(t)},timeline(t={}){return new $t(t)},tween(t,e,s={}){return new Bt(t,e,s)},spring(t,e,s={}){return new Vt(t,e,s)},keyframes(t,e,s={}){return le(t,e,s)},path(t,e={}){return Zt(t,e)},motionPath(t,e={}){return Zt(t,e)},sequence(t,e={}){return new Qt(t,e)},to(t,e,s={}){return new Bt(t,e,{...s,paused:!1})},from(t,e,s={}){return new Bt(t,e,{...s,from:!0,paused:!1})},fromTo(t,e,s,i={}){return new Bt(t,s,{...i,fromTo:e,paused:!1})},set(t,e){return new Bt(t,e,{duration:0,paused:!1})},interactions(t={}){return new ye(t)},scroll(t,e={}){const s="string"==typeof t||ht(t)?{...e,trigger:t}:{...t,...e};return new Wt(s)},pin(t,e={}){const s="string"==typeof t||ht(t)?{...e,trigger:t}:{...t,...e};return new Wt({...s,pin:!0,scrub:s.scrub??!0})},inOut(t,e,s,i={}){const r=new Bt(t,e,{...i,paused:!0}),n=new Bt(t,s,{...i,paused:!0});return{enter:r,leave:n,playIn:()=>r.restart(),playOut:()=>n.restart(),reverse:()=>{r.seek(1),r.reverse(),r.play()},kill:()=>{r.kill(),n.kill()}}},initInteractions(){return ye.initFromDOM()},context(t={}){return new Ae(t)},lottie(t,e={}){return ee.createController(t,e)},dotLottie(t,e={}){return ie.createController(t,e)},video(t,e={}){return new Kt(t,e)},audio(t,e={}){return new Jt(t,e)},sound(t,e={}){return new Jt(t,e)},shader(t,e={}){return he.createShader(t,e)},webglShader(t,e={}){return he.createShader(t,e)},threeStateMachine(t,e={}){const s=Le.createAnimationStateMachine(t,e),i=e.id||e.name,r=ot();return i&&r&&(r.__ANIMOTION__=r.__ANIMOTION__||{},r.__ANIMOTION__.threeStateMachines=r.__ANIMOTION__.threeStateMachines||new Map,r.__ANIMOTION__.threeStateMachines.set(i,s)),s},getTimeline(t){return ot()?.__ANIMOTION__?.timelines?.get(t)||null},getSplitText(t){return ot()?.__ANIMOTION__?.splitTexts?.get(t)||null}};return e}()});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Animotion=e():t.Animotion=e()}(this,function(){return function(){"use strict";var t={d:function(e,s){for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{AnimationContext:function(){return be},AnimationCore:function(){return ve},AudioAnimation:function(){return te},DomUtils:function(){return n},DotLottieSupport:function(){return re},Draggable:function(){return Ht},Easing:function(){return i},EnvironmentUtils:function(){return r},Interactions:function(){return Ae},Logger:function(){return f},LottieSupport:function(){return se},MathUtils:function(){return s},ParallaxEffect:function(){return Vt},ParserUtils:function(){return o},SceneSequence:function(){return Kt},ScrollTrigger:function(){return Xt},SplitText:function(){return jt},SpringPhysics:function(){return Gt},TextEffects:function(){return a},ThreeJsSupport:function(){return Me},Timeline:function(){return $t},Tween:function(){return Bt},VideoAnimation:function(){return Jt},WebGLSupport:function(){return le},animotionAttrs:function(){return Ce},default:function(){return ke},keyframes:function(){return ue},motionPath:function(){return Qt}});var s={};t.r(s),t.d(s,{angle:function(){return m},clamp:function(){return h},distance:function(){return d},lerp:function(){return l},map:function(){return u},random:function(){return c},randomInt:function(){return p},round:function(){return g}});var i={};t.r(i),t.d(i,{easeInBack:function(){return B},easeInBounce:function(){return X},easeInCirc:function(){return N},easeInCubic:function(){return T},easeInElastic:function(){return U},easeInExpo:function(){return O},easeInOutBack:function(){return j},easeInOutBounce:function(){return H},easeInOutCirc:function(){return D},easeInOutCubic:function(){return w},easeInOutElastic:function(){return Y},easeInOutExpo:function(){return _},easeInOutQuad:function(){return b},easeInOutQuart:function(){return L},easeInOutQuint:function(){return k},easeInOutSine:function(){return I},easeInQuad:function(){return y},easeInQuart:function(){return E},easeInQuint:function(){return M},easeInSine:function(){return P},easeOutBack:function(){return $},easeOutBounce:function(){return W},easeOutCirc:function(){return R},easeOutCubic:function(){return S},easeOutElastic:function(){return z},easeOutExpo:function(){return q},easeOutQuad:function(){return A},easeOutQuart:function(){return x},easeOutQuint:function(){return C},easeOutSine:function(){return F},getAvailableEasings:function(){return G},getEaseFunction:function(){return V},linear:function(){return v}});var r={};t.r(r),t.d(r,{getDocument:function(){return at},getWindow:function(){return ot},isBrowser:function(){return nt},isElement:function(){return ht},isNodeList:function(){return lt}});var n={};t.r(n),t.d(n,{addClass:function(){return qt},getData:function(){return Dt},getElement:function(){return kt},getElementByIdOrSelector:function(){return Ft},getElements:function(){return Pt},hasClass:function(){return Ot},placeElementInContainer:function(){return It},removeClass:function(){return _t},setData:function(){return Rt},toggleClass:function(){return Nt}});var o={};t.r(o),t.d(o,{parseBoolean:function(){return de},parseCSS:function(){return me},parseJSON:function(){return ce},parseNumber:function(){return pe}});var a={};t.r(a),t.d(a,{blurEffect:function(){return Ee},counterAnimation:function(){return we},morphText:function(){return Le},scrambleText:function(){return Se},typeText:function(){return Te},waveEffect:function(){return xe}});const h=(t,e,s)=>Math.max(e,Math.min(s,t)),l=(t,e,s)=>t+(e-t)*h(s,0,1),u=(t,e,s,i,r)=>i+(t-e)*(r-i)/(s-e),c=(t,e)=>Math.random()*(e-t)+t,p=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,d=(t,e,s,i)=>Math.sqrt(Math.pow(s-t,2)+Math.pow(i-e,2)),m=(t,e,s,i)=>Math.atan2(i-e,s-t),g=(t,e=0)=>Number(Math.round(t+"e"+e)+"e-"+e);var f=new class{constructor(){this.level="warn",this.levels={debug:0,info:1,warn:2,error:3}}setLevel(t){this.level=t}debug(t){this.levels[this.level]<=0&&console.log("[Animotion Debug]",t)}info(t){this.levels[this.level]<=1&&console.log("[Animotion Info]",t)}warn(t){this.levels[this.level]<=2&&console.warn("[Animotion Warn]",t)}error(t){this.levels[this.level]<=3&&console.error("[Animotion Error]",t)}};const v=t=>t,y=t=>t*t,A=t=>t*(2-t),b=t=>t<.5?2*t*t:(4-2*t)*t-1,T=t=>t*t*t,S=t=>--t*t*t+1,w=t=>t<.5?4*t*t*t:2*(t-2)*(t-1)*(2*(t-2))+1,E=t=>t*t*t*t,x=t=>1- --t*t*t*t,L=t=>t<.5?8*t*t*t*t:1-8*--t*t*t*t,M=t=>t*t*t*t*t,C=t=>1+--t*t*t*t*t,k=t=>t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t,P=t=>1-Math.cos(t*Math.PI/2),F=t=>Math.sin(t*Math.PI/2),I=t=>-(Math.cos(Math.PI*t)-1)/2,O=t=>0===t?0:Math.pow(2,10*t-10),q=t=>1===t?1:1-Math.pow(2,-10*t),_=t=>0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2,N=t=>1-Math.sqrt(1-Math.pow(t,2)),R=t=>Math.sqrt(1-Math.pow(t-1,2)),D=t=>t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2,B=t=>{const e=1.70158;return 2.70158*t*t*t-e*t*t},$=t=>{const e=1.70158;return 1+2.70158*Math.pow(t-1,3)+e*Math.pow(t-1,2)},j=t=>{const e=2.5949095;return t<.5?Math.pow(2*t,2)*(7.189819*t-e)/2:(Math.pow(2*t-2,2)*((e+1)*(2*t-2)+e)+2)/2},U=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:-Math.pow(2,10*t-10)*Math.sin((10*t-10.75)*e)},z=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Y=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1},W=t=>{const e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-=1.5/s)*t+.75:t<2.5/s?e*(t-=2.25/s)*t+.9375:e*(t-=2.625/s)*t+.984375},X=t=>1-W(1-t),H=t=>t<.5?(1-W(1-2*t))/2:(1+W(2*t-1))/2,V=(t="linear")=>({linear:v,"ease-in":y,"ease-out":A,"ease-in-out":b,none:v,"quad-in":y,"quad-out":A,"quad-in-out":b,"cubic-in":T,"cubic-out":S,"cubic-in-out":w,"quart-in":E,"quart-out":x,"quart-in-out":L,"quint-in":M,"quint-out":C,"quint-in-out":k,"sine-in":P,"sine-out":F,"sine-in-out":I,"expo-in":O,"expo-out":q,"expo-in-out":_,"circ-in":N,"circ-out":R,"circ-in-out":D,"back-in":B,"back-out":$,"back-in-out":j,"elastic-in":U,"elastic-out":z,"elastic-in-out":Y,"bounce-in":X,"bounce-out":W,"bounce-in-out":H}[t.toLowerCase()]||v),G=()=>["linear","ease-in","ease-out","ease-in-out","quad-in","quad-out","quad-in-out","cubic-in","cubic-out","cubic-in-out","quart-in","quart-out","quart-in-out","quint-in","quint-out","quint-in-out","sine-in","sine-out","sine-in-out","expo-in","expo-out","expo-in-out","circ-in","circ-out","circ-in-out","back-in","back-out","back-in-out","elastic-in","elastic-out","elastic-in-out","bounce-in","bounce-out","bounce-in-out"],Z=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Q=t=>"[object Object]"===Object.prototype.toString.call(t),K=t=>{const e=Number(t);return Number.isFinite(e)?e:null},J=(t,e=255)=>Math.round(h(t,0,e)),tt=t=>{const e=t.match(/hsla?\(([^)]+)\)/i);if(!e)return null;const s=e[1].split(",").map(t=>t.trim().replace("%",""));if(s.length<3)return null;const i=((t,e,s)=>{const i=(t%360+360)%360/360,r=h(e/100,0,1),n=h(s/100,0,1);if(0===r){const t=255*n;return{r:t,g:t,b:t}}const o=n<.5?n*(1+r):n+r-n*r,a=2*n-o,l=t=>{let e=t;return e<0&&(e+=1),e>1&&(e-=1),e<1/6?a+6*(o-a)*e:e<.5?o:e<2/3?a+(o-a)*(2/3-e)*6:a};return{r:255*l(i+1/3),g:255*l(i),b:255*l(i-1/3)}})(K(s[0])??0,K(s[1])??0,K(s[2])??0);return{...i,a:K(s[3])??1}},et=t=>{if("string"!=typeof t)return null;const e=t.trim();return(t=>{const e=t.replace("#","").trim();if(![3,4,6,8].includes(e.length)||!/^[0-9a-fA-F]+$/.test(e))return null;const s=e.length<=4?e.split("").map(t=>t+t).join(""):e,i=8===s.length?parseInt(s.slice(6,8),16)/255:1;return{r:parseInt(s.slice(0,2),16),g:parseInt(s.slice(2,4),16),b:parseInt(s.slice(4,6),16),a:i}})(e)||(t=>{const e=t.match(/rgba?\(([^)]+)\)/i);if(!e)return null;const s=e[1].split(",").map(t=>t.trim());return s.length<3?null:{r:K(s[0])??0,g:K(s[1])??0,b:K(s[2])??0,a:K(s[3])??1}})(e)||tt(e)},st=(t,e)=>{const s=et(t),i=et(e);return s&&i?t=>(t=>{const e=Math.round(1e3*h(t.a,0,1))/1e3;return`rgba(${J(t.r)}, ${J(t.g)}, ${J(t.b)}, ${e})`})({r:s.r+(i.r-s.r)*t,g:s.g+(i.g-s.g)*t,b:s.b+(i.b-s.b)*t,a:s.a+(i.a-s.a)*t}):null},it=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)return null;const s=t.match(Z),i=e.match(Z);if(!s||!i||s.length!==i.length)return null;const r=e.split(Z);if(r.length!==i.length+1)return null;const n=s.map(t=>Number(t)),o=i.map(t=>Number(t));return n.some(t=>!Number.isFinite(t))||o.some(t=>!Number.isFinite(t))?null:t=>{let e=r[0]||"";return o.forEach((s,i)=>{const o=n[i]+(s-n[i])*t;e+=(t=>{if(!Number.isFinite(t))return 0;const e=Math.round(1e4*t)/1e4;return String(e).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")})(o),e+=r[i+1]||""}),e}},rt=(t,e)=>{const s=K(t),i=K(e);if(null!==s&&null!==i)return t=>s+(i-s)*t;const r=st(t,e);if(r)return r;const n=it(t,e);if(n)return n;const o=((t,e)=>{if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return null;const s=t.map((t,s)=>rt(t,e[s]));return t=>s.map(e=>e(t))})(t,e);if(o)return o;if(Q(t)&&Q(e)){const s=Object.keys(e),i=s.reduce((s,i)=>(s[i]=rt(t[i],e[i]),s),{});return t=>s.reduce((e,s)=>(e[s]=i[s](t),e),{})}return s=>s<1?t:e},nt=()=>"undefined"!=typeof window&&"undefined"!=typeof document,ot=()=>"undefined"!=typeof window?window:null,at=()=>"undefined"!=typeof document?document:null,ht=t=>!(!nt()||"undefined"==typeof Element)&&t instanceof Element,lt=t=>"undefined"!=typeof NodeList&&t instanceof NodeList,ut=new WeakMap,ct=new WeakMap,pt={x:"0px",y:"0px",z:"0px",scale:1,scaleX:1,scaleY:1,scaleZ:1,rotate:"0deg",rotateX:"0deg",rotateY:"0deg",rotateZ:"0deg",skewX:"0deg",skewY:"0deg"},dt={blur:"0px",brightness:1,contrast:1,grayscale:0,hueRotate:"0deg",invert:0,saturate:1,sepia:0},mt=Object.keys(pt),gt=Object.keys(dt),ft=t=>t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase()),vt=t=>t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),yt=t=>String(t).split(".").filter(Boolean),At=(t,e)=>yt(e).reduce((t,e)=>{if(null!=t)return t[e]},t),bt=(t,e,s)=>{const i=yt(e);if(0===i.length)return;const r=i.pop(),n=i.reduce((t,e)=>null==t?null:t[e],t);if(!n||!r)return;const o=n[r];!o||"function"!=typeof o.set||"string"!=typeof s&&"number"!=typeof s?o&&"function"==typeof o.copy&&s&&"object"==typeof s?o.copy(s):n[r]=s:o.set(s)},Tt=t=>{if(ut.has(t))return ut.get(t);const e=ot(),s=e?.getComputedStyle?.(t).transform,i={base:s&&"none"!==s?s:"",values:{...pt}};return ut.set(t,i),i},St=t=>{if(ct.has(t))return ct.get(t);const e=ot(),s=e?.getComputedStyle?.(t).filter,i={base:s&&"none"!==s?s:"",values:{...dt}};return ct.set(t,i),i},wt=(t,e,s)=>{if(mt.includes(e)){const i=Tt(t);return"scale"===e?(i.values.scaleX=s,i.values.scaleY=s,i.values.scaleZ=s):i.values[e]=s,void(t=>{const e=Tt(t),s=[e.base,`translate3d(${e.values.x}, ${e.values.y}, ${e.values.z})`,`rotate(${e.values.rotate})`,`rotateX(${e.values.rotateX})`,`rotateY(${e.values.rotateY})`,`rotateZ(${e.values.rotateZ})`,`skewX(${e.values.skewX})`,`skewY(${e.values.skewY})`,`scale3d(${e.values.scaleX}, ${e.values.scaleY}, ${e.values.scaleZ})`].filter(Boolean);t.style.transform=s.join(" ").trim()})(t)}if(gt.includes(e))return St(t).values[e]=s,void(t=>{const e=St(t),s=[e.base,`blur(${e.values.blur})`,`brightness(${e.values.brightness})`,`contrast(${e.values.contrast})`,`grayscale(${e.values.grayscale})`,`hue-rotate(${e.values.hueRotate})`,`invert(${e.values.invert})`,`saturate(${e.values.saturate})`,`sepia(${e.values.sepia})`].filter(Boolean);t.style.filter=s.join(" ").trim()})(t);if(e.startsWith("--"))return void t.style.setProperty(e,s);if(e.startsWith("attr."))return void t.setAttribute(e.slice(5),s);if("scrollTop"===e||"scrollLeft"===e)return void(t[e]=Number(s));if(e.startsWith("style.")){const i=ft(e.slice(6));return void(t.style[i]=s)}if(e.includes("."))return void bt(t,e,s);const i=ft(e);i in t.style?t.style[i]=s:e in t&&"function"!=typeof t[e]?t[e]=s:bt(t,e,s)},Et=t=>ht(t),xt=(t,e={})=>{if(null==t)return[];if("string"==typeof t){if(!nt())return[];const s=e.scope&&ht(e.scope)?e.scope:document;return Array.from(s.querySelectorAll(t))}return Array.isArray(t)?t.flatMap(t=>xt(t,e)):lt(t)?Array.from(t):[t]},Lt=(t,e="")=>Object.entries(t||{}).reduce((t,[s,i])=>{const r=e?`${e}.${s}`:s;return!(t=>"[object Object]"===Object.prototype.toString.call(t))(i)||Array.isArray(i)||r.startsWith("attr.")||r.startsWith("style.")?(t[r]=i,t):(Object.assign(t,Lt(i,r)),t)},{}),Mt=(t,e)=>{if(Et(t))return((t,e)=>{const s=ot(),i=s?.getComputedStyle?.(t);if(mt.includes(e))return Tt(t).values[e];if(gt.includes(e))return St(t).values[e];if(e.startsWith("--"))return i?.getPropertyValue(e).trim()||t.style.getPropertyValue(e).trim()||"0";if(e.startsWith("attr."))return t.getAttribute(e.slice(5));if("scrollTop"===e||"scrollLeft"===e)return t[e];if(e.startsWith("style.")){const s=ft(e.slice(6));return t.style[s]||i?.[s]||""}if(e.includes(".")&&!e.startsWith("style."))return At(t,e);if(e in t&&"function"!=typeof t[e])return t[e];const r=ft(e);return r in t.style||i?.getPropertyValue(vt(r))?t.style[r]||i?.getPropertyValue(vt(r)).trim()||i?.[r]||"":At(t,e)})(t,e);const s=At(t,e);if(s&&"object"==typeof s&&"function"==typeof s.getStyle)return s.getStyle();if(s&&"object"==typeof s&&"number"==typeof s.r&&"number"==typeof s.g&&"number"==typeof s.b){const t="number"==typeof s.a?s.a:1;return`rgba(${Math.round(255*s.r)}, ${Math.round(255*s.g)}, ${Math.round(255*s.b)}, ${t})`}return s},Ct=(t,e,s)=>{Et(t)?wt(t,e,s):bt(t,e,s)},kt=(t,e=null)=>{if(!t)return e;if("string"==typeof t)try{return document.querySelector(t)||e}catch(t){return e}return t},Pt=(t,e=[])=>{if(!t)return e;if("string"==typeof t)try{return Array.from(document.querySelectorAll(t))}catch(t){return e}return t instanceof Element?[t]:Array.isArray(t)?t:e},Ft=(t,e=null)=>{if(!t)return e;if("string"==typeof t){const s=t.trim();return s?s.startsWith("#")?document.getElementById(s.slice(1))||e:document.querySelector(s)||document.getElementById(s)||e:e}return t instanceof Element?t:e},It=(t,e)=>{if(!(t&&e&&e.appendChild&&t.getBoundingClientRect))return;if(t===e||e.contains(t))return;const s=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=window.getComputedStyle(e);"static"===r.position&&(e.style.position="relative");const n=parseFloat(r.paddingLeft||"0"),o=parseFloat(r.paddingTop||"0"),a=i.left-s.left-parseFloat(r.borderLeftWidth||"0")-n,h=i.top-s.top-parseFloat(r.borderTopWidth||"0")-o;t.style.position="absolute",t.style.left=`${a}px`,t.style.top=`${h}px`,t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,t.style.margin="0",e.appendChild(t)},Ot=(t,e)=>t.classList.contains(e),qt=(t,e)=>t.classList.add(e),_t=(t,e)=>t.classList.remove(e),Nt=(t,e)=>t.classList.toggle(e),Rt=(t,e,s)=>{t.dataset[e]=s},Dt=(t,e,s=null)=>t.dataset[e]||s;var Bt=class{constructor(t,e,s={}){this.originalTarget=t,this.targets=xt(t,s),this.props=Lt(e),this.fromProps=s.fromTo?Lt(s.fromTo):null,this.duration=Math.max(s.duration||1,0),this.ease=s.ease||"ease-out",this.delay=s.delay||0,this.repeat=s.repeat||0,this.yoyo=!1!==s.yoyo,this.stagger=s.stagger||0,this.from=!0===s.from,this.place=s.place||s.stick||null,this.placed=!1,this.render=s.render||null,this.onStart=s.onStart||null,this.onUpdate=s.onUpdate||null,this.onComplete=s.onComplete||null,this.onRepeat=s.onRepeat||null,this.paused=!0===s.paused,this.frameId=null,this.startTime=null,this.currentTime=0,this.currentRepeat=0,this.isReverse=!1,this.hasStarted=!1,this.totalDuration=this.duration+Math.max(this.targets.length-1,0)*this.stagger,this.targetStates=this.targets.map((t,e)=>({target:t,offset:e*this.stagger,properties:this.createPropertyAnimations(t,e)})),this.delay>0?setTimeout(()=>this.play(),1e3*this.delay):this.paused||this.play()}createPropertyAnimations(t,e){return Object.entries(this.props).map(([s,i])=>{const r=Mt(t,s),n=this.resolveValue(i,t,e,r),o=this.from?this.resolveValue(i,t,e,r):this.resolveValue(this.fromProps?.[s],t,e,r);let a=this.from||this.fromProps?o:r,h=this.from?r:n;return[a,h]=this.normalizeValueTypes(a,h),{path:s,startValue:a,endValue:h,interpolator:rt(a,h)}})}normalizeValueTypes(t,e){if("number"==typeof t&&"string"==typeof e){const s=e.match(/(px|deg|%|em|rem|vh|vw|vmin|vmax|cm|mm|in|pt|pc|s|ms)$/);s&&(t+=s[1])}else if("string"==typeof t&&"number"==typeof e){const s=t.match(/(px|deg|%|em|rem|vh|vw|vmin|vmax|cm|mm|in|pt|pc|s|ms)$/);s&&(e+=s[1])}return[t,e]}resolveValue(t,e,s,i){return"function"==typeof t?t(e,s,i):void 0===t?i:t}play(){if(this.paused||!this.frameId){if(this.paused=!1,0===this.totalDuration)return this.seek(1),this.placeIntoDestination(),void this.onComplete?.(this);this.startTime=performance.now()-this.currentTime*this.totalDuration*1e3,this.animate()}}pause(){this.paused=!0,this.frameId&&(cancelAnimationFrame(this.frameId),this.frameId=null)}reverse(){this.isReverse=!this.isReverse,this.seek(this.currentTime),this.paused||this.play()}restart(){this.currentTime=0,this.currentRepeat=0,this.hasStarted=!1,this.startTime=null,this.play()}seek(t){return this.currentTime=h(t,0,1),this.applyFrame(this.currentTime),this.currentTime>=1&&this.placeIntoDestination(),this}progress(t){return void 0!==t&&this.seek(t),this.currentTime}kill(){this.pause(),this.targets=[],this.targetStates=[],this.props=null,this.place=null,this.placed=!1}placeIntoDestination(){if(this.placed||!this.place)return;const t="string"==typeof this.place?Ft(this.place):this.place;t&&ht(t)&&(this.targets.forEach(e=>{ht(e)&&e!==t&&!t.contains(e)&&It(e,t)}),this.placed=!0)}animate=()=>{if(this.paused)return;this.startTime||(this.startTime=performance.now());const t=(performance.now()-this.startTime)/1e3;this.currentTime=0===this.totalDuration?1:h(t/this.totalDuration,0,1),this.applyFrame(this.currentTime),this.currentTime>=1?(this.currentRepeat++,this.repeat>0&&this.currentRepeat<=this.repeat?(this.yoyo&&(this.isReverse=!this.isReverse),this.startTime=performance.now(),this.onRepeat?.(this),this.frameId=requestAnimationFrame(this.animate)):(this.pause(),this.placeIntoDestination(),this.onComplete?.(this))):this.frameId=requestAnimationFrame(this.animate)};applyFrame(t){const e=h(t,0,1)*this.totalDuration,s=this.isReverse?this.totalDuration-e:e,i=V(this.ease);this.hasStarted||(this.hasStarted=!0,this.onStart?.(this)),this.targetStates.forEach(t=>{const e=this.getTargetProgress(s,t.offset),r=i(e);t.properties.forEach(e=>{const s=e.interpolator(r);Ct(t.target,e.path,s)})}),this.render?.(this),this.onUpdate?.(this)}getTargetProgress(t,e){if(0===this.duration)return t>=e?1:0;const s=h(t-e,0,this.duration);return h(s/this.duration,0,1)}};var $t=class{constructor(t={}){this.id=t.id||`timeline-${Date.now()}`,this.items=[],this.labels=new Map,this.duration=0,this.currentTime=0,this.autoplay=!1!==t.autoplay,this.paused=!0===t.paused,this.autoplayPending=this.autoplay&&!this.paused,this.isPlaying=!1,this.repeat=t.repeat||0,this.yoyo=!1!==t.yoyo,this.isReverse=!1,this.currentRepeat=0,this.frameId=null,this.startTime=null,this.onComplete=t.onComplete||null,this.scope=t.scope||null,f.debug(`Timeline created: ${this.id}`)}to(t,e,s=1,i="ease-out",r=">"){return this.addTween(t,e,{duration:s,ease:i,paused:!0,scope:this.scope},r)}from(t,e,s=1,i="ease-out",r=">"){return this.addTween(t,e,{duration:s,ease:i,from:!0,paused:!0,scope:this.scope},r)}fromTo(t,e,s,i=1,r="ease-out",n=">"){return this.addTween(t,s,{duration:i,ease:r,fromTo:e,paused:!0,scope:this.scope},n)}set(t,e,s=">"){return this.addTween(t,e,{duration:0,paused:!0,scope:this.scope},s)}call(t,e=">"){return this.addItem({type:"call",callback:t,startTime:this.resolvePosition(e),hasApplied:!1})}addLabel(t,e=">"){return this.labels.set(t,this.resolvePosition(e)),this}addTween(t,e,s,i){const r=new Bt(t,e,s);return r.pause(),this.addItem({type:"tween",tween:r,startTime:this.resolvePosition(i),duration:r.totalDuration})}addItem(t){return this.items.push(t),this.calculateDuration(),this.scheduleAutoplay(),this}scheduleAutoplay(){this.autoplayPending&&!this.isPlaying&&queueMicrotask(()=>{this.autoplayPending&&!this.isPlaying&&0!==this.items.length&&(this.autoplayPending=!1,this.play())})}resolvePosition(t){if("number"==typeof t)return t;if("<"===t){const t=this.items[this.items.length-1];return t?t.startTime:0}if(">"===t||null==t)return this.duration;if("string"==typeof t){const e=t.match(/^([a-zA-Z0-9_-]+)?([+-]=)(\d*\.?\d+)$/);if(e){const[,t,s,i]=e,r=t?this.labels.get(t)??this.duration:this.duration,n=Number(i);return"+="===s?r+n:Math.max(0,r-n)}if(this.labels.has(t))return this.labels.get(t)}return this.duration}calculateDuration(){this.duration=this.items.reduce((t,e)=>{const s="tween"===e.type?e.duration:0;return Math.max(t,e.startTime+s)},0)}play(){if(!this.isPlaying||this.paused){if(this.paused=!1,this.isPlaying=!0,0===this.duration)return this.currentTime=1,this.applyFrame(),this.pause(),void this.onComplete?.();this.startTime=performance.now()-this.currentTime*this.duration*1e3,this.animate()}}pause(){this.paused=!0,this.isPlaying=!1,this.frameId&&(cancelAnimationFrame(this.frameId),this.frameId=null)}reverse(){this.isReverse=!this.isReverse,this.applyFrame()}restart(){this.currentTime=0,this.isReverse=!1,this.currentRepeat=0,this.items.forEach(t=>{"call"===t.type&&(t.hasApplied=!1)}),this.play()}seek(t){return this.currentTime=h(t,0,1),this.applyFrame(),this}progress(t){return void 0!==t&&this.seek(t),this.currentTime}animate=()=>{if(this.paused)return;this.startTime||(this.startTime=performance.now());const t=(performance.now()-this.startTime)/1e3,e=0===this.duration?1:h(t/this.duration,0,1);this.currentTime=this.isReverse?1-e:e,this.applyFrame();(this.isReverse?this.currentTime<=0:this.currentTime>=1)?(this.currentRepeat++,this.repeat>0&&this.currentRepeat<this.repeat?(this.startTime=performance.now(),this.yoyo&&(this.isReverse=!this.isReverse),this.frameId=requestAnimationFrame(this.animate)):(this.pause(),this.onComplete?.())):this.frameId=requestAnimationFrame(this.animate)};applyFrame(){const t=this.currentTime*this.duration;this.items.forEach(e=>{if("call"===e.type)return void(t>=e.startTime&&!e.hasApplied?(e.callback?.(this),e.hasApplied=!0):t<e.startTime&&(e.hasApplied=!1));const s=e.startTime+e.duration;if(t<=e.startTime)return void e.tween.seek(0);if(t>=s)return void e.tween.seek(1);const i=t-e.startTime,r=0===e.duration?1:h(i/e.duration,0,1);e.tween.seek(r)})}kill(){this.pause(),this.items.forEach(t=>{t.tween?.kill?.()}),this.items=[],this.duration=0}};var jt=class{constructor(t,e={}){this.element=t,this.type=e.type||"chars",this.id=e.id||`split-${Date.now()}`,this.spans=[],this.groups={chars:[],words:[],lines:[]},this.split(),f.debug(`SplitText created: ${this.id}`)}split(){const t=this.element.textContent||"";this.element.innerHTML="";const e=document.createDocumentFragment();if("words"===this.type){(t.match(/\s+|\S+/g)||[]).forEach(t=>{const s=document.createElement("span");s.textContent=t,s.style.display="inline-block",e.appendChild(s),this.spans.push(s),this.groups.words.push(s)})}else if("lines"===this.type){const s=t.split(/\r?\n/);s.forEach((t,i)=>{const r=document.createElement("span");r.textContent=t+(i<s.length-1?"\n":""),r.style.display="block",e.appendChild(r),this.spans.push(r),this.groups.lines.push(r)})}else for(let s=0;s<t.length;s++){const i=document.createElement("span");i.textContent=t[s],i.style.display="inline-block",e.appendChild(i),this.spans.push(i),this.groups.chars.push(i)}this.element.appendChild(e)}getSpans(t){if(!t||"all"===t)return this.spans;if("chars"===t)return this.groups.chars;if("words"===t)return this.groups.words;if("lines"===t)return this.groups.lines;if("first"===t)return[this.spans[0]];if("last"===t)return[this.spans[this.spans.length-1]];if(t.startsWith("index:")){const e=parseInt(t.split(":")[1]);return[this.spans[e]]}return this.spans}revert(){const t=this.spans.map(t=>t.textContent).join("");this.element.textContent=t}};const Ut=()=>window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,zt=t=>"string"==typeof t?document.querySelector(t):t,Yt=(t,e,s,i)=>{if("number"==typeof t)return t;const[r="top",n="bottom"]=String(t||"top bottom").trim().split(/\s+/);return e+((t,e)=>{if("number"==typeof t)return t;if(!t)return 0;const s=String(t).trim();return"top"===s?0:"center"===s?e.height/2:"bottom"===s?e.height:s.endsWith("%")?e.height*(parseFloat(s)/100):s.endsWith("px")?parseFloat(s):Number(s)||0})(r,s)-((t,e)=>{if("number"==typeof t)return t;if(!t)return 0;const s=String(t).trim();return"top"===s?0:"center"===s?e/2:"bottom"===s?e:s.endsWith("%")?e*(parseFloat(s)/100):s.endsWith("px")?parseFloat(s):Number(s)||0})(n,i)},Wt=(t,e,s,i)=>{if("number"==typeof t)return t;if(!t)return i;const r=String(t).trim();if(r.startsWith("+="))return Wt(r.slice(2),e,s,i);if(r.endsWith("vh"))return s*(parseFloat(r)/100);if(r.endsWith("%"))return e.height*(parseFloat(r)/100);if(r.endsWith("px"))return parseFloat(r);const n=Number(r);return Number.isFinite(n)?n:i};var Xt=class{constructor(t={}){this.trigger=zt(t.trigger),this.start=t.start||"top center",this.end=t.end||(t.pin?"+=100vh":"bottom center"),this.scrub=t.scrub||!1,this.pin=t.pin||!1,this.pinTarget=zt(t.pinTarget)||this.trigger,this.pinSpacing=!1!==t.pinSpacing,this.pinClass=t.pinClass||"am-pinned",this.pinZIndex=t.pinZIndex||10,this.anticipatePin=t.anticipatePin||0,this.duration=t.duration||t.scrollDistance||null,this.animation=t.animation||null,this.autoPlayAnimation=!1!==t.autoPlayAnimation,this.reverse=!0===t.reverse,this.once=!0===t.once,this.markers=t.markers||!1,this.onEnter=t.onEnter||null,this.onLeave=t.onLeave||null,this.onEnterBack=t.onEnterBack||null,this.onLeaveBack=t.onLeaveBack||null,this.onUpdate=t.onUpdate||null,this.progress=0,this.isActive=!1,this.direction=1,this.previousScrollY=Ut(),this.startY=0,this.endY=0,this.pinOffset=0,this.pinActive=!1,this.spacer=null,this.originalPinStyles=null,this.trigger?(this.animation?.pause?.(),this.animation?.seek?.(0),this.handleScroll=this.handleScroll.bind(this),this.refresh=this.refresh.bind(this),window.addEventListener("scroll",this.handleScroll,{passive:!0}),window.addEventListener("resize",this.refresh),this.refresh(),f.debug("ScrollTrigger created for element")):f.warn("ScrollTrigger requires a valid trigger element")}calculateBounds(){const t=this.trigger.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,s=this.trigger.getBoundingClientRect().top+Ut();const i=this.duration?Number(this.duration):Math.max(t.height,e);this.startY=Yt(this.start,s,t,e)-this.anticipatePin,"string"==typeof this.end&&this.end.trim().startsWith("+=")?this.endY=this.startY+Wt(this.end,t,e,i):(this.endY=Yt(this.end,s,t,e),this.endY<=this.startY&&(this.endY=this.startY+i))}handleScroll(){const t=Ut(),e=this.isActive,s=Math.max(this.endY-this.startY,1);this.direction=t>=this.previousScrollY?1:-1,this.previousScrollY=t,this.progress=h((t-this.startY)/s,0,1),this.isActive=t>=this.startY&&t<=this.endY,this.updatePin(t),this.updateAnimation(),this.isActive&&!e?(this.direction>=0?this.onEnter?.(this):this.onEnterBack?.(this),this.handleAnimationBoundary("enter")):!this.isActive&&e&&(this.direction>=0?this.onLeave?.(this):this.onLeaveBack?.(this),this.handleAnimationBoundary("leave")),this.onUpdate?.({progress:this.progress,isActive:this.isActive,direction:this.direction,trigger:this}),this.once&&this.progress>=1&&this.kill()}updateAnimation(){if(this.animation)return this.scrub?(this.animation.seek?.(this.progress),this.animation.progress?.(this.progress),void this.animation.scrubToProgress?.(this.progress)):void(this.autoPlayAnimation&&this.isActive)}playAnimationForward(){this.animation&&(this.animation.pause?.(),this.animation.isReverse=!1,this.animation.startTime=null,this.animation.currentTime=0,this.animation.paused=!1,this.animation.play?.())}playAnimationReverse(){this.animation&&(this.animation.pause?.(),this.animation.seek?.(1),this.animation.isReverse=!0,this.animation.startTime=null,this.animation.currentTime=0,this.animation.paused=!1,this.animation.play?.())}handleAnimationBoundary(t){if(this.autoPlayAnimation&&this.animation&&!this.scrub)if("enter"===t&&this.direction>=0)this.playAnimationForward();else{if(!("enter"===t&&this.direction<0&&this.reverse))return"leave"===t&&this.direction>=0?(this.animation.seek?.(1),void this.animation.pause?.()):void("leave"===t&&this.direction<0&&this.reverse&&(this.animation.seek?.(0),this.animation.pause?.()));this.playAnimationReverse()}}setupPin(){if(!this.pin||this.spacer||!this.pinTarget?.parentNode)return;const t=this.pinTarget.getBoundingClientRect();this.spacer=document.createElement("div"),this.spacer.className="am-pin-spacer",this.spacer.style.position="relative",this.spacer.style.width=`${t.width}px`,this.spacer.style.height=this.pinSpacing?`${t.height+Math.max(this.endY-this.startY,0)}px`:`${t.height}px`,this.originalPinStyles={position:this.pinTarget.style.position,top:this.pinTarget.style.top,left:this.pinTarget.style.left,width:this.pinTarget.style.width,zIndex:this.pinTarget.style.zIndex,transform:this.pinTarget.style.transform},this.pinTarget.parentNode.insertBefore(this.spacer,this.pinTarget),this.spacer.appendChild(this.pinTarget)}updatePin(t){if(!this.pin)return;if(this.setupPin(),!this.spacer)return;const e=this.spacer.getBoundingClientRect(),s=t>=this.startY&&t<=this.endY;s&&!this.pinActive?(this.pinOffset=t-this.startY,this.pinTarget.classList.add(this.pinClass),this.pinTarget.style.position="fixed",this.pinTarget.style.top="0px",this.pinTarget.style.left=`${e.left}px`,this.pinTarget.style.width=`${e.width}px`,this.pinTarget.style.zIndex=String(this.pinZIndex),this.pinActive=!0):!s&&this.pinActive&&(this.pinTarget.classList.remove(this.pinClass),Object.assign(this.pinTarget.style,this.originalPinStyles),this.pinActive=!1),this.pinActive?(this.pinTarget.style.left=`${e.left}px`,this.pinTarget.style.width=`${e.width}px`):t>this.endY&&this.pinSpacing?this.pinTarget.style.transform=`translateY(${Math.max(this.endY-this.startY,0)}px)`:!this.pinActive&&this.originalPinStyles&&(this.pinTarget.style.transform=this.originalPinStyles.transform)}refresh(){if(this.pinActive&&(Object.assign(this.pinTarget.style,this.originalPinStyles),this.pinTarget.classList.remove(this.pinClass),this.pinActive=!1),this.spacer){const t=this.spacer.parentNode;t?.insertBefore(this.pinTarget,this.spacer),this.spacer.remove(),this.spacer=null}this.calculateBounds(),this.setupPin(),this.handleScroll()}kill(){if(window.removeEventListener("scroll",this.handleScroll),window.removeEventListener("resize",this.refresh),this.pinActive&&this.originalPinStyles&&(Object.assign(this.pinTarget.style,this.originalPinStyles),this.pinTarget.classList.remove(this.pinClass)),this.spacer){const t=this.spacer.parentNode;t?.insertBefore(this.pinTarget,this.spacer),this.spacer.remove(),this.spacer=null}}};var Ht=class{constructor(t,e={}){this.element=t,this.isDragging=!1,this.startX=0,this.startY=0,this.currentX=0,this.currentY=0,this.bounds=e.bounds||null,this.lockAxis=e.lockAxis||null,this.cursor=e.cursor||"grab",this.activeCursor=e.activeCursor||"grabbing",this.onDragStart=e.onDragStart||null,this.onDrag=e.onDrag||null,this.onDragEnd=e.onDragEnd||null,this.handleMouseDown=this.onMouseDown.bind(this),this.handleMouseMove=this.onMouseMove.bind(this),this.handleMouseUp=this.onMouseUp.bind(this),this.element.style.cursor=this.cursor,this.element.style.userSelect="none",this.bindEvents()}bindEvents(){this.element.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseDown(t){this.isDragging=!0,this.startX=t.clientX,this.startY=t.clientY,this.element.style.cursor=this.activeCursor,this.onDragStart?.()}onMouseMove(t){if(!this.isDragging)return;let e=t.clientX-this.startX,s=t.clientY-this.startY;"x"===this.lockAxis&&(s=0),"y"===this.lockAxis&&(e=0),this.currentX+=e,this.currentY+=s,this.element.style.transform=`translate(${this.currentX}px, ${this.currentY}px)`,this.startX=t.clientX,this.startY=t.clientY,this.onDrag?.({x:this.currentX,y:this.currentY})}onMouseUp(){this.isDragging&&(this.isDragging=!1,this.element.style.cursor=this.cursor,this.onDragEnd?.({x:this.currentX,y:this.currentY}))}destroy(){this.element.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}};var Vt=class{constructor(t,e={}){this.element=t,this.speed=e.speed||.5,this.axis=e.axis||"y",this.handleScroll=this.handleScroll.bind(this),window.addEventListener("scroll",this.handleScroll),this.handleScroll()}handleScroll(){const t=-this.element.getBoundingClientRect().top*this.speed;"y"===this.axis?this.element.style.transform=`translateY(${t}px)`:"x"===this.axis&&(this.element.style.transform=`translateX(${t}px)`)}destroy(){window.removeEventListener("scroll",this.handleScroll)}};var Gt=class{constructor(t,e={},s={}){this.targets=xt(t,s),this.props=e,this.stiffness=s.stiffness||170,this.damping=s.damping||26,this.mass=s.mass||1,this.precision=s.precision||.01,this.maxDuration=s.maxDuration||8,this.ease=s.ease?V(s.ease):null,this.onUpdate=s.onUpdate||null,this.onComplete=s.onComplete||null,this.paused=!0===s.paused,this.frameId=null,this.startTime=null,this.states=this.createStates(),this.paused||this.play()}createStates(){return this.targets.map(t=>({target:t,properties:Object.entries(this.props).map(([e,s])=>({path:e,value:Number(Mt(t,e))||0,velocity:0,target:Number(s)||0}))}))}play(){return this.frameId||(this.paused=!1,this.startTime=this.startTime||performance.now(),this.frameId=requestAnimationFrame(this.tick)),this}pause(){return this.paused=!0,this.frameId&&(cancelAnimationFrame(this.frameId),this.frameId=null),this}seek(t){const e=this.ease?this.ease(h(t,0,1)):h(t,0,1);return this.states.forEach(t=>{t.properties.forEach(s=>{const i=s.value+(s.target-s.value)*e;Ct(t.target,s.path,i)})}),this}tick=t=>{if(this.paused)return;const e=(t-this.startTime)/1e3,s=1/60;let i=!0;if(this.states.forEach(t=>{t.properties.forEach(e=>{const r=e.value-e.target,n=(-this.stiffness*r+-this.damping*e.velocity)/this.mass;e.velocity+=n*s,e.value+=e.velocity*s,(Math.abs(e.velocity)>this.precision||Math.abs(e.target-e.value)>this.precision)&&(i=!1),Ct(t.target,e.path,e.value)})}),this.onUpdate?.(this),i||e>=this.maxDuration)return this.states.forEach(t=>{t.properties.forEach(e=>{Ct(t.target,e.path,e.target)})}),this.pause(),void this.onComplete?.(this);this.frameId=requestAnimationFrame(this.tick)};kill(){this.pause(),this.states=[]}};const Zt=(t,e)=>{if(t&&"function"==typeof t.getTotalLength){const s=t.getTotalLength();return t.getPointAtLength(s*h(e,0,1))}return((t,e)=>{if(!t.length)return{x:0,y:0};if(1===t.length)return t[0];const s=h(e,0,1)*(t.length-1),i=Math.floor(s),r=Math.min(i+1,t.length-1),n=s-i,o=t[i],a=t[r];return{x:o.x+(a.x-o.x)*n,y:o.y+(a.y-o.y)*n}})(t||[],e)};var Qt=(t,e={})=>{const s=xt(t,e),i={progress:e.from||0},r=e.path||e.points||[],n=!0===e.rotate||!0===e.autoRotate,o=e.x||"x",a=e.y||"y";let h=null;return new Bt(i,{progress:void 0===e.to?1:e.to},{duration:e.duration||1,ease:e.ease||"linear",delay:e.delay||0,repeat:e.repeat||0,yoyo:e.yoyo,paused:!0===e.paused,render:t=>{const l=Zt(r,i.progress);s.forEach(t=>{if(Ct(t,o,`${l.x}px`),Ct(t,a,`${l.y}px`),n&&h){const s=Math.atan2(l.y-h.y,l.x-h.x);Ct(t,e.rotatePath||"rotate",`${s}rad`)}}),h=l,e.onUpdate?.(t,l)},onComplete:e.onComplete})};var Kt=class{constructor(t=[],e={}){this.scenes=t,this.currentIndex=0,this.timeline=new $t({autoplay:!1!==e.autoplay,paused:!0===e.paused,repeat:e.repeat||0,yoyo:e.yoyo,onComplete:e.onComplete}),this.build(e)}build(t={}){this.scenes.forEach((e,s)=>{const i=e.at??e.position??(0===s?0:">");if((e.label||e.id)&&this.timeline.addLabel(e.label||e.id,i),e.enter){(Array.isArray(e.enter)?e.enter:[e.enter]).forEach(s=>{this.timeline.to(s.target||e.target||t.target,s.to||s.props||{},s.duration||e.duration||1,s.ease||e.ease||"ease-out",s.position||i)})}e.call&&this.timeline.call(()=>{this.currentIndex=s,e.call(this,e)},i)})}play(){return this.timeline.play(),this}pause(){return this.timeline.pause(),this}restart(){return this.currentIndex=0,this.timeline.restart(),this}seek(t){return this.timeline.seek(t),this}progress(t){return this.timeline.progress(t)}kill(){this.timeline.kill()}};var Jt=class{constructor(t,e={}){this.element="string"==typeof t?document.querySelector(t):t,this.url=e.src||this.element.dataset.animVideoUrl||this.element.getAttribute("src"),this.autoplay=!0===e.autoplay||"load"===e.autoplay,this.muted=!1!==e.muted,this.loop=!0===e.loop,this.controls=!0===e.controls,this.objectFit=e.objectFit||"cover",this.frameRate=e.frameRate||30,this.sections=e.sections||{},this.defaultSegment=e.segment||e.frames||null,this.video=e.video||null,this.segmentTimer=null,this.video?this.configureVideo():this.createVideo(),this.defaultSegment&&this.seekSegment(this.defaultSegment)}createVideo(){this.video=document.createElement("video"),this.video.src=this.url,this.configureVideo(),this.element.style.position="relative",this.element.style.overflow="hidden",this.element.prepend(this.video)}configureVideo(){this.url&&!this.video.src&&(this.video.src=this.url),this.video.muted=this.muted,this.video.loop=this.loop,this.video.controls=this.controls,this.video.playsInline=!0,this.video.preload="auto",this.video.style.position="absolute",this.video.style.top="0",this.video.style.left="0",this.video.style.width="100%",this.video.style.height="100%",this.video.style.objectFit=this.objectFit,this.video.style.zIndex="-1",this.autoplay&&this.play()}scrubToProgress(t){if(!this.video||!this.video.duration)return;const e=this.normalizeSegment(this.activeSegment||this.defaultSegment);this.video.currentTime=e?e.start+t*(e.end-e.start):t*this.video.duration}normalizeSegment(t){if(!t)return null;if("string"==typeof t&&this.sections[t])return this.normalizeSegment(this.sections[t]);if("string"==typeof t){const e=t.split(",").map(t=>Number(t.trim()));return e.length>=2&&e.every(Number.isFinite)?{start:e[0],end:e[1]}:null}return Array.isArray(t)&&t.length>=2?{start:Number(t[0]),end:Number(t[1])}:t.frames?this.normalizeFrames(t.frames[0],t.frames[1],t.frameRate||this.frameRate):void 0!==t.startFrame||void 0!==t.endFrame?this.normalizeFrames(t.startFrame||0,t.endFrame||0,t.frameRate||this.frameRate):void 0!==t.start||void 0!==t.end?{start:Number(t.start)||0,end:Number(t.end)||0}:null}normalizeFrames(t,e,s=this.frameRate){return{start:Number(t||0)/s,end:Number(e||0)/s}}seekSegment(t){const e=this.normalizeSegment(t);return e&&this.video?(this.activeSegment=e,this.video.currentTime=e.start,this):this}playSegment(t,e={}){const s=this.normalizeSegment(t);if(!s||!this.video)return this;this.clearSegmentTimer(),this.activeSegment=s,this.video.currentTime=s.start,this.video.play().catch(()=>{f.warn("Video playback failed")});const i=!0===e.loop,r=()=>{if(this.video){if(this.video.currentTime>=s.end){if(!i)return this.video.pause(),void e.onComplete?.(this);this.video.currentTime=s.start,this.video.play()}this.segmentTimer=requestAnimationFrame(r)}};return this.segmentTimer=requestAnimationFrame(r),this}playFrames(t,e,s={}){return this.playSegment(this.normalizeFrames(t,e,s.frameRate||this.frameRate),s)}clearSegmentTimer(){this.segmentTimer&&(cancelAnimationFrame(this.segmentTimer),this.segmentTimer=null)}play(){return this.video?.play()?.catch?.(()=>{f.warn("Video autoplay/play failed")}),this}pause(){return this.video?.pause(),this}destroy(){this.clearSegmentTimer(),this.video?.remove()}};var te=class{constructor(t,e={}){const s="string"==typeof t||"undefined"!=typeof Element&&t instanceof Element?{...e,target:t}:{...t,...e};this.target="string"==typeof s.target?document.querySelector(s.target):s.target,this.ownsAudio=!("undefined"!=typeof HTMLAudioElement&&this.target instanceof HTMLAudioElement||s.audio),this.audio=s.audio||this.resolveAudio(s),this.frameRate=s.frameRate||60,this.defaultSegment=s.segment||null,this.segmentTimer=null,this.audio.loop=!0===s.loop,this.audio.muted=!0===s.muted,this.audio.volume=void 0===s.volume?this.audio.volume:Number(s.volume),this.audio.preload=s.preload||"auto",!0!==s.autoplay&&"load"!==s.autoplay||this.play()}resolveAudio(t){if("undefined"!=typeof HTMLAudioElement&&this.target instanceof HTMLAudioElement)return t.src&&!this.target.src&&(this.target.src=t.src),this.target;const e=document.createElement("audio");return e.src=t.src||this.target?.getAttribute?.("src")||"",this.target&&this.target.appendChild(e),e}normalizeSegment(t=this.defaultSegment){if(!t)return null;if("string"==typeof t){const e=t.split(",").map(t=>Number(t.trim()));return e.length>=2&&e.every(Number.isFinite)?{start:e[0],end:e[1]}:null}return Array.isArray(t)&&t.length>=2?{start:Number(t[0])||0,end:Number(t[1])||0}:void 0!==t.start||void 0!==t.end?{start:Number(t.start)||0,end:Number(t.end)||0}:null}play(){return this.audio?.play?.()?.catch?.(()=>f.warn("Audio playback failed")),this}pause(){return this.audio?.pause?.(),this}stop(){return this.pause(),this.seek(0),this}seek(t){return this.audio&&(this.audio.currentTime=Math.max(0,Number(t)||0)),this}setVolume(t){return this.audio&&(this.audio.volume=Math.max(0,Math.min(1,Number(t)))),this}scrubToProgress(t){if(!this.audio)return this;const e=this.normalizeSegment(),s=Math.max(0,Math.min(1,Number(t)||0));return e?this.audio.currentTime=e.start+s*(e.end-e.start):this.audio.duration&&(this.audio.currentTime=s*this.audio.duration),this}playSegment(t=this.defaultSegment,e={}){const s=this.normalizeSegment(t);if(!s||!this.audio)return this;this.clearSegmentTimer(),this.audio.currentTime=s.start,this.play();const i=()=>{if(this.audio){if(this.audio.currentTime>=s.end){if(!e.loop)return this.pause(),void e.onComplete?.(this);this.audio.currentTime=s.start}this.segmentTimer=requestAnimationFrame(i)}};return this.segmentTimer=requestAnimationFrame(i),this}clearSegmentTimer(){this.segmentTimer&&(cancelAnimationFrame(this.segmentTimer),this.segmentTimer=null)}destroy(){this.clearSegmentTimer(),this.pause(),this.ownsAudio&&this.audio?.remove?.()}};class ee{constructor(t){this.instance=t}play(){return this.instance?.play?.(),this}pause(){return this.instance?.pause?.(),this}stop(){return this.instance?.stop?.(),this}destroy(){this.instance?.destroy?.()}setSpeed(t){return this.instance?.setSpeed?.(t),this}setDirection(t){return this.instance?.setDirection?.(t),this}playSegments(t,e=!0){return this.instance?.playSegments?.(t,e),this}goToAndPlay(t,e=!0){return this.instance?.goToAndPlay?.(t,e),this}goToAndStop(t,e=!0){return this.instance?.goToAndStop?.(t,e),this}setFrame(t){return this.goToAndStop(t,!0),this}setProgress(t){const e=this.instance?.totalFrames||0;return this.setFrame(e*t),this}tweenToFrame(t,e={}){const s={frame:this.instance?.currentFrame||0};return new Bt(s,{frame:t},{duration:e.duration||1,ease:e.ease||"ease-in-out",paused:!1,onUpdate:()=>{this.goToAndStop(s.frame,!0),e.onUpdate?.(s.frame,this.instance)},onComplete:()=>{e.onComplete?.(this.instance)}})}tweenToProgress(t,e={}){const s=this.instance?.totalFrames||0;return this.tweenToFrame(s*t,e)}on(t,e){return this.instance?.addEventListener?.(t,e),()=>this.instance?.removeEventListener?.(t,e)}}var se=class{static resolveLibrary(t){if(t)return t;const e=ot();if(e?.lottie)return e.lottie;throw new Error("Lottie is not loaded")}static isLoaded(){const t=ot();return void 0!==t?.lottie}static get lottie(){return this.resolveLibrary()}static load(t={},e){return this.resolveLibrary(e).loadAnimation(t)}static createController(t,e={},s){if(t&&"function"==typeof t.play)return new ee(t);const i=ht(t)?{...e,container:t}:{...t},r=this.load(i,s);return new ee(r)}};class ie{constructor(t){this.instance=t}play(){return this.instance?.play?.(),this}pause(){return this.instance?.pause?.(),this}stop(){return this.instance?.stop?.(),this}destroy(){this.instance?.destroy?.()}setLoop(t){return"function"==typeof this.instance?.setLoop?this.instance.setLoop(t):this.instance.loop=t,this}setMode(t){return this.instance?.setMode?.(t),this}setSpeed(t){return this.instance?.setSpeed?.(t),this}setSegment(t,e){return this.instance?.setSegment?.(t,e),this}setFrame(t){return"function"==typeof this.instance?.setFrame&&this.instance.setFrame(t),this}setProgress(t){return"function"==typeof this.instance?.setProgress?(this.instance.setProgress(t),this):("number"==typeof this.instance?.totalFrames&&this.setFrame(this.instance.totalFrames*t),this)}tweenToFrame(t,e={}){const s={frame:this.instance?.currentFrame||0};return new Bt(s,{frame:t},{duration:e.duration||1,ease:e.ease||"ease-in-out",paused:!1,onUpdate:()=>{this.setFrame(s.frame),e.onUpdate?.(s.frame,this.instance)},onComplete:()=>{e.onComplete?.(this.instance)}})}on(t,e){return this.instance?.addEventListener?.(t,e),()=>this.instance?.removeEventListener?.(t,e)}}var re=class{static resolveConstructor(t){if(t)return t;const e=ot();if(e?.DotLottie)return e.DotLottie;throw new Error("dotLottie is not loaded")}static isLoaded(){const t=ot();return void 0!==t?.DotLottie}static createController(t,e={},s){if(t&&"function"==typeof t.play)return new ie(t);const i=new(this.resolveConstructor(s))(ht(t)?{...e,canvas:t}:{...t});return new ie(i)}};const ne=new Uint8Array([255,255,255,255]),oe=t=>Array.isArray(t)?t:t&&"object"==typeof t&&"value"in t?oe(t.value):t;class ae{constructor(t,e={}){const s=(i=t,"undefined"!=typeof Element&&i instanceof Element||"string"==typeof t?{...e,target:t}:{...t,...e});var i,r;this.options={background:!0,fit:"cover",autoplay:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),uniforms:{},...s},this.target="string"==typeof(r=this.options.target||this.options.element||this.options.container)?document.querySelector(r):r,this.canvas=this.options.canvas||document.createElement("canvas"),this.gl=null,this.program=null,this.uniformLocations=new Map,this.uniforms={u_time:0,u_progress:0,u_mouse:[0,0],u_resolution:[1,1],u_hasTexture:0,...this.options.uniforms},this.textures=new Map,this.frameId=null,this.startedAt=null,this.paused=!0,this.boundResize=()=>this.resize(),this.boundPointerMove=t=>this.handlePointerMove(t),this.mount(),this.initGL(),this.createMediaTexture(),this.resize(),this.addEventListeners(),!1!==this.options.autoplay?this.play():this.render(0)}mount(){if(!this.target&&!this.options.canvas)throw new Error("WebGL shader requires a target element or canvas");!this.canvas.parentNode&&this.target&&("static"===getComputedStyle(this.target).position&&(this.target.style.position="relative"),!1!==this.options.background?(this.canvas.style.position="absolute",this.canvas.style.inset="0",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.pointerEvents="none",this.canvas.style.zIndex=String(this.options.zIndex??-1),this.target.prepend(this.canvas)):this.target.appendChild(this.canvas)),this.canvas.classList.add("am-shader-canvas")}initGL(){if(this.gl=he.createContext(this.canvas,this.options),!this.gl)throw new Error("WebGL is not supported in this browser");const t=this.createShader(this.gl.VERTEX_SHADER,this.options.vertex||"\nattribute vec2 a_position;\nattribute vec2 a_uv;\nvarying vec2 v_uv;\n\nvoid main() {\n v_uv = a_uv;\n gl_Position = vec4(a_position, 0.0, 1.0);\n}\n"),e=this.createShader(this.gl.FRAGMENT_SHADER,this.options.fragment||"\nprecision mediump float;\n\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform vec2 u_mouse;\nuniform float u_progress;\nuniform sampler2D u_texture;\nuniform float u_hasTexture;\nvarying vec2 v_uv;\n\nvoid main() {\n vec2 uv = v_uv;\n vec3 base = 0.5 + 0.5 * cos(u_time + uv.xyx * 5.0 + vec3(0.0, 2.0, 4.0));\n vec4 textureColor = texture2D(u_texture, uv);\n vec3 color = mix(base, textureColor.rgb, u_hasTexture);\n color += vec3(u_mouse.x / max(u_resolution.x, 1.0), u_mouse.y / max(u_resolution.y, 1.0), u_progress) * 0.18;\n gl_FragColor = vec4(color, 1.0);\n}\n");this.program=this.createProgram(t,e),this.gl.useProgram(this.program),this.createQuad(),this.cacheUniformLocations()}createShader(t,e){const s=this.gl.createShader(t);if(this.gl.shaderSource(s,e),this.gl.compileShader(s),!this.gl.getShaderParameter(s,this.gl.COMPILE_STATUS)){const t=this.gl.getShaderInfoLog(s);throw this.gl.deleteShader(s),new Error(`Shader compile failed: ${t}`)}return s}createProgram(t,e){const s=this.gl.createProgram();if(this.gl.attachShader(s,t),this.gl.attachShader(s,e),this.gl.linkProgram(s),!this.gl.getProgramParameter(s,this.gl.LINK_STATUS))throw new Error(`Shader link failed: ${this.gl.getProgramInfoLog(s)}`);return s}createQuad(){const t=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,-1,1,0,1,1,-1,1,0,1,1,1,1]),e=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW);const s=this.gl.getAttribLocation(this.program,"a_position"),i=this.gl.getAttribLocation(this.program,"a_uv");this.gl.enableVertexAttribArray(s),this.gl.vertexAttribPointer(s,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(i),this.gl.vertexAttribPointer(i,2,this.gl.FLOAT,!1,16,8)}cacheUniformLocations(){Object.keys(this.uniforms).forEach(t=>{this.uniformLocations.set(t,this.gl.getUniformLocation(this.program,t))}),this.uniformLocations.set("u_texture",this.gl.getUniformLocation(this.program,"u_texture"))}createMediaTexture(){const t=this.createMediaSource(this.options.texture||this.options.image||this.options.video)||this.resolveTargetMedia(),e=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,1,1,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,ne),this.textures.set("u_texture",{texture:e,source:t}),t&&(this.uniforms.u_hasTexture=1,t instanceof HTMLImageElement&&!t.complete?t.addEventListener("load",()=>this.updateTexture("u_texture"),{once:!0}):t instanceof HTMLVideoElement&&t.readyState<2?t.addEventListener("loadeddata",()=>this.updateTexture("u_texture"),{once:!0}):this.updateTexture("u_texture"))}createMediaSource(t){if(!t||"string"!=typeof t)return t||null;if(/\.(mp4|webm|ogg|mov)(\?|#|$)/i.test(t)){const e=document.createElement("video");return e.src=t,e.muted=!0,e.loop=!0,e.playsInline=!0,e.crossOrigin=this.options.crossOrigin||"anonymous",e.play?.().catch?.(()=>{}),e}const e=new Image;return e.crossOrigin=this.options.crossOrigin||"anonymous",e.src=t,e}resolveTargetMedia(){return this.target instanceof HTMLImageElement||this.target instanceof HTMLVideoElement||this.target instanceof HTMLCanvasElement?this.target:this.target?.querySelector?.("img, video, canvas")||null}updateTexture(t){const e=this.textures.get(t);if(e?.source)try{this.gl.bindTexture(this.gl.TEXTURE_2D,e.texture),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!0),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e.source)}catch(t){this.uniforms.u_hasTexture=0}}addEventListeners(){window.addEventListener("resize",this.boundResize),(this.target||this.canvas).addEventListener("pointermove",this.boundPointerMove)}handlePointerMove(t){const e=this.canvas.getBoundingClientRect();this.setUniform("u_mouse",[t.clientX-e.left,e.height-(t.clientY-e.top)])}resize(){const t=(this.target||this.canvas).getBoundingClientRect(),e=Math.max(1,Math.round(t.width*this.options.pixelRatio)),s=Math.max(1,Math.round(t.height*this.options.pixelRatio));return this.canvas.width===e&&this.canvas.height===s||(this.canvas.width=e,this.canvas.height=s),this.gl?.viewport(0,0,e,s),this.setUniform("u_resolution",[e,s]),this}setUniform(t,e){return this.uniforms[t]=e,!this.uniformLocations.has(t)&&this.gl&&this.program&&this.uniformLocations.set(t,this.gl.getUniformLocation(this.program,t)),this}tweenUniforms(t,e={}){return new Bt(this.uniforms,t,{duration:e.duration||1,ease:e.ease||"ease-out",paused:!0===e.paused,onUpdate:()=>this.render(),onComplete:e.onComplete})}scrubToProgress(t){return this.setUniform("u_progress",t),this.render(),this}play(){return this.paused?(this.paused=!1,this.startedAt=performance.now()-1e3*(this.uniforms.u_time||0),this.tick(),this):this}pause(){return this.paused=!0,this.frameId&&(cancelAnimationFrame(this.frameId),this.frameId=null),this}tick=(t=performance.now())=>{this.paused||(this.uniforms.u_time=(t-this.startedAt)/1e3,this.render(),this.frameId=requestAnimationFrame(this.tick))};render(){return this.resize(),this.updateTexture("u_texture"),this.gl.useProgram(this.program),this.applyUniforms(),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.options.onRender?.(this),this}applyUniforms(){let t=0;Object.entries(this.uniforms).forEach(([t,e])=>{const s=this.uniformLocations.get(t);if(!s)return;const i=oe(e);Array.isArray(i)?2===i.length?this.gl.uniform2f(s,Number(i[0])||0,Number(i[1])||0):3===i.length?this.gl.uniform3f(s,Number(i[0])||0,Number(i[1])||0,Number(i[2])||0):4===i.length&&this.gl.uniform4f(s,Number(i[0])||0,Number(i[1])||0,Number(i[2])||0,Number(i[3])||0):Number.isInteger(i)?this.gl.uniform1i(s,i):this.gl.uniform1f(s,Number(i)||0)}),this.textures.forEach((e,s)=>{const i=this.uniformLocations.get(s);i&&(this.gl.activeTexture(this.gl.TEXTURE0+t),this.gl.bindTexture(this.gl.TEXTURE_2D,e.texture),this.gl.uniform1i(i,t),t+=1)})}destroy(){this.pause(),window.removeEventListener("resize",this.boundResize),(this.target||this.canvas)?.removeEventListener?.("pointermove",this.boundPointerMove),this.options.canvas||this.canvas.remove()}}class he{static isSupported(){try{const t=document.createElement("canvas");return!!t.getContext("webgl")||!!t.getContext("webgl2")}catch{return!1}}static createContext(t,e={}){return t.getContext("webgl2",e.contextAttributes)||t.getContext("webgl",e.contextAttributes)||t.getContext("experimental-webgl",e.contextAttributes)}static createShader(t,e={}){return new ae(t,e)}static shader(t,e={}){return this.createShader(t,e)}}var le=he;var ue=(t,e=[],s={})=>{const i=new $t({autoplay:!1!==s.autoplay,paused:!0===s.paused,repeat:s.repeat||0,yoyo:s.yoyo,scope:s.scope||null,onComplete:s.onComplete});return e.forEach((e,r)=>{const n=e.at??e.position??(0===r?0:">"),o=e.duration??s.duration??1,a=e.ease||s.ease||"ease-out",h=e.props||e.to||e,l=e.from||null;e.label&&i.addLabel(e.label,n),e.call?i.call(e.call,n):l?i.fromTo(e.target||t,l,h,o,a,n):e.fromOnly?i.from(e.target||t,h,o,a,n):i.to(e.target||t,h,o,a,n)}),i};const ce=t=>{if(!t||!String(t).trim())return{};const e=String(t).trim().replace(/;$/,"");try{return JSON.parse(e)}catch(s){try{let t=e;"{"!==t[0]&&t.includes(":")&&(t="{"+t+"}");try{return new Function("return ("+t+")")()}catch(e){const s=t.replace(/:(\s*)(-?\d+(?:\.\d+)?(?:px|deg|%|em|rem|vh|vw|s|ms))/gi,':$1"$2"');return new Function("return ("+s+")")()}}catch(e){return f.warn(`Invalid JSON/Object: ${t}`),{}}}},pe=(t,e=0)=>{const s=Number(t);return isNaN(s)?e:s},de=(t,e=!1)=>{if(null==t||""===t)return e;if("boolean"==typeof t)return t;const s=String(t).toLowerCase();return!!["true","1","yes","on"].includes(s)||!["false","0","no","off"].includes(s)&&e},me=t=>{const e={};return t.split(";").forEach(t=>{const[s,i]=t.split(":");s&&i&&(e[s.trim()]=i.trim())}),e},ge={root:"data-anim",scroll:"data-anim-scroll-trigger",split:"data-anim-split-text"},fe={enter:"mouseenter",leave:"mouseleave",press:"pointerdown",release:"pointerup",tap:"click"};var ve=class{constructor(t={}){this.options={debug:!1,autoInit:!0,attributePrefix:"am",root:null,observeMutations:!1,legacyAttributes:!0,...t},this.root=null,this.timelines=new Map,this.tweens=new Map,this.splitTexts=new Map,this.scrollTriggers=new Map,this.draggables=new Map,this.parallaxEffects=new Map,this.springAnimations=new Map,this.motionPathAnimations=new Map,this.keyframeTimelines=new Map,this.sceneSequences=new Map,this.lottieControllers=new Map,this.dotLottieControllers=new Map,this.videoAnimations=new Map,this.audioAnimations=new Map,this.shaderControllers=new Map,this.observers=new Map,this.cleanups=[],this.initialized=!1,this.mutationObserver=null,this.options.debug&&f.setLevel("debug"),f.info("AnimationCore initialized")}init(){nt()?this.initialized?f.warn("AnimationCore already initialized"):(this.root=this.resolveRoot(),this.initialized=!0,f.info("Initializing AnimationCore..."),this.initSplitTexts(),this.initTimelines(),this.initControls(),this.initDeclarativeAnimations(),this.initEventAnimations(),this.initScrollAnimations(),this.initMouseAnimations(),this.initParallaxEffects(),this.initDraggables(),this.initSpringAnimations(),this.initKeyframeAnimations(),this.initMotionPathAnimations(),this.initSceneSequences(),this.initThreeStateControls(),this.initShaderAnimations(),this.initVideoAnimations(),this.initAudioAnimations(),this.initLottieAnimations(),this.initDotLottieAnimations(),this.observeMutations(),this.exposeGlobalState(),this.refreshScrollTriggers()):f.warn("AnimationCore.init() requires a browser environment")}destroy(){this.killAll(),this.cleanups.splice(0).forEach(t=>t()),this.mutationObserver?.disconnect(),this.mutationObserver=null,this.initialized=!1}resolveRoot(){if(ht(this.options.root))return this.options.root;if("string"==typeof this.options.root){const t=at();return t?.querySelector(this.options.root)||t}return at()}exposeGlobalState(){const t=ot();if(!t)return;const e=t.__ANIMOTION__||{};t.__ANIMOTION__={...e,core:this,timelines:this.timelines,tweens:this.tweens,splitTexts:this.splitTexts,scrollTriggers:this.scrollTriggers,draggables:this.draggables,parallaxEffects:this.parallaxEffects,springAnimations:this.springAnimations,motionPathAnimations:this.motionPathAnimations,keyframeTimelines:this.keyframeTimelines,sceneSequences:this.sceneSequences,lottieControllers:this.lottieControllers,dotLottieControllers:this.dotLottieControllers,videoAnimations:this.videoAnimations,audioAnimations:this.audioAnimations,shaderControllers:this.shaderControllers,threeStateMachines:e.threeStateMachines||new Map,version:"1.1.0"}}observeMutations(){this.options.observeMutations&&this.root&&"undefined"!=typeof MutationObserver&&(this.mutationObserver=new MutationObserver(()=>{this.refresh()}),this.mutationObserver.observe(this.root,{childList:!0,subtree:!0}))}refresh(){this.destroy(),this.init()}registerCleanup(t){"function"==typeof t&&this.cleanups.push(t)}getAttrName(t){return"root"===t?this.options.attributePrefix:t?`${this.options.attributePrefix}-${t}`:this.options.attributePrefix}getLegacyAttrNames(t){return"root"===t?[ge.root]:Array.from(new Set([ge[t],`data-anim-${t}`].filter(Boolean)))}getAttrCandidates(t){const e=[this.getAttrName(t)],s=this.options.legacyAttributes?this.getLegacyAttrNames(t):[];return s.length&&e.push(...s),Array.from(new Set(e.filter(Boolean)))}getSelectorForAttr(t){return this.getAttrCandidates(t).map(t=>`[${t}]`).join(", ")}getAttr(t,e){const s=this.getAttrCandidates(e).find(e=>t.hasAttribute(e));return s?t.getAttribute(s):null}hasAttr(t,e){return this.getAttrCandidates(e).some(e=>t.hasAttribute(e))}queryAllByAttr(t){const e=this.getSelectorForAttr(t);return e?Array.from(this.root.querySelectorAll(e)):[]}queryAll(t){return Array.from(this.root.querySelectorAll(t))}parseAttrObject(t,e,s=null){const i=this.getAttr(t,e);return null===i||""===i?s:ce(i)}parseAttrString(t,e,s=""){const i=this.getAttr(t,e);return null===i||""===i?s:i}parseAttrNumber(t,e,s=0){const i=this.getAttr(t,e);return null===i||""===i?s:pe(i,s)}parseAttrBoolean(t,e,s=!1){const i=this.getAttr(t,e);return null===i||""===i?s:de(i,s)}getAnimationMode(t){return this.hasAttr(t,"set")?"set":this.hasAttr(t,"from")&&(this.hasAttr(t,"to")||this.hasAttr(t,"props"))?"fromTo":this.hasAttr(t,"from")&&!this.hasAttr(t,"to")?"from":"to"}resolveAnimationTarget(t){const e=this.parseAttrString(t,"target"),s=this.parseAttrString(t,"split-target",""),i=this.splitTexts.get(t);return i?i.getSpans(s||"all"):e?Array.from(this.root.querySelectorAll(e)):t}buildTweenOptions(t,e={}){const s=this.parseAttrObject(t,"options",{}),i=this.parseAttrString(t,"place","")||this.parseAttrString(t,"stick","");return{duration:this.parseAttrNumber(t,"duration",e.duration??1),ease:this.parseAttrString(t,"ease",e.ease||"ease-out"),delay:this.parseAttrNumber(t,"delay",e.delay??0),repeat:this.parseAttrNumber(t,"repeat",e.repeat??0),yoyo:this.parseAttrBoolean(t,"yoyo",e.yoyo??!0),stagger:this.parseAttrNumber(t,"stagger",e.stagger??0),place:i||s.place||s.stick||e.place||e.stick||null,paused:e.paused??!1,scope:this.root,...s,...e}}buildTweenConfig(t){const e=this.getAnimationMode(t),s=this.parseAttrObject(t,"to")||this.parseAttrObject(t,"props")||this.parseAttrObject(t,"set")||this.parseAttrObject(t,"from")||{};return{target:this.resolveAnimationTarget(t),mode:e,fromProps:this.parseAttrObject(t,"from",{}),toProps:s,options:this.buildTweenOptions(t)}}createTweenFromElement(t,e={}){const s=this.buildTweenConfig(t),i=e.target||s.target,r={...s.options,...e.options};let n=null;return n="set"===s.mode?new Bt(i,s.toProps,{...r,duration:0}):"fromTo"===s.mode?new Bt(i,s.toProps,{...r,fromTo:s.fromProps}):"from"===s.mode?new Bt(i,s.fromProps,{...r,from:!0}):new Bt(i,s.toProps,r),this.hasAttr(t,"id")?this.tweens.set(this.parseAttrString(t,"id"),n):this.tweens.set(`${Date.now()}-${this.tweens.size}`,n),n}shouldHandleAsImmediate(t){if(t.closest(this.getSelectorForAttr("timeline")))return!1;const e=t.closest(this.getSelectorForAttr("scroll"));return(!e||e===t)&&(!this.hasAttr(t,"on")&&(!this.hasAttr(t,"scroll")&&(!(this.hasAttr(t,"pin")||this.hasAttr(t,"scrub")||this.hasAttr(t,"in")||this.hasAttr(t,"out"))&&(!this.hasAttr(t,"parallax")&&(!this.hasAttr(t,"mouse")&&(!this.hasAttr(t,"draggable")&&(!this.hasAttr(t,"spring")&&(!this.hasAttr(t,"keyframes")&&(!this.hasAttr(t,"motion-path")&&(!this.hasAttr(t,"path")&&(!this.hasAttr(t,"sequence")&&(!this.hasAttr(t,"three-state")&&(!this.hasAttr(t,"lottie")&&!this.hasAttr(t,"dotlottie")&&(!this.hasAttr(t,"video")&&(!this.hasAttr(t,"audio")&&!this.hasAttr(t,"sound")&&(!this.hasAttr(t,"shader")&&!this.hasAttr(t,"webgl")&&(this.hasAttr(t,"root")||this.hasAttr(t,"to")||this.hasAttr(t,"from")||this.hasAttr(t,"set"))))))))))))))))))}getChildAnimationElements(t){const e=[this.getSelectorForAttr("root"),this.getSelectorForAttr("to"),this.getSelectorForAttr("from"),this.getSelectorForAttr("set")].filter(Boolean).join(", ");return Array.from(t.querySelectorAll(e)).filter(e=>e!==t&&e.closest(this.getSelectorForAttr("scroll"))===t)}createTimelineFromChildren(t,e={}){const s=this.getChildAnimationElements(t);if(!s.length)return null;const i=new $t({id:e.id||this.parseAttrString(t,"id",`scroll-timeline-${this.timelines.size+1}`),autoplay:!1,paused:!0,scope:this.root});return s.forEach(t=>{const e=this.parseAttrString(t,"label");e&&i.addLabel(e,this.parseAttrString(t,"position",">"));const s=this.buildTweenConfig(t),r=this.parseAttrString(t,"position",">");"set"===s.mode?i.set(s.target,s.toProps,r):"fromTo"===s.mode?i.fromTo(s.target,s.fromProps,s.toProps,s.options.duration,s.options.ease,r):"from"===s.mode?i.from(s.target,s.fromProps,s.options.duration,s.options.ease,r):i.to(s.target,s.toProps,s.options.duration,s.options.ease,r)}),this.timelines.set(i.id,i),i}initSplitTexts(){this.queryAllByAttr("split").forEach(t=>{if(this.splitTexts.has(t))return;const e=this.parseAttrString(t,"split","chars"),s="string"==typeof e&&e.trim().startsWith("{")?ce(e):{type:e||"chars"},i=new jt(t,{...s,...this.parseAttrObject(t,"split-options",{})});this.splitTexts.set(t,i)})}initTimelines(){this.queryAllByAttr("timeline").forEach(t=>{const e=this.parseAttrString(t,"timeline",`timeline-${this.timelines.size+1}`),s=new $t({id:e,autoplay:this.parseAttrBoolean(t,"timeline-auto",!0),...this.parseAttrObject(t,"timeline-options",{}),scope:this.root});this.timelines.set(e,s);const i=[this.getSelectorForAttr("root"),this.getSelectorForAttr("to"),this.getSelectorForAttr("from"),this.getSelectorForAttr("set")].filter(Boolean).join(", ");Array.from(t.querySelectorAll(i)).forEach(e=>{if(e.closest(this.getSelectorForAttr("timeline"))!==t)return;const i=this.parseAttrString(e,"label");i&&s.addLabel(i,this.parseAttrString(e,"position",">"));const r=this.buildTweenConfig(e),n=this.parseAttrString(e,"position",">");"set"===r.mode?s.set(r.target,r.toProps,n):"fromTo"===r.mode?s.fromTo(r.target,r.fromProps,r.toProps,r.options.duration,r.options.ease,n):"from"===r.mode?s.from(r.target,r.fromProps,r.options.duration,r.options.ease,n):s.to(r.target,r.toProps,r.options.duration,r.options.ease,n)})})}initControls(){this.queryAll(`${this.getSelectorForAttr("control")}, ${this.getSelectorForAttr("action")}`).forEach(t=>{const e=this.parseAttrString(t,"control"),s=e.includes("|")?e:null;if(s){const[e,i="click",r,n="play"]=s.split("|").map(t=>t.trim());return void this.bindTimelineControl(e?Array.from(this.root.querySelectorAll(e)):[t],i,r,n)}const i=this.parseAttrString(t,"control")||this.parseAttrString(t,"timeline-target"),r=this.parseAttrString(t,"action","play"),n=fe[this.parseAttrString(t,"on","click")]||this.parseAttrString(t,"on","click");i&&this.bindTimelineControl([t],n,i,r)})}bindTimelineControl(t,e,s,i){t.forEach(t=>{const r=e=>{this.parseAttrBoolean(t,"prevent-default",!0)&&e.preventDefault?.(),this.runTimelineCommand(s,i)};t.addEventListener(e,r),this.registerCleanup(()=>t.removeEventListener(e,r))})}runTimelineCommand(t,e){const s=this.timelines.get(t);s?"play"===e?s.play():"pause"===e?s.pause():"reverse"===e?s.reverse():"restart"===e?s.restart():e.startsWith("seek:")?s.seek(parseFloat(e.split(":")[1])):e.startsWith("progress:")&&s.progress(parseFloat(e.split(":")[1])):f.warn(`Timeline not found: ${t}`)}initDeclarativeAnimations(){const t=[this.getSelectorForAttr("root"),this.getSelectorForAttr("to"),this.getSelectorForAttr("from"),this.getSelectorForAttr("set")].filter(Boolean).join(", ");this.queryAll(t).forEach(t=>{this.shouldHandleAsImmediate(t)&&this.createTweenFromElement(t)})}initEventAnimations(){this.queryAllByAttr("on").forEach(t=>{const e=this.parseAttrString(t,"on").split(",").map(t=>t.trim()).filter(Boolean),s=this.parseAttrBoolean(t,"once",!1),i=this.parseAttrBoolean(t,"prevent-default",!0);e.forEach(e=>{const r=fe[e]||e;if("load"===r||"init"===r)return void this.createTweenFromElement(t);if("inview"===r){const e=new Xt({trigger:t,...this.parseAttrObject(t,"scroll-options",{}),onEnter:()=>{this.createTweenFromElement(t),s&&e.kill()}});return void this.scrollTriggers.set(t,e)}const n=e=>{i&&e.preventDefault?.(),this.createTweenFromElement(t),s&&t.removeEventListener(r,n)};t.addEventListener(r,n),this.registerCleanup(()=>t.removeEventListener(r,n))})})}initScrollAnimations(){Array.from(new Set([...this.queryAllByAttr("scroll"),...this.queryAllByAttr("pin"),...this.queryAllByAttr("scrub"),...this.queryAllByAttr("in"),...this.queryAllByAttr("out")])).forEach(t=>{const e=this.parseAttrObject(t,"scroll",{}),s=this.parseAttrBoolean(t,"pin",!0===e.pin),i=this.getAttr(t,"scrub"),r=null===i?!0===e.scrub:de(i,!0===e.scrub),n=this.parseAttrBoolean(t,"reverse",!0===e.reverse),o=this.parseAttrBoolean(t,"once",!0===e.once),a=this.parseAttrObject(t,"in",null)||e.in||e.enter||null,h=this.parseAttrObject(t,"out",null)||e.out||e.leave||null,l=this.getFeatureTarget(t,e),u=s||r||!0===e.children||this.parseAttrBoolean(t,"scroll-children",!1)?this.createTimelineFromChildren(t,{id:e.timeline||this.parseAttrString(t,"timeline","")}):null;u?.seek?.(0);let c=u,p=null,d=null;if(!c&&(this.hasAttr(t,"to")||this.hasAttr(t,"from")||this.hasAttr(t,"set")||this.hasAttr(t,"root"))){c=this.createTweenFromElement(t,{options:{paused:!0,duration:this.parseAttrNumber(t,"duration",e.duration||1)}}),c.pause();const s=this.getAnimationMode(t);"set"===s?c.seek(1):"from"!==s&&"fromTo"!==s||c.seek(0)}a&&(p=new Bt(l,a,{...this.buildTweenOptions(t,{from:!0,paused:!0,duration:e.inDuration||e.enterDuration||e.duration||1})}),p.pause(),p.seek(0)),h&&(d=new Bt(l,h,{...this.buildTweenOptions(t,{paused:!0,duration:e.outDuration||e.leaveDuration||e.duration||1})}),d.pause());const m=new Xt({trigger:t,...e,pin:s,scrub:r,reverse:n,once:o,animation:c,autoPlayAnimation:r,duration:e.pinDuration||e.scrollDistance||(u?.duration?Math.max(1,u.duration)*(e.pixelsPerSecond||1e3):e.duration),onEnter:s=>{var i;("function"==typeof e.onEnter&&e.onEnter(t,s),r)||(p?p.restart():(i=c)&&(i.pause?.(),i.isReverse=!1,i.startTime=null,i.currentTime=0,i.paused=!1,i.play?.()),o&&s.kill())},onLeave:s=>{"function"==typeof e.onLeave&&e.onLeave(t,s),d?d.restart():c&&(c.seek?.(1),c.pause?.())},onEnterBack:s=>{var i;"function"==typeof e.onEnterBack&&e.onEnterBack(t,s),n&&(d?d.restart():(i=c)&&(i.pause?.(),i.seek?.(1),i.isReverse=!0,i.currentTime=0,i.startTime=null,i.paused=!1,i.play?.()))},onLeaveBack:s=>{var i;"function"==typeof e.onLeaveBack&&e.onLeaveBack(t,s),n&&(p?p.seek(0):(i=c,i?.seek?.(0),i?.pause?.()))},onUpdate:({progress:s,direction:i})=>{"function"==typeof e.onUpdate&&e.onUpdate({progress:s,direction:i,element:t}),r&&c?.seek?.(s),r&&p&&!d?p.seek(s):r&&p&&d&&(s<.5?p.seek(2*s):d.seek(2*(s-.5)))}});this.scrollTriggers.set(t,m)})}initMouseAnimations(){this.queryAllByAttr("mouse").forEach(t=>{const e=this.parseAttrObject(t,"mouse",{}),s=e.movement||30,i=e.duration||.5,r=e.axis||"both",n=this.resolveAnimationTarget(t),o=t=>{const{innerWidth:o,innerHeight:a}=ot(),h=100*(t.clientX/o-.5),l=100*(t.clientY/a-.5),u={};"both"!==r&&"x"!==r||(u.x=h*s/100+"px"),"both"!==r&&"y"!==r||(u.y=l*s/100+"px"),new Bt(n,u,{duration:i,ease:e.ease||"ease-out",paused:!1,scope:this.root})};at().addEventListener("mousemove",o),this.registerCleanup(()=>at().removeEventListener("mousemove",o))})}initParallaxEffects(){this.queryAllByAttr("parallax").forEach(t=>{const e=this.parseAttrString(t,"parallax","0.5"),s=e.trim().startsWith("{")?ce(e):{speed:pe(e,.5)},i=new Vt(t,{...s,...this.parseAttrObject(t,"parallax-options",{})});this.parallaxEffects.set(t,i)})}initDraggables(){this.queryAllByAttr("draggable").forEach(t=>{const e=this.parseAttrObject(t,"draggable",{}),s=new Ht(t,e);this.draggables.set(t,s)})}getFeatureTarget(t,e={}){return e.target?"string"==typeof e.target?Array.from(this.root.querySelectorAll(e.target)):e.target:this.resolveAnimationTarget(t)}bindFeatureRun(t,e,s,i={}){const r=this.parseAttrString(t,`${e}-on`,i.eventName||"load"),n=this.parseAttrBoolean(t,`${e}-once`,i.once||!1);if("load"===r||"init"===r)return s();if("inview"===r){let r=null;const o=new Xt({trigger:t,...this.parseAttrObject(t,`${e}-scroll-options`,{}),onEnter:()=>{r=s(),n&&o.kill()},onUpdate:({progress:t})=>{!0===i.scrub&&r?.seek?.(t)}});return this.scrollTriggers.set(t,o),r}const o=fe[r]||r,a=()=>{s(),n&&t.removeEventListener(o,a)};return t.addEventListener(o,a),this.registerCleanup(()=>t.removeEventListener(o,a)),null}initSpringAnimations(){this.queryAllByAttr("spring").forEach(t=>{const e=this.parseAttrObject(t,"spring",{}),s=e.props||e.to||this.parseAttrObject(t,"to",{})||this.parseAttrObject(t,"props",{}),i={...this.buildTweenOptions(t,{paused:!0}),...e,...this.parseAttrObject(t,"spring-options",{})};this.bindFeatureRun(t,"spring",()=>{const r=new Gt(this.getFeatureTarget(t,e),s,{...i,paused:!1});return this.springAnimations.set(t,r),r},{eventName:e.on||this.parseAttrString(t,"on","load")})})}initKeyframeAnimations(){this.queryAllByAttr("keyframes").forEach(t=>{const e=this.parseAttrObject(t,"keyframes",[]),s=Array.isArray(e)?{frames:e}:e,i=s.frames||[],r=this.getFeatureTarget(t,s),n={...this.buildTweenOptions(t,{paused:!0}),...s,...this.parseAttrObject(t,"keyframes-options",{})};this.bindFeatureRun(t,"keyframes",()=>{const e=ue(r,i,{...n,autoplay:!1!==n.autoplay,paused:!1,scope:this.root});return this.keyframeTimelines.set(t,e),e},{eventName:s.on||this.parseAttrString(t,"on","load")})})}initMotionPathAnimations(){Array.from(new Set([...this.queryAllByAttr("motion-path"),...this.queryAllByAttr("path")])).forEach(t=>{const e=this.parseAttrObject(t,"motion-path",null)||this.parseAttrObject(t,"path",{}),s=e.pathSelector||this.parseAttrString(t,"motion-path-selector","")||this.parseAttrString(t,"path-selector",""),i=s?this.root.querySelector(s):null,r={...this.buildTweenOptions(t,{paused:!0}),...e,...this.parseAttrObject(t,"motion-path-options",{}),...this.parseAttrObject(t,"path-options",{})};i&&(r.path=i);this.bindFeatureRun(t,this.hasAttr(t,"motion-path")?"motion-path":"path",()=>{const s=Qt(this.getFeatureTarget(t,e),{...r,paused:!1,scope:this.root});return this.motionPathAnimations.set(t,s),s},{eventName:e.on||this.parseAttrString(t,"on","load"),scrub:!0===e.scrub})})}initSceneSequences(){this.queryAllByAttr("sequence").forEach(t=>{const e=this.parseAttrObject(t,"sequence",[]),s=Array.isArray(e)?{scenes:e}:e,i={...s,...this.parseAttrObject(t,"sequence-options",{}),target:s.target||t};this.bindFeatureRun(t,"sequence",()=>{const e=new Kt(s.scenes||[],{...i,autoplay:!1!==i.autoplay,paused:!1});return this.sceneSequences.set(t,e),e},{eventName:s.on||this.parseAttrString(t,"on","load")})})}initThreeStateControls(){this.queryAllByAttr("three-state").forEach(t=>{const e=this.parseAttrString(t,"three-state",""),s=e.trim().startsWith("{")?ce(e):{state:e},i=s.machine||this.parseAttrString(t,"three-machine",""),r=s.state||this.parseAttrString(t,"three-state",""),n=s.action||this.parseAttrString(t,"three-action","play"),o=s.on||this.parseAttrString(t,"three-on",this.parseAttrString(t,"on","click"));this.bindFeatureRun(t,"three",()=>{const t=ot()?.__ANIMOTION__?.threeStateMachines?.get?.(i);return t?("pause"===n?t.pause?.(r||void 0):"stop"===n?t.stop?.(r||void 0):r&&t.play?.(r,s),t):(f.warn(`Three.js state machine not found: ${i}`),null)},{eventName:o})})}initVideoAnimations(){this.queryAllByAttr("video").forEach(t=>{const e=this.parseAttrString(t,"video"),s=e&&e.trim().startsWith("{")?ce(e):{src:e},i=new Jt(t,{muted:this.parseAttrBoolean(t,"video-muted",!0),loop:this.parseAttrBoolean(t,"video-loop",!1),controls:this.parseAttrBoolean(t,"video-controls",!1),objectFit:this.parseAttrString(t,"video-fit","cover"),frameRate:this.parseAttrNumber(t,"video-frame-rate",30),segment:this.parseAttrString(t,"video-segment","")||this.parseAttrString(t,"video-frames",""),...s,...this.parseAttrObject(t,"video-options",{}),autoplay:"load"===this.parseAttrString(t,"video-autoplay","")}),r=this.parseAttrString(t,"video-on",this.parseAttrString(t,"video-autoplay","load")),n=this.parseAttrString(t,"video-action","play"),o=this.parseAttrString(t,"video-segment","")||this.parseAttrString(t,"video-section",""),a=this.parseAttrString(t,"video-frames",""),h=()=>{if("pause"===n)i.pause();else if("scrub"===n)i.seekSegment(o||a);else if(a){const[t,e]=a.split(",").map(t=>Number(t.trim()));i.playFrames(t,e)}else o?i.playSegment(o):i.play()};if("load"===r||"init"===r)h();else if("inview"===r){const e=new Xt({trigger:t,scrub:"scrub"===n,onEnter:()=>{"scrub"!==n&&h()},onLeave:()=>{this.parseAttrBoolean(t,"video-pause-on-leave",!0)&&i.pause()},onUpdate:({progress:t})=>{"scrub"===n&&i.scrubToProgress(t)}});this.scrollTriggers.set(t,e)}else{const e=fe[r]||r,s=()=>h();t.addEventListener(e,s),this.registerCleanup(()=>t.removeEventListener(e,s))}this.videoAnimations.set(t,i)})}initAudioAnimations(){Array.from(new Set([...this.queryAllByAttr("audio"),...this.queryAllByAttr("sound")])).forEach(t=>{const e=this.parseAttrString(t,"audio","")||this.parseAttrString(t,"sound",""),s=e&&e.trim().startsWith("{")?ce(e):{src:e},i=new te(t,{volume:this.parseAttrNumber(t,"audio-volume",s.volume??1),loop:this.parseAttrBoolean(t,"audio-loop",!0===s.loop),muted:this.parseAttrBoolean(t,"audio-muted",!0===s.muted),segment:this.parseAttrString(t,"audio-segment","")||s.segment,...s,...this.parseAttrObject(t,"audio-options",{}),autoplay:"load"===this.parseAttrString(t,"audio-autoplay","")}),r=this.parseAttrString(t,"audio-on",this.parseAttrString(t,"audio-autoplay","load")),n=this.parseAttrString(t,"audio-action","play"),o=this.parseAttrString(t,"audio-segment","")||s.segment,a=()=>{"pause"===n?i.pause():"stop"===n?i.stop():"scrub"===n?i.scrubToProgress(0):o?i.playSegment(o):i.play()};if("load"===r||"init"===r)a();else if("inview"===r){const e=new Xt({trigger:t,scrub:"scrub"===n,...this.parseAttrObject(t,"audio-scroll",{}),onEnter:()=>{"scrub"!==n&&a()},onLeave:()=>{this.parseAttrBoolean(t,"audio-pause-on-leave",!0)&&i.pause()},onUpdate:({progress:e})=>{"scrub"===n&&i.scrubToProgress(e);const s=this.parseAttrObject(t,"audio-volume-scroll",null);if(s){const t=Number(s.from??0),r=Number(s.to??1);i.setVolume(t+(r-t)*e)}}});this.scrollTriggers.set(t,e)}else{const e=fe[r]||r,s=()=>a();t.addEventListener(e,s),this.registerCleanup(()=>t.removeEventListener(e,s))}this.audioAnimations.set(t,i)})}initShaderAnimations(){Array.from(new Set([...this.queryAllByAttr("shader"),...this.queryAllByAttr("webgl")])).forEach(t=>{const e=this.parseAttrString(t,"shader","")||this.parseAttrString(t,"webgl",""),s=e&&e.trim().startsWith("{")?ce(e):{fragment:e},i={...this.parseAttrObject(t,"shader-uniforms",{}),...this.parseAttrObject(t,"webgl-uniforms",{})},r=le.createShader(t,{...s,fragment:this.parseAttrString(t,"shader-fragment",s.fragment||""),vertex:this.parseAttrString(t,"shader-vertex",s.vertex||""),texture:this.parseAttrString(t,"shader-texture","")||s.texture,background:this.parseAttrBoolean(t,"shader-background",!1!==s.background),uniforms:i,autoplay:!1,...this.parseAttrObject(t,"shader-options",{}),...this.parseAttrObject(t,"webgl-options",{})}),n=s.on||this.parseAttrString(t,"shader-on",this.parseAttrString(t,"webgl-on",this.parseAttrString(t,"on","load"))),o=s.action||this.parseAttrString(t,"shader-action",this.parseAttrString(t,"webgl-action","play")),a=this.parseAttrObject(t,"shader-to",null)||this.parseAttrObject(t,"webgl-to",null),h=this.parseAttrNumber(t,"shader-duration",this.parseAttrNumber(t,"duration",1)),l=this.parseAttrString(t,"shader-ease",this.parseAttrString(t,"ease","ease-out")),u=()=>{a&&r.tweenUniforms(a,{duration:h,ease:l}),"pause"===o?r.pause():"scrub"===o?r.scrubToProgress(0):r.play()};if("load"===n||"init"===n)u();else if("inview"===n){const e=new Xt({trigger:t,scrub:"scrub"===o,...this.parseAttrObject(t,"shader-scroll",{}),onEnter:()=>{"scrub"!==o&&u()},onLeave:()=>{this.parseAttrBoolean(t,"shader-pause-on-leave",!1)&&r.pause()},onUpdate:({progress:t})=>{"scrub"===o&&r.scrubToProgress(t)}});this.scrollTriggers.set(t,e)}else{const e=fe[n]||n,s=()=>u();t.addEventListener(e,s),this.registerCleanup(()=>t.removeEventListener(e,s))}this.shaderControllers.set(t,r)})}initLottieAnimations(){this.queryAllByAttr("lottie").forEach(t=>{const e=this.parseAttrString(t,"lottie"),s=e&&e.trim().startsWith("{")?ce(e):{path:e,container:t},i=se.createController({container:t,renderer:"svg",autoplay:!1,loop:!1,...s,...this.parseAttrObject(t,"lottie-options",{})});this.lottieControllers.set(t,i),this.bindPlaybackController(t,i,"lottie")})}initDotLottieAnimations(){this.queryAllByAttr("dotlottie").forEach(t=>{const e=this.parseAttrString(t,"dotlottie"),s=e&&e.trim().startsWith("{")?ce(e):{src:e,canvas:t},i=re.createController({canvas:t,autoplay:!1,loop:!1,...s,...this.parseAttrObject(t,"dotlottie-options",{})});this.dotLottieControllers.set(t,i),this.bindPlaybackController(t,i,"dotlottie")})}bindPlaybackController(t,e,s){const i=this.parseAttrString(t,`${s}-on`,"load"),r=this.parseAttrString(t,`${s}-action`,"play"),n=this.getAttr(t,`${s}-progress`),o=this.getAttr(t,`${s}-frame`),a=this.parseAttrString(t,`${s}-segment`,""),h=()=>{if(a){const[t,s]=a.split(",").map(t=>Number(t.trim()));Number.isFinite(t)&&Number.isFinite(s)&&(e.setSegment?.(t,s),e.playSegments?.([t,s],!0))}null!==n&&e.setProgress(pe(n,0)),null!==o&&e.setFrame(pe(o,0)),"play"===r?e.play():"pause"===r?e.pause():"stop"===r&&e.stop()};if("load"===i||"init"===i)return void h();if("inview"===i){const e=new Xt({trigger:t,onEnter:()=>h()});return void this.scrollTriggers.set(t,e)}const l=fe[i]||i,u=()=>h();t.addEventListener(l,u),this.registerCleanup(()=>t.removeEventListener(l,u))}refreshScrollTriggers(){this.scrollTriggers.forEach(t=>{t.refresh?.()})}killAll(){this.timelines.forEach(t=>t.kill()),this.tweens.forEach(t=>t.kill()),this.scrollTriggers.forEach(t=>t.kill?.()),this.draggables.forEach(t=>t.destroy?.()),this.parallaxEffects.forEach(t=>t.destroy?.()),this.springAnimations.forEach(t=>t.kill?.()),this.motionPathAnimations.forEach(t=>t.kill?.()),this.keyframeTimelines.forEach(t=>t.kill?.()),this.sceneSequences.forEach(t=>t.kill?.()),this.splitTexts.forEach(t=>t.revert?.()),this.lottieControllers.forEach(t=>t.destroy?.()),this.dotLottieControllers.forEach(t=>t.destroy?.()),this.videoAnimations.forEach(t=>t.destroy?.()),this.audioAnimations.forEach(t=>t.destroy?.()),this.shaderControllers.forEach(t=>t.destroy?.())}getStats(){return{timelines:this.timelines.size,tweens:this.tweens.size,splitTexts:this.splitTexts.size,scrollTriggers:this.scrollTriggers.size,draggables:this.draggables.size,parallaxEffects:this.parallaxEffects.size,springAnimations:this.springAnimations.size,motionPathAnimations:this.motionPathAnimations.size,keyframeTimelines:this.keyframeTimelines.size,sceneSequences:this.sceneSequences.size,lottieControllers:this.lottieControllers.size,dotLottieControllers:this.dotLottieControllers.size,videoAnimations:this.videoAnimations.size,audioAnimations:this.audioAnimations.size,shaderControllers:this.shaderControllers.size}}};class ye{constructor(t={}){this.interactions=new Map,this.activeInteractions=new Set,this.eventListeners=new Map,this.options={debug:!1,preventDefault:!0,globalEvents:!0,scope:null,...t},this.boundHandlers=new Map}on(t,e,s={}){return this.resolveTarget(t).forEach(t=>{const i=`${t.id||Math.random()}_${e}`,r={element:t,eventType:e,config:{animation:s.animation||{},duration:s.duration||.5,ease:s.ease||"ease-out",delay:s.delay||0,target:s.target||t,onStart:s.onStart||null,onComplete:s.onComplete||null,autoReverse:s.autoReverse||!1,reverseDelay:s.reverseDelay||0,...s}};this.interactions.set(i,r),this.attachListener(t,e,r)}),this}resolveTarget(t){if("string"==typeof t){const e=this.options.scope||document;return Array.from(e.querySelectorAll(t))}return[t]}attachListener(t,e,s){this.eventListeners.has(t)||this.eventListeners.set(t,new Map);const i=this.eventListeners.get(t);let r;switch(e){case"click":r=t=>{t.preventDefault?.(),this.executeAnimation(s,t)},t.addEventListener("click",r);break;case"hover":{const e=t=>this.executeAnimation(s,t),r=t=>{s.config.autoReverse&&this.reverseAnimation(s,t)};return t.addEventListener("mouseenter",e),t.addEventListener("mouseleave",r),i.set("hoverIn",e),void i.set("hoverOut",r)}case"focus":{r=t=>this.executeAnimation(s,t);const e=t=>{s.config.autoReverse&&this.reverseAnimation(s,t)};return t.addEventListener("focus",r),t.addEventListener("blur",e),i.set("focus",r),void i.set("blur",e)}case"touch":{r=t=>this.executeAnimation(s,t);const e=t=>{s.config.autoReverse&&this.reverseAnimation(s,t)};return t.addEventListener("touchstart",r),t.addEventListener("touchend",e),i.set("touchstart",r),void i.set("touchend",e)}case"pointer":{r=t=>this.executeAnimation(s,t);const e=t=>{s.config.autoReverse&&this.reverseAnimation(s,t)};return t.addEventListener("pointerdown",r),t.addEventListener("pointerup",e),i.set("pointerdown",r),void i.set("pointerup",e)}case"keyboard":return void this.attachKeyboardListener(t,s);case"doubletap":return void this.attachDoubleTapListener(t,s);case"longpress":return void this.attachLongPressListener(t,s);case"swipe":return void this.attachSwipeListener(t,s);case"wheel":r=t=>{t.preventDefault?.(),this.executeAnimation(s,t)},t.addEventListener("wheel",r,{passive:!1});break;default:r=t=>this.executeAnimation(s,t),t.addEventListener(e,r)}r&&i.set(e,r)}attachKeyboardListener(t,e){const s=t=>{const s=e.config.key;(!s||t.key===s||t.code===s)&&(t.preventDefault?.(),this.executeAnimation(e,t))};document.addEventListener("keydown",s),this.eventListeners.has(t)||this.eventListeners.set(t,new Map),this.eventListeners.get(t).set("keyboard",s)}attachDoubleTapListener(t,e){let s=0;const i=t=>{const i=(new Date).getTime(),r=i-s;r<300&&r>0&&this.executeAnimation(e,t),s=i};t.addEventListener("touchend",i),this.eventListeners.has(t)||this.eventListeners.set(t,new Map),this.eventListeners.get(t).set("doubletap",i)}attachLongPressListener(t,e){let s=null;const i=e.config.pressDuration||500,r=()=>{s=setTimeout(()=>{this.executeAnimation(e)},i)},n=()=>clearTimeout(s);t.addEventListener("mousedown",r),t.addEventListener("mouseup",n),t.addEventListener("mouseleave",n),this.eventListeners.has(t)||this.eventListeners.set(t,new Map),this.eventListeners.get(t).set("longpress",{onMouseDown:r,onMouseUp:n})}attachSwipeListener(t,e){let s,i;const r=t=>{s=t.changedTouches[0].screenX},n=t=>{i=t.changedTouches[0].screenX;const r=i-s,n=e.config.swipeThreshold||50;if(Math.abs(r)>n){const t=r>0?"right":"left";e.config.direction!==t&&e.config.direction||this.executeAnimation(e)}};t.addEventListener("touchstart",r),t.addEventListener("touchend",n),this.eventListeners.has(t)||this.eventListeners.set(t,new Map),this.eventListeners.get(t).set("swipe",{onTouchStart:r,onTouchEnd:n})}executeAnimation(t,e=null){const s=t.config,i=s.target||t.element;s.onStart?.(e,i);const r=new Bt(i,s.animation,{duration:s.duration,ease:s.ease,delay:s.delay,onComplete:()=>{s.onComplete?.(e,i)}});this.activeInteractions.add(r),this.options.debug&&f.debug(`Animation executed on ${i.tagName||"object"}`)}reverseAnimation(t){const e=t.config,s=e.target||t.element,i=this.reverseProps(e.animation),r=new Bt(s,i,{duration:e.duration,ease:e.ease,delay:e.reverseDelay});this.activeInteractions.add(r)}reverseProps(t){const e={};for(const[s,i]of Object.entries(t))e[s]="number"==typeof i?-i:"opacity"===s?1:"transform"===s?"none":i;return e}static initFromDOM(){const t=new ye;return document.querySelectorAll("[data-anim-click]").forEach(e=>{const s=ce(e.dataset.animClick||"{}");t.on(e,"click",s)}),document.querySelectorAll("[data-anim-hover]").forEach(e=>{const s=ce(e.dataset.animHover||"{}");t.on(e,"hover",s)}),document.querySelectorAll("[data-anim-focus]").forEach(e=>{const s=ce(e.dataset.animFocus||"{}");t.on(e,"focus",s)}),document.querySelectorAll("[data-anim-touch]").forEach(e=>{const s=ce(e.dataset.animTouch||"{}");t.on(e,"touch",s)}),document.querySelectorAll("[data-anim-keyboard]").forEach(e=>{const s=ce(e.dataset.animKeyboard||"{}");t.on(e,"keyboard",s)}),document.querySelectorAll("[data-anim-pointer]").forEach(e=>{const s=ce(e.dataset.animPointer||"{}");t.on(e,"pointer",s)}),t}off(t,e){return this.resolveTarget(t).forEach(t=>{if(!this.eventListeners.has(t))return;const s=this.eventListeners.get(t);this.getHandlerKeys(e,s).forEach(e=>{this.removeStoredHandler(t,s,e)}),0===s.size&&this.eventListeners.delete(t)}),this}offAll(){return this.eventListeners.forEach((t,e)=>{Array.from(t.keys()).forEach(s=>{this.removeStoredHandler(e,t,s)})}),this.interactions.clear(),this.activeInteractions.clear(),this.eventListeners.clear(),this.boundHandlers.clear(),this}getHandlerKeys(t,e){if(!t)return Array.from(e.keys());return{hover:["hoverIn","hoverOut"],focus:["focus","blur"],touch:["touchstart","touchend"],pointer:["pointerdown","pointerup"],longpress:["longpress"],swipe:["swipe"]}[t]||[t]}removeStoredHandler(t,e,s){const i=e.get(s);i&&("keyboard"===s?document.removeEventListener("keydown",i):"hoverIn"===s?t.removeEventListener("mouseenter",i):"hoverOut"===s?t.removeEventListener("mouseleave",i):"touchstart"===s?t.removeEventListener("touchstart",i):"touchend"===s?t.removeEventListener("touchend",i):"pointerdown"===s?t.removeEventListener("pointerdown",i):"pointerup"===s?t.removeEventListener("pointerup",i):"longpress"===s?(t.removeEventListener("mousedown",i.onMouseDown),t.removeEventListener("mouseup",i.onMouseUp),t.removeEventListener("mouseleave",i.onMouseUp)):"swipe"===s?(t.removeEventListener("touchstart",i.onTouchStart),t.removeEventListener("touchend",i.onTouchEnd)):"wheel"===s?t.removeEventListener("wheel",i):t.removeEventListener(s,i),e.delete(s))}getStats(){return{totalInteractions:this.interactions.size,activeAnimations:this.activeInteractions.size,registeredElements:this.eventListeners.size}}}var Ae=ye;var be=class{constructor(t={}){this.scope=t.scope||null,this.instances=new Set,this.cleanups=[]}add(t){return t?(this.instances.add(t),t):t}addCleanup(t){return"function"==typeof t&&this.cleanups.push(t),t}resolveScopeTarget(t){return"string"==typeof t&&ht(this.scope)?Array.from(this.scope.querySelectorAll(t)):t}tween(t,e,s={}){return this.add(new Bt(this.resolveScopeTarget(t),e,{...s,scope:this.scope,paused:!1}))}to(t,e,s={}){return this.tween(t,e,s)}from(t,e,s={}){return this.add(new Bt(this.resolveScopeTarget(t),e,{...s,from:!0,scope:this.scope,paused:!1}))}fromTo(t,e,s,i={}){return this.add(new Bt(this.resolveScopeTarget(t),s,{...i,fromTo:e,scope:this.scope,paused:!1}))}set(t,e,s={}){return this.add(new Bt(this.resolveScopeTarget(t),e,{...s,duration:0,scope:this.scope,paused:!1}))}timeline(t={}){return this.add(new $t({...t,scope:t.scope||this.scope}))}spring(t,e,s={}){return this.add(new Gt(this.resolveScopeTarget(t),e,{...s,scope:this.scope}))}keyframes(t,e,s={}){return this.add(ue(this.resolveScopeTarget(t),e,{...s,scope:this.scope}))}motionPath(t,e={}){return this.add(Qt(this.resolveScopeTarget(t),{...e,scope:this.scope}))}sequence(t=[],e={}){return this.add(new Kt(t,{...e,scope:this.scope}))}interactions(t={}){return this.add(new Ae({...t,scope:t.scope||this.scope}))}initAttributes(t={}){const e=new ve({...t,root:t.root||this.scope,autoInit:!1});return e.init(),this.add(e)}query(t){return ht(this.scope)?Array.from(this.scope.querySelectorAll(t)):[]}revert(){this.cleanups.slice().reverse().forEach(t=>t()),this.cleanups=[],this.instances.forEach(t=>{"function"==typeof t.revert?t.revert():"function"==typeof t.kill?t.kill():"function"==typeof t.destroy&&t.destroy()}),this.instances.clear()}};const Te=(t,e,s={})=>{const i=s.speed||50,r=s.startDelay||0;let n=0;t.textContent="";const o=()=>{const r=setInterval(()=>{n<e.length?(t.textContent+=e[n],n++):(clearInterval(r),s.onComplete?.())},i)};r>0?setTimeout(o,1e3*r):o()},Se=(t,e={})=>{const s=e.chars||"0123456789!@#$%^&*()_+-=[]{}|;:,.<>?/",i=t.textContent,r=e.duration||1,n=e.revealDelay||.05,o=performance.now(),a=h=>{const l=(h-o)/1e3,u=Math.min(l/r,1);let c="";for(let t=0;t<i.length;t++){c+=Math.max(0,u-t*n)>=1?i[t]:s[Math.floor(Math.random()*s.length)]}t.textContent=c,u<1?requestAnimationFrame(a):(t.textContent=i,e.onComplete?.())};requestAnimationFrame(a)},we=(t,e={})=>{const s=e.from||0,i=e.to||100,r=e.duration||1,n=e.ease||(t=>t),o=e.prefix||"",a=e.suffix||"",h=performance.now(),l=u=>{const c=(u-h)/1e3,p=Math.min(c/r,1),d=n(p),m=s+(i-s)*d;t.textContent=o+Math.floor(m)+a,p<1?requestAnimationFrame(l):e.onComplete?.()};requestAnimationFrame(l)},Ee=(t,e={})=>{const s=e.duration||1,i=performance.now(),r=n=>{const o=(n-i)/1e3,a=Math.min(o/s,1),h=10*(1-a);t.style.filter=`blur(${h}px)`,a<1?requestAnimationFrame(r):(t.style.filter="blur(0px)",e.onComplete?.())};requestAnimationFrame(r)},xe=(t,e={})=>{const s=e.duration||1,i=e.wave||10,r=e.speed||1,n=t.textContent;t.innerHTML="";const o=n.split("").map(e=>{const s=document.createElement("span");return s.textContent=e,s.style.display="inline-block",t.appendChild(s),s}),a=performance.now(),h=t=>{const n=(t-a)/1e3;o.forEach((t,e)=>{const s=Math.sin((n*r+.1*e)*Math.PI)*i;t.style.transform=`translateY(${s}px)`}),n<s?requestAnimationFrame(h):e.onComplete?.()};requestAnimationFrame(h)},Le=(t,e,s={})=>{const i=s.from??t.textContent??"",r=e??s.to??"",n=s.duration||.8,o=s.ease||(t=>t),a=Math.max(i.length,r.length),h=performance.now();t.textContent=i;const l=e=>{const u=(e-h)/1e3,c=Math.min(u/n,1),p=o(c),d=Math.round(p*a);let m="";for(let t=0;t<a;t++)m+=t<d?r[t]||"":i[t]||"";t.textContent=m,c<1?requestAnimationFrame(l):(t.textContent=r,s.onComplete?.())};requestAnimationFrame(l)};var Me=class{static resolveLibrary(t){if(t)return t;const e=ot();if(e?.THREE)return e.THREE;throw new Error("Three.js is not loaded")}static isLoaded(){const t=ot();return void 0!==t?.THREE}static get THREE(){return this.resolveLibrary()}static tween(t,e,s={}){return new Bt(t,e,{...s,paused:!0===s.paused,render:e=>{s.renderer?.render?.(s.scene,s.camera),s.onRender?.(e,t)}})}static orbit(t,e={}){const s={angle:e.fromAngle||0},i=e.radius||5,r=e.center||{x:0,y:0,z:0};return new Bt(s,{angle:void 0===e.toAngle?2*Math.PI:e.toAngle},{duration:e.duration||2,ease:e.ease||"linear",paused:!0===e.paused,repeat:e.repeat||0,render:()=>{t.position.x=r.x+Math.cos(s.angle)*i,t.position.z=r.z+Math.sin(s.angle)*i,t.position.y=r.y,"function"==typeof t.lookAt&&t.lookAt(r.x,r.y,r.z),e.renderer?.render?.(e.scene,e.camera)}})}static createAnimationStateMachine(t,e={}){const s=this.resolveLibrary(e.THREE||e.library),i=t.scene||t,r=e.clips||t.animations||[],n=e.mixer||new s.AnimationMixer(i),o=new Map;let a=null,h=null,l=null;r.forEach(t=>{const e=n.clipAction(t,i);o.set(t.name,e)});const u=()=>{e.renderer?.render?.(e.scene||i,e.camera),e.onRender?.(p)},c=t=>{null===l&&(l=t),n.update((t-l)/1e3),l=t,u(),h=requestAnimationFrame(c)},p={root:i,mixer:n,actions:o,states:o,get current(){return a},has(t){return o.has(t)},getAction(t){return o.get(t)||null},play(t,i={}){const r=o.get(t);if(!r)throw new Error(`GLTF animation action not found: ${t}`);const n=a?o.get(a):null,h=i.fade??e.fade??.25;return r.enabled=!0,r.paused=!1,r.timeScale=i.timeScale??1,r.clampWhenFinished=i.clampWhenFinished??e.clampWhenFinished??!0,void 0!==i.loop&&s[i.loop]&&r.setLoop(s[i.loop],i.repetitions??1/0),!1!==i.reset&&r.reset(),n&&n!==r&&h>0&&n.crossFadeTo(r,h,!1!==i.warp),r.play(),a=t,e.onStateChange?.(t,n,p),p},stop(t=a){return o.get(t)?.stop(),t===a&&(a=null),p},pause(t=a){const e=o.get(t);return e&&(e.paused=!0),p},update(t){return n.update(t),u(),p},start(){return h||(l=null,h=requestAnimationFrame(c)),p},stopLoop(){return h&&(cancelAnimationFrame(h),h=null),p},dispose(){p.stopLoop(),o.forEach(t=>t.stop()),n.stopAllAction()}};return p.setState=p.play,(e.initialState||e.initial)&&p.play(e.initialState||e.initial,{fade:0,reset:!0}),!1!==e.autoplay&&p.start(),p}static gltfStateMachine(t,e={}){return this.createAnimationStateMachine(t,e)}};const Ce=(t={},e="am")=>Object.entries(t).reduce((t,[s,i])=>{if(null==i||!1===i)return t;const r=`${e}-${s.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`,n=(t=>{if(null!=t&&!1!==t)return"string"==typeof t?t:"number"==typeof t||"boolean"==typeof t?String(t):JSON.stringify(t)})(i);return void 0===n||(t[r]=n),t},{[e]:""});var ke={version:"1.1.0",AnimationCore:ve,AnimationContext:be,Timeline:$t,Tween:Bt,Keyframes:ue,Easing:i,SplitText:jt,ScrollTrigger:Xt,Draggable:Ht,ParallaxEffect:Vt,SpringPhysics:Gt,MotionPath:Qt,SceneSequence:Kt,TextEffects:a,VideoAnimation:Jt,AudioAnimation:te,Interactions:Ae,WebGLSupport:le,ThreeJsSupport:Me,LottieSupport:se,DotLottieSupport:re,animotionAttrs:Ce,DomUtils:n,EnvironmentUtils:r,MathUtils:s,ParserUtils:o,Logger:f,init(t={}){const e=new ve(t);return e.init(),e},initAttributes(t={}){return this.init(t)},timeline(t={}){return new $t(t)},tween(t,e,s={}){return new Bt(t,e,s)},spring(t,e,s={}){return new Gt(t,e,s)},keyframes(t,e,s={}){return ue(t,e,s)},path(t,e={}){return Qt(t,e)},motionPath(t,e={}){return Qt(t,e)},sequence(t,e={}){return new Kt(t,e)},to(t,e,s={}){return new Bt(t,e,{...s,paused:!1})},from(t,e,s={}){return new Bt(t,e,{...s,from:!0,paused:!1})},fromTo(t,e,s,i={}){return new Bt(t,s,{...i,fromTo:e,paused:!1})},set(t,e){return new Bt(t,e,{duration:0,paused:!1})},interactions(t={}){return new Ae(t)},scroll(t,e={}){const s="string"==typeof t||ht(t)?{...e,trigger:t}:{...t,...e};return new Xt(s)},pin(t,e={}){const s="string"==typeof t||ht(t)?{...e,trigger:t}:{...t,...e};return new Xt({...s,pin:!0,scrub:s.scrub??!0})},inOut(t,e,s,i={}){const r=new Bt(t,e,{...i,paused:!0}),n=new Bt(t,s,{...i,paused:!0});return{enter:r,leave:n,playIn:()=>r.restart(),playOut:()=>n.restart(),reverse:()=>{r.seek(1),r.reverse(),r.play()},kill:()=>{r.kill(),n.kill()}}},initInteractions(){return Ae.initFromDOM()},context(t={}){return new be(t)},lottie(t,e={}){return se.createController(t,e)},dotLottie(t,e={}){return re.createController(t,e)},video(t,e={}){return new Jt(t,e)},audio(t,e={}){return new te(t,e)},sound(t,e={}){return new te(t,e)},shader(t,e={}){return le.createShader(t,e)},webglShader(t,e={}){return le.createShader(t,e)},threeStateMachine(t,e={}){const s=Me.createAnimationStateMachine(t,e),i=e.id||e.name,r=ot();return i&&r&&(r.__ANIMOTION__=r.__ANIMOTION__||{},r.__ANIMOTION__.threeStateMachines=r.__ANIMOTION__.threeStateMachines||new Map,r.__ANIMOTION__.threeStateMachines.set(i,s)),s},getTimeline(t){return ot()?.__ANIMOTION__?.timelines?.get(t)||null},getSplitText(t){return ot()?.__ANIMOTION__?.splitTexts?.get(t)||null}};return e}()});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "animotionjs-plus",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "An advanced custom web animation engine for Vanilla JS, React, and Next.js with CSS, Three.js, Lottie, and dotLottie support.",
|
|
5
5
|
"main": "dist/animotion.min.js",
|
|
6
6
|
"module": "src/index.core.js",
|