@algorisys/tinyfly 0.75.0 → 0.77.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 +6 -6
- package/lib/addons/adapters.js +2 -2
- package/lib/addons/characters.js +1259 -282
- package/lib/addons/{sketch-CB6VNfnR.js → sketch-CA8ZXhxI.js} +2 -2
- package/lib/browser/tinyfly.iife.js +4 -4
- package/lib/browser/tinyfly.js +4096 -3120
- package/lib/browser/tinyfly.umd.js +4 -4
- package/lib/headless/headless.js +2 -1
- package/lib/types/characters/character.d.ts +165 -0
- package/lib/types/characters/head/face.d.ts +17 -0
- package/lib/types/characters/index.d.ts +5 -0
- package/lib/types/characters/look/curves.d.ts +7 -0
- package/lib/types/characters/look/pen.d.ts +59 -0
- package/lib/types/characters/look/tapered-line.d.ts +13 -0
- package/lib/types/characters/rig/body-plan.d.ts +89 -0
- package/lib/types/characters/rig/reach.d.ts +11 -0
- package/lib/types/characters/rig/skeleton.d.ts +71 -0
- package/lib/types/characters/species/human.d.ts +59 -0
- package/lib/types/characters/stick-figure.d.ts +185 -8
- package/lib/types/characters/wardrobe/basic-outfit.d.ts +14 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(y){"use strict";function ai(e){return typeof e=="object"&&e!==null&&e.type==="cubic-bezier"}function vt(e){return typeof e=="object"&&e!==null&&e.type!=="cubic-bezier"}const wt=1;function Dt(e){return e.property==="text"&&"textConfig"in e}function Q(e){return e.kind==="inertia"&&"inertia"in e}function Z(e){return e.kind==="spring"&&"spring"in e}function re(e){return e.property==="motionPath"&&"motionPathConfig"in e}function Is(e){return typeof e=="object"&&e!==null&&"x"in e&&"y"in e&&"angle"in e}function li(e){return"keyframes"in e}class Rs{_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 Ls{_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 oe(e,t,i="start"){if(t<=1)return 0;if(typeof i=="number"){const n=Math.max(0,Math.min(t-1,i));return Math.abs(e-n)}switch(i){case"end":return t-1-e;case"center":return Math.abs(e-(t-1)/2);case"edges":return(t-1)/2-Math.abs(e-(t-1)/2);default:return e}}function ae(e,t="start"){if(e<=1)return 0;let i=0;for(let n=0;n<e;n++)i=Math.max(i,oe(n,e,t));return i}function Ot(e,t,i){if(i.offsets)return i.offsets[e]??0;const n=i.from??"start",s=oe(e,t,n);if(i.amount!==void 0){const r=ae(t,n);return r===0?0:i.amount*s/r}return i.each!==void 0?i.each*s:0}function Bt(e,t){return Array.from({length:e},(i,n)=>Ot(n,e,t))}function Tt(e,t){return e<=1?0:Math.max(...Bt(e,t))}const ot=1,le=6e4,Nt=le/ot,V={stiffness:180,damping:12,mass:1,velocity:0,restDelta:.01,restSpeed:.1},qt={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 kt{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 i=Math.floor(t/ot);if(this.simulateTo(i+1),this.settledStep!==null&&i>=this.settledStep)return this.to;const n=this.samples[Math.min(i,this.samples.length-1)],s=this.samples[Math.min(i+1,this.samples.length-1)],r=t/ot-i;return n+(s-n)*r}settleTime(){return this.simulateTo(Nt+1),this.settledStep!==null?this.settledStep*ot:le}simulateTo(t){if(this.settledStep!==null)return;const i=Math.min(t,Nt+1),n=ot/1e3;for(;this.samples.length<i;){const s=this.samples[this.samples.length-1],r=s-this.to,o=-this.stiffness*r,a=-this.damping*this.velocity,l=(o+a)/this.mass;this.velocity+=l*n;const c=s+this.velocity*n;if(this.samples.push(c),this.isAtRest(c)){this.settledStep=this.samples.length-1;return}}this.samples.length>Nt&&(this.settledStep=Nt)}}function Fs(e,t){return new kt(e).valueAt(t)}function ci(e){return new kt(e).settleTime()}function $s(e){const t=e.stiffness??V.stiffness,i=e.damping??V.damping,n=e.mass??V.mass;return i<2*Math.sqrt(t*n)}function Ds(e){const t=e.stiffness??V.stiffness,i=e.mass??V.mass;return 2*Math.sqrt(t*i)}const ce=4,Os=.002,Bs=1e-4,hi=6e4;function Yt(e){const t=e.friction??ce;return t>0?t:ce}function St(e){return e.from+e.velocity/Yt(e)}function Ns(e,t){if(t===void 0)return e;if(typeof t=="number")return t>0?Math.round(e/t)*t:e;if(t.length===0)return e;let i=t[0];for(const n of t)Math.abs(n-e)<Math.abs(i-e)&&(i=n);return i}function at(e){let t=Ns(St(e),e.end);return e.min!==void 0&&(t=Math.max(e.min,t)),e.max!==void 0&&(t=Math.min(e.max,t)),t}function lt(e){const t=Math.abs(at(e)-e.from);if(t===0)return 0;const i=e.restDelta??Math.max(Bs,t*Os);if(i>=t)return 0;const n=Math.log(t/i)/Yt(e);return Math.min(hi,n*1e3)}function Xt(e,t){if(t<=0)return e.from;const i=at(e);if(t>=lt(e))return i;const n=Yt(e);return e.from+(i-e.from)*(1-Math.exp(-n*t/1e3))}function qs(e,t){const i=Yt(e),n=at(e);return t>=lt(e)?0:(n-e.from)*i*Math.exp(-i*Math.max(0,t)/1e3)}const Vt=e=>e,ui=e=>e*e,fi=e=>1-(1-e)*(1-e),di=e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,he=e=>e*e*e,ue=e=>1-Math.pow(1-e,3),Mt=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,pi=he,mi=ue,gi=Mt,Ys={linear:Vt,"ease-in":pi,"ease-out":mi,"ease-in-out":gi,"ease-in-quad":ui,"ease-out-quad":fi,"ease-in-out-quad":di,"ease-in-cubic":he,"ease-out-cubic":ue,"ease-in-out-cubic":Mt};function yi(e){const[t,i,n,s]=e,r=3*t,o=3*(n-t)-r,a=1-r-o,l=3*i,c=3*(s-i)-l,u=1-l-c,f=p=>((a*p+o)*p+r)*p,h=p=>((u*p+c)*p+l)*p,d=p=>(3*a*p+2*o)*p+r,g=p=>{let m=p;for(let v=0;v<8;v++){const S=f(m)-p;if(Math.abs(S)<1e-7)return m;const w=d(m);if(Math.abs(w)<1e-7)break;m-=S/w}let b=0,T=1;for(m=p;b<T;){const v=f(m);if(Math.abs(v-p)<1e-7)return m;p>v?b=m:T=m,m=(b+T)/2}return m};return p=>{if(p<=0)return 0;if(p>=1)return 1;const m=g(p);return h(m)}}function fe(e,t="out"){if(t==="out")return e;const i=n=>1-e(1-n);return t==="in"?i:n=>n<.5?i(n*2)/2:e(n*2-1)/2+.5}function bi(e=1,t=.3){const i=Math.max(1,e),n=t/(2*Math.PI)*Math.asin(1/i);return s=>s<=0?0:s>=1?1:i*Math.pow(2,-10*s)*Math.sin((s-n)*(2*Math.PI)/t)+1}const vi=e=>{if(e<=0)return 0;if(e>=1)return 1;if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const s=e-.5454545454545454;return 7.5625*s*s+.75}if(e<2.5/2.75){const s=e-.8181818181818182;return 7.5625*s*s+.9375}const n=e-2.625/2.75;return 7.5625*n*n+.984375};function wi(e=1.70158){return t=>{if(t<=0)return 0;if(t>=1)return 1;const i=t-1;return i*i*((e+1)*i+e)+1}}function Ti(e,t="end"){const i=Math.max(1,Math.floor(e));return n=>{if(n>=1)return 1;if(n<=0)return t==="start"||t==="both"?t==="start"?1/i:1/(i+1):0;const s=Math.floor(n*i);switch(t){case"start":return Math.min(1,(s+1)/i);case"both":return(s+1)/(i+1);case"none":return i===1?0:Math.min(1,s/(i-1));default:return s/i}}}function ki(e){switch(e.type){case"steps":return Ti(e.count,e.position);case"elastic":return fe(bi(e.amplitude,e.period),e.mode);case"bounce":return fe(vi,e.mode);case"back":return fe(wi(e.overshoot),e.mode)}}function U(e){return e===void 0?Vt:ai(e)?yi(e.points):vt(e)?ki(e):Ys[e]??Vt}const Si=32,Xs=256,ct=new Map,Vs=/[MmLlHhVvCcSsQqTtAaZz]/,Ws=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/,Us={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};function Hs(e){const t=[];let i=0,n=null;const s=()=>{for(;i<e.length&&/[\s,]/.test(e[i]);)i++};for(;i<e.length&&(s(),!(i>=e.length));){const r=e[i];if(Vs.test(r)){n={type:r,args:[]},t.push(n),i++;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),i++;continue}const l=Ws.exec(e.slice(i));if(!l)break;n.args.push(parseFloat(l[0])),i+=l[0].length}return t}function js(e,t,i,n,s,r,o,a,l){if(e===a&&t===l)return[];let c=Math.abs(i),u=Math.abs(n);if(c===0||u===0)return[[e,t,a,l,a,l]];const f=s*Math.PI/180,h=Math.cos(f),d=Math.sin(f),g=(e-a)/2,p=(t-l)/2,m=h*g+d*p,b=-d*g+h*p,T=m*m/(c*c)+b*b/(u*u);if(T>1){const F=Math.sqrt(T);c*=F,u*=F}const v=r===o?-1:1,S=c*c*u*u-c*c*b*b-u*u*m*m,w=c*c*b*b+u*u*m*m,k=v*Math.sqrt(Math.max(0,S/w)),M=k*c*b/u,E=-k*u*m/c,R=h*M-d*E+(e+a)/2,P=d*M+h*E+(t+l)/2,A=(F,B,X,bt)=>{const oi=F*X+B*bt,se=Math.sqrt((F*F+B*B)*(X*X+bt*bt)),$t=Math.acos(Math.max(-1,Math.min(1,oi/se)));return F*bt-B*X<0?-$t:$t},_=A(1,0,(m-M)/c,(b-E)/u);let C=A((m-M)/c,(b-E)/u,(-m-M)/c,(-b-E)/u);!o&&C>0&&(C-=2*Math.PI),o&&C<0&&(C+=2*Math.PI);const I=Math.max(1,Math.ceil(Math.abs(C)/(Math.PI/2))),x=C/I,L=4/3*Math.tan(x/4),O=F=>{const B=c*Math.cos(F),X=u*Math.sin(F);return[h*B-d*X+R,d*B+h*X+P]},q=F=>{const B=-c*Math.sin(F),X=u*Math.cos(F);return[h*B-d*X,d*B+h*X]},N=[];for(let F=0;F<I;F++){const B=_+F*x,X=B+x,[bt,oi]=O(B),[se,$t]=F===I-1?[a,l]:O(X),[rl,ol]=q(B),[al,ll]=q(X);N.push([bt+L*rl,oi+L*ol,se-L*al,$t-L*ll,se,$t])}return N}function J(e,t,i,n,s){const r=1-s;return r*r*r*e+3*r*r*s*t+3*r*s*s*i+s*s*s*n}function Mi(e,t,i,n,s){const r=1-s;return 3*r*r*(t-e)+6*r*s*(i-t)+3*s*s*(n-i)}function At(e,t,i,n){return{subpath:0,type:"L",points:[i,n],startX:e,startY:t,endX:i,endY:n,length:Math.hypot(i-e,n-t)}}function Wt(e,t,i){const[n,s,r,o,a,l]=i,c=[0];let u=e,f=t,h=0;for(let d=1;d<=Si;d++){const g=d/Si,p=J(e,n,r,a,g),m=J(t,s,o,l,g);h+=Math.hypot(p-u,m-f),c.push(h),u=p,f=m}return{subpath:0,type:"C",points:[n,s,r,o,a,l],startX:e,startY:t,endX:a,endY:l,length:h,lengths:c}}function it(e){const t=ct.get(e);if(t)return t;const i=[];let n=0,s=0,r=0,o=0,a=null,l=null,c=-1;const u=new Set,f=p=>{c<0&&(c=0),p.subpath=c,i.push(p)};for(const{type:p,args:m}of Hs(e)){const b=p.toUpperCase(),T=p!==b,v=Us[b];if(b==="Z"){(n!==r||s!==o)&&f(At(n,s,r,o)),c>=0&&u.add(c),n=r,s=o,a=l=null;continue}for(let S=0;S+v<=m.length;S+=v){const w=m.slice(S,S+v),k=T?n:0,M=T?s:0;let E=null,R=null;switch(b){case"M":S===0?(n=w[0]+k,s=w[1]+M,r=n,o=s,(c<0||i[i.length-1]?.subpath===c)&&c++):(f(At(n,s,w[0]+k,w[1]+M)),n=w[0]+k,s=w[1]+M);break;case"L":f(At(n,s,w[0]+k,w[1]+M)),n=w[0]+k,s=w[1]+M;break;case"H":f(At(n,s,w[0]+k,s)),n=w[0]+k;break;case"V":f(At(n,s,n,w[0]+M)),s=w[0]+M;break;case"C":{const P=[w[0]+k,w[1]+M,w[2]+k,w[3]+M,w[4]+k,w[5]+M];f(Wt(n,s,P)),E=[P[2],P[3]],n=P[4],s=P[5];break}case"S":{const[P,A]=a?[2*n-a[0],2*s-a[1]]:[n,s],_=[P,A,w[0]+k,w[1]+M,w[2]+k,w[3]+M];f(Wt(n,s,_)),E=[_[2],_[3]],n=_[4],s=_[5];break}case"Q":case"T":{let P=n,A=s;b==="Q"?(P=w[0]+k,A=w[1]+M):l&&(P=2*n-l[0],A=2*s-l[1]);const _=b==="Q"?w[2]+k:w[0]+k,C=b==="Q"?w[3]+M:w[1]+M;f(Wt(n,s,[n+2/3*(P-n),s+2/3*(A-s),_+2/3*(P-_),C+2/3*(A-C),_,C])),R=[P,A],n=_,s=C;break}case"A":{const P=w[5]+k,A=w[6]+M;let _=n,C=s;for(const I of js(n,s,w[0],w[1],w[2],w[3],w[4],P,A))f(Wt(_,C,I)),_=I[4],C=I[5];n=P,s=A;break}}a=E,l=R}}const h=i.reduce((p,m)=>p+m.length,0),d=[];for(let p=0;p<i.length;){const m=i[p].subpath;let b=p,T=0;for(;b<i.length&&i[b].subpath===m;)T+=i[b++].length;const v=i[p],S=i[b-1],w=u.has(m)||Math.abs(S.endX-v.startX)<1e-9&&Math.abs(S.endY-v.startY)<1e-9;d.push({start:p,end:b,length:T,closed:w}),p=b}const g={segments:i,totalLength:h,subpaths:d};return ct.size>=Xs&&ct.delete(ct.keys().next().value),ct.set(e,g),g}function zs(e,t){const i=e.lengths;if(t<=0)return 0;if(t>=e.length)return 1;let n=0,s=i.length-1;for(;n<s-1;){const a=n+s>>1;i[a]<t?n=a:s=a}const r=i[s]-i[n],o=r>0?(t-i[n])/r:0;return(n+o)/(i.length-1)}function Gs(e,t){if(e.type==="L"){const f=e.length>0?Math.max(0,Math.min(1,t/e.length)):0;return{x:e.startX+(e.endX-e.startX)*f,y:e.startY+(e.endY-e.startY)*f,angle:Math.atan2(e.endY-e.startY,e.endX-e.startX)*180/Math.PI}}const[i,n,s,r,o,a]=e.points,l=zs(e,t);let c=Mi(e.startX,i,s,o,l),u=Mi(e.startY,n,r,a,l);if(Math.hypot(c,u)<1e-9){const f=l<.5?Math.min(1,l+.001):Math.max(0,l-.001),h=J(e.startX,i,s,o,f),d=J(e.startY,n,r,a,f),g=J(e.startX,i,s,o,l),p=J(e.startY,n,r,a,l);c=l<.5?h-g:g-h,u=l<.5?d-p:p-d}return{x:J(e.startX,i,s,o,l),y:J(e.startY,n,r,a,l),angle:Math.atan2(u,c)*180/Math.PI}}function de(e,t,i=0,n=e.length){if(n<=i)return{x:0,y:0,angle:0};let s=0;for(let r=i;r<n;r++){const o=e[r];if(s+o.length>=t||r===n-1)return Gs(o,t-s);s+=o.length}return{x:0,y:0,angle:0}}function Ai(e,t){const{segments:i,totalLength:n}=it(e);return de(i,Math.max(0,Math.min(1,t))*n)}function Ks(){ct.clear()}function Qs(e){return it(e).totalLength}const Zs=24,Js=320,tr=2.5,Et=72,er=64,ir=.2,nr=128,Pt=new Map;let Ut=0,tt;const Ei=e=>Math.round(e*100)/100;function Pi(e,t){const{segments:i,subpaths:n,totalLength:s}=it(e);if(i.length===0)return[];if(t){const r=n.every(o=>o.closed);return[{segments:i,start:0,end:i.length,length:s,closed:r}]}return n.filter(r=>r.length>0).map(r=>({segments:i,start:r.start,end:r.end,length:r.length,closed:r.closed}))}function pe(e,t){const i=e.closed?(t%1+1)%1:Math.max(0,Math.min(1,t)),n=de(e.segments,i*e.length,e.start,e.end);return[n.x,n.y]}function xi(e){const t=[];let i=0;for(let n=e.start;n<e.end;n++)i+=e.segments[n].length,e.length>0&&t.push(i/e.length);return t}function Ci(e,t){const i=[];for(let n=0;n<t;n++)i.push(pe(e,e.closed?n/t:n/(t-1)));return i}function _i(e){let t=0,i=0;for(const[n,s]of e)t+=n,i+=s;return t/=e.length,i/=e.length,e.map(([n,s])=>[n-t,s-i])}function sr(e,t,i){const n=e.closed&&t.closed;if(i!==void 0)return{offset:n?Math.abs(i)%Et/Et:0,reversed:i<0};const s=_i(Ci(e,Et)),r=_i(Ci(t,Et)),o=Et;let a={offset:0,reversed:!1},l=1/0;for(const c of[!1,!0]){const u=n?o:1;for(let f=0;f<u;f++){let h=0;for(let d=0;d<o&&h<l;d++){const g=n?c?(f-d+o)%o:(d+f)%o:c?o-1-d:d,p=s[d][0]-r[g][0],m=s[d][1]-r[g][1];h+=p*p+m*m}h<l&&(l=h,a={offset:n?f/o:0,reversed:c})}}return a}function rr(e,t,i){return i?((t.reversed?t.offset-e:e+t.offset)%1+1)%1:t.reversed?1-e:e}function or(e,t,i){return i?((t.reversed?t.offset-e:e-t.offset)%1+1)%1:t.reversed?1-e:e}function ar(e,t,i){const n=e.closed&&t.closed,s=sr(e,t,i.shapeIndex),r=Math.max(Zs,Math.min(Js,Math.ceil(Math.max(e.length,t.length)/tr))),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 xi(e))a(f);for(const f of xi(t))a(or(f,s,n));let l=[...o].sort((f,h)=>f-h);n&&(l=l.filter(f=>f<1));const c=[],u=[];for(const f of l)c.push(...pe(e,f)),u.push(...pe(t,rr(f,s,n)));return lr({from:c,to:u,closed:n})}function lr(e){const t=e.from.length/2;if(t<=3)return e;const i=new Uint8Array(t);i[0]=1,i[t-1]=1;const n=[[0,t-1]];for(;n.length>0;){const[o,a]=n.pop();let l=-1,c=ir;for(let u=o+1;u<a;u++){const f=Math.max(Ii(e.from,o,a,u),Ii(e.to,o,a,u));f>c&&(c=f,l=u)}l!==-1&&(i[l]=1,n.push([o,l],[l,a]))}const s=[],r=[];for(let o=0;o<t;o++)i[o]&&(s.push(e.from[o*2],e.from[o*2+1]),r.push(e.to[o*2],e.to[o*2+1]));return{from:s,to:r,closed:e.closed}}function Ii(e,t,i,n){const s=e[t*2],r=e[t*2+1],o=e[i*2]-s,a=e[i*2+1]-r,l=e[n*2]-s,c=e[n*2+1]-r,u=o*o+a*a,f=u===0?0:Math.max(0,Math.min(1,(l*o+c*a)/u));return Math.hypot(l-f*o,c-f*a)}function cr(e,t,i){const n=i.shapeIndex;if(tt&&tt.from===e&&tt.to===t&&tt.shapeIndex===n)return tt.plan;const r=Pt.get(String(n??"auto"))?.get(e)?.get(t);if(r)return tt={from:e,to:t,shapeIndex:n,plan:r},r;const o=it(e).subpaths.filter(d=>d.length>0).length===it(t).subpaths.filter(d=>d.length>0).length,a=Pi(e,!o),l=Pi(t,!o),c={pairs:a.map((d,g)=>ar(d,l[g],i))};Ut>=nr&&(Pt.clear(),Ut=0);const u=String(n??"auto"),f=Pt.get(u)??new Map;Pt.set(u,f);const h=f.get(e)??new Map;return f.set(e,h),h.set(t,c),Ut++,tt={from:e,to:t,shapeIndex:n,plan:c},c}function Ri(e,t,i,n={}){if(!e)return t;if(!t)return e;const s=Math.max(0,Math.min(1,i));if(s===0)return e;if(s===1)return t;const r=cr(e,t,n);if(r.pairs.length===0)return s<.5?e:t;let o="";for(const a of r.pairs){for(let l=0;l<a.from.length;l+=2){const c=Ei(a.from[l]+(a.to[l]-a.from[l])*s),u=Ei(a.from[l+1]+(a.to[l+1]-a.from[l+1])*s);o+=`${l===0?o?" M":"M":" L"}${c} ${u}`}a.closed&&(o+=" Z")}return o}function hr(){Pt.clear(),Ut=0,tt=void 0}function ht(e){return/^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(e)}const H=(e,t,i)=>e+(t-e)*i,Li=512,me=new Map,ge=new Map;function Fi(e){const t=me.get(e);if(t)return t;const i=e.replace("#",""),n=[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16)];return me.size<Li&&me.set(e,n),n}const $i=e=>e.charCodeAt(0)===35,Di=e=>e.startsWith("rgb"),Oi=e=>e.startsWith("rgba"),ur=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/,ye=e=>Math.round(e).toString(16).padStart(2,"0");function fr(e,t,i){return`#${ye(e)}${ye(t)}${ye(i)}`}function Bi(e){const t=ge.get(e);if(t)return t;const i=e.match(ur);if(!i)throw new Error(`Invalid rgb color: ${e}`);const n=parseInt(i[1],10),s=parseInt(i[2],10),r=parseInt(i[3],10),o=i[4]!==void 0?[n,s,r,parseFloat(i[4])]:[n,s,r];return ge.size<Li&&ge.set(e,o),o}const Ni=(e,t,i)=>{if($i(e)&&$i(t)){const[n,s,r]=Fi(e),[o,a,l]=Fi(t),c=H(n,o,i),u=H(s,a,i),f=H(r,l,i);return fr(c,u,f)}if((Di(e)||Oi(e))&&(Di(t)||Oi(t))){const n=Bi(e),s=Bi(t),r=Math.round(H(n[0],s[0],i)),o=Math.round(H(n[1],s[1],i)),a=Math.round(H(n[2],s[2],i));if(n.length===4||s.length===4){const l=n[3]??1,c=s[3]??1,u=H(l,c,i);return`rgba(${r}, ${o}, ${a}, ${u})`}return`rgb(${r}, ${o}, ${a})`}return i<1?e:t},qi=(e,t,i)=>{const n=Math.min(e.length,t.length),s=[];for(let r=0;r<n;r++)s.push(H(e[r],t[r],i));return s},be=(e,t,i)=>i<1?e:t,Yi=(e,t,i)=>Ri(e,t,i);function xt(e){return typeof e=="number"?H:Array.isArray(e)?qi:typeof e=="string"?e.startsWith("#")||e.startsWith("rgb")?Ni:ht(e)?Yi:be:be}const ve=1e3/60;function we(e,t={}){if(!Z(e))throw new Error(`bakeSpringTrack: track "${e.id}" is not a spring track`);const i=new kt(e.spring);return Xi(e,n=>i.valueAt(n),i.settleTime(),e.spring.from,e.spring.to,t)}function Te(e,t={}){if(!Q(e))throw new Error(`bakeInertiaTrack: track "${e.id}" is not an inertia track`);const i=e.inertia;return Xi(e,n=>Xt(i,n),lt(i),i.from,at(i),t)}function Xi(e,t,i,n,s,r){const o=r.intervalMs??ve,a=r.tolerance??.01,l=e.delay??0,c=[];for(let f=0;f<=i;f+=o)c.push({time:f+l,value:t(f),easing:"linear"});const u=c[c.length-1];return!u||u.time<i+l?c.push({time:i+l,value:s,easing:"linear"}):u.value=s,l>0&&c.unshift({time:0,value:n,easing:"linear"}),{id:e.id,target:e.target,property:e.property,keyframes:a>0?Wi(c,a):c,...e.targets&&{targets:[...e.targets]},...e.stagger&&{stagger:{...e.stagger}}}}function ke(e,t,i,n={}){const s=n.intervalMs??ve,r=typeof i=="function"?i:U(i),o=xt(e.value),a=t.time-e.time;if(a<=0)return[t];const l=[];for(let u=s;u<a;u+=s){const f=u/a;l.push({time:e.time+u,value:o(e.value,t.value,r(f)),easing:"linear"})}const c=r(1);return l.push({...t,...c!==1&&{value:o(e.value,t.value,c)},easing:"linear"}),l}function dr(e,t){return Z(e)?we(e,t):Q(e)?Te(e,t):e}function Vi(e,t={}){const i=e.keyframes;if(!i.some(s=>vt(s.easing)))return e;const n=i.length>0?[i[0]]:[];for(let s=1;s<i.length;s++){const r=i[s];vt(r.easing)?n.push(...ke(i[s-1],r,r.easing,t)):n.push(r)}return{...e,keyframes:n}}function pr(e,t){return e.filter(li).map(i=>Vi(i,t)).concat(e.filter(Z).map(i=>we(i,t)),e.filter(Q).map(i=>Te(i,t)))}function Wi(e,t){if(e.length<=2)return e;const i=[e[0]];for(let n=1;n<e.length-1;n++){const s=i[i.length-1],r=e[n],o=e[n+1],a=o.time-s.time;if(a<=0)continue;const l=(r.time-s.time)/a,c=s.value+(o.value-s.value)*l;Math.abs(r.value-c)>t&&i.push(r)}return i.push(e[e.length-1]),i}function Ht(e){const t=[...e.keyframes].sort((i,n)=>i.time-n.time);return{...e,keyframes:t}}function et(e){return e.targets&&e.targets.length>0?e.targets:[e.target]}function ut(e,t,i,n){const s=i??0;return!n||t<=1?s:s+Ot(e,t,n)}class jt{track;targets;constructor(t){this.track=t,this.targets=et(t)}getValueAtTime(t){return this.valueForOffset(t-ut(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const i=this.targets.length,n=[];for(let s=0;s<i;s++){const r=ut(s,i,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 i=t[t.length-1].time,n=this.track.stagger?Tt(this.targets.length,this.track.stagger):0;return i+(this.track.delay??0)+n+(this.track.endDelay??0)}getTrack(){return this.track}valueForOffset(t){const{keyframes:i}=this.track;if(i.length===0)return;if(i.length===1||t<=i[0].time)return i[0].value;if(t>=i[i.length-1].time)return i[i.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,l=U(s.easing)(o);return xt(n.value)(n.value,s.value,l)}findSurroundingKeyframes(t){const{keyframes:i}=this.track;for(let n=0;n<i.length-1;n++)if(t>=i[n].time&&t<=i[n+1].time)return{from:i[n],to:i[n+1]};return{from:null,to:null}}}class Ui{track;targets;sampler;constructor(t){this.track=t,this.targets=et(t),this.sampler=new kt(t.spring)}getValueAtTime(t){return this.sampler.valueAt(t-ut(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const i=this.targets.length,n=[];for(let s=0;s<i;s++){const r=ut(s,i,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?Tt(this.targets.length,this.track.stagger):0;return this.sampler.settleTime()+(this.track.delay??0)+t}getTrack(){return this.track}}class Hi{track;targets;duration;constructor(t){this.track=t,this.targets=et(t),this.duration=lt(t.inertia)}getValueAtTime(t){return Xt(this.track.inertia,t-ut(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const i=this.targets.length,n=[];for(let s=0;s<i;s++){const r=ut(s,i,this.track.delay,this.track.stagger);n.push({target:this.targets[s],value:Xt(this.track.inertia,t-r),start:r})}return n}getDuration(){const t=this.track.stagger?Tt(this.targets.length,this.track.stagger):0;return this.duration+(this.track.delay??0)+t}getTrack(){return this.track}}function Se(e,t){const i={...Ai(e.pathData,t)};if(e.matrix){const[n,s,r,o,a,l]=e.matrix,{x:c,y:u}=i;i.x=n*c+r*u+a,i.y=s*c+o*u+l;const f=i.angle*Math.PI/180,h=Math.cos(f),d=Math.sin(f);i.angle=Math.atan2(s*h+o*d,n*h+r*d)*180/Math.PI}return e.autoRotate&&e.rotateOffset&&(i.angle+=e.rotateOffset),i}function mr(e,t,i,n){const s=t+(i-t)*n;return Se(e,s)}const Me={upperCase:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",lowerCase:"abcdefghijklmnopqrstuvwxyz",upperAndLowerCase:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",numbers:"0123456789"},gr=20;function ji(e){const t=Me[e??"upperCase"]??e??Me.upperCase,i=Array.from(t);return i.length>0?i:Array.from(Me.upperCase)}function yr(e,t,i){let n=(e|0)^Math.imul(t+1,2654435761)^Math.imul(i+1,2246822507);return n=Math.imul(n^n>>>16,2146121005),n=Math.imul(n^n>>>15,2221713035),(n^n>>>16)>>>0}function zi(e,t,i=0){const n=e.from??"",s=e.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),l=e.rightToLeft??!1;if(e.mode==="type"){const T=Math.round(r*Math.max(o.length,a.length));return l?o.slice(0,Math.max(0,o.length-T)).join("")+a.slice(Math.max(0,a.length-T)).join(""):a.slice(0,T).join("")+o.slice(T).join("")}const c=Math.max(0,Math.min(.999,e.revealDelay??0)),u=Math.max(0,(r-c)/(1-c)),f=Math.floor(u*a.length),h=e.tweenLength===!1?a.length:Math.round(o.length+(a.length-o.length)*r),d=ji(e.chars),g=e.refreshRate??gr,p=g>0?Math.floor(i*g/1e3):0,m=e.seed??1;let b="";for(let T=0;T<h;T++){const v=l?T>=h-f:T<f,S=l?a[a.length-(h-T)]:a[T];v&&S!==void 0||S===" "||S===`
|
|
2
|
-
`?b+=S:b+=d[yr(m,T,p)%d.length]}return b}class Ae{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 i of t.tracks)this.addTrack(i)}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 i={...this._config};delete i.duration,this._config=i}}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 i=this.duration>0?this.duration:1/0;this._currentTime=Math.max(0,Math.min(t,i)),this._repeatDelayRemaining=0,this._wrapAfterDelay=!1}reverse(){this._direction=this._direction==="forward"?"reverse":"forward"}tick(t){if(this._playbackState!=="playing")return;const i=this.duration;if(i<=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 l=i-this._currentTime;if(s>=l){if(s-=l,this._currentTime=i,!this._handleEndReached())break}else this._currentTime+=s,s=0}else{const l=this._currentTime;if(s>=l){if(s-=l,this._currentTime=0,!this._handleStartReached())break}else this._currentTime-=s,s=0}const o=this.getStateAtTime(this._currentTime);this.onUpdate?.(o)}getStateAtTime(t){const i=new Map;if(this._hasSharedWrites())this._resolveShared(t,i);else for(const[n,s]of this._trackPlayers){const r=s.getTrack().property;for(const{target:o,value:a,start:l}of s.getTargetValues(t))this._write(i,n,o,r,a,t-l)}return{values:i,currentTime:this._currentTime,playbackState:this._playbackState,direction:this._direction,loopIteration:this._loopIteration}}_resolveShared(t,i){const n=new Map;for(const[s,r]of this._trackPlayers){const o=r.getTrack().property;for(const{target:a,value:l,start:c}of r.getTargetValues(t)){const u=`${a}\0${o}`,f=c<=t,h=n.get(u);(!h||(f!==h.started?f:f?c>=h.start:c<=h.start))&&n.set(u,{trackId:s,target:a,property:o,value:l,start:c,started:f})}}for(const{trackId:s,target:r,property:o,value:a,start:l}of n.values())this._write(i,s,r,o,a,t-l)}_write(t,i,n,s,r,o){if(r===void 0)return;let a=t.get(n);a||(a=new Map,t.set(n,a));const l=this._textTracks.get(i);if(l&&typeof r=="number"){a.set("text",zi(l.textConfig,r,Math.max(0,o)));return}const c=this._motionPathTracks.get(i);if(c&&typeof r=="number"){const u=Se(c.motionPathConfig,r);a.set("motionPathX",u.x),a.set("motionPathY",u.y),c.motionPathConfig.autoRotate&&a.set("motionPathRotate",u.angle)}else a.set(s,r)}_sharedWrites=null;_hasSharedWrites(){if(this._sharedWrites===null){const t=new Set;this._sharedWrites=!1;t:for(const i of this._tracks)for(const n of et(i)){const s=`${n}\0${i.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,Q(t)){this._trackPlayers.set(t.id,new Hi(t));return}if(Z(t)){this._trackPlayers.set(t.id,new Ui(t)),this._springTracks.set(t.id,t);return}if(Dt(t))this._trackPlayers.set(t.id,new jt(t)),this._textTracks.set(t.id,t);else if(re(t)){const i={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(i)),this._motionPathTracks.set(t.id,t)}else this._trackPlayers.set(t.id,new jt(t))}replaceTrack(t,i){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(i);for(const r of s)this.addTrack(r)}removeTrack(t){this._tracks=this._tracks.filter(i=>i.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(i=>this._matches(i,t))}removeTracks(t={}){const i=this.getTracks(t).map(n=>n.id);for(const n of i)this.removeTrack(n);return i}getTrackSpan(t){const i=this._trackPlayers.get(t);if(!i)return;const n=i.getTrack(),s=n.delay??0;if(Z(n)||Q(n))return{from:s,to:i.getDuration()};const r=n.keyframes;if(!(!r||r.length===0))return{from:r[0].time+s,to:i.getDuration()}}findConflicts(){const t=[];for(let i=0;i<this._tracks.length;i++){const n=this._tracks[i],s=this.getTrackSpan(n.id);if(s)for(let r=0;r<i;r++){const o=this._tracks[r];if(o.property!==n.property)continue;const a=et(o).filter(f=>et(n).includes(f));if(a.length===0)continue;const l=this.getTrackSpan(o.id);if(!l||!(l.from<=s.to&&s.from<=l.to))continue;const u=s.from>=l.from;for(const f of a)t.push({target:f,property:n.property,losingTrackId:u?o.id:n.id,winningTrackId:u?n.id:o.id})}}return t}_matches(t,i){if(i.id!==void 0&&t.id!==i.id||i.property!==void 0&&t.property!==i.property||i.target!==void 0&&!et(t).includes(i.target))return!1;if(i.timeRange){const n=this.getTrackSpan(t.id);if(!n||n.to<i.timeRange.from||n.from>i.timeRange.to)return!1}return!0}toDefinition(){return{formatVersion:wt,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,i)=>t.time-i.time)}setMarkers(t){const i=t&&t.length>0?[...t].sort((s,r)=>s.time-r.time).map(s=>({...s})):void 0,n={...this._config};i?n.markers=i:delete n.markers,this._config=n}get captions(){return this._captions}setCaptions(t){const i={};for(const[n,s]of Object.entries(t??{}))i[n]={...s};this._captions=Object.keys(i).length>0?i:void 0}_armRepeatDelay(){this._repeatDelayRemaining=this._config.repeatDelay??0}_calculateDuration(){let t=0;for(const[,i]of this._trackPlayers)t=Math.max(t,i.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 br=100;function Ee(e,t,i,n){const s=[],r=[],{duration:o,alternate:a}=n,l=(d,g,p,m)=>{r.push([d,g]);const b=[];e.forEach((T,v)=>{(p==="forward"?(m?T>=d:T>d)&&T<=g:(m?T<=d:T<d)&&T>=g)&&b.push(v)}),b.sort((T,v)=>(p==="forward"?e[T]-e[v]:e[v]-e[T])||T-v);for(const T of b)s.push({kind:"event",index:T,direction:p})};let c=t.time,u=t.direction,f=t.fresh===!0;const h=Math.min(br,Math.max(0,i.iteration-t.iteration));for(let d=0;d<h;d++){const g=u==="forward"?o:0;l(c,g,u,f),s.push({kind:"repeat"}),a?(u=u==="forward"?"reverse":"forward",c=g,f=!1):(c=u==="forward"?0:o,f=!0)}return h>0&&n.holding&&!a?{crossings:s,passes:r}:(l(c,i.time,u,f),{crossings:s,passes:r})}function Gi(e){return Q(e)?{id:e.id,target:e.target,property:e.property,kind:"inertia",inertia:Ki(e.inertia),...j(e)}:Z(e)?{id:e.id,target:e.target,property:e.property,kind:"spring",spring:{...e.spring},...j(e)}:Dt(e)?{id:e.id,target:e.target,property:"text",textConfig:{...e.textConfig},keyframes:e.keyframes.map(Pe),...j(e)}:re(e)?{id:e.id,target:e.target,property:"motionPath",motionPathConfig:{...e.motionPathConfig},keyframes:e.keyframes.map(Pe),...j(e)}:{id:e.id,target:e.target,property:e.property,keyframes:e.keyframes.map(Pe),...j(e)}}function Ki(e){return{...e,...Array.isArray(e.end)&&{end:[...e.end]}}}function Pe(e){return{time:e.time,value:e.value,...e.easing&&{easing:e.easing}}}function j(e){const t=e.endDelay;return{...e.delay!==void 0&&{delay:e.delay},...t!==void 0&&{endDelay:t},...e.targets!==void 0&&{targets:[...e.targets]},...e.stagger!==void 0&&{stagger:{...e.stagger}}}}function Qi(e){if(Q(e)){const t=e;return{id:t.id,target:t.target,property:t.property,kind:"inertia",inertia:Ki(t.inertia),...j(t)}}if(Z(e)){const t=e;return{id:t.id,target:t.target,property:t.property,kind:"spring",spring:{...t.spring},...j(t)}}if(Dt(e)){const t=e;return{id:t.id,target:t.target,property:"text",textConfig:{...t.textConfig},keyframes:[...t.keyframes].sort((i,n)=>i.time-n.time),...j(t)}}if(e.property==="motionPath"&&"motionPathConfig"in e){const t=e,i=[...t.keyframes].sort((n,s)=>n.time-s.time);return{id:t.id,target:t.target,property:"motionPath",motionPathConfig:{...t.motionPathConfig},keyframes:i,...j(t)}}return Ht({id:e.id,target:e.target,property:e.property,keyframes:e.keyframes,...j(e)})}function Zi(e){const t=e._config.markers;return{formatVersion:wt,id:e.id,name:e.name,config:{duration:e.duration>0?e.duration:void 0,loop:e._config.loop,speed:e._config.speed,alternate:e._config.alternate,repeatDelay:e._config.repeatDelay,...t&&{markers:t.map(i=>({...i}))}},tracks:e.tracks.map(Gi),...e.captions&&{captions:JSON.parse(JSON.stringify(e.captions))}}}function ft(e){const t=e.formatVersion??1;if(t>wt)throw new Error(`tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${wt}. Update tinyfly to play it.`);return new Ae({id:e.id,name:e.name,config:e.config,tracks:e.tracks.map(Qi),captions:e.captions})}function vr(e){return JSON.stringify(Zi(e))}function wr(e){const t=JSON.parse(e);return ft(t)}function Ji(e){let t=2166136261;for(let i=0;i<e.length;i++)t^=e.charCodeAt(i),t=Math.imul(t,16777619);return t>>>0}function xe(e){let t=e>>>0||2654435769;return{seed:e>>>0,next(){return t^=t<<13,t>>>=0,t^=t>>17,t^=t<<5,t>>>=0,t/4294967296}}}function Ce(e,t,i){return t+e.next()*(i-t)}function tn(e,t,i,n){if(n<=0)return Ce(e,t,i);const s=Math.floor((i-t)/n),r=Math.round(e.next()*s);return t+r*n}function Tr(e,t){if(t.length!==0)return t[Math.floor(e.next()*t.length)]}const en=/^([+\-*/])=\s*(-?[\d.]+)$/,nn=/^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;function kr(e){return typeof e!="string"?!1:en.test(e.trim())||nn.test(e.trim())}function _e(e,t={}){if(typeof e!="string")return e;const i=e.trim(),n=en.exec(i);if(n){const[,r,o]=n,a=t.base??0,l=Number.parseFloat(o);switch(r){case"+":return a+l;case"-":return a-l;case"*":return a*l;case"/":return l===0?a:a/l}}const s=nn.exec(i);if(s){if(!t.random)throw new Error(`resolveValue: "${i}" 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?tn(t.random,r,o,a):Ce(t.random,r,o)}return e}function sn(e,t=0,i){const n=[];let s=t;for(const r of e){const o=_e(r,{base:s,random:i});n.push(o),typeof o=="number"&&(s=o)}return n}class Sr{random;constructor(t){this.random=xe(t)}get seed(){return this.random.seed}resolve(t,i=0){return _e(t,{base:i,random:this.random})}resolveSequence(t,i=0){return sn(t,i,this.random)}}const Mr=600;function rn(e){if(Array.isArray(e)){const[h,d,g,p]=e;return{fn:ln(h,d,g,p),bezier:[h,d,g,p]}}const{segments:t}=it(e);if(t.length===0)throw new Error(`customEase: no curve in "${e}"`);const i=t[0].startX,n=t[0].startY,s=t[t.length-1],r=s.endX-i,o=s.endY-n;if(r===0||o===0)throw new Error(`customEase: "${e}" must move along both axes`);const a=h=>(h-i)/r,l=h=>(h-n)/o;if(t.length===1&&s.type==="C"){const[h,d,g,p]=s.points,m=[a(h),l(d),a(g),l(p)];return{fn:ln(...m),bezier:m}}const c=[],u=[],f=Math.max(8,Math.ceil(Mr/t.length));for(const h of t)for(let d=c.length===0?0:1;d<=f;d++){const[g,p]=Ar(h,d/f);c.push(a(g)),u.push(l(p))}return{fn:Er(c,u)}}function on(e={}){const i=.1+Math.max(0,Math.min(1,e.strength??.7))*.7,n=[1];for(let r=i;r>.002;r*=i)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 l=n[a]/2,c=l*l,u=o-l;return 1-(c-u*u)}o-=n[a]}return 1}}function an(e={}){const t=Math.max(1,e.wiggles??10),i=e.type??"easeOut",n=s=>i==="uniform"?1:i==="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 Ar(e,t){if(e.type==="L"){const[c,u]=e.points;return[e.startX+(c-e.startX)*t,e.startY+(u-e.startY)*t]}const[i,n,s,r,o,a]=e.points,l=1-t;return[l*l*l*e.startX+3*l*l*t*i+3*l*t*t*s+t*t*t*o,l*l*l*e.startY+3*l*l*t*n+3*l*t*t*r+t*t*t*a]}function Er(e,t){return i=>{if(i<=e[0])return t[0];if(i>=e[e.length-1])return t[t.length-1];let n=0,s=e.length-1;for(;s-n>1;){const o=n+s>>1;e[o]<=i?n=o:s=o}const r=e[s]-e[n];return r===0?t[s]:t[n]+(i-e[n])/r*(t[s]-t[n])}}function ln(e,t,i,n){const s=(o,a,l)=>3*(1-o)*(1-o)*o*a+3*(1-o)*o*o*l+o*o*o,r=(o,a,l)=>3*(1-o)*(1-o)*a+6*(1-o)*o*(l-a)+3*o*o*(1-l);return o=>{if(o<=0)return 0;if(o>=1)return 1;let a=o;for(let u=0;u<8;u++){const f=s(a,e,i)-o,h=r(a,e,i);if(Math.abs(f)<1e-6)return s(a,t,n);if(Math.abs(h)<1e-6)break;a-=f/h}let l=0,c=1;a=o;for(let u=0;u<40;u++)s(a,e,i)<o?l=a:c=a,a=(l+c)/2;return s(a,t,n)}}const Pr=350,xr=300,Cr=550;function _r(e,t={}){const i=t.lead??Pr,n=t.gap??xr,s=t.tail??Cr,r=[];let o=0;return e.forEach((a,l)=>{const c=[];let u=o+i;a.lines.forEach((h,d)=>{if(!(h.duration>=0))throw new Error(`narration: scene ${l} line ${d} has an invalid duration (${h.duration})`);d>0&&(u+=n),c.push({id:h.id??`s${l}-l${d}`,scene:l,line:d,start:u,end:u+h.duration,text:h.text}),u+=h.duration});const f=u+s+(a.tail??0);r.push({id:a.id??`s${l}`,start:o,duration:f-o,cues:c}),o=f}),{duration:o,scenes:r,cues:r.flatMap(a=>a.cues)}}function Ir(e){return e.cues.map(t=>({id:t.id,time:t.start,label:t.text}))}function Rr(e,t){let i=e.scenes[0];for(const n of e.scenes)if(t>=n.start)i=n;else break;return i}const z=e=>Math.round(e*1e3)/1e3;function cn(e,t={}){if(e.length===0)return"";const i=t.curviness??1,n=t.closed??!1,s=e.length;let r=`M${z(e[0].x)} ${z(e[0].y)}`;if(s===1)return r;const o=l=>n?e[(l%s+s)%s]:e[Math.max(0,Math.min(s-1,l))],a=n?s:s-1;for(let l=0;l<a;l++){const c=o(l-1),u=o(l),f=o(l+1),h=o(l+2);if(i===0){r+=` L${z(f.x)} ${z(f.y)}`;continue}const d=i/6,g=u.x+(f.x-c.x)*d,p=u.y+(f.y-c.y)*d,m=f.x-(h.x-u.x)*d,b=f.y-(h.y-u.y)*d;r+=` C${z(g)} ${z(p)} ${z(m)} ${z(b)} ${z(f.x)} ${z(f.y)}`}return n?`${r} Z`:r}const $=(e,t=0)=>{const i=parseFloat(e??"");return Number.isFinite(i)?i:t};function Lr(e){const t=(e??"").trim().split(/[\s,]+/).filter(Boolean).map(Number),i=[];for(let n=0;n+1<t.length;n+=2)i.push({x:t[n],y:t[n+1]});return i}function zt(e){const t=e.attributes;switch(e.tag.toLowerCase()){case"path":return t.d??null;case"circle":case"ellipse":{const i=$(t.cx),n=$(t.cy),s=e.tag.toLowerCase()==="circle"?$(t.r):$(t.rx),r=e.tag.toLowerCase()==="circle"?$(t.r):$(t.ry);return`M${i+s} ${n} A${s} ${r} 0 1 1 ${i-s} ${n} A${s} ${r} 0 1 1 ${i+s} ${n} Z`}case"rect":{const i=$(t.x),n=$(t.y),s=$(t.width),r=$(t.height);let o=t.rx!=null?$(t.rx):t.ry!=null?$(t.ry):0,a=t.ry!=null?$(t.ry):o;return o=Math.min(o,s/2),a=Math.min(a,r/2),o===0||a===0?`M${i} ${n} H${i+s} V${n+r} H${i} Z`:`M${i+o} ${n} H${i+s-o} A${o} ${a} 0 0 1 ${i+s} ${n+a} V${n+r-a} A${o} ${a} 0 0 1 ${i+s-o} ${n+r} H${i+o} A${o} ${a} 0 0 1 ${i} ${n+r-a} V${n+a} A${o} ${a} 0 0 1 ${i+o} ${n} Z`}case"line":return`M${$(t.x1)} ${$(t.y1)} L${$(t.x2)} ${$(t.y2)}`;case"polyline":case"polygon":{const i=Lr(t.points);if(i.length===0)return null;const n=i.map((s,r)=>`${r===0?"M":"L"}${s.x} ${s.y}`).join(" ");return e.tag.toLowerCase()==="polygon"?`${n} Z`:n}default:return null}}const Gt={"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]},hn={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 Fr(e){let t=e.trim().toLowerCase();t=t.replace(/\.ease(in|out|inout)$/,".$1");const i=/^([a-z]+\d?)(\(.*\))?$/.exec(t);return i&&i[1]!=="steps"&&t!=="none"&&t!=="linear"&&(t=`${i[1]}.out${i[2]??""}`),t}U({type:"bounce",mode:"in"}),U({type:"bounce",mode:"in-out"});function Ct(e){const t=un.get(e.trim().toLowerCase());if(t)return t;const i=Fr(e),n=/^steps\(\s*(\d+)\s*\)$/.exec(i);if(n){const o={type:"steps",count:Math.max(1,Number.parseInt(n[1],10))+1,position:"none"};return{easing:o,fn:U(o)}}const s=/^(elastic|bounce|back)\.(in|out|inout)(?:\(([^)]*)\))?$/.exec(i);if(s){const[,r,o,a]=s,l=(a??"").split(",").map(f=>Number.parseFloat(f)).filter(f=>Number.isFinite(f)),c=o==="inout"?"in-out":o;if(r==="back"&&l.length===0&&i in Gt)return{easing:{type:"cubic-bezier",points:Gt[i]}};const u=r==="elastic"?{type:"elastic",mode:c,...l[0]!==void 0&&{amplitude:l[0]},...l[1]!==void 0&&{period:l[1]}}:r==="bounce"?{type:"bounce",mode:c}:{type:"back",mode:c,...l[0]!==void 0&&{overshoot:l[0]}};return{easing:u,fn:U(u)}}return i in hn?{easing:hn[i]}:i in Gt?{easing:{type:"cubic-bezier",points:Gt[i]}}:{easing:"ease-out"}}const un=new Map;function Ie(e,t){return un.set(e.trim().toLowerCase(),t.bezier?{easing:{type:"cubic-bezier",points:t.bezier},fn:t.fn}:{fn:t.fn,requiresBaking:"custom"}),e}function Re(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let i=t;return i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61),((i^i>>>14)>>>0)/4294967296}}const fn=/^\s*random\(\s*(\[.*\]|[^)]*)\s*\)\s*$/;function dn(e){return typeof e=="string"&&fn.test(e)}function $r(e=1){let t=Re(e);const i=(l,c)=>((...u)=>u.length>=l?c(...u):f=>c(...u,f)),n=(l,c,u)=>Math.min(Math.max(u,Math.min(l,c)),Math.max(l,c)),s=(l,c,u,f,h)=>c===l?u:u+(h-l)/(c-l)*(f-u),r=(l,c)=>{if(typeof l=="number")return l===0?c:Math.round(c/l)*l;if(Array.isArray(l))return pn(l,c,1/0);if("values"in l)return pn(l.values,c,l.radius??1/0);const u=Math.round(c/l.increment)*l.increment;return Math.abs(u-c)<=(l.radius??1/0)?u:c},o=(l,c,u)=>{const f=l+t()*(c-l);return u?Math.round(f/u)*u:f};return{clamp:i(3,n),mapRange:i(5,s),normalize:i(3,(l,c,u)=>s(l,c,0,1,u)),interpolate:i(3,(l,c,u)=>{if(typeof l=="object"&&!Array.isArray(l)){const f={};for(const h of Object.keys(l))f[h]=xt(l[h])(l[h],c[h],u);return f}return xt(l)(l,c,u)}),wrap:((l,c,u)=>{if(Array.isArray(l)){const p=l,m=b=>p[(Math.round(b)%p.length+p.length)%p.length];return c===void 0?m:m(c)}const f=l,d=c-f,g=p=>d===0?f:((p-f)%d+d)%d+f;return u===void 0?g:g(u)}),wrapYoyo:i(3,(l,c,u)=>{const f=c-l;if(f===0)return l;const h=((u-l)%(f*2)+f*2)%(f*2);return l+(h>f?f*2-h:h)}),snap:i(2,r),random:((l,c,u,f)=>{if(Array.isArray(l)){const d=()=>l[Math.floor(t()*l.length)];return c===!0?d:d()}const h=()=>o(l,c,u);return f?h:h()}),shuffle:l=>{for(let c=l.length-1;c>0;c--){const u=Math.floor(t()*(c+1));[l[c],l[u]]=[l[u],l[c]]}return l},distribute:({base:l=0,amount:c,each:u,from:f="start",ease:h})=>(d,g,p)=>{const m=p.length,T=Ot(d,m,{...c!==void 0?{amount:c}:{each:u??1},from:f}),v=c!==void 0?c:(u??1)*ae(m,f),S=h&&v>0?h(T/v)*v:T;return l+S},pipe:(...l)=>c=>l.reduce((u,f)=>f(u),c),splitColor:l=>Dr(l),getUnit:l=>typeof l=="number"?"":/^-?[\d.]+(?:e[-+]?\d+)?([a-z%]*)$/i.exec(l.trim())?.[1]??"",seed:l=>{t=Re(l)},resolveRandomString:l=>{const c=fn.exec(l)?.[1]??"";if(c.startsWith("[")){const g=c.slice(1,-1).split(",").map(p=>p.trim()).filter(Boolean).map(p=>Number.isFinite(Number(p))?Number(p):p.replace(/^['"]|['"]$/g,""));return g[Math.floor(t()*g.length)]}const[u,f,h]=c.split(",").map(d=>Number.parseFloat(d));return o(u,f,Number.isFinite(h)?h:void 0)}}}function pn(e,t,i){let n=t,s=1/0;for(const r of e){const o=Math.abs(r-t);o<s&&(s=o,n=r)}return s<=i?n:t}function Dr(e){const t=e.trim(),i=/^#([0-9a-f]{3,8})$/i.exec(t)?.[1];if(i){const r=(i.length<=4?[...i].map(o=>o+o).join(""):i).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 Or=/^([+-])=\s*(-?[\d.]+)$/,Br=/^([<>])\s*(?:([+-])?=?\s*(-?[\d.]+))?$/;function _t(e,t){const i=t.scale??1,n=c=>Number.parseFloat(c)*i;if(e===void 0)return t.cursor;if(typeof e=="number")return e*i;const s=e.trim();if(s==="")return t.cursor;const r=Or.exec(s);if(r){const c=n(r[2]);return t.cursor+(r[1]==="-"?-c:c)}const o=Br.exec(s);if(o){const c=o[1]==="<"?t.previousStart:t.previousEnd;if(o[3]===void 0)return c;const u=n(o[3]);return c+(o[2]==="-"?-u:u)}const a=/^(.+?)([+-])=\s*(-?[\d.]+)$/.exec(s);if(a){const c=t.labels.get(a[1].trim());if(c!==void 0){const u=n(a[3]);return c+(a[2]==="-"?-u:u)}}const l=t.labels.get(s);return l!==void 0?l:/^-?[\d.]+$/.test(s)?n(s):t.cursor}function Nr(e){if(typeof e!="object"||e===null)return!1;const t=e;return t.grid!==void 0||t.from==="random"||Array.isArray(t.from)||t.ease!==void 0||t.axis!==void 0}function qr(e,t,i={}){if(e===0)return[];const n=t.grid==="auto"?Math.max(1,Math.min(e,i.columnsFromLayout?.()??e)):Array.isArray(t.grid)?Math.max(1,t.grid[1]):e,s=Array.isArray(t.grid)?Math.max(1,t.grid[0]):Math.ceil(e/n),r=g=>({x:g%n,y:Math.floor(g/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(e-1,o))):o==="end"?r(e-1):o==="center"||o==="edges"?{x:(n-1)/2,y:(s-1)/2}:{x:0,y:0},l=g=>{const{x:p,y:m}=r(g),b=Math.abs(p-a.x),T=Math.abs(m-a.y);return t.axis==="x"?b:t.axis==="y"?T:Math.hypot(b,T)};let c=Array.from({length:e},(g,p)=>l(p));const u=Math.max(...c);if(o==="edges"&&(c=c.map(g=>u-g)),o==="random"){const g=i.random??Math.random;c=c.map(()=>g()*u)}const f=t.amount!==void 0?t.amount:(t.each??0)*u,h=t.ease?Ct(t.ease):void 0,d=h?h.fn??U(h.easing):void 0;return c.map(g=>{const p=u===0?0:g/u;return(d?d(p):p)*f})}const Le=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 Kt(e){const t={},i={};for(const[n,s]of Object.entries(e))Le.has(n)?t[n]=s:i[n]=s;return{config:t,properties:i}}function Qt(e,t){return e===void 0?t:e*1e3}function Fe(e,t){if(e!==void 0)return typeof e=="number"?{each:e*1e3}:Nr(e)?{offsets:qr(t?.count??0,e,t??{}).map(n=>n*1e3)}:{...e.each!==void 0&&{each:e.each*1e3},...e.amount!==void 0&&{amount:e.amount*1e3},...e.from!==void 0&&{from:e.from}}}const Yr={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 mn(e){return Yr[e]}function Xr(e){const t=typeof e=="string"||Array.isArray(e)?{path:e}:e;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 i;if(Array.isArray(t.path))i=cn(t.path,{curviness:t.curviness});else if(ht(t.path))i=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:i};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 Vr(e){const t=typeof e=="string"||Array.isArray(e)?{path:e}:{...e};return{...t,start:t.end??1,end:t.start??0}}function gn(e){return typeof e=="object"&&e!==null&&"shape"in e?e.shape:e}function Wr(e){if(e.morphSVG===void 0)return e;const{morphSVG:t,...i}=e,n=gn(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{...i,d:n}}function Ur(e,t){if(e===!0)return[0,t];if(e===!1)return[0,0];if(typeof e=="number")return[0,yn(e,t)];const i=e.trim().split(/[\s,]+/).filter(Boolean),n=o=>{const a=Number.parseFloat(o);if(Number.isNaN(a))throw new Error(`gsap-compat: drawSVG "${e}" is not a length or percentage`);return yn(o.endsWith("%")?t*a/100:a,t)};if(i.length===0)return[0,t];if(i.length===1)return[0,n(i[0])];const s=n(i[0]),r=n(i[1]);return s<=r?[s,r]:[r,s]}function Hr(e,t){const[i,n]=Ur(e,t);return{strokeDasharray:[n-i,t],strokeDashoffset:-i}}function jr(e,t){if(e.drawSVG===void 0)return e;const{drawSVG:i,...n}=e;return{...n,...Hr(i,t)}}function zr(e){if(e.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 e}function yn(e,t){return Math.max(0,Math.min(t,e))}function Gr(e){let t=2166136261;for(let i=0;i<e.length;i++)t=Math.imul(t^e.charCodeAt(i),16777619);return t>>>0}function Kr(e,t,i){if(e.scrambleText!==void 0){const n=e.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&&i>0?s.revealDelay*1e3/i: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??Gr(`${t}|${s.text}`)}}if(e.text!==void 0){const n=e.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 $e(e){return Math.max(.1,e/25)}function Qr(e,t){const i=typeof t=="number"?{velocity:t}:t;if(typeof i?.velocity!="number"||!Number.isFinite(i.velocity))throw new Error("gsap-compat: inertia needs a velocity for each property — a number, or { velocity }.");const n=i.friction??(i.resistance!==void 0?$e(i.resistance):void 0),s={from:e,velocity:i.velocity,...n!==void 0&&{friction:n},...i.min!==void 0&&{min:i.min},...i.max!==void 0&&{max:i.max}};return typeof i.end=="function"?s.end=[i.end(St(s))]:i.end!==void 0&&(s.end=Array.isArray(i.end)?[...i.end]:i.end),s}function Zr(e){const t=e===!0?{}:typeof e=="string"?{preset:e}:e;if(t.preset!==void 0&&!(t.preset in qt))throw new Error(`gsap-compat: unknown spring preset "${t.preset}" — use one of ${Object.keys(qt).join(", ")}`);return{...t.preset?qt[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 Jr(e,t){if(e===!0||typeof e=="string")return;const i=e.velocity;return typeof i=="number"?i:i?.[t]}class nt{timeline;options;cursor=0;fallbackRandom=Re(1);previousStart=0;previousEnd=0;labels=new Map;trackCounter=0;lastValues=new Map;constructor(t={}){this.options=t,this.timeline=new Ae({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,i,n){return this.build(t,void 0,It(i),n)}from(t,i,n){const{config:s,properties:r}=Kt(It(i)),{motionPath:o,text:a,scrambleText:l,...c}=r,u=this.targetsOf(t)[0],f={...s};for(const g of Object.keys(c))f[g]=this.resolveStart(u,g);o!==void 0&&(f.motionPath=Vr(o));const h={},d=String(this.resolveStart(u,"text"));return a!==void 0&&(h.text=De(a),f.text=typeof a=="object"?{...a,value:d}:d),l!==void 0&&(h.text=De(l),f.scrambleText=typeof l=="object"?{...l,text:d}:d),this.build(t,{...c,...h},f,n)}fromTo(t,i,n,s){const{properties:r}=Kt(It(i));return this.build(t,r,It(n),s)}set(t,i,n){return this.build(t,void 0,{...It(i),duration:0},n)}get lastStart(){return this.previousStart}get lastEnd(){return this.previousEnd}addEvent(t){const i=Math.max(0,_t(t,this.context()));return this.previousStart=i,this.previousEnd=i,this.cursor=Math.max(this.cursor,i),i}timeOf(t){return _t(t,this.context())}addLabel(t,i){return this.labels.set(t,_t(i,this.context())),this}labelTimes(){return[...this.labels.values()].sort((t,i)=>t-i)}labelTime(t){return this.labels.get(t)}add(t,i){const n=_t(i,this.context());for(const r of t.timeline.tracks){if(!("keyframes"in r))continue;const o=Ht({...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 i=this.labels.get(t);return i!==void 0&&this.timeline.seek(i),this}return this.timeline.seek(t*1e3),this}progress(t){const i=this.timeline.duration;return t!==void 0&&i>0&&this.timeline.seek(t*i),i>0?this.timeline.currentTime/i: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,i,n,s){const{config:r,properties:o}=Kt(n),{motionPath:a,text:l,scrambleText:c,inertia:u,...f}=o,h=this.targetsOf(t),d=_t(s,this.context()),g=Qt(r.delay,0),p=Qt(r.duration,500),m=Fe(r.stagger,{count:h.length,columnsFromLayout:this.options.layoutColumns?()=>this.options.layoutColumns(h):void 0,random:this.options.random??this.fallbackRandom}),b=this.easingFor(r.ease),T=[],v=r.spring;let S=0,w=!1;for(const[A,_]of Object.entries(f)){const C=_;let I=i?.[A]!==void 0?i[A]:this.resolveStart(h[0],A);if(typeof I!=typeof C&&(this.warn(`no usable start value for "${A}" on "${h[0]}" — it will snap to ${String(C)}. Use fromTo() to animate it.`),I=C),v!==void 0&&(typeof I!="number"||typeof C!="number")&&this.warn(`spring works on numbers, so "${A}" on "${h[0]}" eases instead`),v!==void 0&&typeof I=="number"&&typeof C=="number"){const O={...Zr(v),from:I,to:C,velocity:Jr(v,A)??this.options.startVelocity?.(h[0],A)??0},q=this.nextTrackId(`${h[0]}-${A}-spring`),N={id:q,target:h[0],...h.length>1&&{targets:h},...m&&h.length>1&&{stagger:m},property:A,kind:"spring",spring:O,delay:d+g};this.timeline.addTrack(N),T.push(q),S=Math.max(S,ci(O));for(const F of h)this.lastValues.set(`${F}|${A}`,C);continue}w=!0;const x=this.keyframesFor(I,C,p,b,r.ease),L=this.nextTrackId(`${h[0]}-${A}`);this.timeline.addTrack(Ht({id:L,target:h[0],...h.length>1&&{targets:h},...m&&h.length>1&&{stagger:m},property:A,delay:d+g,keyframes:x})),T.push(L);for(const O of h)this.lastValues.set(`${O}|${A}`,C)}const k=Kr({text:l,scrambleText:c},h[0],p);if(k){const A=i?.text??i?.scrambleText,_=A!==void 0?De(A):this.resolveStart(h[0],"text"),C=this.nextTrackId(`${h[0]}-text`),I={id:C,target:h[0],...h.length>1&&{targets:h},...m&&h.length>1&&{stagger:m},property:"text",textConfig:{from:typeof _=="string"?_:String(_??""),...k},delay:d+g,keyframes:this.keyframesFor(0,1,p,b,r.ease)};this.timeline.addTrack(I),T.push(C);for(const x of h)this.lastValues.set(`${x}|text`,k.to)}if(a!==void 0){const{config:A,start:_,end:C}=Xr(a),I=this.nextTrackId(`${h[0]}-motionPath`),x={id:I,target:h[0],...h.length>1&&{targets:h},...m&&h.length>1&&{stagger:m},property:"motionPath",motionPathConfig:A,delay:d+g,keyframes:this.keyframesFor(_,C,p,b,r.ease)};this.timeline.addTrack(x),T.push(I)}if(u!==void 0)for(const[A,_]of Object.entries(u)){const C=this.resolveStart(h[0],A);if(typeof C!="number"){this.warn(`inertia on "${A}" needs a numeric start value; skipped`);continue}const I=Qr(C,_),x=this.nextTrackId(`${h[0]}-${A}-inertia`),L={id:x,target:h[0],...h.length>1&&{targets:h},...m&&h.length>1&&{stagger:m},property:A,kind:"inertia",inertia:I,delay:d+g};this.timeline.addTrack(L),T.push(x),S=Math.max(S,lt(I));for(const O of h)this.lastValues.set(`${O}|${A}`,at(I))}const R=((u!==void 0||v!==void 0)&&!w&&!k&&a===void 0?S:Math.max(p,S))+(m&&h.length>1?Tt(h.length,m):0),P=d+g+R;return this.previousStart=d+g,this.previousEnd=P,this.cursor=Math.max(this.cursor,P),{trackIds:T,start:d+g,end:P,kill:()=>{for(const A of T)this.timeline.removeTrack(A)}}}keyframesFor(t,i,n,s,r){const o={time:0,value:t};if(n<=0)return[{time:0,value:i}];const a=typeof r=="string"?Ct(r):void 0;if(a?.requiresBaking==="custom"||this.options.bakeEases&&vt(s)){const c=a?.fn??U(s);return[o,...ke(o,{time:n,value:i},c,{intervalMs:this.options.bakeIntervalMs})]}return[o,{time:n,value:i,...s&&{easing:s}}]}resolveStart(t,i){const n=this.lastValues.get(`${t}|${i}`);if(n!==void 0)return n;const s=this.options.startValue?.(t,i);if(s!==void 0)return s;const r=this.options.defaults?.[i];if(r!==void 0)return r;if(i==="text")return"";if(i==="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=mn(i);return o!==void 0?(this.warn(`no start value for "${i}" 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 "${i}" on "${t}" — using 0`),0)}easingFor(t){if(t!==void 0){if(typeof t=="string")return Ct(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 De(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){const t=e;return String(t.value??t.text??"")}return String(e??"")}function to(e){return new nt(e)}function It(e){return zr(Wr(e))}const eo=new Set(["blur","brightness","glow","glowColor","shadowX","shadowY","shadowBlur","shadowColor"]),io="#ffffff",no="rgba(0, 0, 0, 0.5)";function so(e){const t=[];if(e.blur!==void 0&&t.push(`blur(${Math.max(0,e.blur)}px)`),e.brightness!==void 0&&t.push(`brightness(${Math.max(0,e.brightness)})`),e.glow!==void 0&&t.push(`drop-shadow(0 0 ${Math.max(0,e.glow)}px ${e.glowColor??io})`),e.shadowX!==void 0||e.shadowY!==void 0||e.shadowBlur!==void 0){const i=e.shadowX??0,n=e.shadowY??0,s=Math.max(0,e.shadowBlur??0);t.push(`drop-shadow(${i}px ${n}px ${s}px ${e.shadowColor??no})`)}return t.length>0?t.join(" "):null}function ro(e,t){const i=e.childNodes.length===1?e.firstChild:null;if(i&&i.nodeType===3){const n=i;n.data!==t&&(n.data=t);return}e.textContent!==t&&(e.textContent=t)}function oo(e){if(!("ownerSVGElement"in e))return;const t=e.style;!t||t.transformBox||(t.transformBox="fill-box",t.transformOrigin||(t.transformOrigin="50% 50%"))}const bn=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"]),ao=new Set(["x","y","z","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skewX","skewY","motionPathX","motionPathY","motionPathRotate"]),lo=new Set(["originX","originY"]),co=new Set(["clipTop","clipRight","clipBottom","clipLeft"]),ho=new Set(["drawOn"]),uo={fill:"backgroundColor",stroke:"borderColor",strokeWidth:"borderWidth",color:"color",backgroundColor:"backgroundColor",borderColor:"borderColor"},vn={fill:"fill",stroke:"stroke",strokeWidth:"strokeWidth",strokeDasharray:"strokeDasharray",strokeDashoffset:"strokeDashoffset",fillOpacity:"fillOpacity",strokeOpacity:"strokeOpacity"},fo="http://www.w3.org/2000/svg";class st{targets=new Map;registerTarget(t,i){this.targets.set(t,i)}unregisterTarget(t){this.targets.delete(t)}getTarget(t){return this.targets.get(t)}clearTargets(){this.targets.clear()}applyState(t){for(const[i,n]of t.values){const s=this.targets.get(i);s&&this.applyProperties(s,n)}}applyProperties(t,i){const n=[];let s=null,r=null,o=null;const a=i.has("motionPathX"),l=i.has("motionPathY"),c=i.has("motionPathRotate");for(const[h,d]of i)if(!(h==="x"&&a)&&!(h==="y"&&l)&&!((h==="rotate"||h==="rotateZ")&&c)&&!ho.has(h)){if(ao.has(h)){const g=this.buildTransformPart(h,d);g&&n.push(g)}else if(lo.has(h))typeof d=="number"&&((s??={})[h]=d);else if(co.has(h))typeof d=="number"&&((r??={})[h]=d);else if(eo.has(h))(o??={})[h]=d;else if(h!=="perspective"){if(h!=="shine")if(h==="text"&&typeof d=="string")ro(t,d);else if(h==="d"&&typeof d=="string"){const g=t;(g.tagName?.toLowerCase()==="path"?g:g.querySelector?.("path"))?.setAttribute?.("d",d)}else this.applyStyleProperty(t,h,d)}}const u=i.get("shine");typeof u=="number"&&this.applyShine(t,u);const f=i.get("perspective");if(typeof f=="number"&&n.unshift(`perspective(${f}px)`),n.length>0&&(t.style.transform=n.join(" "),oo(t)),s){const h=s.originX??50,d=s.originY??50;t.style.transformOrigin=`${h}% ${d}%`}if(r){const h=r.clipTop??0,d=r.clipRight??0,g=r.clipBottom??0,p=r.clipLeft??0;t.style.clipPath=`inset(${h}% ${d}% ${g}% ${p}%)`}if(o){const h=so(o);h&&(t.style.filter=h)}}buildTransformPart(t,i){if(typeof i!="number")return null;switch(t){case"x":case"motionPathX":return`translateX(${i}px)`;case"y":case"motionPathY":return`translateY(${i}px)`;case"z":return`translateZ(${i}px)`;case"rotate":case"rotateZ":case"motionPathRotate":return`rotate(${i}deg)`;case"rotateX":return`rotateX(${i}deg)`;case"rotateY":return`rotateY(${i}deg)`;case"scale":return`scale(${i})`;case"scaleX":return`scaleX(${i})`;case"scaleY":return`scaleY(${i})`;case"scaleZ":return`scaleZ(${i})`;case"skewX":return`skewX(${i}deg)`;case"skewY":return`skewY(${i}deg)`;default:return null}}applyShine(t,i){t.dataset.shineBase||(t.dataset.shineBase=t.style.color||"currentColor");const n=t.dataset.shineBase,s=-20+i*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,i,n){let s;if(t.namespaceURI===fo&&i in vn){const a=Array.isArray(n)?n.join(", "):String(n);t.style[vn[i]]=a;return}else i==="fill"&&t.dataset?.elementType==="text"?s="color":s=uo[i]??i;let o;typeof n=="number"?bn.has(i)||bn.has(s)?o=`${n}px`:o=String(n):Array.isArray(n)?o=n.join(", "):o=n,t.style[s]=o}}const po={request:e=>requestAnimationFrame(e),cancel:e=>cancelAnimationFrame(e)};class wn{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=$r();active=new Map;applied=new Map;dirty=new Set;frameId=null;lastTimestamp=null;destroyed=!1;constructor(t={}){this.scheduler=t.scheduler??po,this.rootOption=t.root,this.onWarning=t.onWarning}get root(){return this.rootOption??document}resolveTargets(t){const i=[];for(const n of this.targetsOf(t)){const s=this.nameFor(n);Oe(n)&&this.currentCollector?.touch(n,s),i.push(s)}return i}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,i){return this.applied.get(t)?.get(i)}velocityOf(t,i){for(const s of[...this.active.keys()].reverse()){if(s.getTracks({target:t,property:i}).length===0)continue;const r=s.currentTime;if(r<4)return 0;const o=s.getStateAtTime(r).values.get(t)?.get(i),a=s.getStateAtTime(r-4).values.get(t)?.get(i);if(typeof o!="number"||typeof a!="number")return;const l=(o-a)/4;return(s.direction==="reverse"?-l:l)*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,i={}){this.destroyed||(t.onUpdate=n=>this.write(n),this.active.delete(t),this.active.set(t,i),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,i){if(this.destroyed)return;const n=new Map(Object.entries(i));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 i=[...this.active];for(const[n]of i)n.duration<=0?(this.write(n.getStateAtTime(0)),n.stop()):n.tick(t);this.flush();for(const[n,s]of i)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 i of[...this.tickerCallbacks])i(this.tickerTime/1e3,t,this.tickerFrame)}}write(t){for(const[i,n]of t.values){let s=this.applied.get(i);s||(s=new Map,this.applied.set(i,s));for(const[r,o]of n)s.set(r,o);this.dirty.add(i)}}flush(){if(this.dirty.size===0)return;const t=new Map;for(const i of this.dirty){const n=this.applied.get(i),s=this.objects.get(i);if(s)for(const[r,o]of n)s[r]=o;else t.set(i,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 i=this.lastTimestamp===null?0:t-this.lastTimestamp;this.lastTimestamp=t,i>0&&this.tick(i),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(Oe(t))return[t];if(!mo(t))return[t];const i=[];for(const n of Array.from(t))i.push(...this.targetsOf(n));return i}nameFor(t){return Oe(t)?this.elementName(t):this.objectName(t)}objectName(t){const i=this.objectNames.get(t);if(i)return i;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 i=this.names.get(t);if(i)return i;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 Oe(e){return typeof e=="object"&&e!==null&&e.nodeType===1}function mo(e){if(Array.isArray(e))return!0;const t=e;return typeof t.length=="number"&&typeof t.item=="function"}function Zt(e){const t=e.style;if(!t)return e.getBoundingClientRect();const i=t.transform;t.transform="none";const n=e.getBoundingClientRect();return t.transform=i,n}const Tn=e=>typeof e=="object"&&e!==null&&e.nodeType===1;function go(e){const t={};for(const i of Array.from(e.attributes))t[i.name]=i.value;return t}function yo(e){const t=e.getScreenCTM?.();if(t)return[t.a,t.b,t.c,t.d,t.e,t.f];const i=e.getBoundingClientRect();return[1,0,0,1,i.left,i.top]}function bo(e,t){const i=typeof e=="string"||Array.isArray(e)||Tn(e)?{path:e}:e,{align:n,alignOrigin:s,path:r,...o}=i,a=k=>{const M=Tn(k)?k:t.query(k);return M||t.warn(`gsap-compat: motionPath could not find "${String(k)}"`),M};let l=null,c="";if(Array.isArray(r)||typeof r=="string"&&ht(r))c=r;else{l=a(r);const k=l&&zt({tag:l.localName,attributes:go(l)});l&&!k&&t.warn(`gsap-compat: motionPath element <${l.localName}> has no path geometry`),c=k??""}const u={...o,path:c};if(n===void 0||n===!1)return u;const f=n===!0?l:a(n);if(!f)return n===!0&&t.warn("gsap-compat: motionPath align: true needs the path to be an element"),u;const h=t.targets[0];if(!h)return u;const[d,g,p,m,b,T]=yo(f),v=Zt(h),[S,w]=s??[.5,.5];for(const k of t.targets.slice(1)){const M=Zt(k);if(Math.abs(M.left-v.left)>.5||Math.abs(M.top-v.top)>.5){t.warn("gsap-compat: motionPath align measures the first target; the others are laid out elsewhere");break}}return u.matrix=[d,g,p,m,b-v.left-S*v.width,T-v.top-w*v.height],u}const kn=e=>typeof e=="object"&&e!==null&&e.nodeType===1;function Sn(e){const t={};for(const i of Array.from(e.attributes))t[i.name]=i.value;return t}function Mn(e){if(!e)return null;const t=zt({tag:e.localName,attributes:Sn(e)});return t||(e.querySelector("path")?.getAttribute("d")??null)}function vo(e,t,i){const n=gn(e);if(typeof n=="string"&&ht(n))return n;const s=kn(n)?n:typeof n=="string"?t(n):null,r=Mn(s);return r||(i(`gsap-compat: morphSVG could not find a shape for "${String(n)}"`),"")}const wo=new Set(["cx","cy","r","rx","ry","x","y","width","height","x1","y1","x2","y2","points"]);function To(e,t=document){return(typeof e=="string"?Array.from(t.querySelectorAll(e)):kn(e)?[e]:Array.from(e)).map(n=>{if(n.localName==="path")return n;const s=zt({tag:n.localName,attributes:Sn(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))wo.has(o.name)||r.setAttribute(o.name,o.value);return r.setAttribute("d",s),n.parentNode.replaceChild(r,n),r})}const An=.3;class En{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,i,n){this.dragging=!0,this.passedTolerance=!1,this.startX=t,this.startY=i,this.lastX=t,this.lastY=i,this.velocityX=0,this.velocityY=0,this.lastTime=Pn(),this.options.onPress?.(this.stateFrom(0,0,n))}move(t,i,n){if(!this.dragging)return;const s=t-this.lastX,r=i-this.lastY;this.lastX=t,this.lastY=i;const o=t-this.startX,a=i-this.startY,l=this.options.tolerance??3;if(!this.passedTolerance){if(Math.hypot(o,a)<l)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,i){const n=Pn(),s=Math.max(1,n-this.lastTime);this.lastTime=n;const r=t/s*1e3,o=i/s*1e3;this.velocityX+=(r-this.velocityX)*An,this.velocityY+=(o-this.velocityY)*An}stateFrom(t,i,n){return{deltaX:t,deltaY:i,velocityX:this.velocityX,velocityY:this.velocityY,totalX:this.lastX-this.startX,totalY:this.lastY-this.startY,isDragging:this.dragging,event:n}}onPointerDown=t=>{const i=t,n=this.target;if(typeof i.pointerId=="number"&&typeof n.setPointerCapture=="function")try{n.setPointerCapture(i.pointerId)}catch{}this.begin(i.clientX,i.clientY,t)};onPointerMove=t=>{const i=t;this.move(i.clientX,i.clientY,t)};onPointerUp=t=>this.end(t);onTouchStart=t=>{const i=t.touches[0];i&&this.begin(i.clientX,i.clientY,t)};onTouchMove=t=>{const i=t.touches[0];i&&this.move(i.clientX,i.clientY,t)};onTouchEnd=t=>this.end(t);onWheel=t=>{const i=t;this.options.preventDefault!==!1&&i.cancelable&&i.preventDefault(),this.updateVelocity(i.deltaX,i.deltaY),this.options.onMove?.({deltaX:i.deltaX,deltaY:i.deltaY,velocityX:this.velocityX,velocityY:this.velocityY,totalX:0,totalY:0,isDragging:!1,event:t})}}function Pn(){return typeof performance<"u"?performance.now():Date.now()}function xn(e,t,i){let n={delta:0,line:null},s=i;for(const r of e)for(const o of t){const a=Math.abs(o-r);a<=s&&(s=a,n={delta:o-r,line:o})}return n}function Cn(e,t){return t<=0?[]:e.map(i=>Math.round(i/t)*t)}class Be{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 En({target:t.target,onPress:i=>{const n=t.getPosition?.();n&&(this.x=n.x,this.y=n.y),this.originX=this.x,this.originY=this.y,t.onPress?.(i)},onMove:i=>this.handleMove(i),onRelease:i=>t.onRelease?.(i)})}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,i){const n=this.options.axis??"both";this.x=n==="y"?this.x:this.applyConstraints(t,"x"),this.y=n==="x"?this.y:this.applyConstraints(i,"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 i=t.duration;if(i<=0)return;const n=this.options.scrubDistance??500;if(n===0)return;const s=(this.options.axis??"both")==="y"?this.y:this.x,r=ko(s/n);t.pause(),t.seek(r*i)}applyConstraints(t,i){let n=t;const s=[...Cn([n],this.options.snap??0),...(i==="x"?this.options.snapLinesX:this.options.snapLinesY)??[]],r=xn([n],s,this.snapThreshold());n+=r.delta,i==="x"?this.snappedX=r.line:this.snappedY=r.line;const o=this.options.bounds;if(o){const a=i==="x"?o.minX:o.minY,l=i==="x"?o.maxX:o.maxY;a!==void 0&&(n=Math.max(a,n)),l!==void 0&&(n=Math.min(l,n))}return n}}function ko(e){return e<0?0:e>1?1:e}function So(e){const t=new Be(e);return t.start(),t}const Mo={x:"x",y:"y","x,y":"both"},Ne=e=>typeof e=="object"&&e!==null&&e.nodeType===1;function _n(e,t){const i=Zt(e),n=t.getBoundingClientRect();return{minX:n.left-i.left,maxX:n.right-i.right,minY:n.top-i.top,maxY:n.bottom-i.bottom}}function In(e){return Array.isArray(e)?[...e]:e}function Ao(e,t,i,n={}){const[s]=t.resolveTargets(i),r=s?t.elementFor(s):void 0;if(!s||!r)throw new Error(`gsap-compat: live.draggable could not find ${String(i)}`);if(n.type==="rotation")return Eo(e,t,s,r,n);const o=Mo[n.type??"x,y"],a=()=>{const p=t.appliedValue(s,"x"),m=t.appliedValue(s,"y");return{x:typeof p=="number"?p:0,y:typeof m=="number"?m:0}},l=typeof n.bounds=="string"?t.query(n.bounds):Ne(n.bounds)?n.bounds:null,u={bounds:(!l&&n.bounds&&!Ne(n.bounds)?n.bounds:void 0)??(l?_n(r,l):void 0)};let f=null;const h=()=>{f?.kill(),f=null},d=p=>{const m=n.inertia===!0?{}:n.inertia,b=m.friction??(m.resistance!==void 0?$e(m.resistance):4),T=a(),v=u.bounds??{};let S,w;const k=m.end;if(Array.isArray(k)){const E=St({from:T.x,velocity:o==="y"?0:p.x,friction:b}),R=St({from:T.y,velocity:o==="x"?0:p.y,friction:b});let P=k[0];for(const A of k)Math.hypot(A.x-E,A.y-R)<Math.hypot(P.x-E,P.y-R)&&(P=A);P&&(S=[P.x],w=[P.y])}else typeof k=="number"?(S=k,w=k):k&&(S=In(k.x),w=In(k.y));const M={};o!=="y"&&(M.x={velocity:p.x,friction:b,min:v.minX,max:v.maxX,end:S}),o!=="x"&&(M.y={velocity:p.y,friction:b,min:v.minY,max:v.maxY,end:w}),f=e.to(r,{inertia:M,onComplete:()=>n.onThrowComplete?.()})},g=new Be({target:r,axis:o,snap:n.snap,get bounds(){return u.bounds},getPosition:a,onPress:()=>{h(),l&&(u.bounds=_n(r,l)),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=g.velocity;n.onRelease?.(p),n.inertia&&d(p)}});return g.start(),{draggable:g,get position(){return a()},get rotation(){const p=t.appliedValue(s,"rotate");return typeof p=="number"?p:0},destroy(){h(),g.destroy()}}}function Eo(e,t,i,n,s){const r=typeof s.bounds=="object"&&s.bounds!==null&&!Ne(s.bounds)?s.bounds:{},o=()=>{const v=t.appliedValue(i,"rotate");return typeof v=="number"?v:0},a=v=>Math.min(r.maxRotation??1/0,Math.max(r.minRotation??-1/0,v));let l=null,c=!1,u,f={x:0,y:0},h=0,d=0,g=[];const p=v=>Math.atan2(v.clientY-f.y,v.clientX-f.x)*180/Math.PI,m=v=>{if(c)return;l?.kill(),l=null,c=!0,u=v.pointerId,n.setPointerCapture?.(v.pointerId);const S=n.getBoundingClientRect();f={x:S.left+S.width/2,y:S.top+S.height/2},h=p(v),d=o(),g=[{time:performance.now(),rotation:d}],s.onPress?.()},b=v=>{if(!c||v.pointerId!==u)return;const S=p(v);let w=S-h;w>180&&(w-=360),w<-180&&(w+=360),h=S,d+=w;let k=a(d);s.snap&&(k=a(Math.round(k/s.snap)*s.snap)),t.apply(i,{rotate:k});const M=performance.now();for(g.push({time:M,rotation:k});g.length>2&&M-g[0].time>100;)g.shift();const E={x:0,y:0};s.onDrag?.(E)},T=v=>{if(!c||v.pointerId!==u)return;c=!1;const S=g[0],w=g[g.length-1],k=S&&w?(w.time-S.time)/1e3:0,M=k>0?(w.rotation-S.rotation)/k:0;if(s.onRelease?.({x:M,y:0}),!s.inertia)return;const E=s.inertia===!0?{}:s.inertia,R=E.friction??(E.resistance!==void 0?$e(E.resistance):4),P=typeof E.end=="number"||Array.isArray(E.end)?E.end:void 0;l=e.to(n,{inertia:{rotate:{velocity:M,friction:R,min:r.minRotation,max:r.maxRotation,end:Array.isArray(P)?P.filter(A=>typeof A=="number"):P}},onComplete:()=>s.onThrowComplete?.()})};return n.addEventListener("pointerdown",m),n.addEventListener("pointermove",b),n.addEventListener("pointerup",T),n.addEventListener("pointercancel",T),n.style.touchAction="none",{draggable:void 0,position:{x:0,y:0},get rotation(){return o()},destroy(){l?.kill(),n.removeEventListener("pointerdown",m),n.removeEventListener("pointermove",b),n.removeEventListener("pointerup",T),n.removeEventListener("pointercancel",T)}}}const Po={opacity:0,scale:.6};function xo(e){const t=e.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 Rn(e){const t=Zt(e);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 qe(e,t){const n=e.resolveTargets(t).map(o=>e.elementFor(o)).filter(o=>!!o),s=new Map,r=new Map;for(const o of n){const a=xo(o);s.set(o,a);const l=Ln(o);a&&l!==void 0&&!r.has(l)&&r.set(l,{element:o,box:a})}return{elements:n,boxes:s,ids:r}}const Ye=new WeakMap;function Xe(e,t,i,n={}){const s=n.duration??.6,r=n.ease??"power2.inOut",o=n.stagger??0,a=n.scale!==!1,l=n.enter===void 0?Po:n.enter,c=new Set(i.elements);if(n.targets!==void 0)for(const d of e.resolveTargets(n.targets)){const g=e.elementFor(d);g&&c.add(g)}const u=[...c].sort((d,g)=>d===g?0:d.compareDocumentPosition(g)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),f=t({onComplete:n.onComplete});let h=0;for(const d of u){const g=Rn(d);if(!g)continue;let p=i.boxes.get(d)??null,m;const b=Ln(d),T=!p&&b!==void 0?i.ids.get(b):void 0;T&&T.element!==d&&(p=T.box,m=T.element);const[v]=e.resolveTargets(d);Ye.get(d)?.timeline.removeTracks({target:v});const S=h*o;if(!p){if(l===!1)continue;f.fromTo(d,{x:0,y:0,scaleX:1,scaleY:1,...l},{...Fn(l),x:0,y:0,scaleX:1,scaleY:1,duration:s,ease:r,delay:S},0),Ye.set(d,f),h++;continue}const w=p.cx-g.cx,k=p.cy-g.cy,M=a?p.width/g.width:1,E=a?p.height/g.height:1;if(!(Math.abs(w)>.5||Math.abs(k)>.5||Math.abs(M-1)>.001||Math.abs(E-1)>.001)){const A=(_,C)=>{const I=e.appliedValue(v,_);return typeof I=="number"&&Math.abs(I-C)>1e-6};(A("x",0)||A("y",0)||A("scaleX",1)||A("scaleY",1))&&f.set(d,{x:0,y:0,scaleX:1,scaleY:1},0);continue}const P=n.fade===!0&&m!==void 0;f.fromTo(d,{x:w,y:k,scaleX:M,scaleY:E,...P&&{opacity:0}},{x:0,y:0,scaleX:1,scaleY:1,...P&&{opacity:1},duration:s,ease:r,delay:S},0),P&&m&&Rn(m)&&f.fromTo(m,{opacity:1},{opacity:0,duration:s,ease:r,delay:S},0),Ye.set(d,f),h++}return f}function Ln(e){return e.dataset?.flipId}function Fn(e){const t={};for(const i of Object.keys(e))t[i]=i==="opacity"||i.startsWith("scale")?1:0;return t}function Co(e,t={}){const i=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=e.map(p=>({element:p,html:p.innerHTML,ariaLabel:p.getAttribute("aria-label")}));let o={chars:[],words:[],lines:[],masks:[]},a,l,c=!1;const u=()=>{for(const{element:p,html:m,ariaLabel:b}of r)p.innerHTML=m,b===null?p.removeAttribute("aria-label"):p.setAttribute("aria-label",b)},f=()=>{a&&(a.revert?a.revert():a.kill?.(),a=void 0)},h=()=>{const p={chars:[],words:[],lines:[],masks:[]};for(const{element:m}of r){const b=(m.textContent??"").replace(/\s+/g," ").trim(),T=_o(m,n.words),v=i.has("chars")?T.flatMap(k=>Io(k,n.chars)):[],S=i.has("lines")?Lo(m,T,n.lines):[];if(s){!m.hasAttribute("aria-label")&&b&&m.setAttribute("aria-label",b);for(const k of T)k.setAttribute("aria-hidden","true")}if(i.has("words"))p.words.push(...T);else for(const k of T)k.removeAttribute("class");p.chars.push(...v),p.lines.push(...S);const w=t.mask==="lines"?S:t.mask==="words"?T:t.mask==="chars"?v:[];for(const k of w)p.masks.push(Fo(k,`${n[t.mask]}-mask`))}o=p},d={elements:e,get chars(){return o.chars},get words(){return o.words},get lines(){return o.lines},get masks(){return o.masks},split(){c||(f(),u(),h(),a=t.onSplit?.(d))},revert(){c=!0,l?.disconnect(),f(),u()}};h(),a=t.onSplit?.(d),t.autoSplit&&g();function g(){const p=new Map;let m=!1;const b=()=>{if(m)return;m=!0;const v=()=>{m=!1,d.split()};typeof requestAnimationFrame=="function"?requestAnimationFrame(v):setTimeout(v,0)};if(typeof ResizeObserver=="function"){l=new ResizeObserver(v=>{let S=!1;for(const w of v){const k=Math.round(w.contentRect.width),M=p.get(w.target);p.set(w.target,k),M!==void 0&&M!==k&&(S=!0)}S&&b()});for(const v of e)l.observe(v)}const T=e[0]?.ownerDocument?.fonts;T&&T.status!=="loaded"&&T.ready.then(()=>b())}return d}function _o(e,t){const i=e.ownerDocument,n=[],s=i.createTreeWalker(e,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 l=i.createDocumentFragment();for(const c of a){if(/^\s/.test(c)){l.appendChild(i.createTextNode(c));continue}const u=i.createElement("span");u.className=t,u.style.display="inline-block",u.textContent=c,l.appendChild(u),n.push(u)}o.replaceWith(l)}return n}function Io(e,t){const i=e.ownerDocument,n=Ro(e.textContent??"").map(s=>{const r=i.createElement("span");return r.className=t,r.style.display="inline-block",r.textContent=s,r});return e.replaceChildren(...n),n}function Ro(e){const t=Intl.Segmenter;return t?Array.from(new t(void 0,{granularity:"grapheme"}).segment(e),i=>i.segment):Array.from(e)}function Lo(e,t,i){const n=e.ownerDocument,s=new Map(t.map(g=>[g,g.getBoundingClientRect()])),r=[],o=g=>{for(const p of Array.from(g.childNodes))p.nodeType===3||s.has(p)||p.tagName==="BR"?r.push(p):o(p)};o(e);const a=[];let l=null,c=0,u=0,f=!1,h=[];const d=()=>{l=n.createElement("span"),l.className=i,l.style.display="block",a.push(l),h=[]};for(const g of r){if(g.tagName==="BR"){f=!0;continue}const p=s.get(g);if(p&&(!l||f||p.top>c+u)&&(d(),c=p.top,u=p.height/2,f=!1),!l)continue;const m=[];for(let v=g.parentNode;v&&v!==e;v=v.parentNode)m.unshift(v);let b=0;for(;b<h.length&&b<m.length&&h[b].original===m[b];)b++;h.length=b;let T=b===0?l:h[b-1].clone;for(const v of m.slice(b)){const S=v.cloneNode(!1);T.appendChild(S),h.push({original:v,clone:S}),T=S}T.appendChild(g)}return e.replaceChildren(...a),a}function Fo(e,t){const i=e.ownerDocument.createElement("span");return i.className=t,i.style.display=e.style.display==="block"?"block":"inline-block",i.style.overflow="clip",i.style.paddingBottom="0.12em",i.style.marginBottom="-0.12em",e.replaceWith(i),i.appendChild(e),i}const $n={top:0,left:0,start:0,center:.5,centre:.5,middle:.5,bottom:1,right:1,end:1};function Ve(e){const t=e.trim().toLowerCase();if(t in $n)return $n[t];if(t.endsWith("%")){const i=Number.parseFloat(t.slice(0,-1));return Number.isNaN(i)?void 0:i/100}}function We(e){if(typeof e=="number")return{elementFraction:0,viewportFraction:0,offsetPx:0,absolutePx:e};let t=0;const n=e.replace(/([+-])=\s*(-?[\d.]+)/g,(o,a,l)=>(t+=(a==="-"?-1:1)*Number.parseFloat(l),"")).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?Ve(n[0]):void 0,r=n[1]!==void 0?Ve(n[1]):void 0;return{elementFraction:s??0,viewportFraction:r??0,offsetPx:t}}function dt(e,t,i){const n=We(i),s=n.absolutePx!==void 0?e.top+n.absolutePx:e.top+e.height*n.elementFraction,r=t*n.viewportFraction;return s-r+n.offsetPx}function $o(e,t,i,n){const s=dt(e,t,i),o=dt(e,t,n)-s;return o<=0?s<=0?1:0:Ue(-s/o)}function Ue(e){return e<0?0:e>1?1:e===0?0:e}function Dn(e,t,i,n){if(i<=0)return t;const s=1-Math.exp(-(n/1e3)/i);return e+(t-e)*s}function He(e,t,i,n,s){const r=u=>dt({top:e+s(u),bottom:e+s(u)+t,height:t},i,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 l=0,c=1;for(let u=0;u<40;u++){const f=(l+c)/2;Math.sign(r(f))===Math.sign(o)?l=f:c=f}return(l+c)/2}class On{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 i of t)i.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 Do(e){const t=new On(e);return t.start(),t}class Bn{element;spacer;saved;axis;spacing;constructor(t,i={}){this.element=t,this.axis=i.axis??"y",this.spacing=i.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,i){const n=Math.max(0,i);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 Oo=.15;function Nn(e){return typeof e=="object"&&!Array.isArray(e)?e:{snapTo:e}}function qn(e,t,i){const n=Jt(e+t*Oo);if(typeof i=="function")return Jt(i(n));if(typeof i=="number")return i<=0?e:Jt(Math.round(n/i)*i);if(i.length===0)return e;let s=i[0];for(const r of i)Math.abs(r-n)<Math.abs(s-n)&&(s=r);return Jt(s)}function Yn(e,t,i){const n=e.duration??{min:.2,max:.8};if(typeof n=="number")return n;const s=Math.min(1,Math.abs(t)/Math.max(1,i));return n.min+(n.max-n.min)*s}class Xn{rafId=null;cancelEvents=["wheel","touchstart","pointerdown","keydown"];onInterrupt=()=>this.cancel();write;eventTarget;constructor(t,i){this.write=t,this.eventTarget=i}get active(){return this.rafId!==null}animate(t,i,n,s=Mt,r){if(this.cancel(),typeof requestAnimationFrame>"u"||n<=0){this.write(i),r?.();return}for(const l of this.cancelEvents)this.eventTarget?.addEventListener(l,this.onInterrupt,{passive:!0});let o=null;const a=l=>{o??=l;const c=Math.min(1,(l-o)/(n*1e3));this.write(t+(i-t)*s(c)),c<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 Jt(e){return Math.max(0,Math.min(1,e))}class Vn{options;scroller;nodes=[];scrollerStart;scrollerEnd;start;end;constructor(t,i,n){this.options=n===!0?{}:n,this.scroller=i;const{startColor:s="#3ecf7a",endColor:r="#ff5a5a",id:o}=this.options,a=o?`${o} `:"",l=(c,u,f)=>{const h=t.createElement("div");return h.textContent=`${a}${c}`,h.setAttribute("aria-hidden","true"),h.className="scroll-marker",Object.assign(h.style,{position:f?"fixed":"absolute",right:`${this.options.indent??0}px`,zIndex:"2147483646",pointerEvents:"none",borderTop:`1px solid ${u}`,color:u,font:`${this.options.fontSize??"11px"} ui-monospace, monospace`,padding:"2px 6px",whiteSpace:"nowrap",background:"rgba(0, 0, 0, 0.35)"}),(i??t.body).appendChild(h),this.nodes.push(h),h};this.scrollerStart=l("scroller-start",s,!i),this.scrollerEnd=l("scroller-end",r,!i),this.start=l("start",s,!1),this.end=l("end",r,!1),i&&getComputedStyle(i).position==="static"&&(i.style.position="relative")}place(t,i){this.start.style.top=`${t.startPage}px`,this.end.style.top=`${t.endPage}px`;const n=this.scroller?i:0;this.scrollerStart.style.top=`${n+t.startViewport}px`,this.scrollerEnd.style.top=`${n+t.endViewport}px`}follow(t,i){this.scroller&&this.place(t,i)}destroy(){for(const t of this.nodes.splice(0))t.remove()}}const Bo=120,pt=[],mt=new Set;let je=!1;const No=()=>{je||mt.size===0||(je=!0,queueMicrotask(()=>{je=!1;for(const e of mt)e.afterRefresh()}))},Wn=()=>{for(const e of mt)e.beforeRefresh();for(const e of pt)e.refresh();for(const e of mt)e.afterRefresh()};let gt={width:0,height:0};const Un=()=>{const e=window.innerWidth,t=window.innerHeight,i=e===gt.width&&t!==gt.height,n=Math.abs(t-gt.height)<gt.height*.25,s=typeof navigator<"u"&&(navigator.maxTouchPoints??0)>0;i&&n&&s||(gt={width:e,height:t},Wn())};class Rt{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 Xn(i=>this.scrollTo(i),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 Bn(t,{axis:this.options.horizontal?"x":"y",spacing:this.options.pinSpacing!==!1})),this.options.markers&&!this.options.horizontal&&typeof document<"u"&&(this.markers=new Vn(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",Un,{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",Un),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(){Wn()}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 i=this.triggerRect();if(i&&this.options.container)this.measureInContainer(this.options.container);else if(i){const n=this.viewportHeight();if(this.startPx=t+dt(i,n,Lt(this.options.start)??"top bottom"),this.endPx=this.resolveEnd(i,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,No()}sample(){this.refresh()}update(t){this.running&&this.updateFrom(t??this.scrollPosition(),!1)}updateFrom(t,i){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?Ue((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),i||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,i,n){const s=Lt(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]==="%"?i*o/100:o)}return n+dt(t,i,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 i=typeof performance<"u"?performance.now():Date.now();this.lastScroll!==null&&i>this.lastScrollTime&&t!==this.lastScroll&&(this.velocityPxPerSecond=(t-this.lastScroll)/(i-this.lastScrollTime)*1e3),(this.lastScroll===null||t!==this.lastScroll)&&(this.lastScroll=t,this.lastScrollTime=i),!(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()},Bo))}fireBoundaryCallbacks(t,i){if(t===i)return;const{onEnter:n,onLeave:s,onEnterBack:r,onLeaveBack:o}=this.options;t==="before"?(n?.(),i==="after"&&s?.()):t==="after"?(r?.(),i==="before"&&o?.()):i==="after"?s?.():o?.()}scheduleSnap(){const t=this.options.snap;if(t===void 0||this.snapper.active)return;const i=Nn(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+qn(o,this.releaseVelocity/s,i.snapTo)*s;Math.abs(a-r)<1||this.snapper.animate(r,a,Yn(i,a-r,this.viewportHeight()),i.ease)};i.delay?this.snapTimer=setTimeout(n,i.delay*1e3):n()}scrollTo(t){const i=this.options.scroller,n=this.options.horizontal?{left:t}:{top:t};i?typeof i.scrollTo=="function"?i.scrollTo({...n,behavior:"instant"}):this.options.horizontal?i.scrollLeft=t:i.scrollTop=t:typeof window<"u"&&window.scrollTo({...n,behavior:"instant"})}measureInContainer(t){const i=this.options.trigger;if(typeof i?.getBoundingClientRect!="function")return;const n=i.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:l}=t.range(),c=d=>a+d*(l-a),u=He(o,n.width,r,Lt(this.options.start)??"left right",t.shiftAt);this.startPx=c(u);const f=Lt(this.options.end)??"right left",h=typeof f=="string"?f.trim().match(/^\+=\s*(-?[\d.]+)\s*(px)?$/):null;this.endPx=h?this.startPx+Number.parseFloat(h[1]):c(He(o,n.width,r,f,t.shiftAt)),this.markerGeometry=null}markersFor(t){const i=(r,o)=>{const a=Lt(r)??o;if(typeof a=="number")return 0;if(/^\s*\+=/.test(a))return;const l=We(a);return t*l.viewportFraction-l.offsetPx},n=i(this.options.start,"top bottom")??0,s=i(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=i=>{if(this.rafId=null,!this.running)return;const n=this.lastFrameTime===null?16.67:i-this.lastFrameTime;this.lastFrameTime=i,this.displayProgress=Dn(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,i=this.options.horizontal;return t?(i?t.scrollLeft:t.scrollTop)??0:typeof window<"u"?(i?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 i=this.options.horizontal,n=i?t.left??0:t.top,s=i?t.right??0:t.bottom,r=i?t.width??0:t.height,o=this.options.scroller;if(o&&typeof o.getBoundingClientRect=="function"){const a=o.getBoundingClientRect(),l=i?a.left:a.top;return{top:n-l,bottom:s-l,height:r}}return{top:n,bottom:s,height:r}}viewportHeight(){const t=this.options.scroller,i=this.options.horizontal;return t?i?t.clientWidth:t.clientHeight:typeof window<"u"?i?window.innerWidth:window.innerHeight:0}}function Lt(e){return typeof e=="function"?e():e}function qo(e){const t=new Rt(e);return t.start(),t}const ze=new Set,Yo=16,Hn=.5,Xo=2;class Ge{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:i=>requestAnimationFrame(i),cancel:i=>cancelAnimationFrame(i)}}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),ze.add(this),this.stopListening=Rt.onRefresh({beforeRefresh:()=>this.rest(),afterRefresh:()=>this.refresh()}),this.refresh(),this}static refreshAll(){for(const t of ze)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),ze.delete(this),this.stopListening?.(),this.stopListening=null,this.cancelFrame(),this.journey=null,this}destroy(){this.stop();for(const t of this.effects)Ke(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,i={}){if(!this.running)return;const n=this.clamp(this.resolve(t)+(i.offset??0)),s=Math.abs(n-this.current),r=this.reduced?0:i.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:i.ease??Mt,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 i=this.options.scroller??document,n=this.position(),s=this.viewportHeight(),r=this.options.scroller?.getBoundingClientRect().top??0;for(const o of i.querySelectorAll(t)){const a=Number.parseFloat(o.dataset.speed??""),l=Number.parseFloat(o.dataset.lag??""),c=o.getBoundingClientRect(),u=c.top-r+n;this.effects.push({element:o,speed:Number.isFinite(a)?a:void 0,lag:Number.isFinite(l)&&l>0?l:void 0,centre:u+c.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)Ke(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 i=t.deltaMode===1?Yo:t.deltaMode===2?this.viewportHeight():1,n=t.deltaY*i*(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)<=Xo||(this.written=null,this.journey=null,this.cancelFrame(),this.current=this.target=t,this.requestFrame())}nestedScrollerTakes(t){const i=this.options.scroller??document.documentElement;for(let n=t.target;n&&n!==i&&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 i=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+=i;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(-i/r)),Math.abs(this.target-this.current)<Hn&&(this.current=this.target)}this.current!==n&&this.write(this.current),this.velocityPxPerSecond=i>0?(this.current-n)*1e3/i:0;const s=this.applyEffects(i);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 i=!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)<Hn?s.lagged=n:i=!0,r+=n-s.lagged}Ke(s.element,r===0?s.saved:`0 ${Vo(r)}px`),s.shift=r}return i}write(t){const i=Math.round(t);this.written=i;const n=this.options.scroller;n?n.scrollTop=i:window.scrollTo({top:i,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 i=this.options.scroller??document,n=typeof t=="string"?i.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 Ke(e,t){t?e.style.setProperty("translate",t):e.style.removeProperty("translate")}function Vo(e){return Math.round(e*100)/100}function Wo(e,t){switch(t){case"play":if(e.progress()>=1)break;e.reversed()?e.reverse():e.play();break;case"reverse":if(e.progress()<=0)break;e.reversed()?e.play():e.reverse();break;case"pause":e.pause();break;case"resume":e.resume();break;case"restart":e.restart();break;case"reset":e.pause(),e.progress(0);break;case"complete":e.pause(),e.progress(1);break}}function Qe(e,t,i,n,s=()=>{}){const r=d=>typeof d=="string"?e.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,l=(t.toggleActions??"play none none none").trim().split(/\s+/);let c=0,u;const f=(d,g)=>()=>{g?.(),i&&!a&&Wo(i,l[d]??"none"),t.once&&d===0&&queueMicrotask(()=>u.destroy())},h=t.containerAnimation?jo(e,t.containerAnimation,o,s):void 0;return u=new Rt({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&&i?.invalidate?()=>i.invalidate():void 0,snap:t.snap===void 0?void 0:Uo(t.snap,i),markers:t.markers,container:h,onUpdate:(d,g)=>{if(i&&a!==!1&&i.progress(d),t.onUpdate){const p=d<c||g<0?-1:1;t.onUpdate({progress:d,velocity:g,direction:p})}c=d},onEnter:f(0,t.onEnter),onLeave:f(1,t.onLeave),onEnterBack:f(2,t.onEnterBack),onLeaveBack:f(3,t.onLeaveBack)}),i&&a===!1&&i.progress(0),u.start(),e.own(u)}function Uo(e,t){const i=s=>s==="labels"?r=>Ho(r,t?.labelProgresses?.()??[]):s;if(typeof e!="object"||Array.isArray(e))return i(e);const n=e.ease?Ct(e.ease):void 0;return{snapTo:i(e.snapTo),duration:e.duration,delay:e.delay,ease:n?n.fn??U(n.easing):void 0}}function Ho(e,t){return t.reduce((i,n)=>Math.abs(n-e)<Math.abs(i-e)?n:i,t[0]??e)}function jo(e,t,i,n){const s=()=>t.timeline.getTracks({property:"x"}).map(r=>r.target).filter(r=>{const o=e.elementFor(r);return!!o&&o!==i&&o.contains(i)});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 l of s()){const c=o.values.get(l)?.get("x");typeof c=="number"&&(a+=c)}return a}}}class jn{conditions={};scope;host;items=[];snapshots=new Map;constructor(t,i){this.host=t,this.scope=i}add(t){const i=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(i)}}track(t){this.items.push(t)}touch(t,i){this.snapshots.has(t)||this.snapshots.set(t,{name:i,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:i,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(i);this.snapshots.clear()}kill(){this.revert()}}class zo{host;scope;entries=[];listeners=[];scheduled=!1;constructor(t,i){this.host=t,this.scope=i}add(t,i){const n={conditions:t,setup:i,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 l=()=>this.scheduleUpdate();a.addEventListener("change",l),this.listeners.push(()=>a.removeEventListener("change",l))}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 i={};for(const[o,a]of t.queries)i[o]=a.matches;const n=Object.values(i).some(Boolean),s=n?JSON.stringify(i):void 0;if(s===t.key||(t.context?.revert(),t.context=void 0,t.key=s,!n))return;const r=new jn(this.host,this.scope);r.conditions=i,r.add(()=>t.setup(r)),t.context=r}}class Go{frames;canvas;context;options;images;ready;current=0;drawn=-1;loadedCount=0;inFlight=0;destroyed=!1;onResize=()=>this.resize();constructor(t,i){this.canvas=t,this.context=t.getContext("2d"),this.options=i,this.frames=Math.max(1,Math.floor(i.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,i=Math.round(this.canvas.clientWidth*t),n=Math.round(this.canvas.clientHeight*t);i>0&&n>0&&(this.canvas.width!==i||this.canvas.height!==n)&&(this.canvas.width=i,this.canvas.height=n),this.drawn=-1,this.draw()}draw(){const t=Math.round(this.current),i=this.nearestReady(t);if(i===-1||i===this.drawn||!this.context)return;const n=this.images[i],{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,l=n.naturalHeight*o;this.context.clearRect(0,0,s,r),this.context.drawImage(n,(s-a)/2,(r-l)/2,a,l),this.drawn=i,this.pump()}nearestReady(t){for(let i=0;i<this.frames;i++){if(t-i>=0&&this.ready[t-i])return t-i;if(t+i<this.frames&&this.ready[t+i])return t+i}return-1}pump(){const t=this.options.concurrency??6,i=Math.round(this.current);for(let n=0;n<this.frames&&this.inFlight<t;n++)for(const s of n===0?[i]:[i+n,i-n])s<0||s>=this.frames||this.images[s]||this.inFlight>=t||this.load(s)}load(t){const i=new Image;i.decoding="async",this.images[t]=i,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()}};i.onload=()=>n(!0),i.onerror=()=>n(!1),i.src=this.options.url(t)}}const Ko={opacity:0,y:-16},Qo={opacity:0,y:16};async function Zo(e,t,i,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 Jo(r,n,o);const a=n.duration??.35,l=n.ease??"power2.inOut",c=m=>new Promise(b=>{m(b)||b()}),u=o(),f=u.length?qe(t,u):void 0,h=n.from!==void 0?zn(t,n.from,n.shared):[];if(h.length&&n.leave!==!1){const m=n.leave??Ko;await c(b=>e.to(h,{...m,duration:a,ease:l,onComplete:b}))}await n.update();const d=[],g=typeof n.to=="function"?n.to():n.to,p=g!==void 0?zn(t,g,n.shared):[];if(p.length&&n.enter!==!1){const m=n.enter??Qo;d.push(c(b=>e.fromTo(p,m,{...Fn(m),duration:a,ease:l,onComplete:b})))}if(f){const m=o().filter(b=>!u.includes(b));m.length&&d.push(c(b=>Xe(t,i,f,{targets:m,duration:a*1.4,ease:l,enter:!1,onComplete:b})))}await Promise.all(d)}function zn(e,t,i){const n=e.resolveTargets(t).map(s=>e.elementFor(s)).filter(s=>!!s);return i?n.flatMap(s=>!s.querySelector(i)&&!s.matches(i)?[s]:[...s.children].filter(r=>!r.matches(i)&&!r.querySelector(i))):n}async function Jo(e,t,i){const n=(a,l)=>{const c=a.dataset?.flipId;c&&a.style.setProperty("view-transition-name",l?`tf-${c.replace(/[^\w-]/g,"-")}`:"")},s=i();s.forEach(a=>n(a,!0));let r=[];await e.startViewTransition(async()=>{s.forEach(a=>n(a,!1)),await t.update(),r=i(),r.forEach(a=>n(a,!0))}).finished,r.forEach(a=>n(a,!1))}const Gn={create:(e,t)=>Ie(e,rn(t))},Kn={create:(e,t)=>Ie(e,{fn:on(t)})},Qn={create:(e,t)=>Ie(e,{fn:an(t)})},ta=new Set(["keyframes","duration","delay","ease","easeEach","stagger","repeat","repeatDelay","yoyo","repeatRefresh","paused","id","onStart","onUpdate","onComplete","onRepeat","onReverseComplete","scrollTrigger"]),Zn=.5,ea="power1.inOut";function ia(e){return e.keyframes!==void 0&&e.keyframes!==null}function na(e){const t=e.keyframes,i={};for(const[c,u]of Object.entries(e))ta.has(c)||(i[c]=u);if(Array.isArray(t))return t.map(c=>({...i,...c,duration:c.duration??e.duration??Zn}));const n=Object.entries(t),s=e.duration??Zn,r=t.easeEach??e.easeEach??ea;if(n.length>0&&n.every(([c])=>/^\s*-?\d+(\.\d+)?\s*%\s*$/.test(c)||c==="easeEach")){const c=n.filter(([h])=>h!=="easeEach").map(([h,d])=>({at:Number.parseFloat(h)/100,step:d})).sort((h,d)=>h.at-d.at),u=[];let f=0;for(const{at:h,step:d}of c){const g=Math.max(0,h-f);u.push({...i,ease:r,...d,duration:g*s}),f=h}return u}const o=n.filter(([c,u])=>c!=="easeEach"&&Array.isArray(u)),a=Math.max(0,...o.map(([,c])=>c.length)),l=[];for(let c=0;c<a;c++){const u={...i,ease:r,duration:s/a};for(const[f,h]of o)c<h.length&&(u[f]=h[c]);l.push(u)}return l}function Jn(e,t,i,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},l=(T,v)=>{if(v===void 0)return o[T];if(typeof v=="number")return v;if(v==="max")return a[T];const S=typeof v=="string"?s.querySelector(v):v;if(!S)return o[T];const w=S.getBoundingClientRect(),k=r?.getBoundingClientRect(),M=(T==="x"?n.offsetX:n.offsetY)??n.offset??0;return T==="x"?w.left-(k?.left??0)+o.x-M:w.top-(k?.top??0)+o.y-M},c=typeof i=="object"&&i!==null&&!("nodeType"in i)?{x:l("x",i.x),y:l("y",i.y)}:{x:o.x,y:l("y",i)},u={x:Math.max(0,Math.min(a.x,c.x)),y:Math.max(0,Math.min(a.y,c.y))},f={...o},h=()=>{r?(r.scrollLeft=f.x,r.scrollTop=f.y):window.scrollTo({left:f.x,top:f.y,behavior:"instant"})},d=["wheel","touchstart","keydown"],g=r??window,p=()=>{b.kill(),m()},m=()=>{for(const T of d)g.removeEventListener(T,p)},b=e.to(f,{x:u.x,y:u.y,duration:n.duration??1,ease:n.ease??"power2.inOut",onStart:n.onStart,onUpdate:()=>{h(),n.onUpdate?.()},onComplete:()=>{m(),n.onComplete?.()}});if(n.autoKill!==!1)for(const T of d)g.addEventListener(T,p,{passive:!0});return b}function sa(e,t,i){const n=e.collector?.scope??e.root,s=typeof t=="string"?[...n.querySelectorAll(t)]:"nodeType"in t?[t]:Array.from(t),{interval:r=.1,batchMax:o,onEnter:a,onLeave:l,onEnterBack:c,onLeaveBack:u,...f}=i,h={onEnter:a,onLeave:l,onEnterBack:c,onLeaveBack:u},d={onEnter:[],onLeave:[],onEnterBack:[],onLeaveBack:[]},g={},p=b=>{g[b]!==void 0&&clearTimeout(g[b]),g[b]=void 0;const T=d[b].splice(0);T.length>0&&h[b]?.(T)},m=(b,T)=>{if(h[b]){if(d[b].push(T),o!==void 0&&d[b].length>=o)return p(b);g[b]===void 0&&(g[b]=setTimeout(()=>p(b),r*1e3))}};return s.map(b=>Qe(e,{...f,trigger:b,onEnter:()=>m("onEnter",b),onLeave:()=>m("onLeave",b),onEnterBack:()=>m("onEnterBack",b),onLeaveBack:()=>m("onLeaveBack",b)})).filter(b=>b!==void 0)}class G{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,i={}){this.stage=t;const n={...i,onWarning:i.onWarning??t.onWarning};if(this.options=n,this.compat=new nt({...n,startValue:(s,r)=>{const o=t.objectFor(s);if(o)return aa(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 l=ss(t.elementFor(s));if(l!==void 0)return r==="strokeDasharray"?[l,l]:0}},startVelocity:(s,r)=>t.velocityOf(s,r),layoutColumns:s=>ns(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=Qe(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,i,n){return ia(i)?this.record(()=>this.keyframed(t,i,n)):this.record(()=>this.tween(t,[i],n,([s],r,o)=>this.compat.to(r,s,o)))}from(t,i,n){return this.record(()=>this.tween(t,[i],n,([s],r,o)=>this.compat.from(r,s,o)))}fromTo(t,i,n,s){return this.record(()=>this.tween(t,[i,n],s,([r,o],a,l)=>this.compat.fromTo(a,r,o,l)))}set(t,i,n){return this.record(()=>this.tween(t,[i],n,([s],r,o)=>this.compat.set(r,s,o)))}addLabel(t,i){return this.record(()=>this.compat.addLabel(t,i))}add(t,i){return this.record(()=>{t.autoplayPending=!1,t.timeline.stop(),t.stage.deactivate(t.timeline),this.compat.add(t.compat,i)})}invalidate(){const t=this.compat.progress();this.compat.progress(0),this.stage.render(this.timeline),this.compat.reset(),this.events=[],this.ranges=[];for(const i of this.recipe)i();return this.syncDuration(),this.compat.progress(t),this.stage.render(this.timeline),this}call(t,i=[],n){return this.record(()=>{const s=this.compat.addEvent(n);this.events.push({time:s,run:()=>t(...i)})})}addPause(t,i,n=[]){return this.record(()=>{const s=this.compat.addEvent(t);this.events.push({time:s,pause:!0,run:()=>i?.(...n)})})}tweenTo(t,i={}){return this.tweenFromTo(this.timeline.currentTime/1e3,t,i)}tweenFromTo(t,i,n={}){this.pause(),this.seek(t);const s=this.timeline.currentTime,r=Math.max(0,Math.min(this.timeline.duration,this.compat.timeOf(i))),o={time:s},a=n.duration??Math.abs(r-s)/1e3/(this.timeScale()||1),l=new G(this.stage,{onStart:n.onStart,onComplete:n.onComplete});return l.to(o,{time:r,duration:a,ease:n.ease??"none",onUpdate:()=>{this.moveTo(o.time),n.onUpdate?.()}}),l}play(){this.autoplayPending=!1,this.started||(this.started=!0,this.options.onStart?.());const t=this.timeline.playbackState==="playing",i=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&&!i},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(i=>i/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,i){for(const n of t)for(const s of i??[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(i=>i.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 i=this.playhead;this.timeline.seek(t),this.stage.render(this.timeline);const n={time:this.timeline.currentTime,iteration:this.timeline.loopIteration,direction:t>=i.time?"forward":"reverse"},s={...i,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 i of this.recipe)i();this.syncDuration(),this.timeline.seek(Math.min(t,this.timeline.duration))}afterFrame(){const t=this.timeline,i=t.repeatDelayRemaining>0;if(this.waitingToWrap&&i){this.options.onUpdate?.();return}this.waitingToWrap=!1;const n=this.playhead,s=this.readPlayhead();this.playhead=s;const r=this.options.yoyo===!0;i&&!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,i);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,i,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}=Ee(s.map(a=>a.time),t,i,{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 l=s[a.index];if(!(l.direction&&l.direction!==a.direction)){if(l.pause)return this.timeline.seek(l.time),this.stage.render(this.timeline),this.pause(),this.playhead=this.readPlayhead(),this.waitingToWrap=!1,l.run(),!0;l.run()}}for(const a of this.ranges)o.some(([c,u])=>c!==u&&Math.max(c,u)>=a.start&&Math.min(c,u)<=a.end)&&a.run();return!1}tween(t,i,n,s){const r=this.resolve(t);if(!r)return;const{onStart:o,onUpdate:a,onComplete:l}=i[i.length-1];if(o||a||l){let c=1/0,u=-1/0;const f=(h,d,g)=>{s(h,d,g),c=Math.min(c,this.compat.lastStart),u=Math.max(u,this.compat.lastEnd)};if(this.buildTween(r,i,n,f),c===1/0)return;o&&this.events.push({time:c,direction:"forward",run:o}),a&&this.ranges.push({start:c,end:u,run:a}),l&&this.events.push({time:u,direction:"forward",run:l});return}this.buildTween(r,i,n,s)}keyframed(t,i,n){const s=this.resolve(t);if(!s)return;const r=na(i);if(r.length===0)return;const o=s.length>1?Fe(i.stagger,this.staggerContext(s)):void 0,a=s.map(m=>this.targetFor(m)).filter(m=>m!==void 0),l=o?a.map(m=>[m]):[a],c=o?Bt(s.length,o).map(m=>m/1e3):[0],u=this.compat.timeOf(n)/1e3+Qt(i.delay,0)/1e3;let f=1/0,h=-1/0;if(l.forEach((m,b)=>{r.forEach((T,v)=>{const S=v===0?u+c[b]:">";this.tween(m,[T],S,([w],k,M)=>this.compat.to(k,w,M)),f=Math.min(f,this.compat.lastStart),h=Math.max(h,this.compat.lastEnd)})}),f===1/0)return;const{onStart:d,onUpdate:g,onComplete:p}=i;d&&this.events.push({time:f,direction:"forward",run:d}),g&&this.ranges.push({start:f,end:h,run:g}),p&&this.events.push({time:h,direction:"forward",run:p})}staggerContext(t){return{count:t.length,columnsFromLayout:()=>ns(t.map(i=>this.stage.elementFor(i))),random:()=>this.stage.utils.random(0,1)}}buildTween(t,i,n,s){const r=t.map(h=>this.targetFor(h));if(!(t.length>1&&(i.some(oa)||t.some(h=>this.stage.objectFor(h)!==void 0)))){const h=this.targetFor(t[0]);s(i.map(d=>this.prepare(is(d,0,h,this.stage.utils,r),t)),t,n);return}const a=i.length-1,{stagger:l,...c}=i[a],u=Fe(l,this.staggerContext(t)),f=u?Bt(t.length,u).map(h=>h/1e3):t.map(()=>0);t.forEach((h,d)=>{const g=d===0?Qt(c.delay,0)/1e3+f[0]:0,p=d===0?0:f[d]-f[d-1],m=d===0?n:`<${p<0?"-":"+"}${Math.abs(p).toFixed(6)}`,T=i.map((v,S)=>S===a?{...c,delay:g}:v).map(v=>this.prepare(is(v,d,this.targetFor(h),this.stage.utils,r),[h]));s(T,[h],m)})}targetFor(t){return this.stage.elementFor(t)??this.stage.objectFor(t)}prepare(t,i){const n=o=>this.options.onWarning?.(o),s=o=>this.stage.query(o);let r=t;if(t.motionPath!==void 0){const o=bo(t.motionPath,{query:s,targets:i.map(a=>this.stage.elementFor(a)).filter(a=>!!a),warn:n});r={...r,motionPath:o}}if(t.morphSVG!==void 0){const o=vo(t.morphSVG,s,n),{morphSVG:a,...l}=r;r=o?{...r,morphSVG:o}:l}if(t.drawSVG!==void 0){const o=ss(this.stage.elementFor(i[0]));if(o===void 0){n("gsap-compat: drawSVG needs an SVG shape with a stroke (path, line, circle…)");const{drawSVG:a,...l}=r;r=l}else r=jr(r,o)}return r}resolve(t){const i=this.stage.resolveTargets(t);if(i.length===0){this.options.onWarning?.(`gsap-compat: no elements found for target ${la(t)}`);return}return this.firstElement??=i.map(n=>this.stage.elementFor(n)).find(n=>n!==void 0),i}}function ts(e=new wn){const t=r=>{const{config:o}=Kt(r);return new G(e,{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})},i=r=>{const{onStart:o,onUpdate:a,onComplete:l,onRepeat:c,onReverseComplete:u,repeatRefresh:f,...h}=r;return h},n=r=>(r&&e.collector?.track(r),r),s={stage:e,ticker:e.ticker,utils:e.utils,getProperty:(r,o)=>{const[a]=e.resolveTargets(r);if(a===void 0)return;const l=e.objectFor(a);return l?l[o]:e.appliedValue(a,o)??mn(o)},scrollTrigger:r=>n(Qe(e,r)),scrollBatch:(r,o)=>sa(e,r,o).map(a=>n(a)),scrollTo:(r,o)=>Jn(s,e,r,o),refreshScroll:()=>{Rt.refreshAll(),Ge.refreshAll()},smoothScroll:(r={})=>{const o=typeof r.scroller=="string"?(e.collector?.scope??e.root).querySelector(r.scroller):r.scroller;return n(new Ge({...r,scroller:o}).start())},context:(r,o)=>{const a=new jn(e,o);return r&&a.add(()=>r(a)),a},matchMedia:r=>new zo(e,r),customEase:Gn.create,customBounce:Kn.create,customWiggle:Qn.create,pageTransition:r=>Zo(s,e,o=>new G(e,o),r),imageSequence:(r,o)=>{const a=typeof r=="string"?(e.collector?.scope??e.root).querySelector(r):r;if(!(a instanceof HTMLCanvasElement))throw new Error(`gsap-compat: imageSequence needs a <canvas>, got ${String(r)}`);return n(new Go(a,o))},quickTo:(r,o,a={})=>{const l=new G(e,{paused:!0}),[c]=e.resolveTargets(r);return Object.assign(f=>{if(!c)return;const h=a.spring!==void 0?e.velocityOf(c,o)??0:0;l.compat.reset(),l.compat.to(c,{[o]:f,duration:a.duration??.4,ease:a.ease??"power3.out",...a.spring!==void 0&&{spring:ra(a.spring,o,h)}}),l.timeline.stop(),l.timeline.play(),e.activate(l.timeline)},{tween:l,kill:()=>l.kill()})},timeline:r=>new G(e,r),to:(r,o)=>{if(o.scrollTo!==void 0){const{scrollTo:a,...l}=o,c=typeof a=="object"&&a!==null&&!("nodeType"in a)?a:{},u=typeof r!="string"&&r!==window&&r.nodeType===1;return Jn(s,e,a,{...l,offsetX:c.offsetX,offsetY:c.offsetY,scroller:u?r:void 0})}return t(o).to(r,i(o))},from:(r,o)=>t(o).from(r,i(o)),fromTo:(r,o,a)=>t(a).fromTo(r,o,i(a)),set:(r,o)=>t(o).set(r,i(o)),delayedCall:(r,o,a)=>new G(e).call(o,a,r),killTweensOf:(r,o)=>{const a=e.resolveTargets(r),l=typeof o=="string"?o.split(",").map(c=>c.trim()).filter(Boolean):o;for(const c of[...e.liveTimelines])c.killTweensOf(a,l)},convertToPath:r=>To(r,e.root),splitText:(r,o)=>{const a=e.collector?.scope??e.root,l=typeof r=="string"?Array.from(a.querySelectorAll(r)):"nodeType"in r?[r]:Array.from(r);return n(Co(l,o))},draggable:(r,o)=>n(Ao(s,e,r,o)),getFlipState:r=>qe(e,r),flipFrom:(r,o)=>Xe(e,a=>new G(e,a),r,o),flip:(r,o,a)=>{const l=qe(e,r);return o(),Xe(e,c=>new G(e,c),l,{targets:r,...a})}};return s}const Y=ts();function ra(e,t,i){return e===!0?{velocity:{[t]:i}}:typeof e=="string"?{preset:e,velocity:{[t]:i}}:{...e,velocity:{[t]:i}}}function oa(e){return e.morphSVG!==void 0||e.drawSVG!==void 0||e.text!==void 0||e.scrambleText!==void 0||es(e)}function es(e){return Object.entries(e).some(([t,i])=>(typeof i=="function"||dn(i))&&!Le.has(t))}function is(e,t,i,n,s){if(!es(e))return e;const r={};for(const[o,a]of Object.entries(e))Le.has(o)?r[o]=a:typeof a=="function"?r[o]=a(t,i,s):dn(a)?r[o]=n.resolveRandomString(a):r[o]=a;return r}function ns(e){const t=e.map(n=>n?.getBoundingClientRect().top);if(t[0]===void 0)return e.length;let i=0;for(const n of t){if(n===void 0||Math.abs(n-t[0])>1)break;i++}return Math.max(1,i)}function ss(e){const t=e;if(typeof t?.getTotalLength=="function")return t.getTotalLength()}function aa(e){if(typeof e=="number"||typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="number"))return e}function la(e){return typeof e=="string"?`"${e}"`:String(e)}class Ze{media;offset;driftTolerance;constructor(t,i={}){this.media=t,this.offset=i.offset??0,this.driftTolerance=Math.max(0,i.driftTolerance??.15)}targetTime(t){return Math.max(0,t/1e3+this.offset)}update(t,i){const n=this.targetTime(t);i?(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 rs(e,t,i,n,s){const r=i-s;if(r<0){t.paused||t.pause(),t.currentTime=0;return}e.update(r,n)}class te{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,i={}){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=i,this.adapter=new st}async load(t){this.scenarioList=[],this.scenarioId=void 0,await this.loadSource(t)}async loadSource(t){let i;if(typeof t=="string"){const n=await fetch(t);if(!n.ok)throw new Error(`Failed to load animation: ${n.statusText}`);i=await n.json()}else i=t;this.useDefinition(i),this.showInitialFrame(),this.watchReducedMotion(),this.watchVisibility(),this.options.autoplay&&!this.reducedMotion&&(this.options.playWhenVisible&&!this.onScreen?this.autoplayWhenSeen=!0:this.play())}useDefinition(t){const i={...t.config};this.options.speed!==void 0&&(i.speed=this.options.speed),this.options.loop!==void 0&&(i.loop=this.options.loop),this.options.alternate!==void 0&&(i.alternate=this.options.alternate),this.timeline=ft({...t,config:i}),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,i={}){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=i.initial===void 0?t[0]:t.find(r=>r.id===i.initial);if(!s)throw new Error(`tinyfly: there is no scenario "${i.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 i=this.scenarioList.find(a=>a.id===t);if(!i||!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(i.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 i={style:t.getAttribute("style")};t.children.length===0&&(i.text=t.textContent??"");const n=t.tagName.toLowerCase()==="path"?t:t.querySelector("path");n&&(i.path={element:n,d:n.getAttribute("d")}),this.authored.set(t,i)}restoreAuthored(){for(const[t,i]of this.authored){i.style===null?t.removeAttribute("style"):t.setAttribute("style",i.style),i.text!==void 0&&t.textContent!==i.text&&(t.textContent=i.text),i.path&&(i.path.d===null?i.path.element.removeAttribute("d"):i.path.element.setAttribute("d",i.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 i;for(const n of this.markers)if(n.time<=t+.5)i=n;else break;return i}caption(t,i){const n=t?this.markers.find(o=>o.id===t):this.currentMarker;if(!n)return;const s=i??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,i=this.markers.find(n=>n.time>t+.5);if(this.reducedMotion){this.seek(i?i.time:this.duration);return}t>=this.duration-.5||(this.stepping=i!==void 0,this.startPlaying())}prev(){if(!this.timeline)return;const t=this.currentTime,i=[...this.markers].reverse().find(n=>n.time<t-.5);this.pause(),this.seek(i?i.time:0)}goToMarker(t){const i=this.markers.find(n=>n.id===t);i&&(this.pause(),this.seek(i.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 i=t==="end"?this.timeline.duration:t==="start"?0:t;this.timeline.seek(Math.max(0,Math.min(this.timeline.duration,i))),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(i=>{for(const n of i)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,i=t?.id;i!==this.lastMarkerId&&(this.lastMarkerId=i,this.options.onMarker(t))}scanMedia(){this.mediaTargets=[],this.container.querySelectorAll("[data-tinyfly-media]").forEach(i=>{const n=i,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 Ze(n)})})}syncAllMedia(t,i){for(const n of this.mediaTargets)rs(n.sync,n.el,t,i,n.startTime)}loadFromString(t){const i=JSON.parse(t);this.load(i)}registerTarget(t,i){if(typeof i=="string"){const n=this.container.querySelector(i);n&&(this.rememberAuthored(n),this.targets[t]=n,this.adapter.registerTarget(t,n))}else this.rememberAuthored(i),this.targets[t]=i,this.adapter.registerTarget(t,i)}autoRegisterTargets(){this.container.querySelectorAll("[data-tinyfly]").forEach(i=>{const n=i.closest("[data-tinyfly-symbol]");if(n&&n!==i)return;const s=i.getAttribute("data-tinyfly");s&&this.registerTarget(s,i)}),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 i=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=i.get(s);if(!r||!r.timeline.tracks?.length)return;const o=new st;n.querySelectorAll("[data-tinyfly]").forEach(a=>{const l=a.getAttribute("data-tinyfly");l&&o.registerTarget(l,a)}),this.symbolInstances.push({adapter:o,timeline:ft(r.timeline)})})}attachMedia(t,i){this.mediaSync=new Ze(t,i),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=i=>{if(this.isDestroyed||!this.timeline)return;const n=i-(this.lastTime??i);this.lastTime=i;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 i=this.timeline,n={time:i.currentTime,iteration:i.loopIteration,direction:i.direction};this.playhead=n;const s=this.markers;if(s.length===0)return;const{crossings:r}=Ee(s.map(o=>o.time),t,n,{duration:i.duration,alternate:i.config.alternate===!0,holding:i.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,i.pause(),i.seek(a.time),this.playhead={time:a.time,iteration:i.loopIteration,direction:i.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 i of this.symbolInstances){const n=i.timeline.duration;i.adapter.applyState(i.timeline.getStateAtTime(n>0?t%n:t))}}}async function ca(e,t,i={}){const n=new te(e,{...i,autoplay:!0});return await n.load(t),n}function ha(e,t={}){return new te(e,t)}const os={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"},as="tinyfly-controls-style",ua=`
|
|
1
|
+
(function(b){"use strict";function Jn(e){return typeof e=="object"&&e!==null&&e.type==="cubic-bezier"}function Lt(e){return typeof e=="object"&&e!==null&&e.type!=="cubic-bezier"}const $t=1;function te(e){return e.property==="text"&&"textConfig"in e}function rt(e){return e.kind==="inertia"&&"inertia"in e}function ot(e){return e.kind==="spring"&&"spring"in e}function Re(e){return e.property==="motionPath"&&"motionPathConfig"in e}function Ur(e){return typeof e=="object"&&e!==null&&"x"in e&&"y"in e&&"angle"in e}function Qn(e){return"keyframes"in e}class jr{_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 zr{_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 i=(t-this._lastFrameTime)*this._speed;this._currentTime+=i,this.onTick?.(i,this._currentTime)}this._lastFrameTime=t,this._scheduleFrame()}}}function Le(e,t,n="start"){if(t<=1)return 0;if(typeof n=="number"){const i=Math.max(0,Math.min(t-1,n));return Math.abs(e-i)}switch(n){case"end":return t-1-e;case"center":return Math.abs(e-(t-1)/2);case"edges":return(t-1)/2-Math.abs(e-(t-1)/2);default:return e}}function $e(e,t="start"){if(e<=1)return 0;let n=0;for(let i=0;i<e;i++)n=Math.max(n,Le(i,e,t));return n}function ee(e,t,n){if(n.offsets)return n.offsets[e]??0;const i=n.from??"start",s=Le(e,t,i);if(n.amount!==void 0){const r=$e(t,i);return r===0?0:n.amount*s/r}return n.each!==void 0?n.each*s:0}function ne(e,t){return Array.from({length:e},(n,i)=>ee(i,e,t))}function Ft(e,t){return e<=1?0:Math.max(...ne(e,t))}const wt=1,Fe=6e4,ie=Fe/wt,H={stiffness:180,damping:12,mass:1,velocity:0,restDelta:.01,restSpeed:.1},se={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 Ot{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??H.stiffness,this.damping=t.damping??H.damping,this.mass=t.mass??H.mass,this.restDelta=t.restDelta??H.restDelta,this.restSpeed=t.restSpeed??H.restSpeed,this.distance=Math.abs(this.to-this.from)||1,this.samples=[this.from],this.velocity=t.velocity??H.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 n=Math.floor(t/wt);if(this.simulateTo(n+1),this.settledStep!==null&&n>=this.settledStep)return this.to;const i=this.samples[Math.min(n,this.samples.length-1)],s=this.samples[Math.min(n+1,this.samples.length-1)],r=t/wt-n;return i+(s-i)*r}settleTime(){return this.simulateTo(ie+1),this.settledStep!==null?this.settledStep*wt:Fe}simulateTo(t){if(this.settledStep!==null)return;const n=Math.min(t,ie+1),i=wt/1e3;for(;this.samples.length<n;){const s=this.samples[this.samples.length-1],r=s-this.to,o=-this.stiffness*r,a=-this.damping*this.velocity,l=(o+a)/this.mass;this.velocity+=l*i;const c=s+this.velocity*i;if(this.samples.push(c),this.isAtRest(c)){this.settledStep=this.samples.length-1;return}}this.samples.length>ie&&(this.settledStep=ie)}}function Gr(e,t){return new Ot(e).valueAt(t)}function Zn(e){return new Ot(e).settleTime()}function Kr(e){const t=e.stiffness??H.stiffness,n=e.damping??H.damping,i=e.mass??H.mass;return n<2*Math.sqrt(t*i)}function Jr(e){const t=e.stiffness??H.stiffness,n=e.mass??H.mass;return 2*Math.sqrt(t*n)}const Oe=4,Qr=.002,Zr=1e-4,ti=6e4;function re(e){const t=e.friction??Oe;return t>0?t:Oe}function Dt(e){return e.from+e.velocity/re(e)}function to(e,t){if(t===void 0)return e;if(typeof t=="number")return t>0?Math.round(e/t)*t:e;if(t.length===0)return e;let n=t[0];for(const i of t)Math.abs(i-e)<Math.abs(n-e)&&(n=i);return n}function vt(e){let t=to(Dt(e),e.end);return e.min!==void 0&&(t=Math.max(e.min,t)),e.max!==void 0&&(t=Math.min(e.max,t)),t}function Tt(e){const t=Math.abs(vt(e)-e.from);if(t===0)return 0;const n=e.restDelta??Math.max(Zr,t*Qr);if(n>=t)return 0;const i=Math.log(t/n)/re(e);return Math.min(ti,i*1e3)}function oe(e,t){if(t<=0)return e.from;const n=vt(e);if(t>=Tt(e))return n;const i=re(e);return e.from+(n-e.from)*(1-Math.exp(-i*t/1e3))}function eo(e,t){const n=re(e),i=vt(e);return t>=Tt(e)?0:(i-e.from)*n*Math.exp(-n*Math.max(0,t)/1e3)}const ae=e=>e,ei=e=>e*e,ni=e=>1-(1-e)*(1-e),ii=e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,De=e=>e*e*e,Be=e=>1-Math.pow(1-e,3),Bt=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,si=De,ri=Be,oi=Bt,no={linear:ae,"ease-in":si,"ease-out":ri,"ease-in-out":oi,"ease-in-quad":ei,"ease-out-quad":ni,"ease-in-out-quad":ii,"ease-in-cubic":De,"ease-out-cubic":Be,"ease-in-out-cubic":Bt};function ai(e){const[t,n,i,s]=e,r=3*t,o=3*(i-t)-r,a=1-r-o,l=3*n,c=3*(s-n)-l,h=1-l-c,d=p=>((a*p+o)*p+r)*p,u=p=>((h*p+c)*p+l)*p,f=p=>(3*a*p+2*o)*p+r,m=p=>{let g=p;for(let w=0;w<8;w++){const k=d(g)-p;if(Math.abs(k)<1e-7)return g;const T=f(g);if(Math.abs(T)<1e-7)break;g-=k/T}let y=0,v=1;for(g=p;y<v;){const w=d(g);if(Math.abs(w-p)<1e-7)return g;p>w?y=g:v=g,g=(y+v)/2}return g};return p=>{if(p<=0)return 0;if(p>=1)return 1;const g=m(p);return u(g)}}function Ne(e,t="out"){if(t==="out")return e;const n=i=>1-e(1-i);return t==="in"?n:i=>i<.5?n(i*2)/2:e(i*2-1)/2+.5}function li(e=1,t=.3){const n=Math.max(1,e),i=t/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-i)*(2*Math.PI)/t)+1}const ci=e=>{if(e<=0)return 0;if(e>=1)return 1;if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const s=e-.5454545454545454;return 7.5625*s*s+.75}if(e<2.5/2.75){const s=e-.8181818181818182;return 7.5625*s*s+.9375}const i=e-2.625/2.75;return 7.5625*i*i+.984375};function hi(e=1.70158){return t=>{if(t<=0)return 0;if(t>=1)return 1;const n=t-1;return n*n*((e+1)*n+e)+1}}function ui(e,t="end"){const n=Math.max(1,Math.floor(e));return i=>{if(i>=1)return 1;if(i<=0)return t==="start"||t==="both"?t==="start"?1/n:1/(n+1):0;const s=Math.floor(i*n);switch(t){case"start":return Math.min(1,(s+1)/n);case"both":return(s+1)/(n+1);case"none":return n===1?0:Math.min(1,s/(n-1));default:return s/n}}}function fi(e){switch(e.type){case"steps":return ui(e.count,e.position);case"elastic":return Ne(li(e.amplitude,e.period),e.mode);case"bounce":return Ne(ci,e.mode);case"back":return Ne(hi(e.overshoot),e.mode)}}function z(e){return e===void 0?ae:Jn(e)?ai(e.points):Lt(e)?fi(e):no[e]??ae}const di=32,io=256,kt=new Map,so=/[MmLlHhVvCcSsQqTtAaZz]/,ro=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/,oo={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};function ao(e){const t=[];let n=0,i=null;const s=()=>{for(;n<e.length&&/[\s,]/.test(e[n]);)n++};for(;n<e.length&&(s(),!(n>=e.length));){const r=e[n];if(so.test(r)){i={type:r,args:[]},t.push(i),n++;continue}if(!i)break;const o=i.type==="A"||i.type==="a",a=i.args.length%7;if(o&&(a===3||a===4)){if(r!=="0"&&r!=="1")break;i.args.push(r==="1"?1:0),n++;continue}const l=ro.exec(e.slice(n));if(!l)break;i.args.push(parseFloat(l[0])),n+=l[0].length}return t}function lo(e,t,n,i,s,r,o,a,l){if(e===a&&t===l)return[];let c=Math.abs(n),h=Math.abs(i);if(c===0||h===0)return[[e,t,a,l,a,l]];const d=s*Math.PI/180,u=Math.cos(d),f=Math.sin(d),m=(e-a)/2,p=(t-l)/2,g=u*m+f*p,y=-f*m+u*p,v=g*g/(c*c)+y*y/(h*h);if(v>1){const F=Math.sqrt(v);c*=F,h*=F}const w=r===o?-1:1,k=c*c*h*h-c*c*y*y-h*h*g*g,T=c*c*y*y+h*h*g*g,M=w*Math.sqrt(Math.max(0,k/T)),x=M*c*y/h,C=-M*h*g/c,L=u*x-f*C+(e+a)/2,I=f*x+u*C+(t+l)/2,A=(F,D,O,j)=>{const et=F*O+D*j,ft=Math.sqrt((F*F+D*D)*(O*O+j*j)),bt=Math.acos(Math.max(-1,Math.min(1,et/ft)));return F*j-D*O<0?-bt:bt},E=A(1,0,(g-x)/c,(y-C)/h);let S=A((g-x)/c,(y-C)/h,(-g-x)/c,(-y-C)/h);!o&&S>0&&(S-=2*Math.PI),o&&S<0&&(S+=2*Math.PI);const _=Math.max(1,Math.ceil(Math.abs(S)/(Math.PI/2))),P=S/_,R=4/3*Math.tan(P/4),$=F=>{const D=c*Math.cos(F),O=h*Math.sin(F);return[u*D-f*O+L,f*D+u*O+I]},B=F=>{const D=-c*Math.sin(F),O=h*Math.cos(F);return[u*D-f*O,f*D+u*O]},N=[];for(let F=0;F<_;F++){const D=E+F*P,O=D+P,[j,et]=$(D),[ft,bt]=F===_-1?[a,l]:$(O),[Ie,Zt]=B(D),[Kn,mh]=B(O);N.push([j+R*Ie,et+R*Zt,ft-R*Kn,bt-R*mh,ft,bt])}return N}function at(e,t,n,i,s){const r=1-s;return r*r*r*e+3*r*r*s*t+3*r*s*s*n+s*s*s*i}function mi(e,t,n,i,s){const r=1-s;return 3*r*r*(t-e)+6*r*s*(n-t)+3*s*s*(i-n)}function Nt(e,t,n,i){return{subpath:0,type:"L",points:[n,i],startX:e,startY:t,endX:n,endY:i,length:Math.hypot(n-e,i-t)}}function le(e,t,n){const[i,s,r,o,a,l]=n,c=[0];let h=e,d=t,u=0;for(let f=1;f<=di;f++){const m=f/di,p=at(e,i,r,a,m),g=at(t,s,o,l,m);u+=Math.hypot(p-h,g-d),c.push(u),h=p,d=g}return{subpath:0,type:"C",points:[i,s,r,o,a,l],startX:e,startY:t,endX:a,endY:l,length:u,lengths:c}}function dt(e){const t=kt.get(e);if(t)return t;const n=[];let i=0,s=0,r=0,o=0,a=null,l=null,c=-1;const h=new Set,d=p=>{c<0&&(c=0),p.subpath=c,n.push(p)};for(const{type:p,args:g}of ao(e)){const y=p.toUpperCase(),v=p!==y,w=oo[y];if(y==="Z"){(i!==r||s!==o)&&d(Nt(i,s,r,o)),c>=0&&h.add(c),i=r,s=o,a=l=null;continue}for(let k=0;k+w<=g.length;k+=w){const T=g.slice(k,k+w),M=v?i:0,x=v?s:0;let C=null,L=null;switch(y){case"M":k===0?(i=T[0]+M,s=T[1]+x,r=i,o=s,(c<0||n[n.length-1]?.subpath===c)&&c++):(d(Nt(i,s,T[0]+M,T[1]+x)),i=T[0]+M,s=T[1]+x);break;case"L":d(Nt(i,s,T[0]+M,T[1]+x)),i=T[0]+M,s=T[1]+x;break;case"H":d(Nt(i,s,T[0]+M,s)),i=T[0]+M;break;case"V":d(Nt(i,s,i,T[0]+x)),s=T[0]+x;break;case"C":{const I=[T[0]+M,T[1]+x,T[2]+M,T[3]+x,T[4]+M,T[5]+x];d(le(i,s,I)),C=[I[2],I[3]],i=I[4],s=I[5];break}case"S":{const[I,A]=a?[2*i-a[0],2*s-a[1]]:[i,s],E=[I,A,T[0]+M,T[1]+x,T[2]+M,T[3]+x];d(le(i,s,E)),C=[E[2],E[3]],i=E[4],s=E[5];break}case"Q":case"T":{let I=i,A=s;y==="Q"?(I=T[0]+M,A=T[1]+x):l&&(I=2*i-l[0],A=2*s-l[1]);const E=y==="Q"?T[2]+M:T[0]+M,S=y==="Q"?T[3]+x:T[1]+x;d(le(i,s,[i+2/3*(I-i),s+2/3*(A-s),E+2/3*(I-E),S+2/3*(A-S),E,S])),L=[I,A],i=E,s=S;break}case"A":{const I=T[5]+M,A=T[6]+x;let E=i,S=s;for(const _ of lo(i,s,T[0],T[1],T[2],T[3],T[4],I,A))d(le(E,S,_)),E=_[4],S=_[5];i=I,s=A;break}}a=C,l=L}}const u=n.reduce((p,g)=>p+g.length,0),f=[];for(let p=0;p<n.length;){const g=n[p].subpath;let y=p,v=0;for(;y<n.length&&n[y].subpath===g;)v+=n[y++].length;const w=n[p],k=n[y-1],T=h.has(g)||Math.abs(k.endX-w.startX)<1e-9&&Math.abs(k.endY-w.startY)<1e-9;f.push({start:p,end:y,length:v,closed:T}),p=y}const m={segments:n,totalLength:u,subpaths:f};return kt.size>=io&&kt.delete(kt.keys().next().value),kt.set(e,m),m}function co(e,t){const n=e.lengths;if(t<=0)return 0;if(t>=e.length)return 1;let i=0,s=n.length-1;for(;i<s-1;){const a=i+s>>1;n[a]<t?i=a:s=a}const r=n[s]-n[i],o=r>0?(t-n[i])/r:0;return(i+o)/(n.length-1)}function ho(e,t){if(e.type==="L"){const d=e.length>0?Math.max(0,Math.min(1,t/e.length)):0;return{x:e.startX+(e.endX-e.startX)*d,y:e.startY+(e.endY-e.startY)*d,angle:Math.atan2(e.endY-e.startY,e.endX-e.startX)*180/Math.PI}}const[n,i,s,r,o,a]=e.points,l=co(e,t);let c=mi(e.startX,n,s,o,l),h=mi(e.startY,i,r,a,l);if(Math.hypot(c,h)<1e-9){const d=l<.5?Math.min(1,l+.001):Math.max(0,l-.001),u=at(e.startX,n,s,o,d),f=at(e.startY,i,r,a,d),m=at(e.startX,n,s,o,l),p=at(e.startY,i,r,a,l);c=l<.5?u-m:m-u,h=l<.5?f-p:p-f}return{x:at(e.startX,n,s,o,l),y:at(e.startY,i,r,a,l),angle:Math.atan2(h,c)*180/Math.PI}}function Ye(e,t,n=0,i=e.length){if(i<=n)return{x:0,y:0,angle:0};let s=0;for(let r=n;r<i;r++){const o=e[r];if(s+o.length>=t||r===i-1)return ho(o,t-s);s+=o.length}return{x:0,y:0,angle:0}}function pi(e,t){const{segments:n,totalLength:i}=dt(e);return Ye(n,Math.max(0,Math.min(1,t))*i)}function uo(){kt.clear()}function fo(e){return dt(e).totalLength}const mo=24,po=320,go=2.5,Yt=72,yo=64,bo=.2,wo=128,Wt=new Map;let ce=0,lt;const gi=e=>Math.round(e*100)/100;function yi(e,t){const{segments:n,subpaths:i,totalLength:s}=dt(e);if(n.length===0)return[];if(t){const r=i.every(o=>o.closed);return[{segments:n,start:0,end:n.length,length:s,closed:r}]}return i.filter(r=>r.length>0).map(r=>({segments:n,start:r.start,end:r.end,length:r.length,closed:r.closed}))}function We(e,t){const n=e.closed?(t%1+1)%1:Math.max(0,Math.min(1,t)),i=Ye(e.segments,n*e.length,e.start,e.end);return[i.x,i.y]}function bi(e){const t=[];let n=0;for(let i=e.start;i<e.end;i++)n+=e.segments[i].length,e.length>0&&t.push(n/e.length);return t}function wi(e,t){const n=[];for(let i=0;i<t;i++)n.push(We(e,e.closed?i/t:i/(t-1)));return n}function vi(e){let t=0,n=0;for(const[i,s]of e)t+=i,n+=s;return t/=e.length,n/=e.length,e.map(([i,s])=>[i-t,s-n])}function vo(e,t,n){const i=e.closed&&t.closed;if(n!==void 0)return{offset:i?Math.abs(n)%Yt/Yt:0,reversed:n<0};const s=vi(wi(e,Yt)),r=vi(wi(t,Yt)),o=Yt;let a={offset:0,reversed:!1},l=1/0;for(const c of[!1,!0]){const h=i?o:1;for(let d=0;d<h;d++){let u=0;for(let f=0;f<o&&u<l;f++){const m=i?c?(d-f+o)%o:(f+d)%o:c?o-1-f:f,p=s[f][0]-r[m][0],g=s[f][1]-r[m][1];u+=p*p+g*g}u<l&&(l=u,a={offset:i?d/o:0,reversed:c})}}return a}function To(e,t,n){return n?((t.reversed?t.offset-e:e+t.offset)%1+1)%1:t.reversed?1-e:e}function ko(e,t,n){return n?((t.reversed?t.offset-e:e-t.offset)%1+1)%1:t.reversed?1-e:e}function Mo(e,t,n){const i=e.closed&&t.closed,s=vo(e,t,n.shapeIndex),r=Math.max(mo,Math.min(po,Math.ceil(Math.max(e.length,t.length)/go))),o=new Set,a=d=>o.add(Math.round(d*1e7)/1e7);for(let d=0;d<=r;d++)a(d/r);for(const d of bi(e))a(d);for(const d of bi(t))a(ko(d,s,i));let l=[...o].sort((d,u)=>d-u);i&&(l=l.filter(d=>d<1));const c=[],h=[];for(const d of l)c.push(...We(e,d)),h.push(...We(t,To(d,s,i)));return So({from:c,to:h,closed:i})}function So(e){const t=e.from.length/2;if(t<=3)return e;const n=new Uint8Array(t);n[0]=1,n[t-1]=1;const i=[[0,t-1]];for(;i.length>0;){const[o,a]=i.pop();let l=-1,c=bo;for(let h=o+1;h<a;h++){const d=Math.max(Ti(e.from,o,a,h),Ti(e.to,o,a,h));d>c&&(c=d,l=h)}l!==-1&&(n[l]=1,i.push([o,l],[l,a]))}const s=[],r=[];for(let o=0;o<t;o++)n[o]&&(s.push(e.from[o*2],e.from[o*2+1]),r.push(e.to[o*2],e.to[o*2+1]));return{from:s,to:r,closed:e.closed}}function Ti(e,t,n,i){const s=e[t*2],r=e[t*2+1],o=e[n*2]-s,a=e[n*2+1]-r,l=e[i*2]-s,c=e[i*2+1]-r,h=o*o+a*a,d=h===0?0:Math.max(0,Math.min(1,(l*o+c*a)/h));return Math.hypot(l-d*o,c-d*a)}function xo(e,t,n){const i=n.shapeIndex;if(lt&<.from===e&<.to===t&<.shapeIndex===i)return lt.plan;const r=Wt.get(String(i??"auto"))?.get(e)?.get(t);if(r)return lt={from:e,to:t,shapeIndex:i,plan:r},r;const o=dt(e).subpaths.filter(f=>f.length>0).length===dt(t).subpaths.filter(f=>f.length>0).length,a=yi(e,!o),l=yi(t,!o),c={pairs:a.map((f,m)=>Mo(f,l[m],n))};ce>=wo&&(Wt.clear(),ce=0);const h=String(i??"auto"),d=Wt.get(h)??new Map;Wt.set(h,d);const u=d.get(e)??new Map;return d.set(e,u),u.set(t,c),ce++,lt={from:e,to:t,shapeIndex:i,plan:c},c}function ki(e,t,n,i={}){if(!e)return t;if(!t)return e;const s=Math.max(0,Math.min(1,n));if(s===0)return e;if(s===1)return t;const r=xo(e,t,i);if(r.pairs.length===0)return s<.5?e:t;let o="";for(const a of r.pairs){for(let l=0;l<a.from.length;l+=2){const c=gi(a.from[l]+(a.to[l]-a.from[l])*s),h=gi(a.from[l+1]+(a.to[l+1]-a.from[l+1])*s);o+=`${l===0?o?" M":"M":" L"}${c} ${h}`}a.closed&&(o+=" Z")}return o}function Ao(){Wt.clear(),ce=0,lt=void 0}function Mt(e){return/^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(e)}const G=(e,t,n)=>e+(t-e)*n,Mi=512,qe=new Map,Xe=new Map;function Si(e){const t=qe.get(e);if(t)return t;const n=e.replace("#",""),i=[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)];return qe.size<Mi&&qe.set(e,i),i}const xi=e=>e.charCodeAt(0)===35,Ai=e=>e.startsWith("rgb"),Ei=e=>e.startsWith("rgba"),Eo=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/,He=e=>Math.round(e).toString(16).padStart(2,"0");function Po(e,t,n){return`#${He(e)}${He(t)}${He(n)}`}function Pi(e){const t=Xe.get(e);if(t)return t;const n=e.match(Eo);if(!n)throw new Error(`Invalid rgb color: ${e}`);const i=parseInt(n[1],10),s=parseInt(n[2],10),r=parseInt(n[3],10),o=n[4]!==void 0?[i,s,r,parseFloat(n[4])]:[i,s,r];return Xe.size<Mi&&Xe.set(e,o),o}const _i=(e,t,n)=>{if(xi(e)&&xi(t)){const[i,s,r]=Si(e),[o,a,l]=Si(t),c=G(i,o,n),h=G(s,a,n),d=G(r,l,n);return Po(c,h,d)}if((Ai(e)||Ei(e))&&(Ai(t)||Ei(t))){const i=Pi(e),s=Pi(t),r=Math.round(G(i[0],s[0],n)),o=Math.round(G(i[1],s[1],n)),a=Math.round(G(i[2],s[2],n));if(i.length===4||s.length===4){const l=i[3]??1,c=s[3]??1,h=G(l,c,n);return`rgba(${r}, ${o}, ${a}, ${h})`}return`rgb(${r}, ${o}, ${a})`}return n<1?e:t},Ci=(e,t,n)=>{const i=Math.min(e.length,t.length),s=[];for(let r=0;r<i;r++)s.push(G(e[r],t[r],n));return s},Ve=(e,t,n)=>n<1?e:t,Ii=(e,t,n)=>ki(e,t,n);function qt(e){return typeof e=="number"?G:Array.isArray(e)?Ci:typeof e=="string"?e.startsWith("#")||e.startsWith("rgb")?_i:Mt(e)?Ii:Ve:Ve}const Ue=1e3/60;function je(e,t={}){if(!ot(e))throw new Error(`bakeSpringTrack: track "${e.id}" is not a spring track`);const n=new Ot(e.spring);return Ri(e,i=>n.valueAt(i),n.settleTime(),e.spring.from,e.spring.to,t)}function ze(e,t={}){if(!rt(e))throw new Error(`bakeInertiaTrack: track "${e.id}" is not an inertia track`);const n=e.inertia;return Ri(e,i=>oe(n,i),Tt(n),n.from,vt(n),t)}function Ri(e,t,n,i,s,r){const o=r.intervalMs??Ue,a=r.tolerance??.01,l=e.delay??0,c=[];for(let d=0;d<=n;d+=o)c.push({time:d+l,value:t(d),easing:"linear"});const h=c[c.length-1];return!h||h.time<n+l?c.push({time:n+l,value:s,easing:"linear"}):h.value=s,l>0&&c.unshift({time:0,value:i,easing:"linear"}),{id:e.id,target:e.target,property:e.property,keyframes:a>0?$i(c,a):c,...e.targets&&{targets:[...e.targets]},...e.stagger&&{stagger:{...e.stagger}}}}function Ge(e,t,n,i={}){const s=i.intervalMs??Ue,r=typeof n=="function"?n:z(n),o=qt(e.value),a=t.time-e.time;if(a<=0)return[t];const l=[];for(let h=s;h<a;h+=s){const d=h/a;l.push({time:e.time+h,value:o(e.value,t.value,r(d)),easing:"linear"})}const c=r(1);return l.push({...t,...c!==1&&{value:o(e.value,t.value,c)},easing:"linear"}),l}function _o(e,t){return ot(e)?je(e,t):rt(e)?ze(e,t):e}function Li(e,t={}){const n=e.keyframes;if(!n.some(s=>Lt(s.easing)))return e;const i=n.length>0?[n[0]]:[];for(let s=1;s<n.length;s++){const r=n[s];Lt(r.easing)?i.push(...Ge(n[s-1],r,r.easing,t)):i.push(r)}return{...e,keyframes:i}}function Co(e,t){return e.filter(Qn).map(n=>Li(n,t)).concat(e.filter(ot).map(n=>je(n,t)),e.filter(rt).map(n=>ze(n,t)))}function $i(e,t){if(e.length<=2)return e;const n=[e[0]];for(let i=1;i<e.length-1;i++){const s=n[n.length-1],r=e[i],o=e[i+1],a=o.time-s.time;if(a<=0)continue;const l=(r.time-s.time)/a,c=s.value+(o.value-s.value)*l;Math.abs(r.value-c)>t&&n.push(r)}return n.push(e[e.length-1]),n}function he(e){const t=[...e.keyframes].sort((n,i)=>n.time-i.time);return{...e,keyframes:t}}function ct(e){return e.targets&&e.targets.length>0?e.targets:[e.target]}function St(e,t,n,i){const s=n??0;return!i||t<=1?s:s+ee(e,t,i)}class ue{track;targets;constructor(t){this.track=t,this.targets=ct(t)}getValueAtTime(t){return this.valueForOffset(t-St(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const n=this.targets.length,i=[];for(let s=0;s<n;s++){const r=St(s,n,this.track.delay,this.track.stagger),o=this.valueForOffset(t-r);o!==void 0&&i.push({target:this.targets[s],value:o,start:r+this.track.keyframes[0].time})}return i}getDuration(){const{keyframes:t}=this.track;if(t.length===0)return 0;const n=t[t.length-1].time,i=this.track.stagger?Ft(this.targets.length,this.track.stagger):0;return n+(this.track.delay??0)+i+(this.track.endDelay??0)}getTrack(){return this.track}valueForOffset(t){const{keyframes:n}=this.track;if(n.length===0)return;if(n.length===1||t<=n[0].time)return n[0].value;if(t>=n[n.length-1].time)return n[n.length-1].value;const{from:i,to:s}=this.findSurroundingKeyframes(t);if(!i||!s)return;if(i.time===t)return i.value;const r=s.time-i.time,o=(t-i.time)/r,l=z(s.easing)(o);return qt(i.value)(i.value,s.value,l)}findSurroundingKeyframes(t){const{keyframes:n}=this.track;for(let i=0;i<n.length-1;i++)if(t>=n[i].time&&t<=n[i+1].time)return{from:n[i],to:n[i+1]};return{from:null,to:null}}}class Fi{track;targets;sampler;constructor(t){this.track=t,this.targets=ct(t),this.sampler=new Ot(t.spring)}getValueAtTime(t){return this.sampler.valueAt(t-St(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const n=this.targets.length,i=[];for(let s=0;s<n;s++){const r=St(s,n,this.track.delay,this.track.stagger);i.push({target:this.targets[s],value:this.sampler.valueAt(t-r),start:r})}return i}getDuration(){const t=this.track.stagger?Ft(this.targets.length,this.track.stagger):0;return this.sampler.settleTime()+(this.track.delay??0)+t}getTrack(){return this.track}}class Oi{track;targets;duration;constructor(t){this.track=t,this.targets=ct(t),this.duration=Tt(t.inertia)}getValueAtTime(t){return oe(this.track.inertia,t-St(0,this.targets.length,this.track.delay,this.track.stagger))}getTargetValues(t){const n=this.targets.length,i=[];for(let s=0;s<n;s++){const r=St(s,n,this.track.delay,this.track.stagger);i.push({target:this.targets[s],value:oe(this.track.inertia,t-r),start:r})}return i}getDuration(){const t=this.track.stagger?Ft(this.targets.length,this.track.stagger):0;return this.duration+(this.track.delay??0)+t}getTrack(){return this.track}}function Ke(e,t){const n={...pi(e.pathData,t)};if(e.matrix){const[i,s,r,o,a,l]=e.matrix,{x:c,y:h}=n;n.x=i*c+r*h+a,n.y=s*c+o*h+l;const d=n.angle*Math.PI/180,u=Math.cos(d),f=Math.sin(d);n.angle=Math.atan2(s*u+o*f,i*u+r*f)*180/Math.PI}return e.autoRotate&&e.rotateOffset&&(n.angle+=e.rotateOffset),n}function Io(e,t,n,i){const s=t+(n-t)*i;return Ke(e,s)}const Je={upperCase:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",lowerCase:"abcdefghijklmnopqrstuvwxyz",upperAndLowerCase:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",numbers:"0123456789"},Ro=20;function Di(e){const t=Je[e??"upperCase"]??e??Je.upperCase,n=Array.from(t);return n.length>0?n:Array.from(Je.upperCase)}function Lo(e,t,n){let i=(e|0)^Math.imul(t+1,2654435761)^Math.imul(n+1,2246822507);return i=Math.imul(i^i>>>16,2146121005),i=Math.imul(i^i>>>15,2221713035),(i^i>>>16)>>>0}function Bi(e,t,n=0){const i=e.from??"",s=e.to,r=Math.max(0,Math.min(1,t));if(r<=0)return i;if(r>=1)return s;const o=Array.from(i),a=Array.from(s),l=e.rightToLeft??!1;if(e.mode==="type"){const v=Math.round(r*Math.max(o.length,a.length));return l?o.slice(0,Math.max(0,o.length-v)).join("")+a.slice(Math.max(0,a.length-v)).join(""):a.slice(0,v).join("")+o.slice(v).join("")}const c=Math.max(0,Math.min(.999,e.revealDelay??0)),h=Math.max(0,(r-c)/(1-c)),d=Math.floor(h*a.length),u=e.tweenLength===!1?a.length:Math.round(o.length+(a.length-o.length)*r),f=Di(e.chars),m=e.refreshRate??Ro,p=m>0?Math.floor(n*m/1e3):0,g=e.seed??1;let y="";for(let v=0;v<u;v++){const w=l?v>=u-d:v<d,k=l?a[a.length-(u-v)]:a[v];w&&k!==void 0||k===" "||k===`
|
|
2
|
+
`?y+=k:y+=f[Lo(g,v,p)%f.length]}return y}class Qe{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 n of t.tracks)this.addTrack(n)}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 n={...this._config};delete n.duration,this._config=n}}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 n=this.duration>0?this.duration:1/0;this._currentTime=Math.max(0,Math.min(t,n)),this._repeatDelayRemaining=0,this._wrapAfterDelay=!1}reverse(){this._direction=this._direction==="forward"?"reverse":"forward"}tick(t){if(this._playbackState!=="playing")return;const n=this.duration;if(n<=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 l=n-this._currentTime;if(s>=l){if(s-=l,this._currentTime=n,!this._handleEndReached())break}else this._currentTime+=s,s=0}else{const l=this._currentTime;if(s>=l){if(s-=l,this._currentTime=0,!this._handleStartReached())break}else this._currentTime-=s,s=0}const o=this.getStateAtTime(this._currentTime);this.onUpdate?.(o)}getStateAtTime(t){const n=new Map;if(this._hasSharedWrites())this._resolveShared(t,n);else for(const[i,s]of this._trackPlayers){const r=s.getTrack().property;for(const{target:o,value:a,start:l}of s.getTargetValues(t))this._write(n,i,o,r,a,t-l)}return{values:n,currentTime:this._currentTime,playbackState:this._playbackState,direction:this._direction,loopIteration:this._loopIteration}}_resolveShared(t,n){const i=new Map;for(const[s,r]of this._trackPlayers){const o=r.getTrack().property;for(const{target:a,value:l,start:c}of r.getTargetValues(t)){const h=`${a}\0${o}`,d=c<=t,u=i.get(h);(!u||(d!==u.started?d:d?c>=u.start:c<=u.start))&&i.set(h,{trackId:s,target:a,property:o,value:l,start:c,started:d})}}for(const{trackId:s,target:r,property:o,value:a,start:l}of i.values())this._write(n,s,r,o,a,t-l)}_write(t,n,i,s,r,o){if(r===void 0)return;let a=t.get(i);a||(a=new Map,t.set(i,a));const l=this._textTracks.get(n);if(l&&typeof r=="number"){a.set("text",Bi(l.textConfig,r,Math.max(0,o)));return}const c=this._motionPathTracks.get(n);if(c&&typeof r=="number"){const h=Ke(c.motionPathConfig,r);a.set("motionPathX",h.x),a.set("motionPathY",h.y),c.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 n of this._tracks)for(const i of ct(n)){const s=`${i}\0${n.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,rt(t)){this._trackPlayers.set(t.id,new Oi(t));return}if(ot(t)){this._trackPlayers.set(t.id,new Fi(t)),this._springTracks.set(t.id,t);return}if(te(t))this._trackPlayers.set(t.id,new ue(t)),this._textTracks.set(t.id,t);else if(Re(t)){const n={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 ue(n)),this._motionPathTracks.set(t.id,t)}else this._trackPlayers.set(t.id,new ue(t))}replaceTrack(t,n){const i=this._tracks.findIndex(r=>r.id===t);if(i<0)return;const s=this._tracks.slice(i+1);this.removeTrack(t);for(const r of s)this.removeTrack(r.id);this.addTrack(n);for(const r of s)this.addTrack(r)}removeTrack(t){this._tracks=this._tracks.filter(n=>n.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(n=>this._matches(n,t))}removeTracks(t={}){const n=this.getTracks(t).map(i=>i.id);for(const i of n)this.removeTrack(i);return n}getTrackSpan(t){const n=this._trackPlayers.get(t);if(!n)return;const i=n.getTrack(),s=i.delay??0;if(ot(i)||rt(i))return{from:s,to:n.getDuration()};const r=i.keyframes;if(!(!r||r.length===0))return{from:r[0].time+s,to:n.getDuration()}}findConflicts(){const t=[];for(let n=0;n<this._tracks.length;n++){const i=this._tracks[n],s=this.getTrackSpan(i.id);if(s)for(let r=0;r<n;r++){const o=this._tracks[r];if(o.property!==i.property)continue;const a=ct(o).filter(d=>ct(i).includes(d));if(a.length===0)continue;const l=this.getTrackSpan(o.id);if(!l||!(l.from<=s.to&&s.from<=l.to))continue;const h=s.from>=l.from;for(const d of a)t.push({target:d,property:i.property,losingTrackId:h?o.id:i.id,winningTrackId:h?i.id:o.id})}}return t}_matches(t,n){if(n.id!==void 0&&t.id!==n.id||n.property!==void 0&&t.property!==n.property||n.target!==void 0&&!ct(t).includes(n.target))return!1;if(n.timeRange){const i=this.getTrackSpan(t.id);if(!i||i.to<n.timeRange.from||i.from>n.timeRange.to)return!1}return!0}toDefinition(){return{formatVersion:$t,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,n)=>t.time-n.time)}setMarkers(t){const n=t&&t.length>0?[...t].sort((s,r)=>s.time-r.time).map(s=>({...s})):void 0,i={...this._config};n?i.markers=n:delete i.markers,this._config=i}get captions(){return this._captions}setCaptions(t){const n={};for(const[i,s]of Object.entries(t??{}))n[i]={...s};this._captions=Object.keys(n).length>0?n:void 0}_armRepeatDelay(){this._repeatDelayRemaining=this._config.repeatDelay??0}_calculateDuration(){let t=0;for(const[,n]of this._trackPlayers)t=Math.max(t,n.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 $o=100;function Ze(e,t,n,i){const s=[],r=[],{duration:o,alternate:a}=i,l=(f,m,p,g)=>{r.push([f,m]);const y=[];e.forEach((v,w)=>{(p==="forward"?(g?v>=f:v>f)&&v<=m:(g?v<=f:v<f)&&v>=m)&&y.push(w)}),y.sort((v,w)=>(p==="forward"?e[v]-e[w]:e[w]-e[v])||v-w);for(const v of y)s.push({kind:"event",index:v,direction:p})};let c=t.time,h=t.direction,d=t.fresh===!0;const u=Math.min($o,Math.max(0,n.iteration-t.iteration));for(let f=0;f<u;f++){const m=h==="forward"?o:0;l(c,m,h,d),s.push({kind:"repeat"}),a?(h=h==="forward"?"reverse":"forward",c=m,d=!1):(c=h==="forward"?0:o,d=!0)}return u>0&&i.holding&&!a?{crossings:s,passes:r}:(l(c,n.time,h,d),{crossings:s,passes:r})}function Ni(e){return rt(e)?{id:e.id,target:e.target,property:e.property,kind:"inertia",inertia:Yi(e.inertia),...K(e)}:ot(e)?{id:e.id,target:e.target,property:e.property,kind:"spring",spring:{...e.spring},...K(e)}:te(e)?{id:e.id,target:e.target,property:"text",textConfig:{...e.textConfig},keyframes:e.keyframes.map(tn),...K(e)}:Re(e)?{id:e.id,target:e.target,property:"motionPath",motionPathConfig:{...e.motionPathConfig},keyframes:e.keyframes.map(tn),...K(e)}:{id:e.id,target:e.target,property:e.property,keyframes:e.keyframes.map(tn),...K(e)}}function Yi(e){return{...e,...Array.isArray(e.end)&&{end:[...e.end]}}}function tn(e){return{time:e.time,value:e.value,...e.easing&&{easing:e.easing}}}function K(e){const t=e.endDelay;return{...e.delay!==void 0&&{delay:e.delay},...t!==void 0&&{endDelay:t},...e.targets!==void 0&&{targets:[...e.targets]},...e.stagger!==void 0&&{stagger:{...e.stagger}}}}function Wi(e){if(rt(e)){const t=e;return{id:t.id,target:t.target,property:t.property,kind:"inertia",inertia:Yi(t.inertia),...K(t)}}if(ot(e)){const t=e;return{id:t.id,target:t.target,property:t.property,kind:"spring",spring:{...t.spring},...K(t)}}if(te(e)){const t=e;return{id:t.id,target:t.target,property:"text",textConfig:{...t.textConfig},keyframes:[...t.keyframes].sort((n,i)=>n.time-i.time),...K(t)}}if(e.property==="motionPath"&&"motionPathConfig"in e){const t=e,n=[...t.keyframes].sort((i,s)=>i.time-s.time);return{id:t.id,target:t.target,property:"motionPath",motionPathConfig:{...t.motionPathConfig},keyframes:n,...K(t)}}return he({id:e.id,target:e.target,property:e.property,keyframes:e.keyframes,...K(e)})}function qi(e){const t=e._config.markers;return{formatVersion:$t,id:e.id,name:e.name,config:{duration:e.duration>0?e.duration:void 0,loop:e._config.loop,speed:e._config.speed,alternate:e._config.alternate,repeatDelay:e._config.repeatDelay,...t&&{markers:t.map(n=>({...n}))}},tracks:e.tracks.map(Ni),...e.captions&&{captions:JSON.parse(JSON.stringify(e.captions))}}}function xt(e){const t=e.formatVersion??1;if(t>$t)throw new Error(`tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${$t}. Update tinyfly to play it.`);return new Qe({id:e.id,name:e.name,config:e.config,tracks:e.tracks.map(Wi),captions:e.captions})}function Fo(e){return JSON.stringify(qi(e))}function Oo(e){const t=JSON.parse(e);return xt(t)}function en(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function fe(e){let t=e>>>0||2654435769;return{seed:e>>>0,next(){return t^=t<<13,t>>>=0,t^=t>>17,t^=t<<5,t>>>=0,t/4294967296}}}function nn(e,t,n){return t+e.next()*(n-t)}function Xi(e,t,n,i){if(i<=0)return nn(e,t,n);const s=Math.floor((n-t)/i),r=Math.round(e.next()*s);return t+r*i}function Do(e,t){if(t.length!==0)return t[Math.floor(e.next()*t.length)]}const Hi=/^([+\-*/])=\s*(-?[\d.]+)$/,Vi=/^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;function Bo(e){return typeof e!="string"?!1:Hi.test(e.trim())||Vi.test(e.trim())}function sn(e,t={}){if(typeof e!="string")return e;const n=e.trim(),i=Hi.exec(n);if(i){const[,r,o]=i,a=t.base??0,l=Number.parseFloat(o);switch(r){case"+":return a+l;case"-":return a-l;case"*":return a*l;case"/":return l===0?a:a/l}}const s=Vi.exec(n);if(s){if(!t.random)throw new Error(`resolveValue: "${n}" 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?Xi(t.random,r,o,a):nn(t.random,r,o)}return e}function Ui(e,t=0,n){const i=[];let s=t;for(const r of e){const o=sn(r,{base:s,random:n});i.push(o),typeof o=="number"&&(s=o)}return i}class No{random;constructor(t){this.random=fe(t)}get seed(){return this.random.seed}resolve(t,n=0){return sn(t,{base:n,random:this.random})}resolveSequence(t,n=0){return Ui(t,n,this.random)}}const Yo=600;function ji(e){if(Array.isArray(e)){const[u,f,m,p]=e;return{fn:Ki(u,f,m,p),bezier:[u,f,m,p]}}const{segments:t}=dt(e);if(t.length===0)throw new Error(`customEase: no curve in "${e}"`);const n=t[0].startX,i=t[0].startY,s=t[t.length-1],r=s.endX-n,o=s.endY-i;if(r===0||o===0)throw new Error(`customEase: "${e}" must move along both axes`);const a=u=>(u-n)/r,l=u=>(u-i)/o;if(t.length===1&&s.type==="C"){const[u,f,m,p]=s.points,g=[a(u),l(f),a(m),l(p)];return{fn:Ki(...g),bezier:g}}const c=[],h=[],d=Math.max(8,Math.ceil(Yo/t.length));for(const u of t)for(let f=c.length===0?0:1;f<=d;f++){const[m,p]=Wo(u,f/d);c.push(a(m)),h.push(l(p))}return{fn:qo(c,h)}}function zi(e={}){const n=.1+Math.max(0,Math.min(1,e.strength??.7))*.7,i=[1];for(let r=n;r>.002;r*=n)i.push(2*Math.sqrt(r));const s=i.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<i.length;a++){if(o<=i[a]){if(a===0)return(o/i[0])**2;const l=i[a]/2,c=l*l,h=o-l;return 1-(c-h*h)}o-=i[a]}return 1}}function Gi(e={}){const t=Math.max(1,e.wiggles??10),n=e.type??"easeOut",i=s=>n==="uniform"?1:n==="easeInOut"?Math.sin(Math.PI*s):(1-s)**2;return s=>s<=0||s>=1?0:Math.sin(s*t*Math.PI*2)*i(s)}function Wo(e,t){if(e.type==="L"){const[c,h]=e.points;return[e.startX+(c-e.startX)*t,e.startY+(h-e.startY)*t]}const[n,i,s,r,o,a]=e.points,l=1-t;return[l*l*l*e.startX+3*l*l*t*n+3*l*t*t*s+t*t*t*o,l*l*l*e.startY+3*l*l*t*i+3*l*t*t*r+t*t*t*a]}function qo(e,t){return n=>{if(n<=e[0])return t[0];if(n>=e[e.length-1])return t[t.length-1];let i=0,s=e.length-1;for(;s-i>1;){const o=i+s>>1;e[o]<=n?i=o:s=o}const r=e[s]-e[i];return r===0?t[s]:t[i]+(n-e[i])/r*(t[s]-t[i])}}function Ki(e,t,n,i){const s=(o,a,l)=>3*(1-o)*(1-o)*o*a+3*(1-o)*o*o*l+o*o*o,r=(o,a,l)=>3*(1-o)*(1-o)*a+6*(1-o)*o*(l-a)+3*o*o*(1-l);return o=>{if(o<=0)return 0;if(o>=1)return 1;let a=o;for(let h=0;h<8;h++){const d=s(a,e,n)-o,u=r(a,e,n);if(Math.abs(d)<1e-6)return s(a,t,i);if(Math.abs(u)<1e-6)break;a-=d/u}let l=0,c=1;a=o;for(let h=0;h<40;h++)s(a,e,n)<o?l=a:c=a,a=(l+c)/2;return s(a,t,i)}}const Xo=350,Ho=300,Vo=550;function Uo(e,t={}){const n=t.lead??Xo,i=t.gap??Ho,s=t.tail??Vo,r=[];let o=0;return e.forEach((a,l)=>{const c=[];let h=o+n;a.lines.forEach((u,f)=>{if(!(u.duration>=0))throw new Error(`narration: scene ${l} line ${f} has an invalid duration (${u.duration})`);f>0&&(h+=i),c.push({id:u.id??`s${l}-l${f}`,scene:l,line:f,start:h,end:h+u.duration,text:u.text}),h+=u.duration});const d=h+s+(a.tail??0);r.push({id:a.id??`s${l}`,start:o,duration:d-o,cues:c}),o=d}),{duration:o,scenes:r,cues:r.flatMap(a=>a.cues)}}function jo(e){return e.cues.map(t=>({id:t.id,time:t.start,label:t.text}))}function zo(e,t){let n=e.scenes[0];for(const i of e.scenes)if(t>=i.start)n=i;else break;return n}const J=e=>Math.round(e*1e3)/1e3;function Ji(e,t={}){if(e.length===0)return"";const n=t.curviness??1,i=t.closed??!1,s=e.length;let r=`M${J(e[0].x)} ${J(e[0].y)}`;if(s===1)return r;const o=l=>i?e[(l%s+s)%s]:e[Math.max(0,Math.min(s-1,l))],a=i?s:s-1;for(let l=0;l<a;l++){const c=o(l-1),h=o(l),d=o(l+1),u=o(l+2);if(n===0){r+=` L${J(d.x)} ${J(d.y)}`;continue}const f=n/6,m=h.x+(d.x-c.x)*f,p=h.y+(d.y-c.y)*f,g=d.x-(u.x-h.x)*f,y=d.y-(u.y-h.y)*f;r+=` C${J(m)} ${J(p)} ${J(g)} ${J(y)} ${J(d.x)} ${J(d.y)}`}return i?`${r} Z`:r}const Y=(e,t=0)=>{const n=parseFloat(e??"");return Number.isFinite(n)?n:t};function Go(e){const t=(e??"").trim().split(/[\s,]+/).filter(Boolean).map(Number),n=[];for(let i=0;i+1<t.length;i+=2)n.push({x:t[i],y:t[i+1]});return n}function de(e){const t=e.attributes;switch(e.tag.toLowerCase()){case"path":return t.d??null;case"circle":case"ellipse":{const n=Y(t.cx),i=Y(t.cy),s=e.tag.toLowerCase()==="circle"?Y(t.r):Y(t.rx),r=e.tag.toLowerCase()==="circle"?Y(t.r):Y(t.ry);return`M${n+s} ${i} A${s} ${r} 0 1 1 ${n-s} ${i} A${s} ${r} 0 1 1 ${n+s} ${i} Z`}case"rect":{const n=Y(t.x),i=Y(t.y),s=Y(t.width),r=Y(t.height);let o=t.rx!=null?Y(t.rx):t.ry!=null?Y(t.ry):0,a=t.ry!=null?Y(t.ry):o;return o=Math.min(o,s/2),a=Math.min(a,r/2),o===0||a===0?`M${n} ${i} H${n+s} V${i+r} H${n} Z`:`M${n+o} ${i} H${n+s-o} A${o} ${a} 0 0 1 ${n+s} ${i+a} V${i+r-a} A${o} ${a} 0 0 1 ${n+s-o} ${i+r} H${n+o} A${o} ${a} 0 0 1 ${n} ${i+r-a} V${i+a} A${o} ${a} 0 0 1 ${n+o} ${i} Z`}case"line":return`M${Y(t.x1)} ${Y(t.y1)} L${Y(t.x2)} ${Y(t.y2)}`;case"polyline":case"polygon":{const n=Go(t.points);if(n.length===0)return null;const i=n.map((s,r)=>`${r===0?"M":"L"}${s.x} ${s.y}`).join(" ");return e.tag.toLowerCase()==="polygon"?`${i} Z`:i}default:return null}}const me={"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]},Qi={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 Ko(e){let t=e.trim().toLowerCase();t=t.replace(/\.ease(in|out|inout)$/,".$1");const n=/^([a-z]+\d?)(\(.*\))?$/.exec(t);return n&&n[1]!=="steps"&&t!=="none"&&t!=="linear"&&(t=`${n[1]}.out${n[2]??""}`),t}z({type:"bounce",mode:"in"}),z({type:"bounce",mode:"in-out"});function Xt(e){const t=Zi.get(e.trim().toLowerCase());if(t)return t;const n=Ko(e),i=/^steps\(\s*(\d+)\s*\)$/.exec(n);if(i){const o={type:"steps",count:Math.max(1,Number.parseInt(i[1],10))+1,position:"none"};return{easing:o,fn:z(o)}}const s=/^(elastic|bounce|back)\.(in|out|inout)(?:\(([^)]*)\))?$/.exec(n);if(s){const[,r,o,a]=s,l=(a??"").split(",").map(d=>Number.parseFloat(d)).filter(d=>Number.isFinite(d)),c=o==="inout"?"in-out":o;if(r==="back"&&l.length===0&&n in me)return{easing:{type:"cubic-bezier",points:me[n]}};const h=r==="elastic"?{type:"elastic",mode:c,...l[0]!==void 0&&{amplitude:l[0]},...l[1]!==void 0&&{period:l[1]}}:r==="bounce"?{type:"bounce",mode:c}:{type:"back",mode:c,...l[0]!==void 0&&{overshoot:l[0]}};return{easing:h,fn:z(h)}}return n in Qi?{easing:Qi[n]}:n in me?{easing:{type:"cubic-bezier",points:me[n]}}:{easing:"ease-out"}}const Zi=new Map;function rn(e,t){return Zi.set(e.trim().toLowerCase(),t.bezier?{easing:{type:"cubic-bezier",points:t.bezier},fn:t.fn}:{fn:t.fn,requiresBaking:"custom"}),e}function on(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}const ts=/^\s*random\(\s*(\[.*\]|[^)]*)\s*\)\s*$/;function es(e){return typeof e=="string"&&ts.test(e)}function Jo(e=1){let t=on(e);const n=(l,c)=>((...h)=>h.length>=l?c(...h):d=>c(...h,d)),i=(l,c,h)=>Math.min(Math.max(h,Math.min(l,c)),Math.max(l,c)),s=(l,c,h,d,u)=>c===l?h:h+(u-l)/(c-l)*(d-h),r=(l,c)=>{if(typeof l=="number")return l===0?c:Math.round(c/l)*l;if(Array.isArray(l))return ns(l,c,1/0);if("values"in l)return ns(l.values,c,l.radius??1/0);const h=Math.round(c/l.increment)*l.increment;return Math.abs(h-c)<=(l.radius??1/0)?h:c},o=(l,c,h)=>{const d=l+t()*(c-l);return h?Math.round(d/h)*h:d};return{clamp:n(3,i),mapRange:n(5,s),normalize:n(3,(l,c,h)=>s(l,c,0,1,h)),interpolate:n(3,(l,c,h)=>{if(typeof l=="object"&&!Array.isArray(l)){const d={};for(const u of Object.keys(l))d[u]=qt(l[u])(l[u],c[u],h);return d}return qt(l)(l,c,h)}),wrap:((l,c,h)=>{if(Array.isArray(l)){const p=l,g=y=>p[(Math.round(y)%p.length+p.length)%p.length];return c===void 0?g:g(c)}const d=l,f=c-d,m=p=>f===0?d:((p-d)%f+f)%f+d;return h===void 0?m:m(h)}),wrapYoyo:n(3,(l,c,h)=>{const d=c-l;if(d===0)return l;const u=((h-l)%(d*2)+d*2)%(d*2);return l+(u>d?d*2-u:u)}),snap:n(2,r),random:((l,c,h,d)=>{if(Array.isArray(l)){const f=()=>l[Math.floor(t()*l.length)];return c===!0?f:f()}const u=()=>o(l,c,h);return d?u:u()}),shuffle:l=>{for(let c=l.length-1;c>0;c--){const h=Math.floor(t()*(c+1));[l[c],l[h]]=[l[h],l[c]]}return l},distribute:({base:l=0,amount:c,each:h,from:d="start",ease:u})=>(f,m,p)=>{const g=p.length,v=ee(f,g,{...c!==void 0?{amount:c}:{each:h??1},from:d}),w=c!==void 0?c:(h??1)*$e(g,d),k=u&&w>0?u(v/w)*w:v;return l+k},pipe:(...l)=>c=>l.reduce((h,d)=>d(h),c),splitColor:l=>Qo(l),getUnit:l=>typeof l=="number"?"":/^-?[\d.]+(?:e[-+]?\d+)?([a-z%]*)$/i.exec(l.trim())?.[1]??"",seed:l=>{t=on(l)},resolveRandomString:l=>{const c=ts.exec(l)?.[1]??"";if(c.startsWith("[")){const m=c.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,d,u]=c.split(",").map(f=>Number.parseFloat(f));return o(h,d,Number.isFinite(u)?u:void 0)}}}function ns(e,t,n){let i=t,s=1/0;for(const r of e){const o=Math.abs(r-t);o<s&&(s=o,i=r)}return s<=n?i:t}function Qo(e){const t=e.trim(),n=/^#([0-9a-f]{3,8})$/i.exec(t)?.[1];if(n){const r=(n.length<=4?[...n].map(o=>o+o).join(""):n).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 i=(/rgba?\(([^)]+)\)/i.exec(t)?.[1]??"0,0,0").split(/[\s,/]+/).filter(Boolean).map(s=>Number.parseFloat(s));return i.length>=4?[i[0],i[1],i[2],i[3]]:[i[0]??0,i[1]??0,i[2]??0]}const Zo=/^([+-])=\s*(-?[\d.]+)$/,ta=/^([<>])\s*(?:([+-])?=?\s*(-?[\d.]+))?$/;function Ht(e,t){const n=t.scale??1,i=c=>Number.parseFloat(c)*n;if(e===void 0)return t.cursor;if(typeof e=="number")return e*n;const s=e.trim();if(s==="")return t.cursor;const r=Zo.exec(s);if(r){const c=i(r[2]);return t.cursor+(r[1]==="-"?-c:c)}const o=ta.exec(s);if(o){const c=o[1]==="<"?t.previousStart:t.previousEnd;if(o[3]===void 0)return c;const h=i(o[3]);return c+(o[2]==="-"?-h:h)}const a=/^(.+?)([+-])=\s*(-?[\d.]+)$/.exec(s);if(a){const c=t.labels.get(a[1].trim());if(c!==void 0){const h=i(a[3]);return c+(a[2]==="-"?-h:h)}}const l=t.labels.get(s);return l!==void 0?l:/^-?[\d.]+$/.test(s)?i(s):t.cursor}function ea(e){if(typeof e!="object"||e===null)return!1;const t=e;return t.grid!==void 0||t.from==="random"||Array.isArray(t.from)||t.ease!==void 0||t.axis!==void 0}function na(e,t,n={}){if(e===0)return[];const i=t.grid==="auto"?Math.max(1,Math.min(e,n.columnsFromLayout?.()??e)):Array.isArray(t.grid)?Math.max(1,t.grid[1]):e,s=Array.isArray(t.grid)?Math.max(1,t.grid[0]):Math.ceil(e/i),r=m=>({x:m%i,y:Math.floor(m/i)}),o=t.from??"start",a=Array.isArray(o)?{x:o[0]*(i-1),y:o[1]*(s-1)}:typeof o=="number"?r(Math.max(0,Math.min(e-1,o))):o==="end"?r(e-1):o==="center"||o==="edges"?{x:(i-1)/2,y:(s-1)/2}:{x:0,y:0},l=m=>{const{x:p,y:g}=r(m),y=Math.abs(p-a.x),v=Math.abs(g-a.y);return t.axis==="x"?y:t.axis==="y"?v:Math.hypot(y,v)};let c=Array.from({length:e},(m,p)=>l(p));const h=Math.max(...c);if(o==="edges"&&(c=c.map(m=>h-m)),o==="random"){const m=n.random??Math.random;c=c.map(()=>m()*h)}const d=t.amount!==void 0?t.amount:(t.each??0)*h,u=t.ease?Xt(t.ease):void 0,f=u?u.fn??z(u.easing):void 0;return c.map(m=>{const p=h===0?0:m/h;return(f?f(p):p)*d})}const an=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 pe(e){const t={},n={};for(const[i,s]of Object.entries(e))an.has(i)?t[i]=s:n[i]=s;return{config:t,properties:n}}function ge(e,t){return e===void 0?t:e*1e3}function ln(e,t){if(e!==void 0)return typeof e=="number"?{each:e*1e3}:ea(e)?{offsets:na(t?.count??0,e,t??{}).map(i=>i*1e3)}:{...e.each!==void 0&&{each:e.each*1e3},...e.amount!==void 0&&{amount:e.amount*1e3},...e.from!==void 0&&{from:e.from}}}const ia={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 is(e){return ia[e]}function sa(e){const t=typeof e=="string"||Array.isArray(e)?{path:e}:e;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 n;if(Array.isArray(t.path))n=Ji(t.path,{curviness:t.curviness});else if(Mt(t.path))n=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 i={pathData:n};return t.autoRotate!==void 0&&t.autoRotate!==!1&&(i.autoRotate=!0,typeof t.autoRotate=="number"&&(i.rotateOffset=t.autoRotate)),t.matrix&&(i.matrix=t.matrix),{config:i,start:t.start??0,end:t.end??1}}function ra(e){const t=typeof e=="string"||Array.isArray(e)?{path:e}:{...e};return{...t,start:t.end??1,end:t.start??0}}function ss(e){return typeof e=="object"&&e!==null&&"shape"in e?e.shape:e}function oa(e){if(e.morphSVG===void 0)return e;const{morphSVG:t,...n}=e,i=ss(t);if(typeof i!="string"||!Mt(i))throw new Error(`gsap-compat: morphSVG "${String(i)}" is not path data. Selectors and elements are resolved by live.to(); timeline() and tf need the path data itself.`);return{...n,d:i}}function aa(e,t){if(e===!0)return[0,t];if(e===!1)return[0,0];if(typeof e=="number")return[0,rs(e,t)];const n=e.trim().split(/[\s,]+/).filter(Boolean),i=o=>{const a=Number.parseFloat(o);if(Number.isNaN(a))throw new Error(`gsap-compat: drawSVG "${e}" is not a length or percentage`);return rs(o.endsWith("%")?t*a/100:a,t)};if(n.length===0)return[0,t];if(n.length===1)return[0,i(n[0])];const s=i(n[0]),r=i(n[1]);return s<=r?[s,r]:[r,s]}function la(e,t){const[n,i]=aa(e,t);return{strokeDasharray:[i-n,t],strokeDashoffset:-n}}function ca(e,t){if(e.drawSVG===void 0)return e;const{drawSVG:n,...i}=e;return{...i,...la(n,t)}}function ha(e){if(e.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 e}function rs(e,t){return Math.max(0,Math.min(t,e))}function ua(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return t>>>0}function fa(e,t,n){if(e.scrambleText!==void 0){const i=e.scrambleText,s=typeof i=="string"?{text:i}:i;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&&n>0?s.revealDelay*1e3/n: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??ua(`${t}|${s.text}`)}}if(e.text!==void 0){const i=e.text,s=typeof i=="string"?{value:i}:i;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 cn(e){return Math.max(.1,e/25)}function da(e,t){const n=typeof t=="number"?{velocity:t}:t;if(typeof n?.velocity!="number"||!Number.isFinite(n.velocity))throw new Error("gsap-compat: inertia needs a velocity for each property — a number, or { velocity }.");const i=n.friction??(n.resistance!==void 0?cn(n.resistance):void 0),s={from:e,velocity:n.velocity,...i!==void 0&&{friction:i},...n.min!==void 0&&{min:n.min},...n.max!==void 0&&{max:n.max}};return typeof n.end=="function"?s.end=[n.end(Dt(s))]:n.end!==void 0&&(s.end=Array.isArray(n.end)?[...n.end]:n.end),s}function ma(e){const t=e===!0?{}:typeof e=="string"?{preset:e}:e;if(t.preset!==void 0&&!(t.preset in se))throw new Error(`gsap-compat: unknown spring preset "${t.preset}" — use one of ${Object.keys(se).join(", ")}`);return{...t.preset?se[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 pa(e,t){if(e===!0||typeof e=="string")return;const n=e.velocity;return typeof n=="number"?n:n?.[t]}class mt{timeline;options;cursor=0;fallbackRandom=on(1);previousStart=0;previousEnd=0;labels=new Map;trackCounter=0;lastValues=new Map;constructor(t={}){this.options=t,this.timeline=new Qe({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,n,i){return this.build(t,void 0,Vt(n),i)}from(t,n,i){const{config:s,properties:r}=pe(Vt(n)),{motionPath:o,text:a,scrambleText:l,...c}=r,h=this.targetsOf(t)[0],d={...s};for(const m of Object.keys(c))d[m]=this.resolveStart(h,m);o!==void 0&&(d.motionPath=ra(o));const u={},f=String(this.resolveStart(h,"text"));return a!==void 0&&(u.text=hn(a),d.text=typeof a=="object"?{...a,value:f}:f),l!==void 0&&(u.text=hn(l),d.scrambleText=typeof l=="object"?{...l,text:f}:f),this.build(t,{...c,...u},d,i)}fromTo(t,n,i,s){const{properties:r}=pe(Vt(n));return this.build(t,r,Vt(i),s)}set(t,n,i){return this.build(t,void 0,{...Vt(n),duration:0},i)}get lastStart(){return this.previousStart}get lastEnd(){return this.previousEnd}addEvent(t){const n=Math.max(0,Ht(t,this.context()));return this.previousStart=n,this.previousEnd=n,this.cursor=Math.max(this.cursor,n),n}timeOf(t){return Ht(t,this.context())}addLabel(t,n){return this.labels.set(t,Ht(n,this.context())),this}labelTimes(){return[...this.labels.values()].sort((t,n)=>t-n)}labelTime(t){return this.labels.get(t)}add(t,n){const i=Ht(n,this.context());for(const r of t.timeline.tracks){if(!("keyframes"in r))continue;const o=he({...r,id:this.nextTrackId(`nested-${r.id}`),keyframes:r.keyframes.map(a=>({...a,time:a.time+i}))});this.timeline.addTrack(o)}const s=i+t.timeline.duration;return this.previousStart=i,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 n=this.labels.get(t);return n!==void 0&&this.timeline.seek(n),this}return this.timeline.seek(t*1e3),this}progress(t){const n=this.timeline.duration;return t!==void 0&&n>0&&this.timeline.seek(t*n),n>0?this.timeline.currentTime/n: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,n,i,s){const{config:r,properties:o}=pe(i),{motionPath:a,text:l,scrambleText:c,inertia:h,...d}=o,u=this.targetsOf(t),f=Ht(s,this.context()),m=ge(r.delay,0),p=ge(r.duration,500),g=ln(r.stagger,{count:u.length,columnsFromLayout:this.options.layoutColumns?()=>this.options.layoutColumns(u):void 0,random:this.options.random??this.fallbackRandom}),y=this.easingFor(r.ease),v=[],w=r.spring;let k=0,T=!1;for(const[A,E]of Object.entries(d)){const S=E;let _=n?.[A]!==void 0?n[A]:this.resolveStart(u[0],A);if(typeof _!=typeof S&&(this.warn(`no usable start value for "${A}" on "${u[0]}" — it will snap to ${String(S)}. Use fromTo() to animate it.`),_=S),w!==void 0&&(typeof _!="number"||typeof S!="number")&&this.warn(`spring works on numbers, so "${A}" on "${u[0]}" eases instead`),w!==void 0&&typeof _=="number"&&typeof S=="number"){const $={...ma(w),from:_,to:S,velocity:pa(w,A)??this.options.startVelocity?.(u[0],A)??0},B=this.nextTrackId(`${u[0]}-${A}-spring`),N={id:B,target:u[0],...u.length>1&&{targets:u},...g&&u.length>1&&{stagger:g},property:A,kind:"spring",spring:$,delay:f+m};this.timeline.addTrack(N),v.push(B),k=Math.max(k,Zn($));for(const F of u)this.lastValues.set(`${F}|${A}`,S);continue}T=!0;const P=this.keyframesFor(_,S,p,y,r.ease),R=this.nextTrackId(`${u[0]}-${A}`);this.timeline.addTrack(he({id:R,target:u[0],...u.length>1&&{targets:u},...g&&u.length>1&&{stagger:g},property:A,delay:f+m,keyframes:P})),v.push(R);for(const $ of u)this.lastValues.set(`${$}|${A}`,S)}const M=fa({text:l,scrambleText:c},u[0],p);if(M){const A=n?.text??n?.scrambleText,E=A!==void 0?hn(A):this.resolveStart(u[0],"text"),S=this.nextTrackId(`${u[0]}-text`),_={id:S,target:u[0],...u.length>1&&{targets:u},...g&&u.length>1&&{stagger:g},property:"text",textConfig:{from:typeof E=="string"?E:String(E??""),...M},delay:f+m,keyframes:this.keyframesFor(0,1,p,y,r.ease)};this.timeline.addTrack(_),v.push(S);for(const P of u)this.lastValues.set(`${P}|text`,M.to)}if(a!==void 0){const{config:A,start:E,end:S}=sa(a),_=this.nextTrackId(`${u[0]}-motionPath`),P={id:_,target:u[0],...u.length>1&&{targets:u},...g&&u.length>1&&{stagger:g},property:"motionPath",motionPathConfig:A,delay:f+m,keyframes:this.keyframesFor(E,S,p,y,r.ease)};this.timeline.addTrack(P),v.push(_)}if(h!==void 0)for(const[A,E]of Object.entries(h)){const S=this.resolveStart(u[0],A);if(typeof S!="number"){this.warn(`inertia on "${A}" needs a numeric start value; skipped`);continue}const _=da(S,E),P=this.nextTrackId(`${u[0]}-${A}-inertia`),R={id:P,target:u[0],...u.length>1&&{targets:u},...g&&u.length>1&&{stagger:g},property:A,kind:"inertia",inertia:_,delay:f+m};this.timeline.addTrack(R),v.push(P),k=Math.max(k,Tt(_));for(const $ of u)this.lastValues.set(`${$}|${A}`,vt(_))}const L=((h!==void 0||w!==void 0)&&!T&&!M&&a===void 0?k:Math.max(p,k))+(g&&u.length>1?Ft(u.length,g):0),I=f+m+L;return this.previousStart=f+m,this.previousEnd=I,this.cursor=Math.max(this.cursor,I),{trackIds:v,start:f+m,end:I,kill:()=>{for(const A of v)this.timeline.removeTrack(A)}}}keyframesFor(t,n,i,s,r){const o={time:0,value:t};if(i<=0)return[{time:0,value:n}];const a=typeof r=="string"?Xt(r):void 0;if(a?.requiresBaking==="custom"||this.options.bakeEases&&Lt(s)){const c=a?.fn??z(s);return[o,...Ge(o,{time:i,value:n},c,{intervalMs:this.options.bakeIntervalMs})]}return[o,{time:i,value:n,...s&&{easing:s}}]}resolveStart(t,n){const i=this.lastValues.get(`${t}|${n}`);if(i!==void 0)return i;const s=this.options.startValue?.(t,n);if(s!==void 0)return s;const r=this.options.defaults?.[n];if(r!==void 0)return r;if(n==="text")return"";if(n==="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=is(n);return o!==void 0?(this.warn(`no start value for "${n}" 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 "${n}" on "${t}" — using 0`),0)}easingFor(t){if(t!==void 0){if(typeof t=="string")return Xt(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 hn(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){const t=e;return String(t.value??t.text??"")}return String(e??"")}function ga(e){return new mt(e)}function Vt(e){return ha(oa(e))}const ya=new Set(["blur","brightness","glow","glowColor","shadowX","shadowY","shadowBlur","shadowColor"]),ba="#ffffff",wa="rgba(0, 0, 0, 0.5)";function va(e){const t=[];if(e.blur!==void 0&&t.push(`blur(${Math.max(0,e.blur)}px)`),e.brightness!==void 0&&t.push(`brightness(${Math.max(0,e.brightness)})`),e.glow!==void 0&&t.push(`drop-shadow(0 0 ${Math.max(0,e.glow)}px ${e.glowColor??ba})`),e.shadowX!==void 0||e.shadowY!==void 0||e.shadowBlur!==void 0){const n=e.shadowX??0,i=e.shadowY??0,s=Math.max(0,e.shadowBlur??0);t.push(`drop-shadow(${n}px ${i}px ${s}px ${e.shadowColor??wa})`)}return t.length>0?t.join(" "):null}function Ta(e,t){const n=e.childNodes.length===1?e.firstChild:null;if(n&&n.nodeType===3){const i=n;i.data!==t&&(i.data=t);return}e.textContent!==t&&(e.textContent=t)}function ka(e){if(!("ownerSVGElement"in e))return;const t=e.style;!t||t.transformBox||(t.transformBox="fill-box",t.transformOrigin||(t.transformOrigin="50% 50%"))}const os=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"]),Ma=new Set(["x","y","z","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skewX","skewY","motionPathX","motionPathY","motionPathRotate"]),Sa=new Set(["originX","originY"]),xa=new Set(["clipTop","clipRight","clipBottom","clipLeft"]),Aa=new Set(["drawOn"]),Ea={fill:"backgroundColor",stroke:"borderColor",strokeWidth:"borderWidth",color:"color",backgroundColor:"backgroundColor",borderColor:"borderColor"},as={fill:"fill",stroke:"stroke",strokeWidth:"strokeWidth",strokeDasharray:"strokeDasharray",strokeDashoffset:"strokeDashoffset",fillOpacity:"fillOpacity",strokeOpacity:"strokeOpacity"},Pa="http://www.w3.org/2000/svg";class pt{targets=new Map;registerTarget(t,n){this.targets.set(t,n)}unregisterTarget(t){this.targets.delete(t)}getTarget(t){return this.targets.get(t)}clearTargets(){this.targets.clear()}applyState(t){for(const[n,i]of t.values){const s=this.targets.get(n);s&&this.applyProperties(s,i)}}applyProperties(t,n){const i=[];let s=null,r=null,o=null;const a=n.has("motionPathX"),l=n.has("motionPathY"),c=n.has("motionPathRotate");for(const[u,f]of n)if(!(u==="x"&&a)&&!(u==="y"&&l)&&!((u==="rotate"||u==="rotateZ")&&c)&&!Aa.has(u)){if(Ma.has(u)){const m=this.buildTransformPart(u,f);m&&i.push(m)}else if(Sa.has(u))typeof f=="number"&&((s??={})[u]=f);else if(xa.has(u))typeof f=="number"&&((r??={})[u]=f);else if(ya.has(u))(o??={})[u]=f;else if(u!=="perspective"){if(u!=="shine")if(u==="text"&&typeof f=="string")Ta(t,f);else if(u==="d"&&typeof f=="string"){const m=t;(m.tagName?.toLowerCase()==="path"?m:m.querySelector?.("path"))?.setAttribute?.("d",f)}else this.applyStyleProperty(t,u,f)}}const h=n.get("shine");typeof h=="number"&&this.applyShine(t,h);const d=n.get("perspective");if(typeof d=="number"&&i.unshift(`perspective(${d}px)`),i.length>0&&(t.style.transform=i.join(" "),ka(t)),s){const u=s.originX??50,f=s.originY??50;t.style.transformOrigin=`${u}% ${f}%`}if(r){const u=r.clipTop??0,f=r.clipRight??0,m=r.clipBottom??0,p=r.clipLeft??0;t.style.clipPath=`inset(${u}% ${f}% ${m}% ${p}%)`}if(o){const u=va(o);u&&(t.style.filter=u)}}buildTransformPart(t,n){if(typeof n!="number")return null;switch(t){case"x":case"motionPathX":return`translateX(${n}px)`;case"y":case"motionPathY":return`translateY(${n}px)`;case"z":return`translateZ(${n}px)`;case"rotate":case"rotateZ":case"motionPathRotate":return`rotate(${n}deg)`;case"rotateX":return`rotateX(${n}deg)`;case"rotateY":return`rotateY(${n}deg)`;case"scale":return`scale(${n})`;case"scaleX":return`scaleX(${n})`;case"scaleY":return`scaleY(${n})`;case"scaleZ":return`scaleZ(${n})`;case"skewX":return`skewX(${n}deg)`;case"skewY":return`skewY(${n}deg)`;default:return null}}applyShine(t,n){t.dataset.shineBase||(t.dataset.shineBase=t.style.color||"currentColor");const i=t.dataset.shineBase,s=-20+n*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(${i}, ${i})`,r.backgroundSize="250% 100%, 100% 100%",r.backgroundPosition=`${s}% 0, 0 0`,r.backgroundRepeat="no-repeat",r.webkitBackgroundClip="text",r.backgroundClip="text"}applyStyleProperty(t,n,i){let s;if(t.namespaceURI===Pa&&n in as){const a=Array.isArray(i)?i.join(", "):String(i);t.style[as[n]]=a;return}else n==="fill"&&t.dataset?.elementType==="text"?s="color":s=Ea[n]??n;let o;typeof i=="number"?os.has(n)||os.has(s)?o=`${i}px`:o=String(i):Array.isArray(i)?o=i.join(", "):o=i,t.style[s]=o}}const _a={request:e=>requestAnimationFrame(e),cancel:e=>cancelAnimationFrame(e)};class ls{adapter=new pt;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=Jo();active=new Map;applied=new Map;dirty=new Set;frameId=null;lastTimestamp=null;destroyed=!1;constructor(t={}){this.scheduler=t.scheduler??_a,this.rootOption=t.root,this.onWarning=t.onWarning}get root(){return this.rootOption??document}resolveTargets(t){const n=[];for(const i of this.targetsOf(t)){const s=this.nameFor(i);un(i)&&this.currentCollector?.touch(i,s),n.push(s)}return n}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,n){return this.applied.get(t)?.get(n)}velocityOf(t,n){for(const s of[...this.active.keys()].reverse()){if(s.getTracks({target:t,property:n}).length===0)continue;const r=s.currentTime;if(r<4)return 0;const o=s.getStateAtTime(r).values.get(t)?.get(n),a=s.getStateAtTime(r-4).values.get(t)?.get(n);if(typeof o!="number"||typeof a!="number")return;const l=(o-a)/4;return(s.direction==="reverse"?-l:l)*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,n={}){this.destroyed||(t.onUpdate=i=>this.write(i),this.active.delete(t),this.active.set(t,n),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,n){if(this.destroyed)return;const i=new Map(Object.entries(n));this.write({values:new Map([[t,i]]),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 n=[...this.active];for(const[i]of n)i.duration<=0?(this.write(i.getStateAtTime(0)),i.stop()):i.tick(t);this.flush();for(const[i,s]of n)s.onUpdate?.(),i.playbackState!=="playing"&&this.active.get(i)===s&&this.active.delete(i);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 n of[...this.tickerCallbacks])n(this.tickerTime/1e3,t,this.tickerFrame)}}write(t){for(const[n,i]of t.values){let s=this.applied.get(n);s||(s=new Map,this.applied.set(n,s));for(const[r,o]of i)s.set(r,o);this.dirty.add(n)}}flush(){if(this.dirty.size===0)return;const t=new Map;for(const n of this.dirty){const i=this.applied.get(n),s=this.objects.get(n);if(s)for(const[r,o]of i)s[r]=o;else t.set(n,i)}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 n=this.lastTimestamp===null?0:t-this.lastTimestamp;this.lastTimestamp=t,n>0&&this.tick(n),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(un(t))return[t];if(!Ca(t))return[t];const n=[];for(const i of Array.from(t))n.push(...this.targetsOf(i));return n}nameFor(t){return un(t)?this.elementName(t):this.objectName(t)}objectName(t){const n=this.objectNames.get(t);if(n)return n;let i;do this.nameCounter+=1,i=`obj-${this.nameCounter}`;while(this.objects.has(i)||this.elements.has(i));return this.objectNames.set(t,i),this.objects.set(i,t),i}elementName(t){const n=this.names.get(t);if(n)return n;let i=t.id?`#${t.id}`:"";if(!i||this.elements.has(i))do this.nameCounter+=1,i=`el-${this.nameCounter}`;while(this.elements.has(i));return this.names.set(t,i),this.elements.set(i,t),this.adapter.registerTarget(i,t),i}}function un(e){return typeof e=="object"&&e!==null&&e.nodeType===1}function Ca(e){if(Array.isArray(e))return!0;const t=e;return typeof t.length=="number"&&typeof t.item=="function"}function ye(e){const t=e.style;if(!t)return e.getBoundingClientRect();const n=t.transform;t.transform="none";const i=e.getBoundingClientRect();return t.transform=n,i}const cs=e=>typeof e=="object"&&e!==null&&e.nodeType===1;function Ia(e){const t={};for(const n of Array.from(e.attributes))t[n.name]=n.value;return t}function Ra(e){const t=e.getScreenCTM?.();if(t)return[t.a,t.b,t.c,t.d,t.e,t.f];const n=e.getBoundingClientRect();return[1,0,0,1,n.left,n.top]}function La(e,t){const n=typeof e=="string"||Array.isArray(e)||cs(e)?{path:e}:e,{align:i,alignOrigin:s,path:r,...o}=n,a=M=>{const x=cs(M)?M:t.query(M);return x||t.warn(`gsap-compat: motionPath could not find "${String(M)}"`),x};let l=null,c="";if(Array.isArray(r)||typeof r=="string"&&Mt(r))c=r;else{l=a(r);const M=l&&de({tag:l.localName,attributes:Ia(l)});l&&!M&&t.warn(`gsap-compat: motionPath element <${l.localName}> has no path geometry`),c=M??""}const h={...o,path:c};if(i===void 0||i===!1)return h;const d=i===!0?l:a(i);if(!d)return i===!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[f,m,p,g,y,v]=Ra(d),w=ye(u),[k,T]=s??[.5,.5];for(const M of t.targets.slice(1)){const x=ye(M);if(Math.abs(x.left-w.left)>.5||Math.abs(x.top-w.top)>.5){t.warn("gsap-compat: motionPath align measures the first target; the others are laid out elsewhere");break}}return h.matrix=[f,m,p,g,y-w.left-k*w.width,v-w.top-T*w.height],h}const hs=e=>typeof e=="object"&&e!==null&&e.nodeType===1;function us(e){const t={};for(const n of Array.from(e.attributes))t[n.name]=n.value;return t}function fs(e){if(!e)return null;const t=de({tag:e.localName,attributes:us(e)});return t||(e.querySelector("path")?.getAttribute("d")??null)}function $a(e,t,n){const i=ss(e);if(typeof i=="string"&&Mt(i))return i;const s=hs(i)?i:typeof i=="string"?t(i):null,r=fs(s);return r||(n(`gsap-compat: morphSVG could not find a shape for "${String(i)}"`),"")}const Fa=new Set(["cx","cy","r","rx","ry","x","y","width","height","x1","y1","x2","y2","points"]);function Oa(e,t=document){return(typeof e=="string"?Array.from(t.querySelectorAll(e)):hs(e)?[e]:Array.from(e)).map(i=>{if(i.localName==="path")return i;const s=de({tag:i.localName,attributes:us(i)});if(!s||!i.parentNode)return i;const r=i.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");for(const o of Array.from(i.attributes))Fa.has(o.name)||r.setAttribute(o.name,o.value);return r.setAttribute("d",s),i.parentNode.replaceChild(r,i),r})}const ds=.3;class ms{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,n,i){this.dragging=!0,this.passedTolerance=!1,this.startX=t,this.startY=n,this.lastX=t,this.lastY=n,this.velocityX=0,this.velocityY=0,this.lastTime=ps(),this.options.onPress?.(this.stateFrom(0,0,i))}move(t,n,i){if(!this.dragging)return;const s=t-this.lastX,r=n-this.lastY;this.lastX=t,this.lastY=n;const o=t-this.startX,a=n-this.startY,l=this.options.tolerance??3;if(!this.passedTolerance){if(Math.hypot(o,a)<l)return;this.passedTolerance=!0}this.updateVelocity(s,r),this.options.preventDefault!==!1&&i.cancelable&&i.preventDefault(),this.options.onMove?.(this.stateFrom(s,r,i))}end(t){this.dragging&&(this.dragging=!1,this.options.onRelease?.(this.stateFrom(0,0,t)))}updateVelocity(t,n){const i=ps(),s=Math.max(1,i-this.lastTime);this.lastTime=i;const r=t/s*1e3,o=n/s*1e3;this.velocityX+=(r-this.velocityX)*ds,this.velocityY+=(o-this.velocityY)*ds}stateFrom(t,n,i){return{deltaX:t,deltaY:n,velocityX:this.velocityX,velocityY:this.velocityY,totalX:this.lastX-this.startX,totalY:this.lastY-this.startY,isDragging:this.dragging,event:i}}onPointerDown=t=>{const n=t,i=this.target;if(typeof n.pointerId=="number"&&typeof i.setPointerCapture=="function")try{i.setPointerCapture(n.pointerId)}catch{}this.begin(n.clientX,n.clientY,t)};onPointerMove=t=>{const n=t;this.move(n.clientX,n.clientY,t)};onPointerUp=t=>this.end(t);onTouchStart=t=>{const n=t.touches[0];n&&this.begin(n.clientX,n.clientY,t)};onTouchMove=t=>{const n=t.touches[0];n&&this.move(n.clientX,n.clientY,t)};onTouchEnd=t=>this.end(t);onWheel=t=>{const n=t;this.options.preventDefault!==!1&&n.cancelable&&n.preventDefault(),this.updateVelocity(n.deltaX,n.deltaY),this.options.onMove?.({deltaX:n.deltaX,deltaY:n.deltaY,velocityX:this.velocityX,velocityY:this.velocityY,totalX:0,totalY:0,isDragging:!1,event:t})}}function ps(){return typeof performance<"u"?performance.now():Date.now()}function gs(e,t,n){let i={delta:0,line:null},s=n;for(const r of e)for(const o of t){const a=Math.abs(o-r);a<=s&&(s=a,i={delta:o-r,line:o})}return i}function ys(e,t){return t<=0?[]:e.map(n=>Math.round(n/t)*t)}class fn{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 ms({target:t.target,onPress:n=>{const i=t.getPosition?.();i&&(this.x=i.x,this.y=i.y),this.originX=this.x,this.originY=this.y,t.onPress?.(n)},onMove:n=>this.handleMove(n),onRelease:n=>t.onRelease?.(n)})}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,n){const i=this.options.axis??"both";this.x=i==="y"?this.x:this.applyConstraints(t,"x"),this.y=i==="x"?this.y:this.applyConstraints(n,"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 n=t.duration;if(n<=0)return;const i=this.options.scrubDistance??500;if(i===0)return;const s=(this.options.axis??"both")==="y"?this.y:this.x,r=Da(s/i);t.pause(),t.seek(r*n)}applyConstraints(t,n){let i=t;const s=[...ys([i],this.options.snap??0),...(n==="x"?this.options.snapLinesX:this.options.snapLinesY)??[]],r=gs([i],s,this.snapThreshold());i+=r.delta,n==="x"?this.snappedX=r.line:this.snappedY=r.line;const o=this.options.bounds;if(o){const a=n==="x"?o.minX:o.minY,l=n==="x"?o.maxX:o.maxY;a!==void 0&&(i=Math.max(a,i)),l!==void 0&&(i=Math.min(l,i))}return i}}function Da(e){return e<0?0:e>1?1:e}function Ba(e){const t=new fn(e);return t.start(),t}const Na={x:"x",y:"y","x,y":"both"},dn=e=>typeof e=="object"&&e!==null&&e.nodeType===1;function bs(e,t){const n=ye(e),i=t.getBoundingClientRect();return{minX:i.left-n.left,maxX:i.right-n.right,minY:i.top-n.top,maxY:i.bottom-n.bottom}}function ws(e){return Array.isArray(e)?[...e]:e}function Ya(e,t,n,i={}){const[s]=t.resolveTargets(n),r=s?t.elementFor(s):void 0;if(!s||!r)throw new Error(`gsap-compat: live.draggable could not find ${String(n)}`);if(i.type==="rotation")return Wa(e,t,s,r,i);const o=Na[i.type??"x,y"],a=()=>{const p=t.appliedValue(s,"x"),g=t.appliedValue(s,"y");return{x:typeof p=="number"?p:0,y:typeof g=="number"?g:0}},l=typeof i.bounds=="string"?t.query(i.bounds):dn(i.bounds)?i.bounds:null,h={bounds:(!l&&i.bounds&&!dn(i.bounds)?i.bounds:void 0)??(l?bs(r,l):void 0)};let d=null;const u=()=>{d?.kill(),d=null},f=p=>{const g=i.inertia===!0?{}:i.inertia,y=g.friction??(g.resistance!==void 0?cn(g.resistance):4),v=a(),w=h.bounds??{};let k,T;const M=g.end;if(Array.isArray(M)){const C=Dt({from:v.x,velocity:o==="y"?0:p.x,friction:y}),L=Dt({from:v.y,velocity:o==="x"?0:p.y,friction:y});let I=M[0];for(const A of M)Math.hypot(A.x-C,A.y-L)<Math.hypot(I.x-C,I.y-L)&&(I=A);I&&(k=[I.x],T=[I.y])}else typeof M=="number"?(k=M,T=M):M&&(k=ws(M.x),T=ws(M.y));const x={};o!=="y"&&(x.x={velocity:p.x,friction:y,min:w.minX,max:w.maxX,end:k}),o!=="x"&&(x.y={velocity:p.y,friction:y,min:w.minY,max:w.maxY,end:T}),d=e.to(r,{inertia:x,onComplete:()=>i.onThrowComplete?.()})},m=new fn({target:r,axis:o,snap:i.snap,get bounds(){return h.bounds},getPosition:a,onPress:()=>{u(),l&&(h.bounds=bs(r,l)),i.onPress?.()},onDrag:p=>{t.apply(s,o==="x"?{x:p.x}:o==="y"?{y:p.y}:{x:p.x,y:p.y}),i.onDrag?.(p)},onRelease:()=>{const p=m.velocity;i.onRelease?.(p),i.inertia&&f(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 Wa(e,t,n,i,s){const r=typeof s.bounds=="object"&&s.bounds!==null&&!dn(s.bounds)?s.bounds:{},o=()=>{const w=t.appliedValue(n,"rotate");return typeof w=="number"?w:0},a=w=>Math.min(r.maxRotation??1/0,Math.max(r.minRotation??-1/0,w));let l=null,c=!1,h,d={x:0,y:0},u=0,f=0,m=[];const p=w=>Math.atan2(w.clientY-d.y,w.clientX-d.x)*180/Math.PI,g=w=>{if(c)return;l?.kill(),l=null,c=!0,h=w.pointerId,i.setPointerCapture?.(w.pointerId);const k=i.getBoundingClientRect();d={x:k.left+k.width/2,y:k.top+k.height/2},u=p(w),f=o(),m=[{time:performance.now(),rotation:f}],s.onPress?.()},y=w=>{if(!c||w.pointerId!==h)return;const k=p(w);let T=k-u;T>180&&(T-=360),T<-180&&(T+=360),u=k,f+=T;let M=a(f);s.snap&&(M=a(Math.round(M/s.snap)*s.snap)),t.apply(n,{rotate:M});const x=performance.now();for(m.push({time:x,rotation:M});m.length>2&&x-m[0].time>100;)m.shift();const C={x:0,y:0};s.onDrag?.(C)},v=w=>{if(!c||w.pointerId!==h)return;c=!1;const k=m[0],T=m[m.length-1],M=k&&T?(T.time-k.time)/1e3:0,x=M>0?(T.rotation-k.rotation)/M:0;if(s.onRelease?.({x,y:0}),!s.inertia)return;const C=s.inertia===!0?{}:s.inertia,L=C.friction??(C.resistance!==void 0?cn(C.resistance):4),I=typeof C.end=="number"||Array.isArray(C.end)?C.end:void 0;l=e.to(i,{inertia:{rotate:{velocity:x,friction:L,min:r.minRotation,max:r.maxRotation,end:Array.isArray(I)?I.filter(A=>typeof A=="number"):I}},onComplete:()=>s.onThrowComplete?.()})};return i.addEventListener("pointerdown",g),i.addEventListener("pointermove",y),i.addEventListener("pointerup",v),i.addEventListener("pointercancel",v),i.style.touchAction="none",{draggable:void 0,position:{x:0,y:0},get rotation(){return o()},destroy(){l?.kill(),i.removeEventListener("pointerdown",g),i.removeEventListener("pointermove",y),i.removeEventListener("pointerup",v),i.removeEventListener("pointercancel",v)}}}const qa={opacity:0,scale:.6};function Xa(e){const t=e.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 vs(e){const t=ye(e);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 mn(e,t){const i=e.resolveTargets(t).map(o=>e.elementFor(o)).filter(o=>!!o),s=new Map,r=new Map;for(const o of i){const a=Xa(o);s.set(o,a);const l=Ts(o);a&&l!==void 0&&!r.has(l)&&r.set(l,{element:o,box:a})}return{elements:i,boxes:s,ids:r}}const pn=new WeakMap;function gn(e,t,n,i={}){const s=i.duration??.6,r=i.ease??"power2.inOut",o=i.stagger??0,a=i.scale!==!1,l=i.enter===void 0?qa:i.enter,c=new Set(n.elements);if(i.targets!==void 0)for(const f of e.resolveTargets(i.targets)){const m=e.elementFor(f);m&&c.add(m)}const h=[...c].sort((f,m)=>f===m?0:f.compareDocumentPosition(m)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),d=t({onComplete:i.onComplete});let u=0;for(const f of h){const m=vs(f);if(!m)continue;let p=n.boxes.get(f)??null,g;const y=Ts(f),v=!p&&y!==void 0?n.ids.get(y):void 0;v&&v.element!==f&&(p=v.box,g=v.element);const[w]=e.resolveTargets(f);pn.get(f)?.timeline.removeTracks({target:w});const k=u*o;if(!p){if(l===!1)continue;d.fromTo(f,{x:0,y:0,scaleX:1,scaleY:1,...l},{...ks(l),x:0,y:0,scaleX:1,scaleY:1,duration:s,ease:r,delay:k},0),pn.set(f,d),u++;continue}const T=p.cx-m.cx,M=p.cy-m.cy,x=a?p.width/m.width:1,C=a?p.height/m.height:1;if(!(Math.abs(T)>.5||Math.abs(M)>.5||Math.abs(x-1)>.001||Math.abs(C-1)>.001)){const A=(E,S)=>{const _=e.appliedValue(w,E);return typeof _=="number"&&Math.abs(_-S)>1e-6};(A("x",0)||A("y",0)||A("scaleX",1)||A("scaleY",1))&&d.set(f,{x:0,y:0,scaleX:1,scaleY:1},0);continue}const I=i.fade===!0&&g!==void 0;d.fromTo(f,{x:T,y:M,scaleX:x,scaleY:C,...I&&{opacity:0}},{x:0,y:0,scaleX:1,scaleY:1,...I&&{opacity:1},duration:s,ease:r,delay:k},0),I&&g&&vs(g)&&d.fromTo(g,{opacity:1},{opacity:0,duration:s,ease:r,delay:k},0),pn.set(f,d),u++}return d}function Ts(e){return e.dataset?.flipId}function ks(e){const t={};for(const n of Object.keys(e))t[n]=n==="opacity"||n.startsWith("scale")?1:0;return t}function Ha(e,t={}){const n=new Set((t.type??"chars,words,lines").split(",").map(p=>p.trim())),i={chars:t.charsClass??"char",words:t.wordsClass??"word",lines:t.linesClass??"line"},s=t.aria!==!1,r=e.map(p=>({element:p,html:p.innerHTML,ariaLabel:p.getAttribute("aria-label")}));let o={chars:[],words:[],lines:[],masks:[]},a,l,c=!1;const h=()=>{for(const{element:p,html:g,ariaLabel:y}of r)p.innerHTML=g,y===null?p.removeAttribute("aria-label"):p.setAttribute("aria-label",y)},d=()=>{a&&(a.revert?a.revert():a.kill?.(),a=void 0)},u=()=>{const p={chars:[],words:[],lines:[],masks:[]};for(const{element:g}of r){const y=(g.textContent??"").replace(/\s+/g," ").trim(),v=Va(g,i.words),w=n.has("chars")?v.flatMap(M=>Ua(M,i.chars)):[],k=n.has("lines")?za(g,v,i.lines):[];if(s){!g.hasAttribute("aria-label")&&y&&g.setAttribute("aria-label",y);for(const M of v)M.setAttribute("aria-hidden","true")}if(n.has("words"))p.words.push(...v);else for(const M of v)M.removeAttribute("class");p.chars.push(...w),p.lines.push(...k);const T=t.mask==="lines"?k:t.mask==="words"?v:t.mask==="chars"?w:[];for(const M of T)p.masks.push(Ga(M,`${i[t.mask]}-mask`))}o=p},f={elements:e,get chars(){return o.chars},get words(){return o.words},get lines(){return o.lines},get masks(){return o.masks},split(){c||(d(),h(),u(),a=t.onSplit?.(f))},revert(){c=!0,l?.disconnect(),d(),h()}};u(),a=t.onSplit?.(f),t.autoSplit&&m();function m(){const p=new Map;let g=!1;const y=()=>{if(g)return;g=!0;const w=()=>{g=!1,f.split()};typeof requestAnimationFrame=="function"?requestAnimationFrame(w):setTimeout(w,0)};if(typeof ResizeObserver=="function"){l=new ResizeObserver(w=>{let k=!1;for(const T of w){const M=Math.round(T.contentRect.width),x=p.get(T.target);p.set(T.target,M),x!==void 0&&x!==M&&(k=!0)}k&&y()});for(const w of e)l.observe(w)}const v=e[0]?.ownerDocument?.fonts;v&&v.status!=="loaded"&&v.ready.then(()=>y())}return f}function Va(e,t){const n=e.ownerDocument,i=[],s=n.createTreeWalker(e,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 l=n.createDocumentFragment();for(const c of a){if(/^\s/.test(c)){l.appendChild(n.createTextNode(c));continue}const h=n.createElement("span");h.className=t,h.style.display="inline-block",h.textContent=c,l.appendChild(h),i.push(h)}o.replaceWith(l)}return i}function Ua(e,t){const n=e.ownerDocument,i=ja(e.textContent??"").map(s=>{const r=n.createElement("span");return r.className=t,r.style.display="inline-block",r.textContent=s,r});return e.replaceChildren(...i),i}function ja(e){const t=Intl.Segmenter;return t?Array.from(new t(void 0,{granularity:"grapheme"}).segment(e),n=>n.segment):Array.from(e)}function za(e,t,n){const i=e.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(e);const a=[];let l=null,c=0,h=0,d=!1,u=[];const f=()=>{l=i.createElement("span"),l.className=n,l.style.display="block",a.push(l),u=[]};for(const m of r){if(m.tagName==="BR"){d=!0;continue}const p=s.get(m);if(p&&(!l||d||p.top>c+h)&&(f(),c=p.top,h=p.height/2,d=!1),!l)continue;const g=[];for(let w=m.parentNode;w&&w!==e;w=w.parentNode)g.unshift(w);let y=0;for(;y<u.length&&y<g.length&&u[y].original===g[y];)y++;u.length=y;let v=y===0?l:u[y-1].clone;for(const w of g.slice(y)){const k=w.cloneNode(!1);v.appendChild(k),u.push({original:w,clone:k}),v=k}v.appendChild(m)}return e.replaceChildren(...a),a}function Ga(e,t){const n=e.ownerDocument.createElement("span");return n.className=t,n.style.display=e.style.display==="block"?"block":"inline-block",n.style.overflow="clip",n.style.paddingBottom="0.12em",n.style.marginBottom="-0.12em",e.replaceWith(n),n.appendChild(e),n}const Ms={top:0,left:0,start:0,center:.5,centre:.5,middle:.5,bottom:1,right:1,end:1};function yn(e){const t=e.trim().toLowerCase();if(t in Ms)return Ms[t];if(t.endsWith("%")){const n=Number.parseFloat(t.slice(0,-1));return Number.isNaN(n)?void 0:n/100}}function bn(e){if(typeof e=="number")return{elementFraction:0,viewportFraction:0,offsetPx:0,absolutePx:e};let t=0;const i=e.replace(/([+-])=\s*(-?[\d.]+)/g,(o,a,l)=>(t+=(a==="-"?-1:1)*Number.parseFloat(l),"")).trim().split(/\s+/).filter(Boolean);if(i.length===1&&/^-?[\d.]+$/.test(i[0]))return{elementFraction:0,viewportFraction:0,offsetPx:0,absolutePx:Number.parseFloat(i[0])+t};const s=i[0]!==void 0?yn(i[0]):void 0,r=i[1]!==void 0?yn(i[1]):void 0;return{elementFraction:s??0,viewportFraction:r??0,offsetPx:t}}function At(e,t,n){const i=bn(n),s=i.absolutePx!==void 0?e.top+i.absolutePx:e.top+e.height*i.elementFraction,r=t*i.viewportFraction;return s-r+i.offsetPx}function Ka(e,t,n,i){const s=At(e,t,n),o=At(e,t,i)-s;return o<=0?s<=0?1:0:wn(-s/o)}function wn(e){return e<0?0:e>1?1:e===0?0:e}function Ss(e,t,n,i){if(n<=0)return t;const s=1-Math.exp(-(i/1e3)/n);return e+(t-e)*s}function vn(e,t,n,i,s){const r=h=>At({top:e+s(h),bottom:e+s(h)+t,height:t},n,i),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 l=0,c=1;for(let h=0;h<40;h++){const d=(l+c)/2;Math.sign(r(d))===Math.sign(o)?l=d:c=d}return(l+c)/2}class xs{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 n of t)n.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 Ja(e){const t=new xs(e);return t.start(),t}class As{element;spacer;saved;axis;spacing;constructor(t,n={}){this.element=t,this.axis=n.axis??"y",this.spacing=n.spacing??!0;const i=t.ownerDocument;this.spacer=i.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,n){const i=Math.max(0,n);this.element.style.position="sticky",this.axis==="x"?(this.spacer.style.width=`${this.element.offsetWidth+i}px`,this.spacer.style.marginRight=this.spacing?"":`-${i}px`,this.element.style.left=`${t}px`):(this.spacer.style.height=`${this.element.offsetHeight+i}px`,this.spacer.style.marginBottom=this.spacing?"":`-${i}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 Qa=.15;function Es(e){return typeof e=="object"&&!Array.isArray(e)?e:{snapTo:e}}function Ps(e,t,n){const i=be(e+t*Qa);if(typeof n=="function")return be(n(i));if(typeof n=="number")return n<=0?e:be(Math.round(i/n)*n);if(n.length===0)return e;let s=n[0];for(const r of n)Math.abs(r-i)<Math.abs(s-i)&&(s=r);return be(s)}function _s(e,t,n){const i=e.duration??{min:.2,max:.8};if(typeof i=="number")return i;const s=Math.min(1,Math.abs(t)/Math.max(1,n));return i.min+(i.max-i.min)*s}class Cs{rafId=null;cancelEvents=["wheel","touchstart","pointerdown","keydown"];onInterrupt=()=>this.cancel();write;eventTarget;constructor(t,n){this.write=t,this.eventTarget=n}get active(){return this.rafId!==null}animate(t,n,i,s=Bt,r){if(this.cancel(),typeof requestAnimationFrame>"u"||i<=0){this.write(n),r?.();return}for(const l of this.cancelEvents)this.eventTarget?.addEventListener(l,this.onInterrupt,{passive:!0});let o=null;const a=l=>{o??=l;const c=Math.min(1,(l-o)/(i*1e3));this.write(t+(n-t)*s(c)),c<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 be(e){return Math.max(0,Math.min(1,e))}class Is{options;scroller;nodes=[];scrollerStart;scrollerEnd;start;end;constructor(t,n,i){this.options=i===!0?{}:i,this.scroller=n;const{startColor:s="#3ecf7a",endColor:r="#ff5a5a",id:o}=this.options,a=o?`${o} `:"",l=(c,h,d)=>{const u=t.createElement("div");return u.textContent=`${a}${c}`,u.setAttribute("aria-hidden","true"),u.className="scroll-marker",Object.assign(u.style,{position:d?"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)"}),(n??t.body).appendChild(u),this.nodes.push(u),u};this.scrollerStart=l("scroller-start",s,!n),this.scrollerEnd=l("scroller-end",r,!n),this.start=l("start",s,!1),this.end=l("end",r,!1),n&&getComputedStyle(n).position==="static"&&(n.style.position="relative")}place(t,n){this.start.style.top=`${t.startPage}px`,this.end.style.top=`${t.endPage}px`;const i=this.scroller?n:0;this.scrollerStart.style.top=`${i+t.startViewport}px`,this.scrollerEnd.style.top=`${i+t.endViewport}px`}follow(t,n){this.scroller&&this.place(t,n)}destroy(){for(const t of this.nodes.splice(0))t.remove()}}const Za=120,Et=[],Pt=new Set;let Tn=!1;const tl=()=>{Tn||Pt.size===0||(Tn=!0,queueMicrotask(()=>{Tn=!1;for(const e of Pt)e.afterRefresh()}))},Rs=()=>{for(const e of Pt)e.beforeRefresh();for(const e of Et)e.refresh();for(const e of Pt)e.afterRefresh()};let _t={width:0,height:0};const Ls=()=>{const e=window.innerWidth,t=window.innerHeight,n=e===_t.width&&t!==_t.height,i=Math.abs(t-_t.height)<_t.height*.25,s=typeof navigator<"u"&&(navigator.maxTouchPoints??0)>0;n&&i&&s||(_t={width:e,height:t},Rs())};class Ut{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 Cs(n=>this.scrollTo(n),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 As(t,{axis:this.options.horizontal?"x":"y",spacing:this.options.pinSpacing!==!1})),this.options.markers&&!this.options.horizontal&&typeof document<"u"&&(this.markers=new Is(document,this.options.scroller??null,this.options.markers)),this.scrollTarget()?.addEventListener("scroll",this.onScroll,{passive:!0}),Et.length===0&&typeof window<"u"&&(_t={width:window.innerWidth,height:window.innerHeight},window.addEventListener("resize",Ls,{passive:!0})),Et.push(this),this.refresh()}stop(){this.running&&(this.running=!1,this.scrollTarget()?.removeEventListener("scroll",this.onScroll),Et.splice(Et.indexOf(this),1),Et.length===0&&typeof window<"u"&&window.removeEventListener("resize",Ls),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(){Rs()}static onRefresh(t){return Pt.add(t),()=>Pt.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 n=this.triggerRect();if(n&&this.options.container)this.measureInContainer(this.options.container);else if(n){const i=this.viewportHeight();if(this.startPx=t+At(n,i,jt(this.options.start)??"top bottom"),this.endPx=this.resolveEnd(n,i,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(i):null}this.markers&&this.markerGeometry&&this.markers.place(this.markerGeometry,t),this.lastScroll=null,this.updateFrom(t,!this.measured),this.measured=!0,tl()}sample(){this.refresh()}update(t){this.running&&this.updateFrom(t??this.scrollPosition(),!1)}updateFrom(t,n){this.trackVelocity(t),this.markers&&this.markerGeometry&&this.markers.follow(this.markerGeometry,t);const i=this.endPx-this.startPx,s=this.zone;this.targetProgress=i>0?wn((t-this.startPx)/i):t>=this.startPx?1:0,this.zone=i>0?t<=this.startPx?"before":t>=this.endPx?"after":"active":t>=this.startPx?"after":"before",this.fireBoundaryCallbacks(s,this.zone),n||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,n,i){const s=jt(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]==="%"?n*o/100:o)}return i+At(t,n,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 n=typeof performance<"u"?performance.now():Date.now();this.lastScroll!==null&&n>this.lastScrollTime&&t!==this.lastScroll&&(this.velocityPxPerSecond=(t-this.lastScroll)/(n-this.lastScrollTime)*1e3),(this.lastScroll===null||t!==this.lastScroll)&&(this.lastScroll=t,this.lastScrollTime=n),!(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()},Za))}fireBoundaryCallbacks(t,n){if(t===n)return;const{onEnter:i,onLeave:s,onEnterBack:r,onLeaveBack:o}=this.options;t==="before"?(i?.(),n==="after"&&s?.()):t==="after"?(r?.(),n==="before"&&o?.()):n==="after"?s?.():o?.()}scheduleSnap(){const t=this.options.snap;if(t===void 0||this.snapper.active)return;const n=Es(t),i=()=>{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+Ps(o,this.releaseVelocity/s,n.snapTo)*s;Math.abs(a-r)<1||this.snapper.animate(r,a,_s(n,a-r,this.viewportHeight()),n.ease)};n.delay?this.snapTimer=setTimeout(i,n.delay*1e3):i()}scrollTo(t){const n=this.options.scroller,i=this.options.horizontal?{left:t}:{top:t};n?typeof n.scrollTo=="function"?n.scrollTo({...i,behavior:"instant"}):this.options.horizontal?n.scrollLeft=t:n.scrollTop=t:typeof window<"u"&&window.scrollTo({...i,behavior:"instant"})}measureInContainer(t){const n=this.options.trigger;if(typeof n?.getBoundingClientRect!="function")return;const i=n.getBoundingClientRect(),s=this.options.scroller?.getBoundingClientRect?.().left??0,r=this.options.scroller?this.options.scroller.clientWidth:typeof window<"u"?window.innerWidth:0,o=i.left-s-t.shiftAt(t.progress()),{start:a,end:l}=t.range(),c=f=>a+f*(l-a),h=vn(o,i.width,r,jt(this.options.start)??"left right",t.shiftAt);this.startPx=c(h);const d=jt(this.options.end)??"right left",u=typeof d=="string"?d.trim().match(/^\+=\s*(-?[\d.]+)\s*(px)?$/):null;this.endPx=u?this.startPx+Number.parseFloat(u[1]):c(vn(o,i.width,r,d,t.shiftAt)),this.markerGeometry=null}markersFor(t){const n=(r,o)=>{const a=jt(r)??o;if(typeof a=="number")return 0;if(/^\s*\+=/.test(a))return;const l=bn(a);return t*l.viewportFraction-l.offsetPx},i=n(this.options.start,"top bottom")??0,s=n(this.options.end,"bottom top")??i;return{startViewport:i,endViewport:s,startPage:this.startPx+i,endPage:this.endPx+s}}startSmoothing(){if(this.rafId!==null||typeof requestAnimationFrame>"u")return;const t=n=>{if(this.rafId=null,!this.running)return;const i=this.lastFrameTime===null?16.67:n-this.lastFrameTime;this.lastFrameTime=n,this.displayProgress=Ss(this.displayProgress,this.targetProgress,this.smoothing(),i);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,n=this.options.horizontal;return t?(n?t.scrollLeft:t.scrollTop)??0:typeof window<"u"?(n?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 n=this.options.horizontal,i=n?t.left??0:t.top,s=n?t.right??0:t.bottom,r=n?t.width??0:t.height,o=this.options.scroller;if(o&&typeof o.getBoundingClientRect=="function"){const a=o.getBoundingClientRect(),l=n?a.left:a.top;return{top:i-l,bottom:s-l,height:r}}return{top:i,bottom:s,height:r}}viewportHeight(){const t=this.options.scroller,n=this.options.horizontal;return t?n?t.clientWidth:t.clientHeight:typeof window<"u"?n?window.innerWidth:window.innerHeight:0}}function jt(e){return typeof e=="function"?e():e}function el(e){const t=new Ut(e);return t.start(),t}const kn=new Set,nl=16,$s=.5,il=2;class Mn{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:n=>requestAnimationFrame(n),cancel:n=>cancelAnimationFrame(n)}}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),kn.add(this),this.stopListening=Ut.onRefresh({beforeRefresh:()=>this.rest(),afterRefresh:()=>this.refresh()}),this.refresh(),this}static refreshAll(){for(const t of kn)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),kn.delete(this),this.stopListening?.(),this.stopListening=null,this.cancelFrame(),this.journey=null,this}destroy(){this.stop();for(const t of this.effects)Sn(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,n={}){if(!this.running)return;const i=this.clamp(this.resolve(t)+(n.offset??0)),s=Math.abs(i-this.current),r=this.reduced?0:n.duration??Math.min(1.2,Math.max(.4,s/2500));if(r<=0){this.journey=null,this.current=this.target=i,this.write(i),this.applyEffects(0);return}this.target=i,this.journey={from:this.current,to:i,ms:r*1e3,ease:n.ease??Bt,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 n=this.options.scroller??document,i=this.position(),s=this.viewportHeight(),r=this.options.scroller?.getBoundingClientRect().top??0;for(const o of n.querySelectorAll(t)){const a=Number.parseFloat(o.dataset.speed??""),l=Number.parseFloat(o.dataset.lag??""),c=o.getBoundingClientRect(),h=c.top-r+i;this.effects.push({element:o,speed:Number.isFinite(a)?a:void 0,lag:Number.isFinite(l)&&l>0?l:void 0,centre:h+c.height/2-s/2,lagged:i,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)Sn(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 n=t.deltaMode===1?nl:t.deltaMode===2?this.viewportHeight():1,i=t.deltaY*n*(this.options.wheelMultiplier??1),s=this.clamp(this.target+i);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)<=il||(this.written=null,this.journey=null,this.cancelFrame(),this.current=this.target=t,this.requestFrame())}nestedScrollerTakes(t){const n=this.options.scroller??document.documentElement;for(let i=t.target;i&&i!==n&&i!==document.body;i=i.parentElement){if(i.hasAttribute?.("data-smooth-ignore"))return!0;const s=getComputedStyle(i);if(!/(auto|scroll)/.test(s.overflowY)||i.scrollHeight<=i.clientHeight)continue;if(t.deltaY<0?i.scrollTop>0:i.scrollTop+i.clientHeight<i.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 n=this.lastTime===null?1e3/60:Math.min(100,t-this.lastTime);this.lastTime=t;const i=this.current;if(this.journey){const r=this.journey;r.elapsed+=n;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(-n/r)),Math.abs(this.target-this.current)<$s&&(this.current=this.target)}this.current!==i&&this.write(this.current),this.velocityPxPerSecond=n>0?(this.current-i)*1e3/n:0;const s=this.applyEffects(n);this.current!==i&&this.options.onUpdate?.(this.state),this.journey||this.current!==this.target||s?this.requestFrame():(this.lastTime=null,this.velocityPxPerSecond=0)}applyEffects(t){let n=!1;const i=this.current;for(const s of this.effects){let r=0;if(s.speed!==void 0&&(r+=(i-s.centre)*(1-s.speed)),s.lag!==void 0){const o=s.lag*1e3/3;s.lagged=t===0?i:s.lagged+(i-s.lagged)*(1-Math.exp(-t/o)),Math.abs(i-s.lagged)<$s?s.lagged=i:n=!0,r+=i-s.lagged}Sn(s.element,r===0?s.saved:`0 ${sl(r)}px`),s.shift=r}return n}write(t){const n=Math.round(t);this.written=n;const i=this.options.scroller;i?i.scrollTop=n:window.scrollTo({top:n,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 n=this.options.scroller??document,i=typeof t=="string"?n.querySelector(t):t;if(!i)return this.current;const s=this.options.scroller?.getBoundingClientRect().top??0,r=this.effects.find(o=>o.element===i)?.shift??0;return i.getBoundingClientRect().top-s+this.position()-r}}function Sn(e,t){t?e.style.setProperty("translate",t):e.style.removeProperty("translate")}function sl(e){return Math.round(e*100)/100}function rl(e,t){switch(t){case"play":if(e.progress()>=1)break;e.reversed()?e.reverse():e.play();break;case"reverse":if(e.progress()<=0)break;e.reversed()?e.play():e.reverse();break;case"pause":e.pause();break;case"resume":e.resume();break;case"restart":e.restart();break;case"reset":e.pause(),e.progress(0);break;case"complete":e.pause(),e.progress(1);break}}function xn(e,t,n,i,s=()=>{}){const r=f=>typeof f=="string"?e.query(f)??void 0:f,o=r(t.trigger)??i;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,l=(t.toggleActions??"play none none none").trim().split(/\s+/);let c=0,h;const d=(f,m)=>()=>{m?.(),n&&!a&&rl(n,l[f]??"none"),t.once&&f===0&&queueMicrotask(()=>h.destroy())},u=t.containerAnimation?ll(e,t.containerAnimation,o,s):void 0;return h=new Ut({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&&n?.invalidate?()=>n.invalidate():void 0,snap:t.snap===void 0?void 0:ol(t.snap,n),markers:t.markers,container:u,onUpdate:(f,m)=>{if(n&&a!==!1&&n.progress(f),t.onUpdate){const p=f<c||m<0?-1:1;t.onUpdate({progress:f,velocity:m,direction:p})}c=f},onEnter:d(0,t.onEnter),onLeave:d(1,t.onLeave),onEnterBack:d(2,t.onEnterBack),onLeaveBack:d(3,t.onLeaveBack)}),n&&a===!1&&n.progress(0),h.start(),e.own(h)}function ol(e,t){const n=s=>s==="labels"?r=>al(r,t?.labelProgresses?.()??[]):s;if(typeof e!="object"||Array.isArray(e))return n(e);const i=e.ease?Xt(e.ease):void 0;return{snapTo:n(e.snapTo),duration:e.duration,delay:e.delay,ease:i?i.fn??z(i.easing):void 0}}function al(e,t){return t.reduce((n,i)=>Math.abs(i-e)<Math.abs(n-e)?i:n,t[0]??e)}function ll(e,t,n,i){const s=()=>t.timeline.getTracks({property:"x"}).map(r=>r.target).filter(r=>{const o=e.elementFor(r);return!!o&&o!==n&&o.contains(n)});return s().length===0&&i("gsap-compat: containerAnimation does not move an ancestor of the trigger along x"),{range:()=>{const r=t.scrollTrigger;return r||i("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 l of s()){const c=o.values.get(l)?.get("x");typeof c=="number"&&(a+=c)}return a}}}class Fs{conditions={};scope;host;items=[];snapshots=new Map;constructor(t,n){this.host=t,this.scope=n}add(t){const n=this.host.collector;this.host.setCollector(this);try{const i=t();return typeof i=="function"&&this.items.push({revert:i}),i}finally{this.host.setCollector(n)}}track(t){this.items.push(t)}touch(t,n){this.snapshots.has(t)||this.snapshots.set(t,{name:n,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:n,style:i,d:s}]of this.snapshots)i===null?t.removeAttribute("style"):t.setAttribute("style",i),s!==null&&t.setAttribute("d",s),this.host.forget(n);this.snapshots.clear()}kill(){this.revert()}}class cl{host;scope;entries=[];listeners=[];scheduled=!1;constructor(t,n){this.host=t,this.scope=n}add(t,n){const i={conditions:t,setup:n,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);i.queries.set(r,a);const l=()=>this.scheduleUpdate();a.addEventListener("change",l),this.listeners.push(()=>a.removeEventListener("change",l))}return this.entries.push(i),this.update(i),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 n={};for(const[o,a]of t.queries)n[o]=a.matches;const i=Object.values(n).some(Boolean),s=i?JSON.stringify(n):void 0;if(s===t.key||(t.context?.revert(),t.context=void 0,t.key=s,!i))return;const r=new Fs(this.host,this.scope);r.conditions=n,r.add(()=>t.setup(r)),t.context=r}}class hl{frames;canvas;context;options;images;ready;current=0;drawn=-1;loadedCount=0;inFlight=0;destroyed=!1;onResize=()=>this.resize();constructor(t,n){this.canvas=t,this.context=t.getContext("2d"),this.options=n,this.frames=Math.max(1,Math.floor(n.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,n=Math.round(this.canvas.clientWidth*t),i=Math.round(this.canvas.clientHeight*t);n>0&&i>0&&(this.canvas.width!==n||this.canvas.height!==i)&&(this.canvas.width=n,this.canvas.height=i),this.drawn=-1,this.draw()}draw(){const t=Math.round(this.current),n=this.nearestReady(t);if(n===-1||n===this.drawn||!this.context)return;const i=this.images[n],{width:s,height:r}=this.canvas,o=(this.options.fit??"cover")==="cover"?Math.max(s/i.naturalWidth,r/i.naturalHeight):Math.min(s/i.naturalWidth,r/i.naturalHeight),a=i.naturalWidth*o,l=i.naturalHeight*o;this.context.clearRect(0,0,s,r),this.context.drawImage(i,(s-a)/2,(r-l)/2,a,l),this.drawn=n,this.pump()}nearestReady(t){for(let n=0;n<this.frames;n++){if(t-n>=0&&this.ready[t-n])return t-n;if(t+n<this.frames&&this.ready[t+n])return t+n}return-1}pump(){const t=this.options.concurrency??6,n=Math.round(this.current);for(let i=0;i<this.frames&&this.inFlight<t;i++)for(const s of i===0?[n]:[n+i,n-i])s<0||s>=this.frames||this.images[s]||this.inFlight>=t||this.load(s)}load(t){const n=new Image;n.decoding="async",this.images[t]=n,this.inFlight++;const i=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()}};n.onload=()=>i(!0),n.onerror=()=>i(!1),n.src=this.options.url(t)}}const ul={opacity:0,y:-16},fl={opacity:0,y:16};async function dl(e,t,n,i){const s=t.collector?.scope??t.root,r=s.ownerDocument??s,o=()=>i.shared?[...s.querySelectorAll(i.shared)]:[];if(i.native&&typeof r.startViewTransition=="function")return ml(r,i,o);const a=i.duration??.35,l=i.ease??"power2.inOut",c=g=>new Promise(y=>{g(y)||y()}),h=o(),d=h.length?mn(t,h):void 0,u=i.from!==void 0?Os(t,i.from,i.shared):[];if(u.length&&i.leave!==!1){const g=i.leave??ul;await c(y=>e.to(u,{...g,duration:a,ease:l,onComplete:y}))}await i.update();const f=[],m=typeof i.to=="function"?i.to():i.to,p=m!==void 0?Os(t,m,i.shared):[];if(p.length&&i.enter!==!1){const g=i.enter??fl;f.push(c(y=>e.fromTo(p,g,{...ks(g),duration:a,ease:l,onComplete:y})))}if(d){const g=o().filter(y=>!h.includes(y));g.length&&f.push(c(y=>gn(t,n,d,{targets:g,duration:a*1.4,ease:l,enter:!1,onComplete:y})))}await Promise.all(f)}function Os(e,t,n){const i=e.resolveTargets(t).map(s=>e.elementFor(s)).filter(s=>!!s);return n?i.flatMap(s=>!s.querySelector(n)&&!s.matches(n)?[s]:[...s.children].filter(r=>!r.matches(n)&&!r.querySelector(n))):i}async function ml(e,t,n){const i=(a,l)=>{const c=a.dataset?.flipId;c&&a.style.setProperty("view-transition-name",l?`tf-${c.replace(/[^\w-]/g,"-")}`:"")},s=n();s.forEach(a=>i(a,!0));let r=[];await e.startViewTransition(async()=>{s.forEach(a=>i(a,!1)),await t.update(),r=n(),r.forEach(a=>i(a,!0))}).finished,r.forEach(a=>i(a,!1))}const Ds={create:(e,t)=>rn(e,ji(t))},Bs={create:(e,t)=>rn(e,{fn:zi(t)})},Ns={create:(e,t)=>rn(e,{fn:Gi(t)})},pl=new Set(["keyframes","duration","delay","ease","easeEach","stagger","repeat","repeatDelay","yoyo","repeatRefresh","paused","id","onStart","onUpdate","onComplete","onRepeat","onReverseComplete","scrollTrigger"]),Ys=.5,gl="power1.inOut";function yl(e){return e.keyframes!==void 0&&e.keyframes!==null}function bl(e){const t=e.keyframes,n={};for(const[c,h]of Object.entries(e))pl.has(c)||(n[c]=h);if(Array.isArray(t))return t.map(c=>({...n,...c,duration:c.duration??e.duration??Ys}));const i=Object.entries(t),s=e.duration??Ys,r=t.easeEach??e.easeEach??gl;if(i.length>0&&i.every(([c])=>/^\s*-?\d+(\.\d+)?\s*%\s*$/.test(c)||c==="easeEach")){const c=i.filter(([u])=>u!=="easeEach").map(([u,f])=>({at:Number.parseFloat(u)/100,step:f})).sort((u,f)=>u.at-f.at),h=[];let d=0;for(const{at:u,step:f}of c){const m=Math.max(0,u-d);h.push({...n,ease:r,...f,duration:m*s}),d=u}return h}const o=i.filter(([c,h])=>c!=="easeEach"&&Array.isArray(h)),a=Math.max(0,...o.map(([,c])=>c.length)),l=[];for(let c=0;c<a;c++){const h={...n,ease:r,duration:s/a};for(const[d,u]of o)c<u.length&&(h[d]=u[c]);l.push(h)}return l}function Ws(e,t,n,i={}){const s=t.collector?.scope??t.root,r=typeof i.scroller=="string"?s.querySelector(i.scroller):i.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},l=(v,w)=>{if(w===void 0)return o[v];if(typeof w=="number")return w;if(w==="max")return a[v];const k=typeof w=="string"?s.querySelector(w):w;if(!k)return o[v];const T=k.getBoundingClientRect(),M=r?.getBoundingClientRect(),x=(v==="x"?i.offsetX:i.offsetY)??i.offset??0;return v==="x"?T.left-(M?.left??0)+o.x-x:T.top-(M?.top??0)+o.y-x},c=typeof n=="object"&&n!==null&&!("nodeType"in n)?{x:l("x",n.x),y:l("y",n.y)}:{x:o.x,y:l("y",n)},h={x:Math.max(0,Math.min(a.x,c.x)),y:Math.max(0,Math.min(a.y,c.y))},d={...o},u=()=>{r?(r.scrollLeft=d.x,r.scrollTop=d.y):window.scrollTo({left:d.x,top:d.y,behavior:"instant"})},f=["wheel","touchstart","keydown"],m=r??window,p=()=>{y.kill(),g()},g=()=>{for(const v of f)m.removeEventListener(v,p)},y=e.to(d,{x:h.x,y:h.y,duration:i.duration??1,ease:i.ease??"power2.inOut",onStart:i.onStart,onUpdate:()=>{u(),i.onUpdate?.()},onComplete:()=>{g(),i.onComplete?.()}});if(i.autoKill!==!1)for(const v of f)m.addEventListener(v,p,{passive:!0});return y}function wl(e,t,n){const i=e.collector?.scope??e.root,s=typeof t=="string"?[...i.querySelectorAll(t)]:"nodeType"in t?[t]:Array.from(t),{interval:r=.1,batchMax:o,onEnter:a,onLeave:l,onEnterBack:c,onLeaveBack:h,...d}=n,u={onEnter:a,onLeave:l,onEnterBack:c,onLeaveBack:h},f={onEnter:[],onLeave:[],onEnterBack:[],onLeaveBack:[]},m={},p=y=>{m[y]!==void 0&&clearTimeout(m[y]),m[y]=void 0;const v=f[y].splice(0);v.length>0&&u[y]?.(v)},g=(y,v)=>{if(u[y]){if(f[y].push(v),o!==void 0&&f[y].length>=o)return p(y);m[y]===void 0&&(m[y]=setTimeout(()=>p(y),r*1e3))}};return s.map(y=>xn(e,{...d,trigger:y,onEnter:()=>g("onEnter",y),onLeave:()=>g("onLeave",y),onEnterBack:()=>g("onEnterBack",y),onLeaveBack:()=>g("onLeaveBack",y)})).filter(y=>y!==void 0)}class Q{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,n={}){this.stage=t;const i={...n,onWarning:n.onWarning??t.onWarning};if(this.options=i,this.compat=new mt({...i,startValue:(s,r)=>{const o=t.objectFor(s);if(o)return kl(o[r]);const a=t.appliedValue(s,r);if(a!==void 0)return a;if(r==="d")return fs(t.elementFor(s))??void 0;if(r==="text")return t.elementFor(s)?.textContent??void 0;if(r==="strokeDasharray"||r==="strokeDashoffset"){const l=Us(t.elementFor(s));if(l!==void 0)return r==="strokeDasharray"?[l,l]:0}},startVelocity:(s,r)=>t.velocityOf(s,r),layoutColumns:s=>Vs(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=!i.paused&&!i.scrollTrigger,i.scrollTrigger){const s=i.scrollTrigger;queueMicrotask(()=>{this.killed||(this.scrollDriver=xn(t,s,this,this.firstElement,r=>i.onWarning?.(r)))})}this.autoplayPending&&queueMicrotask(()=>{this.autoplayPending&&this.play()})}get timeline(){return this.compat.timeline}get scrollTrigger(){return this.scrollDriver}to(t,n,i){return yl(n)?this.record(()=>this.keyframed(t,n,i)):this.record(()=>this.tween(t,[n],i,([s],r,o)=>this.compat.to(r,s,o)))}from(t,n,i){return this.record(()=>this.tween(t,[n],i,([s],r,o)=>this.compat.from(r,s,o)))}fromTo(t,n,i,s){return this.record(()=>this.tween(t,[n,i],s,([r,o],a,l)=>this.compat.fromTo(a,r,o,l)))}set(t,n,i){return this.record(()=>this.tween(t,[n],i,([s],r,o)=>this.compat.set(r,s,o)))}addLabel(t,n){return this.record(()=>this.compat.addLabel(t,n))}add(t,n){return this.record(()=>{t.autoplayPending=!1,t.timeline.stop(),t.stage.deactivate(t.timeline),this.compat.add(t.compat,n)})}invalidate(){const t=this.compat.progress();this.compat.progress(0),this.stage.render(this.timeline),this.compat.reset(),this.events=[],this.ranges=[];for(const n of this.recipe)n();return this.syncDuration(),this.compat.progress(t),this.stage.render(this.timeline),this}call(t,n=[],i){return this.record(()=>{const s=this.compat.addEvent(i);this.events.push({time:s,run:()=>t(...n)})})}addPause(t,n,i=[]){return this.record(()=>{const s=this.compat.addEvent(t);this.events.push({time:s,pause:!0,run:()=>n?.(...i)})})}tweenTo(t,n={}){return this.tweenFromTo(this.timeline.currentTime/1e3,t,n)}tweenFromTo(t,n,i={}){this.pause(),this.seek(t);const s=this.timeline.currentTime,r=Math.max(0,Math.min(this.timeline.duration,this.compat.timeOf(n))),o={time:s},a=i.duration??Math.abs(r-s)/1e3/(this.timeScale()||1),l=new Q(this.stage,{onStart:i.onStart,onComplete:i.onComplete});return l.to(o,{time:r,duration:a,ease:i.ease??"none",onUpdate:()=>{this.moveTo(o.time),i.onUpdate?.()}}),l}play(){this.autoplayPending=!1,this.started||(this.started=!0,this.options.onStart?.());const t=this.timeline.playbackState==="playing",n=this.timeline.playbackState==="paused";if(this.timeline.play(),!t){const i=this.timeline,s=i.direction==="forward"?i.currentTime===0:i.currentTime===i.duration;this.playhead={...this.readPlayhead(),fresh:s&&!n},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(n=>n/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,n){for(const i of t)for(const s of n??[void 0])this.timeline.removeTracks({target:i,...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(n=>n.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 n=this.playhead;this.timeline.seek(t),this.stage.render(this.timeline);const i={time:this.timeline.currentTime,iteration:this.timeline.loopIteration,direction:t>=n.time?"forward":"reverse"},s={...n,iteration:i.iteration,direction:i.direction};this.playhead={...this.readPlayhead()},this.waitingToWrap=!1,this.runCrossings(s,i,!1),this.options.onUpdate?.()}refreshForRepeat(){const t=this.timeline.currentTime;this.compat.reset(),this.events=[],this.ranges=[];for(const n of this.recipe)n();this.syncDuration(),this.timeline.seek(Math.min(t,this.timeline.duration))}afterFrame(){const t=this.timeline,n=t.repeatDelayRemaining>0;if(this.waitingToWrap&&n){this.options.onUpdate?.();return}this.waitingToWrap=!1;const i=this.playhead,s=this.readPlayhead();this.playhead=s;const r=this.options.yoyo===!0;n&&!r&&s.iteration>i.iteration&&(this.playhead={time:0,iteration:s.iteration,direction:"forward",fresh:!0},this.waitingToWrap=!0);const o=this.runCrossings(i,s,n);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,n,i){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}=Ze(s.map(a=>a.time),t,n,{duration:this.timeline.duration,alternate:this.options.yoyo===!0,holding:i});for(const a of r){if(this.killed)return!0;if(a.kind==="repeat"){this.options.repeatRefresh&&this.refreshForRepeat(),this.options.onRepeat?.();continue}const l=s[a.index];if(!(l.direction&&l.direction!==a.direction)){if(l.pause)return this.timeline.seek(l.time),this.stage.render(this.timeline),this.pause(),this.playhead=this.readPlayhead(),this.waitingToWrap=!1,l.run(),!0;l.run()}}for(const a of this.ranges)o.some(([c,h])=>c!==h&&Math.max(c,h)>=a.start&&Math.min(c,h)<=a.end)&&a.run();return!1}tween(t,n,i,s){const r=this.resolve(t);if(!r)return;const{onStart:o,onUpdate:a,onComplete:l}=n[n.length-1];if(o||a||l){let c=1/0,h=-1/0;const d=(u,f,m)=>{s(u,f,m),c=Math.min(c,this.compat.lastStart),h=Math.max(h,this.compat.lastEnd)};if(this.buildTween(r,n,i,d),c===1/0)return;o&&this.events.push({time:c,direction:"forward",run:o}),a&&this.ranges.push({start:c,end:h,run:a}),l&&this.events.push({time:h,direction:"forward",run:l});return}this.buildTween(r,n,i,s)}keyframed(t,n,i){const s=this.resolve(t);if(!s)return;const r=bl(n);if(r.length===0)return;const o=s.length>1?ln(n.stagger,this.staggerContext(s)):void 0,a=s.map(g=>this.targetFor(g)).filter(g=>g!==void 0),l=o?a.map(g=>[g]):[a],c=o?ne(s.length,o).map(g=>g/1e3):[0],h=this.compat.timeOf(i)/1e3+ge(n.delay,0)/1e3;let d=1/0,u=-1/0;if(l.forEach((g,y)=>{r.forEach((v,w)=>{const k=w===0?h+c[y]:">";this.tween(g,[v],k,([T],M,x)=>this.compat.to(M,T,x)),d=Math.min(d,this.compat.lastStart),u=Math.max(u,this.compat.lastEnd)})}),d===1/0)return;const{onStart:f,onUpdate:m,onComplete:p}=n;f&&this.events.push({time:d,direction:"forward",run:f}),m&&this.ranges.push({start:d,end:u,run:m}),p&&this.events.push({time:u,direction:"forward",run:p})}staggerContext(t){return{count:t.length,columnsFromLayout:()=>Vs(t.map(n=>this.stage.elementFor(n))),random:()=>this.stage.utils.random(0,1)}}buildTween(t,n,i,s){const r=t.map(u=>this.targetFor(u));if(!(t.length>1&&(n.some(Tl)||t.some(u=>this.stage.objectFor(u)!==void 0)))){const u=this.targetFor(t[0]);s(n.map(f=>this.prepare(Hs(f,0,u,this.stage.utils,r),t)),t,i);return}const a=n.length-1,{stagger:l,...c}=n[a],h=ln(l,this.staggerContext(t)),d=h?ne(t.length,h).map(u=>u/1e3):t.map(()=>0);t.forEach((u,f)=>{const m=f===0?ge(c.delay,0)/1e3+d[0]:0,p=f===0?0:d[f]-d[f-1],g=f===0?i:`<${p<0?"-":"+"}${Math.abs(p).toFixed(6)}`,v=n.map((w,k)=>k===a?{...c,delay:m}:w).map(w=>this.prepare(Hs(w,f,this.targetFor(u),this.stage.utils,r),[u]));s(v,[u],g)})}targetFor(t){return this.stage.elementFor(t)??this.stage.objectFor(t)}prepare(t,n){const i=o=>this.options.onWarning?.(o),s=o=>this.stage.query(o);let r=t;if(t.motionPath!==void 0){const o=La(t.motionPath,{query:s,targets:n.map(a=>this.stage.elementFor(a)).filter(a=>!!a),warn:i});r={...r,motionPath:o}}if(t.morphSVG!==void 0){const o=$a(t.morphSVG,s,i),{morphSVG:a,...l}=r;r=o?{...r,morphSVG:o}:l}if(t.drawSVG!==void 0){const o=Us(this.stage.elementFor(n[0]));if(o===void 0){i("gsap-compat: drawSVG needs an SVG shape with a stroke (path, line, circle…)");const{drawSVG:a,...l}=r;r=l}else r=ca(r,o)}return r}resolve(t){const n=this.stage.resolveTargets(t);if(n.length===0){this.options.onWarning?.(`gsap-compat: no elements found for target ${Ml(t)}`);return}return this.firstElement??=n.map(i=>this.stage.elementFor(i)).find(i=>i!==void 0),n}}function qs(e=new ls){const t=r=>{const{config:o}=pe(r);return new Q(e,{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})},n=r=>{const{onStart:o,onUpdate:a,onComplete:l,onRepeat:c,onReverseComplete:h,repeatRefresh:d,...u}=r;return u},i=r=>(r&&e.collector?.track(r),r),s={stage:e,ticker:e.ticker,utils:e.utils,getProperty:(r,o)=>{const[a]=e.resolveTargets(r);if(a===void 0)return;const l=e.objectFor(a);return l?l[o]:e.appliedValue(a,o)??is(o)},scrollTrigger:r=>i(xn(e,r)),scrollBatch:(r,o)=>wl(e,r,o).map(a=>i(a)),scrollTo:(r,o)=>Ws(s,e,r,o),refreshScroll:()=>{Ut.refreshAll(),Mn.refreshAll()},smoothScroll:(r={})=>{const o=typeof r.scroller=="string"?(e.collector?.scope??e.root).querySelector(r.scroller):r.scroller;return i(new Mn({...r,scroller:o}).start())},context:(r,o)=>{const a=new Fs(e,o);return r&&a.add(()=>r(a)),a},matchMedia:r=>new cl(e,r),customEase:Ds.create,customBounce:Bs.create,customWiggle:Ns.create,pageTransition:r=>dl(s,e,o=>new Q(e,o),r),imageSequence:(r,o)=>{const a=typeof r=="string"?(e.collector?.scope??e.root).querySelector(r):r;if(!(a instanceof HTMLCanvasElement))throw new Error(`gsap-compat: imageSequence needs a <canvas>, got ${String(r)}`);return i(new hl(a,o))},quickTo:(r,o,a={})=>{const l=new Q(e,{paused:!0}),[c]=e.resolveTargets(r);return Object.assign(d=>{if(!c)return;const u=a.spring!==void 0?e.velocityOf(c,o)??0:0;l.compat.reset(),l.compat.to(c,{[o]:d,duration:a.duration??.4,ease:a.ease??"power3.out",...a.spring!==void 0&&{spring:vl(a.spring,o,u)}}),l.timeline.stop(),l.timeline.play(),e.activate(l.timeline)},{tween:l,kill:()=>l.kill()})},timeline:r=>new Q(e,r),to:(r,o)=>{if(o.scrollTo!==void 0){const{scrollTo:a,...l}=o,c=typeof a=="object"&&a!==null&&!("nodeType"in a)?a:{},h=typeof r!="string"&&r!==window&&r.nodeType===1;return Ws(s,e,a,{...l,offsetX:c.offsetX,offsetY:c.offsetY,scroller:h?r:void 0})}return t(o).to(r,n(o))},from:(r,o)=>t(o).from(r,n(o)),fromTo:(r,o,a)=>t(a).fromTo(r,o,n(a)),set:(r,o)=>t(o).set(r,n(o)),delayedCall:(r,o,a)=>new Q(e).call(o,a,r),killTweensOf:(r,o)=>{const a=e.resolveTargets(r),l=typeof o=="string"?o.split(",").map(c=>c.trim()).filter(Boolean):o;for(const c of[...e.liveTimelines])c.killTweensOf(a,l)},convertToPath:r=>Oa(r,e.root),splitText:(r,o)=>{const a=e.collector?.scope??e.root,l=typeof r=="string"?Array.from(a.querySelectorAll(r)):"nodeType"in r?[r]:Array.from(r);return i(Ha(l,o))},draggable:(r,o)=>i(Ya(s,e,r,o)),getFlipState:r=>mn(e,r),flipFrom:(r,o)=>gn(e,a=>new Q(e,a),r,o),flip:(r,o,a)=>{const l=mn(e,r);return o(),gn(e,c=>new Q(e,c),l,{targets:r,...a})}};return s}const q=qs();function vl(e,t,n){return e===!0?{velocity:{[t]:n}}:typeof e=="string"?{preset:e,velocity:{[t]:n}}:{...e,velocity:{[t]:n}}}function Tl(e){return e.morphSVG!==void 0||e.drawSVG!==void 0||e.text!==void 0||e.scrambleText!==void 0||Xs(e)}function Xs(e){return Object.entries(e).some(([t,n])=>(typeof n=="function"||es(n))&&!an.has(t))}function Hs(e,t,n,i,s){if(!Xs(e))return e;const r={};for(const[o,a]of Object.entries(e))an.has(o)?r[o]=a:typeof a=="function"?r[o]=a(t,n,s):es(a)?r[o]=i.resolveRandomString(a):r[o]=a;return r}function Vs(e){const t=e.map(i=>i?.getBoundingClientRect().top);if(t[0]===void 0)return e.length;let n=0;for(const i of t){if(i===void 0||Math.abs(i-t[0])>1)break;n++}return Math.max(1,n)}function Us(e){const t=e;if(typeof t?.getTotalLength=="function")return t.getTotalLength()}function kl(e){if(typeof e=="number"||typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="number"))return e}function Ml(e){return typeof e=="string"?`"${e}"`:String(e)}class An{media;offset;driftTolerance;constructor(t,n={}){this.media=t,this.offset=n.offset??0,this.driftTolerance=Math.max(0,n.driftTolerance??.15)}targetTime(t){return Math.max(0,t/1e3+this.offset)}update(t,n){const i=this.targetTime(t);n?(this.media.paused&&this.safePlay(),Math.abs(this.media.currentTime-i)>this.driftTolerance&&(this.media.currentTime=i)):(this.media.paused||this.media.pause(),this.media.currentTime!==i&&(this.media.currentTime=i))}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 js(e,t,n,i,s){const r=n-s;if(r<0){t.paused||t.pause(),t.currentTime=0;return}e.update(r,i)}class we{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,n={}){if(typeof t=="string"){const i=document.querySelector(t);if(!i)throw new Error(`Container not found: ${t}`);this.container=i}else this.container=t;this.options=n,this.adapter=new pt}async load(t){this.scenarioList=[],this.scenarioId=void 0,await this.loadSource(t)}async loadSource(t){let n;if(typeof t=="string"){const i=await fetch(t);if(!i.ok)throw new Error(`Failed to load animation: ${i.statusText}`);n=await i.json()}else n=t;this.useDefinition(n),this.showInitialFrame(),this.watchReducedMotion(),this.watchVisibility(),this.options.autoplay&&!this.reducedMotion&&(this.options.playWhenVisible&&!this.onScreen?this.autoplayWhenSeen=!0:this.play())}useDefinition(t){const n={...t.config};this.options.speed!==void 0&&(n.speed=this.options.speed),this.options.loop!==void 0&&(n.loop=this.options.loop),this.options.alternate!==void 0&&(n.alternate=this.options.alternate),this.timeline=xt({...t,config:n}),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,n={}){if(t.length===0)throw new Error("tinyfly: loadScenarios needs at least one scenario");const i=new Set;for(const r of t){if(i.has(r.id))throw new Error(`tinyfly: scenario id "${r.id}" is used more than once`);i.add(r.id)}const s=n.initial===void 0?t[0]:t.find(r=>r.id===n.initial);if(!s)throw new Error(`tinyfly: there is no scenario "${n.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 n=this.scenarioList.find(a=>a.id===t);if(!n||!this.timeline)return!1;if(t===this.scenarioId)return!0;const i=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(n.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),i&&!this.reducedMotion?(this.stepping=this.options.stepMode===!0,this.startPlaying()):this.notify(),!0}rememberAuthored(t){if(this.authored.has(t))return;const n={style:t.getAttribute("style")};t.children.length===0&&(n.text=t.textContent??"");const i=t.tagName.toLowerCase()==="path"?t:t.querySelector("path");i&&(n.path={element:i,d:i.getAttribute("d")}),this.authored.set(t,n)}restoreAuthored(){for(const[t,n]of this.authored){n.style===null?t.removeAttribute("style"):t.setAttribute("style",n.style),n.text!==void 0&&t.textContent!==n.text&&(t.textContent=n.text),n.path&&(n.path.d===null?n.path.element.removeAttribute("d"):n.path.element.setAttribute("d",n.path.d));const i=t.dataset;i&&delete i.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 n;for(const i of this.markers)if(i.time<=t+.5)n=i;else break;return n}caption(t,n){const i=t?this.markers.find(o=>o.id===t):this.currentMarker;if(!i)return;const s=n??this.language(),r=o=>o?.[s]?.[i.id]??o?.[s.split("-")[0]]?.[i.id];return r(this.options.captions)??r(this.timeline?.captions)??i.label}next(){if(!this.timeline)return;const t=this.currentTime,n=this.markers.find(i=>i.time>t+.5);if(this.reducedMotion){this.seek(n?n.time:this.duration);return}t>=this.duration-.5||(this.stepping=n!==void 0,this.startPlaying())}prev(){if(!this.timeline)return;const t=this.currentTime,n=[...this.markers].reverse().find(i=>i.time<t-.5);this.pause(),this.seek(n?n.time:0)}goToMarker(t){const n=this.markers.find(i=>i.id===t);n&&(this.pause(),this.seek(n.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 n=t==="end"?this.timeline.duration:t==="start"?0:t;this.timeline.seek(Math.max(0,Math.min(this.timeline.duration,n))),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(n=>{for(const i of n)this.onScreen=i.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,n=t?.id;n!==this.lastMarkerId&&(this.lastMarkerId=n,this.options.onMarker(t))}scanMedia(){this.mediaTargets=[],this.container.querySelectorAll("[data-tinyfly-media]").forEach(n=>{const i=n,s=Number(i.getAttribute("data-tinyfly-start")??"0")||0,r=i.getAttribute("data-volume");r!==null&&(i.volume=Math.max(0,Math.min(1,Number(r)||0))),this.mediaTargets.push({el:i,startTime:s,sync:new An(i)})})}syncAllMedia(t,n){for(const i of this.mediaTargets)js(i.sync,i.el,t,n,i.startTime)}loadFromString(t){const n=JSON.parse(t);this.load(n)}registerTarget(t,n){if(typeof n=="string"){const i=this.container.querySelector(n);i&&(this.rememberAuthored(i),this.targets[t]=i,this.adapter.registerTarget(t,i))}else this.rememberAuthored(n),this.targets[t]=n,this.adapter.registerTarget(t,n)}autoRegisterTargets(){this.container.querySelectorAll("[data-tinyfly]").forEach(n=>{const i=n.closest("[data-tinyfly-symbol]");if(i&&i!==n)return;const s=n.getAttribute("data-tinyfly");s&&this.registerTarget(s,n)}),this.timeline&&new Set(this.timeline.tracks.map(i=>i.target)).forEach(i=>{if(!this.targets[i]){const s=this.container.querySelector(`[data-tinyfly="${i}"]`)||this.container.querySelector(`.${i}`)||this.container.querySelector(`#${i}`);s&&this.registerTarget(i,s)}})}setupSymbolInstances(){this.symbolInstances=[];const t=this.options.symbols;if(!t||t.length===0)return;const n=new Map(t.map(i=>[i.id,i]));this.container.querySelectorAll("[data-tinyfly-symbol]").forEach(i=>{const s=i.getAttribute("data-tinyfly-symbol");if(!s)return;const r=n.get(s);if(!r||!r.timeline.tracks?.length)return;const o=new pt;i.querySelectorAll("[data-tinyfly]").forEach(a=>{const l=a.getAttribute("data-tinyfly");l&&o.registerTarget(l,a)}),this.symbolInstances.push({adapter:o,timeline:xt(r.timeline)})})}attachMedia(t,n){this.mediaSync=new An(t,n),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=n=>{if(this.isDestroyed||!this.timeline)return;const i=n-(this.lastTime??n);this.lastTime=n;const s=this.playhead;this.timeline.tick(i),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 n=this.timeline,i={time:n.currentTime,iteration:n.loopIteration,direction:n.direction};this.playhead=i;const s=this.markers;if(s.length===0)return;const{crossings:r}=Ze(s.map(o=>o.time),t,i,{duration:n.duration,alternate:n.config.alternate===!0,holding:n.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,n.pause(),n.seek(a.time),this.playhead={time:a.time,iteration:n.loopIteration,direction:n.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 n of this.symbolInstances){const i=n.timeline.duration;n.adapter.applyState(n.timeline.getStateAtTime(i>0?t%i:t))}}}async function Sl(e,t,n={}){const i=new we(e,{...n,autoplay:!0});return await i.load(t),i}function xl(e,t={}){return new we(e,t)}const zs={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"},Gs="tinyfly-controls-style",Al=`
|
|
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 El=0;function Pl(e){if(e.getElementById(Gs))return;const t=e.createElement("style");t.id=Gs,t.textContent=Al,e.head.appendChild(t)}function Ks(e,t,n={}){const i=t.ownerDocument;Pl(i);const s={...zs,...n.labels},r=n.speeds??[.5,1,2],o=()=>e.markers.length>0,a=()=>e.markers.some(P=>P.label!==void 0||e.caption(P.id)!==void 0),l=i.createElement("div");l.className="tf-ctl";const c=i.createElement("div");c.className="tf-ctl-bar",c.setAttribute("role","group");const h=(P,R,$,B="")=>{const N=i.createElement("button");return N.type="button",N.className=`tf-ctl-btn ${B}`.trim(),N.setAttribute("aria-label",P),N.title=P,N.textContent=R,N.addEventListener("click",$),N},d=h(s.restart,"⟲",()=>{e.pause(),e.seek(0)}),u=h(s.prev,"|◀",()=>e.prev()),f=h(s.play,"▶",()=>e.isPlaying?e.pause():p(),"tf-ctl-primary"),m=h(s.next,"▶|",()=>e.next()),p=()=>{e.currentTime>=e.duration-.5&&e.seek(0),e.play()},g=i.createElement("input");g.type="range",g.className="tf-ctl-scrub",g.min="0",g.max="1000",g.step="1",g.setAttribute("aria-label",s.scrub),g.addEventListener("input",()=>{e.pause(),e.seek(Number(g.value)/1e3*e.duration)});const y=i.createElement("span");y.className="tf-ctl-step";const v=i.createElement("select");v.className="tf-ctl-speed",v.setAttribute("aria-label",s.speed);for(const P of r){const R=i.createElement("option");R.value=String(P),R.textContent=`${P}×`,P===1&&(R.selected=!0),v.appendChild(R)}v.addEventListener("change",()=>e.setSpeed(Number(v.value))),c.append(d,u,f,m,g,y),r.length>0&&c.append(v),l.append(c);const w=n.fullscreen?Rl(t,i,s):void 0;w&&c.append(w.button);const k=i.createElement("p");k.className="tf-ctl-caption",k.setAttribute("aria-live","polite"),n.captions!==!1&&l.append(k);const T=i.createElement("div");T.className="tf-ctl-question",T.hidden=!0;const M=i.createElement("span"),x=h(s.reveal,s.reveal,()=>e.play(),"tf-ctl-primary");T.append(M,x),l.append(T);const C=_l(e,i,s.scenario,n.scenarioControl??"buttons");C&&l.append(C.element);const L=n.mount;L?L.appendChild(l):t.insertAdjacentElement("afterend",l);const I=()=>{const P=e.isPlaying;f.textContent=P?"❚❚":"▶",f.setAttribute("aria-label",P?s.pause:s.play),f.title=P?s.pause:s.play;const R=e.duration;i.activeElement!==g&&(g.value=String(R>0?Math.round(e.currentTime/R*1e3):0));const $=e.markers;if(u.hidden=m.hidden=y.hidden=$.length===0,$.length>0){const B=e.currentMarker,N=B?$.indexOf(B)+1:0;y.textContent=s.stepFormat.replace("{index}",String(N)).replace("{total}",String($.length)),y.setAttribute("aria-label",`${s.step} ${N} ${s.of} ${$.length}`),u.disabled=e.currentTime<=.5,m.disabled=e.currentTime>=R-.5;const F=e.caption()??"";k.textContent!==F&&(k.textContent=F),k.hidden=!a();const D=!P&&B?.question!==void 0&&Math.abs(e.currentTime-B.time)<1;T.hidden=!D,D&&M.textContent!==B.question&&(M.textContent=B.question)}else T.hidden=!0,k.hidden=!0;C?.update()},A=e.subscribe(I);I();const E=n.keyboardScope??t;!E.hasAttribute("tabindex")&&E.tabIndex<0&&(E.tabIndex=0);const S=new WeakSet,_=P=>{if(S.has(P)||(S.add(P),P.defaultPrevented||P.altKey||P.ctrlKey||P.metaKey))return;const R=P.target;if(!(R.tagName==="INPUT"||R.tagName==="SELECT")&&!(P.key===" "&&R.tagName==="BUTTON"))switch(P.key){case" ":P.preventDefault(),e.isPlaying?e.pause():p();break;case"ArrowRight":if(!o())return;P.preventDefault(),e.next();break;case"ArrowLeft":if(!o())return;P.preventDefault(),e.prev();break;case"Home":P.preventDefault(),e.pause(),e.seek(0);break;case"f":case"F":if(!w)return;P.preventDefault(),w.active?w.exit():w.enter();break}};return E.addEventListener("keydown",_),l.addEventListener("keydown",_),{element:l,fullscreen:w&&{get active(){return w.active},enter:w.enter,exit:w.exit},destroy(){w?.destroy(),A(),E.removeEventListener("keydown",_),l.removeEventListener("keydown",_),l.remove()}}}function _l(e,t,n,i){const s=e.scenarios;if(s.length<2)return;if(i==="slider"){const h=t.createElement("div");h.className="tf-ctl-choice-slider";const d=t.createElement("span");d.textContent=n,d.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",n);const f=t.createElement("output");return f.setAttribute("aria-hidden","true"),u.addEventListener("input",()=>{const p=s[Number(u.value)];p&&e.setScenario(p.id)}),h.append(d,u,f),{element:h,update:()=>{const p=Math.max(0,s.findIndex(y=>y.id===e.scenario));t.activeElement!==u&&(u.value=String(p));const g=s[p].label;f.textContent!==g&&(f.textContent=g),u.setAttribute("aria-valuetext",g)}}}const r=t.createElement("fieldset");r.className="tf-ctl-choices";const o=t.createElement("legend");o.textContent=n,r.append(o);const a=`tf-ctl-scenario-${++El}`,l=s.map(h=>{const d=t.createElement("label");d.className="tf-ctl-choice";const u=t.createElement("input");u.type="radio",u.name=a,u.value=h.id,u.addEventListener("change",()=>{u.checked&&e.setScenario(h.id)});const f=t.createElement("span");return f.textContent=h.label,d.append(u,f),r.append(d),u});return{element:r,update:()=>{for(const h of l){const d=h.value===e.scenario;h.checked!==d&&(h.checked=d)}}}}const Cl='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>',Il='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></svg>';function Rl(e,t,n){const i=t,s=e,r=t.createElement("button");r.type="button",r.className="tf-ctl-btn tf-ctl-fullscreen";let o,a="";const l=()=>{const p=o!==void 0;r.innerHTML=p?Il:Cl;const g=p?n.exitFullscreen:n.fullscreen;r.setAttribute("aria-label",g),r.title=g,r.setAttribute("aria-pressed",String(p)),e.classList.toggle("tf-fullscreen",p),e.classList.toggle("tf-fullscreen-overlay",o==="overlay")},c=()=>i.fullscreenElement??i.webkitFullscreenElement??null,h=()=>{c()===e?o="native":o==="native"&&(o=void 0),l()},d=p=>{p.key==="Escape"&&m()},u=()=>{o="overlay",a=t.documentElement.style.overflow,t.documentElement.style.overflow="hidden",t.addEventListener("keydown",d),l()};async function f(){if(o)return;const p=s.requestFullscreen?.bind(s)??s.webkitRequestFullscreen?.bind(s),g=i.fullscreenEnabled??i.webkitFullscreenEnabled??!1;if(p&&g)try{if(await p(),c()===e){o="native",l();return}}catch{}u()}async function m(){if(o==="overlay")t.removeEventListener("keydown",d),t.documentElement.style.overflow=a,o=void 0,l();else if(o==="native"){o=void 0,l();const p=i.exitFullscreen?.bind(i)??i.webkitExitFullscreen?.bind(i);c()===e&&p&&await p()}}return r.addEventListener("click",()=>{o?m():f()}),t.addEventListener("fullscreenchange",h),t.addEventListener("webkitfullscreenchange",h),l(),{button:r,get active(){return o!==void 0},enter:f,exit:m,destroy(){m(),t.removeEventListener("fullscreenchange",h),t.removeEventListener("webkitfullscreenchange",h),r.remove()}}}const Js="tinyfly-choices-style",Ll=`
|
|
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 va(e){if(e.getElementById(cs))return;const t=e.createElement("style");t.id=cs,t.textContent=ba,e.head.appendChild(t)}function hs(e,t){const i=Array.from(t.querySelectorAll("[data-tinyfly-choose]"));if(i.length===0)return()=>{};va(t.ownerDocument);const n=[],s=[];for(const a of i){const l=a.getAttribute("data-tinyfly-choose")??"",c=[],u=(g,p)=>{a.hasAttribute(g)||(a.setAttribute(g,p),c.push(g))};u("role","button"),u("tabindex","0");const f=e.scenarios.find(g=>g.id===l)?.label;f!==void 0&&u("aria-label",f),a.setAttribute("aria-pressed","false"),c.push("aria-pressed"),n.push({element:a,attributes:c});const h=()=>e.setScenario(l),d=g=>{const p=g.key;p!=="Enter"&&p!==" "||(g.preventDefault(),h())};a.addEventListener("click",h),a.addEventListener("keydown",d),s.push(()=>{a.removeEventListener("click",h),a.removeEventListener("keydown",d)})}const r=()=>{for(const{element:a}of n)a.setAttribute("aria-pressed",String(a.getAttribute("data-tinyfly-choose")===e.scenario))},o=e.subscribe(r);return r(),()=>{o();for(const a of s)a();for(const{element:a,attributes:l}of n)for(const c of l)a.removeAttribute(c)}}const ee=new WeakMap,Je=new WeakMap;let wa=0;function Ft(e,t,i){if(e)try{return JSON.parse(e)}catch(n){console.warn(`tinyfly: invalid ${t} JSON on`,i,n);return}}async function us(e,t={}){const i=ee.get(e);if(i)return i;const n=Array.from(e.querySelectorAll("script[data-tinyfly-timeline]")),s=n[0],r=e.getAttribute("data-src"),o=ka(e.getAttribute("data-markers")),a=n.length>1||s?.hasAttribute("data-scenario")?Ta(n,o,e):void 0;if(a&&a.length===0)return;let l=s&&!a?Ft(s.textContent,"timeline",e):void 0;if(!l&&r&&o){const d=await fetch(r);d.ok&&(l=await d.json())}if(l&&o&&(l=fs(l,o)),!l&&!r&&!a){console.warn('tinyfly: embed has no timeline (a <script type="application/json" data-tinyfly-timeline> or data-src)',e);return}const c=Ft(e.querySelector("script[data-tinyfly-captions]")?.textContent,"captions",e),u={playWhenVisible:!0,...t.player,...c&&{captions:c},...Ft(e.getAttribute("data-options"),"data-options",e)};Ma(e);const f=new te(e,u),h={element:e,player:f};if(ee.set(e,h),e.setAttribute("data-tinyfly-mounted",""),a){const d=e.getAttribute("data-scenario")??void 0;await f.loadScenarios(a,{initial:a.some(g=>g.id===d)?d:void 0}),Je.set(e,hs(f,e))}else await f.load(l??r);if(e.getAttribute("data-controls")!=="false"){const d=Ft(e.getAttribute("data-labels"),"data-labels",e),g=e.querySelector("figcaption"),p=e.getAttribute("data-scenario-legend"),m=e.getAttribute("data-scenario-control");h.controls=ls(f,e,{...t.controls,...e.getAttribute("data-fullscreen")==="true"?{fullscreen:!0}:{},...m==="slider"||m==="buttons"?{scenarioControl:m}:{},labels:{...t.controls?.labels,...d,...p?{scenario:p}:{}},mount:void 0}),g?e.insertBefore(h.controls.element,g):e.appendChild(h.controls.element)}return h}function Ta(e,t,i){const n=[];return e.forEach((s,r)=>{const o=Ft(s.textContent,"timeline",i);if(!o)return;const a=s.getAttribute("data-scenario")||`scenario-${r+1}`;if(n.some(c=>c.id===a)){console.warn(`tinyfly: scenario id "${a}" is used more than once; the later one is skipped`,i);return}const l=s.getAttribute("data-scenario-label")??void 0;n.push({id:a,label:l,timeline:t?fs(o,t):o})}),n}function fs(e,t){return e.config.markers?.length?e:{...e,config:{...e.config,markers:t.map((i,n)=>({id:`step-${n+1}`,time:i}))}}}function ka(e){if(!e)return;const t=e.split(/[\s,]+/).filter(Boolean).map(Number).filter(i=>Number.isFinite(i)&&i>=0).sort((i,n)=>i-n);return t.length>0?t:void 0}async function ds(e=document,t={}){const i=Array.from(e.querySelectorAll("[data-tinyfly-embed]"));return(await Promise.all(i.map(s=>us(s,t)))).filter(s=>s!==void 0)}function Sa(e){const t=ee.get(e);t&&(Je.get(e)?.(),Je.delete(e),t.controls?.destroy(),t.player.destroy(),ee.delete(e),e.removeAttribute("data-tinyfly-mounted"))}function Ma(e){const t=e.querySelector("svg");if(!t||t.hasAttribute("role")||t.hasAttribute("aria-hidden"))return;const i=e.getAttribute("data-alt"),n=e.querySelector("figcaption");t.setAttribute("role","img"),i?t.setAttribute("aria-label",i):n&&(n.id||=`tinyfly-caption-${++wa}`,t.setAttribute("aria-labelledby",n.id))}function Aa(){if(!(typeof document<"u"?document.currentScript:null)?.hasAttribute("data-tinyfly-auto"))return;const t=()=>{ds()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}class ps{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,i={}){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=i,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 i;if(typeof t=="string"){const n=await fetch(t);if(!n.ok)throw new Error(`Failed to load sequence: ${n.statusText}`);i=await n.json()}else i=t;this.sequence=i,this.symbolDefs.clear();for(const n of i.symbols??[])n.timeline?.tracks?.length&&this.symbolDefs.set(n.id,n.timeline);this.container.style.width=`${i.canvas.width}px`,this.container.style.height=`${i.canvas.height}px`,i.scenes.length>0&&(this.renderScene(i.scenes[0],this.containerA,this.adapterA),this.timelineA=this.createTimeline(i.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 i=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=i?"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),i)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 i of t)i.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,i,n){i.innerHTML="",n.clearTargets();const s=document.createElement("div");s.style.cssText="position:absolute;inset:0;transform-origin:center center",s.setAttribute("data-tinyfly","Camera"),i.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 l=a.getAttribute("data-tinyfly");l&&n.registerTarget(l,a)}}this.setupNested(s,n)}setupNested(t,i){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(l=>{const c=l.getAttribute("data-tinyfly");c&&a.registerTarget(c,l)}),n.push({adapter:a,timeline:ft(o)})}),n.length?this.nestedByAdapter.set(i,n):this.nestedByAdapter.delete(i)}applyNested(t,i){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?i%r:i))}}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 i=this.options.loop??this.sequence.loop??0;i===-1||i>0&&this.loopIteration<i-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 i=this.sequence.scenes[t],n=i.transition;if(n.type==="none"||n.duration<=0){this.switchToScene(t);return}this._state="transitioning",this.containerB.style.visibility="visible",this.renderScene(i,this.containerB,this.adapterB),this.timelineB=this.createTimeline(i),this.timelineB&&this.timelineB.play(),this.applyTransition(n.type,n.duration),this.transitionTimer=window.setTimeout(()=>{this.finishTransition(t)},n.duration)}applyTransition(t,i){const n=`${i}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 i=this.containerA;this.containerA=this.containerB,this.containerB=i;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 i=this.sequence.scenes[t];this.renderScene(i,this.containerA,this.adapterA),this.timelineA=this.createTimeline(i),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=i=>{if(this._isDestroyed||!this._isPlaying)return;const n=i-(this.lastTime??i);if(this.lastTime=i,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 Ea(e,t,i={}){const n=new ps(e,{...i,autoplay:!0});return await n.load(t),n}const Pa={type:"none",duration:0};function ms(e){let t=0;for(let i=1;i<e.length;i++)t+=Math.hypot(e[i].x-e[i-1].x,e[i].y-e[i-1].y);return t}function yt(e,t){const i=Math.min(1,Math.max(0,t));if(e.length<2||i===1)return e.slice();if(i===0)return e.slice(0,1);let n=ms(e)*i;const s=[e[0]];for(let r=1;r<e.length;r++){const o=e[r-1],a=e[r],l=Math.hypot(a.x-o.x,a.y-o.y);if(l>=n){const c=l===0?0:n/l;return s.push({x:o.x+(a.x-o.x)*c,y:o.y+(a.y-o.y)*c}),s}s.push(a),n-=l}return s}function ti(e,t){const i=yt(e,t);return i[i.length-1]}function gs(e,t){return t>0?Math.floor(Math.max(0,e)*t/1e3):0}function ei(e,t,i){const n=t.roughness??2,s=Math.max(1,Math.round(t.passes??2)),r=gs(i,t.boil??8);let o=0;const a=()=>{const h=o++;return d=>xe(Ji(`${t.seed??1}:${r}:${h}:${d}`))},l=(h,d)=>(h.next()*2-1)*d,c=h=>{const d=a(),g=e.lineWidth,p=e.globalAlpha;for(let m=0;m<s;m++)e.lineWidth=m===0?g:g*.55,e.globalAlpha=m===0?p:p*.6,h(d(m));e.lineWidth=g,e.globalAlpha=p},u=(h,d=1)=>{if(h.length<2)return;const g=h.slice(1).map((m,b)=>Math.hypot(m.x-h[b].x,m.y-h[b].y)),p=g.reduce((m,b)=>m+b,0)*Math.min(1,Math.max(0,d));c(m=>{const b=[],T=[];if(h.forEach((S,w)=>{b.push({x:S.x+l(m,n*.5),y:S.y+l(m,n*.5)}),w>0&&T.push([m.next()*2-1,m.next()*2-1])}),p<=0)return;e.beginPath(),e.moveTo(b[0].x,b[0].y);let v=0;for(let S=1;S<b.length;S++){const w=xa(b[S-1],b[S],n,T[S-1]),k=g[S-1];if(v+k<=p){e.bezierCurveTo(w[1].x,w[1].y,w[2].x,w[2].y,w[3].x,w[3].y),v+=k;continue}const M=Ca(w,k===0?1:(p-v)/k);e.bezierCurveTo(M[1].x,M[1].y,M[2].x,M[2].y,M[3].x,M[3].y);break}e.stroke()})},f=(h,d,g,p,m=1)=>{c(b=>{const v=b.next()*Math.PI*2,S=Math.PI*2+.15+b.next()*.3,w=[];for(let M=0;M<=14;M++){const E=v+S*M/14,R=l(b,n*.6);w.push({x:h+Math.cos(E)*(g+R),y:d+Math.sin(E)*(p+R)})}const k=yt(w,m);k.length<2||(ys(e,k),e.stroke())})};return{line:u,curve(h,d=1){if(h.length<2)return;const g=h[0],p=h[h.length-1],m=Math.hypot(p.x-g.x,p.y-g.y)||1,b=-(p.y-g.y)/m,T=(p.x-g.x)/m;c(v=>{const S={x:l(v,n*.5),y:l(v,n*.5)},w={x:l(v,n*.5),y:l(v,n*.5)},k=l(v,n*Math.min(1.5,Math.max(.3,m/80))),M=h.map((R,P)=>{const A=P/(h.length-1),_=Math.sin(Math.PI*A)*k;return{x:R.x+S.x+(w.x-S.x)*A+b*_,y:R.y+S.y+(w.y-S.y)*A+T*_}}),E=yt(M,d);E.length<2||(ys(e,E),e.stroke())})},circle(h,d,g,p=1){f(h,d,g,g,p)},ellipse:f,nudge(h=.5){const d=a()(0);return{x:l(d,n*h),y:l(d,n*h)}}}}function xa(e,t,i,n){const s=t.x-e.x,r=t.y-e.y,o=Math.hypot(s,r)||1,a=i*Math.min(1.5,Math.max(.3,o/80)),l=-r/o,c=s/o;return[e,{x:e.x+s/3+l*n[0]*a,y:e.y+r/3+c*n[0]*a},{x:e.x+2*s/3+l*n[1]*a,y:e.y+2*r/3+c*n[1]*a},t]}function Ca([e,t,i,n],s){const r=(f,h)=>({x:f.x+(h.x-f.x)*s,y:f.y+(h.y-f.y)*s}),o=r(e,t),a=r(t,i),l=r(i,n),c=r(o,a),u=r(a,l);return[e,o,c,r(c,u)]}function ys(e,t){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length-1;n++){const s={x:(t[n].x+t[n+1].x)/2,y:(t[n].y+t[n+1].y)/2};e.quadraticCurveTo(t[n].x,t[n].y,s.x,s.y)}const i=t[t.length-1];e.lineTo(i.x,i.y)}const 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,stretch:1};function W(e){return{...rt,...e}}const bs={mouth:0,smile:0,mouthWidth:1,leftEye:1,rightEye:1,leftBrow:0,rightBrow:0,browTilt:0,lookX:0,lookY:0},D=e=>({...bs,...e}),K={neutral:bs,happy:D({smile:.9,leftBrow:.2,rightBrow:.2}),joyful:D({mouth:.6,smile:1,mouthWidth:1.2,leftEye:0,rightEye:0,leftBrow:.4,rightBrow:.4}),sad:D({smile:-.8,leftEye:.8,rightEye:.8,browTilt:.9,leftBrow:-.1,rightBrow:-.1,lookY:.6}),crying:D({mouth:.45,smile:-1,leftEye:0,rightEye:0,browTilt:1,lookY:.4}),surprised:D({mouth:.7,mouthWidth:.7,leftEye:1.5,rightEye:1.5,leftBrow:1,rightBrow:1}),shocked:D({mouth:1,mouthWidth:.8,leftEye:1.6,rightEye:1.6,leftBrow:1,rightBrow:1,browTilt:.4}),angry:D({smile:-.6,mouthWidth:.9,leftEye:.8,rightEye:.8,leftBrow:-.6,rightBrow:-.6,browTilt:-1}),furious:D({mouth:.5,smile:-1,mouthWidth:1.3,leftEye:.9,rightEye:.9,leftBrow:-.9,rightBrow:-.9,browTilt:-1}),worried:D({smile:-.3,mouthWidth:.8,leftEye:1.1,rightEye:1.1,leftBrow:.3,rightBrow:.3,browTilt:.8,lookX:-.5}),scared:D({mouth:.35,smile:-.5,mouthWidth:.8,leftEye:1.45,rightEye:1.45,leftBrow:.8,rightBrow:.8,browTilt:.9}),confused:D({smile:-.2,mouthWidth:.8,leftEye:.9,rightEye:1.15,leftBrow:-.3,rightBrow:.8,lookX:.5,lookY:-.4}),skeptical:D({smile:-.1,leftEye:.6,rightEye:1,leftBrow:-.4,rightBrow:.7,lookX:.4}),thinking:D({smile:0,mouthWidth:.7,leftBrow:.3,rightBrow:.5,lookX:.6,lookY:-.8}),sleepy:D({smile:.1,leftEye:.25,rightEye:.25,leftBrow:-.3,rightBrow:-.3,lookY:.5}),disgusted:D({smile:-.7,mouthWidth:.9,leftEye:.6,rightEye:.75,leftBrow:-.5,rightBrow:-.2,browTilt:-.4,lookX:-.6}),smug:D({smile:.6,mouthWidth:.9,leftEye:.6,rightEye:.6,leftBrow:.1,rightBrow:.5,lookX:.5}),wink:D({smile:.9,leftEye:0,rightEye:1,leftBrow:-.2,rightBrow:.3})};function vs(e,t){return{...e,...typeof t=="string"?K[t]:t}}const ws={rest:rt,wave:W({rightShoulder:135,rightElbow:30,headTilt:6,...K.happy}),cheer:W({leftShoulder:125,leftElbow:20,rightShoulder:125,rightElbow:20,...K.joyful}),shrug:W({leftShoulder:30,leftElbow:85,rightShoulder:30,rightElbow:85,headTilt:-10,...K.confused,lookX:0,lookY:0}),point:W({rightShoulder:90,rightElbow:0,lean:4,smile:.4}),think:W({rightShoulder:60,rightElbow:150,headTilt:10,...K.thinking}),handsOnHips:W({leftShoulder:45,leftElbow:-100,rightShoulder:45,rightElbow:-100,leftHip:14,rightHip:14,smile:.8}),sad:W({leftShoulder:14,rightShoulder:14,leftElbow:-4,rightElbow:-4,headTilt:-14,lean:-3,...K.sad}),surprised:W({leftShoulder:70,leftElbow:60,rightShoulder:70,rightElbow:60,...K.surprised}),crouch:W({stretch:.72,leftShoulder:35,rightShoulder:35,leftElbow:-50,rightElbow:-50,leftHip:22,rightHip:22,headTilt:-4}),jump:W({stretch:1.22,leftShoulder:140,rightShoulder:140,leftElbow:20,rightElbow:20,leftHip:4,rightHip:4,...K.joyful})},Ts=Object.keys(rt);function ks(e,t,i){const n={...e};for(const s of Ts)n[s]=e[s]+(t[s]-e[s])*i;return n}const ii=24,_a=40;function Ss(e,t=rt,i=1){const n=Math.sin(e*Math.PI*2)*i,s=Math.cos(e*Math.PI*2)*i,r=o=>o<=_a?22*n:o;return{...t,leftHip:-ii*n,rightHip:-ii*n,leftKnee:-30*Math.max(0,s),rightKnee:30*Math.max(0,-s),leftShoulder:r(t.leftShoulder),rightShoulder:r(t.rightShoulder)}}function Ia(e,t=1){return 4*((As+Es)*e)*Math.sin(ii*t*Math.PI/180)}function Ms(e){const t=Math.abs(Math.sin(e/65)),i=.55+.45*Math.sin(e/310);return t*i}const Ra=.12,La=.1,Fa=.21,$a=.19,As=.24,Es=.22,ie=e=>e*Math.PI/180,Da=(e,t)=>({x:t*Math.sin(ie(e)),y:Math.cos(ie(e))});function Oa(e,t,i,n,s,r){const o=Math.max(1,r*.6),a=.12*i,l=n-.12*i,c=a+t.lookX*.08*i,u=t.lookY*.07*i,f=[{x:-.34*i,open:t.leftEye,brow:t.leftBrow,side:-1},{x:.34*i,open:t.rightEye,brow:t.rightBrow,side:1}];e.fillStyle=s,e.strokeStyle=s,e.lineWidth=o;for(const m of f){const b=Math.max(0,m.open)*(1-Math.min(1,Math.max(0,t.blink)));if(b<.2){const w=t.smile>.5?-.12*i:.06*i;e.beginPath(),e.moveTo(m.x+a-.12*i,l),e.quadraticCurveTo(m.x+a,l+w,m.x+a+.12*i,l),e.stroke()}else{if(b>1.2){const k=.13*i*b;e.beginPath(),e.ellipse(m.x+a,l,k*.85,k,0,0,Math.PI*2),e.fillStyle="#ffffff",e.fill(),e.stroke(),e.fillStyle=s}const w=b>1.2?.075*i:.1*i;e.beginPath(),e.ellipse(m.x+c,l+u,w,w*1.1*Math.min(b,1),0,0,Math.PI*2),e.fill()}const T=l-.3*i-m.brow*.14*i-Math.max(0,b-1)*.12*i,v=m.x+a-m.side*.13*i,S=m.x+a+m.side*.13*i;e.beginPath(),e.moveTo(S,T),e.lineTo(v,T-t.browTilt*.1*i),e.stroke()}const h=n+.4*i,d=.25*i*Math.max(.3,t.mouthWidth),g=Math.min(1,Math.max(0,t.mouth));if(e.beginPath(),g<=.05){e.moveTo(a-d,h),e.quadraticCurveTo(a,h+t.smile*.25*i,a+d,h),e.stroke();return}const p=.3*i*g;t.smile>.3?(e.moveTo(a-d,h-.05*i),e.lineTo(a+d,h-.05*i),e.quadraticCurveTo(a,h+p*2,a-d,h-.05*i)):t.smile<-.3?(e.moveTo(a-d,h+p*.6),e.lineTo(a+d,h+p*.6),e.quadraticCurveTo(a,h-p*1.4,a-d,h+p*.6)):e.ellipse(a,h,d*.8,p,0,0,Math.PI*2),e.fill()}function Ps(e,t,i,n,s=16){const r={x:2*t.x-(e.x+i.x)/2,y:2*t.y-(e.y+i.y)/2},o=[];for(let a=0;a<=s;a++){const l=a/s,c=l<.5?{x:e.x+(t.x-e.x)*2*l,y:e.y+(t.y-e.y)*2*l}:{x:t.x+(i.x-t.x)*(2*l-1),y:t.y+(i.y-t.y)*(2*l-1)},u=1-l,f={x:u*u*e.x+2*u*l*r.x+l*l*i.x,y:u*u*e.y+2*u*l*r.y+l*l*i.y};o.push({x:c.x+(f.x-c.x)*n,y:c.y+(f.y-c.y)*n})}return o}function xs(e,t,i={},n=0){const s=i.height??300,r=i.color??"#1e293b",o=(i.facing??1)<0?-1:1,a=Math.min(3,Math.max(.3,t.stretch??1)),l=Math.sqrt(a),c=Ra*s,u=c/Math.sqrt(a),f=c*Math.sqrt(a),h=-.46*s*a,d=-.76*s*a;e.save(),e.scale(o,1),e.strokeStyle=r,e.lineWidth=i.lineWidth??s*.025,e.lineCap="round",e.lineJoin="round";const g=(w,k,M,E,R)=>{const P=Da(M,E);return{x:w+P.x*R*s,y:k+P.y*R*s}},p=i.sketch?ei(e,i.sketch,n):void 0,m=(...w)=>{if(p)return p.line(w);e.beginPath(),e.moveTo(w[0].x,w[0].y);for(const k of w.slice(1))e.lineTo(k.x,k.y);e.stroke()},b=(w,k,M)=>{const E=Math.min(1,Math.max(0,i.rubber??0));if(E===0)return m(w,k,M);const R=Ps(w,k,M,E);if(p)return p.curve(R);e.beginPath(),e.moveTo(R[0].x,R[0].y);for(const P of R.slice(1))e.lineTo(P.x,P.y);e.stroke()};for(const[w,k,M]of[[-1,t.leftHip,t.leftKnee],[1,t.rightHip,t.rightKnee]]){const E=g(0,h,k,w,As*a);b({x:0,y:h},E,g(E.x,E.y,k-M,w,Es*a))}e.translate(0,h),e.rotate(ie(t.lean)),e.translate(0,-h),m({x:0,y:h},{x:0,y:d});const T=d+La*s*a;for(const[w,k,M]of[[-1,t.leftShoulder,t.leftElbow],[1,t.rightShoulder,t.rightElbow]]){const E=g(0,T,k,w,Fa*l);b({x:0,y:T},E,g(E.x,E.y,k+M,w,$a*l))}e.translate(0,d),e.rotate(ie(t.headTilt));const v=-f;e.beginPath(),e.ellipse(0,v,u,f,0,0,Math.PI*2);const S=i.headFill??"#ffffff";if(S!=="none"&&(e.fillStyle=S,e.fill()),p){p.ellipse(0,v,u,f);const w=p.nudge();e.translate(w.x,w.y)}else e.stroke();e.translate(0,v),e.scale(u/c,f/c),Oa(e,t,c,0,r,i.lineWidth??s*.025),e.restore(),i.label&&(e.save(),e.fillStyle=r,e.font=i.labelFont??`700 ${Math.round(s*.11)}px sans-serif`,e.textAlign="center",e.textBaseline="bottom",e.fillText(i.label,0,-s*a-.04*s),e.restore())}function Ba(e){const t=e.style??{},i=t.height??300,n=i*.8,s={...W(e.pose??{}),walk:0,walking:0,talk:0,rubber:t.rubber??0};return{type:"custom",x:e.x-n/2,y:e.y-i,width:n,height:i,props:{...s},draw(r,o,a){const l=o.props,c={...l};let u=l.walking>0?ks(c,Ss(l.walk,c),l.walking):c;l.talk>0&&(u={...u,mouth:Math.max(u.mouth,l.talk*Ms(a))}),r.translate(n/2,i),xs(r,u,{...t,rubber:l.rubber},a)}}}function Na(e,t){const i=[];return t.forEach((n,s)=>{const r=s===0?rt:i[s-1],o=typeof n.pose=="string"?ws[n.pose]:{...r,...n.pose};i.push(n.expression?vs(o,n.expression):o)}),Ts.filter(n=>i.some(s=>s[n]!==rt[n])).map(n=>({id:`${e}-${n}`,target:e,property:n,keyframes:t.map((s,r)=>({time:s.time,value:i[r][n],...s.easing?{easing:s.easing}:{}}))}))}function Cs(e,t,i={},n){const s=i.length??240,r=9,o=28,a=s-22;e.save(),e.translate(t.x,t.y),e.rotate((i.angle??-30)*Math.PI/180),e.fillStyle=i.color??"#f4c542",e.fillRect(o,-r,a-o,2*r),e.fillStyle="#e8b4a0",e.fillRect(a,-r,s-a,2*r),e.fillStyle="#f1dcbf",e.beginPath(),e.moveTo(0,0),e.lineTo(o,-r),e.lineTo(o,r),e.closePath(),e.fill(),e.fillStyle=i.outline??"#2f2f33",e.beginPath(),e.moveTo(0,0),e.lineTo(o*.35,-r*.35),e.lineTo(o*.35,r*.35),e.closePath(),e.fill(),e.strokeStyle=i.outline??"#2f2f33",e.lineWidth=3,e.lineJoin="round",e.lineCap="round";const l=[[{x:0,y:0},{x:o,y:-r},{x:s,y:-r},{x:s,y:r},{x:o,y:r},{x:0,y:0}],[{x:o,y:-r},{x:o,y:r}],[{x:a,y:-r},{x:a,y:r}]];for(const c of l)_s(e,c,n);e.restore()}function ni(e,t,i={},n){const s=i.length??90,r=i.thickness??34;e.save(),e.translate(t.x,t.y),e.rotate((i.angle??-35)*Math.PI/180);const o=-r/2;e.fillStyle=i.color??"#f4a7b9",e.fillRect(0,o,s,r),e.fillStyle="#e9edf2",e.fillRect(s*.45,o,s*.55,r),e.strokeStyle=i.outline??"#2f2f33",e.lineWidth=3,e.lineJoin="round";const a=[{x:0,y:o},{x:s,y:o},{x:s,y:-o},{x:0,y:-o},{x:0,y:o}],l=[{x:s*.45,y:o},{x:s*.45,y:-o}];if(n)n.line(a),n.line(l);else for(const c of[a,l]){e.beginPath(),e.moveTo(c[0].x,c[0].y);for(const u of c.slice(1))e.lineTo(u.x,u.y);e.stroke()}e.restore()}function si(e,t,i={},n){const s=i.tool??"pencil",r=i.skin??"#f1c9a5",o=i.outline??"#2f2f33",a=s==="eraser"?17:9,l=s==="eraser"?-40:0,c=n?n.nudge(.6):{x:0,y:0};e.save(),e.translate(t.x+c.x,t.y+c.y),e.rotate((i.angle??-30)*Math.PI/180),e.scale(i.scale??1,i.scale??1),e.lineCap="round",e.lineJoin="round";const u=(d,g,p,m)=>{for(const[b,T]of[[o,p+6],[m,p]])e.strokeStyle=b,e.lineWidth=T,e.beginPath(),e.moveTo(d.x,d.y),e.lineTo(g.x,g.y),e.stroke()};e.save(),e.translate(l,0);const f={x:165,y:-a-26},h=d=>({x:f.x+d*.8,y:f.y+d*.6});u(f,h(2e3),64,r),u(h(110),h(2e3),92,i.sleeve??"#5b7db1"),e.fillStyle=r,e.strokeStyle=o,e.lineWidth=3,e.beginPath(),e.ellipse(f.x,f.y,54,40,.25,0,Math.PI*2),e.fill(),e.stroke(),e.restore(),s==="eraser"?ni(e,{x:0,y:0},{angle:0,outline:o},n):Cs(e,{x:0,y:0},{angle:0,outline:o},n),e.translate(l,0),u({x:150,y:a+8},{x:92,y:a+12},22,r),u({x:140,y:-a-18},{x:58,y:-a-6},20,r),u({x:150,y:-a-30},{x:112,y:-a+2},20,r),u({x:172,y:-a-30},{x:140,y:-a+4},20,r),e.restore()}function qa(e,t,i,n=.08,s=32){const r=Math.PI*2*(1+n),o=[];for(let a=0;a<=s;a++){const l=-Math.PI/2+r*a/s;o.push({x:e+Math.cos(l)*i,y:t+Math.sin(l)*i})}return o}function Ya(e){const{path:t}=e,i=t.map(a=>a.x),n=t.map(a=>a.y),s=Math.min(...i),r=Math.min(...n),o=e.hand===!1?void 0:e.hand===!0||e.hand===void 0?{}:e.hand;return{type:"custom",x:s,y:r,width:Math.max(1,Math.max(...i)-s),height:Math.max(1,Math.max(...n)-r),props:{draw:0},draw(a,l,c){const u=Math.min(1,Math.max(0,Number(l.props?.draw??0)));a.translate(-s,-r),a.strokeStyle=e.color??"#2f2f33",a.lineWidth=e.lineWidth??5,a.lineCap="round",a.lineJoin="round";const f=e.sketch?ei(a,e.sketch,c):void 0;u>0&&(f?e.smooth?f.curve(t,u):f.line(t,u):_s(a,yt(t,u))),o&&u>0&&u<1&&si(a,ti(t,u),o,f)}}}function _s(e,t,i){if(!(t.length<2)){if(i)return i.line(t);e.beginPath(),e.moveTo(t[0].x,t[0].y);for(const n of t.slice(1))e.lineTo(n.x,n.y);e.stroke()}}const ne=1e5;function Xa(e,t,i,n,s=6){const r=[],o=Math.max(1,Math.round(s));for(let a=0;a<=o;a++)r.push({x:a%2===0?e:e+i,y:t+n*a/o});return r}function ri(e,t,i,n){if(n<=0||t.length===0)return;const s=yt(t,n),r=i/2,o=a=>{e.beginPath(),e.rect(-ne,-ne,2*ne,2*ne),a(),e.clip("evenodd")};for(const a of s)o(()=>{e.moveTo(a.x+r,a.y),e.arc(a.x,a.y,r,0,Math.PI*2)});for(let a=1;a<s.length;a++){const l=s[a-1],c=s[a],u=Math.hypot(c.x-l.x,c.y-l.y);if(u===0)continue;const f=-(c.y-l.y)/u*r,h=(c.x-l.x)/u*r;o(()=>{e.moveTo(l.x+f,l.y+h),e.lineTo(c.x+f,c.y+h),e.lineTo(c.x-f,c.y-h),e.lineTo(l.x-f,l.y-h),e.closePath()})}}function Va(e,t,i,n,s){e.save(),ri(e,t,i,n),s(),e.restore()}function Wa(e,t){const i=t.width??40,n=t.hand===!0?{}:t.hand||void 0,s=t.eraser===!1?void 0:t.eraser===!0||t.eraser===void 0?{}:t.eraser;return{...e,props:{...e.props,erase:0},draw(r,o,a){const l=Number(o.props?.erase??0);if(r.save(),ri(r,t.path,i,l),e.draw(r,o,a),r.restore(),!s||l<=0||l>=1)return;const c=ti(t.path,l);n?si(r,c,{...n,tool:"eraser"}):ni(r,c,s)}}}function Ua(e){const{timeline:t}=e,i=new st;for(const[c,u]of Object.entries(e.targets)){const f=typeof u=="string"?document.querySelector(u):u;if(!f)throw new Error(`quickPlay: no element found for target "${c}" (${String(u)})`);i.registerTarget(c,f)}t.onUpdate=c=>{i.applyState(c),e.onUpdate?.(c)},e.onComplete&&(t.onComplete=e.onComplete);let n=null,s=null,r=!1;const o=c=>{if(r)return;const u=s===null?0:c-s;s=c,u>0&&t.tick(u),n=requestAnimationFrame(o)},a=()=>{n!==null||r||(s=null,n=requestAnimationFrame(o))},l=()=>{n!==null&&cancelAnimationFrame(n),n=null,s=null};return i.applyState(t.getStateAtTime(t.currentTime)),e.autoplay!==!1&&(t.play(),a()),{timeline:t,adapter:i,play(){t.play(),a()},pause(){t.pause(),l()},restart(){t.stop(),t.play(),a()},seek(c){t.seek(c*1e3),i.applyState(t.getStateAtTime(t.currentTime))},destroy(){r=!0,l(),t.stop(),i.clearTargets()}}}const Ha={timeline:to,to(e,t,i){const n=new nt(i);return n.to(e,t),n},from(e,t,i){const n=new nt(i);return n.from(e,t),n},fromTo(e,t,i,n){const s=new nt(n);return s.fromTo(e,t,i),s},set(e,t,i){const n=new nt(i);return n.set(e,t),n}},ja=Y.to,za=Y.from,Ga=Y.fromTo,Ka=Y.set,Qa=Y.timeline,Za=Y.ticker,Ja=Y.splitText,tl=Y.context,el=Y.matchMedia,il=Y.quickTo,nl=Y.imageSequence,sl=Y.pageTransition;Aa(),y.Clock=Ls,y.CompatTimeline=nt,y.CustomBounce=Kn,y.CustomEase=Gn,y.CustomWiggle=Qn,y.DEFAULT_BAKE_INTERVAL_MS=ve,y.DEFAULT_INERTIA_FRICTION=ce,y.DEFAULT_LABELS=os,y.DEFAULT_SPRING=V,y.DEFAULT_TRANSITION=Pa,y.Draggable=Be,y.EXPRESSIONS=K,y.FORMAT_VERSION=wt,y.INERTIA_MAX_DURATION_MS=hi,y.InertiaTrackPlayer=Hi,y.LiveTimeline=G,y.MORPH_SAMPLES=er,y.ManualClock=Rs,y.MediaSync=Ze,y.Observer=En,y.POSES=ws,y.REST_POSE=rt,y.SPRING_MAX_DURATION_MS=le,y.SPRING_PRESETS=qt,y.SPRING_STEP_MS=ot,y.ScrollAnimator=Xn,y.ScrollDriver=Rt,y.ScrollMarkers=Vn,y.ScrollPin=Bn,y.SmoothScroll=Ge,y.SpringSampler=kt,y.SpringTrackPlayer=Ui,y.Stage=wn,y.Timeline=Ae,y.TinyflyPlayer=te,y.TinyflySequencer=ps,y.TrackPlayer=jt,y.ValueResolver=Sr,y.VisibilityDriver=On,y.backOut=wi,y.bakeEasing=ke,y.bakeInertiaTrack=Te,y.bakeSpringTrack=we,y.bindChoiceHotspots=hs,y.blendPose=ks,y.boilFrame=gs,y.bounceOut=vi,y.charactersFor=ji,y.circlePath=qa,y.clamp01=Ue,y.clearMorphCache=hr,y.clearPathCache=Ks,y.clipErased=ri,y.containerProgressAt=He,y.context=tl,y.create=ha,y.createControls=ls,y.createCubicBezier=yi,y.createLive=ts,y.createRandom=xe,y.createTrack=Ht,y.criticalDamping=Ds,y.customBounce=on,y.customEase=rn,y.customWiggle=an,y.deserializeTimeline=ft,y.deserializeTrack=Qi,y.draggable=So,y.drawEraser=ni,y.drawHand=si,y.drawPencil=Cs,y.drawStickFigure=xs,y.drawnPathTarget=Ya,y.easeIn=pi,y.easeInCubic=he,y.easeInOut=gi,y.easeInOutCubic=Mt,y.easeInOutQuad=di,y.easeInQuad=ui,y.easeOut=mi,y.easeOutCubic=ue,y.easeOutQuad=fi,y.elasticOut=bi,y.erasable=Wa,y.expandParametricEasings=Vi,y.from=za,y.fromJSON=wr,y.fromTo=Ga,y.getEasingFunction=U,y.getInterpolator=xt,y.getMotionPathPoint=Se,y.getPathLength=Qs,y.getPointAtProgress=Ai,y.gridLinesFor=Cn,y.hasKeyframes=li,y.hashSeed=Ji,y.imageSequence=nl,y.inertiaDuration=lt,y.inertiaRest=at,y.inertiaValueAt=Xt,y.inertiaVelocityAt=qs,y.interpolateArray=qi,y.interpolateColor=Ni,y.interpolateMotionPath=mr,y.interpolateNumber=H,y.interpolatePathString=Yi,y.interpolateString=be,y.isCubicBezierEasing=ai,y.isInertiaTrack=Q,y.isMotionPathPoint=Is,y.isMotionPathTrack=re,y.isParametricEasing=vt,y.isPathData=ht,y.isSpringTrack=Z,y.isTextTrack=Dt,y.isUnderdamped=$s,y.isUnresolved=kr,y.linear=Vt,y.live=Y,y.mapEase=Ct,y.matchMedia=el,y.maxStaggerDistance=ae,y.morphPath=Ri,y.mount=us,y.mountAll=ds,y.narrationMarkers=Ir,y.narrationSceneAt=Rr,y.naturalRest=St,y.pageTransition=sl,y.parametricEasing=ki,y.parseEdge=Ve,y.parsePath=it,y.parseTrigger=We,y.partialPath=yt,y.pathLength=ms,y.planNarration=_r,y.play=ca,y.playSequence=Ea,y.playWhenVisible=Do,y.playheadCrossings=Ee,y.pointAlong=ti,y.pointAtDistance=de,y.pointsToPath=cn,y.pose=W,y.poseTracks=Na,y.quickPlay=Ua,y.quickTo=il,y.randomBetween=Ce,y.randomChoice=Tr,y.randomSnapped=tn,y.resolveSequence=sn,y.resolveValue=_e,y.rubberLimb=Ps,y.scrollProgress=$o,y.scrubOnScroll=qo,y.scrubPath=Xa,y.serializeTimeline=Zi,y.serializeTrack=Gi,y.set=Ka,y.shapeToPathData=zt,y.simplifyKeyframes=Wi,y.sketchPen=ei,y.smoothToward=Dn,y.snapAxis=xn,y.snapConfig=Nn,y.snapDuration=Yn,y.snapProgress=qn,y.splitText=Ja,y.springDuration=ci,y.springValueAt=Fs,y.staggerDistance=oe,y.staggerOffset=Ot,y.staggerOffsets=Bt,y.staggerSpan=Tt,y.stepsEasing=Ti,y.stickFigureTarget=Ba,y.strideLength=Ia,y.syncMediaElement=rs,y.talkingMouth=Ms,y.textAt=zi,y.tf=Ha,y.ticker=Za,y.timeline=Qa,y.to=ja,y.toJSON=vr,y.toKeyframedTrack=dr,y.toKeyframedTracks=pr,y.trackTargets=et,y.triggerDistance=dt,y.unmount=Sa,y.walkPose=Ss,y.withErased=Va,y.withExpression=vs,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})})(this.tinyfly=this.tinyfly||{});
|
|
53
|
+
`;function $l(e){if(e.getElementById(Js))return;const t=e.createElement("style");t.id=Js,t.textContent=Ll,e.head.appendChild(t)}function Qs(e,t){const n=Array.from(t.querySelectorAll("[data-tinyfly-choose]"));if(n.length===0)return()=>{};$l(t.ownerDocument);const i=[],s=[];for(const a of n){const l=a.getAttribute("data-tinyfly-choose")??"",c=[],h=(m,p)=>{a.hasAttribute(m)||(a.setAttribute(m,p),c.push(m))};h("role","button"),h("tabindex","0");const d=e.scenarios.find(m=>m.id===l)?.label;d!==void 0&&h("aria-label",d),a.setAttribute("aria-pressed","false"),c.push("aria-pressed"),i.push({element:a,attributes:c});const u=()=>e.setScenario(l),f=m=>{const p=m.key;p!=="Enter"&&p!==" "||(m.preventDefault(),u())};a.addEventListener("click",u),a.addEventListener("keydown",f),s.push(()=>{a.removeEventListener("click",u),a.removeEventListener("keydown",f)})}const r=()=>{for(const{element:a}of i)a.setAttribute("aria-pressed",String(a.getAttribute("data-tinyfly-choose")===e.scenario))},o=e.subscribe(r);return r(),()=>{o();for(const a of s)a();for(const{element:a,attributes:l}of i)for(const c of l)a.removeAttribute(c)}}const ve=new WeakMap,En=new WeakMap;let Fl=0;function zt(e,t,n){if(e)try{return JSON.parse(e)}catch(i){console.warn(`tinyfly: invalid ${t} JSON on`,n,i);return}}async function Zs(e,t={}){const n=ve.get(e);if(n)return n;const i=Array.from(e.querySelectorAll("script[data-tinyfly-timeline]")),s=i[0],r=e.getAttribute("data-src"),o=Dl(e.getAttribute("data-markers")),a=i.length>1||s?.hasAttribute("data-scenario")?Ol(i,o,e):void 0;if(a&&a.length===0)return;let l=s&&!a?zt(s.textContent,"timeline",e):void 0;if(!l&&r&&o){const f=await fetch(r);f.ok&&(l=await f.json())}if(l&&o&&(l=tr(l,o)),!l&&!r&&!a){console.warn('tinyfly: embed has no timeline (a <script type="application/json" data-tinyfly-timeline> or data-src)',e);return}const c=zt(e.querySelector("script[data-tinyfly-captions]")?.textContent,"captions",e),h={playWhenVisible:!0,...t.player,...c&&{captions:c},...zt(e.getAttribute("data-options"),"data-options",e)};Nl(e);const d=new we(e,h),u={element:e,player:d};if(ve.set(e,u),e.setAttribute("data-tinyfly-mounted",""),a){const f=e.getAttribute("data-scenario")??void 0;await d.loadScenarios(a,{initial:a.some(m=>m.id===f)?f:void 0}),En.set(e,Qs(d,e))}else await d.load(l??r);if(e.getAttribute("data-controls")!=="false"){const f=zt(e.getAttribute("data-labels"),"data-labels",e),m=e.querySelector("figcaption"),p=e.getAttribute("data-scenario-legend"),g=e.getAttribute("data-scenario-control");u.controls=Ks(d,e,{...t.controls,...e.getAttribute("data-fullscreen")==="true"?{fullscreen:!0}:{},...g==="slider"||g==="buttons"?{scenarioControl:g}:{},labels:{...t.controls?.labels,...f,...p?{scenario:p}:{}},mount:void 0}),m?e.insertBefore(u.controls.element,m):e.appendChild(u.controls.element)}return u}function Ol(e,t,n){const i=[];return e.forEach((s,r)=>{const o=zt(s.textContent,"timeline",n);if(!o)return;const a=s.getAttribute("data-scenario")||`scenario-${r+1}`;if(i.some(c=>c.id===a)){console.warn(`tinyfly: scenario id "${a}" is used more than once; the later one is skipped`,n);return}const l=s.getAttribute("data-scenario-label")??void 0;i.push({id:a,label:l,timeline:t?tr(o,t):o})}),i}function tr(e,t){return e.config.markers?.length?e:{...e,config:{...e.config,markers:t.map((n,i)=>({id:`step-${i+1}`,time:n}))}}}function Dl(e){if(!e)return;const t=e.split(/[\s,]+/).filter(Boolean).map(Number).filter(n=>Number.isFinite(n)&&n>=0).sort((n,i)=>n-i);return t.length>0?t:void 0}async function er(e=document,t={}){const n=Array.from(e.querySelectorAll("[data-tinyfly-embed]"));return(await Promise.all(n.map(s=>Zs(s,t)))).filter(s=>s!==void 0)}function Bl(e){const t=ve.get(e);t&&(En.get(e)?.(),En.delete(e),t.controls?.destroy(),t.player.destroy(),ve.delete(e),e.removeAttribute("data-tinyfly-mounted"))}function Nl(e){const t=e.querySelector("svg");if(!t||t.hasAttribute("role")||t.hasAttribute("aria-hidden"))return;const n=e.getAttribute("data-alt"),i=e.querySelector("figcaption");t.setAttribute("role","img"),n?t.setAttribute("aria-label",n):i&&(i.id||=`tinyfly-caption-${++Fl}`,t.setAttribute("aria-labelledby",i.id))}function Yl(){if(!(typeof document<"u"?document.currentScript:null)?.hasAttribute("data-tinyfly-auto"))return;const t=()=>{er()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}class nr{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,n={}){if(typeof t=="string"){const i=document.querySelector(t);if(!i)throw new Error(`Container not found: ${t}`);this.container=i}else this.container=t;this.options=n,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 pt,this.adapterB=new pt}async load(t){let n;if(typeof t=="string"){const i=await fetch(t);if(!i.ok)throw new Error(`Failed to load sequence: ${i.statusText}`);n=await i.json()}else n=t;this.sequence=n,this.symbolDefs.clear();for(const i of n.symbols??[])i.timeline?.tracks?.length&&this.symbolDefs.set(i.id,i.timeline);this.container.style.width=`${n.canvas.width}px`,this.container.style.height=`${n.canvas.height}px`,n.scenes.length>0&&(this.renderScene(n.scenes[0],this.containerA,this.adapterA),this.timelineA=this.createTimeline(n.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 n=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=n?"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 i=this.sequence.scenes[t];if(this.renderScene(i,this.containerA,this.adapterA),this.timelineA=this.createTimeline(i),this.options.onSceneChange?.(t),n)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 n of t)n.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,n,i){n.innerHTML="",i.clearTargets();const s=document.createElement("div");s.style.cssText="position:absolute;inset:0;transform-origin:center center",s.setAttribute("data-tinyfly","Camera"),n.appendChild(s),i.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 l=a.getAttribute("data-tinyfly");l&&i.registerTarget(l,a)}}this.setupNested(s,i)}setupNested(t,n){const i=[];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 pt;s.querySelectorAll("[data-tinyfly]").forEach(l=>{const c=l.getAttribute("data-tinyfly");c&&a.registerTarget(c,l)}),i.push({adapter:a,timeline:xt(o)})}),i.length?this.nestedByAdapter.set(n,i):this.nestedByAdapter.delete(n)}applyNested(t,n){const i=this.nestedByAdapter.get(t);if(i)for(const s of i){const r=s.timeline.duration;s.adapter.applyState(s.timeline.getStateAtTime(r>0?n%r:n))}}clearContainer(t){t.innerHTML=""}createTimeline(t){return t.timeline?xt(t.timeline):null}onSceneComplete(){if(this._isDestroyed||!this.sequence)return;const t=this._currentSceneIndex+1;if(t>=this.sequence.scenes.length){const n=this.options.loop??this.sequence.loop??0;n===-1||n>0&&this.loopIteration<n-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 n=this.sequence.scenes[t],i=n.transition;if(i.type==="none"||i.duration<=0){this.switchToScene(t);return}this._state="transitioning",this.containerB.style.visibility="visible",this.renderScene(n,this.containerB,this.adapterB),this.timelineB=this.createTimeline(n),this.timelineB&&this.timelineB.play(),this.applyTransition(i.type,i.duration),this.transitionTimer=window.setTimeout(()=>{this.finishTransition(t)},i.duration)}applyTransition(t,n){const i=`${n}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 ${i} ${s}, transform ${i} ${s}`,this.containerB.style.transition=`opacity ${i} ${s}, transform ${i} ${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 n=this.containerA;this.containerA=this.containerB,this.containerB=n;const i=this.adapterA;this.adapterA=this.adapterB,this.adapterB=i,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 n=this.sequence.scenes[t];this.renderScene(n,this.containerA,this.adapterA),this.timelineA=this.createTimeline(n),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=n=>{if(this._isDestroyed||!this._isPlaying)return;const i=n-(this.lastTime??n);if(this.lastTime=n,this.timelineA&&this.timelineA.playbackState==="playing"){this.timelineA.tick(i);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(i);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 Wl(e,t,n={}){const i=new nr(e,{...n,autoplay:!0});return await i.load(t),i}const ql={type:"none",duration:0};function ir(e){let t=0;for(let n=1;n<e.length;n++)t+=Math.hypot(e[n].x-e[n-1].x,e[n].y-e[n-1].y);return t}function Ct(e,t){const n=Math.min(1,Math.max(0,t));if(e.length<2||n===1)return e.slice();if(n===0)return e.slice(0,1);let i=ir(e)*n;const s=[e[0]];for(let r=1;r<e.length;r++){const o=e[r-1],a=e[r],l=Math.hypot(a.x-o.x,a.y-o.y);if(l>=i){const c=l===0?0:i/l;return s.push({x:o.x+(a.x-o.x)*c,y:o.y+(a.y-o.y)*c}),s}s.push(a),i-=l}return s}function Pn(e,t){const n=Ct(e,t);return n[n.length-1]}function _n(e,t){return t>0?Math.floor(Math.max(0,e)*t/1e3):0}function Te(e,t,n){const i=t.roughness??2,s=Math.max(1,Math.round(t.passes??2)),r=_n(n,t.boil??8);let o=0;const a=()=>{const u=o++;return f=>fe(en(`${t.seed??1}:${r}:${u}:${f}`))},l=(u,f)=>(u.next()*2-1)*f,c=u=>{const f=a(),m=e.lineWidth,p=e.globalAlpha;for(let g=0;g<s;g++)e.lineWidth=g===0?m:m*.55,e.globalAlpha=g===0?p:p*.6,u(f(g));e.lineWidth=m,e.globalAlpha=p},h=(u,f=1)=>{if(u.length<2)return;const m=u.slice(1).map((g,y)=>Math.hypot(g.x-u[y].x,g.y-u[y].y)),p=m.reduce((g,y)=>g+y,0)*Math.min(1,Math.max(0,f));c(g=>{const y=[],v=[];if(u.forEach((k,T)=>{y.push({x:k.x+l(g,i*.5),y:k.y+l(g,i*.5)}),T>0&&v.push([g.next()*2-1,g.next()*2-1])}),p<=0)return;e.beginPath(),e.moveTo(y[0].x,y[0].y);let w=0;for(let k=1;k<y.length;k++){const T=Xl(y[k-1],y[k],i,v[k-1]),M=m[k-1];if(w+M<=p){e.bezierCurveTo(T[1].x,T[1].y,T[2].x,T[2].y,T[3].x,T[3].y),w+=M;continue}const x=Hl(T,M===0?1:(p-w)/M);e.bezierCurveTo(x[1].x,x[1].y,x[2].x,x[2].y,x[3].x,x[3].y);break}e.stroke()})},d=(u,f,m,p,g=1)=>{c(y=>{const w=y.next()*Math.PI*2,k=Math.PI*2+.15+y.next()*.3,T=[];for(let x=0;x<=14;x++){const C=w+k*x/14,L=l(y,i*.6);T.push({x:u+Math.cos(C)*(m+L),y:f+Math.sin(C)*(p+L)})}const M=Ct(T,g);M.length<2||(sr(e,M),e.stroke())})};return{line:h,curve(u,f=1){if(u.length<2)return;const m=u[0],p=u[u.length-1],g=Math.hypot(p.x-m.x,p.y-m.y)||1,y=-(p.y-m.y)/g,v=(p.x-m.x)/g;c(w=>{const k={x:l(w,i*.5),y:l(w,i*.5)},T={x:l(w,i*.5),y:l(w,i*.5)},M=l(w,i*Math.min(1.5,Math.max(.3,g/80))),x=u.map((L,I)=>{const A=I/(u.length-1),E=Math.sin(Math.PI*A)*M;return{x:L.x+k.x+(T.x-k.x)*A+y*E,y:L.y+k.y+(T.y-k.y)*A+v*E}}),C=Ct(x,f);C.length<2||(sr(e,C),e.stroke())})},circle(u,f,m,p=1){d(u,f,m,m,p)},ellipse:d,nudge(u=.5){const f=a()(0);return{x:l(f,i*u),y:l(f,i*u)}}}}function Xl(e,t,n,i){const s=t.x-e.x,r=t.y-e.y,o=Math.hypot(s,r)||1,a=n*Math.min(1.5,Math.max(.3,o/80)),l=-r/o,c=s/o;return[e,{x:e.x+s/3+l*i[0]*a,y:e.y+r/3+c*i[0]*a},{x:e.x+2*s/3+l*i[1]*a,y:e.y+2*r/3+c*i[1]*a},t]}function Hl([e,t,n,i],s){const r=(d,u)=>({x:d.x+(u.x-d.x)*s,y:d.y+(u.y-d.y)*s}),o=r(e,t),a=r(t,n),l=r(n,i),c=r(o,a),h=r(a,l);return[e,o,c,r(c,h)]}function sr(e,t){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let i=1;i<t.length-1;i++){const s={x:(t[i].x+t[i+1].x)/2,y:(t[i].y+t[i+1].y)/2};e.quadraticCurveTo(t[i].x,t[i].y,s.x,s.y)}const n=t[t.length-1];e.lineTo(n.x,n.y)}function Gt(e,t,n){const i=e.length;if(i<2)return[];const s=[],r=[],o=a=>t+(n-t)*a/(i-1);return e.forEach((a,l)=>{const c=e[Math.max(0,l-1)],h=e[Math.min(i-1,l+1)],d=Math.hypot(h.x-c.x,h.y-c.y)||1,u=o(l)/2,f=-(h.y-c.y)/d*u,m=(h.x-c.x)/d*u;s.push({x:a.x+f,y:a.y+m}),r.push({x:a.x-f,y:a.y-m})}),[...s,...r.reverse()]}function Cn(e,t,n,i){const s=t.length;if(s<2)return;const r=Gt(t,n,i),o=a=>n+(i-n)*a/(s-1);e.beginPath(),e.moveTo(r[0].x,r[0].y);for(const a of r.slice(1))e.lineTo(a.x,a.y);e.closePath(),e.fill(),t.forEach((a,l)=>{l!==0&&l!==s-1&&s>3||(e.beginPath(),e.arc(a.x,a.y,o(l)/2,0,Math.PI*2),e.fill())})}function gt(e,t,n,i,s=16){const r={x:2*t.x-(e.x+n.x)/2,y:2*t.y-(e.y+n.y)/2},o=[];for(let a=0;a<=s;a++){const l=a/s,c=l<.5?{x:e.x+(t.x-e.x)*2*l,y:e.y+(t.y-e.y)*2*l}:{x:t.x+(n.x-t.x)*(2*l-1),y:t.y+(n.y-t.y)*(2*l-1)},h=1-l,d={x:h*h*e.x+2*h*l*r.x+l*l*n.x,y:h*h*e.y+2*h*l*r.y+l*l*n.y};o.push({x:c.x+(d.x-c.x)*i,y:c.y+(d.y-c.y)*i})}return o}const yt={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,stretch:1,turn:0,sit:0};function X(e){return{...yt,...e}}const rr={mouth:0,smile:0,mouthWidth:1,leftEye:1,rightEye:1,leftBrow:0,rightBrow:0,browTilt:0,lookX:0,lookY:0},W=e=>({...rr,...e}),Z={neutral:rr,happy:W({smile:.9,leftBrow:.2,rightBrow:.2}),joyful:W({mouth:.6,smile:1,mouthWidth:1.2,leftEye:0,rightEye:0,leftBrow:.4,rightBrow:.4}),sad:W({smile:-.8,leftEye:.8,rightEye:.8,browTilt:.9,leftBrow:-.1,rightBrow:-.1,lookY:.6}),crying:W({mouth:.45,smile:-1,leftEye:0,rightEye:0,browTilt:1,lookY:.4}),surprised:W({mouth:.7,mouthWidth:.7,leftEye:1.5,rightEye:1.5,leftBrow:1,rightBrow:1}),shocked:W({mouth:1,mouthWidth:.8,leftEye:1.6,rightEye:1.6,leftBrow:1,rightBrow:1,browTilt:.4}),angry:W({smile:-.6,mouthWidth:.9,leftEye:.8,rightEye:.8,leftBrow:-.6,rightBrow:-.6,browTilt:-1}),furious:W({mouth:.5,smile:-1,mouthWidth:1.3,leftEye:.9,rightEye:.9,leftBrow:-.9,rightBrow:-.9,browTilt:-1}),worried:W({smile:-.3,mouthWidth:.8,leftEye:1.1,rightEye:1.1,leftBrow:.3,rightBrow:.3,browTilt:.8,lookX:-.5}),scared:W({mouth:.35,smile:-.5,mouthWidth:.8,leftEye:1.45,rightEye:1.45,leftBrow:.8,rightBrow:.8,browTilt:.9}),confused:W({smile:-.2,mouthWidth:.8,leftEye:.9,rightEye:1.15,leftBrow:-.3,rightBrow:.8,lookX:.5,lookY:-.4}),skeptical:W({smile:-.1,leftEye:.6,rightEye:1,leftBrow:-.4,rightBrow:.7,lookX:.4}),thinking:W({smile:0,mouthWidth:.7,leftBrow:.3,rightBrow:.5,lookX:.6,lookY:-.8}),sleepy:W({smile:.1,leftEye:.25,rightEye:.25,leftBrow:-.3,rightBrow:-.3,lookY:.5}),disgusted:W({smile:-.7,mouthWidth:.9,leftEye:.6,rightEye:.75,leftBrow:-.5,rightBrow:-.2,browTilt:-.4,lookX:-.6}),smug:W({smile:.6,mouthWidth:.9,leftEye:.6,rightEye:.6,leftBrow:.1,rightBrow:.5,lookX:.5}),wink:W({smile:.9,leftEye:0,rightEye:1,leftBrow:-.2,rightBrow:.3})};function or(e,t){return{...e,...typeof t=="string"?Z[t]:t}}const ar={rest:yt,wave:X({rightShoulder:135,rightElbow:30,headTilt:6,...Z.happy}),cheer:X({leftShoulder:125,leftElbow:20,rightShoulder:125,rightElbow:20,...Z.joyful}),shrug:X({leftShoulder:30,leftElbow:85,rightShoulder:30,rightElbow:85,headTilt:-10,...Z.confused,lookX:0,lookY:0}),point:X({rightShoulder:90,rightElbow:0,lean:4,smile:.4}),think:X({rightShoulder:60,rightElbow:150,headTilt:10,...Z.thinking}),handsOnHips:X({leftShoulder:45,leftElbow:-100,rightShoulder:45,rightElbow:-100,leftHip:14,rightHip:14,smile:.8}),sad:X({leftShoulder:14,rightShoulder:14,leftElbow:-4,rightElbow:-4,headTilt:-14,lean:-3,...Z.sad}),surprised:X({leftShoulder:70,leftElbow:60,rightShoulder:70,rightElbow:60,...Z.surprised}),crouch:X({stretch:.72,leftShoulder:35,rightShoulder:35,leftElbow:-50,rightElbow:-50,leftHip:22,rightHip:22,headTilt:-4}),sit:X({sit:1,turn:.5,leftShoulder:-25,rightShoulder:25,leftElbow:-55,rightElbow:55}),jump:X({stretch:1.22,leftShoulder:140,rightShoulder:140,leftElbow:20,rightElbow:20,leftHip:4,rightHip:4,...Z.joyful})},lr=Object.keys(yt);function cr(e,t,n){const i={...e};for(const s of lr)i[s]=e[s]+(t[s]-e[s])*n;return i}const In=24,hr=4,ur=28,Vl=40;function fr(e,t=yt,n=1){const i=Math.sin(e*Math.PI*2)*n,s=Math.cos(e*Math.PI*2)*n,r=c=>c<=Vl,o=c=>r(c)?22*i:c,a=r(t.leftShoulder)?t.leftElbow-ur*Math.max(0,-i):t.leftElbow,l=r(t.rightShoulder)?t.rightElbow+ur*Math.max(0,i):t.rightElbow;return{...t,lean:t.lean+hr*n,headTilt:t.headTilt-hr*.5*n,leftElbow:a,rightElbow:l,leftHip:-In*i,rightHip:-In*i,leftKnee:-30*Math.max(0,s),rightKnee:30*Math.max(0,-s),leftShoulder:o(t.leftShoulder),rightShoulder:o(t.rightShoulder)}}function Ul(e,t=1){return 4*((Rn+ke)*e)*Math.sin(In*t*Math.PI/180)}function dr(e){const t=Math.abs(Math.sin(e/65)),n=.55+.45*Math.sin(e/310);return t*n}const mr=.12,pr=.46,jl=1-2*mr,zl=.1,Gl=.21,Kl=.19,Rn=.24,ke=.22,gr=.12,Jl=.14,yr=.33,br=.7,wr=.3,Ql=.35,Zl=[1.7,1.05],tc=[1.3,.75],vr=[1.45,.85],ec=[1.15,.75],Tr=.06,nc=.7,ic=.65,sc=.3,rc=.02,oc=.012,ac=12,lc=.25,Me=90,cc=.25,hc=.01,It=e=>Math.min(1,Math.max(0,e??0));function uc(e,t=1){return ke*e*t}const Ln=-.12,kr=.4,nt=e=>e*Math.PI/180,fc=(e,t)=>({x:t*Math.sin(nt(e)),y:Math.cos(nt(e))}),Mr=(e,t)=>Math.max(0,e)*(1-Math.min(1,Math.max(0,t))),Sr=(e,t,n,i)=>e-.3*t-n*.14*t-Math.max(0,i-1)*.12*t;function dc(e,t,n,i,s,r){const o=Math.max(1,Math.min(r*.6,Jl*n)),a=It(t.turn),l=(gr+yr*a)*n,c=i+Ln*n,h=l+t.lookX*.08*n,d=t.lookY*.07*n,u=[{x:-.34*n*(1-br*a),squeeze:1-br*a,open:t.leftEye,brow:t.leftBrow,side:-1},{x:.34*n*(1-wr*a),squeeze:1-wr*a,open:t.rightEye,brow:t.rightBrow,side:1}];e.fillStyle=s,e.strokeStyle=s,e.lineWidth=o;for(const y of u){const v=Mr(y.open,t.blink);if(v<.2){const M=t.smile>.5?-.12*n:.06*n;e.beginPath(),e.moveTo(y.x+l-.12*n,c),e.quadraticCurveTo(y.x+l,c+M,y.x+l+.12*n,c),e.stroke()}else{if(v>1.2){const x=.13*n*v;e.beginPath(),e.ellipse(y.x+l,c,x*.85,x,0,0,Math.PI*2),e.fillStyle="#ffffff",e.fill(),e.stroke(),e.fillStyle=s}const M=v>1.2?.075*n:.1*n;e.beginPath(),e.ellipse(y.x+h,c+d,M,M*1.1*Math.min(v,1),0,0,Math.PI*2),e.fill()}const w=Sr(c,n,y.brow,v),k=y.x+l-y.side*.13*n*y.squeeze,T=y.x+l+y.side*.13*n*y.squeeze;e.beginPath(),e.moveTo(T,w),e.lineTo(k,w-t.browTilt*.1*n),e.stroke()}const f=i+kr*n,m=.25*n*Math.max(.3,t.mouthWidth)*(1-Ql*a),p=Math.min(1,Math.max(0,t.mouth));if(e.beginPath(),p<=.05){e.moveTo(l-m,f),e.quadraticCurveTo(l,f+t.smile*.25*n,l+m,f),e.stroke();return}const g=.3*n*p;t.smile>.3?(e.moveTo(l-m,f-.05*n),e.lineTo(l+m,f-.05*n),e.quadraticCurveTo(l,f+g*2,l-m,f-.05*n)):t.smile<-.3?(e.moveTo(l-m,f+g*.6),e.lineTo(l+m,f+g*.6),e.quadraticCurveTo(l,f-g*1.4,l-m,f+g*.6)):e.ellipse(l,f,m*.8,g,0,0,Math.PI*2),e.fill()}function xr(e,t){const n=t.height??300,i=Math.min(3,Math.max(.3,e.stretch??1)),s=Math.sqrt(i),r=(t.headSize??2*mr)/2,o=t.headSize===void 0?jl:1-2*r,a=r*n,l=It(e.sit),c=e.leftHip+(-Me-e.leftHip)*l,h=e.leftKnee+(-Me-e.leftKnee)*l,d=e.rightHip+(Me-e.rightHip)*l,u=e.rightKnee+(Me-e.rightKnee)*l,f=t.classic===!0,m=It(e.turn),p=(E,S,_)=>{const P=nt(S-_)/2,R=m+(1-m)*E*nc;return f?{x:0,y:0}:{x:Math.cos(P)*Tr*R,y:Math.abs(Math.sin(P))*Tr}};let g=0;if(l>0||!f){const E=(P,R,$)=>Rn*Math.cos(nt(R))+ke*Math.cos(nt(R-$))+p(P,R,$).y,S=Math.max(E(-1,c,h),E(1,d,u)),_=f?Math.min(1,l/cc):1;g=(pr-S)*_*n*i}const y=-pr*n*i+g,v=-o*n*i+g,w=f?0:(rc*It(e.turn)+oc*l)*n*i,k=w===0?[{x:0,y},{x:0,y:v}]:gt({x:0,y},{x:-w,y:(y+v)/2},{x:0,y:v},1,8),T=v+zl*n*i,M=(t.shoulderWidth??0)*n*Math.cos(m*Math.PI/2),x=(E,S,_,P,R)=>{const $=fc(_,P);return{x:E+$.x*R*n,y:S+$.y*R*n}},C=(E,S,_)=>{const P=x(0,y,S,E,Rn*i);return{root:{x:0,y},joint:P,end:x(P.x,P.y,S-_,E,ke*i)}},L=(E,S,_)=>{const P={x:E*M,y:T},R=x(P.x,P.y,S,E,Gl*s);return{root:P,joint:R,end:x(R.x,R.y,S+_,E,Kl*s)}},I={left:C(-1,c,h),right:C(1,d,u)},A=(E,S,_,P)=>{const R=p(E,_,P);return{x:S.end.x+R.x*n*i,y:S.end.y+R.y*n*i}};return{height:n,facing:(t.facing??1)<0?-1:1,stretch:i,lineWidth:t.lineWidth??n*.025,rubber:Math.min(1,Math.max(f?0:sc,t.rubber??0)),r:a,headRx:a/Math.sqrt(i),headRy:a*Math.sqrt(i),hipY:y,neckY:v,drop:g,lean:f?e.lean:e.lean+ac*Math.sin(Math.PI*l),classic:f,legs:I,toes:{left:A(-1,I.left,c,h),right:A(1,I.right,d,u)},spine:k,arms:{left:L(-1,e.leftShoulder,e.leftElbow),right:L(1,e.rightShoulder,e.rightElbow)}}}const Kt=(e,t)=>t===0?[e.root,e.joint,e.end]:gt(e.root,e.joint,e.end,t);function $n(e,t,n){const i=Math.cos(n),s=Math.sin(n),r=e.x-t.x,o=e.y-t.y;return{x:t.x+r*i-o*s,y:t.y+r*s+o*i}}function Ar(e,t){const n=nt(e.lean),i=nt(t.headTilt),s={x:0,y:e.hipY},r=y=>({x:e.facing*y.x,y:y.y}),o=y=>r($n(y,s,n)),a=y=>o($n({x:y.x,y:y.y+e.neckY},{x:0,y:e.neckY},i)),l=Kt(e.arms.left,e.rubber).map(o),c=Kt(e.arms.right,e.rubber).map(o),h=y=>{const[v,w]=y.slice(-2);return Math.atan2(w.y-v.y,w.x-v.x)};let d=1/0;for(const[y,v]of[[t.leftBrow,t.leftEye],[t.rightBrow,t.rightEye]]){const w=Sr(Ln,1,y,Mr(v,t.blink));d=Math.min(d,w,w-t.browTilt*.1)}const u={left:r(e.legs.left.end),right:r(e.legs.right.end)},f={left:r(e.toes.left),right:r(e.toes.right)},m={left:Math.max(u.left.y,f.left.y),right:Math.max(u.right.y,f.right.y)},p=Math.max(m.left,m.right),g=hc*e.height;return{facing:e.facing,height:e.height,stretch:e.stretch,lineWidth:e.lineWidth,hip:s,neck:o({x:0,y:e.neckY}),shoulders:{left:o(e.arms.left.root),right:o(e.arms.right.root)},elbows:{left:o(e.arms.left.joint),right:o(e.arms.right.joint)},hands:{left:o(e.arms.left.end),right:o(e.arms.right.end)},knees:{left:r(e.legs.left.joint),right:r(e.legs.right.joint)},feet:u,toes:f,feetY:p,grounded:{left:m.left>=p-g,right:m.right>=p-g},handAngle:{left:h(l),right:h(c)},limbs:{leftArm:l,rightArm:c,leftLeg:Kt(e.legs.left,e.rubber).map(r),rightLeg:Kt(e.legs.right,e.rubber).map(r),spine:e.spine.map(o)},head:{center:a({x:0,y:-e.headRy}),rx:e.headRx,ry:e.headRy,angle:e.facing*(n+i),eyeY:Ln,browTopY:d,mouthY:kr,faceX:e.facing*(gr+yr*It(t.turn))}}}function Er(e,t={}){return Ar(xr(e,t),e)}function mc(e,t,n){return $n({x:e.center.x+t*e.rx,y:e.center.y+n*e.ry},e.center,e.angle)}function Pr(e,t,n){const i=r=>({x:r.x+t,y:r.y+n}),s=r=>({left:i(r.left),right:i(r.right)});return{...e,hip:i(e.hip),neck:i(e.neck),shoulders:s(e.shoulders),elbows:s(e.elbows),hands:s(e.hands),knees:s(e.knees),feet:s(e.feet),toes:s(e.toes),feetY:e.feetY+n,grounded:{...e.grounded},handAngle:{...e.handAngle},limbs:{leftArm:e.limbs.leftArm.map(i),rightArm:e.limbs.rightArm.map(i),leftLeg:e.limbs.leftLeg.map(i),rightLeg:e.limbs.rightLeg.map(i),spine:e.limbs.spine.map(i)},head:{...e.head,center:i(e.head.center)}}}function _r(e,t,n={},i=0){const s=xr(t,n),r=n.color??"#1e293b",o=n.layers??{},a=n.layers?Ar(s,t):void 0,l=n.sketch?Te(e,n.sketch,i):void 0,c=n.sketch&&n.layers?Te(e,n.sketch,i):void 0,h=k=>{e.save(),k(),e.restore()},d=k=>{k&&a&&h(()=>k(e,a,i,c))},u=()=>e.scale(s.facing,1),f=()=>{u(),e.translate(0,s.hipY),e.rotate(nt(s.lean)),e.translate(0,-s.hipY)},m=(k,T,M)=>{if(l)return T?l.curve(k):l.line(k);if(s.classic){e.beginPath(),e.moveTo(k[0].x,k[0].y);for(const x of k.slice(1))e.lineTo(x.x,x.y);e.stroke();return}Cn(e,k,M[0]*s.lineWidth,M[1]*s.lineWidth)},p=(k,T)=>m(Kt(k,s.rubber),s.rubber>0,T),g=k=>{s.classic||m([s.legs[k].end,s.toes[k]],!1,ec)},y=k=>{if(s.classic||l)return;const T=s.arms[k].end;e.beginPath(),e.arc(T.x,T.y,ic*s.lineWidth,0,Math.PI*2),e.fill()};e.save(),e.strokeStyle=r,e.fillStyle=r,e.lineWidth=s.lineWidth,e.lineCap="round",e.lineJoin="round";const v=k=>{h(()=>{f(),p(s.arms[k],tc),y(k)});const T=o.sleeve;T&&a&&h(()=>T(e,a,k,i,c))},w=It(t.turn)>lc;d(o.behind),h(()=>{u(),p(s.legs.left,vr),g("left"),p(s.legs.right,vr),g("right")}),w&&v("left"),h(()=>{f(),m(s.spine,s.spine.length>2,Zl);const{left:k,right:T}={left:s.arms.left.root,right:s.arms.right.root};if(k.x!==T.x)if(s.classic)m([k,T],!1,[1,1]);else{const M={x:(k.x+T.x)/2,y:k.y-.3*Math.abs(T.x-k.x)};m(gt(k,M,T,1,8),!0,[1.1,1.1])}}),d(o.body),w||v("left"),v("right"),d(o.behindHead),h(()=>{f(),e.translate(0,s.neckY),e.rotate(nt(t.headTilt));const k=-s.headRy;e.beginPath(),e.ellipse(0,k,s.headRx,s.headRy,0,0,Math.PI*2);const T=n.headFill??"#ffffff";if(T!=="none"&&(e.fillStyle=T,e.fill()),l){l.ellipse(0,k,s.headRx,s.headRy);const M=l.nudge();e.translate(M.x,M.y)}else e.stroke();e.translate(0,k),e.scale(s.headRx/s.r,s.headRy/s.r),dc(e,t,s.r,0,r,s.lineWidth)}),d(o.overHead),d(o.front),e.restore(),n.label&&(e.save(),e.fillStyle=r,e.font=n.labelFont??`700 ${Math.round(s.height*.11)}px sans-serif`,e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,0,-s.height*s.stretch-.04*s.height+s.drop),e.restore())}function Fn(e,t){const n={...e};let i=e.walking>0?cr(n,fr(e.walk,n),e.walking):n;return e.talk>0&&(i={...i,mouth:Math.max(i.mouth,e.talk*dr(t))}),i}function pc(e){const t=e.style??{},n=t.height??300,i=n*.8,s={...X(e.pose??{}),walk:0,walking:0,talk:0,rubber:t.rubber??0};return{type:"custom",x:e.x-i/2,y:e.y-n,width:i,height:n,props:{...s},figureStyle:t,draw(r,o,a){const l=o.props;r.translate(i/2,n),_r(r,Fn(l,a),{...t,rubber:l.rubber},a)}}}function gc(e,t,n){const i=e.figureStyle;if(!i)throw new Error("stickFigureAt: the target was not made by stickFigureTarget");const s={...e.props};let r=0,o=0;for(const[c,h]of t.state?.values.get(n)??[])typeof h=="number"&&(c==="x"||c==="motionPathX"?r=h:c==="y"||c==="motionPathY"?o=h:c in s&&(s[c]=h));const a=Fn(s,t.time),l=Er(a,{...i,rubber:s.rubber});return{pose:a,joints:Pr(l,e.x+r+e.width/2,e.y+o+e.height)}}function yc(e,t){const n=[];return t.forEach((i,s)=>{const r=s===0?yt:n[s-1],o=typeof i.pose=="string"?ar[i.pose]:{...r,...i.pose};n.push(i.expression?or(o,i.expression):o)}),lr.filter(i=>n.some(s=>s[i]!==yt[i])).map(i=>({id:`${e}-${i}`,target:e,property:i,keyframes:t.map((s,r)=>({time:s.time,value:n[r][i],...s.easing?{easing:s.easing}:{}}))}))}function Cr(e,t,n={},i){const s=n.length??240,r=9,o=28,a=s-22;e.save(),e.translate(t.x,t.y),e.rotate((n.angle??-30)*Math.PI/180),e.fillStyle=n.color??"#f4c542",e.fillRect(o,-r,a-o,2*r),e.fillStyle="#e8b4a0",e.fillRect(a,-r,s-a,2*r),e.fillStyle="#f1dcbf",e.beginPath(),e.moveTo(0,0),e.lineTo(o,-r),e.lineTo(o,r),e.closePath(),e.fill(),e.fillStyle=n.outline??"#2f2f33",e.beginPath(),e.moveTo(0,0),e.lineTo(o*.35,-r*.35),e.lineTo(o*.35,r*.35),e.closePath(),e.fill(),e.strokeStyle=n.outline??"#2f2f33",e.lineWidth=3,e.lineJoin="round",e.lineCap="round";const l=[[{x:0,y:0},{x:o,y:-r},{x:s,y:-r},{x:s,y:r},{x:o,y:r},{x:0,y:0}],[{x:o,y:-r},{x:o,y:r}],[{x:a,y:-r},{x:a,y:r}]];for(const c of l)Ir(e,c,i);e.restore()}function On(e,t,n={},i){const s=n.length??90,r=n.thickness??34;e.save(),e.translate(t.x,t.y),e.rotate((n.angle??-35)*Math.PI/180);const o=-r/2;e.fillStyle=n.color??"#f4a7b9",e.fillRect(0,o,s,r),e.fillStyle="#e9edf2",e.fillRect(s*.45,o,s*.55,r),e.strokeStyle=n.outline??"#2f2f33",e.lineWidth=3,e.lineJoin="round";const a=[{x:0,y:o},{x:s,y:o},{x:s,y:-o},{x:0,y:-o},{x:0,y:o}],l=[{x:s*.45,y:o},{x:s*.45,y:-o}];if(i)i.line(a),i.line(l);else for(const c of[a,l]){e.beginPath(),e.moveTo(c[0].x,c[0].y);for(const h of c.slice(1))e.lineTo(h.x,h.y);e.stroke()}e.restore()}function Dn(e,t,n={},i){const s=n.tool??"pencil",r=n.skin??"#f1c9a5",o=n.outline??"#2f2f33",a=s==="eraser"?17:9,l=s==="eraser"?-40:0,c=i?i.nudge(.6):{x:0,y:0};e.save(),e.translate(t.x+c.x,t.y+c.y),e.rotate((n.angle??-30)*Math.PI/180),e.scale(n.scale??1,n.scale??1),e.lineCap="round",e.lineJoin="round";const h=(f,m,p,g)=>{for(const[y,v]of[[o,p+6],[g,p]])e.strokeStyle=y,e.lineWidth=v,e.beginPath(),e.moveTo(f.x,f.y),e.lineTo(m.x,m.y),e.stroke()};e.save(),e.translate(l,0);const d={x:165,y:-a-26},u=f=>({x:d.x+f*.8,y:d.y+f*.6});h(d,u(2e3),64,r),h(u(110),u(2e3),92,n.sleeve??"#5b7db1"),e.fillStyle=r,e.strokeStyle=o,e.lineWidth=3,e.beginPath(),e.ellipse(d.x,d.y,54,40,.25,0,Math.PI*2),e.fill(),e.stroke(),e.restore(),s==="eraser"?On(e,{x:0,y:0},{angle:0,outline:o},i):Cr(e,{x:0,y:0},{angle:0,outline:o},i),e.translate(l,0),h({x:150,y:a+8},{x:92,y:a+12},22,r),h({x:140,y:-a-18},{x:58,y:-a-6},20,r),h({x:150,y:-a-30},{x:112,y:-a+2},20,r),h({x:172,y:-a-30},{x:140,y:-a+4},20,r),e.restore()}function bc(e,t,n,i=.08,s=32){const r=Math.PI*2*(1+i),o=[];for(let a=0;a<=s;a++){const l=-Math.PI/2+r*a/s;o.push({x:e+Math.cos(l)*n,y:t+Math.sin(l)*n})}return o}function wc(e){const{path:t}=e,n=t.map(a=>a.x),i=t.map(a=>a.y),s=Math.min(...n),r=Math.min(...i),o=e.hand===!1?void 0:e.hand===!0||e.hand===void 0?{}:e.hand;return{type:"custom",x:s,y:r,width:Math.max(1,Math.max(...n)-s),height:Math.max(1,Math.max(...i)-r),props:{draw:0},draw(a,l,c){const h=Math.min(1,Math.max(0,Number(l.props?.draw??0)));a.translate(-s,-r),a.strokeStyle=e.color??"#2f2f33",a.lineWidth=e.lineWidth??5,a.lineCap="round",a.lineJoin="round";const d=e.sketch?Te(a,e.sketch,c):void 0;h>0&&(d?e.smooth?d.curve(t,h):d.line(t,h):Ir(a,Ct(t,h))),o&&h>0&&h<1&&Dn(a,Pn(t,h),o,d)}}}function Ir(e,t,n){if(!(t.length<2)){if(n)return n.line(t);e.beginPath(),e.moveTo(t[0].x,t[0].y);for(const i of t.slice(1))e.lineTo(i.x,i.y);e.stroke()}}const Se=1e5;function vc(e,t,n,i,s=6){const r=[],o=Math.max(1,Math.round(s));for(let a=0;a<=o;a++)r.push({x:a%2===0?e:e+n,y:t+i*a/o});return r}function Bn(e,t,n,i){if(i<=0||t.length===0)return;const s=Ct(t,i),r=n/2,o=a=>{e.beginPath(),e.rect(-Se,-Se,2*Se,2*Se),a(),e.clip("evenodd")};for(const a of s)o(()=>{e.moveTo(a.x+r,a.y),e.arc(a.x,a.y,r,0,Math.PI*2)});for(let a=1;a<s.length;a++){const l=s[a-1],c=s[a],h=Math.hypot(c.x-l.x,c.y-l.y);if(h===0)continue;const d=-(c.y-l.y)/h*r,u=(c.x-l.x)/h*r;o(()=>{e.moveTo(l.x+d,l.y+u),e.lineTo(c.x+d,c.y+u),e.lineTo(c.x-d,c.y-u),e.lineTo(l.x-d,l.y-u),e.closePath()})}}function Tc(e,t,n,i,s){e.save(),Bn(e,t,n,i),s(),e.restore()}function kc(e,t){const n=t.width??40,i=t.hand===!0?{}:t.hand||void 0,s=t.eraser===!1?void 0:t.eraser===!0||t.eraser===void 0?{}:t.eraser;return{...e,props:{...e.props,erase:0},draw(r,o,a){const l=Number(o.props?.erase??0);if(r.save(),Bn(r,t.path,n,l),e.draw(r,o,a),r.restore(),!s||l<=0||l>=1)return;const c=Pn(t.path,l);i?Dn(r,c,{...i,tool:"eraser"}):On(r,c,s)}}}const ht=e=>e*Math.PI/180;function Rr([e,t,n],i){const s=Math.cos(i),r=Math.sin(i);return[e,t*s+n*r,-t*r+n*s]}function Lr([e,t,n],i){const s=Math.cos(i),r=Math.sin(i);return[e*s-t*r,e*r+t*s,n]}function Jt([e,t,n],i){const s=Math.cos(i),r=Math.sin(i);return[e*s+n*r,t,-e*r+n*s]}const Nn=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],$r=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],xe=(e,t)=>Lr(Rr(e,t.swing),t.spread);function Yn(e,t){const n=Jt(e,t);return{point:{x:n[0],y:-n[1]},depth:n[2]}}function Wn(e,t,n){const i=n.height,s=ht(90*(t.turn??0)),o=[0,e.hipHeight*i*(e.boneScale?.(t,null)??1),0],a={};for(const S of e.chains){const _=S.parent?a[S.parent]:void 0;if(S.parent&&!_)throw new Error(`body plan ${e.id}: chain ${S.id} comes before its parent ${S.parent}`);const P=S.at??(_?_.joints3.length-1:0),R=_?_.joints3[P]:o,$=_?_.frames[Math.max(0,P-1)]:{swing:0,spread:0},B=S.offset?Nn(R,xe($r(S.offset,i),$)):R,N=S.side??1,F=e.boneScale?.(t,S)??1,D=e.angles(t,S),O=[B],j=[];let et=$.swing,ft=$.spread;S.bones.forEach((bt,Ie)=>{const Zt=D[Ie]??{swing:0,spread:0};et+=ht(Zt.swing),ft+=ht(Zt.spread)*N,j.push({swing:et,spread:ft});const Kn=Jt(xe(S.rest,{swing:et,spread:ft}),ht(Zt.yaw??0));O.push(Nn(O[Ie],$r(Kn,bt.length*i*F)))}),a[S.id]={joints3:O,frames:j}}const l=a[e.head.on],c=e.headPose?.(t)??{yaw:0,nod:0,tilt:0,sx:1,sy:1},h=l.frames[l.frames.length-1],d=e.head.size/2*i,u=d*c.sx,f=d*c.sy,m=S=>xe(Jt(Rr(Lr(S,-ht(c.tilt)),-ht(c.nod)),ht(c.yaw)),h),p=Nn(l.joints3[l.joints3.length-1],m([0,f,0])),g={};for(const S of e.chains){const{joints3:_,frames:P}=a[S.id],R=_.map($=>Yn($,s));g[S.id]={id:S.id,joints3:_,frames:P,points:R.map($=>$.point),depths:R.map($=>$.depth)}}const y=Yn(p,s),v=[[1,0,0],[0,1,0],[0,0,1]].map(S=>Jt(m(S),s)),w=Yn(o,s).point,k=ht(t.roll??0),T=S=>{const _=S.x-w.x,P=S.y-w.y;return{x:w.x+_*Math.cos(k)-P*Math.sin(k),y:w.y+_*Math.sin(k)+P*Math.cos(k)}},M=([S,_,P])=>[S*Math.cos(k)+_*Math.sin(k),-S*Math.sin(k)+_*Math.cos(k),P];for(const S of Object.values(g))S.points=S.points.map(T);const x={center:T(y.point),depth:y.depth,rx:u,ry:f,angle:0,axes:v.map(M)},C=x.axes[1];x.angle=Math.atan2(C[0],C[1]);const L=S=>{if("head"in S)return{x:x.center.x+C[0]*f,y:x.center.y-C[1]*f};const _=g[S.chain];return _.points[Math.min(S.joint,_.points.length-1)]};let I=0;(n.contact??"ground")==="ground"&&(I=-Math.max(...e.contacts.map(S=>L(S).y))),I-=(t.lift??0)*i;const A=S=>({x:S.x,y:S.y+I});for(const S of Object.values(g))S.points=S.points.map(A);x.center=A(x.center);const E=e.contacts.map(S=>({spec:S,point:L(S)}));return{height:i,view:s,chains:g,head:x,hip:A(T(w)),contacts:E,groundY:Math.max(...E.map(S=>S.point.y))}}function Fr(e,[t,n,i]){const[s,r,o]=e.axes,a=[s[0]*t*e.rx+r[0]*n*e.ry+o[0]*i*e.rx,s[1]*t*e.rx+r[1]*n*e.ry+o[1]*i*e.rx,s[2]*t*e.rx+r[2]*n*e.ry+o[2]*i*e.rx],l=Math.hypot(t,n,i)||1,c=(s[2]*t+r[2]*n+o[2]*i)/l;return{point:{x:e.center.x+a[0],y:e.center.y-a[1]},depth:e.depth+a[2],facing:c}}const Ae=e=>e*180/Math.PI,Rt=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],qn=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],Qt=e=>Math.hypot(e[0],e[1],e[2]),Xn=e=>{const t=Qt(e)||1;return[e[0]/t,e[1]/t,e[2]/t]},Ee=e=>Math.atan2(Math.sin(e),Math.cos(e));function Or(e){const[t,n,i]=Xn(e);return{swing:Math.asin(Math.max(-1,Math.min(1,i))),spread:Math.atan2(t,-n)}}function Mc(e,t,n,i,s){const r=e.chains.find(I=>I.id===n);if(!r)throw new Error(`reach: no chain ${n} in ${e.id}`);if(r.bones.length<2||r.rest[1]>-.99)throw new Error(`reach: ${n} is not a hanging limb of two bones or more`);if(!e.withAngles)throw new Error(`reach: the ${e.id} plan cannot set angles`);const o=Wn(e,{...t,turn:0,roll:0,lift:0},{height:s.height,contact:"none"}),a=o.chains[n],l=a.joints3[0],c=Qt(Rt(a.joints3[1],a.joints3[0])),h=Qt(Rt(a.joints3[2],a.joints3[1])),d=r.parent?o.chains[r.parent].frames[Math.max(0,(r.at??o.chains[r.parent].joints3.length-1)-1)]:{swing:0,spread:0},u=Rt(i,l),f=Math.min(c+h-1e-6,Math.max(Math.abs(c-h)+1e-6,Qt(u))),m=Xn(u),p=r.parent!==null,g=xe(r.pole??(p?[0,-.35,-1]:[0,0,1]),d);let y=Rt(g,[m[0]*qn(g,m),m[1]*qn(g,m),m[2]*qn(g,m)]);Qt(y)<1e-6&&(y=Jt([1,0,0],0)),y=Xn(y);const v=(c*c+f*f-h*h)/(2*c*f),w=Math.sqrt(Math.max(0,1-v*v)),k=[l[0]+c*(v*m[0]+w*y[0]),l[1]+c*(v*m[1]+w*y[1]),l[2]+c*(v*m[2]+w*y[2])],T=[l[0]+m[0]*f,l[1]+m[1]*f,l[2]+m[2]*f],M=r.side??1,x=Or(Rt(k,l)),C=Or(Rt(T,k)),L=[{swing:Ae(Ee(x.swing-d.swing)),spread:Ae(Ee(x.spread-d.spread))*M},{swing:Ae(Ee(C.swing-x.swing)),spread:Ae(Ee(C.spread-x.spread))*M}];return e.withAngles(t,r,L)}function Hn(e,t,n,i,s,r=0,o=1,a=40){const l=Math.cos(s),c=Math.sin(s);return Array.from({length:a+1},(h,d)=>{const u=r+Math.PI*2*o*d/a,f=Math.cos(u)*n,m=Math.sin(u)*i;return{x:e+f*l-m*c,y:t+f*c+m*l}})}function Dr(e,t){return t.look==="pencil"?Ec(e,t):Sc(e,t.ink,t.look)}function Pe(e,t,n=!1){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(const i of t.slice(1))e.lineTo(i.x,i.y);n&&e.closePath()}function Sc(e,t,n){const i=n==="silhouette",s=i?1.25:1;return{look:n,ink:t,limb(r,o,a){e.fillStyle=t,Cn(e,r,o*s,a*s)},line(r,o){r.length<2||(e.strokeStyle=t,e.lineWidth=o*s,e.lineCap="round",e.lineJoin="round",Pe(e,r),e.stroke())},shape(r,o,a){Pe(e,r,!0),(o!==null||i)&&(e.fillStyle=i?t:o,e.fill()),!(a<=0)&&(e.strokeStyle=t,e.lineWidth=a*s,e.lineJoin="round",e.stroke())},ellipse(r,o,a,l,c,h,d){e.beginPath(),e.ellipse(r,o,a,l,c,0,Math.PI*2),(h!==null||i)&&(e.fillStyle=i?t:h,e.fill()),!(d<=0)&&(e.strokeStyle=t,e.lineWidth=d*s,e.stroke())},dot(r,o,a){e.fillStyle=t,e.beginPath(),e.arc(r,o,a*s,0,Math.PI*2),e.fill()},guide(){},guideEllipse(){}}}function xc(e,t){const n=[e[0]];let i=0;for(let o=1;o<e.length;o++){const a=e[o-1],l=e[o],c=Math.hypot(l.x-a.x,l.y-a.y);let h=t-i;for(;h<c;){const d=h/c;n.push({x:a.x+(l.x-a.x)*d,y:a.y+(l.y-a.y)*d}),h+=t}i=c-(h-t)}const s=e[e.length-1],r=n[n.length-1];return Math.hypot(s.x-r.x,s.y-r.y)>t*.25?n.push(s):n[n.length-1]=s,n}function Ac(e,t){const n=e.length;return e.map((i,s)=>{const r=e[Math.max(0,s-1)],o=e[Math.min(n-1,s+1)],a=Math.hypot(o.x-r.x,o.y-r.y)||1,l=t(n===1?0:s/(n-1));return{x:i.x-(o.y-r.y)/a*l,y:i.y+(o.x-r.x)/a*l}})}function Br(e){const t=[.6,1.4,2.9].map(i=>({frequency:i*(.8+e.next()*.4),phase:e.next()*Math.PI*2,amount:.5+e.next()*.5})),n=t.reduce((i,s)=>i+s.amount,0);return i=>t.reduce((s,r)=>s+r.amount*Math.sin(Math.PI*2*r.frequency*i+r.phase),0)/n}function Ec(e,t){const n=t.pencil??{},i=t.ink,s=n.roughness??Math.max(1,t.lineWidth*.12),r=Math.max(1,Math.round(n.passes??2)),o=Math.min(1,Math.max(0,n.pressure??.25)),a=Math.min(1,Math.max(0,n.rubbedOut??.15)),l=_n(t.time,n.boil??8);let c=0;const h=(m,p,g=!1)=>fe(en(`${t.seed}:${g?"paper":l}:${m}:${p}`)),d=(m,p,g,y,v,w=0)=>{if(m.length<2)return;const k=m.slice(1).reduce((A,E,S)=>A+Math.hypot(E.x-m[S].x,E.y-m[S].y),0);let T=xc(m,Math.max(1.5,Math.min(t.lineWidth*.8,k/24)));if(w>0&&T.length>=2){const[A,E]=[T[T.length-2],T[T.length-1]],S=Math.hypot(E.x-A.x,E.y-A.y)||1;T=[...T,{x:E.x+(E.x-A.x)/S*w,y:E.y+(E.y-A.y)/S*w}]}const M=Br(g),x=Br(g),C=T.length,L=[],I=[];T.forEach((A,E)=>{const S=C===1?0:E/(C-1),_=T[Math.max(0,E-1)],P=T[Math.min(C-1,E+1)],R=Math.hypot(P.x-_.x,P.y-_.y)||1,$=-(P.y-_.y)/R,B=(P.x-_.x)/R,N=M(S)*v,F=Math.min(1,S/.08,(1-S)/.08),D=(.55+.45*Math.sqrt(Math.max(0,F)))*(1+o*x(S)),O=Math.max(.3,p(S)*D/2),j=A.x+$*N,et=A.y+B*N;L.push({x:j+$*O,y:et+B*O}),I.push({x:j-$*O,y:et-B*O})}),e.save(),e.globalAlpha*=y,e.fillStyle=i,Pe(e,[...L,...I.reverse()],!0),e.fill(),e.restore()},u=(m,p)=>{const g=c++,y=h(g,99,!0);if(y.next()<a){const T=(y.next()*2-1)*t.lineWidth*1.4,M=(y.next()*2-1)*t.lineWidth*1.4,x=m.map(C=>({x:C.x+T,y:C.y+M}));d(x,C=>p(C)*1.8,h(g,98,!0),.035,s),d(x,C=>p(C)*.45,h(g,97,!0),.12,s*1.5)}const v=m.slice(1).reduce((T,M,x)=>T+Math.hypot(M.x-m[x].x,M.y-m[x].y),0),w=p(.5)>4&&v>p(.5)*6,k=w?[-.3,.3,0]:[0];for(let T=0;T<r;T++){const M=T===0;k.forEach((x,C)=>{const L=h(g,T*10+C),I=x===0?m:Ac(m,E=>p(E)*x*Math.sqrt(Math.sin(Math.PI*E))),A=!M&&x===0?t.lineWidth*(.3+L.next()*.8):0;d(I,E=>p(E)*(w?.5:1)*(M?1:.6),L,M?.85:.45,s*(M?.6:1),A)})}},f=(m,p,g,y,v,w)=>{const T=h(c,50).next()*Math.PI*2;u(Hn(m,p,g,y,v,T,1.08,48),()=>w)};return{look:"pencil",ink:i,limb(m,p,g){u(m,y=>p+(g-p)*y)},line(m,p){u(m,()=>p)},shape(m,p,g){p!==null&&(e.save(),e.globalAlpha*=.88,e.fillStyle=p,Pe(e,m,!0),e.fill(),e.restore()),g>0&&u([...m,m[0]],()=>g)},ellipse(m,p,g,y,v,w,k){w!==null&&(e.save(),e.globalAlpha*=.9,e.fillStyle=w,e.beginPath(),e.ellipse(m,p,g,y,v,0,Math.PI*2),e.fill(),e.restore()),f(m,p,g,y,v,k)},dot(m,p,g){e.save(),e.globalAlpha*=.9,e.fillStyle=i,e.beginPath(),e.arc(m,p,g,0,Math.PI*2),e.fill(),e.restore()},guide(m){if(n.construction===!1||m.length<2)return;const p=c++;d(m,()=>Math.max(.6,t.lineWidth*.18),h(p,0),.28,s*1.2,t.lineWidth)},guideEllipse(m,p,g,y,v){if(n.construction===!1)return;const w=c++,k=h(w,0),T=Hn(m,p,g,y,v,k.next()*Math.PI*2,1.12,48);d(T,()=>Math.max(.6,t.lineWidth*.18),k,.28,s*1.5)}}}const Pc=.34,ut=.12,tt=-.4,it=(e,t,n)=>e[t]??n,_c=(e,t)=>Math.max(0,e)*(1-Math.min(1,Math.max(0,t))),Cc=.45,Ic=.35,Rc=.7;function _e(e,t,n){const i=f=>Math.sqrt(Math.max(0,1-f.x*f.x-f.y*f.y)),s=Fr(e,[n.x,n.y,i(n)]).facing,r=e.axes[2],o=Math.atan2(r[0],r[2]),a=Math.cos(o),l=a>=0?1:-1,c=l*Math.max(Ic,Math.abs(a)),h=l*Math.max(Rc,Math.abs(a)),d=Math.cos(e.angle),u=Math.sin(e.angle);return{facing:s,points:t.map(f=>{const m=Cc*Math.sin(o)+n.x*c+(f.x-n.x)*h,p=f.y+r[1]*i(f),g=m*e.rx,y=p*e.ry;return{x:e.center.x+g*d+y*u,y:e.center.y+g*u-y*d}})}}const Ce=(e,t,n,i=12)=>Array.from({length:i+1},(s,r)=>{const o=r/i,a=1-o;return{x:a*a*e.x+2*a*o*t.x+o*o*n.x,y:a*a*e.y+2*a*o*t.y+o*o*n.y}}),Vn=(e,t,n,i,s=16)=>Array.from({length:s},(r,o)=>{const a=Math.PI*2*o/s;return{x:e+Math.cos(a)*n,y:t+Math.sin(a)*i}}),Nr=.05;function Lc(e,t,n,i){const s=Math.max(1,Math.min(i*.6,.14*t.rx)),r=(y,v)=>_e(t,y,v).points,o=(y,v)=>_e(t,[],{x:y,y:v}).facing,a=it(n,"smile",0),l=it(n,"blink",0),c=it(n,"lookX",0),h=it(n,"lookY",0),d=it(n,"browTilt",0);for(const y of[1,-1]){const v=y===1?"left":"right",w=Pc*y;if(o(w,ut)<Nr)continue;const k={x:w,y:ut},T=_c(it(n,`eye.${v}`,1),l);if(T<.2){const L=a>.5?.12:-.06;e.line(r(Ce({x:w-.12,y:ut},{x:w,y:ut+L},{x:w+.12,y:ut}),k),s)}else{if(T>1.2){const E=.13*T;e.shape(r(Vn(w,ut,E*.85,E),k),"#ffffff",s)}const L=T>1.2?.075:.1,I=w+c*.08,A=ut-h*.07;e.shape(r(Vn(I,A,L,L*1.1*Math.min(T,1)),k),e.ink,0)}const M=ut+.3+it(n,`brow.${v}`,0)*.14+Math.max(0,T-1)*.12,x={x:w+y*.13,y:M},C={x:w-y*.13,y:M+d*.1};e.line(r([x,{x:(x.x+C.x)/2,y:(x.y+C.y)/2},C],{x:w,y:M}),s)}const u={x:0,y:tt};if(o(0,tt)<-Nr)return;const f=.25*Math.max(.3,it(n,"mouthWidth",1)),m=Math.min(1,Math.max(0,it(n,"mouth",0)));if(m<=.05){e.line(r(Ce({x:-f,y:tt},{x:0,y:tt-a*.25},{x:f,y:tt}),u),s);return}const p=.3*m;let g;if(a>.3){const y=tt+.05;g=[...Ce({x:f,y},{x:0,y:tt-p*2},{x:-f,y})]}else if(a<-.3){const y=tt-p*.6;g=[...Ce({x:f,y},{x:0,y:tt+p*1.4},{x:-f,y})]}else g=Vn(0,tt,f*.8,p);e.shape(r(g,u),e.ink,0)}const Un=.215,jn=.205,$c=.065,Yr=.035,Fc=.165,Oc=.155,Dc=12,st={turn:0,lean:0,side:0,"head.turn":0,"head.nod":0,"head.tilt":0,"arm.left.swing":0,"arm.left.spread":12,"arm.left.elbow":8,"arm.left.bend":0,"arm.right.swing":0,"arm.right.spread":12,"arm.right.elbow":8,"arm.right.bend":0,"leg.left.swing":0,"leg.left.spread":3,"leg.left.knee":0,"leg.left.ankle":0,"leg.right.swing":0,"leg.right.spread":3,"leg.right.knee":0,"leg.right.ankle":0,stretch:1,lift:0,roll:0,mouth:0,smile:.5,mouthWidth:1,blink:0,"eye.left":1,"eye.right":1,"brow.left":0,"brow.right":0,browTilt:0,lookX:0,lookY:0};function V(e={}){return{...st,...e}}function U(e,t){const n={};for(const i of["left","right"])for(const[s,r]of Object.entries(t))n[`${e}.${i}.${s}`]=r;return n}const Wr={rest:st,wave:V({"arm.right.spread":115,"arm.right.bend":55,"arm.right.elbow":0,"head.tilt":-6,smile:.9}),cheer:V({...U("arm",{spread:140,bend:20,elbow:0}),mouth:.6,smile:1,"eye.left":0,"eye.right":0}),point:V({"arm.right.spread":88,"arm.right.elbow":0,"arm.right.bend":0,"head.turn":-20,smile:.4}),handsOnHips:V({...U("arm",{spread:50,bend:-105,elbow:0}),...U("leg",{spread:9}),smile:.8}),think:V({"arm.right.spread":22,"arm.right.bend":-150,"arm.right.elbow":0,"head.tilt":10,lookX:-.5,lookY:-.8,smile:0}),shrug:V({...U("arm",{spread:35,bend:75,elbow:0}),"head.tilt":-10,smile:-.2}),sit:V({...U("leg",{swing:90,knee:90,spread:4}),...U("arm",{swing:25,elbow:45,spread:8})}),kneel:V({"leg.left.swing":90,"leg.left.knee":90,"leg.right.swing":-18,"leg.right.knee":108,"leg.right.ankle":16,...U("arm",{swing:20,elbow:30})}),crouch:V({...U("leg",{swing:75,knee:140,spread:6}),lean:25,...U("arm",{swing:50,elbow:40}),"head.nod":-15}),crawl:V({lean:82,"head.nod":-35,...U("arm",{swing:80,elbow:0,spread:4}),...U("leg",{knee:92,ankle:-88})}),lieDown:V({roll:90,...U("arm",{spread:8}),"head.nod":0})};function qr(e={}){const t=e.headSize??.3,n=e.shoulderWidth??.06,i=e.hipWidth??.022,s=Math.max(.12,1-t-Yr-(Un+jn)),r=l=>({id:`arm.${l}`,parent:"spine",offset:[(l==="left"?1:-1)*n,-.035,0],rest:[0,-1,0],side:l==="left"?1:-1,bones:[{length:Fc,width:[1.25,.9]},{length:Oc,width:[.9,.75]}]}),o=l=>({id:`leg.${l}`,parent:null,offset:[(l==="left"?1:-1)*i,0,0],rest:[0,-1,0],side:l==="left"?1:-1,bones:[{length:Un,width:[1.45,1.05]},{length:jn,width:[1.05,.85]},{length:$c,width:[.95,.7]}]}),a=(l,c)=>l[c]??st[c]??0;return{id:"human",hipHeight:Un+jn,chains:[o("left"),o("right"),{id:"spine",parent:null,rest:[0,1,0],bones:[{length:s/2,width:[1.7,1.4]},{length:s/2,width:[1.4,1.1]}]},{id:"neck",parent:"spine",rest:[0,1,0],bones:[{length:Yr,width:[1,.9]}]},r("left"),r("right")],head:{on:"neck",size:t},contacts:[...["left","right"].flatMap(l=>[{chain:`leg.${l}`,joint:1},{chain:`leg.${l}`,joint:2},{chain:`leg.${l}`,joint:3},{chain:`arm.${l}`,joint:1},{chain:`arm.${l}`,joint:2}]),{chain:"spine",joint:0},{chain:"spine",joint:1},{chain:"spine",joint:2},{head:"top"}],angles(l,c){if(c.id==="spine"){const f=-a(l,"lean")/2,m=a(l,"side")/2;return[{swing:f,spread:m},{swing:f,spread:m}]}if(c.id==="neck")return[{swing:0,spread:0}];const[h,d]=c.id.split("."),u=f=>a(l,`${h}.${d}.${f}`);return h==="arm"?[{swing:u("swing"),spread:u("spread")},{swing:u("elbow"),spread:u("bend")}]:[{swing:u("swing"),spread:u("spread")},{swing:-u("knee"),spread:0},{swing:90+u("ankle"),spread:0,yaw:Dc*(c.side??1)}]},withAngles(l,c,h){const[d,u]=c.id.split("."),f=m=>`${d}.${u}.${m}`;return d==="arm"?{...l,[f("swing")]:h[0].swing,[f("spread")]:h[0].spread,[f("elbow")]:h[1].swing,[f("bend")]:h[1].spread}:d==="leg"?{...l,[f("swing")]:h[0].swing,[f("spread")]:h[0].spread,[f("knee")]:-h[1].swing}:l},boneScale(l,c){const h=Math.min(3,Math.max(.3,a(l,"stretch")));return c?.id.startsWith("arm.")?Math.sqrt(h):h},headPose(l){const c=Math.min(3,Math.max(.3,a(l,"stretch")));return{yaw:a(l,"head.turn"),nod:a(l,"head.nod"),tilt:a(l,"head.tilt"),sx:1/Math.sqrt(c),sy:Math.sqrt(c)}},landmarks:{neck:["neck",0],"shoulder.left":["arm.left",0],"elbow.left":["arm.left",1],"hand.left":["arm.left",2],"shoulder.right":["arm.right",0],"elbow.right":["arm.right",1],"hand.right":["arm.right",2],"hip.left":["leg.left",0],"knee.left":["leg.left",1],"ankle.left":["leg.left",2],"toe.left":["leg.left",3],"hip.right":["leg.right",0],"knee.right":["leg.right",1],"ankle.right":["leg.right",2],"toe.right":["leg.right",3]}}}function Bc(e){const t=e.split(".");if(t.length===3){const[i,s,r]=t;return`${`${s==="left"?"Left":"Right"} ${i}`} · ${{swing:"forward / back",spread:"out / in",elbow:"elbow bend",bend:"forearm out / in",knee:"knee bend",ankle:"foot tilt"}[r]??r}`}return{turn:"View (front → side → back)",lean:"Lean forward / back",side:"Lean sideways","head.turn":"Head · turn","head.nod":"Head · nod","head.tilt":"Head · tilt",stretch:"Squash / stretch",lift:"Lift off the ground",roll:"Roll (whole figure)",mouth:"Mouth open",smile:"Smile",mouthWidth:"Mouth width",blink:"Blink","eye.left":"Left eye open","eye.right":"Right eye open","brow.left":"Left brow","brow.right":"Right brow",browTilt:"Brow slant",lookX:"Look left / right",lookY:"Look up / down"}[e]??e}const Nc={leftEye:"eye.left",rightEye:"eye.right",leftBrow:"brow.left",rightBrow:"brow.right"},Yc=Object.fromEntries(Object.entries(Z).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([n,i])=>[Nc[n]??n,i]))]));function Wc(e={}){const t=(e.proportions??"bold")==="bold",n=e.figure??"fluid",i=e.look??"clean",s=e.height??300,r=n==="stick";return{plan:e.plan??qr({headSize:e.headSize??(t?.3:.24),shoulderWidth:r?0:e.shoulderWidth??.06,hipWidth:r?0:e.hipWidth??.022}),figure:n,look:i,height:s,lineWidth:e.lineWidth??s*(t?.045:.022),ink:e.ink??(i==="pencil"?"#2f2f33":"#1e293b"),skin:e.skin??(i==="pencil"?"none":"#ffffff"),seed:e.seed??1,pencil:e.pencil??{},layers:e.layers??{},contact:e.contact??"ground"}}function qc(e,t,n,i){const{point:s,facing:r}=Fr(e,[t,n,i]);return{point:s,facing:r}}const zn=e=>e.rest[1]<-.5,Xc=.3;function Hc(e,t,n){return e.figure==="stick"?zn(t)?n.slice(0,3):n:zn(t)&&n.length>=3?gt(n[0],n[1],n[2],Xc):n.length===3?gt(n[0],n[1],n[2],1):n}function Gn(e,t){const n=e.plan.id==="human"?{...st,...t}:t,i=Wn(e.plan,n,{height:e.height,contact:e.contact}),s={},r={},o={},a=.01*e.height;e.plan.chains.forEach(f=>{const m=i.chains[f.id];s[f.id]=m.points;const p=m.depths.reduce((w,k)=>w+k,0)/m.depths.length,g=f.parent?i.chains[f.parent]:void 0,y=g?g.depths[f.at??g.depths.length-1]:0,v=p-y;o[f.id]=Math.abs(v)<a?0:v,r[f.id]={points:Hc(e,f,m.points),depth:p}}),r.head={points:[i.head.center],depth:i.head.depth},o.head=0;const l=[...e.plan.chains.map(f=>f.id),"head"],c=[...l].sort((f,m)=>o[f]-o[m]||l.indexOf(f)-l.indexOf(m)),h={hip:i.hip};for(const[f,[m,p]]of Object.entries(e.plan.landmarks??{})){const g=i.chains[m]?.points;g&&(h[f]=g[Math.min(p,g.length-1)])}const d={};for(const[f,m]of Object.entries(h))d[f]=m.y>=i.groundY-.01*e.height;const u={height:e.height,lineWidth:e.lineWidth,turn:n.turn??0,points:h,chains:s,parts:r,head:i.head,groundY:i.groundY,grounded:d};return{skeleton:i,joints:u,order:c}}function Xr(e,t){return Gn(e,t).joints}function Vc(e,t,n){const{head:i}=n;e.guideEllipse(i.center.x,i.center.y,i.rx*1.03,i.ry*1.03,i.angle);const s=Array.from({length:13},(l,c)=>({x:0,y:-.95+1.9*c/12})),r=Array.from({length:13},(l,c)=>({x:-.95+1.9*c/12,y:.12})),o=_e(i,s,{x:0,y:0});o.facing>0&&e.guide(o.points),e.guide(_e(i,r,{x:0,y:.12}).points),e.guide(n.chains.spine??[]);const a=t.lineWidth*.9;for(const l of["shoulder.left","shoulder.right","elbow.left","elbow.right","hip.left","hip.right","knee.left","knee.right"]){const c=n.points[l];c&&e.guideEllipse(c.x,c.y,a,a,0)}}function Uc(e,t,n,i,s){const r=t.lineWidth;if(i==="head"){const{head:u}=n,f=t.skin==="none"?null:t.skin;e.ellipse(u.center.x,u.center.y,u.rx,u.ry,u.angle,f,r),e.look!=="silhouette"&&Lc(e,u,s,r);return}const o=t.plan.chains.find(u=>u.id===i),a=n.chains[i],l=n.parts[i].points;if(t.figure==="stick"){if(i==="neck")return;const u=i==="spine"?[...a,...n.chains.neck?.slice(1)??[]]:l;e.line(u,r);return}const c=(u,f)=>[o.bones[u].width[0]*r,o.bones[f].width[1]*r];if(zn(o)){const[u,f]=c(0,1);if(e.limb(l,u,f),o.bones.length>=3)e.limb([a[2],a[3]],o.bones[2].width[0]*r,o.bones[2].width[1]*r);else{const m=a[a.length-1];e.dot(m.x,m.y,r*.62)}return}if(i==="spine"){const u=n.points["hip.left"],f=n.points["hip.right"];u&&f&&Math.hypot(u.x-f.x,u.y-f.y)>.5&&e.limb([u,f],r*1.3,r*1.3);const[m,p]=c(0,o.bones.length-1);e.limb(l,m,p);const g=n.points["shoulder.left"],y=n.points["shoulder.right"];g&&y&&Math.hypot(g.x-y.x,g.y-y.y)>.5&&e.limb(gt(g,a[a.length-1],y,1,10),r*1.15,r*1.15);return}const[h,d]=c(0,o.bones.length-1);e.limb(l,h,d)}function Hr(e,t,n,i=0){const s=t.plan.id==="human"?{...st,...n}:n,{joints:r,order:o}=Gn(t,s),a=Dr(e,{look:t.look,ink:t.ink,lineWidth:t.lineWidth,seed:t.seed,time:i,pencil:t.pencil}),l=c=>{c&&(e.save(),c(e,r,a,i),e.restore())};e.save(),e.lineCap="round",e.lineJoin="round",t.look==="pencil"&&t.pencil.construction!==!1&&Vc(a,t,r),l(t.layers.behind);for(const c of o){const h=t.layers.parts?.[c];l(h?.under),Uc(a,t,r,c,s),l(h?.over)}l(t.layers.front),e.restore()}function jc(e,t,n){const i={...e};for(const[s,r]of Object.entries(t)){const o=e[s]??r;i[s]=o+(r-o)*n}return i}function zc(e,t,n,i){const s=e.plan.id==="human"?{...st,...t}:t;let r;if(Array.isArray(i))r=i;else{const{skeleton:o}=Gn(e,s),a=Wn(e.plan,{...s,roll:0},{height:e.height,contact:"none"}),l=(s.roll??0)*Math.PI/180,c=i.x-o.hip.x,h=i.y-o.hip.y,d=a.hip.x+c*Math.cos(-l)-h*Math.sin(-l),u=a.hip.y+c*Math.sin(-l)+h*Math.cos(-l),f=Math.PI/2*(s.turn??0),m=i.depth??o.chains[n].depths[o.chains[n].depths.length-1],p=Math.cos(f),g=Math.sin(f);r=[d*p-m*g,-u,d*g+m*p]}return Mc(e.plan,s,n,r,{height:e.height})}function Gc(e){const{character:t}=e,n=t.height*.8,i=t.height,s=t.plan.id==="human"?st:{};return{type:"custom",x:e.x-n/2,y:e.y-i,width:n,height:i,props:{...s,...e.pose},character:t,draw(r,o,a){r.translate(n/2,i),Hr(r,t,o.props,a)}}}function Vr(e,t,n){const i=r=>({x:r.x+t,y:r.y+n}),s=r=>Object.fromEntries(Object.entries(r).map(([o,a])=>[o,a.map(i)]));return{...e,points:Object.fromEntries(Object.entries(e.points).map(([r,o])=>[r,i(o)])),chains:s(e.chains),parts:Object.fromEntries(Object.entries(e.parts).map(([r,o])=>[r,{...o,points:o.points.map(i)}])),head:{...e.head,center:i(e.head.center)},groundY:e.groundY+n}}function Kc(e,t,n){const i=e.character;if(!i)throw new Error("characterAt: the target was not made by characterTarget");const s={...e.props};let r=0,o=0;for(const[l,c]of t.state?.values.get(n)??[])typeof c=="number"&&(l==="x"||l==="motionPathX"?r=c:l==="y"||l==="motionPathY"?o=c:l in s&&(s[l]=c));const a=Xr(i,s);return{pose:s,joints:Vr(a,e.x+r+e.width/2,e.y+o+e.height)}}function Jc(e,t,n=st){const i=[];return t.forEach((r,o)=>{const a=o===0?n:i[o-1],l=typeof r.pose=="string"?Wr[r.pose]:void 0;i.push(l?{...l,turn:a.turn??0}:{...a,...r.pose})}),Object.keys(n).filter(r=>i.some(o=>(o[r]??n[r])!==n[r])).map(r=>({id:`${e}-${r}`,target:e,property:r,keyframes:t.map((o,a)=>({time:o.time,value:i[a][r]??n[r],...o.easing?{easing:o.easing}:{}}))}))}const Qc=(e,t,n)=>e.slice(Math.floor((e.length-1)*t),Math.ceil((e.length-1)*n)+1);function Zc(e={}){const t=e.shirt??"#e2493b",n=e.trousers??"#24476b",i=a=>a.lineWidth*.45,s=(a,l,c)=>{const h=a.parts[`leg.${c}`].points;l.shape(Gt(h,a.height*.08,a.height*.05),n,i(a))},r=(a,l)=>{const c=a.chains.spine,h=c[0],d=c[c.length-1],u={x:h.x-(d.x-h.x)*.25,y:h.y-(d.y-h.y)*.25};l.shape(Gt([u,...a.parts.spine.points],a.height*.15,a.height*.14),t,i(a))},o=(a,l,c)=>{const h=a.parts[`arm.${c}`].points,d=h[0],u=a.chains.spine[a.chains.spine.length-1],m=[{x:d.x+(u.x-d.x)*.45,y:d.y+(u.y-d.y)*.45},...Qc(h,0,.45)],p=Gt(m,a.height*.085,a.height*.06),g=m.length,y=p.slice(0,g),v=p.slice(g).reverse();l.shape(p,t,0);const w=M=>Math.hypot(M[1].x-u.x,M[1].y-u.y),[k,T]=w(y)>w(v)?[y,v]:[v,y];l.line(k.slice(1),i(a)),l.line(T.slice(Math.ceil(g*.45)),i(a)),l.line([y[g-1],v[g-1]],i(a))};return{parts:{"leg.left":{over:(a,l,c)=>s(l,c,"left")},"leg.right":{over:(a,l,c)=>s(l,c,"right")},spine:{over:(a,l,c)=>r(l,c)},"arm.left":{over:(a,l,c)=>o(l,c,"left")},"arm.right":{over:(a,l,c)=>o(l,c,"right")}}}}function th(e){const{timeline:t}=e,n=new pt;for(const[c,h]of Object.entries(e.targets)){const d=typeof h=="string"?document.querySelector(h):h;if(!d)throw new Error(`quickPlay: no element found for target "${c}" (${String(h)})`);n.registerTarget(c,d)}t.onUpdate=c=>{n.applyState(c),e.onUpdate?.(c)},e.onComplete&&(t.onComplete=e.onComplete);let i=null,s=null,r=!1;const o=c=>{if(r)return;const h=s===null?0:c-s;s=c,h>0&&t.tick(h),i=requestAnimationFrame(o)},a=()=>{i!==null||r||(s=null,i=requestAnimationFrame(o))},l=()=>{i!==null&&cancelAnimationFrame(i),i=null,s=null};return n.applyState(t.getStateAtTime(t.currentTime)),e.autoplay!==!1&&(t.play(),a()),{timeline:t,adapter:n,play(){t.play(),a()},pause(){t.pause(),l()},restart(){t.stop(),t.play(),a()},seek(c){t.seek(c*1e3),n.applyState(t.getStateAtTime(t.currentTime))},destroy(){r=!0,l(),t.stop(),n.clearTargets()}}}const eh={timeline:ga,to(e,t,n){const i=new mt(n);return i.to(e,t),i},from(e,t,n){const i=new mt(n);return i.from(e,t),i},fromTo(e,t,n,i){const s=new mt(i);return s.fromTo(e,t,n),s},set(e,t,n){const i=new mt(n);return i.set(e,t),i}},nh=q.to,ih=q.from,sh=q.fromTo,rh=q.set,oh=q.timeline,ah=q.ticker,lh=q.splitText,ch=q.context,hh=q.matchMedia,uh=q.quickTo,fh=q.imageSequence,dh=q.pageTransition;Yl(),b.Clock=zr,b.CompatTimeline=mt,b.CustomBounce=Bs,b.CustomEase=Ds,b.CustomWiggle=Ns,b.DEFAULT_BAKE_INTERVAL_MS=Ue,b.DEFAULT_INERTIA_FRICTION=Oe,b.DEFAULT_LABELS=zs,b.DEFAULT_SPRING=H,b.DEFAULT_TRANSITION=ql,b.Draggable=fn,b.EXPRESSIONS=Z,b.FORMAT_VERSION=$t,b.HUMAN_EXPRESSIONS=Yc,b.HUMAN_POSES=Wr,b.HUMAN_REST=st,b.INERTIA_MAX_DURATION_MS=ti,b.InertiaTrackPlayer=Oi,b.LiveTimeline=Q,b.MORPH_SAMPLES=yo,b.ManualClock=jr,b.MediaSync=An,b.Observer=ms,b.POSES=ar,b.REST_POSE=yt,b.SPRING_MAX_DURATION_MS=Fe,b.SPRING_PRESETS=se,b.SPRING_STEP_MS=wt,b.ScrollAnimator=Cs,b.ScrollDriver=Ut,b.ScrollMarkers=Is,b.ScrollPin=As,b.SmoothScroll=Mn,b.SpringSampler=Ot,b.SpringTrackPlayer=Fi,b.Stage=ls,b.Timeline=Qe,b.TinyflyPlayer=we,b.TinyflySequencer=nr,b.TrackPlayer=ue,b.ValueResolver=No,b.VisibilityDriver=xs,b.backOut=hi,b.bakeEasing=Ge,b.bakeInertiaTrack=ze,b.bakeSpringTrack=je,b.basicOutfit=Zc,b.bindChoiceHotspots=Qs,b.blendPose=cr,b.boilFrame=_n,b.bounceOut=ci,b.character=Wc,b.characterAt=Kc,b.characterJoints=Xr,b.characterPoseTracks=Jc,b.characterTarget=Gc,b.charactersFor=Di,b.circlePath=bc,b.clamp01=wn,b.clearMorphCache=Ao,b.clearPathCache=uo,b.clipErased=Bn,b.containerProgressAt=vn,b.context=ch,b.create=xl,b.createControls=Ks,b.createCubicBezier=ai,b.createLive=qs,b.createPen=Dr,b.createRandom=fe,b.createTrack=he,b.criticalDamping=Jr,b.customBounce=zi,b.customEase=ji,b.customWiggle=Gi,b.deserializeTimeline=xt,b.deserializeTrack=Wi,b.draggable=Ba,b.drawCharacter=Hr,b.drawEraser=On,b.drawHand=Dn,b.drawPencil=Cr,b.drawStickFigure=_r,b.drawnPathTarget=wc,b.easeIn=si,b.easeInCubic=De,b.easeInOut=oi,b.easeInOutCubic=Bt,b.easeInOutQuad=ii,b.easeInQuad=ei,b.easeOut=ri,b.easeOutCubic=Be,b.easeOutQuad=ni,b.elasticOut=li,b.ellipsePoints=Hn,b.erasable=kc,b.expandParametricEasings=Li,b.from=ih,b.fromJSON=Oo,b.fromTo=sh,b.getEasingFunction=z,b.getInterpolator=qt,b.getMotionPathPoint=Ke,b.getPathLength=fo,b.getPointAtProgress=pi,b.gridLinesFor=ys,b.hasKeyframes=Qn,b.hashSeed=en,b.headPoint=mc,b.humanFieldLabel=Bc,b.humanPlan=qr,b.humanPose=V,b.imageSequence=fh,b.inertiaDuration=Tt,b.inertiaRest=vt,b.inertiaValueAt=oe,b.inertiaVelocityAt=eo,b.interpolateArray=Ci,b.interpolateColor=_i,b.interpolateMotionPath=Io,b.interpolateNumber=G,b.interpolatePathString=Ii,b.interpolateString=Ve,b.isCubicBezierEasing=Jn,b.isInertiaTrack=rt,b.isMotionPathPoint=Ur,b.isMotionPathTrack=Re,b.isParametricEasing=Lt,b.isPathData=Mt,b.isSpringTrack=ot,b.isTextTrack=te,b.isUnderdamped=Kr,b.isUnresolved=Bo,b.jointsInScene=Vr,b.jointsToScene=Pr,b.linear=ae,b.live=q,b.mapEase=Xt,b.matchMedia=hh,b.maxStaggerDistance=$e,b.mixPoses=jc,b.morphPath=ki,b.mount=Zs,b.mountAll=er,b.narrationMarkers=jo,b.narrationSceneAt=zo,b.naturalRest=Dt,b.pageTransition=dh,b.parametricEasing=fi,b.parseEdge=yn,b.parsePath=dt,b.parseTrigger=bn,b.partialPath=Ct,b.pathLength=ir,b.planNarration=Uo,b.play=Sl,b.playSequence=Wl,b.playWhenVisible=Ja,b.playheadCrossings=Ze,b.pointAlong=Pn,b.pointAtDistance=Ye,b.pointOnHead=qc,b.pointsToPath=Ji,b.pose=X,b.poseTracks=yc,b.quickPlay=th,b.quickTo=uh,b.randomBetween=nn,b.randomChoice=Do,b.randomSnapped=Xi,b.reachCharacter=zc,b.resolveSequence=Ui,b.resolveStickPose=Fn,b.resolveValue=sn,b.rubberLimb=gt,b.scrollProgress=Ka,b.scrubOnScroll=el,b.scrubPath=vc,b.seatHeight=uc,b.serializeTimeline=qi,b.serializeTrack=Ni,b.set=rh,b.shapeToPathData=de,b.simplifyKeyframes=$i,b.sketchPen=Te,b.smoothToward=Ss,b.snapAxis=gs,b.snapConfig=Es,b.snapDuration=_s,b.snapProgress=Ps,b.splitText=lh,b.springDuration=Zn,b.springValueAt=Gr,b.staggerDistance=Le,b.staggerOffset=ee,b.staggerOffsets=ne,b.staggerSpan=Ft,b.stepsEasing=ui,b.stickFigureAt=gc,b.stickFigureJoints=Er,b.stickFigureTarget=pc,b.strideLength=Ul,b.syncMediaElement=js,b.talkingMouth=dr,b.taperedLine=Cn,b.taperedOutline=Gt,b.textAt=Bi,b.tf=eh,b.ticker=ah,b.timeline=oh,b.to=nh,b.toJSON=Fo,b.toKeyframedTrack=_o,b.toKeyframedTracks=Co,b.trackTargets=ct,b.triggerDistance=At,b.unmount=Bl,b.walkPose=fr,b.withErased=Tc,b.withExpression=or,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})(this.tinyfly=this.tinyfly||{});
|