@motion.page/sdk 1.1.0 → 1.1.1

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/index.cjs CHANGED
@@ -33,4 +33,3 @@ var{defineProperty:DJ,getOwnPropertyNames:r6,getOwnPropertyDescriptor:t6}=Object
33
33
  `||J==="\t"}function k9(J){let $=J.textContent??"";if(!_J.has(J))_J.set(J,$);return $===" "?" ":$}function R9(J,$){if(!$||$.length===0)return{width:0,char:""};let Q=J.parentElement;if(!Q)return{width:0,char:""};let Z=document.createElement("span"),j=Z.style;j.position="absolute",j.left="-99999px",j.top="0",j.visibility="hidden",j.whiteSpace="pre",j.display="inline-block",j.pointerEvents="none";let q=[],z=new Set;for(let N of $){if(z.has(N))continue;z.add(N);let H=document.createElement("span");H.style.display="inline-block",H.textContent=N,Z.appendChild(H),q.push({el:H,c:N})}Q.appendChild(Z);let G=0,Y="";try{for(let{el:N,c:H}of q){let X=N.getBoundingClientRect().width;if(X>G)G=X,Y=H}}finally{Q.removeChild(Z)}return{width:G,char:Y}}function b9(J,$,Q=v6,Z=!0,j="none",q=!1,z=""){let G=0,Y=0,N="";if(j!=="none"&&$!=="board"){let H=null;for(let X of J)if(!N0(X.textContent??""))G=Math.max(G,X.offsetWidth),H??=X;if(H&&z){let X=R9(H,z);if(Y=X.width,N=X.char,Y>G)G=Y}G=Math.max(G,8)+4}if(j==="container"&&$!=="board"&&N){let H=new Map;for(let X of J){let K=T6(X);if(!K)continue;let _=H.get(K);if(!_)_=[],H.set(K,_);_.push(X)}for(let[X,K]of H){if(KJ.has(X))continue;let _=X.getBoundingClientRect().width,B=0;for(let W of K){if(N0(W.textContent??""))continue;let O=W.getBoundingClientRect().width;if(Y>O)B+=Y-O}let U=Math.ceil(_+B+2);KJ.set(X,{display:X.style.display,width:X.style.width}),X.style.display="inline-block",X.style.width=`${U}px`}}if($==="flip"){let H=new Set;for(let X of J){if(X.style.display="inline-block",X.style.backfaceVisibility="hidden",X.style.verticalAlign="top",j==="cells"&&!N0(X.textContent??""))X.style.width=`${G}px`,X.style.textAlign="center";if(X.parentElement&&!H.has(X.parentElement))H.add(X.parentElement),X.parentElement.style.height=`${X.parentElement.offsetHeight}px`}}else if($==="slide")for(let H of J){if(H.style.display="inline-block",H.parentElement)H.parentElement.style.overflow="hidden";if(j==="cells"&&!N0(H.textContent??""))H.style.width=`${G}px`,H.style.textAlign="center"}else if($==="blur"||$==="scale"||$==="fade"||$==="none"){for(let H of J)if(H.style.display="inline-block",j==="cells"&&!N0(H.textContent??""))H.style.width=`${G}px`,H.style.textAlign="center"}else if($==="board"){let H=0;if(Z){for(let X of J)if(!N0(X.textContent??""))H=Math.max(H,X.offsetWidth);H=Math.max(H,8)+4}for(let X of J){let F=function(e){let r=document.createElement("span"),k=r.style;return k.display="block",k.position="absolute",k.left="0",k.width="100%",k.height="200%",k.fontSize=U.fontSize,k.fontFamily=U.fontFamily,k.fontWeight=U.fontWeight,k.color=U.color,k.lineHeight=`${O}px`,k.textAlign="center",k.setProperty("-webkit-text-fill-color",U.color),k.top=e,r},A=function(e){let r=document.createElement("div"),k=r.style;k.position="absolute",k.left="0",k.width="100%",k.height="50%",k.overflow="hidden",k.top=e?"50%":"0",k.zIndex="1";let H0=F(e?"-100%":"0");return r.appendChild(H0),[r,H0]},L=function(e="0"){let r=document.createElement("div"),k=r.style;k.position="absolute",k.left="0",k.top="0",k.width="100%",k.height="100%",k.overflow="hidden",k.backfaceVisibility="hidden";let H0=F(e);return r.appendChild(H0),[r,H0]};if(v0.has(X))continue;let K=X.textContent??"",_=N0(K);if(_&&!q)continue;let B=_?" ":K,U=window.getComputedStyle(X),W=Z?H:X.offsetWidth,O=X.offsetHeight;X.textContent="",X.style.display="inline-block",X.style.position="relative",X.style.width=`${W}px`,X.style.height=`${O}px`,X.style.perspective=`${Q}px`;let[R,O0]=A(!1);O0.textContent=B;let[I0,f0]=A(!0);f0.textContent=B;let F0=document.createElement("div"),p=F0.style;p.position="absolute",p.left="0",p.top="0",p.width="100%",p.height="50%",p.transformOrigin="center bottom",p.transformStyle="preserve-3d",p.zIndex="2";let[k0,L0]=L();L0.textContent=B;let[G0,A0]=L("-100%");G0.style.transform="rotateX(180deg)",A0.textContent=B,F0.appendChild(k0),F0.appendChild(G0);let g=document.createElement("div"),z0=g.style;z0.position="absolute",z0.left="0",z0.width="100%",z0.height="1px",z0.top="calc(50% - 0.5px)",z0.zIndex="3",z0.pointerEvents="none";let u0=document.createElement("div"),a=u0.style;if(a.position="absolute",a.left="0",a.width="100%",a.height="50%",a.top="50%",a.zIndex="2",a.pointerEvents="none",a.opacity="0",a.background="linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 100%)",X.appendChild(R),X.appendChild(I0),X.appendChild(F0),X.appendChild(u0),X.appendChild(g),g.style.background=Z?"rgba(0, 0, 0, 0.6)":"rgba(0, 0, 0, 0.15)",X.style.marginRight=Z?"2px":"1px",Z){R.style.background="linear-gradient(180deg, #2a2a2e 0%, #1e1e22 100%)",R.style.borderRadius="4px 4px 0 0",I0.style.background="linear-gradient(180deg, #1e1e22 0%, #16161a 100%)",I0.style.borderRadius="0 0 4px 4px",k0.style.background="linear-gradient(180deg, #2a2a2e 0%, #1e1e22 100%)",k0.style.borderRadius="4px 4px 0 0",G0.style.background="linear-gradient(180deg, #1e1e22 0%, #16161a 100%)",G0.style.borderRadius="0 0 4px 4px";for(let H0 of[O0,f0,L0,A0])H0.style.color="#e8e8ec",H0.style.setProperty("-webkit-text-fill-color","#e8e8ec")}v0.set(X,{staticTop:R,staticBottom:I0,flapWrap:F0,flapFront:k0,flapBack:G0,splitLine:g,shadow:u0,staticTopText:O0,staticBottomText:f0,flapFrontText:L0,flapBackText:A0})}}}function E9(J,$,Q,Z,j,q,z,G){let Y=[];for(let H=0;H<Q;H++){let X=!z&&H===Q-1?$:l0(Z);Y.push(X)}let N=-1;return(H)=>{let X=Math.min(H,0.9999)*Q,K=Math.floor(X),_=X-K,B=_>=0.5,U=K*2+(B?1:0);if(j!=="board"&&U!==N){if(B)J.textContent=z?l0(Z):Y[K]??$;else J.textContent=K===0?$:z?l0(Z):Y[K-1]??$;N=U}switch(j){case"flip":{let W=_<0.5?-90*(_/0.5):90*(1-(_-0.5)/0.5);E(J,"perspective",q,"px"),E(J,"rotateX",W,"deg"),$0(J);break}case"fade":{let W=_<0.5?1-_/0.5:(_-0.5)/0.5;J.style.opacity=String(W);break}case"slide":{let W=_<0.5?-100*(_/0.5):100*(1-(_-0.5)/0.5),O=_<0.5?1-_/0.5:(_-0.5)/0.5;E(J,"y",W,"%"),$0(J),J.style.opacity=String(O);break}case"blur":{let W=_<0.5?8*(_/0.5):8*(1-(_-0.5)/0.5);J.style.filter=`blur(${W}px)`;break}case"scale":{let W=_<0.5?1-_/0.5:(_-0.5)/0.5;E(J,"scale",W),$0(J);break}case"board":{let W=v0.get(J);if(!W)break;let O=K===0?$:z?l0(Z):Y[K-1]??$,F=z?l0(Z):Y[K]??$;W.staticTopText.textContent=F,W.flapFrontText.textContent=O,W.flapBackText.textContent=F,W.staticBottomText.textContent=O;let A=-180*_;W.flapWrap.style.transform=`rotateX(${A}deg)`;let L=Math.sin(_*Math.PI);W.shadow.style.opacity=String(L);break}default:break}if(G&&G.length>0){let W=!1;for(let O of G){let F=_<0.5?1-_/0.5:(_-0.5)/0.5,A=O.from+(O.to-O.from)*F;if(O.isTransform)E(J,O.prop,A,O.unit||void 0),W=!0;else J.style[O.prop]=O.unit?`${A}${O.unit}`:String(A)}if(W)$0(J)}}}function V9(J,$,Q,Z){return()=>{if(Q==="board"){let j=v0.get(J);if(j)j.staticTopText.textContent=$,j.staticBottomText.textContent=$,j.flapFrontText.textContent=$,j.flapBackText.textContent=$,j.flapWrap.style.transform="",j.shadow.style.opacity="0";if(Z&&Z.length>0){for(let q of Z)if(!q.isTransform)J.style[q.prop]=q.unit?`${q.to}${q.unit}`:String(q.to)}return}if(J.textContent=$,Q==="flip"||Q==="scale")x(J,!0);else if(Q==="slide")x(J,!0),J.style.opacity="";else if(Q==="fade")J.style.opacity="";else if(Q==="blur")J.style.filter="";if(Z&&Z.length>0){for(let j of Z)if(j.isTransform)E(J,j.prop,j.to,j.unit||void 0);else J.style[j.prop]=j.unit?`${j.to}${j.unit}`:String(j.to);if(Z.some((j)=>j.isTransform))$0(J)}}}class s0{static prepare(J,$,Q=!1,Z){let j=$.type??"flip",q=D9($.charset),z=$.perspective??v6,G=$.styledBoard??!0,Y=$.stableWidth??!1,N=Y==="container"?"container":Y==="cells"||Y===!0?"cells":"none",H=$.preserveWhitespaceCells??!1,X=[];for(let _ of J){let B=k9(_),U=_.textContent??"",W=N0(U),O=W&&H&&j==="board";if(W&&!O)continue;let F=O?" ":B;X.push({el:_,target:F,isBlankCell:O})}b9(J,j,z,G,N,H,q);let K=[];for(let{el:_,target:B,isBlankCell:U}of X)if(U)K.push({el:_,render:()=>{},finalize:()=>{}});else{let W=y6($.cycles);K.push({el:_,render:E9(_,B,W,q,j,z,Q,Z),finalize:V9(_,B,j,Z)})}if(K.length===0&&J.length>0){if(J.some((B)=>B.textContent===""))console.warn("[Motion.page SDK] TextFlapper produced zero drivers.","The element likely contains detached char spans from a previous split","(textContent was cleared but spans remain registered).",`Effect type: '${j}'.`,"Fix: call Motion(name).kill() and Motion.reset(element) before re-animating, or mutate innerHTML/textContent on the ORIGINAL container (not the split fragments).",{charElements:J,type:j})}return K}static flap(J,$,Q,Z=!1){let j=s0.prepare(J,$,Z);if(j.length===0)return{kill(){},finished:Promise.resolve(),isComplete:!0};let q=y6($.cycles),z=q*2*sJ+Math.max(0,q-1)*0.5*sJ,G=()=>{},Y=new Promise((W)=>{G=W}),N=!1,H=0,X=0,K=[],_=0;for(let W=0;W<J.length;W++){let O=J[W].textContent??"";if(N0(O))continue;K.push(Q?.[W]??_*sJ*2),_++}let B=performance.now();function U(){if(N)return;let W=performance.now(),O=!0;for(let F=0;F<j.length;F++){let A=j[F],L=W-B-K[F];if(L<0){O=!1;continue}if(Z){let R=L%z/z;A.render(R),O=!1}else{let R=Math.min(L/z,1);if(A.render(R),R>=1)A.finalize();else O=!1}}if(O&&!Z)H=j.length,G();else X=requestAnimationFrame(U)}if(X=requestAnimationFrame(U),Z)G();return{kill(){if(N)return;N=!0,cancelAnimationFrame(X);for(let W of j)W.finalize();G()},get finished(){return Y},get isComplete(){return N||H===j.length}}}static revert(J){for(let $ of J){let Q=v0.get($);if(Q)Q.staticTop.remove(),Q.staticBottom.remove(),Q.flapWrap.remove(),Q.splitLine.remove(),Q.shadow.remove(),v0.delete($),$.style.perspective="",$.style.position="",$.style.width="",$.style.height="",$.style.marginRight="";let Z=_J.get($);if(Z!==void 0)$.textContent=Z,_J.delete($);if($.style.display="",$.style.backfaceVisibility="",$.style.overflow="",$.style.transform="",$.style.transition="",$.style.opacity="",$.style.filter="",$.style.width="",$.style.textAlign="",$.style.verticalAlign="",$.parentElement)$.parentElement.style.overflow="",$.parentElement.style.height="";let j=T6($);if(j){let q=KJ.get(j);if(q)j.style.display=q.display,j.style.width=q.width,KJ.delete(j)}}}}I.textFlapper={prepare:(J,$,Q,Z)=>s0.prepare(J,$,Q,Z),flap:(J,$,Q,Z)=>s0.flap(J,$,Q,Z),revert:(J)=>s0.revert(J)};class h6{static resolve(J,$){if(J.length===0)return[];if(J.length===1)return[0];if(typeof $==="number")return J.map((Q,Z)=>Z*$);return this.resolveComplexStagger(J,$)}static resolveComplexStagger(J,$){let Q=J.length;if(Q===1)return[0];let Z;if($.each!==void 0)Z=$.each;else if($.amount!==void 0)Z=$.amount/(Q-1);else Z=0.1;let j=this.getOrdering(J,$),q=Array(Q);for(let z=0;z<Q;z++)q[j[z].originalIndex]=j[z].order*Z;return q}static getOrdering(J,$){let Q=J.length,Z=$.from??"start";if($.grid)return this.getGridOrdering(J,$);switch(Z){case"start":return J.map((j,q)=>({originalIndex:q,order:q}));case"end":return J.map((j,q)=>({originalIndex:q,order:Q-1-q}));case"center":{let j=Math.floor(Q/2);return J.map((q,z)=>{let G=Math.abs(z-j);return{originalIndex:z,order:G}})}case"edges":return J.map((j,q)=>{let z=Math.min(q,Q-1-q);return{originalIndex:q,order:z}});case"random":{let j=J.map((q,z)=>({originalIndex:z,order:Math.random()}));return j.sort((q,z)=>q.order-z.order),j.forEach((q,z)=>{q.order=z}),j}default:if(typeof Z==="number"){let j=Math.max(0,Math.min(Q-1,Z));return J.map((q,z)=>{let G=Math.abs(z-j);return{originalIndex:z,order:G}})}return J.map((j,q)=>({originalIndex:q,order:q}))}}static getGridOrdering(J,$){let Q,Z;if($.grid==="auto"){let G=this.detectGrid(J);Q=G.cols,Z=G.rows}else[Q,Z]=$.grid;let j=$.from??"start",q=$.axis??"x",z=J.map((G,Y)=>{let N=Y%Q,H=Math.floor(Y/Q);return{originalIndex:Y,col:N,row:H}});if(j==="random"){let G=z.map((Y)=>({originalIndex:Y.originalIndex,order:Math.random()}));return G.sort((Y,N)=>Y.order-N.order),G.forEach((Y,N)=>{Y.order=N}),G}return z.map((G)=>{let Y;if(typeof j==="number"){let N=j%Q,H=Math.floor(j/Q);Y=q==="x"?Math.abs(G.col-N)+Math.abs(G.row-H)*0.5:Math.abs(G.row-H)+Math.abs(G.col-N)*0.5}else if(j==="center"){let N=(Q-1)/2,H=(Z-1)/2;Y=Math.abs(G.col-N)+Math.abs(G.row-H)}else if(j==="edges"){let N=Math.min(G.col,Q-1-G.col),H=Math.min(G.row,Z-1-G.row);Y=Math.min(N,H)}else if(j==="end")Y=q==="x"?(Z-1-G.row)*Q+(Q-1-G.col):(Q-1-G.col)*Z+(Z-1-G.row);else Y=q==="x"?G.row*Q+G.col:G.col*Z+G.row;return{originalIndex:G.originalIndex,order:Y}})}static detectGrid(J){if(J.length===0)return{cols:0,rows:0};let $=J.filter((q)=>q instanceof Element);if($.length===0)return{cols:J.length,rows:1};let Q=new Map;$.forEach((q)=>{let z=q.getBoundingClientRect(),G=Math.round(z.top);Q.set(G,(Q.get(G)||0)+1)});let Z=Q.size;return{cols:Math.ceil(J.length/Z),rows:Z}}}I.stagger={resolve:(J,$)=>h6.resolve(J,$)};function w9(J,$,Q){if(!(J instanceof HTMLElement))return console.warn("[Motion Fit] Fit animations only support HTML elements. SVG elements are not supported."),null;let Z=document.querySelector($);if(!Z)return console.warn(`[Motion Fit] Target element not found: "${$}". Animation skipped.`),null;if(!(Z instanceof HTMLElement))return console.warn("[Motion Fit] Fit animations only support HTML elements. SVG elements are not supported."),null;if(Z===J)return console.warn("[Motion Fit] Target element is the same as source element. Animation skipped."),null;let j=J.getBoundingClientRect(),q=Z.getBoundingClientRect(),z=j.width===0?1:j.width,G=j.height===0?1:j.height,Y=j.left+z/2,N=j.top+G/2,H=q.left+q.width/2,X=q.top+q.height/2,K=H-Y,_=X-N,B=q.width/z,U=q.height/G;if(!Q)return{dx:K,dy:_,sx:B,sy:U,sourceWidth:j.width,sourceHeight:j.height,targetWidth:q.width,targetHeight:q.height};let W=J.offsetParent??document.documentElement,O=W.getBoundingClientRect(),F=W.scrollLeft??0,A=W.scrollTop??0;return{dx:K,dy:_,sx:B,sy:U,sourceWidth:j.width,sourceHeight:j.height,targetWidth:q.width,targetHeight:q.height,sourceLeft:J.offsetLeft,sourceTop:J.offsetTop,targetLeft:q.left-O.left+F,targetTop:q.top-O.top+A}}function f6(J,$,Q,Z){if(!Z||Z==="px")return Q;if(Z==="%"){let j=J,q=$==="x"?j.offsetWidth:j.offsetHeight;return Q/100*q}if(Z==="vw")return Q/100*window.innerWidth;if(Z==="vh")return Q/100*window.innerHeight;if(Z==="vmin")return Q/100*Math.min(window.innerWidth,window.innerHeight);if(Z==="vmax")return Q/100*Math.max(window.innerWidth,window.innerHeight);if(Z==="em"){let j=parseFloat(window.getComputedStyle(J).fontSize);return Q*j}if(Z==="rem"){let j=parseFloat(window.getComputedStyle(document.documentElement).fontSize);return Q*j}return Q}var c=0.01,T0=0.001;function C9(J,$,Q,Z){let{absolute:j=!1,scale:q=!0,resize:z=!1}=Q;if($ instanceof HTMLElement)x($,!1);let G=w9($,Q.target,j);if(!G)return;if(!j)if(z){let Y=G.dx-(G.targetWidth-G.sourceWidth)/2,N=G.dy-(G.targetHeight-G.sourceHeight)/2;if(Math.abs(Y)>c){let H=Z.acquire();H.init($,"x",0,Y,"px"),J.addPropTween(H)}if(Math.abs(N)>c){let H=Z.acquire();H.init($,"y",0,N,"px"),J.addPropTween(H)}if(Math.abs(G.targetWidth-G.sourceWidth)>c){let H=Z.acquire();H.init($,"width",G.sourceWidth,G.targetWidth,"px"),J.addPropTween(H)}if(Math.abs(G.targetHeight-G.sourceHeight)>c){let H=Z.acquire();H.init($,"height",G.sourceHeight,G.targetHeight,"px"),J.addPropTween(H)}}else{let Y=Y0($,"x"),N=Y0($,"y"),H=wJ($,"x"),X=wJ($,"y"),K=f6($,"x",Y,H),_=f6($,"y",N,X),B=K+G.dx,U=_+G.dy;if(Math.abs(B-K)>c||Math.abs(K)>c||Math.abs(B)>c){let W=Z.acquire();W.init($,"x",K,B,"px"),J.addPropTween(W)}if(Math.abs(U-_)>c||Math.abs(_)>c||Math.abs(U)>c){let W=Z.acquire();W.init($,"y",_,U,"px"),J.addPropTween(W)}if(q){let W=Y0($,"scaleX"),O=Y0($,"scaleY"),F=W*G.sx,A=O*G.sy;if(Math.abs(F-W)>T0||Math.abs(W-1)>T0||Math.abs(F-1)>T0){let L=Z.acquire();L.init($,"scaleX",W,F,""),J.addPropTween(L)}if(Math.abs(A-O)>T0||Math.abs(O-1)>T0||Math.abs(A-1)>T0){let L=Z.acquire();L.init($,"scaleY",O,A,""),J.addPropTween(L)}}}else{let Y=$;if(window.getComputedStyle(Y).position==="static")Y.style.position="absolute";let{sourceLeft:H,sourceTop:X,targetLeft:K,targetTop:_}=G;if(Math.abs(K-H)>c){let B=Z.acquire();B.init($,"left",H,K,"px"),J.addPropTween(B)}if(Math.abs(_-X)>c){let B=Z.acquire();B.init($,"top",X,_,"px"),J.addPropTween(B)}if(q){if(Math.abs(G.targetWidth-G.sourceWidth)>c){let B=Z.acquire();B.init($,"width",G.sourceWidth,G.targetWidth,"px"),J.addPropTween(B)}if(Math.abs(G.targetHeight-G.sourceHeight)>c){let B=Z.acquire();B.init($,"height",G.sourceHeight,G.targetHeight,"px"),J.addPropTween(B)}}}}function x9(J,$,Q,Z){J.setPendingFitSetup((z)=>C9(J,$,Q,z)),J.setLazyStartCapture(!0);let{absolute:j=!1,resize:q=!1}=Q;J.setFitCleanup(()=>{if($ instanceof HTMLElement){if(x($,!0),q)$.style.width="",$.style.height="";if(j)$.style.width="",$.style.height="",$.style.left="",$.style.top=""}})}I.fit={registerPendingSetup:x9};var m6=(J)=>J,S9=m6,y={in:(J)=>J*J,out:(J)=>J*(2-J),inOut:(J)=>J<0.5?2*J*J:-1+(4-2*J)*J},W0={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},U0={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},i={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 BJ={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},WJ={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}},UJ={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 p6=(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}}},OJ=p6();var g6=(J=1,$=0.3)=>{let Q=Math.max(1,J),Z=$/(2*Math.PI)*Math.asin(1/Q),j=$*1.5,q=j/(2*Math.PI)*Math.asin(1/Q);return{in:(z)=>{if(z===0)return 0;if(z===1)return 1;return-(Q*Math.pow(2,10*(z-=1))*Math.sin((z-Z)*(2*Math.PI)/$))},out:(z)=>{if(z===0)return 0;if(z===1)return 1;return Q*Math.pow(2,-10*z)*Math.sin((z-Z)*(2*Math.PI)/$)+1},inOut:(z)=>{if(z===0)return 0;if(z===1)return 1;if((z*=2)<1)return-0.5*(Q*Math.pow(2,10*(z-=1))*Math.sin((z-q)*(2*Math.PI)/j));return Q*Math.pow(2,-10*(z-=1))*Math.sin((z-q)*(2*Math.PI)/j)*0.5+1}}},IJ=g6(),u6=(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},h0={in:(J)=>1-u6(1-J),out:u6,inOut:(J)=>{if(J<0.5)return h0.in(J*2)*0.5;return h0.out(J*2-1)*0.5+0.5}},i0=(J=0.7,$=0.7,Q=!1)=>{let Z=J!==1?$:0,j=(1-J)/2,q=j+J,z=Q;return(G)=>{let Y=G+(0.5-G)*Z;if(G<j){let N=1-G/j;if(z)return 1-N*N;return Y-N*N*N*N*Y}else if(G>q){let N=(G-q)/j;if(z)return G===1?0:1-N*N;return Y+(G-Y)*N*N*N*N}return z?1:Y}},d6={in:i0(0.7,0.7,!1),out:i0(0.7,0.7,!1),inOut:i0(0.7,0.7,!1)},LJ=(J=1,$=20,Q=!1)=>{let Z=[],j=1/$;for(let q=0;q<$;q++){let z=q*j,Y=((q*1327+531)%1000/1000-0.5)*J*0.4,N=z+Y;Z.push({x:z,y:Q?Math.max(0,Math.min(1,N)):N})}return Z[0]={x:0,y:0},Z.push({x:1,y:1}),(q)=>{if(q<=0)return 0;if(q>=1)return 1;let z=0,G=Z.length-1;while(z<G-1){let X=z+G>>1;if(Z[X].x<=q)z=X;else G=X}let Y=Z[z],N=Z[G],H=(q-Y.x)/(N.x-Y.x);return Y.y+(N.y-Y.y)*H}},P9={in:LJ(1,20,!0),out:LJ(1,20,!0),inOut:LJ(1,20,!0)},AJ=(J)=>{return($)=>{if($>=1)return 1;return Math.floor($*J)/J}},FJ={in:AJ(12),out:AJ(12),inOut:AJ(12)},c6={linear:m6,none:S9,power1:y.out,"power1.in":y.in,"power1.out":y.out,"power1.inout":y.inOut,power2:W0.out,"power2.in":W0.in,"power2.out":W0.out,"power2.inout":W0.inOut,power3:U0.out,"power3.in":U0.in,"power3.out":U0.out,"power3.inout":U0.inOut,power4:i.out,"power4.in":i.in,"power4.out":i.out,"power4.inout":i.inOut,quad:y.out,"quad.in":y.in,"quad.out":y.out,"quad.inout":y.inOut,cubic:W0.out,"cubic.in":W0.in,"cubic.out":W0.out,"cubic.inout":W0.inOut,quart:U0.out,"quart.in":U0.in,"quart.out":U0.out,"quart.inout":U0.inOut,quint:i.out,"quint.in":i.in,"quint.out":i.out,"quint.inout":i.inOut,strong:i.out,"strong.in":i.in,"strong.out":i.out,"strong.inout":i.inOut,sine:BJ.out,"sine.in":BJ.in,"sine.out":BJ.out,"sine.inout":BJ.inOut,expo:WJ.out,"expo.in":WJ.in,"expo.out":WJ.out,"expo.inout":WJ.inOut,circ:UJ.out,"circ.in":UJ.in,"circ.out":UJ.out,"circ.inout":UJ.inOut,back:OJ.out,"back.in":OJ.in,"back.out":OJ.out,"back.inout":OJ.inOut,elastic:IJ.out,"elastic.in":IJ.in,"elastic.out":IJ.out,"elastic.inout":IJ.inOut,bounce:h0.out,"bounce.in":h0.in,"bounce.out":h0.out,"bounce.inout":h0.inOut,slow:d6.inOut,"slow.in":y.out,"slow.out":y.out,"slow.inout":y.out,slowmo:d6.inOut,"slowmo.in":y.out,"slowmo.out":y.out,"slowmo.inout":y.out,rough:P9.inOut,"rough.in":y.out,"rough.out":y.out,"rough.inout":y.out,steps:FJ.inOut,"steps.in":FJ.in,"steps.out":FJ.out,"steps.inout":FJ.inOut},y9={back:(J)=>p6(J),elastic:(J,$)=>g6(J,$),slow:(J,$,Q)=>{let Z=i0(J,$,Q===1);return{in:Z,out:Z,inOut:Z}},slowmo:(J,$,Q)=>{let Z=i0(J,$,Q===1);return{in:Z,out:Z,inOut:Z}},rough:(J,$,Q)=>{let Z=LJ(J,$,Q===1);return{in:Z,out:Z,inOut:Z}},steps:(J)=>{let $=AJ(J??12);return{in:$,out:$,inOut:$}}},v9=/^(\w+)(?:\.(\w+))?\(([^)]*)\)$/;function o6(J){let $=J.toLowerCase();if(c6[$])return c6[$];let Q=v9.exec($);if(Q){let[,Z,j,q]=Q,z=y9[Z];if(z){let G=q.split(",").map((Y)=>Y.trim()).filter((Y)=>Y.length>0).map(Number);if(G.every((Y)=>!isNaN(Y))){let Y=z(...G),N=j||"out",X=Y[N==="inout"?"inOut":N];if(X)return X}}}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)`),y.out}class iJ{_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,Z,j,q){return this._id=J,this._targets=$,this._duration=Q,this._delay=Z,this._easingFn=o6(j),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=q?.repeat??0,this._repeatDelay=q?.repeatDelay??0,this._yoyo=q?.yoyo??!1,this._onStart=q?.onStart,this._onUpdate=q?.onUpdate,this._onComplete=q?.onComplete,this._onRepeat=q?.onRepeat,this._onReverseComplete=q?.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,Z=this._delay,j=this._currentRepeat;if(Q===0){let q=$>=Z?1:0;this._time=$,this._progress=q,this.render(q)}else{let q=Math.max(0,$-Z);if(this._repeat===0){let z=Math.min(1,q/Q);this._time=Math.min(Q,q),this._progress=z,this.render(z)}else{let z=this._repeatDelay,G=Q+z,Y=this._repeat===-1?1/0:Q*(this._repeat+1)+z*this._repeat,N=this._repeat===-1?q:Math.min(q,Y),H=G>0?Math.floor(N/G):0,X=N-H*G,K=X>Q,_=Q>0?Math.min(1,X/Q):1,B=this._yoyo&&H%2===1;if(K)_=B?0:1;else if(B)_=1-_;this._currentRepeat=this._repeat===-1?H:Math.min(H,this._repeat),this._isReversed=B,this._progress=_,this._time=Q*_,this.render(_)}}if(this._isActive){if(!this._startFired){this._startFired=!0;try{this._onStart?.()}catch(q){console.error("[Motion] onStart callback error:",q)}}try{this._onUpdate?.(this._progress)}catch(q){console.error("[Motion] onUpdate callback error:",q)}if(this._currentRepeat>j)try{this._onRepeat?.(this._currentRepeat)}catch(q){console.error("[Motion] onRepeat callback error:",q)}if(!this._completeFired&&this._repeat!==-1){if($>=this.totalDuration()){this._completeFired=!0;try{this._onComplete?.()}catch(q){console.error("[Motion] onComplete callback error:",q)}}}}}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;K0.release($),$=Q}this._propTweens=null,this._lastPropTween=null,this._pendingFitSetup(K0),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"&&_0(Q)){let Z=I.color?.getCurrentColor($,Q);if(Z&&J.endColor)J.startColor=Z,J.changeColor=new Float32Array([J.endColor[0]-Z[0],J.endColor[1]-Z[1],J.endColor[2]-Z[2],J.endColor[3]-Z[3]])}else if(J.valueType==="filter"&&t(Q)){let Z=I.filter?.getCurrentFilter($);if(Z&&J.endFilters){let j=I.filter.mergeFilterArrays(Z,J.endFilters);J.startFilters=j.start,J.endFilters=j.end}}else if(J.valueType==="clipPath"&&vJ(Q)){let Z=I.clipPath;if(Z&&J.endClipPath){let j=Z.getCurrentClipPath($);if(j&&Z.canInterpolate(j,J.endClipPath))J.startClipPath=j}}else{let Z=Y0($,Q);J.startValue=Z,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=K0,$=this._propTweens;while($){let Q=$.next;J.release($),$=Q}this._propTweens=null,this._lastPropTween=null}}var n0=new g0(()=>new iJ,100),l6={acquire:()=>n0.acquire(),release:(J)=>n0.release(J),getPoolSize:()=>n0.getPoolSize(),getTotalCreated:()=>n0.getTotalCreated(),clear:()=>n0.clear()};class C{static instance;animations=[];animationIdToIndex=new Map;nextAnimationId=1;totalCreated=0;_animationSnapshot=[];timelines=new Map;_captureTarget=null;ticker;animationPool;propTweenPool;constructor(){this.ticker=T.getInstance(),this.animationPool=l6,this.propTweenPool=K0,this.ticker.add(this.update,0)}static getInstance(){if(!C.instance)C.instance=new C,P.setEngineRegisterCallback((J,$)=>{let Q=C.instance;if(!Q.hasTimeline(J))Q.registerTimeline(J,$)}),f.setCreateAnimationCallback((J,$,Q,Z,j,q,z,G)=>{return C.instance.createAnimation(J,$,Q,Z,j,q,z,G)});return C.instance}update=(J)=>{let $=this._animationSnapshot,Q=this.animations.length;$.length=Q;for(let j=0;j<Q;j++)$[j]=this.animations[j];let Z=[];for(let j=0,q=$.length;j<q;j++){let z=$[j];if(z.isTimelineChild())continue;if(z.isActive()){if(z.update(J),!z.isActive()&&!z.isTimelineChild())Z.push(z.getId())}}for(let j of Z)this.unregisterAnimation(j);for(let j of this.timelines.values())if(j.isActive())j.update(J)};createAnimation(J,$,Q,Z,j,q,z,G){let Y=G?.stagger;if(Y&&J.length>1)return this.createStaggeredAnimations(J,$,Q,Z,j,q,z,Y,G);let N=this.animationPool.acquire(),H=this.registerAnimation(N);if(N.init(H,J,Q,Z,j,G),this.setupPropertyTweens(N,J,$,q,z),Q===0)N.render(1);else if(q&&!G?._skipInitialRender)N.render(0);return N}createStaggeredAnimations(J,$,Q,Z,j,q,z,G,Y){if(!I.stagger){let X=this.animationPool.acquire(),K=this.registerAnimation(X);if(X.init(K,J,Q,Z,j,Y),this.setupPropertyTweens(X,J,$,q,z),Q===0)X.render(1);else if(q&&!Y?._skipInitialRender)X.render(0);return[X]}let N=I.stagger.resolve(J,G),H=[];for(let X=0;X<J.length;X++){let K=J[X],_=N[X],B=this.animationPool.acquire(),U=this.registerAnimation(B);if(B.init(U,[K],Q,Z+_,j,Y),this.setupPropertyTweens(B,[K],$,q,z),Q===0)B.render(1);else if(q&&!Y?._skipInitialRender)B.render(0);H.push(B)}return H}setupPropertyTweens(J,$,Q,Z,j){let q=i6(s6(Q)),z=j?i6(s6(j)):void 0,G=Object.keys(q),Y=z?Object.keys(z):[],N=[...new Set([...G,...Y])],H="perspective"in q,X=z&&"perspective"in z,K=H&&X;for(let _ of $){if(!K&&(H||X)&&_ instanceof Element){let B=H?q.perspective:z.perspective,U=typeof B==="number"?B:parseFloat(String(B))||0;if(U>0)E(_,"perspective",U,"px"),_.style.transform=w(_)}for(let B of N){if(B==="perspective"&&!K)continue;let U=q[B],W=TJ(_,B,U,z?z[B]:void 0),O=this.propTweenPool.acquire(),F=Z&&!j;switch(W.type){case"color":{let A=F?W.endColor:W.startColor,L=F?W.startColor:W.endColor;O.initColor(_,B,A,L);break}case"filter":{let A=F?W.endFilters:W.startFilters,L=F?W.startFilters:W.endFilters;O.initFilter(_,B,A,L);break}case"clipPath":{let A=F?W.endClipPath:W.startClipPath,L=F?W.startClipPath:W.endClipPath;O.initClipPath(_,B,A,L);break}case"scalar":{let A=F?W.endValue:W.startValue,L=F?W.startValue:W.endValue;O.init(_,B,A,L,W.unit);break}case"drawSVG":{let A=F?W.endDraw:W.startDraw,L=F?W.startDraw:W.endDraw;O.initDrawSVG(_,B,A,L,W.length);break}case"path":{let A=F?W.endProgress:W.startProgress,L=F?W.startProgress:W.endProgress;O.initPath(_,B,W.pathData,W.pathLength,A,L,W.rotate,W.alignOffset,W.pathOffset);break}}J.addPropTween(O)}}}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[$],Z=this.animations.length-1;if($!==Z){let j=this.animations[Z];this.animations[$]=j,this.animationIdToIndex.set(j.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 Z=0,j=this.animations.length;Z<j;Z++){let q=this.animations[Z],z=q.getTargets();for(let G of z)if(G instanceof Element&&$.has(G)){Q.push(q);break}}for(let Z of Q)Z.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){if(this._captureTarget)this._captureTarget.add(J);let $=this.timelines.get(J);if(!$){if($=new P(J),!this.timelines.has(J))this.timelines.set(J,$),$.setUnregisterCallback(()=>this.removeTimeline(J))}return $}startCapture(J){this._captureTarget=J}stopCapture(){this._captureTarget=null}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(),q6()}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 s6(J){if(!("transform"in J))return J;let $=J.transform;if(typeof $!=="string")return J;let Q=/([a-zA-Z0-9]+)\(([^)]+)\)/g,Z,j={},q=!1;while((Z=Q.exec($))!==null){let G=Z[1],N=Z[2].match(/[-+]?\d*\.?\d+(?:e[-+]?\d+)?[a-z%]*/gi)||[];switch(G){case"perspective":{if(!("perspective"in J))j.perspective=N[0]||"0px",q=!0;break}case"translate":{if(N[0]&&!("x"in J))j.x=N[0],q=!0;if(N[1]&&!("y"in J))j.y=N[1],q=!0;break}case"translate3d":{if(N[0]&&!("x"in J))j.x=N[0],q=!0;if(N[1]&&!("y"in J))j.y=N[1],q=!0;if(N[2]&&!("z"in J))j.z=N[2],q=!0;break}case"translateX":{if(N[0]&&!("x"in J))j.x=N[0],q=!0;break}case"translateY":{if(N[0]&&!("y"in J))j.y=N[0],q=!0;break}case"translateZ":{if(N[0]&&!("z"in J))j.z=N[0],q=!0;break}case"rotate":{if(N[0]&&!("rotate"in J))j.rotate=N[0],q=!0;break}case"rotateX":{if(N[0]&&!("rotateX"in J))j.rotateX=N[0],q=!0;break}case"rotateY":{if(N[0]&&!("rotateY"in J))j.rotateY=N[0],q=!0;break}case"rotateZ":{if(N[0]&&!("rotateZ"in J))j.rotateZ=N[0],q=!0;break}case"scale":{if(N[0]&&!("scale"in J))j.scale=parseFloat(N[0]),q=!0;break}case"scaleX":{if(N[0]&&!("scaleX"in J))j.scaleX=parseFloat(N[0]),q=!0;break}case"scaleY":{if(N[0]&&!("scaleY"in J))j.scaleY=parseFloat(N[0]),q=!0;break}case"scaleZ":{if(N[0]&&!("scaleZ"in J))j.scaleZ=parseFloat(N[0]),q=!0;break}case"skew":{if(N[0]&&!("skewX"in J))j.skewX=N[0],q=!0;if(N[1]&&!("skewY"in J))j.skewY=N[1],q=!0;break}case"skewX":{if(N[0]&&!("skewX"in J))j.skewX=N[0],q=!0;break}case"skewY":{if(N[0]&&!("skewY"in J))j.skewY=N[0],q=!0;break}default:break}}if(!q)return J;let z={...j};for(let[G,Y]of Object.entries(J)){if(G==="transform")continue;z[G]=Y}return z}function i6(J){let $=!1;for(let Z of Object.keys(J))if(Z.includes("-")&&!Z.startsWith("--")){$=!0;break}if(!$)return J;let Q={};for(let[Z,j]of Object.entries(J))if(Z.includes("-")&&!Z.startsWith("--")){let q=Z.replace(/-([a-z])/g,(z,G)=>G.toUpperCase());Q[q]=j}else Q[Z]=j;return Q}class a0{_fn;_timelineNames=new Set;_reverted=!1;constructor(J){this._fn=J,this._execute()}revert(){if(this._reverted)return;let J=C.getInstance();for(let $ of this._timelineNames)if(J.hasTimeline($))J.getTimeline($).kill();if(typeof document<"u")document.querySelectorAll("[data-scrolltrigger-spacer]").forEach(($)=>$.remove()),document.querySelectorAll("[data-scrolltrigger-markers]").forEach(($)=>$.remove());this._timelineNames.clear(),this._reverted=!0}refresh(){this.revert(),this._reverted=!1,this._execute()}add(J){this._reverted=!1,this._execute(J)}getTimelineNames(){return Array.from(this._timelineNames)}_execute(J){let $=C.getInstance();$.startCapture(this._timelineNames);try{(J||this._fn)()}finally{$.stopCapture()}}}function T9(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 h9(J,$,Q){if(Q===void 0)return(Z)=>Math.min($,Math.max(J,Z));return Math.min($,Math.max(J,Q))}function f9(J,$,Q){let Z=J+Math.random()*($-J);if(Q&&Q>0)return Math.round(Z/Q)*Q;return Z}function u9(J,$){let Q=(Z)=>{if(typeof J==="number"){if(J<=0)return Z;return Math.round(Z/J)*J}let j=J,q=j[0],z=Math.abs(Z-q);for(let G=1;G<j.length;G++){let Y=Math.abs(Z-j[G]);if(Y<z)z=Y,q=j[G]}return q};if($===void 0)return Q;return Q($)}function d9(J,$,Q){return J+($-J)*Q}function c9(J,$,Q,Z,j){let q=(z)=>{let G=(z-J)/($-J);return Q+G*(Z-Q)};if(j===void 0)return q;return q(j)}function m9(J,$,Q){let Z=(j)=>(j-J)/($-J);if(Q===void 0)return Z;return Z(Q)}function p9(J,$,Q){let Z=$-J,j=(q)=>{return((q-J)%Z+Z)%Z+J};if(Q===void 0)return j;return j(Q)}var MJ={toArray:T9,clamp:h9,random:f9,snap:u9,interpolate:d9,mapRange:c9,normalize:m9,wrap:p9};function n(J,$,Q){let j=C.getInstance().getTimeline(J);if($!==void 0&&j.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 q of $)j._addEntry(q.target,q,q.position);else if($!==void 0&&Q!==void 0)j._addEntry($,Q);return j}n.reset=function(J){C.getInstance();let $=r0(J),Q=[];for(let Z of $)if(Z instanceof Element)Q.push(Z);if(Q.length>0)C.getInstance().killAnimationsForTargets(Q);for(let Z of $){if(!(Z instanceof Element))continue;if(I.textSplitter?.isSplit?.(Z))I.textSplitter?.revert?.(Z);x(Z),I.styleReset?.clearAnimationStylesAndUnregister?.(Z),I.styleReset?.clearPinStylesAndUnregister?.(Z)}};n.set=function(J,$){C.getInstance();let Q=new P;Q._addEntry(J,{to:$,duration:0}),Q.kill(!1)};n.get=function(J){let $=C.getInstance();return $.hasTimeline(J)?$.getTimeline(J):void 0};n.has=function(J){return C.getInstance().hasTimeline(J)};n.getNames=function(){return C.getInstance().getTimelineNames()};n.kill=function(J){let $=C.getInstance();if($.hasTimeline(J))$.getTimeline(J).kill()};n.killAll=function(){C.getInstance().killEverything()};n.refreshScrollTriggers=function(){I.triggerManager?.getInstance?.()?.refreshScrollTriggers()};n.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())};n.context=function(J){return new a0(J)};n.utils=MJ;var n6=n;var a6={};
