@motion.page/sdk 1.0.3 → 1.0.4
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/core/Animation.d.ts +6 -0
- package/dist/core/Timeline.d.ts +1 -0
- package/dist/easing/index.d.ts +1 -0
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +10 -10
- package/dist/index.js +16 -16
- package/dist/index.js.map +10 -10
- package/dist/triggers/PinManager.d.ts +25 -1
- package/dist/utils/TextSplitter.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
function w(J,$){switch(J){case"play":case"resume":$.play();break;case"pause":$.pause();break;case"reverse":$.reverse();break;case"restart":$.restart();break;case"reset":$.pause(),$.progress(0);break;case"complete":$.progress(1),$.pause();break;case"none":break;default:console.warn(`[Motion] Unknown timeline action: "${J}". Valid actions: play, pause, resume, reverse, restart, reset, complete, none`)}}var X={color:null,filter:null,drawSVG:null,stagger:null,textSplitter:null,triggerManager:null,styleReset:null,fit:null};class F{static _instance;static _triggerRegistry=new Map;static _pageLoadTriggerFactory=null;static _RESIZE_DEBOUNCE_MS=200;_pageLoadTrigger=null;_scrollTriggers=new Map;_eventTriggers=new Map;_mouseMoveTriggers=new Map;_gestureTriggers=new Map;_cursorTriggers=new Map;_pageExitTriggers=new Map;_resizeHandler=null;_resizeTimer=null;get _allTriggerMaps(){return[this._scrollTriggers,this._eventTriggers,this._mouseMoveTriggers,this._gestureTriggers,this._cursorTriggers,this._pageExitTriggers]}constructor(){}static getInstance(){if(!F._instance)F._instance=new F;return F._instance}static registerTrigger(J,$){F._triggerRegistry.set(J,$)}static registerPageLoadTrigger(J){F._pageLoadTriggerFactory=J}_getPageLoadTrigger(){if(!this._pageLoadTrigger&&F._pageLoadTriggerFactory)this._pageLoadTrigger=new F._pageLoadTriggerFactory;return this._pageLoadTrigger}_createTrigger(J,...$){let Q=F._triggerRegistry.get(J);if(!Q){let q=Array.from(F._triggerRegistry.keys());return console.warn(`[Motion SDK] Trigger type '${J}' is not available in this bundle. Available triggers: ${q.join(", ")||"none"}. Animations using .on${J.charAt(0).toUpperCase()+J.slice(1)}() will be skipped.`),null}return new Q(...$)}registerPageLoad(J,$){this.unregister(J);let Q=this._getPageLoadTrigger();if(Q)Q.register(J,$)}_attachResizeListener(){if(this._resizeHandler||typeof window>"u")return;this._resizeHandler=()=>{if(this._resizeTimer!==null)clearTimeout(this._resizeTimer);this._resizeTimer=setTimeout(()=>{this._resizeTimer=null,this.refreshScrollTriggers()},F._RESIZE_DEBOUNCE_MS)},window.addEventListener("resize",this._resizeHandler,{passive:!0})}_detachResizeListener(){if(!this._resizeHandler||typeof window>"u")return;if(window.removeEventListener("resize",this._resizeHandler),this._resizeTimer!==null)clearTimeout(this._resizeTimer),this._resizeTimer=null;this._resizeHandler=null}registerScroll(J,$){this.unregister(J);let Q=this._createTrigger("scroll",J,$);if(!Q)return;this._scrollTriggers.set(J,Q),J._trigger=Q,Q.enable(),this._attachResizeListener()}registerHover(J,$){this.unregister(J);let Q=this._createTrigger("event",J,{type:"hover",target:$.target,onLeave:$.onLeave,leaveDelay:$.leaveDelay});if(!Q)return;this._eventTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerClick(J,$){this.unregister(J);let Q=this._createTrigger("event",J,{type:"click",target:$.target,secondTarget:$.secondTarget,toggle:$.toggle,preventDefault:$.preventDefault});if(!Q)return;this._eventTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerMouseMove(J,$){this.unregister(J);let Q=this._createTrigger("mouseMove",J,$);if(!Q)return;this._mouseMoveTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerGesture(J,$){this.unregister(J);let Q=this._createTrigger("gesture",J,$);if(!Q)return;this._gestureTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerCursor(J,$){this.unregister(J);let Q=this._createTrigger("cursor",J,$);if(!Q)return;this._cursorTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerPageExit(J,$){this.unregister(J);let Q=this._createTrigger("pageExit",J,$);if(!Q)return;this._pageExitTriggers.set(J,Q),J._trigger=Q,Q.enable()}unregister(J){let $=this._getPageLoadTrigger();if($)$.unregister(J);for(let Q of this._allTriggerMaps){let q=Q.get(J);if(q)q.disable(),Q.delete(J)}if(J._trigger=void 0,this._scrollTriggers.size===0)this._detachResizeListener()}refreshScrollTriggers(){let J=Array.from(this._scrollTriggers.values()),$=typeof window<"u"?window.scrollY:0;J.sort((Q,q)=>{let Z=Q._pinManager?.getLayoutRect?.(),j=q._pinManager?.getLayoutRect?.();if(!Z&&!j)return 0;if(!Z)return 1;if(!j)return-1;return Z.top+$-(j.top+$)}),J.forEach((Q)=>Q.refresh?.()),this._eventTriggers.forEach((Q)=>Q.refresh?.()),this._gestureTriggers.forEach((Q)=>Q.refresh?.()),this._mouseMoveTriggers.forEach((Q)=>Q.refresh?.())}killAll(){let J=this._getPageLoadTrigger();if(J)J.clear();for(let $ of this._allTriggerMaps)$.forEach((Q)=>Q.disable()),$.clear();this._detachResizeListener()}static _reset(){if(F._instance){if(F._instance._pageLoadTrigger)F._instance._pageLoadTrigger._reset();F._instance.killAll(),F._instance=void 0}}}X.triggerManager={getInstance:F.getInstance};function LJ(J){if(typeof document>"u"){J();return}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",J,{once:!0});else J()}function OJ(J){if(J===null||typeof J!=="object")return!1;if(J instanceof Element)return!1;if("nodeType"in J)return!1;if("style"in J)return!1;let $=J;if("x"in $&&typeof $.x==="number")return!0;if("length"in J)return!1;return!0}function o0(J){return J instanceof Element||typeof J==="object"&&J!==null&&(("nodeType"in J)||("style"in J))}function A0(J){if(OJ(J))return[J];if(typeof J==="string"){if(typeof document<"u")try{return Array.from(document.querySelectorAll(J))}catch($){return console.warn(`[Motion] Invalid selector "${J}":`,$),[]}return[]}if(J instanceof Element)return[J];if(J&&typeof J==="object"&&"style"in J&&!Array.isArray(J))return[J];if(J instanceof NodeList)return Array.from(J);if(Array.isArray(J)){if(J.length===0)return[];if(typeof J[0]==="string"){if(typeof document>"u")return[];let $=[];for(let Q of J)try{$.push(...Array.from(document.querySelectorAll(Q)))}catch(q){console.warn(`[Motion] Invalid selector "${Q}":`,q)}return $}if(OJ(J[0]))return J;return J}if(J&&typeof J==="object"&&"length"in J)return Array.from(J);return[]}class h{_timeline;_config;_enabled=!1;constructor(J,$){this._timeline=J,this._config=$}enable(){if(this._enabled)return;this._enabled=!0,LJ(()=>{if(!this._enabled)return;this._onEnable()})}disable(){if(!this._enabled)return;this._enabled=!1,this._onDisable()}_resolveElement(J,$){if(J===void 0||J===null)return $??null;if(typeof J!=="string")return J;if(typeof document<"u")try{let Q=document.querySelector(J);if(Q!==null)return Q}catch(Q){console.warn(`[Motion] Invalid selector "${J}":`,Q)}return $??null}_resolveElements(J){if(J===void 0||J===null)return[];if(typeof J!=="string")return[J];if(typeof document<"u")try{let $=document.querySelectorAll(J);return Array.from($)}catch($){return console.warn(`[Motion] Invalid selector "${J}":`,$),[]}return[]}_cleanupListenerMap(J){J.forEach(($,Q)=>{$.forEach((q,Z)=>{Q.removeEventListener(Z,q)})}),J.clear()}}function f(J){let $=J,Q=$.style.transform,q=$.style.transition;$.style.transition="none",$.style.transform="none";let Z=!1,j=$.style.position,z=$.style.top,G=$.style.left,N=$.style.width;if(j==="fixed")Z=!0;else if(j===""||j===void 0){if(typeof window<"u"&&typeof window.getComputedStyle==="function"&&window.getComputedStyle($).position==="fixed")Z=!0}if(Z)$.style.position="",$.style.top="",$.style.left="",$.style.width="";let W=$.getBoundingClientRect();if($.style.transform=Q,$.style.transition=q,Z)$.style.position=j,$.style.top=z,$.style.left=G,$.style.width=N;return W}class MJ extends h{_targets=[];_secondTargets=[];_listeners=new Map;_isForward=!0;_frozenRects=new Map;_snapshotScrollX=0;_snapshotScrollY=0;_wasHovering=!1;_hoverLeaveTimeout=null;_boundMouseMoveHandler=null;constructor(J,$){super(J,$)}_onEnable(){if(this._resolveTargets(),this._config.type==="hover")this._addHoverListeners();else if(this._config.type==="click")this._addClickListeners()}_onDisable(){if(this._boundMouseMoveHandler)window.removeEventListener("mousemove",this._boundMouseMoveHandler),this._boundMouseMoveHandler=null;if(this._hoverLeaveTimeout!==null)clearTimeout(this._hoverLeaveTimeout),this._hoverLeaveTimeout=null;this._frozenRects.clear(),this._wasHovering=!1,this._cleanupListenerMap(this._listeners)}refresh(){if(this._config.type!=="hover")return;this._snapshotRects()}_snapshotRects(){this._snapshotScrollX=window.scrollX||0,this._snapshotScrollY=window.scrollY||0;for(let J of this._targets)this._frozenRects.set(J,f(J))}_resolveTargets(){if(this._targets=this._resolveElements(this._config.target),this._config.secondTarget)this._secondTargets=this._resolveElements(this._config.secondTarget);else this._secondTargets=this._targets}_addHoverListeners(){let J=this._config.onLeave||"reverse",$=this._config.leaveDelay||0;this._snapshotRects(),this._boundMouseMoveHandler=(Q)=>{let q=(window.scrollX||0)-this._snapshotScrollX,Z=(window.scrollY||0)-this._snapshotScrollY,j=Q.clientX+q,z=Q.clientY+Z,G=!1;for(let N of this._frozenRects.values())if(j>=N.left&&j<=N.right&&z>=N.top&&z<=N.bottom){G=!0;break}if(G&&!this._wasHovering){if(this._wasHovering=!0,this._hoverLeaveTimeout!==null)clearTimeout(this._hoverLeaveTimeout),this._hoverLeaveTimeout=null;this._timeline.play()}else if(!G&&this._wasHovering){if(this._wasHovering=!1,J==="none")return;let N=()=>{this._handleLeaveAction(J),this._hoverLeaveTimeout=null};if($>0)this._hoverLeaveTimeout=window.setTimeout(N,$*1000);else N()}},window.addEventListener("mousemove",this._boundMouseMoveHandler)}_handleLeaveAction(J){w(J==="stop"?"reset":J,this._timeline)}_addClickListeners(){let J=this._config.toggle||"play",$=this._config.preventDefault||!1,Q=this._config.secondTarget&&this._config.secondTarget!==this._config.target;if(this._targets.forEach((q)=>{let Z=this._listeners.get(q)||new Map,j=(z)=>{if($)z.preventDefault();if(!Q)if(this._isForward){if(this._timeline.restart(),J!=="play")this._isForward=!1}else this._handleSecondClick(J),this._isForward=!0;else this._timeline.restart()};q.addEventListener("click",j),Z.set("click",j),this._listeners.set(q,Z)}),Q)this._secondTargets.forEach((q)=>{if(this._listeners.has(q))return;let Z=new Map,j=(z)=>{if($)z.preventDefault();this._handleSecondClick(J)};q.addEventListener("click",j),Z.set("click",j),this._listeners.set(q,Z)})}_handleSecondClick(J){w(J,this._timeline)}}F.registerTrigger("event",MJ);var a0={perspective:0,x:1,y:2,z:3,rotate:4,rotateX:5,rotateY:6,rotateZ:7,scale:8,scaleX:9,scaleY:10,scaleZ:11,skewX:12,skewY:13},DJ=["px","px","px","px","deg","deg","deg","deg","","","","","deg","deg"],j0=new WeakMap,F0=new WeakMap,D=[];function c(J){let $=J.trim().match(/([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z%]*)/i);if(!$)return{value:0,unit:""};return{value:parseFloat($[1]),unit:$[2]||""}}function Z0(J,$){switch($){case"rad":return J*180/Math.PI;case"turn":return J*360;case"grad":return J*0.9;default:return J}}function a(J){let $=c(J);return Z0($.value,$.unit||"deg")}function A(J,$,Q,q){let Z=a0[$];if(Z===void 0)return;J.values[Z]=Q;let j=q&&q.length>0?q:DJ[Z]||"";J.units[Z]=j,J.used|=1<<Z}function Y6(J,$){let Q=/([a-zA-Z0-9]+)\(([^)]+)\)/g,q;while((q=Q.exec(J))!==null){let Z=q[1],j=q[2].match(/[-+]?\d*\.?\d+(?:e[-+]?\d+)?[a-z%]*/gi)||[];switch(Z){case"translate":{let z=j[0]?c(j[0]):{value:0,unit:""},G=j[1]?c(j[1]):{value:0,unit:""};A($,"x",z.value,z.unit),A($,"y",G.value,G.unit);break}case"translate3d":{let z=j[0]?c(j[0]):{value:0,unit:""},G=j[1]?c(j[1]):{value:0,unit:""},N=j[2]?c(j[2]):{value:0,unit:""};A($,"x",z.value,z.unit),A($,"y",G.value,G.unit),A($,"z",N.value,N.unit);break}case"translateX":{let z=j[0]?c(j[0]):{value:0,unit:""};A($,"x",z.value,z.unit);break}case"translateY":{let z=j[0]?c(j[0]):{value:0,unit:""};A($,"y",z.value,z.unit);break}case"translateZ":{let z=j[0]?c(j[0]):{value:0,unit:""};A($,"z",z.value,z.unit);break}case"scale":{let z=j[0]?parseFloat(j[0]):1,G=j[1]?parseFloat(j[1]):z;A($,"scaleX",z),A($,"scaleY",G);break}case"scale3d":{let z=j[0]?parseFloat(j[0]):1,G=j[1]?parseFloat(j[1]):1,N=j[2]?parseFloat(j[2]):1;A($,"scaleX",z),A($,"scaleY",G),A($,"scaleZ",N);break}case"scaleX":{let z=j[0]?parseFloat(j[0]):1;A($,"scaleX",z);break}case"scaleY":{let z=j[0]?parseFloat(j[0]):1;A($,"scaleY",z);break}case"scaleZ":{let z=j[0]?parseFloat(j[0]):1;A($,"scaleZ",z);break}case"rotate":A($,"rotate",j[0]?a(j[0]):0,"deg");break;case"rotateX":A($,"rotateX",j[0]?a(j[0]):0,"deg");break;case"rotateY":A($,"rotateY",j[0]?a(j[0]):0,"deg");break;case"rotateZ":A($,"rotateZ",j[0]?a(j[0]):0,"deg");break;case"skew":{let z=j[0]?a(j[0]):0,G=j[1]?a(j[1]):0;A($,"skewX",z,"deg"),A($,"skewY",G,"deg");break}case"skewX":A($,"skewX",j[0]?a(j[0]):0,"deg");break;case"skewY":A($,"skewY",j[0]?a(j[0]):0,"deg");break;case"perspective":{let z=j[0]?c(j[0]):{value:0,unit:""};A($,"perspective",z.value,z.unit);break}default:break}}}function i0(J,$,Q,q,Z,j,z,G,N,W,B,Y,U,_){if(U){let J0=Math.hypot(J,$),N6=J*Z-$*q,W6=J0!==0?N6/J0:0,B6=J0!==0?Math.atan2($,J):0,FJ=J0!==0?Math.atan2(J*q+$*Z,J0*J0):0;if(A(_,"x",W,"px"),A(_,"y",B,"px"),A(_,"scaleX",J0||1),A(_,"scaleY",W6||1),A(_,"rotate",Z0(B6,"rad"),"deg"),Math.abs(FJ)>0.000001)A(_,"skewX",Z0(FJ,"rad"),"deg");return}let H=Math.hypot(J,$,Q)||1,I=Math.hypot(q,Z,j)||1,K=Math.hypot(z,G,N)||1,M=J/H,k=$/H,L=Q/H,O=q/I,v=Z/I,c0=j/I,AJ=z/K,j6=G/K,G6=N/K,m0=Math.sqrt(M*M+O*O),z6=m0<0.000001,g0=0,s0=0,l0=0;if(!z6)g0=Math.atan2(j6,G6),s0=Math.atan2(-AJ,m0),l0=Math.atan2(O,M);else g0=Math.atan2(-c0,v),s0=Math.atan2(-AJ,m0),l0=0;A(_,"x",W,"px"),A(_,"y",B,"px"),A(_,"z",Y,"px"),A(_,"scaleX",H),A(_,"scaleY",I),A(_,"scaleZ",K),A(_,"rotateX",Z0(g0,"rad"),"deg"),A(_,"rotateY",Z0(s0,"rad"),"deg"),A(_,"rotateZ",Z0(l0,"rad"),"deg")}function _6(J,$){if(!J||J==="none")return;if(typeof DOMMatrixReadOnly<"u"){let q=new DOMMatrixReadOnly(J);i0(q.m11,q.m12,q.m13,q.m21,q.m22,q.m23,q.m31,q.m32,q.m33,q.m41,q.m42,q.m43,q.is2D,$);return}let Q=J.match(/[-+]?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];if(J.startsWith("matrix3d")&&Q.length>=16){let q=Q.map(Number);i0(q[0],q[1],q[2],q[4],q[5],q[6],q[8],q[9],q[10],q[12],q[13],q[14],!1,$);return}if(J.startsWith("matrix")&&Q.length>=6){let q=Q.map(Number);i0(q[0],q[1],0,q[2],q[3],0,0,0,1,q[4],q[5],0,!0,$)}}function H6(J,$){if(!(J instanceof HTMLElement)&&!(J instanceof SVGElement))return;let q=J.style.transform;if(q&&q!=="none"){Y6(q,$),$.cachedString=q;return}try{if(typeof window<"u"&&window.getComputedStyle){let Z=window.getComputedStyle(J),j=Z.transform||Z.getPropertyValue("transform");if(j&&j!=="none")_6(j,$),$.cachedString=j}}catch{}}function EJ(J){let $=j0.get(J);if(!$){let Q=new Float32Array(14);Q[8]=1,Q[9]=1,Q[10]=1,Q[11]=1,$={values:Q,units:[...DJ],dirty:0,used:0,cachedString:"",pinDirty:!1},H6(J,$),j0.set(J,$)}return $}function S(J,$,Q,q){let Z=EJ(J),j=a0[$];if(j!==void 0){if(Z.values[j]=Q,q!==void 0)Z.units[j]=q;if(Z.used|=1<<j,$==="scale")Z.values[9]=Q,Z.values[10]=Q,Z.dirty|=1536;else if($==="scaleX"||$==="scaleY")Z.values[8]=1,Z.dirty|=256;if($==="rotate")Z.values[7]=0,Z.dirty|=128;else if($==="rotateZ")Z.values[4]=0,Z.dirty|=16;Z.dirty|=1<<j}}function r0(J,$){let Q=EJ(J),q=a0[$];if(q===void 0)return $.startsWith("scale")?1:0;if($==="scale"){if(Q.values[q]!==1)return Q.values[q];let Z=Q.values[9],j=Q.values[10];if(Math.abs(Z-j)<0.000001&&Z!==1)return Z;return Q.values[q]}if($==="rotate"){if(Q.values[q]!==0)return Q.values[q];let Z=Q.values[7];if(Z!==0&&Q.values[5]===0&&Q.values[6]===0)return Z;return Q.values[q]}return Q.values[q]}function n0(J){return J===0?"0":`${Math.round(J)}px`}function kJ(J,$,Q){return`translate3d(${n0(J)}, ${n0($)}, ${n0(Q)})`}function O0(J,$,Q,q){F0.set(J,{x:$,y:Q,z:q});let Z=j0.get(J);if(Z)Z.pinDirty=!0}function Y0(J){let $=F0.has(J);if(F0.delete(J),$){let Q=j0.get(J);if(Q)Q.pinDirty=!0}}function E(J){let $=j0.get(J),Q=F0.get(J);if(!$){if(Q&&(Q.x!==0||Q.y!==0||Q.z!==0))return kJ(Q.x,Q.y,Q.z);return""}if($.dirty===0&&!$.pinDirty&&$.cachedString)return $.cachedString;let{values:q,units:Z}=$;D.length=0;let j=$.used,z=q[0];if(z!==0){let O=Z[0];D.push(`perspective(${z}${O})`)}let G=q[1],N=q[2],W=q[3],B=Z[1],Y=Z[2],U=Z[3],_=j&2,H=j&4,I=j&8;if(G!==0||N!==0||W!==0||_||H||I){let O=B===Y&&(W===0&&!I||Y===U);if(W!==0||I)if(O)D.push(`translate3d(${G}${B}, ${N}${Y}, ${W}${U})`);else{if(G!==0||_)D.push(`translateX(${G}${B})`);if(N!==0||H)D.push(`translateY(${N}${Y})`);D.push(`translateZ(${W}${U})`)}else if(O&&(G!==0||_)&&(N!==0||H))D.push(`translate(${G}${B}, ${N}${Y})`);else{if(G!==0||_)D.push(`translateX(${G}${B})`);if(N!==0||H)D.push(`translateY(${N}${Y})`)}}if(q[4]!==0||j&16)D.push(`rotate(${q[4]}deg)`);if(q[5]!==0||j&32)D.push(`rotateX(${q[5]}deg)`);if(q[6]!==0||j&64)D.push(`rotateY(${q[6]}deg)`);if(q[7]!==0||j&128)D.push(`rotateZ(${q[7]}deg)`);let K=j&256,M=j&512,k=j&1024;if(q[8]!==1||K)D.push(`scale(${q[8]})`);else if(q[9]!==1||q[10]!==1||M||k)D.push(`scaleX(${q[9]})`),D.push(`scaleY(${q[10]})`);if(q[11]!==1||j&2048)D.push(`scaleZ(${q[11]})`);if(q[12]!==0||j&4096)D.push(`skewX(${q[12]}deg)`);if(q[13]!==0||j&8192)D.push(`skewY(${q[13]}deg)`);let L=D.join(" ");if(Q&&(Q.x!==0||Q.y!==0||Q.z!==0)){let O=kJ(Q.x,Q.y,Q.z);$.cachedString=L?`${O} ${L}`:O}else $.cachedString=L;return $.dirty=0,$.pinDirty=!1,$.cachedString}function y(J,$=!1){if(j0.delete(J),$&&J instanceof HTMLElement)J.style.transform=""}var t0=new Set,L0=new Map,M0=!1;function k0(J){t0.add(J),M0=!0}function D0(J,$,Q){let q=L0.get(J);if(!q)q=new Map,L0.set(J,q);q.set($,Q),M0=!0}function e0(){if(!M0)return;for(let J of t0){let $=J;if($.style){let Q=E(J);$.style.transform=Q}}t0.clear();for(let[J,$]of L0){let Q=J;if(Q.style)for(let[q,Z]of $)try{if(q.startsWith("--"))Q.style.setProperty(q,Z);else Q.style[q]=Z}catch{}}L0.clear(),M0=!1}var $0=!1;function G0(){return $0}function JJ(J){if($0){J();return}$0=!0;try{J(),e0()}finally{$0=!1}}class C{static instance;listeners=[];_listenersDirty=!0;_listenersSnapshot=[];_isRunning=!1;rafId=null;lastTime=0;elapsedTime=0;lagThreshold=500;maxDelta=33;fpsFrames=0;fpsTime=0;currentFPS=60;lastFrameTime=0;constructor(){}static getInstance(){if(!C.instance)C.instance=new C;return C.instance}add(J,$=0){let Q=this.listeners.findIndex((q)=>q.callback===J);if(Q!==-1)this.listeners[Q].priority=$;else this.listeners.push({callback:J,priority:$});if(this.listeners.sort((q,Z)=>Z.priority-q.priority),this._listenersDirty=!0,!this._isRunning&&this.listeners.length>0)this.start()}remove(J){let $=this.listeners.findIndex((Q)=>Q.callback===J);if($!==-1)this.listeners.splice($,1),this._listenersDirty=!0;if(this.listeners.length===0&&this._isRunning)this.stop()}start(){if(this._isRunning)return;if(typeof requestAnimationFrame>"u"){this._isRunning=!1;return}this._isRunning=!0,this.lastTime=performance.now(),this.rafId=requestAnimationFrame(this.tick)}stop(){if(!this._isRunning)return;if(this._isRunning=!1,this.rafId!==null&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.rafId),this.rafId=null}pause(){this.stop()}resume(){if(this.listeners.length>0)this.start()}tick=()=>{if(!this._isRunning)return;let J=performance.now(),$=J-this.lastTime;if($>this.lagThreshold)$=this.maxDelta,this.lastTime=J-$;else this.lastTime=J;let Q=$/1000;if(this.elapsedTime+=Q,this.lastFrameTime=$,this.updateFPS($),$0=!0,this._listenersDirty)this._listenersSnapshot=[...this.listeners],this._listenersDirty=!1;for(let q of this._listenersSnapshot)try{q.callback(Q,this.elapsedTime)}catch(Z){console.error("[Motion] Uncaught error in animation callback:",Z)}try{e0()}catch(q){console.error("[Motion] Uncaught error in render batch flush:",q)}if($0=!1,typeof requestAnimationFrame<"u")this.rafId=requestAnimationFrame(this.tick)};updateFPS(J){if(this.fpsFrames++,this.fpsTime+=J,this.fpsTime>=1000)this.currentFPS=Math.round(this.fpsFrames*1000/this.fpsTime),this.fpsFrames=0,this.fpsTime=0}getFPS(){return this.currentFPS}getLastDelta(){return this.lastFrameTime}isRunning(){return this._isRunning}isInTick(){return $0}getListenerCount(){return this.listeners.length}removeAll(){this.listeners=[],this.stop()}}var g=null,z0=null,X6=100,m=new Map;function K6(J){let $=m.get(J);if($!==void 0)m.delete(J),m.set(J,$);return $}function U6(J,$){if(m.has(J))m.delete(J);while(m.size>=X6){let Q=m.keys().next().value;if(Q!==void 0)m.delete(Q);else break}m.set(J,$)}function I6(J){return/^\s*[Mm]/.test(J)}function RJ(){if(z0)return z0;if(typeof document>"u")throw Error("PathParser requires a browser environment");return g=document.createElementNS("http://www.w3.org/2000/svg","svg"),g.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;",g.setAttribute("aria-hidden","true"),z0=document.createElementNS("http://www.w3.org/2000/svg","path"),g.appendChild(z0),document.body.appendChild(g),z0}function bJ(J){if(J instanceof Element)return J.getAttribute("d");if(typeof J==="string"){if(I6(J))return J;if(typeof document<"u"){let $=document.querySelector(J);if($)return $.getAttribute("d")}}return null}function xJ(J){let $=K6(J);if($!==void 0)return $;try{let Q=RJ();Q.setAttribute("d",J);let q=Q.getTotalLength();return U6(J,q),q}catch{return 0}}function $J(J,$,Q=!1){try{let q=RJ();q.setAttribute("d",J);let Z=q.getTotalLength(),j=Math.max(0,Math.min(1,$)),z=Z*j,G=q.getPointAtLength(z),N=0;if(Q)N=A6(q,z,Z);return{x:G.x,y:G.y,angle:N}}catch{return{x:0,y:0,angle:0}}}function A6(J,$,Q){let q=Math.min(0.1,Q*0.001),Z=Math.max(0,$-q),j=Math.min(Q,$+q),z=J.getPointAtLength(Z),G=J.getPointAtLength(j),N=G.x-z.x,W=G.y-z.y;return Math.atan2(W,N)*(180/Math.PI)}function CJ(J,$=[50,50]){if(!J)return{x:0,y:0};let Q=null;if(J instanceof Element)Q=J;else if(typeof J==="string"&&typeof document<"u")Q=document.querySelector(J);if(!Q||typeof Q.getBoundingClientRect!=="function")return{x:0,y:0};let q=Q.getBoundingClientRect(),Z=q.width*$[0]/100,j=q.height*$[1]/100;return{x:Z,y:j}}function VJ(J,$,Q){if(!J)return{x:0,y:0};let q=null;if(J instanceof Element)q=J;else if(typeof J==="string"&&typeof document<"u")q=document.querySelector(J);if(!q)return{x:0,y:0};let Z=$J($,0,!1);if(Q&&Q instanceof HTMLElement){let j=Q.style.transform,z=j&&j!=="none"&&j!=="";if(z)Q.style.transform="none";let G=Q.getBoundingClientRect(),N=q.getBoundingClientRect();if(z)Q.style.transform=j;let W=N.left+N.width/2-(G.left+G.width/2),B=N.top+N.height/2-(G.top+G.height/2);return{x:W-Z.x,y:B-Z.y}}return{x:-Z.x,y:-Z.y}}function wJ(){if(g&&g.parentNode)g.parentNode.removeChild(g);g=null,z0=null,m.clear()}var F6=new Set(["perspective","x","y","z","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skewX","skewY"]),O6=new Set(["perspective","x","y","z","width","height","top","left","right","bottom","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","borderRadius","fontSize","lineHeight"]),L6=new Set(["rotate","rotateX","rotateY","rotateZ","skewX","skewY"]),M6=new Set(["opacity","scale","scaleX","scaleY","scaleZ","z-index","zIndex"]),k6=new Set(["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor","textDecorationColor","caretColor","fill","stroke"]),D6=new Set(["red","green","blue","yellow","orange","purple","pink","cyan","magenta","white","black","gray","grey","transparent","crimson","gold","silver","navy","teal","maroon","olive","lime","aqua","fuchsia","coral","salmon","tomato","indigo"]);function T(J){return F6.has(J)}function Q0(J){return k6.has(J)}function n(J){return J==="filter"}function QJ(J){return J==="drawSVG"}function qJ(J){return J==="path"}function q0(J){return J.startsWith("--")}function PJ(J){if(typeof J!=="string")return!1;let $=J.trim().toLowerCase();if($.startsWith("#"))return!0;if(/^(rgb|rgba|hsl|hsla)\s*\(/.test($))return!0;let Q=X.color;if(Q)return Q.parseColor($)!==null;return D6.has($)}function i(J){if(typeof J==="number"){if(isNaN(J)||!isFinite(J))return console.warn(`[Motion] Property value is ${J}. This property will not animate correctly.`),{value:0,unit:""};return{value:J,unit:""}}if(typeof J==="string"){let $=J.match(/^([+\-*/])=(.+)/);if($){let q=$[2].match(/([-+]?[\d.]+(?:e[-+]?\d+)?)([a-z%]*)/i);if(q)return{value:parseFloat(q[1]),unit:q[2]||""}}let Q=J.match(/([-+]?[\d.]+(?:e[-+]?\d+)?)([a-z%]*)/i);if(Q)return{value:parseFloat(Q[1]),unit:Q[2]||""}}return{value:0,unit:""}}function _0(J){if(M6.has(J))return"";if(L6.has(J))return"deg";if(O6.has(J))return"px";return""}function SJ(J){if(J==="opacity")return 1;if(J.startsWith("scale"))return 1;return 0}function E0(J,$){if(!(J instanceof Element)){let Q=J;if($ in Q)return Q[$];return E6($)}if(T($))return r0(J,$);try{if(typeof window<"u"&&window.getComputedStyle){let q=window.getComputedStyle(J).getPropertyValue(s($));if(q)return i(q).value}}catch(Q){}return SJ($)}function yJ(J,$){let Q=J,q=s($);if(T($)){let Z=Q.style.transform;y(J),Q.style.transform="";let j=r0(J,$);return Q.style.transform=Z,y(J),{value:j,unit:_0($)}}try{if(typeof window<"u"&&window.getComputedStyle){let Z=Q.style.getPropertyValue(q);Q.style.removeProperty(q);let z=window.getComputedStyle(J).getPropertyValue(q);if(Z)Q.style.setProperty(q,Z);if(z){let G=i(z);return{value:G.value,unit:G.unit}}}}catch(Z){}return{value:SJ($),unit:_0($)}}function E6(J){if(J.startsWith("scale"))return 1;return 0}function s(J){return J.replace(/[A-Z]/g,($)=>`-${$.toLowerCase()}`)}function R6(J){if(typeof J==="string")return/^[+\-*/]=/.test(J);return!1}function b6(J){let $=J.match(/^([+\-*/])=/);return $?$[0]:null}function x6(J,$,Q){switch(Q){case"+=":return J+$;case"-=":return J-$;case"*=":return J*$;case"/=":return $!==0?J/$:J;default:return $}}function C6(J,$,Q,q){let Z=X.color;if(!Z)return null;let j=String(Q),z=j===""?Z.getCurrentColor(J,$):Z.parseColor(j,J),G=q!==void 0?Z.parseColor(String(q),J):Z.getCurrentColor(J,$);return{type:"color",property:$,isTransform:!1,startColor:G||new Float32Array([0,0,0,1]),endColor:z||new Float32Array([0,0,0,1])}}function V6(J,$,Q,q){let Z=X.filter;if(!Z)return null;let j=String(Q),z=j===""?Z.getCurrentFilter(J):Z.parseFilter(j),G=q!==void 0?Z.parseFilter(String(q)):Z.getCurrentFilter(J);G=G||[],z=z||[];let N=Z.mergeFilterArrays(G,z);return{type:"filter",property:$,isTransform:!1,startFilters:N.start,endFilters:N.end}}function w6(J,$,Q,q){if(PJ(Q)||q!==void 0&&PJ(q)){let G=X.color;if(G){let N=String(Q),W=G.parseColor(N,J),B=q!==void 0?G.parseColor(String(q),J):P6(J,$);return{type:"color",property:$,isTransform:!1,startColor:B||new Float32Array([0,0,0,1]),endColor:W||new Float32Array([0,0,0,1])}}}let j=i(Q),z;if(q!==void 0)z=i(q).value;else z=S6(J,$);return{type:"scalar",property:$,isTransform:!1,startValue:z,endValue:j.value,unit:j.unit}}function P6(J,$){let Q=X.color;if(!Q)return null;try{if(typeof window<"u"&&window.getComputedStyle){let Z=window.getComputedStyle(J).getPropertyValue($).trim();if(Z)return Q.parseColor(Z,J)}}catch{}return null}function S6(J,$){try{if(typeof window<"u"&&window.getComputedStyle){let q=window.getComputedStyle(J).getPropertyValue($).trim();if(q)return i(q).value}}catch{}return 0}function y6(J,$,Q,q){let Z=X.drawSVG;if(!Z)return null;let j=Z.getPathLength(J),z=Z.parseDrawSVG(Q,J)||{start:0,end:1},G=q!==void 0?Z.parseDrawSVG(q,J)||{start:0,end:1}:Z.getCurrentDrawSVG(J);return{type:"drawSVG",property:$,isTransform:!1,startDraw:G,endDraw:z,length:j}}function v6(J,$,Q,q){let Z=Q,j=q,z=Z?.target?Z:j;if(!z?.target)return null;let G=bJ(z.target);if(!G)return null;let N=xJ(G);if(N===0)return null;let W,B;if(Z?.target&&j?.target)W=j.start??0,B=Z.end??1;else if(Z?.target)W=Z.start??0,B=Z.end??1;else W=j.start??0,B=j.end??1;let Y=Z?.rotate??j?.rotate??!1,U=Z?.alignAt??j?.alignAt??[50,50],_=CJ(J,U),H=Z?.align??j?.align,I=VJ(H,G,J);return{type:"path",property:$,isTransform:!1,pathData:G,pathLength:N,startProgress:W,endProgress:B,rotate:Y,alignOffset:_,pathOffset:I}}function vJ(J,$,Q,q){let Z=J instanceof Element;if(Z&&q0($))return w6(J,$,Q,q);if(Z&&Q0($)){let B=C6(J,$,Q,q);if(B)return B}if(Z&&n($)){let B=V6(J,$,Q,q);if(B)return B}if(Z&&QJ($)){let B=y6(J,$,Q,q);if(B)return B}if(Z&&qJ($)){let B=v6(J,$,Q,q);if(B)return B}let j=T($),z=q===void 0&&R6(Q),G,N,W;if(q!==void 0){let B=i(q),Y=i(Q);G=B.value,N=Y.value,W=Y.unit||B.unit||_0($)}else if(z){let B=b6(Q),Y=E0(J,$),U=i(Q);G=Y,N=x6(Y,U.value,B),W=U.unit||_0($)}else{let B=E0(J,$),Y=i(Q);G=B,N=Y.value,W=Y.unit||_0($)}return{type:"scalar",property:$,isTransform:j,startValue:G,endValue:N,unit:W}}function hJ(){let J=new WeakMap;return{register($,Q){let q=J.get($);if(!q)q=new Set,J.set($,q);q.add(Q)},registerMany($,Q){for(let q of Q)this.register($,q)},get($){return J.get($)},clearRegistry($){J.delete($)}}}var ZJ=hJ(),R0=new WeakMap,jJ=hJ();function TJ(J){if(T(J))return["transform"];if(n(J))return["filter"];if(QJ(J))return["strokeDasharray","strokeDashoffset"];return[J]}function h6(J,$){if(T($)&&!R0.has(J)){if(J instanceof HTMLElement||J instanceof SVGElement){let q=J.style.transform;R0.set(J,q||null)}}let Q=TJ($);for(let q of Q)ZJ.register(J,q)}function T6(J,$){for(let Q of $)h6(J,Q)}function f6(J){ZJ.clearRegistry(J),R0.delete(J)}function u6(J,$){if(!(J instanceof HTMLElement)&&!(J instanceof SVGElement))return;let Q=new Set;for(let q of $)for(let Z of TJ(q))Q.add(Z);for(let q of Q)if(q0(q))J.style.removeProperty(q);else J.style[q]=""}function d6(J){if(!(J instanceof HTMLElement)&&!(J instanceof SVGElement))return;let $=ZJ.get(J);if(!$||$.size===0)return;for(let Q of $){if(Q==="transform"){let q=R0.get(J);if(q!==void 0){if(q)J.style.transform=q;else J.style.removeProperty("transform");continue}}if(q0(Q))J.style.removeProperty(Q);else J.style[Q]=""}}function p6(J){d6(J),f6(J)}function b0(J,$){jJ.registerMany(J,$)}function GJ(J){jJ.clearRegistry(J)}function c6(J){if(!(J instanceof HTMLElement)&&!(J instanceof SVGElement))return;let $=jJ.get(J);if(!$||$.size===0)return;for(let Q of $)J.style[Q]=""}function m6(J){c6(J),GJ(J)}X.styleReset={registerAnimatedProps:T6,clearAnimationStylesForProps:u6,clearAnimationStylesAndUnregister:p6,clearPinStylesAndUnregister:m6};class V{static _registry=new Map;static _users=new Map;static getOrCreate(J,$){let Q=V._registry.get($);if(!Q)Q=new V(J),V._registry.set($,Q);let q=V._users.get($);if(!q)q=new Set,V._users.set($,q);return q.add(J),Q}static release(J,$){let Q=V._users.get($);if(!Q)return;if(Q.delete(J),Q.size===0){let q=V._registry.get($);V._registry.delete($),V._users.delete($),q?.cleanup()}}_id;_element=null;_originalStyles=null;_spacer=null;_currentState="before";_pinStart=0;_pinEnd=0;_pinDistance=0;_useFixedPin=!1;_pinSpacing;_elementHeight=0;_fixedTop=0;_fixedLeft=0;_width=0;_fixedBreakingAncestors=[];constructor(J){this._id=J}setup(J,$,Q,q,Z,j){if(typeof document>"u")return;this._element=J,this._pinStart=$,this._pinEnd=Q;let z=this._pinDistance;this._pinDistance=Q-$,this._useFixedPin=Z,this._pinSpacing=j;let G=this._spacer!==null;if(G&&this._currentState==="pinned"&&Z)this._updateFixed("before");let N=J.getBoundingClientRect(),W=G&&this._spacer?window.getComputedStyle(this._spacer):window.getComputedStyle(J);if(this._elementHeight=N.height,!G)this._originalStyles={position:J.style.position,top:J.style.top,left:J.style.left,width:J.style.width,marginTop:J.style.marginTop,marginBottom:J.style.marginBottom,marginLeft:J.style.marginLeft,marginRight:J.style.marginRight,zIndex:J.style.zIndex};if(Z){this._fixedTop=q,this._fixedLeft=N.left,this._width=N.width;let B=this._resolvePinSpacing(),Y=`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
function w(J,$){switch(J){case"play":case"resume":$.play();break;case"pause":$.pause();break;case"reverse":$.reverse();break;case"restart":$.restart();break;case"reset":$.pause(),$.progress(0);break;case"complete":$.progress(1),$.pause();break;case"none":break;default:console.warn(`[Motion] Unknown timeline action: "${J}". Valid actions: play, pause, resume, reverse, restart, reset, complete, none`)}}var U={color:null,filter:null,drawSVG:null,stagger:null,textSplitter:null,triggerManager:null,styleReset:null,fit:null};class I{static _instance;static _triggerRegistry=new Map;static _pageLoadTriggerFactory=null;static _RESIZE_DEBOUNCE_MS=200;_pageLoadTrigger=null;_scrollTriggers=new Map;_eventTriggers=new Map;_mouseMoveTriggers=new Map;_gestureTriggers=new Map;_cursorTriggers=new Map;_pageExitTriggers=new Map;_resizeHandler=null;_resizeTimer=null;get _allTriggerMaps(){return[this._scrollTriggers,this._eventTriggers,this._mouseMoveTriggers,this._gestureTriggers,this._cursorTriggers,this._pageExitTriggers]}constructor(){}static getInstance(){if(!I._instance)I._instance=new I;return I._instance}static registerTrigger(J,$){I._triggerRegistry.set(J,$)}static registerPageLoadTrigger(J){I._pageLoadTriggerFactory=J}_getPageLoadTrigger(){if(!this._pageLoadTrigger&&I._pageLoadTriggerFactory)this._pageLoadTrigger=new I._pageLoadTriggerFactory;return this._pageLoadTrigger}_createTrigger(J,...$){let Q=I._triggerRegistry.get(J);if(!Q){let q=Array.from(I._triggerRegistry.keys());return console.warn(`[Motion SDK] Trigger type '${J}' is not available in this bundle. Available triggers: ${q.join(", ")||"none"}. Animations using .on${J.charAt(0).toUpperCase()+J.slice(1)}() will be skipped.`),null}return new Q(...$)}registerPageLoad(J,$){this.unregister(J);let Q=this._getPageLoadTrigger();if(Q)Q.register(J,$)}_attachResizeListener(){if(this._resizeHandler||typeof window>"u")return;this._resizeHandler=()=>{if(this._resizeTimer!==null)clearTimeout(this._resizeTimer);this._resizeTimer=setTimeout(()=>{this._resizeTimer=null,this.refreshScrollTriggers()},I._RESIZE_DEBOUNCE_MS)},window.addEventListener("resize",this._resizeHandler,{passive:!0})}_detachResizeListener(){if(!this._resizeHandler||typeof window>"u")return;if(window.removeEventListener("resize",this._resizeHandler),this._resizeTimer!==null)clearTimeout(this._resizeTimer),this._resizeTimer=null;this._resizeHandler=null}registerScroll(J,$){this.unregister(J);let Q=this._createTrigger("scroll",J,$);if(!Q)return;this._scrollTriggers.set(J,Q),J._trigger=Q,Q.enable(),this._attachResizeListener()}registerHover(J,$){this.unregister(J);let Q=this._createTrigger("event",J,{type:"hover",target:$.target,onLeave:$.onLeave,leaveDelay:$.leaveDelay});if(!Q)return;this._eventTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerClick(J,$){this.unregister(J);let Q=this._createTrigger("event",J,{type:"click",target:$.target,secondTarget:$.secondTarget,toggle:$.toggle,preventDefault:$.preventDefault});if(!Q)return;this._eventTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerMouseMove(J,$){this.unregister(J);let Q=this._createTrigger("mouseMove",J,$);if(!Q)return;this._mouseMoveTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerGesture(J,$){this.unregister(J);let Q=this._createTrigger("gesture",J,$);if(!Q)return;this._gestureTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerCursor(J,$){this.unregister(J);let Q=this._createTrigger("cursor",J,$);if(!Q)return;this._cursorTriggers.set(J,Q),J._trigger=Q,Q.enable()}registerPageExit(J,$){this.unregister(J);let Q=this._createTrigger("pageExit",J,$);if(!Q)return;this._pageExitTriggers.set(J,Q),J._trigger=Q,Q.enable()}unregister(J){let $=this._getPageLoadTrigger();if($)$.unregister(J);for(let Q of this._allTriggerMaps){let q=Q.get(J);if(q)q.disable(),Q.delete(J)}if(J._trigger=void 0,this._scrollTriggers.size===0)this._detachResizeListener()}refreshScrollTriggers(){let J=Array.from(this._scrollTriggers.values()),$=typeof window<"u"?window.scrollY:0;J.sort((Q,q)=>{let Z=Q._pinManager?.getLayoutRect?.(),j=q._pinManager?.getLayoutRect?.();if(!Z&&!j)return 0;if(!Z)return 1;if(!j)return-1;return Z.top+$-(j.top+$)}),J.forEach((Q)=>Q.refresh?.()),this._eventTriggers.forEach((Q)=>Q.refresh?.()),this._gestureTriggers.forEach((Q)=>Q.refresh?.()),this._mouseMoveTriggers.forEach((Q)=>Q.refresh?.())}killAll(){let J=this._getPageLoadTrigger();if(J)J.clear();for(let $ of this._allTriggerMaps)$.forEach((Q)=>Q.disable()),$.clear();this._detachResizeListener()}static _reset(){if(I._instance){if(I._instance._pageLoadTrigger)I._instance._pageLoadTrigger._reset();I._instance.killAll(),I._instance=void 0}}}U.triggerManager={getInstance:I.getInstance};function LJ(J){if(typeof document>"u"){J();return}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",J,{once:!0});else J()}function OJ(J){if(J===null||typeof J!=="object")return!1;if(J instanceof Element)return!1;if("nodeType"in J)return!1;if("style"in J)return!1;let $=J;if("x"in $&&typeof $.x==="number")return!0;if("length"in J)return!1;return!0}function a0(J){return J instanceof Element||typeof J==="object"&&J!==null&&(("nodeType"in J)||("style"in J))}function M0(J){if(OJ(J))return[J];if(typeof J==="string"){if(typeof document<"u")try{return Array.from(document.querySelectorAll(J))}catch($){return console.warn(`[Motion] Invalid selector "${J}":`,$),[]}return[]}if(J instanceof Element)return[J];if(J&&typeof J==="object"&&"style"in J&&!Array.isArray(J))return[J];if(J instanceof NodeList)return Array.from(J);if(Array.isArray(J)){if(J.length===0)return[];if(typeof J[0]==="string"){if(typeof document>"u")return[];let $=[];for(let Q of J)try{$.push(...Array.from(document.querySelectorAll(Q)))}catch(q){console.warn(`[Motion] Invalid selector "${Q}":`,q)}return $}if(OJ(J[0]))return J;return J}if(J&&typeof J==="object"&&"length"in J)return Array.from(J);return[]}class T{_timeline;_config;_enabled=!1;constructor(J,$){this._timeline=J,this._config=$}enable(){if(this._enabled)return;this._enabled=!0,LJ(()=>{if(!this._enabled)return;this._onEnable()})}disable(){if(!this._enabled)return;this._enabled=!1,this._onDisable()}_resolveElement(J,$){if(J===void 0||J===null)return $??null;if(typeof J!=="string")return J;if(typeof document<"u")try{let Q=document.querySelector(J);if(Q!==null)return Q}catch(Q){console.warn(`[Motion] Invalid selector "${J}":`,Q)}return $??null}_resolveElements(J){if(J===void 0||J===null)return[];if(typeof J!=="string")return[J];if(typeof document<"u")try{let $=document.querySelectorAll(J);return Array.from($)}catch($){return console.warn(`[Motion] Invalid selector "${J}":`,$),[]}return[]}_cleanupListenerMap(J){J.forEach(($,Q)=>{$.forEach((q,Z)=>{Q.removeEventListener(Z,q)})}),J.clear()}}function u(J){let $=J,Q=$.style.transform,q=$.style.transition;$.style.transition="none",$.style.transform="none";let Z=!1,j=$.style.position,G=$.style.top,z=$.style.left,W=$.style.width;if(j==="fixed")Z=!0;else if(j===""||j===void 0){if(typeof window<"u"&&typeof window.getComputedStyle==="function"&&window.getComputedStyle($).position==="fixed")Z=!0}if(Z)$.style.position="",$.style.top="",$.style.left="",$.style.width="";let N=$.getBoundingClientRect();if($.style.transform=Q,$.style.transition=q,Z)$.style.position=j,$.style.top=G,$.style.left=z,$.style.width=W;return N}class MJ extends T{_targets=[];_secondTargets=[];_listeners=new Map;_isForward=!0;_frozenRects=new Map;_snapshotScrollX=0;_snapshotScrollY=0;_wasHovering=!1;_hoverLeaveTimeout=null;_boundMouseMoveHandler=null;constructor(J,$){super(J,$)}_onEnable(){if(this._resolveTargets(),this._config.type==="hover")this._addHoverListeners();else if(this._config.type==="click")this._addClickListeners()}_onDisable(){if(this._boundMouseMoveHandler)window.removeEventListener("mousemove",this._boundMouseMoveHandler),this._boundMouseMoveHandler=null;if(this._hoverLeaveTimeout!==null)clearTimeout(this._hoverLeaveTimeout),this._hoverLeaveTimeout=null;this._frozenRects.clear(),this._wasHovering=!1,this._cleanupListenerMap(this._listeners)}refresh(){if(this._config.type!=="hover")return;this._snapshotRects()}_snapshotRects(){this._snapshotScrollX=window.scrollX||0,this._snapshotScrollY=window.scrollY||0;for(let J of this._targets)this._frozenRects.set(J,u(J))}_resolveTargets(){if(this._targets=this._resolveElements(this._config.target),this._config.secondTarget)this._secondTargets=this._resolveElements(this._config.secondTarget);else this._secondTargets=this._targets}_addHoverListeners(){let J=this._config.onLeave||"reverse",$=this._config.leaveDelay||0;this._snapshotRects(),this._boundMouseMoveHandler=(Q)=>{let q=(window.scrollX||0)-this._snapshotScrollX,Z=(window.scrollY||0)-this._snapshotScrollY,j=Q.clientX+q,G=Q.clientY+Z,z=!1;for(let W of this._frozenRects.values())if(j>=W.left&&j<=W.right&&G>=W.top&&G<=W.bottom){z=!0;break}if(z&&!this._wasHovering){if(this._wasHovering=!0,this._hoverLeaveTimeout!==null)clearTimeout(this._hoverLeaveTimeout),this._hoverLeaveTimeout=null;this._timeline.play()}else if(!z&&this._wasHovering){if(this._wasHovering=!1,J==="none")return;let W=()=>{this._handleLeaveAction(J),this._hoverLeaveTimeout=null};if($>0)this._hoverLeaveTimeout=window.setTimeout(W,$*1000);else W()}},window.addEventListener("mousemove",this._boundMouseMoveHandler)}_handleLeaveAction(J){w(J==="stop"?"reset":J,this._timeline)}_addClickListeners(){let J=this._config.toggle||"play",$=this._config.preventDefault||!1,Q=this._config.secondTarget&&this._config.secondTarget!==this._config.target;if(this._targets.forEach((q)=>{let Z=this._listeners.get(q)||new Map,j=(G)=>{if($)G.preventDefault();if(!Q)if(this._isForward){if(this._timeline.restart(),J!=="play")this._isForward=!1}else this._handleSecondClick(J),this._isForward=!0;else this._timeline.restart()};q.addEventListener("click",j),Z.set("click",j),this._listeners.set(q,Z)}),Q)this._secondTargets.forEach((q)=>{if(this._listeners.has(q))return;let Z=new Map,j=(G)=>{if($)G.preventDefault();this._handleSecondClick(J)};q.addEventListener("click",j),Z.set("click",j),this._listeners.set(q,Z)})}_handleSecondClick(J){w(J,this._timeline)}}I.registerTrigger("event",MJ);var e0={perspective:0,x:1,y:2,z:3,rotate:4,rotateX:5,rotateY:6,rotateZ:7,scale:8,scaleX:9,scaleY:10,scaleZ:11,skewX:12,skewY:13},DJ=["px","px","px","px","deg","deg","deg","deg","","","","","deg","deg"],G0=new WeakMap,k0=new WeakMap,D=[];function m(J){let $=J.trim().match(/([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z%]*)/i);if(!$)return{value:0,unit:""};return{value:parseFloat($[1]),unit:$[2]||""}}function j0(J,$){switch($){case"rad":return J*180/Math.PI;case"turn":return J*360;case"grad":return J*0.9;default:return J}}function r(J){let $=m(J);return j0($.value,$.unit||"deg")}function A(J,$,Q,q){let Z=e0[$];if(Z===void 0)return;J.values[Z]=Q;let j=q&&q.length>0?q:DJ[Z]||"";J.units[Z]=j,J.used|=1<<Z}function H6(J,$){let Q=/([a-zA-Z0-9]+)\(([^)]+)\)/g,q;while((q=Q.exec(J))!==null){let Z=q[1],j=q[2].match(/[-+]?\d*\.?\d+(?:e[-+]?\d+)?[a-z%]*/gi)||[];switch(Z){case"translate":{let G=j[0]?m(j[0]):{value:0,unit:""},z=j[1]?m(j[1]):{value:0,unit:""};A($,"x",G.value,G.unit),A($,"y",z.value,z.unit);break}case"translate3d":{let G=j[0]?m(j[0]):{value:0,unit:""},z=j[1]?m(j[1]):{value:0,unit:""},W=j[2]?m(j[2]):{value:0,unit:""};A($,"x",G.value,G.unit),A($,"y",z.value,z.unit),A($,"z",W.value,W.unit);break}case"translateX":{let G=j[0]?m(j[0]):{value:0,unit:""};A($,"x",G.value,G.unit);break}case"translateY":{let G=j[0]?m(j[0]):{value:0,unit:""};A($,"y",G.value,G.unit);break}case"translateZ":{let G=j[0]?m(j[0]):{value:0,unit:""};A($,"z",G.value,G.unit);break}case"scale":{let G=j[0]?parseFloat(j[0]):1,z=j[1]?parseFloat(j[1]):G;A($,"scaleX",G),A($,"scaleY",z);break}case"scale3d":{let G=j[0]?parseFloat(j[0]):1,z=j[1]?parseFloat(j[1]):1,W=j[2]?parseFloat(j[2]):1;A($,"scaleX",G),A($,"scaleY",z),A($,"scaleZ",W);break}case"scaleX":{let G=j[0]?parseFloat(j[0]):1;A($,"scaleX",G);break}case"scaleY":{let G=j[0]?parseFloat(j[0]):1;A($,"scaleY",G);break}case"scaleZ":{let G=j[0]?parseFloat(j[0]):1;A($,"scaleZ",G);break}case"rotate":A($,"rotate",j[0]?r(j[0]):0,"deg");break;case"rotateX":A($,"rotateX",j[0]?r(j[0]):0,"deg");break;case"rotateY":A($,"rotateY",j[0]?r(j[0]):0,"deg");break;case"rotateZ":A($,"rotateZ",j[0]?r(j[0]):0,"deg");break;case"skew":{let G=j[0]?r(j[0]):0,z=j[1]?r(j[1]):0;A($,"skewX",G,"deg"),A($,"skewY",z,"deg");break}case"skewX":A($,"skewX",j[0]?r(j[0]):0,"deg");break;case"skewY":A($,"skewY",j[0]?r(j[0]):0,"deg");break;case"perspective":{let G=j[0]?m(j[0]):{value:0,unit:""};A($,"perspective",G.value,G.unit);break}default:break}}}function r0(J,$,Q,q,Z,j,G,z,W,N,B,_,K,H){if(K){let $0=Math.hypot(J,$),N6=J*Z-$*q,B6=$0!==0?N6/$0:0,_6=$0!==0?Math.atan2($,J):0,IJ=$0!==0?Math.atan2(J*q+$*Z,$0*$0):0;if(A(H,"x",N,"px"),A(H,"y",B,"px"),A(H,"scaleX",$0||1),A(H,"scaleY",B6||1),A(H,"rotate",j0(_6,"rad"),"deg"),Math.abs(IJ)>0.000001)A(H,"skewX",j0(IJ,"rad"),"deg");return}let Y=Math.hypot(J,$,Q)||1,F=Math.hypot(q,Z,j)||1,X=Math.hypot(G,z,W)||1,M=J/Y,k=$/Y,L=Q/Y,O=q/F,h=Z/F,s0=j/F,AJ=G/X,G6=z/X,z6=W/X,l0=Math.sqrt(M*M+O*O),W6=l0<0.000001,o0=0,i0=0,n0=0;if(!W6)o0=Math.atan2(G6,z6),i0=Math.atan2(-AJ,l0),n0=Math.atan2(O,M);else o0=Math.atan2(-s0,h),i0=Math.atan2(-AJ,l0),n0=0;A(H,"x",N,"px"),A(H,"y",B,"px"),A(H,"z",_,"px"),A(H,"scaleX",Y),A(H,"scaleY",F),A(H,"scaleZ",X),A(H,"rotateX",j0(o0,"rad"),"deg"),A(H,"rotateY",j0(i0,"rad"),"deg"),A(H,"rotateZ",j0(n0,"rad"),"deg")}function Y6(J,$){if(!J||J==="none")return;if(typeof DOMMatrixReadOnly<"u"){let q=new DOMMatrixReadOnly(J);r0(q.m11,q.m12,q.m13,q.m21,q.m22,q.m23,q.m31,q.m32,q.m33,q.m41,q.m42,q.m43,q.is2D,$);return}let Q=J.match(/[-+]?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];if(J.startsWith("matrix3d")&&Q.length>=16){let q=Q.map(Number);r0(q[0],q[1],q[2],q[4],q[5],q[6],q[8],q[9],q[10],q[12],q[13],q[14],!1,$);return}if(J.startsWith("matrix")&&Q.length>=6){let q=Q.map(Number);r0(q[0],q[1],0,q[2],q[3],0,0,0,1,q[4],q[5],0,!0,$)}}function K6(J,$){if(!(J instanceof HTMLElement)&&!(J instanceof SVGElement))return;let q=J.style.transform;if(q&&q!=="none"){H6(q,$),$.cachedString=q;return}try{if(typeof window<"u"&&window.getComputedStyle){let Z=window.getComputedStyle(J),j=Z.transform||Z.getPropertyValue("transform");if(j&&j!=="none")Y6(j,$),$.cachedString=j}}catch{}}function bJ(J){let $=G0.get(J);if(!$){let Q=new Float32Array(14);Q[8]=1,Q[9]=1,Q[10]=1,Q[11]=1,$={values:Q,units:[...DJ],dirty:0,used:0,cachedString:"",pinDirty:!1},K6(J,$),G0.set(J,$)}return $}function y(J,$,Q,q){let Z=bJ(J),j=e0[$];if(j!==void 0){if(Z.values[j]=Q,q!==void 0)Z.units[j]=q;if(Z.used|=1<<j,$==="scale")Z.values[9]=Q,Z.values[10]=Q,Z.dirty|=1536;else if($==="scaleX"||$==="scaleY")Z.values[8]=1,Z.dirty|=256;if($==="rotate")Z.values[7]=0,Z.dirty|=128;else if($==="rotateZ")Z.values[4]=0,Z.dirty|=16;Z.dirty|=1<<j}}function JJ(J,$){let Q=bJ(J),q=e0[$];if(q===void 0)return $.startsWith("scale")?1:0;if($==="scale"){if(Q.values[q]!==1)return Q.values[q];let Z=Q.values[9],j=Q.values[10];if(Math.abs(Z-j)<0.000001&&Z!==1)return Z;return Q.values[q]}if($==="rotate"){if(Q.values[q]!==0)return Q.values[q];let Z=Q.values[7];if(Z!==0&&Q.values[5]===0&&Q.values[6]===0)return Z;return Q.values[q]}return Q.values[q]}function t0(J){return J===0?"0":`${Math.round(J)}px`}function kJ(J,$,Q){return`translate3d(${t0(J)}, ${t0($)}, ${t0(Q)})`}function D0(J,$,Q,q){k0.set(J,{x:$,y:Q,z:q});let Z=G0.get(J);if(Z)Z.pinDirty=!0}function z0(J){let $=k0.has(J);if(k0.delete(J),$){let Q=G0.get(J);if(Q)Q.pinDirty=!0}}function b(J){let $=G0.get(J),Q=k0.get(J);if(!$){if(Q&&(Q.x!==0||Q.y!==0||Q.z!==0))return kJ(Q.x,Q.y,Q.z);return""}if($.dirty===0&&!$.pinDirty&&$.cachedString)return $.cachedString;let{values:q,units:Z}=$;D.length=0;let j=$.used,G=q[0];if(G!==0){let O=Z[0];D.push(`perspective(${G}${O})`)}let z=q[1],W=q[2],N=q[3],B=Z[1],_=Z[2],K=Z[3],H=j&2,Y=j&4,F=j&8;if(z!==0||W!==0||N!==0||H||Y||F){let O=B===_&&(N===0&&!F||_===K);if(N!==0||F)if(O)D.push(`translate3d(${z}${B}, ${W}${_}, ${N}${K})`);else{if(z!==0||H)D.push(`translateX(${z}${B})`);if(W!==0||Y)D.push(`translateY(${W}${_})`);D.push(`translateZ(${N}${K})`)}else if(O&&(z!==0||H)&&(W!==0||Y))D.push(`translate(${z}${B}, ${W}${_})`);else{if(z!==0||H)D.push(`translateX(${z}${B})`);if(W!==0||Y)D.push(`translateY(${W}${_})`)}}if(q[4]!==0||j&16)D.push(`rotate(${q[4]}deg)`);if(q[5]!==0||j&32)D.push(`rotateX(${q[5]}deg)`);if(q[6]!==0||j&64)D.push(`rotateY(${q[6]}deg)`);if(q[7]!==0||j&128)D.push(`rotateZ(${q[7]}deg)`);let X=j&256,M=j&512,k=j&1024;if(q[8]!==1||X)D.push(`scale(${q[8]})`);else if(q[9]!==1||q[10]!==1||M||k)D.push(`scaleX(${q[9]})`),D.push(`scaleY(${q[10]})`);if(q[11]!==1||j&2048)D.push(`scaleZ(${q[11]})`);if(q[12]!==0||j&4096)D.push(`skewX(${q[12]}deg)`);if(q[13]!==0||j&8192)D.push(`skewY(${q[13]}deg)`);let L=D.join(" ");if(Q&&(Q.x!==0||Q.y!==0||Q.z!==0)){let O=kJ(Q.x,Q.y,Q.z);$.cachedString=L?`${O} ${L}`:O}else $.cachedString=L;return $.dirty=0,$.pinDirty=!1,$.cachedString}function P(J,$=!1){if(G0.delete(J),$&&J instanceof HTMLElement)J.style.transform=""}var $J=new Set,b0=new Map,R0=!1;function E0(J){$J.add(J),R0=!0}function x0(J,$,Q){let q=b0.get(J);if(!q)q=new Map,b0.set(J,q);q.set($,Q),R0=!0}function QJ(){if(!R0)return;for(let J of $J){let $=J;if($.style){let Q=b(J);$.style.transform=Q}}$J.clear();for(let[J,$]of b0){let Q=J;if(Q.style)for(let[q,Z]of $)try{if(q.startsWith("--"))Q.style.setProperty(q,Z);else Q.style[q]=Z}catch{}}b0.clear(),R0=!1}var Q0=!1;function W0(){return Q0}function qJ(J){if(Q0){J();return}Q0=!0;try{J(),QJ()}finally{Q0=!1}}class V{static instance;listeners=[];_listenersDirty=!0;_listenersSnapshot=[];_isRunning=!1;rafId=null;lastTime=0;elapsedTime=0;lagThreshold=500;maxDelta=33;fpsFrames=0;fpsTime=0;currentFPS=60;lastFrameTime=0;constructor(){}static getInstance(){if(!V.instance)V.instance=new V;return V.instance}add(J,$=0){let Q=this.listeners.findIndex((q)=>q.callback===J);if(Q!==-1)this.listeners[Q].priority=$;else this.listeners.push({callback:J,priority:$});if(this.listeners.sort((q,Z)=>Z.priority-q.priority),this._listenersDirty=!0,!this._isRunning&&this.listeners.length>0)this.start()}remove(J){let $=this.listeners.findIndex((Q)=>Q.callback===J);if($!==-1)this.listeners.splice($,1),this._listenersDirty=!0;if(this.listeners.length===0&&this._isRunning)this.stop()}start(){if(this._isRunning)return;if(typeof requestAnimationFrame>"u"){this._isRunning=!1;return}this._isRunning=!0,this.lastTime=performance.now(),this.rafId=requestAnimationFrame(this.tick)}stop(){if(!this._isRunning)return;if(this._isRunning=!1,this.rafId!==null&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.rafId),this.rafId=null}pause(){this.stop()}resume(){if(this.listeners.length>0)this.start()}tick=()=>{if(!this._isRunning)return;let J=performance.now(),$=J-this.lastTime;if($>this.lagThreshold)$=this.maxDelta,this.lastTime=J-$;else this.lastTime=J;let Q=$/1000;if(this.elapsedTime+=Q,this.lastFrameTime=$,this.updateFPS($),Q0=!0,this._listenersDirty)this._listenersSnapshot=[...this.listeners],this._listenersDirty=!1;for(let q of this._listenersSnapshot)try{q.callback(Q,this.elapsedTime)}catch(Z){console.error("[Motion] Uncaught error in animation callback:",Z)}try{QJ()}catch(q){console.error("[Motion] Uncaught error in render batch flush:",q)}if(Q0=!1,typeof requestAnimationFrame<"u")this.rafId=requestAnimationFrame(this.tick)};updateFPS(J){if(this.fpsFrames++,this.fpsTime+=J,this.fpsTime>=1000)this.currentFPS=Math.round(this.fpsFrames*1000/this.fpsTime),this.fpsFrames=0,this.fpsTime=0}getFPS(){return this.currentFPS}getLastDelta(){return this.lastFrameTime}isRunning(){return this._isRunning}isInTick(){return Q0}getListenerCount(){return this.listeners.length}removeAll(){this.listeners=[],this.stop()}}var s=null,N0=null,X6=100,g=new Map;function U6(J){let $=g.get(J);if($!==void 0)g.delete(J),g.set(J,$);return $}function F6(J,$){if(g.has(J))g.delete(J);while(g.size>=X6){let Q=g.keys().next().value;if(Q!==void 0)g.delete(Q);else break}g.set(J,$)}function A6(J){return/^\s*[Mm]/.test(J)}function RJ(){if(N0)return N0;if(typeof document>"u")throw Error("PathParser requires a browser environment");return s=document.createElementNS("http://www.w3.org/2000/svg","svg"),s.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;",s.setAttribute("aria-hidden","true"),N0=document.createElementNS("http://www.w3.org/2000/svg","path"),s.appendChild(N0),document.body.appendChild(s),N0}function EJ(J){if(J instanceof Element)return J.getAttribute("d");if(typeof J==="string"){if(A6(J))return J;if(typeof document<"u"){let $=document.querySelector(J);if($)return $.getAttribute("d")}}return null}function xJ(J){let $=U6(J);if($!==void 0)return $;try{let Q=RJ();Q.setAttribute("d",J);let q=Q.getTotalLength();return F6(J,q),q}catch{return 0}}function ZJ(J,$,Q=!1){try{let q=RJ();q.setAttribute("d",J);let Z=q.getTotalLength(),j=Math.max(0,Math.min(1,$)),G=Z*j,z=q.getPointAtLength(G),W=0;if(Q)W=I6(q,G,Z);return{x:z.x,y:z.y,angle:W}}catch{return{x:0,y:0,angle:0}}}function I6(J,$,Q){let q=Math.min(0.1,Q*0.001),Z=Math.max(0,$-q),j=Math.min(Q,$+q),G=J.getPointAtLength(Z),z=J.getPointAtLength(j),W=z.x-G.x,N=z.y-G.y;return Math.atan2(N,W)*(180/Math.PI)}function VJ(J,$=[50,50]){if(!J)return{x:0,y:0};let Q=null;if(J instanceof Element)Q=J;else if(typeof J==="string"&&typeof document<"u")Q=document.querySelector(J);if(!Q||typeof Q.getBoundingClientRect!=="function")return{x:0,y:0};let q=Q.getBoundingClientRect(),Z=q.width*$[0]/100,j=q.height*$[1]/100;return{x:Z,y:j}}function CJ(J,$,Q){if(!J)return{x:0,y:0};let q=null;if(J instanceof Element)q=J;else if(typeof J==="string"&&typeof document<"u")q=document.querySelector(J);if(!q)return{x:0,y:0};let Z=ZJ($,0,!1);if(Q&&Q instanceof HTMLElement){let j=Q.style.transform,G=j&&j!=="none"&&j!=="";if(G)Q.style.transform="none";let z=Q.getBoundingClientRect(),W=q.getBoundingClientRect();if(G)Q.style.transform=j;let N=W.left+W.width/2-(z.left+z.width/2),B=W.top+W.height/2-(z.top+z.height/2);return{x:N-Z.x,y:B-Z.y}}return{x:-Z.x,y:-Z.y}}function wJ(){if(s&&s.parentNode)s.parentNode.removeChild(s);s=null,N0=null,g.clear()}var O6=new Set(["perspective","x","y","z","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skewX","skewY"]),L6=new Set(["perspective","x","y","z","width","height","top","left","right","bottom","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","borderRadius","fontSize","lineHeight"]),M6=new Set(["rotate","rotateX","rotateY","rotateZ","skewX","skewY"]),k6=new Set(["opacity","scale","scaleX","scaleY","scaleZ","z-index","zIndex"]),D6=new Set(["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor","textDecorationColor","caretColor","fill","stroke"]),b6=new Set(["red","green","blue","yellow","orange","purple","pink","cyan","magenta","white","black","gray","grey","transparent","crimson","gold","silver","navy","teal","maroon","olive","lime","aqua","fuchsia","coral","salmon","tomato","indigo"]);function f(J){return O6.has(J)}function q0(J){return D6.has(J)}function a(J){return J==="filter"}function jJ(J){return J==="drawSVG"}function GJ(J){return J==="path"}function Z0(J){return J.startsWith("--")}function PJ(J){if(typeof J!=="string")return!1;let $=J.trim().toLowerCase();if($.startsWith("#"))return!0;if(/^(rgb|rgba|hsl|hsla)\s*\(/.test($))return!0;let Q=U.color;if(Q)return Q.parseColor($)!==null;return b6.has($)}function i(J){if(typeof J==="number"){if(isNaN(J)||!isFinite(J))return console.warn(`[Motion] Property value is ${J}. This property will not animate correctly.`),{value:0,unit:""};return{value:J,unit:""}}if(typeof J==="string"){let $=J.match(/^([+\-*/])=(.+)/);if($){let q=$[2].match(/([-+]?[\d.]+(?:e[-+]?\d+)?)([a-z%]*)/i);if(q)return{value:parseFloat(q[1]),unit:q[2]||""}}let Q=J.match(/([-+]?[\d.]+(?:e[-+]?\d+)?)([a-z%]*)/i);if(Q)return{value:parseFloat(Q[1]),unit:Q[2]||""}}return{value:0,unit:""}}function K0(J){if(k6.has(J))return"";if(M6.has(J))return"deg";if(L6.has(J))return"px";return""}function SJ(J){if(J==="opacity")return 1;if(J.startsWith("scale"))return 1;return 0}function n(J,$){if(!(J instanceof Element)){let Q=J;if($ in Q)return Q[$];return R6($)}if(f($))return JJ(J,$);try{if(typeof window<"u"&&window.getComputedStyle){let q=window.getComputedStyle(J).getPropertyValue(l($));if(q)return i(q).value}}catch(Q){}return SJ($)}function yJ(J,$){let Q=J,q=l($);if(f($)){let Z=Q.style.transform;P(J),Q.style.transform="";let j=JJ(J,$);return Q.style.transform=Z,P(J),{value:j,unit:K0($)}}try{if(typeof window<"u"&&window.getComputedStyle){let Z=Q.style.getPropertyValue(q);Q.style.removeProperty(q);let G=window.getComputedStyle(J).getPropertyValue(q);if(Z)Q.style.setProperty(q,Z);if(G){let z=i(G);return{value:z.value,unit:z.unit}}}}catch(Z){}return{value:SJ($),unit:K0($)}}function R6(J){if(J.startsWith("scale"))return 1;return 0}function l(J){return J.replace(/[A-Z]/g,($)=>`-${$.toLowerCase()}`)}function E6(J){if(typeof J==="string")return/^[+\-*/]=/.test(J);return!1}function x6(J){let $=J.match(/^([+\-*/])=/);return $?$[0]:null}function V6(J,$,Q){switch(Q){case"+=":return J+$;case"-=":return J-$;case"*=":return J*$;case"/=":return $!==0?J/$:J;default:return $}}function C6(J,$,Q,q){let Z=U.color;if(!Z)return null;let j=String(Q),G=j===""?Z.getCurrentColor(J,$):Z.parseColor(j,J),z=q!==void 0?Z.parseColor(String(q),J):Z.getCurrentColor(J,$);return{type:"color",property:$,isTransform:!1,startColor:z||new Float32Array([0,0,0,1]),endColor:G||new Float32Array([0,0,0,1])}}function w6(J,$,Q,q){let Z=U.filter;if(!Z)return null;let j=String(Q),G=j===""?Z.getCurrentFilter(J):Z.parseFilter(j),z=q!==void 0?Z.parseFilter(String(q)):Z.getCurrentFilter(J);z=z||[],G=G||[];let W=Z.mergeFilterArrays(z,G);return{type:"filter",property:$,isTransform:!1,startFilters:W.start,endFilters:W.end}}function P6(J,$,Q,q){if(PJ(Q)||q!==void 0&&PJ(q)){let z=U.color;if(z){let W=String(Q),N=z.parseColor(W,J),B=q!==void 0?z.parseColor(String(q),J):S6(J,$);return{type:"color",property:$,isTransform:!1,startColor:B||new Float32Array([0,0,0,1]),endColor:N||new Float32Array([0,0,0,1])}}}let j=i(Q),G;if(q!==void 0)G=i(q).value;else G=y6(J,$);return{type:"scalar",property:$,isTransform:!1,startValue:G,endValue:j.value,unit:j.unit}}function S6(J,$){let Q=U.color;if(!Q)return null;try{if(typeof window<"u"&&window.getComputedStyle){let Z=window.getComputedStyle(J).getPropertyValue($).trim();if(Z)return Q.parseColor(Z,J)}}catch{}return null}function y6(J,$){try{if(typeof window<"u"&&window.getComputedStyle){let q=window.getComputedStyle(J).getPropertyValue($).trim();if(q)return i(q).value}}catch{}return 0}function v6(J,$,Q,q){let Z=U.drawSVG;if(!Z)return null;let j=Z.getPathLength(J),G=Z.parseDrawSVG(Q,J)||{start:0,end:1},z=q!==void 0?Z.parseDrawSVG(q,J)||{start:0,end:1}:Z.getCurrentDrawSVG(J);return{type:"drawSVG",property:$,isTransform:!1,startDraw:z,endDraw:G,length:j}}function h6(J,$,Q,q){let Z=Q,j=q,G=Z?.target?Z:j;if(!G?.target)return null;let z=EJ(G.target);if(!z)return null;let W=xJ(z);if(W===0)return null;let N,B;if(Z?.target&&j?.target)N=j.start??0,B=Z.end??1;else if(Z?.target)N=Z.start??0,B=Z.end??1;else N=j.start??0,B=j.end??1;let _=Z?.rotate??j?.rotate??!1,K=Z?.alignAt??j?.alignAt??[50,50],H=VJ(J,K),Y=Z?.align??j?.align,F=CJ(Y,z,J);return{type:"path",property:$,isTransform:!1,pathData:z,pathLength:W,startProgress:N,endProgress:B,rotate:_,alignOffset:H,pathOffset:F}}function vJ(J,$,Q,q){let Z=J instanceof Element;if(Z&&Z0($))return P6(J,$,Q,q);if(Z&&q0($)){let B=C6(J,$,Q,q);if(B)return B}if(Z&&a($)){let B=w6(J,$,Q,q);if(B)return B}if(Z&&jJ($)){let B=v6(J,$,Q,q);if(B)return B}if(Z&&GJ($)){let B=h6(J,$,Q,q);if(B)return B}let j=f($),G=q===void 0&&E6(Q),z,W,N;if(q!==void 0){let B=i(q),_=i(Q);z=B.value,W=_.value,N=_.unit||B.unit||K0($)}else if(G){let B=x6(Q),_=n(J,$),K=i(Q);z=_,W=V6(_,K.value,B),N=K.unit||K0($)}else{let B=n(J,$),_=i(Q);z=B,W=_.value,N=_.unit||K0($)}return{type:"scalar",property:$,isTransform:j,startValue:z,endValue:W,unit:N}}function hJ(){let J=new WeakMap;return{register($,Q){let q=J.get($);if(!q)q=new Set,J.set($,q);q.add(Q)},registerMany($,Q){for(let q of Q)this.register($,q)},get($){return J.get($)},clearRegistry($){J.delete($)}}}var zJ=hJ(),V0=new WeakMap,WJ=hJ();function TJ(J){if(f(J))return["transform"];if(a(J))return["filter"];if(jJ(J))return["strokeDasharray","strokeDashoffset"];return[J]}function T6(J,$){if(f($)&&!V0.has(J)){if(J instanceof HTMLElement||J instanceof SVGElement){let q=J.style.transform;V0.set(J,q||null)}}let Q=TJ($);for(let q of Q)zJ.register(J,q)}function f6(J,$){for(let Q of $)T6(J,Q)}function u6(J){zJ.clearRegistry(J),V0.delete(J)}function d6(J,$){if(!(J instanceof HTMLElement)&&!(J instanceof SVGElement))return;let Q=new Set;for(let q of $)for(let Z of TJ(q))Q.add(Z);for(let q of Q)if(Z0(q))J.style.removeProperty(q);else J.style[q]=""}function p6(J){if(!(J instanceof HTMLElement)&&!(J instanceof SVGElement))return;let $=zJ.get(J);if(!$||$.size===0)return;for(let Q of $){if(Q==="transform"){let q=V0.get(J);if(q!==void 0){if(q)J.style.transform=q;else J.style.removeProperty("transform");continue}}if(Z0(Q))J.style.removeProperty(Q);else J.style[Q]=""}}function c6(J){p6(J),u6(J)}function X0(J,$){WJ.registerMany(J,$)}function NJ(J){WJ.clearRegistry(J)}function m6(J){if(!(J instanceof HTMLElement)&&!(J instanceof SVGElement))return;let $=WJ.get(J);if(!$||$.size===0)return;for(let Q of $)J.style[Q]=""}function g6(J){m6(J),NJ(J)}U.styleReset={registerAnimatedProps:f6,clearAnimationStylesForProps:d6,clearAnimationStylesAndUnregister:c6,clearPinStylesAndUnregister:g6};class C{static _registry=new Map;static _users=new Map;static getOrCreate(J,$){let Q=C._registry.get($);if(!Q)Q=new C(J),C._registry.set($,Q);let q=C._users.get($);if(!q)q=new Set,C._users.set($,q);return q.add(J),Q}static release(J,$){let Q=C._users.get($);if(!Q)return;if(Q.delete(J),Q.size===0){let q=C._registry.get($);C._registry.delete($),C._users.delete($),q?.cleanup()}}_id;_element=null;_originalStyles=null;_spacer=null;_currentState="before";_pinStart=0;_pinEnd=0;_pinDistance=0;_useFixedPin=!1;_pinSpacing;_elementHeight=0;_fixedTop=0;_fixedLeft=0;_width=0;_fixedBreakingAncestors=[];_isBodyPin=!1;_originalHtmlHeight="";_originalHtmlOverflow="";constructor(J){this._id=J}setup(J,$,Q,q,Z,j){if(typeof document>"u")return;this._isBodyPin=J===document.body,this._element=J,this._pinStart=$,this._pinEnd=Q;let G=this._pinDistance;this._pinDistance=Q-$,this._useFixedPin=Z,this._pinSpacing=j;let z=this._isBodyPin?this._originalStyles!==null:this._spacer!==null;if(z&&this._currentState==="pinned"&&Z)this._updateFixed("before");if(z&&this._spacer)this._spacer.style.width="";let W=z&&this._isBodyPin?document.documentElement.style.height:null;if(W!==null)document.documentElement.style.height=this._originalHtmlHeight;let N=J.getBoundingClientRect();if(W!==null)document.documentElement.style.height=W;let B=z&&this._spacer?window.getComputedStyle(this._spacer):window.getComputedStyle(J);if(this._elementHeight=N.height,!z)this._originalStyles={position:J.style.position,top:J.style.top,left:J.style.left,width:J.style.width,marginTop:J.style.marginTop,marginBottom:J.style.marginBottom,marginLeft:J.style.marginLeft,marginRight:J.style.marginRight,zIndex:J.style.zIndex};if(Z)if(this._fixedTop=q,this._fixedLeft=N.left,this._width=N.width,this._isBodyPin){if(!z)this._originalHtmlHeight=document.documentElement.style.height,this._originalHtmlOverflow=document.documentElement.style.overflow,this._detectFixedBreakingAncestors(J);document.documentElement.style.height=`${this._elementHeight+this._pinDistance}px`}else{let _=this._resolvePinSpacing(),K=`
|
|
2
|
+
display: block;
|
|
3
|
+
box-sizing: content-box;
|
|
4
|
+
width: ${N.width}px;
|
|
5
|
+
height: ${N.height}px;
|
|
6
|
+
margin-top: ${B.marginTop};
|
|
7
|
+
margin-left: ${B.marginLeft};
|
|
8
|
+
margin-right: ${B.marginRight};
|
|
9
|
+
overflow: visible;
|
|
10
|
+
`;if(_==="padding")K+=`padding-bottom: ${this._pinDistance}px;`,K+=`margin-bottom: ${B.marginBottom};`;else if(_==="margin"){let H=parseFloat(B.marginBottom)||0,Y=z?H-G:H;K+=`margin-bottom: ${Y+this._pinDistance}px;`}else K+=`margin-bottom: ${B.marginBottom};`;if(!this._spacer)this._detectFixedBreakingAncestors(J),this._spacer=document.createElement("div"),J.parentNode?.insertBefore(this._spacer,J),this._spacer.appendChild(J),J.style.marginTop="0",J.style.marginBottom="0",J.style.marginLeft="0",J.style.marginRight="0";this._spacer.style.cssText=K,this._spacer.setAttribute("data-scrolltrigger-spacer",String(this._id))}this._currentState="before"}update(J){if(!this._element)return;let $=J<this._pinStart?"before":J<this._pinEnd?"pinned":"after";if(this._useFixedPin){if($!==this._currentState)this._updateFixed($),this._currentState=$}else if($!==this._currentState||$==="pinned")this._updateTransform($,J),this._currentState=$}cleanup(){if(this._element&&C._registry.get(this._element)===this)C._registry.delete(this._element),C._users.delete(this._element);if(this._element&&this._originalStyles){let J=this._element;z0(J),J.style.position=this._originalStyles.position,J.style.top=this._originalStyles.top,J.style.left=this._originalStyles.left,J.style.width=this._originalStyles.width,J.style.marginTop=this._originalStyles.marginTop,J.style.marginBottom=this._originalStyles.marginBottom,J.style.marginLeft=this._originalStyles.marginLeft,J.style.marginRight=this._originalStyles.marginRight,J.style.zIndex=this._originalStyles.zIndex,J.style.transform="",NJ(J)}if(this._isBodyPin){if(typeof document<"u")document.documentElement.style.height=this._originalHtmlHeight,document.documentElement.style.overflow=this._originalHtmlOverflow}else if(this._spacer?.parentNode&&this._element)this._spacer.parentNode.insertBefore(this._element,this._spacer),this._spacer.parentNode.removeChild(this._spacer);this._restoreFixedBreakingAncestors(),this._fixedBreakingAncestors=[],this._element=null,this._originalStyles=null,this._spacer=null,this._currentState="before",this._pinSpacing=void 0,this._isBodyPin=!1,this._originalHtmlHeight="",this._originalHtmlOverflow=""}getElement(){return this._element}getPinDistance(){return this._pinDistance}getState(){return this._currentState}getLayoutRect(){if(this._spacer?.parentNode){let J=this._spacer.getBoundingClientRect();return{top:J.top,left:J.left,width:J.width,height:this._elementHeight,bottom:J.top+this._elementHeight,right:J.left+J.width}}return null}isBodyPin(){return this._isBodyPin}suspendHtmlHeight(){if(!this._isBodyPin)return null;let J=document.documentElement.style.height;return document.documentElement.style.height=this._originalHtmlHeight,()=>{document.documentElement.style.height=J}}isFixedPin(){return this._useFixedPin}_detectFixedBreakingAncestors(J){this._fixedBreakingAncestors=[];let $=J.parentElement;while($&&$!==document.documentElement){let Q=window.getComputedStyle($),q=[];if(Q.filter&&Q.filter!=="none")q.push({property:"filter",originalValue:""});if(Q.transform&&Q.transform!=="none")q.push({property:"transform",originalValue:""});if(Q.perspective&&Q.perspective!=="none")q.push({property:"perspective",originalValue:""});if(Q.willChange&&Q.willChange!=="auto"){if(Q.willChange.split(",").map((j)=>j.trim()).some((j)=>j==="transform"||j==="filter"||j==="perspective"))q.push({property:"willChange",originalValue:""})}if(Q.contain&&Q.contain!=="none"){if(["paint","layout","strict","content"].some((j)=>Q.contain.includes(j)))q.push({property:"contain",originalValue:""})}if(Q.backdropFilter&&Q.backdropFilter!=="none")q.push({property:"backdropFilter",originalValue:""});if(Q.overflow==="clip"||Q.overflowX==="clip"||Q.overflowY==="clip"){if(Q.overflowY==="clip")q.push({property:"overflowY",originalValue:""});if(Q.overflowX==="clip")q.push({property:"overflowX",originalValue:""})}if(q.length>0)this._fixedBreakingAncestors.push({element:$,overrides:q});$=$.parentElement}}_overrideFixedBreakingAncestors(){for(let{element:J,overrides:$}of this._fixedBreakingAncestors)for(let Q of $)switch(Q.originalValue=J.style[Q.property]||"",Q.property){case"filter":case"backdropFilter":case"transform":case"perspective":J.style[Q.property]="none";break;case"willChange":J.style.willChange="auto";break;case"contain":J.style.contain="none";break;case"overflowY":J.style.overflowY="visible";break;case"overflowX":J.style.overflowX="hidden";break}}_restoreFixedBreakingAncestors(){for(let{element:J,overrides:$}of this._fixedBreakingAncestors)for(let{property:Q,originalValue:q}of $)J.style[Q]=q}_resolvePinSpacing(){if(this._pinSpacing===!1)return!1;if(this._pinSpacing==="margin")return"margin";if(this._pinSpacing===void 0||this._pinSpacing===!0){if(this._isBodyPin)return!1;if(this._element?.parentElement){let J=getComputedStyle(this._element.parentElement).display;if(J==="flex"||J==="inline-flex")return!1}}return"padding"}_updateFixed(J){let $=this._element;if(J==="before"){if($.style.position=this._originalStyles?.position||"",$.style.top=this._originalStyles?.top||"",$.style.left=this._originalStyles?.left||"",$.style.width=this._originalStyles?.width||"",this._isBodyPin)$.style.marginTop=this._originalStyles?.marginTop||"";else $.style.marginTop="0",$.style.marginLeft="0";$.style.zIndex=this._originalStyles?.zIndex||"",z0($),$.style.transform=b($),this._restoreFixedBreakingAncestors()}else if(J==="pinned"){if(this._overrideFixedBreakingAncestors(),$.style.position="fixed",$.style.top=`${this._fixedTop}px`,$.style.left=`${this._fixedLeft}px`,$.style.width=`${this._width}px`,this._isBodyPin)$.style.marginTop=this._originalStyles?.marginTop||"";else $.style.marginTop="0",$.style.marginLeft="0";if($.style.zIndex="100",z0($),$.style.transform=b($),this._isBodyPin)X0($,["position","top","left","width","zIndex","transform","marginTop"]);else X0($,["position","top","left","width","marginTop","marginLeft","zIndex","transform"])}else{if($.style.position=this._originalStyles?.position||"",$.style.top=this._originalStyles?.top||"",$.style.left=this._originalStyles?.left||"",$.style.width=this._originalStyles?.width||"",this._isBodyPin)z0($),$.style.transform=b($),$.style.marginTop=`${this._pinDistance}px`;else $.style.marginTop="0",$.style.marginLeft="0",D0($,0,this._pinDistance,0),$.style.transform=b($);$.style.zIndex=this._originalStyles?.zIndex||"",this._restoreFixedBreakingAncestors()}}_updateTransform(J,$){let Q=this._element;if(J==="before")Q.style.zIndex=this._originalStyles?.zIndex||"",z0(Q),Q.style.transform=b(Q);else if(J==="pinned"){let q=Math.round($-this._pinStart);Q.style.zIndex="100",D0(Q,0,q,0),Q.style.transform=b(Q),X0(Q,["transform","zIndex"])}else Q.style.zIndex=this._originalStyles?.zIndex||"",D0(Q,0,this._pinDistance,0),Q.style.transform=b(Q),X0(Q,["transform","zIndex"])}}function S(J,$,Q,q){if(!J)return 0;let Z=J.trim().toLowerCase(),j=Z.match(/^(top|center|bottom)([+-])(-?\d+(?:\.\d+)?)(px|%|vh|vw)?$/);if(j){let z=j[1],W=j[2]==="-"?-1:1,N=parseFloat(j[3]),B=j[4]||"px",_=0;switch(z){case"top":_=0;break;case"center":_=$/2;break;case"bottom":_=$;break}let K=fJ(N,B,$,Q,q);return _+W*K}switch(Z){case"top":return 0;case"center":return $/2;case"bottom":return $}let G=Z.match(/^(-?\d+(?:\.\d+)?)(px|%|vh|vw)?$/);if(G){let z=parseFloat(G[1]),W=G[2]||"px";return fJ(z,W,$,Q,q)}return 0}function fJ(J,$,Q,q,Z){switch($){case"px":return J;case"%":return J/100*Q;case"vh":return J/100*q;case"vw":return J/100*(Z??(typeof window<"u"?window.innerWidth:0));default:return J}}class BJ{_id;_markers;_markerContainer;_triggerElement;_scrollerStartOffset=0;_scrollerEndOffset=0;_scroller=window;_startConfig="top top";_endConfig="bottom top";_cachedElStartDocTop=0;_cachedElEndDocTop=0;_cachedElPositionValid=!1;constructor(J){this._id=J}setup(J){if(typeof document>"u")return;this._scroller=J.scroller,this._triggerElement=J.triggerElement||void 0,this._startConfig=J.startConfig,this._endConfig=J.endConfig;let $=J.markerConfig,Q=(typeof $==="object"?$.startColor:null)||"lime",q=(typeof $==="object"?$.endColor:null)||"red",Z=(typeof $==="object"?$.fontSize:null)||"10px",j=this._scroller!==window,G=J.viewportHeight,z=this._startConfig.split(" "),W=S(z[1]||"top",G,G),N=this._endConfig.startsWith("+=")?W:S(this._endConfig.split(" ")[1]||"top",G,G);this._markerContainer=document.createElement("div"),this._markerContainer.setAttribute("data-scrolltrigger-markers",String(this._id)),this._markerContainer.style.cssText="position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 9999;";let B=(F,X,M)=>{let k=document.createElement("div");k.setAttribute("data-marker",F),k.style.cssText=`
|
|
11
11
|
position: absolute;
|
|
12
12
|
${M}: 0;
|
|
13
13
|
height: 1px;
|
|
14
14
|
width: 50px;
|
|
15
|
-
background: ${
|
|
15
|
+
background: ${X};
|
|
16
16
|
pointer-events: none;
|
|
17
|
-
`;let L=document.createElement("span");return L.textContent=
|
|
17
|
+
`;let L=document.createElement("span");return L.textContent=F,L.style.cssText=`
|
|
18
18
|
position: absolute;
|
|
19
19
|
${M}: 0;
|
|
20
20
|
top: 2px;
|
|
21
|
-
background: ${
|
|
22
|
-
color: ${
|
|
21
|
+
background: ${X};
|
|
22
|
+
color: ${X==="lime"?"#000":"#fff"};
|
|
23
23
|
padding: 1px 3px;
|
|
24
24
|
font-size: ${Z};
|
|
25
25
|
font-family: monospace;
|
|
26
26
|
white-space: nowrap;
|
|
27
27
|
border-radius: 2px;
|
|
28
28
|
line-height: 1.2;
|
|
29
|
-
`,k.appendChild(L),k},Y=B("scroller-start",Q,"right"),U=B("scroller-end",q,"right"),_=B("start",Q,"left"),H=B("end",q,"left");if(!this._triggerElement)_.style.display="none",H.style.display="none";if(this._markerContainer.appendChild(Y),this._markerContainer.appendChild(U),this._markerContainer.appendChild(_),this._markerContainer.appendChild(H),this._markers={scrollerStart:Y,scrollerEnd:U,elementStart:_,elementEnd:H},j){let I=this._scroller;if(window.getComputedStyle(I).position==="static")I.style.position="relative";I.appendChild(this._markerContainer)}else document.body.appendChild(this._markerContainer),this._markerContainer.style.position="fixed";this._scrollerStartOffset=N,this._scrollerEndOffset=W,this._cacheElementPositions(z)}_cacheElementPositions(J){if(!this._triggerElement){this._cachedElPositionValid=!1;return}let $=f(this._triggerElement),Q=P(this._startConfig.split(" ")[0]||"top",$.height,J),q=this._endConfig.startsWith("+=")?Q:P(this._endConfig.split(" ")[0]||"bottom",$.height,J);if(this._scroller!==window){let j=this._scroller.getBoundingClientRect(),z=this._scroller.scrollTop,G=$.top-j.top+z;this._cachedElStartDocTop=G+Q,this._cachedElEndDocTop=G+q}else{let j=window.scrollY||window.pageYOffset||0,z=$.top+j;this._cachedElStartDocTop=z+Q,this._cachedElEndDocTop=z+q}this._cachedElPositionValid=!0}update(J,$,Q){if(!this._markers||!this._markerContainer)return;let q=this._triggerElement;if(this._triggerElement=$||void 0,this._triggerElement!==q)this._cacheElementPositions(Q);let Z=this._scroller!==window;if(Z)this._markers.scrollerStart.style.top=`${J+this._scrollerStartOffset}px`,this._markers.scrollerEnd.style.top=`${J+this._scrollerEndOffset}px`;else this._markers.scrollerStart.style.top=`${this._scrollerStartOffset}px`,this._markers.scrollerEnd.style.top=`${this._scrollerEndOffset}px`;if(this._triggerElement&&this._cachedElPositionValid)if(this._markers.elementStart.style.display="",this._markers.elementEnd.style.display="",Z)this._markers.elementStart.style.top=`${this._cachedElStartDocTop}px`,this._markers.elementEnd.style.top=`${this._cachedElEndDocTop}px`;else this._markers.elementStart.style.top=`${this._cachedElStartDocTop-J}px`,this._markers.elementEnd.style.top=`${this._cachedElEndDocTop-J}px`;else this._markers.elementStart.style.display="none",this._markers.elementEnd.style.display="none"}recachePositions(J){this._cacheElementPositions(J)}cleanup(){if(this._markerContainer&&this._markerContainer.parentNode)this._markerContainer.parentNode.removeChild(this._markerContainer);this._markerContainer=void 0,this._markers=void 0,this._triggerElement=void 0}}class l extends h{static _nextId=0;_id;static _SCRUB_TICKER_PRIORITY=1;static _activeInstances=new Set;static _loadListenerAdded=!1;_scrollListener;_scrubTickListener=null;_currentProgress=0;_targetProgress=0;_scrubLag=0;_scroller;_triggerStart=0;_triggerEnd=0;_pinManager=null;_markerManager=null;_triggerState="before";_toggleActions=["play","none","none","none"];_initializing=!1;constructor(J,$){super(J,$);this._id=l._nextId++,this._scrubLag=typeof $.scrub==="number"?$.scrub:0}static _ensureLoadListener(){if(l._loadListenerAdded||typeof window>"u")return;if(l._loadListenerAdded=!0,document.readyState==="complete")return;window.addEventListener("load",()=>{setTimeout(()=>{for(let J of l._activeInstances)J.refresh()},100)},{once:!0})}_resolveScroller(){if(this._config.scroller)if(typeof this._config.scroller==="string"){if(typeof document>"u"){this._scroller=window;return}try{let J=document.querySelector(this._config.scroller);this._scroller=J??window}catch(J){console.warn(`[Motion] Invalid scroller selector "${this._config.scroller}":`,J),this._scroller=window}}else this._scroller=this._config.scroller;else this._scroller=window}_resolvePinElement(){if(!this._config.pin||typeof document>"u")return null;if(typeof this._config.pin==="string")return document.querySelector(this._config.pin);else if(this._config.pin===!0){let J=this._timeline.getFirstChildAnimation();if(J){let $=J.getTargets();if($.length>0&&$[0]instanceof HTMLElement)return $[0]}}return null}_defaultStart(){return this._config.start||(this._config.pin?"top top":"top bottom")}_defaultEnd(){return this._config.end||"bottom top"}_getFirstAnimatedElement(){let J=this._timeline.getFirstChildAnimation();if(J){let $=J.getTargets();if($.length>0&&$[0]instanceof HTMLElement)return $[0]}return null}_resolveTriggerElement(){if(this._config.target instanceof HTMLElement)return this._config.target;if(typeof this._config.target==="string"&&typeof document<"u"){let J=document.querySelector(this._config.target);if(J instanceof HTMLElement)return J}return this._getFirstAnimatedElement()}_calculateTriggerPositions(J){let $=J||this._resolveTriggerElement(),Q=this._getViewportHeight(),q=this._getScrollTop();if(!$){this._triggerStart=0,this._triggerEnd=this._getScrollHeight();return}let Z=this._pinManager?.getLayoutRect()??f($),j;if(this._scroller instanceof Element){let _=this._scroller.getBoundingClientRect();j=Z.top-_.top+q}else j=Z.top+q;let G=this._defaultStart().split(" "),N=G[0]||"top",W=G[1]||"top",B=P(N,Z.height,Q),Y=P(W,Q,Q);this._triggerStart=j+B-Y;let U=this._defaultEnd();if(U.startsWith("+=")){let _=P(U.slice(2),Q,Q);this._triggerEnd=this._triggerStart+_}else{let _=U.split(" "),H=_[0]||"bottom",I=_[1]||"top",K=P(H,Z.height,Q),M=P(I,Q,Q);this._triggerEnd=j+K-M}if(this._triggerEnd<=this._triggerStart)this._triggerEnd=this._triggerStart+Math.max(Q,100)}_onEnable(){this._resolveScroller();let J=this._resolvePinElement();this._calculateTriggerPositions(J),l._activeInstances.add(this),l._ensureLoadListener();let Q=(this._config.toggleActions||"play none none none").trim().split(/\s+/);if(this._toggleActions=[Q[0],Q[1],Q[2],Q[3]],J){let Z=this._defaultStart().split(" "),j=this._getViewportHeight(),z=P(Z[0]||"top",J.getBoundingClientRect().height,j),N=P(Z[1]||"top",j,j)-z;this._pinManager=V.getOrCreate(this._id,J),this._pinManager.setup(J,this._triggerStart,this._triggerEnd,N,this._scroller===window,this._config.pinSpacing)}if(this._config.markers&&typeof document<"u"){let q=this._pinManager?.getElement()||this._resolveTriggerElement();this._markerManager=new zJ(this._id),this._markerManager.setup({scroller:this._scroller,triggerElement:q,startConfig:this._defaultStart(),endConfig:this._defaultEnd(),markerConfig:this._config.markers,viewportHeight:this._getViewportHeight()})}if(this._scrollListener=()=>this._onScroll(),this._scroller){if(this._scroller.addEventListener("scroll",this._scrollListener,{passive:!0}),this._initializing=!0,this._onScroll(),this._initializing=!1,this._config.scrub===!1||this._config.scrub===void 0){if(this._triggerState==="active")w(this._toggleActions[0],this._timeline);else if(this._triggerState==="after")this._timeline.progress(1),this._timeline.pause()}}}_onDisable(){if(this._scrollListener&&this._scroller)this._scroller.removeEventListener("scroll",this._scrollListener);if(this._markerManager?.cleanup(),this._markerManager=null,this._pinManager){let J=this._pinManager.getElement();if(J)V.release(this._id,J);else this._pinManager.cleanup();this._pinManager=null}this._stopSmoothScrollLoop(),l._activeInstances.delete(this)}refresh(){if(!this._enabled)return;let J=this._pinManager?.getElement()||null;if(this._calculateTriggerPositions(J),this._pinManager&&J){let Q=this._defaultStart().split(" "),q=this._getViewportHeight(),Z=this._pinManager.getLayoutRect()?.height??J.getBoundingClientRect().height,j=P(Q[0]||"top",Z,q),G=P(Q[1]||"top",q,q)-j;this._pinManager.setup(J,this._triggerStart,this._triggerEnd,G,this._scroller===window,this._config.pinSpacing)}if(this._markerManager)this._markerManager.recachePositions(this._getViewportHeight());this._onScroll()}_getViewportHeight(){if(this._scroller===window)return typeof window<"u"?window.innerHeight:0;else if(this._scroller instanceof Element)return this._scroller.clientHeight;return 0}_getScrollTop(){if(this._scroller===window)return typeof window<"u"?window.scrollY||window.pageYOffset:0;else if(this._scroller instanceof Element)return this._scroller.scrollTop;return 0}_getScrollHeight(){if(this._scroller===window){if(typeof document<"u"&&document.documentElement)return document.documentElement.scrollHeight-window.innerHeight;return 0}else if(this._scroller instanceof Element)return this._scroller.scrollHeight-this._scroller.clientHeight;return 0}_onScroll(){if(!this._enabled)return;let J=this._getScrollTop(),$=this._triggerEnd-this._triggerStart,Q=$>0?(J-this._triggerStart)/$:0;if(Q=Math.max(0,Math.min(1,Q)),Q=this._applySnap(Q),this._targetProgress=Q,this._pinManager?.update(J),this._markerManager){let q=this._pinManager?.getElement()||this._resolveTriggerElement();this._markerManager.update(J,q,this._getViewportHeight())}if(this._config.scrub!==!1&&this._config.scrub!==void 0)if(this._scrubLag===0)this._currentProgress=this._targetProgress,JJ(()=>this._timeline.progress(this._currentProgress));else this._startSmoothScrollLoop();else{let q;if(Q<=0)q="before";else if(Q>=1)q="after";else q="active";if(q!==this._triggerState){let Z=this._triggerState;if(this._triggerState=q,this._initializing)return;JJ(()=>{if(q==="active"&&Z==="before")w(this._toggleActions[0],this._timeline);else if(q==="after"&&Z==="active")w(this._toggleActions[1],this._timeline);else if(q==="active"&&Z==="after")w(this._toggleActions[2],this._timeline);else if(q==="before"&&Z==="active")w(this._toggleActions[3],this._timeline);else if(q==="after"&&Z==="before")w(this._toggleActions[0],this._timeline),this._timeline.progress(1),w(this._toggleActions[1],this._timeline);else if(q==="before"&&Z==="after")w(this._toggleActions[2],this._timeline),this._timeline.progress(0),w(this._toggleActions[3],this._timeline)})}}}_applySnap(J){let $=this._config.snap;if($==null)return J;if(typeof $==="function")return $(J);if(Array.isArray($)){let Q=$[0]??J,q=Math.abs(J-Q);for(let Z=1;Z<$.length;Z++){let j=Math.abs(J-$[Z]);if(j<q)q=j,Q=$[Z]}return Q}if(typeof $==="number"&&$>0)return Math.round(J/$)*$;return J}_startSmoothScrollLoop(){if(this._scrubTickListener)return;this._scrubTickListener=(J,$)=>{if(!this._enabled){this._stopSmoothScrollLoop();return}let Q=this._targetProgress-this._currentProgress,q=1-Math.exp(-J*3/this._scrubLag);if(this._currentProgress+=Q*q,Math.abs(this._targetProgress-this._currentProgress)<0.0001){this._currentProgress=this._targetProgress,this._timeline.progress(this._currentProgress),this._stopSmoothScrollLoop();return}this._timeline.progress(this._currentProgress)},C.getInstance().add(this._scrubTickListener,l._SCRUB_TICKER_PRIORITY)}_stopSmoothScrollLoop(){if(this._scrubTickListener)C.getInstance().remove(this._scrubTickListener),this._scrubTickListener=null}}F.registerTrigger("scroll",l);class uJ{_registrations=[];_domContentLoaded=!1;_windowLoaded=!1;_initialized=!1;constructor(){this._initialize()}_initialize(){if(this._initialized)return;if(this._initialized=!0,typeof document<"u"){if(document.addEventListener("DOMContentLoaded",()=>{this._domContentLoaded=!0,this._triggerDuring()}),typeof window<"u")window.addEventListener("load",()=>{this._windowLoaded=!0,this._triggerAfter()});if(document.readyState==="interactive"||document.readyState==="complete")this._domContentLoaded=!0;if(document.readyState==="complete")this._windowLoaded=!0}}register(J,$){let Q=$.timing||"during",q=$.paused===!0;if(this._registrations.push({timeline:J,timing:Q,paused:q}),q)return;if(Q==="before")J.play();else if(Q==="during"&&this._domContentLoaded)J.play();else if(Q==="after"&&this._windowLoaded)J.play()}unregister(J){this._registrations=this._registrations.filter(($)=>$.timeline!==J)}clear(){this._registrations=[]}_triggerDuring(){this._registrations.filter((J)=>J.timing==="during"&&!J.paused).forEach((J)=>J.timeline.play())}_triggerAfter(){this._registrations.filter((J)=>J.timing==="after"&&!J.paused).forEach((J)=>J.timeline.play())}_reset(){this._registrations=[],this._domContentLoaded=!1,this._windowLoaded=!1,this._initialized=!1,this._initialize()}}F.registerPageLoadTrigger(uJ);class dJ extends h{_targets=[];_listeners=new Map;_frozenRects=new Map;_state={x:0.5,y:0.5,distance:0.5,isInside:!1};_targetState={targetX:0.5,targetY:0.5,targetDistance:0.5};_tickerCallback;_defaultStartProgress=0.5;_defaultLeaveProgress=0.5;constructor(J,$){super(J,$);this._config={type:"distance",startProgress:this._defaultStartProgress,leaveProgress:this._defaultLeaveProgress,...$};let Q=this._config.startProgress??this._defaultStartProgress;this._state.x=Q,this._state.y=Q,this._state.distance=Q,this._targetState.targetX=Q,this._targetState.targetY=Q,this._targetState.targetDistance=Q}_onEnable(){if(this._targets=this._resolveElements(this._config.target),this._targets.length===0)this._addViewportListeners();else this._addTargetListeners();if(this._config.smooth!==void 0&&this._config.smooth>0)this._startSmoothingTicker();this._updateTimelineProgress()}_onDisable(){if(this._tickerCallback)C.getInstance().remove(this._tickerCallback),this._tickerCallback=void 0;this._frozenRects.clear(),this._cleanupListenerMap(this._listeners)}_addViewportListeners(){if(typeof window>"u")return;let J=new Map,$=(Q)=>{let q=Q;this._handleViewportMouseMove(q.clientX,q.clientY)};window.addEventListener("mousemove",$),J.set("mousemove",$),this._state.isInside=!0,this._listeners.set(window,J)}refresh(){for(let J of this._targets)this._frozenRects.set(J,f(J))}_addTargetListeners(){this._targets.forEach((J)=>{this._frozenRects.set(J,f(J));let $=new Map,Q=(j)=>{let z=j;this._handleTargetMouseMove(J,z.clientX,z.clientY)};J.addEventListener("mousemove",Q),$.set("mousemove",Q);let q=()=>{this._state.isInside=!0};J.addEventListener("mouseenter",q),$.set("mouseenter",q);let Z=()=>{this._state.isInside=!1,this._handleMouseLeave()};J.addEventListener("mouseleave",Z),$.set("mouseleave",Z),this._listeners.set(J,$)})}_handleViewportMouseMove(J,$){if(typeof window>"u")return;let{innerWidth:Q,innerHeight:q}=window,Z=Q/2,j=q/2;if(this._config.type==="axis")this._targetState.targetX=J/Q,this._targetState.targetY=$/q;else{let z=J-Z,G=$-j,N=Math.sqrt(z*z+G*G),W=Math.sqrt(Z*Z+j*j);this._targetState.targetDistance=1-Math.min(N/W,1)}this._applyProgress()}_handleTargetMouseMove(J,$,Q){let q=this._frozenRects.get(J)??J.getBoundingClientRect(),Z=q.left+q.width/2,j=q.top+q.height/2;if(this._config.type==="axis"){let z=$-q.left,G=Q-q.top;this._targetState.targetX=Math.max(0,Math.min(1,z/q.width)),this._targetState.targetY=Math.max(0,Math.min(1,G/q.height))}else{let z=$-Z,G=Q-j,N=Math.sqrt(z*z+G*G),W=Math.sqrt(Math.pow(q.width/2,2)+Math.pow(q.height/2,2));this._targetState.targetDistance=1-Math.min(N/W,1)}this._applyProgress()}_handleMouseLeave(){let J=this._config.leaveProgress??this._defaultLeaveProgress;if(this._targetState.targetX=J,this._targetState.targetY=J,this._targetState.targetDistance=J,!this._config.smooth)this._state.x=J,this._state.y=J,this._state.distance=J,this._updateTimelineProgress()}_applyProgress(){if(this._config.smooth)return;this._state.x=this._targetState.targetX,this._state.y=this._targetState.targetY,this._state.distance=this._targetState.targetDistance,this._updateTimelineProgress()}_startSmoothingTicker(){let J=Math.max(0,Math.min(1,this._config.smooth??0.1));this._tickerCallback=($)=>{let Q=this._lerp(this._state.x,this._targetState.targetX,J,$),q=this._lerp(this._state.y,this._targetState.targetY,J,$),Z=this._lerp(this._state.distance,this._targetState.targetDistance,J,$),j=0.0001,z=Math.abs(Q-this._state.x)<0.0001&&Math.abs(Q-this._targetState.targetX)<0.0001,G=Math.abs(q-this._state.y)<0.0001&&Math.abs(q-this._targetState.targetY)<0.0001,N=Math.abs(Z-this._state.distance)<0.0001&&Math.abs(Z-this._targetState.targetDistance)<0.0001;if(this._state.x=Q,this._state.y=q,this._state.distance=Z,!z||!G||!N)this._updateTimelineProgress()},C.getInstance().add(this._tickerCallback)}_lerp(J,$,Q,q){let Z=$-J;if(Math.abs(Z)<0.0001)return $;let j=0.5*Math.pow(1-Q,2)+0.005,z=1-Math.pow(1-j,q*60);return J+Z*z}_updateTimelineProgress(){if(this._config.type==="axis")this._timeline.setAxisProgress("x",this._state.x),this._timeline.setAxisProgress("y",this._state.y);else this._timeline.progress(this._state.distance)}}F.registerTrigger("mouseMove",dJ);class H0 extends h{_target=window;_tolerance;_dragMinimum;_dragMinimumSquared;_wheelSpeed;_scrollSpeed;_stopDelay;_preventDefault;_lockAxis;_animationStep;_smooth;_startX=0;_startY=0;_deltaX=0;_deltaY=0;_lockedAxis=null;_isPressed=!1;_isDragging=!1;_lastDirectionX=null;_lastDirectionY=null;_lastScrollX=0;_lastScrollY=0;_stopTimeout=null;_isMoving=!1;_lastActivityTime=0;_pendingActions=new Map;_rafScheduled=!1;_rafId=null;_wheelAccumulatorX=0;_wheelAccumulatorY=0;_wheelRafId=null;_scrollRafId=null;_lastPointerX=0;_lastPointerY=0;_activatedDirections=new Set;_targetProgress=0;_currentProgress=0;_interpolationRafId=null;_siblings=null;_index=0;static _sequenceStates=new WeakMap;_boundHandlers={};_frozenHoverRect=null;_gestureHoverActive=!1;_boundHoverMoveHandler=null;constructor(J,$){super(J,$);this._tolerance=$.tolerance??1,this._dragMinimum=$.dragMinimum??10,this._dragMinimumSquared=this._dragMinimum*this._dragMinimum,this._wheelSpeed=$.wheelSpeed??1,this._scrollSpeed=$.scrollSpeed??1,this._stopDelay=$.stopDelay??150,this._preventDefault=$.preventDefault??!1,this._lockAxis=$.lockAxis??!1,this._animationStep=$.animationStep??0.1,this._smooth=Math.max(0,Math.min(1,$.smooth??0));let Q=$;if(Q._siblings&&Q._index!==void 0){if(this._siblings=Q._siblings,this._index=Q._index,!H0._sequenceStates.has(this._siblings))H0._sequenceStates.set(this._siblings,{lastIndex:0})}}_onEnable(){let J=this._resolveElement(this._config.target,window);this._target=J??window;let $=this._config.types;if($.includes("pointer"))this._addPointerListeners();if($.includes("touch"))this._addTouchListeners();if($.includes("wheel"))this._addWheelListener();if($.includes("scroll"))this._addScrollListener();if(this._config.events.Hover||this._config.events.HoverEnd)this._addHoverListeners()}_onDisable(){if(this._stopTimeout)clearTimeout(this._stopTimeout),this._stopTimeout=null;if(this._rafId!==null)cancelAnimationFrame(this._rafId),this._rafId=null;if(this._wheelRafId!==null)cancelAnimationFrame(this._wheelRafId),this._wheelRafId=null;if(this._scrollRafId!==null)cancelAnimationFrame(this._scrollRafId),this._scrollRafId=null;if(this._interpolationRafId!==null)cancelAnimationFrame(this._interpolationRafId),this._interpolationRafId=null;this._rafScheduled=!1,this._pendingActions.clear();let J=this._target;if(this._boundHandlers.pointerDown)J.removeEventListener("pointerdown",this._boundHandlers.pointerDown),window.removeEventListener("pointermove",this._boundHandlers.pointerMove),window.removeEventListener("pointerup",this._boundHandlers.pointerUp);if(this._boundHandlers.touchStart)J.removeEventListener("touchstart",this._boundHandlers.touchStart),window.removeEventListener("touchmove",this._boundHandlers.touchMove),window.removeEventListener("touchend",this._boundHandlers.touchEnd);if(this._boundHandlers.wheel)J.removeEventListener("wheel",this._boundHandlers.wheel);if(this._boundHandlers.scroll)(this._target===window?window:this._target).removeEventListener("scroll",this._boundHandlers.scroll);if(this._boundHoverMoveHandler)window.removeEventListener("mousemove",this._boundHoverMoveHandler),this._boundHoverMoveHandler=null;this._frozenHoverRect=null,this._gestureHoverActive=!1,this._boundHandlers={}}_addPointerListeners(){this._boundHandlers.pointerDown=this._handlePointerDown.bind(this),this._boundHandlers.pointerMove=this._handlePointerMove.bind(this),this._boundHandlers.pointerUp=this._handlePointerUp.bind(this);let J={passive:!this._preventDefault};this._target.addEventListener("pointerdown",this._boundHandlers.pointerDown,J),window.addEventListener("pointermove",this._boundHandlers.pointerMove,J),window.addEventListener("pointerup",this._boundHandlers.pointerUp)}_handlePointerDown(J){if(J.pointerType==="touch"&&this._config.types.includes("touch"))return;if(this._preventDefault)J.preventDefault();this._handleInputStart(J.clientX,J.clientY)}_handlePointerMove(J){if(J.pointerType==="touch"&&this._config.types.includes("touch"))return;if(this._handleInputMove(J.clientX,J.clientY)){if(this._preventDefault)J.preventDefault()}}_handlePointerUp(J){if(J.pointerType==="touch"&&this._config.types.includes("touch"))return;this._handleInputEnd()}_addTouchListeners(){this._boundHandlers.touchStart=this._handleTouchStart.bind(this),this._boundHandlers.touchMove=this._handleTouchMove.bind(this),this._boundHandlers.touchEnd=this._handleTouchEnd.bind(this);let J={passive:!this._preventDefault};this._target.addEventListener("touchstart",this._boundHandlers.touchStart,J),window.addEventListener("touchmove",this._boundHandlers.touchMove,J),window.addEventListener("touchend",this._boundHandlers.touchEnd)}_handleTouchStart(J){if(this._preventDefault)J.preventDefault();let $=J.touches[0];if(!$)return;this._handleInputStart($.clientX,$.clientY)}_handleTouchMove(J){let $=J.touches[0];if(!$)return;if(this._handleInputMove($.clientX,$.clientY)){if(this._preventDefault)J.preventDefault()}}_handleTouchEnd(J){this._handleInputEnd()}_handleInputStart(J,$){this._fireEvent("PressInit"),this._startX=J,this._startY=$,this._lastPointerX=J,this._lastPointerY=$,this._deltaX=0,this._deltaY=0,this._isPressed=!0,this._isDragging=!1,this._lockedAxis=null,this._fireEvent("Press")}_handleInputMove(J,$){if(!this._isPressed)return!1;let Q=J-this._lastPointerX,q=$-this._lastPointerY;if(Math.abs(Q)<1&&Math.abs(q)<1)return!1;this._lastPointerX=J,this._lastPointerY=$;let Z=J-this._startX,j=$-this._startY;if(this._updateDeltas(Z,j),this._checkDragStart(),this._checkDirectionAndFire(!1),this._checkToggle(Z,j),this._scheduleStopCheck(),this._isDragging)this._fireEvent("Drag");return!0}_handleInputEnd(){if(!this._isPressed)return;if(this._isDragging)this._fireEvent("DragEnd");this._fireEvent("Release"),this._fireCompleteCallbacks(),this._fireEvent("Stop"),this._resetGestureState()}_addWheelListener(){this._boundHandlers.wheel=this._handleWheel.bind(this),this._target.addEventListener("wheel",this._boundHandlers.wheel,{passive:!this._preventDefault})}_handleWheel(J){if(this._preventDefault)J.preventDefault();if(this._wheelAccumulatorX+=J.deltaX*this._wheelSpeed,this._wheelAccumulatorY+=J.deltaY*this._wheelSpeed,this._wheelRafId!==null)return;this._wheelRafId=requestAnimationFrame(()=>{this._wheelRafId=null,this._deltaX=this._wheelAccumulatorX,this._deltaY=this._wheelAccumulatorY,this._wheelAccumulatorX=0,this._wheelAccumulatorY=0,this._checkDirectionAndFire(!0),this._checkToggle(this._deltaX,this._deltaY),this._scheduleStopCheck(),this._deltaX=0,this._deltaY=0})}_addScrollListener(){if(this._boundHandlers.scroll=this._handleScroll.bind(this),this._target===window)this._lastScrollX=window.scrollX,this._lastScrollY=window.scrollY;else{let J=this._target;this._lastScrollX=J.scrollLeft,this._lastScrollY=J.scrollTop}this._target.addEventListener("scroll",this._boundHandlers.scroll,{passive:!0})}_handleScroll(){if(this._scrollRafId!==null)return;this._scrollRafId=requestAnimationFrame(()=>{this._scrollRafId=null,this._processScroll()})}_processScroll(){let J,$;if(this._target===window)J=window.scrollX,$=window.scrollY;else{let Z=this._target;J=Z.scrollLeft,$=Z.scrollTop}let Q=(J-this._lastScrollX)*this._scrollSpeed,q=($-this._lastScrollY)*this._scrollSpeed;this._lastScrollX=J,this._lastScrollY=$,this._deltaX=Q,this._deltaY=q,this._checkDirectionAndFire(!0),this._checkToggle(Q,q),this._scheduleStopCheck(),this._deltaX=0,this._deltaY=0}_addHoverListeners(){if(this._target===window)return;let J=this._target;this._frozenHoverRect=f(J),this._boundHoverMoveHandler=($)=>{if(!this._frozenHoverRect)return;let Q=this._frozenHoverRect,q=$.clientX>=Q.left&&$.clientX<=Q.right&&$.clientY>=Q.top&&$.clientY<=Q.bottom;if(q&&!this._gestureHoverActive)this._gestureHoverActive=!0,this._fireEvent("Hover");else if(!q&&this._gestureHoverActive)this._gestureHoverActive=!1,this._fireEvent("HoverEnd")},window.addEventListener("mousemove",this._boundHoverMoveHandler)}refresh(){if(this._target===window||!this._frozenHoverRect)return;this._frozenHoverRect=f(this._target)}_updateDeltas(J,$){if(this._lockAxis&&this._lockedAxis)if(this._lockedAxis==="x")this._deltaX=J,this._deltaY=0;else this._deltaX=0,this._deltaY=$;else this._deltaX=J,this._deltaY=$;if(this._lockAxis&&!this._lockedAxis){let Q=this._tolerance;if(Math.abs(this._deltaX)>Q||Math.abs(this._deltaY)>Q)this._lockedAxis=Math.abs(this._deltaX)>Math.abs(this._deltaY)?"x":"y"}}_checkDirectionAndFire(J){let $=this._tolerance;if(J||!this._lockedAxis||this._lockedAxis==="y"){if(this._deltaY<-$){if(this._fireEvent("Up"),!J)this._activatedDirections.add("Up")}if(this._deltaY>$){if(this._fireEvent("Down"),!J)this._activatedDirections.add("Down")}}if(J||!this._lockedAxis||this._lockedAxis==="x"){if(this._deltaX<-$){if(this._fireEvent("Left"),!J)this._activatedDirections.add("Left")}if(this._deltaX>$){if(this._fireEvent("Right"),!J)this._activatedDirections.add("Right")}}if(Math.abs(this._deltaX)>$||Math.abs(this._deltaY)>$){if(this._fireEvent("Change"),Math.abs(this._deltaX)>$)this._fireEvent("ChangeX");if(Math.abs(this._deltaY)>$)this._fireEvent("ChangeY")}}_checkToggle(J,$){let Q=this._tolerance;if(Math.abs(J)>=Q){let q=J>0?1:-1;if(this._lastDirectionX!==null&&q!==this._lastDirectionX)this._fireEvent("ToggleX");this._lastDirectionX=q}if(Math.abs($)>=Q){let q=$>0?1:-1;if(this._lastDirectionY!==null&&q!==this._lastDirectionY)this._fireEvent("ToggleY");this._lastDirectionY=q}}_checkDragStart(){if(this._isDragging)return;if(this._deltaX*this._deltaX+this._deltaY*this._deltaY>this._dragMinimumSquared)this._isDragging=!0}_scheduleStopCheck(){if(this._isMoving=!0,this._lastActivityTime=performance.now(),this._stopTimeout)return;let J=()=>{let $=performance.now()-this._lastActivityTime;if($>=this._stopDelay){if(this._stopTimeout=null,this._isMoving){if(this._isMoving=!1,this._lastDirectionX=null,this._lastDirectionY=null,!this._isPressed)this._fireEvent("Stop")}}else this._stopTimeout=setTimeout(J,this._stopDelay-$)};this._stopTimeout=setTimeout(J,this._stopDelay)}_fireEvent(J){let $=this._config.events[J];if($)this._pendingActions.set($,J),this._scheduleRAF()}_scheduleRAF(){if(this._rafScheduled)return;this._rafScheduled=!0,this._rafId=requestAnimationFrame(()=>{this._rafScheduled=!1,this._rafId=null;for(let[J,$]of this._pendingActions)this._executeAction(J,$);this._pendingActions.clear()})}_getStepForEvent(J){if(typeof this._animationStep==="number")return this._animationStep;if(J&&this._animationStep[J]!==void 0)return this._animationStep[J];let $=Object.values(this._animationStep);return $.length>0?$[0]:0.1}_executeAction(J,$){switch(J){case"play":case"pause":case"reverse":case"restart":case"reset":case"complete":w(J,this._timeline);break;case"toggle":if(this._timeline.isActive())this._timeline.pause();else this._timeline.play();break;case"kill":this._timeline.kill();break;case"playReverse":{let Q=this._timeline.progress();if(Q>=1)this._timeline.reverse();else if(Q<=0)this._timeline.play();else if(!this._timeline.isActive())if(this._timeline.reversed())this._timeline.play();else this._timeline.reverse();break}case"progressUp":this._interpolateProgress(this._getStepForEvent($));break;case"progressDown":this._interpolateProgress(-this._getStepForEvent($));break;case"playNext":this._playSequenceItem(1);break;case"playPrevious":this._playSequenceItem(-1);break}}_playSequenceItem(J){if(!this._siblings||this._siblings.length===0)return;let $=H0._sequenceStates.get(this._siblings);if(!$)return;let Q=this._siblings.length,q=$.lastIndex,Z=(q+J+Q)%Q,j=this._siblings[q];if(j&&j.progress()>0)j.reverse();let z=this._siblings[Z];if(z)z.restart();$.lastIndex=Z}_interpolateProgress(J){let $=this._timeline.progress();if(Math.abs($-this._currentProgress)>0.01)this._currentProgress=$,this._targetProgress=$;if(this._interpolationRafId===null)this._currentProgress=$,this._targetProgress=$;if(this._targetProgress=Math.max(0,Math.min(1,this._targetProgress+J)),this._smooth===0){this._currentProgress=this._targetProgress,this._timeline.progress(this._currentProgress);return}if(this._interpolationRafId===null)this._startInterpolationLoop()}_startInterpolationLoop(){if(this._interpolationRafId!==null)return;let J=0.08+(1-this._smooth)*0.12,$=()=>{let Q=this._targetProgress-this._currentProgress;if(Math.abs(Q)<0.0001){this._currentProgress=this._targetProgress,this._timeline.progress(this._currentProgress),this._interpolationRafId=null;return}this._currentProgress+=Q*J,this._timeline.progress(this._currentProgress),this._interpolationRafId=requestAnimationFrame($)};this._interpolationRafId=requestAnimationFrame($)}_fireCompleteCallbacks(){if(this._activatedDirections.has("Up"))this._fireEvent("UpComplete");if(this._activatedDirections.has("Down"))this._fireEvent("DownComplete");if(this._activatedDirections.has("Left"))this._fireEvent("LeftComplete");if(this._activatedDirections.has("Right"))this._fireEvent("RightComplete");this._activatedDirections.clear()}_resetGestureState(){this._isPressed=!1,this._isDragging=!1,this._deltaX=0,this._deltaY=0,this._lockedAxis=null,this._lastDirectionX=null,this._lastDirectionY=null,this._activatedDirections.clear()}}F.registerTrigger("gesture",H0);var x0=null;function pJ(J,$,Q,q){let Z=J;if(!Z.style)return;let j=G0();if(T($))if(S(J,$,Q,q),j)k0(J);else Z.style.transform=E(J);else{let z=q?`${Q}${q}`:`${Q}`;if(j)D0(J,$,z);else try{if(q0($))Z.style.setProperty($,z);else if($ in Z.style)Z.style[$]=z;else Z.style.setProperty(s($),z)}catch{}}}function cJ(J,$,Q,q,Z,j){let z=J;if(!z.style)return;let G=j===1?`rgb(${Math.round(Q)}, ${Math.round(q)}, ${Math.round(Z)})`:`rgba(${Math.round(Q)}, ${Math.round(q)}, ${Math.round(Z)}, ${j})`;if(G0())D0(J,$,G);else try{if(q0($))z.style.setProperty($,G);else if($ in z.style)z.style[$]=G;else z.style.setProperty(s($),G)}catch{}}function mJ(J,$,Q,q){let Z=J;if(!Z.style)return;if(x0||(x0=X.filter)){let j=x0.interpolateFilters($,Q,q),z=x0.filterToString(j);if(G0())D0(J,"filter",z);else Z.style.filter=z}}function gJ(J,$,Q){let{pathLUT:q,alignOffset:Z,pathOffset:j,pathRotate:z}=Q;if(!q||q.length===0)return;let G=$*(q.length-1),N=Math.floor(G),W=Math.min(N+1,q.length-1),B=G-N,Y=q[N],U=q[W],_=Y.x+(U.x-Y.x)*B,H=Y.y+(U.y-Y.y)*B,I=(j?.x??0)+_-(Z?.x??0),K=(j?.y??0)+H-(Z?.y??0);if(S(J,"x",I,"px"),S(J,"y",K,"px"),z){let M=g6(Y.angle,U.angle,B);S(J,"rotate",M,"deg")}if(G0())k0(J);else J.style.transform=E(J)}function g6(J,$,Q){let q=$-J;if(q>180)q-=360;if(q<-180)q+=360;return J+q*Q}var NJ=null,s6=100,l6=500,o6=0.5,X0=[],i6=50;function n6(J){for(let $=0;$<X0.length;$++)if(X0[$].length>=J){let Q=X0.splice($,1)[0];return Q.length=J,Q}return Array(J)}function a6(J){if(X0.length<i6)X0.push(J)}class WJ{target=null;property="";startValue=0;endValue=0;change=0;unit="";next=null;valueType="scalar";startColor=null;endColor=null;changeColor=new Float32Array(4);startFilters=null;endFilters=null;startDraw=null;endDraw=null;pathLength=0;pathData=null;motionPathLength=0;startProgress=0;endProgress=0;pathRotate=!1;alignOffset=null;pathOffset=null;pathLUT=null;_isElement=!1;init(J,$,Q,q,Z=""){return this.target=J,this.property=$,this.startValue=Q,this.endValue=q,this.change=q-Q,this.unit=Z,this.valueType="scalar",this._isElement=J instanceof Element,this}initColor(J,$,Q,q){return this.target=J,this.property=$,this.valueType="color",this.startColor=Q,this.endColor=q,this.changeColor[0]=q[0]-Q[0],this.changeColor[1]=q[1]-Q[1],this.changeColor[2]=q[2]-Q[2],this.changeColor[3]=q[3]-Q[3],this._isElement=J instanceof Element,this}initFilter(J,$,Q,q){return this.target=J,this.property=$,this.valueType="filter",this.startFilters=Q,this.endFilters=q,this._isElement=J instanceof Element,this}initDrawSVG(J,$,Q,q,Z){return this.target=J,this.property=$,this.valueType="drawSVG",this.startDraw=Q,this.endDraw=q,this.pathLength=Z,this._isElement=J instanceof Element,this}initPath(J,$,Q,q,Z,j,z,G,N){if(J instanceof Element)y(J,!0);this.target=J,this.property=$,this.valueType="path",this.pathData=Q,this.motionPathLength=q,this.startProgress=Z,this.endProgress=j,this.pathRotate=z,this.alignOffset=G,this.pathOffset=N,this._isElement=J instanceof Element;let W=Math.abs(j-Z),B=q*W,Y=Math.min(l6,Math.max(s6,Math.ceil(B*o6)));this.pathLUT=n6(Y+1);for(let U=0;U<=Y;U++){let _=U/Y,H=Z+(j-Z)*_;this.pathLUT[U]=$J(Q,H,z)}return this}render(J){if(!this.target)return;if(this.valueType==="color"&&this.startColor){let $=this.startColor[0]+this.changeColor[0]*J,Q=this.startColor[1]+this.changeColor[1]*J,q=this.startColor[2]+this.changeColor[2]*J,Z=this.startColor[3]+this.changeColor[3]*J;if(this._isElement)cJ(this.target,this.property,$,Q,q,Z)}else if(this.valueType==="filter"&&this.startFilters&&this.endFilters){if(this._isElement)mJ(this.target,this.startFilters,this.endFilters,J)}else if(this.valueType==="drawSVG"&&this.startDraw&&this.endDraw){if(this._isElement&&this.pathLength>0){let $=this.startDraw.start+(this.endDraw.start-this.startDraw.start)*J,Q=this.startDraw.end+(this.endDraw.end-this.startDraw.end)*J;if(NJ||(NJ=X.drawSVG))NJ.applyDrawSVG(this.target,$,Q,this.pathLength)}}else if(this.valueType==="path"&&this.pathLUT&&this.pathLUT.length>0){if(this._isElement)gJ(this.target,J,{pathLUT:this.pathLUT,alignOffset:this.alignOffset??{x:0,y:0},pathOffset:this.pathOffset??{x:0,y:0},pathRotate:this.pathRotate})}else{let $=this.startValue+this.change*J;if(this._isElement)pJ(this.target,this.property,$,this.unit);else this.target[this.property]=$}}reset(){if(this.target=null,this.property="",this.startValue=0,this.endValue=0,this.change=0,this.unit="",this.next=null,this.valueType="scalar",this.startColor=null,this.endColor=null,this.startFilters=null,this.endFilters=null,this.startDraw=null,this.endDraw=null,this.pathLength=0,this.pathData=null,this.motionPathLength=0,this.startProgress=0,this.endProgress=0,this.pathRotate=!1,this.alignOffset=null,this.pathOffset=null,this.pathLUT)a6(this.pathLUT);this.pathLUT=null,this._isElement=!1}}class K0{pool=[];totalCreated=0;factory;maxSize;constructor(J,$){this.factory=J,this.maxSize=$}acquire(){if(this.pool.length>0)return this.pool.pop();return this.totalCreated++,this.factory()}release(J){if(J.reset(),this.maxSize===void 0||this.pool.length<this.maxSize)this.pool.push(J)}getPoolSize(){return this.pool.length}getTotalCreated(){return this.totalCreated}clear(){this.pool=[]}}var U0=new K0(()=>new WJ,500),r={acquire:()=>U0.acquire(),release:(J)=>U0.release(J),getPoolSize:()=>U0.getPoolSize(),getTotalCreated:()=>U0.getTotalCreated(),clear:()=>U0.clear()};var sJ={x:0,y:0,z:0,rotate:0,rotateX:0,rotateY:0,rotateZ:0,scale:1,scaleX:1,scaleY:1,scaleZ:1,skewX:0,skewY:0,opacity:1};class u{static _createAnimationCallback=null;static setCreateAnimationCallback(J){u._createAnimationCallback=J}_targets;_originalTargets;_fromVars;_toVars;_duration=0.5;_delay=0;_ease="power1.out";_animation=null;_animations=[];_built=!1;_splitType;_mask;_repeat;_repeatDelay;_yoyo;_stagger;_axis;_fitConfig;_onStart;_onUpdate;_onComplete;_onRepeat;_onReverseComplete;_skipInitialFromRender=!1;_plainObjectInitialValues=new Map;_expectedAnimationIds=[];_propsToAnimate=[];constructor(J,$){if(this._targets=A0(J),this._originalTargets=this._targets,this._targets.length===0&&typeof J==="string")console.warn(`[Motion] Selector "${J}" matched no elements. Animation will not run.`);if($)this._applyAnimationConfig($)}_applyAnimationConfig(J){if(J.from)this._fromVars=J.from;if(J.to)this._toVars=J.to;if(J.duration!==void 0)if(typeof J.duration!=="number"||!isFinite(J.duration)||J.duration<0)console.warn(`[Motion] Invalid duration: ${J.duration}. Must be a finite number >= 0. Using default.`);else this._duration=J.duration;if(J.delay!==void 0)if(typeof J.delay!=="number"||isNaN(J.delay))console.warn(`[Motion] Invalid delay: ${J.delay}. Must be a number. Using default 0.`);else if(!isFinite(J.delay))console.warn(`[Motion] Invalid delay: ${J.delay}. Infinity is not a valid delay. Using default 0.`);else this._delay=J.delay;if(J.ease)this._ease=J.ease;if(J.split)this._splitType=J.split;if(J.mask)this._mask=J.mask;if(J.stagger!==void 0)this._stagger=J.stagger;if(J.axis)this._axis=J.axis;if(J.fit)this._fitConfig=J.fit;if(J.repeat)if(typeof J.repeat==="number")this._repeat=J.repeat;else this._repeat=J.repeat.times,this._repeatDelay=J.repeat.delay,this._yoyo=J.repeat.yoyo;if(J.onStart)this._onStart=J.onStart;if(J.onUpdate)this._onUpdate=J.onUpdate;if(J.onComplete)this._onComplete=J.onComplete;if(J.onRepeat)this._onRepeat=J.onRepeat;if(J.onReverseComplete)this._onReverseComplete=J.onReverseComplete}_capturePlainObjectValues(J){for(let $ of this._targets){if($ instanceof Element)continue;let Q=$,q={};for(let Z of J)if(Z in Q&&typeof Q[Z]==="number")q[Z]=Q[Z];if(Object.keys(q).length>0)this._plainObjectInitialValues.set($,q)}}_restorePlainObjectValues(){for(let[J,$]of this._plainObjectInitialValues){let Q=J;for(let[q,Z]of Object.entries($))Q[q]=Z}}_ensureBuilt(){if(!this._built)this._build()}_isInvalidated(){if(this._animations.length===0)return!1;return this._animations.some((J,$)=>{let Q=J.getId(),q=this._expectedAnimationIds[$];return Q===0||Q!==q})}rebuildIfPooled(){if(this._isInvalidated()){this._restorePlainObjectValues();for(let J of this._targets)if(J instanceof Element)y(J),X.styleReset?.clearAnimationStylesForProps?.(J,this._propsToAnimate);this._resetBuildState(),this._ensureBuilt()}}_build(){if(this._built)return;if(this._targets.length===0)return;if(!this._fromVars&&!this._toVars&&!this._fitConfig&&this._duration<=0)return;if(this._fitConfig){if(!X.fit){console.warn("[Motion] FitResolver not loaded. Did you import the SDK?");return}if(this._built=!0,!u._createAnimationCallback)throw Error("AnimationBuilder: Engine not initialized. Call Engine.init() first.");let j={};if(this._repeat!==void 0)j.repeat=this._repeat;if(this._repeatDelay!==void 0)j.repeatDelay=this._repeatDelay;if(this._yoyo)j.yoyo=this._yoyo;if(this._onStart)j.onStart=this._onStart;if(this._onUpdate)j.onUpdate=this._onUpdate;if(this._onComplete)j.onComplete=this._onComplete;if(this._onRepeat)j.onRepeat=this._onRepeat;if(this._onReverseComplete)j.onReverseComplete=this._onReverseComplete;if(this._stagger!==void 0)j.stagger=this._stagger;let z=[];for(let N of this._targets){if(!(N instanceof Element))continue;let W=u._createAnimationCallback([N],{},this._duration,this._delay,this._ease,!1,void 0,j);if(Array.isArray(W))z.push(...W);else z.push(W)}let G=this._fitConfig;for(let N of z)for(let W of N.getTargets())if(W instanceof Element)X.fit.registerPendingSetup(N,W,G,r);this._animation=z[0]??null,this._animations=z,this._expectedAnimationIds=z.map((N)=>N.getId());return}this._built=!0;let J={},$=!1,Q;if(this._fromVars&&this._toVars){J={...this._toVars},Q={...this._fromVars},$=!0;for(let j of Object.keys(Q))if(!(j in J)){if(j in sJ)J[j]=sJ[j];else if(Q0(j))J[j]="";else if(n(j))J[j]=""}}else if(this._fromVars)J={...this._fromVars},$=!0;else if(this._toVars)J={...this._toVars};if(this._splitType&&X.textSplitter?.split){let j=this._mask?{mask:!0}:void 0,z=[];for(let G of this._originalTargets)if(G instanceof Element){let N=X.textSplitter?.split(G,this._splitType,j);z.push(...N)}if(z.length>0)this._targets=z}if(this._propsToAnimate=Object.keys(J),Q){for(let j of Object.keys(Q))if(!this._propsToAnimate.includes(j))this._propsToAnimate.push(j)}if(this._plainObjectInitialValues.size===0)this._capturePlainObjectValues(this._propsToAnimate);if($){for(let j of this._targets)if(j instanceof Element)y(j),X.styleReset?.clearAnimationStylesForProps?.(j,this._propsToAnimate)}if(X.styleReset?.registerAnimatedProps){for(let j of this._targets)if(j instanceof Element)X.styleReset?.registerAnimatedProps(j,this._propsToAnimate)}let q={repeat:this._repeat,repeatDelay:this._repeatDelay,yoyo:this._yoyo,stagger:this._stagger,onStart:this._onStart,onUpdate:this._onUpdate,onComplete:this._onComplete,onRepeat:this._onRepeat,onReverseComplete:this._onReverseComplete,_skipInitialRender:this._skipInitialFromRender||void 0};if(!u._createAnimationCallback)throw Error("AnimationBuilder: Engine not initialized. Call AnimationBuilder.setCreateAnimationCallback first.");let Z=u._createAnimationCallback(this._targets,J,this._duration,this._delay,this._ease,$,Q,q);if(Array.isArray(Z))this._animations=Z,this._animation=Z[0]||null;else this._animation=Z,this._animations=[Z];this._expectedAnimationIds=this._animations.map((j)=>j.getId())}getAnimation(){return this._ensureBuilt(),this._animation}getAnimations(){return this._ensureBuilt(),this._animations}getTargets(){return this._targets}getOriginalTargets(){return this._originalTargets}hasSplit(){return!!this._splitType}_resetBuildState(){this._built=!1,this._animations=[],this._animation=null,this._expectedAnimationIds=[]}getConfig(){return{fromVars:this._fromVars?{...this._fromVars}:void 0,toVars:this._toVars?{...this._toVars}:void 0,duration:this._duration,delay:this._delay,ease:this._ease,axis:this._axis,fit:this._fitConfig?{...this._fitConfig}:void 0,split:this._splitType,mask:this._mask,stagger:this._stagger,repeat:this._repeat,repeatDelay:this._repeatDelay,yoyo:this._yoyo,onStart:this._onStart,onUpdate:this._onUpdate,onComplete:this._onComplete,onRepeat:this._onRepeat,onReverseComplete:this._onReverseComplete}}setAxis(J){this._axis=J}getAxis(){return this._axis}setSkipInitialFromRender(J){this._skipInitialFromRender=J}}class C0{static parse(J,$,Q,q){if(J===void 0)return $;if(typeof J==="number")return J;let Z=J.trim();if(Z==="<")return Q;if(Z===">")return q;if(Z.startsWith("<")){let j=parseFloat(Z.substring(1));if(!isNaN(j))return Q+j}if(Z.startsWith(">")){let j=parseFloat(Z.substring(1));if(!isNaN(j))return q+j}if(Z.startsWith("+=")){let j=parseFloat(Z.substring(2));return $+j}if(Z.startsWith("-=")){let j=parseFloat(Z.substring(2));return $-j}return console.warn(`Invalid position parameter: "${Z}", using current end`),$}}class b{static _eachCounter=0;static _registerWithEngine=null;static setEngineRegisterCallback(J){b._registerWithEngine=J}_name;_children=[];_duration=0;_time=0;_progress=0;_timeScale=1;_isActive=!1;_isReversed=!1;_killed=!1;_atZeroState=!1;_repeat=0;_repeatDelay=0;_yoyo=!1;_currentRepeat=0;_completeFired=!1;_inRepeatDelay=!1;_repeatDelayCounter=0;_onStart;_onUpdate;_onComplete;_onRepeat;_startFired=!1;_trigger;_unregisterCallback;setUnregisterCallback(J){this._unregisterCallback=J}_previousStart=0;_previousEnd=0;_eachInstances;_eachDuration;_initialValues=new Map;_initialTransforms=new Map;_transformElements=new Set;_savedTransitions=new Map;_transitionsDisabled=!1;_savedWillChange=new Map;_willChangeApplied=!1;constructor(J,$){if(this._name=J,$?.repeat!==void 0)if(typeof $.repeat==="number")this._repeat=$.repeat;else this._repeat=$.repeat.times,this._repeatDelay=$.repeat.delay??0,this._yoyo=$.repeat.yoyo??!1;if($?.onStart)this._onStart=$.onStart;if($?.onUpdate)this._onUpdate=$.onUpdate;if($?.onComplete)this._onComplete=$.onComplete;if($?.onRepeat)this._onRepeat=$.onRepeat;if(J&&b._registerWithEngine)b._registerWithEngine(J,this)}duration(){if(this._eachDuration!==void 0)return this._eachDuration;return this._duration}totalDuration(){if(this._repeat===-1)return 1/0;return this._duration*(this._repeat+1)+this._repeatDelay*this._repeat}clear(){for(let J of this._children)if(J.type==="animation")J.child.kill();else if(J.type==="timeline")J.child.kill();return this._children=[],this._duration=0,this._time=0,this._progress=0,this._isActive=!1,this._isReversed=!1,this._startFired=!1,this._previousStart=0,this._previousEnd=0,this._initialValues.clear(),this._initialTransforms.clear(),this._transformElements.clear(),this._clearTransitionData(),this._currentRepeat=0,this._completeFired=!1,this._inRepeatDelay=!1,this._repeatDelayCounter=0,this}_captureInitialValues(J){let $=J.getTargets(),Q=J.getFirstPropTween();while(Q){let q=Q.property;for(let Z of $){if(!(Z instanceof Element))continue;let j=this._initialValues.get(Z);if(!j)j=new Map,this._initialValues.set(Z,j);if(!j.has(q)){let z=Z;if(T(q)||qJ(q)){if(this._transformElements.add(Z),!this._initialTransforms.has(Z)){let G=z.style.transform;this._initialTransforms.set(Z,G||null)}j.set(q,{removeInline:!0})}else if(Q0(q)||n(q))j.set(q,{removeInline:!0});else{let G=q.replace(/([A-Z])/g,"-$1").toLowerCase();if(z.style.getPropertyValue(G)!==""){let W=yJ(Z,q);j.set(q,{removeInline:!1,value:W.value,unit:W.unit})}else j.set(q,{removeInline:!0})}}}Q=Q.next}}_restoreInitialValues(){for(let J of this._transformElements){let $=J;y(J);let Q=this._initialTransforms.get(J);if(Q)$.style.transform=Q;else $.style.removeProperty("transform")}for(let[J,$]of this._initialValues){let Q=J;for(let[q,Z]of $){if(T(q))continue;let j=q.replace(/([A-Z])/g,"-$1").toLowerCase();if(Z.removeInline)Q.style.removeProperty(j);else{let z=`${Z.value}${Z.unit}`;Q.style.setProperty(j,z)}}}}_disableTransitions(){if(this._transitionsDisabled)return;for(let J of this._savedTransitions.keys())J.style.transition="none";this._transitionsDisabled=!0}_applyWillChange(){if(this._willChangeApplied)return;for(let J of this._savedWillChange.keys())J.style.willChange="transform";this._willChangeApplied=!0}_restoreTransitions(){if(!this._transitionsDisabled)return;for(let[J,$]of this._savedTransitions)J.style.transition=$;this._transitionsDisabled=!1}_clearTransitionData(){this._restoreTransitions(),this._savedTransitions.clear(),this._transitionsDisabled=!1,this._restoreWillChange()}_restoreWillChange(){if(this._willChangeApplied)for(let[J,$]of this._savedWillChange)if($)J.style.willChange=$;else J.style.removeProperty("will-change");this._savedWillChange.clear(),this._willChangeApplied=!1}_addEntry(J,$,Q){let q=C0.parse(Q,this._duration,this._previousStart,this._previousEnd),Z=new u(J,$);return this._addBuilder(Z,q)}_addBuilder(J,$){J.setSkipInitialFromRender(!0);let Q=J.getAnimations();if(Q.length===0)return this;let q=$;for(let Z of Q){let j=Z.getDelay(),z=$+j;Z.clearDelay();let G=Z.totalDuration(),N={type:"animation",child:Z,builder:J,startTime:z,duration:G};this._children.push(N),Z.setTimelineChild(!0),Z.pause(),this._captureInitialValues(Z);for(let Y of Z.getTargets())if(Y instanceof HTMLElement&&!this._savedTransitions.has(Y))this._savedTransitions.set(Y,Y.style.transition);for(let Y of Z.getTargets())if(Y instanceof HTMLElement&&this._transformElements.has(Y)&&!this._savedWillChange.has(Y))this._savedWillChange.set(Y,Y.style.willChange);let W=!!J.getConfig().fromVars;if(z>0&&!W)Z.setLazyStartCapture(!0);if(W)Z.renderAtTime(0);if(J.hasSplit()){for(let Y of J.getOriginalTargets())if(Y instanceof Element)Y.style.opacity="1"}let B=z+G;if(B>q)q=B}if(this._previousStart=$,this._previousEnd=q,q>this._duration)this._duration=q;return this}call(J,$,Q){let q=C0.parse(Q,this._duration,this._previousStart,this._previousEnd),Z={type:"callback",child:J,startTime:q,duration:0,params:$};if(this._children.push(Z),this._previousStart=q,this._previousEnd=q,q>this._duration)this._duration=q;return this}_getFirstAnimationTarget(){let J=this.getFirstChildAnimation();if(J){let $=J.getTargets();for(let Q of $)if(o0(Q))return Q}return}_getAllAnimationTargets(){for(let J of this._children)if(J.type==="animation"&&J.builder)return(J.builder.hasSplit()?J.builder.getOriginalTargets():J.builder.getTargets()).filter((Q)=>o0(Q));return[]}_createInstanceForElement(J,$){let q=`${this._name||"__each"}__each_${$}_${b._eachCounter++}`,Z=new b(q),j=new Set;for(let z of this._children)if(z.type==="animation"&&z.builder){if(j.has(z.builder))continue;j.add(z.builder);let G=z.builder.getConfig(),N=G.repeat!=null?{times:G.repeat,delay:G.repeatDelay,yoyo:G.yoyo}:void 0,W=z.builder.hasSplit(),B=new u(J,{from:G.fromVars,to:G.toVars,duration:G.duration,delay:G.delay,ease:G.ease,repeat:N,...W&&G.split?{split:G.split}:{},...W&&G.mask?{mask:G.mask}:{},...W&&G.stagger!==void 0?{stagger:G.stagger}:{},onStart:G.onStart,onUpdate:G.onUpdate,onComplete:G.onComplete,onRepeat:G.onRepeat,onReverseComplete:G.onReverseComplete});if(G.axis)B.setAxis(G.axis);Z._addBuilder(B,z.startTime)}else if(z.type==="callback")Z.call(z.child,z.params,z.startTime);return Z}_createInstanceForElements(J,$){let q=`${this._name||"__each"}__each_${$}_${b._eachCounter++}`,Z=new b(q),j=new Set;for(let z of this._children)if(z.type==="animation"&&z.builder){if(j.has(z.builder))continue;j.add(z.builder);let G=z.builder.getConfig(),N=G.repeat!=null?{times:G.repeat,delay:G.repeatDelay,yoyo:G.yoyo}:void 0,W=z.builder.hasSplit(),B=new u(J,{from:G.fromVars,to:G.toVars,duration:G.duration,delay:G.delay,ease:G.ease,repeat:N,...W&&G.split?{split:G.split}:{},...W&&G.mask?{mask:G.mask}:{},...W&&G.stagger!==void 0?{stagger:G.stagger}:{},onStart:G.onStart,onUpdate:G.onUpdate,onComplete:G.onComplete,onRepeat:G.onRepeat,onReverseComplete:G.onReverseComplete});if(G.axis)B.setAxis(G.axis);Z._addBuilder(B,z.startTime)}else if(z.type==="callback")Z.call(z.child,z.params,z.startTime);return Z}_resolveTargetElements(J){if(typeof J!=="string")return[J];if(typeof document<"u")try{return Array.from(document.querySelectorAll(J))}catch($){console.warn(`[Motion] Invalid selector "${J}":`,$)}return[]}_setupEachModeGeneric(J,$){if(J.length===0)return;if(this._eachInstances=[],this._children.some((q)=>q.type==="animation"&&q.builder?.hasSplit()))for(let q of J)X.textSplitter?.revert?.(q);this._clearTransitionData();for(let q=0;q<J.length;q++){let Z=J[q],j=this._createInstanceForElement(Z,q);$(j,Z),this._eachInstances.push(j)}{let q=null,Z=this._onUpdate,j=this._onStart,z=this._onComplete;for(let G of this._eachInstances){if(Z)G.onUpdate((N,W)=>{let B=N>0&&N<1;if(B)q=G;if(q===G){if(Z(N,W),!B)q=null}});if(j)G.onStart(()=>{q=G,j()});if(z)G.onComplete(()=>{if(q===G)q=null,z()})}}this._eachDuration=this._duration;for(let q of this._children)if(q.type==="animation"){let Z=q.child;Z.setTimelineChild(!1),Z.kill()}else if(q.type==="timeline")q.child.kill();this._children=[],this._duration=0,this._initialValues.clear(),this._initialTransforms.clear(),this._transformElements.clear(),this._isActive=!1,this._time=0,this._progress=0,this._isReversed=!1,this._startFired=!1}_setupEachMode(J,$){let Q=X.triggerManager?.getInstance?.();if(!Q)return;let{each:q,...Z}=$;if($.target){let z=this._resolveTargetElements($.target);if(z.length===0)return;let G=this._getAllAnimationTargets();if(this._children.some((W)=>W.type==="animation"&&W.builder?.hasSplit()))for(let W of G)X.textSplitter?.revert?.(W);this._clearTransitionData(),this._eachInstances=[];for(let W=0;W<z.length;W++){let B=z[W],Y=G.filter((_)=>B.contains(_));if(Y.length===0)continue;let U=this._createInstanceForElements(Y,W);if(J==="scroll")Q.registerScroll(U,{...Z,target:B});else if(J==="hover")Q.registerHover(U,{...Z,target:B});else Q.registerClick(U,{...Z,target:B});this._eachInstances.push(U)}{let W=null,B=this._onUpdate,Y=this._onStart,U=this._onComplete;for(let _ of this._eachInstances){if(B)_.onUpdate((H,I)=>{let K=H>0&&H<1;if(K)W=_;if(W===_){if(B(H,I),!K)W=null}});if(Y)_.onStart(()=>{W=_,Y()});if(U)_.onComplete(()=>{if(W===_)W=null,U()})}}this._eachDuration=this._duration;for(let W of this._children)if(W.type==="animation"){let B=W.child;B.setTimelineChild(!1),B.kill()}else if(W.type==="timeline")W.child.kill();this._children=[],this._duration=0,this._initialValues.clear(),this._initialTransforms.clear(),this._transformElements.clear(),this._isActive=!1,this._time=0,this._progress=0,this._isReversed=!1,this._startFired=!1;return}let j=this._getAllAnimationTargets();this._setupEachModeGeneric(j,(z,G)=>{if(J==="scroll")Q.registerScroll(z,{...Z,target:G});else if(J==="hover")Q.registerHover(z,{...Z,target:G});else Q.registerClick(z,{...Z,target:G})})}onHover(J){if(J?.each)return this._setupEachMode("hover",J),this;let $=J?.target??this._getFirstAnimationTarget();return X.triggerManager?.getInstance?.().registerHover(this,{target:$,onLeave:J?.onLeave,leaveDelay:J?.leaveDelay}),this}onClick(J){if(J?.each)return this._setupEachMode("click",J),this;let $=J?.target??this._getFirstAnimationTarget();return X.triggerManager?.getInstance?.().registerClick(this,{target:$,secondTarget:J?.secondTarget,toggle:J?.toggle,preventDefault:J?.preventDefault}),this}onScroll(J){if(J?.each)return this._setupEachMode("scroll",J),this;let $=J?.target??this._getFirstAnimationTarget();return X.triggerManager?.getInstance?.().registerScroll(this,{...J,target:$}),this}onMouseMove(J){if(J?.each&&J.target)return this._setupMouseMoveEachMode(J),this;return X.triggerManager?.getInstance?.().registerMouseMove(this,{type:J?.type??"distance",target:J?.target,smooth:J?.smooth,startProgress:J?.startProgress,leaveProgress:J?.leaveProgress}),this}_setupMouseMoveEachMode(J){if(!J.target)return;let $=[];if(typeof J.target==="string"){if(typeof document<"u")$=Array.from(document.querySelectorAll(J.target))}else $=[J.target];let Q=X.triggerManager?.getInstance?.();if(!Q)return;this._setupEachModeGeneric($,(q,Z)=>{Q.registerMouseMove(q,{type:J.type??"distance",target:Z,smooth:J.smooth,startProgress:J.startProgress,leaveProgress:J.leaveProgress})})}onPageLoad(J){return X.triggerManager?.getInstance?.().registerPageLoad(this,J||{}),this}onPageExit(J){return X.triggerManager?.getInstance?.().registerPageExit(this,J||{}),this}onGesture(J){if(J.each)return this._setupGestureEachMode(J),this;return X.triggerManager?.getInstance?.().registerGesture(this,J),this}_setupGestureEachMode(J){let $=[];if(J.target)if(typeof J.target==="string"){if(typeof document<"u")$=Array.from(document.querySelectorAll(J.target))}else $=[J.target];else $=this._getAllAnimationTargets();if(this._setupEachModeGeneric($,()=>{}),!this._eachInstances||this._eachInstances.length===0)return;let Q=X.triggerManager?.getInstance?.();if(!Q)return;for(let q=0;q<$.length;q++){let Z=$[q],j=this._eachInstances[q];Q.registerGesture(j,{...J,target:Z,each:!1,_siblings:this._eachInstances,_index:q})}}onCursor(J){return X.triggerManager?.getInstance?.().registerCursor(this,J),this}_updateCallbackChild(J,$,Q){let q=J.startTime,Z=$<q&&this._time>=q,j=$>q&&this._time<=q,z=Math.abs(this._time-q)<0.001;if(Z||j||z&&Q===0){let G=J.child,N=J.params||[];G(...N)}}_updateAnimationChild(J,$){let Q=J.child,q=Math.abs(Q.getTimeScale())||1,Z=Q.totalDuration()/q,j=this._time-J.startTime,z=j*q;if(j>=0&&j<=Z){if(!Q.isActive())Q.captureStartValues(),Q.play();Q.renderAtTime(z)}else if(j<0){if(!Q.isLazyCapture())Q.renderAtTime(0);if(Q.isActive())Q.pause(),Q.fireReverseComplete()}else if(Q.isActive())Q.renderAtTime(Q.totalDuration()),Q.pause();else if($===0)Q.renderAtTime(Q.totalDuration())}_updateTimelineChild(J,$){let Q=J.child,q=Q.duration(),Z=this._time-J.startTime;if(Z>=0&&Z<=q){if(!Q.isActive())Q.play();Q.time(Z)}else if(Q.isActive())if(Z<0)Q.time(0),Q.pause();else Q.time(q),Q.pause();else if($===0)if(Z<0);else Q.time(q)}update(J){if(this._eachInstances){for(let q of this._eachInstances)q.update(J);return}let $=this._time;if(!this._isActive&&J===0);else if(!this._isActive)return;let Q=J*this._timeScale;if(this._inRepeatDelay&&J>0){if(this._repeatDelayCounter-=Q,this._repeatDelayCounter>0)return;if(this._inRepeatDelay=!1,this._repeatDelayCounter=0,this._isReversed){this._time=this._duration;for(let q of this._children)if(q.type==="animation")q.child.resetForReplay()}else this._time=0,this._startFired=!1,this._resetChildrenForCycle()}else if(!this._inRepeatDelay){if(this._time+=this._isReversed?-Q:Q,J>0){if(!this._isReversed&&this._time>=this._duration&&this._repeat!==0){if(this._repeat===-1||this._currentRepeat<this._repeat){this._time=this._duration,this._currentRepeat++;try{this._onRepeat?.(this._currentRepeat)}catch(Z){console.error("[Motion] onRepeat callback error:",Z)}if(this._yoyo){this._isReversed=!0;for(let Z of this._children)if(Z.type==="animation")Z.child.resetForReplay()}else this._time=0,this._startFired=!1,this._resetChildrenForCycle();if(this._repeatDelay>0)this._inRepeatDelay=!0,this._repeatDelayCounter=this._repeatDelay}}else if(this._isReversed&&this._time<=0&&this._yoyo&&this._repeat!==0){if(this._repeat===-1||this._currentRepeat<this._repeat){this._time=0,this._currentRepeat++;try{this._onRepeat?.(this._currentRepeat)}catch(Z){console.error("[Motion] onRepeat callback error:",Z)}if(this._isReversed=!1,this._startFired=!1,this._resetChildrenForCycle(),this._repeatDelay>0)this._inRepeatDelay=!0,this._repeatDelayCounter=this._repeatDelay}}}}if(this._time<0)this._time=0;else if(this._time>this._duration)this._time=this._duration;if(this._progress=this._duration>0?this._time/this._duration:0,!this._startFired&&this._isActive&&this._time>0)this._startFired=!0,this._disableTransitions(),this._applyWillChange(),this._onStart?.();if(this._isActive)this._onUpdate?.(this._progress,this._time);for(let q of this._children)if(q.type==="callback")this._updateCallbackChild(q,$,J);else if(q.type==="animation")this._updateAnimationChild(q,J);else if(q.type==="timeline")this._updateTimelineChild(q,J);if(!this._completeFired){let q=!this._isReversed&&this._time>=this._duration,Z=this._isReversed&&this._time<=0,j=this._repeat!==-1&&this._currentRepeat>=this._repeat;if(q&&(this._repeat===0||j))this._completeFired=!0,this._isActive=!1,this._startFired=!1,this._restoreTransitions(),this._onComplete?.();else if(Z&&(this._repeat===0||this._yoyo&&j))this._completeFired=!0,this._isActive=!1,this._startFired=!1,this._restoreTransitions(),this._onComplete?.()}}play(J){if(this._killed)return console.warn("[Motion] Cannot play a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let $ of this._eachInstances)$.play(J);return this}if(J!==void 0){if(this._time=J,this._progress=this._duration>0?this._time/this._duration:0,J===0)this._currentRepeat=0,this._inRepeatDelay=!1,this._repeatDelayCounter=0}else if(this._time>=this._duration&&!this._isReversed)return this;return this._completeFired=!1,this._isReversed=!1,this._isActive=!0,this._atZeroState=!1,this}pause(J){if(this._killed)return console.warn("[Motion] Cannot pause a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let $ of this._eachInstances)$.pause(J);return this}if(J!==void 0)this._time=J,this._progress=this._duration>0?this._time/this._duration:0;this._isActive=!1;for(let $ of this._children)if($.type!=="callback"){let Q=$.child;if("pause"in Q)Q.pause()}return this}reverse(J){if(this._killed)return console.warn("[Motion] Cannot reverse a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let $ of this._eachInstances)$.reverse(J);return this}if(J!==void 0)this._time=J,this._progress=this._duration>0?this._time/this._duration:0;else if(this._time<=0&&this._isReversed)return this;return this._completeFired=!1,this._inRepeatDelay=!1,this._repeatDelayCounter=0,this._isReversed=!0,this._isActive=!0,this._atZeroState=!1,this}restart(){if(this._killed)return console.warn("[Motion] Cannot restart a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let J of this._eachInstances)J.restart();return this}this._time=0,this._progress=0,this._isActive=!0,this._isReversed=!1,this._startFired=!1,this._atZeroState=!1,this._currentRepeat=0,this._completeFired=!1,this._inRepeatDelay=!1,this._repeatDelayCounter=0;for(let J of this._children)if(J.type==="animation")J.child.resetForReplay();return this._restoreInitialValues(),this._renderPositionZeroAnimations(),this}_resetChildrenForCycle(){for(let J of this._children)if(J.type==="animation")J.child.resetForReplay();this._restoreInitialValues(),this._renderPositionZeroAnimations()}_renderPositionZeroAnimations(){for(let J of this._children)if(J.type==="animation"){let $=J.child;if(!$.isLazyCapture())$.renderAtTime(0);if($.isActive())$.pause()}else if(J.type==="timeline")J.child.progress(0)}seek(J){if(this._killed)return console.warn("[Motion] Cannot seek a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let $ of this._eachInstances)$.seek(J);return this}return this._time=Math.max(0,Math.min(J,this._duration)),this._progress=this._duration>0?this._time/this._duration:0,this._atZeroState=!1,this.update(0),this}setAxisProgress(J,$){let Q=Math.max(0,Math.min(1,$));for(let q of this._children)if(q.type==="animation"&&q.builder){if(q.builder.getConfig().axis===J){let j=q.child,z=j.totalDuration();if(!j.isActive())j.captureStartValues(),j.play();j.renderAtTime(Q*z)}}return this}onStart(J){return this._onStart=J,this}onUpdate(J){return this._onUpdate=J,this}onComplete(J){return this._onComplete=J,this}onRepeat(J){return this._onRepeat=J,this}withRepeat(J){if(typeof J==="number")this._repeat=J,this._repeatDelay=0,this._yoyo=!1;else this._repeat=J.times,this._repeatDelay=J.delay??0,this._yoyo=J.yoyo??!1;return this}progress(J){if(J===void 0){if(this._eachInstances&&this._eachInstances.length>0){let Q=0;for(let q of this._eachInstances){let Z=q.progress();if(Z>Q)Q=Z}return Q}return this._progress}if(this._eachInstances){for(let Q of this._eachInstances)Q.progress(J);return this}let $=Math.max(0,Math.min(1,J));if($===0){for(let Q of this._children)if(Q.type==="animation")Q.child.resetForReplay()}if(this._time=$*this._duration,this._progress=$,$===0)if(this._atZeroState);else this._restoreInitialValues(),this._renderPositionZeroAnimations(),this._atZeroState=!0;else this._atZeroState=!1,this.update(0);return this._onUpdate?.(this._progress,this._time),this}time(J){if(J===void 0){if(this._eachInstances&&this._eachInstances.length>0){let $=0;for(let Q of this._eachInstances){let q=Q.time();if(q>$)$=q}return $}return this._time}if(this._eachInstances){for(let $ of this._eachInstances)$.time(J);return this}return this._time=Math.max(0,Math.min(J,this._duration)),this._progress=this._duration>0?this._time/this._duration:0,this.update(0),this}timeScale(J){if(J===void 0)return this._timeScale;return this._timeScale=J,this}kill(J=!0){if(this._killed=!0,this._isActive=!1,this._atZeroState=!1,X.triggerManager?.getInstance?.().unregister(this),this._eachInstances){for(let $ of this._eachInstances)$.kill(J);this._eachInstances=void 0}if(this._clearTransitionData(),J&&(this._initialValues.size>0||this._transformElements.size>0))this._restoreInitialValues();for(let $ of this._children)if($.type==="animation"){let Q=$.child;Q.setTimelineChild(!1),Q.kill()}else if($.type==="timeline")$.child.kill(J);if(this._unregisterCallback)this._unregisterCallback(),this._unregisterCallback=void 0;this._children=[],this._initialValues.clear(),this._initialTransforms.clear(),this._transformElements.clear(),this._savedTransitions.clear(),this._savedWillChange.clear(),this._willChangeApplied=!1,this._transitionsDisabled=!1,this._duration=0,this._time=0,this._progress=0,this._previousStart=0,this._previousEnd=0,this._isReversed=!1,this._startFired=!1,this._currentRepeat=0,this._completeFired=!1,this._inRepeatDelay=!1,this._repeatDelayCounter=0}isActive(){if(this._eachInstances)return this._eachInstances.some((J)=>J.isActive());return this._isActive}reversed(){if(this._eachInstances)return this._eachInstances.some((J)=>J.reversed());return this._isReversed}getName(){return this._name}getFirstChildAnimation(){let J=this._children[0];if(J?.type==="animation")return J.child;return null}}function V0(J,$,Q){let q=J;if(T($)){let z=Q??($.startsWith("scale")?"":"px");return(G)=>{S(J,$,G,z),q.style.transform=E(J)}}if($.startsWith("--")){let z=Q??"";return(G)=>{q.style.setProperty($,`${G}${z}`)}}let Z=$.replace(/([A-Z])/g,"-$1").toLowerCase(),j=Q??"";return(z)=>{q.style.setProperty(Z,`${z}${j}`)}}var r6=new Set(["opacity","z-index","font-weight","line-height","flex","flex-grow","flex-shrink","order","scale","column-count","columns","tab-size","orphans","widows","zoom"]);function t6(J){if(typeof location>"u")return!J.includes(":");try{let $=new URL(J,location.href);return $.protocol==="https:"||$.protocol==="http:"}catch{return!J.includes(":")}}class N0 extends h{_element=null;_innerElement=null;_mousePos={x:-100,y:-100};_cursorPos={x:-100,y:-100};_xSetter=null;_ySetter=null;_squeezeSetter=null;_squeezeConfig={min:0.55,max:1.2,multiplier:150};_state="default";_stateTimelines=new Map;_parsedStates=new Map;_textElement=null;_mediaElement=null;_tickerCallback;_boundMouseMove;_boundMouseDown;_boundMouseUp;_hoverSelectors=null;_isHoveringCursorTarget=!1;_boundHoverTargetMoveHandler=null;_cursorStyleTag=null;_attributeListeners=new Map;constructor(J,$){super(J,$);if(this._config={type:"basic",smooth:0.25,hideNative:!1,...$},$.squeeze===!0)this._squeezeConfig={min:0.55,max:1.2,multiplier:150};else if(typeof $.squeeze==="object")this._squeezeConfig={min:$.squeeze.min??0.55,max:$.squeeze.max??1.2,multiplier:$.squeeze.multiplier??150};if(this._parsedStates.set("default",this._parseStateConfig($.default)),$.hover)this._parsedStates.set("hover",this._parseStateConfig($.hover));if($.click)this._parsedStates.set("click",this._parseStateConfig($.click))}_parseStateConfig(J){let{targets:$,duration:Q,ease:q,enabled:Z,...j}=J;return{properties:j,duration:Q??0.15,ease:q??"power3.inOut",targets:$,enabled:Z??!0}}_onEnable(){if(this._element=this._createContainer(),this._innerElement=document.createElement("div"),this._innerElement.setAttribute("data-cursor-inner",""),this._innerElement.style.cssText="pointer-events:none;position:absolute;top:0;left:0;",this._element.appendChild(this._innerElement),S(this._innerElement,"x",-50,"%"),S(this._innerElement,"y",-50,"%"),this._xSetter=V0(this._element,"x","px"),this._ySetter=V0(this._element,"y","px"),this._config.squeeze)this._squeezeSetter=V0(this._element,"scale");if(this._cursorPos={x:-100,y:-100},this._mousePos={x:-100,y:-100},this._xSetter(-100),this._ySetter(-100),this._applyProperties(this._parsedStates.get("default").properties),this._innerElement.style.transform=E(this._innerElement),this._config.hideNative)this._cursorStyleTag=document.createElement("style"),this._cursorStyleTag.setAttribute("data-cursor-hide",""),this._cursorStyleTag.textContent="* { cursor: none !important; }",document.head.appendChild(this._cursorStyleTag);if(this._config.type==="text")this._setupTextCursor();else if(this._config.type==="media")this._setupMediaCursor();this._createStateTimelines(),this._setupEventListeners(),this._tickerCallback=(J)=>this._tick(J),C.getInstance().add(this._tickerCallback)}_onDisable(){if(this._tickerCallback)C.getInstance().remove(this._tickerCallback),this._tickerCallback=void 0;if(this._cursorStyleTag)this._cursorStyleTag.remove(),this._cursorStyleTag=null;if(this._removeEventListeners(),this._stateTimelines.forEach((J)=>J.kill()),this._stateTimelines.clear(),this._innerElement?.parentNode)this._innerElement.remove();if(this._innerElement=null,this._element?.parentNode)this._element.remove();this._element=null}_createContainer(){let J=document.createElement("div");return J.setAttribute("data-cursor-container",""),J.style.cssText="position:fixed;top:0;left:0;pointer-events:none;z-index:999999;width:0;height:0;",document.body.appendChild(J),J}_applyProperties(J){if(!this._innerElement)return;for(let[$,Q]of Object.entries(J))if($==="transform"){let q=N0._expandTransformShorthand(String(Q));for(let[Z,j]of Object.entries(q))S(this._innerElement,Z,j)}else{let q=s($),Z=typeof Q==="number"&&!r6.has(q)?`${Q}px`:String(Q);this._innerElement.style.setProperty(q,Z)}}_createStateTimelines(){if(!this._innerElement)return;let J=this._parsedStates.get("hover");if(J&&J.enabled){let Q=new b;Q._addEntry(this._innerElement,{to:N0._expandStateProperties(J.properties),duration:J.duration,ease:J.ease}),this._stateTimelines.set("hover",Q)}let $=this._parsedStates.get("click");if($&&$.enabled){let Q=new b;Q._addEntry(this._innerElement,{to:N0._expandStateProperties($.properties),duration:$.duration,ease:$.ease}),this._stateTimelines.set("click",Q)}}static _expandStateProperties(J){let $={};for(let[Q,q]of Object.entries(J))if(Q==="transform"){let Z=N0._expandTransformShorthand(String(q));Object.assign($,Z)}else $[Q]=q;return $}static _expandTransformShorthand(J){let $={},Q=/([a-zA-Z0-9]+)\(([^)]+)\)/g,q;while((q=Q.exec(J))!==null){let Z=q[1],j=q[2].split(",").map((z)=>parseFloat(z.trim()));switch(Z){case"scale":{let z=j[0]??1,G=j.length>1?j[1]:z;if(z===G)$.scale=z;else $.scaleX=z,$.scaleY=G;break}case"scaleX":$.scaleX=j[0]??1;break;case"scaleY":$.scaleY=j[0]??1;break;case"scaleZ":$.scaleZ=j[0]??1;break;case"rotate":$.rotate=j[0]??0;break;case"rotateX":$.rotateX=j[0]??0;break;case"rotateY":$.rotateY=j[0]??0;break;case"rotateZ":$.rotateZ=j[0]??0;break;case"skewX":$.skewX=j[0]??0;break;case"skewY":$.skewY=j[0]??0;break}}return $}_setupEventListeners(){if(this._boundMouseMove=(Q)=>{this._mousePos.x=Q.clientX,this._mousePos.y=Q.clientY},document.addEventListener("mousemove",this._boundMouseMove),this._parsedStates.get("click")?.enabled)this._boundMouseDown=()=>this._setState("click"),this._boundMouseUp=()=>this._setState(this._state==="click"?"default":this._state),document.addEventListener("mousedown",this._boundMouseDown),document.addEventListener("mouseup",this._boundMouseUp);let $=this._parsedStates.get("hover");if($?.enabled&&$.targets&&$.targets.length>0)this._setupHoverTargets($.targets)}_setupHoverTargets(J){this._hoverSelectors=J,this._boundHoverTargetMoveHandler=($)=>{let q=document.elementsFromPoint($.clientX,$.clientY).some((Z)=>this._hoverSelectors.some((j)=>{try{return Z.matches(j)}catch{return!1}}));if(q&&!this._isHoveringCursorTarget)this._isHoveringCursorTarget=!0,this._setState("hover");else if(!q&&this._isHoveringCursorTarget){if(this._isHoveringCursorTarget=!1,this._state==="hover")this._setState("default")}},window.addEventListener("mousemove",this._boundHoverTargetMoveHandler)}_setupTextCursor(){if(!this._innerElement)return;this._innerElement.style.display="grid",this._innerElement.style.placeItems="center",this._innerElement.style.overflow="visible",this._textElement=document.createElement("div"),this._textElement.setAttribute("data-cursor-text",""),this._textElement.style.whiteSpace="nowrap",this._textElement.style.opacity="0",this._innerElement.appendChild(this._textElement);let $=this._parsedStates.get("hover")?.duration??0.15;if(this._textElement.style.transition=`opacity ${$}s ease-in-out`,this._config.text)for(let[q,Z]of Object.entries(this._config.text))this._textElement.style.setProperty(s(q),String(Z));let Q=document.querySelectorAll("[mp-cursor-text], [mp-cursor-tooltip]");for(let q of Q){let Z=(z)=>{let G=z.target,N=G.getAttribute("mp-cursor-text")??G.getAttribute("mp-cursor-tooltip")??"";if(this._textElement)this._textElement.textContent=N,this._textElement.style.opacity="1";this._setState("hover")},j=()=>{if(this._textElement)this._textElement.style.opacity="0";if(this._state==="hover")this._setState("default")};q.addEventListener("mouseenter",Z),q.addEventListener("mouseleave",j),this._attributeListeners.set(q,{enter:Z,leave:j})}}_setupMediaCursor(){if(!this._innerElement)return;let J=document.createElement("img");J.setAttribute("data-cursor-media",""),J.style.display="none",this._innerElement.appendChild(J);let $=document.createElement("video");if($.setAttribute("data-cursor-media",""),$.autoplay=!0,$.muted=!0,$.loop=!0,$.style.display="none",this._innerElement.appendChild($),this._config.media)for(let[q,Z]of Object.entries(this._config.media))J.style.setProperty(s(q),String(Z)),$.style.setProperty(s(q),String(Z));let Q=document.querySelectorAll("[mp-cursor-media]");for(let q of Q){let Z=(z)=>{let G=z.target.getAttribute("mp-cursor-media")||"";if(!G||!t6(G)){if(G)console.warn(`[Motion] Blocked unsafe media URL: "${G}". Only http/https URLs and relative paths are allowed.`);return}if(G.endsWith(".mp4")||G.endsWith(".webm"))$.src=G,$.style.display="block",J.style.display="none",$.play().catch(()=>{}),this._mediaElement=$;else J.src=G,J.style.display="block",$.style.display="none",this._mediaElement=J;this._setState("hover")},j=()=>{if(J.style.display="none",$.style.display="none",$.pause(),this._state==="hover")this._setState("default")};q.addEventListener("mouseenter",Z),q.addEventListener("mouseleave",j),this._attributeListeners.set(q,{enter:Z,leave:j})}}_removeEventListeners(){if(this._boundMouseMove)document.removeEventListener("mousemove",this._boundMouseMove);if(this._boundMouseDown)document.removeEventListener("mousedown",this._boundMouseDown);if(this._boundMouseUp)document.removeEventListener("mouseup",this._boundMouseUp);if(this._boundHoverTargetMoveHandler)window.removeEventListener("mousemove",this._boundHoverTargetMoveHandler),this._boundHoverTargetMoveHandler=null;this._hoverSelectors=null,this._isHoveringCursorTarget=!1,this._attributeListeners.forEach((J,$)=>{$.removeEventListener("mouseenter",J.enter),$.removeEventListener("mouseleave",J.leave)}),this._attributeListeners.clear()}_setState(J){if(this._state===J)return;let $=this._state;this._state=J;let Q=this._stateTimelines.get(J),q=this._stateTimelines.get($);if(J==="default"){if(q)q.reverse()}else{if($!=="default"&&q)q.reverse();if(Q)Q.play()}}_tick(J){if(!this._xSetter||!this._ySetter)return;let $=this._config.smooth??0.25,Q=Math.pow($,2.5)||0.000001,q=1-Math.pow(1-Q,J*60);if(this._cursorPos.x+=(this._mousePos.x-this._cursorPos.x)*q,this._cursorPos.y+=(this._mousePos.y-this._cursorPos.y)*q,this._xSetter(this._cursorPos.x),this._ySetter(this._cursorPos.y),this._squeezeSetter&&this._config.squeeze){let Z=this._calculateSqueeze();this._squeezeSetter(Z)}for(let Z of this._stateTimelines.values())if(Z.isActive())Z.update(J)}_calculateSqueeze(){let J=this._cursorPos.x-this._mousePos.x,$=this._cursorPos.y-this._mousePos.y,Q=Math.sqrt(J*J+$*$),{min:q,max:Z,multiplier:j}=this._squeezeConfig,z=1-(Math.exp(Q/j)-1)/10;if(Number.isNaN(z))return 1;return Math.max(q,Math.min(Z,z))}getElement(){return this._element}getState(){return this._state}}F.registerTrigger("cursor",N0);class lJ extends h{_links=[];_listeners=new Map;_isNavigating=!1;_pendingUrl=null;_onCompleteHandler=null;_pollTimerId=null;constructor(J,$){super(J,$)}_onEnable(){if(this._isInsideBuilder())return;this._resolveLinks(),this._addClickListeners()}_onDisable(){if(this._cleanupListenerMap(this._listeners),this._links=[],this._isNavigating=!1,this._pendingUrl=null,this._pollTimerId!==null)clearTimeout(this._pollTimerId),this._pollTimerId=null;if(this._onCompleteHandler)this._onCompleteHandler=null}_isInsideBuilder(){try{if(typeof window<"u"&&window.top?.mp_iframe)return!0}catch{}return!1}_resolveLinks(){if(typeof document>"u")return;let J=this._config.mode||"all",$;if(J==="include"&&this._config.selectors&&this._config.selectors.trim()!=="")try{$=Array.from(document.querySelectorAll(this._config.selectors)).filter((q)=>q.tagName==="A"),document.querySelectorAll(this._config.selectors).forEach((q)=>{if(q.tagName!=="A"){let Z=q.querySelectorAll("a");$.push(...Array.from(Z))}})}catch(Q){console.warn(`[Motion] Invalid selector "${this._config.selectors}":`,Q),$=[]}else if(J==="include")$=[];else if(J==="exclude"&&this._config.selectors&&this._config.selectors.trim()!==""){let Q=Array.from(document.querySelectorAll("a")),q;try{q=new Set(document.querySelectorAll(this._config.selectors))}catch(Z){console.warn(`[Motion] Invalid selector "${this._config.selectors}":`,Z),q=new Set}$=Q.filter((Z)=>!q.has(Z))}else $=Array.from(document.querySelectorAll("a"));this._links=[...new Set($)],this._links=this._links.filter((Q)=>this._shouldIntercept(Q))}_shouldIntercept(J){let $=J.getAttribute("href");if(!$||$==="")return!1;let Q=this._config.skipHref||[];if($.startsWith("#"))return!Q.includes("anchor");if($.toLowerCase().startsWith("javascript:"))return!Q.includes("javascript");if($.toLowerCase().startsWith("mailto:")||$.toLowerCase().startsWith("tel:"))return!Q.includes("mailto");return!0}_addClickListeners(){this._links.forEach((J)=>{let $=new Map,Q=(q)=>{if(this._isNavigating)return;let Z=q;if(Z.ctrlKey||Z.metaKey||Z.shiftKey||Z.altKey)return;let j=J.getAttribute("target");if(j&&j!=="_self")return;let z=J.href;if(!z)return;q.preventDefault(),q.stopPropagation(),this._isNavigating=!0,this._pendingUrl=z,this._onCompleteHandler=()=>{this._navigate()},this._timeline.restart(),this._waitForCompletion()};J.addEventListener("click",Q),$.set("click",Q),this._listeners.set(J,$)})}_waitForCompletion(){let J=this._timeline,$=16,Q=()=>{if(this._pollTimerId=null,!this._enabled||!this._isNavigating||!this._pendingUrl)return;let q=J.progress(),Z=J.isActive();if(q>=1||!Z&&q>0)this._navigate();else this._pollTimerId=setTimeout(Q,16)};this._pollTimerId=setTimeout(Q,16)}_navigate(){if(!this._pendingUrl)return;let J=this._pendingUrl;if(this._pendingUrl=null,this._isNavigating=!1,typeof window<"u")window.location.href=J}}F.registerTrigger("pageExit",lJ);var BJ=null;function e6(){if(!BJ&&typeof document<"u"){let J=document.createElement("canvas");J.width=1,J.height=1,BJ=J.getContext("2d")}return BJ}function oJ(J){let $=J.replace("#",""),Q,q,Z,j=1;if($.length===3)Q=parseInt($[0]+$[0],16),q=parseInt($[1]+$[1],16),Z=parseInt($[2]+$[2],16);else if($.length===4)Q=parseInt($[0]+$[0],16),q=parseInt($[1]+$[1],16),Z=parseInt($[2]+$[2],16),j=parseInt($[3]+$[3],16)/255;else if($.length===6)Q=parseInt($.slice(0,2),16),q=parseInt($.slice(2,4),16),Z=parseInt($.slice(4,6),16);else if($.length===8)Q=parseInt($.slice(0,2),16),q=parseInt($.slice(2,4),16),Z=parseInt($.slice(4,6),16),j=parseInt($.slice(6,8),16)/255;else return null;if(isNaN(Q)||isNaN(q)||isNaN(Z)||isNaN(j))return null;return new Float32Array([Q,q,Z,j])}function J7(J){let $=J.match(/rgba?\s*\(\s*([\d.]+)\s*[,\s]\s*([\d.]+)\s*[,\s]\s*([\d.]+)\s*(?:[,\/]\s*([\d.]+))?\s*\)/i);if(!$)return null;let Q=parseFloat($[1]),q=parseFloat($[2]),Z=parseFloat($[3]),j=$[4]!==void 0?parseFloat($[4]):1;if(isNaN(Q)||isNaN(q)||isNaN(Z)||isNaN(j))return null;return new Float32Array([Q,q,Z,j])}function $7(J,$,Q){J=J/360,$=$/100,Q=Q/100;let q,Z,j;if($===0)q=Z=j=Q;else{let z=(W,B,Y)=>{if(Y<0)Y+=1;if(Y>1)Y-=1;if(Y<0.16666666666666666)return W+(B-W)*6*Y;if(Y<0.5)return B;if(Y<0.6666666666666666)return W+(B-W)*(0.6666666666666666-Y)*6;return W},G=Q<0.5?Q*(1+$):Q+$-Q*$,N=2*Q-G;q=z(N,G,J+0.3333333333333333),Z=z(N,G,J),j=z(N,G,J-0.3333333333333333)}return[Math.round(q*255),Math.round(Z*255),Math.round(j*255)]}function Q7(J){let $=J.match(/hsla?\s*\(\s*([\d.]+)\s*[,\s]\s*([\d.]+)%\s*[,\s]\s*([\d.]+)%\s*(?:[,\/]\s*([\d.]+))?\s*\)/i);if(!$)return null;let Q=parseFloat($[1]),q=parseFloat($[2]),Z=parseFloat($[3]),j=$[4]!==void 0?parseFloat($[4]):1;if(isNaN(Q)||isNaN(q)||isNaN(Z)||isNaN(j))return null;let[z,G,N]=$7(Q,q,Z);return new Float32Array([z,G,N,j])}function q7(J,$){if(!$||typeof window>"u")return null;let Q=J.match(/var\s*\(\s*(--[\w-]+)\s*\)/i);if(!Q)return null;let q=Q[1],Z=window.getComputedStyle($).getPropertyValue(q).trim();if(!Z)return null;return YJ(Z,$)}function Z7(J){let $=e6();if(!$)return null;$.fillStyle="#000000",$.fillStyle=J;let Q=$.fillStyle;if(Q==="#000000"&&J.toLowerCase()!=="black"&&J!=="#000000"&&J!=="#000")return null;return oJ(Q)}function YJ(J,$){if(!J||typeof J!=="string")return null;let Q=J.trim().toLowerCase();if(Q==="transparent")return new Float32Array([0,0,0,0]);if(Q.startsWith("#"))return oJ(Q);if(Q.startsWith("rgb"))return J7(Q);if(Q.startsWith("hsl"))return Q7(Q);if(Q.startsWith("var("))return q7(Q,$);return Z7(Q)}function j7(J,$){if(typeof window>"u")return new Float32Array([0,0,0,1]);let Q=window.getComputedStyle(J),q=$.replace(/[A-Z]/g,(z)=>`-${z.toLowerCase()}`),Z=Q.getPropertyValue(q).trim();if(!Z||Z==="none")return new Float32Array([0,0,0,0]);return YJ(Z,J)||new Float32Array([0,0,0,1])}X.color={parseColor:YJ,getCurrentColor:j7};var iJ={blur:{value:0,unit:"px"},brightness:{value:1,unit:""},contrast:{value:1,unit:""},saturate:{value:1,unit:""},grayscale:{value:0,unit:""},sepia:{value:0,unit:""},"hue-rotate":{value:0,unit:"deg"},invert:{value:0,unit:""},opacity:{value:1,unit:""}};function G7(J){let $=J.trim().match(/^([\w-]+)\(\s*([\d.]+)(px|%|deg)?\s*\)$/);if(!$)return null;let Q=$[1].toLowerCase(),q=parseFloat($[2]),Z=$[3]||"";if(Z==="%")q=q/100,Z="";return{name:Q,value:q,unit:Z}}function nJ(J){if(J===null||J===void 0||typeof J!=="string")return null;let $=J.trim().toLowerCase();if($==="none"||$==="")return[];let Q=[],q=/([\w-]+)\([^)]+\)/g,Z;while((Z=q.exec($))!==null){let j=G7(Z[0]);if(j)Q.push(j)}return Q.length>0?Q:null}function z7(J){let $=iJ[J.name];if(!$)return!1;return J.value===$.value}function N7(J){if(!J||J.length===0)return"none";if(J.every(z7))return"none";return J.map(($)=>{let Q;if($.name==="blur")Q=`${$.value}${$.unit||"px"}`;else if($.name==="hue-rotate")Q=`${$.value}${$.unit||"deg"}`;else Q=`${$.value}`;return`${$.name}(${Q})`}).join(" ")}function W7(J){if(typeof window>"u")return[];let $=window.getComputedStyle(J),Q=$.filter||$.getPropertyValue("filter");if(!Q||Q==="none")return[];return nJ(Q)||[]}function B7(J){let $=iJ[J];if($)return{name:J,value:$.value,unit:$.unit};return{name:J,value:0,unit:""}}function Y7(J,$){let Q=new Set;for(let j of J)Q.add(j.name);for(let j of $)Q.add(j.name);let q=[],Z=[];for(let j of Q){let z=J.find((W)=>W.name===j),G=$.find((W)=>W.name===j),N=B7(j);q.push(z||N),Z.push(G||N)}return{start:q,end:Z}}var W0=[];function _7(J,$,Q){let q=J.length;if(W0.length<q)for(let Z=W0.length;Z<q;Z++)W0.push({name:"",value:0,unit:""});for(let Z=0;Z<q;Z++){let j=J[Z],z=$[Z],G=W0[Z];G.name=j.name,G.value=j.value+(z.value-j.value)*Q,G.unit=j.unit||z.unit}return W0.length=q,W0}X.filter={parseFilter:nJ,getCurrentFilter:W7,mergeFilterArrays:Y7,interpolateFilters:_7,filterToString:N7};var aJ=new WeakMap;function H7(J){return"getTotalLength"in J&&typeof J.getTotalLength==="function"}function w0(J){let $=aJ.get(J);if($!==void 0)return $;if(H7(J)){let Q=J.getTotalLength();return aJ.set(J,Q),Q}return 0}function X7(J,$){if(J===null||J===void 0)return null;if(typeof J==="object"){let Q=J.start??0,q=J.end??100;return{start:Q/100,end:q/100}}if(typeof J==="string"){let Q=J.trim();if(Q==="true")return{start:0,end:1};if(Q==="false"||Q===""||Q==="none")return{start:0,end:0};let q=Q.match(/^([-\d.]+)(px|%)?\s+([-\d.]+)(px|%)?$/);if(q){let j=parseFloat(q[1]),z=q[2]||"%",G=parseFloat(q[3]),N=q[4]||"%",W=$?w0($):0,B=_J(j,z,W),Y=_J(G,N,W);return{start:B,end:Y}}let Z=Q.match(/^([-\d.]+)(px|%)?$/);if(Z){let j=parseFloat(Z[1]),z=Z[2]||"%",G=$?w0($):0;return{start:0,end:_J(j,z,G)}}}return null}function _J(J,$,Q){if($==="px"&&Q>0)return J/Q;return J/100}function K7(J){let $=w0(J);if($===0)return{start:0,end:1};try{if(typeof window<"u"&&window.getComputedStyle){let Q=window.getComputedStyle(J),q=Q.strokeDasharray,Z=Q.strokeDashoffset;if(!q||q==="none")return{start:0,end:1};let j=q.split(/[\s,]+/).map(parseFloat).filter((G)=>!isNaN(G)),z=parseFloat(Z)||0;if(j.length>=1){let G=j[0],N=z/$,W=(z+G)/$;return{start:N,end:W}}}}catch{}return{start:0,end:1}}function U7(J,$,Q,q){if(!(J instanceof SVGElement)||q===0)return;let Z=J,j=Math.abs(Q-$)*q,z=Math.min($,Q)*q;Z.style.strokeDasharray=`${j} ${q}`,Z.style.strokeDashoffset=`${-z}`}X.drawSVG={parseDrawSVG:X7,getCurrentDrawSVG:K7,getPathLength:w0,applyDrawSVG:U7};var P0=new WeakMap,S0=new WeakMap;class y0{static split(J,$,Q){if(!(J instanceof HTMLElement))return[];let q=P0.get(J);if(q!==void 0)J.innerHTML=q,J.removeAttribute("data-split"),S0.delete(J);else P0.set(J,J.innerHTML);let Z={chars:[],words:[],lines:[],elements:[]},j=$.split(",").map((W)=>W.trim()),z=j.includes("chars"),G=j.includes("words"),N=j.includes("lines");if(N)this._splitWithLinesDom(J,G,z,Z);else if(G&&z)this._splitWordsWithCharsDom(J,Z);else if(G)this._splitWordsDom(J,Z);else if(z)this._splitCharsDom(J,Z);if(z)Z.elements=Z.chars;else if(G)Z.elements=Z.words;else if(N)Z.elements=Z.lines;if(Q?.mask&&Z.elements.length>0)this._applyMaskWrappers(Z);return S0.set(J,Z),J.setAttribute("data-split",$),Z.elements}static _splitWordsDom(J,$){let Q=Array.from(J.childNodes);for(let q of Q)if(q.nodeType===3){let Z=q.textContent||"";if(!Z)continue;let j=Z.split(/(\s+)/),z=document.createDocumentFragment(),G=!1;for(let N of j)if(/^\s+$/.test(N))z.appendChild(document.createTextNode(N.replace(/\n/g," "))),G=!0;else if(N){let W=document.createElement("span");W.setAttribute("data-split-word",""),W.setAttribute("data-word-index",String($.words.length)),W.style.display="inline-block",W.textContent=N,$.words.push(W),z.appendChild(W),G=!0}if(G)J.replaceChild(z,q)}else if(q.nodeType===1){let Z=q;if(Z.tagName==="BR")continue;this._splitWordsDom(Z,$)}}static _splitCharsDom(J,$){let Q=Array.from(J.childNodes);for(let q of Q)if(q.nodeType===3){let Z=q.textContent||"";if(!Z)continue;let j=Z.split(/(\s+)/),z=document.createDocumentFragment();for(let G of j)if(/^\s+$/.test(G))z.appendChild(document.createTextNode(G.replace(/\n/g," ")));else if(G){let N=document.createElement("span");N.style.display="inline-block",N.style.whiteSpace="nowrap";for(let W of G){let B=document.createElement("span");B.setAttribute("data-split-char",""),B.setAttribute("data-char-index",String($.chars.length)),B.style.display="inline-block",B.textContent=W,$.chars.push(B),N.appendChild(B)}z.appendChild(N)}J.replaceChild(z,q)}else if(q.nodeType===1){let Z=q;if(Z.tagName==="BR")continue;this._splitCharsDom(Z,$)}}static _splitWordsWithCharsDom(J,$){let Q=Array.from(J.childNodes);for(let q of Q)if(q.nodeType===3){let Z=q.textContent||"";if(!Z)continue;let j=Z.split(/(\s+)/),z=document.createDocumentFragment();for(let G of j)if(/^\s+$/.test(G))z.appendChild(document.createTextNode(G.replace(/\n/g," ")));else if(G){let N=document.createElement("span");N.setAttribute("data-split-word",""),N.setAttribute("data-word-index",String($.words.length)),N.style.display="inline-block",N.style.whiteSpace="nowrap";for(let W of G){let B=document.createElement("span");B.setAttribute("data-split-char",""),B.setAttribute("data-char-index",String($.chars.length)),B.style.display="inline-block",B.textContent=W,$.chars.push(B),N.appendChild(B)}$.words.push(N),z.appendChild(N)}J.replaceChild(z,q)}else if(q.nodeType===1){let Z=q;if(Z.tagName==="BR")continue;this._splitWordsWithCharsDom(Z,$)}}static _splitWithLinesDom(J,$,Q,q){let Z={chars:[],words:[],lines:[],elements:[]};this._splitWordsDom(J,Z);let j=[],z=[],G=-1/0;for(let _ of Z.words){let H=_.getBoundingClientRect();if(H.top>G+2){if(z.length>0)j.push(z);z=[_],G=H.top}else z.push(_)}if(z.length>0)j.push(z);let N=new Map;for(let _ of Z.words)N.set(_,this._getWrapperChain(_,J));let W="",B=0,Y=0,U=0;for(let _ of j){let H="",I=[];for(let K=0;K<_.length;K++){let M=_[K],k=M.textContent||"",L=N.get(M)||[],O=0;while(O<I.length&&O<L.length&&I[O]===L[O])O++;for(let v=I.length-1;v>=O;v--)H+=`</${I[v].tagName.toLowerCase()}>`;if(K>0)H+=" ";for(let v=O;v<L.length;v++)H+=this._openTag(L[v]);if(Q){let v="";for(let c0 of k)v+=`<span data-split-char data-char-index="${U}" style="display:inline-block">${this._escapeHtml(c0)}</span>`,U++;if($)H+=`<span data-split-word data-word-index="${Y}" style="display:inline-block;white-space:nowrap">${v}</span>`;else H+=v}else if($)H+=`<span data-split-word data-word-index="${Y}" style="display:inline-block">${this._escapeHtml(k)}</span>`;else H+=this._escapeHtml(k);Y++,I=L}for(let K=I.length-1;K>=0;K--)H+=`</${I[K].tagName.toLowerCase()}>`;W+=`<span data-split-line data-line-index="${B}" style="display:block">${H}</span>`,B++}if(J.innerHTML=W,Q)q.chars=Array.from(J.querySelectorAll("[data-split-char]"));if($)q.words=Array.from(J.querySelectorAll("[data-split-word]"));q.lines=Array.from(J.querySelectorAll("[data-split-line]"))}static _applyMaskWrappers(J){let $=J.elements;for(let Q of $){let q=Q.hasAttribute("data-split-line"),Z=Q.hasAttribute("data-split-word"),j=document.createElement("span");if(j.setAttribute("data-split-mask",""),j.style.overflow="hidden",j.style.display=q?"block":"inline-block",!q)j.style.verticalAlign=Z?"bottom":"bottom";Q.parentNode.insertBefore(j,Q),j.appendChild(Q)}}static revert(J){let $=P0.get(J);if($!==void 0&&J instanceof HTMLElement)return J.innerHTML=$,J.removeAttribute("data-split"),P0.delete(J),S0.delete(J),!0;return!1}static isSplit(J){return J.hasAttribute("data-split")}static getResult(J){return S0.get(J)}static _getWrapperChain(J,$){let Q=[],q=J.parentElement;while(q&&q!==$)Q.unshift(q),q=q.parentElement;return Q}static _openTag(J){let $=J.tagName.toLowerCase(),Q="";for(let q of Array.from(J.attributes))Q+=` ${q.name}="${this._escapeHtml(q.value)}"`;return`<${$}${Q}>`}static _escapeHtml(J){return J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}}X.textSplitter={split:(J,$,Q)=>y0.split(J,$,Q),revert:y0.revert,isSplit:y0.isSplit};class rJ{static resolve(J,$){if(J.length===0)return[];if(J.length===1)return[0];if(typeof $==="number")return J.map((Q,q)=>q*$);return this.resolveComplexStagger(J,$)}static resolveComplexStagger(J,$){let Q=J.length;if(Q===1)return[0];let q;if($.each!==void 0)q=$.each;else if($.amount!==void 0)q=$.amount/(Q-1);else q=0.1;let Z=this.getOrdering(J,$),j=Array(Q);for(let z=0;z<Q;z++)j[Z[z].originalIndex]=Z[z].order*q;return j}static getOrdering(J,$){let Q=J.length,q=$.from??"start";if($.grid)return this.getGridOrdering(J,$);switch(q){case"start":return J.map((Z,j)=>({originalIndex:j,order:j}));case"end":return J.map((Z,j)=>({originalIndex:j,order:Q-1-j}));case"center":{let Z=Math.floor(Q/2);return J.map((j,z)=>{let G=Math.abs(z-Z);return{originalIndex:z,order:G}})}case"edges":return J.map((Z,j)=>{let z=Math.min(j,Q-1-j);return{originalIndex:j,order:z}});case"random":{let Z=J.map((j,z)=>({originalIndex:z,order:Math.random()}));return Z.sort((j,z)=>j.order-z.order),Z.forEach((j,z)=>{j.order=z}),Z}default:if(typeof q==="number"){let Z=Math.max(0,Math.min(Q-1,q));return J.map((j,z)=>{let G=Math.abs(z-Z);return{originalIndex:z,order:G}})}return J.map((Z,j)=>({originalIndex:j,order:j}))}}static getGridOrdering(J,$){let Q,q;if($.grid==="auto"){let G=this.detectGrid(J);Q=G.cols,q=G.rows}else[Q,q]=$.grid;let Z=$.from??"start",j=$.axis??"x",z=J.map((G,N)=>{let W=N%Q,B=Math.floor(N/Q);return{originalIndex:N,col:W,row:B}});if(Z==="random"){let G=z.map((N)=>({originalIndex:N.originalIndex,order:Math.random()}));return G.sort((N,W)=>N.order-W.order),G.forEach((N,W)=>{N.order=W}),G}return z.map((G)=>{let N;if(typeof Z==="number"){let W=Z%Q,B=Math.floor(Z/Q);N=j==="x"?Math.abs(G.col-W)+Math.abs(G.row-B)*0.5:Math.abs(G.row-B)+Math.abs(G.col-W)*0.5}else if(Z==="center"){let W=(Q-1)/2,B=(q-1)/2;N=Math.abs(G.col-W)+Math.abs(G.row-B)}else if(Z==="edges"){let W=Math.min(G.col,Q-1-G.col),B=Math.min(G.row,q-1-G.row);N=Math.min(W,B)}else if(Z==="end")N=j==="x"?(q-1-G.row)*Q+(Q-1-G.col):(Q-1-G.col)*q+(q-1-G.row);else N=j==="x"?G.row*Q+G.col:G.col*q+G.row;return{originalIndex:G.originalIndex,order:N}})}static detectGrid(J){if(J.length===0)return{cols:0,rows:0};let $=J.filter((j)=>j instanceof Element);if($.length===0)return{cols:J.length,rows:1};let Q=new Map;$.forEach((j)=>{let z=j.getBoundingClientRect(),G=Math.round(z.top);Q.set(G,(Q.get(G)||0)+1)});let q=Q.size;return{cols:Math.ceil(J.length/q),rows:q}}}X.stagger={resolve:(J,$)=>rJ.resolve(J,$)};function I7(J,$,Q){if(!(J instanceof HTMLElement))return console.warn("[Motion Fit] Fit animations only support HTML elements. SVG elements are not supported."),null;let q=document.querySelector($);if(!q)return console.warn(`[Motion Fit] Target element not found: "${$}". Animation skipped.`),null;if(!(q instanceof HTMLElement))return console.warn("[Motion Fit] Fit animations only support HTML elements. SVG elements are not supported."),null;if(q===J)return console.warn("[Motion Fit] Target element is the same as source element. Animation skipped."),null;let Z=J.getBoundingClientRect(),j=q.getBoundingClientRect(),z=Z.width===0?1:Z.width,G=Z.height===0?1:Z.height,N=Z.left+z/2,W=Z.top+G/2,B=j.left+j.width/2,Y=j.top+j.height/2,U=B-N,_=Y-W,H=j.width/z,I=j.height/G;if(!Q)return{dx:U,dy:_,sx:H,sy:I,sourceWidth:Z.width,sourceHeight:Z.height,targetWidth:j.width,targetHeight:j.height};let K=J.offsetParent??document.documentElement,M=K.getBoundingClientRect(),k=K.scrollLeft??0,L=K.scrollTop??0;return{dx:U,dy:_,sx:H,sy:I,sourceWidth:Z.width,sourceHeight:Z.height,targetWidth:j.width,targetHeight:j.height,sourceLeft:J.offsetLeft,sourceTop:J.offsetTop,targetLeft:j.left-M.left+k,targetTop:j.top-M.top+L}}var o=0.01,tJ=0.001;function A7(J,$,Q,q){let{absolute:Z=!1,scale:j=!0,resize:z=!1}=Q;if($ instanceof HTMLElement){if(y($,!0),z)$.style.width="",$.style.height="";if(Z)$.style.width="",$.style.height="",$.style.left="",$.style.top=""}let G=I7($,Q.target,Z);if(!G)return;if(!Z)if(z){let N=G.dx-(G.targetWidth-G.sourceWidth)/2,W=G.dy-(G.targetHeight-G.sourceHeight)/2;if(Math.abs(N)>o){let B=q.acquire();B.init($,"x",0,N,"px"),J.addPropTween(B)}if(Math.abs(W)>o){let B=q.acquire();B.init($,"y",0,W,"px"),J.addPropTween(B)}if(Math.abs(G.targetWidth-G.sourceWidth)>o){let B=q.acquire();B.init($,"width",G.sourceWidth,G.targetWidth,"px"),J.addPropTween(B)}if(Math.abs(G.targetHeight-G.sourceHeight)>o){let B=q.acquire();B.init($,"height",G.sourceHeight,G.targetHeight,"px"),J.addPropTween(B)}}else{if(Math.abs(G.dx)>o){let N=q.acquire();N.init($,"x",0,G.dx,"px"),J.addPropTween(N)}if(Math.abs(G.dy)>o){let N=q.acquire();N.init($,"y",0,G.dy,"px"),J.addPropTween(N)}if(j){if(Math.abs(G.sx-1)>tJ){let N=q.acquire();N.init($,"scaleX",1,G.sx,""),J.addPropTween(N)}if(Math.abs(G.sy-1)>tJ){let N=q.acquire();N.init($,"scaleY",1,G.sy,""),J.addPropTween(N)}}}else{let N=$;if(window.getComputedStyle(N).position==="static")N.style.position="absolute";let{sourceLeft:B,sourceTop:Y,targetLeft:U,targetTop:_}=G;if(Math.abs(U-B)>o){let H=q.acquire();H.init($,"left",B,U,"px"),J.addPropTween(H)}if(Math.abs(_-Y)>o){let H=q.acquire();H.init($,"top",Y,_,"px"),J.addPropTween(H)}if(j){if(Math.abs(G.targetWidth-G.sourceWidth)>o){let H=q.acquire();H.init($,"width",G.sourceWidth,G.targetWidth,"px"),J.addPropTween(H)}if(Math.abs(G.targetHeight-G.sourceHeight)>o){let H=q.acquire();H.init($,"height",G.sourceHeight,G.targetHeight,"px"),J.addPropTween(H)}}}}function F7(J,$,Q,q){J.setPendingFitSetup((Z)=>A7(J,$,Q,Z)),J.setLazyStartCapture(!0)}X.fit={registerPendingSetup:F7};var Q6=(J)=>J,O7=Q6,R={in:(J)=>J*J,out:(J)=>J*(2-J),inOut:(J)=>J<0.5?2*J*J:-1+(4-2*J)*J},t={in:(J)=>J*J*J,out:(J)=>--J*J*J+1,inOut:(J)=>J<0.5?4*J*J*J:(J-1)*(2*J-2)*(2*J-2)+1},e={in:(J)=>J*J*J*J,out:(J)=>1- --J*J*J*J,inOut:(J)=>J<0.5?8*J*J*J*J:1-8*--J*J*J*J},d={in:(J)=>J*J*J*J*J,out:(J)=>1+--J*J*J*J*J,inOut:(J)=>J<0.5?16*J*J*J*J*J:1+16*--J*J*J*J*J};var v0={in:(J)=>1-Math.cos(J*Math.PI/2),out:(J)=>Math.sin(J*Math.PI/2),inOut:(J)=>-(Math.cos(Math.PI*J)-1)/2},h0={in:(J)=>2**(10*(J-1))*J+J*J*J*J*J*J*(1-J),out:(J)=>1-(2**(10*-J)*(1-J)+(1-J)*(1-J)*(1-J)*(1-J)*(1-J)*(1-J)*J),inOut:(J)=>{if(J<0.5){let Q=J*2;return(2**(10*(Q-1))*Q+Q*Q*Q*Q*Q*Q*(1-Q))/2}let $=(1-J)*2;return 1-(2**(10*($-1))*$+$*$*$*$*$*$*(1-$))/2}},T0={in:(J)=>1-Math.sqrt(1-J*J),out:(J)=>Math.sqrt(1- --J*J),inOut:(J)=>{if((J*=2)<1)return-0.5*(Math.sqrt(1-J*J)-1);return 0.5*(Math.sqrt(1-(J-=2)*J)+1)}};var f0=(J)=>J?--J*J*(2.70158*J+1.70158)+1:0,u0={in:(J)=>1-f0(1-J),out:f0,inOut:(J)=>{if(J<0.5)return(1-f0(1-J*2))/2;return 0.5+f0((J-0.5)*2)/2}},d0={in:(J)=>{if(J===0)return 0;if(J===1)return 1;let $=0.3,Q=$/4;return-(Math.pow(2,10*(J-=1))*Math.sin((J-Q)*(2*Math.PI)/$))},out:(J)=>{if(J===0)return 0;if(J===1)return 1;let $=0.3,Q=$/4;return Math.pow(2,-10*J)*Math.sin((J-Q)*(2*Math.PI)/$)+1},inOut:(J)=>{if(J===0)return 0;if(J===1)return 1;let $=0.44999999999999996,Q=$/4;if((J*=2)<1)return-0.5*(Math.pow(2,10*(J-=1))*Math.sin((J-Q)*(2*Math.PI)/$));return Math.pow(2,-10*(J-=1))*Math.sin((J-Q)*(2*Math.PI)/$)*0.5+1}},eJ=(J)=>{if(J<0.36363636363636365)return 7.5625*J*J;else if(J<0.7272727272727273)return 7.5625*(J-=0.5454545454545454)*J+0.75;else if(J<0.9090909090909091)return 7.5625*(J-=0.8181818181818182)*J+0.9375;else return 7.5625*(J-=0.9545454545454546)*J+0.984375},B0={in:(J)=>1-eJ(1-J),out:eJ,inOut:(J)=>{if(J<0.5)return B0.in(J*2)*0.5;return B0.out(J*2-1)*0.5+0.5}},HJ=(J=0.7,$=0.7,Q=!1)=>{let q=J!==1?$:0,Z=(1-J)/2,j=Z+J,z=Q;return(G)=>{let N=G+(0.5-G)*q;if(G<Z){let W=1-G/Z;if(z)return 1-W*W;return N-W*W*W*W*N}else if(G>j){let W=(G-j)/Z;if(z)return G===1?0:1-W*W;return N+(G-N)*W*W*W*W}return z?1:N}},J6={in:HJ(0.7,0.7,!1),out:HJ(0.7,0.7,!1),inOut:HJ(0.7,0.7,!1)},XJ=(J=1,$=20,Q=!1)=>{let q=[],Z=1/$;for(let j=0;j<$;j++){let z=j*Z,N=((j*1327+531)%1000/1000-0.5)*J*0.4,W=z+N;q.push({x:z,y:Q?Math.max(0,Math.min(1,W)):W})}return q[0]={x:0,y:0},q.push({x:1,y:1}),(j)=>{if(j<=0)return 0;if(j>=1)return 1;let z=0,G=q.length-1;while(z<G-1){let Y=z+G>>1;if(q[Y].x<=j)z=Y;else G=Y}let N=q[z],W=q[G],B=(j-N.x)/(W.x-N.x);return N.y+(W.y-N.y)*B}},L7={in:XJ(1,20,!0),out:XJ(1,20,!0),inOut:XJ(1,20,!0)},KJ=(J)=>{return($)=>{if($>=1)return 1;return Math.floor($*J)/J}},p0={in:KJ(12),out:KJ(12),inOut:KJ(12)},$6={linear:Q6,none:O7,power1:R.out,"power1.in":R.in,"power1.out":R.out,"power1.inout":R.inOut,power2:t.out,"power2.in":t.in,"power2.out":t.out,"power2.inout":t.inOut,power3:e.out,"power3.in":e.in,"power3.out":e.out,"power3.inout":e.inOut,power4:d.out,"power4.in":d.in,"power4.out":d.out,"power4.inout":d.inOut,quad:R.out,"quad.in":R.in,"quad.out":R.out,"quad.inout":R.inOut,cubic:t.out,"cubic.in":t.in,"cubic.out":t.out,"cubic.inout":t.inOut,quart:e.out,"quart.in":e.in,"quart.out":e.out,"quart.inout":e.inOut,quint:d.out,"quint.in":d.in,"quint.out":d.out,"quint.inout":d.inOut,strong:d.out,"strong.in":d.in,"strong.out":d.out,"strong.inout":d.inOut,sine:v0.out,"sine.in":v0.in,"sine.out":v0.out,"sine.inout":v0.inOut,expo:h0.out,"expo.in":h0.in,"expo.out":h0.out,"expo.inout":h0.inOut,circ:T0.out,"circ.in":T0.in,"circ.out":T0.out,"circ.inout":T0.inOut,back:u0.out,"back.in":u0.in,"back.out":u0.out,"back.inout":u0.inOut,elastic:d0.out,"elastic.in":d0.in,"elastic.out":d0.out,"elastic.inout":d0.inOut,bounce:B0.out,"bounce.in":B0.in,"bounce.out":B0.out,"bounce.inout":B0.inOut,slow:J6.inOut,"slow.in":R.out,"slow.out":R.out,"slow.inout":R.out,slowmo:J6.inOut,"slowmo.in":R.out,"slowmo.out":R.out,"slowmo.inout":R.out,rough:L7.inOut,"rough.in":R.out,"rough.out":R.out,"rough.inout":R.out,steps:p0.inOut,"steps.in":p0.in,"steps.out":p0.out,"steps.inout":p0.inOut};function q6(J){let $=J.toLowerCase();if(!$6[$])console.warn(`[Motion] Unknown easing "${J}". Falling back to "power1.out". Valid easings: linear, power1-4.in/out/inOut, quad, cubic, quart, quint, strong, sine, expo, circ, back, elastic, bounce, slow, rough, steps`);return $6[$]||R.out}class UJ{_id=0;_targets=[];_duration=0.5;_delay=0;_time=0;_progress=0;_timeScale=1;_isActive=!1;_isReversed=!1;_propTweens=null;_lastPropTween=null;_easingFn=null;_repeat=0;_repeatDelay=0;_yoyo=!1;_currentRepeat=0;_onStart;_onUpdate;_onComplete;_onRepeat;_onReverseComplete;_startFired=!1;_completeFired=!1;_timelineChild=!1;_needsStartCapture=!1;_startCaptured=!1;_fitSetupFn=null;_pendingFitSetup=null;_unregisterCallback=null;init(J,$,Q,q,Z,j){return this._id=J,this._targets=$,this._duration=Q,this._delay=q,this._easingFn=q6(Z),this._time=0,this._progress=0,this._timeScale=1,this._isActive=!1,this._isReversed=!1,this._startFired=!1,this._completeFired=!1,this._currentRepeat=0,this._repeat=j?.repeat??0,this._repeatDelay=j?.repeatDelay??0,this._yoyo=j?.yoyo??!1,this._onStart=j?.onStart,this._onUpdate=j?.onUpdate,this._onComplete=j?.onComplete,this._onRepeat=j?.onRepeat,this._onReverseComplete=j?.onReverseComplete,this}update(J){if(!this._isActive)return;let $=J*this._timeScale;if(this._time+=this._isReversed?-$:$,!this._isReversed&&this._time<0){this._time=0;return}let Q=Math.max(0,this._time-this._delay);if(this._progress=this._duration>0?Math.min(1,Q/this._duration):1,!this._startFired&&this._progress>0)this._startFired=!0,this._onStart?.();if(this.render(this._progress),this._onUpdate?.(this._progress),this._isReversed){if(this._time<=0)this.handleComplete()}else if(this._progress>=1)this.handleComplete()}render(J){let $=this.applyEasing(J),Q=this._propTweens;while(Q)Q.render($),Q=Q.next}renderAtTime(J){let $=Math.max(0,J),Q=this._duration,q=this._delay,Z=this._currentRepeat;if(Q===0){let j=$>=q?1:0;this._time=$,this._progress=j,this.render(j)}else{let j=Math.max(0,$-q);if(this._repeat===0){let z=Math.min(1,j/Q);this._time=Math.min(Q,j),this._progress=z,this.render(z)}else{let z=this._repeatDelay,G=Q+z,N=this._repeat===-1?1/0:Q*(this._repeat+1)+z*this._repeat,W=this._repeat===-1?j:Math.min(j,N),B=G>0?Math.floor(W/G):0,Y=W-B*G,U=Y>Q,_=Q>0?Math.min(1,Y/Q):1,H=this._yoyo&&B%2===1;if(U)_=H?0:1;else if(H)_=1-_;this._currentRepeat=this._repeat===-1?B:Math.min(B,this._repeat),this._isReversed=H,this._progress=_,this._time=Q*_,this.render(_)}}if(this._isActive){if(!this._startFired){this._startFired=!0;try{this._onStart?.()}catch(j){console.error("[Motion] onStart callback error:",j)}}try{this._onUpdate?.(this._progress)}catch(j){console.error("[Motion] onUpdate callback error:",j)}if(this._currentRepeat>Z)try{this._onRepeat?.(this._currentRepeat)}catch(j){console.error("[Motion] onRepeat callback error:",j)}if(!this._completeFired&&this._repeat!==-1){if($>=this.totalDuration()){this._completeFired=!0;try{this._onComplete?.()}catch(j){console.error("[Motion] onComplete callback error:",j)}}}}}applyEasing(J){if(!this._easingFn)return J;return this._easingFn(J)}handleComplete(){if(this._repeat===-1||this._currentRepeat<this._repeat){if(this._currentRepeat++,this._onRepeat?.(this._currentRepeat),this._yoyo)this._isReversed=!this._isReversed,this._time=this._isReversed?this._duration+this._delay:0;else this._time=0,this._startFired=!1;this._time-=this._repeatDelay;return}if(this._isReversed)this._onReverseComplete?.();else this._onComplete?.();this._isActive=!1}play(J){if(J!==void 0)return this.seek(J),this._isActive=!0,this._isReversed=!1,this;if(this._isActive&&!this._isReversed)return this;return this._isActive=!0,this._isReversed=!1,this}pause(J){if(J!==void 0){this._time=J;let $=Math.max(0,this._time-this._delay);this._progress=this._duration>0?Math.min(1,$/this._duration):1,this.render(this._progress)}return this._isActive=!1,this}reverse(J){if(J!==void 0)this.seek(J);return this._isActive=!0,this._isReversed=!0,this}restart(J=!0){return this._time=J?0:this._delay,this._progress=0,this._isActive=!0,this._isReversed=!1,this._startFired=!1,this._currentRepeat=0,this.render(0),this}seek(J){this._time=J;let $=Math.max(0,this._time-this._delay);return this._progress=this._duration>0?Math.min(1,$/this._duration):1,this.render(this._progress),this}progress(J){if(J===void 0)return this._progress;if(this._progress=Math.max(0,Math.min(1,J)),this._progress===0)this._time=0;else this._time=this._progress*this._duration+this._delay;return this.render(this._progress),this}time(J){if(J===void 0)return this._time;this._time=J;let $=Math.max(0,this._time-this._delay);return this._progress=this._duration>0?Math.min(1,$/this._duration):1,this.render(this._progress),this}timeScale(J){if(J===void 0)return this._timeScale;return this._timeScale=J,this}getTimeScale(){return this._timeScale}kill(){this._isActive=!1,this._unregisterCallback?.()}isActive(){return this._isActive}isTimelineChild(){return this._timelineChild}setTimelineChild(J){this._timelineChild=J}setLazyStartCapture(J){this._needsStartCapture=J,this._startCaptured=!1}setPendingFitSetup(J){this._fitSetupFn=J,this._pendingFitSetup=J}resetForReplay(){if(this._fitSetupFn)this._pendingFitSetup=this._fitSetupFn,this._startCaptured=!1;this._startFired=!1,this._completeFired=!1}needsStartCapture(){return this._needsStartCapture&&!this._startCaptured}isLazyCapture(){return this._needsStartCapture}fireReverseComplete(){try{this._onReverseComplete?.()}catch(J){console.error("[Motion] onReverseComplete callback error:",J)}this._startFired=!1,this._completeFired=!1}setUnregisterCallback(J){this._unregisterCallback=J}captureStartValues(){if(!this._needsStartCapture||this._startCaptured)return;if(this._pendingFitSetup){let $=this._propTweens;while($){let Q=$.next;r.release($),$=Q}this._propTweens=null,this._lastPropTween=null,this._pendingFitSetup(r),this._pendingFitSetup=null,this._startCaptured=!0;return}let J=this._propTweens;while(J){if(J.target instanceof Element){let{target:$,property:Q}=J;if(J.valueType==="color"&&Q0(Q)){let q=X.color?.getCurrentColor($,Q);if(q&&J.endColor)J.startColor=q,J.changeColor=new Float32Array([J.endColor[0]-q[0],J.endColor[1]-q[1],J.endColor[2]-q[2],J.endColor[3]-q[3]])}else if(J.valueType==="filter"&&n(Q)){let q=X.filter?.getCurrentFilter($);if(q&&J.endFilters){let Z=X.filter.mergeFilterArrays(q,J.endFilters);J.startFilters=Z.start,J.endFilters=Z.end}}else{let q=E0($,Q);J.startValue=q,J.change=J.endValue-J.startValue}}J=J.next}this._startCaptured=!0}getId(){return this._id}getTargets(){return this._targets}getDuration(){return this._duration}getDelay(){return this._delay}clearDelay(){this._delay=0}getFirstPropTween(){return this._propTweens}addPropTween(J){if(!this._lastPropTween)this._propTweens=J;else this._lastPropTween.next=J;this._lastPropTween=J}totalDuration(){if(this._repeat===-1)return 1/0;let $=this._duration*(this._repeat+1)+this._repeatDelay*this._repeat;return this._delay+$}reset(){this._id=0,this._targets=[],this._duration=0.5,this._delay=0,this._time=0,this._progress=0,this._timeScale=1,this._isActive=!1,this._isReversed=!1,this._easingFn=null,this._repeat=0,this._repeatDelay=0,this._yoyo=!1,this._currentRepeat=0,this._onStart=void 0,this._onUpdate=void 0,this._onComplete=void 0,this._onRepeat=void 0,this._onReverseComplete=void 0,this._startFired=!1,this._completeFired=!1,this._timelineChild=!1,this._needsStartCapture=!1,this._startCaptured=!1,this._fitSetupFn=null,this._pendingFitSetup=null,this._unregisterCallback=null;let J=r,$=this._propTweens;while($){let Q=$.next;J.release($),$=Q}this._propTweens=null,this._lastPropTween=null}}var I0=new K0(()=>new UJ,100),Z6={acquire:()=>I0.acquire(),release:(J)=>I0.release(J),getPoolSize:()=>I0.getPoolSize(),getTotalCreated:()=>I0.getTotalCreated(),clear:()=>I0.clear()};class x{static instance;animations=[];animationIdToIndex=new Map;nextAnimationId=1;totalCreated=0;_animationSnapshot=[];timelines=new Map;ticker;animationPool;propTweenPool;constructor(){this.ticker=C.getInstance(),this.animationPool=Z6,this.propTweenPool=r,this.ticker.add(this.update,0)}static getInstance(){if(!x.instance)x.instance=new x,b.setEngineRegisterCallback((J,$)=>{let Q=x.instance;if(!Q.hasTimeline(J))Q.registerTimeline(J,$)}),u.setCreateAnimationCallback((J,$,Q,q,Z,j,z,G)=>{return x.instance.createAnimation(J,$,Q,q,Z,j,z,G)});return x.instance}update=(J)=>{let $=this._animationSnapshot,Q=this.animations.length;$.length=Q;for(let Z=0;Z<Q;Z++)$[Z]=this.animations[Z];let q=[];for(let Z=0,j=$.length;Z<j;Z++){let z=$[Z];if(z.isTimelineChild())continue;if(z.isActive()){if(z.update(J),!z.isActive()&&!z.isTimelineChild())q.push(z.getId())}}for(let Z of q)this.unregisterAnimation(Z);for(let Z of this.timelines.values())if(Z.isActive())Z.update(J)};createAnimation(J,$,Q,q,Z,j,z,G){let N=G?.stagger;if(N&&J.length>1)return this.createStaggeredAnimations(J,$,Q,q,Z,j,z,N,G);let W=this.animationPool.acquire(),B=this.registerAnimation(W);if(W.init(B,J,Q,q,Z,G),this.setupPropertyTweens(W,J,$,j,z),Q===0)W.render(1);else if(j&&!G?._skipInitialRender)W.render(0);return W}createStaggeredAnimations(J,$,Q,q,Z,j,z,G,N){if(!X.stagger){let Y=this.animationPool.acquire(),U=this.registerAnimation(Y);if(Y.init(U,J,Q,q,Z,N),this.setupPropertyTweens(Y,J,$,j,z),Q===0)Y.render(1);else if(j&&!N?._skipInitialRender)Y.render(0);return[Y]}let W=X.stagger.resolve(J,G),B=[];for(let Y=0;Y<J.length;Y++){let U=J[Y],_=W[Y],H=this.animationPool.acquire(),I=this.registerAnimation(H);if(H.init(I,[U],Q,q+_,Z,N),this.setupPropertyTweens(H,[U],$,j,z),Q===0)H.render(1);else if(j&&!N?._skipInitialRender)H.render(0);B.push(H)}return B}setupPropertyTweens(J,$,Q,q,Z){let j=Object.keys(Q),z=Z?Object.keys(Z):[],G=[...new Set([...j,...z])],N=Q,W=Z,B="perspective"in N,Y=W&&"perspective"in W,U=B&&Y;for(let _ of $){if(!U&&(B||Y)&&_ instanceof Element){let H=B?N.perspective:W.perspective,I=typeof H==="number"?H:parseFloat(String(H))||0;if(I>0)S(_,"perspective",I,"px"),_.style.transform=E(_)}for(let H of G){if(H==="perspective"&&!U)continue;let I=N[H],K=vJ(_,H,I,W?W[H]:void 0),M=this.propTweenPool.acquire(),k=q&&!Z;switch(K.type){case"color":{let L=k?K.endColor:K.startColor,O=k?K.startColor:K.endColor;M.initColor(_,H,L,O);break}case"filter":{let L=k?K.endFilters:K.startFilters,O=k?K.startFilters:K.endFilters;M.initFilter(_,H,L,O);break}case"scalar":{let L=k?K.endValue:K.startValue,O=k?K.startValue:K.endValue;M.init(_,H,L,O,K.unit);break}case"drawSVG":{let L=k?K.endDraw:K.startDraw,O=k?K.startDraw:K.endDraw;M.initDrawSVG(_,H,L,O,K.length);break}case"path":{let L=k?K.endProgress:K.startProgress,O=k?K.startProgress:K.endProgress;M.initPath(_,H,K.pathData,K.pathLength,L,O,K.rotate,K.alignOffset,K.pathOffset);break}}J.addPropTween(M)}}}registerAnimation(J){let $=this.nextAnimationId++,Q=this.animations.length;return this.animations.push(J),this.animationIdToIndex.set($,Q),this.totalCreated++,J.setUnregisterCallback(()=>this.unregisterAnimation($)),$}unregisterAnimation(J){let $=this.animationIdToIndex.get(J);if($===void 0)return;let Q=this.animations[$],q=this.animations.length-1;if($!==q){let Z=this.animations[q];this.animations[$]=Z,this.animationIdToIndex.set(Z.getId(),$)}this.animations.pop(),this.animationIdToIndex.delete(J),this.animationPool.release(Q)}getAnimation(J){let $=this.animationIdToIndex.get(J);return $!==void 0?this.animations[$]:void 0}killAll(){let J=[...this.animations];for(let $=0,Q=J.length;$<Q;$++)J[$].kill();this.animations.length=0,this.animationIdToIndex.clear()}killAnimationsForTargets(J){if(J.length===0)return;let $=new Set(J),Q=[];for(let q=0,Z=this.animations.length;q<Z;q++){let j=this.animations[q],z=j.getTargets();for(let G of z)if(G instanceof Element&&$.has(G)){Q.push(j);break}}for(let q of Q)q.kill()}getActiveCount(){let J=0;for(let $=0,Q=this.animations.length;$<Q;$++)if(this.animations[$].isActive())J++;return J}getTotalCreated(){return this.totalCreated}getTimeline(J){let $=this.timelines.get(J);if(!$){if($=new b(J),!this.timelines.has(J))this.timelines.set(J,$),$.setUnregisterCallback(()=>this.removeTimeline(J))}return $}hasTimeline(J){return this.timelines.has(J)}registerTimeline(J,$){this.timelines.set(J,$),$.setUnregisterCallback(()=>this.removeTimeline(J))}getTimelineCount(){return this.timelines.size}getTimelineNames(){return Array.from(this.timelines.keys())}removeTimeline(J){this.timelines.delete(J)}killAllTimelines(){for(let J of this.timelines.values())J.kill();this.timelines.clear()}killEverything(){this.killAllTimelines(),this.killAll(),wJ()}getAnimationPool(){return this.animationPool}getPropTweenPool(){return this.propTweenPool}getPoolStats(){return{animations:this.animationPool.getPoolSize(),propTweens:this.propTweenPool.getPoolSize()}}clearPools(){this.animationPool.clear(),this.propTweenPool.clear()}getMemoryEstimate(){let J=this.animations.length,$=this.animationPool.getPoolSize(),Q=this.propTweenPool.getPoolSize();return(J+$)*500+Q*100}getTicker(){return this.ticker}}function M7(J,$){if(typeof J==="string"){let Q=$||(typeof document<"u"?document:null);if(!Q)return[];try{return Array.from(Q.querySelectorAll(J))}catch{return[]}}if(typeof Element<"u"&&J instanceof Element)return[J];if(typeof NodeList<"u"&&J instanceof NodeList||typeof HTMLCollection<"u"&&J instanceof HTMLCollection)return Array.from(J);if(Array.isArray(J))return J;if(J&&typeof J==="object"&&"length"in J)return Array.from(J);return[]}function k7(J,$,Q){if(Q===void 0)return(q)=>Math.min($,Math.max(J,q));return Math.min($,Math.max(J,Q))}function D7(J,$,Q){let q=J+Math.random()*($-J);if(Q&&Q>0)return Math.round(q/Q)*Q;return q}function E7(J,$){let Q=(q)=>{if(typeof J==="number"){if(J<=0)return q;return Math.round(q/J)*J}let Z=J,j=Z[0],z=Math.abs(q-j);for(let G=1;G<Z.length;G++){let N=Math.abs(q-Z[G]);if(N<z)z=N,j=Z[G]}return j};if($===void 0)return Q;return Q($)}function R7(J,$,Q){return J+($-J)*Q}function b7(J,$,Q,q,Z){let j=(z)=>{let G=(z-J)/($-J);return Q+G*(q-Q)};if(Z===void 0)return j;return j(Z)}function x7(J,$,Q){let q=(Z)=>(Z-J)/($-J);if(Q===void 0)return q;return q(Q)}function C7(J,$,Q){let q=$-J,Z=(j)=>{return((j-J)%q+q)%q+J};if(Q===void 0)return Z;return Z(Q)}var IJ={toArray:M7,clamp:k7,random:D7,snap:E7,interpolate:R7,mapRange:b7,normalize:x7,wrap:C7};function p(J,$,Q){let Z=x.getInstance().getTimeline(J);if($!==void 0&&Z.duration()>0)console.warn(`[Motion] Timeline "${J}" already has animations. New entries will be appended. Call Motion("${J}").kill() first to rebuild from scratch.`);if(Array.isArray($)&&$.length>0&&typeof $[0]==="object"&&$[0]!==null&&"target"in $[0])for(let j of $)Z._addEntry(j.target,j,j.position);else if($!==void 0&&Q!==void 0)Z._addEntry($,Q);return Z}p.reset=function(J){x.getInstance();let $=A0(J),Q=[];for(let q of $)if(q instanceof Element)Q.push(q);if(Q.length>0)x.getInstance().killAnimationsForTargets(Q);for(let q of $){if(!(q instanceof Element))continue;if(X.textSplitter?.isSplit?.(q))X.textSplitter?.revert?.(q);y(q),X.styleReset?.clearAnimationStylesAndUnregister?.(q),X.styleReset?.clearPinStylesAndUnregister?.(q)}};p.set=function(J,$){x.getInstance();let Q=new b;Q._addEntry(J,{to:$,duration:0}),Q.kill(!1)};p.get=function(J){let $=x.getInstance();return $.hasTimeline(J)?$.getTimeline(J):void 0};p.has=function(J){return x.getInstance().hasTimeline(J)};p.getNames=function(){return x.getInstance().getTimelineNames()};p.kill=function(J){let $=x.getInstance();if($.hasTimeline(J))$.getTimeline(J).kill()};p.killAll=function(){x.getInstance().killEverything()};p.refreshScrollTriggers=function(){X.triggerManager?.getInstance?.()?.refreshScrollTriggers()};p.cleanup=function(){if(typeof document>"u")return;document.querySelectorAll("[data-scrolltrigger-spacer]").forEach((J)=>J.remove()),document.querySelectorAll("[data-scrolltrigger-markers]").forEach((J)=>J.remove())};p.utils=IJ;var V7=p;var w7={};export{w7 as Types,b as Timeline,IJ as MotionUtils,V7 as Motion};
|
|
29
|
+
`,k.appendChild(L),k},_=B("scroller-start",Q,"right"),K=B("scroller-end",q,"right"),H=B("start",Q,"left"),Y=B("end",q,"left");if(!this._triggerElement)H.style.display="none",Y.style.display="none";if(this._markerContainer.appendChild(_),this._markerContainer.appendChild(K),this._markerContainer.appendChild(H),this._markerContainer.appendChild(Y),this._markers={scrollerStart:_,scrollerEnd:K,elementStart:H,elementEnd:Y},j){let F=this._scroller;if(window.getComputedStyle(F).position==="static")F.style.position="relative";F.appendChild(this._markerContainer)}else document.body.appendChild(this._markerContainer),this._markerContainer.style.position="fixed";this._scrollerStartOffset=W,this._scrollerEndOffset=N,this._cacheElementPositions(G)}_cacheElementPositions(J){if(!this._triggerElement){this._cachedElPositionValid=!1;return}let $=u(this._triggerElement),Q=S(this._startConfig.split(" ")[0]||"top",$.height,J),q=this._endConfig.startsWith("+=")?Q:S(this._endConfig.split(" ")[0]||"bottom",$.height,J);if(this._scroller!==window){let j=this._scroller.getBoundingClientRect(),G=this._scroller.scrollTop,z=$.top-j.top+G;this._cachedElStartDocTop=z+Q,this._cachedElEndDocTop=z+q}else{let j=window.scrollY||window.pageYOffset||0,G=$.top+j;this._cachedElStartDocTop=G+Q,this._cachedElEndDocTop=G+q}this._cachedElPositionValid=!0}update(J,$,Q){if(!this._markers||!this._markerContainer)return;let q=this._triggerElement;if(this._triggerElement=$||void 0,this._triggerElement!==q)this._cacheElementPositions(Q);let Z=this._scroller!==window;if(Z)this._markers.scrollerStart.style.top=`${J+this._scrollerStartOffset}px`,this._markers.scrollerEnd.style.top=`${J+this._scrollerEndOffset}px`;else this._markers.scrollerStart.style.top=`${this._scrollerStartOffset}px`,this._markers.scrollerEnd.style.top=`${this._scrollerEndOffset}px`;if(this._triggerElement&&this._cachedElPositionValid)if(this._markers.elementStart.style.display="",this._markers.elementEnd.style.display="",Z)this._markers.elementStart.style.top=`${this._cachedElStartDocTop}px`,this._markers.elementEnd.style.top=`${this._cachedElEndDocTop}px`;else this._markers.elementStart.style.top=`${this._cachedElStartDocTop-J}px`,this._markers.elementEnd.style.top=`${this._cachedElEndDocTop-J}px`;else this._markers.elementStart.style.display="none",this._markers.elementEnd.style.display="none"}recachePositions(J){this._cacheElementPositions(J)}cleanup(){if(this._markerContainer&&this._markerContainer.parentNode)this._markerContainer.parentNode.removeChild(this._markerContainer);this._markerContainer=void 0,this._markers=void 0,this._triggerElement=void 0}}class o extends T{static _nextId=0;_id;static _SCRUB_TICKER_PRIORITY=1;static _activeInstances=new Set;static _loadListenerAdded=!1;_scrollListener;_scrubTickListener=null;_currentProgress=0;_targetProgress=0;_scrubLag=0;_scroller;_triggerStart=0;_triggerEnd=0;_pinManager=null;_markerManager=null;_triggerState="before";_toggleActions=["play","none","none","none"];_initializing=!1;constructor(J,$){super(J,$);this._id=o._nextId++,this._scrubLag=typeof $.scrub==="number"?$.scrub:0}static _ensureLoadListener(){if(o._loadListenerAdded||typeof window>"u")return;if(o._loadListenerAdded=!0,document.readyState==="complete")return;window.addEventListener("load",()=>{setTimeout(()=>{for(let J of o._activeInstances)J.refresh()},100)},{once:!0})}_resolveScroller(){if(this._config.scroller)if(typeof this._config.scroller==="string"){if(typeof document>"u"){this._scroller=window;return}try{let J=document.querySelector(this._config.scroller);this._scroller=J??window}catch(J){console.warn(`[Motion] Invalid scroller selector "${this._config.scroller}":`,J),this._scroller=window}}else this._scroller=this._config.scroller;else this._scroller=window}_resolvePinElement(){if(!this._config.pin||typeof document>"u")return null;let J=null;if(typeof this._config.pin==="string")J=document.querySelector(this._config.pin);else if(this._config.pin===!0){let $=this._timeline.getFirstChildAnimation();if($){let Q=$.getTargets();if(Q.length>0&&Q[0]instanceof HTMLElement)J=Q[0]}}return J}_defaultStart(){return this._config.start||(this._config.pin?"top top":"top bottom")}_defaultEnd(){return this._config.end||"bottom top"}_getFirstAnimatedElement(){let J=this._timeline.getFirstChildAnimation();if(J){let $=J.getTargets();if($.length>0&&$[0]instanceof HTMLElement)return $[0]}return null}_resolveTriggerElement(){if(this._config.target instanceof HTMLElement)return this._config.target;if(typeof this._config.target==="string"&&typeof document<"u"){let J=document.querySelector(this._config.target);if(J instanceof HTMLElement)return J}return this._getFirstAnimatedElement()}_calculateTriggerPositions(J){let $=J||this._resolveTriggerElement(),Q=this._getViewportHeight(),q=this._getScrollTop();if(!$){this._triggerStart=0,this._triggerEnd=this._getScrollHeight();return}let Z=this._pinManager?.getLayoutRect()??u($),j;if(this._scroller instanceof Element){let H=this._scroller.getBoundingClientRect();j=Z.top-H.top+q}else j=Z.top+q;let z=this._defaultStart().split(" "),W=z[0]||"top",N=z[1]||"top",B=S(W,Z.height,Q),_=S(N,Q,Q);this._triggerStart=j+B-_;let K=this._defaultEnd();if(K.startsWith("+=")){let H=S(K.slice(2),Q,Q);this._triggerEnd=this._triggerStart+H}else{let H=K.split(" "),Y=H[0]||"bottom",F=H[1]||"top",X=S(Y,Z.height,Q),M=S(F,Q,Q);this._triggerEnd=j+X-M}if(this._triggerEnd<=this._triggerStart)this._triggerEnd=this._triggerStart+Math.max(Q,100)}_onEnable(){this._resolveScroller();let J=this._resolvePinElement();this._calculateTriggerPositions(J),o._activeInstances.add(this),o._ensureLoadListener();let Q=(this._config.toggleActions||"play none none none").trim().split(/\s+/);if(this._toggleActions=[Q[0],Q[1],Q[2],Q[3]],J){let Z=this._defaultStart().split(" "),j=this._getViewportHeight(),G=S(Z[0]||"top",J.getBoundingClientRect().height,j),W=S(Z[1]||"top",j,j)-G;this._pinManager=C.getOrCreate(this._id,J),this._pinManager.setup(J,this._triggerStart,this._triggerEnd,W,this._scroller===window,this._config.pinSpacing)}if(this._config.markers&&typeof document<"u"){let q=this._pinManager?.getElement()||this._resolveTriggerElement();this._markerManager=new BJ(this._id),this._markerManager.setup({scroller:this._scroller,triggerElement:q,startConfig:this._defaultStart(),endConfig:this._defaultEnd(),markerConfig:this._config.markers,viewportHeight:this._getViewportHeight()})}if(this._scrollListener=()=>this._onScroll(),this._scroller){if(this._scroller.addEventListener("scroll",this._scrollListener,{passive:!0}),this._initializing=!0,this._onScroll(),this._initializing=!1,this._config.scrub===!1||this._config.scrub===void 0){if(this._triggerState==="active")w(this._toggleActions[0],this._timeline);else if(this._triggerState==="after")this._timeline.progress(1),this._timeline.pause()}}}_onDisable(){if(this._scrollListener&&this._scroller)this._scroller.removeEventListener("scroll",this._scrollListener);if(this._markerManager?.cleanup(),this._markerManager=null,this._pinManager){let J=this._pinManager.getElement();if(J)C.release(this._id,J);else this._pinManager.cleanup();this._pinManager=null}this._stopSmoothScrollLoop(),o._activeInstances.delete(this)}refresh(){if(!this._enabled)return;let J=this._pinManager?.getElement()||null,$=this._pinManager?.suspendHtmlHeight?.()??null;if(this._calculateTriggerPositions(J),$?.(),this._pinManager&&J){let q=this._defaultStart().split(" "),Z=this._getViewportHeight(),j=this._pinManager.getLayoutRect()?.height??J.getBoundingClientRect().height,G=S(q[0]||"top",j,Z),W=S(q[1]||"top",Z,Z)-G;this._pinManager.setup(J,this._triggerStart,this._triggerEnd,W,this._scroller===window,this._config.pinSpacing)}if(this._markerManager)this._markerManager.recachePositions(this._getViewportHeight());this._onScroll()}_getViewportHeight(){if(this._scroller===window)return typeof window<"u"?window.innerHeight:0;else if(this._scroller instanceof Element)return this._scroller.clientHeight;return 0}_getScrollTop(){if(this._scroller===window)return typeof window<"u"?window.scrollY||window.pageYOffset:0;else if(this._scroller instanceof Element)return this._scroller.scrollTop;return 0}_getScrollHeight(){if(this._scroller===window){if(typeof document<"u"&&document.documentElement)return document.documentElement.scrollHeight-window.innerHeight;return 0}else if(this._scroller instanceof Element)return this._scroller.scrollHeight-this._scroller.clientHeight;return 0}_onScroll(){if(!this._enabled)return;let J=this._getScrollTop(),$=this._triggerEnd-this._triggerStart,Q=$>0?(J-this._triggerStart)/$:0;if(Q=Math.max(0,Math.min(1,Q)),Q=this._applySnap(Q),this._targetProgress=Q,this._pinManager?.update(J),this._markerManager){let q=this._pinManager?.getElement()||this._resolveTriggerElement();this._markerManager.update(J,q,this._getViewportHeight())}if(this._config.scrub!==!1&&this._config.scrub!==void 0)if(this._scrubLag===0)this._currentProgress=this._targetProgress,qJ(()=>this._timeline.progress(this._currentProgress));else this._startSmoothScrollLoop();else{let q;if(Q<=0)q="before";else if(Q>=1)q="after";else q="active";if(q!==this._triggerState){let Z=this._triggerState;if(this._triggerState=q,this._initializing)return;qJ(()=>{if(q==="active"&&Z==="before")w(this._toggleActions[0],this._timeline);else if(q==="after"&&Z==="active")w(this._toggleActions[1],this._timeline);else if(q==="active"&&Z==="after")w(this._toggleActions[2],this._timeline);else if(q==="before"&&Z==="active")w(this._toggleActions[3],this._timeline);else if(q==="after"&&Z==="before")w(this._toggleActions[0],this._timeline),this._timeline.progress(1),w(this._toggleActions[1],this._timeline);else if(q==="before"&&Z==="after")w(this._toggleActions[2],this._timeline),this._timeline.progress(0),w(this._toggleActions[3],this._timeline)})}}}_applySnap(J){let $=this._config.snap;if($==null)return J;if(typeof $==="function")return $(J);if(Array.isArray($)){let Q=$[0]??J,q=Math.abs(J-Q);for(let Z=1;Z<$.length;Z++){let j=Math.abs(J-$[Z]);if(j<q)q=j,Q=$[Z]}return Q}if(typeof $==="number"&&$>0)return Math.round(J/$)*$;return J}_startSmoothScrollLoop(){if(this._scrubTickListener)return;this._scrubTickListener=(J,$)=>{if(!this._enabled){this._stopSmoothScrollLoop();return}let Q=this._targetProgress-this._currentProgress,q=1-Math.exp(-J*3/this._scrubLag);if(this._currentProgress+=Q*q,Math.abs(this._targetProgress-this._currentProgress)<0.0001){this._currentProgress=this._targetProgress,this._timeline.progress(this._currentProgress),this._stopSmoothScrollLoop();return}this._timeline.progress(this._currentProgress)},V.getInstance().add(this._scrubTickListener,o._SCRUB_TICKER_PRIORITY)}_stopSmoothScrollLoop(){if(this._scrubTickListener)V.getInstance().remove(this._scrubTickListener),this._scrubTickListener=null}}I.registerTrigger("scroll",o);class uJ{_registrations=[];_domContentLoaded=!1;_windowLoaded=!1;_initialized=!1;constructor(){this._initialize()}_initialize(){if(this._initialized)return;if(this._initialized=!0,typeof document<"u"){if(document.addEventListener("DOMContentLoaded",()=>{this._domContentLoaded=!0,this._triggerDuring()}),typeof window<"u")window.addEventListener("load",()=>{this._windowLoaded=!0,this._triggerAfter()});if(document.readyState==="interactive"||document.readyState==="complete")this._domContentLoaded=!0;if(document.readyState==="complete")this._windowLoaded=!0}}register(J,$){let Q=$.timing||"during",q=$.paused===!0;if(this._registrations.push({timeline:J,timing:Q,paused:q}),q)return;if(Q==="before")J.play();else if(Q==="during"&&this._domContentLoaded)J.play();else if(Q==="after"&&this._windowLoaded)J.play()}unregister(J){this._registrations=this._registrations.filter(($)=>$.timeline!==J)}clear(){this._registrations=[]}_triggerDuring(){this._registrations.filter((J)=>J.timing==="during"&&!J.paused).forEach((J)=>J.timeline.play())}_triggerAfter(){this._registrations.filter((J)=>J.timing==="after"&&!J.paused).forEach((J)=>J.timeline.play())}_reset(){this._registrations=[],this._domContentLoaded=!1,this._windowLoaded=!1,this._initialized=!1,this._initialize()}}I.registerPageLoadTrigger(uJ);class dJ extends T{_targets=[];_listeners=new Map;_frozenRects=new Map;_state={x:0.5,y:0.5,distance:0.5,isInside:!1};_targetState={targetX:0.5,targetY:0.5,targetDistance:0.5};_tickerCallback;_defaultStartProgress=0.5;_defaultLeaveProgress=0.5;constructor(J,$){super(J,$);this._config={type:"distance",startProgress:this._defaultStartProgress,leaveProgress:this._defaultLeaveProgress,...$};let Q=this._config.startProgress??this._defaultStartProgress;this._state.x=Q,this._state.y=Q,this._state.distance=Q,this._targetState.targetX=Q,this._targetState.targetY=Q,this._targetState.targetDistance=Q}_onEnable(){if(this._targets=this._resolveElements(this._config.target),this._targets.length===0)this._addViewportListeners();else this._addTargetListeners();if(this._config.smooth!==void 0&&this._config.smooth>0)this._startSmoothingTicker();this._updateTimelineProgress()}_onDisable(){if(this._tickerCallback)V.getInstance().remove(this._tickerCallback),this._tickerCallback=void 0;this._frozenRects.clear(),this._cleanupListenerMap(this._listeners)}_addViewportListeners(){if(typeof window>"u")return;let J=new Map,$=(Q)=>{let q=Q;this._handleViewportMouseMove(q.clientX,q.clientY)};window.addEventListener("mousemove",$),J.set("mousemove",$),this._state.isInside=!0,this._listeners.set(window,J)}refresh(){for(let J of this._targets)this._frozenRects.set(J,u(J))}_addTargetListeners(){this._targets.forEach((J)=>{this._frozenRects.set(J,u(J));let $=new Map,Q=(j)=>{let G=j;this._handleTargetMouseMove(J,G.clientX,G.clientY)};J.addEventListener("mousemove",Q),$.set("mousemove",Q);let q=()=>{this._state.isInside=!0};J.addEventListener("mouseenter",q),$.set("mouseenter",q);let Z=()=>{this._state.isInside=!1,this._handleMouseLeave()};J.addEventListener("mouseleave",Z),$.set("mouseleave",Z),this._listeners.set(J,$)})}_handleViewportMouseMove(J,$){if(typeof window>"u")return;let{innerWidth:Q,innerHeight:q}=window,Z=Q/2,j=q/2;if(this._config.type==="axis")this._targetState.targetX=J/Q,this._targetState.targetY=$/q;else{let G=J-Z,z=$-j,W=Math.sqrt(G*G+z*z),N=Math.sqrt(Z*Z+j*j);this._targetState.targetDistance=1-Math.min(W/N,1)}this._applyProgress()}_handleTargetMouseMove(J,$,Q){let q=this._frozenRects.get(J)??J.getBoundingClientRect(),Z=q.left+q.width/2,j=q.top+q.height/2;if(this._config.type==="axis"){let G=$-q.left,z=Q-q.top;this._targetState.targetX=Math.max(0,Math.min(1,G/q.width)),this._targetState.targetY=Math.max(0,Math.min(1,z/q.height))}else{let G=$-Z,z=Q-j,W=Math.sqrt(G*G+z*z),N=Math.sqrt(Math.pow(q.width/2,2)+Math.pow(q.height/2,2));this._targetState.targetDistance=1-Math.min(W/N,1)}this._applyProgress()}_handleMouseLeave(){let J=this._config.leaveProgress??this._defaultLeaveProgress;if(this._targetState.targetX=J,this._targetState.targetY=J,this._targetState.targetDistance=J,!this._config.smooth)this._state.x=J,this._state.y=J,this._state.distance=J,this._updateTimelineProgress()}_applyProgress(){if(this._config.smooth)return;this._state.x=this._targetState.targetX,this._state.y=this._targetState.targetY,this._state.distance=this._targetState.targetDistance,this._updateTimelineProgress()}_startSmoothingTicker(){let J=Math.max(0,Math.min(1,this._config.smooth??0.1));this._tickerCallback=($)=>{let Q=this._lerp(this._state.x,this._targetState.targetX,J,$),q=this._lerp(this._state.y,this._targetState.targetY,J,$),Z=this._lerp(this._state.distance,this._targetState.targetDistance,J,$),j=0.0001,G=Math.abs(Q-this._state.x)<0.0001&&Math.abs(Q-this._targetState.targetX)<0.0001,z=Math.abs(q-this._state.y)<0.0001&&Math.abs(q-this._targetState.targetY)<0.0001,W=Math.abs(Z-this._state.distance)<0.0001&&Math.abs(Z-this._targetState.targetDistance)<0.0001;if(this._state.x=Q,this._state.y=q,this._state.distance=Z,!G||!z||!W)this._updateTimelineProgress()},V.getInstance().add(this._tickerCallback)}_lerp(J,$,Q,q){let Z=$-J;if(Math.abs(Z)<0.0001)return $;let j=0.5*Math.pow(1-Q,2)+0.005,G=1-Math.pow(1-j,q*60);return J+Z*G}_updateTimelineProgress(){if(this._config.type==="axis")this._timeline.setAxisProgress("x",this._state.x),this._timeline.setAxisProgress("y",this._state.y);else this._timeline.progress(this._state.distance)}}I.registerTrigger("mouseMove",dJ);class U0 extends T{_target=window;_tolerance;_dragMinimum;_dragMinimumSquared;_wheelSpeed;_scrollSpeed;_stopDelay;_preventDefault;_lockAxis;_animationStep;_smooth;_startX=0;_startY=0;_deltaX=0;_deltaY=0;_lockedAxis=null;_isPressed=!1;_isDragging=!1;_lastDirectionX=null;_lastDirectionY=null;_lastScrollX=0;_lastScrollY=0;_stopTimeout=null;_isMoving=!1;_lastActivityTime=0;_pendingActions=new Map;_rafScheduled=!1;_rafId=null;_wheelAccumulatorX=0;_wheelAccumulatorY=0;_wheelRafId=null;_scrollRafId=null;_lastPointerX=0;_lastPointerY=0;_activatedDirections=new Set;_targetProgress=0;_currentProgress=0;_interpolationRafId=null;_siblings=null;_index=0;static _sequenceStates=new WeakMap;_boundHandlers={};_frozenHoverRect=null;_gestureHoverActive=!1;_boundHoverMoveHandler=null;constructor(J,$){super(J,$);this._tolerance=$.tolerance??1,this._dragMinimum=$.dragMinimum??10,this._dragMinimumSquared=this._dragMinimum*this._dragMinimum,this._wheelSpeed=$.wheelSpeed??1,this._scrollSpeed=$.scrollSpeed??1,this._stopDelay=$.stopDelay??150,this._preventDefault=$.preventDefault??!1,this._lockAxis=$.lockAxis??!1,this._animationStep=$.animationStep??0.1,this._smooth=Math.max(0,Math.min(1,$.smooth??0));let Q=$;if(Q._siblings&&Q._index!==void 0){if(this._siblings=Q._siblings,this._index=Q._index,!U0._sequenceStates.has(this._siblings))U0._sequenceStates.set(this._siblings,{lastIndex:0})}}_onEnable(){let J=this._resolveElement(this._config.target,window);this._target=J??window;let $=this._config.types;if($.includes("pointer"))this._addPointerListeners();if($.includes("touch"))this._addTouchListeners();if($.includes("wheel"))this._addWheelListener();if($.includes("scroll"))this._addScrollListener();if(this._config.events.Hover||this._config.events.HoverEnd)this._addHoverListeners()}_onDisable(){if(this._stopTimeout)clearTimeout(this._stopTimeout),this._stopTimeout=null;if(this._rafId!==null)cancelAnimationFrame(this._rafId),this._rafId=null;if(this._wheelRafId!==null)cancelAnimationFrame(this._wheelRafId),this._wheelRafId=null;if(this._scrollRafId!==null)cancelAnimationFrame(this._scrollRafId),this._scrollRafId=null;if(this._interpolationRafId!==null)cancelAnimationFrame(this._interpolationRafId),this._interpolationRafId=null;this._rafScheduled=!1,this._pendingActions.clear();let J=this._target;if(this._boundHandlers.pointerDown)J.removeEventListener("pointerdown",this._boundHandlers.pointerDown),window.removeEventListener("pointermove",this._boundHandlers.pointerMove),window.removeEventListener("pointerup",this._boundHandlers.pointerUp);if(this._boundHandlers.touchStart)J.removeEventListener("touchstart",this._boundHandlers.touchStart),window.removeEventListener("touchmove",this._boundHandlers.touchMove),window.removeEventListener("touchend",this._boundHandlers.touchEnd);if(this._boundHandlers.wheel)J.removeEventListener("wheel",this._boundHandlers.wheel);if(this._boundHandlers.scroll)(this._target===window?window:this._target).removeEventListener("scroll",this._boundHandlers.scroll);if(this._boundHoverMoveHandler)window.removeEventListener("mousemove",this._boundHoverMoveHandler),this._boundHoverMoveHandler=null;this._frozenHoverRect=null,this._gestureHoverActive=!1,this._boundHandlers={}}_addPointerListeners(){this._boundHandlers.pointerDown=this._handlePointerDown.bind(this),this._boundHandlers.pointerMove=this._handlePointerMove.bind(this),this._boundHandlers.pointerUp=this._handlePointerUp.bind(this);let J={passive:!this._preventDefault};this._target.addEventListener("pointerdown",this._boundHandlers.pointerDown,J),window.addEventListener("pointermove",this._boundHandlers.pointerMove,J),window.addEventListener("pointerup",this._boundHandlers.pointerUp)}_handlePointerDown(J){if(J.pointerType==="touch"&&this._config.types.includes("touch"))return;if(this._preventDefault)J.preventDefault();this._handleInputStart(J.clientX,J.clientY)}_handlePointerMove(J){if(J.pointerType==="touch"&&this._config.types.includes("touch"))return;if(this._handleInputMove(J.clientX,J.clientY)){if(this._preventDefault)J.preventDefault()}}_handlePointerUp(J){if(J.pointerType==="touch"&&this._config.types.includes("touch"))return;this._handleInputEnd()}_addTouchListeners(){this._boundHandlers.touchStart=this._handleTouchStart.bind(this),this._boundHandlers.touchMove=this._handleTouchMove.bind(this),this._boundHandlers.touchEnd=this._handleTouchEnd.bind(this);let J={passive:!this._preventDefault};this._target.addEventListener("touchstart",this._boundHandlers.touchStart,J),window.addEventListener("touchmove",this._boundHandlers.touchMove,J),window.addEventListener("touchend",this._boundHandlers.touchEnd)}_handleTouchStart(J){if(this._preventDefault)J.preventDefault();let $=J.touches[0];if(!$)return;this._handleInputStart($.clientX,$.clientY)}_handleTouchMove(J){let $=J.touches[0];if(!$)return;if(this._handleInputMove($.clientX,$.clientY)){if(this._preventDefault)J.preventDefault()}}_handleTouchEnd(J){this._handleInputEnd()}_handleInputStart(J,$){this._fireEvent("PressInit"),this._startX=J,this._startY=$,this._lastPointerX=J,this._lastPointerY=$,this._deltaX=0,this._deltaY=0,this._isPressed=!0,this._isDragging=!1,this._lockedAxis=null,this._fireEvent("Press")}_handleInputMove(J,$){if(!this._isPressed)return!1;let Q=J-this._lastPointerX,q=$-this._lastPointerY;if(Math.abs(Q)<1&&Math.abs(q)<1)return!1;this._lastPointerX=J,this._lastPointerY=$;let Z=J-this._startX,j=$-this._startY;if(this._updateDeltas(Z,j),this._checkDragStart(),this._checkDirectionAndFire(!1),this._checkToggle(Z,j),this._scheduleStopCheck(),this._isDragging)this._fireEvent("Drag");return!0}_handleInputEnd(){if(!this._isPressed)return;if(this._isDragging)this._fireEvent("DragEnd");this._fireEvent("Release"),this._fireCompleteCallbacks(),this._fireEvent("Stop"),this._resetGestureState()}_addWheelListener(){this._boundHandlers.wheel=this._handleWheel.bind(this),this._target.addEventListener("wheel",this._boundHandlers.wheel,{passive:!this._preventDefault})}_handleWheel(J){if(this._preventDefault)J.preventDefault();if(this._wheelAccumulatorX+=J.deltaX*this._wheelSpeed,this._wheelAccumulatorY+=J.deltaY*this._wheelSpeed,this._wheelRafId!==null)return;this._wheelRafId=requestAnimationFrame(()=>{this._wheelRafId=null,this._deltaX=this._wheelAccumulatorX,this._deltaY=this._wheelAccumulatorY,this._wheelAccumulatorX=0,this._wheelAccumulatorY=0,this._checkDirectionAndFire(!0),this._checkToggle(this._deltaX,this._deltaY),this._scheduleStopCheck(),this._deltaX=0,this._deltaY=0})}_addScrollListener(){if(this._boundHandlers.scroll=this._handleScroll.bind(this),this._target===window)this._lastScrollX=window.scrollX,this._lastScrollY=window.scrollY;else{let J=this._target;this._lastScrollX=J.scrollLeft,this._lastScrollY=J.scrollTop}this._target.addEventListener("scroll",this._boundHandlers.scroll,{passive:!0})}_handleScroll(){if(this._scrollRafId!==null)return;this._scrollRafId=requestAnimationFrame(()=>{this._scrollRafId=null,this._processScroll()})}_processScroll(){let J,$;if(this._target===window)J=window.scrollX,$=window.scrollY;else{let Z=this._target;J=Z.scrollLeft,$=Z.scrollTop}let Q=(J-this._lastScrollX)*this._scrollSpeed,q=($-this._lastScrollY)*this._scrollSpeed;this._lastScrollX=J,this._lastScrollY=$,this._deltaX=Q,this._deltaY=q,this._checkDirectionAndFire(!0),this._checkToggle(Q,q),this._scheduleStopCheck(),this._deltaX=0,this._deltaY=0}_addHoverListeners(){if(this._target===window)return;let J=this._target;this._frozenHoverRect=u(J),this._boundHoverMoveHandler=($)=>{if(!this._frozenHoverRect)return;let Q=this._frozenHoverRect,q=$.clientX>=Q.left&&$.clientX<=Q.right&&$.clientY>=Q.top&&$.clientY<=Q.bottom;if(q&&!this._gestureHoverActive)this._gestureHoverActive=!0,this._fireEvent("Hover");else if(!q&&this._gestureHoverActive)this._gestureHoverActive=!1,this._fireEvent("HoverEnd")},window.addEventListener("mousemove",this._boundHoverMoveHandler)}refresh(){if(this._target===window||!this._frozenHoverRect)return;this._frozenHoverRect=u(this._target)}_updateDeltas(J,$){if(this._lockAxis&&this._lockedAxis)if(this._lockedAxis==="x")this._deltaX=J,this._deltaY=0;else this._deltaX=0,this._deltaY=$;else this._deltaX=J,this._deltaY=$;if(this._lockAxis&&!this._lockedAxis){let Q=this._tolerance;if(Math.abs(this._deltaX)>Q||Math.abs(this._deltaY)>Q)this._lockedAxis=Math.abs(this._deltaX)>Math.abs(this._deltaY)?"x":"y"}}_checkDirectionAndFire(J){let $=this._tolerance;if(J||!this._lockedAxis||this._lockedAxis==="y"){if(this._deltaY<-$){if(this._fireEvent("Up"),!J)this._activatedDirections.add("Up")}if(this._deltaY>$){if(this._fireEvent("Down"),!J)this._activatedDirections.add("Down")}}if(J||!this._lockedAxis||this._lockedAxis==="x"){if(this._deltaX<-$){if(this._fireEvent("Left"),!J)this._activatedDirections.add("Left")}if(this._deltaX>$){if(this._fireEvent("Right"),!J)this._activatedDirections.add("Right")}}if(Math.abs(this._deltaX)>$||Math.abs(this._deltaY)>$){if(this._fireEvent("Change"),Math.abs(this._deltaX)>$)this._fireEvent("ChangeX");if(Math.abs(this._deltaY)>$)this._fireEvent("ChangeY")}}_checkToggle(J,$){let Q=this._tolerance;if(Math.abs(J)>=Q){let q=J>0?1:-1;if(this._lastDirectionX!==null&&q!==this._lastDirectionX)this._fireEvent("ToggleX");this._lastDirectionX=q}if(Math.abs($)>=Q){let q=$>0?1:-1;if(this._lastDirectionY!==null&&q!==this._lastDirectionY)this._fireEvent("ToggleY");this._lastDirectionY=q}}_checkDragStart(){if(this._isDragging)return;if(this._deltaX*this._deltaX+this._deltaY*this._deltaY>this._dragMinimumSquared)this._isDragging=!0}_scheduleStopCheck(){if(this._isMoving=!0,this._lastActivityTime=performance.now(),this._stopTimeout)return;let J=()=>{let $=performance.now()-this._lastActivityTime;if($>=this._stopDelay){if(this._stopTimeout=null,this._isMoving){if(this._isMoving=!1,this._lastDirectionX=null,this._lastDirectionY=null,!this._isPressed)this._fireEvent("Stop")}}else this._stopTimeout=setTimeout(J,this._stopDelay-$)};this._stopTimeout=setTimeout(J,this._stopDelay)}_fireEvent(J){let $=this._config.events[J];if($)this._pendingActions.set($,J),this._scheduleRAF()}_scheduleRAF(){if(this._rafScheduled)return;this._rafScheduled=!0,this._rafId=requestAnimationFrame(()=>{this._rafScheduled=!1,this._rafId=null;for(let[J,$]of this._pendingActions)this._executeAction(J,$);this._pendingActions.clear()})}_getStepForEvent(J){if(typeof this._animationStep==="number")return this._animationStep;if(J&&this._animationStep[J]!==void 0)return this._animationStep[J];let $=Object.values(this._animationStep);return $.length>0?$[0]:0.1}_executeAction(J,$){switch(J){case"play":case"pause":case"reverse":case"restart":case"reset":case"complete":w(J,this._timeline);break;case"toggle":if(this._timeline.isActive())this._timeline.pause();else this._timeline.play();break;case"kill":this._timeline.kill();break;case"playReverse":{let Q=this._timeline.progress();if(Q>=1)this._timeline.reverse();else if(Q<=0)this._timeline.play();else if(!this._timeline.isActive())if(this._timeline.reversed())this._timeline.play();else this._timeline.reverse();break}case"progressUp":this._interpolateProgress(this._getStepForEvent($));break;case"progressDown":this._interpolateProgress(-this._getStepForEvent($));break;case"playNext":this._playSequenceItem(1);break;case"playPrevious":this._playSequenceItem(-1);break}}_playSequenceItem(J){if(!this._siblings||this._siblings.length===0)return;let $=U0._sequenceStates.get(this._siblings);if(!$)return;let Q=this._siblings.length,q=$.lastIndex,Z=(q+J+Q)%Q,j=this._siblings[q];if(j&&j.progress()>0)j.reverse();let G=this._siblings[Z];if(G)G.restart();$.lastIndex=Z}_interpolateProgress(J){let $=this._timeline.progress();if(Math.abs($-this._currentProgress)>0.01)this._currentProgress=$,this._targetProgress=$;if(this._interpolationRafId===null)this._currentProgress=$,this._targetProgress=$;if(this._targetProgress=Math.max(0,Math.min(1,this._targetProgress+J)),this._smooth===0){this._currentProgress=this._targetProgress,this._timeline.progress(this._currentProgress);return}if(this._interpolationRafId===null)this._startInterpolationLoop()}_startInterpolationLoop(){if(this._interpolationRafId!==null)return;let J=0.08+(1-this._smooth)*0.12,$=()=>{let Q=this._targetProgress-this._currentProgress;if(Math.abs(Q)<0.0001){this._currentProgress=this._targetProgress,this._timeline.progress(this._currentProgress),this._interpolationRafId=null;return}this._currentProgress+=Q*J,this._timeline.progress(this._currentProgress),this._interpolationRafId=requestAnimationFrame($)};this._interpolationRafId=requestAnimationFrame($)}_fireCompleteCallbacks(){if(this._activatedDirections.has("Up"))this._fireEvent("UpComplete");if(this._activatedDirections.has("Down"))this._fireEvent("DownComplete");if(this._activatedDirections.has("Left"))this._fireEvent("LeftComplete");if(this._activatedDirections.has("Right"))this._fireEvent("RightComplete");this._activatedDirections.clear()}_resetGestureState(){this._isPressed=!1,this._isDragging=!1,this._deltaX=0,this._deltaY=0,this._lockedAxis=null,this._lastDirectionX=null,this._lastDirectionY=null,this._activatedDirections.clear()}}I.registerTrigger("gesture",U0);var C0=null;function pJ(J,$,Q,q){let Z=J;if(!Z.style)return;let j=W0();if(f($))if(y(J,$,Q,q),j)E0(J);else Z.style.transform=b(J);else{let G=q?`${Q}${q}`:`${Q}`;if(j)x0(J,$,G);else try{if(Z0($))Z.style.setProperty($,G);else if($ in Z.style)Z.style[$]=G;else Z.style.setProperty(l($),G)}catch{}}}function cJ(J,$,Q,q,Z,j){let G=J;if(!G.style)return;let z=j===1?`rgb(${Math.round(Q)}, ${Math.round(q)}, ${Math.round(Z)})`:`rgba(${Math.round(Q)}, ${Math.round(q)}, ${Math.round(Z)}, ${j})`;if(W0())x0(J,$,z);else try{if(Z0($))G.style.setProperty($,z);else if($ in G.style)G.style[$]=z;else G.style.setProperty(l($),z)}catch{}}function mJ(J,$,Q,q){let Z=J;if(!Z.style)return;if(C0||(C0=U.filter)){let j=C0.interpolateFilters($,Q,q),G=C0.filterToString(j);if(W0())x0(J,"filter",G);else Z.style.filter=G}}function gJ(J,$,Q){let{pathLUT:q,alignOffset:Z,pathOffset:j,pathRotate:G}=Q;if(!q||q.length===0)return;let z=$*(q.length-1),W=Math.floor(z),N=Math.min(W+1,q.length-1),B=z-W,_=q[W],K=q[N],H=_.x+(K.x-_.x)*B,Y=_.y+(K.y-_.y)*B,F=(j?.x??0)+H-(Z?.x??0),X=(j?.y??0)+Y-(Z?.y??0);if(y(J,"x",F,"px"),y(J,"y",X,"px"),G){let M=s6(_.angle,K.angle,B);y(J,"rotate",M,"deg")}if(W0())E0(J);else J.style.transform=b(J)}function s6(J,$,Q){let q=$-J;if(q>180)q-=360;if(q<-180)q+=360;return J+q*Q}var _J=null,l6=100,o6=500,i6=0.5,F0=[],n6=50;function a6(J){for(let $=0;$<F0.length;$++)if(F0[$].length>=J){let Q=F0.splice($,1)[0];return Q.length=J,Q}return Array(J)}function r6(J){if(F0.length<n6)F0.push(J)}class HJ{target=null;property="";startValue=0;endValue=0;change=0;unit="";next=null;valueType="scalar";startColor=null;endColor=null;changeColor=new Float32Array(4);startFilters=null;endFilters=null;startDraw=null;endDraw=null;pathLength=0;pathData=null;motionPathLength=0;startProgress=0;endProgress=0;pathRotate=!1;alignOffset=null;pathOffset=null;pathLUT=null;_isElement=!1;init(J,$,Q,q,Z=""){return this.target=J,this.property=$,this.startValue=Q,this.endValue=q,this.change=q-Q,this.unit=Z,this.valueType="scalar",this._isElement=J instanceof Element,this}initColor(J,$,Q,q){return this.target=J,this.property=$,this.valueType="color",this.startColor=Q,this.endColor=q,this.changeColor[0]=q[0]-Q[0],this.changeColor[1]=q[1]-Q[1],this.changeColor[2]=q[2]-Q[2],this.changeColor[3]=q[3]-Q[3],this._isElement=J instanceof Element,this}initFilter(J,$,Q,q){return this.target=J,this.property=$,this.valueType="filter",this.startFilters=Q,this.endFilters=q,this._isElement=J instanceof Element,this}initDrawSVG(J,$,Q,q,Z){return this.target=J,this.property=$,this.valueType="drawSVG",this.startDraw=Q,this.endDraw=q,this.pathLength=Z,this._isElement=J instanceof Element,this}initPath(J,$,Q,q,Z,j,G,z,W){if(J instanceof Element)P(J,!0);this.target=J,this.property=$,this.valueType="path",this.pathData=Q,this.motionPathLength=q,this.startProgress=Z,this.endProgress=j,this.pathRotate=G,this.alignOffset=z,this.pathOffset=W,this._isElement=J instanceof Element;let N=Math.abs(j-Z),B=q*N,_=Math.min(o6,Math.max(l6,Math.ceil(B*i6)));this.pathLUT=a6(_+1);for(let K=0;K<=_;K++){let H=K/_,Y=Z+(j-Z)*H;this.pathLUT[K]=ZJ(Q,Y,G)}return this}render(J){if(!this.target)return;if(this.valueType==="color"&&this.startColor){let $=this.startColor[0]+this.changeColor[0]*J,Q=this.startColor[1]+this.changeColor[1]*J,q=this.startColor[2]+this.changeColor[2]*J,Z=this.startColor[3]+this.changeColor[3]*J;if(this._isElement)cJ(this.target,this.property,$,Q,q,Z)}else if(this.valueType==="filter"&&this.startFilters&&this.endFilters){if(this._isElement)mJ(this.target,this.startFilters,this.endFilters,J)}else if(this.valueType==="drawSVG"&&this.startDraw&&this.endDraw){if(this._isElement&&this.pathLength>0){let $=this.startDraw.start+(this.endDraw.start-this.startDraw.start)*J,Q=this.startDraw.end+(this.endDraw.end-this.startDraw.end)*J;if(_J||(_J=U.drawSVG))_J.applyDrawSVG(this.target,$,Q,this.pathLength)}}else if(this.valueType==="path"&&this.pathLUT&&this.pathLUT.length>0){if(this._isElement)gJ(this.target,J,{pathLUT:this.pathLUT,alignOffset:this.alignOffset??{x:0,y:0},pathOffset:this.pathOffset??{x:0,y:0},pathRotate:this.pathRotate})}else{let $=this.startValue+this.change*J;if(this._isElement)pJ(this.target,this.property,$,this.unit);else this.target[this.property]=$}}reset(){if(this.target=null,this.property="",this.startValue=0,this.endValue=0,this.change=0,this.unit="",this.next=null,this.valueType="scalar",this.startColor=null,this.endColor=null,this.startFilters=null,this.endFilters=null,this.startDraw=null,this.endDraw=null,this.pathLength=0,this.pathData=null,this.motionPathLength=0,this.startProgress=0,this.endProgress=0,this.pathRotate=!1,this.alignOffset=null,this.pathOffset=null,this.pathLUT)r6(this.pathLUT);this.pathLUT=null,this._isElement=!1}}class A0{pool=[];totalCreated=0;factory;maxSize;constructor(J,$){this.factory=J,this.maxSize=$}acquire(){if(this.pool.length>0)return this.pool.pop();return this.totalCreated++,this.factory()}release(J){if(J.reset(),this.maxSize===void 0||this.pool.length<this.maxSize)this.pool.push(J)}getPoolSize(){return this.pool.length}getTotalCreated(){return this.totalCreated}clear(){this.pool=[]}}var I0=new A0(()=>new HJ,500),t={acquire:()=>I0.acquire(),release:(J)=>I0.release(J),getPoolSize:()=>I0.getPoolSize(),getTotalCreated:()=>I0.getTotalCreated(),clear:()=>I0.clear()};var sJ={x:0,y:0,z:0,rotate:0,rotateX:0,rotateY:0,rotateZ:0,scale:1,scaleX:1,scaleY:1,scaleZ:1,skewX:0,skewY:0,opacity:1};class d{static _createAnimationCallback=null;static setCreateAnimationCallback(J){d._createAnimationCallback=J}_targets;_originalTargets;_fromVars;_toVars;_duration=0.5;_delay=0;_ease="power1.out";_animation=null;_animations=[];_built=!1;_splitType;_mask;_repeat;_repeatDelay;_yoyo;_stagger;_axis;_fitConfig;_onStart;_onUpdate;_onComplete;_onRepeat;_onReverseComplete;_skipInitialFromRender=!1;_plainObjectInitialValues=new Map;_expectedAnimationIds=[];_propsToAnimate=[];constructor(J,$){if(this._targets=M0(J),this._originalTargets=this._targets,this._targets.length===0&&typeof J==="string")console.warn(`[Motion] Selector "${J}" matched no elements. Animation will not run.`);if($)this._applyAnimationConfig($)}_applyAnimationConfig(J){if(J.from)this._fromVars=J.from;if(J.to)this._toVars=J.to;if(J.duration!==void 0)if(typeof J.duration!=="number"||!isFinite(J.duration)||J.duration<0)console.warn(`[Motion] Invalid duration: ${J.duration}. Must be a finite number >= 0. Using default.`);else this._duration=J.duration;if(J.delay!==void 0)if(typeof J.delay!=="number"||isNaN(J.delay))console.warn(`[Motion] Invalid delay: ${J.delay}. Must be a number. Using default 0.`);else if(!isFinite(J.delay))console.warn(`[Motion] Invalid delay: ${J.delay}. Infinity is not a valid delay. Using default 0.`);else this._delay=J.delay;if(J.ease)this._ease=J.ease;if(J.split)this._splitType=J.split;if(J.mask)this._mask=J.mask;if(J.stagger!==void 0)this._stagger=J.stagger;if(J.axis)this._axis=J.axis;if(J.fit)this._fitConfig=J.fit;if(J.repeat)if(typeof J.repeat==="number")this._repeat=J.repeat;else this._repeat=J.repeat.times,this._repeatDelay=J.repeat.delay,this._yoyo=J.repeat.yoyo;if(J.onStart)this._onStart=J.onStart;if(J.onUpdate)this._onUpdate=J.onUpdate;if(J.onComplete)this._onComplete=J.onComplete;if(J.onRepeat)this._onRepeat=J.onRepeat;if(J.onReverseComplete)this._onReverseComplete=J.onReverseComplete}_capturePlainObjectValues(J){for(let $ of this._targets){if($ instanceof Element)continue;let Q=$,q={};for(let Z of J)if(Z in Q&&typeof Q[Z]==="number")q[Z]=Q[Z];if(Object.keys(q).length>0)this._plainObjectInitialValues.set($,q)}}_restorePlainObjectValues(){for(let[J,$]of this._plainObjectInitialValues){let Q=J;for(let[q,Z]of Object.entries($))Q[q]=Z}}_ensureBuilt(){if(!this._built)this._build()}_isInvalidated(){if(this._animations.length===0)return!1;return this._animations.some((J,$)=>{let Q=J.getId(),q=this._expectedAnimationIds[$];return Q===0||Q!==q})}rebuildIfPooled(){if(this._isInvalidated()){this._restorePlainObjectValues();for(let J of this._targets)if(J instanceof Element)P(J),U.styleReset?.clearAnimationStylesForProps?.(J,this._propsToAnimate);this._resetBuildState(),this._ensureBuilt()}}_build(){if(this._built)return;if(this._targets.length===0)return;if(!this._fromVars&&!this._toVars&&!this._fitConfig&&this._duration<=0)return;if(this._fitConfig){if(!U.fit){console.warn("[Motion] FitResolver not loaded. Did you import the SDK?");return}if(this._built=!0,!d._createAnimationCallback)throw Error("AnimationBuilder: Engine not initialized. Call Engine.init() first.");let j={};if(this._repeat!==void 0)j.repeat=this._repeat;if(this._repeatDelay!==void 0)j.repeatDelay=this._repeatDelay;if(this._yoyo)j.yoyo=this._yoyo;if(this._onStart)j.onStart=this._onStart;if(this._onUpdate)j.onUpdate=this._onUpdate;if(this._onComplete)j.onComplete=this._onComplete;if(this._onRepeat)j.onRepeat=this._onRepeat;if(this._onReverseComplete)j.onReverseComplete=this._onReverseComplete;if(this._stagger!==void 0)j.stagger=this._stagger;let G=[];for(let W of this._targets){if(!(W instanceof Element))continue;let N=d._createAnimationCallback([W],{},this._duration,this._delay,this._ease,!1,void 0,j);if(Array.isArray(N))G.push(...N);else G.push(N)}let z=this._fitConfig;for(let W of G)for(let N of W.getTargets())if(N instanceof Element)U.fit.registerPendingSetup(W,N,z,t);this._animation=G[0]??null,this._animations=G,this._expectedAnimationIds=G.map((W)=>W.getId());return}this._built=!0;let J={},$=!1,Q;if(this._fromVars&&this._toVars){J={...this._toVars},Q={...this._fromVars},$=!0;for(let j of Object.keys(Q))if(!(j in J)){if(j in sJ)J[j]=sJ[j];else if(q0(j))J[j]="";else if(a(j))J[j]=""}}else if(this._fromVars)J={...this._fromVars},$=!0;else if(this._toVars)J={...this._toVars};if(this._splitType&&U.textSplitter?.split){let j=this._mask?{mask:!0}:void 0,G=[];for(let z of this._originalTargets)if(z instanceof Element){let W=U.textSplitter?.split(z,this._splitType,j);G.push(...W)}if(G.length>0)this._targets=G}if(this._propsToAnimate=Object.keys(J),Q){for(let j of Object.keys(Q))if(!this._propsToAnimate.includes(j))this._propsToAnimate.push(j)}if(this._plainObjectInitialValues.size===0)this._capturePlainObjectValues(this._propsToAnimate);if($){for(let j of this._targets)if(j instanceof Element)P(j),U.styleReset?.clearAnimationStylesForProps?.(j,this._propsToAnimate)}if(U.styleReset?.registerAnimatedProps){for(let j of this._targets)if(j instanceof Element)U.styleReset?.registerAnimatedProps(j,this._propsToAnimate)}let q={repeat:this._repeat,repeatDelay:this._repeatDelay,yoyo:this._yoyo,stagger:this._stagger,onStart:this._onStart,onUpdate:this._onUpdate,onComplete:this._onComplete,onRepeat:this._onRepeat,onReverseComplete:this._onReverseComplete,_skipInitialRender:this._skipInitialFromRender||void 0};if(!d._createAnimationCallback)throw Error("AnimationBuilder: Engine not initialized. Call AnimationBuilder.setCreateAnimationCallback first.");let Z=d._createAnimationCallback(this._targets,J,this._duration,this._delay,this._ease,$,Q,q);if(Array.isArray(Z))this._animations=Z,this._animation=Z[0]||null;else this._animation=Z,this._animations=[Z];this._expectedAnimationIds=this._animations.map((j)=>j.getId())}getAnimation(){return this._ensureBuilt(),this._animation}getAnimations(){return this._ensureBuilt(),this._animations}getTargets(){return this._targets}getOriginalTargets(){return this._originalTargets}hasSplit(){return!!this._splitType}_resetBuildState(){this._built=!1,this._animations=[],this._animation=null,this._expectedAnimationIds=[]}getConfig(){return{fromVars:this._fromVars?{...this._fromVars}:void 0,toVars:this._toVars?{...this._toVars}:void 0,duration:this._duration,delay:this._delay,ease:this._ease,axis:this._axis,fit:this._fitConfig?{...this._fitConfig}:void 0,split:this._splitType,mask:this._mask,stagger:this._stagger,repeat:this._repeat,repeatDelay:this._repeatDelay,yoyo:this._yoyo,onStart:this._onStart,onUpdate:this._onUpdate,onComplete:this._onComplete,onRepeat:this._onRepeat,onReverseComplete:this._onReverseComplete}}setAxis(J){this._axis=J}getAxis(){return this._axis}setSkipInitialFromRender(J){this._skipInitialFromRender=J}}class w0{static parse(J,$,Q,q){if(J===void 0)return $;if(typeof J==="number")return J;let Z=J.trim();if(Z==="<")return Q;if(Z===">")return q;if(Z.startsWith("<")){let j=parseFloat(Z.substring(1));if(!isNaN(j))return Q+j}if(Z.startsWith(">")){let j=parseFloat(Z.substring(1));if(!isNaN(j))return q+j}if(Z.startsWith("+=")){let j=parseFloat(Z.substring(2));return $+j}if(Z.startsWith("-=")){let j=parseFloat(Z.substring(2));return $-j}return console.warn(`Invalid position parameter: "${Z}", using current end`),$}}class E{static _eachCounter=0;static _registerWithEngine=null;static setEngineRegisterCallback(J){E._registerWithEngine=J}_name;_children=[];_duration=0;_time=0;_progress=0;_timeScale=1;_isActive=!1;_isReversed=!1;_killed=!1;_atZeroState=!1;_repeat=0;_repeatDelay=0;_yoyo=!1;_currentRepeat=0;_completeFired=!1;_inRepeatDelay=!1;_repeatDelayCounter=0;_onStart;_onUpdate;_onComplete;_onRepeat;_startFired=!1;_trigger;_unregisterCallback;setUnregisterCallback(J){this._unregisterCallback=J}_previousStart=0;_previousEnd=0;_eachInstances;_eachDuration;_initialValues=new Map;_initialTransforms=new Map;_transformElements=new Set;_savedTransitions=new Map;_transitionsDisabled=!1;_savedWillChange=new Map;_willChangeApplied=!1;_splitParentOverrides=new Map;constructor(J,$){if(this._name=J,$?.repeat!==void 0)if(typeof $.repeat==="number")this._repeat=$.repeat;else this._repeat=$.repeat.times,this._repeatDelay=$.repeat.delay??0,this._yoyo=$.repeat.yoyo??!1;if($?.onStart)this._onStart=$.onStart;if($?.onUpdate)this._onUpdate=$.onUpdate;if($?.onComplete)this._onComplete=$.onComplete;if($?.onRepeat)this._onRepeat=$.onRepeat;if(J&&E._registerWithEngine)E._registerWithEngine(J,this)}duration(){if(this._eachDuration!==void 0)return this._eachDuration;return this._duration}totalDuration(){if(this._repeat===-1)return 1/0;return this._duration*(this._repeat+1)+this._repeatDelay*this._repeat}clear(){for(let J of this._children)if(J.type==="animation")J.child.kill();else if(J.type==="timeline")J.child.kill();return this._children=[],this._duration=0,this._time=0,this._progress=0,this._isActive=!1,this._isReversed=!1,this._startFired=!1,this._previousStart=0,this._previousEnd=0,this._initialValues.clear(),this._initialTransforms.clear(),this._transformElements.clear(),this._splitParentOverrides.clear(),this._clearTransitionData(),this._currentRepeat=0,this._completeFired=!1,this._inRepeatDelay=!1,this._repeatDelayCounter=0,this}_captureInitialValues(J){let $=J.getTargets(),Q=J.getFirstPropTween();while(Q){let q=Q.property;for(let Z of $){if(!(Z instanceof Element))continue;let j=this._initialValues.get(Z);if(!j)j=new Map,this._initialValues.set(Z,j);if(!j.has(q)){let G=Z;if(f(q)||GJ(q)){if(this._transformElements.add(Z),!this._initialTransforms.has(Z)){let z=G.style.transform;this._initialTransforms.set(Z,z||null)}j.set(q,{removeInline:!0})}else if(q0(q)||a(q))j.set(q,{removeInline:!0});else{let z=q.replace(/([A-Z])/g,"-$1").toLowerCase();if(G.style.getPropertyValue(z)!==""){let N=yJ(Z,q);j.set(q,{removeInline:!1,value:N.value,unit:N.unit})}else j.set(q,{removeInline:!0})}}}Q=Q.next}}_restoreInitialValues(){for(let J of this._transformElements){let $=J;P(J);let Q=this._initialTransforms.get(J);if(Q)$.style.transform=Q;else $.style.removeProperty("transform")}for(let[J,$]of this._initialValues){let Q=J;for(let[q,Z]of $){if(f(q))continue;let j=q.replace(/([A-Z])/g,"-$1").toLowerCase();if(Z.removeInline)Q.style.removeProperty(j);else{let G=`${Z.value}${Z.unit}`;Q.style.setProperty(j,G)}}}}_disableTransitions(){if(this._transitionsDisabled)return;for(let J of this._savedTransitions.keys())J.style.transition="none";this._transitionsDisabled=!0}_applyWillChange(){if(this._willChangeApplied)return;for(let J of this._savedWillChange.keys())J.style.willChange="transform";this._willChangeApplied=!0}_restoreTransitions(){if(!this._transitionsDisabled)return;for(let[J,$]of this._savedTransitions)J.style.transition=$;this._transitionsDisabled=!1}_clearTransitionData(){this._restoreTransitions(),this._savedTransitions.clear(),this._transitionsDisabled=!1,this._restoreWillChange()}_restoreWillChange(){if(this._willChangeApplied)for(let[J,$]of this._savedWillChange)if($)J.style.willChange=$;else J.style.removeProperty("will-change");this._savedWillChange.clear(),this._willChangeApplied=!1}_addEntry(J,$,Q){let q=w0.parse(Q,this._duration,this._previousStart,this._previousEnd),Z=new d(J,$);return this._addBuilder(Z,q)}_addBuilder(J,$){J.setSkipInitialFromRender(!0);let Q=J.getAnimations();if(Q.length===0)return this;let q=$;for(let Z of Q){let j=Z.getDelay(),G=$+j;Z.clearDelay();let z=Z.totalDuration(),W={type:"animation",child:Z,builder:J,startTime:G,duration:z};this._children.push(W),Z.setTimelineChild(!0),Z.pause(),this._captureInitialValues(Z);for(let _ of Z.getTargets())if(_ instanceof HTMLElement&&!this._savedTransitions.has(_))this._savedTransitions.set(_,_.style.transition);for(let _ of Z.getTargets())if(_ instanceof HTMLElement&&this._transformElements.has(_)&&!this._savedWillChange.has(_))this._savedWillChange.set(_,_.style.willChange);let N=!!J.getConfig().fromVars;if(G>0&&!N)Z.setLazyStartCapture(!0);if(N)Z.renderAtTime(0);if(J.hasSplit()){for(let _ of J.getOriginalTargets())if(_ instanceof Element){let K=_;if(!this._splitParentOverrides.has(K))this._splitParentOverrides.set(K,K.style.opacity);K.style.opacity="1"}}let B=G+z;if(B>q)q=B}if(this._previousStart=$,this._previousEnd=q,q>this._duration)this._duration=q;return this}call(J,$,Q){let q=w0.parse(Q,this._duration,this._previousStart,this._previousEnd),Z={type:"callback",child:J,startTime:q,duration:0,params:$};if(this._children.push(Z),this._previousStart=q,this._previousEnd=q,q>this._duration)this._duration=q;return this}_getFirstAnimationTarget(){let J=this.getFirstChildAnimation();if(J){let $=J.getTargets();for(let Q of $)if(a0(Q))return Q}return}_getAllAnimationTargets(){for(let J of this._children)if(J.type==="animation"&&J.builder)return(J.builder.hasSplit()?J.builder.getOriginalTargets():J.builder.getTargets()).filter((Q)=>a0(Q));return[]}_createInstanceForElement(J,$){let q=`${this._name||"__each"}__each_${$}_${E._eachCounter++}`,Z=new E(q),j=new Set;for(let G of this._children)if(G.type==="animation"&&G.builder){if(j.has(G.builder))continue;j.add(G.builder);let z=G.builder.getConfig(),W=z.repeat!=null?{times:z.repeat,delay:z.repeatDelay,yoyo:z.yoyo}:void 0,N=G.builder.hasSplit(),B=new d(J,{from:z.fromVars,to:z.toVars,duration:z.duration,delay:z.delay,ease:z.ease,repeat:W,...N&&z.split?{split:z.split}:{},...N&&z.mask?{mask:z.mask}:{},...N&&z.stagger!==void 0?{stagger:z.stagger}:{},onStart:z.onStart,onUpdate:z.onUpdate,onComplete:z.onComplete,onRepeat:z.onRepeat,onReverseComplete:z.onReverseComplete});if(z.axis)B.setAxis(z.axis);Z._addBuilder(B,G.startTime)}else if(G.type==="callback")Z.call(G.child,G.params,G.startTime);return Z}_createInstanceForElements(J,$){let q=`${this._name||"__each"}__each_${$}_${E._eachCounter++}`,Z=new E(q),j=new Set;for(let G of this._children)if(G.type==="animation"&&G.builder){if(j.has(G.builder))continue;j.add(G.builder);let z=G.builder.getConfig(),W=z.repeat!=null?{times:z.repeat,delay:z.repeatDelay,yoyo:z.yoyo}:void 0,N=G.builder.hasSplit(),B=new d(J,{from:z.fromVars,to:z.toVars,duration:z.duration,delay:z.delay,ease:z.ease,repeat:W,...N&&z.split?{split:z.split}:{},...N&&z.mask?{mask:z.mask}:{},...N&&z.stagger!==void 0?{stagger:z.stagger}:{},onStart:z.onStart,onUpdate:z.onUpdate,onComplete:z.onComplete,onRepeat:z.onRepeat,onReverseComplete:z.onReverseComplete});if(z.axis)B.setAxis(z.axis);Z._addBuilder(B,G.startTime)}else if(G.type==="callback")Z.call(G.child,G.params,G.startTime);return Z}_resolveTargetElements(J){if(typeof J!=="string")return[J];if(typeof document<"u")try{return Array.from(document.querySelectorAll(J))}catch($){console.warn(`[Motion] Invalid selector "${J}":`,$)}return[]}_setupEachModeGeneric(J,$){if(J.length===0)return;if(this._eachInstances=[],this._children.some((q)=>q.type==="animation"&&q.builder?.hasSplit()))for(let q of J)U.textSplitter?.revert?.(q);this._clearTransitionData();for(let q=0;q<J.length;q++){let Z=J[q],j=this._createInstanceForElement(Z,q);$(j,Z),this._eachInstances.push(j)}{let q=null,Z=this._onUpdate,j=this._onStart,G=this._onComplete;for(let z of this._eachInstances){if(Z)z.onUpdate((W,N)=>{let B=W>0&&W<1;if(B)q=z;if(q===z){if(Z(W,N),!B)q=null}});if(j)z.onStart(()=>{q=z,j()});if(G)z.onComplete(()=>{if(q===z)q=null,G()})}}this._eachDuration=this._duration;for(let q of this._children)if(q.type==="animation"){let Z=q.child;Z.setTimelineChild(!1),Z.kill()}else if(q.type==="timeline")q.child.kill();this._children=[],this._duration=0,this._initialValues.clear(),this._initialTransforms.clear(),this._transformElements.clear(),this._splitParentOverrides.clear(),this._isActive=!1,this._time=0,this._progress=0,this._isReversed=!1,this._startFired=!1}_setupEachMode(J,$){let Q=U.triggerManager?.getInstance?.();if(!Q)return;let{each:q,...Z}=$;if($.target){let G=this._resolveTargetElements($.target);if(G.length===0)return;let z=this._getAllAnimationTargets();if(this._children.some((N)=>N.type==="animation"&&N.builder?.hasSplit()))for(let N of z)U.textSplitter?.revert?.(N);this._clearTransitionData(),this._eachInstances=[];for(let N=0;N<G.length;N++){let B=G[N],_=z.filter((H)=>B.contains(H));if(_.length===0)continue;let K=this._createInstanceForElements(_,N);if(J==="scroll")Q.registerScroll(K,{...Z,target:B});else if(J==="hover")Q.registerHover(K,{...Z,target:B});else Q.registerClick(K,{...Z,target:B});this._eachInstances.push(K)}{let N=null,B=this._onUpdate,_=this._onStart,K=this._onComplete;for(let H of this._eachInstances){if(B)H.onUpdate((Y,F)=>{let X=Y>0&&Y<1;if(X)N=H;if(N===H){if(B(Y,F),!X)N=null}});if(_)H.onStart(()=>{N=H,_()});if(K)H.onComplete(()=>{if(N===H)N=null,K()})}}this._eachDuration=this._duration;for(let N of this._children)if(N.type==="animation"){let B=N.child;B.setTimelineChild(!1),B.kill()}else if(N.type==="timeline")N.child.kill();this._children=[],this._duration=0,this._initialValues.clear(),this._initialTransforms.clear(),this._transformElements.clear(),this._splitParentOverrides.clear(),this._isActive=!1,this._time=0,this._progress=0,this._isReversed=!1,this._startFired=!1;return}let j=this._getAllAnimationTargets();this._setupEachModeGeneric(j,(G,z)=>{if(J==="scroll")Q.registerScroll(G,{...Z,target:z});else if(J==="hover")Q.registerHover(G,{...Z,target:z});else Q.registerClick(G,{...Z,target:z})})}onHover(J){if(J?.each)return this._setupEachMode("hover",J),this;let $=J?.target??this._getFirstAnimationTarget();return U.triggerManager?.getInstance?.().registerHover(this,{target:$,onLeave:J?.onLeave,leaveDelay:J?.leaveDelay}),this}onClick(J){if(J?.each)return this._setupEachMode("click",J),this;let $=J?.target??this._getFirstAnimationTarget();return U.triggerManager?.getInstance?.().registerClick(this,{target:$,secondTarget:J?.secondTarget,toggle:J?.toggle,preventDefault:J?.preventDefault}),this}onScroll(J){if(J?.each)return this._setupEachMode("scroll",J),this;let $=J?.target??this._getFirstAnimationTarget();return U.triggerManager?.getInstance?.().registerScroll(this,{...J,target:$}),this}onMouseMove(J){if(J?.each&&J.target)return this._setupMouseMoveEachMode(J),this;return U.triggerManager?.getInstance?.().registerMouseMove(this,{type:J?.type??"distance",target:J?.target,smooth:J?.smooth,startProgress:J?.startProgress,leaveProgress:J?.leaveProgress}),this}_setupMouseMoveEachMode(J){if(!J.target)return;let $=[];if(typeof J.target==="string"){if(typeof document<"u")$=Array.from(document.querySelectorAll(J.target))}else $=[J.target];let Q=U.triggerManager?.getInstance?.();if(!Q)return;this._setupEachModeGeneric($,(q,Z)=>{Q.registerMouseMove(q,{type:J.type??"distance",target:Z,smooth:J.smooth,startProgress:J.startProgress,leaveProgress:J.leaveProgress})})}onPageLoad(J){return U.triggerManager?.getInstance?.().registerPageLoad(this,J||{}),this}onPageExit(J){return U.triggerManager?.getInstance?.().registerPageExit(this,J||{}),this}onGesture(J){if(J.each)return this._setupGestureEachMode(J),this;return U.triggerManager?.getInstance?.().registerGesture(this,J),this}_setupGestureEachMode(J){let $=[];if(J.target)if(typeof J.target==="string"){if(typeof document<"u")$=Array.from(document.querySelectorAll(J.target))}else $=[J.target];else $=this._getAllAnimationTargets();if(this._setupEachModeGeneric($,()=>{}),!this._eachInstances||this._eachInstances.length===0)return;let Q=U.triggerManager?.getInstance?.();if(!Q)return;for(let q=0;q<$.length;q++){let Z=$[q],j=this._eachInstances[q];Q.registerGesture(j,{...J,target:Z,each:!1,_siblings:this._eachInstances,_index:q})}}onCursor(J){return U.triggerManager?.getInstance?.().registerCursor(this,J),this}_updateCallbackChild(J,$,Q){let q=J.startTime,Z=$<q&&this._time>=q,j=$>q&&this._time<=q,G=Math.abs(this._time-q)<0.001;if(Z||j||G&&Q===0){let z=J.child,W=J.params||[];z(...W)}}_updateAnimationChild(J,$){let Q=J.child,q=Math.abs(Q.getTimeScale())||1,Z=Q.totalDuration()/q,j=this._time-J.startTime,G=j*q;if(j>=0&&j<=Z){if(!Q.isActive())Q.captureStartValues(),Q.play();Q.renderAtTime(G)}else if(j<0){if(!Q.isLazyCapture())Q.renderAtTime(0);if(Q.isActive())Q.pause(),Q.fireReverseComplete()}else if(Q.isActive())Q.renderAtTime(Q.totalDuration()),Q.pause();else if($===0)Q.renderAtTime(Q.totalDuration())}_updateTimelineChild(J,$){let Q=J.child,q=Q.duration(),Z=this._time-J.startTime;if(Z>=0&&Z<=q){if(!Q.isActive())Q.play();Q.time(Z)}else if(Q.isActive())if(Z<0)Q.time(0),Q.pause();else Q.time(q),Q.pause();else if($===0)if(Z<0);else Q.time(q)}update(J){if(this._eachInstances){for(let q of this._eachInstances)q.update(J);return}let $=this._time;if(!this._isActive&&J===0);else if(!this._isActive)return;let Q=J*this._timeScale;if(this._inRepeatDelay&&J>0){if(this._repeatDelayCounter-=Q,this._repeatDelayCounter>0)return;if(this._inRepeatDelay=!1,this._repeatDelayCounter=0,this._isReversed){this._time=this._duration;for(let q of this._children)if(q.type==="animation")q.child.resetForReplay()}else this._time=0,this._startFired=!1,this._resetChildrenForCycle()}else if(!this._inRepeatDelay){if(this._time+=this._isReversed?-Q:Q,J>0){if(!this._isReversed&&this._time>=this._duration&&this._repeat!==0){if(this._repeat===-1||this._currentRepeat<this._repeat){this._time=this._duration,this._currentRepeat++;try{this._onRepeat?.(this._currentRepeat)}catch(Z){console.error("[Motion] onRepeat callback error:",Z)}if(this._yoyo){this._isReversed=!0;for(let Z of this._children)if(Z.type==="animation")Z.child.resetForReplay()}else this._time=0,this._startFired=!1,this._resetChildrenForCycle();if(this._repeatDelay>0)this._inRepeatDelay=!0,this._repeatDelayCounter=this._repeatDelay}}else if(this._isReversed&&this._time<=0&&this._yoyo&&this._repeat!==0){if(this._repeat===-1||this._currentRepeat<this._repeat){this._time=0,this._currentRepeat++;try{this._onRepeat?.(this._currentRepeat)}catch(Z){console.error("[Motion] onRepeat callback error:",Z)}if(this._isReversed=!1,this._startFired=!1,this._resetChildrenForCycle(),this._repeatDelay>0)this._inRepeatDelay=!0,this._repeatDelayCounter=this._repeatDelay}}}}if(this._time<0)this._time=0;else if(this._time>this._duration)this._time=this._duration;if(this._progress=this._duration>0?this._time/this._duration:0,!this._startFired&&this._isActive&&this._time>0)this._startFired=!0,this._disableTransitions(),this._applyWillChange(),this._onStart?.();if(this._isActive)this._onUpdate?.(this._progress,this._time);for(let q of this._children)if(q.type==="callback")this._updateCallbackChild(q,$,J);else if(q.type==="animation")this._updateAnimationChild(q,J);else if(q.type==="timeline")this._updateTimelineChild(q,J);if(!this._completeFired){let q=!this._isReversed&&this._time>=this._duration,Z=this._isReversed&&this._time<=0,j=this._repeat!==-1&&this._currentRepeat>=this._repeat;if(q&&(this._repeat===0||j))this._completeFired=!0,this._isActive=!1,this._startFired=!1,this._restoreTransitions(),this._onComplete?.();else if(Z&&(this._repeat===0||this._yoyo&&j))this._completeFired=!0,this._isActive=!1,this._startFired=!1,this._restoreTransitions(),this._onComplete?.()}}play(J){if(this._killed)return console.warn("[Motion] Cannot play a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let $ of this._eachInstances)$.play(J);return this}if(J!==void 0){if(this._time=J,this._progress=this._duration>0?this._time/this._duration:0,J===0)this._currentRepeat=0,this._inRepeatDelay=!1,this._repeatDelayCounter=0}else if(this._time>=this._duration&&!this._isReversed)return this;return this._completeFired=!1,this._isReversed=!1,this._isActive=!0,this._atZeroState=!1,this}pause(J){if(this._killed)return console.warn("[Motion] Cannot pause a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let $ of this._eachInstances)$.pause(J);return this}if(J!==void 0)this._time=J,this._progress=this._duration>0?this._time/this._duration:0;this._isActive=!1;for(let $ of this._children)if($.type!=="callback"){let Q=$.child;if("pause"in Q)Q.pause()}return this}reverse(J){if(this._killed)return console.warn("[Motion] Cannot reverse a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let $ of this._eachInstances)$.reverse(J);return this}if(J!==void 0)this._time=J,this._progress=this._duration>0?this._time/this._duration:0;else if(this._time<=0&&this._isReversed)return this;return this._completeFired=!1,this._inRepeatDelay=!1,this._repeatDelayCounter=0,this._isReversed=!0,this._isActive=!0,this._atZeroState=!1,this}restart(){if(this._killed)return console.warn("[Motion] Cannot restart a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let J of this._eachInstances)J.restart();return this}this._time=0,this._progress=0,this._isActive=!0,this._isReversed=!1,this._startFired=!1,this._atZeroState=!1,this._currentRepeat=0,this._completeFired=!1,this._inRepeatDelay=!1,this._repeatDelayCounter=0;for(let J of this._children)if(J.type==="animation")J.child.resetForReplay();return this._restoreInitialValues(),this._renderPositionZeroAnimations(),this}_resetChildrenForCycle(){for(let J of this._children)if(J.type==="animation")J.child.resetForReplay();this._restoreInitialValues(),this._renderPositionZeroAnimations()}_renderPositionZeroAnimations(){for(let J of this._children)if(J.type==="animation"){let $=J.child;if(!$.isLazyCapture())$.renderAtTime(0);if($.isActive())$.pause()}else if(J.type==="timeline")J.child.progress(0)}seek(J){if(this._killed)return console.warn("[Motion] Cannot seek a killed timeline. Create a new one with Motion(name)."),this;if(this._eachInstances){for(let $ of this._eachInstances)$.seek(J);return this}return this._time=Math.max(0,Math.min(J,this._duration)),this._progress=this._duration>0?this._time/this._duration:0,this._atZeroState=!1,this.update(0),this}setAxisProgress(J,$){let Q=Math.max(0,Math.min(1,$));for(let q of this._children)if(q.type==="animation"&&q.builder){if(q.builder.getConfig().axis===J){let j=q.child,G=j.totalDuration();if(!j.isActive())j.captureStartValues(),j.play();j.renderAtTime(Q*G)}}return this}onStart(J){return this._onStart=J,this}onUpdate(J){return this._onUpdate=J,this}onComplete(J){return this._onComplete=J,this}onRepeat(J){return this._onRepeat=J,this}withRepeat(J){if(typeof J==="number")this._repeat=J,this._repeatDelay=0,this._yoyo=!1;else this._repeat=J.times,this._repeatDelay=J.delay??0,this._yoyo=J.yoyo??!1;return this}progress(J){if(J===void 0){if(this._eachInstances&&this._eachInstances.length>0){let Q=0;for(let q of this._eachInstances){let Z=q.progress();if(Z>Q)Q=Z}return Q}return this._progress}if(this._eachInstances){for(let Q of this._eachInstances)Q.progress(J);return this}let $=Math.max(0,Math.min(1,J));if(!this._transitionsDisabled&&this._savedTransitions.size>0)this._disableTransitions(),this._applyWillChange();if($===0){for(let Q of this._children)if(Q.type==="animation")Q.child.resetForReplay()}if(this._time=$*this._duration,this._progress=$,$===0)if(this._atZeroState);else this._restoreInitialValues(),this._renderPositionZeroAnimations(),this._atZeroState=!0;else this._atZeroState=!1,this.update(0);return this._onUpdate?.(this._progress,this._time),this}time(J){if(J===void 0){if(this._eachInstances&&this._eachInstances.length>0){let $=0;for(let Q of this._eachInstances){let q=Q.time();if(q>$)$=q}return $}return this._time}if(this._eachInstances){for(let $ of this._eachInstances)$.time(J);return this}return this._time=Math.max(0,Math.min(J,this._duration)),this._progress=this._duration>0?this._time/this._duration:0,this.update(0),this}timeScale(J){if(J===void 0)return this._timeScale;return this._timeScale=J,this}kill(J=!0){if(this._killed=!0,this._isActive=!1,this._atZeroState=!1,U.triggerManager?.getInstance?.().unregister(this),this._eachInstances){for(let $ of this._eachInstances)$.kill(J);this._eachInstances=void 0}if(this._clearTransitionData(),J&&(this._initialValues.size>0||this._transformElements.size>0))this._restoreInitialValues();if(J&&this._splitParentOverrides.size>0){for(let[$,Q]of this._splitParentOverrides)if(Q)$.style.opacity=Q;else $.style.removeProperty("opacity");this._splitParentOverrides.clear()}for(let $ of this._children)if($.type==="animation"){let Q=$.child;Q.setTimelineChild(!1),Q.kill()}else if($.type==="timeline")$.child.kill(J);if(this._unregisterCallback)this._unregisterCallback(),this._unregisterCallback=void 0;this._children=[],this._initialValues.clear(),this._initialTransforms.clear(),this._transformElements.clear(),this._savedTransitions.clear(),this._savedWillChange.clear(),this._splitParentOverrides.clear(),this._willChangeApplied=!1,this._transitionsDisabled=!1,this._duration=0,this._time=0,this._progress=0,this._previousStart=0,this._previousEnd=0,this._isReversed=!1,this._startFired=!1,this._currentRepeat=0,this._completeFired=!1,this._inRepeatDelay=!1,this._repeatDelayCounter=0}isActive(){if(this._eachInstances)return this._eachInstances.some((J)=>J.isActive());return this._isActive}reversed(){if(this._eachInstances)return this._eachInstances.some((J)=>J.reversed());return this._isReversed}getName(){return this._name}getFirstChildAnimation(){let J=this._children[0];if(J?.type==="animation")return J.child;return null}}function P0(J,$,Q){let q=J;if(f($)){let G=Q??($.startsWith("scale")?"":"px");return(z)=>{y(J,$,z,G),q.style.transform=b(J)}}if($.startsWith("--")){let G=Q??"";return(z)=>{q.style.setProperty($,`${z}${G}`)}}let Z=$.replace(/([A-Z])/g,"-$1").toLowerCase(),j=Q??"";return(G)=>{q.style.setProperty(Z,`${G}${j}`)}}var t6=new Set(["opacity","z-index","font-weight","line-height","flex","flex-grow","flex-shrink","order","scale","column-count","columns","tab-size","orphans","widows","zoom"]);function e6(J){if(typeof location>"u")return!J.includes(":");try{let $=new URL(J,location.href);return $.protocol==="https:"||$.protocol==="http:"}catch{return!J.includes(":")}}class B0 extends T{_element=null;_innerElement=null;_mousePos={x:-100,y:-100};_cursorPos={x:-100,y:-100};_xSetter=null;_ySetter=null;_squeezeSetter=null;_squeezeConfig={min:0.55,max:1.2,multiplier:150};_state="default";_stateTimelines=new Map;_parsedStates=new Map;_textElement=null;_mediaElement=null;_tickerCallback;_boundMouseMove;_boundMouseDown;_boundMouseUp;_hoverSelectors=null;_isHoveringCursorTarget=!1;_boundHoverTargetMoveHandler=null;_cursorStyleTag=null;_attributeListeners=new Map;constructor(J,$){super(J,$);if(this._config={type:"basic",smooth:0.25,hideNative:!1,...$},$.squeeze===!0)this._squeezeConfig={min:0.55,max:1.2,multiplier:150};else if(typeof $.squeeze==="object")this._squeezeConfig={min:$.squeeze.min??0.55,max:$.squeeze.max??1.2,multiplier:$.squeeze.multiplier??150};if(this._parsedStates.set("default",this._parseStateConfig($.default)),$.hover)this._parsedStates.set("hover",this._parseStateConfig($.hover));if($.click)this._parsedStates.set("click",this._parseStateConfig($.click))}_parseStateConfig(J){let{targets:$,duration:Q,ease:q,enabled:Z,...j}=J;return{properties:j,duration:Q??0.15,ease:q??"power3.inOut",targets:$,enabled:Z??!0}}_onEnable(){if(this._element=this._createContainer(),this._innerElement=document.createElement("div"),this._innerElement.setAttribute("data-cursor-inner",""),this._innerElement.style.cssText="pointer-events:none;position:absolute;top:0;left:0;",this._element.appendChild(this._innerElement),y(this._innerElement,"x",-50,"%"),y(this._innerElement,"y",-50,"%"),this._xSetter=P0(this._element,"x","px"),this._ySetter=P0(this._element,"y","px"),this._config.squeeze)this._squeezeSetter=P0(this._element,"scale");if(this._cursorPos={x:-100,y:-100},this._mousePos={x:-100,y:-100},this._xSetter(-100),this._ySetter(-100),this._applyProperties(this._parsedStates.get("default").properties),this._innerElement.style.transform=b(this._innerElement),this._config.hideNative)this._cursorStyleTag=document.createElement("style"),this._cursorStyleTag.setAttribute("data-cursor-hide",""),this._cursorStyleTag.textContent="* { cursor: none !important; }",document.head.appendChild(this._cursorStyleTag);if(this._config.type==="text")this._setupTextCursor();else if(this._config.type==="media")this._setupMediaCursor();this._createStateTimelines(),this._setupEventListeners(),this._tickerCallback=(J)=>this._tick(J),V.getInstance().add(this._tickerCallback)}_onDisable(){if(this._tickerCallback)V.getInstance().remove(this._tickerCallback),this._tickerCallback=void 0;if(this._cursorStyleTag)this._cursorStyleTag.remove(),this._cursorStyleTag=null;if(this._removeEventListeners(),this._stateTimelines.forEach((J)=>J.kill()),this._stateTimelines.clear(),this._innerElement?.parentNode)this._innerElement.remove();if(this._innerElement=null,this._element?.parentNode)this._element.remove();this._element=null}_createContainer(){let J=document.createElement("div");return J.setAttribute("data-cursor-container",""),J.style.cssText="position:fixed;top:0;left:0;pointer-events:none;z-index:999999;width:0;height:0;",document.body.appendChild(J),J}_applyProperties(J){if(!this._innerElement)return;for(let[$,Q]of Object.entries(J))if($==="transform"){let q=B0._expandTransformShorthand(String(Q));for(let[Z,j]of Object.entries(q))y(this._innerElement,Z,j)}else{let q=l($),Z=typeof Q==="number"&&!t6.has(q)?`${Q}px`:String(Q);this._innerElement.style.setProperty(q,Z)}}_createStateTimelines(){if(!this._innerElement)return;let J=this._parsedStates.get("hover");if(J&&J.enabled){let Q=new E;Q._addEntry(this._innerElement,{to:B0._expandStateProperties(J.properties),duration:J.duration,ease:J.ease}),this._stateTimelines.set("hover",Q)}let $=this._parsedStates.get("click");if($&&$.enabled){let Q=new E;Q._addEntry(this._innerElement,{to:B0._expandStateProperties($.properties),duration:$.duration,ease:$.ease}),this._stateTimelines.set("click",Q)}}static _expandStateProperties(J){let $={};for(let[Q,q]of Object.entries(J))if(Q==="transform"){let Z=B0._expandTransformShorthand(String(q));Object.assign($,Z)}else $[Q]=q;return $}static _expandTransformShorthand(J){let $={},Q=/([a-zA-Z0-9]+)\(([^)]+)\)/g,q;while((q=Q.exec(J))!==null){let Z=q[1],j=q[2].split(",").map((G)=>parseFloat(G.trim()));switch(Z){case"scale":{let G=j[0]??1,z=j.length>1?j[1]:G;if(G===z)$.scale=G;else $.scaleX=G,$.scaleY=z;break}case"scaleX":$.scaleX=j[0]??1;break;case"scaleY":$.scaleY=j[0]??1;break;case"scaleZ":$.scaleZ=j[0]??1;break;case"rotate":$.rotate=j[0]??0;break;case"rotateX":$.rotateX=j[0]??0;break;case"rotateY":$.rotateY=j[0]??0;break;case"rotateZ":$.rotateZ=j[0]??0;break;case"skewX":$.skewX=j[0]??0;break;case"skewY":$.skewY=j[0]??0;break}}return $}_setupEventListeners(){if(this._boundMouseMove=(Q)=>{this._mousePos.x=Q.clientX,this._mousePos.y=Q.clientY},document.addEventListener("mousemove",this._boundMouseMove),this._parsedStates.get("click")?.enabled)this._boundMouseDown=()=>this._setState("click"),this._boundMouseUp=()=>this._setState(this._state==="click"?"default":this._state),document.addEventListener("mousedown",this._boundMouseDown),document.addEventListener("mouseup",this._boundMouseUp);let $=this._parsedStates.get("hover");if($?.enabled&&$.targets&&$.targets.length>0)this._setupHoverTargets($.targets)}_setupHoverTargets(J){this._hoverSelectors=J,this._boundHoverTargetMoveHandler=($)=>{let q=document.elementsFromPoint($.clientX,$.clientY).some((Z)=>this._hoverSelectors.some((j)=>{try{return Z.matches(j)}catch{return!1}}));if(q&&!this._isHoveringCursorTarget)this._isHoveringCursorTarget=!0,this._setState("hover");else if(!q&&this._isHoveringCursorTarget){if(this._isHoveringCursorTarget=!1,this._state==="hover")this._setState("default")}},window.addEventListener("mousemove",this._boundHoverTargetMoveHandler)}_setupTextCursor(){if(!this._innerElement)return;this._innerElement.style.display="grid",this._innerElement.style.placeItems="center",this._innerElement.style.overflow="visible",this._textElement=document.createElement("div"),this._textElement.setAttribute("data-cursor-text",""),this._textElement.style.whiteSpace="nowrap",this._textElement.style.opacity="0",this._innerElement.appendChild(this._textElement);let $=this._parsedStates.get("hover")?.duration??0.15;if(this._textElement.style.transition=`opacity ${$}s ease-in-out`,this._config.text)for(let[q,Z]of Object.entries(this._config.text))this._textElement.style.setProperty(l(q),String(Z));let Q=document.querySelectorAll("[mp-cursor-text], [mp-cursor-tooltip]");for(let q of Q){let Z=(G)=>{let z=G.target,W=z.getAttribute("mp-cursor-text")??z.getAttribute("mp-cursor-tooltip")??"";if(this._textElement)this._textElement.textContent=W,this._textElement.style.opacity="1";this._setState("hover")},j=()=>{if(this._textElement)this._textElement.style.opacity="0";if(this._state==="hover")this._setState("default")};q.addEventListener("mouseenter",Z),q.addEventListener("mouseleave",j),this._attributeListeners.set(q,{enter:Z,leave:j})}}_setupMediaCursor(){if(!this._innerElement)return;let J=document.createElement("img");J.setAttribute("data-cursor-media",""),J.style.display="none",this._innerElement.appendChild(J);let $=document.createElement("video");if($.setAttribute("data-cursor-media",""),$.autoplay=!0,$.muted=!0,$.loop=!0,$.style.display="none",this._innerElement.appendChild($),this._config.media)for(let[q,Z]of Object.entries(this._config.media))J.style.setProperty(l(q),String(Z)),$.style.setProperty(l(q),String(Z));let Q=document.querySelectorAll("[mp-cursor-media]");for(let q of Q){let Z=(G)=>{let z=G.target.getAttribute("mp-cursor-media")||"";if(!z||!e6(z)){if(z)console.warn(`[Motion] Blocked unsafe media URL: "${z}". Only http/https URLs and relative paths are allowed.`);return}if(z.endsWith(".mp4")||z.endsWith(".webm"))$.src=z,$.style.display="block",J.style.display="none",$.play().catch(()=>{}),this._mediaElement=$;else J.src=z,J.style.display="block",$.style.display="none",this._mediaElement=J;this._setState("hover")},j=()=>{if(J.style.display="none",$.style.display="none",$.pause(),this._state==="hover")this._setState("default")};q.addEventListener("mouseenter",Z),q.addEventListener("mouseleave",j),this._attributeListeners.set(q,{enter:Z,leave:j})}}_removeEventListeners(){if(this._boundMouseMove)document.removeEventListener("mousemove",this._boundMouseMove);if(this._boundMouseDown)document.removeEventListener("mousedown",this._boundMouseDown);if(this._boundMouseUp)document.removeEventListener("mouseup",this._boundMouseUp);if(this._boundHoverTargetMoveHandler)window.removeEventListener("mousemove",this._boundHoverTargetMoveHandler),this._boundHoverTargetMoveHandler=null;this._hoverSelectors=null,this._isHoveringCursorTarget=!1,this._attributeListeners.forEach((J,$)=>{$.removeEventListener("mouseenter",J.enter),$.removeEventListener("mouseleave",J.leave)}),this._attributeListeners.clear()}_setState(J){if(this._state===J)return;let $=this._state;this._state=J;let Q=this._stateTimelines.get(J),q=this._stateTimelines.get($);if(J==="default"){if(q)q.reverse()}else{if($!=="default"&&q)q.reverse();if(Q)Q.play()}}_tick(J){if(!this._xSetter||!this._ySetter)return;let $=this._config.smooth??0.25,Q=Math.pow($,2.5)||0.000001,q=1-Math.pow(1-Q,J*60);if(this._cursorPos.x+=(this._mousePos.x-this._cursorPos.x)*q,this._cursorPos.y+=(this._mousePos.y-this._cursorPos.y)*q,this._xSetter(this._cursorPos.x),this._ySetter(this._cursorPos.y),this._squeezeSetter&&this._config.squeeze){let Z=this._calculateSqueeze();this._squeezeSetter(Z)}for(let Z of this._stateTimelines.values())if(Z.isActive())Z.update(J)}_calculateSqueeze(){let J=this._cursorPos.x-this._mousePos.x,$=this._cursorPos.y-this._mousePos.y,Q=Math.sqrt(J*J+$*$),{min:q,max:Z,multiplier:j}=this._squeezeConfig,G=1-(Math.exp(Q/j)-1)/10;if(Number.isNaN(G))return 1;return Math.max(q,Math.min(Z,G))}getElement(){return this._element}getState(){return this._state}}I.registerTrigger("cursor",B0);class lJ extends T{_links=[];_listeners=new Map;_isNavigating=!1;_pendingUrl=null;_onCompleteHandler=null;_pollTimerId=null;constructor(J,$){super(J,$)}_onEnable(){if(this._isInsideBuilder())return;this._resolveLinks(),this._addClickListeners()}_onDisable(){if(this._cleanupListenerMap(this._listeners),this._links=[],this._isNavigating=!1,this._pendingUrl=null,this._pollTimerId!==null)clearTimeout(this._pollTimerId),this._pollTimerId=null;if(this._onCompleteHandler)this._onCompleteHandler=null}_isInsideBuilder(){try{if(typeof window<"u"&&window.top?.mp_iframe)return!0}catch{}return!1}_resolveLinks(){if(typeof document>"u")return;let J=this._config.mode||"all",$;if(J==="include"&&this._config.selectors&&this._config.selectors.trim()!=="")try{$=Array.from(document.querySelectorAll(this._config.selectors)).filter((q)=>q.tagName==="A"),document.querySelectorAll(this._config.selectors).forEach((q)=>{if(q.tagName!=="A"){let Z=q.querySelectorAll("a");$.push(...Array.from(Z))}})}catch(Q){console.warn(`[Motion] Invalid selector "${this._config.selectors}":`,Q),$=[]}else if(J==="include")$=[];else if(J==="exclude"&&this._config.selectors&&this._config.selectors.trim()!==""){let Q=Array.from(document.querySelectorAll("a")),q;try{q=new Set(document.querySelectorAll(this._config.selectors))}catch(Z){console.warn(`[Motion] Invalid selector "${this._config.selectors}":`,Z),q=new Set}$=Q.filter((Z)=>!q.has(Z))}else $=Array.from(document.querySelectorAll("a"));this._links=[...new Set($)],this._links=this._links.filter((Q)=>this._shouldIntercept(Q))}_shouldIntercept(J){let $=J.getAttribute("href");if(!$||$==="")return!1;let Q=this._config.skipHref||[];if($.startsWith("#"))return!Q.includes("anchor");if($.toLowerCase().startsWith("javascript:"))return!Q.includes("javascript");if($.toLowerCase().startsWith("mailto:")||$.toLowerCase().startsWith("tel:"))return!Q.includes("mailto");return!0}_addClickListeners(){this._links.forEach((J)=>{let $=new Map,Q=(q)=>{if(this._isNavigating)return;let Z=q;if(Z.ctrlKey||Z.metaKey||Z.shiftKey||Z.altKey)return;let j=J.getAttribute("target");if(j&&j!=="_self")return;let G=J.href;if(!G)return;q.preventDefault(),q.stopPropagation(),this._isNavigating=!0,this._pendingUrl=G,this._onCompleteHandler=()=>{this._navigate()},this._timeline.restart(),this._waitForCompletion()};J.addEventListener("click",Q),$.set("click",Q),this._listeners.set(J,$)})}_waitForCompletion(){let J=this._timeline,$=16,Q=()=>{if(this._pollTimerId=null,!this._enabled||!this._isNavigating||!this._pendingUrl)return;let q=J.progress(),Z=J.isActive();if(q>=1||!Z&&q>0)this._navigate();else this._pollTimerId=setTimeout(Q,16)};this._pollTimerId=setTimeout(Q,16)}_navigate(){if(!this._pendingUrl)return;let J=this._pendingUrl;if(this._pendingUrl=null,this._isNavigating=!1,typeof window<"u")window.location.href=J}}I.registerTrigger("pageExit",lJ);var YJ=null;function J7(){if(!YJ&&typeof document<"u"){let J=document.createElement("canvas");J.width=1,J.height=1,YJ=J.getContext("2d")}return YJ}function oJ(J){let $=J.replace("#",""),Q,q,Z,j=1;if($.length===3)Q=parseInt($[0]+$[0],16),q=parseInt($[1]+$[1],16),Z=parseInt($[2]+$[2],16);else if($.length===4)Q=parseInt($[0]+$[0],16),q=parseInt($[1]+$[1],16),Z=parseInt($[2]+$[2],16),j=parseInt($[3]+$[3],16)/255;else if($.length===6)Q=parseInt($.slice(0,2),16),q=parseInt($.slice(2,4),16),Z=parseInt($.slice(4,6),16);else if($.length===8)Q=parseInt($.slice(0,2),16),q=parseInt($.slice(2,4),16),Z=parseInt($.slice(4,6),16),j=parseInt($.slice(6,8),16)/255;else return null;if(isNaN(Q)||isNaN(q)||isNaN(Z)||isNaN(j))return null;return new Float32Array([Q,q,Z,j])}function $7(J){let $=J.match(/rgba?\s*\(\s*([\d.]+)\s*[,\s]\s*([\d.]+)\s*[,\s]\s*([\d.]+)\s*(?:[,\/]\s*([\d.]+))?\s*\)/i);if(!$)return null;let Q=parseFloat($[1]),q=parseFloat($[2]),Z=parseFloat($[3]),j=$[4]!==void 0?parseFloat($[4]):1;if(isNaN(Q)||isNaN(q)||isNaN(Z)||isNaN(j))return null;return new Float32Array([Q,q,Z,j])}function Q7(J,$,Q){J=J/360,$=$/100,Q=Q/100;let q,Z,j;if($===0)q=Z=j=Q;else{let G=(N,B,_)=>{if(_<0)_+=1;if(_>1)_-=1;if(_<0.16666666666666666)return N+(B-N)*6*_;if(_<0.5)return B;if(_<0.6666666666666666)return N+(B-N)*(0.6666666666666666-_)*6;return N},z=Q<0.5?Q*(1+$):Q+$-Q*$,W=2*Q-z;q=G(W,z,J+0.3333333333333333),Z=G(W,z,J),j=G(W,z,J-0.3333333333333333)}return[Math.round(q*255),Math.round(Z*255),Math.round(j*255)]}function q7(J){let $=J.match(/hsla?\s*\(\s*([\d.]+)\s*[,\s]\s*([\d.]+)%\s*[,\s]\s*([\d.]+)%\s*(?:[,\/]\s*([\d.]+))?\s*\)/i);if(!$)return null;let Q=parseFloat($[1]),q=parseFloat($[2]),Z=parseFloat($[3]),j=$[4]!==void 0?parseFloat($[4]):1;if(isNaN(Q)||isNaN(q)||isNaN(Z)||isNaN(j))return null;let[G,z,W]=Q7(Q,q,Z);return new Float32Array([G,z,W,j])}function Z7(J,$){if(!$||typeof window>"u")return null;let Q=J.match(/var\s*\(\s*(--[\w-]+)\s*\)/i);if(!Q)return null;let q=Q[1],Z=window.getComputedStyle($).getPropertyValue(q).trim();if(!Z)return null;return KJ(Z,$)}function j7(J){let $=J7();if(!$)return null;$.fillStyle="#000000",$.fillStyle=J;let Q=$.fillStyle;if(Q==="#000000"&&J.toLowerCase()!=="black"&&J!=="#000000"&&J!=="#000")return null;return oJ(Q)}function KJ(J,$){if(!J||typeof J!=="string")return null;let Q=J.trim().toLowerCase();if(Q==="transparent")return new Float32Array([0,0,0,0]);if(Q.startsWith("#"))return oJ(Q);if(Q.startsWith("rgb"))return $7(Q);if(Q.startsWith("hsl"))return q7(Q);if(Q.startsWith("var("))return Z7(Q,$);return j7(Q)}function G7(J,$){if(typeof window>"u")return new Float32Array([0,0,0,1]);let Q=window.getComputedStyle(J),q=$.replace(/[A-Z]/g,(G)=>`-${G.toLowerCase()}`),Z=Q.getPropertyValue(q).trim();if(!Z||Z==="none")return new Float32Array([0,0,0,0]);return KJ(Z,J)||new Float32Array([0,0,0,1])}U.color={parseColor:KJ,getCurrentColor:G7};var iJ={blur:{value:0,unit:"px"},brightness:{value:1,unit:""},contrast:{value:1,unit:""},saturate:{value:1,unit:""},grayscale:{value:0,unit:""},sepia:{value:0,unit:""},"hue-rotate":{value:0,unit:"deg"},invert:{value:0,unit:""},opacity:{value:1,unit:""}};function z7(J){let $=J.trim().match(/^([\w-]+)\(\s*([\d.]+)(px|%|deg)?\s*\)$/);if(!$)return null;let Q=$[1].toLowerCase(),q=parseFloat($[2]),Z=$[3]||"";if(Z==="%")q=q/100,Z="";return{name:Q,value:q,unit:Z}}function nJ(J){if(J===null||J===void 0||typeof J!=="string")return null;let $=J.trim().toLowerCase();if($==="none"||$==="")return[];let Q=[],q=/([\w-]+)\([^)]+\)/g,Z;while((Z=q.exec($))!==null){let j=z7(Z[0]);if(j)Q.push(j)}return Q.length>0?Q:null}function W7(J){let $=iJ[J.name];if(!$)return!1;return J.value===$.value}function N7(J){if(!J||J.length===0)return"none";if(J.every(W7))return"none";return J.map(($)=>{let Q;if($.name==="blur")Q=`${$.value}${$.unit||"px"}`;else if($.name==="hue-rotate")Q=`${$.value}${$.unit||"deg"}`;else Q=`${$.value}`;return`${$.name}(${Q})`}).join(" ")}function B7(J){if(typeof window>"u")return[];let $=window.getComputedStyle(J),Q=$.filter||$.getPropertyValue("filter");if(!Q||Q==="none")return[];return nJ(Q)||[]}function _7(J){let $=iJ[J];if($)return{name:J,value:$.value,unit:$.unit};return{name:J,value:0,unit:""}}function H7(J,$){let Q=new Set;for(let j of J)Q.add(j.name);for(let j of $)Q.add(j.name);let q=[],Z=[];for(let j of Q){let G=J.find((N)=>N.name===j),z=$.find((N)=>N.name===j),W=_7(j);q.push(G||W),Z.push(z||W)}return{start:q,end:Z}}var _0=[];function Y7(J,$,Q){let q=J.length;if(_0.length<q)for(let Z=_0.length;Z<q;Z++)_0.push({name:"",value:0,unit:""});for(let Z=0;Z<q;Z++){let j=J[Z],G=$[Z],z=_0[Z];z.name=j.name,z.value=j.value+(G.value-j.value)*Q,z.unit=j.unit||G.unit}return _0.length=q,_0}U.filter={parseFilter:nJ,getCurrentFilter:B7,mergeFilterArrays:H7,interpolateFilters:Y7,filterToString:N7};var aJ=new WeakMap;function K7(J){return"getTotalLength"in J&&typeof J.getTotalLength==="function"}function S0(J){let $=aJ.get(J);if($!==void 0)return $;if(K7(J)){let Q=J.getTotalLength();return aJ.set(J,Q),Q}return 0}function X7(J,$){if(J===null||J===void 0)return null;if(typeof J==="object"){let Q=J.start??0,q=J.end??100;return{start:Q/100,end:q/100}}if(typeof J==="string"){let Q=J.trim();if(Q==="true")return{start:0,end:1};if(Q==="false"||Q===""||Q==="none")return{start:0,end:0};let q=Q.match(/^([-\d.]+)(px|%)?\s+([-\d.]+)(px|%)?$/);if(q){let j=parseFloat(q[1]),G=q[2]||"%",z=parseFloat(q[3]),W=q[4]||"%",N=$?S0($):0,B=XJ(j,G,N),_=XJ(z,W,N);return{start:B,end:_}}let Z=Q.match(/^([-\d.]+)(px|%)?$/);if(Z){let j=parseFloat(Z[1]),G=Z[2]||"%",z=$?S0($):0;return{start:0,end:XJ(j,G,z)}}}return null}function XJ(J,$,Q){if($==="px"&&Q>0)return J/Q;return J/100}function U7(J){let $=S0(J);if($===0)return{start:0,end:1};try{if(typeof window<"u"&&window.getComputedStyle){let Q=window.getComputedStyle(J),q=Q.strokeDasharray,Z=Q.strokeDashoffset;if(!q||q==="none")return{start:0,end:1};let j=q.split(/[\s,]+/).map(parseFloat).filter((z)=>!isNaN(z)),G=parseFloat(Z)||0;if(j.length>=1){let z=j[0],W=-G/$,N=(-G+z)/$;return{start:W,end:N}}}}catch{}return{start:0,end:1}}function F7(J,$,Q,q){if(!(J instanceof SVGElement)||q===0)return;let Z=J,j=Math.abs(Q-$)*q,G=Math.min($,Q)*q;Z.style.strokeDasharray=`${j} ${q}`,Z.style.strokeDashoffset=`${-G}`}U.drawSVG={parseDrawSVG:X7,getCurrentDrawSVG:U7,getPathLength:S0,applyDrawSVG:F7};var y0=new WeakMap,v0=new WeakMap;class h0{static split(J,$,Q){if(!(J instanceof HTMLElement))return[];let q=y0.get(J);if(q!==void 0)J.innerHTML=q,J.removeAttribute("data-split"),v0.delete(J);else y0.set(J,J.innerHTML);let Z={chars:[],words:[],lines:[],elements:[]},j=$.split(",").map((N)=>N.trim()),G=j.includes("chars"),z=j.includes("words"),W=j.includes("lines");if(W)this._splitWithLinesDom(J,z,G,Z);else if(z&&G)this._splitWordsWithCharsDom(J,Z);else if(z)this._splitWordsDom(J,Z);else if(G)this._splitCharsDom(J,Z);if(G)Z.elements=Z.chars;else if(z)Z.elements=Z.words;else if(W)Z.elements=Z.lines;if(Q?.mask&&Z.elements.length>0)this._applyMaskWrappers(Z);return this._propagateGradientText(J,Z),v0.set(J,Z),J.setAttribute("data-split",$),Z.elements}static _splitWordsDom(J,$){let Q=Array.from(J.childNodes);for(let q of Q)if(q.nodeType===3){let Z=q.textContent||"";if(!Z)continue;let j=Z.split(/(\s+)/),G=document.createDocumentFragment(),z=!1;for(let W of j)if(/^\s+$/.test(W))G.appendChild(document.createTextNode(W.replace(/\n/g," "))),z=!0;else if(W){let N=document.createElement("span");N.setAttribute("data-split-word",""),N.setAttribute("data-word-index",String($.words.length)),N.style.display="inline-block",N.textContent=W,$.words.push(N),G.appendChild(N),z=!0}if(z)J.replaceChild(G,q)}else if(q.nodeType===1){let Z=q;if(Z.tagName==="BR")continue;this._splitWordsDom(Z,$)}}static _splitCharsDom(J,$){let Q=Array.from(J.childNodes);for(let q of Q)if(q.nodeType===3){let Z=q.textContent||"";if(!Z)continue;let j=Z.split(/(\s+)/),G=document.createDocumentFragment();for(let z of j)if(/^\s+$/.test(z))G.appendChild(document.createTextNode(z.replace(/\n/g," ")));else if(z){let W=document.createElement("span");W.setAttribute("data-split-word-wrap",""),W.style.display="inline-block",W.style.whiteSpace="nowrap";for(let N of z){let B=document.createElement("span");B.setAttribute("data-split-char",""),B.setAttribute("data-char-index",String($.chars.length)),B.style.display="inline-block",B.textContent=N,$.chars.push(B),W.appendChild(B)}G.appendChild(W)}J.replaceChild(G,q)}else if(q.nodeType===1){let Z=q;if(Z.tagName==="BR")continue;this._splitCharsDom(Z,$)}}static _splitWordsWithCharsDom(J,$){let Q=Array.from(J.childNodes);for(let q of Q)if(q.nodeType===3){let Z=q.textContent||"";if(!Z)continue;let j=Z.split(/(\s+)/),G=document.createDocumentFragment();for(let z of j)if(/^\s+$/.test(z))G.appendChild(document.createTextNode(z.replace(/\n/g," ")));else if(z){let W=document.createElement("span");W.setAttribute("data-split-word",""),W.setAttribute("data-word-index",String($.words.length)),W.style.display="inline-block",W.style.whiteSpace="nowrap";for(let N of z){let B=document.createElement("span");B.setAttribute("data-split-char",""),B.setAttribute("data-char-index",String($.chars.length)),B.style.display="inline-block",B.textContent=N,$.chars.push(B),W.appendChild(B)}$.words.push(W),G.appendChild(W)}J.replaceChild(G,q)}else if(q.nodeType===1){let Z=q;if(Z.tagName==="BR")continue;this._splitWordsWithCharsDom(Z,$)}}static _splitWithLinesDom(J,$,Q,q){let Z={chars:[],words:[],lines:[],elements:[]};this._splitWordsDom(J,Z);let j=[],G=[],z=-1/0;for(let H of Z.words){let Y=H.getBoundingClientRect();if(Y.top>z+2){if(G.length>0)j.push(G);G=[H],z=Y.top}else G.push(H)}if(G.length>0)j.push(G);let W=new Map;for(let H of Z.words)W.set(H,this._getWrapperChain(H,J));let N="",B=0,_=0,K=0;for(let H of j){let Y="",F=[];for(let X=0;X<H.length;X++){let M=H[X],k=M.textContent||"",L=W.get(M)||[],O=0;while(O<F.length&&O<L.length&&F[O]===L[O])O++;for(let h=F.length-1;h>=O;h--)Y+=`</${F[h].tagName.toLowerCase()}>`;if(X>0)Y+=" ";for(let h=O;h<L.length;h++)Y+=this._openTag(L[h]);if(Q){let h="";for(let s0 of k)h+=`<span data-split-char data-char-index="${K}" style="display:inline-block">${this._escapeHtml(s0)}</span>`,K++;if($)Y+=`<span data-split-word data-word-index="${_}" style="display:inline-block;white-space:nowrap">${h}</span>`;else Y+=h}else if($)Y+=`<span data-split-word data-word-index="${_}" style="display:inline-block">${this._escapeHtml(k)}</span>`;else Y+=this._escapeHtml(k);_++,F=L}for(let X=F.length-1;X>=0;X--)Y+=`</${F[X].tagName.toLowerCase()}>`;N+=`<span data-split-line data-line-index="${B}" style="display:block">${Y}</span>`,B++}if(J.innerHTML=N,Q)q.chars=Array.from(J.querySelectorAll("[data-split-char]"));if($)q.words=Array.from(J.querySelectorAll("[data-split-word]"));q.lines=Array.from(J.querySelectorAll("[data-split-line]"))}static _applyMaskWrappers(J){let $=J.elements;for(let Q of $){let q=Q.hasAttribute("data-split-line"),Z=Q.hasAttribute("data-split-word"),j=document.createElement("span");if(j.setAttribute("data-split-mask",""),j.style.overflow="hidden",j.style.display=q?"block":"inline-block",!q)j.style.verticalAlign=Z?"bottom":"bottom";Q.parentNode.insertBefore(j,Q),j.appendChild(Q)}}static _propagateGradientText(J,$){let Q=window.getComputedStyle(J);if((Q.getPropertyValue("background-clip")||Q.getPropertyValue("-webkit-background-clip"))!=="text")return;let Z=J.querySelectorAll("[data-split-mask], [data-split-word], [data-split-word-wrap], [data-split-char], [data-split-line]");for(let j of Z)j.style.background="inherit",j.style.backgroundClip="text",j.style.setProperty("-webkit-background-clip","text"),j.style.setProperty("-webkit-text-fill-color","transparent")}static revert(J){let $=y0.get(J);if($!==void 0&&J instanceof HTMLElement)return J.innerHTML=$,J.removeAttribute("data-split"),y0.delete(J),v0.delete(J),!0;return!1}static isSplit(J){return J.hasAttribute("data-split")}static getResult(J){return v0.get(J)}static _getWrapperChain(J,$){let Q=[],q=J.parentElement;while(q&&q!==$)Q.unshift(q),q=q.parentElement;return Q}static _openTag(J){let $=J.tagName.toLowerCase(),Q="";for(let q of Array.from(J.attributes))Q+=` ${q.name}="${this._escapeHtml(q.value)}"`;return`<${$}${Q}>`}static _escapeHtml(J){return J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}}U.textSplitter={split:(J,$,Q)=>h0.split(J,$,Q),revert:h0.revert,isSplit:h0.isSplit};class rJ{static resolve(J,$){if(J.length===0)return[];if(J.length===1)return[0];if(typeof $==="number")return J.map((Q,q)=>q*$);return this.resolveComplexStagger(J,$)}static resolveComplexStagger(J,$){let Q=J.length;if(Q===1)return[0];let q;if($.each!==void 0)q=$.each;else if($.amount!==void 0)q=$.amount/(Q-1);else q=0.1;let Z=this.getOrdering(J,$),j=Array(Q);for(let G=0;G<Q;G++)j[Z[G].originalIndex]=Z[G].order*q;return j}static getOrdering(J,$){let Q=J.length,q=$.from??"start";if($.grid)return this.getGridOrdering(J,$);switch(q){case"start":return J.map((Z,j)=>({originalIndex:j,order:j}));case"end":return J.map((Z,j)=>({originalIndex:j,order:Q-1-j}));case"center":{let Z=Math.floor(Q/2);return J.map((j,G)=>{let z=Math.abs(G-Z);return{originalIndex:G,order:z}})}case"edges":return J.map((Z,j)=>{let G=Math.min(j,Q-1-j);return{originalIndex:j,order:G}});case"random":{let Z=J.map((j,G)=>({originalIndex:G,order:Math.random()}));return Z.sort((j,G)=>j.order-G.order),Z.forEach((j,G)=>{j.order=G}),Z}default:if(typeof q==="number"){let Z=Math.max(0,Math.min(Q-1,q));return J.map((j,G)=>{let z=Math.abs(G-Z);return{originalIndex:G,order:z}})}return J.map((Z,j)=>({originalIndex:j,order:j}))}}static getGridOrdering(J,$){let Q,q;if($.grid==="auto"){let z=this.detectGrid(J);Q=z.cols,q=z.rows}else[Q,q]=$.grid;let Z=$.from??"start",j=$.axis??"x",G=J.map((z,W)=>{let N=W%Q,B=Math.floor(W/Q);return{originalIndex:W,col:N,row:B}});if(Z==="random"){let z=G.map((W)=>({originalIndex:W.originalIndex,order:Math.random()}));return z.sort((W,N)=>W.order-N.order),z.forEach((W,N)=>{W.order=N}),z}return G.map((z)=>{let W;if(typeof Z==="number"){let N=Z%Q,B=Math.floor(Z/Q);W=j==="x"?Math.abs(z.col-N)+Math.abs(z.row-B)*0.5:Math.abs(z.row-B)+Math.abs(z.col-N)*0.5}else if(Z==="center"){let N=(Q-1)/2,B=(q-1)/2;W=Math.abs(z.col-N)+Math.abs(z.row-B)}else if(Z==="edges"){let N=Math.min(z.col,Q-1-z.col),B=Math.min(z.row,q-1-z.row);W=Math.min(N,B)}else if(Z==="end")W=j==="x"?(q-1-z.row)*Q+(Q-1-z.col):(Q-1-z.col)*q+(q-1-z.row);else W=j==="x"?z.row*Q+z.col:z.col*q+z.row;return{originalIndex:z.originalIndex,order:W}})}static detectGrid(J){if(J.length===0)return{cols:0,rows:0};let $=J.filter((j)=>j instanceof Element);if($.length===0)return{cols:J.length,rows:1};let Q=new Map;$.forEach((j)=>{let G=j.getBoundingClientRect(),z=Math.round(G.top);Q.set(z,(Q.get(z)||0)+1)});let q=Q.size;return{cols:Math.ceil(J.length/q),rows:q}}}U.stagger={resolve:(J,$)=>rJ.resolve(J,$)};function A7(J,$,Q){if(!(J instanceof HTMLElement))return console.warn("[Motion Fit] Fit animations only support HTML elements. SVG elements are not supported."),null;let q=document.querySelector($);if(!q)return console.warn(`[Motion Fit] Target element not found: "${$}". Animation skipped.`),null;if(!(q instanceof HTMLElement))return console.warn("[Motion Fit] Fit animations only support HTML elements. SVG elements are not supported."),null;if(q===J)return console.warn("[Motion Fit] Target element is the same as source element. Animation skipped."),null;let Z=J.getBoundingClientRect(),j=q.getBoundingClientRect(),G=Z.width===0?1:Z.width,z=Z.height===0?1:Z.height,W=Z.left+G/2,N=Z.top+z/2,B=j.left+j.width/2,_=j.top+j.height/2,K=B-W,H=_-N,Y=j.width/G,F=j.height/z;if(!Q)return{dx:K,dy:H,sx:Y,sy:F,sourceWidth:Z.width,sourceHeight:Z.height,targetWidth:j.width,targetHeight:j.height};let X=J.offsetParent??document.documentElement,M=X.getBoundingClientRect(),k=X.scrollLeft??0,L=X.scrollTop??0;return{dx:K,dy:H,sx:Y,sy:F,sourceWidth:Z.width,sourceHeight:Z.height,targetWidth:j.width,targetHeight:j.height,sourceLeft:J.offsetLeft,sourceTop:J.offsetTop,targetLeft:j.left-M.left+k,targetTop:j.top-M.top+L}}var v=0.01,H0=0.001;function I7(J,$,Q,q){let{absolute:Z=!1,scale:j=!0,resize:G=!1}=Q;if($ instanceof HTMLElement)P($,!1);let z=A7($,Q.target,Z);if(!z)return;if(!Z)if(G){let W=z.dx-(z.targetWidth-z.sourceWidth)/2,N=z.dy-(z.targetHeight-z.sourceHeight)/2;if(Math.abs(W)>v){let B=q.acquire();B.init($,"x",0,W,"px"),J.addPropTween(B)}if(Math.abs(N)>v){let B=q.acquire();B.init($,"y",0,N,"px"),J.addPropTween(B)}if(Math.abs(z.targetWidth-z.sourceWidth)>v){let B=q.acquire();B.init($,"width",z.sourceWidth,z.targetWidth,"px"),J.addPropTween(B)}if(Math.abs(z.targetHeight-z.sourceHeight)>v){let B=q.acquire();B.init($,"height",z.sourceHeight,z.targetHeight,"px"),J.addPropTween(B)}}else{let W=n($,"x"),N=n($,"y"),B=W+z.dx,_=N+z.dy;if(Math.abs(B-W)>v||Math.abs(W)>v||Math.abs(B)>v){let K=q.acquire();K.init($,"x",W,B,"px"),J.addPropTween(K)}if(Math.abs(_-N)>v||Math.abs(N)>v||Math.abs(_)>v){let K=q.acquire();K.init($,"y",N,_,"px"),J.addPropTween(K)}if(j){let K=n($,"scaleX"),H=n($,"scaleY"),Y=K*z.sx,F=H*z.sy;if(Math.abs(Y-K)>H0||Math.abs(K-1)>H0||Math.abs(Y-1)>H0){let X=q.acquire();X.init($,"scaleX",K,Y,""),J.addPropTween(X)}if(Math.abs(F-H)>H0||Math.abs(H-1)>H0||Math.abs(F-1)>H0){let X=q.acquire();X.init($,"scaleY",H,F,""),J.addPropTween(X)}}}else{let W=$;if(window.getComputedStyle(W).position==="static")W.style.position="absolute";let{sourceLeft:B,sourceTop:_,targetLeft:K,targetTop:H}=z;if(Math.abs(K-B)>v){let Y=q.acquire();Y.init($,"left",B,K,"px"),J.addPropTween(Y)}if(Math.abs(H-_)>v){let Y=q.acquire();Y.init($,"top",_,H,"px"),J.addPropTween(Y)}if(j){if(Math.abs(z.targetWidth-z.sourceWidth)>v){let Y=q.acquire();Y.init($,"width",z.sourceWidth,z.targetWidth,"px"),J.addPropTween(Y)}if(Math.abs(z.targetHeight-z.sourceHeight)>v){let Y=q.acquire();Y.init($,"height",z.sourceHeight,z.targetHeight,"px"),J.addPropTween(Y)}}}}function O7(J,$,Q,q){J.setPendingFitSetup((G)=>I7(J,$,Q,G)),J.setLazyStartCapture(!0);let{absolute:Z=!1,resize:j=!1}=Q;J.setFitCleanup(()=>{if($ instanceof HTMLElement){if(P($,!0),j)$.style.width="",$.style.height="";if(Z)$.style.width="",$.style.height="",$.style.left="",$.style.top=""}})}U.fit={registerPendingSetup:O7};var $6=(J)=>J,L7=$6,R={in:(J)=>J*J,out:(J)=>J*(2-J),inOut:(J)=>J<0.5?2*J*J:-1+(4-2*J)*J},e={in:(J)=>J*J*J,out:(J)=>--J*J*J+1,inOut:(J)=>J<0.5?4*J*J*J:(J-1)*(2*J-2)*(2*J-2)+1},J0={in:(J)=>J*J*J*J,out:(J)=>1- --J*J*J*J,inOut:(J)=>J<0.5?8*J*J*J*J:1-8*--J*J*J*J},p={in:(J)=>J*J*J*J*J,out:(J)=>1+--J*J*J*J*J,inOut:(J)=>J<0.5?16*J*J*J*J*J:1+16*--J*J*J*J*J};var T0={in:(J)=>1-Math.cos(J*Math.PI/2),out:(J)=>Math.sin(J*Math.PI/2),inOut:(J)=>-(Math.cos(Math.PI*J)-1)/2},f0={in:(J)=>2**(10*(J-1))*J+J*J*J*J*J*J*(1-J),out:(J)=>1-(2**(10*-J)*(1-J)+(1-J)*(1-J)*(1-J)*(1-J)*(1-J)*(1-J)*J),inOut:(J)=>{if(J<0.5){let Q=J*2;return(2**(10*(Q-1))*Q+Q*Q*Q*Q*Q*Q*(1-Q))/2}let $=(1-J)*2;return 1-(2**(10*($-1))*$+$*$*$*$*$*$*(1-$))/2}},u0={in:(J)=>1-Math.sqrt(1-J*J),out:(J)=>Math.sqrt(1- --J*J),inOut:(J)=>{if((J*=2)<1)return-0.5*(Math.sqrt(1-J*J)-1);return 0.5*(Math.sqrt(1-(J-=2)*J)+1)}};var Q6=(J=1.70158)=>{let $=(Q)=>Q?--Q*Q*((J+1)*Q+J)+1:0;return{in:(Q)=>1-$(1-Q),out:$,inOut:(Q)=>{if(Q<0.5)return(1-$(1-Q*2))/2;return 0.5+$((Q-0.5)*2)/2}}},d0=Q6();var q6=(J=1,$=0.3)=>{let Q=Math.max(1,J),q=$/(2*Math.PI)*Math.asin(1/Q),Z=$*1.5,j=Z/(2*Math.PI)*Math.asin(1/Q);return{in:(G)=>{if(G===0)return 0;if(G===1)return 1;return-(Q*Math.pow(2,10*(G-=1))*Math.sin((G-q)*(2*Math.PI)/$))},out:(G)=>{if(G===0)return 0;if(G===1)return 1;return Q*Math.pow(2,-10*G)*Math.sin((G-q)*(2*Math.PI)/$)+1},inOut:(G)=>{if(G===0)return 0;if(G===1)return 1;if((G*=2)<1)return-0.5*(Q*Math.pow(2,10*(G-=1))*Math.sin((G-j)*(2*Math.PI)/Z));return Q*Math.pow(2,-10*(G-=1))*Math.sin((G-j)*(2*Math.PI)/Z)*0.5+1}}},p0=q6(),tJ=(J)=>{if(J<0.36363636363636365)return 7.5625*J*J;else if(J<0.7272727272727273)return 7.5625*(J-=0.5454545454545454)*J+0.75;else if(J<0.9090909090909091)return 7.5625*(J-=0.8181818181818182)*J+0.9375;else return 7.5625*(J-=0.9545454545454546)*J+0.984375},Y0={in:(J)=>1-tJ(1-J),out:tJ,inOut:(J)=>{if(J<0.5)return Y0.in(J*2)*0.5;return Y0.out(J*2-1)*0.5+0.5}},O0=(J=0.7,$=0.7,Q=!1)=>{let q=J!==1?$:0,Z=(1-J)/2,j=Z+J,G=Q;return(z)=>{let W=z+(0.5-z)*q;if(z<Z){let N=1-z/Z;if(G)return 1-N*N;return W-N*N*N*N*W}else if(z>j){let N=(z-j)/Z;if(G)return z===1?0:1-N*N;return W+(z-W)*N*N*N*N}return G?1:W}},eJ={in:O0(0.7,0.7,!1),out:O0(0.7,0.7,!1),inOut:O0(0.7,0.7,!1)},m0=(J=1,$=20,Q=!1)=>{let q=[],Z=1/$;for(let j=0;j<$;j++){let G=j*Z,W=((j*1327+531)%1000/1000-0.5)*J*0.4,N=G+W;q.push({x:G,y:Q?Math.max(0,Math.min(1,N)):N})}return q[0]={x:0,y:0},q.push({x:1,y:1}),(j)=>{if(j<=0)return 0;if(j>=1)return 1;let G=0,z=q.length-1;while(G<z-1){let _=G+z>>1;if(q[_].x<=j)G=_;else z=_}let W=q[G],N=q[z],B=(j-W.x)/(N.x-W.x);return W.y+(N.y-W.y)*B}},M7={in:m0(1,20,!0),out:m0(1,20,!0),inOut:m0(1,20,!0)},g0=(J)=>{return($)=>{if($>=1)return 1;return Math.floor($*J)/J}},c0={in:g0(12),out:g0(12),inOut:g0(12)},J6={linear:$6,none:L7,power1:R.out,"power1.in":R.in,"power1.out":R.out,"power1.inout":R.inOut,power2:e.out,"power2.in":e.in,"power2.out":e.out,"power2.inout":e.inOut,power3:J0.out,"power3.in":J0.in,"power3.out":J0.out,"power3.inout":J0.inOut,power4:p.out,"power4.in":p.in,"power4.out":p.out,"power4.inout":p.inOut,quad:R.out,"quad.in":R.in,"quad.out":R.out,"quad.inout":R.inOut,cubic:e.out,"cubic.in":e.in,"cubic.out":e.out,"cubic.inout":e.inOut,quart:J0.out,"quart.in":J0.in,"quart.out":J0.out,"quart.inout":J0.inOut,quint:p.out,"quint.in":p.in,"quint.out":p.out,"quint.inout":p.inOut,strong:p.out,"strong.in":p.in,"strong.out":p.out,"strong.inout":p.inOut,sine:T0.out,"sine.in":T0.in,"sine.out":T0.out,"sine.inout":T0.inOut,expo:f0.out,"expo.in":f0.in,"expo.out":f0.out,"expo.inout":f0.inOut,circ:u0.out,"circ.in":u0.in,"circ.out":u0.out,"circ.inout":u0.inOut,back:d0.out,"back.in":d0.in,"back.out":d0.out,"back.inout":d0.inOut,elastic:p0.out,"elastic.in":p0.in,"elastic.out":p0.out,"elastic.inout":p0.inOut,bounce:Y0.out,"bounce.in":Y0.in,"bounce.out":Y0.out,"bounce.inout":Y0.inOut,slow:eJ.inOut,"slow.in":R.out,"slow.out":R.out,"slow.inout":R.out,slowmo:eJ.inOut,"slowmo.in":R.out,"slowmo.out":R.out,"slowmo.inout":R.out,rough:M7.inOut,"rough.in":R.out,"rough.out":R.out,"rough.inout":R.out,steps:c0.inOut,"steps.in":c0.in,"steps.out":c0.out,"steps.inout":c0.inOut},k7={back:(J)=>Q6(J),elastic:(J,$)=>q6(J,$),slow:(J,$,Q)=>{let q=O0(J,$,Q===1);return{in:q,out:q,inOut:q}},slowmo:(J,$,Q)=>{let q=O0(J,$,Q===1);return{in:q,out:q,inOut:q}},rough:(J,$,Q)=>{let q=m0(J,$,Q===1);return{in:q,out:q,inOut:q}},steps:(J)=>{let $=g0(J??12);return{in:$,out:$,inOut:$}}},D7=/^(\w+)(?:\.(\w+))?\(([^)]*)\)$/;function Z6(J){let $=J.toLowerCase();if(J6[$])return J6[$];let Q=D7.exec($);if(Q){let[,q,Z,j]=Q,G=k7[q];if(G){let z=j.split(",").map((W)=>W.trim()).filter((W)=>W.length>0).map(Number);if(z.every((W)=>!isNaN(W))){let W=G(...z),N=Z||"out",_=W[N==="inout"?"inOut":N];if(_)return _}}}return console.warn(`[Motion] Unknown easing "${J}". Falling back to "power1.out". Valid easings: linear, power1-4.in/out/inOut, quad, cubic, quart, quint, strong, sine, expo, circ, back, elastic, bounce, slow, rough, steps. Parameterized: back.out(overshoot), elastic.out(amplitude, period), steps(n), slow(ratio, power, yoyo), rough(strength, points, clamp)`),R.out}class UJ{_id=0;_targets=[];_duration=0.5;_delay=0;_time=0;_progress=0;_timeScale=1;_isActive=!1;_isReversed=!1;_propTweens=null;_lastPropTween=null;_easingFn=null;_repeat=0;_repeatDelay=0;_yoyo=!1;_currentRepeat=0;_onStart;_onUpdate;_onComplete;_onRepeat;_onReverseComplete;_startFired=!1;_completeFired=!1;_timelineChild=!1;_needsStartCapture=!1;_startCaptured=!1;_fitSetupFn=null;_pendingFitSetup=null;_fitCleanupFn=null;_unregisterCallback=null;init(J,$,Q,q,Z,j){return this._id=J,this._targets=$,this._duration=Q,this._delay=q,this._easingFn=Z6(Z),this._time=0,this._progress=0,this._timeScale=1,this._isActive=!1,this._isReversed=!1,this._startFired=!1,this._completeFired=!1,this._currentRepeat=0,this._repeat=j?.repeat??0,this._repeatDelay=j?.repeatDelay??0,this._yoyo=j?.yoyo??!1,this._onStart=j?.onStart,this._onUpdate=j?.onUpdate,this._onComplete=j?.onComplete,this._onRepeat=j?.onRepeat,this._onReverseComplete=j?.onReverseComplete,this}update(J){if(!this._isActive)return;let $=J*this._timeScale;if(this._time+=this._isReversed?-$:$,!this._isReversed&&this._time<0){this._time=0;return}let Q=Math.max(0,this._time-this._delay);if(this._progress=this._duration>0?Math.min(1,Q/this._duration):1,!this._startFired&&this._progress>0)this._startFired=!0,this._onStart?.();if(this.render(this._progress),this._onUpdate?.(this._progress),this._isReversed){if(this._time<=0)this.handleComplete()}else if(this._progress>=1)this.handleComplete()}render(J){let $=this.applyEasing(J),Q=this._propTweens;while(Q)Q.render($),Q=Q.next}renderAtTime(J){let $=Math.max(0,J),Q=this._duration,q=this._delay,Z=this._currentRepeat;if(Q===0){let j=$>=q?1:0;this._time=$,this._progress=j,this.render(j)}else{let j=Math.max(0,$-q);if(this._repeat===0){let G=Math.min(1,j/Q);this._time=Math.min(Q,j),this._progress=G,this.render(G)}else{let G=this._repeatDelay,z=Q+G,W=this._repeat===-1?1/0:Q*(this._repeat+1)+G*this._repeat,N=this._repeat===-1?j:Math.min(j,W),B=z>0?Math.floor(N/z):0,_=N-B*z,K=_>Q,H=Q>0?Math.min(1,_/Q):1,Y=this._yoyo&&B%2===1;if(K)H=Y?0:1;else if(Y)H=1-H;this._currentRepeat=this._repeat===-1?B:Math.min(B,this._repeat),this._isReversed=Y,this._progress=H,this._time=Q*H,this.render(H)}}if(this._isActive){if(!this._startFired){this._startFired=!0;try{this._onStart?.()}catch(j){console.error("[Motion] onStart callback error:",j)}}try{this._onUpdate?.(this._progress)}catch(j){console.error("[Motion] onUpdate callback error:",j)}if(this._currentRepeat>Z)try{this._onRepeat?.(this._currentRepeat)}catch(j){console.error("[Motion] onRepeat callback error:",j)}if(!this._completeFired&&this._repeat!==-1){if($>=this.totalDuration()){this._completeFired=!0;try{this._onComplete?.()}catch(j){console.error("[Motion] onComplete callback error:",j)}}}}}applyEasing(J){if(!this._easingFn)return J;return this._easingFn(J)}handleComplete(){if(this._repeat===-1||this._currentRepeat<this._repeat){if(this._currentRepeat++,this._onRepeat?.(this._currentRepeat),this._yoyo)this._isReversed=!this._isReversed,this._time=this._isReversed?this._duration+this._delay:0;else this._time=0,this._startFired=!1;this._time-=this._repeatDelay;return}if(this._isReversed)this._onReverseComplete?.();else this._onComplete?.();this._isActive=!1}play(J){if(J!==void 0)return this.seek(J),this._isActive=!0,this._isReversed=!1,this;if(this._isActive&&!this._isReversed)return this;return this._isActive=!0,this._isReversed=!1,this}pause(J){if(J!==void 0){this._time=J;let $=Math.max(0,this._time-this._delay);this._progress=this._duration>0?Math.min(1,$/this._duration):1,this.render(this._progress)}return this._isActive=!1,this}reverse(J){if(J!==void 0)this.seek(J);return this._isActive=!0,this._isReversed=!0,this}restart(J=!0){return this._time=J?0:this._delay,this._progress=0,this._isActive=!0,this._isReversed=!1,this._startFired=!1,this._currentRepeat=0,this.render(0),this}seek(J){this._time=J;let $=Math.max(0,this._time-this._delay);return this._progress=this._duration>0?Math.min(1,$/this._duration):1,this.render(this._progress),this}progress(J){if(J===void 0)return this._progress;if(this._progress=Math.max(0,Math.min(1,J)),this._progress===0)this._time=0;else this._time=this._progress*this._duration+this._delay;return this.render(this._progress),this}time(J){if(J===void 0)return this._time;this._time=J;let $=Math.max(0,this._time-this._delay);return this._progress=this._duration>0?Math.min(1,$/this._duration):1,this.render(this._progress),this}timeScale(J){if(J===void 0)return this._timeScale;return this._timeScale=J,this}getTimeScale(){return this._timeScale}kill(){this._isActive=!1,this._unregisterCallback?.()}isActive(){return this._isActive}isTimelineChild(){return this._timelineChild}setTimelineChild(J){this._timelineChild=J}setLazyStartCapture(J){this._needsStartCapture=J,this._startCaptured=!1}setPendingFitSetup(J){this._fitSetupFn=J,this._pendingFitSetup=J}setFitCleanup(J){this._fitCleanupFn=J}resetForReplay(){if(this._fitSetupFn)this._fitCleanupFn?.(),this._pendingFitSetup=this._fitSetupFn,this._startCaptured=!1;this._startFired=!1,this._completeFired=!1}needsStartCapture(){return this._needsStartCapture&&!this._startCaptured}isLazyCapture(){return this._needsStartCapture}fireReverseComplete(){try{this._onReverseComplete?.()}catch(J){console.error("[Motion] onReverseComplete callback error:",J)}this._startFired=!1,this._completeFired=!1}setUnregisterCallback(J){this._unregisterCallback=J}captureStartValues(){if(!this._needsStartCapture||this._startCaptured)return;if(this._pendingFitSetup){let $=this._propTweens;while($){let Q=$.next;t.release($),$=Q}this._propTweens=null,this._lastPropTween=null,this._pendingFitSetup(t),this._pendingFitSetup=null,this._startCaptured=!0;return}let J=this._propTweens;while(J){if(J.target instanceof Element){let{target:$,property:Q}=J;if(J.valueType==="color"&&q0(Q)){let q=U.color?.getCurrentColor($,Q);if(q&&J.endColor)J.startColor=q,J.changeColor=new Float32Array([J.endColor[0]-q[0],J.endColor[1]-q[1],J.endColor[2]-q[2],J.endColor[3]-q[3]])}else if(J.valueType==="filter"&&a(Q)){let q=U.filter?.getCurrentFilter($);if(q&&J.endFilters){let Z=U.filter.mergeFilterArrays(q,J.endFilters);J.startFilters=Z.start,J.endFilters=Z.end}}else{let q=n($,Q);J.startValue=q,J.change=J.endValue-J.startValue}}J=J.next}this._startCaptured=!0}getId(){return this._id}getTargets(){return this._targets}getDuration(){return this._duration}getDelay(){return this._delay}clearDelay(){this._delay=0}getFirstPropTween(){return this._propTweens}addPropTween(J){if(!this._lastPropTween)this._propTweens=J;else this._lastPropTween.next=J;this._lastPropTween=J}totalDuration(){if(this._repeat===-1)return 1/0;let $=this._duration*(this._repeat+1)+this._repeatDelay*this._repeat;return this._delay+$}reset(){this._id=0,this._targets=[],this._duration=0.5,this._delay=0,this._time=0,this._progress=0,this._timeScale=1,this._isActive=!1,this._isReversed=!1,this._easingFn=null,this._repeat=0,this._repeatDelay=0,this._yoyo=!1,this._currentRepeat=0,this._onStart=void 0,this._onUpdate=void 0,this._onComplete=void 0,this._onRepeat=void 0,this._onReverseComplete=void 0,this._startFired=!1,this._completeFired=!1,this._timelineChild=!1,this._needsStartCapture=!1,this._startCaptured=!1,this._fitSetupFn=null,this._pendingFitSetup=null,this._fitCleanupFn=null,this._unregisterCallback=null;let J=t,$=this._propTweens;while($){let Q=$.next;J.release($),$=Q}this._propTweens=null,this._lastPropTween=null}}var L0=new A0(()=>new UJ,100),j6={acquire:()=>L0.acquire(),release:(J)=>L0.release(J),getPoolSize:()=>L0.getPoolSize(),getTotalCreated:()=>L0.getTotalCreated(),clear:()=>L0.clear()};class x{static instance;animations=[];animationIdToIndex=new Map;nextAnimationId=1;totalCreated=0;_animationSnapshot=[];timelines=new Map;ticker;animationPool;propTweenPool;constructor(){this.ticker=V.getInstance(),this.animationPool=j6,this.propTweenPool=t,this.ticker.add(this.update,0)}static getInstance(){if(!x.instance)x.instance=new x,E.setEngineRegisterCallback((J,$)=>{let Q=x.instance;if(!Q.hasTimeline(J))Q.registerTimeline(J,$)}),d.setCreateAnimationCallback((J,$,Q,q,Z,j,G,z)=>{return x.instance.createAnimation(J,$,Q,q,Z,j,G,z)});return x.instance}update=(J)=>{let $=this._animationSnapshot,Q=this.animations.length;$.length=Q;for(let Z=0;Z<Q;Z++)$[Z]=this.animations[Z];let q=[];for(let Z=0,j=$.length;Z<j;Z++){let G=$[Z];if(G.isTimelineChild())continue;if(G.isActive()){if(G.update(J),!G.isActive()&&!G.isTimelineChild())q.push(G.getId())}}for(let Z of q)this.unregisterAnimation(Z);for(let Z of this.timelines.values())if(Z.isActive())Z.update(J)};createAnimation(J,$,Q,q,Z,j,G,z){let W=z?.stagger;if(W&&J.length>1)return this.createStaggeredAnimations(J,$,Q,q,Z,j,G,W,z);let N=this.animationPool.acquire(),B=this.registerAnimation(N);if(N.init(B,J,Q,q,Z,z),this.setupPropertyTweens(N,J,$,j,G),Q===0)N.render(1);else if(j&&!z?._skipInitialRender)N.render(0);return N}createStaggeredAnimations(J,$,Q,q,Z,j,G,z,W){if(!U.stagger){let _=this.animationPool.acquire(),K=this.registerAnimation(_);if(_.init(K,J,Q,q,Z,W),this.setupPropertyTweens(_,J,$,j,G),Q===0)_.render(1);else if(j&&!W?._skipInitialRender)_.render(0);return[_]}let N=U.stagger.resolve(J,z),B=[];for(let _=0;_<J.length;_++){let K=J[_],H=N[_],Y=this.animationPool.acquire(),F=this.registerAnimation(Y);if(Y.init(F,[K],Q,q+H,Z,W),this.setupPropertyTweens(Y,[K],$,j,G),Q===0)Y.render(1);else if(j&&!W?._skipInitialRender)Y.render(0);B.push(Y)}return B}setupPropertyTweens(J,$,Q,q,Z){let j=Object.keys(Q),G=Z?Object.keys(Z):[],z=[...new Set([...j,...G])],W=Q,N=Z,B="perspective"in W,_=N&&"perspective"in N,K=B&&_;for(let H of $){if(!K&&(B||_)&&H instanceof Element){let Y=B?W.perspective:N.perspective,F=typeof Y==="number"?Y:parseFloat(String(Y))||0;if(F>0)y(H,"perspective",F,"px"),H.style.transform=b(H)}for(let Y of z){if(Y==="perspective"&&!K)continue;let F=W[Y],X=vJ(H,Y,F,N?N[Y]:void 0),M=this.propTweenPool.acquire(),k=q&&!Z;switch(X.type){case"color":{let L=k?X.endColor:X.startColor,O=k?X.startColor:X.endColor;M.initColor(H,Y,L,O);break}case"filter":{let L=k?X.endFilters:X.startFilters,O=k?X.startFilters:X.endFilters;M.initFilter(H,Y,L,O);break}case"scalar":{let L=k?X.endValue:X.startValue,O=k?X.startValue:X.endValue;M.init(H,Y,L,O,X.unit);break}case"drawSVG":{let L=k?X.endDraw:X.startDraw,O=k?X.startDraw:X.endDraw;M.initDrawSVG(H,Y,L,O,X.length);break}case"path":{let L=k?X.endProgress:X.startProgress,O=k?X.startProgress:X.endProgress;M.initPath(H,Y,X.pathData,X.pathLength,L,O,X.rotate,X.alignOffset,X.pathOffset);break}}J.addPropTween(M)}}}registerAnimation(J){let $=this.nextAnimationId++,Q=this.animations.length;return this.animations.push(J),this.animationIdToIndex.set($,Q),this.totalCreated++,J.setUnregisterCallback(()=>this.unregisterAnimation($)),$}unregisterAnimation(J){let $=this.animationIdToIndex.get(J);if($===void 0)return;let Q=this.animations[$],q=this.animations.length-1;if($!==q){let Z=this.animations[q];this.animations[$]=Z,this.animationIdToIndex.set(Z.getId(),$)}this.animations.pop(),this.animationIdToIndex.delete(J),this.animationPool.release(Q)}getAnimation(J){let $=this.animationIdToIndex.get(J);return $!==void 0?this.animations[$]:void 0}killAll(){let J=[...this.animations];for(let $=0,Q=J.length;$<Q;$++)J[$].kill();this.animations.length=0,this.animationIdToIndex.clear()}killAnimationsForTargets(J){if(J.length===0)return;let $=new Set(J),Q=[];for(let q=0,Z=this.animations.length;q<Z;q++){let j=this.animations[q],G=j.getTargets();for(let z of G)if(z instanceof Element&&$.has(z)){Q.push(j);break}}for(let q of Q)q.kill()}getActiveCount(){let J=0;for(let $=0,Q=this.animations.length;$<Q;$++)if(this.animations[$].isActive())J++;return J}getTotalCreated(){return this.totalCreated}getTimeline(J){let $=this.timelines.get(J);if(!$){if($=new E(J),!this.timelines.has(J))this.timelines.set(J,$),$.setUnregisterCallback(()=>this.removeTimeline(J))}return $}hasTimeline(J){return this.timelines.has(J)}registerTimeline(J,$){this.timelines.set(J,$),$.setUnregisterCallback(()=>this.removeTimeline(J))}getTimelineCount(){return this.timelines.size}getTimelineNames(){return Array.from(this.timelines.keys())}removeTimeline(J){this.timelines.delete(J)}killAllTimelines(){for(let J of this.timelines.values())J.kill();this.timelines.clear()}killEverything(){this.killAllTimelines(),this.killAll(),wJ()}getAnimationPool(){return this.animationPool}getPropTweenPool(){return this.propTweenPool}getPoolStats(){return{animations:this.animationPool.getPoolSize(),propTweens:this.propTweenPool.getPoolSize()}}clearPools(){this.animationPool.clear(),this.propTweenPool.clear()}getMemoryEstimate(){let J=this.animations.length,$=this.animationPool.getPoolSize(),Q=this.propTweenPool.getPoolSize();return(J+$)*500+Q*100}getTicker(){return this.ticker}}function b7(J,$){if(typeof J==="string"){let Q=$||(typeof document<"u"?document:null);if(!Q)return[];try{return Array.from(Q.querySelectorAll(J))}catch{return[]}}if(typeof Element<"u"&&J instanceof Element)return[J];if(typeof NodeList<"u"&&J instanceof NodeList||typeof HTMLCollection<"u"&&J instanceof HTMLCollection)return Array.from(J);if(Array.isArray(J))return J;if(J&&typeof J==="object"&&"length"in J)return Array.from(J);return[]}function R7(J,$,Q){if(Q===void 0)return(q)=>Math.min($,Math.max(J,q));return Math.min($,Math.max(J,Q))}function E7(J,$,Q){let q=J+Math.random()*($-J);if(Q&&Q>0)return Math.round(q/Q)*Q;return q}function x7(J,$){let Q=(q)=>{if(typeof J==="number"){if(J<=0)return q;return Math.round(q/J)*J}let Z=J,j=Z[0],G=Math.abs(q-j);for(let z=1;z<Z.length;z++){let W=Math.abs(q-Z[z]);if(W<G)G=W,j=Z[z]}return j};if($===void 0)return Q;return Q($)}function V7(J,$,Q){return J+($-J)*Q}function C7(J,$,Q,q,Z){let j=(G)=>{let z=(G-J)/($-J);return Q+z*(q-Q)};if(Z===void 0)return j;return j(Z)}function w7(J,$,Q){let q=(Z)=>(Z-J)/($-J);if(Q===void 0)return q;return q(Q)}function P7(J,$,Q){let q=$-J,Z=(j)=>{return((j-J)%q+q)%q+J};if(Q===void 0)return Z;return Z(Q)}var FJ={toArray:b7,clamp:R7,random:E7,snap:x7,interpolate:V7,mapRange:C7,normalize:w7,wrap:P7};function c(J,$,Q){let Z=x.getInstance().getTimeline(J);if($!==void 0&&Z.duration()>0)console.warn(`[Motion] Timeline "${J}" already has animations. New entries will be appended. Call Motion("${J}").kill() first to rebuild from scratch.`);if(Array.isArray($)&&$.length>0&&typeof $[0]==="object"&&$[0]!==null&&"target"in $[0])for(let j of $)Z._addEntry(j.target,j,j.position);else if($!==void 0&&Q!==void 0)Z._addEntry($,Q);return Z}c.reset=function(J){x.getInstance();let $=M0(J),Q=[];for(let q of $)if(q instanceof Element)Q.push(q);if(Q.length>0)x.getInstance().killAnimationsForTargets(Q);for(let q of $){if(!(q instanceof Element))continue;if(U.textSplitter?.isSplit?.(q))U.textSplitter?.revert?.(q);P(q),U.styleReset?.clearAnimationStylesAndUnregister?.(q),U.styleReset?.clearPinStylesAndUnregister?.(q)}};c.set=function(J,$){x.getInstance();let Q=new E;Q._addEntry(J,{to:$,duration:0}),Q.kill(!1)};c.get=function(J){let $=x.getInstance();return $.hasTimeline(J)?$.getTimeline(J):void 0};c.has=function(J){return x.getInstance().hasTimeline(J)};c.getNames=function(){return x.getInstance().getTimelineNames()};c.kill=function(J){let $=x.getInstance();if($.hasTimeline(J))$.getTimeline(J).kill()};c.killAll=function(){x.getInstance().killEverything()};c.refreshScrollTriggers=function(){U.triggerManager?.getInstance?.()?.refreshScrollTriggers()};c.cleanup=function(){if(typeof document>"u")return;document.querySelectorAll("[data-scrolltrigger-spacer]").forEach((J)=>J.remove()),document.querySelectorAll("[data-scrolltrigger-markers]").forEach((J)=>J.remove())};c.utils=FJ;var S7=c;var y7={};export{y7 as Types,E as Timeline,FJ as MotionUtils,S7 as Motion};
|
|
30
30
|
|
|
31
|
-
//# debugId=
|
|
31
|
+
//# debugId=B4528A88FBEF928264756E2164756E21
|
|
32
32
|
//# sourceMappingURL=index.js.map
|