@algorisys/tinyfly 0.70.1 → 0.74.0
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/README.md +32 -8
- package/bin/tinyfly.mjs +95 -2
- package/lib/addons/adapters.js +31 -12
- package/lib/addons/characters.js +204 -0
- package/lib/addons/export.js +476 -440
- package/lib/browser/tinyfly.iife.js +4 -4
- package/lib/browser/tinyfly.js +1352 -1115
- package/lib/browser/tinyfly.umd.js +4 -4
- package/lib/embed/tinyfly-embed.iife.js +1 -1
- package/lib/embed/tinyfly-embed.js +1 -1
- package/lib/engine/tinyfly-engine.js +313 -277
- package/lib/engine/tinyfly-engine.umd.cjs +2 -2
- package/lib/headless/headless.js +947 -0
- package/lib/types/adapters/canvas/canvas-adapter.d.ts +32 -2
- package/lib/types/browser/index.d.ts +3 -1
- package/lib/types/characters/index.d.ts +5 -0
- package/lib/types/characters/stick-figure.d.ts +162 -0
- package/lib/types/engine/authoring/index.d.ts +1 -0
- package/lib/types/engine/authoring/narration.d.ts +80 -0
- package/lib/types/engine/export/captions.d.ts +31 -0
- package/lib/types/engine/export/index.d.ts +1 -0
- package/lib/types/headless/ffmpeg-args.d.ts +28 -0
- package/lib/types/headless/frame-renderer.d.ts +45 -0
- package/lib/types/headless/index.d.ts +12 -0
- package/lib/types/headless/narration-audio.d.ts +13 -0
- package/lib/types/headless/node-audio.d.ts +46 -0
- package/lib/types/headless/node-video.d.ts +48 -0
- package/lib/types/headless/scene-captions.d.ts +4 -0
- package/lib/types/headless/video-scene.d.ts +57 -0
- package/package.json +19 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(g){"use strict";function ze(i){return typeof i=="object"&&i!==null&&i.type==="cubic-bezier"}function pt(i){return typeof i=="object"&&i!==null&&i.type!=="cubic-bezier"}const mt=1;function It(i){return i.property==="text"&&"textConfig"in i}function H(i){return i.kind==="inertia"&&"inertia"in i}function G(i){return i.kind==="spring"&&"spring"in i}function Zt(i){return i.property==="motionPath"&&"motionPathConfig"in i}function es(i){return typeof i=="object"&&i!==null&&"x"in i&&"y"in i&&"angle"in i}function He(i){return"keyframes"in i}class is{_currentTime=0;_isRunning=!1;onTick=null;get currentTime(){return this._currentTime}get isRunning(){return this._isRunning}start(){this._isRunning=!0}stop(){this._isRunning=!1}tick(t){this._currentTime+=t,this.onTick?.(t,this._currentTime)}reset(){this._currentTime=0}seek(t){this._currentTime=t}}class ns{_currentTime=0;_isRunning=!1;_lastFrameTime=null;_rafId=null;_speed;onTick=null;constructor(t={}){this._speed=t.speed??1}get currentTime(){return this._currentTime}get isRunning(){return this._isRunning}get speed(){return this._speed}set speed(t){this._speed=t}start(){this._isRunning||(this._isRunning=!0,this._lastFrameTime=null,this._scheduleFrame())}stop(){this._isRunning=!1,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null)}reset(){this._currentTime=0,this._lastFrameTime=null}seek(t){this._currentTime=t}_scheduleFrame(){this._rafId=requestAnimationFrame(this._onFrame.bind(this))}_onFrame(t){if(this._isRunning){if(this._lastFrameTime!==null){const n=(t-this._lastFrameTime)*this._speed;this._currentTime+=n,this.onTick?.(n,this._currentTime)}this._lastFrameTime=t,this._scheduleFrame()}}}function Jt(i,t,e="start"){if(t<=1)return 0;if(typeof e=="number"){const n=Math.max(0,Math.min(t-1,e));return Math.abs(i-n)}switch(e){case"end":return t-1-i;case"center":return Math.abs(i-(t-1)/2);case"edges":return(t-1)/2-Math.abs(i-(t-1)/2);default:return i}}function te(i,t="start"){if(i<=1)return 0;let e=0;for(let n=0;n<i;n++)e=Math.max(e,Jt(n,i,t));return e}function Rt(i,t,e){if(e.offsets)return e.offsets[i]??0;const n=e.from??"start",s=Jt(i,t,n);if(e.amount!==void 0){const r=te(t,n);return r===0?0:e.amount*s/r}return e.each!==void 0?e.each*s:0}function Lt(i,t){return Array.from({length:i},(e,n)=>Rt(n,i,t))}function gt(i,t){return i<=1?0:Math.max(...Lt(i,t))}const it=1,ee=6e4,Ft=ee/it,Y={stiffness:180,damping:12,mass:1,velocity:0,restDelta:.01,restSpeed:.1},$t={gentle:{stiffness:120,damping:18,mass:1},default:{stiffness:180,damping:12,mass:1},snappy:{stiffness:280,damping:20,mass:1},bouncy:{stiffness:220,damping:8,mass:1},wobbly:{stiffness:180,damping:5,mass:1},stiff:{stiffness:400,damping:30,mass:1}};class yt{from;to;stiffness;damping;mass;restDelta;restSpeed;distance;samples;velocity;settledStep=null;constructor(t){this.from=t.from,this.to=t.to,this.stiffness=t.stiffness??Y.stiffness,this.damping=t.damping??Y.damping,this.mass=t.mass??Y.mass,this.restDelta=t.restDelta??Y.restDelta,this.restSpeed=t.restSpeed??Y.restSpeed,this.distance=Math.abs(this.to-this.from)||1,this.samples=[this.from],this.velocity=t.velocity??Y.velocity,this.isAtRest(this.from)&&(this.settledStep=0)}isAtRest(t){return Math.abs(t-this.to)<this.restDelta*this.distance&&Math.abs(this.velocity)<this.restSpeed*this.distance}valueAt(t){if(t<=0)return this.from;const e=Math.floor(t/it);if(this.simulateTo(e+1),this.settledStep!==null&&e>=this.settledStep)return this.to;const n=this.samples[Math.min(e,this.samples.length-1)],s=this.samples[Math.min(e+1,this.samples.length-1)],r=t/it-e;return n+(s-n)*r}settleTime(){return this.simulateTo(Ft+1),this.settledStep!==null?this.settledStep*it:ee}simulateTo(t){if(this.settledStep!==null)return;const e=Math.min(t,Ft+1),n=it/1e3;for(;this.samples.length<e;){const s=this.samples[this.samples.length-1],r=s-this.to,o=-this.stiffness*r,a=-this.damping*this.velocity,c=(o+a)/this.mass;this.velocity+=c*n;const l=s+this.velocity*n;if(this.samples.push(l),this.isAtRest(l)){this.settledStep=this.samples.length-1;return}}this.samples.length>Ft&&(this.settledStep=Ft)}}function ss(i,t){return new yt(i).valueAt(t)}function Ge(i){return new yt(i).settleTime()}function rs(i){const t=i.stiffness??Y.stiffness,e=i.damping??Y.damping,n=i.mass??Y.mass;return e<2*Math.sqrt(t*n)}function os(i){const t=i.stiffness??Y.stiffness,e=i.mass??Y.mass;return 2*Math.sqrt(t*e)}const ie=4,as=.002,cs=1e-4,Ke=6e4;function Dt(i){const t=i.friction??ie;return t>0?t:ie}function bt(i){return i.from+i.velocity/Dt(i)}function ls(i,t){if(t===void 0)return i;if(typeof t=="number")return t>0?Math.round(i/t)*t:i;if(t.length===0)return i;let e=t[0];for(const n of t)Math.abs(n-i)<Math.abs(e-i)&&(e=n);return e}function nt(i){let t=ls(bt(i),i.end);return i.min!==void 0&&(t=Math.max(i.min,t)),i.max!==void 0&&(t=Math.min(i.max,t)),t}function st(i){const t=Math.abs(nt(i)-i.from);if(t===0)return 0;const e=i.restDelta??Math.max(cs,t*as);if(e>=t)return 0;const n=Math.log(t/e)/Dt(i);return Math.min(Ke,n*1e3)}function Ot(i,t){if(t<=0)return i.from;const e=nt(i);if(t>=st(i))return e;const n=Dt(i);return i.from+(e-i.from)*(1-Math.exp(-n*t/1e3))}function hs(i,t){const e=Dt(i),n=nt(i);return t>=st(i)?0:(n-i.from)*e*Math.exp(-e*Math.max(0,t)/1e3)}const Nt=i=>i,Qe=i=>i*i,Ze=i=>1-(1-i)*(1-i),Je=i=>i<.5?2*i*i:1-Math.pow(-2*i+2,2)/2,ne=i=>i*i*i,se=i=>1-Math.pow(1-i,3),vt=i=>i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2,ti=ne,ei=se,ii=vt,us={linear:Nt,"ease-in":ti,"ease-out":ei,"ease-in-out":ii,"ease-in-quad":Qe,"ease-out-quad":Ze,"ease-in-out-quad":Je,"ease-in-cubic":ne,"ease-out-cubic":se,"ease-in-out-cubic":vt};function ni(i){const[t,e,n,s]=i,r=3*t,o=3*(n-t)-r,a=1-r-o,c=3*e,l=3*(s-e)-c,h=1-c-l,f=p=>((a*p+o)*p+r)*p,u=p=>((h*p+l)*p+c)*p,d=p=>(3*a*p+2*o)*p+r,m=p=>{let y=p;for(let v=0;v<8;v++){const k=f(y)-p;if(Math.abs(k)<1e-7)return y;const T=d(y);if(Math.abs(T)<1e-7)break;y-=k/T}let b=0,w=1;for(y=p;b<w;){const v=f(y);if(Math.abs(v-p)<1e-7)return y;p>v?b=y:w=y,y=(b+w)/2}return y};return p=>{if(p<=0)return 0;if(p>=1)return 1;const y=m(p);return u(y)}}function re(i,t="out"){if(t==="out")return i;const e=n=>1-i(1-n);return t==="in"?e:n=>n<.5?e(n*2)/2:i(n*2-1)/2+.5}function si(i=1,t=.3){const e=Math.max(1,i),n=t/(2*Math.PI)*Math.asin(1/e);return s=>s<=0?0:s>=1?1:e*Math.pow(2,-10*s)*Math.sin((s-n)*(2*Math.PI)/t)+1}const ri=i=>{if(i<=0)return 0;if(i>=1)return 1;if(i<1/2.75)return 7.5625*i*i;if(i<2/2.75){const s=i-.5454545454545454;return 7.5625*s*s+.75}if(i<2.5/2.75){const s=i-.8181818181818182;return 7.5625*s*s+.9375}const n=i-2.625/2.75;return 7.5625*n*n+.984375};function oi(i=1.70158){return t=>{if(t<=0)return 0;if(t>=1)return 1;const e=t-1;return e*e*((i+1)*e+i)+1}}function ai(i,t="end"){const e=Math.max(1,Math.floor(i));return n=>{if(n>=1)return 1;if(n<=0)return t==="start"||t==="both"?t==="start"?1/e:1/(e+1):0;const s=Math.floor(n*e);switch(t){case"start":return Math.min(1,(s+1)/e);case"both":return(s+1)/(e+1);case"none":return e===1?0:Math.min(1,s/(e-1));default:return s/e}}}function ci(i){switch(i.type){case"steps":return ai(i.count,i.position);case"elastic":return re(si(i.amplitude,i.period),i.mode);case"bounce":return re(ri,i.mode);case"back":return re(oi(i.overshoot),i.mode)}}function V(i){return i===void 0?Nt:ze(i)?ni(i.points):pt(i)?ci(i):us[i]??Nt}const li=32,fs=256,rt=new Map,ds=/[MmLlHhVvCcSsQqTtAaZz]/,ps=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/,ms={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};function gs(i){const t=[];let e=0,n=null;const s=()=>{for(;e<i.length&&/[\s,]/.test(i[e]);)e++};for(;e<i.length&&(s(),!(e>=i.length));){const r=i[e];if(ds.test(r)){n={type:r,args:[]},t.push(n),e++;continue}if(!n)break;const o=n.type==="A"||n.type==="a",a=n.args.length%7;if(o&&(a===3||a===4)){if(r!=="0"&&r!=="1")break;n.args.push(r==="1"?1:0),e++;continue}const c=ps.exec(i.slice(e));if(!c)break;n.args.push(parseFloat(c[0])),e+=c[0].length}return t}function ys(i,t,e,n,s,r,o,a,c){if(i===a&&t===c)return[];let l=Math.abs(e),h=Math.abs(n);if(l===0||h===0)return[[i,t,a,c,a,c]];const f=s*Math.PI/180,u=Math.cos(f),d=Math.sin(f),m=(i-a)/2,p=(t-c)/2,y=u*m+d*p,b=-d*m+u*p,w=y*y/(l*l)+b*b/(h*h);if(w>1){const L=Math.sqrt(w);l*=L,h*=L}const v=r===o?-1:1,k=l*l*h*h-l*l*b*b-h*h*y*y,T=l*l*b*b+h*h*y*y,S=v*Math.sqrt(Math.max(0,k/T)),A=S*l*b/h,I=-S*h*y/l,O=u*A-d*I+(i+a)/2,E=d*A+u*I+(t+c)/2,M=(L,D,X,dt)=>{const je=L*X+D*dt,Qt=Math.sqrt((L*L+D*D)*(X*X+dt*dt)),_t=Math.acos(Math.max(-1,Math.min(1,je/Qt)));return L*dt-D*X<0?-_t:_t},C=M(1,0,(y-A)/l,(b-I)/h);let P=M((y-A)/l,(b-I)/h,(-y-A)/l,(-b-I)/h);!o&&P>0&&(P-=2*Math.PI),o&&P<0&&(P+=2*Math.PI);const _=Math.max(1,Math.ceil(Math.abs(P)/(Math.PI/2))),x=P/_,R=4/3*Math.tan(x/4),$=L=>{const D=l*Math.cos(L),X=h*Math.sin(L);return[u*D-d*X+O,d*D+u*X+E]},B=L=>{const D=-l*Math.sin(L),X=h*Math.cos(L);return[u*D-d*X,d*D+u*X]},N=[];for(let L=0;L<_;L++){const D=C+L*x,X=D+x,[dt,je]=$(D),[Qt,_t]=L===_-1?[a,c]:$(X),[oa,aa]=B(D),[ca,la]=B(X);N.push([dt+R*oa,je+R*aa,Qt-R*ca,_t-R*la,Qt,_t])}return N}function K(i,t,e,n,s){const r=1-s;return r*r*r*i+3*r*r*s*t+3*r*s*s*e+s*s*s*n}function hi(i,t,e,n,s){const r=1-s;return 3*r*r*(t-i)+6*r*s*(e-t)+3*s*s*(n-e)}function wt(i,t,e,n){return{subpath:0,type:"L",points:[e,n],startX:i,startY:t,endX:e,endY:n,length:Math.hypot(e-i,n-t)}}function Bt(i,t,e){const[n,s,r,o,a,c]=e,l=[0];let h=i,f=t,u=0;for(let d=1;d<=li;d++){const m=d/li,p=K(i,n,r,a,m),y=K(t,s,o,c,m);u+=Math.hypot(p-h,y-f),l.push(u),h=p,f=y}return{subpath:0,type:"C",points:[n,s,r,o,a,c],startX:i,startY:t,endX:a,endY:c,length:u,lengths:l}}function J(i){const t=rt.get(i);if(t)return t;const e=[];let n=0,s=0,r=0,o=0,a=null,c=null,l=-1;const h=new Set,f=p=>{l<0&&(l=0),p.subpath=l,e.push(p)};for(const{type:p,args:y}of gs(i)){const b=p.toUpperCase(),w=p!==b,v=ms[b];if(b==="Z"){(n!==r||s!==o)&&f(wt(n,s,r,o)),l>=0&&h.add(l),n=r,s=o,a=c=null;continue}for(let k=0;k+v<=y.length;k+=v){const T=y.slice(k,k+v),S=w?n:0,A=w?s:0;let I=null,O=null;switch(b){case"M":k===0?(n=T[0]+S,s=T[1]+A,r=n,o=s,(l<0||e[e.length-1]?.subpath===l)&&l++):(f(wt(n,s,T[0]+S,T[1]+A)),n=T[0]+S,s=T[1]+A);break;case"L":f(wt(n,s,T[0]+S,T[1]+A)),n=T[0]+S,s=T[1]+A;break;case"H":f(wt(n,s,T[0]+S,s)),n=T[0]+S;break;case"V":f(wt(n,s,n,T[0]+A)),s=T[0]+A;break;case"C":{const E=[T[0]+S,T[1]+A,T[2]+S,T[3]+A,T[4]+S,T[5]+A];f(Bt(n,s,E)),I=[E[2],E[3]],n=E[4],s=E[5];break}case"S":{const[E,M]=a?[2*n-a[0],2*s-a[1]]:[n,s],C=[E,M,T[0]+S,T[1]+A,T[2]+S,T[3]+A];f(Bt(n,s,C)),I=[C[2],C[3]],n=C[4],s=C[5];break}case"Q":case"T":{let E=n,M=s;b==="Q"?(E=T[0]+S,M=T[1]+A):c&&(E=2*n-c[0],M=2*s-c[1]);const C=b==="Q"?T[2]+S:T[0]+S,P=b==="Q"?T[3]+A:T[1]+A;f(Bt(n,s,[n+2/3*(E-n),s+2/3*(M-s),C+2/3*(E-C),P+2/3*(M-P),C,P])),O=[E,M],n=C,s=P;break}case"A":{const E=T[5]+S,M=T[6]+A;let C=n,P=s;for(const _ of ys(n,s,T[0],T[1],T[2],T[3],T[4],E,M))f(Bt(C,P,_)),C=_[4],P=_[5];n=E,s=M;break}}a=I,c=O}}const u=e.reduce((p,y)=>p+y.length,0),d=[];for(let p=0;p<e.length;){const y=e[p].subpath;let b=p,w=0;for(;b<e.length&&e[b].subpath===y;)w+=e[b++].length;const v=e[p],k=e[b-1],T=h.has(y)||Math.abs(k.endX-v.startX)<1e-9&&Math.abs(k.endY-v.startY)<1e-9;d.push({start:p,end:b,length:w,closed:T}),p=b}const m={segments:e,totalLength:u,subpaths:d};return rt.size>=fs&&rt.delete(rt.keys().next().value),rt.set(i,m),m}function bs(i,t){const e=i.lengths;if(t<=0)return 0;if(t>=i.length)return 1;let n=0,s=e.length-1;for(;n<s-1;){const a=n+s>>1;e[a]<t?n=a:s=a}const r=e[s]-e[n],o=r>0?(t-e[n])/r:0;return(n+o)/(e.length-1)}function vs(i,t){if(i.type==="L"){const f=i.length>0?Math.max(0,Math.min(1,t/i.length)):0;return{x:i.startX+(i.endX-i.startX)*f,y:i.startY+(i.endY-i.startY)*f,angle:Math.atan2(i.endY-i.startY,i.endX-i.startX)*180/Math.PI}}const[e,n,s,r,o,a]=i.points,c=bs(i,t);let l=hi(i.startX,e,s,o,c),h=hi(i.startY,n,r,a,c);if(Math.hypot(l,h)<1e-9){const f=c<.5?Math.min(1,c+.001):Math.max(0,c-.001),u=K(i.startX,e,s,o,f),d=K(i.startY,n,r,a,f),m=K(i.startX,e,s,o,c),p=K(i.startY,n,r,a,c);l=c<.5?u-m:m-u,h=c<.5?d-p:p-d}return{x:K(i.startX,e,s,o,c),y:K(i.startY,n,r,a,c),angle:Math.atan2(h,l)*180/Math.PI}}function oe(i,t,e=0,n=i.length){if(n<=e)return{x:0,y:0,angle:0};let s=0;for(let r=e;r<n;r++){const o=i[r];if(s+o.length>=t||r===n-1)return vs(o,t-s);s+=o.length}return{x:0,y:0,angle:0}}function ui(i,t){const{segments:e,totalLength:n}=J(i);return oe(e,Math.max(0,Math.min(1,t))*n)}function ws(){rt.clear()}function Ts(i){return J(i).totalLength}const ks=24,Ss=320,Ms=2.5,Tt=72,As=64,xs=.2,Es=128,kt=new Map;let qt=0,Q;const fi=i=>Math.round(i*100)/100;function di(i,t){const{segments:e,subpaths:n,totalLength:s}=J(i);if(e.length===0)return[];if(t){const r=n.every(o=>o.closed);return[{segments:e,start:0,end:e.length,length:s,closed:r}]}return n.filter(r=>r.length>0).map(r=>({segments:e,start:r.start,end:r.end,length:r.length,closed:r.closed}))}function ae(i,t){const e=i.closed?(t%1+1)%1:Math.max(0,Math.min(1,t)),n=oe(i.segments,e*i.length,i.start,i.end);return[n.x,n.y]}function pi(i){const t=[];let e=0;for(let n=i.start;n<i.end;n++)e+=i.segments[n].length,i.length>0&&t.push(e/i.length);return t}function mi(i,t){const e=[];for(let n=0;n<t;n++)e.push(ae(i,i.closed?n/t:n/(t-1)));return e}function gi(i){let t=0,e=0;for(const[n,s]of i)t+=n,e+=s;return t/=i.length,e/=i.length,i.map(([n,s])=>[n-t,s-e])}function Ps(i,t,e){const n=i.closed&&t.closed;if(e!==void 0)return{offset:n?Math.abs(e)%Tt/Tt:0,reversed:e<0};const s=gi(mi(i,Tt)),r=gi(mi(t,Tt)),o=Tt;let a={offset:0,reversed:!1},c=1/0;for(const l of[!1,!0]){const h=n?o:1;for(let f=0;f<h;f++){let u=0;for(let d=0;d<o&&u<c;d++){const m=n?l?(f-d+o)%o:(d+f)%o:l?o-1-d:d,p=s[d][0]-r[m][0],y=s[d][1]-r[m][1];u+=p*p+y*y}u<c&&(c=u,a={offset:n?f/o:0,reversed:l})}}return a}function Cs(i,t,e){return e?((t.reversed?t.offset-i:i+t.offset)%1+1)%1:t.reversed?1-i:i}function _s(i,t,e){return e?((t.reversed?t.offset-i:i-t.offset)%1+1)%1:t.reversed?1-i:i}function Is(i,t,e){const n=i.closed&&t.closed,s=Ps(i,t,e.shapeIndex),r=Math.max(ks,Math.min(Ss,Math.ceil(Math.max(i.length,t.length)/Ms))),o=new Set,a=f=>o.add(Math.round(f*1e7)/1e7);for(let f=0;f<=r;f++)a(f/r);for(const f of pi(i))a(f);for(const f of pi(t))a(_s(f,s,n));let c=[...o].sort((f,u)=>f-u);n&&(c=c.filter(f=>f<1));const l=[],h=[];for(const f of c)l.push(...ae(i,f)),h.push(...ae(t,Cs(f,s,n)));return Rs({from:l,to:h,closed:n})}function Rs(i){const t=i.from.length/2;if(t<=3)return i;const e=new Uint8Array(t);e[0]=1,e[t-1]=1;const n=[[0,t-1]];for(;n.length>0;){const[o,a]=n.pop();let c=-1,l=xs;for(let h=o+1;h<a;h++){const f=Math.max(yi(i.from,o,a,h),yi(i.to,o,a,h));f>l&&(l=f,c=h)}c!==-1&&(e[c]=1,n.push([o,c],[c,a]))}const s=[],r=[];for(let o=0;o<t;o++)e[o]&&(s.push(i.from[o*2],i.from[o*2+1]),r.push(i.to[o*2],i.to[o*2+1]));return{from:s,to:r,closed:i.closed}}function yi(i,t,e,n){const s=i[t*2],r=i[t*2+1],o=i[e*2]-s,a=i[e*2+1]-r,c=i[n*2]-s,l=i[n*2+1]-r,h=o*o+a*a,f=h===0?0:Math.max(0,Math.min(1,(c*o+l*a)/h));return Math.hypot(c-f*o,l-f*a)}function Ls(i,t,e){const n=e.shapeIndex;if(Q&&Q.from===i&&Q.to===t&&Q.shapeIndex===n)return Q.plan;const r=kt.get(String(n??"auto"))?.get(i)?.get(t);if(r)return Q={from:i,to:t,shapeIndex:n,plan:r},r;const o=J(i).subpaths.filter(d=>d.length>0).length===J(t).subpaths.filter(d=>d.length>0).length,a=di(i,!o),c=di(t,!o),l={pairs:a.map((d,m)=>Is(d,c[m],e))};qt>=Es&&(kt.clear(),qt=0);const h=String(n??"auto"),f=kt.get(h)??new Map;kt.set(h,f);const u=f.get(i)??new Map;return f.set(i,u),u.set(t,l),qt++,Q={from:i,to:t,shapeIndex:n,plan:l},l}function bi(i,t,e,n={}){if(!i)return t;if(!t)return i;const s=Math.max(0,Math.min(1,e));if(s===0)return i;if(s===1)return t;const r=Ls(i,t,n);if(r.pairs.length===0)return s<.5?i:t;let o="";for(const a of r.pairs){for(let c=0;c<a.from.length;c+=2){const l=fi(a.from[c]+(a.to[c]-a.from[c])*s),h=fi(a.from[c+1]+(a.to[c+1]-a.from[c+1])*s);o+=`${c===0?o?" M":"M":" L"}${l} ${h}`}a.closed&&(o+=" Z")}return o}function Fs(){kt.clear(),qt=0,Q=void 0}function ot(i){return/^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(i)}const W=(i,t,e)=>i+(t-i)*e,vi=512,ce=new Map,le=new Map;function wi(i){const t=ce.get(i);if(t)return t;const e=i.replace("#",""),n=[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)];return ce.size<vi&&ce.set(i,n),n}const Ti=i=>i.charCodeAt(0)===35,ki=i=>i.startsWith("rgb"),Si=i=>i.startsWith("rgba"),$s=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/,he=i=>Math.round(i).toString(16).padStart(2,"0");function Ds(i,t,e){return`#${he(i)}${he(t)}${he(e)}`}function Mi(i){const t=le.get(i);if(t)return t;const e=i.match($s);if(!e)throw new Error(`Invalid rgb color: ${i}`);const n=parseInt(e[1],10),s=parseInt(e[2],10),r=parseInt(e[3],10),o=e[4]!==void 0?[n,s,r,parseFloat(e[4])]:[n,s,r];return le.size<vi&&le.set(i,o),o}const Ai=(i,t,e)=>{if(Ti(i)&&Ti(t)){const[n,s,r]=wi(i),[o,a,c]=wi(t),l=W(n,o,e),h=W(s,a,e),f=W(r,c,e);return Ds(l,h,f)}if((ki(i)||Si(i))&&(ki(t)||Si(t))){const n=Mi(i),s=Mi(t),r=Math.round(W(n[0],s[0],e)),o=Math.round(W(n[1],s[1],e)),a=Math.round(W(n[2],s[2],e));if(n.length===4||s.length===4){const c=n[3]??1,l=s[3]??1,h=W(c,l,e);return`rgba(${r}, ${o}, ${a}, ${h})`}return`rgb(${r}, ${o}, ${a})`}return e<1?i:t},xi=(i,t,e)=>{const n=Math.min(i.length,t.length),s=[];for(let r=0;r<n;r++)s.push(W(i[r],t[r],e));return s},ue=(i,t,e)=>e<1?i:t,Ei=(i,t,e)=>bi(i,t,e);function St(i){return typeof i=="number"?W:Array.isArray(i)?xi:typeof i=="string"?i.startsWith("#")||i.startsWith("rgb")?Ai:ot(i)?Ei:ue:ue}const fe=1e3/60;function de(i,t={}){if(!G(i))throw new Error(`bakeSpringTrack: track "${i.id}" is not a spring track`);const e=new yt(i.spring);return Pi(i,n=>e.valueAt(n),e.settleTime(),i.spring.from,i.spring.to,t)}function pe(i,t={}){if(!H(i))throw new Error(`bakeInertiaTrack: track "${i.id}" is not an inertia track`);const e=i.inertia;return Pi(i,n=>Ot(e,n),st(e),e.from,nt(e),t)}function Pi(i,t,e,n,s,r){const o=r.intervalMs??fe,a=r.tolerance??.01,c=i.delay??0,l=[];for(let f=0;f<=e;f+=o)l.push({time:f+c,value:t(f),easing:"linear"});const h=l[l.length-1];return!h||h.time<e+c?l.push({time:e+c,value:s,easing:"linear"}):h.value=s,c>0&&l.unshift({time:0,value:n,easing:"linear"}),{id:i.id,target:i.target,property:i.property,keyframes:a>0?_i(l,a):l,...i.targets&&{targets:[...i.targets]},...i.stagger&&{stagger:{...i.stagger}}}}function me(i,t,e,n={}){const s=n.intervalMs??fe,r=typeof e=="function"?e:V(e),o=St(i.value),a=t.time-i.time;if(a<=0)return[t];const c=[];for(let h=s;h<a;h+=s){const f=h/a;c.push({time:i.time+h,value:o(i.value,t.value,r(f)),easing:"linear"})}const l=r(1);return c.push({...t,...l!==1&&{value:o(i.value,t.value,l)},easing:"linear"}),c}function Os(i,t){return G(i)?de(i,t):H(i)?pe(i,t):i}function Ci(i,t={}){const e=i.keyframes;if(!e.some(s=>pt(s.easing)))return i;const n=e.length>0?[e[0]]:[];for(let s=1;s<e.length;s++){const r=e[s];pt(r.easing)?n.push(...me(e[s-1],r,r.easing,t)):n.push(r)}return{...i,keyframes:n}}function Ns(i,t){return i.filter(He).map(e=>Ci(e,t)).concat(i.filter(G).map(e=>de(e,t)),i.filter(H).map(e=>pe(e,t)))}function _i(i,t){if(i.length<=2)return i;const e=[i[0]];for(let n=1;n<i.length-1;n++){const s=e[e.length-1],r=i[n],o=i[n+1],a=o.time-s.time;if(a<=0)continue;const c=(r.time-s.time)/a,l=s.value+(o.value-s.value)*c;Math.abs(r.value-l)>t&&e.push(r)}return e.push(i[i.length-1]),e}function Xt(i){const t=[...i.keyframes].sort((e,n)=>e.time-n.time);return{...i,keyframes:t}}function Z(i){return i.targets&&i.targets.length>0?i.targets:[i.target]}function at(i,t,e,n){const s=e??0;return!n||t<=1?s:s+Rt(i,t,n)}class Yt{track;targets;constructor(t){this.track=t,this.targets=Z(t)}getValueAtTime(t){return this.valueForOffset(t-at(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const e=this.targets.length,n=[];for(let s=0;s<e;s++){const r=at(s,e,this.track.delay,this.track.stagger),o=this.valueForOffset(t-r);o!==void 0&&n.push({target:this.targets[s],value:o,start:r+this.track.keyframes[0].time})}return n}getDuration(){const{keyframes:t}=this.track;if(t.length===0)return 0;const e=t[t.length-1].time,n=this.track.stagger?gt(this.targets.length,this.track.stagger):0;return e+(this.track.delay??0)+n+(this.track.endDelay??0)}getTrack(){return this.track}valueForOffset(t){const{keyframes:e}=this.track;if(e.length===0)return;if(e.length===1||t<=e[0].time)return e[0].value;if(t>=e[e.length-1].time)return e[e.length-1].value;const{from:n,to:s}=this.findSurroundingKeyframes(t);if(!n||!s)return;if(n.time===t)return n.value;const r=s.time-n.time,o=(t-n.time)/r,c=V(s.easing)(o);return St(n.value)(n.value,s.value,c)}findSurroundingKeyframes(t){const{keyframes:e}=this.track;for(let n=0;n<e.length-1;n++)if(t>=e[n].time&&t<=e[n+1].time)return{from:e[n],to:e[n+1]};return{from:null,to:null}}}class Ii{track;targets;sampler;constructor(t){this.track=t,this.targets=Z(t),this.sampler=new yt(t.spring)}getValueAtTime(t){return this.sampler.valueAt(t-at(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const e=this.targets.length,n=[];for(let s=0;s<e;s++){const r=at(s,e,this.track.delay,this.track.stagger);n.push({target:this.targets[s],value:this.sampler.valueAt(t-r),start:r})}return n}getDuration(){const t=this.track.stagger?gt(this.targets.length,this.track.stagger):0;return this.sampler.settleTime()+(this.track.delay??0)+t}getTrack(){return this.track}}class Ri{track;targets;duration;constructor(t){this.track=t,this.targets=Z(t),this.duration=st(t.inertia)}getValueAtTime(t){return Ot(this.track.inertia,t-at(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const e=this.targets.length,n=[];for(let s=0;s<e;s++){const r=at(s,e,this.track.delay,this.track.stagger);n.push({target:this.targets[s],value:Ot(this.track.inertia,t-r),start:r})}return n}getDuration(){const t=this.track.stagger?gt(this.targets.length,this.track.stagger):0;return this.duration+(this.track.delay??0)+t}getTrack(){return this.track}}function ge(i,t){const e={...ui(i.pathData,t)};if(i.matrix){const[n,s,r,o,a,c]=i.matrix,{x:l,y:h}=e;e.x=n*l+r*h+a,e.y=s*l+o*h+c;const f=e.angle*Math.PI/180,u=Math.cos(f),d=Math.sin(f);e.angle=Math.atan2(s*u+o*d,n*u+r*d)*180/Math.PI}return i.autoRotate&&i.rotateOffset&&(e.angle+=i.rotateOffset),e}function Bs(i,t,e,n){const s=t+(e-t)*n;return ge(i,s)}const ye={upperCase:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",lowerCase:"abcdefghijklmnopqrstuvwxyz",upperAndLowerCase:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",numbers:"0123456789"},qs=20;function Li(i){const t=ye[i??"upperCase"]??i??ye.upperCase,e=Array.from(t);return e.length>0?e:Array.from(ye.upperCase)}function Xs(i,t,e){let n=(i|0)^Math.imul(t+1,2654435761)^Math.imul(e+1,2246822507);return n=Math.imul(n^n>>>16,2146121005),n=Math.imul(n^n>>>15,2221713035),(n^n>>>16)>>>0}function Fi(i,t,e=0){const n=i.from??"",s=i.to,r=Math.max(0,Math.min(1,t));if(r<=0)return n;if(r>=1)return s;const o=Array.from(n),a=Array.from(s),c=i.rightToLeft??!1;if(i.mode==="type"){const w=Math.round(r*Math.max(o.length,a.length));return c?o.slice(0,Math.max(0,o.length-w)).join("")+a.slice(Math.max(0,a.length-w)).join(""):a.slice(0,w).join("")+o.slice(w).join("")}const l=Math.max(0,Math.min(.999,i.revealDelay??0)),h=Math.max(0,(r-l)/(1-l)),f=Math.floor(h*a.length),u=i.tweenLength===!1?a.length:Math.round(o.length+(a.length-o.length)*r),d=Li(i.chars),m=i.refreshRate??qs,p=m>0?Math.floor(e*m/1e3):0,y=i.seed??1;let b="";for(let w=0;w<u;w++){const v=c?w>=u-f:w<f,k=c?a[a.length-(u-w)]:a[w];v&&k!==void 0||k===" "||k===`
|
|
2
|
-
`?b+=k:b+=d[Xs(y,w,p)%d.length]}return b}class be{id;name;_captions;_tracks=[];_trackPlayers=new Map;_motionPathTracks=new Map;_springTracks=new Map;_textTracks=new Map;_config;_currentTime=0;_playbackState="idle";_direction="forward";_loopIteration=0;_explicitDuration;_repeatDelayRemaining=0;_wrapAfterDelay=!1;onUpdate=null;onComplete=null;constructor(t){if(this.id=t.id,this.name=t.name,this._captions=t.captions,this._config=t.config??{},this._explicitDuration=t.config?.duration,t.tracks)for(const e of t.tracks)this.addTrack(e)}get tracks(){return[...this._tracks]}get duration(){return this._explicitDuration!==void 0?this._explicitDuration:this._calculateDuration()}setDuration(t){if(this._explicitDuration=t,t!==void 0)this._config={...this._config,duration:t};else if(this._config.duration!==void 0){const e={...this._config};delete e.duration,this._config=e}}get currentTime(){return this._currentTime}get playbackState(){return this._playbackState}get direction(){return this._direction}get loopIteration(){return this._loopIteration}get repeatDelayRemaining(){return this._repeatDelayRemaining}get speed(){return this._config.speed??1}set speed(t){this._config.speed=t}play(){const t=this.duration;this._direction==="forward"&&this._currentTime>=t&&t>0?(this._currentTime=0,this._loopIteration=0):this._direction==="reverse"&&this._currentTime<=0&&t>0&&(this._currentTime=t,this._loopIteration=0),this._playbackState="playing"}pause(){this._playbackState="paused"}stop(){this._playbackState="idle",this._repeatDelayRemaining=0,this._wrapAfterDelay=!1,this._currentTime=0,this._loopIteration=0,this._direction="forward"}seek(t){const e=this.duration>0?this.duration:1/0;this._currentTime=Math.max(0,Math.min(t,e)),this._repeatDelayRemaining=0,this._wrapAfterDelay=!1}reverse(){this._direction=this._direction==="forward"?"reverse":"forward"}tick(t){if(this._playbackState!=="playing")return;const e=this.duration;if(e<=0)return;let s=t*this.speed;if(this._repeatDelayRemaining>0){const a=Math.min(this._repeatDelayRemaining,s);if(this._repeatDelayRemaining-=a,s-=a,this._repeatDelayRemaining>0){this.onUpdate?.(this.getStateAtTime(this._currentTime));return}this._wrapAfterDelay&&(this._wrapAfterDelay=!1,this._currentTime=0)}const r=1e3;for(let a=0;a<r&&s>0&&this._playbackState==="playing";a++)if(this._direction==="forward"){const c=e-this._currentTime;if(s>=c){if(s-=c,this._currentTime=e,!this._handleEndReached())break}else this._currentTime+=s,s=0}else{const c=this._currentTime;if(s>=c){if(s-=c,this._currentTime=0,!this._handleStartReached())break}else this._currentTime-=s,s=0}const o=this.getStateAtTime(this._currentTime);this.onUpdate?.(o)}getStateAtTime(t){const e=new Map;if(this._hasSharedWrites())this._resolveShared(t,e);else for(const[n,s]of this._trackPlayers){const r=s.getTrack().property;for(const{target:o,value:a,start:c}of s.getTargetValues(t))this._write(e,n,o,r,a,t-c)}return{values:e,currentTime:this._currentTime,playbackState:this._playbackState,direction:this._direction,loopIteration:this._loopIteration}}_resolveShared(t,e){const n=new Map;for(const[s,r]of this._trackPlayers){const o=r.getTrack().property;for(const{target:a,value:c,start:l}of r.getTargetValues(t)){const h=`${a}\0${o}`,f=l<=t,u=n.get(h);(!u||(f!==u.started?f:f?l>=u.start:l<=u.start))&&n.set(h,{trackId:s,target:a,property:o,value:c,start:l,started:f})}}for(const{trackId:s,target:r,property:o,value:a,start:c}of n.values())this._write(e,s,r,o,a,t-c)}_write(t,e,n,s,r,o){if(r===void 0)return;let a=t.get(n);a||(a=new Map,t.set(n,a));const c=this._textTracks.get(e);if(c&&typeof r=="number"){a.set("text",Fi(c.textConfig,r,Math.max(0,o)));return}const l=this._motionPathTracks.get(e);if(l&&typeof r=="number"){const h=ge(l.motionPathConfig,r);a.set("motionPathX",h.x),a.set("motionPathY",h.y),l.motionPathConfig.autoRotate&&a.set("motionPathRotate",h.angle)}else a.set(s,r)}_sharedWrites=null;_hasSharedWrites(){if(this._sharedWrites===null){const t=new Set;this._sharedWrites=!1;t:for(const e of this._tracks)for(const n of Z(e)){const s=`${n}\0${e.property}`;if(t.has(s)){this._sharedWrites=!0;break t}t.add(s)}}return this._sharedWrites}addTrack(t){if(this._tracks.push(t),this._sharedWrites=null,H(t)){this._trackPlayers.set(t.id,new Ri(t));return}if(G(t)){this._trackPlayers.set(t.id,new Ii(t)),this._springTracks.set(t.id,t);return}if(It(t))this._trackPlayers.set(t.id,new Yt(t)),this._textTracks.set(t.id,t);else if(Zt(t)){const e={id:t.id,target:t.target,property:t.property,keyframes:t.keyframes,delay:t.delay,endDelay:t.endDelay,targets:t.targets,stagger:t.stagger};this._trackPlayers.set(t.id,new Yt(e)),this._motionPathTracks.set(t.id,t)}else this._trackPlayers.set(t.id,new Yt(t))}replaceTrack(t,e){const n=this._tracks.findIndex(r=>r.id===t);if(n<0)return;const s=this._tracks.slice(n+1);this.removeTrack(t);for(const r of s)this.removeTrack(r.id);this.addTrack(e);for(const r of s)this.addTrack(r)}removeTrack(t){this._tracks=this._tracks.filter(e=>e.id!==t),this._sharedWrites=null,this._trackPlayers.delete(t),this._motionPathTracks.delete(t),this._springTracks.delete(t),this._textTracks.delete(t)}getTracks(t={}){return this._tracks.filter(e=>this._matches(e,t))}removeTracks(t={}){const e=this.getTracks(t).map(n=>n.id);for(const n of e)this.removeTrack(n);return e}getTrackSpan(t){const e=this._trackPlayers.get(t);if(!e)return;const n=e.getTrack(),s=n.delay??0;if(G(n)||H(n))return{from:s,to:e.getDuration()};const r=n.keyframes;if(!(!r||r.length===0))return{from:r[0].time+s,to:e.getDuration()}}findConflicts(){const t=[];for(let e=0;e<this._tracks.length;e++){const n=this._tracks[e],s=this.getTrackSpan(n.id);if(s)for(let r=0;r<e;r++){const o=this._tracks[r];if(o.property!==n.property)continue;const a=Z(o).filter(f=>Z(n).includes(f));if(a.length===0)continue;const c=this.getTrackSpan(o.id);if(!c||!(c.from<=s.to&&s.from<=c.to))continue;const h=s.from>=c.from;for(const f of a)t.push({target:f,property:n.property,losingTrackId:h?o.id:n.id,winningTrackId:h?n.id:o.id})}}return t}_matches(t,e){if(e.id!==void 0&&t.id!==e.id||e.property!==void 0&&t.property!==e.property||e.target!==void 0&&!Z(t).includes(e.target))return!1;if(e.timeRange){const n=this.getTrackSpan(t.id);if(!n||n.to<e.timeRange.from||n.from>e.timeRange.to)return!1}return!0}toDefinition(){return{formatVersion:mt,id:this.id,name:this.name,config:{...this._config},tracks:[...this._tracks],...this.captions&&{captions:this.captions}}}get config(){return this._config}get markers(){return[...this._config.markers??[]].sort((t,e)=>t.time-e.time)}setMarkers(t){const e=t&&t.length>0?[...t].sort((s,r)=>s.time-r.time).map(s=>({...s})):void 0,n={...this._config};e?n.markers=e:delete n.markers,this._config=n}get captions(){return this._captions}setCaptions(t){const e={};for(const[n,s]of Object.entries(t??{}))e[n]={...s};this._captions=Object.keys(e).length>0?e:void 0}_armRepeatDelay(){this._repeatDelayRemaining=this._config.repeatDelay??0}_calculateDuration(){let t=0;for(const[,e]of this._trackPlayers)t=Math.max(t,e.getDuration());return t}_handleEndReached(){const t=this._config.loop??0;return t===-1||this._loopIteration<t?(this._loopIteration++,this._armRepeatDelay(),this._config.alternate?this._direction="reverse":this._repeatDelayRemaining>0?this._wrapAfterDelay=!0:this._currentTime=0,this._repeatDelayRemaining===0):(this._playbackState="idle",this.onComplete?.(),!1)}_handleStartReached(){const t=this._config.loop??0;return this._config.alternate&&(t===-1||this._loopIteration<t)?(this._loopIteration++,this._armRepeatDelay(),this._direction="forward",this._repeatDelayRemaining===0):(this._playbackState="idle",this.onComplete?.(),!1)}}const Ys=100;function ve(i,t,e,n){const s=[],r=[],{duration:o,alternate:a}=n,c=(d,m,p,y)=>{r.push([d,m]);const b=[];i.forEach((w,v)=>{(p==="forward"?(y?w>=d:w>d)&&w<=m:(y?w<=d:w<d)&&w>=m)&&b.push(v)}),b.sort((w,v)=>(p==="forward"?i[w]-i[v]:i[v]-i[w])||w-v);for(const w of b)s.push({kind:"event",index:w,direction:p})};let l=t.time,h=t.direction,f=t.fresh===!0;const u=Math.min(Ys,Math.max(0,e.iteration-t.iteration));for(let d=0;d<u;d++){const m=h==="forward"?o:0;c(l,m,h,f),s.push({kind:"repeat"}),a?(h=h==="forward"?"reverse":"forward",l=m,f=!1):(l=h==="forward"?0:o,f=!0)}return u>0&&n.holding&&!a?{crossings:s,passes:r}:(c(l,e.time,h,f),{crossings:s,passes:r})}function $i(i){return H(i)?{id:i.id,target:i.target,property:i.property,kind:"inertia",inertia:Di(i.inertia),...U(i)}:G(i)?{id:i.id,target:i.target,property:i.property,kind:"spring",spring:{...i.spring},...U(i)}:It(i)?{id:i.id,target:i.target,property:"text",textConfig:{...i.textConfig},keyframes:i.keyframes.map(we),...U(i)}:Zt(i)?{id:i.id,target:i.target,property:"motionPath",motionPathConfig:{...i.motionPathConfig},keyframes:i.keyframes.map(we),...U(i)}:{id:i.id,target:i.target,property:i.property,keyframes:i.keyframes.map(we),...U(i)}}function Di(i){return{...i,...Array.isArray(i.end)&&{end:[...i.end]}}}function we(i){return{time:i.time,value:i.value,...i.easing&&{easing:i.easing}}}function U(i){const t=i.endDelay;return{...i.delay!==void 0&&{delay:i.delay},...t!==void 0&&{endDelay:t},...i.targets!==void 0&&{targets:[...i.targets]},...i.stagger!==void 0&&{stagger:{...i.stagger}}}}function Oi(i){if(H(i)){const t=i;return{id:t.id,target:t.target,property:t.property,kind:"inertia",inertia:Di(t.inertia),...U(t)}}if(G(i)){const t=i;return{id:t.id,target:t.target,property:t.property,kind:"spring",spring:{...t.spring},...U(t)}}if(It(i)){const t=i;return{id:t.id,target:t.target,property:"text",textConfig:{...t.textConfig},keyframes:[...t.keyframes].sort((e,n)=>e.time-n.time),...U(t)}}if(i.property==="motionPath"&&"motionPathConfig"in i){const t=i,e=[...t.keyframes].sort((n,s)=>n.time-s.time);return{id:t.id,target:t.target,property:"motionPath",motionPathConfig:{...t.motionPathConfig},keyframes:e,...U(t)}}return Xt({id:i.id,target:i.target,property:i.property,keyframes:i.keyframes,...U(i)})}function Ni(i){const t=i._config.markers;return{formatVersion:mt,id:i.id,name:i.name,config:{duration:i.duration>0?i.duration:void 0,loop:i._config.loop,speed:i._config.speed,alternate:i._config.alternate,repeatDelay:i._config.repeatDelay,...t&&{markers:t.map(e=>({...e}))}},tracks:i.tracks.map($i),...i.captions&&{captions:JSON.parse(JSON.stringify(i.captions))}}}function ct(i){const t=i.formatVersion??1;if(t>mt)throw new Error(`tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${mt}. Update tinyfly to play it.`);return new be({id:i.id,name:i.name,config:i.config,tracks:i.tracks.map(Oi),captions:i.captions})}function Vs(i){return JSON.stringify(Ni(i))}function Ws(i){const t=JSON.parse(i);return ct(t)}function Us(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i.charCodeAt(e),t=Math.imul(t,16777619);return t>>>0}function Bi(i){let t=i>>>0||2654435769;return{seed:i>>>0,next(){return t^=t<<13,t>>>=0,t^=t>>17,t^=t<<5,t>>>=0,t/4294967296}}}function Te(i,t,e){return t+i.next()*(e-t)}function qi(i,t,e,n){if(n<=0)return Te(i,t,e);const s=Math.floor((e-t)/n),r=Math.round(i.next()*s);return t+r*n}function js(i,t){if(t.length!==0)return t[Math.floor(i.next()*t.length)]}const Xi=/^([+\-*/])=\s*(-?[\d.]+)$/,Yi=/^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;function zs(i){return typeof i!="string"?!1:Xi.test(i.trim())||Yi.test(i.trim())}function ke(i,t={}){if(typeof i!="string")return i;const e=i.trim(),n=Xi.exec(e);if(n){const[,r,o]=n,a=t.base??0,c=Number.parseFloat(o);switch(r){case"+":return a+c;case"-":return a-c;case"*":return a*c;case"/":return c===0?a:a/c}}const s=Yi.exec(e);if(s){if(!t.random)throw new Error(`resolveValue: "${e}" needs a random source — pass one via context.random`);const r=Number.parseFloat(s[1]),o=Number.parseFloat(s[2]),a=s[3]!==void 0?Number.parseFloat(s[3]):void 0;return a!==void 0?qi(t.random,r,o,a):Te(t.random,r,o)}return i}function Vi(i,t=0,e){const n=[];let s=t;for(const r of i){const o=ke(r,{base:s,random:e});n.push(o),typeof o=="number"&&(s=o)}return n}class Hs{random;constructor(t){this.random=Bi(t)}get seed(){return this.random.seed}resolve(t,e=0){return ke(t,{base:e,random:this.random})}resolveSequence(t,e=0){return Vi(t,e,this.random)}}const Gs=600;function Wi(i){if(Array.isArray(i)){const[u,d,m,p]=i;return{fn:zi(u,d,m,p),bezier:[u,d,m,p]}}const{segments:t}=J(i);if(t.length===0)throw new Error(`customEase: no curve in "${i}"`);const e=t[0].startX,n=t[0].startY,s=t[t.length-1],r=s.endX-e,o=s.endY-n;if(r===0||o===0)throw new Error(`customEase: "${i}" must move along both axes`);const a=u=>(u-e)/r,c=u=>(u-n)/o;if(t.length===1&&s.type==="C"){const[u,d,m,p]=s.points,y=[a(u),c(d),a(m),c(p)];return{fn:zi(...y),bezier:y}}const l=[],h=[],f=Math.max(8,Math.ceil(Gs/t.length));for(const u of t)for(let d=l.length===0?0:1;d<=f;d++){const[m,p]=Ks(u,d/f);l.push(a(m)),h.push(c(p))}return{fn:Qs(l,h)}}function Ui(i={}){const e=.1+Math.max(0,Math.min(1,i.strength??.7))*.7,n=[1];for(let r=e;r>.002;r*=e)n.push(2*Math.sqrt(r));const s=n.reduce((r,o)=>r+o,0);return r=>{if(r<=0)return 0;if(r>=1)return 1;let o=r*s;for(let a=0;a<n.length;a++){if(o<=n[a]){if(a===0)return(o/n[0])**2;const c=n[a]/2,l=c*c,h=o-c;return 1-(l-h*h)}o-=n[a]}return 1}}function ji(i={}){const t=Math.max(1,i.wiggles??10),e=i.type??"easeOut",n=s=>e==="uniform"?1:e==="easeInOut"?Math.sin(Math.PI*s):(1-s)**2;return s=>s<=0||s>=1?0:Math.sin(s*t*Math.PI*2)*n(s)}function Ks(i,t){if(i.type==="L"){const[l,h]=i.points;return[i.startX+(l-i.startX)*t,i.startY+(h-i.startY)*t]}const[e,n,s,r,o,a]=i.points,c=1-t;return[c*c*c*i.startX+3*c*c*t*e+3*c*t*t*s+t*t*t*o,c*c*c*i.startY+3*c*c*t*n+3*c*t*t*r+t*t*t*a]}function Qs(i,t){return e=>{if(e<=i[0])return t[0];if(e>=i[i.length-1])return t[t.length-1];let n=0,s=i.length-1;for(;s-n>1;){const o=n+s>>1;i[o]<=e?n=o:s=o}const r=i[s]-i[n];return r===0?t[s]:t[n]+(e-i[n])/r*(t[s]-t[n])}}function zi(i,t,e,n){const s=(o,a,c)=>3*(1-o)*(1-o)*o*a+3*(1-o)*o*o*c+o*o*o,r=(o,a,c)=>3*(1-o)*(1-o)*a+6*(1-o)*o*(c-a)+3*o*o*(1-c);return o=>{if(o<=0)return 0;if(o>=1)return 1;let a=o;for(let h=0;h<8;h++){const f=s(a,i,e)-o,u=r(a,i,e);if(Math.abs(f)<1e-6)return s(a,t,n);if(Math.abs(u)<1e-6)break;a-=f/u}let c=0,l=1;a=o;for(let h=0;h<40;h++)s(a,i,e)<o?c=a:l=a,a=(c+l)/2;return s(a,t,n)}}const j=i=>Math.round(i*1e3)/1e3;function Hi(i,t={}){if(i.length===0)return"";const e=t.curviness??1,n=t.closed??!1,s=i.length;let r=`M${j(i[0].x)} ${j(i[0].y)}`;if(s===1)return r;const o=c=>n?i[(c%s+s)%s]:i[Math.max(0,Math.min(s-1,c))],a=n?s:s-1;for(let c=0;c<a;c++){const l=o(c-1),h=o(c),f=o(c+1),u=o(c+2);if(e===0){r+=` L${j(f.x)} ${j(f.y)}`;continue}const d=e/6,m=h.x+(f.x-l.x)*d,p=h.y+(f.y-l.y)*d,y=f.x-(u.x-h.x)*d,b=f.y-(u.y-h.y)*d;r+=` C${j(m)} ${j(p)} ${j(y)} ${j(b)} ${j(f.x)} ${j(f.y)}`}return n?`${r} Z`:r}const F=(i,t=0)=>{const e=parseFloat(i??"");return Number.isFinite(e)?e:t};function Zs(i){const t=(i??"").trim().split(/[\s,]+/).filter(Boolean).map(Number),e=[];for(let n=0;n+1<t.length;n+=2)e.push({x:t[n],y:t[n+1]});return e}function Vt(i){const t=i.attributes;switch(i.tag.toLowerCase()){case"path":return t.d??null;case"circle":case"ellipse":{const e=F(t.cx),n=F(t.cy),s=i.tag.toLowerCase()==="circle"?F(t.r):F(t.rx),r=i.tag.toLowerCase()==="circle"?F(t.r):F(t.ry);return`M${e+s} ${n} A${s} ${r} 0 1 1 ${e-s} ${n} A${s} ${r} 0 1 1 ${e+s} ${n} Z`}case"rect":{const e=F(t.x),n=F(t.y),s=F(t.width),r=F(t.height);let o=t.rx!=null?F(t.rx):t.ry!=null?F(t.ry):0,a=t.ry!=null?F(t.ry):o;return o=Math.min(o,s/2),a=Math.min(a,r/2),o===0||a===0?`M${e} ${n} H${e+s} V${n+r} H${e} Z`:`M${e+o} ${n} H${e+s-o} A${o} ${a} 0 0 1 ${e+s} ${n+a} V${n+r-a} A${o} ${a} 0 0 1 ${e+s-o} ${n+r} H${e+o} A${o} ${a} 0 0 1 ${e} ${n+r-a} V${n+a} A${o} ${a} 0 0 1 ${e+o} ${n} Z`}case"line":return`M${F(t.x1)} ${F(t.y1)} L${F(t.x2)} ${F(t.y2)}`;case"polyline":case"polygon":{const e=Zs(t.points);if(e.length===0)return null;const n=e.map((s,r)=>`${r===0?"M":"L"}${s.x} ${s.y}`).join(" ");return i.tag.toLowerCase()==="polygon"?`${n} Z`:n}default:return null}}const Wt={"power1.in":[.55,.085,.68,.53],"power1.out":[.25,.46,.45,.94],"power1.inout":[.455,.03,.515,.955],"power2.in":[.55,.055,.675,.19],"power2.out":[.215,.61,.355,1],"power2.inout":[.645,.045,.355,1],"power3.in":[.895,.03,.685,.22],"power3.out":[.165,.84,.44,1],"power3.inout":[.77,0,.175,1],"power4.in":[.755,.05,.855,.06],"power4.out":[.23,1,.32,1],"power4.inout":[.86,0,.07,1],"sine.in":[.47,0,.745,.715],"sine.out":[.39,.575,.565,1],"sine.inout":[.445,.05,.55,.95],"expo.in":[.95,.05,.795,.035],"expo.out":[.19,1,.22,1],"expo.inout":[1,0,0,1],"circ.in":[.6,.04,.98,.335],"circ.out":[.075,.82,.165,1],"circ.inout":[.785,.135,.15,.86],"back.in":[.6,-.28,.735,.045],"back.out":[.175,.885,.32,1.275],"back.inout":[.68,-.55,.265,1.55]},Gi={none:"linear",linear:"linear","linear.none":"linear","power1.in":"ease-in-quad","power1.out":"ease-out-quad","power1.inout":"ease-in-out-quad","power2.in":"ease-in-cubic","power2.out":"ease-out-cubic","power2.inout":"ease-in-out-cubic"};function Js(i){let t=i.trim().toLowerCase();t=t.replace(/\.ease(in|out|inout)$/,".$1");const e=/^([a-z]+\d?)(\(.*\))?$/.exec(t);return e&&e[1]!=="steps"&&t!=="none"&&t!=="linear"&&(t=`${e[1]}.out${e[2]??""}`),t}V({type:"bounce",mode:"in"}),V({type:"bounce",mode:"in-out"});function Mt(i){const t=Ki.get(i.trim().toLowerCase());if(t)return t;const e=Js(i),n=/^steps\(\s*(\d+)\s*\)$/.exec(e);if(n){const o={type:"steps",count:Math.max(1,Number.parseInt(n[1],10))+1,position:"none"};return{easing:o,fn:V(o)}}const s=/^(elastic|bounce|back)\.(in|out|inout)(?:\(([^)]*)\))?$/.exec(e);if(s){const[,r,o,a]=s,c=(a??"").split(",").map(f=>Number.parseFloat(f)).filter(f=>Number.isFinite(f)),l=o==="inout"?"in-out":o;if(r==="back"&&c.length===0&&e in Wt)return{easing:{type:"cubic-bezier",points:Wt[e]}};const h=r==="elastic"?{type:"elastic",mode:l,...c[0]!==void 0&&{amplitude:c[0]},...c[1]!==void 0&&{period:c[1]}}:r==="bounce"?{type:"bounce",mode:l}:{type:"back",mode:l,...c[0]!==void 0&&{overshoot:c[0]}};return{easing:h,fn:V(h)}}return e in Gi?{easing:Gi[e]}:e in Wt?{easing:{type:"cubic-bezier",points:Wt[e]}}:{easing:"ease-out"}}const Ki=new Map;function Se(i,t){return Ki.set(i.trim().toLowerCase(),t.bezier?{easing:{type:"cubic-bezier",points:t.bezier},fn:t.fn}:{fn:t.fn,requiresBaking:"custom"}),i}function Me(i){let t=i>>>0;return()=>{t=t+1831565813>>>0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}const Qi=/^\s*random\(\s*(\[.*\]|[^)]*)\s*\)\s*$/;function Zi(i){return typeof i=="string"&&Qi.test(i)}function tr(i=1){let t=Me(i);const e=(c,l)=>((...h)=>h.length>=c?l(...h):f=>l(...h,f)),n=(c,l,h)=>Math.min(Math.max(h,Math.min(c,l)),Math.max(c,l)),s=(c,l,h,f,u)=>l===c?h:h+(u-c)/(l-c)*(f-h),r=(c,l)=>{if(typeof c=="number")return c===0?l:Math.round(l/c)*c;if(Array.isArray(c))return Ji(c,l,1/0);if("values"in c)return Ji(c.values,l,c.radius??1/0);const h=Math.round(l/c.increment)*c.increment;return Math.abs(h-l)<=(c.radius??1/0)?h:l},o=(c,l,h)=>{const f=c+t()*(l-c);return h?Math.round(f/h)*h:f};return{clamp:e(3,n),mapRange:e(5,s),normalize:e(3,(c,l,h)=>s(c,l,0,1,h)),interpolate:e(3,(c,l,h)=>{if(typeof c=="object"&&!Array.isArray(c)){const f={};for(const u of Object.keys(c))f[u]=St(c[u])(c[u],l[u],h);return f}return St(c)(c,l,h)}),wrap:((c,l,h)=>{if(Array.isArray(c)){const p=c,y=b=>p[(Math.round(b)%p.length+p.length)%p.length];return l===void 0?y:y(l)}const f=c,d=l-f,m=p=>d===0?f:((p-f)%d+d)%d+f;return h===void 0?m:m(h)}),wrapYoyo:e(3,(c,l,h)=>{const f=l-c;if(f===0)return c;const u=((h-c)%(f*2)+f*2)%(f*2);return c+(u>f?f*2-u:u)}),snap:e(2,r),random:((c,l,h,f)=>{if(Array.isArray(c)){const d=()=>c[Math.floor(t()*c.length)];return l===!0?d:d()}const u=()=>o(c,l,h);return f?u:u()}),shuffle:c=>{for(let l=c.length-1;l>0;l--){const h=Math.floor(t()*(l+1));[c[l],c[h]]=[c[h],c[l]]}return c},distribute:({base:c=0,amount:l,each:h,from:f="start",ease:u})=>(d,m,p)=>{const y=p.length,w=Rt(d,y,{...l!==void 0?{amount:l}:{each:h??1},from:f}),v=l!==void 0?l:(h??1)*te(y,f),k=u&&v>0?u(w/v)*v:w;return c+k},pipe:(...c)=>l=>c.reduce((h,f)=>f(h),l),splitColor:c=>er(c),getUnit:c=>typeof c=="number"?"":/^-?[\d.]+(?:e[-+]?\d+)?([a-z%]*)$/i.exec(c.trim())?.[1]??"",seed:c=>{t=Me(c)},resolveRandomString:c=>{const l=Qi.exec(c)?.[1]??"";if(l.startsWith("[")){const m=l.slice(1,-1).split(",").map(p=>p.trim()).filter(Boolean).map(p=>Number.isFinite(Number(p))?Number(p):p.replace(/^['"]|['"]$/g,""));return m[Math.floor(t()*m.length)]}const[h,f,u]=l.split(",").map(d=>Number.parseFloat(d));return o(h,f,Number.isFinite(u)?u:void 0)}}}function Ji(i,t,e){let n=t,s=1/0;for(const r of i){const o=Math.abs(r-t);o<s&&(s=o,n=r)}return s<=e?n:t}function er(i){const t=i.trim(),e=/^#([0-9a-f]{3,8})$/i.exec(t)?.[1];if(e){const r=(e.length<=4?[...e].map(o=>o+o).join(""):e).match(/../g).map(o=>Number.parseInt(o,16));return r.length>=4?[r[0],r[1],r[2],Math.round(r[3]/255*1e3)/1e3]:[r[0],r[1],r[2]]}const n=(/rgba?\(([^)]+)\)/i.exec(t)?.[1]??"0,0,0").split(/[\s,/]+/).filter(Boolean).map(s=>Number.parseFloat(s));return n.length>=4?[n[0],n[1],n[2],n[3]]:[n[0]??0,n[1]??0,n[2]??0]}const ir=/^([+-])=\s*(-?[\d.]+)$/,nr=/^([<>])\s*(?:([+-])?=?\s*(-?[\d.]+))?$/;function At(i,t){const e=t.scale??1,n=l=>Number.parseFloat(l)*e;if(i===void 0)return t.cursor;if(typeof i=="number")return i*e;const s=i.trim();if(s==="")return t.cursor;const r=ir.exec(s);if(r){const l=n(r[2]);return t.cursor+(r[1]==="-"?-l:l)}const o=nr.exec(s);if(o){const l=o[1]==="<"?t.previousStart:t.previousEnd;if(o[3]===void 0)return l;const h=n(o[3]);return l+(o[2]==="-"?-h:h)}const a=/^(.+?)([+-])=\s*(-?[\d.]+)$/.exec(s);if(a){const l=t.labels.get(a[1].trim());if(l!==void 0){const h=n(a[3]);return l+(a[2]==="-"?-h:h)}}const c=t.labels.get(s);return c!==void 0?c:/^-?[\d.]+$/.test(s)?n(s):t.cursor}function sr(i){if(typeof i!="object"||i===null)return!1;const t=i;return t.grid!==void 0||t.from==="random"||Array.isArray(t.from)||t.ease!==void 0||t.axis!==void 0}function rr(i,t,e={}){if(i===0)return[];const n=t.grid==="auto"?Math.max(1,Math.min(i,e.columnsFromLayout?.()??i)):Array.isArray(t.grid)?Math.max(1,t.grid[1]):i,s=Array.isArray(t.grid)?Math.max(1,t.grid[0]):Math.ceil(i/n),r=m=>({x:m%n,y:Math.floor(m/n)}),o=t.from??"start",a=Array.isArray(o)?{x:o[0]*(n-1),y:o[1]*(s-1)}:typeof o=="number"?r(Math.max(0,Math.min(i-1,o))):o==="end"?r(i-1):o==="center"||o==="edges"?{x:(n-1)/2,y:(s-1)/2}:{x:0,y:0},c=m=>{const{x:p,y}=r(m),b=Math.abs(p-a.x),w=Math.abs(y-a.y);return t.axis==="x"?b:t.axis==="y"?w:Math.hypot(b,w)};let l=Array.from({length:i},(m,p)=>c(p));const h=Math.max(...l);if(o==="edges"&&(l=l.map(m=>h-m)),o==="random"){const m=e.random??Math.random;l=l.map(()=>m()*h)}const f=t.amount!==void 0?t.amount:(t.each??0)*h,u=t.ease?Mt(t.ease):void 0,d=u?u.fn??V(u.easing):void 0;return l.map(m=>{const p=h===0?0:m/h;return(d?d(p):p)*f})}const Ae=new Set(["duration","delay","ease","repeat","repeatDelay","yoyo","stagger","onComplete","onUpdate","onStart","onRepeat","onReverseComplete","repeatRefresh","keyframes","easeEach","scrollTo","id","immediateRender","overwrite","paused","scrollTrigger","spring"]);function Ut(i){const t={},e={};for(const[n,s]of Object.entries(i))Ae.has(n)?t[n]=s:e[n]=s;return{config:t,properties:e}}function jt(i,t){return i===void 0?t:i*1e3}function xe(i,t){if(i!==void 0)return typeof i=="number"?{each:i*1e3}:sr(i)?{offsets:rr(t?.count??0,i,t??{}).map(n=>n*1e3)}:{...i.each!==void 0&&{each:i.each*1e3},...i.amount!==void 0&&{amount:i.amount*1e3},...i.from!==void 0&&{from:i.from}}}const or={opacity:1,x:0,y:0,z:0,rotate:0,rotateX:0,rotateY:0,rotateZ:0,rotation:0,scale:1,scaleX:1,scaleY:1,scaleZ:1,skewX:0,skewY:0,originX:50,originY:50,perspective:0,blur:0,glow:0,clipTop:0,clipRight:0,clipBottom:0,clipLeft:0};function tn(i){return or[i]}function ar(i){const t=typeof i=="string"||Array.isArray(i)?{path:i}:i;if(!t||typeof t.path!="string"&&!Array.isArray(t.path))throw new Error("gsap-compat: motionPath needs a path — SVG path data or an array of { x, y } points.");let e;if(Array.isArray(t.path))e=Hi(t.path,{curviness:t.curviness});else if(ot(t.path))e=t.path;else throw new Error(`gsap-compat: motionPath "${t.path}" is not path data. Selectors and elements are resolved by live.to(); timeline() and tf need the path data itself.`);const n={pathData:e};return t.autoRotate!==void 0&&t.autoRotate!==!1&&(n.autoRotate=!0,typeof t.autoRotate=="number"&&(n.rotateOffset=t.autoRotate)),t.matrix&&(n.matrix=t.matrix),{config:n,start:t.start??0,end:t.end??1}}function cr(i){const t=typeof i=="string"||Array.isArray(i)?{path:i}:{...i};return{...t,start:t.end??1,end:t.start??0}}function en(i){return typeof i=="object"&&i!==null&&"shape"in i?i.shape:i}function lr(i){if(i.morphSVG===void 0)return i;const{morphSVG:t,...e}=i,n=en(t);if(typeof n!="string"||!ot(n))throw new Error(`gsap-compat: morphSVG "${String(n)}" is not path data. Selectors and elements are resolved by live.to(); timeline() and tf need the path data itself.`);return{...e,d:n}}function hr(i,t){if(i===!0)return[0,t];if(i===!1)return[0,0];if(typeof i=="number")return[0,nn(i,t)];const e=i.trim().split(/[\s,]+/).filter(Boolean),n=o=>{const a=Number.parseFloat(o);if(Number.isNaN(a))throw new Error(`gsap-compat: drawSVG "${i}" is not a length or percentage`);return nn(o.endsWith("%")?t*a/100:a,t)};if(e.length===0)return[0,t];if(e.length===1)return[0,n(e[0])];const s=n(e[0]),r=n(e[1]);return s<=r?[s,r]:[r,s]}function ur(i,t){const[e,n]=hr(i,t);return{strokeDasharray:[n-e,t],strokeDashoffset:-e}}function fr(i,t){if(i.drawSVG===void 0)return i;const{drawSVG:e,...n}=i;return{...n,...ur(e,t)}}function dr(i){if(i.drawSVG!==void 0)throw new Error("gsap-compat: drawSVG needs the stroke length from the page. Use live.to(), or animate strokeDasharray / strokeDashoffset directly (see drawSvgProperties).");return i}function nn(i,t){return Math.max(0,Math.min(t,i))}function pr(i){let t=2166136261;for(let e=0;e<i.length;e++)t=Math.imul(t^i.charCodeAt(e),16777619);return t>>>0}function mr(i,t,e){if(i.scrambleText!==void 0){const n=i.scrambleText,s=typeof n=="string"?{text:n}:n;if(typeof s?.text!="string")throw new Error("gsap-compat: scrambleText needs the text to end on — a string, or { text }.");const r=s.revealDelay&&e>0?s.revealDelay*1e3/e:void 0;return{to:s.text,mode:"scramble",...s.chars!==void 0&&{chars:s.chars},...s.speed!==void 0&&{refreshRate:20*s.speed},...r!==void 0&&{revealDelay:Math.min(r,.999)},...s.tweenLength!==void 0&&{tweenLength:s.tweenLength},...s.rightToLeft!==void 0&&{rightToLeft:s.rightToLeft},seed:s.seed??pr(`${t}|${s.text}`)}}if(i.text!==void 0){const n=i.text,s=typeof n=="string"?{value:n}:n;if(typeof s?.value!="string")throw new Error("gsap-compat: text needs the text to end on — a string, or { value }.");return{to:s.value,mode:"type",...s.rightToLeft!==void 0&&{rightToLeft:s.rightToLeft}}}}function Ee(i){return Math.max(.1,i/25)}function gr(i,t){const e=typeof t=="number"?{velocity:t}:t;if(typeof e?.velocity!="number"||!Number.isFinite(e.velocity))throw new Error("gsap-compat: inertia needs a velocity for each property — a number, or { velocity }.");const n=e.friction??(e.resistance!==void 0?Ee(e.resistance):void 0),s={from:i,velocity:e.velocity,...n!==void 0&&{friction:n},...e.min!==void 0&&{min:e.min},...e.max!==void 0&&{max:e.max}};return typeof e.end=="function"?s.end=[e.end(bt(s))]:e.end!==void 0&&(s.end=Array.isArray(e.end)?[...e.end]:e.end),s}function yr(i){const t=i===!0?{}:typeof i=="string"?{preset:i}:i;if(t.preset!==void 0&&!(t.preset in $t))throw new Error(`gsap-compat: unknown spring preset "${t.preset}" — use one of ${Object.keys($t).join(", ")}`);return{...t.preset?$t[t.preset]:{},...t.stiffness!==void 0&&{stiffness:t.stiffness},...t.damping!==void 0&&{damping:t.damping},...t.mass!==void 0&&{mass:t.mass},...t.restDelta!==void 0&&{restDelta:t.restDelta}}}function br(i,t){if(i===!0||typeof i=="string")return;const e=i.velocity;return typeof e=="number"?e:e?.[t]}class tt{timeline;options;cursor=0;fallbackRandom=Me(1);previousStart=0;previousEnd=0;labels=new Map;trackCounter=0;lastValues=new Map;constructor(t={}){this.options=t,this.timeline=new be({id:t.id??"gsap-compat",name:t.name,config:{...t.repeat!==void 0&&{loop:t.repeat},...t.yoyo!==void 0&&{alternate:t.yoyo},...t.repeatDelay!==void 0&&{repeatDelay:t.repeatDelay*1e3},...t.timeScale!==void 0&&{speed:t.timeScale}}})}to(t,e,n){return this.build(t,void 0,xt(e),n)}from(t,e,n){const{config:s,properties:r}=Ut(xt(e)),{motionPath:o,text:a,scrambleText:c,...l}=r,h=this.targetsOf(t)[0],f={...s};for(const m of Object.keys(l))f[m]=this.resolveStart(h,m);o!==void 0&&(f.motionPath=cr(o));const u={},d=String(this.resolveStart(h,"text"));return a!==void 0&&(u.text=Pe(a),f.text=typeof a=="object"?{...a,value:d}:d),c!==void 0&&(u.text=Pe(c),f.scrambleText=typeof c=="object"?{...c,text:d}:d),this.build(t,{...l,...u},f,n)}fromTo(t,e,n,s){const{properties:r}=Ut(xt(e));return this.build(t,r,xt(n),s)}set(t,e,n){return this.build(t,void 0,{...xt(e),duration:0},n)}get lastStart(){return this.previousStart}get lastEnd(){return this.previousEnd}addEvent(t){const e=Math.max(0,At(t,this.context()));return this.previousStart=e,this.previousEnd=e,this.cursor=Math.max(this.cursor,e),e}timeOf(t){return At(t,this.context())}addLabel(t,e){return this.labels.set(t,At(e,this.context())),this}labelTimes(){return[...this.labels.values()].sort((t,e)=>t-e)}labelTime(t){return this.labels.get(t)}add(t,e){const n=At(e,this.context());for(const r of t.timeline.tracks){if(!("keyframes"in r))continue;const o=Xt({...r,id:this.nextTrackId(`nested-${r.id}`),keyframes:r.keyframes.map(a=>({...a,time:a.time+n}))});this.timeline.addTrack(o)}const s=n+t.timeline.duration;return this.previousStart=n,this.previousEnd=s,this.cursor=Math.max(this.cursor,s),this}play(){return this.timeline.play(),this}pause(){return this.timeline.pause(),this}restart(){return this.timeline.stop(),this.timeline.play(),this}reverse(){return this.timeline.reverse(),this}kill(){return this.timeline.removeTracks(),this}reset(){return this.timeline.removeTracks(),this.cursor=0,this.previousStart=0,this.previousEnd=0,this.labels.clear(),this.lastValues.clear(),this.trackCounter=0,this}seek(t){if(typeof t=="string"){const e=this.labels.get(t);return e!==void 0&&this.timeline.seek(e),this}return this.timeline.seek(t*1e3),this}progress(t){const e=this.timeline.duration;return t!==void 0&&e>0&&this.timeline.seek(t*e),e>0?this.timeline.currentTime/e:0}timeScale(t){return t!==void 0&&(this.timeline.speed=t),this.timeline.speed}duration(){return this.timeline.duration/1e3}tick(t){return this.timeline.tick(t),this}toDefinition(){return this.timeline.toDefinition()}build(t,e,n,s){const{config:r,properties:o}=Ut(n),{motionPath:a,text:c,scrambleText:l,inertia:h,...f}=o,u=this.targetsOf(t),d=At(s,this.context()),m=jt(r.delay,0),p=jt(r.duration,500),y=xe(r.stagger,{count:u.length,columnsFromLayout:this.options.layoutColumns?()=>this.options.layoutColumns(u):void 0,random:this.options.random??this.fallbackRandom}),b=this.easingFor(r.ease),w=[],v=r.spring;let k=0,T=!1;for(const[M,C]of Object.entries(f)){const P=C;let _=e?.[M]!==void 0?e[M]:this.resolveStart(u[0],M);if(typeof _!=typeof P&&(this.warn(`no usable start value for "${M}" on "${u[0]}" — it will snap to ${String(P)}. Use fromTo() to animate it.`),_=P),v!==void 0&&(typeof _!="number"||typeof P!="number")&&this.warn(`spring works on numbers, so "${M}" on "${u[0]}" eases instead`),v!==void 0&&typeof _=="number"&&typeof P=="number"){const $={...yr(v),from:_,to:P,velocity:br(v,M)??this.options.startVelocity?.(u[0],M)??0},B=this.nextTrackId(`${u[0]}-${M}-spring`),N={id:B,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:M,kind:"spring",spring:$,delay:d+m};this.timeline.addTrack(N),w.push(B),k=Math.max(k,Ge($));for(const L of u)this.lastValues.set(`${L}|${M}`,P);continue}T=!0;const x=this.keyframesFor(_,P,p,b,r.ease),R=this.nextTrackId(`${u[0]}-${M}`);this.timeline.addTrack(Xt({id:R,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:M,delay:d+m,keyframes:x})),w.push(R);for(const $ of u)this.lastValues.set(`${$}|${M}`,P)}const S=mr({text:c,scrambleText:l},u[0],p);if(S){const M=e?.text??e?.scrambleText,C=M!==void 0?Pe(M):this.resolveStart(u[0],"text"),P=this.nextTrackId(`${u[0]}-text`),_={id:P,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:"text",textConfig:{from:typeof C=="string"?C:String(C??""),...S},delay:d+m,keyframes:this.keyframesFor(0,1,p,b,r.ease)};this.timeline.addTrack(_),w.push(P);for(const x of u)this.lastValues.set(`${x}|text`,S.to)}if(a!==void 0){const{config:M,start:C,end:P}=ar(a),_=this.nextTrackId(`${u[0]}-motionPath`),x={id:_,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:"motionPath",motionPathConfig:M,delay:d+m,keyframes:this.keyframesFor(C,P,p,b,r.ease)};this.timeline.addTrack(x),w.push(_)}if(h!==void 0)for(const[M,C]of Object.entries(h)){const P=this.resolveStart(u[0],M);if(typeof P!="number"){this.warn(`inertia on "${M}" needs a numeric start value; skipped`);continue}const _=gr(P,C),x=this.nextTrackId(`${u[0]}-${M}-inertia`),R={id:x,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:M,kind:"inertia",inertia:_,delay:d+m};this.timeline.addTrack(R),w.push(x),k=Math.max(k,st(_));for(const $ of u)this.lastValues.set(`${$}|${M}`,nt(_))}const O=((h!==void 0||v!==void 0)&&!T&&!S&&a===void 0?k:Math.max(p,k))+(y&&u.length>1?gt(u.length,y):0),E=d+m+O;return this.previousStart=d+m,this.previousEnd=E,this.cursor=Math.max(this.cursor,E),{trackIds:w,start:d+m,end:E,kill:()=>{for(const M of w)this.timeline.removeTrack(M)}}}keyframesFor(t,e,n,s,r){const o={time:0,value:t};if(n<=0)return[{time:0,value:e}];const a=typeof r=="string"?Mt(r):void 0;if(a?.requiresBaking==="custom"||this.options.bakeEases&&pt(s)){const l=a?.fn??V(s);return[o,...me(o,{time:n,value:e},l,{intervalMs:this.options.bakeIntervalMs})]}return[o,{time:n,value:e,...s&&{easing:s}}]}resolveStart(t,e){const n=this.lastValues.get(`${t}|${e}`);if(n!==void 0)return n;const s=this.options.startValue?.(t,e);if(s!==void 0)return s;const r=this.options.defaults?.[e];if(r!==void 0)return r;if(e==="text")return"";if(e==="d")throw new Error(`gsap-compat: no starting shape for "${t}". Use fromTo({ d: … }, { morphSVG: … }), or live.to(), which reads the element's current shape.`);const o=tn(e);return o!==void 0?(this.warn(`no start value for "${e}" on "${t}" — using the static default ${o}. GSAP would read the live DOM here; tinyfly cannot, so pass an explicit fromTo() or a defaults map.`),o):(this.warn(`no start value or default for "${e}" on "${t}" — using 0`),0)}easingFor(t){if(t!==void 0){if(typeof t=="string")return Mt(t).easing;if(typeof t=="function")throw new Error('gsap-compat: function eases cannot be serialized. Use a named ease, or a cubic-bezier via { type: "cubic-bezier", points: [...] }.');return t}}targetsOf(t){return Array.isArray(t)?t:[t]}context(){return{cursor:this.cursor,previousStart:this.previousStart,previousEnd:this.previousEnd,labels:this.labels,scale:1e3}}nextTrackId(t){return this.trackCounter+=1,`${t}-${this.trackCounter}`}warn(t){this.options.onWarning?.(`gsap-compat: ${t}`)}}function Pe(i){if(typeof i=="string")return i;if(i&&typeof i=="object"){const t=i;return String(t.value??t.text??"")}return String(i??"")}function vr(i){return new tt(i)}function xt(i){return dr(lr(i))}const wr=new Set(["blur","brightness","glow","glowColor","shadowX","shadowY","shadowBlur","shadowColor"]),Tr="#ffffff",kr="rgba(0, 0, 0, 0.5)";function Sr(i){const t=[];if(i.blur!==void 0&&t.push(`blur(${Math.max(0,i.blur)}px)`),i.brightness!==void 0&&t.push(`brightness(${Math.max(0,i.brightness)})`),i.glow!==void 0&&t.push(`drop-shadow(0 0 ${Math.max(0,i.glow)}px ${i.glowColor??Tr})`),i.shadowX!==void 0||i.shadowY!==void 0||i.shadowBlur!==void 0){const e=i.shadowX??0,n=i.shadowY??0,s=Math.max(0,i.shadowBlur??0);t.push(`drop-shadow(${e}px ${n}px ${s}px ${i.shadowColor??kr})`)}return t.length>0?t.join(" "):null}function Mr(i,t){const e=i.childNodes.length===1?i.firstChild:null;if(e&&e.nodeType===3){const n=e;n.data!==t&&(n.data=t);return}i.textContent!==t&&(i.textContent=t)}function Ar(i){if(!("ownerSVGElement"in i))return;const t=i.style;!t||t.transformBox||(t.transformBox="fill-box",t.transformOrigin||(t.transformOrigin="50% 50%"))}const sn=new Set(["width","height","top","right","bottom","left","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","borderRadius","borderWidth","fontSize","lineHeight","letterSpacing","outlineWidth","gap","rowGap","columnGap"]),xr=new Set(["x","y","z","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skewX","skewY","motionPathX","motionPathY","motionPathRotate"]),Er=new Set(["originX","originY"]),Pr=new Set(["clipTop","clipRight","clipBottom","clipLeft"]),Cr={fill:"backgroundColor",stroke:"borderColor",strokeWidth:"borderWidth",color:"color",backgroundColor:"backgroundColor",borderColor:"borderColor"},rn={fill:"fill",stroke:"stroke",strokeWidth:"strokeWidth",strokeDasharray:"strokeDasharray",strokeDashoffset:"strokeDashoffset",fillOpacity:"fillOpacity",strokeOpacity:"strokeOpacity"},_r="http://www.w3.org/2000/svg";class et{targets=new Map;registerTarget(t,e){this.targets.set(t,e)}unregisterTarget(t){this.targets.delete(t)}getTarget(t){return this.targets.get(t)}clearTargets(){this.targets.clear()}applyState(t){for(const[e,n]of t.values){const s=this.targets.get(e);s&&this.applyProperties(s,n)}}applyProperties(t,e){const n=[];let s=null,r=null,o=null;const a=e.has("motionPathX"),c=e.has("motionPathY"),l=e.has("motionPathRotate");for(const[u,d]of e)if(!(u==="x"&&a)&&!(u==="y"&&c)&&!((u==="rotate"||u==="rotateZ")&&l)){if(xr.has(u)){const m=this.buildTransformPart(u,d);m&&n.push(m)}else if(Er.has(u))typeof d=="number"&&((s??={})[u]=d);else if(Pr.has(u))typeof d=="number"&&((r??={})[u]=d);else if(wr.has(u))(o??={})[u]=d;else if(u!=="perspective"){if(u!=="shine")if(u==="text"&&typeof d=="string")Mr(t,d);else if(u==="d"&&typeof d=="string"){const m=t;(m.tagName?.toLowerCase()==="path"?m:m.querySelector?.("path"))?.setAttribute?.("d",d)}else this.applyStyleProperty(t,u,d)}}const h=e.get("shine");typeof h=="number"&&this.applyShine(t,h);const f=e.get("perspective");if(typeof f=="number"&&n.unshift(`perspective(${f}px)`),n.length>0&&(t.style.transform=n.join(" "),Ar(t)),s){const u=s.originX??50,d=s.originY??50;t.style.transformOrigin=`${u}% ${d}%`}if(r){const u=r.clipTop??0,d=r.clipRight??0,m=r.clipBottom??0,p=r.clipLeft??0;t.style.clipPath=`inset(${u}% ${d}% ${m}% ${p}%)`}if(o){const u=Sr(o);u&&(t.style.filter=u)}}buildTransformPart(t,e){if(typeof e!="number")return null;switch(t){case"x":case"motionPathX":return`translateX(${e}px)`;case"y":case"motionPathY":return`translateY(${e}px)`;case"z":return`translateZ(${e}px)`;case"rotate":case"rotateZ":case"motionPathRotate":return`rotate(${e}deg)`;case"rotateX":return`rotateX(${e}deg)`;case"rotateY":return`rotateY(${e}deg)`;case"scale":return`scale(${e})`;case"scaleX":return`scaleX(${e})`;case"scaleY":return`scaleY(${e})`;case"scaleZ":return`scaleZ(${e})`;case"skewX":return`skewX(${e}deg)`;case"skewY":return`skewY(${e}deg)`;default:return null}}applyShine(t,e){t.dataset.shineBase||(t.dataset.shineBase=t.style.color||"currentColor");const n=t.dataset.shineBase,s=-20+e*140,r=t.style;r.color="transparent",r.backgroundImage=`linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%), linear-gradient(${n}, ${n})`,r.backgroundSize="250% 100%, 100% 100%",r.backgroundPosition=`${s}% 0, 0 0`,r.backgroundRepeat="no-repeat",r.webkitBackgroundClip="text",r.backgroundClip="text"}applyStyleProperty(t,e,n){let s;if(t.namespaceURI===_r&&e in rn){const a=Array.isArray(n)?n.join(", "):String(n);t.style[rn[e]]=a;return}else e==="fill"&&t.dataset?.elementType==="text"?s="color":s=Cr[e]??e;let o;typeof n=="number"?sn.has(e)||sn.has(s)?o=`${n}px`:o=String(n):Array.isArray(n)?o=n.join(", "):o=n,t.style[s]=o}}const Ir={request:i=>requestAnimationFrame(i),cancel:i=>cancelAnimationFrame(i)};class on{adapter=new et;scheduler;rootOption;onWarning;names=new WeakMap;elements=new Map;nameCounter=0;objectNames=new WeakMap;objects=new Map;owned=new Set;currentCollector;tickerCallbacks=new Set;tickerTime=0;tickerFrame=0;liveTimelines=new Set;utils=tr();active=new Map;applied=new Map;dirty=new Set;frameId=null;lastTimestamp=null;destroyed=!1;constructor(t={}){this.scheduler=t.scheduler??Ir,this.rootOption=t.root,this.onWarning=t.onWarning}get root(){return this.rootOption??document}resolveTargets(t){const e=[];for(const n of this.targetsOf(t)){const s=this.nameFor(n);Ce(n)&&this.currentCollector?.touch(n,s),e.push(s)}return e}query(t){return this.selectorRoot.querySelector(t)}get collector(){return this.currentCollector}setCollector(t){this.currentCollector=t}forget(t){this.applied.delete(t),this.dirty.delete(t)}get selectorRoot(){return this.currentCollector?.scope??this.root}elementFor(t){return this.elements.get(t)}objectFor(t){return this.objects.get(t)}appliedValue(t,e){return this.applied.get(t)?.get(e)}velocityOf(t,e){for(const s of[...this.active.keys()].reverse()){if(s.getTracks({target:t,property:e}).length===0)continue;const r=s.currentTime;if(r<4)return 0;const o=s.getStateAtTime(r).values.get(t)?.get(e),a=s.getStateAtTime(r-4).values.get(t)?.get(e);if(typeof o!="number"||typeof a!="number")return;const c=(o-a)/4;return(s.direction==="reverse"?-c:c)*1e3}}ticker={add:t=>{this.destroyed||(this.tickerCallbacks.size===0&&(this.tickerTime=0,this.tickerFrame=0),this.tickerCallbacks.add(t),this.currentCollector?.track({revert:()=>this.ticker.remove(t)}),this.startLoop())},remove:t=>{this.tickerCallbacks.delete(t),this.running||this.stopLoop()}};activate(t,e={}){this.destroyed||(t.onUpdate=n=>this.write(n),this.active.delete(t),this.active.set(t,e),this.startLoop())}deactivate(t){this.active.delete(t),this.running||this.stopLoop()}own(t){return this.destroyed?t.destroy():this.owned.add(t),t}destroy(){this.destroyed=!0;for(const t of this.owned)t.destroy();this.owned.clear();for(const t of this.active.keys())t.stop();this.active.clear(),this.stopLoop(),this.adapter.clearTargets(),this.elements.clear(),this.names=new WeakMap,this.objects.clear(),this.objectNames=new WeakMap,this.tickerCallbacks.clear(),this.liveTimelines.clear(),this.applied.clear(),this.dirty.clear()}apply(t,e){if(this.destroyed)return;const n=new Map(Object.entries(e));this.write({values:new Map([[t,n]]),currentTime:0,playbackState:"idle",direction:"forward",loopIteration:0}),this.flush()}render(t){this.destroyed||(this.write(t.getStateAtTime(t.currentTime)),this.flush())}tick(t){const e=[...this.active];for(const[n]of e)n.duration<=0?(this.write(n.getStateAtTime(0)),n.stop()):n.tick(t);this.flush();for(const[n,s]of e)s.onUpdate?.(),n.playbackState!=="playing"&&this.active.get(n)===s&&this.active.delete(n);this.flush(),this.runTicker(t),this.running||this.stopLoop()}get running(){return this.active.size>0||this.tickerCallbacks.size>0}runTicker(t){if(this.tickerCallbacks.size!==0){this.tickerTime+=t,this.tickerFrame+=1;for(const e of[...this.tickerCallbacks])e(this.tickerTime/1e3,t,this.tickerFrame)}}write(t){for(const[e,n]of t.values){let s=this.applied.get(e);s||(s=new Map,this.applied.set(e,s));for(const[r,o]of n)s.set(r,o);this.dirty.add(e)}}flush(){if(this.dirty.size===0)return;const t=new Map;for(const e of this.dirty){const n=this.applied.get(e),s=this.objects.get(e);if(s)for(const[r,o]of n)s[r]=o;else t.set(e,n)}this.dirty.clear(),t.size!==0&&this.adapter.applyState({values:t,currentTime:0,playbackState:"playing",direction:"forward",loopIteration:0})}frame=t=>{this.frameId=null;const e=this.lastTimestamp===null?0:t-this.lastTimestamp;this.lastTimestamp=t,e>0&&this.tick(e),this.running&&this.frameId===null&&(this.frameId=this.scheduler.request(this.frame))};startLoop(){this.frameId===null&&(this.lastTimestamp=null,this.frameId=this.scheduler.request(this.frame))}stopLoop(){this.frameId!==null&&this.scheduler.cancel(this.frameId),this.frameId=null,this.lastTimestamp=null}targetsOf(t){if(typeof t=="string")return Array.from(this.selectorRoot.querySelectorAll(t));if(Ce(t))return[t];if(!Rr(t))return[t];const e=[];for(const n of Array.from(t))e.push(...this.targetsOf(n));return e}nameFor(t){return Ce(t)?this.elementName(t):this.objectName(t)}objectName(t){const e=this.objectNames.get(t);if(e)return e;let n;do this.nameCounter+=1,n=`obj-${this.nameCounter}`;while(this.objects.has(n)||this.elements.has(n));return this.objectNames.set(t,n),this.objects.set(n,t),n}elementName(t){const e=this.names.get(t);if(e)return e;let n=t.id?`#${t.id}`:"";if(!n||this.elements.has(n))do this.nameCounter+=1,n=`el-${this.nameCounter}`;while(this.elements.has(n));return this.names.set(t,n),this.elements.set(n,t),this.adapter.registerTarget(n,t),n}}function Ce(i){return typeof i=="object"&&i!==null&&i.nodeType===1}function Rr(i){if(Array.isArray(i))return!0;const t=i;return typeof t.length=="number"&&typeof t.item=="function"}function zt(i){const t=i.style;if(!t)return i.getBoundingClientRect();const e=t.transform;t.transform="none";const n=i.getBoundingClientRect();return t.transform=e,n}const an=i=>typeof i=="object"&&i!==null&&i.nodeType===1;function Lr(i){const t={};for(const e of Array.from(i.attributes))t[e.name]=e.value;return t}function Fr(i){const t=i.getScreenCTM?.();if(t)return[t.a,t.b,t.c,t.d,t.e,t.f];const e=i.getBoundingClientRect();return[1,0,0,1,e.left,e.top]}function $r(i,t){const e=typeof i=="string"||Array.isArray(i)||an(i)?{path:i}:i,{align:n,alignOrigin:s,path:r,...o}=e,a=S=>{const A=an(S)?S:t.query(S);return A||t.warn(`gsap-compat: motionPath could not find "${String(S)}"`),A};let c=null,l="";if(Array.isArray(r)||typeof r=="string"&&ot(r))l=r;else{c=a(r);const S=c&&Vt({tag:c.localName,attributes:Lr(c)});c&&!S&&t.warn(`gsap-compat: motionPath element <${c.localName}> has no path geometry`),l=S??""}const h={...o,path:l};if(n===void 0||n===!1)return h;const f=n===!0?c:a(n);if(!f)return n===!0&&t.warn("gsap-compat: motionPath align: true needs the path to be an element"),h;const u=t.targets[0];if(!u)return h;const[d,m,p,y,b,w]=Fr(f),v=zt(u),[k,T]=s??[.5,.5];for(const S of t.targets.slice(1)){const A=zt(S);if(Math.abs(A.left-v.left)>.5||Math.abs(A.top-v.top)>.5){t.warn("gsap-compat: motionPath align measures the first target; the others are laid out elsewhere");break}}return h.matrix=[d,m,p,y,b-v.left-k*v.width,w-v.top-T*v.height],h}const cn=i=>typeof i=="object"&&i!==null&&i.nodeType===1;function ln(i){const t={};for(const e of Array.from(i.attributes))t[e.name]=e.value;return t}function hn(i){if(!i)return null;const t=Vt({tag:i.localName,attributes:ln(i)});return t||(i.querySelector("path")?.getAttribute("d")??null)}function Dr(i,t,e){const n=en(i);if(typeof n=="string"&&ot(n))return n;const s=cn(n)?n:typeof n=="string"?t(n):null,r=hn(s);return r||(e(`gsap-compat: morphSVG could not find a shape for "${String(n)}"`),"")}const Or=new Set(["cx","cy","r","rx","ry","x","y","width","height","x1","y1","x2","y2","points"]);function Nr(i,t=document){return(typeof i=="string"?Array.from(t.querySelectorAll(i)):cn(i)?[i]:Array.from(i)).map(n=>{if(n.localName==="path")return n;const s=Vt({tag:n.localName,attributes:ln(n)});if(!s||!n.parentNode)return n;const r=n.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");for(const o of Array.from(n.attributes))Or.has(o.name)||r.setAttribute(o.name,o.value);return r.setAttribute("d",s),n.parentNode.replaceChild(r,n),r})}const un=.3;class fn{options;target;running=!1;dragging=!1;passedTolerance=!1;lastX=0;lastY=0;startX=0;startY=0;velocityX=0;velocityY=0;lastTime=0;constructor(t){this.options=t,this.target=t.target}start(){if(this.running)return;this.running=!0;const t=this.options.type??["pointer","touch"];t.includes("pointer")&&(this.target.addEventListener("pointerdown",this.onPointerDown),this.target.addEventListener("pointermove",this.onPointerMove),this.target.addEventListener("pointerup",this.onPointerUp),this.target.addEventListener("pointercancel",this.onPointerUp)),t.includes("touch")&&(this.target.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.target.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.target.addEventListener("touchend",this.onTouchEnd)),t.includes("wheel")&&this.target.addEventListener("wheel",this.onWheel,{passive:!1})}stop(){this.running&&(this.running=!1,this.target.removeEventListener("pointerdown",this.onPointerDown),this.target.removeEventListener("pointermove",this.onPointerMove),this.target.removeEventListener("pointerup",this.onPointerUp),this.target.removeEventListener("pointercancel",this.onPointerUp),this.target.removeEventListener("touchstart",this.onTouchStart),this.target.removeEventListener("touchmove",this.onTouchMove),this.target.removeEventListener("touchend",this.onTouchEnd),this.target.removeEventListener("wheel",this.onWheel))}destroy(){this.stop()}get velocity(){return{x:this.velocityX,y:this.velocityY}}begin(t,e,n){this.dragging=!0,this.passedTolerance=!1,this.startX=t,this.startY=e,this.lastX=t,this.lastY=e,this.velocityX=0,this.velocityY=0,this.lastTime=dn(),this.options.onPress?.(this.stateFrom(0,0,n))}move(t,e,n){if(!this.dragging)return;const s=t-this.lastX,r=e-this.lastY;this.lastX=t,this.lastY=e;const o=t-this.startX,a=e-this.startY,c=this.options.tolerance??3;if(!this.passedTolerance){if(Math.hypot(o,a)<c)return;this.passedTolerance=!0}this.updateVelocity(s,r),this.options.preventDefault!==!1&&n.cancelable&&n.preventDefault(),this.options.onMove?.(this.stateFrom(s,r,n))}end(t){this.dragging&&(this.dragging=!1,this.options.onRelease?.(this.stateFrom(0,0,t)))}updateVelocity(t,e){const n=dn(),s=Math.max(1,n-this.lastTime);this.lastTime=n;const r=t/s*1e3,o=e/s*1e3;this.velocityX+=(r-this.velocityX)*un,this.velocityY+=(o-this.velocityY)*un}stateFrom(t,e,n){return{deltaX:t,deltaY:e,velocityX:this.velocityX,velocityY:this.velocityY,totalX:this.lastX-this.startX,totalY:this.lastY-this.startY,isDragging:this.dragging,event:n}}onPointerDown=t=>{const e=t,n=this.target;if(typeof e.pointerId=="number"&&typeof n.setPointerCapture=="function")try{n.setPointerCapture(e.pointerId)}catch{}this.begin(e.clientX,e.clientY,t)};onPointerMove=t=>{const e=t;this.move(e.clientX,e.clientY,t)};onPointerUp=t=>this.end(t);onTouchStart=t=>{const e=t.touches[0];e&&this.begin(e.clientX,e.clientY,t)};onTouchMove=t=>{const e=t.touches[0];e&&this.move(e.clientX,e.clientY,t)};onTouchEnd=t=>this.end(t);onWheel=t=>{const e=t;this.options.preventDefault!==!1&&e.cancelable&&e.preventDefault(),this.updateVelocity(e.deltaX,e.deltaY),this.options.onMove?.({deltaX:e.deltaX,deltaY:e.deltaY,velocityX:this.velocityX,velocityY:this.velocityY,totalX:0,totalY:0,isDragging:!1,event:t})}}function dn(){return typeof performance<"u"?performance.now():Date.now()}function pn(i,t,e){let n={delta:0,line:null},s=e;for(const r of i)for(const o of t){const a=Math.abs(o-r);a<=s&&(s=a,n={delta:o-r,line:o})}return n}function mn(i,t){return t<=0?[]:i.map(e=>Math.round(e/t)*t)}class _e{options;observer;x;y;originX=0;originY=0;snappedX=null;snappedY=null;constructor(t){this.options=t,this.x=t.initialX??0,this.y=t.initialY??0,this.observer=new fn({target:t.target,onPress:e=>{const n=t.getPosition?.();n&&(this.x=n.x,this.y=n.y),this.originX=this.x,this.originY=this.y,t.onPress?.(e)},onMove:e=>this.handleMove(e),onRelease:e=>t.onRelease?.(e)})}start(){this.observer.start()}stop(){this.observer.stop()}destroy(){this.observer.destroy()}get position(){return{x:this.x,y:this.y}}get velocity(){return this.observer.velocity}setPosition(t,e){const n=this.options.axis??"both";this.x=n==="y"?this.x:this.applyConstraints(t,"x"),this.y=n==="x"?this.y:this.applyConstraints(e,"y")}get snapLines(){return{x:this.snappedX,y:this.snappedY}}snapThreshold(){if(this.options.snapThreshold!==void 0)return this.options.snapThreshold;const t=this.options.snap??0;return t>0?t/2:8}handleMove(t){this.setPosition(this.originX+t.totalX,this.originY+t.totalY),this.options.mode==="scrub"&&this.scrub(),this.options.onDrag?.(this.position,t),this.options.onSnap?.(this.snapLines)}scrub(){const t=this.options.timeline;if(!t)return;const e=t.duration;if(e<=0)return;const n=this.options.scrubDistance??500;if(n===0)return;const s=(this.options.axis??"both")==="y"?this.y:this.x,r=Br(s/n);t.pause(),t.seek(r*e)}applyConstraints(t,e){let n=t;const s=[...mn([n],this.options.snap??0),...(e==="x"?this.options.snapLinesX:this.options.snapLinesY)??[]],r=pn([n],s,this.snapThreshold());n+=r.delta,e==="x"?this.snappedX=r.line:this.snappedY=r.line;const o=this.options.bounds;if(o){const a=e==="x"?o.minX:o.minY,c=e==="x"?o.maxX:o.maxY;a!==void 0&&(n=Math.max(a,n)),c!==void 0&&(n=Math.min(c,n))}return n}}function Br(i){return i<0?0:i>1?1:i}function qr(i){const t=new _e(i);return t.start(),t}const Xr={x:"x",y:"y","x,y":"both"},Ie=i=>typeof i=="object"&&i!==null&&i.nodeType===1;function gn(i,t){const e=zt(i),n=t.getBoundingClientRect();return{minX:n.left-e.left,maxX:n.right-e.right,minY:n.top-e.top,maxY:n.bottom-e.bottom}}function yn(i){return Array.isArray(i)?[...i]:i}function Yr(i,t,e,n={}){const[s]=t.resolveTargets(e),r=s?t.elementFor(s):void 0;if(!s||!r)throw new Error(`gsap-compat: live.draggable could not find ${String(e)}`);if(n.type==="rotation")return Vr(i,t,s,r,n);const o=Xr[n.type??"x,y"],a=()=>{const p=t.appliedValue(s,"x"),y=t.appliedValue(s,"y");return{x:typeof p=="number"?p:0,y:typeof y=="number"?y:0}},c=typeof n.bounds=="string"?t.query(n.bounds):Ie(n.bounds)?n.bounds:null,h={bounds:(!c&&n.bounds&&!Ie(n.bounds)?n.bounds:void 0)??(c?gn(r,c):void 0)};let f=null;const u=()=>{f?.kill(),f=null},d=p=>{const y=n.inertia===!0?{}:n.inertia,b=y.friction??(y.resistance!==void 0?Ee(y.resistance):4),w=a(),v=h.bounds??{};let k,T;const S=y.end;if(Array.isArray(S)){const I=bt({from:w.x,velocity:o==="y"?0:p.x,friction:b}),O=bt({from:w.y,velocity:o==="x"?0:p.y,friction:b});let E=S[0];for(const M of S)Math.hypot(M.x-I,M.y-O)<Math.hypot(E.x-I,E.y-O)&&(E=M);E&&(k=[E.x],T=[E.y])}else typeof S=="number"?(k=S,T=S):S&&(k=yn(S.x),T=yn(S.y));const A={};o!=="y"&&(A.x={velocity:p.x,friction:b,min:v.minX,max:v.maxX,end:k}),o!=="x"&&(A.y={velocity:p.y,friction:b,min:v.minY,max:v.maxY,end:T}),f=i.to(r,{inertia:A,onComplete:()=>n.onThrowComplete?.()})},m=new _e({target:r,axis:o,snap:n.snap,get bounds(){return h.bounds},getPosition:a,onPress:()=>{u(),c&&(h.bounds=gn(r,c)),n.onPress?.()},onDrag:p=>{t.apply(s,o==="x"?{x:p.x}:o==="y"?{y:p.y}:{x:p.x,y:p.y}),n.onDrag?.(p)},onRelease:()=>{const p=m.velocity;n.onRelease?.(p),n.inertia&&d(p)}});return m.start(),{draggable:m,get position(){return a()},get rotation(){const p=t.appliedValue(s,"rotate");return typeof p=="number"?p:0},destroy(){u(),m.destroy()}}}function Vr(i,t,e,n,s){const r=typeof s.bounds=="object"&&s.bounds!==null&&!Ie(s.bounds)?s.bounds:{},o=()=>{const v=t.appliedValue(e,"rotate");return typeof v=="number"?v:0},a=v=>Math.min(r.maxRotation??1/0,Math.max(r.minRotation??-1/0,v));let c=null,l=!1,h,f={x:0,y:0},u=0,d=0,m=[];const p=v=>Math.atan2(v.clientY-f.y,v.clientX-f.x)*180/Math.PI,y=v=>{if(l)return;c?.kill(),c=null,l=!0,h=v.pointerId,n.setPointerCapture?.(v.pointerId);const k=n.getBoundingClientRect();f={x:k.left+k.width/2,y:k.top+k.height/2},u=p(v),d=o(),m=[{time:performance.now(),rotation:d}],s.onPress?.()},b=v=>{if(!l||v.pointerId!==h)return;const k=p(v);let T=k-u;T>180&&(T-=360),T<-180&&(T+=360),u=k,d+=T;let S=a(d);s.snap&&(S=a(Math.round(S/s.snap)*s.snap)),t.apply(e,{rotate:S});const A=performance.now();for(m.push({time:A,rotation:S});m.length>2&&A-m[0].time>100;)m.shift();const I={x:0,y:0};s.onDrag?.(I)},w=v=>{if(!l||v.pointerId!==h)return;l=!1;const k=m[0],T=m[m.length-1],S=k&&T?(T.time-k.time)/1e3:0,A=S>0?(T.rotation-k.rotation)/S:0;if(s.onRelease?.({x:A,y:0}),!s.inertia)return;const I=s.inertia===!0?{}:s.inertia,O=I.friction??(I.resistance!==void 0?Ee(I.resistance):4),E=typeof I.end=="number"||Array.isArray(I.end)?I.end:void 0;c=i.to(n,{inertia:{rotate:{velocity:A,friction:O,min:r.minRotation,max:r.maxRotation,end:Array.isArray(E)?E.filter(M=>typeof M=="number"):E}},onComplete:()=>s.onThrowComplete?.()})};return n.addEventListener("pointerdown",y),n.addEventListener("pointermove",b),n.addEventListener("pointerup",w),n.addEventListener("pointercancel",w),n.style.touchAction="none",{draggable:void 0,position:{x:0,y:0},get rotation(){return o()},destroy(){c?.kill(),n.removeEventListener("pointerdown",y),n.removeEventListener("pointermove",b),n.removeEventListener("pointerup",w),n.removeEventListener("pointercancel",w)}}}const Wr={opacity:0,scale:.6};function Ur(i){const t=i.getBoundingClientRect();return t.width===0&&t.height===0?null:{cx:t.left+t.width/2,cy:t.top+t.height/2,width:t.width,height:t.height}}function bn(i){const t=zt(i);return t.width===0&&t.height===0?null:{cx:t.left+t.width/2,cy:t.top+t.height/2,width:t.width,height:t.height}}function Re(i,t){const n=i.resolveTargets(t).map(o=>i.elementFor(o)).filter(o=>!!o),s=new Map,r=new Map;for(const o of n){const a=Ur(o);s.set(o,a);const c=vn(o);a&&c!==void 0&&!r.has(c)&&r.set(c,{element:o,box:a})}return{elements:n,boxes:s,ids:r}}const Le=new WeakMap;function Fe(i,t,e,n={}){const s=n.duration??.6,r=n.ease??"power2.inOut",o=n.stagger??0,a=n.scale!==!1,c=n.enter===void 0?Wr:n.enter,l=new Set(e.elements);if(n.targets!==void 0)for(const d of i.resolveTargets(n.targets)){const m=i.elementFor(d);m&&l.add(m)}const h=[...l].sort((d,m)=>d===m?0:d.compareDocumentPosition(m)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),f=t({onComplete:n.onComplete});let u=0;for(const d of h){const m=bn(d);if(!m)continue;let p=e.boxes.get(d)??null,y;const b=vn(d),w=!p&&b!==void 0?e.ids.get(b):void 0;w&&w.element!==d&&(p=w.box,y=w.element);const[v]=i.resolveTargets(d);Le.get(d)?.timeline.removeTracks({target:v});const k=u*o;if(!p){if(c===!1)continue;f.fromTo(d,{x:0,y:0,scaleX:1,scaleY:1,...c},{...wn(c),x:0,y:0,scaleX:1,scaleY:1,duration:s,ease:r,delay:k},0),Le.set(d,f),u++;continue}const T=p.cx-m.cx,S=p.cy-m.cy,A=a?p.width/m.width:1,I=a?p.height/m.height:1;if(!(Math.abs(T)>.5||Math.abs(S)>.5||Math.abs(A-1)>.001||Math.abs(I-1)>.001)){const M=(C,P)=>{const _=i.appliedValue(v,C);return typeof _=="number"&&Math.abs(_-P)>1e-6};(M("x",0)||M("y",0)||M("scaleX",1)||M("scaleY",1))&&f.set(d,{x:0,y:0,scaleX:1,scaleY:1},0);continue}const E=n.fade===!0&&y!==void 0;f.fromTo(d,{x:T,y:S,scaleX:A,scaleY:I,...E&&{opacity:0}},{x:0,y:0,scaleX:1,scaleY:1,...E&&{opacity:1},duration:s,ease:r,delay:k},0),E&&y&&bn(y)&&f.fromTo(y,{opacity:1},{opacity:0,duration:s,ease:r,delay:k},0),Le.set(d,f),u++}return f}function vn(i){return i.dataset?.flipId}function wn(i){const t={};for(const e of Object.keys(i))t[e]=e==="opacity"||e.startsWith("scale")?1:0;return t}function jr(i,t={}){const e=new Set((t.type??"chars,words,lines").split(",").map(p=>p.trim())),n={chars:t.charsClass??"char",words:t.wordsClass??"word",lines:t.linesClass??"line"},s=t.aria!==!1,r=i.map(p=>({element:p,html:p.innerHTML,ariaLabel:p.getAttribute("aria-label")}));let o={chars:[],words:[],lines:[],masks:[]},a,c,l=!1;const h=()=>{for(const{element:p,html:y,ariaLabel:b}of r)p.innerHTML=y,b===null?p.removeAttribute("aria-label"):p.setAttribute("aria-label",b)},f=()=>{a&&(a.revert?a.revert():a.kill?.(),a=void 0)},u=()=>{const p={chars:[],words:[],lines:[],masks:[]};for(const{element:y}of r){const b=(y.textContent??"").replace(/\s+/g," ").trim(),w=zr(y,n.words),v=e.has("chars")?w.flatMap(S=>Hr(S,n.chars)):[],k=e.has("lines")?Kr(y,w,n.lines):[];if(s){!y.hasAttribute("aria-label")&&b&&y.setAttribute("aria-label",b);for(const S of w)S.setAttribute("aria-hidden","true")}if(e.has("words"))p.words.push(...w);else for(const S of w)S.removeAttribute("class");p.chars.push(...v),p.lines.push(...k);const T=t.mask==="lines"?k:t.mask==="words"?w:t.mask==="chars"?v:[];for(const S of T)p.masks.push(Qr(S,`${n[t.mask]}-mask`))}o=p},d={elements:i,get chars(){return o.chars},get words(){return o.words},get lines(){return o.lines},get masks(){return o.masks},split(){l||(f(),h(),u(),a=t.onSplit?.(d))},revert(){l=!0,c?.disconnect(),f(),h()}};u(),a=t.onSplit?.(d),t.autoSplit&&m();function m(){const p=new Map;let y=!1;const b=()=>{if(y)return;y=!0;const v=()=>{y=!1,d.split()};typeof requestAnimationFrame=="function"?requestAnimationFrame(v):setTimeout(v,0)};if(typeof ResizeObserver=="function"){c=new ResizeObserver(v=>{let k=!1;for(const T of v){const S=Math.round(T.contentRect.width),A=p.get(T.target);p.set(T.target,S),A!==void 0&&A!==S&&(k=!0)}k&&b()});for(const v of i)c.observe(v)}const w=i[0]?.ownerDocument?.fonts;w&&w.status!=="loaded"&&w.ready.then(()=>b())}return d}function zr(i,t){const e=i.ownerDocument,n=[],s=e.createTreeWalker(i,4),r=[];for(let o=s.nextNode();o;o=s.nextNode())r.push(o);for(const o of r){const a=o.data.match(/\s+|\S+/g)??[];if(a.length===0)continue;const c=e.createDocumentFragment();for(const l of a){if(/^\s/.test(l)){c.appendChild(e.createTextNode(l));continue}const h=e.createElement("span");h.className=t,h.style.display="inline-block",h.textContent=l,c.appendChild(h),n.push(h)}o.replaceWith(c)}return n}function Hr(i,t){const e=i.ownerDocument,n=Gr(i.textContent??"").map(s=>{const r=e.createElement("span");return r.className=t,r.style.display="inline-block",r.textContent=s,r});return i.replaceChildren(...n),n}function Gr(i){const t=Intl.Segmenter;return t?Array.from(new t(void 0,{granularity:"grapheme"}).segment(i),e=>e.segment):Array.from(i)}function Kr(i,t,e){const n=i.ownerDocument,s=new Map(t.map(m=>[m,m.getBoundingClientRect()])),r=[],o=m=>{for(const p of Array.from(m.childNodes))p.nodeType===3||s.has(p)||p.tagName==="BR"?r.push(p):o(p)};o(i);const a=[];let c=null,l=0,h=0,f=!1,u=[];const d=()=>{c=n.createElement("span"),c.className=e,c.style.display="block",a.push(c),u=[]};for(const m of r){if(m.tagName==="BR"){f=!0;continue}const p=s.get(m);if(p&&(!c||f||p.top>l+h)&&(d(),l=p.top,h=p.height/2,f=!1),!c)continue;const y=[];for(let v=m.parentNode;v&&v!==i;v=v.parentNode)y.unshift(v);let b=0;for(;b<u.length&&b<y.length&&u[b].original===y[b];)b++;u.length=b;let w=b===0?c:u[b-1].clone;for(const v of y.slice(b)){const k=v.cloneNode(!1);w.appendChild(k),u.push({original:v,clone:k}),w=k}w.appendChild(m)}return i.replaceChildren(...a),a}function Qr(i,t){const e=i.ownerDocument.createElement("span");return e.className=t,e.style.display=i.style.display==="block"?"block":"inline-block",e.style.overflow="clip",e.style.paddingBottom="0.12em",e.style.marginBottom="-0.12em",i.replaceWith(e),e.appendChild(i),e}const Tn={top:0,left:0,start:0,center:.5,centre:.5,middle:.5,bottom:1,right:1,end:1};function $e(i){const t=i.trim().toLowerCase();if(t in Tn)return Tn[t];if(t.endsWith("%")){const e=Number.parseFloat(t.slice(0,-1));return Number.isNaN(e)?void 0:e/100}}function De(i){if(typeof i=="number")return{elementFraction:0,viewportFraction:0,offsetPx:0,absolutePx:i};let t=0;const n=i.replace(/([+-])=\s*(-?[\d.]+)/g,(o,a,c)=>(t+=(a==="-"?-1:1)*Number.parseFloat(c),"")).trim().split(/\s+/).filter(Boolean);if(n.length===1&&/^-?[\d.]+$/.test(n[0]))return{elementFraction:0,viewportFraction:0,offsetPx:0,absolutePx:Number.parseFloat(n[0])+t};const s=n[0]!==void 0?$e(n[0]):void 0,r=n[1]!==void 0?$e(n[1]):void 0;return{elementFraction:s??0,viewportFraction:r??0,offsetPx:t}}function lt(i,t,e){const n=De(e),s=n.absolutePx!==void 0?i.top+n.absolutePx:i.top+i.height*n.elementFraction,r=t*n.viewportFraction;return s-r+n.offsetPx}function Zr(i,t,e,n){const s=lt(i,t,e),o=lt(i,t,n)-s;return o<=0?s<=0?1:0:Oe(-s/o)}function Oe(i){return i<0?0:i>1?1:i===0?0:i}function kn(i,t,e,n){if(e<=0)return t;const s=1-Math.exp(-(n/1e3)/e);return i+(t-i)*s}function Ne(i,t,e,n,s){const r=h=>lt({top:i+s(h),bottom:i+s(h)+t,height:t},e,n),o=r(0),a=r(1);if(Math.sign(o)===Math.sign(a)||o===0||a===0)return o===0?0:a===0?1:Math.abs(o)<Math.abs(a)?0:1;let c=0,l=1;for(let h=0;h<40;h++){const f=(c+l)/2;Math.sign(r(f))===Math.sign(o)?c=f:l=f}return(c+l)/2}class Sn{timeline;trigger;behaviour;options;observer=null;hasPlayed=!1;running=!1;constructor(t){this.timeline=t.timeline,this.trigger=t.trigger,this.behaviour=t.behaviour??"once",this.options=t}start(){if(!this.running){if(this.running=!0,typeof IntersectionObserver>"u"){this.enter();return}this.observer=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?this.enter():this.leave()},{threshold:this.options.threshold??.15,rootMargin:this.options.rootMargin,root:this.options.root??null}),this.observer.observe(this.trigger)}}stop(){this.running=!1,this.observer?.disconnect(),this.observer=null}destroy(){this.stop()}reset(){this.hasPlayed=!1,this.timeline.stop()}enter(){this.options.onEnter?.(),!(this.behaviour==="once"&&this.hasPlayed)&&(this.hasPlayed=!0,this.behaviour!=="once"&&this.timeline.seek(0),this.timeline.play())}leave(){this.options.onLeave?.(),this.behaviour==="reset"&&this.timeline.stop()}}function Jr(i){const t=new Sn(i);return t.start(),t}class Mn{element;spacer;saved;axis;spacing;constructor(t,e={}){this.element=t,this.axis=e.axis??"y",this.spacing=e.spacing??!0;const n=t.ownerDocument;this.spacer=n.createElement("div"),this.spacer.className="pin-spacer",this.saved={position:t.style.position,top:t.style.top,left:t.style.left},this.axis==="x"&&(this.spacer.style.flexShrink="0"),t.replaceWith(this.spacer),this.spacer.appendChild(t)}release(){this.element.style.position=this.saved.position,this.element.style.top=this.saved.top,this.element.style.left=this.saved.left}apply(t,e){const n=Math.max(0,e);this.element.style.position="sticky",this.axis==="x"?(this.spacer.style.width=`${this.element.offsetWidth+n}px`,this.spacer.style.marginRight=this.spacing?"":`-${n}px`,this.element.style.left=`${t}px`):(this.spacer.style.height=`${this.element.offsetHeight+n}px`,this.spacer.style.marginBottom=this.spacing?"":`-${n}px`,this.element.style.top=`${t}px`)}destroy(){this.element.style.position=this.saved.position,this.element.style.top=this.saved.top,this.element.style.left=this.saved.left,this.spacer.parentNode&&this.spacer.replaceWith(this.element)}}const to=.15;function An(i){return typeof i=="object"&&!Array.isArray(i)?i:{snapTo:i}}function xn(i,t,e){const n=Ht(i+t*to);if(typeof e=="function")return Ht(e(n));if(typeof e=="number")return e<=0?i:Ht(Math.round(n/e)*e);if(e.length===0)return i;let s=e[0];for(const r of e)Math.abs(r-n)<Math.abs(s-n)&&(s=r);return Ht(s)}function En(i,t,e){const n=i.duration??{min:.2,max:.8};if(typeof n=="number")return n;const s=Math.min(1,Math.abs(t)/Math.max(1,e));return n.min+(n.max-n.min)*s}class Pn{rafId=null;cancelEvents=["wheel","touchstart","pointerdown","keydown"];onInterrupt=()=>this.cancel();write;eventTarget;constructor(t,e){this.write=t,this.eventTarget=e}get active(){return this.rafId!==null}animate(t,e,n,s=vt,r){if(this.cancel(),typeof requestAnimationFrame>"u"||n<=0){this.write(e),r?.();return}for(const c of this.cancelEvents)this.eventTarget?.addEventListener(c,this.onInterrupt,{passive:!0});let o=null;const a=c=>{o??=c;const l=Math.min(1,(c-o)/(n*1e3));this.write(t+(e-t)*s(l)),l<1?this.rafId=requestAnimationFrame(a):(this.rafId=null,this.detach(),r?.())};this.rafId=requestAnimationFrame(a)}cancel(){this.rafId!==null&&typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(this.rafId),this.rafId=null,this.detach()}detach(){for(const t of this.cancelEvents)this.eventTarget?.removeEventListener(t,this.onInterrupt)}}function Ht(i){return Math.max(0,Math.min(1,i))}class Cn{options;scroller;nodes=[];scrollerStart;scrollerEnd;start;end;constructor(t,e,n){this.options=n===!0?{}:n,this.scroller=e;const{startColor:s="#3ecf7a",endColor:r="#ff5a5a",id:o}=this.options,a=o?`${o} `:"",c=(l,h,f)=>{const u=t.createElement("div");return u.textContent=`${a}${l}`,u.setAttribute("aria-hidden","true"),u.className="scroll-marker",Object.assign(u.style,{position:f?"fixed":"absolute",right:`${this.options.indent??0}px`,zIndex:"2147483646",pointerEvents:"none",borderTop:`1px solid ${h}`,color:h,font:`${this.options.fontSize??"11px"} ui-monospace, monospace`,padding:"2px 6px",whiteSpace:"nowrap",background:"rgba(0, 0, 0, 0.35)"}),(e??t.body).appendChild(u),this.nodes.push(u),u};this.scrollerStart=c("scroller-start",s,!e),this.scrollerEnd=c("scroller-end",r,!e),this.start=c("start",s,!1),this.end=c("end",r,!1),e&&getComputedStyle(e).position==="static"&&(e.style.position="relative")}place(t,e){this.start.style.top=`${t.startPage}px`,this.end.style.top=`${t.endPage}px`;const n=this.scroller?e:0;this.scrollerStart.style.top=`${n+t.startViewport}px`,this.scrollerEnd.style.top=`${n+t.endViewport}px`}follow(t,e){this.scroller&&this.place(t,e)}destroy(){for(const t of this.nodes.splice(0))t.remove()}}const eo=120,ht=[],ut=new Set;let Be=!1;const io=()=>{Be||ut.size===0||(Be=!0,queueMicrotask(()=>{Be=!1;for(const i of ut)i.afterRefresh()}))},_n=()=>{for(const i of ut)i.beforeRefresh();for(const i of ht)i.refresh();for(const i of ut)i.afterRefresh()};let ft={width:0,height:0};const In=()=>{const i=window.innerWidth,t=window.innerHeight,e=i===ft.width&&t!==ft.height,n=Math.abs(t-ft.height)<ft.height*.25,s=typeof navigator<"u"&&(navigator.maxTouchPoints??0)>0;e&&n&&s||(ft={width:i,height:t},_n())};class Et{timeline;options;running=!1;pin=null;startPx=0;endPx=0;targetProgress=0;displayProgress=0;zone="before";measured=!1;lastScroll=null;lastScrollTime=0;velocityPxPerSecond=0;idleTimer=null;lastEmitted=null;rafId=null;lastFrameTime=null;onScroll=()=>this.update();releaseVelocity=0;snapper;snapTimer=null;markers=null;markerGeometry=null;constructor(t){this.timeline=t.timeline,this.options=t,this.snapper=new Pn(e=>this.scrollTo(e),typeof window<"u"?window:null)}start(){if(this.running)return;this.running=!0,this.timeline?.pause();const t=this.options.pin===!0?this.options.trigger:this.options.pin||null;t&&!this.options.container&&(this.pin=new Mn(t,{axis:this.options.horizontal?"x":"y",spacing:this.options.pinSpacing!==!1})),this.options.markers&&!this.options.horizontal&&typeof document<"u"&&(this.markers=new Cn(document,this.options.scroller??null,this.options.markers)),this.scrollTarget()?.addEventListener("scroll",this.onScroll,{passive:!0}),ht.length===0&&typeof window<"u"&&(ft={width:window.innerWidth,height:window.innerHeight},window.addEventListener("resize",In,{passive:!0})),ht.push(this),this.refresh()}stop(){this.running&&(this.running=!1,this.scrollTarget()?.removeEventListener("scroll",this.onScroll),ht.splice(ht.indexOf(this),1),ht.length===0&&typeof window<"u"&&window.removeEventListener("resize",In),this.stopSmoothing(),this.idleTimer!==null&&clearTimeout(this.idleTimer),this.idleTimer=null,this.snapTimer!==null&&clearTimeout(this.snapTimer),this.snapTimer=null,this.snapper.cancel())}destroy(){this.stop(),this.pin?.destroy(),this.pin=null,this.markers?.destroy(),this.markers=null}get startOffset(){return this.startPx}get endOffset(){return this.endPx}static refreshAll(){_n()}static onRefresh(t){return ut.add(t),()=>ut.delete(t)}get progress(){return this.targetProgress}get velocity(){return this.velocityPxPerSecond}refresh(){if(!this.running)return;this.measured&&this.options.onRefresh?.();const t=this.scrollPosition();this.pin?.release();const e=this.triggerRect();if(e&&this.options.container)this.measureInContainer(this.options.container);else if(e){const n=this.viewportHeight();if(this.startPx=t+lt(e,n,Pt(this.options.start)??"top bottom"),this.endPx=this.resolveEnd(e,n,t),this.pin){const s=this.relativeRect(this.pin.element.getBoundingClientRect());this.pin.apply(s.top-(this.startPx-t),this.endPx-this.startPx)}this.markerGeometry=this.markers?this.markersFor(n):null}this.markers&&this.markerGeometry&&this.markers.place(this.markerGeometry,t),this.lastScroll=null,this.updateFrom(t,!this.measured),this.measured=!0,io()}sample(){this.refresh()}update(t){this.running&&this.updateFrom(t??this.scrollPosition(),!1)}updateFrom(t,e){this.trackVelocity(t),this.markers&&this.markerGeometry&&this.markers.follow(this.markerGeometry,t);const n=this.endPx-this.startPx,s=this.zone;this.targetProgress=n>0?Oe((t-this.startPx)/n):t>=this.startPx?1:0,this.zone=n>0?t<=this.startPx?"before":t>=this.endPx?"after":"active":t>=this.startPx?"after":"before",this.fireBoundaryCallbacks(s,this.zone),e||this.smoothing()<=0?(this.displayProgress=this.targetProgress,this.applyProgress()):(this.emitUpdate(),this.startSmoothing())}smoothing(){const t=this.options.scrub;return typeof t=="number"?Math.max(0,t):0}resolveEnd(t,e,n){const s=Pt(this.options.end)??"bottom top",r=typeof s=="string"?s.trim().match(/^\+=\s*(-?[\d.]+)\s*(%|px)?$/):null;if(r){const o=Number.parseFloat(r[1]);return this.startPx+(r[2]==="%"?e*o/100:o)}return n+lt(t,e,s)}applyProgress(){const t=this.timeline?.duration??0;this.timeline&&t>0&&this.timeline.seek(this.displayProgress*t),this.emitUpdate()}emitUpdate(){if(!this.options.onUpdate)return;const t=[this.displayProgress,this.velocityPxPerSecond];this.lastEmitted&&this.lastEmitted[0]===t[0]&&this.lastEmitted[1]===t[1]||(this.lastEmitted=t,this.options.onUpdate(t[0],t[1]))}trackVelocity(t){const e=typeof performance<"u"?performance.now():Date.now();this.lastScroll!==null&&e>this.lastScrollTime&&t!==this.lastScroll&&(this.velocityPxPerSecond=(t-this.lastScroll)/(e-this.lastScrollTime)*1e3),(this.lastScroll===null||t!==this.lastScroll)&&(this.lastScroll=t,this.lastScrollTime=e),!(this.velocityPxPerSecond===0||typeof setTimeout>"u")&&(this.idleTimer!==null&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this.idleTimer=null,this.releaseVelocity=this.velocityPxPerSecond,this.velocityPxPerSecond=0,this.emitUpdate(),this.scheduleSnap()},eo))}fireBoundaryCallbacks(t,e){if(t===e)return;const{onEnter:n,onLeave:s,onEnterBack:r,onLeaveBack:o}=this.options;t==="before"?(n?.(),e==="after"&&s?.()):t==="after"?(r?.(),e==="before"&&o?.()):e==="after"?s?.():o?.()}scheduleSnap(){const t=this.options.snap;if(t===void 0||this.snapper.active)return;const e=An(t),n=()=>{this.snapTimer=null;const s=this.endPx-this.startPx,r=this.scrollPosition();if(!this.running||s<=0||r<=this.startPx||r>=this.endPx)return;const o=(r-this.startPx)/s,a=this.startPx+xn(o,this.releaseVelocity/s,e.snapTo)*s;Math.abs(a-r)<1||this.snapper.animate(r,a,En(e,a-r,this.viewportHeight()),e.ease)};e.delay?this.snapTimer=setTimeout(n,e.delay*1e3):n()}scrollTo(t){const e=this.options.scroller,n=this.options.horizontal?{left:t}:{top:t};e?typeof e.scrollTo=="function"?e.scrollTo({...n,behavior:"instant"}):this.options.horizontal?e.scrollLeft=t:e.scrollTop=t:typeof window<"u"&&window.scrollTo({...n,behavior:"instant"})}measureInContainer(t){const e=this.options.trigger;if(typeof e?.getBoundingClientRect!="function")return;const n=e.getBoundingClientRect(),s=this.options.scroller?.getBoundingClientRect?.().left??0,r=this.options.scroller?this.options.scroller.clientWidth:typeof window<"u"?window.innerWidth:0,o=n.left-s-t.shiftAt(t.progress()),{start:a,end:c}=t.range(),l=d=>a+d*(c-a),h=Ne(o,n.width,r,Pt(this.options.start)??"left right",t.shiftAt);this.startPx=l(h);const f=Pt(this.options.end)??"right left",u=typeof f=="string"?f.trim().match(/^\+=\s*(-?[\d.]+)\s*(px)?$/):null;this.endPx=u?this.startPx+Number.parseFloat(u[1]):l(Ne(o,n.width,r,f,t.shiftAt)),this.markerGeometry=null}markersFor(t){const e=(r,o)=>{const a=Pt(r)??o;if(typeof a=="number")return 0;if(/^\s*\+=/.test(a))return;const c=De(a);return t*c.viewportFraction-c.offsetPx},n=e(this.options.start,"top bottom")??0,s=e(this.options.end,"bottom top")??n;return{startViewport:n,endViewport:s,startPage:this.startPx+n,endPage:this.endPx+s}}startSmoothing(){if(this.rafId!==null||typeof requestAnimationFrame>"u")return;const t=e=>{if(this.rafId=null,!this.running)return;const n=this.lastFrameTime===null?16.67:e-this.lastFrameTime;this.lastFrameTime=e,this.displayProgress=kn(this.displayProgress,this.targetProgress,this.smoothing(),n);const s=Math.abs(this.targetProgress-this.displayProgress)<1e-4;s&&(this.displayProgress=this.targetProgress),this.applyProgress(),s?this.lastFrameTime=null:this.rafId=requestAnimationFrame(t)};this.rafId=requestAnimationFrame(t)}stopSmoothing(){this.rafId!==null&&typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(this.rafId),this.rafId=null,this.lastFrameTime=null}scrollTarget(){return this.options.scroller??(typeof window<"u"?window:null)}scrollPosition(){const t=this.options.scroller,e=this.options.horizontal;return t?(e?t.scrollLeft:t.scrollTop)??0:typeof window<"u"?(e?window.scrollX:window.scrollY)??0:0}triggerRect(){const t=this.options.trigger;return typeof t?.getBoundingClientRect!="function"?null:this.relativeRect(t.getBoundingClientRect())}relativeRect(t){const e=this.options.horizontal,n=e?t.left??0:t.top,s=e?t.right??0:t.bottom,r=e?t.width??0:t.height,o=this.options.scroller;if(o&&typeof o.getBoundingClientRect=="function"){const a=o.getBoundingClientRect(),c=e?a.left:a.top;return{top:n-c,bottom:s-c,height:r}}return{top:n,bottom:s,height:r}}viewportHeight(){const t=this.options.scroller,e=this.options.horizontal;return t?e?t.clientWidth:t.clientHeight:typeof window<"u"?e?window.innerWidth:window.innerHeight:0}}function Pt(i){return typeof i=="function"?i():i}function no(i){const t=new Et(i);return t.start(),t}const qe=new Set,so=16,Rn=.5,ro=2;class Xe{options;frames;running=!1;reduced=!1;current=0;target=0;written=null;velocityPxPerSecond=0;frameId=null;lastTime=null;journey=null;pausedState=!1;effects=[];onWheel=t=>this.wheel(t);onScroll=()=>this.nativeScroll();onResize=()=>this.refresh();onLoad=()=>this.refresh();stopListening=null;constructor(t={}){this.options=t,this.frames=t.frames??{request:e=>requestAnimationFrame(e),cancel:e=>cancelAnimationFrame(e)}}start(){if(this.running||typeof window>"u")return this;this.running=!0,this.reduced=this.options.reducedMotion??(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches),this.current=this.target=this.position();const t=this.options.scroller??window;return t.addEventListener("wheel",this.onWheel,{passive:!1}),t.addEventListener("scroll",this.onScroll,{passive:!0}),window.addEventListener("resize",this.onResize,{passive:!0}),window.addEventListener("load",this.onLoad),qe.add(this),this.stopListening=Et.onRefresh({beforeRefresh:()=>this.rest(),afterRefresh:()=>this.refresh()}),this.refresh(),this}static refreshAll(){for(const t of qe)t.refresh()}stop(){if(!this.running)return this;this.running=!1;const t=this.options.scroller??window;return t.removeEventListener("wheel",this.onWheel),t.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onResize),window.removeEventListener("load",this.onLoad),qe.delete(this),this.stopListening?.(),this.stopListening=null,this.cancelFrame(),this.journey=null,this}destroy(){this.stop();for(const t of this.effects)Ye(t.element,t.saved);this.effects=[]}kill(){this.destroy()}get state(){const t=this.limit();return{scroll:this.current,target:this.target,progress:t>0?this.current/t:0,velocity:this.velocityPxPerSecond}}paused(t){return t!==void 0&&(this.pausedState=t,t&&(this.target=this.current,this.journey=null)),this.pausedState}scrollTo(t,e={}){if(!this.running)return;const n=this.clamp(this.resolve(t)+(e.offset??0)),s=Math.abs(n-this.current),r=this.reduced?0:e.duration??Math.min(1.2,Math.max(.4,s/2500));if(r<=0){this.journey=null,this.current=this.target=n,this.write(n),this.applyEffects(0);return}this.target=n,this.journey={from:this.current,to:n,ms:r*1e3,ease:e.ease??vt,elapsed:0},this.requestFrame()}refresh(){if(!this.running)return;this.rest(),this.effects=[];const t=this.options.effects===!0?"[data-speed], [data-lag]":this.options.effects||"";if(t&&!this.reduced){const e=this.options.scroller??document,n=this.position(),s=this.viewportHeight(),r=this.options.scroller?.getBoundingClientRect().top??0;for(const o of e.querySelectorAll(t)){const a=Number.parseFloat(o.dataset.speed??""),c=Number.parseFloat(o.dataset.lag??""),l=o.getBoundingClientRect(),h=l.top-r+n;this.effects.push({element:o,speed:Number.isFinite(a)?a:void 0,lag:Number.isFinite(c)&&c>0?c:void 0,centre:h+l.height/2-s/2,lagged:n,shift:0,saved:o.style.getPropertyValue("translate")})}}this.current=this.target=this.clamp(this.position()),this.applyEffects(0)}rest(){for(const t of this.effects)Ye(t.element,t.saved)}wheel(t){if(this.pausedState||this.reduced||(this.options.smooth??.8)<=0||t.ctrlKey||Math.abs(t.deltaX)>Math.abs(t.deltaY)||this.nestedScrollerTakes(t))return;const e=t.deltaMode===1?so:t.deltaMode===2?this.viewportHeight():1,n=t.deltaY*e*(this.options.wheelMultiplier??1),s=this.clamp(this.target+n);s===this.target&&s===this.current||(t.preventDefault(),this.journey=null,this.target=s,this.requestFrame())}nativeScroll(){const t=this.position();this.written!==null&&Math.abs(t-this.written)<=ro||(this.written=null,this.journey=null,this.cancelFrame(),this.current=this.target=t,this.requestFrame())}nestedScrollerTakes(t){const e=this.options.scroller??document.documentElement;for(let n=t.target;n&&n!==e&&n!==document.body;n=n.parentElement){if(n.hasAttribute?.("data-smooth-ignore"))return!0;const s=getComputedStyle(n);if(!/(auto|scroll)/.test(s.overflowY)||n.scrollHeight<=n.clientHeight)continue;if(t.deltaY<0?n.scrollTop>0:n.scrollTop+n.clientHeight<n.scrollHeight-1)return!0}return!1}requestFrame(){this.frameId!==null||!this.running||(this.frameId=this.frames.request(t=>this.frame(t)))}cancelFrame(){this.frameId!==null&&this.frames.cancel(this.frameId),this.frameId=null,this.lastTime=null}frame(t){this.frameId=null;const e=this.lastTime===null?1e3/60:Math.min(100,t-this.lastTime);this.lastTime=t;const n=this.current;if(this.journey){const r=this.journey;r.elapsed+=e;const o=Math.min(1,r.elapsed/r.ms);this.current=r.from+(r.to-r.from)*r.ease(o),o>=1&&(this.journey=null)}else if(this.current!==this.target){const r=(this.options.smooth??.8)*1e3/3;this.current+=(this.target-this.current)*(1-Math.exp(-e/r)),Math.abs(this.target-this.current)<Rn&&(this.current=this.target)}this.current!==n&&this.write(this.current),this.velocityPxPerSecond=e>0?(this.current-n)*1e3/e:0;const s=this.applyEffects(e);this.current!==n&&this.options.onUpdate?.(this.state),this.journey||this.current!==this.target||s?this.requestFrame():(this.lastTime=null,this.velocityPxPerSecond=0)}applyEffects(t){let e=!1;const n=this.current;for(const s of this.effects){let r=0;if(s.speed!==void 0&&(r+=(n-s.centre)*(1-s.speed)),s.lag!==void 0){const o=s.lag*1e3/3;s.lagged=t===0?n:s.lagged+(n-s.lagged)*(1-Math.exp(-t/o)),Math.abs(n-s.lagged)<Rn?s.lagged=n:e=!0,r+=n-s.lagged}Ye(s.element,r===0?s.saved:`0 ${oo(r)}px`),s.shift=r}return e}write(t){const e=Math.round(t);this.written=e;const n=this.options.scroller;n?n.scrollTop=e:window.scrollTo({top:e,behavior:"instant"})}position(){const t=this.options.scroller;return t?t.scrollTop:window.scrollY}viewportHeight(){const t=this.options.scroller;return t?t.clientHeight:window.innerHeight}limit(){const t=this.options.scroller??document.documentElement;return Math.max(0,t.scrollHeight-this.viewportHeight())}clamp(t){return Math.max(0,Math.min(this.limit(),t))}resolve(t){if(typeof t=="number")return t;const e=this.options.scroller??document,n=typeof t=="string"?e.querySelector(t):t;if(!n)return this.current;const s=this.options.scroller?.getBoundingClientRect().top??0,r=this.effects.find(o=>o.element===n)?.shift??0;return n.getBoundingClientRect().top-s+this.position()-r}}function Ye(i,t){t?i.style.setProperty("translate",t):i.style.removeProperty("translate")}function oo(i){return Math.round(i*100)/100}function ao(i,t){switch(t){case"play":if(i.progress()>=1)break;i.reversed()?i.reverse():i.play();break;case"reverse":if(i.progress()<=0)break;i.reversed()?i.play():i.reverse();break;case"pause":i.pause();break;case"resume":i.resume();break;case"restart":i.restart();break;case"reset":i.pause(),i.progress(0);break;case"complete":i.pause(),i.progress(1);break}}function Ve(i,t,e,n,s=()=>{}){const r=d=>typeof d=="string"?i.query(d)??void 0:d,o=r(t.trigger)??n;if(!o){s(`gsap-compat: scrollTrigger has no trigger element${typeof t.trigger=="string"?` for "${t.trigger}"`:""}`);return}const a=t.scrub===void 0||t.scrub===!1?!1:t.scrub,c=(t.toggleActions??"play none none none").trim().split(/\s+/);let l=0,h;const f=(d,m)=>()=>{m?.(),e&&!a&&ao(e,c[d]??"none"),t.once&&d===0&&queueMicrotask(()=>h.destroy())},u=t.containerAnimation?ho(i,t.containerAnimation,o,s):void 0;return h=new Et({trigger:o,start:t.start,end:t.end,scrub:a===!1?void 0:a,pin:t.pin===!0?!0:r(t.pin),scroller:r(t.scroller),horizontal:t.horizontal,pinSpacing:t.pinSpacing,onRefresh:t.invalidateOnRefresh&&e?.invalidate?()=>e.invalidate():void 0,snap:t.snap===void 0?void 0:co(t.snap,e),markers:t.markers,container:u,onUpdate:(d,m)=>{if(e&&a!==!1&&e.progress(d),t.onUpdate){const p=d<l||m<0?-1:1;t.onUpdate({progress:d,velocity:m,direction:p})}l=d},onEnter:f(0,t.onEnter),onLeave:f(1,t.onLeave),onEnterBack:f(2,t.onEnterBack),onLeaveBack:f(3,t.onLeaveBack)}),e&&a===!1&&e.progress(0),h.start(),i.own(h)}function co(i,t){const e=s=>s==="labels"?r=>lo(r,t?.labelProgresses?.()??[]):s;if(typeof i!="object"||Array.isArray(i))return e(i);const n=i.ease?Mt(i.ease):void 0;return{snapTo:e(i.snapTo),duration:i.duration,delay:i.delay,ease:n?n.fn??V(n.easing):void 0}}function lo(i,t){return t.reduce((e,n)=>Math.abs(n-i)<Math.abs(e-i)?n:e,t[0]??i)}function ho(i,t,e,n){const s=()=>t.timeline.getTracks({property:"x"}).map(r=>r.target).filter(r=>{const o=i.elementFor(r);return!!o&&o!==e&&o.contains(e)});return s().length===0&&n("gsap-compat: containerAnimation does not move an ancestor of the trigger along x"),{range:()=>{const r=t.scrollTrigger;return r||n("gsap-compat: containerAnimation needs its own scrollTrigger (created before this one)"),{start:r?.startOffset??0,end:r?.endOffset??0}},progress:()=>t.progress(),shiftAt:r=>{const o=t.timeline.getStateAtTime(r*t.timeline.duration);let a=0;for(const c of s()){const l=o.values.get(c)?.get("x");typeof l=="number"&&(a+=l)}return a}}}class Ln{conditions={};scope;host;items=[];snapshots=new Map;constructor(t,e){this.host=t,this.scope=e}add(t){const e=this.host.collector;this.host.setCollector(this);try{const n=t();return typeof n=="function"&&this.items.push({revert:n}),n}finally{this.host.setCollector(e)}}track(t){this.items.push(t)}touch(t,e){this.snapshots.has(t)||this.snapshots.set(t,{name:e,style:t.getAttribute("style"),d:t.getAttribute("d")})}revert(){for(const t of this.items.splice(0).reverse())t.revert?t.revert():t.kill?t.kill():t.destroy?.();for(const[t,{name:e,style:n,d:s}]of this.snapshots)n===null?t.removeAttribute("style"):t.setAttribute("style",n),s!==null&&t.setAttribute("d",s),this.host.forget(e);this.snapshots.clear()}kill(){this.revert()}}class uo{host;scope;entries=[];listeners=[];scheduled=!1;constructor(t,e){this.host=t,this.scope=e}add(t,e){const n={conditions:t,setup:e,queries:new Map},s=typeof t=="string"?{matches:t}:t;if(typeof window<"u"&&typeof window.matchMedia=="function")for(const[r,o]of Object.entries(s)){const a=window.matchMedia(o);n.queries.set(r,a);const c=()=>this.scheduleUpdate();a.addEventListener("change",c),this.listeners.push(()=>a.removeEventListener("change",c))}return this.entries.push(n),this.update(n),this}revert(){for(const t of this.listeners.splice(0))t();for(const t of this.entries.splice(0))t.context?.revert()}kill(){this.revert()}scheduleUpdate(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1;for(const t of this.entries)this.update(t)}))}update(t){const e={};for(const[o,a]of t.queries)e[o]=a.matches;const n=Object.values(e).some(Boolean),s=n?JSON.stringify(e):void 0;if(s===t.key||(t.context?.revert(),t.context=void 0,t.key=s,!n))return;const r=new Ln(this.host,this.scope);r.conditions=e,r.add(()=>t.setup(r)),t.context=r}}class fo{frames;canvas;context;options;images;ready;current=0;drawn=-1;loadedCount=0;inFlight=0;destroyed=!1;onResize=()=>this.resize();constructor(t,e){this.canvas=t,this.context=t.getContext("2d"),this.options=e,this.frames=Math.max(1,Math.floor(e.frames)),this.images=new Array(this.frames),this.ready=new Array(this.frames).fill(!1),typeof window<"u"&&window.addEventListener("resize",this.onResize,{passive:!0}),this.resize(),this.pump()}get frame(){return this.current}set frame(t){this.current=Math.max(0,Math.min(this.frames-1,t)),this.draw()}get loaded(){return this.loadedCount}destroy(){this.destroyed=!0,typeof window<"u"&&window.removeEventListener("resize",this.onResize);for(const t of this.images)t&&(t.src="")}resize(){const t=typeof window<"u"?Math.min(window.devicePixelRatio||1,2):1,e=Math.round(this.canvas.clientWidth*t),n=Math.round(this.canvas.clientHeight*t);e>0&&n>0&&(this.canvas.width!==e||this.canvas.height!==n)&&(this.canvas.width=e,this.canvas.height=n),this.drawn=-1,this.draw()}draw(){const t=Math.round(this.current),e=this.nearestReady(t);if(e===-1||e===this.drawn||!this.context)return;const n=this.images[e],{width:s,height:r}=this.canvas,o=(this.options.fit??"cover")==="cover"?Math.max(s/n.naturalWidth,r/n.naturalHeight):Math.min(s/n.naturalWidth,r/n.naturalHeight),a=n.naturalWidth*o,c=n.naturalHeight*o;this.context.clearRect(0,0,s,r),this.context.drawImage(n,(s-a)/2,(r-c)/2,a,c),this.drawn=e,this.pump()}nearestReady(t){for(let e=0;e<this.frames;e++){if(t-e>=0&&this.ready[t-e])return t-e;if(t+e<this.frames&&this.ready[t+e])return t+e}return-1}pump(){const t=this.options.concurrency??6,e=Math.round(this.current);for(let n=0;n<this.frames&&this.inFlight<t;n++)for(const s of n===0?[e]:[e+n,e-n])s<0||s>=this.frames||this.images[s]||this.inFlight>=t||this.load(s)}load(t){const e=new Image;e.decoding="async",this.images[t]=e,this.inFlight++;const n=s=>{if(!this.destroyed){if(this.inFlight--,s){this.ready[t]=!0,this.loadedCount++,this.options.onProgress?.(this.loadedCount,this.frames);const r=Math.round(this.current);(Math.abs(t-r)<Math.abs(this.drawn-r)||this.drawn===-1)&&(this.drawn=-1,this.draw())}this.pump()}};e.onload=()=>n(!0),e.onerror=()=>n(!1),e.src=this.options.url(t)}}const po={opacity:0,y:-16},mo={opacity:0,y:16};async function go(i,t,e,n){const s=t.collector?.scope??t.root,r=s.ownerDocument??s,o=()=>n.shared?[...s.querySelectorAll(n.shared)]:[];if(n.native&&typeof r.startViewTransition=="function")return yo(r,n,o);const a=n.duration??.35,c=n.ease??"power2.inOut",l=y=>new Promise(b=>{y(b)||b()}),h=o(),f=h.length?Re(t,h):void 0,u=n.from!==void 0?Fn(t,n.from,n.shared):[];if(u.length&&n.leave!==!1){const y=n.leave??po;await l(b=>i.to(u,{...y,duration:a,ease:c,onComplete:b}))}await n.update();const d=[],m=typeof n.to=="function"?n.to():n.to,p=m!==void 0?Fn(t,m,n.shared):[];if(p.length&&n.enter!==!1){const y=n.enter??mo;d.push(l(b=>i.fromTo(p,y,{...wn(y),duration:a,ease:c,onComplete:b})))}if(f){const y=o().filter(b=>!h.includes(b));y.length&&d.push(l(b=>Fe(t,e,f,{targets:y,duration:a*1.4,ease:c,enter:!1,onComplete:b})))}await Promise.all(d)}function Fn(i,t,e){const n=i.resolveTargets(t).map(s=>i.elementFor(s)).filter(s=>!!s);return e?n.flatMap(s=>!s.querySelector(e)&&!s.matches(e)?[s]:[...s.children].filter(r=>!r.matches(e)&&!r.querySelector(e))):n}async function yo(i,t,e){const n=(a,c)=>{const l=a.dataset?.flipId;l&&a.style.setProperty("view-transition-name",c?`tf-${l.replace(/[^\w-]/g,"-")}`:"")},s=e();s.forEach(a=>n(a,!0));let r=[];await i.startViewTransition(async()=>{s.forEach(a=>n(a,!1)),await t.update(),r=e(),r.forEach(a=>n(a,!0))}).finished,r.forEach(a=>n(a,!1))}const $n={create:(i,t)=>Se(i,Wi(t))},Dn={create:(i,t)=>Se(i,{fn:Ui(t)})},On={create:(i,t)=>Se(i,{fn:ji(t)})},bo=new Set(["keyframes","duration","delay","ease","easeEach","stagger","repeat","repeatDelay","yoyo","repeatRefresh","paused","id","onStart","onUpdate","onComplete","onRepeat","onReverseComplete","scrollTrigger"]),Nn=.5,vo="power1.inOut";function wo(i){return i.keyframes!==void 0&&i.keyframes!==null}function To(i){const t=i.keyframes,e={};for(const[l,h]of Object.entries(i))bo.has(l)||(e[l]=h);if(Array.isArray(t))return t.map(l=>({...e,...l,duration:l.duration??i.duration??Nn}));const n=Object.entries(t),s=i.duration??Nn,r=t.easeEach??i.easeEach??vo;if(n.length>0&&n.every(([l])=>/^\s*-?\d+(\.\d+)?\s*%\s*$/.test(l)||l==="easeEach")){const l=n.filter(([u])=>u!=="easeEach").map(([u,d])=>({at:Number.parseFloat(u)/100,step:d})).sort((u,d)=>u.at-d.at),h=[];let f=0;for(const{at:u,step:d}of l){const m=Math.max(0,u-f);h.push({...e,ease:r,...d,duration:m*s}),f=u}return h}const o=n.filter(([l,h])=>l!=="easeEach"&&Array.isArray(h)),a=Math.max(0,...o.map(([,l])=>l.length)),c=[];for(let l=0;l<a;l++){const h={...e,ease:r,duration:s/a};for(const[f,u]of o)l<u.length&&(h[f]=u[l]);c.push(h)}return c}function Bn(i,t,e,n={}){const s=t.collector?.scope??t.root,r=typeof n.scroller=="string"?s.querySelector(n.scroller):n.scroller??null,o={x:r?r.scrollLeft:window.scrollX,y:r?r.scrollTop:window.scrollY},a={x:r?r.scrollWidth-r.clientWidth:document.documentElement.scrollWidth-window.innerWidth,y:r?r.scrollHeight-r.clientHeight:document.documentElement.scrollHeight-window.innerHeight},c=(w,v)=>{if(v===void 0)return o[w];if(typeof v=="number")return v;if(v==="max")return a[w];const k=typeof v=="string"?s.querySelector(v):v;if(!k)return o[w];const T=k.getBoundingClientRect(),S=r?.getBoundingClientRect(),A=(w==="x"?n.offsetX:n.offsetY)??n.offset??0;return w==="x"?T.left-(S?.left??0)+o.x-A:T.top-(S?.top??0)+o.y-A},l=typeof e=="object"&&e!==null&&!("nodeType"in e)?{x:c("x",e.x),y:c("y",e.y)}:{x:o.x,y:c("y",e)},h={x:Math.max(0,Math.min(a.x,l.x)),y:Math.max(0,Math.min(a.y,l.y))},f={...o},u=()=>{r?(r.scrollLeft=f.x,r.scrollTop=f.y):window.scrollTo({left:f.x,top:f.y,behavior:"instant"})},d=["wheel","touchstart","keydown"],m=r??window,p=()=>{b.kill(),y()},y=()=>{for(const w of d)m.removeEventListener(w,p)},b=i.to(f,{x:h.x,y:h.y,duration:n.duration??1,ease:n.ease??"power2.inOut",onStart:n.onStart,onUpdate:()=>{u(),n.onUpdate?.()},onComplete:()=>{y(),n.onComplete?.()}});if(n.autoKill!==!1)for(const w of d)m.addEventListener(w,p,{passive:!0});return b}function ko(i,t,e){const n=i.collector?.scope??i.root,s=typeof t=="string"?[...n.querySelectorAll(t)]:"nodeType"in t?[t]:Array.from(t),{interval:r=.1,batchMax:o,onEnter:a,onLeave:c,onEnterBack:l,onLeaveBack:h,...f}=e,u={onEnter:a,onLeave:c,onEnterBack:l,onLeaveBack:h},d={onEnter:[],onLeave:[],onEnterBack:[],onLeaveBack:[]},m={},p=b=>{m[b]!==void 0&&clearTimeout(m[b]),m[b]=void 0;const w=d[b].splice(0);w.length>0&&u[b]?.(w)},y=(b,w)=>{if(u[b]){if(d[b].push(w),o!==void 0&&d[b].length>=o)return p(b);m[b]===void 0&&(m[b]=setTimeout(()=>p(b),r*1e3))}};return s.map(b=>Ve(i,{...f,trigger:b,onEnter:()=>y("onEnter",b),onLeave:()=>y("onLeave",b),onEnterBack:()=>y("onEnterBack",b),onLeaveBack:()=>y("onLeaveBack",b)})).filter(b=>b!==void 0)}class z{compat;stage;options;autoplayPending;started=!1;killed=!1;recipe=[];firstElement;scrollDriver;events=[];ranges=[];playhead={time:0,iteration:0,direction:"forward",fresh:!0};waitingToWrap=!1;finishedThisFrame=!1;backwards=!1;constructor(t,e={}){this.stage=t;const n={...e,onWarning:e.onWarning??t.onWarning};if(this.options=n,this.compat=new tt({...n,startValue:(s,r)=>{const o=t.objectFor(s);if(o)return Ao(o[r]);const a=t.appliedValue(s,r);if(a!==void 0)return a;if(r==="d")return hn(t.elementFor(s))??void 0;if(r==="text")return t.elementFor(s)?.textContent??void 0;if(r==="strokeDasharray"||r==="strokeDashoffset"){const c=Wn(t.elementFor(s));if(c!==void 0)return r==="strokeDasharray"?[c,c]:0}},startVelocity:(s,r)=>t.velocityOf(s,r),layoutColumns:s=>Vn(s.map(r=>t.elementFor(r))),random:()=>t.utils.random(0,1)}),this.compat.timeline.onComplete=()=>{this.finishedThisFrame=!0},t.collector?.track(this),t.liveTimelines.add(this),this.autoplayPending=!n.paused&&!n.scrollTrigger,n.scrollTrigger){const s=n.scrollTrigger;queueMicrotask(()=>{this.killed||(this.scrollDriver=Ve(t,s,this,this.firstElement,r=>n.onWarning?.(r)))})}this.autoplayPending&&queueMicrotask(()=>{this.autoplayPending&&this.play()})}get timeline(){return this.compat.timeline}get scrollTrigger(){return this.scrollDriver}to(t,e,n){return wo(e)?this.record(()=>this.keyframed(t,e,n)):this.record(()=>this.tween(t,[e],n,([s],r,o)=>this.compat.to(r,s,o)))}from(t,e,n){return this.record(()=>this.tween(t,[e],n,([s],r,o)=>this.compat.from(r,s,o)))}fromTo(t,e,n,s){return this.record(()=>this.tween(t,[e,n],s,([r,o],a,c)=>this.compat.fromTo(a,r,o,c)))}set(t,e,n){return this.record(()=>this.tween(t,[e],n,([s],r,o)=>this.compat.set(r,s,o)))}addLabel(t,e){return this.record(()=>this.compat.addLabel(t,e))}add(t,e){return this.record(()=>{t.autoplayPending=!1,t.timeline.stop(),t.stage.deactivate(t.timeline),this.compat.add(t.compat,e)})}invalidate(){const t=this.compat.progress();this.compat.progress(0),this.stage.render(this.timeline),this.compat.reset(),this.events=[],this.ranges=[];for(const e of this.recipe)e();return this.syncDuration(),this.compat.progress(t),this.stage.render(this.timeline),this}call(t,e=[],n){return this.record(()=>{const s=this.compat.addEvent(n);this.events.push({time:s,run:()=>t(...e)})})}addPause(t,e,n=[]){return this.record(()=>{const s=this.compat.addEvent(t);this.events.push({time:s,pause:!0,run:()=>e?.(...n)})})}tweenTo(t,e={}){return this.tweenFromTo(this.timeline.currentTime/1e3,t,e)}tweenFromTo(t,e,n={}){this.pause(),this.seek(t);const s=this.timeline.currentTime,r=Math.max(0,Math.min(this.timeline.duration,this.compat.timeOf(e))),o={time:s},a=n.duration??Math.abs(r-s)/1e3/(this.timeScale()||1),c=new z(this.stage,{onStart:n.onStart,onComplete:n.onComplete});return c.to(o,{time:r,duration:a,ease:n.ease??"none",onUpdate:()=>{this.moveTo(o.time),n.onUpdate?.()}}),c}play(){this.autoplayPending=!1,this.started||(this.started=!0,this.options.onStart?.());const t=this.timeline.playbackState==="playing",e=this.timeline.playbackState==="paused";if(this.timeline.play(),!t){const n=this.timeline,s=n.direction==="forward"?n.currentTime===0:n.currentTime===n.duration;this.playhead={...this.readPlayhead(),fresh:s&&!e},this.waitingToWrap=!1}return this.stage.liveTimelines.add(this),this.stage.render(this.timeline),this.stage.activate(this.timeline,{onUpdate:()=>this.afterFrame()}),this}pause(){return this.autoplayPending=!1,this.timeline.pause(),this.stage.deactivate(this.timeline),this}resume(){return this.play()}restart(){return this.timeline.stop(),this.backwards=!1,this.play()}reverse(){this.backwards=!this.backwards;const t=this.timeline.playbackState==="idle"&&this.timeline.direction==="forward";return this.timeline.reverse(),t&&this.timeline.currentTime===0&&this.timeline.seek(this.timeline.duration),this.play()}labelProgresses(){const t=this.timeline.duration;return t>0?this.compat.labelTimes().map(e=>e/t):[]}reversed(){return this.timeline.direction==="reverse"}seek(t){return this.autoplayPending=!1,this.compat.seek(t),this.stage.render(this.timeline),this.playhead=this.readPlayhead(),this.waitingToWrap=!1,this.options.onUpdate?.(),this}progress(t){return t===void 0?this.compat.progress():(this.autoplayPending=!1,this.moveTo(Math.max(0,Math.min(1,t))*this.timeline.duration),this.compat.progress())}timeScale(t){return this.compat.timeScale(t)}duration(){return this.compat.duration()}isActive(){return this.timeline.playbackState==="playing"}kill(){return this.killed=!0,this.stage.liveTimelines.delete(this),this.scrollDriver?.destroy(),this.scrollDriver=void 0,this.autoplayPending=!1,this.timeline.stop(),this.stage.deactivate(this.timeline),this.compat.kill(),this}toDefinition(){return this.compat.toDefinition()}killTweensOf(t,e){for(const n of t)for(const s of e??[void 0])this.timeline.removeTracks({target:n,...s!==void 0&&{property:s}});this.timeline.tracks.length===0&&this.events.length===0&&this.kill()}record(t){return this.recipe.push(t),t(),this.syncDuration(),this}syncDuration(){if(this.events.length===0)return;this.timeline.setDuration(void 0);const t=Math.max(...this.events.map(e=>e.time));t>this.timeline.duration&&this.timeline.setDuration(t)}readPlayhead(){const t=this.timeline;return{time:t.currentTime,iteration:t.loopIteration,direction:t.direction}}moveTo(t){const e=this.playhead;this.timeline.seek(t),this.stage.render(this.timeline);const n={time:this.timeline.currentTime,iteration:this.timeline.loopIteration,direction:t>=e.time?"forward":"reverse"},s={...e,iteration:n.iteration,direction:n.direction};this.playhead={...this.readPlayhead()},this.waitingToWrap=!1,this.runCrossings(s,n,!1),this.options.onUpdate?.()}refreshForRepeat(){const t=this.timeline.currentTime;this.compat.reset(),this.events=[],this.ranges=[];for(const e of this.recipe)e();this.syncDuration(),this.timeline.seek(Math.min(t,this.timeline.duration))}afterFrame(){const t=this.timeline,e=t.repeatDelayRemaining>0;if(this.waitingToWrap&&e){this.options.onUpdate?.();return}this.waitingToWrap=!1;const n=this.playhead,s=this.readPlayhead();this.playhead=s;const r=this.options.yoyo===!0;e&&!r&&s.iteration>n.iteration&&(this.playhead={time:0,iteration:s.iteration,direction:"forward",fresh:!0},this.waitingToWrap=!0);const o=this.runCrossings(n,s,e);if(this.options.onUpdate?.(),this.finishedThisFrame&&!o){this.finishedThisFrame=!1;const a=t.currentTime===0&&t.direction==="reverse";!this.scrollDriver&&!r&&this.stage.liveTimelines.delete(this),a&&this.backwards?this.options.onReverseComplete?.():this.options.onComplete?.()}this.finishedThisFrame=!1}runCrossings(t,e,n){if(this.events.length===0&&this.ranges.length===0&&!this.options.onRepeat&&!this.options.repeatRefresh)return!1;const s=this.events,{crossings:r,passes:o}=ve(s.map(a=>a.time),t,e,{duration:this.timeline.duration,alternate:this.options.yoyo===!0,holding:n});for(const a of r){if(this.killed)return!0;if(a.kind==="repeat"){this.options.repeatRefresh&&this.refreshForRepeat(),this.options.onRepeat?.();continue}const c=s[a.index];if(!(c.direction&&c.direction!==a.direction)){if(c.pause)return this.timeline.seek(c.time),this.stage.render(this.timeline),this.pause(),this.playhead=this.readPlayhead(),this.waitingToWrap=!1,c.run(),!0;c.run()}}for(const a of this.ranges)o.some(([l,h])=>l!==h&&Math.max(l,h)>=a.start&&Math.min(l,h)<=a.end)&&a.run();return!1}tween(t,e,n,s){const r=this.resolve(t);if(!r)return;const{onStart:o,onUpdate:a,onComplete:c}=e[e.length-1];if(o||a||c){let l=1/0,h=-1/0;const f=(u,d,m)=>{s(u,d,m),l=Math.min(l,this.compat.lastStart),h=Math.max(h,this.compat.lastEnd)};if(this.buildTween(r,e,n,f),l===1/0)return;o&&this.events.push({time:l,direction:"forward",run:o}),a&&this.ranges.push({start:l,end:h,run:a}),c&&this.events.push({time:h,direction:"forward",run:c});return}this.buildTween(r,e,n,s)}keyframed(t,e,n){const s=this.resolve(t);if(!s)return;const r=To(e);if(r.length===0)return;const o=s.length>1?xe(e.stagger,this.staggerContext(s)):void 0,a=s.map(y=>this.targetFor(y)).filter(y=>y!==void 0),c=o?a.map(y=>[y]):[a],l=o?Lt(s.length,o).map(y=>y/1e3):[0],h=this.compat.timeOf(n)/1e3+jt(e.delay,0)/1e3;let f=1/0,u=-1/0;if(c.forEach((y,b)=>{r.forEach((w,v)=>{const k=v===0?h+l[b]:">";this.tween(y,[w],k,([T],S,A)=>this.compat.to(S,T,A)),f=Math.min(f,this.compat.lastStart),u=Math.max(u,this.compat.lastEnd)})}),f===1/0)return;const{onStart:d,onUpdate:m,onComplete:p}=e;d&&this.events.push({time:f,direction:"forward",run:d}),m&&this.ranges.push({start:f,end:u,run:m}),p&&this.events.push({time:u,direction:"forward",run:p})}staggerContext(t){return{count:t.length,columnsFromLayout:()=>Vn(t.map(e=>this.stage.elementFor(e))),random:()=>this.stage.utils.random(0,1)}}buildTween(t,e,n,s){const r=t.map(u=>this.targetFor(u));if(!(t.length>1&&(e.some(Mo)||t.some(u=>this.stage.objectFor(u)!==void 0)))){const u=this.targetFor(t[0]);s(e.map(d=>this.prepare(Yn(d,0,u,this.stage.utils,r),t)),t,n);return}const a=e.length-1,{stagger:c,...l}=e[a],h=xe(c,this.staggerContext(t)),f=h?Lt(t.length,h).map(u=>u/1e3):t.map(()=>0);t.forEach((u,d)=>{const m=d===0?jt(l.delay,0)/1e3+f[0]:0,p=d===0?0:f[d]-f[d-1],y=d===0?n:`<${p<0?"-":"+"}${Math.abs(p).toFixed(6)}`,w=e.map((v,k)=>k===a?{...l,delay:m}:v).map(v=>this.prepare(Yn(v,d,this.targetFor(u),this.stage.utils,r),[u]));s(w,[u],y)})}targetFor(t){return this.stage.elementFor(t)??this.stage.objectFor(t)}prepare(t,e){const n=o=>this.options.onWarning?.(o),s=o=>this.stage.query(o);let r=t;if(t.motionPath!==void 0){const o=$r(t.motionPath,{query:s,targets:e.map(a=>this.stage.elementFor(a)).filter(a=>!!a),warn:n});r={...r,motionPath:o}}if(t.morphSVG!==void 0){const o=Dr(t.morphSVG,s,n),{morphSVG:a,...c}=r;r=o?{...r,morphSVG:o}:c}if(t.drawSVG!==void 0){const o=Wn(this.stage.elementFor(e[0]));if(o===void 0){n("gsap-compat: drawSVG needs an SVG shape with a stroke (path, line, circle…)");const{drawSVG:a,...c}=r;r=c}else r=fr(r,o)}return r}resolve(t){const e=this.stage.resolveTargets(t);if(e.length===0){this.options.onWarning?.(`gsap-compat: no elements found for target ${xo(t)}`);return}return this.firstElement??=e.map(n=>this.stage.elementFor(n)).find(n=>n!==void 0),e}}function qn(i=new on){const t=r=>{const{config:o}=Ut(r);return new z(i,{repeat:o.repeat,yoyo:o.yoyo,repeatDelay:o.repeatDelay,paused:o.paused,onStart:o.onStart,onUpdate:o.onUpdate,onComplete:o.onComplete,onRepeat:o.onRepeat,onReverseComplete:o.onReverseComplete,repeatRefresh:o.repeatRefresh,scrollTrigger:o.scrollTrigger})},e=r=>{const{onStart:o,onUpdate:a,onComplete:c,onRepeat:l,onReverseComplete:h,repeatRefresh:f,...u}=r;return u},n=r=>(r&&i.collector?.track(r),r),s={stage:i,ticker:i.ticker,utils:i.utils,getProperty:(r,o)=>{const[a]=i.resolveTargets(r);if(a===void 0)return;const c=i.objectFor(a);return c?c[o]:i.appliedValue(a,o)??tn(o)},scrollTrigger:r=>n(Ve(i,r)),scrollBatch:(r,o)=>ko(i,r,o).map(a=>n(a)),scrollTo:(r,o)=>Bn(s,i,r,o),refreshScroll:()=>{Et.refreshAll(),Xe.refreshAll()},smoothScroll:(r={})=>{const o=typeof r.scroller=="string"?(i.collector?.scope??i.root).querySelector(r.scroller):r.scroller;return n(new Xe({...r,scroller:o}).start())},context:(r,o)=>{const a=new Ln(i,o);return r&&a.add(()=>r(a)),a},matchMedia:r=>new uo(i,r),customEase:$n.create,customBounce:Dn.create,customWiggle:On.create,pageTransition:r=>go(s,i,o=>new z(i,o),r),imageSequence:(r,o)=>{const a=typeof r=="string"?(i.collector?.scope??i.root).querySelector(r):r;if(!(a instanceof HTMLCanvasElement))throw new Error(`gsap-compat: imageSequence needs a <canvas>, got ${String(r)}`);return n(new fo(a,o))},quickTo:(r,o,a={})=>{const c=new z(i,{paused:!0}),[l]=i.resolveTargets(r);return Object.assign(f=>{if(!l)return;const u=a.spring!==void 0?i.velocityOf(l,o)??0:0;c.compat.reset(),c.compat.to(l,{[o]:f,duration:a.duration??.4,ease:a.ease??"power3.out",...a.spring!==void 0&&{spring:So(a.spring,o,u)}}),c.timeline.stop(),c.timeline.play(),i.activate(c.timeline)},{tween:c,kill:()=>c.kill()})},timeline:r=>new z(i,r),to:(r,o)=>{if(o.scrollTo!==void 0){const{scrollTo:a,...c}=o,l=typeof a=="object"&&a!==null&&!("nodeType"in a)?a:{},h=typeof r!="string"&&r!==window&&r.nodeType===1;return Bn(s,i,a,{...c,offsetX:l.offsetX,offsetY:l.offsetY,scroller:h?r:void 0})}return t(o).to(r,e(o))},from:(r,o)=>t(o).from(r,e(o)),fromTo:(r,o,a)=>t(a).fromTo(r,o,e(a)),set:(r,o)=>t(o).set(r,e(o)),delayedCall:(r,o,a)=>new z(i).call(o,a,r),killTweensOf:(r,o)=>{const a=i.resolveTargets(r),c=typeof o=="string"?o.split(",").map(l=>l.trim()).filter(Boolean):o;for(const l of[...i.liveTimelines])l.killTweensOf(a,c)},convertToPath:r=>Nr(r,i.root),splitText:(r,o)=>{const a=i.collector?.scope??i.root,c=typeof r=="string"?Array.from(a.querySelectorAll(r)):"nodeType"in r?[r]:Array.from(r);return n(jr(c,o))},draggable:(r,o)=>n(Yr(s,i,r,o)),getFlipState:r=>Re(i,r),flipFrom:(r,o)=>Fe(i,a=>new z(i,a),r,o),flip:(r,o,a)=>{const c=Re(i,r);return o(),Fe(i,l=>new z(i,l),c,{targets:r,...a})}};return s}const q=qn();function So(i,t,e){return i===!0?{velocity:{[t]:e}}:typeof i=="string"?{preset:i,velocity:{[t]:e}}:{...i,velocity:{[t]:e}}}function Mo(i){return i.morphSVG!==void 0||i.drawSVG!==void 0||i.text!==void 0||i.scrambleText!==void 0||Xn(i)}function Xn(i){return Object.entries(i).some(([t,e])=>(typeof e=="function"||Zi(e))&&!Ae.has(t))}function Yn(i,t,e,n,s){if(!Xn(i))return i;const r={};for(const[o,a]of Object.entries(i))Ae.has(o)?r[o]=a:typeof a=="function"?r[o]=a(t,e,s):Zi(a)?r[o]=n.resolveRandomString(a):r[o]=a;return r}function Vn(i){const t=i.map(n=>n?.getBoundingClientRect().top);if(t[0]===void 0)return i.length;let e=0;for(const n of t){if(n===void 0||Math.abs(n-t[0])>1)break;e++}return Math.max(1,e)}function Wn(i){const t=i;if(typeof t?.getTotalLength=="function")return t.getTotalLength()}function Ao(i){if(typeof i=="number"||typeof i=="string"||Array.isArray(i)&&i.every(t=>typeof t=="number"))return i}function xo(i){return typeof i=="string"?`"${i}"`:String(i)}class We{media;offset;driftTolerance;constructor(t,e={}){this.media=t,this.offset=e.offset??0,this.driftTolerance=Math.max(0,e.driftTolerance??.15)}targetTime(t){return Math.max(0,t/1e3+this.offset)}update(t,e){const n=this.targetTime(t);e?(this.media.paused&&this.safePlay(),Math.abs(this.media.currentTime-n)>this.driftTolerance&&(this.media.currentTime=n)):(this.media.paused||this.media.pause(),this.media.currentTime!==n&&(this.media.currentTime=n))}seek(t){this.media.currentTime=this.targetTime(t)}setRate(t){this.media.playbackRate=t}dispose(){this.media.paused||this.media.pause()}safePlay(){const t=this.media.play();t&&typeof t.catch=="function"&&t.catch(()=>{})}}function Un(i,t,e,n,s){const r=e-s;if(r<0){t.paused||t.pause(),t.currentTime=0;return}i.update(r,n)}class Gt{container;timeline=null;adapter;animationFrameId;lastTime;options;targets={};isDestroyed=!1;mediaSync;mediaTargets=[];symbolInstances=[];scenarioList=[];scenarioId;authored=new Map;markerList=[];listeners=new Set;playhead={time:0,iteration:0,direction:"forward"};stepping=!1;lastMarkerId=null;reducedQuery;onReducedChange=()=>this.applyReducedMotion();visibilityObserver;onScreen=!0;pausedByVisibility=!1;autoplayWhenSeen=!1;onDocumentVisibility=()=>this.updateVisibility();constructor(t,e={}){if(typeof t=="string"){const n=document.querySelector(t);if(!n)throw new Error(`Container not found: ${t}`);this.container=n}else this.container=t;this.options=e,this.adapter=new et}async load(t){this.scenarioList=[],this.scenarioId=void 0,await this.loadSource(t)}async loadSource(t){let e;if(typeof t=="string"){const n=await fetch(t);if(!n.ok)throw new Error(`Failed to load animation: ${n.statusText}`);e=await n.json()}else e=t;this.useDefinition(e),this.showInitialFrame(),this.watchReducedMotion(),this.watchVisibility(),this.options.autoplay&&!this.reducedMotion&&(this.options.playWhenVisible&&!this.onScreen?this.autoplayWhenSeen=!0:this.play())}useDefinition(t){const e={...t.config};this.options.speed!==void 0&&(e.speed=this.options.speed),this.options.loop!==void 0&&(e.loop=this.options.loop),this.options.alternate!==void 0&&(e.alternate=this.options.alternate),this.timeline=ct({...t,config:e}),this.markerList=this.timeline.markers,this.lastMarkerId=null,this.options.onComplete&&(this.timeline.onComplete=this.options.onComplete),this.options.onUpdate&&(this.timeline.onUpdate=this.options.onUpdate),this.autoRegisterTargets(),this.setupSymbolInstances(),this.scanMedia()}async loadScenarios(t,e={}){if(t.length===0)throw new Error("tinyfly: loadScenarios needs at least one scenario");const n=new Set;for(const r of t){if(n.has(r.id))throw new Error(`tinyfly: scenario id "${r.id}" is used more than once`);n.add(r.id)}const s=e.initial===void 0?t[0]:t.find(r=>r.id===e.initial);if(!s)throw new Error(`tinyfly: there is no scenario "${e.initial}"`);this.scenarioList=[...t],this.scenarioId=s.id,await this.loadSource(s.timeline)}get scenarios(){return this.scenarioList.map(t=>({id:t.id,label:t.label??t.id}))}get scenario(){return this.scenarioId}setScenario(t){const e=this.scenarioList.find(a=>a.id===t);if(!e||!this.timeline)return!1;if(t===this.scenarioId)return!0;const n=this.isPlaying,s=this.currentTime>=this.duration-.5,r=this.currentMarker?.id;this.stopAnimationLoop(),this.stepping=!1,this.pausedByVisibility=!1,this.restoreAuthored(),this.scenarioId=t,this.useDefinition(e.timeline),this.lastMarkerId=null;let o=0;return this.reducedMotion||s?o=this.duration:r!==void 0&&(o=this.markers.find(a=>a.id===r)?.time??0),this.seek(o),n&&!this.reducedMotion?(this.stepping=this.options.stepMode===!0,this.startPlaying()):this.notify(),!0}rememberAuthored(t){if(this.authored.has(t))return;const e={style:t.getAttribute("style")};t.children.length===0&&(e.text=t.textContent??"");const n=t.tagName.toLowerCase()==="path"?t:t.querySelector("path");n&&(e.path={element:n,d:n.getAttribute("d")}),this.authored.set(t,e)}restoreAuthored(){for(const[t,e]of this.authored){e.style===null?t.removeAttribute("style"):t.setAttribute("style",e.style),e.text!==void 0&&t.textContent!==e.text&&(t.textContent=e.text),e.path&&(e.path.d===null?e.path.element.removeAttribute("d"):e.path.element.setAttribute("d",e.path.d));const n=t.dataset;n&&delete n.shineBase}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(){for(const t of this.listeners)t()}get reducedMotion(){return this.reducedQuery?.matches===!0}get markers(){return this.markerList}get currentMarker(){const t=this.currentTime;let e;for(const n of this.markers)if(n.time<=t+.5)e=n;else break;return e}caption(t,e){const n=t?this.markers.find(o=>o.id===t):this.currentMarker;if(!n)return;const s=e??this.language(),r=o=>o?.[s]?.[n.id]??o?.[s.split("-")[0]]?.[n.id];return r(this.options.captions)??r(this.timeline?.captions)??n.label}next(){if(!this.timeline)return;const t=this.currentTime,e=this.markers.find(n=>n.time>t+.5);if(this.reducedMotion){this.seek(e?e.time:this.duration);return}t>=this.duration-.5||(this.stepping=e!==void 0,this.startPlaying())}prev(){if(!this.timeline)return;const t=this.currentTime,e=[...this.markers].reverse().find(n=>n.time<t-.5);this.pause(),this.seek(e?e.time:0)}goToMarker(t){const e=this.markers.find(n=>n.id===t);e&&(this.pause(),this.seek(e.time))}language(){return this.container.closest("[lang]")?.getAttribute("lang")||(typeof document<"u"?document.documentElement.lang:"")||"en"}showInitialFrame(){if(!this.timeline)return;const t=this.options.initialFrame??"start";if(t==="none")return;const e=t==="end"?this.timeline.duration:t==="start"?0:t;this.timeline.seek(Math.max(0,Math.min(this.timeline.duration,e))),this.applyState()}watchReducedMotion(){this.options.respectReducedMotion===!1||typeof window>"u"||typeof window.matchMedia!="function"||(this.reducedQuery??=window.matchMedia("(prefers-reduced-motion: reduce)"),this.reducedQuery.addEventListener?.("change",this.onReducedChange),this.reducedQuery.matches&&this.applyReducedMotion())}applyReducedMotion(){!this.reducedMotion||!this.timeline||(this.autoplayWhenSeen=!1,this.pause(),this.seek(this.timeline.duration))}watchVisibility(){if(!(!this.options.playWhenVisible||typeof window>"u")){if(typeof IntersectionObserver=="function"){this.visibilityObserver?.disconnect(),this.visibilityObserver=new IntersectionObserver(e=>{for(const n of e)this.onScreen=n.isIntersecting;this.updateVisibility()}),this.visibilityObserver.observe(this.container);const t=this.container.getBoundingClientRect?.();t&&(t.width>0||t.height>0)&&(this.onScreen=t.bottom>0&&t.top<window.innerHeight&&t.right>0&&t.left<window.innerWidth)}document.addEventListener("visibilitychange",this.onDocumentVisibility)}}updateVisibility(){const t=this.onScreen&&document.visibilityState!=="hidden";!t&&this.isPlaying?(this.pausedByVisibility=!0,this.pause()):t&&(this.pausedByVisibility||this.autoplayWhenSeen)&&!this.reducedMotion&&(this.pausedByVisibility=!1,this.autoplayWhenSeen=!1,this.startPlaying())}announceMarker(){if(!this.options.onMarker)return;const t=this.currentMarker,e=t?.id;e!==this.lastMarkerId&&(this.lastMarkerId=e,this.options.onMarker(t))}scanMedia(){this.mediaTargets=[],this.container.querySelectorAll("[data-tinyfly-media]").forEach(e=>{const n=e,s=Number(n.getAttribute("data-tinyfly-start")??"0")||0,r=n.getAttribute("data-volume");r!==null&&(n.volume=Math.max(0,Math.min(1,Number(r)||0))),this.mediaTargets.push({el:n,startTime:s,sync:new We(n)})})}syncAllMedia(t,e){for(const n of this.mediaTargets)Un(n.sync,n.el,t,e,n.startTime)}loadFromString(t){const e=JSON.parse(t);this.load(e)}registerTarget(t,e){if(typeof e=="string"){const n=this.container.querySelector(e);n&&(this.rememberAuthored(n),this.targets[t]=n,this.adapter.registerTarget(t,n))}else this.rememberAuthored(e),this.targets[t]=e,this.adapter.registerTarget(t,e)}autoRegisterTargets(){this.container.querySelectorAll("[data-tinyfly]").forEach(e=>{const n=e.closest("[data-tinyfly-symbol]");if(n&&n!==e)return;const s=e.getAttribute("data-tinyfly");s&&this.registerTarget(s,e)}),this.timeline&&new Set(this.timeline.tracks.map(n=>n.target)).forEach(n=>{if(!this.targets[n]){const s=this.container.querySelector(`[data-tinyfly="${n}"]`)||this.container.querySelector(`.${n}`)||this.container.querySelector(`#${n}`);s&&this.registerTarget(n,s)}})}setupSymbolInstances(){this.symbolInstances=[];const t=this.options.symbols;if(!t||t.length===0)return;const e=new Map(t.map(n=>[n.id,n]));this.container.querySelectorAll("[data-tinyfly-symbol]").forEach(n=>{const s=n.getAttribute("data-tinyfly-symbol");if(!s)return;const r=e.get(s);if(!r||!r.timeline.tracks?.length)return;const o=new et;n.querySelectorAll("[data-tinyfly]").forEach(a=>{const c=a.getAttribute("data-tinyfly");c&&o.registerTarget(c,a)}),this.symbolInstances.push({adapter:o,timeline:ct(r.timeline)})})}attachMedia(t,e){this.mediaSync=new We(t,e),this.timeline&&(this.mediaSync.setRate(this.timeline.speed),this.mediaSync.update(this.timeline.currentTime,this.isPlaying))}detachMedia(){this.mediaSync?.dispose(),this.mediaSync=void 0}play(){!this.timeline||this.isDestroyed||(this.autoplayWhenSeen=!1,this.stepping=this.options.stepMode===!0,this.startPlaying())}startPlaying(){if(!this.timeline||this.isDestroyed)return;const t=this.timeline.playbackState==="idle";this.timeline.play(),t&&this.timeline.currentTime===0&&this.applyState(),this.playhead={time:this.timeline.currentTime,iteration:this.timeline.loopIteration,direction:this.timeline.direction},this.mediaSync?.update(this.timeline.currentTime,!0),this.syncAllMedia(this.timeline.currentTime,!0),this.startAnimationLoop(),this.notify()}pause(){this.timeline&&(this.stepping=!1,this.timeline.pause(),this.notify(),this.mediaSync?.update(this.timeline.currentTime,!1),this.syncAllMedia(this.timeline.currentTime,!1),this.stopAnimationLoop())}stop(){this.timeline&&(this.timeline.stop(),this.stopAnimationLoop(),this.applyState(),this.mediaSync?.update(this.timeline.currentTime,!1),this.syncAllMedia(this.timeline.currentTime,!1))}seek(t){this.timeline&&(this.timeline.seek(t),this.applyState(),this.playhead={time:this.timeline.currentTime,iteration:this.timeline.loopIteration,direction:this.timeline.direction},this.mediaSync?.seek(this.timeline.currentTime),this.syncAllMedia(this.timeline.currentTime,this.isPlaying))}setSpeed(t){this.timeline&&(this.timeline.speed=t,this.mediaSync?.setRate(t))}reverse(){this.timeline&&this.timeline.reverse()}get currentTime(){return this.timeline?.currentTime??0}get duration(){return this.timeline?.duration??0}get isPlaying(){return this.timeline?.playbackState==="playing"}destroy(){this.isDestroyed=!0,this.stopAnimationLoop(),this.reducedQuery?.removeEventListener?.("change",this.onReducedChange),this.visibilityObserver?.disconnect(),typeof document<"u"&&document.removeEventListener("visibilitychange",this.onDocumentVisibility),this.mediaSync?.dispose(),this.mediaSync=void 0;for(const t of this.mediaTargets)t.el.paused||t.el.pause();this.mediaTargets=[],this.adapter.clearTargets();for(const t of this.symbolInstances)t.adapter.clearTargets();this.symbolInstances=[],this.authored.clear(),this.timeline=null}startAnimationLoop(){if(this.animationFrameId!==void 0)return;this.lastTime=performance.now();const t=e=>{if(this.isDestroyed||!this.timeline)return;const n=e-(this.lastTime??e);this.lastTime=e;const s=this.playhead;this.timeline.tick(n),this.stopAtMarker(s),this.applyState();const r=this.timeline.playbackState==="playing";this.mediaSync?.update(this.timeline.currentTime,r),this.syncAllMedia(this.timeline.currentTime,r),this.timeline.playbackState==="playing"?this.animationFrameId=requestAnimationFrame(t):(this.animationFrameId=void 0,this.notify())};this.animationFrameId=requestAnimationFrame(t)}stopAtMarker(t){const e=this.timeline,n={time:e.currentTime,iteration:e.loopIteration,direction:e.direction};this.playhead=n;const s=this.markers;if(s.length===0)return;const{crossings:r}=ve(s.map(o=>o.time),t,n,{duration:e.duration,alternate:e.config.alternate===!0,holding:e.repeatDelayRemaining>0});for(const o of r){if(o.kind!=="event")continue;const a=s[o.index];if(this.stepping||a.pause){this.stepping=!1,e.pause(),e.seek(a.time),this.playhead={time:a.time,iteration:e.loopIteration,direction:e.direction};return}}}stopAnimationLoop(){this.animationFrameId!==void 0&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}applyState(){if(!this.timeline)return;const t=this.timeline.currentTime;this.adapter.applyState(this.timeline.getStateAtTime(t)),this.announceMarker(),this.notify();for(const e of this.symbolInstances){const n=e.timeline.duration;e.adapter.applyState(e.timeline.getStateAtTime(n>0?t%n:t))}}}async function Eo(i,t,e={}){const n=new Gt(i,{...e,autoplay:!0});return await n.load(t),n}function Po(i,t={}){return new Gt(i,t)}const jn={play:"Play",pause:"Pause",prev:"Previous step",next:"Next step",restart:"Restart",scrub:"Position",speed:"Speed",reveal:"Reveal",step:"Step",of:"of",stepFormat:"{index} / {total}",scenario:"Scenario",fullscreen:"Full screen",exitFullscreen:"Exit full screen"},zn="tinyfly-controls-style",Co=`
|
|
1
|
+
(function(g){"use strict";function Ze(i){return typeof i=="object"&&i!==null&&i.type==="cubic-bezier"}function bt(i){return typeof i=="object"&&i!==null&&i.type!=="cubic-bezier"}const vt=1;function $t(i){return i.property==="text"&&"textConfig"in i}function K(i){return i.kind==="inertia"&&"inertia"in i}function Q(i){return i.kind==="spring"&&"spring"in i}function ne(i){return i.property==="motionPath"&&"motionPathConfig"in i}function ps(i){return typeof i=="object"&&i!==null&&"x"in i&&"y"in i&&"angle"in i}function Je(i){return"keyframes"in i}class ms{_currentTime=0;_isRunning=!1;onTick=null;get currentTime(){return this._currentTime}get isRunning(){return this._isRunning}start(){this._isRunning=!0}stop(){this._isRunning=!1}tick(t){this._currentTime+=t,this.onTick?.(t,this._currentTime)}reset(){this._currentTime=0}seek(t){this._currentTime=t}}class gs{_currentTime=0;_isRunning=!1;_lastFrameTime=null;_rafId=null;_speed;onTick=null;constructor(t={}){this._speed=t.speed??1}get currentTime(){return this._currentTime}get isRunning(){return this._isRunning}get speed(){return this._speed}set speed(t){this._speed=t}start(){this._isRunning||(this._isRunning=!0,this._lastFrameTime=null,this._scheduleFrame())}stop(){this._isRunning=!1,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null)}reset(){this._currentTime=0,this._lastFrameTime=null}seek(t){this._currentTime=t}_scheduleFrame(){this._rafId=requestAnimationFrame(this._onFrame.bind(this))}_onFrame(t){if(this._isRunning){if(this._lastFrameTime!==null){const n=(t-this._lastFrameTime)*this._speed;this._currentTime+=n,this.onTick?.(n,this._currentTime)}this._lastFrameTime=t,this._scheduleFrame()}}}function se(i,t,e="start"){if(t<=1)return 0;if(typeof e=="number"){const n=Math.max(0,Math.min(t-1,e));return Math.abs(i-n)}switch(e){case"end":return t-1-i;case"center":return Math.abs(i-(t-1)/2);case"edges":return(t-1)/2-Math.abs(i-(t-1)/2);default:return i}}function re(i,t="start"){if(i<=1)return 0;let e=0;for(let n=0;n<i;n++)e=Math.max(e,se(n,i,t));return e}function Dt(i,t,e){if(e.offsets)return e.offsets[i]??0;const n=e.from??"start",s=se(i,t,n);if(e.amount!==void 0){const r=re(t,n);return r===0?0:e.amount*s/r}return e.each!==void 0?e.each*s:0}function Bt(i,t){return Array.from({length:i},(e,n)=>Dt(n,i,t))}function wt(i,t){return i<=1?0:Math.max(...Bt(i,t))}const ot=1,oe=6e4,Ot=oe/ot,V={stiffness:180,damping:12,mass:1,velocity:0,restDelta:.01,restSpeed:.1},Nt={gentle:{stiffness:120,damping:18,mass:1},default:{stiffness:180,damping:12,mass:1},snappy:{stiffness:280,damping:20,mass:1},bouncy:{stiffness:220,damping:8,mass:1},wobbly:{stiffness:180,damping:5,mass:1},stiff:{stiffness:400,damping:30,mass:1}};class Tt{from;to;stiffness;damping;mass;restDelta;restSpeed;distance;samples;velocity;settledStep=null;constructor(t){this.from=t.from,this.to=t.to,this.stiffness=t.stiffness??V.stiffness,this.damping=t.damping??V.damping,this.mass=t.mass??V.mass,this.restDelta=t.restDelta??V.restDelta,this.restSpeed=t.restSpeed??V.restSpeed,this.distance=Math.abs(this.to-this.from)||1,this.samples=[this.from],this.velocity=t.velocity??V.velocity,this.isAtRest(this.from)&&(this.settledStep=0)}isAtRest(t){return Math.abs(t-this.to)<this.restDelta*this.distance&&Math.abs(this.velocity)<this.restSpeed*this.distance}valueAt(t){if(t<=0)return this.from;const e=Math.floor(t/ot);if(this.simulateTo(e+1),this.settledStep!==null&&e>=this.settledStep)return this.to;const n=this.samples[Math.min(e,this.samples.length-1)],s=this.samples[Math.min(e+1,this.samples.length-1)],r=t/ot-e;return n+(s-n)*r}settleTime(){return this.simulateTo(Ot+1),this.settledStep!==null?this.settledStep*ot:oe}simulateTo(t){if(this.settledStep!==null)return;const e=Math.min(t,Ot+1),n=ot/1e3;for(;this.samples.length<e;){const s=this.samples[this.samples.length-1],r=s-this.to,o=-this.stiffness*r,a=-this.damping*this.velocity,c=(o+a)/this.mass;this.velocity+=c*n;const l=s+this.velocity*n;if(this.samples.push(l),this.isAtRest(l)){this.settledStep=this.samples.length-1;return}}this.samples.length>Ot&&(this.settledStep=Ot)}}function ys(i,t){return new Tt(i).valueAt(t)}function ti(i){return new Tt(i).settleTime()}function bs(i){const t=i.stiffness??V.stiffness,e=i.damping??V.damping,n=i.mass??V.mass;return e<2*Math.sqrt(t*n)}function vs(i){const t=i.stiffness??V.stiffness,e=i.mass??V.mass;return 2*Math.sqrt(t*e)}const ae=4,ws=.002,Ts=1e-4,ei=6e4;function qt(i){const t=i.friction??ae;return t>0?t:ae}function kt(i){return i.from+i.velocity/qt(i)}function ks(i,t){if(t===void 0)return i;if(typeof t=="number")return t>0?Math.round(i/t)*t:i;if(t.length===0)return i;let e=t[0];for(const n of t)Math.abs(n-i)<Math.abs(e-i)&&(e=n);return e}function at(i){let t=ks(kt(i),i.end);return i.min!==void 0&&(t=Math.max(i.min,t)),i.max!==void 0&&(t=Math.min(i.max,t)),t}function ct(i){const t=Math.abs(at(i)-i.from);if(t===0)return 0;const e=i.restDelta??Math.max(Ts,t*ws);if(e>=t)return 0;const n=Math.log(t/e)/qt(i);return Math.min(ei,n*1e3)}function Yt(i,t){if(t<=0)return i.from;const e=at(i);if(t>=ct(i))return e;const n=qt(i);return i.from+(e-i.from)*(1-Math.exp(-n*t/1e3))}function Ss(i,t){const e=qt(i),n=at(i);return t>=ct(i)?0:(n-i.from)*e*Math.exp(-e*Math.max(0,t)/1e3)}const Xt=i=>i,ii=i=>i*i,ni=i=>1-(1-i)*(1-i),si=i=>i<.5?2*i*i:1-Math.pow(-2*i+2,2)/2,ce=i=>i*i*i,le=i=>1-Math.pow(1-i,3),St=i=>i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2,ri=ce,oi=le,ai=St,Ms={linear:Xt,"ease-in":ri,"ease-out":oi,"ease-in-out":ai,"ease-in-quad":ii,"ease-out-quad":ni,"ease-in-out-quad":si,"ease-in-cubic":ce,"ease-out-cubic":le,"ease-in-out-cubic":St};function ci(i){const[t,e,n,s]=i,r=3*t,o=3*(n-t)-r,a=1-r-o,c=3*e,l=3*(s-e)-c,h=1-c-l,f=p=>((a*p+o)*p+r)*p,u=p=>((h*p+l)*p+c)*p,d=p=>(3*a*p+2*o)*p+r,m=p=>{let y=p;for(let v=0;v<8;v++){const k=f(y)-p;if(Math.abs(k)<1e-7)return y;const T=d(y);if(Math.abs(T)<1e-7)break;y-=k/T}let b=0,w=1;for(y=p;b<w;){const v=f(y);if(Math.abs(v-p)<1e-7)return y;p>v?b=y:w=y,y=(b+w)/2}return y};return p=>{if(p<=0)return 0;if(p>=1)return 1;const y=m(p);return u(y)}}function he(i,t="out"){if(t==="out")return i;const e=n=>1-i(1-n);return t==="in"?e:n=>n<.5?e(n*2)/2:i(n*2-1)/2+.5}function li(i=1,t=.3){const e=Math.max(1,i),n=t/(2*Math.PI)*Math.asin(1/e);return s=>s<=0?0:s>=1?1:e*Math.pow(2,-10*s)*Math.sin((s-n)*(2*Math.PI)/t)+1}const hi=i=>{if(i<=0)return 0;if(i>=1)return 1;if(i<1/2.75)return 7.5625*i*i;if(i<2/2.75){const s=i-.5454545454545454;return 7.5625*s*s+.75}if(i<2.5/2.75){const s=i-.8181818181818182;return 7.5625*s*s+.9375}const n=i-2.625/2.75;return 7.5625*n*n+.984375};function ui(i=1.70158){return t=>{if(t<=0)return 0;if(t>=1)return 1;const e=t-1;return e*e*((i+1)*e+i)+1}}function fi(i,t="end"){const e=Math.max(1,Math.floor(i));return n=>{if(n>=1)return 1;if(n<=0)return t==="start"||t==="both"?t==="start"?1/e:1/(e+1):0;const s=Math.floor(n*e);switch(t){case"start":return Math.min(1,(s+1)/e);case"both":return(s+1)/(e+1);case"none":return e===1?0:Math.min(1,s/(e-1));default:return s/e}}}function di(i){switch(i.type){case"steps":return fi(i.count,i.position);case"elastic":return he(li(i.amplitude,i.period),i.mode);case"bounce":return he(hi,i.mode);case"back":return he(ui(i.overshoot),i.mode)}}function W(i){return i===void 0?Xt:Ze(i)?ci(i.points):bt(i)?di(i):Ms[i]??Xt}const pi=32,As=256,lt=new Map,Es=/[MmLlHhVvCcSsQqTtAaZz]/,xs=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/,Ps={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};function Cs(i){const t=[];let e=0,n=null;const s=()=>{for(;e<i.length&&/[\s,]/.test(i[e]);)e++};for(;e<i.length&&(s(),!(e>=i.length));){const r=i[e];if(Es.test(r)){n={type:r,args:[]},t.push(n),e++;continue}if(!n)break;const o=n.type==="A"||n.type==="a",a=n.args.length%7;if(o&&(a===3||a===4)){if(r!=="0"&&r!=="1")break;n.args.push(r==="1"?1:0),e++;continue}const c=xs.exec(i.slice(e));if(!c)break;n.args.push(parseFloat(c[0])),e+=c[0].length}return t}function _s(i,t,e,n,s,r,o,a,c){if(i===a&&t===c)return[];let l=Math.abs(e),h=Math.abs(n);if(l===0||h===0)return[[i,t,a,c,a,c]];const f=s*Math.PI/180,u=Math.cos(f),d=Math.sin(f),m=(i-a)/2,p=(t-c)/2,y=u*m+d*p,b=-d*m+u*p,w=y*y/(l*l)+b*b/(h*h);if(w>1){const L=Math.sqrt(w);l*=L,h*=L}const v=r===o?-1:1,k=l*l*h*h-l*l*b*b-h*h*y*y,T=l*l*b*b+h*h*y*y,S=v*Math.sqrt(Math.max(0,k/T)),A=S*l*b/h,I=-S*h*y/l,O=u*A-d*I+(i+a)/2,x=d*A+u*I+(t+c)/2,M=(L,B,X,yt)=>{const Qe=L*X+B*yt,ie=Math.sqrt((L*L+B*B)*(X*X+yt*yt)),Ft=Math.acos(Math.max(-1,Math.min(1,Qe/ie)));return L*yt-B*X<0?-Ft:Ft},C=M(1,0,(y-A)/l,(b-I)/h);let P=M((y-A)/l,(b-I)/h,(-y-A)/l,(-b-I)/h);!o&&P>0&&(P-=2*Math.PI),o&&P<0&&(P+=2*Math.PI);const _=Math.max(1,Math.ceil(Math.abs(P)/(Math.PI/2))),E=P/_,R=4/3*Math.tan(E/4),D=L=>{const B=l*Math.cos(L),X=h*Math.sin(L);return[u*B-d*X+O,d*B+u*X+x]},q=L=>{const B=-l*Math.sin(L),X=h*Math.cos(L);return[u*B-d*X,d*B+u*X]},N=[];for(let L=0;L<_;L++){const B=C+L*E,X=B+E,[yt,Qe]=D(B),[ie,Ft]=L===_-1?[a,c]:D(X),[$a,Da]=q(B),[Ba,Oa]=q(X);N.push([yt+R*$a,Qe+R*Da,ie-R*Ba,Ft-R*Oa,ie,Ft])}return N}function Z(i,t,e,n,s){const r=1-s;return r*r*r*i+3*r*r*s*t+3*r*s*s*e+s*s*s*n}function mi(i,t,e,n,s){const r=1-s;return 3*r*r*(t-i)+6*r*s*(e-t)+3*s*s*(n-e)}function Mt(i,t,e,n){return{subpath:0,type:"L",points:[e,n],startX:i,startY:t,endX:e,endY:n,length:Math.hypot(e-i,n-t)}}function Vt(i,t,e){const[n,s,r,o,a,c]=e,l=[0];let h=i,f=t,u=0;for(let d=1;d<=pi;d++){const m=d/pi,p=Z(i,n,r,a,m),y=Z(t,s,o,c,m);u+=Math.hypot(p-h,y-f),l.push(u),h=p,f=y}return{subpath:0,type:"C",points:[n,s,r,o,a,c],startX:i,startY:t,endX:a,endY:c,length:u,lengths:l}}function it(i){const t=lt.get(i);if(t)return t;const e=[];let n=0,s=0,r=0,o=0,a=null,c=null,l=-1;const h=new Set,f=p=>{l<0&&(l=0),p.subpath=l,e.push(p)};for(const{type:p,args:y}of Cs(i)){const b=p.toUpperCase(),w=p!==b,v=Ps[b];if(b==="Z"){(n!==r||s!==o)&&f(Mt(n,s,r,o)),l>=0&&h.add(l),n=r,s=o,a=c=null;continue}for(let k=0;k+v<=y.length;k+=v){const T=y.slice(k,k+v),S=w?n:0,A=w?s:0;let I=null,O=null;switch(b){case"M":k===0?(n=T[0]+S,s=T[1]+A,r=n,o=s,(l<0||e[e.length-1]?.subpath===l)&&l++):(f(Mt(n,s,T[0]+S,T[1]+A)),n=T[0]+S,s=T[1]+A);break;case"L":f(Mt(n,s,T[0]+S,T[1]+A)),n=T[0]+S,s=T[1]+A;break;case"H":f(Mt(n,s,T[0]+S,s)),n=T[0]+S;break;case"V":f(Mt(n,s,n,T[0]+A)),s=T[0]+A;break;case"C":{const x=[T[0]+S,T[1]+A,T[2]+S,T[3]+A,T[4]+S,T[5]+A];f(Vt(n,s,x)),I=[x[2],x[3]],n=x[4],s=x[5];break}case"S":{const[x,M]=a?[2*n-a[0],2*s-a[1]]:[n,s],C=[x,M,T[0]+S,T[1]+A,T[2]+S,T[3]+A];f(Vt(n,s,C)),I=[C[2],C[3]],n=C[4],s=C[5];break}case"Q":case"T":{let x=n,M=s;b==="Q"?(x=T[0]+S,M=T[1]+A):c&&(x=2*n-c[0],M=2*s-c[1]);const C=b==="Q"?T[2]+S:T[0]+S,P=b==="Q"?T[3]+A:T[1]+A;f(Vt(n,s,[n+2/3*(x-n),s+2/3*(M-s),C+2/3*(x-C),P+2/3*(M-P),C,P])),O=[x,M],n=C,s=P;break}case"A":{const x=T[5]+S,M=T[6]+A;let C=n,P=s;for(const _ of _s(n,s,T[0],T[1],T[2],T[3],T[4],x,M))f(Vt(C,P,_)),C=_[4],P=_[5];n=x,s=M;break}}a=I,c=O}}const u=e.reduce((p,y)=>p+y.length,0),d=[];for(let p=0;p<e.length;){const y=e[p].subpath;let b=p,w=0;for(;b<e.length&&e[b].subpath===y;)w+=e[b++].length;const v=e[p],k=e[b-1],T=h.has(y)||Math.abs(k.endX-v.startX)<1e-9&&Math.abs(k.endY-v.startY)<1e-9;d.push({start:p,end:b,length:w,closed:T}),p=b}const m={segments:e,totalLength:u,subpaths:d};return lt.size>=As&<.delete(lt.keys().next().value),lt.set(i,m),m}function Is(i,t){const e=i.lengths;if(t<=0)return 0;if(t>=i.length)return 1;let n=0,s=e.length-1;for(;n<s-1;){const a=n+s>>1;e[a]<t?n=a:s=a}const r=e[s]-e[n],o=r>0?(t-e[n])/r:0;return(n+o)/(e.length-1)}function Rs(i,t){if(i.type==="L"){const f=i.length>0?Math.max(0,Math.min(1,t/i.length)):0;return{x:i.startX+(i.endX-i.startX)*f,y:i.startY+(i.endY-i.startY)*f,angle:Math.atan2(i.endY-i.startY,i.endX-i.startX)*180/Math.PI}}const[e,n,s,r,o,a]=i.points,c=Is(i,t);let l=mi(i.startX,e,s,o,c),h=mi(i.startY,n,r,a,c);if(Math.hypot(l,h)<1e-9){const f=c<.5?Math.min(1,c+.001):Math.max(0,c-.001),u=Z(i.startX,e,s,o,f),d=Z(i.startY,n,r,a,f),m=Z(i.startX,e,s,o,c),p=Z(i.startY,n,r,a,c);l=c<.5?u-m:m-u,h=c<.5?d-p:p-d}return{x:Z(i.startX,e,s,o,c),y:Z(i.startY,n,r,a,c),angle:Math.atan2(h,l)*180/Math.PI}}function ue(i,t,e=0,n=i.length){if(n<=e)return{x:0,y:0,angle:0};let s=0;for(let r=e;r<n;r++){const o=i[r];if(s+o.length>=t||r===n-1)return Rs(o,t-s);s+=o.length}return{x:0,y:0,angle:0}}function gi(i,t){const{segments:e,totalLength:n}=it(i);return ue(e,Math.max(0,Math.min(1,t))*n)}function Ls(){lt.clear()}function Fs(i){return it(i).totalLength}const $s=24,Ds=320,Bs=2.5,At=72,Os=64,Ns=.2,qs=128,Et=new Map;let Wt=0,J;const yi=i=>Math.round(i*100)/100;function bi(i,t){const{segments:e,subpaths:n,totalLength:s}=it(i);if(e.length===0)return[];if(t){const r=n.every(o=>o.closed);return[{segments:e,start:0,end:e.length,length:s,closed:r}]}return n.filter(r=>r.length>0).map(r=>({segments:e,start:r.start,end:r.end,length:r.length,closed:r.closed}))}function fe(i,t){const e=i.closed?(t%1+1)%1:Math.max(0,Math.min(1,t)),n=ue(i.segments,e*i.length,i.start,i.end);return[n.x,n.y]}function vi(i){const t=[];let e=0;for(let n=i.start;n<i.end;n++)e+=i.segments[n].length,i.length>0&&t.push(e/i.length);return t}function wi(i,t){const e=[];for(let n=0;n<t;n++)e.push(fe(i,i.closed?n/t:n/(t-1)));return e}function Ti(i){let t=0,e=0;for(const[n,s]of i)t+=n,e+=s;return t/=i.length,e/=i.length,i.map(([n,s])=>[n-t,s-e])}function Ys(i,t,e){const n=i.closed&&t.closed;if(e!==void 0)return{offset:n?Math.abs(e)%At/At:0,reversed:e<0};const s=Ti(wi(i,At)),r=Ti(wi(t,At)),o=At;let a={offset:0,reversed:!1},c=1/0;for(const l of[!1,!0]){const h=n?o:1;for(let f=0;f<h;f++){let u=0;for(let d=0;d<o&&u<c;d++){const m=n?l?(f-d+o)%o:(d+f)%o:l?o-1-d:d,p=s[d][0]-r[m][0],y=s[d][1]-r[m][1];u+=p*p+y*y}u<c&&(c=u,a={offset:n?f/o:0,reversed:l})}}return a}function Xs(i,t,e){return e?((t.reversed?t.offset-i:i+t.offset)%1+1)%1:t.reversed?1-i:i}function Vs(i,t,e){return e?((t.reversed?t.offset-i:i-t.offset)%1+1)%1:t.reversed?1-i:i}function Ws(i,t,e){const n=i.closed&&t.closed,s=Ys(i,t,e.shapeIndex),r=Math.max($s,Math.min(Ds,Math.ceil(Math.max(i.length,t.length)/Bs))),o=new Set,a=f=>o.add(Math.round(f*1e7)/1e7);for(let f=0;f<=r;f++)a(f/r);for(const f of vi(i))a(f);for(const f of vi(t))a(Vs(f,s,n));let c=[...o].sort((f,u)=>f-u);n&&(c=c.filter(f=>f<1));const l=[],h=[];for(const f of c)l.push(...fe(i,f)),h.push(...fe(t,Xs(f,s,n)));return Us({from:l,to:h,closed:n})}function Us(i){const t=i.from.length/2;if(t<=3)return i;const e=new Uint8Array(t);e[0]=1,e[t-1]=1;const n=[[0,t-1]];for(;n.length>0;){const[o,a]=n.pop();let c=-1,l=Ns;for(let h=o+1;h<a;h++){const f=Math.max(ki(i.from,o,a,h),ki(i.to,o,a,h));f>l&&(l=f,c=h)}c!==-1&&(e[c]=1,n.push([o,c],[c,a]))}const s=[],r=[];for(let o=0;o<t;o++)e[o]&&(s.push(i.from[o*2],i.from[o*2+1]),r.push(i.to[o*2],i.to[o*2+1]));return{from:s,to:r,closed:i.closed}}function ki(i,t,e,n){const s=i[t*2],r=i[t*2+1],o=i[e*2]-s,a=i[e*2+1]-r,c=i[n*2]-s,l=i[n*2+1]-r,h=o*o+a*a,f=h===0?0:Math.max(0,Math.min(1,(c*o+l*a)/h));return Math.hypot(c-f*o,l-f*a)}function js(i,t,e){const n=e.shapeIndex;if(J&&J.from===i&&J.to===t&&J.shapeIndex===n)return J.plan;const r=Et.get(String(n??"auto"))?.get(i)?.get(t);if(r)return J={from:i,to:t,shapeIndex:n,plan:r},r;const o=it(i).subpaths.filter(d=>d.length>0).length===it(t).subpaths.filter(d=>d.length>0).length,a=bi(i,!o),c=bi(t,!o),l={pairs:a.map((d,m)=>Ws(d,c[m],e))};Wt>=qs&&(Et.clear(),Wt=0);const h=String(n??"auto"),f=Et.get(h)??new Map;Et.set(h,f);const u=f.get(i)??new Map;return f.set(i,u),u.set(t,l),Wt++,J={from:i,to:t,shapeIndex:n,plan:l},l}function Si(i,t,e,n={}){if(!i)return t;if(!t)return i;const s=Math.max(0,Math.min(1,e));if(s===0)return i;if(s===1)return t;const r=js(i,t,n);if(r.pairs.length===0)return s<.5?i:t;let o="";for(const a of r.pairs){for(let c=0;c<a.from.length;c+=2){const l=yi(a.from[c]+(a.to[c]-a.from[c])*s),h=yi(a.from[c+1]+(a.to[c+1]-a.from[c+1])*s);o+=`${c===0?o?" M":"M":" L"}${l} ${h}`}a.closed&&(o+=" Z")}return o}function Hs(){Et.clear(),Wt=0,J=void 0}function ht(i){return/^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(i)}const U=(i,t,e)=>i+(t-i)*e,Mi=512,de=new Map,pe=new Map;function Ai(i){const t=de.get(i);if(t)return t;const e=i.replace("#",""),n=[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)];return de.size<Mi&&de.set(i,n),n}const Ei=i=>i.charCodeAt(0)===35,xi=i=>i.startsWith("rgb"),Pi=i=>i.startsWith("rgba"),zs=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/,me=i=>Math.round(i).toString(16).padStart(2,"0");function Gs(i,t,e){return`#${me(i)}${me(t)}${me(e)}`}function Ci(i){const t=pe.get(i);if(t)return t;const e=i.match(zs);if(!e)throw new Error(`Invalid rgb color: ${i}`);const n=parseInt(e[1],10),s=parseInt(e[2],10),r=parseInt(e[3],10),o=e[4]!==void 0?[n,s,r,parseFloat(e[4])]:[n,s,r];return pe.size<Mi&&pe.set(i,o),o}const _i=(i,t,e)=>{if(Ei(i)&&Ei(t)){const[n,s,r]=Ai(i),[o,a,c]=Ai(t),l=U(n,o,e),h=U(s,a,e),f=U(r,c,e);return Gs(l,h,f)}if((xi(i)||Pi(i))&&(xi(t)||Pi(t))){const n=Ci(i),s=Ci(t),r=Math.round(U(n[0],s[0],e)),o=Math.round(U(n[1],s[1],e)),a=Math.round(U(n[2],s[2],e));if(n.length===4||s.length===4){const c=n[3]??1,l=s[3]??1,h=U(c,l,e);return`rgba(${r}, ${o}, ${a}, ${h})`}return`rgb(${r}, ${o}, ${a})`}return e<1?i:t},Ii=(i,t,e)=>{const n=Math.min(i.length,t.length),s=[];for(let r=0;r<n;r++)s.push(U(i[r],t[r],e));return s},ge=(i,t,e)=>e<1?i:t,Ri=(i,t,e)=>Si(i,t,e);function xt(i){return typeof i=="number"?U:Array.isArray(i)?Ii:typeof i=="string"?i.startsWith("#")||i.startsWith("rgb")?_i:ht(i)?Ri:ge:ge}const ye=1e3/60;function be(i,t={}){if(!Q(i))throw new Error(`bakeSpringTrack: track "${i.id}" is not a spring track`);const e=new Tt(i.spring);return Li(i,n=>e.valueAt(n),e.settleTime(),i.spring.from,i.spring.to,t)}function ve(i,t={}){if(!K(i))throw new Error(`bakeInertiaTrack: track "${i.id}" is not an inertia track`);const e=i.inertia;return Li(i,n=>Yt(e,n),ct(e),e.from,at(e),t)}function Li(i,t,e,n,s,r){const o=r.intervalMs??ye,a=r.tolerance??.01,c=i.delay??0,l=[];for(let f=0;f<=e;f+=o)l.push({time:f+c,value:t(f),easing:"linear"});const h=l[l.length-1];return!h||h.time<e+c?l.push({time:e+c,value:s,easing:"linear"}):h.value=s,c>0&&l.unshift({time:0,value:n,easing:"linear"}),{id:i.id,target:i.target,property:i.property,keyframes:a>0?$i(l,a):l,...i.targets&&{targets:[...i.targets]},...i.stagger&&{stagger:{...i.stagger}}}}function we(i,t,e,n={}){const s=n.intervalMs??ye,r=typeof e=="function"?e:W(e),o=xt(i.value),a=t.time-i.time;if(a<=0)return[t];const c=[];for(let h=s;h<a;h+=s){const f=h/a;c.push({time:i.time+h,value:o(i.value,t.value,r(f)),easing:"linear"})}const l=r(1);return c.push({...t,...l!==1&&{value:o(i.value,t.value,l)},easing:"linear"}),c}function Ks(i,t){return Q(i)?be(i,t):K(i)?ve(i,t):i}function Fi(i,t={}){const e=i.keyframes;if(!e.some(s=>bt(s.easing)))return i;const n=e.length>0?[e[0]]:[];for(let s=1;s<e.length;s++){const r=e[s];bt(r.easing)?n.push(...we(e[s-1],r,r.easing,t)):n.push(r)}return{...i,keyframes:n}}function Qs(i,t){return i.filter(Je).map(e=>Fi(e,t)).concat(i.filter(Q).map(e=>be(e,t)),i.filter(K).map(e=>ve(e,t)))}function $i(i,t){if(i.length<=2)return i;const e=[i[0]];for(let n=1;n<i.length-1;n++){const s=e[e.length-1],r=i[n],o=i[n+1],a=o.time-s.time;if(a<=0)continue;const c=(r.time-s.time)/a,l=s.value+(o.value-s.value)*c;Math.abs(r.value-l)>t&&e.push(r)}return e.push(i[i.length-1]),e}function Ut(i){const t=[...i.keyframes].sort((e,n)=>e.time-n.time);return{...i,keyframes:t}}function tt(i){return i.targets&&i.targets.length>0?i.targets:[i.target]}function ut(i,t,e,n){const s=e??0;return!n||t<=1?s:s+Dt(i,t,n)}class jt{track;targets;constructor(t){this.track=t,this.targets=tt(t)}getValueAtTime(t){return this.valueForOffset(t-ut(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const e=this.targets.length,n=[];for(let s=0;s<e;s++){const r=ut(s,e,this.track.delay,this.track.stagger),o=this.valueForOffset(t-r);o!==void 0&&n.push({target:this.targets[s],value:o,start:r+this.track.keyframes[0].time})}return n}getDuration(){const{keyframes:t}=this.track;if(t.length===0)return 0;const e=t[t.length-1].time,n=this.track.stagger?wt(this.targets.length,this.track.stagger):0;return e+(this.track.delay??0)+n+(this.track.endDelay??0)}getTrack(){return this.track}valueForOffset(t){const{keyframes:e}=this.track;if(e.length===0)return;if(e.length===1||t<=e[0].time)return e[0].value;if(t>=e[e.length-1].time)return e[e.length-1].value;const{from:n,to:s}=this.findSurroundingKeyframes(t);if(!n||!s)return;if(n.time===t)return n.value;const r=s.time-n.time,o=(t-n.time)/r,c=W(s.easing)(o);return xt(n.value)(n.value,s.value,c)}findSurroundingKeyframes(t){const{keyframes:e}=this.track;for(let n=0;n<e.length-1;n++)if(t>=e[n].time&&t<=e[n+1].time)return{from:e[n],to:e[n+1]};return{from:null,to:null}}}class Di{track;targets;sampler;constructor(t){this.track=t,this.targets=tt(t),this.sampler=new Tt(t.spring)}getValueAtTime(t){return this.sampler.valueAt(t-ut(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const e=this.targets.length,n=[];for(let s=0;s<e;s++){const r=ut(s,e,this.track.delay,this.track.stagger);n.push({target:this.targets[s],value:this.sampler.valueAt(t-r),start:r})}return n}getDuration(){const t=this.track.stagger?wt(this.targets.length,this.track.stagger):0;return this.sampler.settleTime()+(this.track.delay??0)+t}getTrack(){return this.track}}class Bi{track;targets;duration;constructor(t){this.track=t,this.targets=tt(t),this.duration=ct(t.inertia)}getValueAtTime(t){return Yt(this.track.inertia,t-ut(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const e=this.targets.length,n=[];for(let s=0;s<e;s++){const r=ut(s,e,this.track.delay,this.track.stagger);n.push({target:this.targets[s],value:Yt(this.track.inertia,t-r),start:r})}return n}getDuration(){const t=this.track.stagger?wt(this.targets.length,this.track.stagger):0;return this.duration+(this.track.delay??0)+t}getTrack(){return this.track}}function Te(i,t){const e={...gi(i.pathData,t)};if(i.matrix){const[n,s,r,o,a,c]=i.matrix,{x:l,y:h}=e;e.x=n*l+r*h+a,e.y=s*l+o*h+c;const f=e.angle*Math.PI/180,u=Math.cos(f),d=Math.sin(f);e.angle=Math.atan2(s*u+o*d,n*u+r*d)*180/Math.PI}return i.autoRotate&&i.rotateOffset&&(e.angle+=i.rotateOffset),e}function Zs(i,t,e,n){const s=t+(e-t)*n;return Te(i,s)}const ke={upperCase:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",lowerCase:"abcdefghijklmnopqrstuvwxyz",upperAndLowerCase:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",numbers:"0123456789"},Js=20;function Oi(i){const t=ke[i??"upperCase"]??i??ke.upperCase,e=Array.from(t);return e.length>0?e:Array.from(ke.upperCase)}function tr(i,t,e){let n=(i|0)^Math.imul(t+1,2654435761)^Math.imul(e+1,2246822507);return n=Math.imul(n^n>>>16,2146121005),n=Math.imul(n^n>>>15,2221713035),(n^n>>>16)>>>0}function Ni(i,t,e=0){const n=i.from??"",s=i.to,r=Math.max(0,Math.min(1,t));if(r<=0)return n;if(r>=1)return s;const o=Array.from(n),a=Array.from(s),c=i.rightToLeft??!1;if(i.mode==="type"){const w=Math.round(r*Math.max(o.length,a.length));return c?o.slice(0,Math.max(0,o.length-w)).join("")+a.slice(Math.max(0,a.length-w)).join(""):a.slice(0,w).join("")+o.slice(w).join("")}const l=Math.max(0,Math.min(.999,i.revealDelay??0)),h=Math.max(0,(r-l)/(1-l)),f=Math.floor(h*a.length),u=i.tweenLength===!1?a.length:Math.round(o.length+(a.length-o.length)*r),d=Oi(i.chars),m=i.refreshRate??Js,p=m>0?Math.floor(e*m/1e3):0,y=i.seed??1;let b="";for(let w=0;w<u;w++){const v=c?w>=u-f:w<f,k=c?a[a.length-(u-w)]:a[w];v&&k!==void 0||k===" "||k===`
|
|
2
|
+
`?b+=k:b+=d[tr(y,w,p)%d.length]}return b}class Se{id;name;_captions;_tracks=[];_trackPlayers=new Map;_motionPathTracks=new Map;_springTracks=new Map;_textTracks=new Map;_config;_currentTime=0;_playbackState="idle";_direction="forward";_loopIteration=0;_explicitDuration;_repeatDelayRemaining=0;_wrapAfterDelay=!1;onUpdate=null;onComplete=null;constructor(t){if(this.id=t.id,this.name=t.name,this._captions=t.captions,this._config=t.config??{},this._explicitDuration=t.config?.duration,t.tracks)for(const e of t.tracks)this.addTrack(e)}get tracks(){return[...this._tracks]}get duration(){return this._explicitDuration!==void 0?this._explicitDuration:this._calculateDuration()}setDuration(t){if(this._explicitDuration=t,t!==void 0)this._config={...this._config,duration:t};else if(this._config.duration!==void 0){const e={...this._config};delete e.duration,this._config=e}}get currentTime(){return this._currentTime}get playbackState(){return this._playbackState}get direction(){return this._direction}get loopIteration(){return this._loopIteration}get repeatDelayRemaining(){return this._repeatDelayRemaining}get speed(){return this._config.speed??1}set speed(t){this._config.speed=t}play(){const t=this.duration;this._direction==="forward"&&this._currentTime>=t&&t>0?(this._currentTime=0,this._loopIteration=0):this._direction==="reverse"&&this._currentTime<=0&&t>0&&(this._currentTime=t,this._loopIteration=0),this._playbackState="playing"}pause(){this._playbackState="paused"}stop(){this._playbackState="idle",this._repeatDelayRemaining=0,this._wrapAfterDelay=!1,this._currentTime=0,this._loopIteration=0,this._direction="forward"}seek(t){const e=this.duration>0?this.duration:1/0;this._currentTime=Math.max(0,Math.min(t,e)),this._repeatDelayRemaining=0,this._wrapAfterDelay=!1}reverse(){this._direction=this._direction==="forward"?"reverse":"forward"}tick(t){if(this._playbackState!=="playing")return;const e=this.duration;if(e<=0)return;let s=t*this.speed;if(this._repeatDelayRemaining>0){const a=Math.min(this._repeatDelayRemaining,s);if(this._repeatDelayRemaining-=a,s-=a,this._repeatDelayRemaining>0){this.onUpdate?.(this.getStateAtTime(this._currentTime));return}this._wrapAfterDelay&&(this._wrapAfterDelay=!1,this._currentTime=0)}const r=1e3;for(let a=0;a<r&&s>0&&this._playbackState==="playing";a++)if(this._direction==="forward"){const c=e-this._currentTime;if(s>=c){if(s-=c,this._currentTime=e,!this._handleEndReached())break}else this._currentTime+=s,s=0}else{const c=this._currentTime;if(s>=c){if(s-=c,this._currentTime=0,!this._handleStartReached())break}else this._currentTime-=s,s=0}const o=this.getStateAtTime(this._currentTime);this.onUpdate?.(o)}getStateAtTime(t){const e=new Map;if(this._hasSharedWrites())this._resolveShared(t,e);else for(const[n,s]of this._trackPlayers){const r=s.getTrack().property;for(const{target:o,value:a,start:c}of s.getTargetValues(t))this._write(e,n,o,r,a,t-c)}return{values:e,currentTime:this._currentTime,playbackState:this._playbackState,direction:this._direction,loopIteration:this._loopIteration}}_resolveShared(t,e){const n=new Map;for(const[s,r]of this._trackPlayers){const o=r.getTrack().property;for(const{target:a,value:c,start:l}of r.getTargetValues(t)){const h=`${a}\0${o}`,f=l<=t,u=n.get(h);(!u||(f!==u.started?f:f?l>=u.start:l<=u.start))&&n.set(h,{trackId:s,target:a,property:o,value:c,start:l,started:f})}}for(const{trackId:s,target:r,property:o,value:a,start:c}of n.values())this._write(e,s,r,o,a,t-c)}_write(t,e,n,s,r,o){if(r===void 0)return;let a=t.get(n);a||(a=new Map,t.set(n,a));const c=this._textTracks.get(e);if(c&&typeof r=="number"){a.set("text",Ni(c.textConfig,r,Math.max(0,o)));return}const l=this._motionPathTracks.get(e);if(l&&typeof r=="number"){const h=Te(l.motionPathConfig,r);a.set("motionPathX",h.x),a.set("motionPathY",h.y),l.motionPathConfig.autoRotate&&a.set("motionPathRotate",h.angle)}else a.set(s,r)}_sharedWrites=null;_hasSharedWrites(){if(this._sharedWrites===null){const t=new Set;this._sharedWrites=!1;t:for(const e of this._tracks)for(const n of tt(e)){const s=`${n}\0${e.property}`;if(t.has(s)){this._sharedWrites=!0;break t}t.add(s)}}return this._sharedWrites}addTrack(t){if(this._tracks.push(t),this._sharedWrites=null,K(t)){this._trackPlayers.set(t.id,new Bi(t));return}if(Q(t)){this._trackPlayers.set(t.id,new Di(t)),this._springTracks.set(t.id,t);return}if($t(t))this._trackPlayers.set(t.id,new jt(t)),this._textTracks.set(t.id,t);else if(ne(t)){const e={id:t.id,target:t.target,property:t.property,keyframes:t.keyframes,delay:t.delay,endDelay:t.endDelay,targets:t.targets,stagger:t.stagger};this._trackPlayers.set(t.id,new jt(e)),this._motionPathTracks.set(t.id,t)}else this._trackPlayers.set(t.id,new jt(t))}replaceTrack(t,e){const n=this._tracks.findIndex(r=>r.id===t);if(n<0)return;const s=this._tracks.slice(n+1);this.removeTrack(t);for(const r of s)this.removeTrack(r.id);this.addTrack(e);for(const r of s)this.addTrack(r)}removeTrack(t){this._tracks=this._tracks.filter(e=>e.id!==t),this._sharedWrites=null,this._trackPlayers.delete(t),this._motionPathTracks.delete(t),this._springTracks.delete(t),this._textTracks.delete(t)}getTracks(t={}){return this._tracks.filter(e=>this._matches(e,t))}removeTracks(t={}){const e=this.getTracks(t).map(n=>n.id);for(const n of e)this.removeTrack(n);return e}getTrackSpan(t){const e=this._trackPlayers.get(t);if(!e)return;const n=e.getTrack(),s=n.delay??0;if(Q(n)||K(n))return{from:s,to:e.getDuration()};const r=n.keyframes;if(!(!r||r.length===0))return{from:r[0].time+s,to:e.getDuration()}}findConflicts(){const t=[];for(let e=0;e<this._tracks.length;e++){const n=this._tracks[e],s=this.getTrackSpan(n.id);if(s)for(let r=0;r<e;r++){const o=this._tracks[r];if(o.property!==n.property)continue;const a=tt(o).filter(f=>tt(n).includes(f));if(a.length===0)continue;const c=this.getTrackSpan(o.id);if(!c||!(c.from<=s.to&&s.from<=c.to))continue;const h=s.from>=c.from;for(const f of a)t.push({target:f,property:n.property,losingTrackId:h?o.id:n.id,winningTrackId:h?n.id:o.id})}}return t}_matches(t,e){if(e.id!==void 0&&t.id!==e.id||e.property!==void 0&&t.property!==e.property||e.target!==void 0&&!tt(t).includes(e.target))return!1;if(e.timeRange){const n=this.getTrackSpan(t.id);if(!n||n.to<e.timeRange.from||n.from>e.timeRange.to)return!1}return!0}toDefinition(){return{formatVersion:vt,id:this.id,name:this.name,config:{...this._config},tracks:[...this._tracks],...this.captions&&{captions:this.captions}}}get config(){return this._config}get markers(){return[...this._config.markers??[]].sort((t,e)=>t.time-e.time)}setMarkers(t){const e=t&&t.length>0?[...t].sort((s,r)=>s.time-r.time).map(s=>({...s})):void 0,n={...this._config};e?n.markers=e:delete n.markers,this._config=n}get captions(){return this._captions}setCaptions(t){const e={};for(const[n,s]of Object.entries(t??{}))e[n]={...s};this._captions=Object.keys(e).length>0?e:void 0}_armRepeatDelay(){this._repeatDelayRemaining=this._config.repeatDelay??0}_calculateDuration(){let t=0;for(const[,e]of this._trackPlayers)t=Math.max(t,e.getDuration());return t}_handleEndReached(){const t=this._config.loop??0;return t===-1||this._loopIteration<t?(this._loopIteration++,this._armRepeatDelay(),this._config.alternate?this._direction="reverse":this._repeatDelayRemaining>0?this._wrapAfterDelay=!0:this._currentTime=0,this._repeatDelayRemaining===0):(this._playbackState="idle",this.onComplete?.(),!1)}_handleStartReached(){const t=this._config.loop??0;return this._config.alternate&&(t===-1||this._loopIteration<t)?(this._loopIteration++,this._armRepeatDelay(),this._direction="forward",this._repeatDelayRemaining===0):(this._playbackState="idle",this.onComplete?.(),!1)}}const er=100;function Me(i,t,e,n){const s=[],r=[],{duration:o,alternate:a}=n,c=(d,m,p,y)=>{r.push([d,m]);const b=[];i.forEach((w,v)=>{(p==="forward"?(y?w>=d:w>d)&&w<=m:(y?w<=d:w<d)&&w>=m)&&b.push(v)}),b.sort((w,v)=>(p==="forward"?i[w]-i[v]:i[v]-i[w])||w-v);for(const w of b)s.push({kind:"event",index:w,direction:p})};let l=t.time,h=t.direction,f=t.fresh===!0;const u=Math.min(er,Math.max(0,e.iteration-t.iteration));for(let d=0;d<u;d++){const m=h==="forward"?o:0;c(l,m,h,f),s.push({kind:"repeat"}),a?(h=h==="forward"?"reverse":"forward",l=m,f=!1):(l=h==="forward"?0:o,f=!0)}return u>0&&n.holding&&!a?{crossings:s,passes:r}:(c(l,e.time,h,f),{crossings:s,passes:r})}function qi(i){return K(i)?{id:i.id,target:i.target,property:i.property,kind:"inertia",inertia:Yi(i.inertia),...j(i)}:Q(i)?{id:i.id,target:i.target,property:i.property,kind:"spring",spring:{...i.spring},...j(i)}:$t(i)?{id:i.id,target:i.target,property:"text",textConfig:{...i.textConfig},keyframes:i.keyframes.map(Ae),...j(i)}:ne(i)?{id:i.id,target:i.target,property:"motionPath",motionPathConfig:{...i.motionPathConfig},keyframes:i.keyframes.map(Ae),...j(i)}:{id:i.id,target:i.target,property:i.property,keyframes:i.keyframes.map(Ae),...j(i)}}function Yi(i){return{...i,...Array.isArray(i.end)&&{end:[...i.end]}}}function Ae(i){return{time:i.time,value:i.value,...i.easing&&{easing:i.easing}}}function j(i){const t=i.endDelay;return{...i.delay!==void 0&&{delay:i.delay},...t!==void 0&&{endDelay:t},...i.targets!==void 0&&{targets:[...i.targets]},...i.stagger!==void 0&&{stagger:{...i.stagger}}}}function Xi(i){if(K(i)){const t=i;return{id:t.id,target:t.target,property:t.property,kind:"inertia",inertia:Yi(t.inertia),...j(t)}}if(Q(i)){const t=i;return{id:t.id,target:t.target,property:t.property,kind:"spring",spring:{...t.spring},...j(t)}}if($t(i)){const t=i;return{id:t.id,target:t.target,property:"text",textConfig:{...t.textConfig},keyframes:[...t.keyframes].sort((e,n)=>e.time-n.time),...j(t)}}if(i.property==="motionPath"&&"motionPathConfig"in i){const t=i,e=[...t.keyframes].sort((n,s)=>n.time-s.time);return{id:t.id,target:t.target,property:"motionPath",motionPathConfig:{...t.motionPathConfig},keyframes:e,...j(t)}}return Ut({id:i.id,target:i.target,property:i.property,keyframes:i.keyframes,...j(i)})}function Vi(i){const t=i._config.markers;return{formatVersion:vt,id:i.id,name:i.name,config:{duration:i.duration>0?i.duration:void 0,loop:i._config.loop,speed:i._config.speed,alternate:i._config.alternate,repeatDelay:i._config.repeatDelay,...t&&{markers:t.map(e=>({...e}))}},tracks:i.tracks.map(qi),...i.captions&&{captions:JSON.parse(JSON.stringify(i.captions))}}}function ft(i){const t=i.formatVersion??1;if(t>vt)throw new Error(`tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${vt}. Update tinyfly to play it.`);return new Se({id:i.id,name:i.name,config:i.config,tracks:i.tracks.map(Xi),captions:i.captions})}function ir(i){return JSON.stringify(Vi(i))}function nr(i){const t=JSON.parse(i);return ft(t)}function sr(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i.charCodeAt(e),t=Math.imul(t,16777619);return t>>>0}function Wi(i){let t=i>>>0||2654435769;return{seed:i>>>0,next(){return t^=t<<13,t>>>=0,t^=t>>17,t^=t<<5,t>>>=0,t/4294967296}}}function Ee(i,t,e){return t+i.next()*(e-t)}function Ui(i,t,e,n){if(n<=0)return Ee(i,t,e);const s=Math.floor((e-t)/n),r=Math.round(i.next()*s);return t+r*n}function rr(i,t){if(t.length!==0)return t[Math.floor(i.next()*t.length)]}const ji=/^([+\-*/])=\s*(-?[\d.]+)$/,Hi=/^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;function or(i){return typeof i!="string"?!1:ji.test(i.trim())||Hi.test(i.trim())}function xe(i,t={}){if(typeof i!="string")return i;const e=i.trim(),n=ji.exec(e);if(n){const[,r,o]=n,a=t.base??0,c=Number.parseFloat(o);switch(r){case"+":return a+c;case"-":return a-c;case"*":return a*c;case"/":return c===0?a:a/c}}const s=Hi.exec(e);if(s){if(!t.random)throw new Error(`resolveValue: "${e}" needs a random source — pass one via context.random`);const r=Number.parseFloat(s[1]),o=Number.parseFloat(s[2]),a=s[3]!==void 0?Number.parseFloat(s[3]):void 0;return a!==void 0?Ui(t.random,r,o,a):Ee(t.random,r,o)}return i}function zi(i,t=0,e){const n=[];let s=t;for(const r of i){const o=xe(r,{base:s,random:e});n.push(o),typeof o=="number"&&(s=o)}return n}class ar{random;constructor(t){this.random=Wi(t)}get seed(){return this.random.seed}resolve(t,e=0){return xe(t,{base:e,random:this.random})}resolveSequence(t,e=0){return zi(t,e,this.random)}}const cr=600;function Gi(i){if(Array.isArray(i)){const[u,d,m,p]=i;return{fn:Zi(u,d,m,p),bezier:[u,d,m,p]}}const{segments:t}=it(i);if(t.length===0)throw new Error(`customEase: no curve in "${i}"`);const e=t[0].startX,n=t[0].startY,s=t[t.length-1],r=s.endX-e,o=s.endY-n;if(r===0||o===0)throw new Error(`customEase: "${i}" must move along both axes`);const a=u=>(u-e)/r,c=u=>(u-n)/o;if(t.length===1&&s.type==="C"){const[u,d,m,p]=s.points,y=[a(u),c(d),a(m),c(p)];return{fn:Zi(...y),bezier:y}}const l=[],h=[],f=Math.max(8,Math.ceil(cr/t.length));for(const u of t)for(let d=l.length===0?0:1;d<=f;d++){const[m,p]=lr(u,d/f);l.push(a(m)),h.push(c(p))}return{fn:hr(l,h)}}function Ki(i={}){const e=.1+Math.max(0,Math.min(1,i.strength??.7))*.7,n=[1];for(let r=e;r>.002;r*=e)n.push(2*Math.sqrt(r));const s=n.reduce((r,o)=>r+o,0);return r=>{if(r<=0)return 0;if(r>=1)return 1;let o=r*s;for(let a=0;a<n.length;a++){if(o<=n[a]){if(a===0)return(o/n[0])**2;const c=n[a]/2,l=c*c,h=o-c;return 1-(l-h*h)}o-=n[a]}return 1}}function Qi(i={}){const t=Math.max(1,i.wiggles??10),e=i.type??"easeOut",n=s=>e==="uniform"?1:e==="easeInOut"?Math.sin(Math.PI*s):(1-s)**2;return s=>s<=0||s>=1?0:Math.sin(s*t*Math.PI*2)*n(s)}function lr(i,t){if(i.type==="L"){const[l,h]=i.points;return[i.startX+(l-i.startX)*t,i.startY+(h-i.startY)*t]}const[e,n,s,r,o,a]=i.points,c=1-t;return[c*c*c*i.startX+3*c*c*t*e+3*c*t*t*s+t*t*t*o,c*c*c*i.startY+3*c*c*t*n+3*c*t*t*r+t*t*t*a]}function hr(i,t){return e=>{if(e<=i[0])return t[0];if(e>=i[i.length-1])return t[t.length-1];let n=0,s=i.length-1;for(;s-n>1;){const o=n+s>>1;i[o]<=e?n=o:s=o}const r=i[s]-i[n];return r===0?t[s]:t[n]+(e-i[n])/r*(t[s]-t[n])}}function Zi(i,t,e,n){const s=(o,a,c)=>3*(1-o)*(1-o)*o*a+3*(1-o)*o*o*c+o*o*o,r=(o,a,c)=>3*(1-o)*(1-o)*a+6*(1-o)*o*(c-a)+3*o*o*(1-c);return o=>{if(o<=0)return 0;if(o>=1)return 1;let a=o;for(let h=0;h<8;h++){const f=s(a,i,e)-o,u=r(a,i,e);if(Math.abs(f)<1e-6)return s(a,t,n);if(Math.abs(u)<1e-6)break;a-=f/u}let c=0,l=1;a=o;for(let h=0;h<40;h++)s(a,i,e)<o?c=a:l=a,a=(c+l)/2;return s(a,t,n)}}const ur=350,fr=300,dr=550;function pr(i,t={}){const e=t.lead??ur,n=t.gap??fr,s=t.tail??dr,r=[];let o=0;return i.forEach((a,c)=>{const l=[];let h=o+e;a.lines.forEach((u,d)=>{if(!(u.duration>=0))throw new Error(`narration: scene ${c} line ${d} has an invalid duration (${u.duration})`);d>0&&(h+=n),l.push({id:u.id??`s${c}-l${d}`,scene:c,line:d,start:h,end:h+u.duration,text:u.text}),h+=u.duration});const f=h+s+(a.tail??0);r.push({id:a.id??`s${c}`,start:o,duration:f-o,cues:l}),o=f}),{duration:o,scenes:r,cues:r.flatMap(a=>a.cues)}}function mr(i){return i.cues.map(t=>({id:t.id,time:t.start,label:t.text}))}function gr(i,t){let e=i.scenes[0];for(const n of i.scenes)if(t>=n.start)e=n;else break;return e}const H=i=>Math.round(i*1e3)/1e3;function Ji(i,t={}){if(i.length===0)return"";const e=t.curviness??1,n=t.closed??!1,s=i.length;let r=`M${H(i[0].x)} ${H(i[0].y)}`;if(s===1)return r;const o=c=>n?i[(c%s+s)%s]:i[Math.max(0,Math.min(s-1,c))],a=n?s:s-1;for(let c=0;c<a;c++){const l=o(c-1),h=o(c),f=o(c+1),u=o(c+2);if(e===0){r+=` L${H(f.x)} ${H(f.y)}`;continue}const d=e/6,m=h.x+(f.x-l.x)*d,p=h.y+(f.y-l.y)*d,y=f.x-(u.x-h.x)*d,b=f.y-(u.y-h.y)*d;r+=` C${H(m)} ${H(p)} ${H(y)} ${H(b)} ${H(f.x)} ${H(f.y)}`}return n?`${r} Z`:r}const F=(i,t=0)=>{const e=parseFloat(i??"");return Number.isFinite(e)?e:t};function yr(i){const t=(i??"").trim().split(/[\s,]+/).filter(Boolean).map(Number),e=[];for(let n=0;n+1<t.length;n+=2)e.push({x:t[n],y:t[n+1]});return e}function Ht(i){const t=i.attributes;switch(i.tag.toLowerCase()){case"path":return t.d??null;case"circle":case"ellipse":{const e=F(t.cx),n=F(t.cy),s=i.tag.toLowerCase()==="circle"?F(t.r):F(t.rx),r=i.tag.toLowerCase()==="circle"?F(t.r):F(t.ry);return`M${e+s} ${n} A${s} ${r} 0 1 1 ${e-s} ${n} A${s} ${r} 0 1 1 ${e+s} ${n} Z`}case"rect":{const e=F(t.x),n=F(t.y),s=F(t.width),r=F(t.height);let o=t.rx!=null?F(t.rx):t.ry!=null?F(t.ry):0,a=t.ry!=null?F(t.ry):o;return o=Math.min(o,s/2),a=Math.min(a,r/2),o===0||a===0?`M${e} ${n} H${e+s} V${n+r} H${e} Z`:`M${e+o} ${n} H${e+s-o} A${o} ${a} 0 0 1 ${e+s} ${n+a} V${n+r-a} A${o} ${a} 0 0 1 ${e+s-o} ${n+r} H${e+o} A${o} ${a} 0 0 1 ${e} ${n+r-a} V${n+a} A${o} ${a} 0 0 1 ${e+o} ${n} Z`}case"line":return`M${F(t.x1)} ${F(t.y1)} L${F(t.x2)} ${F(t.y2)}`;case"polyline":case"polygon":{const e=yr(t.points);if(e.length===0)return null;const n=e.map((s,r)=>`${r===0?"M":"L"}${s.x} ${s.y}`).join(" ");return i.tag.toLowerCase()==="polygon"?`${n} Z`:n}default:return null}}const zt={"power1.in":[.55,.085,.68,.53],"power1.out":[.25,.46,.45,.94],"power1.inout":[.455,.03,.515,.955],"power2.in":[.55,.055,.675,.19],"power2.out":[.215,.61,.355,1],"power2.inout":[.645,.045,.355,1],"power3.in":[.895,.03,.685,.22],"power3.out":[.165,.84,.44,1],"power3.inout":[.77,0,.175,1],"power4.in":[.755,.05,.855,.06],"power4.out":[.23,1,.32,1],"power4.inout":[.86,0,.07,1],"sine.in":[.47,0,.745,.715],"sine.out":[.39,.575,.565,1],"sine.inout":[.445,.05,.55,.95],"expo.in":[.95,.05,.795,.035],"expo.out":[.19,1,.22,1],"expo.inout":[1,0,0,1],"circ.in":[.6,.04,.98,.335],"circ.out":[.075,.82,.165,1],"circ.inout":[.785,.135,.15,.86],"back.in":[.6,-.28,.735,.045],"back.out":[.175,.885,.32,1.275],"back.inout":[.68,-.55,.265,1.55]},tn={none:"linear",linear:"linear","linear.none":"linear","power1.in":"ease-in-quad","power1.out":"ease-out-quad","power1.inout":"ease-in-out-quad","power2.in":"ease-in-cubic","power2.out":"ease-out-cubic","power2.inout":"ease-in-out-cubic"};function br(i){let t=i.trim().toLowerCase();t=t.replace(/\.ease(in|out|inout)$/,".$1");const e=/^([a-z]+\d?)(\(.*\))?$/.exec(t);return e&&e[1]!=="steps"&&t!=="none"&&t!=="linear"&&(t=`${e[1]}.out${e[2]??""}`),t}W({type:"bounce",mode:"in"}),W({type:"bounce",mode:"in-out"});function Pt(i){const t=en.get(i.trim().toLowerCase());if(t)return t;const e=br(i),n=/^steps\(\s*(\d+)\s*\)$/.exec(e);if(n){const o={type:"steps",count:Math.max(1,Number.parseInt(n[1],10))+1,position:"none"};return{easing:o,fn:W(o)}}const s=/^(elastic|bounce|back)\.(in|out|inout)(?:\(([^)]*)\))?$/.exec(e);if(s){const[,r,o,a]=s,c=(a??"").split(",").map(f=>Number.parseFloat(f)).filter(f=>Number.isFinite(f)),l=o==="inout"?"in-out":o;if(r==="back"&&c.length===0&&e in zt)return{easing:{type:"cubic-bezier",points:zt[e]}};const h=r==="elastic"?{type:"elastic",mode:l,...c[0]!==void 0&&{amplitude:c[0]},...c[1]!==void 0&&{period:c[1]}}:r==="bounce"?{type:"bounce",mode:l}:{type:"back",mode:l,...c[0]!==void 0&&{overshoot:c[0]}};return{easing:h,fn:W(h)}}return e in tn?{easing:tn[e]}:e in zt?{easing:{type:"cubic-bezier",points:zt[e]}}:{easing:"ease-out"}}const en=new Map;function Pe(i,t){return en.set(i.trim().toLowerCase(),t.bezier?{easing:{type:"cubic-bezier",points:t.bezier},fn:t.fn}:{fn:t.fn,requiresBaking:"custom"}),i}function Ce(i){let t=i>>>0;return()=>{t=t+1831565813>>>0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}const nn=/^\s*random\(\s*(\[.*\]|[^)]*)\s*\)\s*$/;function sn(i){return typeof i=="string"&&nn.test(i)}function vr(i=1){let t=Ce(i);const e=(c,l)=>((...h)=>h.length>=c?l(...h):f=>l(...h,f)),n=(c,l,h)=>Math.min(Math.max(h,Math.min(c,l)),Math.max(c,l)),s=(c,l,h,f,u)=>l===c?h:h+(u-c)/(l-c)*(f-h),r=(c,l)=>{if(typeof c=="number")return c===0?l:Math.round(l/c)*c;if(Array.isArray(c))return rn(c,l,1/0);if("values"in c)return rn(c.values,l,c.radius??1/0);const h=Math.round(l/c.increment)*c.increment;return Math.abs(h-l)<=(c.radius??1/0)?h:l},o=(c,l,h)=>{const f=c+t()*(l-c);return h?Math.round(f/h)*h:f};return{clamp:e(3,n),mapRange:e(5,s),normalize:e(3,(c,l,h)=>s(c,l,0,1,h)),interpolate:e(3,(c,l,h)=>{if(typeof c=="object"&&!Array.isArray(c)){const f={};for(const u of Object.keys(c))f[u]=xt(c[u])(c[u],l[u],h);return f}return xt(c)(c,l,h)}),wrap:((c,l,h)=>{if(Array.isArray(c)){const p=c,y=b=>p[(Math.round(b)%p.length+p.length)%p.length];return l===void 0?y:y(l)}const f=c,d=l-f,m=p=>d===0?f:((p-f)%d+d)%d+f;return h===void 0?m:m(h)}),wrapYoyo:e(3,(c,l,h)=>{const f=l-c;if(f===0)return c;const u=((h-c)%(f*2)+f*2)%(f*2);return c+(u>f?f*2-u:u)}),snap:e(2,r),random:((c,l,h,f)=>{if(Array.isArray(c)){const d=()=>c[Math.floor(t()*c.length)];return l===!0?d:d()}const u=()=>o(c,l,h);return f?u:u()}),shuffle:c=>{for(let l=c.length-1;l>0;l--){const h=Math.floor(t()*(l+1));[c[l],c[h]]=[c[h],c[l]]}return c},distribute:({base:c=0,amount:l,each:h,from:f="start",ease:u})=>(d,m,p)=>{const y=p.length,w=Dt(d,y,{...l!==void 0?{amount:l}:{each:h??1},from:f}),v=l!==void 0?l:(h??1)*re(y,f),k=u&&v>0?u(w/v)*v:w;return c+k},pipe:(...c)=>l=>c.reduce((h,f)=>f(h),l),splitColor:c=>wr(c),getUnit:c=>typeof c=="number"?"":/^-?[\d.]+(?:e[-+]?\d+)?([a-z%]*)$/i.exec(c.trim())?.[1]??"",seed:c=>{t=Ce(c)},resolveRandomString:c=>{const l=nn.exec(c)?.[1]??"";if(l.startsWith("[")){const m=l.slice(1,-1).split(",").map(p=>p.trim()).filter(Boolean).map(p=>Number.isFinite(Number(p))?Number(p):p.replace(/^['"]|['"]$/g,""));return m[Math.floor(t()*m.length)]}const[h,f,u]=l.split(",").map(d=>Number.parseFloat(d));return o(h,f,Number.isFinite(u)?u:void 0)}}}function rn(i,t,e){let n=t,s=1/0;for(const r of i){const o=Math.abs(r-t);o<s&&(s=o,n=r)}return s<=e?n:t}function wr(i){const t=i.trim(),e=/^#([0-9a-f]{3,8})$/i.exec(t)?.[1];if(e){const r=(e.length<=4?[...e].map(o=>o+o).join(""):e).match(/../g).map(o=>Number.parseInt(o,16));return r.length>=4?[r[0],r[1],r[2],Math.round(r[3]/255*1e3)/1e3]:[r[0],r[1],r[2]]}const n=(/rgba?\(([^)]+)\)/i.exec(t)?.[1]??"0,0,0").split(/[\s,/]+/).filter(Boolean).map(s=>Number.parseFloat(s));return n.length>=4?[n[0],n[1],n[2],n[3]]:[n[0]??0,n[1]??0,n[2]??0]}const Tr=/^([+-])=\s*(-?[\d.]+)$/,kr=/^([<>])\s*(?:([+-])?=?\s*(-?[\d.]+))?$/;function Ct(i,t){const e=t.scale??1,n=l=>Number.parseFloat(l)*e;if(i===void 0)return t.cursor;if(typeof i=="number")return i*e;const s=i.trim();if(s==="")return t.cursor;const r=Tr.exec(s);if(r){const l=n(r[2]);return t.cursor+(r[1]==="-"?-l:l)}const o=kr.exec(s);if(o){const l=o[1]==="<"?t.previousStart:t.previousEnd;if(o[3]===void 0)return l;const h=n(o[3]);return l+(o[2]==="-"?-h:h)}const a=/^(.+?)([+-])=\s*(-?[\d.]+)$/.exec(s);if(a){const l=t.labels.get(a[1].trim());if(l!==void 0){const h=n(a[3]);return l+(a[2]==="-"?-h:h)}}const c=t.labels.get(s);return c!==void 0?c:/^-?[\d.]+$/.test(s)?n(s):t.cursor}function Sr(i){if(typeof i!="object"||i===null)return!1;const t=i;return t.grid!==void 0||t.from==="random"||Array.isArray(t.from)||t.ease!==void 0||t.axis!==void 0}function Mr(i,t,e={}){if(i===0)return[];const n=t.grid==="auto"?Math.max(1,Math.min(i,e.columnsFromLayout?.()??i)):Array.isArray(t.grid)?Math.max(1,t.grid[1]):i,s=Array.isArray(t.grid)?Math.max(1,t.grid[0]):Math.ceil(i/n),r=m=>({x:m%n,y:Math.floor(m/n)}),o=t.from??"start",a=Array.isArray(o)?{x:o[0]*(n-1),y:o[1]*(s-1)}:typeof o=="number"?r(Math.max(0,Math.min(i-1,o))):o==="end"?r(i-1):o==="center"||o==="edges"?{x:(n-1)/2,y:(s-1)/2}:{x:0,y:0},c=m=>{const{x:p,y}=r(m),b=Math.abs(p-a.x),w=Math.abs(y-a.y);return t.axis==="x"?b:t.axis==="y"?w:Math.hypot(b,w)};let l=Array.from({length:i},(m,p)=>c(p));const h=Math.max(...l);if(o==="edges"&&(l=l.map(m=>h-m)),o==="random"){const m=e.random??Math.random;l=l.map(()=>m()*h)}const f=t.amount!==void 0?t.amount:(t.each??0)*h,u=t.ease?Pt(t.ease):void 0,d=u?u.fn??W(u.easing):void 0;return l.map(m=>{const p=h===0?0:m/h;return(d?d(p):p)*f})}const _e=new Set(["duration","delay","ease","repeat","repeatDelay","yoyo","stagger","onComplete","onUpdate","onStart","onRepeat","onReverseComplete","repeatRefresh","keyframes","easeEach","scrollTo","id","immediateRender","overwrite","paused","scrollTrigger","spring"]);function Gt(i){const t={},e={};for(const[n,s]of Object.entries(i))_e.has(n)?t[n]=s:e[n]=s;return{config:t,properties:e}}function Kt(i,t){return i===void 0?t:i*1e3}function Ie(i,t){if(i!==void 0)return typeof i=="number"?{each:i*1e3}:Sr(i)?{offsets:Mr(t?.count??0,i,t??{}).map(n=>n*1e3)}:{...i.each!==void 0&&{each:i.each*1e3},...i.amount!==void 0&&{amount:i.amount*1e3},...i.from!==void 0&&{from:i.from}}}const Ar={opacity:1,x:0,y:0,z:0,rotate:0,rotateX:0,rotateY:0,rotateZ:0,rotation:0,scale:1,scaleX:1,scaleY:1,scaleZ:1,skewX:0,skewY:0,originX:50,originY:50,perspective:0,blur:0,glow:0,clipTop:0,clipRight:0,clipBottom:0,clipLeft:0};function on(i){return Ar[i]}function Er(i){const t=typeof i=="string"||Array.isArray(i)?{path:i}:i;if(!t||typeof t.path!="string"&&!Array.isArray(t.path))throw new Error("gsap-compat: motionPath needs a path — SVG path data or an array of { x, y } points.");let e;if(Array.isArray(t.path))e=Ji(t.path,{curviness:t.curviness});else if(ht(t.path))e=t.path;else throw new Error(`gsap-compat: motionPath "${t.path}" is not path data. Selectors and elements are resolved by live.to(); timeline() and tf need the path data itself.`);const n={pathData:e};return t.autoRotate!==void 0&&t.autoRotate!==!1&&(n.autoRotate=!0,typeof t.autoRotate=="number"&&(n.rotateOffset=t.autoRotate)),t.matrix&&(n.matrix=t.matrix),{config:n,start:t.start??0,end:t.end??1}}function xr(i){const t=typeof i=="string"||Array.isArray(i)?{path:i}:{...i};return{...t,start:t.end??1,end:t.start??0}}function an(i){return typeof i=="object"&&i!==null&&"shape"in i?i.shape:i}function Pr(i){if(i.morphSVG===void 0)return i;const{morphSVG:t,...e}=i,n=an(t);if(typeof n!="string"||!ht(n))throw new Error(`gsap-compat: morphSVG "${String(n)}" is not path data. Selectors and elements are resolved by live.to(); timeline() and tf need the path data itself.`);return{...e,d:n}}function Cr(i,t){if(i===!0)return[0,t];if(i===!1)return[0,0];if(typeof i=="number")return[0,cn(i,t)];const e=i.trim().split(/[\s,]+/).filter(Boolean),n=o=>{const a=Number.parseFloat(o);if(Number.isNaN(a))throw new Error(`gsap-compat: drawSVG "${i}" is not a length or percentage`);return cn(o.endsWith("%")?t*a/100:a,t)};if(e.length===0)return[0,t];if(e.length===1)return[0,n(e[0])];const s=n(e[0]),r=n(e[1]);return s<=r?[s,r]:[r,s]}function _r(i,t){const[e,n]=Cr(i,t);return{strokeDasharray:[n-e,t],strokeDashoffset:-e}}function Ir(i,t){if(i.drawSVG===void 0)return i;const{drawSVG:e,...n}=i;return{...n,..._r(e,t)}}function Rr(i){if(i.drawSVG!==void 0)throw new Error("gsap-compat: drawSVG needs the stroke length from the page. Use live.to(), or animate strokeDasharray / strokeDashoffset directly (see drawSvgProperties).");return i}function cn(i,t){return Math.max(0,Math.min(t,i))}function Lr(i){let t=2166136261;for(let e=0;e<i.length;e++)t=Math.imul(t^i.charCodeAt(e),16777619);return t>>>0}function Fr(i,t,e){if(i.scrambleText!==void 0){const n=i.scrambleText,s=typeof n=="string"?{text:n}:n;if(typeof s?.text!="string")throw new Error("gsap-compat: scrambleText needs the text to end on — a string, or { text }.");const r=s.revealDelay&&e>0?s.revealDelay*1e3/e:void 0;return{to:s.text,mode:"scramble",...s.chars!==void 0&&{chars:s.chars},...s.speed!==void 0&&{refreshRate:20*s.speed},...r!==void 0&&{revealDelay:Math.min(r,.999)},...s.tweenLength!==void 0&&{tweenLength:s.tweenLength},...s.rightToLeft!==void 0&&{rightToLeft:s.rightToLeft},seed:s.seed??Lr(`${t}|${s.text}`)}}if(i.text!==void 0){const n=i.text,s=typeof n=="string"?{value:n}:n;if(typeof s?.value!="string")throw new Error("gsap-compat: text needs the text to end on — a string, or { value }.");return{to:s.value,mode:"type",...s.rightToLeft!==void 0&&{rightToLeft:s.rightToLeft}}}}function Re(i){return Math.max(.1,i/25)}function $r(i,t){const e=typeof t=="number"?{velocity:t}:t;if(typeof e?.velocity!="number"||!Number.isFinite(e.velocity))throw new Error("gsap-compat: inertia needs a velocity for each property — a number, or { velocity }.");const n=e.friction??(e.resistance!==void 0?Re(e.resistance):void 0),s={from:i,velocity:e.velocity,...n!==void 0&&{friction:n},...e.min!==void 0&&{min:e.min},...e.max!==void 0&&{max:e.max}};return typeof e.end=="function"?s.end=[e.end(kt(s))]:e.end!==void 0&&(s.end=Array.isArray(e.end)?[...e.end]:e.end),s}function Dr(i){const t=i===!0?{}:typeof i=="string"?{preset:i}:i;if(t.preset!==void 0&&!(t.preset in Nt))throw new Error(`gsap-compat: unknown spring preset "${t.preset}" — use one of ${Object.keys(Nt).join(", ")}`);return{...t.preset?Nt[t.preset]:{},...t.stiffness!==void 0&&{stiffness:t.stiffness},...t.damping!==void 0&&{damping:t.damping},...t.mass!==void 0&&{mass:t.mass},...t.restDelta!==void 0&&{restDelta:t.restDelta}}}function Br(i,t){if(i===!0||typeof i=="string")return;const e=i.velocity;return typeof e=="number"?e:e?.[t]}class nt{timeline;options;cursor=0;fallbackRandom=Ce(1);previousStart=0;previousEnd=0;labels=new Map;trackCounter=0;lastValues=new Map;constructor(t={}){this.options=t,this.timeline=new Se({id:t.id??"gsap-compat",name:t.name,config:{...t.repeat!==void 0&&{loop:t.repeat},...t.yoyo!==void 0&&{alternate:t.yoyo},...t.repeatDelay!==void 0&&{repeatDelay:t.repeatDelay*1e3},...t.timeScale!==void 0&&{speed:t.timeScale}}})}to(t,e,n){return this.build(t,void 0,_t(e),n)}from(t,e,n){const{config:s,properties:r}=Gt(_t(e)),{motionPath:o,text:a,scrambleText:c,...l}=r,h=this.targetsOf(t)[0],f={...s};for(const m of Object.keys(l))f[m]=this.resolveStart(h,m);o!==void 0&&(f.motionPath=xr(o));const u={},d=String(this.resolveStart(h,"text"));return a!==void 0&&(u.text=Le(a),f.text=typeof a=="object"?{...a,value:d}:d),c!==void 0&&(u.text=Le(c),f.scrambleText=typeof c=="object"?{...c,text:d}:d),this.build(t,{...l,...u},f,n)}fromTo(t,e,n,s){const{properties:r}=Gt(_t(e));return this.build(t,r,_t(n),s)}set(t,e,n){return this.build(t,void 0,{..._t(e),duration:0},n)}get lastStart(){return this.previousStart}get lastEnd(){return this.previousEnd}addEvent(t){const e=Math.max(0,Ct(t,this.context()));return this.previousStart=e,this.previousEnd=e,this.cursor=Math.max(this.cursor,e),e}timeOf(t){return Ct(t,this.context())}addLabel(t,e){return this.labels.set(t,Ct(e,this.context())),this}labelTimes(){return[...this.labels.values()].sort((t,e)=>t-e)}labelTime(t){return this.labels.get(t)}add(t,e){const n=Ct(e,this.context());for(const r of t.timeline.tracks){if(!("keyframes"in r))continue;const o=Ut({...r,id:this.nextTrackId(`nested-${r.id}`),keyframes:r.keyframes.map(a=>({...a,time:a.time+n}))});this.timeline.addTrack(o)}const s=n+t.timeline.duration;return this.previousStart=n,this.previousEnd=s,this.cursor=Math.max(this.cursor,s),this}play(){return this.timeline.play(),this}pause(){return this.timeline.pause(),this}restart(){return this.timeline.stop(),this.timeline.play(),this}reverse(){return this.timeline.reverse(),this}kill(){return this.timeline.removeTracks(),this}reset(){return this.timeline.removeTracks(),this.cursor=0,this.previousStart=0,this.previousEnd=0,this.labels.clear(),this.lastValues.clear(),this.trackCounter=0,this}seek(t){if(typeof t=="string"){const e=this.labels.get(t);return e!==void 0&&this.timeline.seek(e),this}return this.timeline.seek(t*1e3),this}progress(t){const e=this.timeline.duration;return t!==void 0&&e>0&&this.timeline.seek(t*e),e>0?this.timeline.currentTime/e:0}timeScale(t){return t!==void 0&&(this.timeline.speed=t),this.timeline.speed}duration(){return this.timeline.duration/1e3}tick(t){return this.timeline.tick(t),this}toDefinition(){return this.timeline.toDefinition()}build(t,e,n,s){const{config:r,properties:o}=Gt(n),{motionPath:a,text:c,scrambleText:l,inertia:h,...f}=o,u=this.targetsOf(t),d=Ct(s,this.context()),m=Kt(r.delay,0),p=Kt(r.duration,500),y=Ie(r.stagger,{count:u.length,columnsFromLayout:this.options.layoutColumns?()=>this.options.layoutColumns(u):void 0,random:this.options.random??this.fallbackRandom}),b=this.easingFor(r.ease),w=[],v=r.spring;let k=0,T=!1;for(const[M,C]of Object.entries(f)){const P=C;let _=e?.[M]!==void 0?e[M]:this.resolveStart(u[0],M);if(typeof _!=typeof P&&(this.warn(`no usable start value for "${M}" on "${u[0]}" — it will snap to ${String(P)}. Use fromTo() to animate it.`),_=P),v!==void 0&&(typeof _!="number"||typeof P!="number")&&this.warn(`spring works on numbers, so "${M}" on "${u[0]}" eases instead`),v!==void 0&&typeof _=="number"&&typeof P=="number"){const D={...Dr(v),from:_,to:P,velocity:Br(v,M)??this.options.startVelocity?.(u[0],M)??0},q=this.nextTrackId(`${u[0]}-${M}-spring`),N={id:q,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:M,kind:"spring",spring:D,delay:d+m};this.timeline.addTrack(N),w.push(q),k=Math.max(k,ti(D));for(const L of u)this.lastValues.set(`${L}|${M}`,P);continue}T=!0;const E=this.keyframesFor(_,P,p,b,r.ease),R=this.nextTrackId(`${u[0]}-${M}`);this.timeline.addTrack(Ut({id:R,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:M,delay:d+m,keyframes:E})),w.push(R);for(const D of u)this.lastValues.set(`${D}|${M}`,P)}const S=Fr({text:c,scrambleText:l},u[0],p);if(S){const M=e?.text??e?.scrambleText,C=M!==void 0?Le(M):this.resolveStart(u[0],"text"),P=this.nextTrackId(`${u[0]}-text`),_={id:P,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:"text",textConfig:{from:typeof C=="string"?C:String(C??""),...S},delay:d+m,keyframes:this.keyframesFor(0,1,p,b,r.ease)};this.timeline.addTrack(_),w.push(P);for(const E of u)this.lastValues.set(`${E}|text`,S.to)}if(a!==void 0){const{config:M,start:C,end:P}=Er(a),_=this.nextTrackId(`${u[0]}-motionPath`),E={id:_,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:"motionPath",motionPathConfig:M,delay:d+m,keyframes:this.keyframesFor(C,P,p,b,r.ease)};this.timeline.addTrack(E),w.push(_)}if(h!==void 0)for(const[M,C]of Object.entries(h)){const P=this.resolveStart(u[0],M);if(typeof P!="number"){this.warn(`inertia on "${M}" needs a numeric start value; skipped`);continue}const _=$r(P,C),E=this.nextTrackId(`${u[0]}-${M}-inertia`),R={id:E,target:u[0],...u.length>1&&{targets:u},...y&&u.length>1&&{stagger:y},property:M,kind:"inertia",inertia:_,delay:d+m};this.timeline.addTrack(R),w.push(E),k=Math.max(k,ct(_));for(const D of u)this.lastValues.set(`${D}|${M}`,at(_))}const O=((h!==void 0||v!==void 0)&&!T&&!S&&a===void 0?k:Math.max(p,k))+(y&&u.length>1?wt(u.length,y):0),x=d+m+O;return this.previousStart=d+m,this.previousEnd=x,this.cursor=Math.max(this.cursor,x),{trackIds:w,start:d+m,end:x,kill:()=>{for(const M of w)this.timeline.removeTrack(M)}}}keyframesFor(t,e,n,s,r){const o={time:0,value:t};if(n<=0)return[{time:0,value:e}];const a=typeof r=="string"?Pt(r):void 0;if(a?.requiresBaking==="custom"||this.options.bakeEases&&bt(s)){const l=a?.fn??W(s);return[o,...we(o,{time:n,value:e},l,{intervalMs:this.options.bakeIntervalMs})]}return[o,{time:n,value:e,...s&&{easing:s}}]}resolveStart(t,e){const n=this.lastValues.get(`${t}|${e}`);if(n!==void 0)return n;const s=this.options.startValue?.(t,e);if(s!==void 0)return s;const r=this.options.defaults?.[e];if(r!==void 0)return r;if(e==="text")return"";if(e==="d")throw new Error(`gsap-compat: no starting shape for "${t}". Use fromTo({ d: … }, { morphSVG: … }), or live.to(), which reads the element's current shape.`);const o=on(e);return o!==void 0?(this.warn(`no start value for "${e}" on "${t}" — using the static default ${o}. GSAP would read the live DOM here; tinyfly cannot, so pass an explicit fromTo() or a defaults map.`),o):(this.warn(`no start value or default for "${e}" on "${t}" — using 0`),0)}easingFor(t){if(t!==void 0){if(typeof t=="string")return Pt(t).easing;if(typeof t=="function")throw new Error('gsap-compat: function eases cannot be serialized. Use a named ease, or a cubic-bezier via { type: "cubic-bezier", points: [...] }.');return t}}targetsOf(t){return Array.isArray(t)?t:[t]}context(){return{cursor:this.cursor,previousStart:this.previousStart,previousEnd:this.previousEnd,labels:this.labels,scale:1e3}}nextTrackId(t){return this.trackCounter+=1,`${t}-${this.trackCounter}`}warn(t){this.options.onWarning?.(`gsap-compat: ${t}`)}}function Le(i){if(typeof i=="string")return i;if(i&&typeof i=="object"){const t=i;return String(t.value??t.text??"")}return String(i??"")}function Or(i){return new nt(i)}function _t(i){return Rr(Pr(i))}const Nr=new Set(["blur","brightness","glow","glowColor","shadowX","shadowY","shadowBlur","shadowColor"]),qr="#ffffff",Yr="rgba(0, 0, 0, 0.5)";function Xr(i){const t=[];if(i.blur!==void 0&&t.push(`blur(${Math.max(0,i.blur)}px)`),i.brightness!==void 0&&t.push(`brightness(${Math.max(0,i.brightness)})`),i.glow!==void 0&&t.push(`drop-shadow(0 0 ${Math.max(0,i.glow)}px ${i.glowColor??qr})`),i.shadowX!==void 0||i.shadowY!==void 0||i.shadowBlur!==void 0){const e=i.shadowX??0,n=i.shadowY??0,s=Math.max(0,i.shadowBlur??0);t.push(`drop-shadow(${e}px ${n}px ${s}px ${i.shadowColor??Yr})`)}return t.length>0?t.join(" "):null}function Vr(i,t){const e=i.childNodes.length===1?i.firstChild:null;if(e&&e.nodeType===3){const n=e;n.data!==t&&(n.data=t);return}i.textContent!==t&&(i.textContent=t)}function Wr(i){if(!("ownerSVGElement"in i))return;const t=i.style;!t||t.transformBox||(t.transformBox="fill-box",t.transformOrigin||(t.transformOrigin="50% 50%"))}const ln=new Set(["width","height","top","right","bottom","left","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","borderRadius","borderWidth","fontSize","lineHeight","letterSpacing","outlineWidth","gap","rowGap","columnGap"]),Ur=new Set(["x","y","z","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skewX","skewY","motionPathX","motionPathY","motionPathRotate"]),jr=new Set(["originX","originY"]),Hr=new Set(["clipTop","clipRight","clipBottom","clipLeft"]),zr={fill:"backgroundColor",stroke:"borderColor",strokeWidth:"borderWidth",color:"color",backgroundColor:"backgroundColor",borderColor:"borderColor"},hn={fill:"fill",stroke:"stroke",strokeWidth:"strokeWidth",strokeDasharray:"strokeDasharray",strokeDashoffset:"strokeDashoffset",fillOpacity:"fillOpacity",strokeOpacity:"strokeOpacity"},Gr="http://www.w3.org/2000/svg";class st{targets=new Map;registerTarget(t,e){this.targets.set(t,e)}unregisterTarget(t){this.targets.delete(t)}getTarget(t){return this.targets.get(t)}clearTargets(){this.targets.clear()}applyState(t){for(const[e,n]of t.values){const s=this.targets.get(e);s&&this.applyProperties(s,n)}}applyProperties(t,e){const n=[];let s=null,r=null,o=null;const a=e.has("motionPathX"),c=e.has("motionPathY"),l=e.has("motionPathRotate");for(const[u,d]of e)if(!(u==="x"&&a)&&!(u==="y"&&c)&&!((u==="rotate"||u==="rotateZ")&&l)){if(Ur.has(u)){const m=this.buildTransformPart(u,d);m&&n.push(m)}else if(jr.has(u))typeof d=="number"&&((s??={})[u]=d);else if(Hr.has(u))typeof d=="number"&&((r??={})[u]=d);else if(Nr.has(u))(o??={})[u]=d;else if(u!=="perspective"){if(u!=="shine")if(u==="text"&&typeof d=="string")Vr(t,d);else if(u==="d"&&typeof d=="string"){const m=t;(m.tagName?.toLowerCase()==="path"?m:m.querySelector?.("path"))?.setAttribute?.("d",d)}else this.applyStyleProperty(t,u,d)}}const h=e.get("shine");typeof h=="number"&&this.applyShine(t,h);const f=e.get("perspective");if(typeof f=="number"&&n.unshift(`perspective(${f}px)`),n.length>0&&(t.style.transform=n.join(" "),Wr(t)),s){const u=s.originX??50,d=s.originY??50;t.style.transformOrigin=`${u}% ${d}%`}if(r){const u=r.clipTop??0,d=r.clipRight??0,m=r.clipBottom??0,p=r.clipLeft??0;t.style.clipPath=`inset(${u}% ${d}% ${m}% ${p}%)`}if(o){const u=Xr(o);u&&(t.style.filter=u)}}buildTransformPart(t,e){if(typeof e!="number")return null;switch(t){case"x":case"motionPathX":return`translateX(${e}px)`;case"y":case"motionPathY":return`translateY(${e}px)`;case"z":return`translateZ(${e}px)`;case"rotate":case"rotateZ":case"motionPathRotate":return`rotate(${e}deg)`;case"rotateX":return`rotateX(${e}deg)`;case"rotateY":return`rotateY(${e}deg)`;case"scale":return`scale(${e})`;case"scaleX":return`scaleX(${e})`;case"scaleY":return`scaleY(${e})`;case"scaleZ":return`scaleZ(${e})`;case"skewX":return`skewX(${e}deg)`;case"skewY":return`skewY(${e}deg)`;default:return null}}applyShine(t,e){t.dataset.shineBase||(t.dataset.shineBase=t.style.color||"currentColor");const n=t.dataset.shineBase,s=-20+e*140,r=t.style;r.color="transparent",r.backgroundImage=`linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%), linear-gradient(${n}, ${n})`,r.backgroundSize="250% 100%, 100% 100%",r.backgroundPosition=`${s}% 0, 0 0`,r.backgroundRepeat="no-repeat",r.webkitBackgroundClip="text",r.backgroundClip="text"}applyStyleProperty(t,e,n){let s;if(t.namespaceURI===Gr&&e in hn){const a=Array.isArray(n)?n.join(", "):String(n);t.style[hn[e]]=a;return}else e==="fill"&&t.dataset?.elementType==="text"?s="color":s=zr[e]??e;let o;typeof n=="number"?ln.has(e)||ln.has(s)?o=`${n}px`:o=String(n):Array.isArray(n)?o=n.join(", "):o=n,t.style[s]=o}}const Kr={request:i=>requestAnimationFrame(i),cancel:i=>cancelAnimationFrame(i)};class un{adapter=new st;scheduler;rootOption;onWarning;names=new WeakMap;elements=new Map;nameCounter=0;objectNames=new WeakMap;objects=new Map;owned=new Set;currentCollector;tickerCallbacks=new Set;tickerTime=0;tickerFrame=0;liveTimelines=new Set;utils=vr();active=new Map;applied=new Map;dirty=new Set;frameId=null;lastTimestamp=null;destroyed=!1;constructor(t={}){this.scheduler=t.scheduler??Kr,this.rootOption=t.root,this.onWarning=t.onWarning}get root(){return this.rootOption??document}resolveTargets(t){const e=[];for(const n of this.targetsOf(t)){const s=this.nameFor(n);Fe(n)&&this.currentCollector?.touch(n,s),e.push(s)}return e}query(t){return this.selectorRoot.querySelector(t)}get collector(){return this.currentCollector}setCollector(t){this.currentCollector=t}forget(t){this.applied.delete(t),this.dirty.delete(t)}get selectorRoot(){return this.currentCollector?.scope??this.root}elementFor(t){return this.elements.get(t)}objectFor(t){return this.objects.get(t)}appliedValue(t,e){return this.applied.get(t)?.get(e)}velocityOf(t,e){for(const s of[...this.active.keys()].reverse()){if(s.getTracks({target:t,property:e}).length===0)continue;const r=s.currentTime;if(r<4)return 0;const o=s.getStateAtTime(r).values.get(t)?.get(e),a=s.getStateAtTime(r-4).values.get(t)?.get(e);if(typeof o!="number"||typeof a!="number")return;const c=(o-a)/4;return(s.direction==="reverse"?-c:c)*1e3}}ticker={add:t=>{this.destroyed||(this.tickerCallbacks.size===0&&(this.tickerTime=0,this.tickerFrame=0),this.tickerCallbacks.add(t),this.currentCollector?.track({revert:()=>this.ticker.remove(t)}),this.startLoop())},remove:t=>{this.tickerCallbacks.delete(t),this.running||this.stopLoop()}};activate(t,e={}){this.destroyed||(t.onUpdate=n=>this.write(n),this.active.delete(t),this.active.set(t,e),this.startLoop())}deactivate(t){this.active.delete(t),this.running||this.stopLoop()}own(t){return this.destroyed?t.destroy():this.owned.add(t),t}destroy(){this.destroyed=!0;for(const t of this.owned)t.destroy();this.owned.clear();for(const t of this.active.keys())t.stop();this.active.clear(),this.stopLoop(),this.adapter.clearTargets(),this.elements.clear(),this.names=new WeakMap,this.objects.clear(),this.objectNames=new WeakMap,this.tickerCallbacks.clear(),this.liveTimelines.clear(),this.applied.clear(),this.dirty.clear()}apply(t,e){if(this.destroyed)return;const n=new Map(Object.entries(e));this.write({values:new Map([[t,n]]),currentTime:0,playbackState:"idle",direction:"forward",loopIteration:0}),this.flush()}render(t){this.destroyed||(this.write(t.getStateAtTime(t.currentTime)),this.flush())}tick(t){const e=[...this.active];for(const[n]of e)n.duration<=0?(this.write(n.getStateAtTime(0)),n.stop()):n.tick(t);this.flush();for(const[n,s]of e)s.onUpdate?.(),n.playbackState!=="playing"&&this.active.get(n)===s&&this.active.delete(n);this.flush(),this.runTicker(t),this.running||this.stopLoop()}get running(){return this.active.size>0||this.tickerCallbacks.size>0}runTicker(t){if(this.tickerCallbacks.size!==0){this.tickerTime+=t,this.tickerFrame+=1;for(const e of[...this.tickerCallbacks])e(this.tickerTime/1e3,t,this.tickerFrame)}}write(t){for(const[e,n]of t.values){let s=this.applied.get(e);s||(s=new Map,this.applied.set(e,s));for(const[r,o]of n)s.set(r,o);this.dirty.add(e)}}flush(){if(this.dirty.size===0)return;const t=new Map;for(const e of this.dirty){const n=this.applied.get(e),s=this.objects.get(e);if(s)for(const[r,o]of n)s[r]=o;else t.set(e,n)}this.dirty.clear(),t.size!==0&&this.adapter.applyState({values:t,currentTime:0,playbackState:"playing",direction:"forward",loopIteration:0})}frame=t=>{this.frameId=null;const e=this.lastTimestamp===null?0:t-this.lastTimestamp;this.lastTimestamp=t,e>0&&this.tick(e),this.running&&this.frameId===null&&(this.frameId=this.scheduler.request(this.frame))};startLoop(){this.frameId===null&&(this.lastTimestamp=null,this.frameId=this.scheduler.request(this.frame))}stopLoop(){this.frameId!==null&&this.scheduler.cancel(this.frameId),this.frameId=null,this.lastTimestamp=null}targetsOf(t){if(typeof t=="string")return Array.from(this.selectorRoot.querySelectorAll(t));if(Fe(t))return[t];if(!Qr(t))return[t];const e=[];for(const n of Array.from(t))e.push(...this.targetsOf(n));return e}nameFor(t){return Fe(t)?this.elementName(t):this.objectName(t)}objectName(t){const e=this.objectNames.get(t);if(e)return e;let n;do this.nameCounter+=1,n=`obj-${this.nameCounter}`;while(this.objects.has(n)||this.elements.has(n));return this.objectNames.set(t,n),this.objects.set(n,t),n}elementName(t){const e=this.names.get(t);if(e)return e;let n=t.id?`#${t.id}`:"";if(!n||this.elements.has(n))do this.nameCounter+=1,n=`el-${this.nameCounter}`;while(this.elements.has(n));return this.names.set(t,n),this.elements.set(n,t),this.adapter.registerTarget(n,t),n}}function Fe(i){return typeof i=="object"&&i!==null&&i.nodeType===1}function Qr(i){if(Array.isArray(i))return!0;const t=i;return typeof t.length=="number"&&typeof t.item=="function"}function Qt(i){const t=i.style;if(!t)return i.getBoundingClientRect();const e=t.transform;t.transform="none";const n=i.getBoundingClientRect();return t.transform=e,n}const fn=i=>typeof i=="object"&&i!==null&&i.nodeType===1;function Zr(i){const t={};for(const e of Array.from(i.attributes))t[e.name]=e.value;return t}function Jr(i){const t=i.getScreenCTM?.();if(t)return[t.a,t.b,t.c,t.d,t.e,t.f];const e=i.getBoundingClientRect();return[1,0,0,1,e.left,e.top]}function to(i,t){const e=typeof i=="string"||Array.isArray(i)||fn(i)?{path:i}:i,{align:n,alignOrigin:s,path:r,...o}=e,a=S=>{const A=fn(S)?S:t.query(S);return A||t.warn(`gsap-compat: motionPath could not find "${String(S)}"`),A};let c=null,l="";if(Array.isArray(r)||typeof r=="string"&&ht(r))l=r;else{c=a(r);const S=c&&Ht({tag:c.localName,attributes:Zr(c)});c&&!S&&t.warn(`gsap-compat: motionPath element <${c.localName}> has no path geometry`),l=S??""}const h={...o,path:l};if(n===void 0||n===!1)return h;const f=n===!0?c:a(n);if(!f)return n===!0&&t.warn("gsap-compat: motionPath align: true needs the path to be an element"),h;const u=t.targets[0];if(!u)return h;const[d,m,p,y,b,w]=Jr(f),v=Qt(u),[k,T]=s??[.5,.5];for(const S of t.targets.slice(1)){const A=Qt(S);if(Math.abs(A.left-v.left)>.5||Math.abs(A.top-v.top)>.5){t.warn("gsap-compat: motionPath align measures the first target; the others are laid out elsewhere");break}}return h.matrix=[d,m,p,y,b-v.left-k*v.width,w-v.top-T*v.height],h}const dn=i=>typeof i=="object"&&i!==null&&i.nodeType===1;function pn(i){const t={};for(const e of Array.from(i.attributes))t[e.name]=e.value;return t}function mn(i){if(!i)return null;const t=Ht({tag:i.localName,attributes:pn(i)});return t||(i.querySelector("path")?.getAttribute("d")??null)}function eo(i,t,e){const n=an(i);if(typeof n=="string"&&ht(n))return n;const s=dn(n)?n:typeof n=="string"?t(n):null,r=mn(s);return r||(e(`gsap-compat: morphSVG could not find a shape for "${String(n)}"`),"")}const io=new Set(["cx","cy","r","rx","ry","x","y","width","height","x1","y1","x2","y2","points"]);function no(i,t=document){return(typeof i=="string"?Array.from(t.querySelectorAll(i)):dn(i)?[i]:Array.from(i)).map(n=>{if(n.localName==="path")return n;const s=Ht({tag:n.localName,attributes:pn(n)});if(!s||!n.parentNode)return n;const r=n.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");for(const o of Array.from(n.attributes))io.has(o.name)||r.setAttribute(o.name,o.value);return r.setAttribute("d",s),n.parentNode.replaceChild(r,n),r})}const gn=.3;class yn{options;target;running=!1;dragging=!1;passedTolerance=!1;lastX=0;lastY=0;startX=0;startY=0;velocityX=0;velocityY=0;lastTime=0;constructor(t){this.options=t,this.target=t.target}start(){if(this.running)return;this.running=!0;const t=this.options.type??["pointer","touch"];t.includes("pointer")&&(this.target.addEventListener("pointerdown",this.onPointerDown),this.target.addEventListener("pointermove",this.onPointerMove),this.target.addEventListener("pointerup",this.onPointerUp),this.target.addEventListener("pointercancel",this.onPointerUp)),t.includes("touch")&&(this.target.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.target.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.target.addEventListener("touchend",this.onTouchEnd)),t.includes("wheel")&&this.target.addEventListener("wheel",this.onWheel,{passive:!1})}stop(){this.running&&(this.running=!1,this.target.removeEventListener("pointerdown",this.onPointerDown),this.target.removeEventListener("pointermove",this.onPointerMove),this.target.removeEventListener("pointerup",this.onPointerUp),this.target.removeEventListener("pointercancel",this.onPointerUp),this.target.removeEventListener("touchstart",this.onTouchStart),this.target.removeEventListener("touchmove",this.onTouchMove),this.target.removeEventListener("touchend",this.onTouchEnd),this.target.removeEventListener("wheel",this.onWheel))}destroy(){this.stop()}get velocity(){return{x:this.velocityX,y:this.velocityY}}begin(t,e,n){this.dragging=!0,this.passedTolerance=!1,this.startX=t,this.startY=e,this.lastX=t,this.lastY=e,this.velocityX=0,this.velocityY=0,this.lastTime=bn(),this.options.onPress?.(this.stateFrom(0,0,n))}move(t,e,n){if(!this.dragging)return;const s=t-this.lastX,r=e-this.lastY;this.lastX=t,this.lastY=e;const o=t-this.startX,a=e-this.startY,c=this.options.tolerance??3;if(!this.passedTolerance){if(Math.hypot(o,a)<c)return;this.passedTolerance=!0}this.updateVelocity(s,r),this.options.preventDefault!==!1&&n.cancelable&&n.preventDefault(),this.options.onMove?.(this.stateFrom(s,r,n))}end(t){this.dragging&&(this.dragging=!1,this.options.onRelease?.(this.stateFrom(0,0,t)))}updateVelocity(t,e){const n=bn(),s=Math.max(1,n-this.lastTime);this.lastTime=n;const r=t/s*1e3,o=e/s*1e3;this.velocityX+=(r-this.velocityX)*gn,this.velocityY+=(o-this.velocityY)*gn}stateFrom(t,e,n){return{deltaX:t,deltaY:e,velocityX:this.velocityX,velocityY:this.velocityY,totalX:this.lastX-this.startX,totalY:this.lastY-this.startY,isDragging:this.dragging,event:n}}onPointerDown=t=>{const e=t,n=this.target;if(typeof e.pointerId=="number"&&typeof n.setPointerCapture=="function")try{n.setPointerCapture(e.pointerId)}catch{}this.begin(e.clientX,e.clientY,t)};onPointerMove=t=>{const e=t;this.move(e.clientX,e.clientY,t)};onPointerUp=t=>this.end(t);onTouchStart=t=>{const e=t.touches[0];e&&this.begin(e.clientX,e.clientY,t)};onTouchMove=t=>{const e=t.touches[0];e&&this.move(e.clientX,e.clientY,t)};onTouchEnd=t=>this.end(t);onWheel=t=>{const e=t;this.options.preventDefault!==!1&&e.cancelable&&e.preventDefault(),this.updateVelocity(e.deltaX,e.deltaY),this.options.onMove?.({deltaX:e.deltaX,deltaY:e.deltaY,velocityX:this.velocityX,velocityY:this.velocityY,totalX:0,totalY:0,isDragging:!1,event:t})}}function bn(){return typeof performance<"u"?performance.now():Date.now()}function vn(i,t,e){let n={delta:0,line:null},s=e;for(const r of i)for(const o of t){const a=Math.abs(o-r);a<=s&&(s=a,n={delta:o-r,line:o})}return n}function wn(i,t){return t<=0?[]:i.map(e=>Math.round(e/t)*t)}class $e{options;observer;x;y;originX=0;originY=0;snappedX=null;snappedY=null;constructor(t){this.options=t,this.x=t.initialX??0,this.y=t.initialY??0,this.observer=new yn({target:t.target,onPress:e=>{const n=t.getPosition?.();n&&(this.x=n.x,this.y=n.y),this.originX=this.x,this.originY=this.y,t.onPress?.(e)},onMove:e=>this.handleMove(e),onRelease:e=>t.onRelease?.(e)})}start(){this.observer.start()}stop(){this.observer.stop()}destroy(){this.observer.destroy()}get position(){return{x:this.x,y:this.y}}get velocity(){return this.observer.velocity}setPosition(t,e){const n=this.options.axis??"both";this.x=n==="y"?this.x:this.applyConstraints(t,"x"),this.y=n==="x"?this.y:this.applyConstraints(e,"y")}get snapLines(){return{x:this.snappedX,y:this.snappedY}}snapThreshold(){if(this.options.snapThreshold!==void 0)return this.options.snapThreshold;const t=this.options.snap??0;return t>0?t/2:8}handleMove(t){this.setPosition(this.originX+t.totalX,this.originY+t.totalY),this.options.mode==="scrub"&&this.scrub(),this.options.onDrag?.(this.position,t),this.options.onSnap?.(this.snapLines)}scrub(){const t=this.options.timeline;if(!t)return;const e=t.duration;if(e<=0)return;const n=this.options.scrubDistance??500;if(n===0)return;const s=(this.options.axis??"both")==="y"?this.y:this.x,r=so(s/n);t.pause(),t.seek(r*e)}applyConstraints(t,e){let n=t;const s=[...wn([n],this.options.snap??0),...(e==="x"?this.options.snapLinesX:this.options.snapLinesY)??[]],r=vn([n],s,this.snapThreshold());n+=r.delta,e==="x"?this.snappedX=r.line:this.snappedY=r.line;const o=this.options.bounds;if(o){const a=e==="x"?o.minX:o.minY,c=e==="x"?o.maxX:o.maxY;a!==void 0&&(n=Math.max(a,n)),c!==void 0&&(n=Math.min(c,n))}return n}}function so(i){return i<0?0:i>1?1:i}function ro(i){const t=new $e(i);return t.start(),t}const oo={x:"x",y:"y","x,y":"both"},De=i=>typeof i=="object"&&i!==null&&i.nodeType===1;function Tn(i,t){const e=Qt(i),n=t.getBoundingClientRect();return{minX:n.left-e.left,maxX:n.right-e.right,minY:n.top-e.top,maxY:n.bottom-e.bottom}}function kn(i){return Array.isArray(i)?[...i]:i}function ao(i,t,e,n={}){const[s]=t.resolveTargets(e),r=s?t.elementFor(s):void 0;if(!s||!r)throw new Error(`gsap-compat: live.draggable could not find ${String(e)}`);if(n.type==="rotation")return co(i,t,s,r,n);const o=oo[n.type??"x,y"],a=()=>{const p=t.appliedValue(s,"x"),y=t.appliedValue(s,"y");return{x:typeof p=="number"?p:0,y:typeof y=="number"?y:0}},c=typeof n.bounds=="string"?t.query(n.bounds):De(n.bounds)?n.bounds:null,h={bounds:(!c&&n.bounds&&!De(n.bounds)?n.bounds:void 0)??(c?Tn(r,c):void 0)};let f=null;const u=()=>{f?.kill(),f=null},d=p=>{const y=n.inertia===!0?{}:n.inertia,b=y.friction??(y.resistance!==void 0?Re(y.resistance):4),w=a(),v=h.bounds??{};let k,T;const S=y.end;if(Array.isArray(S)){const I=kt({from:w.x,velocity:o==="y"?0:p.x,friction:b}),O=kt({from:w.y,velocity:o==="x"?0:p.y,friction:b});let x=S[0];for(const M of S)Math.hypot(M.x-I,M.y-O)<Math.hypot(x.x-I,x.y-O)&&(x=M);x&&(k=[x.x],T=[x.y])}else typeof S=="number"?(k=S,T=S):S&&(k=kn(S.x),T=kn(S.y));const A={};o!=="y"&&(A.x={velocity:p.x,friction:b,min:v.minX,max:v.maxX,end:k}),o!=="x"&&(A.y={velocity:p.y,friction:b,min:v.minY,max:v.maxY,end:T}),f=i.to(r,{inertia:A,onComplete:()=>n.onThrowComplete?.()})},m=new $e({target:r,axis:o,snap:n.snap,get bounds(){return h.bounds},getPosition:a,onPress:()=>{u(),c&&(h.bounds=Tn(r,c)),n.onPress?.()},onDrag:p=>{t.apply(s,o==="x"?{x:p.x}:o==="y"?{y:p.y}:{x:p.x,y:p.y}),n.onDrag?.(p)},onRelease:()=>{const p=m.velocity;n.onRelease?.(p),n.inertia&&d(p)}});return m.start(),{draggable:m,get position(){return a()},get rotation(){const p=t.appliedValue(s,"rotate");return typeof p=="number"?p:0},destroy(){u(),m.destroy()}}}function co(i,t,e,n,s){const r=typeof s.bounds=="object"&&s.bounds!==null&&!De(s.bounds)?s.bounds:{},o=()=>{const v=t.appliedValue(e,"rotate");return typeof v=="number"?v:0},a=v=>Math.min(r.maxRotation??1/0,Math.max(r.minRotation??-1/0,v));let c=null,l=!1,h,f={x:0,y:0},u=0,d=0,m=[];const p=v=>Math.atan2(v.clientY-f.y,v.clientX-f.x)*180/Math.PI,y=v=>{if(l)return;c?.kill(),c=null,l=!0,h=v.pointerId,n.setPointerCapture?.(v.pointerId);const k=n.getBoundingClientRect();f={x:k.left+k.width/2,y:k.top+k.height/2},u=p(v),d=o(),m=[{time:performance.now(),rotation:d}],s.onPress?.()},b=v=>{if(!l||v.pointerId!==h)return;const k=p(v);let T=k-u;T>180&&(T-=360),T<-180&&(T+=360),u=k,d+=T;let S=a(d);s.snap&&(S=a(Math.round(S/s.snap)*s.snap)),t.apply(e,{rotate:S});const A=performance.now();for(m.push({time:A,rotation:S});m.length>2&&A-m[0].time>100;)m.shift();const I={x:0,y:0};s.onDrag?.(I)},w=v=>{if(!l||v.pointerId!==h)return;l=!1;const k=m[0],T=m[m.length-1],S=k&&T?(T.time-k.time)/1e3:0,A=S>0?(T.rotation-k.rotation)/S:0;if(s.onRelease?.({x:A,y:0}),!s.inertia)return;const I=s.inertia===!0?{}:s.inertia,O=I.friction??(I.resistance!==void 0?Re(I.resistance):4),x=typeof I.end=="number"||Array.isArray(I.end)?I.end:void 0;c=i.to(n,{inertia:{rotate:{velocity:A,friction:O,min:r.minRotation,max:r.maxRotation,end:Array.isArray(x)?x.filter(M=>typeof M=="number"):x}},onComplete:()=>s.onThrowComplete?.()})};return n.addEventListener("pointerdown",y),n.addEventListener("pointermove",b),n.addEventListener("pointerup",w),n.addEventListener("pointercancel",w),n.style.touchAction="none",{draggable:void 0,position:{x:0,y:0},get rotation(){return o()},destroy(){c?.kill(),n.removeEventListener("pointerdown",y),n.removeEventListener("pointermove",b),n.removeEventListener("pointerup",w),n.removeEventListener("pointercancel",w)}}}const lo={opacity:0,scale:.6};function ho(i){const t=i.getBoundingClientRect();return t.width===0&&t.height===0?null:{cx:t.left+t.width/2,cy:t.top+t.height/2,width:t.width,height:t.height}}function Sn(i){const t=Qt(i);return t.width===0&&t.height===0?null:{cx:t.left+t.width/2,cy:t.top+t.height/2,width:t.width,height:t.height}}function Be(i,t){const n=i.resolveTargets(t).map(o=>i.elementFor(o)).filter(o=>!!o),s=new Map,r=new Map;for(const o of n){const a=ho(o);s.set(o,a);const c=Mn(o);a&&c!==void 0&&!r.has(c)&&r.set(c,{element:o,box:a})}return{elements:n,boxes:s,ids:r}}const Oe=new WeakMap;function Ne(i,t,e,n={}){const s=n.duration??.6,r=n.ease??"power2.inOut",o=n.stagger??0,a=n.scale!==!1,c=n.enter===void 0?lo:n.enter,l=new Set(e.elements);if(n.targets!==void 0)for(const d of i.resolveTargets(n.targets)){const m=i.elementFor(d);m&&l.add(m)}const h=[...l].sort((d,m)=>d===m?0:d.compareDocumentPosition(m)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),f=t({onComplete:n.onComplete});let u=0;for(const d of h){const m=Sn(d);if(!m)continue;let p=e.boxes.get(d)??null,y;const b=Mn(d),w=!p&&b!==void 0?e.ids.get(b):void 0;w&&w.element!==d&&(p=w.box,y=w.element);const[v]=i.resolveTargets(d);Oe.get(d)?.timeline.removeTracks({target:v});const k=u*o;if(!p){if(c===!1)continue;f.fromTo(d,{x:0,y:0,scaleX:1,scaleY:1,...c},{...An(c),x:0,y:0,scaleX:1,scaleY:1,duration:s,ease:r,delay:k},0),Oe.set(d,f),u++;continue}const T=p.cx-m.cx,S=p.cy-m.cy,A=a?p.width/m.width:1,I=a?p.height/m.height:1;if(!(Math.abs(T)>.5||Math.abs(S)>.5||Math.abs(A-1)>.001||Math.abs(I-1)>.001)){const M=(C,P)=>{const _=i.appliedValue(v,C);return typeof _=="number"&&Math.abs(_-P)>1e-6};(M("x",0)||M("y",0)||M("scaleX",1)||M("scaleY",1))&&f.set(d,{x:0,y:0,scaleX:1,scaleY:1},0);continue}const x=n.fade===!0&&y!==void 0;f.fromTo(d,{x:T,y:S,scaleX:A,scaleY:I,...x&&{opacity:0}},{x:0,y:0,scaleX:1,scaleY:1,...x&&{opacity:1},duration:s,ease:r,delay:k},0),x&&y&&Sn(y)&&f.fromTo(y,{opacity:1},{opacity:0,duration:s,ease:r,delay:k},0),Oe.set(d,f),u++}return f}function Mn(i){return i.dataset?.flipId}function An(i){const t={};for(const e of Object.keys(i))t[e]=e==="opacity"||e.startsWith("scale")?1:0;return t}function uo(i,t={}){const e=new Set((t.type??"chars,words,lines").split(",").map(p=>p.trim())),n={chars:t.charsClass??"char",words:t.wordsClass??"word",lines:t.linesClass??"line"},s=t.aria!==!1,r=i.map(p=>({element:p,html:p.innerHTML,ariaLabel:p.getAttribute("aria-label")}));let o={chars:[],words:[],lines:[],masks:[]},a,c,l=!1;const h=()=>{for(const{element:p,html:y,ariaLabel:b}of r)p.innerHTML=y,b===null?p.removeAttribute("aria-label"):p.setAttribute("aria-label",b)},f=()=>{a&&(a.revert?a.revert():a.kill?.(),a=void 0)},u=()=>{const p={chars:[],words:[],lines:[],masks:[]};for(const{element:y}of r){const b=(y.textContent??"").replace(/\s+/g," ").trim(),w=fo(y,n.words),v=e.has("chars")?w.flatMap(S=>po(S,n.chars)):[],k=e.has("lines")?go(y,w,n.lines):[];if(s){!y.hasAttribute("aria-label")&&b&&y.setAttribute("aria-label",b);for(const S of w)S.setAttribute("aria-hidden","true")}if(e.has("words"))p.words.push(...w);else for(const S of w)S.removeAttribute("class");p.chars.push(...v),p.lines.push(...k);const T=t.mask==="lines"?k:t.mask==="words"?w:t.mask==="chars"?v:[];for(const S of T)p.masks.push(yo(S,`${n[t.mask]}-mask`))}o=p},d={elements:i,get chars(){return o.chars},get words(){return o.words},get lines(){return o.lines},get masks(){return o.masks},split(){l||(f(),h(),u(),a=t.onSplit?.(d))},revert(){l=!0,c?.disconnect(),f(),h()}};u(),a=t.onSplit?.(d),t.autoSplit&&m();function m(){const p=new Map;let y=!1;const b=()=>{if(y)return;y=!0;const v=()=>{y=!1,d.split()};typeof requestAnimationFrame=="function"?requestAnimationFrame(v):setTimeout(v,0)};if(typeof ResizeObserver=="function"){c=new ResizeObserver(v=>{let k=!1;for(const T of v){const S=Math.round(T.contentRect.width),A=p.get(T.target);p.set(T.target,S),A!==void 0&&A!==S&&(k=!0)}k&&b()});for(const v of i)c.observe(v)}const w=i[0]?.ownerDocument?.fonts;w&&w.status!=="loaded"&&w.ready.then(()=>b())}return d}function fo(i,t){const e=i.ownerDocument,n=[],s=e.createTreeWalker(i,4),r=[];for(let o=s.nextNode();o;o=s.nextNode())r.push(o);for(const o of r){const a=o.data.match(/\s+|\S+/g)??[];if(a.length===0)continue;const c=e.createDocumentFragment();for(const l of a){if(/^\s/.test(l)){c.appendChild(e.createTextNode(l));continue}const h=e.createElement("span");h.className=t,h.style.display="inline-block",h.textContent=l,c.appendChild(h),n.push(h)}o.replaceWith(c)}return n}function po(i,t){const e=i.ownerDocument,n=mo(i.textContent??"").map(s=>{const r=e.createElement("span");return r.className=t,r.style.display="inline-block",r.textContent=s,r});return i.replaceChildren(...n),n}function mo(i){const t=Intl.Segmenter;return t?Array.from(new t(void 0,{granularity:"grapheme"}).segment(i),e=>e.segment):Array.from(i)}function go(i,t,e){const n=i.ownerDocument,s=new Map(t.map(m=>[m,m.getBoundingClientRect()])),r=[],o=m=>{for(const p of Array.from(m.childNodes))p.nodeType===3||s.has(p)||p.tagName==="BR"?r.push(p):o(p)};o(i);const a=[];let c=null,l=0,h=0,f=!1,u=[];const d=()=>{c=n.createElement("span"),c.className=e,c.style.display="block",a.push(c),u=[]};for(const m of r){if(m.tagName==="BR"){f=!0;continue}const p=s.get(m);if(p&&(!c||f||p.top>l+h)&&(d(),l=p.top,h=p.height/2,f=!1),!c)continue;const y=[];for(let v=m.parentNode;v&&v!==i;v=v.parentNode)y.unshift(v);let b=0;for(;b<u.length&&b<y.length&&u[b].original===y[b];)b++;u.length=b;let w=b===0?c:u[b-1].clone;for(const v of y.slice(b)){const k=v.cloneNode(!1);w.appendChild(k),u.push({original:v,clone:k}),w=k}w.appendChild(m)}return i.replaceChildren(...a),a}function yo(i,t){const e=i.ownerDocument.createElement("span");return e.className=t,e.style.display=i.style.display==="block"?"block":"inline-block",e.style.overflow="clip",e.style.paddingBottom="0.12em",e.style.marginBottom="-0.12em",i.replaceWith(e),e.appendChild(i),e}const En={top:0,left:0,start:0,center:.5,centre:.5,middle:.5,bottom:1,right:1,end:1};function qe(i){const t=i.trim().toLowerCase();if(t in En)return En[t];if(t.endsWith("%")){const e=Number.parseFloat(t.slice(0,-1));return Number.isNaN(e)?void 0:e/100}}function Ye(i){if(typeof i=="number")return{elementFraction:0,viewportFraction:0,offsetPx:0,absolutePx:i};let t=0;const n=i.replace(/([+-])=\s*(-?[\d.]+)/g,(o,a,c)=>(t+=(a==="-"?-1:1)*Number.parseFloat(c),"")).trim().split(/\s+/).filter(Boolean);if(n.length===1&&/^-?[\d.]+$/.test(n[0]))return{elementFraction:0,viewportFraction:0,offsetPx:0,absolutePx:Number.parseFloat(n[0])+t};const s=n[0]!==void 0?qe(n[0]):void 0,r=n[1]!==void 0?qe(n[1]):void 0;return{elementFraction:s??0,viewportFraction:r??0,offsetPx:t}}function dt(i,t,e){const n=Ye(e),s=n.absolutePx!==void 0?i.top+n.absolutePx:i.top+i.height*n.elementFraction,r=t*n.viewportFraction;return s-r+n.offsetPx}function bo(i,t,e,n){const s=dt(i,t,e),o=dt(i,t,n)-s;return o<=0?s<=0?1:0:Xe(-s/o)}function Xe(i){return i<0?0:i>1?1:i===0?0:i}function xn(i,t,e,n){if(e<=0)return t;const s=1-Math.exp(-(n/1e3)/e);return i+(t-i)*s}function Ve(i,t,e,n,s){const r=h=>dt({top:i+s(h),bottom:i+s(h)+t,height:t},e,n),o=r(0),a=r(1);if(Math.sign(o)===Math.sign(a)||o===0||a===0)return o===0?0:a===0?1:Math.abs(o)<Math.abs(a)?0:1;let c=0,l=1;for(let h=0;h<40;h++){const f=(c+l)/2;Math.sign(r(f))===Math.sign(o)?c=f:l=f}return(c+l)/2}class Pn{timeline;trigger;behaviour;options;observer=null;hasPlayed=!1;running=!1;constructor(t){this.timeline=t.timeline,this.trigger=t.trigger,this.behaviour=t.behaviour??"once",this.options=t}start(){if(!this.running){if(this.running=!0,typeof IntersectionObserver>"u"){this.enter();return}this.observer=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?this.enter():this.leave()},{threshold:this.options.threshold??.15,rootMargin:this.options.rootMargin,root:this.options.root??null}),this.observer.observe(this.trigger)}}stop(){this.running=!1,this.observer?.disconnect(),this.observer=null}destroy(){this.stop()}reset(){this.hasPlayed=!1,this.timeline.stop()}enter(){this.options.onEnter?.(),!(this.behaviour==="once"&&this.hasPlayed)&&(this.hasPlayed=!0,this.behaviour!=="once"&&this.timeline.seek(0),this.timeline.play())}leave(){this.options.onLeave?.(),this.behaviour==="reset"&&this.timeline.stop()}}function vo(i){const t=new Pn(i);return t.start(),t}class Cn{element;spacer;saved;axis;spacing;constructor(t,e={}){this.element=t,this.axis=e.axis??"y",this.spacing=e.spacing??!0;const n=t.ownerDocument;this.spacer=n.createElement("div"),this.spacer.className="pin-spacer",this.saved={position:t.style.position,top:t.style.top,left:t.style.left},this.axis==="x"&&(this.spacer.style.flexShrink="0"),t.replaceWith(this.spacer),this.spacer.appendChild(t)}release(){this.element.style.position=this.saved.position,this.element.style.top=this.saved.top,this.element.style.left=this.saved.left}apply(t,e){const n=Math.max(0,e);this.element.style.position="sticky",this.axis==="x"?(this.spacer.style.width=`${this.element.offsetWidth+n}px`,this.spacer.style.marginRight=this.spacing?"":`-${n}px`,this.element.style.left=`${t}px`):(this.spacer.style.height=`${this.element.offsetHeight+n}px`,this.spacer.style.marginBottom=this.spacing?"":`-${n}px`,this.element.style.top=`${t}px`)}destroy(){this.element.style.position=this.saved.position,this.element.style.top=this.saved.top,this.element.style.left=this.saved.left,this.spacer.parentNode&&this.spacer.replaceWith(this.element)}}const wo=.15;function _n(i){return typeof i=="object"&&!Array.isArray(i)?i:{snapTo:i}}function In(i,t,e){const n=Zt(i+t*wo);if(typeof e=="function")return Zt(e(n));if(typeof e=="number")return e<=0?i:Zt(Math.round(n/e)*e);if(e.length===0)return i;let s=e[0];for(const r of e)Math.abs(r-n)<Math.abs(s-n)&&(s=r);return Zt(s)}function Rn(i,t,e){const n=i.duration??{min:.2,max:.8};if(typeof n=="number")return n;const s=Math.min(1,Math.abs(t)/Math.max(1,e));return n.min+(n.max-n.min)*s}class Ln{rafId=null;cancelEvents=["wheel","touchstart","pointerdown","keydown"];onInterrupt=()=>this.cancel();write;eventTarget;constructor(t,e){this.write=t,this.eventTarget=e}get active(){return this.rafId!==null}animate(t,e,n,s=St,r){if(this.cancel(),typeof requestAnimationFrame>"u"||n<=0){this.write(e),r?.();return}for(const c of this.cancelEvents)this.eventTarget?.addEventListener(c,this.onInterrupt,{passive:!0});let o=null;const a=c=>{o??=c;const l=Math.min(1,(c-o)/(n*1e3));this.write(t+(e-t)*s(l)),l<1?this.rafId=requestAnimationFrame(a):(this.rafId=null,this.detach(),r?.())};this.rafId=requestAnimationFrame(a)}cancel(){this.rafId!==null&&typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(this.rafId),this.rafId=null,this.detach()}detach(){for(const t of this.cancelEvents)this.eventTarget?.removeEventListener(t,this.onInterrupt)}}function Zt(i){return Math.max(0,Math.min(1,i))}class Fn{options;scroller;nodes=[];scrollerStart;scrollerEnd;start;end;constructor(t,e,n){this.options=n===!0?{}:n,this.scroller=e;const{startColor:s="#3ecf7a",endColor:r="#ff5a5a",id:o}=this.options,a=o?`${o} `:"",c=(l,h,f)=>{const u=t.createElement("div");return u.textContent=`${a}${l}`,u.setAttribute("aria-hidden","true"),u.className="scroll-marker",Object.assign(u.style,{position:f?"fixed":"absolute",right:`${this.options.indent??0}px`,zIndex:"2147483646",pointerEvents:"none",borderTop:`1px solid ${h}`,color:h,font:`${this.options.fontSize??"11px"} ui-monospace, monospace`,padding:"2px 6px",whiteSpace:"nowrap",background:"rgba(0, 0, 0, 0.35)"}),(e??t.body).appendChild(u),this.nodes.push(u),u};this.scrollerStart=c("scroller-start",s,!e),this.scrollerEnd=c("scroller-end",r,!e),this.start=c("start",s,!1),this.end=c("end",r,!1),e&&getComputedStyle(e).position==="static"&&(e.style.position="relative")}place(t,e){this.start.style.top=`${t.startPage}px`,this.end.style.top=`${t.endPage}px`;const n=this.scroller?e:0;this.scrollerStart.style.top=`${n+t.startViewport}px`,this.scrollerEnd.style.top=`${n+t.endViewport}px`}follow(t,e){this.scroller&&this.place(t,e)}destroy(){for(const t of this.nodes.splice(0))t.remove()}}const To=120,pt=[],mt=new Set;let We=!1;const ko=()=>{We||mt.size===0||(We=!0,queueMicrotask(()=>{We=!1;for(const i of mt)i.afterRefresh()}))},$n=()=>{for(const i of mt)i.beforeRefresh();for(const i of pt)i.refresh();for(const i of mt)i.afterRefresh()};let gt={width:0,height:0};const Dn=()=>{const i=window.innerWidth,t=window.innerHeight,e=i===gt.width&&t!==gt.height,n=Math.abs(t-gt.height)<gt.height*.25,s=typeof navigator<"u"&&(navigator.maxTouchPoints??0)>0;e&&n&&s||(gt={width:i,height:t},$n())};class It{timeline;options;running=!1;pin=null;startPx=0;endPx=0;targetProgress=0;displayProgress=0;zone="before";measured=!1;lastScroll=null;lastScrollTime=0;velocityPxPerSecond=0;idleTimer=null;lastEmitted=null;rafId=null;lastFrameTime=null;onScroll=()=>this.update();releaseVelocity=0;snapper;snapTimer=null;markers=null;markerGeometry=null;constructor(t){this.timeline=t.timeline,this.options=t,this.snapper=new Ln(e=>this.scrollTo(e),typeof window<"u"?window:null)}start(){if(this.running)return;this.running=!0,this.timeline?.pause();const t=this.options.pin===!0?this.options.trigger:this.options.pin||null;t&&!this.options.container&&(this.pin=new Cn(t,{axis:this.options.horizontal?"x":"y",spacing:this.options.pinSpacing!==!1})),this.options.markers&&!this.options.horizontal&&typeof document<"u"&&(this.markers=new Fn(document,this.options.scroller??null,this.options.markers)),this.scrollTarget()?.addEventListener("scroll",this.onScroll,{passive:!0}),pt.length===0&&typeof window<"u"&&(gt={width:window.innerWidth,height:window.innerHeight},window.addEventListener("resize",Dn,{passive:!0})),pt.push(this),this.refresh()}stop(){this.running&&(this.running=!1,this.scrollTarget()?.removeEventListener("scroll",this.onScroll),pt.splice(pt.indexOf(this),1),pt.length===0&&typeof window<"u"&&window.removeEventListener("resize",Dn),this.stopSmoothing(),this.idleTimer!==null&&clearTimeout(this.idleTimer),this.idleTimer=null,this.snapTimer!==null&&clearTimeout(this.snapTimer),this.snapTimer=null,this.snapper.cancel())}destroy(){this.stop(),this.pin?.destroy(),this.pin=null,this.markers?.destroy(),this.markers=null}get startOffset(){return this.startPx}get endOffset(){return this.endPx}static refreshAll(){$n()}static onRefresh(t){return mt.add(t),()=>mt.delete(t)}get progress(){return this.targetProgress}get velocity(){return this.velocityPxPerSecond}refresh(){if(!this.running)return;this.measured&&this.options.onRefresh?.();const t=this.scrollPosition();this.pin?.release();const e=this.triggerRect();if(e&&this.options.container)this.measureInContainer(this.options.container);else if(e){const n=this.viewportHeight();if(this.startPx=t+dt(e,n,Rt(this.options.start)??"top bottom"),this.endPx=this.resolveEnd(e,n,t),this.pin){const s=this.relativeRect(this.pin.element.getBoundingClientRect());this.pin.apply(s.top-(this.startPx-t),this.endPx-this.startPx)}this.markerGeometry=this.markers?this.markersFor(n):null}this.markers&&this.markerGeometry&&this.markers.place(this.markerGeometry,t),this.lastScroll=null,this.updateFrom(t,!this.measured),this.measured=!0,ko()}sample(){this.refresh()}update(t){this.running&&this.updateFrom(t??this.scrollPosition(),!1)}updateFrom(t,e){this.trackVelocity(t),this.markers&&this.markerGeometry&&this.markers.follow(this.markerGeometry,t);const n=this.endPx-this.startPx,s=this.zone;this.targetProgress=n>0?Xe((t-this.startPx)/n):t>=this.startPx?1:0,this.zone=n>0?t<=this.startPx?"before":t>=this.endPx?"after":"active":t>=this.startPx?"after":"before",this.fireBoundaryCallbacks(s,this.zone),e||this.smoothing()<=0?(this.displayProgress=this.targetProgress,this.applyProgress()):(this.emitUpdate(),this.startSmoothing())}smoothing(){const t=this.options.scrub;return typeof t=="number"?Math.max(0,t):0}resolveEnd(t,e,n){const s=Rt(this.options.end)??"bottom top",r=typeof s=="string"?s.trim().match(/^\+=\s*(-?[\d.]+)\s*(%|px)?$/):null;if(r){const o=Number.parseFloat(r[1]);return this.startPx+(r[2]==="%"?e*o/100:o)}return n+dt(t,e,s)}applyProgress(){const t=this.timeline?.duration??0;this.timeline&&t>0&&this.timeline.seek(this.displayProgress*t),this.emitUpdate()}emitUpdate(){if(!this.options.onUpdate)return;const t=[this.displayProgress,this.velocityPxPerSecond];this.lastEmitted&&this.lastEmitted[0]===t[0]&&this.lastEmitted[1]===t[1]||(this.lastEmitted=t,this.options.onUpdate(t[0],t[1]))}trackVelocity(t){const e=typeof performance<"u"?performance.now():Date.now();this.lastScroll!==null&&e>this.lastScrollTime&&t!==this.lastScroll&&(this.velocityPxPerSecond=(t-this.lastScroll)/(e-this.lastScrollTime)*1e3),(this.lastScroll===null||t!==this.lastScroll)&&(this.lastScroll=t,this.lastScrollTime=e),!(this.velocityPxPerSecond===0||typeof setTimeout>"u")&&(this.idleTimer!==null&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this.idleTimer=null,this.releaseVelocity=this.velocityPxPerSecond,this.velocityPxPerSecond=0,this.emitUpdate(),this.scheduleSnap()},To))}fireBoundaryCallbacks(t,e){if(t===e)return;const{onEnter:n,onLeave:s,onEnterBack:r,onLeaveBack:o}=this.options;t==="before"?(n?.(),e==="after"&&s?.()):t==="after"?(r?.(),e==="before"&&o?.()):e==="after"?s?.():o?.()}scheduleSnap(){const t=this.options.snap;if(t===void 0||this.snapper.active)return;const e=_n(t),n=()=>{this.snapTimer=null;const s=this.endPx-this.startPx,r=this.scrollPosition();if(!this.running||s<=0||r<=this.startPx||r>=this.endPx)return;const o=(r-this.startPx)/s,a=this.startPx+In(o,this.releaseVelocity/s,e.snapTo)*s;Math.abs(a-r)<1||this.snapper.animate(r,a,Rn(e,a-r,this.viewportHeight()),e.ease)};e.delay?this.snapTimer=setTimeout(n,e.delay*1e3):n()}scrollTo(t){const e=this.options.scroller,n=this.options.horizontal?{left:t}:{top:t};e?typeof e.scrollTo=="function"?e.scrollTo({...n,behavior:"instant"}):this.options.horizontal?e.scrollLeft=t:e.scrollTop=t:typeof window<"u"&&window.scrollTo({...n,behavior:"instant"})}measureInContainer(t){const e=this.options.trigger;if(typeof e?.getBoundingClientRect!="function")return;const n=e.getBoundingClientRect(),s=this.options.scroller?.getBoundingClientRect?.().left??0,r=this.options.scroller?this.options.scroller.clientWidth:typeof window<"u"?window.innerWidth:0,o=n.left-s-t.shiftAt(t.progress()),{start:a,end:c}=t.range(),l=d=>a+d*(c-a),h=Ve(o,n.width,r,Rt(this.options.start)??"left right",t.shiftAt);this.startPx=l(h);const f=Rt(this.options.end)??"right left",u=typeof f=="string"?f.trim().match(/^\+=\s*(-?[\d.]+)\s*(px)?$/):null;this.endPx=u?this.startPx+Number.parseFloat(u[1]):l(Ve(o,n.width,r,f,t.shiftAt)),this.markerGeometry=null}markersFor(t){const e=(r,o)=>{const a=Rt(r)??o;if(typeof a=="number")return 0;if(/^\s*\+=/.test(a))return;const c=Ye(a);return t*c.viewportFraction-c.offsetPx},n=e(this.options.start,"top bottom")??0,s=e(this.options.end,"bottom top")??n;return{startViewport:n,endViewport:s,startPage:this.startPx+n,endPage:this.endPx+s}}startSmoothing(){if(this.rafId!==null||typeof requestAnimationFrame>"u")return;const t=e=>{if(this.rafId=null,!this.running)return;const n=this.lastFrameTime===null?16.67:e-this.lastFrameTime;this.lastFrameTime=e,this.displayProgress=xn(this.displayProgress,this.targetProgress,this.smoothing(),n);const s=Math.abs(this.targetProgress-this.displayProgress)<1e-4;s&&(this.displayProgress=this.targetProgress),this.applyProgress(),s?this.lastFrameTime=null:this.rafId=requestAnimationFrame(t)};this.rafId=requestAnimationFrame(t)}stopSmoothing(){this.rafId!==null&&typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(this.rafId),this.rafId=null,this.lastFrameTime=null}scrollTarget(){return this.options.scroller??(typeof window<"u"?window:null)}scrollPosition(){const t=this.options.scroller,e=this.options.horizontal;return t?(e?t.scrollLeft:t.scrollTop)??0:typeof window<"u"?(e?window.scrollX:window.scrollY)??0:0}triggerRect(){const t=this.options.trigger;return typeof t?.getBoundingClientRect!="function"?null:this.relativeRect(t.getBoundingClientRect())}relativeRect(t){const e=this.options.horizontal,n=e?t.left??0:t.top,s=e?t.right??0:t.bottom,r=e?t.width??0:t.height,o=this.options.scroller;if(o&&typeof o.getBoundingClientRect=="function"){const a=o.getBoundingClientRect(),c=e?a.left:a.top;return{top:n-c,bottom:s-c,height:r}}return{top:n,bottom:s,height:r}}viewportHeight(){const t=this.options.scroller,e=this.options.horizontal;return t?e?t.clientWidth:t.clientHeight:typeof window<"u"?e?window.innerWidth:window.innerHeight:0}}function Rt(i){return typeof i=="function"?i():i}function So(i){const t=new It(i);return t.start(),t}const Ue=new Set,Mo=16,Bn=.5,Ao=2;class je{options;frames;running=!1;reduced=!1;current=0;target=0;written=null;velocityPxPerSecond=0;frameId=null;lastTime=null;journey=null;pausedState=!1;effects=[];onWheel=t=>this.wheel(t);onScroll=()=>this.nativeScroll();onResize=()=>this.refresh();onLoad=()=>this.refresh();stopListening=null;constructor(t={}){this.options=t,this.frames=t.frames??{request:e=>requestAnimationFrame(e),cancel:e=>cancelAnimationFrame(e)}}start(){if(this.running||typeof window>"u")return this;this.running=!0,this.reduced=this.options.reducedMotion??(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches),this.current=this.target=this.position();const t=this.options.scroller??window;return t.addEventListener("wheel",this.onWheel,{passive:!1}),t.addEventListener("scroll",this.onScroll,{passive:!0}),window.addEventListener("resize",this.onResize,{passive:!0}),window.addEventListener("load",this.onLoad),Ue.add(this),this.stopListening=It.onRefresh({beforeRefresh:()=>this.rest(),afterRefresh:()=>this.refresh()}),this.refresh(),this}static refreshAll(){for(const t of Ue)t.refresh()}stop(){if(!this.running)return this;this.running=!1;const t=this.options.scroller??window;return t.removeEventListener("wheel",this.onWheel),t.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onResize),window.removeEventListener("load",this.onLoad),Ue.delete(this),this.stopListening?.(),this.stopListening=null,this.cancelFrame(),this.journey=null,this}destroy(){this.stop();for(const t of this.effects)He(t.element,t.saved);this.effects=[]}kill(){this.destroy()}get state(){const t=this.limit();return{scroll:this.current,target:this.target,progress:t>0?this.current/t:0,velocity:this.velocityPxPerSecond}}paused(t){return t!==void 0&&(this.pausedState=t,t&&(this.target=this.current,this.journey=null)),this.pausedState}scrollTo(t,e={}){if(!this.running)return;const n=this.clamp(this.resolve(t)+(e.offset??0)),s=Math.abs(n-this.current),r=this.reduced?0:e.duration??Math.min(1.2,Math.max(.4,s/2500));if(r<=0){this.journey=null,this.current=this.target=n,this.write(n),this.applyEffects(0);return}this.target=n,this.journey={from:this.current,to:n,ms:r*1e3,ease:e.ease??St,elapsed:0},this.requestFrame()}refresh(){if(!this.running)return;this.rest(),this.effects=[];const t=this.options.effects===!0?"[data-speed], [data-lag]":this.options.effects||"";if(t&&!this.reduced){const e=this.options.scroller??document,n=this.position(),s=this.viewportHeight(),r=this.options.scroller?.getBoundingClientRect().top??0;for(const o of e.querySelectorAll(t)){const a=Number.parseFloat(o.dataset.speed??""),c=Number.parseFloat(o.dataset.lag??""),l=o.getBoundingClientRect(),h=l.top-r+n;this.effects.push({element:o,speed:Number.isFinite(a)?a:void 0,lag:Number.isFinite(c)&&c>0?c:void 0,centre:h+l.height/2-s/2,lagged:n,shift:0,saved:o.style.getPropertyValue("translate")})}}this.current=this.target=this.clamp(this.position()),this.applyEffects(0)}rest(){for(const t of this.effects)He(t.element,t.saved)}wheel(t){if(this.pausedState||this.reduced||(this.options.smooth??.8)<=0||t.ctrlKey||Math.abs(t.deltaX)>Math.abs(t.deltaY)||this.nestedScrollerTakes(t))return;const e=t.deltaMode===1?Mo:t.deltaMode===2?this.viewportHeight():1,n=t.deltaY*e*(this.options.wheelMultiplier??1),s=this.clamp(this.target+n);s===this.target&&s===this.current||(t.preventDefault(),this.journey=null,this.target=s,this.requestFrame())}nativeScroll(){const t=this.position();this.written!==null&&Math.abs(t-this.written)<=Ao||(this.written=null,this.journey=null,this.cancelFrame(),this.current=this.target=t,this.requestFrame())}nestedScrollerTakes(t){const e=this.options.scroller??document.documentElement;for(let n=t.target;n&&n!==e&&n!==document.body;n=n.parentElement){if(n.hasAttribute?.("data-smooth-ignore"))return!0;const s=getComputedStyle(n);if(!/(auto|scroll)/.test(s.overflowY)||n.scrollHeight<=n.clientHeight)continue;if(t.deltaY<0?n.scrollTop>0:n.scrollTop+n.clientHeight<n.scrollHeight-1)return!0}return!1}requestFrame(){this.frameId!==null||!this.running||(this.frameId=this.frames.request(t=>this.frame(t)))}cancelFrame(){this.frameId!==null&&this.frames.cancel(this.frameId),this.frameId=null,this.lastTime=null}frame(t){this.frameId=null;const e=this.lastTime===null?1e3/60:Math.min(100,t-this.lastTime);this.lastTime=t;const n=this.current;if(this.journey){const r=this.journey;r.elapsed+=e;const o=Math.min(1,r.elapsed/r.ms);this.current=r.from+(r.to-r.from)*r.ease(o),o>=1&&(this.journey=null)}else if(this.current!==this.target){const r=(this.options.smooth??.8)*1e3/3;this.current+=(this.target-this.current)*(1-Math.exp(-e/r)),Math.abs(this.target-this.current)<Bn&&(this.current=this.target)}this.current!==n&&this.write(this.current),this.velocityPxPerSecond=e>0?(this.current-n)*1e3/e:0;const s=this.applyEffects(e);this.current!==n&&this.options.onUpdate?.(this.state),this.journey||this.current!==this.target||s?this.requestFrame():(this.lastTime=null,this.velocityPxPerSecond=0)}applyEffects(t){let e=!1;const n=this.current;for(const s of this.effects){let r=0;if(s.speed!==void 0&&(r+=(n-s.centre)*(1-s.speed)),s.lag!==void 0){const o=s.lag*1e3/3;s.lagged=t===0?n:s.lagged+(n-s.lagged)*(1-Math.exp(-t/o)),Math.abs(n-s.lagged)<Bn?s.lagged=n:e=!0,r+=n-s.lagged}He(s.element,r===0?s.saved:`0 ${Eo(r)}px`),s.shift=r}return e}write(t){const e=Math.round(t);this.written=e;const n=this.options.scroller;n?n.scrollTop=e:window.scrollTo({top:e,behavior:"instant"})}position(){const t=this.options.scroller;return t?t.scrollTop:window.scrollY}viewportHeight(){const t=this.options.scroller;return t?t.clientHeight:window.innerHeight}limit(){const t=this.options.scroller??document.documentElement;return Math.max(0,t.scrollHeight-this.viewportHeight())}clamp(t){return Math.max(0,Math.min(this.limit(),t))}resolve(t){if(typeof t=="number")return t;const e=this.options.scroller??document,n=typeof t=="string"?e.querySelector(t):t;if(!n)return this.current;const s=this.options.scroller?.getBoundingClientRect().top??0,r=this.effects.find(o=>o.element===n)?.shift??0;return n.getBoundingClientRect().top-s+this.position()-r}}function He(i,t){t?i.style.setProperty("translate",t):i.style.removeProperty("translate")}function Eo(i){return Math.round(i*100)/100}function xo(i,t){switch(t){case"play":if(i.progress()>=1)break;i.reversed()?i.reverse():i.play();break;case"reverse":if(i.progress()<=0)break;i.reversed()?i.play():i.reverse();break;case"pause":i.pause();break;case"resume":i.resume();break;case"restart":i.restart();break;case"reset":i.pause(),i.progress(0);break;case"complete":i.pause(),i.progress(1);break}}function ze(i,t,e,n,s=()=>{}){const r=d=>typeof d=="string"?i.query(d)??void 0:d,o=r(t.trigger)??n;if(!o){s(`gsap-compat: scrollTrigger has no trigger element${typeof t.trigger=="string"?` for "${t.trigger}"`:""}`);return}const a=t.scrub===void 0||t.scrub===!1?!1:t.scrub,c=(t.toggleActions??"play none none none").trim().split(/\s+/);let l=0,h;const f=(d,m)=>()=>{m?.(),e&&!a&&xo(e,c[d]??"none"),t.once&&d===0&&queueMicrotask(()=>h.destroy())},u=t.containerAnimation?_o(i,t.containerAnimation,o,s):void 0;return h=new It({trigger:o,start:t.start,end:t.end,scrub:a===!1?void 0:a,pin:t.pin===!0?!0:r(t.pin),scroller:r(t.scroller),horizontal:t.horizontal,pinSpacing:t.pinSpacing,onRefresh:t.invalidateOnRefresh&&e?.invalidate?()=>e.invalidate():void 0,snap:t.snap===void 0?void 0:Po(t.snap,e),markers:t.markers,container:u,onUpdate:(d,m)=>{if(e&&a!==!1&&e.progress(d),t.onUpdate){const p=d<l||m<0?-1:1;t.onUpdate({progress:d,velocity:m,direction:p})}l=d},onEnter:f(0,t.onEnter),onLeave:f(1,t.onLeave),onEnterBack:f(2,t.onEnterBack),onLeaveBack:f(3,t.onLeaveBack)}),e&&a===!1&&e.progress(0),h.start(),i.own(h)}function Po(i,t){const e=s=>s==="labels"?r=>Co(r,t?.labelProgresses?.()??[]):s;if(typeof i!="object"||Array.isArray(i))return e(i);const n=i.ease?Pt(i.ease):void 0;return{snapTo:e(i.snapTo),duration:i.duration,delay:i.delay,ease:n?n.fn??W(n.easing):void 0}}function Co(i,t){return t.reduce((e,n)=>Math.abs(n-i)<Math.abs(e-i)?n:e,t[0]??i)}function _o(i,t,e,n){const s=()=>t.timeline.getTracks({property:"x"}).map(r=>r.target).filter(r=>{const o=i.elementFor(r);return!!o&&o!==e&&o.contains(e)});return s().length===0&&n("gsap-compat: containerAnimation does not move an ancestor of the trigger along x"),{range:()=>{const r=t.scrollTrigger;return r||n("gsap-compat: containerAnimation needs its own scrollTrigger (created before this one)"),{start:r?.startOffset??0,end:r?.endOffset??0}},progress:()=>t.progress(),shiftAt:r=>{const o=t.timeline.getStateAtTime(r*t.timeline.duration);let a=0;for(const c of s()){const l=o.values.get(c)?.get("x");typeof l=="number"&&(a+=l)}return a}}}class On{conditions={};scope;host;items=[];snapshots=new Map;constructor(t,e){this.host=t,this.scope=e}add(t){const e=this.host.collector;this.host.setCollector(this);try{const n=t();return typeof n=="function"&&this.items.push({revert:n}),n}finally{this.host.setCollector(e)}}track(t){this.items.push(t)}touch(t,e){this.snapshots.has(t)||this.snapshots.set(t,{name:e,style:t.getAttribute("style"),d:t.getAttribute("d")})}revert(){for(const t of this.items.splice(0).reverse())t.revert?t.revert():t.kill?t.kill():t.destroy?.();for(const[t,{name:e,style:n,d:s}]of this.snapshots)n===null?t.removeAttribute("style"):t.setAttribute("style",n),s!==null&&t.setAttribute("d",s),this.host.forget(e);this.snapshots.clear()}kill(){this.revert()}}class Io{host;scope;entries=[];listeners=[];scheduled=!1;constructor(t,e){this.host=t,this.scope=e}add(t,e){const n={conditions:t,setup:e,queries:new Map},s=typeof t=="string"?{matches:t}:t;if(typeof window<"u"&&typeof window.matchMedia=="function")for(const[r,o]of Object.entries(s)){const a=window.matchMedia(o);n.queries.set(r,a);const c=()=>this.scheduleUpdate();a.addEventListener("change",c),this.listeners.push(()=>a.removeEventListener("change",c))}return this.entries.push(n),this.update(n),this}revert(){for(const t of this.listeners.splice(0))t();for(const t of this.entries.splice(0))t.context?.revert()}kill(){this.revert()}scheduleUpdate(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1;for(const t of this.entries)this.update(t)}))}update(t){const e={};for(const[o,a]of t.queries)e[o]=a.matches;const n=Object.values(e).some(Boolean),s=n?JSON.stringify(e):void 0;if(s===t.key||(t.context?.revert(),t.context=void 0,t.key=s,!n))return;const r=new On(this.host,this.scope);r.conditions=e,r.add(()=>t.setup(r)),t.context=r}}class Ro{frames;canvas;context;options;images;ready;current=0;drawn=-1;loadedCount=0;inFlight=0;destroyed=!1;onResize=()=>this.resize();constructor(t,e){this.canvas=t,this.context=t.getContext("2d"),this.options=e,this.frames=Math.max(1,Math.floor(e.frames)),this.images=new Array(this.frames),this.ready=new Array(this.frames).fill(!1),typeof window<"u"&&window.addEventListener("resize",this.onResize,{passive:!0}),this.resize(),this.pump()}get frame(){return this.current}set frame(t){this.current=Math.max(0,Math.min(this.frames-1,t)),this.draw()}get loaded(){return this.loadedCount}destroy(){this.destroyed=!0,typeof window<"u"&&window.removeEventListener("resize",this.onResize);for(const t of this.images)t&&(t.src="")}resize(){const t=typeof window<"u"?Math.min(window.devicePixelRatio||1,2):1,e=Math.round(this.canvas.clientWidth*t),n=Math.round(this.canvas.clientHeight*t);e>0&&n>0&&(this.canvas.width!==e||this.canvas.height!==n)&&(this.canvas.width=e,this.canvas.height=n),this.drawn=-1,this.draw()}draw(){const t=Math.round(this.current),e=this.nearestReady(t);if(e===-1||e===this.drawn||!this.context)return;const n=this.images[e],{width:s,height:r}=this.canvas,o=(this.options.fit??"cover")==="cover"?Math.max(s/n.naturalWidth,r/n.naturalHeight):Math.min(s/n.naturalWidth,r/n.naturalHeight),a=n.naturalWidth*o,c=n.naturalHeight*o;this.context.clearRect(0,0,s,r),this.context.drawImage(n,(s-a)/2,(r-c)/2,a,c),this.drawn=e,this.pump()}nearestReady(t){for(let e=0;e<this.frames;e++){if(t-e>=0&&this.ready[t-e])return t-e;if(t+e<this.frames&&this.ready[t+e])return t+e}return-1}pump(){const t=this.options.concurrency??6,e=Math.round(this.current);for(let n=0;n<this.frames&&this.inFlight<t;n++)for(const s of n===0?[e]:[e+n,e-n])s<0||s>=this.frames||this.images[s]||this.inFlight>=t||this.load(s)}load(t){const e=new Image;e.decoding="async",this.images[t]=e,this.inFlight++;const n=s=>{if(!this.destroyed){if(this.inFlight--,s){this.ready[t]=!0,this.loadedCount++,this.options.onProgress?.(this.loadedCount,this.frames);const r=Math.round(this.current);(Math.abs(t-r)<Math.abs(this.drawn-r)||this.drawn===-1)&&(this.drawn=-1,this.draw())}this.pump()}};e.onload=()=>n(!0),e.onerror=()=>n(!1),e.src=this.options.url(t)}}const Lo={opacity:0,y:-16},Fo={opacity:0,y:16};async function $o(i,t,e,n){const s=t.collector?.scope??t.root,r=s.ownerDocument??s,o=()=>n.shared?[...s.querySelectorAll(n.shared)]:[];if(n.native&&typeof r.startViewTransition=="function")return Do(r,n,o);const a=n.duration??.35,c=n.ease??"power2.inOut",l=y=>new Promise(b=>{y(b)||b()}),h=o(),f=h.length?Be(t,h):void 0,u=n.from!==void 0?Nn(t,n.from,n.shared):[];if(u.length&&n.leave!==!1){const y=n.leave??Lo;await l(b=>i.to(u,{...y,duration:a,ease:c,onComplete:b}))}await n.update();const d=[],m=typeof n.to=="function"?n.to():n.to,p=m!==void 0?Nn(t,m,n.shared):[];if(p.length&&n.enter!==!1){const y=n.enter??Fo;d.push(l(b=>i.fromTo(p,y,{...An(y),duration:a,ease:c,onComplete:b})))}if(f){const y=o().filter(b=>!h.includes(b));y.length&&d.push(l(b=>Ne(t,e,f,{targets:y,duration:a*1.4,ease:c,enter:!1,onComplete:b})))}await Promise.all(d)}function Nn(i,t,e){const n=i.resolveTargets(t).map(s=>i.elementFor(s)).filter(s=>!!s);return e?n.flatMap(s=>!s.querySelector(e)&&!s.matches(e)?[s]:[...s.children].filter(r=>!r.matches(e)&&!r.querySelector(e))):n}async function Do(i,t,e){const n=(a,c)=>{const l=a.dataset?.flipId;l&&a.style.setProperty("view-transition-name",c?`tf-${l.replace(/[^\w-]/g,"-")}`:"")},s=e();s.forEach(a=>n(a,!0));let r=[];await i.startViewTransition(async()=>{s.forEach(a=>n(a,!1)),await t.update(),r=e(),r.forEach(a=>n(a,!0))}).finished,r.forEach(a=>n(a,!1))}const qn={create:(i,t)=>Pe(i,Gi(t))},Yn={create:(i,t)=>Pe(i,{fn:Ki(t)})},Xn={create:(i,t)=>Pe(i,{fn:Qi(t)})},Bo=new Set(["keyframes","duration","delay","ease","easeEach","stagger","repeat","repeatDelay","yoyo","repeatRefresh","paused","id","onStart","onUpdate","onComplete","onRepeat","onReverseComplete","scrollTrigger"]),Vn=.5,Oo="power1.inOut";function No(i){return i.keyframes!==void 0&&i.keyframes!==null}function qo(i){const t=i.keyframes,e={};for(const[l,h]of Object.entries(i))Bo.has(l)||(e[l]=h);if(Array.isArray(t))return t.map(l=>({...e,...l,duration:l.duration??i.duration??Vn}));const n=Object.entries(t),s=i.duration??Vn,r=t.easeEach??i.easeEach??Oo;if(n.length>0&&n.every(([l])=>/^\s*-?\d+(\.\d+)?\s*%\s*$/.test(l)||l==="easeEach")){const l=n.filter(([u])=>u!=="easeEach").map(([u,d])=>({at:Number.parseFloat(u)/100,step:d})).sort((u,d)=>u.at-d.at),h=[];let f=0;for(const{at:u,step:d}of l){const m=Math.max(0,u-f);h.push({...e,ease:r,...d,duration:m*s}),f=u}return h}const o=n.filter(([l,h])=>l!=="easeEach"&&Array.isArray(h)),a=Math.max(0,...o.map(([,l])=>l.length)),c=[];for(let l=0;l<a;l++){const h={...e,ease:r,duration:s/a};for(const[f,u]of o)l<u.length&&(h[f]=u[l]);c.push(h)}return c}function Wn(i,t,e,n={}){const s=t.collector?.scope??t.root,r=typeof n.scroller=="string"?s.querySelector(n.scroller):n.scroller??null,o={x:r?r.scrollLeft:window.scrollX,y:r?r.scrollTop:window.scrollY},a={x:r?r.scrollWidth-r.clientWidth:document.documentElement.scrollWidth-window.innerWidth,y:r?r.scrollHeight-r.clientHeight:document.documentElement.scrollHeight-window.innerHeight},c=(w,v)=>{if(v===void 0)return o[w];if(typeof v=="number")return v;if(v==="max")return a[w];const k=typeof v=="string"?s.querySelector(v):v;if(!k)return o[w];const T=k.getBoundingClientRect(),S=r?.getBoundingClientRect(),A=(w==="x"?n.offsetX:n.offsetY)??n.offset??0;return w==="x"?T.left-(S?.left??0)+o.x-A:T.top-(S?.top??0)+o.y-A},l=typeof e=="object"&&e!==null&&!("nodeType"in e)?{x:c("x",e.x),y:c("y",e.y)}:{x:o.x,y:c("y",e)},h={x:Math.max(0,Math.min(a.x,l.x)),y:Math.max(0,Math.min(a.y,l.y))},f={...o},u=()=>{r?(r.scrollLeft=f.x,r.scrollTop=f.y):window.scrollTo({left:f.x,top:f.y,behavior:"instant"})},d=["wheel","touchstart","keydown"],m=r??window,p=()=>{b.kill(),y()},y=()=>{for(const w of d)m.removeEventListener(w,p)},b=i.to(f,{x:h.x,y:h.y,duration:n.duration??1,ease:n.ease??"power2.inOut",onStart:n.onStart,onUpdate:()=>{u(),n.onUpdate?.()},onComplete:()=>{y(),n.onComplete?.()}});if(n.autoKill!==!1)for(const w of d)m.addEventListener(w,p,{passive:!0});return b}function Yo(i,t,e){const n=i.collector?.scope??i.root,s=typeof t=="string"?[...n.querySelectorAll(t)]:"nodeType"in t?[t]:Array.from(t),{interval:r=.1,batchMax:o,onEnter:a,onLeave:c,onEnterBack:l,onLeaveBack:h,...f}=e,u={onEnter:a,onLeave:c,onEnterBack:l,onLeaveBack:h},d={onEnter:[],onLeave:[],onEnterBack:[],onLeaveBack:[]},m={},p=b=>{m[b]!==void 0&&clearTimeout(m[b]),m[b]=void 0;const w=d[b].splice(0);w.length>0&&u[b]?.(w)},y=(b,w)=>{if(u[b]){if(d[b].push(w),o!==void 0&&d[b].length>=o)return p(b);m[b]===void 0&&(m[b]=setTimeout(()=>p(b),r*1e3))}};return s.map(b=>ze(i,{...f,trigger:b,onEnter:()=>y("onEnter",b),onLeave:()=>y("onLeave",b),onEnterBack:()=>y("onEnterBack",b),onLeaveBack:()=>y("onLeaveBack",b)})).filter(b=>b!==void 0)}class z{compat;stage;options;autoplayPending;started=!1;killed=!1;recipe=[];firstElement;scrollDriver;events=[];ranges=[];playhead={time:0,iteration:0,direction:"forward",fresh:!0};waitingToWrap=!1;finishedThisFrame=!1;backwards=!1;constructor(t,e={}){this.stage=t;const n={...e,onWarning:e.onWarning??t.onWarning};if(this.options=n,this.compat=new nt({...n,startValue:(s,r)=>{const o=t.objectFor(s);if(o)return Wo(o[r]);const a=t.appliedValue(s,r);if(a!==void 0)return a;if(r==="d")return mn(t.elementFor(s))??void 0;if(r==="text")return t.elementFor(s)?.textContent??void 0;if(r==="strokeDasharray"||r==="strokeDashoffset"){const c=Gn(t.elementFor(s));if(c!==void 0)return r==="strokeDasharray"?[c,c]:0}},startVelocity:(s,r)=>t.velocityOf(s,r),layoutColumns:s=>zn(s.map(r=>t.elementFor(r))),random:()=>t.utils.random(0,1)}),this.compat.timeline.onComplete=()=>{this.finishedThisFrame=!0},t.collector?.track(this),t.liveTimelines.add(this),this.autoplayPending=!n.paused&&!n.scrollTrigger,n.scrollTrigger){const s=n.scrollTrigger;queueMicrotask(()=>{this.killed||(this.scrollDriver=ze(t,s,this,this.firstElement,r=>n.onWarning?.(r)))})}this.autoplayPending&&queueMicrotask(()=>{this.autoplayPending&&this.play()})}get timeline(){return this.compat.timeline}get scrollTrigger(){return this.scrollDriver}to(t,e,n){return No(e)?this.record(()=>this.keyframed(t,e,n)):this.record(()=>this.tween(t,[e],n,([s],r,o)=>this.compat.to(r,s,o)))}from(t,e,n){return this.record(()=>this.tween(t,[e],n,([s],r,o)=>this.compat.from(r,s,o)))}fromTo(t,e,n,s){return this.record(()=>this.tween(t,[e,n],s,([r,o],a,c)=>this.compat.fromTo(a,r,o,c)))}set(t,e,n){return this.record(()=>this.tween(t,[e],n,([s],r,o)=>this.compat.set(r,s,o)))}addLabel(t,e){return this.record(()=>this.compat.addLabel(t,e))}add(t,e){return this.record(()=>{t.autoplayPending=!1,t.timeline.stop(),t.stage.deactivate(t.timeline),this.compat.add(t.compat,e)})}invalidate(){const t=this.compat.progress();this.compat.progress(0),this.stage.render(this.timeline),this.compat.reset(),this.events=[],this.ranges=[];for(const e of this.recipe)e();return this.syncDuration(),this.compat.progress(t),this.stage.render(this.timeline),this}call(t,e=[],n){return this.record(()=>{const s=this.compat.addEvent(n);this.events.push({time:s,run:()=>t(...e)})})}addPause(t,e,n=[]){return this.record(()=>{const s=this.compat.addEvent(t);this.events.push({time:s,pause:!0,run:()=>e?.(...n)})})}tweenTo(t,e={}){return this.tweenFromTo(this.timeline.currentTime/1e3,t,e)}tweenFromTo(t,e,n={}){this.pause(),this.seek(t);const s=this.timeline.currentTime,r=Math.max(0,Math.min(this.timeline.duration,this.compat.timeOf(e))),o={time:s},a=n.duration??Math.abs(r-s)/1e3/(this.timeScale()||1),c=new z(this.stage,{onStart:n.onStart,onComplete:n.onComplete});return c.to(o,{time:r,duration:a,ease:n.ease??"none",onUpdate:()=>{this.moveTo(o.time),n.onUpdate?.()}}),c}play(){this.autoplayPending=!1,this.started||(this.started=!0,this.options.onStart?.());const t=this.timeline.playbackState==="playing",e=this.timeline.playbackState==="paused";if(this.timeline.play(),!t){const n=this.timeline,s=n.direction==="forward"?n.currentTime===0:n.currentTime===n.duration;this.playhead={...this.readPlayhead(),fresh:s&&!e},this.waitingToWrap=!1}return this.stage.liveTimelines.add(this),this.stage.render(this.timeline),this.stage.activate(this.timeline,{onUpdate:()=>this.afterFrame()}),this}pause(){return this.autoplayPending=!1,this.timeline.pause(),this.stage.deactivate(this.timeline),this}resume(){return this.play()}restart(){return this.timeline.stop(),this.backwards=!1,this.play()}reverse(){this.backwards=!this.backwards;const t=this.timeline.playbackState==="idle"&&this.timeline.direction==="forward";return this.timeline.reverse(),t&&this.timeline.currentTime===0&&this.timeline.seek(this.timeline.duration),this.play()}labelProgresses(){const t=this.timeline.duration;return t>0?this.compat.labelTimes().map(e=>e/t):[]}reversed(){return this.timeline.direction==="reverse"}seek(t){return this.autoplayPending=!1,this.compat.seek(t),this.stage.render(this.timeline),this.playhead=this.readPlayhead(),this.waitingToWrap=!1,this.options.onUpdate?.(),this}progress(t){return t===void 0?this.compat.progress():(this.autoplayPending=!1,this.moveTo(Math.max(0,Math.min(1,t))*this.timeline.duration),this.compat.progress())}timeScale(t){return this.compat.timeScale(t)}duration(){return this.compat.duration()}isActive(){return this.timeline.playbackState==="playing"}kill(){return this.killed=!0,this.stage.liveTimelines.delete(this),this.scrollDriver?.destroy(),this.scrollDriver=void 0,this.autoplayPending=!1,this.timeline.stop(),this.stage.deactivate(this.timeline),this.compat.kill(),this}toDefinition(){return this.compat.toDefinition()}killTweensOf(t,e){for(const n of t)for(const s of e??[void 0])this.timeline.removeTracks({target:n,...s!==void 0&&{property:s}});this.timeline.tracks.length===0&&this.events.length===0&&this.kill()}record(t){return this.recipe.push(t),t(),this.syncDuration(),this}syncDuration(){if(this.events.length===0)return;this.timeline.setDuration(void 0);const t=Math.max(...this.events.map(e=>e.time));t>this.timeline.duration&&this.timeline.setDuration(t)}readPlayhead(){const t=this.timeline;return{time:t.currentTime,iteration:t.loopIteration,direction:t.direction}}moveTo(t){const e=this.playhead;this.timeline.seek(t),this.stage.render(this.timeline);const n={time:this.timeline.currentTime,iteration:this.timeline.loopIteration,direction:t>=e.time?"forward":"reverse"},s={...e,iteration:n.iteration,direction:n.direction};this.playhead={...this.readPlayhead()},this.waitingToWrap=!1,this.runCrossings(s,n,!1),this.options.onUpdate?.()}refreshForRepeat(){const t=this.timeline.currentTime;this.compat.reset(),this.events=[],this.ranges=[];for(const e of this.recipe)e();this.syncDuration(),this.timeline.seek(Math.min(t,this.timeline.duration))}afterFrame(){const t=this.timeline,e=t.repeatDelayRemaining>0;if(this.waitingToWrap&&e){this.options.onUpdate?.();return}this.waitingToWrap=!1;const n=this.playhead,s=this.readPlayhead();this.playhead=s;const r=this.options.yoyo===!0;e&&!r&&s.iteration>n.iteration&&(this.playhead={time:0,iteration:s.iteration,direction:"forward",fresh:!0},this.waitingToWrap=!0);const o=this.runCrossings(n,s,e);if(this.options.onUpdate?.(),this.finishedThisFrame&&!o){this.finishedThisFrame=!1;const a=t.currentTime===0&&t.direction==="reverse";!this.scrollDriver&&!r&&this.stage.liveTimelines.delete(this),a&&this.backwards?this.options.onReverseComplete?.():this.options.onComplete?.()}this.finishedThisFrame=!1}runCrossings(t,e,n){if(this.events.length===0&&this.ranges.length===0&&!this.options.onRepeat&&!this.options.repeatRefresh)return!1;const s=this.events,{crossings:r,passes:o}=Me(s.map(a=>a.time),t,e,{duration:this.timeline.duration,alternate:this.options.yoyo===!0,holding:n});for(const a of r){if(this.killed)return!0;if(a.kind==="repeat"){this.options.repeatRefresh&&this.refreshForRepeat(),this.options.onRepeat?.();continue}const c=s[a.index];if(!(c.direction&&c.direction!==a.direction)){if(c.pause)return this.timeline.seek(c.time),this.stage.render(this.timeline),this.pause(),this.playhead=this.readPlayhead(),this.waitingToWrap=!1,c.run(),!0;c.run()}}for(const a of this.ranges)o.some(([l,h])=>l!==h&&Math.max(l,h)>=a.start&&Math.min(l,h)<=a.end)&&a.run();return!1}tween(t,e,n,s){const r=this.resolve(t);if(!r)return;const{onStart:o,onUpdate:a,onComplete:c}=e[e.length-1];if(o||a||c){let l=1/0,h=-1/0;const f=(u,d,m)=>{s(u,d,m),l=Math.min(l,this.compat.lastStart),h=Math.max(h,this.compat.lastEnd)};if(this.buildTween(r,e,n,f),l===1/0)return;o&&this.events.push({time:l,direction:"forward",run:o}),a&&this.ranges.push({start:l,end:h,run:a}),c&&this.events.push({time:h,direction:"forward",run:c});return}this.buildTween(r,e,n,s)}keyframed(t,e,n){const s=this.resolve(t);if(!s)return;const r=qo(e);if(r.length===0)return;const o=s.length>1?Ie(e.stagger,this.staggerContext(s)):void 0,a=s.map(y=>this.targetFor(y)).filter(y=>y!==void 0),c=o?a.map(y=>[y]):[a],l=o?Bt(s.length,o).map(y=>y/1e3):[0],h=this.compat.timeOf(n)/1e3+Kt(e.delay,0)/1e3;let f=1/0,u=-1/0;if(c.forEach((y,b)=>{r.forEach((w,v)=>{const k=v===0?h+l[b]:">";this.tween(y,[w],k,([T],S,A)=>this.compat.to(S,T,A)),f=Math.min(f,this.compat.lastStart),u=Math.max(u,this.compat.lastEnd)})}),f===1/0)return;const{onStart:d,onUpdate:m,onComplete:p}=e;d&&this.events.push({time:f,direction:"forward",run:d}),m&&this.ranges.push({start:f,end:u,run:m}),p&&this.events.push({time:u,direction:"forward",run:p})}staggerContext(t){return{count:t.length,columnsFromLayout:()=>zn(t.map(e=>this.stage.elementFor(e))),random:()=>this.stage.utils.random(0,1)}}buildTween(t,e,n,s){const r=t.map(u=>this.targetFor(u));if(!(t.length>1&&(e.some(Vo)||t.some(u=>this.stage.objectFor(u)!==void 0)))){const u=this.targetFor(t[0]);s(e.map(d=>this.prepare(Hn(d,0,u,this.stage.utils,r),t)),t,n);return}const a=e.length-1,{stagger:c,...l}=e[a],h=Ie(c,this.staggerContext(t)),f=h?Bt(t.length,h).map(u=>u/1e3):t.map(()=>0);t.forEach((u,d)=>{const m=d===0?Kt(l.delay,0)/1e3+f[0]:0,p=d===0?0:f[d]-f[d-1],y=d===0?n:`<${p<0?"-":"+"}${Math.abs(p).toFixed(6)}`,w=e.map((v,k)=>k===a?{...l,delay:m}:v).map(v=>this.prepare(Hn(v,d,this.targetFor(u),this.stage.utils,r),[u]));s(w,[u],y)})}targetFor(t){return this.stage.elementFor(t)??this.stage.objectFor(t)}prepare(t,e){const n=o=>this.options.onWarning?.(o),s=o=>this.stage.query(o);let r=t;if(t.motionPath!==void 0){const o=to(t.motionPath,{query:s,targets:e.map(a=>this.stage.elementFor(a)).filter(a=>!!a),warn:n});r={...r,motionPath:o}}if(t.morphSVG!==void 0){const o=eo(t.morphSVG,s,n),{morphSVG:a,...c}=r;r=o?{...r,morphSVG:o}:c}if(t.drawSVG!==void 0){const o=Gn(this.stage.elementFor(e[0]));if(o===void 0){n("gsap-compat: drawSVG needs an SVG shape with a stroke (path, line, circle…)");const{drawSVG:a,...c}=r;r=c}else r=Ir(r,o)}return r}resolve(t){const e=this.stage.resolveTargets(t);if(e.length===0){this.options.onWarning?.(`gsap-compat: no elements found for target ${Uo(t)}`);return}return this.firstElement??=e.map(n=>this.stage.elementFor(n)).find(n=>n!==void 0),e}}function Un(i=new un){const t=r=>{const{config:o}=Gt(r);return new z(i,{repeat:o.repeat,yoyo:o.yoyo,repeatDelay:o.repeatDelay,paused:o.paused,onStart:o.onStart,onUpdate:o.onUpdate,onComplete:o.onComplete,onRepeat:o.onRepeat,onReverseComplete:o.onReverseComplete,repeatRefresh:o.repeatRefresh,scrollTrigger:o.scrollTrigger})},e=r=>{const{onStart:o,onUpdate:a,onComplete:c,onRepeat:l,onReverseComplete:h,repeatRefresh:f,...u}=r;return u},n=r=>(r&&i.collector?.track(r),r),s={stage:i,ticker:i.ticker,utils:i.utils,getProperty:(r,o)=>{const[a]=i.resolveTargets(r);if(a===void 0)return;const c=i.objectFor(a);return c?c[o]:i.appliedValue(a,o)??on(o)},scrollTrigger:r=>n(ze(i,r)),scrollBatch:(r,o)=>Yo(i,r,o).map(a=>n(a)),scrollTo:(r,o)=>Wn(s,i,r,o),refreshScroll:()=>{It.refreshAll(),je.refreshAll()},smoothScroll:(r={})=>{const o=typeof r.scroller=="string"?(i.collector?.scope??i.root).querySelector(r.scroller):r.scroller;return n(new je({...r,scroller:o}).start())},context:(r,o)=>{const a=new On(i,o);return r&&a.add(()=>r(a)),a},matchMedia:r=>new Io(i,r),customEase:qn.create,customBounce:Yn.create,customWiggle:Xn.create,pageTransition:r=>$o(s,i,o=>new z(i,o),r),imageSequence:(r,o)=>{const a=typeof r=="string"?(i.collector?.scope??i.root).querySelector(r):r;if(!(a instanceof HTMLCanvasElement))throw new Error(`gsap-compat: imageSequence needs a <canvas>, got ${String(r)}`);return n(new Ro(a,o))},quickTo:(r,o,a={})=>{const c=new z(i,{paused:!0}),[l]=i.resolveTargets(r);return Object.assign(f=>{if(!l)return;const u=a.spring!==void 0?i.velocityOf(l,o)??0:0;c.compat.reset(),c.compat.to(l,{[o]:f,duration:a.duration??.4,ease:a.ease??"power3.out",...a.spring!==void 0&&{spring:Xo(a.spring,o,u)}}),c.timeline.stop(),c.timeline.play(),i.activate(c.timeline)},{tween:c,kill:()=>c.kill()})},timeline:r=>new z(i,r),to:(r,o)=>{if(o.scrollTo!==void 0){const{scrollTo:a,...c}=o,l=typeof a=="object"&&a!==null&&!("nodeType"in a)?a:{},h=typeof r!="string"&&r!==window&&r.nodeType===1;return Wn(s,i,a,{...c,offsetX:l.offsetX,offsetY:l.offsetY,scroller:h?r:void 0})}return t(o).to(r,e(o))},from:(r,o)=>t(o).from(r,e(o)),fromTo:(r,o,a)=>t(a).fromTo(r,o,e(a)),set:(r,o)=>t(o).set(r,e(o)),delayedCall:(r,o,a)=>new z(i).call(o,a,r),killTweensOf:(r,o)=>{const a=i.resolveTargets(r),c=typeof o=="string"?o.split(",").map(l=>l.trim()).filter(Boolean):o;for(const l of[...i.liveTimelines])l.killTweensOf(a,c)},convertToPath:r=>no(r,i.root),splitText:(r,o)=>{const a=i.collector?.scope??i.root,c=typeof r=="string"?Array.from(a.querySelectorAll(r)):"nodeType"in r?[r]:Array.from(r);return n(uo(c,o))},draggable:(r,o)=>n(ao(s,i,r,o)),getFlipState:r=>Be(i,r),flipFrom:(r,o)=>Ne(i,a=>new z(i,a),r,o),flip:(r,o,a)=>{const c=Be(i,r);return o(),Ne(i,l=>new z(i,l),c,{targets:r,...a})}};return s}const Y=Un();function Xo(i,t,e){return i===!0?{velocity:{[t]:e}}:typeof i=="string"?{preset:i,velocity:{[t]:e}}:{...i,velocity:{[t]:e}}}function Vo(i){return i.morphSVG!==void 0||i.drawSVG!==void 0||i.text!==void 0||i.scrambleText!==void 0||jn(i)}function jn(i){return Object.entries(i).some(([t,e])=>(typeof e=="function"||sn(e))&&!_e.has(t))}function Hn(i,t,e,n,s){if(!jn(i))return i;const r={};for(const[o,a]of Object.entries(i))_e.has(o)?r[o]=a:typeof a=="function"?r[o]=a(t,e,s):sn(a)?r[o]=n.resolveRandomString(a):r[o]=a;return r}function zn(i){const t=i.map(n=>n?.getBoundingClientRect().top);if(t[0]===void 0)return i.length;let e=0;for(const n of t){if(n===void 0||Math.abs(n-t[0])>1)break;e++}return Math.max(1,e)}function Gn(i){const t=i;if(typeof t?.getTotalLength=="function")return t.getTotalLength()}function Wo(i){if(typeof i=="number"||typeof i=="string"||Array.isArray(i)&&i.every(t=>typeof t=="number"))return i}function Uo(i){return typeof i=="string"?`"${i}"`:String(i)}class Ge{media;offset;driftTolerance;constructor(t,e={}){this.media=t,this.offset=e.offset??0,this.driftTolerance=Math.max(0,e.driftTolerance??.15)}targetTime(t){return Math.max(0,t/1e3+this.offset)}update(t,e){const n=this.targetTime(t);e?(this.media.paused&&this.safePlay(),Math.abs(this.media.currentTime-n)>this.driftTolerance&&(this.media.currentTime=n)):(this.media.paused||this.media.pause(),this.media.currentTime!==n&&(this.media.currentTime=n))}seek(t){this.media.currentTime=this.targetTime(t)}setRate(t){this.media.playbackRate=t}dispose(){this.media.paused||this.media.pause()}safePlay(){const t=this.media.play();t&&typeof t.catch=="function"&&t.catch(()=>{})}}function Kn(i,t,e,n,s){const r=e-s;if(r<0){t.paused||t.pause(),t.currentTime=0;return}i.update(r,n)}class Jt{container;timeline=null;adapter;animationFrameId;lastTime;options;targets={};isDestroyed=!1;mediaSync;mediaTargets=[];symbolInstances=[];scenarioList=[];scenarioId;authored=new Map;markerList=[];listeners=new Set;playhead={time:0,iteration:0,direction:"forward"};stepping=!1;lastMarkerId=null;reducedQuery;onReducedChange=()=>this.applyReducedMotion();visibilityObserver;onScreen=!0;pausedByVisibility=!1;autoplayWhenSeen=!1;onDocumentVisibility=()=>this.updateVisibility();constructor(t,e={}){if(typeof t=="string"){const n=document.querySelector(t);if(!n)throw new Error(`Container not found: ${t}`);this.container=n}else this.container=t;this.options=e,this.adapter=new st}async load(t){this.scenarioList=[],this.scenarioId=void 0,await this.loadSource(t)}async loadSource(t){let e;if(typeof t=="string"){const n=await fetch(t);if(!n.ok)throw new Error(`Failed to load animation: ${n.statusText}`);e=await n.json()}else e=t;this.useDefinition(e),this.showInitialFrame(),this.watchReducedMotion(),this.watchVisibility(),this.options.autoplay&&!this.reducedMotion&&(this.options.playWhenVisible&&!this.onScreen?this.autoplayWhenSeen=!0:this.play())}useDefinition(t){const e={...t.config};this.options.speed!==void 0&&(e.speed=this.options.speed),this.options.loop!==void 0&&(e.loop=this.options.loop),this.options.alternate!==void 0&&(e.alternate=this.options.alternate),this.timeline=ft({...t,config:e}),this.markerList=this.timeline.markers,this.lastMarkerId=null,this.options.onComplete&&(this.timeline.onComplete=this.options.onComplete),this.options.onUpdate&&(this.timeline.onUpdate=this.options.onUpdate),this.autoRegisterTargets(),this.setupSymbolInstances(),this.scanMedia()}async loadScenarios(t,e={}){if(t.length===0)throw new Error("tinyfly: loadScenarios needs at least one scenario");const n=new Set;for(const r of t){if(n.has(r.id))throw new Error(`tinyfly: scenario id "${r.id}" is used more than once`);n.add(r.id)}const s=e.initial===void 0?t[0]:t.find(r=>r.id===e.initial);if(!s)throw new Error(`tinyfly: there is no scenario "${e.initial}"`);this.scenarioList=[...t],this.scenarioId=s.id,await this.loadSource(s.timeline)}get scenarios(){return this.scenarioList.map(t=>({id:t.id,label:t.label??t.id}))}get scenario(){return this.scenarioId}setScenario(t){const e=this.scenarioList.find(a=>a.id===t);if(!e||!this.timeline)return!1;if(t===this.scenarioId)return!0;const n=this.isPlaying,s=this.currentTime>=this.duration-.5,r=this.currentMarker?.id;this.stopAnimationLoop(),this.stepping=!1,this.pausedByVisibility=!1,this.restoreAuthored(),this.scenarioId=t,this.useDefinition(e.timeline),this.lastMarkerId=null;let o=0;return this.reducedMotion||s?o=this.duration:r!==void 0&&(o=this.markers.find(a=>a.id===r)?.time??0),this.seek(o),n&&!this.reducedMotion?(this.stepping=this.options.stepMode===!0,this.startPlaying()):this.notify(),!0}rememberAuthored(t){if(this.authored.has(t))return;const e={style:t.getAttribute("style")};t.children.length===0&&(e.text=t.textContent??"");const n=t.tagName.toLowerCase()==="path"?t:t.querySelector("path");n&&(e.path={element:n,d:n.getAttribute("d")}),this.authored.set(t,e)}restoreAuthored(){for(const[t,e]of this.authored){e.style===null?t.removeAttribute("style"):t.setAttribute("style",e.style),e.text!==void 0&&t.textContent!==e.text&&(t.textContent=e.text),e.path&&(e.path.d===null?e.path.element.removeAttribute("d"):e.path.element.setAttribute("d",e.path.d));const n=t.dataset;n&&delete n.shineBase}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(){for(const t of this.listeners)t()}get reducedMotion(){return this.reducedQuery?.matches===!0}get markers(){return this.markerList}get currentMarker(){const t=this.currentTime;let e;for(const n of this.markers)if(n.time<=t+.5)e=n;else break;return e}caption(t,e){const n=t?this.markers.find(o=>o.id===t):this.currentMarker;if(!n)return;const s=e??this.language(),r=o=>o?.[s]?.[n.id]??o?.[s.split("-")[0]]?.[n.id];return r(this.options.captions)??r(this.timeline?.captions)??n.label}next(){if(!this.timeline)return;const t=this.currentTime,e=this.markers.find(n=>n.time>t+.5);if(this.reducedMotion){this.seek(e?e.time:this.duration);return}t>=this.duration-.5||(this.stepping=e!==void 0,this.startPlaying())}prev(){if(!this.timeline)return;const t=this.currentTime,e=[...this.markers].reverse().find(n=>n.time<t-.5);this.pause(),this.seek(e?e.time:0)}goToMarker(t){const e=this.markers.find(n=>n.id===t);e&&(this.pause(),this.seek(e.time))}language(){return this.container.closest("[lang]")?.getAttribute("lang")||(typeof document<"u"?document.documentElement.lang:"")||"en"}showInitialFrame(){if(!this.timeline)return;const t=this.options.initialFrame??"start";if(t==="none")return;const e=t==="end"?this.timeline.duration:t==="start"?0:t;this.timeline.seek(Math.max(0,Math.min(this.timeline.duration,e))),this.applyState()}watchReducedMotion(){this.options.respectReducedMotion===!1||typeof window>"u"||typeof window.matchMedia!="function"||(this.reducedQuery??=window.matchMedia("(prefers-reduced-motion: reduce)"),this.reducedQuery.addEventListener?.("change",this.onReducedChange),this.reducedQuery.matches&&this.applyReducedMotion())}applyReducedMotion(){!this.reducedMotion||!this.timeline||(this.autoplayWhenSeen=!1,this.pause(),this.seek(this.timeline.duration))}watchVisibility(){if(!(!this.options.playWhenVisible||typeof window>"u")){if(typeof IntersectionObserver=="function"){this.visibilityObserver?.disconnect(),this.visibilityObserver=new IntersectionObserver(e=>{for(const n of e)this.onScreen=n.isIntersecting;this.updateVisibility()}),this.visibilityObserver.observe(this.container);const t=this.container.getBoundingClientRect?.();t&&(t.width>0||t.height>0)&&(this.onScreen=t.bottom>0&&t.top<window.innerHeight&&t.right>0&&t.left<window.innerWidth)}document.addEventListener("visibilitychange",this.onDocumentVisibility)}}updateVisibility(){const t=this.onScreen&&document.visibilityState!=="hidden";!t&&this.isPlaying?(this.pausedByVisibility=!0,this.pause()):t&&(this.pausedByVisibility||this.autoplayWhenSeen)&&!this.reducedMotion&&(this.pausedByVisibility=!1,this.autoplayWhenSeen=!1,this.startPlaying())}announceMarker(){if(!this.options.onMarker)return;const t=this.currentMarker,e=t?.id;e!==this.lastMarkerId&&(this.lastMarkerId=e,this.options.onMarker(t))}scanMedia(){this.mediaTargets=[],this.container.querySelectorAll("[data-tinyfly-media]").forEach(e=>{const n=e,s=Number(n.getAttribute("data-tinyfly-start")??"0")||0,r=n.getAttribute("data-volume");r!==null&&(n.volume=Math.max(0,Math.min(1,Number(r)||0))),this.mediaTargets.push({el:n,startTime:s,sync:new Ge(n)})})}syncAllMedia(t,e){for(const n of this.mediaTargets)Kn(n.sync,n.el,t,e,n.startTime)}loadFromString(t){const e=JSON.parse(t);this.load(e)}registerTarget(t,e){if(typeof e=="string"){const n=this.container.querySelector(e);n&&(this.rememberAuthored(n),this.targets[t]=n,this.adapter.registerTarget(t,n))}else this.rememberAuthored(e),this.targets[t]=e,this.adapter.registerTarget(t,e)}autoRegisterTargets(){this.container.querySelectorAll("[data-tinyfly]").forEach(e=>{const n=e.closest("[data-tinyfly-symbol]");if(n&&n!==e)return;const s=e.getAttribute("data-tinyfly");s&&this.registerTarget(s,e)}),this.timeline&&new Set(this.timeline.tracks.map(n=>n.target)).forEach(n=>{if(!this.targets[n]){const s=this.container.querySelector(`[data-tinyfly="${n}"]`)||this.container.querySelector(`.${n}`)||this.container.querySelector(`#${n}`);s&&this.registerTarget(n,s)}})}setupSymbolInstances(){this.symbolInstances=[];const t=this.options.symbols;if(!t||t.length===0)return;const e=new Map(t.map(n=>[n.id,n]));this.container.querySelectorAll("[data-tinyfly-symbol]").forEach(n=>{const s=n.getAttribute("data-tinyfly-symbol");if(!s)return;const r=e.get(s);if(!r||!r.timeline.tracks?.length)return;const o=new st;n.querySelectorAll("[data-tinyfly]").forEach(a=>{const c=a.getAttribute("data-tinyfly");c&&o.registerTarget(c,a)}),this.symbolInstances.push({adapter:o,timeline:ft(r.timeline)})})}attachMedia(t,e){this.mediaSync=new Ge(t,e),this.timeline&&(this.mediaSync.setRate(this.timeline.speed),this.mediaSync.update(this.timeline.currentTime,this.isPlaying))}detachMedia(){this.mediaSync?.dispose(),this.mediaSync=void 0}play(){!this.timeline||this.isDestroyed||(this.autoplayWhenSeen=!1,this.stepping=this.options.stepMode===!0,this.startPlaying())}startPlaying(){if(!this.timeline||this.isDestroyed)return;const t=this.timeline.playbackState==="idle";this.timeline.play(),t&&this.timeline.currentTime===0&&this.applyState(),this.playhead={time:this.timeline.currentTime,iteration:this.timeline.loopIteration,direction:this.timeline.direction},this.mediaSync?.update(this.timeline.currentTime,!0),this.syncAllMedia(this.timeline.currentTime,!0),this.startAnimationLoop(),this.notify()}pause(){this.timeline&&(this.stepping=!1,this.timeline.pause(),this.notify(),this.mediaSync?.update(this.timeline.currentTime,!1),this.syncAllMedia(this.timeline.currentTime,!1),this.stopAnimationLoop())}stop(){this.timeline&&(this.timeline.stop(),this.stopAnimationLoop(),this.applyState(),this.mediaSync?.update(this.timeline.currentTime,!1),this.syncAllMedia(this.timeline.currentTime,!1))}seek(t){this.timeline&&(this.timeline.seek(t),this.applyState(),this.playhead={time:this.timeline.currentTime,iteration:this.timeline.loopIteration,direction:this.timeline.direction},this.mediaSync?.seek(this.timeline.currentTime),this.syncAllMedia(this.timeline.currentTime,this.isPlaying))}setSpeed(t){this.timeline&&(this.timeline.speed=t,this.mediaSync?.setRate(t))}reverse(){this.timeline&&this.timeline.reverse()}get currentTime(){return this.timeline?.currentTime??0}get duration(){return this.timeline?.duration??0}get isPlaying(){return this.timeline?.playbackState==="playing"}destroy(){this.isDestroyed=!0,this.stopAnimationLoop(),this.reducedQuery?.removeEventListener?.("change",this.onReducedChange),this.visibilityObserver?.disconnect(),typeof document<"u"&&document.removeEventListener("visibilitychange",this.onDocumentVisibility),this.mediaSync?.dispose(),this.mediaSync=void 0;for(const t of this.mediaTargets)t.el.paused||t.el.pause();this.mediaTargets=[],this.adapter.clearTargets();for(const t of this.symbolInstances)t.adapter.clearTargets();this.symbolInstances=[],this.authored.clear(),this.timeline=null}startAnimationLoop(){if(this.animationFrameId!==void 0)return;this.lastTime=performance.now();const t=e=>{if(this.isDestroyed||!this.timeline)return;const n=e-(this.lastTime??e);this.lastTime=e;const s=this.playhead;this.timeline.tick(n),this.stopAtMarker(s),this.applyState();const r=this.timeline.playbackState==="playing";this.mediaSync?.update(this.timeline.currentTime,r),this.syncAllMedia(this.timeline.currentTime,r),this.timeline.playbackState==="playing"?this.animationFrameId=requestAnimationFrame(t):(this.animationFrameId=void 0,this.notify())};this.animationFrameId=requestAnimationFrame(t)}stopAtMarker(t){const e=this.timeline,n={time:e.currentTime,iteration:e.loopIteration,direction:e.direction};this.playhead=n;const s=this.markers;if(s.length===0)return;const{crossings:r}=Me(s.map(o=>o.time),t,n,{duration:e.duration,alternate:e.config.alternate===!0,holding:e.repeatDelayRemaining>0});for(const o of r){if(o.kind!=="event")continue;const a=s[o.index];if(this.stepping||a.pause){this.stepping=!1,e.pause(),e.seek(a.time),this.playhead={time:a.time,iteration:e.loopIteration,direction:e.direction};return}}}stopAnimationLoop(){this.animationFrameId!==void 0&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}applyState(){if(!this.timeline)return;const t=this.timeline.currentTime;this.adapter.applyState(this.timeline.getStateAtTime(t)),this.announceMarker(),this.notify();for(const e of this.symbolInstances){const n=e.timeline.duration;e.adapter.applyState(e.timeline.getStateAtTime(n>0?t%n:t))}}}async function jo(i,t,e={}){const n=new Jt(i,{...e,autoplay:!0});return await n.load(t),n}function Ho(i,t={}){return new Jt(i,t)}const Qn={play:"Play",pause:"Pause",prev:"Previous step",next:"Next step",restart:"Restart",scrub:"Position",speed:"Speed",reveal:"Reveal",step:"Step",of:"of",stepFormat:"{index} / {total}",scenario:"Scenario",fullscreen:"Full screen",exitFullscreen:"Exit full screen"},Zn="tinyfly-controls-style",zo=`
|
|
3
3
|
.tf-ctl { --tf-ctl-fg: #1d1d1f; --tf-ctl-bg: #f4f2ee; --tf-ctl-accent: #c2410c; --tf-ctl-radius: 8px;
|
|
4
4
|
font: 14px/1.4 var(--tf-ctl-font, system-ui, sans-serif); color: var(--tf-ctl-fg); margin-top: 8px; }
|
|
5
5
|
.tf-ctl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; border-radius: var(--tf-ctl-radius); background: var(--tf-ctl-bg); }
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
.tf-fullscreen > svg, .tf-fullscreen > canvas { grid-column: 1; grid-row: 1 / span 12; height: calc(100vh - 24px) !important; height: calc(100dvh - 24px) !important; }
|
|
48
48
|
.tf-fullscreen > :not(svg):not(canvas) { grid-column: 2; }
|
|
49
49
|
}
|
|
50
|
-
`;let
|
|
50
|
+
`;let Go=0;function Ko(i){if(i.getElementById(Zn))return;const t=i.createElement("style");t.id=Zn,t.textContent=zo,i.head.appendChild(t)}function Jn(i,t,e={}){const n=t.ownerDocument;Ko(n);const s={...Qn,...e.labels},r=e.speeds??[.5,1,2],o=()=>i.markers.length>0,a=()=>i.markers.some(E=>E.label!==void 0||i.caption(E.id)!==void 0),c=n.createElement("div");c.className="tf-ctl";const l=n.createElement("div");l.className="tf-ctl-bar",l.setAttribute("role","group");const h=(E,R,D,q="")=>{const N=n.createElement("button");return N.type="button",N.className=`tf-ctl-btn ${q}`.trim(),N.setAttribute("aria-label",E),N.title=E,N.textContent=R,N.addEventListener("click",D),N},f=h(s.restart,"⟲",()=>{i.pause(),i.seek(0)}),u=h(s.prev,"|◀",()=>i.prev()),d=h(s.play,"▶",()=>i.isPlaying?i.pause():p(),"tf-ctl-primary"),m=h(s.next,"▶|",()=>i.next()),p=()=>{i.currentTime>=i.duration-.5&&i.seek(0),i.play()},y=n.createElement("input");y.type="range",y.className="tf-ctl-scrub",y.min="0",y.max="1000",y.step="1",y.setAttribute("aria-label",s.scrub),y.addEventListener("input",()=>{i.pause(),i.seek(Number(y.value)/1e3*i.duration)});const b=n.createElement("span");b.className="tf-ctl-step";const w=n.createElement("select");w.className="tf-ctl-speed",w.setAttribute("aria-label",s.speed);for(const E of r){const R=n.createElement("option");R.value=String(E),R.textContent=`${E}×`,E===1&&(R.selected=!0),w.appendChild(R)}w.addEventListener("change",()=>i.setSpeed(Number(w.value))),l.append(f,u,d,m,y,b),r.length>0&&l.append(w),c.append(l);const v=e.fullscreen?ta(t,n,s):void 0;v&&l.append(v.button);const k=n.createElement("p");k.className="tf-ctl-caption",k.setAttribute("aria-live","polite"),e.captions!==!1&&c.append(k);const T=n.createElement("div");T.className="tf-ctl-question",T.hidden=!0;const S=n.createElement("span"),A=h(s.reveal,s.reveal,()=>i.play(),"tf-ctl-primary");T.append(S,A),c.append(T);const I=Qo(i,n,s.scenario,e.scenarioControl??"buttons");I&&c.append(I.element);const O=e.mount;O?O.appendChild(c):t.insertAdjacentElement("afterend",c);const x=()=>{const E=i.isPlaying;d.textContent=E?"❚❚":"▶",d.setAttribute("aria-label",E?s.pause:s.play),d.title=E?s.pause:s.play;const R=i.duration;n.activeElement!==y&&(y.value=String(R>0?Math.round(i.currentTime/R*1e3):0));const D=i.markers;if(u.hidden=m.hidden=b.hidden=D.length===0,D.length>0){const q=i.currentMarker,N=q?D.indexOf(q)+1:0;b.textContent=s.stepFormat.replace("{index}",String(N)).replace("{total}",String(D.length)),b.setAttribute("aria-label",`${s.step} ${N} ${s.of} ${D.length}`),u.disabled=i.currentTime<=.5,m.disabled=i.currentTime>=R-.5;const L=i.caption()??"";k.textContent!==L&&(k.textContent=L),k.hidden=!a();const B=!E&&q?.question!==void 0&&Math.abs(i.currentTime-q.time)<1;T.hidden=!B,B&&S.textContent!==q.question&&(S.textContent=q.question)}else T.hidden=!0,k.hidden=!0;I?.update()},M=i.subscribe(x);x();const C=e.keyboardScope??t;!C.hasAttribute("tabindex")&&C.tabIndex<0&&(C.tabIndex=0);const P=new WeakSet,_=E=>{if(P.has(E)||(P.add(E),E.defaultPrevented||E.altKey||E.ctrlKey||E.metaKey))return;const R=E.target;if(!(R.tagName==="INPUT"||R.tagName==="SELECT")&&!(E.key===" "&&R.tagName==="BUTTON"))switch(E.key){case" ":E.preventDefault(),i.isPlaying?i.pause():p();break;case"ArrowRight":if(!o())return;E.preventDefault(),i.next();break;case"ArrowLeft":if(!o())return;E.preventDefault(),i.prev();break;case"Home":E.preventDefault(),i.pause(),i.seek(0);break;case"f":case"F":if(!v)return;E.preventDefault(),v.active?v.exit():v.enter();break}};return C.addEventListener("keydown",_),c.addEventListener("keydown",_),{element:c,fullscreen:v&&{get active(){return v.active},enter:v.enter,exit:v.exit},destroy(){v?.destroy(),M(),C.removeEventListener("keydown",_),c.removeEventListener("keydown",_),c.remove()}}}function Qo(i,t,e,n){const s=i.scenarios;if(s.length<2)return;if(n==="slider"){const h=t.createElement("div");h.className="tf-ctl-choice-slider";const f=t.createElement("span");f.textContent=e,f.setAttribute("aria-hidden","true");const u=t.createElement("input");u.type="range",u.min="0",u.max=String(s.length-1),u.step="1",u.setAttribute("aria-label",e);const d=t.createElement("output");return d.setAttribute("aria-hidden","true"),u.addEventListener("input",()=>{const p=s[Number(u.value)];p&&i.setScenario(p.id)}),h.append(f,u,d),{element:h,update:()=>{const p=Math.max(0,s.findIndex(b=>b.id===i.scenario));t.activeElement!==u&&(u.value=String(p));const y=s[p].label;d.textContent!==y&&(d.textContent=y),u.setAttribute("aria-valuetext",y)}}}const r=t.createElement("fieldset");r.className="tf-ctl-choices";const o=t.createElement("legend");o.textContent=e,r.append(o);const a=`tf-ctl-scenario-${++Go}`,c=s.map(h=>{const f=t.createElement("label");f.className="tf-ctl-choice";const u=t.createElement("input");u.type="radio",u.name=a,u.value=h.id,u.addEventListener("change",()=>{u.checked&&i.setScenario(h.id)});const d=t.createElement("span");return d.textContent=h.label,f.append(u,d),r.append(f),u});return{element:r,update:()=>{for(const h of c){const f=h.value===i.scenario;h.checked!==f&&(h.checked=f)}}}}const Zo='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>',Jo='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></svg>';function ta(i,t,e){const n=t,s=i,r=t.createElement("button");r.type="button",r.className="tf-ctl-btn tf-ctl-fullscreen";let o,a="";const c=()=>{const p=o!==void 0;r.innerHTML=p?Jo:Zo;const y=p?e.exitFullscreen:e.fullscreen;r.setAttribute("aria-label",y),r.title=y,r.setAttribute("aria-pressed",String(p)),i.classList.toggle("tf-fullscreen",p),i.classList.toggle("tf-fullscreen-overlay",o==="overlay")},l=()=>n.fullscreenElement??n.webkitFullscreenElement??null,h=()=>{l()===i?o="native":o==="native"&&(o=void 0),c()},f=p=>{p.key==="Escape"&&m()},u=()=>{o="overlay",a=t.documentElement.style.overflow,t.documentElement.style.overflow="hidden",t.addEventListener("keydown",f),c()};async function d(){if(o)return;const p=s.requestFullscreen?.bind(s)??s.webkitRequestFullscreen?.bind(s),y=n.fullscreenEnabled??n.webkitFullscreenEnabled??!1;if(p&&y)try{if(await p(),l()===i){o="native",c();return}}catch{}u()}async function m(){if(o==="overlay")t.removeEventListener("keydown",f),t.documentElement.style.overflow=a,o=void 0,c();else if(o==="native"){o=void 0,c();const p=n.exitFullscreen?.bind(n)??n.webkitExitFullscreen?.bind(n);l()===i&&p&&await p()}}return r.addEventListener("click",()=>{o?m():d()}),t.addEventListener("fullscreenchange",h),t.addEventListener("webkitfullscreenchange",h),c(),{button:r,get active(){return o!==void 0},enter:d,exit:m,destroy(){m(),t.removeEventListener("fullscreenchange",h),t.removeEventListener("webkitfullscreenchange",h),r.remove()}}}const ts="tinyfly-choices-style",ea=`
|
|
51
51
|
[data-tinyfly-choose] { cursor: pointer; }
|
|
52
52
|
[data-tinyfly-choose]:focus-visible { outline: 2px solid var(--tf-ctl-accent, #c2410c); outline-offset: 2px; }
|
|
53
|
-
`;function Oo(i){if(i.getElementById(Gn))return;const t=i.createElement("style");t.id=Gn,t.textContent=Do,i.head.appendChild(t)}function Kn(i,t){const e=Array.from(t.querySelectorAll("[data-tinyfly-choose]"));if(e.length===0)return()=>{};Oo(t.ownerDocument);const n=[],s=[];for(const a of e){const c=a.getAttribute("data-tinyfly-choose")??"",l=[],h=(m,p)=>{a.hasAttribute(m)||(a.setAttribute(m,p),l.push(m))};h("role","button"),h("tabindex","0");const f=i.scenarios.find(m=>m.id===c)?.label;f!==void 0&&h("aria-label",f),a.setAttribute("aria-pressed","false"),l.push("aria-pressed"),n.push({element:a,attributes:l});const u=()=>i.setScenario(c),d=m=>{const p=m.key;p!=="Enter"&&p!==" "||(m.preventDefault(),u())};a.addEventListener("click",u),a.addEventListener("keydown",d),s.push(()=>{a.removeEventListener("click",u),a.removeEventListener("keydown",d)})}const r=()=>{for(const{element:a}of n)a.setAttribute("aria-pressed",String(a.getAttribute("data-tinyfly-choose")===i.scenario))},o=i.subscribe(r);return r(),()=>{o();for(const a of s)a();for(const{element:a,attributes:c}of n)for(const l of c)a.removeAttribute(l)}}const Kt=new WeakMap,Ue=new WeakMap;let No=0;function Ct(i,t,e){if(i)try{return JSON.parse(i)}catch(n){console.warn(`tinyfly: invalid ${t} JSON on`,e,n);return}}async function Qn(i,t={}){const e=Kt.get(i);if(e)return e;const n=Array.from(i.querySelectorAll("script[data-tinyfly-timeline]")),s=n[0],r=i.getAttribute("data-src"),o=qo(i.getAttribute("data-markers")),a=n.length>1||s?.hasAttribute("data-scenario")?Bo(n,o,i):void 0;if(a&&a.length===0)return;let c=s&&!a?Ct(s.textContent,"timeline",i):void 0;if(!c&&r&&o){const d=await fetch(r);d.ok&&(c=await d.json())}if(c&&o&&(c=Zn(c,o)),!c&&!r&&!a){console.warn('tinyfly: embed has no timeline (a <script type="application/json" data-tinyfly-timeline> or data-src)',i);return}const l=Ct(i.querySelector("script[data-tinyfly-captions]")?.textContent,"captions",i),h={playWhenVisible:!0,...t.player,...l&&{captions:l},...Ct(i.getAttribute("data-options"),"data-options",i)};Yo(i);const f=new Gt(i,h),u={element:i,player:f};if(Kt.set(i,u),i.setAttribute("data-tinyfly-mounted",""),a){const d=i.getAttribute("data-scenario")??void 0;await f.loadScenarios(a,{initial:a.some(m=>m.id===d)?d:void 0}),Ue.set(i,Kn(f,i))}else await f.load(c??r);if(i.getAttribute("data-controls")!=="false"){const d=Ct(i.getAttribute("data-labels"),"data-labels",i),m=i.querySelector("figcaption"),p=i.getAttribute("data-scenario-legend"),y=i.getAttribute("data-scenario-control");u.controls=Hn(f,i,{...t.controls,...i.getAttribute("data-fullscreen")==="true"?{fullscreen:!0}:{},...y==="slider"||y==="buttons"?{scenarioControl:y}:{},labels:{...t.controls?.labels,...d,...p?{scenario:p}:{}},mount:void 0}),m?i.insertBefore(u.controls.element,m):i.appendChild(u.controls.element)}return u}function Bo(i,t,e){const n=[];return i.forEach((s,r)=>{const o=Ct(s.textContent,"timeline",e);if(!o)return;const a=s.getAttribute("data-scenario")||`scenario-${r+1}`;if(n.some(l=>l.id===a)){console.warn(`tinyfly: scenario id "${a}" is used more than once; the later one is skipped`,e);return}const c=s.getAttribute("data-scenario-label")??void 0;n.push({id:a,label:c,timeline:t?Zn(o,t):o})}),n}function Zn(i,t){return i.config.markers?.length?i:{...i,config:{...i.config,markers:t.map((e,n)=>({id:`step-${n+1}`,time:e}))}}}function qo(i){if(!i)return;const t=i.split(/[\s,]+/).filter(Boolean).map(Number).filter(e=>Number.isFinite(e)&&e>=0).sort((e,n)=>e-n);return t.length>0?t:void 0}async function Jn(i=document,t={}){const e=Array.from(i.querySelectorAll("[data-tinyfly-embed]"));return(await Promise.all(e.map(s=>Qn(s,t)))).filter(s=>s!==void 0)}function Xo(i){const t=Kt.get(i);t&&(Ue.get(i)?.(),Ue.delete(i),t.controls?.destroy(),t.player.destroy(),Kt.delete(i),i.removeAttribute("data-tinyfly-mounted"))}function Yo(i){const t=i.querySelector("svg");if(!t||t.hasAttribute("role")||t.hasAttribute("aria-hidden"))return;const e=i.getAttribute("data-alt"),n=i.querySelector("figcaption");t.setAttribute("role","img"),e?t.setAttribute("aria-label",e):n&&(n.id||=`tinyfly-caption-${++No}`,t.setAttribute("aria-labelledby",n.id))}function Vo(){if(!(typeof document<"u"?document.currentScript:null)?.hasAttribute("data-tinyfly-auto"))return;const t=()=>{Jn()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}class ts{container;containerA;containerB;adapterA;adapterB;timelineA=null;timelineB=null;symbolDefs=new Map;nestedByAdapter=new Map;sequence=null;options;_currentSceneIndex=0;_state="idle";_isPlaying=!1;_isDestroyed=!1;loopIteration=0;animationFrameId;lastTime;transitionTimer;constructor(t,e={}){if(typeof t=="string"){const n=document.querySelector(t);if(!n)throw new Error(`Container not found: ${t}`);this.container=n}else this.container=t;this.options=e,this.container.style.position="relative",this.container.style.overflow="hidden",this.containerA=this.createSceneContainer(),this.containerB=this.createSceneContainer(),this.container.appendChild(this.containerA),this.container.appendChild(this.containerB),this.containerB.style.visibility="hidden",this.adapterA=new et,this.adapterB=new et}async load(t){let e;if(typeof t=="string"){const n=await fetch(t);if(!n.ok)throw new Error(`Failed to load sequence: ${n.statusText}`);e=await n.json()}else e=t;this.sequence=e,this.symbolDefs.clear();for(const n of e.symbols??[])n.timeline?.tracks?.length&&this.symbolDefs.set(n.id,n.timeline);this.container.style.width=`${e.canvas.width}px`,this.container.style.height=`${e.canvas.height}px`,e.scenes.length>0&&(this.renderScene(e.scenes[0],this.containerA,this.adapterA),this.timelineA=this.createTimeline(e.scenes[0])),this.options.autoplay&&this.play()}play(){if(!(!this.sequence||this._isDestroyed)&&this.sequence.scenes.length!==0){if(this._isPlaying=!0,this._state==="idle"){if(this._state="playing-scene",this._currentSceneIndex=0,this.timelineA)this.timelineA.onComplete=()=>this.onSceneComplete(),this.timelineA.play();else{this.onSceneComplete();return}this.options.onSceneChange?.(0)}else this._state==="playing-scene"&&this.timelineA&&this.timelineA.play();this.startAnimationLoop()}}pause(){this._isPlaying&&(this._isPlaying=!1,this.timelineA&&this.timelineA.pause(),this.timelineB&&this.timelineB.pause(),this.stopAnimationLoop())}stop(){if(this._isPlaying=!1,this._state="idle",this._currentSceneIndex=0,this.loopIteration=0,this.transitionTimer!==void 0&&(clearTimeout(this.transitionTimer),this.transitionTimer=void 0),this.timelineA&&this.timelineA.stop(),this.timelineB&&this.timelineB.stop(),this.stopAnimationLoop(),this.sequence&&this.sequence.scenes.length>0&&(this.clearContainer(this.containerA),this.clearContainer(this.containerB),this.adapterA.clearTargets(),this.adapterB.clearTargets(),this.containerB.style.visibility="hidden",this.resetTransitionStyles(this.containerA),this.resetTransitionStyles(this.containerB),this.renderScene(this.sequence.scenes[0],this.containerA,this.adapterA),this.timelineA=this.createTimeline(this.sequence.scenes[0]),this.timelineA)){const t=this.timelineA.getStateAtTime(0);this.adapterA.applyState(t),this.applyNested(this.adapterA,0)}}goToScene(t){if(!this.sequence||t<0||t>=this.sequence.scenes.length)return;const e=this._isPlaying;this.transitionTimer!==void 0&&(clearTimeout(this.transitionTimer),this.transitionTimer=void 0),this.stopAnimationLoop(),this.timelineA&&this.timelineA.stop(),this.timelineB&&this.timelineB.stop(),this._currentSceneIndex=t,this._state=e?"playing-scene":"idle",this.clearContainer(this.containerA),this.clearContainer(this.containerB),this.adapterA.clearTargets(),this.adapterB.clearTargets(),this.containerB.style.visibility="hidden",this.resetTransitionStyles(this.containerA),this.resetTransitionStyles(this.containerB);const n=this.sequence.scenes[t];if(this.renderScene(n,this.containerA,this.adapterA),this.timelineA=this.createTimeline(n),this.options.onSceneChange?.(t),e)this.timelineA?(this.timelineA.onComplete=()=>this.onSceneComplete(),this.timelineA.play(),this.startAnimationLoop()):this.onSceneComplete();else if(this.timelineA){const s=this.timelineA.getStateAtTime(0);this.adapterA.applyState(s),this.applyNested(this.adapterA,0)}}destroy(){this._isDestroyed=!0,this._isPlaying=!1,this.transitionTimer!==void 0&&(clearTimeout(this.transitionTimer),this.transitionTimer=void 0),this.stopAnimationLoop(),this.adapterA.clearTargets(),this.adapterB.clearTargets();for(const t of this.nestedByAdapter.values())for(const e of t)e.adapter.clearTargets();this.nestedByAdapter.clear(),this.timelineA&&this.timelineA.stop(),this.timelineB&&this.timelineB.stop(),this.timelineA=null,this.timelineB=null,this.containerA.parentNode&&this.containerA.remove(),this.containerB.parentNode&&this.containerB.remove(),this.sequence=null}get currentSceneIndex(){return this._currentSceneIndex}get sceneCount(){return this.sequence?.scenes.length??0}get isPlaying(){return this._isPlaying}get state(){return this._state}createSceneContainer(){const t=document.createElement("div");return t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t}renderScene(t,e,n){e.innerHTML="",n.clearTargets();const s=document.createElement("div");s.style.cssText="position:absolute;inset:0;transform-origin:center center",s.setAttribute("data-tinyfly","Camera"),e.appendChild(s),n.registerTarget("Camera",s);for(const r of t.elements){if(!r.html)continue;const o=document.createElement("div");o.innerHTML=r.html.trim();const a=o.firstElementChild;if(a){s.appendChild(a);const c=a.getAttribute("data-tinyfly");c&&n.registerTarget(c,a)}}this.setupNested(s,n)}setupNested(t,e){const n=[];t.querySelectorAll("[data-tinyfly-symbol]").forEach(s=>{const r=s.getAttribute("data-tinyfly-symbol");if(!r)return;const o=this.symbolDefs.get(r);if(!o)return;const a=new et;s.querySelectorAll("[data-tinyfly]").forEach(c=>{const l=c.getAttribute("data-tinyfly");l&&a.registerTarget(l,c)}),n.push({adapter:a,timeline:ct(o)})}),n.length?this.nestedByAdapter.set(e,n):this.nestedByAdapter.delete(e)}applyNested(t,e){const n=this.nestedByAdapter.get(t);if(n)for(const s of n){const r=s.timeline.duration;s.adapter.applyState(s.timeline.getStateAtTime(r>0?e%r:e))}}clearContainer(t){t.innerHTML=""}createTimeline(t){return t.timeline?ct(t.timeline):null}onSceneComplete(){if(this._isDestroyed||!this.sequence)return;const t=this._currentSceneIndex+1;if(t>=this.sequence.scenes.length){const e=this.options.loop??this.sequence.loop??0;e===-1||e>0&&this.loopIteration<e-1?(this.loopIteration++,this.beginTransitionTo(0)):(this._isPlaying=!1,this._state="idle",this.stopAnimationLoop(),this.options.onComplete?.())}else this.beginTransitionTo(t)}beginTransitionTo(t){if(!this.sequence||this._isDestroyed)return;const e=this.sequence.scenes[t],n=e.transition;if(n.type==="none"||n.duration<=0){this.switchToScene(t);return}this._state="transitioning",this.containerB.style.visibility="visible",this.renderScene(e,this.containerB,this.adapterB),this.timelineB=this.createTimeline(e),this.timelineB&&this.timelineB.play(),this.applyTransition(n.type,n.duration),this.transitionTimer=window.setTimeout(()=>{this.finishTransition(t)},n.duration)}applyTransition(t,e){const n=`${e}ms`,s="ease-in-out";switch(this.resetTransitionStyles(this.containerA),this.resetTransitionStyles(this.containerB),t){case"fade":this.containerB.style.opacity="0";break;case"slide-left":this.containerB.style.transform="translateX(100%)";break;case"slide-right":this.containerB.style.transform="translateX(-100%)";break;case"slide-up":this.containerB.style.transform="translateY(100%)";break;case"slide-down":this.containerB.style.transform="translateY(-100%)";break}switch(this.containerB.offsetHeight,this.containerA.style.transition=`opacity ${n} ${s}, transform ${n} ${s}`,this.containerB.style.transition=`opacity ${n} ${s}, transform ${n} ${s}`,t){case"fade":this.containerA.style.opacity="0",this.containerB.style.opacity="1";break;case"slide-left":this.containerA.style.transform="translateX(-100%)",this.containerB.style.transform="translateX(0)";break;case"slide-right":this.containerA.style.transform="translateX(100%)",this.containerB.style.transform="translateX(0)";break;case"slide-up":this.containerA.style.transform="translateY(-100%)",this.containerB.style.transform="translateY(0)";break;case"slide-down":this.containerA.style.transform="translateY(100%)",this.containerB.style.transform="translateY(0)";break}}resetTransitionStyles(t){t.style.transition="",t.style.opacity="1",t.style.transform=""}finishTransition(t){this.transitionTimer=void 0,this.timelineA&&(this.timelineA.stop(),this.timelineA=null),this.adapterA.clearTargets(),this.clearContainer(this.containerA);const e=this.containerA;this.containerA=this.containerB,this.containerB=e;const n=this.adapterA;this.adapterA=this.adapterB,this.adapterB=n,this.timelineA=this.timelineB,this.timelineB=null,this.containerB.style.visibility="hidden",this.resetTransitionStyles(this.containerA),this.resetTransitionStyles(this.containerB),this._currentSceneIndex=t,this._state="playing-scene",this.options.onSceneChange?.(t),this.timelineA?(this.timelineA.onComplete=()=>this.onSceneComplete(),this.timelineA.playbackState!=="playing"&&this.timelineA.play()):this.onSceneComplete()}switchToScene(t){if(!this.sequence||this._isDestroyed)return;this.timelineA&&this.timelineA.stop(),this.adapterA.clearTargets(),this.clearContainer(this.containerA);const e=this.sequence.scenes[t];this.renderScene(e,this.containerA,this.adapterA),this.timelineA=this.createTimeline(e),this._currentSceneIndex=t,this._state="playing-scene",this.options.onSceneChange?.(t),this.timelineA?(this.timelineA.onComplete=()=>this.onSceneComplete(),this.timelineA.play()):this.onSceneComplete()}startAnimationLoop(){if(this.animationFrameId!==void 0)return;this.lastTime=performance.now();const t=e=>{if(this._isDestroyed||!this._isPlaying)return;const n=e-(this.lastTime??e);if(this.lastTime=e,this.timelineA&&this.timelineA.playbackState==="playing"){this.timelineA.tick(n);const s=this.timelineA.getStateAtTime(this.timelineA.currentTime);this.adapterA.applyState(s),this.applyNested(this.adapterA,this.timelineA.currentTime)}if(this._state==="transitioning"&&this.timelineB&&this.timelineB.playbackState==="playing"){this.timelineB.tick(n);const s=this.timelineB.getStateAtTime(this.timelineB.currentTime);this.adapterB.applyState(s),this.applyNested(this.adapterB,this.timelineB.currentTime)}this._isPlaying?this.animationFrameId=requestAnimationFrame(t):this.animationFrameId=void 0};this.animationFrameId=requestAnimationFrame(t)}stopAnimationLoop(){this.animationFrameId!==void 0&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}}async function Wo(i,t,e={}){const n=new ts(i,{...e,autoplay:!0});return await n.load(t),n}const Uo={type:"none",duration:0};function jo(i){const{timeline:t}=i,e=new et;for(const[l,h]of Object.entries(i.targets)){const f=typeof h=="string"?document.querySelector(h):h;if(!f)throw new Error(`quickPlay: no element found for target "${l}" (${String(h)})`);e.registerTarget(l,f)}t.onUpdate=l=>{e.applyState(l),i.onUpdate?.(l)},i.onComplete&&(t.onComplete=i.onComplete);let n=null,s=null,r=!1;const o=l=>{if(r)return;const h=s===null?0:l-s;s=l,h>0&&t.tick(h),n=requestAnimationFrame(o)},a=()=>{n!==null||r||(s=null,n=requestAnimationFrame(o))},c=()=>{n!==null&&cancelAnimationFrame(n),n=null,s=null};return e.applyState(t.getStateAtTime(t.currentTime)),i.autoplay!==!1&&(t.play(),a()),{timeline:t,adapter:e,play(){t.play(),a()},pause(){t.pause(),c()},restart(){t.stop(),t.play(),a()},seek(l){t.seek(l*1e3),e.applyState(t.getStateAtTime(t.currentTime))},destroy(){r=!0,c(),t.stop(),e.clearTargets()}}}const zo={timeline:vr,to(i,t,e){const n=new tt(e);return n.to(i,t),n},from(i,t,e){const n=new tt(e);return n.from(i,t),n},fromTo(i,t,e,n){const s=new tt(n);return s.fromTo(i,t,e),s},set(i,t,e){const n=new tt(e);return n.set(i,t),n}},Ho=q.to,Go=q.from,Ko=q.fromTo,Qo=q.set,Zo=q.timeline,Jo=q.ticker,ta=q.splitText,ea=q.context,ia=q.matchMedia,na=q.quickTo,sa=q.imageSequence,ra=q.pageTransition;Vo(),g.Clock=ns,g.CompatTimeline=tt,g.CustomBounce=Dn,g.CustomEase=$n,g.CustomWiggle=On,g.DEFAULT_BAKE_INTERVAL_MS=fe,g.DEFAULT_INERTIA_FRICTION=ie,g.DEFAULT_LABELS=jn,g.DEFAULT_SPRING=Y,g.DEFAULT_TRANSITION=Uo,g.Draggable=_e,g.FORMAT_VERSION=mt,g.INERTIA_MAX_DURATION_MS=Ke,g.InertiaTrackPlayer=Ri,g.LiveTimeline=z,g.MORPH_SAMPLES=As,g.ManualClock=is,g.MediaSync=We,g.Observer=fn,g.SPRING_MAX_DURATION_MS=ee,g.SPRING_PRESETS=$t,g.SPRING_STEP_MS=it,g.ScrollAnimator=Pn,g.ScrollDriver=Et,g.ScrollMarkers=Cn,g.ScrollPin=Mn,g.SmoothScroll=Xe,g.SpringSampler=yt,g.SpringTrackPlayer=Ii,g.Stage=on,g.Timeline=be,g.TinyflyPlayer=Gt,g.TinyflySequencer=ts,g.TrackPlayer=Yt,g.ValueResolver=Hs,g.VisibilityDriver=Sn,g.backOut=oi,g.bakeEasing=me,g.bakeInertiaTrack=pe,g.bakeSpringTrack=de,g.bindChoiceHotspots=Kn,g.bounceOut=ri,g.charactersFor=Li,g.clamp01=Oe,g.clearMorphCache=Fs,g.clearPathCache=ws,g.containerProgressAt=Ne,g.context=ea,g.create=Po,g.createControls=Hn,g.createCubicBezier=ni,g.createLive=qn,g.createRandom=Bi,g.createTrack=Xt,g.criticalDamping=os,g.customBounce=Ui,g.customEase=Wi,g.customWiggle=ji,g.deserializeTimeline=ct,g.deserializeTrack=Oi,g.draggable=qr,g.easeIn=ti,g.easeInCubic=ne,g.easeInOut=ii,g.easeInOutCubic=vt,g.easeInOutQuad=Je,g.easeInQuad=Qe,g.easeOut=ei,g.easeOutCubic=se,g.easeOutQuad=Ze,g.elasticOut=si,g.expandParametricEasings=Ci,g.from=Go,g.fromJSON=Ws,g.fromTo=Ko,g.getEasingFunction=V,g.getInterpolator=St,g.getMotionPathPoint=ge,g.getPathLength=Ts,g.getPointAtProgress=ui,g.gridLinesFor=mn,g.hasKeyframes=He,g.hashSeed=Us,g.imageSequence=sa,g.inertiaDuration=st,g.inertiaRest=nt,g.inertiaValueAt=Ot,g.inertiaVelocityAt=hs,g.interpolateArray=xi,g.interpolateColor=Ai,g.interpolateMotionPath=Bs,g.interpolateNumber=W,g.interpolatePathString=Ei,g.interpolateString=ue,g.isCubicBezierEasing=ze,g.isInertiaTrack=H,g.isMotionPathPoint=es,g.isMotionPathTrack=Zt,g.isParametricEasing=pt,g.isPathData=ot,g.isSpringTrack=G,g.isTextTrack=It,g.isUnderdamped=rs,g.isUnresolved=zs,g.linear=Nt,g.live=q,g.mapEase=Mt,g.matchMedia=ia,g.maxStaggerDistance=te,g.morphPath=bi,g.mount=Qn,g.mountAll=Jn,g.naturalRest=bt,g.pageTransition=ra,g.parametricEasing=ci,g.parseEdge=$e,g.parsePath=J,g.parseTrigger=De,g.play=Eo,g.playSequence=Wo,g.playWhenVisible=Jr,g.playheadCrossings=ve,g.pointAtDistance=oe,g.pointsToPath=Hi,g.quickPlay=jo,g.quickTo=na,g.randomBetween=Te,g.randomChoice=js,g.randomSnapped=qi,g.resolveSequence=Vi,g.resolveValue=ke,g.scrollProgress=Zr,g.scrubOnScroll=no,g.serializeTimeline=Ni,g.serializeTrack=$i,g.set=Qo,g.shapeToPathData=Vt,g.simplifyKeyframes=_i,g.smoothToward=kn,g.snapAxis=pn,g.snapConfig=An,g.snapDuration=En,g.snapProgress=xn,g.splitText=ta,g.springDuration=Ge,g.springValueAt=ss,g.staggerDistance=Jt,g.staggerOffset=Rt,g.staggerOffsets=Lt,g.staggerSpan=gt,g.stepsEasing=ai,g.syncMediaElement=Un,g.textAt=Fi,g.tf=zo,g.ticker=Jo,g.timeline=Zo,g.to=Ho,g.toJSON=Vs,g.toKeyframedTrack=Os,g.toKeyframedTracks=Ns,g.trackTargets=Z,g.triggerDistance=lt,g.unmount=Xo,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})})(this.tinyfly=this.tinyfly||{});
|
|
53
|
+
`;function ia(i){if(i.getElementById(ts))return;const t=i.createElement("style");t.id=ts,t.textContent=ea,i.head.appendChild(t)}function es(i,t){const e=Array.from(t.querySelectorAll("[data-tinyfly-choose]"));if(e.length===0)return()=>{};ia(t.ownerDocument);const n=[],s=[];for(const a of e){const c=a.getAttribute("data-tinyfly-choose")??"",l=[],h=(m,p)=>{a.hasAttribute(m)||(a.setAttribute(m,p),l.push(m))};h("role","button"),h("tabindex","0");const f=i.scenarios.find(m=>m.id===c)?.label;f!==void 0&&h("aria-label",f),a.setAttribute("aria-pressed","false"),l.push("aria-pressed"),n.push({element:a,attributes:l});const u=()=>i.setScenario(c),d=m=>{const p=m.key;p!=="Enter"&&p!==" "||(m.preventDefault(),u())};a.addEventListener("click",u),a.addEventListener("keydown",d),s.push(()=>{a.removeEventListener("click",u),a.removeEventListener("keydown",d)})}const r=()=>{for(const{element:a}of n)a.setAttribute("aria-pressed",String(a.getAttribute("data-tinyfly-choose")===i.scenario))},o=i.subscribe(r);return r(),()=>{o();for(const a of s)a();for(const{element:a,attributes:c}of n)for(const l of c)a.removeAttribute(l)}}const te=new WeakMap,Ke=new WeakMap;let na=0;function Lt(i,t,e){if(i)try{return JSON.parse(i)}catch(n){console.warn(`tinyfly: invalid ${t} JSON on`,e,n);return}}async function is(i,t={}){const e=te.get(i);if(e)return e;const n=Array.from(i.querySelectorAll("script[data-tinyfly-timeline]")),s=n[0],r=i.getAttribute("data-src"),o=ra(i.getAttribute("data-markers")),a=n.length>1||s?.hasAttribute("data-scenario")?sa(n,o,i):void 0;if(a&&a.length===0)return;let c=s&&!a?Lt(s.textContent,"timeline",i):void 0;if(!c&&r&&o){const d=await fetch(r);d.ok&&(c=await d.json())}if(c&&o&&(c=ns(c,o)),!c&&!r&&!a){console.warn('tinyfly: embed has no timeline (a <script type="application/json" data-tinyfly-timeline> or data-src)',i);return}const l=Lt(i.querySelector("script[data-tinyfly-captions]")?.textContent,"captions",i),h={playWhenVisible:!0,...t.player,...l&&{captions:l},...Lt(i.getAttribute("data-options"),"data-options",i)};aa(i);const f=new Jt(i,h),u={element:i,player:f};if(te.set(i,u),i.setAttribute("data-tinyfly-mounted",""),a){const d=i.getAttribute("data-scenario")??void 0;await f.loadScenarios(a,{initial:a.some(m=>m.id===d)?d:void 0}),Ke.set(i,es(f,i))}else await f.load(c??r);if(i.getAttribute("data-controls")!=="false"){const d=Lt(i.getAttribute("data-labels"),"data-labels",i),m=i.querySelector("figcaption"),p=i.getAttribute("data-scenario-legend"),y=i.getAttribute("data-scenario-control");u.controls=Jn(f,i,{...t.controls,...i.getAttribute("data-fullscreen")==="true"?{fullscreen:!0}:{},...y==="slider"||y==="buttons"?{scenarioControl:y}:{},labels:{...t.controls?.labels,...d,...p?{scenario:p}:{}},mount:void 0}),m?i.insertBefore(u.controls.element,m):i.appendChild(u.controls.element)}return u}function sa(i,t,e){const n=[];return i.forEach((s,r)=>{const o=Lt(s.textContent,"timeline",e);if(!o)return;const a=s.getAttribute("data-scenario")||`scenario-${r+1}`;if(n.some(l=>l.id===a)){console.warn(`tinyfly: scenario id "${a}" is used more than once; the later one is skipped`,e);return}const c=s.getAttribute("data-scenario-label")??void 0;n.push({id:a,label:c,timeline:t?ns(o,t):o})}),n}function ns(i,t){return i.config.markers?.length?i:{...i,config:{...i.config,markers:t.map((e,n)=>({id:`step-${n+1}`,time:e}))}}}function ra(i){if(!i)return;const t=i.split(/[\s,]+/).filter(Boolean).map(Number).filter(e=>Number.isFinite(e)&&e>=0).sort((e,n)=>e-n);return t.length>0?t:void 0}async function ss(i=document,t={}){const e=Array.from(i.querySelectorAll("[data-tinyfly-embed]"));return(await Promise.all(e.map(s=>is(s,t)))).filter(s=>s!==void 0)}function oa(i){const t=te.get(i);t&&(Ke.get(i)?.(),Ke.delete(i),t.controls?.destroy(),t.player.destroy(),te.delete(i),i.removeAttribute("data-tinyfly-mounted"))}function aa(i){const t=i.querySelector("svg");if(!t||t.hasAttribute("role")||t.hasAttribute("aria-hidden"))return;const e=i.getAttribute("data-alt"),n=i.querySelector("figcaption");t.setAttribute("role","img"),e?t.setAttribute("aria-label",e):n&&(n.id||=`tinyfly-caption-${++na}`,t.setAttribute("aria-labelledby",n.id))}function ca(){if(!(typeof document<"u"?document.currentScript:null)?.hasAttribute("data-tinyfly-auto"))return;const t=()=>{ss()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}class rs{container;containerA;containerB;adapterA;adapterB;timelineA=null;timelineB=null;symbolDefs=new Map;nestedByAdapter=new Map;sequence=null;options;_currentSceneIndex=0;_state="idle";_isPlaying=!1;_isDestroyed=!1;loopIteration=0;animationFrameId;lastTime;transitionTimer;constructor(t,e={}){if(typeof t=="string"){const n=document.querySelector(t);if(!n)throw new Error(`Container not found: ${t}`);this.container=n}else this.container=t;this.options=e,this.container.style.position="relative",this.container.style.overflow="hidden",this.containerA=this.createSceneContainer(),this.containerB=this.createSceneContainer(),this.container.appendChild(this.containerA),this.container.appendChild(this.containerB),this.containerB.style.visibility="hidden",this.adapterA=new st,this.adapterB=new st}async load(t){let e;if(typeof t=="string"){const n=await fetch(t);if(!n.ok)throw new Error(`Failed to load sequence: ${n.statusText}`);e=await n.json()}else e=t;this.sequence=e,this.symbolDefs.clear();for(const n of e.symbols??[])n.timeline?.tracks?.length&&this.symbolDefs.set(n.id,n.timeline);this.container.style.width=`${e.canvas.width}px`,this.container.style.height=`${e.canvas.height}px`,e.scenes.length>0&&(this.renderScene(e.scenes[0],this.containerA,this.adapterA),this.timelineA=this.createTimeline(e.scenes[0])),this.options.autoplay&&this.play()}play(){if(!(!this.sequence||this._isDestroyed)&&this.sequence.scenes.length!==0){if(this._isPlaying=!0,this._state==="idle"){if(this._state="playing-scene",this._currentSceneIndex=0,this.timelineA)this.timelineA.onComplete=()=>this.onSceneComplete(),this.timelineA.play();else{this.onSceneComplete();return}this.options.onSceneChange?.(0)}else this._state==="playing-scene"&&this.timelineA&&this.timelineA.play();this.startAnimationLoop()}}pause(){this._isPlaying&&(this._isPlaying=!1,this.timelineA&&this.timelineA.pause(),this.timelineB&&this.timelineB.pause(),this.stopAnimationLoop())}stop(){if(this._isPlaying=!1,this._state="idle",this._currentSceneIndex=0,this.loopIteration=0,this.transitionTimer!==void 0&&(clearTimeout(this.transitionTimer),this.transitionTimer=void 0),this.timelineA&&this.timelineA.stop(),this.timelineB&&this.timelineB.stop(),this.stopAnimationLoop(),this.sequence&&this.sequence.scenes.length>0&&(this.clearContainer(this.containerA),this.clearContainer(this.containerB),this.adapterA.clearTargets(),this.adapterB.clearTargets(),this.containerB.style.visibility="hidden",this.resetTransitionStyles(this.containerA),this.resetTransitionStyles(this.containerB),this.renderScene(this.sequence.scenes[0],this.containerA,this.adapterA),this.timelineA=this.createTimeline(this.sequence.scenes[0]),this.timelineA)){const t=this.timelineA.getStateAtTime(0);this.adapterA.applyState(t),this.applyNested(this.adapterA,0)}}goToScene(t){if(!this.sequence||t<0||t>=this.sequence.scenes.length)return;const e=this._isPlaying;this.transitionTimer!==void 0&&(clearTimeout(this.transitionTimer),this.transitionTimer=void 0),this.stopAnimationLoop(),this.timelineA&&this.timelineA.stop(),this.timelineB&&this.timelineB.stop(),this._currentSceneIndex=t,this._state=e?"playing-scene":"idle",this.clearContainer(this.containerA),this.clearContainer(this.containerB),this.adapterA.clearTargets(),this.adapterB.clearTargets(),this.containerB.style.visibility="hidden",this.resetTransitionStyles(this.containerA),this.resetTransitionStyles(this.containerB);const n=this.sequence.scenes[t];if(this.renderScene(n,this.containerA,this.adapterA),this.timelineA=this.createTimeline(n),this.options.onSceneChange?.(t),e)this.timelineA?(this.timelineA.onComplete=()=>this.onSceneComplete(),this.timelineA.play(),this.startAnimationLoop()):this.onSceneComplete();else if(this.timelineA){const s=this.timelineA.getStateAtTime(0);this.adapterA.applyState(s),this.applyNested(this.adapterA,0)}}destroy(){this._isDestroyed=!0,this._isPlaying=!1,this.transitionTimer!==void 0&&(clearTimeout(this.transitionTimer),this.transitionTimer=void 0),this.stopAnimationLoop(),this.adapterA.clearTargets(),this.adapterB.clearTargets();for(const t of this.nestedByAdapter.values())for(const e of t)e.adapter.clearTargets();this.nestedByAdapter.clear(),this.timelineA&&this.timelineA.stop(),this.timelineB&&this.timelineB.stop(),this.timelineA=null,this.timelineB=null,this.containerA.parentNode&&this.containerA.remove(),this.containerB.parentNode&&this.containerB.remove(),this.sequence=null}get currentSceneIndex(){return this._currentSceneIndex}get sceneCount(){return this.sequence?.scenes.length??0}get isPlaying(){return this._isPlaying}get state(){return this._state}createSceneContainer(){const t=document.createElement("div");return t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t}renderScene(t,e,n){e.innerHTML="",n.clearTargets();const s=document.createElement("div");s.style.cssText="position:absolute;inset:0;transform-origin:center center",s.setAttribute("data-tinyfly","Camera"),e.appendChild(s),n.registerTarget("Camera",s);for(const r of t.elements){if(!r.html)continue;const o=document.createElement("div");o.innerHTML=r.html.trim();const a=o.firstElementChild;if(a){s.appendChild(a);const c=a.getAttribute("data-tinyfly");c&&n.registerTarget(c,a)}}this.setupNested(s,n)}setupNested(t,e){const n=[];t.querySelectorAll("[data-tinyfly-symbol]").forEach(s=>{const r=s.getAttribute("data-tinyfly-symbol");if(!r)return;const o=this.symbolDefs.get(r);if(!o)return;const a=new st;s.querySelectorAll("[data-tinyfly]").forEach(c=>{const l=c.getAttribute("data-tinyfly");l&&a.registerTarget(l,c)}),n.push({adapter:a,timeline:ft(o)})}),n.length?this.nestedByAdapter.set(e,n):this.nestedByAdapter.delete(e)}applyNested(t,e){const n=this.nestedByAdapter.get(t);if(n)for(const s of n){const r=s.timeline.duration;s.adapter.applyState(s.timeline.getStateAtTime(r>0?e%r:e))}}clearContainer(t){t.innerHTML=""}createTimeline(t){return t.timeline?ft(t.timeline):null}onSceneComplete(){if(this._isDestroyed||!this.sequence)return;const t=this._currentSceneIndex+1;if(t>=this.sequence.scenes.length){const e=this.options.loop??this.sequence.loop??0;e===-1||e>0&&this.loopIteration<e-1?(this.loopIteration++,this.beginTransitionTo(0)):(this._isPlaying=!1,this._state="idle",this.stopAnimationLoop(),this.options.onComplete?.())}else this.beginTransitionTo(t)}beginTransitionTo(t){if(!this.sequence||this._isDestroyed)return;const e=this.sequence.scenes[t],n=e.transition;if(n.type==="none"||n.duration<=0){this.switchToScene(t);return}this._state="transitioning",this.containerB.style.visibility="visible",this.renderScene(e,this.containerB,this.adapterB),this.timelineB=this.createTimeline(e),this.timelineB&&this.timelineB.play(),this.applyTransition(n.type,n.duration),this.transitionTimer=window.setTimeout(()=>{this.finishTransition(t)},n.duration)}applyTransition(t,e){const n=`${e}ms`,s="ease-in-out";switch(this.resetTransitionStyles(this.containerA),this.resetTransitionStyles(this.containerB),t){case"fade":this.containerB.style.opacity="0";break;case"slide-left":this.containerB.style.transform="translateX(100%)";break;case"slide-right":this.containerB.style.transform="translateX(-100%)";break;case"slide-up":this.containerB.style.transform="translateY(100%)";break;case"slide-down":this.containerB.style.transform="translateY(-100%)";break}switch(this.containerB.offsetHeight,this.containerA.style.transition=`opacity ${n} ${s}, transform ${n} ${s}`,this.containerB.style.transition=`opacity ${n} ${s}, transform ${n} ${s}`,t){case"fade":this.containerA.style.opacity="0",this.containerB.style.opacity="1";break;case"slide-left":this.containerA.style.transform="translateX(-100%)",this.containerB.style.transform="translateX(0)";break;case"slide-right":this.containerA.style.transform="translateX(100%)",this.containerB.style.transform="translateX(0)";break;case"slide-up":this.containerA.style.transform="translateY(-100%)",this.containerB.style.transform="translateY(0)";break;case"slide-down":this.containerA.style.transform="translateY(100%)",this.containerB.style.transform="translateY(0)";break}}resetTransitionStyles(t){t.style.transition="",t.style.opacity="1",t.style.transform=""}finishTransition(t){this.transitionTimer=void 0,this.timelineA&&(this.timelineA.stop(),this.timelineA=null),this.adapterA.clearTargets(),this.clearContainer(this.containerA);const e=this.containerA;this.containerA=this.containerB,this.containerB=e;const n=this.adapterA;this.adapterA=this.adapterB,this.adapterB=n,this.timelineA=this.timelineB,this.timelineB=null,this.containerB.style.visibility="hidden",this.resetTransitionStyles(this.containerA),this.resetTransitionStyles(this.containerB),this._currentSceneIndex=t,this._state="playing-scene",this.options.onSceneChange?.(t),this.timelineA?(this.timelineA.onComplete=()=>this.onSceneComplete(),this.timelineA.playbackState!=="playing"&&this.timelineA.play()):this.onSceneComplete()}switchToScene(t){if(!this.sequence||this._isDestroyed)return;this.timelineA&&this.timelineA.stop(),this.adapterA.clearTargets(),this.clearContainer(this.containerA);const e=this.sequence.scenes[t];this.renderScene(e,this.containerA,this.adapterA),this.timelineA=this.createTimeline(e),this._currentSceneIndex=t,this._state="playing-scene",this.options.onSceneChange?.(t),this.timelineA?(this.timelineA.onComplete=()=>this.onSceneComplete(),this.timelineA.play()):this.onSceneComplete()}startAnimationLoop(){if(this.animationFrameId!==void 0)return;this.lastTime=performance.now();const t=e=>{if(this._isDestroyed||!this._isPlaying)return;const n=e-(this.lastTime??e);if(this.lastTime=e,this.timelineA&&this.timelineA.playbackState==="playing"){this.timelineA.tick(n);const s=this.timelineA.getStateAtTime(this.timelineA.currentTime);this.adapterA.applyState(s),this.applyNested(this.adapterA,this.timelineA.currentTime)}if(this._state==="transitioning"&&this.timelineB&&this.timelineB.playbackState==="playing"){this.timelineB.tick(n);const s=this.timelineB.getStateAtTime(this.timelineB.currentTime);this.adapterB.applyState(s),this.applyNested(this.adapterB,this.timelineB.currentTime)}this._isPlaying?this.animationFrameId=requestAnimationFrame(t):this.animationFrameId=void 0};this.animationFrameId=requestAnimationFrame(t)}stopAnimationLoop(){this.animationFrameId!==void 0&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}}async function la(i,t,e={}){const n=new rs(i,{...e,autoplay:!0});return await n.load(t),n}const ha={type:"none",duration:0},rt={lean:0,headTilt:0,leftShoulder:18,rightShoulder:18,leftElbow:-6,rightElbow:-6,leftHip:8,rightHip:8,leftKnee:0,rightKnee:0,mouth:0,smile:.6,mouthWidth:1,blink:0,leftEye:1,rightEye:1,leftBrow:0,rightBrow:0,browTilt:0,lookX:0,lookY:0};function G(i){return{...rt,...i}}const os={mouth:0,smile:0,mouthWidth:1,leftEye:1,rightEye:1,leftBrow:0,rightBrow:0,browTilt:0,lookX:0,lookY:0},$=i=>({...os,...i}),et={neutral:os,happy:$({smile:.9,leftBrow:.2,rightBrow:.2}),joyful:$({mouth:.6,smile:1,mouthWidth:1.2,leftEye:0,rightEye:0,leftBrow:.4,rightBrow:.4}),sad:$({smile:-.8,leftEye:.8,rightEye:.8,browTilt:.9,leftBrow:-.1,rightBrow:-.1,lookY:.6}),crying:$({mouth:.45,smile:-1,leftEye:0,rightEye:0,browTilt:1,lookY:.4}),surprised:$({mouth:.7,mouthWidth:.7,leftEye:1.5,rightEye:1.5,leftBrow:1,rightBrow:1}),shocked:$({mouth:1,mouthWidth:.8,leftEye:1.6,rightEye:1.6,leftBrow:1,rightBrow:1,browTilt:.4}),angry:$({smile:-.6,mouthWidth:.9,leftEye:.8,rightEye:.8,leftBrow:-.6,rightBrow:-.6,browTilt:-1}),furious:$({mouth:.5,smile:-1,mouthWidth:1.3,leftEye:.9,rightEye:.9,leftBrow:-.9,rightBrow:-.9,browTilt:-1}),worried:$({smile:-.3,mouthWidth:.8,leftEye:1.1,rightEye:1.1,leftBrow:.3,rightBrow:.3,browTilt:.8,lookX:-.5}),scared:$({mouth:.35,smile:-.5,mouthWidth:.8,leftEye:1.45,rightEye:1.45,leftBrow:.8,rightBrow:.8,browTilt:.9}),confused:$({smile:-.2,mouthWidth:.8,leftEye:.9,rightEye:1.15,leftBrow:-.3,rightBrow:.8,lookX:.5,lookY:-.4}),skeptical:$({smile:-.1,leftEye:.6,rightEye:1,leftBrow:-.4,rightBrow:.7,lookX:.4}),thinking:$({smile:0,mouthWidth:.7,leftBrow:.3,rightBrow:.5,lookX:.6,lookY:-.8}),sleepy:$({smile:.1,leftEye:.25,rightEye:.25,leftBrow:-.3,rightBrow:-.3,lookY:.5}),disgusted:$({smile:-.7,mouthWidth:.9,leftEye:.6,rightEye:.75,leftBrow:-.5,rightBrow:-.2,browTilt:-.4,lookX:-.6}),smug:$({smile:.6,mouthWidth:.9,leftEye:.6,rightEye:.6,leftBrow:.1,rightBrow:.5,lookX:.5}),wink:$({smile:.9,leftEye:0,rightEye:1,leftBrow:-.2,rightBrow:.3})};function as(i,t){return{...i,...typeof t=="string"?et[t]:t}}const cs={rest:rt,wave:G({rightShoulder:135,rightElbow:30,headTilt:6,...et.happy}),cheer:G({leftShoulder:125,leftElbow:20,rightShoulder:125,rightElbow:20,...et.joyful}),shrug:G({leftShoulder:30,leftElbow:85,rightShoulder:30,rightElbow:85,headTilt:-10,...et.confused,lookX:0,lookY:0}),point:G({rightShoulder:90,rightElbow:0,lean:4,smile:.4}),think:G({rightShoulder:60,rightElbow:150,headTilt:10,...et.thinking}),handsOnHips:G({leftShoulder:45,leftElbow:-100,rightShoulder:45,rightElbow:-100,leftHip:14,rightHip:14,smile:.8}),sad:G({leftShoulder:14,rightShoulder:14,leftElbow:-4,rightElbow:-4,headTilt:-14,lean:-3,...et.sad}),surprised:G({leftShoulder:70,leftElbow:60,rightShoulder:70,rightElbow:60,...et.surprised})},ls=Object.keys(rt);function hs(i,t,e){const n={...i};for(const s of ls)n[s]=i[s]+(t[s]-i[s])*e;return n}function us(i,t=rt,e=1){const n=Math.sin(i*Math.PI*2),s=Math.cos(i*Math.PI*2);return{...t,leftHip:t.leftHip+22*n*e,rightHip:t.rightHip-22*n*e,leftKnee:t.leftKnee+14*Math.max(0,s)*e,rightKnee:t.rightKnee+14*Math.max(0,-s)*e,leftShoulder:t.leftShoulder-14*n*e,rightShoulder:t.rightShoulder+14*n*e}}function fs(i){const t=Math.abs(Math.sin(i/65)),e=.55+.45*Math.sin(i/310);return t*e}const ua=.12,fa=.1,da=.21,pa=.19,ma=.24,ga=.22,ee=i=>i*Math.PI/180,ya=(i,t)=>({x:t*Math.sin(ee(i)),y:Math.cos(ee(i))});function ba(i,t,e,n,s,r){const o=Math.max(1,r*.6),a=.12*e,c=n-.12*e,l=a+t.lookX*.08*e,h=t.lookY*.07*e,f=[{x:-.34*e,open:t.leftEye,brow:t.leftBrow,side:-1},{x:.34*e,open:t.rightEye,brow:t.rightBrow,side:1}];i.fillStyle=s,i.strokeStyle=s,i.lineWidth=o;for(const y of f){const b=Math.max(0,y.open)*(1-Math.min(1,Math.max(0,t.blink)));if(b<.2){const T=t.smile>.5?-.12*e:.06*e;i.beginPath(),i.moveTo(y.x+a-.12*e,c),i.quadraticCurveTo(y.x+a,c+T,y.x+a+.12*e,c),i.stroke()}else{if(b>1.2){const S=.13*e*b;i.beginPath(),i.ellipse(y.x+a,c,S*.85,S,0,0,Math.PI*2),i.fillStyle="#ffffff",i.fill(),i.stroke(),i.fillStyle=s}const T=b>1.2?.075*e:.1*e;i.beginPath(),i.ellipse(y.x+l,c+h,T,T*1.1*Math.min(b,1),0,0,Math.PI*2),i.fill()}const w=c-.3*e-y.brow*.14*e-Math.max(0,b-1)*.12*e,v=y.x+a-y.side*.13*e,k=y.x+a+y.side*.13*e;i.beginPath(),i.moveTo(k,w),i.lineTo(v,w-t.browTilt*.1*e),i.stroke()}const u=n+.4*e,d=.25*e*Math.max(.3,t.mouthWidth),m=Math.min(1,Math.max(0,t.mouth));if(i.beginPath(),m<=.05){i.moveTo(a-d,u),i.quadraticCurveTo(a,u+t.smile*.25*e,a+d,u),i.stroke();return}const p=.3*e*m;t.smile>.3?(i.moveTo(a-d,u-.05*e),i.lineTo(a+d,u-.05*e),i.quadraticCurveTo(a,u+p*2,a-d,u-.05*e)):t.smile<-.3?(i.moveTo(a-d,u+p*.6),i.lineTo(a+d,u+p*.6),i.quadraticCurveTo(a,u-p*1.4,a-d,u+p*.6)):i.ellipse(a,u,d*.8,p,0,0,Math.PI*2),i.fill()}function ds(i,t,e={}){const n=e.height??300,s=e.color??"#1e293b",r=(e.facing??1)<0?-1:1,o=ua*n,a=-.46*n,c=-.76*n;i.save(),i.scale(r,1),i.strokeStyle=s,i.lineWidth=e.lineWidth??n*.025,i.lineCap="round",i.lineJoin="round";const l=(m,p,y,b,w)=>{const v=ya(y,b);return{x:m+v.x*w*n,y:p+v.y*w*n}},h=(...m)=>{i.beginPath(),i.moveTo(m[0].x,m[0].y);for(const p of m.slice(1))i.lineTo(p.x,p.y);i.stroke()};for(const[m,p,y]of[[-1,t.leftHip,t.leftKnee],[1,t.rightHip,t.rightKnee]]){const b=l(0,a,p,m,ma);h({x:0,y:a},b,l(b.x,b.y,p-y,m,ga))}i.translate(0,a),i.rotate(ee(t.lean)),i.translate(0,-a),h({x:0,y:a},{x:0,y:c});const f=c+fa*n;for(const[m,p,y]of[[-1,t.leftShoulder,t.leftElbow],[1,t.rightShoulder,t.rightElbow]]){const b=l(0,f,p,m,da);h({x:0,y:f},b,l(b.x,b.y,p+y,m,pa))}i.translate(0,c),i.rotate(ee(t.headTilt));const u=-o;i.beginPath(),i.arc(0,u,o,0,Math.PI*2);const d=e.headFill??"#ffffff";d!=="none"&&(i.fillStyle=d,i.fill()),i.stroke(),ba(i,t,o,u,s,e.lineWidth??n*.025),i.restore(),e.label&&(i.save(),i.fillStyle=s,i.font=e.labelFont??`700 ${Math.round(n*.11)}px sans-serif`,i.textAlign="center",i.textBaseline="bottom",i.fillText(e.label,0,-n-.04*n),i.restore())}function va(i){const t=i.style??{},e=t.height??300,n=e*.8,s={...G(i.pose??{}),walk:0,walking:0,talk:0};return{type:"custom",x:i.x-n/2,y:i.y-e,width:n,height:e,props:{...s},draw(r,o,a){const c=o.props,l={...c};let h=c.walking>0?hs(l,us(c.walk,l),c.walking):l;c.talk>0&&(h={...h,mouth:Math.max(h.mouth,c.talk*fs(a))}),r.translate(n/2,e),ds(r,h,t)}}}function wa(i,t){const e=[];return t.forEach((n,s)=>{const r=s===0?rt:e[s-1],o=typeof n.pose=="string"?cs[n.pose]:{...r,...n.pose};e.push(n.expression?as(o,n.expression):o)}),ls.filter(n=>e.some(s=>s[n]!==rt[n])).map(n=>({id:`${i}-${n}`,target:i,property:n,keyframes:t.map((s,r)=>({time:s.time,value:e[r][n],...s.easing?{easing:s.easing}:{}}))}))}function Ta(i){const{timeline:t}=i,e=new st;for(const[l,h]of Object.entries(i.targets)){const f=typeof h=="string"?document.querySelector(h):h;if(!f)throw new Error(`quickPlay: no element found for target "${l}" (${String(h)})`);e.registerTarget(l,f)}t.onUpdate=l=>{e.applyState(l),i.onUpdate?.(l)},i.onComplete&&(t.onComplete=i.onComplete);let n=null,s=null,r=!1;const o=l=>{if(r)return;const h=s===null?0:l-s;s=l,h>0&&t.tick(h),n=requestAnimationFrame(o)},a=()=>{n!==null||r||(s=null,n=requestAnimationFrame(o))},c=()=>{n!==null&&cancelAnimationFrame(n),n=null,s=null};return e.applyState(t.getStateAtTime(t.currentTime)),i.autoplay!==!1&&(t.play(),a()),{timeline:t,adapter:e,play(){t.play(),a()},pause(){t.pause(),c()},restart(){t.stop(),t.play(),a()},seek(l){t.seek(l*1e3),e.applyState(t.getStateAtTime(t.currentTime))},destroy(){r=!0,c(),t.stop(),e.clearTargets()}}}const ka={timeline:Or,to(i,t,e){const n=new nt(e);return n.to(i,t),n},from(i,t,e){const n=new nt(e);return n.from(i,t),n},fromTo(i,t,e,n){const s=new nt(n);return s.fromTo(i,t,e),s},set(i,t,e){const n=new nt(e);return n.set(i,t),n}},Sa=Y.to,Ma=Y.from,Aa=Y.fromTo,Ea=Y.set,xa=Y.timeline,Pa=Y.ticker,Ca=Y.splitText,_a=Y.context,Ia=Y.matchMedia,Ra=Y.quickTo,La=Y.imageSequence,Fa=Y.pageTransition;ca(),g.Clock=gs,g.CompatTimeline=nt,g.CustomBounce=Yn,g.CustomEase=qn,g.CustomWiggle=Xn,g.DEFAULT_BAKE_INTERVAL_MS=ye,g.DEFAULT_INERTIA_FRICTION=ae,g.DEFAULT_LABELS=Qn,g.DEFAULT_SPRING=V,g.DEFAULT_TRANSITION=ha,g.Draggable=$e,g.EXPRESSIONS=et,g.FORMAT_VERSION=vt,g.INERTIA_MAX_DURATION_MS=ei,g.InertiaTrackPlayer=Bi,g.LiveTimeline=z,g.MORPH_SAMPLES=Os,g.ManualClock=ms,g.MediaSync=Ge,g.Observer=yn,g.POSES=cs,g.REST_POSE=rt,g.SPRING_MAX_DURATION_MS=oe,g.SPRING_PRESETS=Nt,g.SPRING_STEP_MS=ot,g.ScrollAnimator=Ln,g.ScrollDriver=It,g.ScrollMarkers=Fn,g.ScrollPin=Cn,g.SmoothScroll=je,g.SpringSampler=Tt,g.SpringTrackPlayer=Di,g.Stage=un,g.Timeline=Se,g.TinyflyPlayer=Jt,g.TinyflySequencer=rs,g.TrackPlayer=jt,g.ValueResolver=ar,g.VisibilityDriver=Pn,g.backOut=ui,g.bakeEasing=we,g.bakeInertiaTrack=ve,g.bakeSpringTrack=be,g.bindChoiceHotspots=es,g.blendPose=hs,g.bounceOut=hi,g.charactersFor=Oi,g.clamp01=Xe,g.clearMorphCache=Hs,g.clearPathCache=Ls,g.containerProgressAt=Ve,g.context=_a,g.create=Ho,g.createControls=Jn,g.createCubicBezier=ci,g.createLive=Un,g.createRandom=Wi,g.createTrack=Ut,g.criticalDamping=vs,g.customBounce=Ki,g.customEase=Gi,g.customWiggle=Qi,g.deserializeTimeline=ft,g.deserializeTrack=Xi,g.draggable=ro,g.drawStickFigure=ds,g.easeIn=ri,g.easeInCubic=ce,g.easeInOut=ai,g.easeInOutCubic=St,g.easeInOutQuad=si,g.easeInQuad=ii,g.easeOut=oi,g.easeOutCubic=le,g.easeOutQuad=ni,g.elasticOut=li,g.expandParametricEasings=Fi,g.from=Ma,g.fromJSON=nr,g.fromTo=Aa,g.getEasingFunction=W,g.getInterpolator=xt,g.getMotionPathPoint=Te,g.getPathLength=Fs,g.getPointAtProgress=gi,g.gridLinesFor=wn,g.hasKeyframes=Je,g.hashSeed=sr,g.imageSequence=La,g.inertiaDuration=ct,g.inertiaRest=at,g.inertiaValueAt=Yt,g.inertiaVelocityAt=Ss,g.interpolateArray=Ii,g.interpolateColor=_i,g.interpolateMotionPath=Zs,g.interpolateNumber=U,g.interpolatePathString=Ri,g.interpolateString=ge,g.isCubicBezierEasing=Ze,g.isInertiaTrack=K,g.isMotionPathPoint=ps,g.isMotionPathTrack=ne,g.isParametricEasing=bt,g.isPathData=ht,g.isSpringTrack=Q,g.isTextTrack=$t,g.isUnderdamped=bs,g.isUnresolved=or,g.linear=Xt,g.live=Y,g.mapEase=Pt,g.matchMedia=Ia,g.maxStaggerDistance=re,g.morphPath=Si,g.mount=is,g.mountAll=ss,g.narrationMarkers=mr,g.narrationSceneAt=gr,g.naturalRest=kt,g.pageTransition=Fa,g.parametricEasing=di,g.parseEdge=qe,g.parsePath=it,g.parseTrigger=Ye,g.planNarration=pr,g.play=jo,g.playSequence=la,g.playWhenVisible=vo,g.playheadCrossings=Me,g.pointAtDistance=ue,g.pointsToPath=Ji,g.pose=G,g.poseTracks=wa,g.quickPlay=Ta,g.quickTo=Ra,g.randomBetween=Ee,g.randomChoice=rr,g.randomSnapped=Ui,g.resolveSequence=zi,g.resolveValue=xe,g.scrollProgress=bo,g.scrubOnScroll=So,g.serializeTimeline=Vi,g.serializeTrack=qi,g.set=Ea,g.shapeToPathData=Ht,g.simplifyKeyframes=$i,g.smoothToward=xn,g.snapAxis=vn,g.snapConfig=_n,g.snapDuration=Rn,g.snapProgress=In,g.splitText=Ca,g.springDuration=ti,g.springValueAt=ys,g.staggerDistance=se,g.staggerOffset=Dt,g.staggerOffsets=Bt,g.staggerSpan=wt,g.stepsEasing=fi,g.stickFigureTarget=va,g.syncMediaElement=Kn,g.talkingMouth=fs,g.textAt=Ni,g.tf=ka,g.ticker=Pa,g.timeline=xa,g.to=Sa,g.toJSON=ir,g.toKeyframedTrack=Ks,g.toKeyframedTracks=Qs,g.trackTargets=tt,g.triggerDistance=dt,g.unmount=oa,g.walkPose=us,g.withExpression=as,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})})(this.tinyfly=this.tinyfly||{});
|