34
34
 
35
35
  //# debugId=59B90128F4684E8164756E2164756E21
36
- //# sourceMappingURL=index.js.map
package/dist/index.js CHANGED
@@ -33,4 +33,3 @@ function u(J,$){switch(J){case"play":case"resume":$.play();break;case"pause":$.p
33
33
  `||J==="\t"}function _9(J){let $=J.textContent??"";if(!XJ.has(J))XJ.set(J,$);return $===" "?" ":$}function K9(J,$){if(!$||$.length===0)return{width:0,char:""};let Q=J.parentElement;if(!Q)return{width:0,char:""};let Z=document.createElement("span"),j=Z.style;j.position="absolute",j.left="-99999px",j.top="0",j.visibility="hidden",j.whiteSpace="pre",j.display="inline-block",j.pointerEvents="none";let q=[],z=new Set;for(let N of $){if(z.has(N))continue;z.add(N);let H=document.createElement("span");H.style.display="inline-block",H.textContent=N,Z.appendChild(H),q.push({el:H,c:N})}Q.appendChild(Z);let G=0,Y="";try{for(let{el:N,c:H}of q){let X=N.getBoundingClientRect().width;if(X>G)G=X,Y=H}}finally{Q.removeChild(Z)}return{width:G,char:Y}}function B9(J,$,Q=P6,Z=!0,j="none",q=!1,z=""){let G=0,Y=0,N="";if(j!=="none"&&$!=="board"){let H=null;for(let X of J)if(!N0(X.textContent??""))G=Math.max(G,X.offsetWidth),H??=X;if(H&&z){let X=K9(H,z);if(Y=X.width,N=X.char,Y>G)G=Y}G=Math.max(G,8)+4}if(j==="container"&&$!=="board"&&N){let H=new Map;for(let X of J){let K=y6(X);if(!K)continue;let _=H.get(K);if(!_)_=[],H.set(K,_);_.push(X)}for(let[X,K]of H){if(_J.has(X))continue;let _=X.getBoundingClientRect().width,B=0;for(let W of K){if(N0(W.textContent??""))continue;let O=W.getBoundingClientRect().width;if(Y>O)B+=Y-O}let U=Math.ceil(_+B+2);_J.set(X,{display:X.style.display,width:X.style.width}),X.style.display="inline-block",X.style.width=`${U}px`}}if($==="flip"){let H=new Set;for(let X of J){if(X.style.display="inline-block",X.style.backfaceVisibility="hidden",X.style.verticalAlign="top",j==="cells"&&!N0(X.textContent??""))X.style.width=`${G}px`,X.style.textAlign="center";if(X.parentElement&&!H.has(X.parentElement))H.add(X.parentElement),X.parentElement.style.height=`${X.parentElement.offsetHeight}px`}}else if($==="slide")for(let H of J){if(H.style.display="inline-block",H.parentElement)H.parentElement.style.overflow="hidden";if(j==="cells"&&!N0(H.textContent??""))H.style.width=`${G}px`,H.style.textAlign="center"}else if($==="blur"||$==="scale"||$==="fade"||$==="none"){for(let H of J)if(H.style.display="inline-block",j==="cells"&&!N0(H.textContent??""))H.style.width=`${G}px`,H.style.textAlign="center"}else if($==="board"){let H=0;if(Z){for(let X of J)if(!N0(X.textContent??""))H=Math.max(H,X.offsetWidth);H=Math.max(H,8)+4}for(let X of J){let F=function(e){let r=document.createElement("span"),k=r.style;return k.display="block",k.position="absolute",k.left="0",k.width="100%",k.height="200%",k.fontSize=U.fontSize,k.fontFamily=U.fontFamily,k.fontWeight=U.fontWeight,k.color=U.color,k.lineHeight=`${O}px`,k.textAlign="center",k.setProperty("-webkit-text-fill-color",U.color),k.top=e,r},A=function(e){let r=document.createElement("div"),k=r.style;k.position="absolute",k.left="0",k.width="100%",k.height="50%",k.overflow="hidden",k.top=e?"50%":"0",k.zIndex="1";let H0=F(e?"-100%":"0");return r.appendChild(H0),[r,H0]},L=function(e="0"){let r=document.createElement("div"),k=r.style;k.position="absolute",k.left="0",k.top="0",k.width="100%",k.height="100%",k.overflow="hidden",k.backfaceVisibility="hidden";let H0=F(e);return r.appendChild(H0),[r,H0]};if(v0.has(X))continue;let K=X.textContent??"",_=N0(K);if(_&&!q)continue;let B=_?" ":K,U=window.getComputedStyle(X),W=Z?H:X.offsetWidth,O=X.offsetHeight;X.textContent="",X.style.display="inline-block",X.style.position="relative",X.style.width=`${W}px`,X.style.height=`${O}px`,X.style.perspective=`${Q}px`;let[R,O0]=A(!1);O0.textContent=B;let[I0,f0]=A(!0);f0.textContent=B;let F0=document.createElement("div"),p=F0.style;p.position="absolute",p.left="0",p.top="0",p.width="100%",p.height="50%",p.transformOrigin="center bottom",p.transformStyle="preserve-3d",p.zIndex="2";let[k0,L0]=L();L0.textContent=B;let[G0,A0]=L("-100%");G0.style.transform="rotateX(180deg)",A0.textContent=B,F0.appendChild(k0),F0.appendChild(G0);let g=document.createElement("div"),z0=g.style;z0.position="absolute",z0.left="0",z0.width="100%",z0.height="1px",z0.top="calc(50% - 0.5px)",z0.zIndex="3",z0.pointerEvents="none";let u0=document.createElement("div"),a=u0.style;if(a.position="absolute",a.left="0",a.width="100%",a.height="50%",a.top="50%",a.zIndex="2",a.pointerEvents="none",a.opacity="0",a.background="linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 100%)",X.appendChild(R),X.appendChild(I0),X.appendChild(F0),X.appendChild(u0),X.appendChild(g),g.style.background=Z?"rgba(0, 0, 0, 0.6)":"rgba(0, 0, 0, 0.15)",X.style.marginRight=Z?"2px":"1px",Z){R.style.background="linear-gradient(180deg, #2a2a2e 0%, #1e1e22 100%)",R.style.borderRadius="4px 4px 0 0",I0.style.background="linear-gradient(180deg, #1e1e22 0%, #16161a 100%)",I0.style.borderRadius="0 0 4px 4px",k0.style.background="linear-gradient(180deg, #2a2a2e 0%, #1e1e22 100%)",k0.style.borderRadius="4px 4px 0 0",G0.style.background="linear-gradient(180deg, #1e1e22 0%, #16161a 100%)",G0.style.borderRadius="0 0 4px 4px";for(let H0 of[O0,f0,L0,A0])H0.style.color="#e8e8ec",H0.style.setProperty("-webkit-text-fill-color","#e8e8ec")}v0.set(X,{staticTop:R,staticBottom:I0,flapWrap:F0,flapFront:k0,flapBack:G0,splitLine:g,shadow:u0,staticTopText:O0,staticBottomText:f0,flapFrontText:L0,flapBackText:A0})}}}function W9(J,$,Q,Z,j,q,z,G){let Y=[];for(let H=0;H<Q;H++){let X=!z&&H===Q-1?$:l0(Z);Y.push(X)}let N=-1;return(H)=>{let X=Math.min(H,0.9999)*Q,K=Math.floor(X),_=X-K,B=_>=0.5,U=K*2+(B?1:0);if(j!=="board"&&U!==N){if(B)J.textContent=z?l0(Z):Y[K]??$;else J.textContent=K===0?$:z?l0(Z):Y[K-1]??$;N=U}switch(j){case"flip":{let W=_<0.5?-90*(_/0.5):90*(1-(_-0.5)/0.5);E(J,"perspective",q,"px"),E(J,"rotateX",W,"deg"),$0(J);break}case"fade":{let W=_<0.5?1-_/0.5:(_-0.5)/0.5;J.style.opacity=String(W);break}case"slide":{let W=_<0.5?-100*(_/0.5):100*(1-(_-0.5)/0.5),O=_<0.5?1-_/0.5:(_-0.5)/0.5;E(J,"y",W,"%"),$0(J),J.style.opacity=String(O);break}case"blur":{let W=_<0.5?8*(_/0.5):8*(1-(_-0.5)/0.5);J.style.filter=`blur(${W}px)`;break}case"scale":{let W=_<0.5?1-_/0.5:(_-0.5)/0.5;E(J,"scale",W),$0(J);break}case"board":{let W=v0.get(J);if(!W)break;let O=K===0?$:z?l0(Z):Y[K-1]??$,F=z?l0(Z):Y[K]??$;W.staticTopText.textContent=F,W.flapFrontText.textContent=O,W.flapBackText.textContent=F,W.staticBottomText.textContent=O;let A=-180*_;W.flapWrap.style.transform=`rotateX(${A}deg)`;let L=Math.sin(_*Math.PI);W.shadow.style.opacity=String(L);break}default:break}if(G&&G.length>0){let W=!1;for(let O of G){let F=_<0.5?1-_/0.5:(_-0.5)/0.5,A=O.from+(O.to-O.from)*F;if(O.isTransform)E(J,O.prop,A,O.unit||void 0),W=!0;else J.style[O.prop]=O.unit?`${A}${O.unit}`:String(A)}if(W)$0(J)}}}function U9(J,$,Q,Z){return()=>{if(Q==="board"){let j=v0.get(J);if(j)j.staticTopText.textContent=$,j.staticBottomText.textContent=$,j.flapFrontText.textContent=$,j.flapBackText.textContent=$,j.flapWrap.style.transform="",j.shadow.style.opacity="0";if(Z&&Z.length>0){for(let q of Z)if(!q.isTransform)J.style[q.prop]=q.unit?`${q.to}${q.unit}`:String(q.to)}return}if(J.textContent=$,Q==="flip"||Q==="scale")x(J,!0);else if(Q==="slide")x(J,!0),J.style.opacity="";else if(Q==="fade")J.style.opacity="";else if(Q==="blur")J.style.filter="";if(Z&&Z.length>0){for(let j of Z)if(j.isTransform)E(J,j.prop,j.to,j.unit||void 0);else J.style[j.prop]=j.unit?`${j.to}${j.unit}`:String(j.to);if(Z.some((j)=>j.isTransform))$0(J)}}}class s0{static prepare(J,$,Q=!1,Z){let j=$.type??"flip",q=X9($.charset),z=$.perspective??P6,G=$.styledBoard??!0,Y=$.stableWidth??!1,N=Y==="container"?"container":Y==="cells"||Y===!0?"cells":"none",H=$.preserveWhitespaceCells??!1,X=[];for(let _ of J){let B=_9(_),U=_.textContent??"",W=N0(U),O=W&&H&&j==="board";if(W&&!O)continue;let F=O?" ":B;X.push({el:_,target:F,isBlankCell:O})}B9(J,j,z,G,N,H,q);let K=[];for(let{el:_,target:B,isBlankCell:U}of X)if(U)K.push({el:_,render:()=>{},finalize:()=>{}});else{let W=S6($.cycles);K.push({el:_,render:W9(_,B,W,q,j,z,Q,Z),finalize:U9(_,B,j,Z)})}if(K.length===0&&J.length>0){if(J.some((B)=>B.textContent===""))console.warn("[Motion.page SDK] TextFlapper produced zero drivers.","The element likely contains detached char spans from a previous split","(textContent was cleared but spans remain registered).",`Effect type: '${j}'.`,"Fix: call Motion(name).kill() and Motion.reset(element) before re-animating, or mutate innerHTML/textContent on the ORIGINAL container (not the split fragments).",{charElements:J,type:j})}return K}static flap(J,$,Q,Z=!1){let j=s0.prepare(J,$,Z);if(j.length===0)return{kill(){},finished:Promise.resolve(),isComplete:!0};let q=S6($.cycles),z=q*2*oJ+Math.max(0,q-1)*0.5*oJ,G=()=>{},Y=new Promise((W)=>{G=W}),N=!1,H=0,X=0,K=[],_=0;for(let W=0;W<J.length;W++){let O=J[W].textContent??"";if(N0(O))continue;K.push(Q?.[W]??_*oJ*2),_++}let B=performance.now();function U(){if(N)return;let W=performance.now(),O=!0;for(let F=0;F<j.length;F++){let A=j[F],L=W-B-K[F];if(L<0){O=!1;continue}if(Z){let R=L%z/z;A.render(R),O=!1}else{let R=Math.min(L/z,1);if(A.render(R),R>=1)A.finalize();else O=!1}}if(O&&!Z)H=j.length,G();else X=requestAnimationFrame(U)}if(X=requestAnimationFrame(U),Z)G();return{kill(){if(N)return;N=!0,cancelAnimationFrame(X);for(let W of j)W.finalize();G()},get finished(){return Y},get isComplete(){return N||H===j.length}}}static revert(J){for(let $ of J){let Q=v0.get($);if(Q)Q.staticTop.remove(),Q.staticBottom.remove(),Q.flapWrap.remove(),Q.splitLine.remove(),Q.shadow.remove(),v0.delete($),$.style.perspective="",$.style.position="",$.style.width="",$.style.height="",$.style.marginRight="";let Z=XJ.get($);if(Z!==void 0)$.textContent=Z,XJ.delete($);if($.style.display="",$.style.backfaceVisibility="",$.style.overflow="",$.style.transform="",$.style.transition="",$.style.opacity="",$.style.filter="",$.style.width="",$.style.textAlign="",$.style.verticalAlign="",$.parentElement)$.parentElement.style.overflow="",$.parentElement.style.height="";let j=y6($);if(j){let q=_J.get(j);if(q)j.style.display=q.display,j.style.width=q.width,_J.delete(j)}}}}I.textFlapper={prepare:(J,$,Q,Z)=>s0.prepare(J,$,Q,Z),flap:(J,$,Q,Z)=>s0.flap(J,$,Q,Z),revert:(J)=>s0.revert(J)};class v6{static resolve(J,$){if(J.length===0)return[];if(J.length===1)return[0];if(typeof $==="number")return J.map((Q,Z)=>Z*$);return this.resolveComplexStagger(J,$)}static resolveComplexStagger(J,$){let Q=J.length;if(Q===1)return[0];let Z;if($.each!==void 0)Z=$.each;else if($.amount!==void 0)Z=$.amount/(Q-1);else Z=0.1;let j=this.getOrdering(J,$),q=Array(Q);for(let z=0;z<Q;z++)q[j[z].originalIndex]=j[z].order*Z;return q}static getOrdering(J,$){let Q=J.length,Z=$.from??"start";if($.grid)return this.getGridOrdering(J,$);switch(Z){case"start":return J.map((j,q)=>({originalIndex:q,order:q}));case"end":return J.map((j,q)=>({originalIndex:q,order:Q-1-q}));case"center":{let j=Math.floor(Q/2);return J.map((q,z)=>{let G=Math.abs(z-j);return{originalIndex:z,order:G}})}case"edges":return J.map((j,q)=>{let z=Math.min(q,Q-1-q);return{originalIndex:q,order:z}});case"random":{let j=J.map((q,z)=>({originalIndex:z,order:Math.random()}));return j.sort((q,z)=>q.order-z.order),j.forEach((q,z)=>{q.order=z}),j}default:if(typeof Z==="number"){let j=Math.max(0,Math.min(Q-1,Z));return J.map((q,z)=>{let G=Math.abs(z-j);return{originalIndex:z,order:G}})}return J.map((j,q)=>({originalIndex:q,order:q}))}}static getGridOrdering(J,$){let Q,Z;if($.grid==="auto"){let G=this.detectGrid(J);Q=G.cols,Z=G.rows}else[Q,Z]=$.grid;let j=$.from??"start",q=$.axis??"x",z=J.map((G,Y)=>{let N=Y%Q,H=Math.floor(Y/Q);return{originalIndex:Y,col:N,row:H}});if(j==="random"){let G=z.map((Y)=>({originalIndex:Y.originalIndex,order:Math.random()}));return G.sort((Y,N)=>Y.order-N.order),G.forEach((Y,N)=>{Y.order=N}),G}return z.map((G)=>{let Y;if(typeof j==="number"){let N=j%Q,H=Math.floor(j/Q);Y=q==="x"?Math.abs(G.col-N)+Math.abs(G.row-H)*0.5:Math.abs(G.row-H)+Math.abs(G.col-N)*0.5}else if(j==="center"){let N=(Q-1)/2,H=(Z-1)/2;Y=Math.abs(G.col-N)+Math.abs(G.row-H)}else if(j==="edges"){let N=Math.min(G.col,Q-1-G.col),H=Math.min(G.row,Z-1-G.row);Y=Math.min(N,H)}else if(j==="end")Y=q==="x"?(Z-1-G.row)*Q+(Q-1-G.col):(Q-1-G.col)*Z+(Z-1-G.row);else Y=q==="x"?G.row*Q+G.col:G.col*Z+G.row;return{originalIndex:G.originalIndex,order:Y}})}static detectGrid(J){if(J.length===0)return{cols:0,rows:0};let $=J.filter((q)=>q instanceof Element);if($.length===0)return{cols:J.length,rows:1};let Q=new Map;$.forEach((q)=>{let z=q.getBoundingClientRect(),G=Math.round(z.top);Q.set(G,(Q.get(G)||0)+1)});let Z=Q.size;return{cols:Math.ceil(J.length/Z),rows:Z}}}I.stagger={resolve:(J,$)=>v6.resolve(J,$)};function O9(J,$,Q){if(!(J instanceof HTMLElement))return console.warn("[Motion Fit] Fit animations only support HTML elements. SVG elements are not supported."),null;let Z=document.querySelector($);if(!Z)return console.warn(`[Motion Fit] Target element not found: "${$}". Animation skipped.`),null;if(!(Z instanceof HTMLElement))return console.warn("[Motion Fit] Fit animations only support HTML elements. SVG elements are not supported."),null;if(Z===J)return console.warn("[Motion Fit] Target element is the same as source element. Animation skipped."),null;let j=J.getBoundingClientRect(),q=Z.getBoundingClientRect(),z=j.width===0?1:j.width,G=j.height===0?1:j.height,Y=j.left+z/2,N=j.top+G/2,H=q.left+q.width/2,X=q.top+q.height/2,K=H-Y,_=X-N,B=q.width/z,U=q.height/G;if(!Q)return{dx:K,dy:_,sx:B,sy:U,sourceWidth:j.width,sourceHeight:j.height,targetWidth:q.width,targetHeight:q.height};let W=J.offsetParent??document.documentElement,O=W.getBoundingClientRect(),F=W.scrollLeft??0,A=W.scrollTop??0;return{dx:K,dy:_,sx:B,sy:U,sourceWidth:j.width,sourceHeight:j.height,targetWidth:q.width,targetHeight:q.height,sourceLeft:J.offsetLeft,sourceTop:J.offsetTop,targetLeft:q.left-O.left+F,targetTop:q.top-O.top+A}}function T6(J,$,Q,Z){if(!Z||Z==="px")return Q;if(Z==="%"){let j=J,q=$==="x"?j.offsetWidth:j.offsetHeight;return Q/100*q}if(Z==="vw")return Q/100*window.innerWidth;if(Z==="vh")return Q/100*window.innerHeight;if(Z==="vmin")return Q/100*Math.min(window.innerWidth,window.innerHeight);if(Z==="vmax")return Q/100*Math.max(window.innerWidth,window.innerHeight);if(Z==="em"){let j=parseFloat(window.getComputedStyle(J).fontSize);return Q*j}if(Z==="rem"){let j=parseFloat(window.getComputedStyle(document.documentElement).fontSize);return Q*j}return Q}var c=0.01,T0=0.001;function I9(J,$,Q,Z){let{absolute:j=!1,scale:q=!0,resize:z=!1}=Q;if($ instanceof HTMLElement)x($,!1);let G=O9($,Q.target,j);if(!G)return;if(!j)if(z){let Y=G.dx-(G.targetWidth-G.sourceWidth)/2,N=G.dy-(G.targetHeight-G.sourceHeight)/2;if(Math.abs(Y)>c){let H=Z.acquire();H.init($,"x",0,Y,"px"),J.addPropTween(H)}if(Math.abs(N)>c){let H=Z.acquire();H.init($,"y",0,N,"px"),J.addPropTween(H)}if(Math.abs(G.targetWidth-G.sourceWidth)>c){let H=Z.acquire();H.init($,"width",G.sourceWidth,G.targetWidth,"px"),J.addPropTween(H)}if(Math.abs(G.targetHeight-G.sourceHeight)>c){let H=Z.acquire();H.init($,"height",G.sourceHeight,G.targetHeight,"px"),J.addPropTween(H)}}else{let Y=Y0($,"x"),N=Y0($,"y"),H=EJ($,"x"),X=EJ($,"y"),K=T6($,"x",Y,H),_=T6($,"y",N,X),B=K+G.dx,U=_+G.dy;if(Math.abs(B-K)>c||Math.abs(K)>c||Math.abs(B)>c){let W=Z.acquire();W.init($,"x",K,B,"px"),J.addPropTween(W)}if(Math.abs(U-_)>c||Math.abs(_)>c||Math.abs(U)>c){let W=Z.acquire();W.init($,"y",_,U,"px"),J.addPropTween(W)}if(q){let W=Y0($,"scaleX"),O=Y0($,"scaleY"),F=W*G.sx,A=O*G.sy;if(Math.abs(F-W)>T0||Math.abs(W-1)>T0||Math.abs(F-1)>T0){let L=Z.acquire();L.init($,"scaleX",W,F,""),J.addPropTween(L)}if(Math.abs(A-O)>T0||Math.abs(O-1)>T0||Math.abs(A-1)>T0){let L=Z.acquire();L.init($,"scaleY",O,A,""),J.addPropTween(L)}}}else{let Y=$;if(window.getComputedStyle(Y).position==="static")Y.style.position="absolute";let{sourceLeft:H,sourceTop:X,targetLeft:K,targetTop:_}=G;if(Math.abs(K-H)>c){let B=Z.acquire();B.init($,"left",H,K,"px"),J.addPropTween(B)}if(Math.abs(_-X)>c){let B=Z.acquire();B.init($,"top",X,_,"px"),J.addPropTween(B)}if(q){if(Math.abs(G.targetWidth-G.sourceWidth)>c){let B=Z.acquire();B.init($,"width",G.sourceWidth,G.targetWidth,"px"),J.addPropTween(B)}if(Math.abs(G.targetHeight-G.sourceHeight)>c){let B=Z.acquire();B.init($,"height",G.sourceHeight,G.targetHeight,"px"),J.addPropTween(B)}}}}function F9(J,$,Q,Z){J.setPendingFitSetup((z)=>I9(J,$,Q,z)),J.setLazyStartCapture(!0);let{absolute:j=!1,resize:q=!1}=Q;J.setFitCleanup(()=>{if($ instanceof HTMLElement){if(x($,!0),q)$.style.width="",$.style.height="";if(j)$.style.width="",$.style.height="",$.style.left="",$.style.top=""}})}I.fit={registerPendingSetup:F9};var d6=(J)=>J,L9=d6,P={in:(J)=>J*J,out:(J)=>J*(2-J),inOut:(J)=>J<0.5?2*J*J:-1+(4-2*J)*J},W0={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},U0={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},i={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 KJ={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},BJ={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}},WJ={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 c6=(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}}},UJ=c6();var m6=(J=1,$=0.3)=>{let Q=Math.max(1,J),Z=$/(2*Math.PI)*Math.asin(1/Q),j=$*1.5,q=j/(2*Math.PI)*Math.asin(1/Q);return{in:(z)=>{if(z===0)return 0;if(z===1)return 1;return-(Q*Math.pow(2,10*(z-=1))*Math.sin((z-Z)*(2*Math.PI)/$))},out:(z)=>{if(z===0)return 0;if(z===1)return 1;return Q*Math.pow(2,-10*z)*Math.sin((z-Z)*(2*Math.PI)/$)+1},inOut:(z)=>{if(z===0)return 0;if(z===1)return 1;if((z*=2)<1)return-0.5*(Q*Math.pow(2,10*(z-=1))*Math.sin((z-q)*(2*Math.PI)/j));return Q*Math.pow(2,-10*(z-=1))*Math.sin((z-q)*(2*Math.PI)/j)*0.5+1}}},OJ=m6(),h6=(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},h0={in:(J)=>1-h6(1-J),out:h6,inOut:(J)=>{if(J<0.5)return h0.in(J*2)*0.5;return h0.out(J*2-1)*0.5+0.5}},i0=(J=0.7,$=0.7,Q=!1)=>{let Z=J!==1?$:0,j=(1-J)/2,q=j+J,z=Q;return(G)=>{let Y=G+(0.5-G)*Z;if(G<j){let N=1-G/j;if(z)return 1-N*N;return Y-N*N*N*N*Y}else if(G>q){let N=(G-q)/j;if(z)return G===1?0:1-N*N;return Y+(G-Y)*N*N*N*N}return z?1:Y}},f6={in:i0(0.7,0.7,!1),out:i0(0.7,0.7,!1),inOut:i0(0.7,0.7,!1)},FJ=(J=1,$=20,Q=!1)=>{let Z=[],j=1/$;for(let q=0;q<$;q++){let z=q*j,Y=((q*1327+531)%1000/1000-0.5)*J*0.4,N=z+Y;Z.push({x:z,y:Q?Math.max(0,Math.min(1,N)):N})}return Z[0]={x:0,y:0},Z.push({x:1,y:1}),(q)=>{if(q<=0)return 0;if(q>=1)return 1;let z=0,G=Z.length-1;while(z<G-1){let X=z+G>>1;if(Z[X].x<=q)z=X;else G=X}let Y=Z[z],N=Z[G],H=(q-Y.x)/(N.x-Y.x);return Y.y+(N.y-Y.y)*H}},A9={in:FJ(1,20,!0),out:FJ(1,20,!0),inOut:FJ(1,20,!0)},LJ=(J)=>{return($)=>{if($>=1)return 1;return Math.floor($*J)/J}},IJ={in:LJ(12),out:LJ(12),inOut:LJ(12)},u6={linear:d6,none:L9,power1:P.out,"power1.in":P.in,"power1.out":P.out,"power1.inout":P.inOut,power2:W0.out,"power2.in":W0.in,"power2.out":W0.out,"power2.inout":W0.inOut,power3:U0.out,"power3.in":U0.in,"power3.out":U0.out,"power3.inout":U0.inOut,power4:i.out,"power4.in":i.in,"power4.out":i.out,"power4.inout":i.inOut,quad:P.out,"quad.in":P.in,"quad.out":P.out,"quad.inout":P.inOut,cubic:W0.out,"cubic.in":W0.in,"cubic.out":W0.out,"cubic.inout":W0.inOut,quart:U0.out,"quart.in":U0.in,"quart.out":U0.out,"quart.inout":U0.inOut,quint:i.out,"quint.in":i.in,"quint.out":i.out,"quint.inout":i.inOut,strong:i.out,"strong.in":i.in,"strong.out":i.out,"strong.inout":i.inOut,sine:KJ.out,"sine.in":KJ.in,"sine.out":KJ.out,"sine.inout":KJ.inOut,expo:BJ.out,"expo.in":BJ.in,"expo.out":BJ.out,"expo.inout":BJ.inOut,circ:WJ.out,"circ.in":WJ.in,"circ.out":WJ.out,"circ.inout":WJ.inOut,back:UJ.out,"back.in":UJ.in,"back.out":UJ.out,"back.inout":UJ.inOut,elastic:OJ.out,"elastic.in":OJ.in,"elastic.out":OJ.out,"elastic.inout":OJ.inOut,bounce:h0.out,"bounce.in":h0.in,"bounce.out":h0.out,"bounce.inout":h0.inOut,slow:f6.inOut,"slow.in":P.out,"slow.out":P.out,"slow.inout":P.out,slowmo:f6.inOut,"slowmo.in":P.out,"slowmo.out":P.out,"slowmo.inout":P.out,rough:A9.inOut,"rough.in":P.out,"rough.out":P.out,"rough.inout":P.out,steps:IJ.inOut,"steps.in":IJ.in,"steps.out":IJ.out,"steps.inout":IJ.inOut},M9={back:(J)=>c6(J),elastic:(J,$)=>m6(J,$),slow:(J,$,Q)=>{let Z=i0(J,$,Q===1);return{in:Z,out:Z,inOut:Z}},slowmo:(J,$,Q)=>{let Z=i0(J,$,Q===1);return{in:Z,out:Z,inOut:Z}},rough:(J,$,Q)=>{let Z=FJ(J,$,Q===1);return{in:Z,out:Z,inOut:Z}},steps:(J)=>{let $=LJ(J??12);return{in:$,out:$,inOut:$}}},D9=/^(\w+)(?:\.(\w+))?\(([^)]*)\)$/;function p6(J){let $=J.toLowerCase();if(u6[$])return u6[$];let Q=D9.exec($);if(Q){let[,Z,j,q]=Q,z=M9[Z];if(z){let G=q.split(",").map((Y)=>Y.trim()).filter((Y)=>Y.length>0).map(Number);if(G.every((Y)=>!isNaN(Y))){let Y=z(...G),N=j||"out",X=Y[N==="inout"?"inOut":N];if(X)return X}}}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)`),P.out}class lJ{_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,Z,j,q){return this._id=J,this._targets=$,this._duration=Q,this._delay=Z,this._easingFn=p6(j),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=q?.repeat??0,this._repeatDelay=q?.repeatDelay??0,this._yoyo=q?.yoyo??!1,this._onStart=q?.onStart,this._onUpdate=q?.onUpdate,this._onComplete=q?.onComplete,this._onRepeat=q?.onRepeat,this._onReverseComplete=q?.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,Z=this._delay,j=this._currentRepeat;if(Q===0){let q=$>=Z?1:0;this._time=$,this._progress=q,this.render(q)}else{let q=Math.max(0,$-Z);if(this._repeat===0){let z=Math.min(1,q/Q);this._time=Math.min(Q,q),this._progress=z,this.render(z)}else{let z=this._repeatDelay,G=Q+z,Y=this._repeat===-1?1/0:Q*(this._repeat+1)+z*this._repeat,N=this._repeat===-1?q:Math.min(q,Y),H=G>0?Math.floor(N/G):0,X=N-H*G,K=X>Q,_=Q>0?Math.min(1,X/Q):1,B=this._yoyo&&H%2===1;if(K)_=B?0:1;else if(B)_=1-_;this._currentRepeat=this._repeat===-1?H:Math.min(H,this._repeat),this._isReversed=B,this._progress=_,this._time=Q*_,this.render(_)}}if(this._isActive){if(!this._startFired){this._startFired=!0;try{this._onStart?.()}catch(q){console.error("[Motion] onStart callback error:",q)}}try{this._onUpdate?.(this._progress)}catch(q){console.error("[Motion] onUpdate callback error:",q)}if(this._currentRepeat>j)try{this._onRepeat?.(this._currentRepeat)}catch(q){console.error("[Motion] onRepeat callback error:",q)}if(!this._completeFired&&this._repeat!==-1){if($>=this.totalDuration()){this._completeFired=!0;try{this._onComplete?.()}catch(q){console.error("[Motion] onComplete callback error:",q)}}}}}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;K0.release($),$=Q}this._propTweens=null,this._lastPropTween=null,this._pendingFitSetup(K0),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"&&_0(Q)){let Z=I.color?.getCurrentColor($,Q);if(Z&&J.endColor)J.startColor=Z,J.changeColor=new Float32Array([J.endColor[0]-Z[0],J.endColor[1]-Z[1],J.endColor[2]-Z[2],J.endColor[3]-Z[3]])}else if(J.valueType==="filter"&&t(Q)){let Z=I.filter?.getCurrentFilter($);if(Z&&J.endFilters){let j=I.filter.mergeFilterArrays(Z,J.endFilters);J.startFilters=j.start,J.endFilters=j.end}}else if(J.valueType==="clipPath"&&PJ(Q)){let Z=I.clipPath;if(Z&&J.endClipPath){let j=Z.getCurrentClipPath($);if(j&&Z.canInterpolate(j,J.endClipPath))J.startClipPath=j}}else{let Z=Y0($,Q);J.startValue=Z,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=K0,$=this._propTweens;while($){let Q=$.next;J.release($),$=Q}this._propTweens=null,this._lastPropTween=null}}var n0=new g0(()=>new lJ,100),g6={acquire:()=>n0.acquire(),release:(J)=>n0.release(J),getPoolSize:()=>n0.getPoolSize(),getTotalCreated:()=>n0.getTotalCreated(),clear:()=>n0.clear()};class C{static instance;animations=[];animationIdToIndex=new Map;nextAnimationId=1;totalCreated=0;_animationSnapshot=[];timelines=new Map;_captureTarget=null;ticker;animationPool;propTweenPool;constructor(){this.ticker=T.getInstance(),this.animationPool=g6,this.propTweenPool=K0,this.ticker.add(this.update,0)}static getInstance(){if(!C.instance)C.instance=new C,v.setEngineRegisterCallback((J,$)=>{let Q=C.instance;if(!Q.hasTimeline(J))Q.registerTimeline(J,$)}),f.setCreateAnimationCallback((J,$,Q,Z,j,q,z,G)=>{return C.instance.createAnimation(J,$,Q,Z,j,q,z,G)});return C.instance}update=(J)=>{let $=this._animationSnapshot,Q=this.animations.length;$.length=Q;for(let j=0;j<Q;j++)$[j]=this.animations[j];let Z=[];for(let j=0,q=$.length;j<q;j++){let z=$[j];if(z.isTimelineChild())continue;if(z.isActive()){if(z.update(J),!z.isActive()&&!z.isTimelineChild())Z.push(z.getId())}}for(let j of Z)this.unregisterAnimation(j);for(let j of this.timelines.values())if(j.isActive())j.update(J)};createAnimation(J,$,Q,Z,j,q,z,G){let Y=G?.stagger;if(Y&&J.length>1)return this.createStaggeredAnimations(J,$,Q,Z,j,q,z,Y,G);let N=this.animationPool.acquire(),H=this.registerAnimation(N);if(N.init(H,J,Q,Z,j,G),this.setupPropertyTweens(N,J,$,q,z),Q===0)N.render(1);else if(q&&!G?._skipInitialRender)N.render(0);return N}createStaggeredAnimations(J,$,Q,Z,j,q,z,G,Y){if(!I.stagger){let X=this.animationPool.acquire(),K=this.registerAnimation(X);if(X.init(K,J,Q,Z,j,Y),this.setupPropertyTweens(X,J,$,q,z),Q===0)X.render(1);else if(q&&!Y?._skipInitialRender)X.render(0);return[X]}let N=I.stagger.resolve(J,G),H=[];for(let X=0;X<J.length;X++){let K=J[X],_=N[X],B=this.animationPool.acquire(),U=this.registerAnimation(B);if(B.init(U,[K],Q,Z+_,j,Y),this.setupPropertyTweens(B,[K],$,q,z),Q===0)B.render(1);else if(q&&!Y?._skipInitialRender)B.render(0);H.push(B)}return H}setupPropertyTweens(J,$,Q,Z,j){let q=l6(o6(Q)),z=j?l6(o6(j)):void 0,G=Object.keys(q),Y=z?Object.keys(z):[],N=[...new Set([...G,...Y])],H="perspective"in q,X=z&&"perspective"in z,K=H&&X;for(let _ of $){if(!K&&(H||X)&&_ instanceof Element){let B=H?q.perspective:z.perspective,U=typeof B==="number"?B:parseFloat(String(B))||0;if(U>0)E(_,"perspective",U,"px"),_.style.transform=w(_)}for(let B of N){if(B==="perspective"&&!K)continue;let U=q[B],W=yJ(_,B,U,z?z[B]:void 0),O=this.propTweenPool.acquire(),F=Z&&!j;switch(W.type){case"color":{let A=F?W.endColor:W.startColor,L=F?W.startColor:W.endColor;O.initColor(_,B,A,L);break}case"filter":{let A=F?W.endFilters:W.startFilters,L=F?W.startFilters:W.endFilters;O.initFilter(_,B,A,L);break}case"clipPath":{let A=F?W.endClipPath:W.startClipPath,L=F?W.startClipPath:W.endClipPath;O.initClipPath(_,B,A,L);break}case"scalar":{let A=F?W.endValue:W.startValue,L=F?W.startValue:W.endValue;O.init(_,B,A,L,W.unit);break}case"drawSVG":{let A=F?W.endDraw:W.startDraw,L=F?W.startDraw:W.endDraw;O.initDrawSVG(_,B,A,L,W.length);break}case"path":{let A=F?W.endProgress:W.startProgress,L=F?W.startProgress:W.endProgress;O.initPath(_,B,W.pathData,W.pathLength,A,L,W.rotate,W.alignOffset,W.pathOffset);break}}J.addPropTween(O)}}}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[$],Z=this.animations.length-1;if($!==Z){let j=this.animations[Z];this.animations[$]=j,this.animationIdToIndex.set(j.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 Z=0,j=this.animations.length;Z<j;Z++){let q=this.animations[Z],z=q.getTargets();for(let G of z)if(G instanceof Element&&$.has(G)){Q.push(q);break}}for(let Z of Q)Z.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){if(this._captureTarget)this._captureTarget.add(J);let $=this.timelines.get(J);if(!$){if($=new v(J),!this.timelines.has(J))this.timelines.set(J,$),$.setUnregisterCallback(()=>this.removeTimeline(J))}return $}startCapture(J){this._captureTarget=J}stopCapture(){this._captureTarget=null}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(),Z6()}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 o6(J){if(!("transform"in J))return J;let $=J.transform;if(typeof $!=="string")return J;let Q=/([a-zA-Z0-9]+)\(([^)]+)\)/g,Z,j={},q=!1;while((Z=Q.exec($))!==null){let G=Z[1],N=Z[2].match(/[-+]?\d*\.?\d+(?:e[-+]?\d+)?[a-z%]*/gi)||[];switch(G){case"perspective":{if(!("perspective"in J))j.perspective=N[0]||"0px",q=!0;break}case"translate":{if(N[0]&&!("x"in J))j.x=N[0],q=!0;if(N[1]&&!("y"in J))j.y=N[1],q=!0;break}case"translate3d":{if(N[0]&&!("x"in J))j.x=N[0],q=!0;if(N[1]&&!("y"in J))j.y=N[1],q=!0;if(N[2]&&!("z"in J))j.z=N[2],q=!0;break}case"translateX":{if(N[0]&&!("x"in J))j.x=N[0],q=!0;break}case"translateY":{if(N[0]&&!("y"in J))j.y=N[0],q=!0;break}case"translateZ":{if(N[0]&&!("z"in J))j.z=N[0],q=!0;break}case"rotate":{if(N[0]&&!("rotate"in J))j.rotate=N[0],q=!0;break}case"rotateX":{if(N[0]&&!("rotateX"in J))j.rotateX=N[0],q=!0;break}case"rotateY":{if(N[0]&&!("rotateY"in J))j.rotateY=N[0],q=!0;break}case"rotateZ":{if(N[0]&&!("rotateZ"in J))j.rotateZ=N[0],q=!0;break}case"scale":{if(N[0]&&!("scale"in J))j.scale=parseFloat(N[0]),q=!0;break}case"scaleX":{if(N[0]&&!("scaleX"in J))j.scaleX=parseFloat(N[0]),q=!0;break}case"scaleY":{if(N[0]&&!("scaleY"in J))j.scaleY=parseFloat(N[0]),q=!0;break}case"scaleZ":{if(N[0]&&!("scaleZ"in J))j.scaleZ=parseFloat(N[0]),q=!0;break}case"skew":{if(N[0]&&!("skewX"in J))j.skewX=N[0],q=!0;if(N[1]&&!("skewY"in J))j.skewY=N[1],q=!0;break}case"skewX":{if(N[0]&&!("skewX"in J))j.skewX=N[0],q=!0;break}case"skewY":{if(N[0]&&!("skewY"in J))j.skewY=N[0],q=!0;break}default:break}}if(!q)return J;let z={...j};for(let[G,Y]of Object.entries(J)){if(G==="transform")continue;z[G]=Y}return z}function l6(J){let $=!1;for(let Z of Object.keys(J))if(Z.includes("-")&&!Z.startsWith("--")){$=!0;break}if(!$)return J;let Q={};for(let[Z,j]of Object.entries(J))if(Z.includes("-")&&!Z.startsWith("--")){let q=Z.replace(/-([a-z])/g,(z,G)=>G.toUpperCase());Q[q]=j}else Q[Z]=j;return Q}class AJ{_fn;_timelineNames=new Set;_reverted=!1;constructor(J){this._fn=J,this._execute()}revert(){if(this._reverted)return;let J=C.getInstance();for(let $ of this._timelineNames)if(J.hasTimeline($))J.getTimeline($).kill();if(typeof document<"u")document.querySelectorAll("[data-scrolltrigger-spacer]").forEach(($)=>$.remove()),document.querySelectorAll("[data-scrolltrigger-markers]").forEach(($)=>$.remove());this._timelineNames.clear(),this._reverted=!0}refresh(){this.revert(),this._reverted=!1,this._execute()}add(J){this._reverted=!1,this._execute(J)}getTimelineNames(){return Array.from(this._timelineNames)}_execute(J){let $=C.getInstance();$.startCapture(this._timelineNames);try{(J||this._fn)()}finally{$.stopCapture()}}}function k9(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 R9(J,$,Q){if(Q===void 0)return(Z)=>Math.min($,Math.max(J,Z));return Math.min($,Math.max(J,Q))}function b9(J,$,Q){let Z=J+Math.random()*($-J);if(Q&&Q>0)return Math.round(Z/Q)*Q;return Z}function E9(J,$){let Q=(Z)=>{if(typeof J==="number"){if(J<=0)return Z;return Math.round(Z/J)*J}let j=J,q=j[0],z=Math.abs(Z-q);for(let G=1;G<j.length;G++){let Y=Math.abs(Z-j[G]);if(Y<z)z=Y,q=j[G]}return q};if($===void 0)return Q;return Q($)}function V9(J,$,Q){return J+($-J)*Q}function w9(J,$,Q,Z,j){let q=(z)=>{let G=(z-J)/($-J);return Q+G*(Z-Q)};if(j===void 0)return q;return q(j)}function C9(J,$,Q){let Z=(j)=>(j-J)/($-J);if(Q===void 0)return Z;return Z(Q)}function x9(J,$,Q){let Z=$-J,j=(q)=>{return((q-J)%Z+Z)%Z+J};if(Q===void 0)return j;return j(Q)}var sJ={toArray:k9,clamp:R9,random:b9,snap:E9,interpolate:V9,mapRange:w9,normalize:C9,wrap:x9};function n(J,$,Q){let j=C.getInstance().getTimeline(J);if($!==void 0&&j.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 q of $)j._addEntry(q.target,q,q.position);else if($!==void 0&&Q!==void 0)j._addEntry($,Q);return j}n.reset=function(J){C.getInstance();let $=a0(J),Q=[];for(let Z of $)if(Z instanceof Element)Q.push(Z);if(Q.length>0)C.getInstance().killAnimationsForTargets(Q);for(let Z of $){if(!(Z instanceof Element))continue;if(I.textSplitter?.isSplit?.(Z))I.textSplitter?.revert?.(Z);x(Z),I.styleReset?.clearAnimationStylesAndUnregister?.(Z),I.styleReset?.clearPinStylesAndUnregister?.(Z)}};n.set=function(J,$){C.getInstance();let Q=new v;Q._addEntry(J,{to:$,duration:0}),Q.kill(!1)};n.get=function(J){let $=C.getInstance();return $.hasTimeline(J)?$.getTimeline(J):void 0};n.has=function(J){return C.getInstance().hasTimeline(J)};n.getNames=function(){return C.getInstance().getTimelineNames()};n.kill=function(J){let $=C.getInstance();if($.hasTimeline(J))$.getTimeline(J).kill()};n.killAll=function(){C.getInstance().killEverything()};n.refreshScrollTriggers=function(){I.triggerManager?.getInstance?.()?.refreshScrollTriggers()};n.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())};n.context=function(J){return new AJ(J)};n.utils=sJ;var S9=n;var P9={};export{P9 as Types,v as Timeline,sJ as MotionUtils,AJ as MotionContext,S9 as Motion};
34
34
 
35
35
  //# debugId=7024CED6728611A264756E2164756E21
36
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motion.page/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "High-performance CSS animation SDK with scroll, hover, gesture, and cursor triggers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,10 +15,11 @@
15
15
  },
16
16
  "files": [
17
17
  "dist",
18
- "llms.txt"
18
+ "llms.txt",
19
+ "!dist/**/*.map"
19
20
  ],
20
21
  "scripts": {
21
- "build": "rm -rf dist && tsc -p tsconfig.build.json && bun build src/index.ts --outdir dist --minify --sourcemap=linked && mkdir -p dist/.cjs-tmp && bun build src/index.ts --outdir dist/.cjs-tmp --format=cjs --minify --sourcemap=linked && mv dist/.cjs-tmp/index.js dist/index.cjs && mv dist/.cjs-tmp/index.js.map dist/index.cjs.map && rm -rf dist/.cjs-tmp",
22
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && bun build src/index.ts --outdir dist --minify --sourcemap=external && mkdir -p dist/.cjs-tmp && bun build src/index.ts --outdir dist/.cjs-tmp --format=cjs --minify --sourcemap=external && mv dist/.cjs-tmp/index.js dist/index.cjs && mv dist/.cjs-tmp/index.js.map dist/index.cjs.map && rm -rf dist/.cjs-tmp",
22
23
  "test": "bun test",
23
24
  "test:parity": "bun test tests/parity",
24
25
  "test:bench": "bun test --bench",