=Y&&q===p.length-1){B=b[q];break}if(N>Y&&N2){var q=k.map(function(Z,Q){return Q/(k.length-1)}),Y=k.map(function(Z){return(Z-x)/(P-x)});Y.every(function(Z,Q){return q[Q]===Z})||(gt=function(Z){if(Z<=0||Z>=1)return Z;for(var Q=0;Z>=Y[Q+1];)Q++;var $t=(Z-Y[Q])/(Y[Q+1]-Y[Q]),ee=q[Q]+$t*(q[Q+1]-q[Q]);return ee})}}return d=[x,P],W},W.mode=function(k){return arguments.length?(o=k,wt(),W):o},W.range=function(k,O){return U(k),W},W.out=function(k){return w=k,W},W.spread=function(k){return arguments.length?(c=k,W):c},W.correctLightness=function(k){return k==null&&(k=!0),S=k,wt(),S?X=function(O){for(var B=pt(0,!0).lab()[0],N=pt(1,!0).lab()[0],vt=B>N,nt=pt(O,!0).lab()[0],q=B+(N-B)*O,Y=nt-q,Z=0,Q=1,$t=20;Math.abs(Y)>.01&&$t-- >0;)(function(){return vt&&(Y*=-1),Y<0?(Z=O,O+=(Q-O)*.5):(Q=O,O+=(Z-O)*.5),nt=pt(O,!0).lab()[0],Y=nt-q})();return O}:X=function(O){return O},W},W.padding=function(k){return k!=null?(Ae(k)==="number"&&(k=[k,k]),f=k,W):f},W.colors=function(k,O){arguments.length<2&&(O="hex");var B=[];if(arguments.length===0)B=b.slice(0);else if(k===1)B=[W(.5)];else if(k>1){var N=d[0],vt=d[1]-N;B=Mh(0,k,!1).map(function(Q){return W(N+Q/(k-1)*vt)})}else{s=[];var nt=[];if(m&&m.length>2)for(var q=1,Y=m.length,Z=1<=Y;Z?qY;Z?q++:q--)nt.push((m[q-1]+m[q])*.5);else nt=d;B=nt.map(function(Q){return W(Q)})}return Mt[O]&&(B=B.map(function(Q){return Q[O]()})),B},W.cache=function(k){return k!=null?(M=k,W):M},W.gamma=function(k){return k!=null?(j=k,W):j},W.nodata=function(k){return k!=null?(l=Mt(k),W):l},W};function Mh(s,o,l){for(var c=[],d=sp;d?f++:f--)c.push(f);return c}var Ue=D,Lh=tn,$h=function(s){for(var o=[1,1],l=1;l=5){var w,x,P;w=s.map(function(S){return S.lab()}),P=s.length-1,x=$h(P),d=function(S){var L=1-S,M=[0,1,2].map(function(j){return w.reduce(function(U,G,X){return U+x[X]*Math.pow(L,P-X)*Math.pow(S,X)*G[j]},0)});return new Ue(M,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return d},Ah=function(s){var o=Ih(s);return o.scale=function(){return Lh(o)},o},en=ct,Lt=function(s,o,l){if(!Lt[l])throw new Error("unknown blend mode "+l);return Lt[l](s,o)},Kt=function(s){return function(o,l){var c=en(l).rgb(),d=en(o).rgb();return en.rgb(s(c,d))}},te=function(s){return function(o,l){var c=[];return c[0]=s(o[0],l[0]),c[1]=s(o[1],l[1]),c[2]=s(o[2],l[2]),c}},Oh=function(s){return s},zh=function(s,o){return s*o/255},Eh=function(s,o){return s>o?o:s},Fh=function(s,o){return s>o?s:o},_h=function(s,o){return 255*(1-(1-s/255)*(1-o/255))},Dh=function(s,o){return o<128?2*s*o/255:255*(1-2*(1-s/255)*(1-o/255))},jh=function(s,o){return 255*(1-(1-o/255)/(s/255))},Nh=function(s,o){return s===255?255:(s=255*(o/255)/(1-s/255),s>255?255:s)};Lt.normal=Kt(te(Oh)),Lt.multiply=Kt(te(zh)),Lt.screen=Kt(te(_h)),Lt.overlay=Kt(te(Dh)),Lt.darken=Kt(te(Eh)),Lt.lighten=Kt(te(Fh)),Lt.dodge=Kt(te(Nh)),Lt.burn=Kt(te(jh));for(var Bh=Lt,rn=T.type,Uh=T.clip_rgb,Wh=T.TWOPI,Gh=Math.pow,qh=Math.sin,Xh=Math.cos,Xs=ct,Hh=function(s,o,l,c,d){s===void 0&&(s=300),o===void 0&&(o=-1.5),l===void 0&&(l=1),c===void 0&&(c=1),d===void 0&&(d=[0,1]);var p=0,f;rn(d)==="array"?f=d[1]-d[0]:(f=0,d=[d,d]);var m=function(b){var w=Wh*((s+120)/360+o*b),x=Gh(d[0]+f*b,c),P=p!==0?l[0]+b*p:l,S=P*x*(1-x)/2,L=Xh(w),M=qh(w),j=x+S*(-.14861*L+1.78277*M),U=x+S*(-.29227*L-.90649*M),G=x+S*(1.97294*L);return Xs(Uh([j*255,U*255,G*255,1]))};return m.start=function(b){return b==null?s:(s=b,m)},m.rotations=function(b){return b==null?o:(o=b,m)},m.gamma=function(b){return b==null?c:(c=b,m)},m.hue=function(b){return b==null?l:(l=b,rn(l)==="array"?(p=l[1]-l[0],p===0&&(l=l[1])):p=0,m)},m.lightness=function(b){return b==null?d:(rn(b)==="array"?(d=b,f=b[1]-b[0]):(d=[b,b],f=0),m)},m.scale=function(){return Xs.scale(m)},m.hue(l),m},Yh=D,Zh="0123456789abcdef",Vh=Math.floor,Jh=Math.random,Qh=function(){for(var s="#",o=0;o<6;o++)s+=Zh.charAt(Vh(Jh()*16));return new Yh(s,"hex")},nn=y,Hs=Math.log,Kh=Math.pow,tc=Math.floor,ec=Math.abs,Ys=function(s,o){o===void 0&&(o=null);var l={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return nn(s)==="object"&&(s=Object.values(s)),s.forEach(function(c){o&&nn(c)==="object"&&(c=c[o]),c!=null&&!isNaN(c)&&(l.values.push(c),l.sum+=c,cl.max&&(l.max=c),l.count+=1)}),l.domain=[l.min,l.max],l.limits=function(c,d){return Zs(l,c,d)},l},Zs=function(s,o,l){o===void 0&&(o="equal"),l===void 0&&(l=7),nn(s)=="array"&&(s=Ys(s));var c=s.min,d=s.max,p=s.values.sort(function(an,on){return an-on});if(l===1)return[c,d];var f=[];if(o.substr(0,1)==="c"&&(f.push(c),f.push(d)),o.substr(0,1)==="e"){f.push(c);for(var m=1;m 0");var b=Math.LOG10E*Hs(c),w=Math.LOG10E*Hs(d);f.push(c);for(var x=1;x200&&(gt=!1)}for(var re={},Oe=0;Oec?(l+.05)/(c+.05):(c+.05)/(l+.05)},Qs=D,Bt=Math.sqrt,ut=Math.pow,nc=Math.min,sc=Math.max,Ks=Math.atan2,ti=Math.abs,gr=Math.cos,ei=Math.sin,ic=Math.exp,ri=Math.PI,ac=function(s,o,l,c,d){l===void 0&&(l=1),c===void 0&&(c=1),d===void 0&&(d=1);var p=function(de){return 360*de/(2*ri)},f=function(de){return 2*ri*de/360};s=new Qs(s),o=new Qs(o);var m=Array.from(s.lab()),b=m[0],w=m[1],x=m[2],P=Array.from(o.lab()),S=P[0],L=P[1],M=P[2],j=(b+S)/2,U=Bt(ut(w,2)+ut(x,2)),G=Bt(ut(L,2)+ut(M,2)),X=(U+G)/2,gt=.5*(1-Bt(ut(X,7)/(ut(X,7)+ut(25,7)))),pt=w*(1+gt),wt=L*(1+gt),W=Bt(ut(pt,2)+ut(x,2)),k=Bt(ut(wt,2)+ut(M,2)),O=(W+k)/2,B=p(Ks(x,pt)),N=p(Ks(M,wt)),vt=B>=0?B:B+360,nt=N>=0?N:N+360,q=ti(vt-nt)>180?(vt+nt+360)/2:(vt+nt)/2,Y=1-.17*gr(f(q-30))+.24*gr(f(2*q))+.32*gr(f(3*q+6))-.2*gr(f(4*q-63)),Z=nt-vt;Z=ti(Z)<=180?Z:nt<=vt?Z+360:Z-360,Z=2*Bt(W*k)*ei(f(Z)/2);var Q=S-b,$t=k-W,ee=1+.015*ut(j-50,2)/Bt(20+ut(j-50,2)),re=1+.045*O,Oe=1+.015*O*Y,ze=30*ic(-ut((q-275)/25,2)),Ut=2*Bt(ut(O,7)/(ut(O,7)+ut(25,7))),fe=-Ut*ei(2*f(ze)),We=Bt(ut(Q/(l*ee),2)+ut($t/(c*re),2)+ut(Z/(d*Oe),2)+fe*($t/(c*re))*(Z/(d*Oe)));return sc(0,nc(100,We))},ni=D,oc=function(s,o,l){l===void 0&&(l="lab"),s=new ni(s),o=new ni(o);var c=s.get(l),d=o.get(l),p=0;for(var f in c){var m=(c[f]||0)-(d[f]||0);p+=m*m}return Math.sqrt(p)},lc=D,hc=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];try{return new(Function.prototype.bind.apply(lc,[null].concat(s))),!0}catch{return!1}},si=ct,ii=tn,cc={cool:function(){return ii([si.hsl(180,1,.9),si.hsl(250,.7,.4)])},hot:function(){return ii(["#000","#f00","#ff0","#fff"]).mode("rgb")}},vr={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},sn=0,ai=Object.keys(vr);sn(st.Color.symbol=st.Color.prototype.symbol=Symbol.for("@motion-canvas/core/types/Color"),st.Color.lerp=st.Color.prototype.lerp=(n,t,e,r="lch")=>{typeof n=="string"&&(n=new st.Color(n)),typeof t=="string"&&(t=new st.Color(t));const i=n instanceof st.Color,a=t instanceof st.Color;return i||(n=a?t.alpha(0):new st.Color("rgba(0, 0, 0, 0)")),a||(t=i?n.alpha(0):new st.Color("rgba(0, 0, 0, 0)")),st.mix(n,t,e,r)},st.Color.createLerp=st.Color.prototype.createLerp=n=>(t,e,r)=>st.Color.lerp(t,e,r,n),st.Color.createSignal=(n,t=st.Color.lerp)=>new we(n,t,void 0,e=>new st.Color(e)).toSignal(),st.Color.prototype.toSymbol=()=>st.Color.symbol,st.Color.prototype.toUniform=function(n,t){n.uniform4fv(t,this.gl())},st.Color.prototype.serialize=function(){return this.css()},st.Color.prototype.lerp=function(n,t,e){return st.Color.lerp(this,n,t,e)},st.Color))();function au(n,t){return g.fromDegrees(n).transform(t).degrees}function un(n,t){return g.magnitude(t.m11,t.m12)*n}class fn extends Ct{constructor(){super(...arguments),this.type=Yt.symbol}parse(t){return t===null?null:new Yt(t)}serialize(){var t;return((t=this.value.current)==null?void 0:t.serialize())??null}}class be extends Ct{constructor(t,e,r=(i=>(i=e[0])==null?void 0:i.value)()){super(t,r),this.options=e,this.type=be.symbol}set(t){var e;super.set((e=this.getOption(t))==null?void 0:e.value)}parse(t){var e;return(e=this.getOption(t))==null?void 0:e.value}getOption(t){return this.options.find(e=>e.value===t)??this.options[0]}}be.symbol=Symbol.for("@motion-canvas/core/meta/EnumMetaField");class ou extends Ct{get onFieldsChanged(){return this.fields.subscribable}get options(){return this.optionFields[this.current]}constructor(t,e,r=0){var u,v;const i=e.plugins.flatMap(y=>{var C;return((C=y.exporters)==null?void 0:C.call(y,e))??[]}),a=i.map(y=>y.meta(e)),h=new be("exporter",i.map(y=>({value:y.id,text:y.displayName})),(u=i[r])==null?void 0:u.id);super(t,{name:h.get(),options:(v=a[r])==null?void 0:v.get()}),this.current=r,this.type=Object,this.handleChange=()=>{var F,H,J;const y=this.exporterField.get(),C=Math.max(this.exporters.findIndex(et=>et.id===y),0);this.current!==C&&((F=this.options)==null||F.onChanged.unsubscribe(this.handleChange),this.current=C,(H=this.options)==null||H.onChanged.subscribe(this.handleChange,!1),this.fields.current=this.options?[this.exporterField,this.options]:[this.exporterField]),this.value.current={name:this.exporterField.get(),options:((J=this.options)==null?void 0:J.get())??null}},this.exporters=i,this.exporterField=h,this.exporterField.onChanged.subscribe(this.handleChange,!1),this.exporterField.disable(a.length<2).space(),this.optionFields=a,this.fields=new ie([this.exporterField]),this.options&&(this.options.onChanged.subscribe(this.handleChange,!1),this.fields.current=[this.exporterField,this.options])}set(t){var e;this.exporterField.set(t.name),(e=this.options)==null||e.set(t.options??{})}serialize(){var t;return{name:this.exporterField.serialize(),options:((t=this.options)==null?void 0:t.serialize())??null}}clone(){return new this.constructor(this.name,this.exporters,this.current)}}var Xe;class er{constructor(t,e=!1){this.name=t,this.source=e,this.lock=new mc,this.ignoreChange=!1,this.cache=null,this.metaField=null,this.handleChanged=async()=>{}}attach(t){var e;this.metaField||(this.metaField=t,this.cache&&this.metaField.set(this.cache),(e=this.metaField)==null||e.onChanged.subscribe(this.handleChanged))}async saveData(t){if(this.source===!1)return;if(!this.source)throw new Error(`The meta file for ${this.name} is missing.`);if(Xe.sourceLookup[this.source])throw new Error(`Metadata for ${this.name} is already being updated`);const e=this.source;await new Promise((r,i)=>{setTimeout(()=>{delete Xe.sourceLookup[e],i(`Connection timeout when updating metadata for ${this.name}`)},1e3),Xe.sourceLookup[e]=()=>{delete Xe.sourceLookup[e],r()},(void 0).send("motion-canvas:meta",{source:e,data:t})})}loadData(t){var e;this.ignoreChange=!0,this.cache=t,(e=this.metaField)==null||e.set(t),this.ignoreChange=!1}}Xe=er;er.sourceLookup={};class hn extends Ct{constructor(){super(...arguments),this.type=Number,this.presets=[]}parse(t){let e=parseFloat(t);return this.min!==void 0&ðis.max&&(e=this.max),e}getPresets(){return this.presets}setPresets(t){return this.presets=t,this}setRange(t,e){return this.min=t,this.max=e,this}getMin(){return this.min??-1/0}getMax(){return this.max??1/0}}class Mr extends Ct{constructor(){super(...arguments),this.type=Mr.symbol}parse(t){return this.parseRange(1/0,t[0],t[1]??1/0)}update(t,e,r,i){this.value.current=this.parseRange(r/i-Ze,t/i-Ze,e/i-Ze)}parseRange(t,e=this.value.current[0],r=this.value.current[1]){return e=xt(0,t,e),r=xt(0,t,r??1/0),e>r&&([e,r]=[r,e]),r>=t&&(r=1/0),[e,r]}}Mr.symbol=Symbol.for("@motion-canvas/core/meta/RangeMetaField");class zi extends Ct{constructor(){super(...arguments),this.type=g.symbol}parse(t){return new g(t)}serialize(){return this.value.current.serialize()}}class Ne{static meta(t){return new Xt(this.displayName,{fastStart:new Cr("fast start",!0),includeAudio:new Cr("include audio",!0).disable(!t.audio)})}static async create(t,e){return new Ne(t,e)}constructor(t,e){this.project=t,this.settings=e}async start(){const t=this.settings.exporter.options;await this.invoke("start",{...this.settings,...t,audio:this.project.audio,audioOffset:this.project.meta.shared.audioOffset.get()-this.settings.range[0]})}async handleFrame(t){await this.invoke("handleFrame",{data:t.toDataURL("image/png")})}async stop(t){await this.invoke("end",t)}invoke(t,e){throw new Error("FFmpegExporter can only be used locally.")}}Ne.id="@motion-canvas/ffmpeg";Ne.displayName="Video (FFmpeg)";Ne.response=new Ot;const lu=dc({name:"ffmpeg-plugin",exporters(){return[Ne]}});let xn;xn??(xn=new er("project",!1));xn.loadData({version:0,shared:{background:"rgba(164,164,164,0)",range:[0,null],size:{x:1920,y:1080},audioOffset:0},preview:{fps:60,resolutionScale:2},rendering:{fps:60,resolutionScale:2,colorSpace:"srgb",exporter:{name:"@motion-canvas/ffmpeg",options:{fastStart:!0,includeAudio:!0}}}});const hu=xn;let Sn;Sn??(Sn=new er("example",!1));Sn.loadData({version:0,timeEvents:[],seed:4267500903});const cu=Sn;function uu(n){var t;return!!((t=n.prototype)!=null&&t.isClass)}const fu=Symbol.for("@motion-canvas/2d/fragment");function Ee(n,t,e){const{ref:r,children:i,...a}=t,h=Array.isArray(i)?i.flat():i;if(n===fu)return h;if(uu(n)){const u=new n({...a,children:h,key:e});return r==null||r(u),u}else return n({...a,ref:r,children:h,key:e})}const mi={invert:{name:"invert"},sepia:{name:"sepia"},grayscale:{name:"grayscale"},brightness:{name:"brightness",default:1},contrast:{name:"contrast",default:1},saturate:{name:"saturate",default:1},hue:{name:"hue-rotate",unit:"deg",scale:1},blur:{name:"blur",transform:!0,unit:"px",scale:1}};class du{get name(){return this.props.name}get default(){return this.props.default}constructor(t){this.props={name:"invert",default:0,unit:"%",scale:100,transform:!1,...t,value:t.value??t.default??0},this.value=je(this.props.value,tt,this)}isActive(){return this.value()!==this.props.default}serialize(t){let e=this.value();return this.props.transform&&(e=un(e,t)),`${this.props.name}(${e*this.props.scale}${this.props.unit})`}}const Wt=Symbol.for("@motion-canvas/2d/decorators/initializers");function rr(n,t){if(!n[Wt])n[Wt]=[];else if(n[Wt]&&!Object.prototype.hasOwnProperty.call(n,Wt)){const e=Object.getPrototypeOf(n);n[Wt]=[...e[Wt]]}n[Wt].push(t)}function pu(n,t){if(n[Wt])try{n[Wt].forEach(e=>e(n,t))}catch(e){throw e.inspect??(e.inspect=n.key),e}}function E(){return(n,t)=>{rr(n,e=>{const r=Object.getPrototypeOf(e)[t];e[t]=nu(r.bind(e),e)})}}function dn(n={},t,e){const r={};if(e&&t){const i=n.setter??(t==null?void 0:t[`set${He(e)}`]);i&&(r.setter=i.bind(t));const a=n.getter??(t==null?void 0:t[`get${He(e)}`]);a&&(r.getter=a.bind(t));const h=n.tweener??(t==null?void 0:t[`tween${He(e)}`]);h&&(r.tweener=h.bind(t))}return r}const Gt=Symbol.for("@motion-canvas/2d/decorators/properties");function Se(n,t){var e;return((e=n[Gt])==null?void 0:e[t])??null}function kn(n,t){let e;return n[Gt]?n[Gt]&&!Object.prototype.hasOwnProperty.call(n,Gt)?n[Gt]=e=Object.fromEntries(Object.entries(n[Gt]).map(([r,i])=>[r,{...i}])):e=n[Gt]:n[Gt]=e={},e[t]??(e[t]={cloneable:!0,inspectable:!0,compoundEntries:[]}),e[t]}function Ei(n){return n&&typeof n=="object"?n[Gt]??{}:{}}function Cn(n,t){pu(n);for(const[e,r]of Object.entries(Ei(n))){const i=n[e];if(i.reset(),t[e]!==void 0&&i(t[e]),r.compoundEntries!==void 0)for(const[a,h]of r.compoundEntries)h in t&&i[a](t[h])}}function R(){return(n,t)=>{const e=kn(n,t);rr(n,r=>{var u;let i=e.default;const a=r[`getDefault${He(t)}`];a&&(i=()=>a.call(r,e.default));const h=new we(i,e.interpolationFunction??De,r,(u=e.parser)==null?void 0:u.bind(r),dn(e,r,t));r[t]=h.toSignal()})}}function I(n){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.default=n}}function Fi(n){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.interpolationFunction=n}}function Tn(n){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.parser=n}}function nr(n){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.parser=i=>new n(i),"lerp"in n&&(r.interpolationFunction??(r.interpolationFunction=n.lerp))}}function ke(n=!0){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.cloneable=n}}function _i(n=!0){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.inspectable=n}}function Di(n,t=Pr){return(e,r)=>{const i=kn(e,r);i.compound=!0,i.compoundEntries=Object.entries(n),rr(e,a=>{if(!i.parser){it().error(`Missing parser decorator for "${r.toString()}"`);return}const h=i.default,u=i.parser.bind(a),v=new t(i.compoundEntries.map(([y,C])=>{const F=new we(me(h,H=>u(H)[y]),tt,a,void 0,dn(void 0,a,C)).toSignal();return[y,F]}),u,h,i.interpolationFunction??De,a,dn(i,a,r));a[r]=v.toSignal()})}}function Jt(n){return(t,e)=>{Di(typeof n=="object"?n:{x:n?`${n}X`:"x",y:n?`${n}Y`:"y"},Ai)(t,e),nr(g)(t,e)}}var ae=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class Nt{constructor(t){Cn(this,t)}canvasGradient(t){let e;switch(this.type()){case"linear":e=t.createLinearGradient(this.from.x(),this.from.y(),this.to.x(),this.to.y());break;case"conic":e=t.createConicGradient(this.angle(),this.from.x(),this.from.y());break;case"radial":e=t.createRadialGradient(this.from.x(),this.from.y(),this.fromRadius(),this.to.x(),this.to.y(),this.toRadius());break}for(const{offset:r,color:i}of this.stops())e.addColorStop(ye(r),new Yt(ye(i)).serialize());return e}}ae([I("linear"),R()],Nt.prototype,"type",void 0);ae([Jt("from")],Nt.prototype,"from",void 0);ae([Jt("to")],Nt.prototype,"to",void 0);ae([I(0),R()],Nt.prototype,"angle",void 0);ae([I(0),R()],Nt.prototype,"fromRadius",void 0);ae([I(0),R()],Nt.prototype,"toRadius",void 0);ae([I([]),R()],Nt.prototype,"stops",void 0);ae([E()],Nt.prototype,"canvasGradient",null);var Rn=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class sr{constructor(t){Cn(this,t)}canvasPattern(t){return t.createPattern(this.image(),this.repetition())}}Rn([R()],sr.prototype,"image",void 0);Rn([I(null),R()],sr.prototype,"repetition",void 0);Rn([E()],sr.prototype,"canvasPattern",null);function gu(n){return n===null?null:n instanceof Nt||n instanceof sr?n:new Yt(n)}function pn(n,t){return n===null?"":n instanceof Yt?n.serialize():n instanceof Nt?n.canvasGradient(t):n instanceof sr?n.canvasPattern(t)??"":""}function bi(n,t,e,r,i){if(e.top===0&&e.right===0&&e.bottom===0&&e.left===0){vu(n,t);return}const a=se(e.top,e.right,e.left,t),h=se(e.right,e.top,e.bottom,t),u=se(e.bottom,e.left,e.right,t),v=se(e.left,e.bottom,e.top,t);if(r){const y=C=>{const F=C*i;return C-F};n.moveTo(t.left+a,t.top),n.lineTo(t.right-h,t.top),n.bezierCurveTo(t.right-y(h),t.top,t.right,t.top+y(h),t.right,t.top+h),n.lineTo(t.right,t.bottom-u),n.bezierCurveTo(t.right,t.bottom-y(u),t.right-y(u),t.bottom,t.right-u,t.bottom),n.lineTo(t.left+v,t.bottom),n.bezierCurveTo(t.left+y(v),t.bottom,t.left,t.bottom-y(v),t.left,t.bottom-v),n.lineTo(t.left,t.top+a),n.bezierCurveTo(t.left,t.top+y(a),t.left+y(a),t.top,t.left+a,t.top);return}n.moveTo(t.left+a,t.top),n.arcTo(t.right,t.top,t.right,t.bottom,h),n.arcTo(t.right,t.bottom,t.left,t.bottom,u),n.arcTo(t.left,t.bottom,t.left,t.top,v),n.arcTo(t.left,t.top,t.right,t.top,a)}function se(n,t,e,r){const i=n+t>r.width?r.width*(n/(n+t)):n,a=n+e>r.height?r.height*(n/(n+e)):n;return Math.min(i,a)}function vu(n,t){n.rect(t.x,t.y,t.width,t.height)}function mu(n,t,e,r){r?n.drawImage(t,e.x,e.y,e.width,e.height,r.x,r.y,r.width,r.height):n.drawImage(t,e.x,e.y,e.width,e.height)}function Lr(n,t){n.moveTo(t.x,t.y)}function qt(n,t){n.lineTo(t.x,t.y)}function pe(n,t){if(!(t.length<2)){Lr(n,t[0]);for(const e of t.slice(1))qt(n,e)}}function bu(n,t,e=8){qt(n,t.addY(-e)),qt(n,t.addY(e)),qt(n,t),qt(n,t.addX(-e)),yu(n,t,e)}function yu(n,t,e,r=0,i=Math.PI*2,a=!1){n.arc(t.x,t.y,e,r,i,a)}function wu(n,t,e,r){n.bezierCurveTo(t.x,t.y,e.x,e.y,r.x,r.y)}function ji(n){return t=>t instanceof n}function Ni(){return(n,t)=>{R()(n,t),Tn(gu)(n,t),Fi(Yt.lerp)(n,t),I(null)(n,t)}}function Bi(){return(n,t)=>{R()(n,t),nr(Yt)(n,t)}}function oe(n,t=e=>e){return(e,r)=>{e[`getDefault${He(r)}`]=function(){this.requestLayoutUpdate();const i=this.element.style[n];this.element.style[n]="";const a=t.call(this,this.styles.getPropertyValue(n));return this.element.style[n]=i,a}}}class xu extends we{constructor(t,e){super(t,De,e);for(const r in mi){const i=mi[r];Object.defineProperty(this.invokable,r,{value:(a,h,u=_t)=>{var y,C,F;if(a===void 0)return((C=(y=this.get())==null?void 0:y.find(H=>H.name===i.name))==null?void 0:C.value())??i.default??0;let v=(F=this.get())==null?void 0:F.find(H=>H.name===i.name);return v||(v=new du(i),this.set([...this.get(),v])),h===void 0?(v.value(a),this.owner):v.value(a,h,u)}})}}*tweener(t,e,r){const i=this.get(),a=ye(t);if(ku(i,a)){yield*ve(...i.map((v,y)=>v.value(a[y].value(),e,r))),this.set(a);return}for(const v of a)v.value(v.default);const h=a.map(v=>v.value.context.raw()),u=i.length>0&&a.length>0?e/2:e;i.length>0&&(yield*ve(...i.map(v=>v.value(v.default,u,r)))),this.set(a),a.length>0&&(yield*ve(...a.map((v,y)=>v.value(h[y],u,r))))}}function Su(){return(n,t)=>{const e=kn(n,t);rr(n,r=>{r[t]=new xu(e.default??[],r).toSignal()})}}function ku(n,t){if(n.length!==t.length)return!1;for(let e=0;e=e){const h=(e-a)/i.arcLength;return i.getPoint(xt(0,1,h))}}return{position:g.zero,tangent:g.up,normal:g.up}}function $r(n){return(t,e)=>{Di({top:n?`${n}Top`:"top",right:n?`${n}Right`:"right",bottom:n?`${n}Bottom`:"bottom",left:n?`${n}Left`:"left"})(t,e),nr(At)(t,e)}}function Tu(n){let t;return n?typeof n=="string"?t=[{fragment:n}]:Array.isArray(n)?t=n.map(e=>typeof e=="string"?{fragment:e}:e):t=[n]:t=[],!bn().experimentalFeatures&&t.length>0&&(t=[],it().log({...Rc("Node uses experimental shaders."),inspect:this.key})),t}function wr(){return bn()}var _=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},xr;let z=xr=class{get x(){return this.position.x}get y(){return this.position.y}getAbsolutePosition(){return new g(this.parentToWorld().transformPoint(this.position()))}setAbsolutePosition(t){this.position(me(t,e=>new g(e).transformAsPoint(this.worldToParent())))}getAbsoluteRotation(){const t=this.localToWorld();return g.degrees(t.m11,t.m12)}setAbsoluteRotation(t){this.rotation(me(t,e=>au(e,this.worldToParent())))}getAbsoluteScale(){const t=this.localToWorld();return new g(g.magnitude(t.m11,t.m12),g.magnitude(t.m21,t.m22))}setAbsoluteScale(t){this.scale(me(t,e=>this.getRelativeScale(new g(e))))}getRelativeScale(t){var r;const e=((r=this.parent())==null?void 0:r.absoluteScale())??g.one;return t.div(e)}*tweenCompositeOperation(t,e,r){const i=ye(t);i==="source-over"?(yield*this.compositeOverride(1,e,r),this.compositeOverride(0),this.compositeOperation(i)):(this.compositeOperation(i),this.compositeOverride(1),yield*this.compositeOverride(0,e,r))}absoluteOpacity(){var t;return(((t=this.parent())==null?void 0:t.absoluteOpacity())??1)*this.opacity()}hasFilters(){return!!this.filters().find(t=>t.isActive())}hasShadow(){return!!this.shadowColor()&&(this.shadowBlur()>0||this.shadowOffset.x()!==0||this.shadowOffset.y()!==0)}filterString(){let t="";const e=this.compositeToWorld();for(const r of this.filters())r.isActive()&&(t+=" "+r.serialize(e));return t}getSpawner(){return this.children()}setSpawner(t){this.children(t)}setChildren(t){if(this.children.context.raw()!==t){if(this.children.context.setter(t),!Ht(t))this.spawnChildren(!1,t);else if(!this.hasSpawnedChildren)for(const e of this.realChildren)e.parent(null)}}getChildren(){return this.children.context.getter(),this.spawnedChildren()}spawnedChildren(){const t=this.children.context.getter();return Ht(this.children.context.raw())&&this.spawnChildren(!0,t),this.realChildren}sortedChildren(){return[...this.children()].sort((t,e)=>Math.sign(t.zIndex()-e.zIndex()))}constructor({children:t,spawner:e,key:r,...i}){this.compositeOverride=je(0),this.stateStack=[],this.realChildren=[],this.hasSpawnedChildren=!1,this.parent=je(null),this.properties=Ei(this);const a=wr();[this.key,this.unregister]=a.registerNode(this,r),this.view2D=a.getView(),this.creationStack=new Error().stack,Cn(this,i),e&&it().warn({message:"Node.spawner() has been deprecated.",remarks:"Use Node.children() instead.",inspect:this.key,stack:new Error().stack}),this.children(e??t)}localToWorld(){const t=this.parent();return t?t.localToWorld().multiply(this.localToParent()):this.localToParent()}worldToLocal(){return this.localToWorld().inverse()}worldToParent(){var t;return((t=this.parent())==null?void 0:t.worldToLocal())??new DOMMatrix}parentToWorld(){var t;return((t=this.parent())==null?void 0:t.localToWorld())??new DOMMatrix}localToParent(){const t=new DOMMatrix;return t.translateSelf(this.x(),this.y()),t.rotateSelf(0,0,this.rotation()),t.scaleSelf(this.scale.x(),this.scale.y()),t.skewXSelf(this.skew.x()),t.skewYSelf(this.skew.y()),t}compositeToWorld(){var t;return((t=this.compositeRoot())==null?void 0:t.localToWorld())??new DOMMatrix}compositeRoot(){var t;return this.composite()?this:((t=this.parent())==null?void 0:t.compositeRoot())??null}compositeToLocal(){const t=this.compositeRoot();if(t){const e=this.worldToLocal();return e.m44=1,t.localToWorld().multiply(e)}return new DOMMatrix}view(){return this.view2D}add(t){return this.insert(t,1/0)}insert(t,e=0){const r=Array.isArray(t)?t:[t];if(r.length===0)return this;const i=this.children(),a=i.slice(0,e);for(const h of r)h instanceof xr&&(a.push(h),h.remove(),h.parent(this));return a.push(...i.slice(e)),this.setParsedChildren(a),this}remove(){const t=this.parent();return t===null?this:(t.removeChild(this),this.parent(null),this)}move(t=1){const e=this.parent();if(t===0||!e)return this;const r=e.children(),i=[];if(t>0)for(let a=0;a=0;a--){const h=r[a];if(h===this){const u=a+t;for(;a>u&&a>0;a--)i[a]=r[a-1]}i[a]=h}return e.setParsedChildren(i),this}moveUp(){return this.move(1)}moveDown(){return this.move(-1)}moveToTop(){return this.move(1/0)}moveToBottom(){return this.move(-1/0)}moveTo(t){const e=this.parent();if(!e)return this;const r=e.children().indexOf(this),i=t-r;return this.move(i)}moveBelow(t,e=!1){const r=this.parent();if(!r)return this;if(t.parent()!==r)return it().error("Cannot position nodes relative to each other if they don't belong to the same parent."),this;const i=r.children(),a=i.indexOf(this),h=i.indexOf(t);if(!e&&ah)return this;const u=h-a+1;return this.move(u)}reparent(t){const e=this.absolutePosition(),r=this.absoluteRotation(),i=this.absoluteScale();return t.add(this),this.absolutePosition(e),this.absoluteRotation(r),this.absoluteScale(i),this}removeChildren(){for(const t of this.realChildren)t.parent(null);return this.setParsedChildren([]),this}peekChildren(){return this.realChildren}findAll(t){const e=[],r=this.reversedChildren();for(;r.length>0;){const i=r.pop();t(i)&&e.push(i);const a=i.children();for(let h=a.length-1;h>=0;h--)r.push(a[h])}return e}findFirst(t){const e=this.reversedChildren();for(;e.length>0;){const r=e.pop();if(t(r))return r;const i=r.children();for(let a=i.length-1;a>=0;a--)e.push(i[a])}return null}findLast(t){const e=[],r=this.reversedChildren();for(;r.length>0;){const i=r.pop();e.push(i);const a=i.children();for(let h=a.length-1;h>=0;h--)r.push(a[h])}for(;e.length>0;){const i=e.pop();if(t(i))return i}return null}findAncestor(t){let e=this.parent();for(;e;){if(t(e))return e;e=e.parent()}return null}childAs(t){return this.children()[t]??null}childrenAs(){return this.children()}parentAs(){return this.parent()??null}dispose(){if(this.unregister){this.stateStack=[],this.unregister(),this.unregister=null;for(const{signal:t}of this)t==null||t.context.dispose();for(const t of this.realChildren)t.dispose()}}clone(t={}){const e={...t};Ht(this.children.context.raw())?e.children??(e.children=this.children.context.raw()):this.children().length>0&&(e.children??(e.children=this.children().map(r=>r.clone())));for(const{key:r,meta:i,signal:a}of this)if(!(!i.cloneable||r in e))if(i.compound)for(const[h,u]of i.compoundEntries){if(u in e)continue;const v=a[h];v.context.isInitial()||(e[u]=v.context.raw())}else a.context.isInitial()||(e[r]=a.context.raw());return this.instantiate(e)}snapshotClone(t={}){const e={...this.getState(),...t};return this.children().length>0&&(e.children??(e.children=this.children().map(r=>r.snapshotClone()))),this.instantiate(e)}reactiveClone(t={}){const e={...t};this.children().length>0&&(e.children??(e.children=this.children().map(r=>r.reactiveClone())));for(const{key:r,meta:i,signal:a}of this)!i.cloneable||r in e||(e[r]=()=>a());return this.instantiate(e)}instantiate(t={}){return new this.constructor(t)}setParsedChildren(t){this.children.context.setter(t),this.realChildren=t}spawnChildren(t,e){const r=this.parseChildren(e),i=new Set;for(const a of r){const h=a.parent.context.raw();h&&h!==this&&h.removeChild(a),i.add(a.key),a.parent(this)}for(const a of this.realChildren)i.has(a.key)||a.parent(null);this.hasSpawnedChildren=t,this.realChildren=r}parseChildren(t){const e=[],r=Array.isArray(t)?t:[t];for(const i of r)i instanceof xr&&e.push(i);return e}removeChild(t){this.setParsedChildren(this.children().filter(e=>e!==t))}requiresCache(){return this.cache()||this.opacity()<1||this.compositeOperation()!=="source-over"||this.hasFilters()||this.hasShadow()||this.shaders().length>0}cacheCanvas(){const t=document.createElement("canvas").getContext("2d");if(!t)throw new Error("Could not create a cache canvas");return t}cachedCanvas(){const t=this.cacheCanvas(),e=this.worldSpaceCacheBBox(),r=this.localToWorld();return t.canvas.width=e.width,t.canvas.height=e.height,t.setTransform(r.a,r.b,r.c,r.d,r.e-e.x,r.f-e.y),this.draw(t),t}getCacheBBox(){return new V}cacheBBox(){const t=this.getCacheBBox(),e=this.children(),r=this.cachePadding();if(e.length===0)return t.addSpacing(r);const i=t.corners;for(const h of e){const u=h.fullCacheBBox(),v=h.localToParent();i.push(...u.corners.map(y=>y.transformAsPoint(v)))}return V.fromPoints(...i).addSpacing(r)}fullCacheBBox(){const t=this.compositeToLocal(),e=this.shadowOffset().transform(t),r=un(this.shadowBlur(),t),i=this.cacheBBox().expand(this.filters.blur()*2+r);return e.x<0?(i.x+=e.x,i.width-=e.x):i.width+=e.x,e.y<0?(i.y+=e.y,i.height-=e.y):i.height+=e.y,i}worldSpaceCacheBBox(){const t=V.fromSizeCentered(this.view().size()).expand(this.view().cachePadding()),e=V.fromPoints(...t.transformCorners(this.view().localToWorld())),r=V.fromPoints(...this.cacheBBox().transformCorners(this.localToWorld()));return e.intersection(r).pixelPerfect.expand(2)}parentWorldSpaceCacheBBox(){var t;return((t=this.findAncestor(e=>e.requiresCache()))==null?void 0:t.worldSpaceCacheBBox())??new V(g.zero,wr().getRealSize())}setupDrawFromCache(t){if(t.globalCompositeOperation=this.compositeOperation(),t.globalAlpha*=this.opacity(),this.hasFilters()&&(t.filter=this.filterString()),this.hasShadow()){const r=this.compositeToWorld(),i=this.shadowOffset().transform(r),a=un(this.shadowBlur(),r);t.shadowColor=this.shadowColor().serialize(),t.shadowBlur=a,t.shadowOffsetX=i.x,t.shadowOffsetY=i.y}const e=this.worldToLocal();t.transform(e.a,e.b,e.c,e.d,e.e,e.f)}renderFromSource(t,e,r,i){this.setupDrawFromCache(t);const a=this.compositeOverride();t.drawImage(e,r,i),a>0&&(t.save(),t.globalAlpha*=a,t.globalCompositeOperation="source-over",t.drawImage(e,r,i),t.restore())}shaderCanvas(t,e){var F,H;const r=this.shaders();if(r.length===0)return null;const i=wr(),a=i.getRealSize(),h=this.parentWorldSpaceCacheBBox(),u=new DOMMatrix().scaleSelf(a.width/h.width,a.height/-h.height).translateSelf(h.x/-a.width,h.y/a.height-1),v=this.worldSpaceCacheBBox(),y=new DOMMatrix().scaleSelf(a.width/v.width,a.height/-v.height).translateSelf(v.x/-a.width,v.y/a.height-1).invertSelf(),C=i.shaders.getGL();i.shaders.copyTextures(t,e),i.shaders.clear();for(const J of r){const et=i.shaders.getProgram(J.fragment);if(et){if(J.uniforms)for(const[T,rt]of Object.entries(J.uniforms)){const ht=C.getUniformLocation(et,T);if(ht===null)continue;const K=ye(rt);typeof K=="number"?C.uniform1f(ht,K):"toUniform"in K?K.toUniform(C,ht):K.length===1?C.uniform1f(ht,K[0]):K.length===2?C.uniform2f(ht,K[0],K[1]):K.length===3?C.uniform3f(ht,K[0],K[1],K[2]):K.length===4&&C.uniform4f(ht,K[0],K[1],K[2],K[3])}C.uniform1f(C.getUniformLocation(et,gi),this.view2D.globalTime()),C.uniform1i(C.getUniformLocation(et,gi),i.playback.frame),C.uniformMatrix4fv(C.getUniformLocation(et,Wc),!1,y.toFloat32Array()),C.uniformMatrix4fv(C.getUniformLocation(et,Gc),!1,u.toFloat32Array()),(F=J.setup)==null||F.call(J,C,et),i.shaders.render(),(H=J.teardown)==null||H.call(J,C,et)}}return C.canvas}render(t){if(!(this.absoluteOpacity()<=0)){if(t.save(),this.transformContext(t),this.requiresCache()){const e=this.worldSpaceCacheBBox();if(e.width!==0&&e.height!==0){const r=this.cachedCanvas().canvas,i=this.shaderCanvas(t.canvas,r);i?this.renderFromSource(t,i,0,0):this.renderFromSource(t,r,e.position.x,e.position.y)}}else this.draw(t);t.restore()}}draw(t){this.drawChildren(t)}drawChildren(t){for(const e of this.sortedChildren())e.render(t)}drawOverlay(t,e){const r=this.cacheBBox().transformCorners(e),i=this.getCacheBBox().transformCorners(e);t.strokeStyle="white",t.lineWidth=1,t.beginPath(),pe(t,r),t.closePath(),t.stroke(),t.strokeStyle="blue",t.beginPath(),pe(t,i),t.closePath(),t.stroke()}transformContext(t){const e=this.localToParent();t.transform(e.a,e.b,e.c,e.d,e.e,e.f)}hit(t){let e=null;const r=t.transformAsPoint(this.localToParent().inverse()),i=this.children();for(let a=i.length-1;a>=0&&(e=i[a].hit(r),!e);a--);return e}collectAsyncResources(){for(const t of this.children())t.collectAsyncResources()}async toPromise(){do await lt.consumePromises(),this.collectAsyncResources();while(lt.hasPromises());return this}getState(){const t={};for(const{key:e,meta:r,signal:i}of this)!r.cloneable||e in t||(t[e]=i());return t}applyState(t,e,r=_t){if(e===void 0)for(const a in t){const h=this.signalByKey(a);h&&h(t[a])}const i=[];for(const a in t){const h=this.signalByKey(a);t[a]!==h.context.raw()&&i.push(h(t[a],e,r))}return ve(...i)}save(){this.stateStack.push(this.getState())}restore(t,e=_t){const r=this.stateStack.pop();if(r!==void 0)return this.applyState(r,t,e)}*[Symbol.iterator](){for(const t in this.properties){const e=this.properties[t],r=this.signalByKey(t);yield{meta:e,signal:r,key:t}}}signalByKey(t){return this[t]}reversedChildren(){const t=this.children(),e=[];for(let r=t.length-1;r>=0;r--)e.push(t[r]);return e}};_([Jt()],z.prototype,"position",void 0);_([nr(g),ke(!1),R()],z.prototype,"absolutePosition",void 0);_([I(0),R()],z.prototype,"rotation",void 0);_([ke(!1),R()],z.prototype,"absoluteRotation",void 0);_([I(g.one),Jt("scale")],z.prototype,"scale",void 0);_([I(g.zero),Jt("skew")],z.prototype,"skew",void 0);_([nr(g),ke(!1),R()],z.prototype,"absoluteScale",void 0);_([I(0),R()],z.prototype,"zIndex",void 0);_([I(!1),R()],z.prototype,"cache",void 0);_([$r("cachePadding")],z.prototype,"cachePadding",void 0);_([I(!1),R()],z.prototype,"composite",void 0);_([I("source-over"),R()],z.prototype,"compositeOperation",void 0);_([ft()],z.prototype,"tweenCompositeOperation",null);_([I(1),Tn(n=>xt(0,1,n)),R()],z.prototype,"opacity",void 0);_([E()],z.prototype,"absoluteOpacity",null);_([Su()],z.prototype,"filters",void 0);_([I("#0000"),Bi()],z.prototype,"shadowColor",void 0);_([I(0),R()],z.prototype,"shadowBlur",void 0);_([Jt("shadowOffset")],z.prototype,"shadowOffset",void 0);_([I([]),Tn(Tu),R()],z.prototype,"shaders",void 0);_([E()],z.prototype,"hasFilters",null);_([E()],z.prototype,"hasShadow",null);_([E()],z.prototype,"filterString",null);_([_i(!1),ke(!1),R()],z.prototype,"spawner",void 0);_([_i(!1),ke(!1),R()],z.prototype,"children",void 0);_([E()],z.prototype,"spawnedChildren",null);_([E()],z.prototype,"sortedChildren",null);_([E()],z.prototype,"localToWorld",null);_([E()],z.prototype,"worldToLocal",null);_([E()],z.prototype,"worldToParent",null);_([E()],z.prototype,"parentToWorld",null);_([E()],z.prototype,"localToParent",null);_([E()],z.prototype,"compositeToWorld",null);_([E()],z.prototype,"compositeRoot",null);_([E()],z.prototype,"compositeToLocal",null);_([E()],z.prototype,"cacheCanvas",null);_([E()],z.prototype,"cachedCanvas",null);_([E()],z.prototype,"cacheBBox",null);_([E()],z.prototype,"fullCacheBBox",null);_([E()],z.prototype,"worldSpaceCacheBBox",null);_([E()],z.prototype,"parentWorldSpaceCacheBBox",null);z=xr=_([Ce("Node")],z);z.prototype.isClass=!0;var A=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},Sr;let $=Sr=class extends z{get columnGap(){return this.gap.x}get rowGap(){return this.gap.y}getX(){return this.isLayoutRoot()?this.x.context.getter():this.computedPosition().x}setX(t){this.x.context.setter(t)}getY(){return this.isLayoutRoot()?this.y.context.getter():this.computedPosition().y}setY(t){this.y.context.setter(t)}get width(){return this.size.x}get height(){return this.size.y}getWidth(){return this.computedSize().width}setWidth(t){this.width.context.setter(t)}*tweenWidth(t,e,r,i){const a=this.desiredSize().x,h=typeof a!="number"||typeof t!="number";let u;h?u=this.size.x():u=a;let v;h?(this.size.x(t),v=this.size.x()):v=t,this.size.x(u),h&&this.lockSize(),yield*Dt(e,y=>this.size.x(i(u,v,r(y)))),this.size.x(t),h&&this.releaseSize()}getHeight(){return this.computedSize().height}setHeight(t){this.height.context.setter(t)}*tweenHeight(t,e,r,i){const a=this.desiredSize().y,h=typeof a!="number"||typeof t!="number";let u;h?u=this.size.y():u=a;let v;h?(this.size.y(t),v=this.size.y()):v=t,this.size.y(u),h&&this.lockSize(),yield*Dt(e,y=>this.size.y(i(u,v,r(y)))),this.size.y(t),h&&this.releaseSize()}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}*tweenSize(t,e,r,i){const a=this.desiredSize();let h;typeof a.x!="number"||typeof a.y!="number"?h=this.size():h=new g(a);let u;typeof t=="object"&&typeof t.x=="number"&&typeof t.y=="number"?u=new g(t):(this.size(t),u=this.size()),this.size(h),this.lockSize(),yield*Dt(e,v=>this.size(i(h,u,r(v)))),this.releaseSize(),this.size(t)}cardinalPoint(t){switch(t){case ot.TopLeft:return this.topLeft;case ot.TopRight:return this.topRight;case ot.BottomLeft:return this.bottomLeft;case ot.BottomRight:return this.bottomRight;case ot.Top:case St.Top:return this.top;case ot.Bottom:case St.Bottom:return this.bottom;case ot.Left:case St.Left:return this.left;case ot.Right:case St.Right:return this.right;default:return this.middle}}constructor(t){super(t),this.element.dataset.motionCanvasKey=this.key}lockSize(){this.sizeLockCounter(this.sizeLockCounter()+1)}releaseSize(){this.sizeLockCounter(this.sizeLockCounter()-1)}parentTransform(){return this.findAncestor(ji(Sr))}anchorPosition(){const t=this.computedSize(),e=this.offset();return t.scale(.5).mul(e)}layoutEnabled(){var t;return this.layout()??((t=this.parentTransform())==null?void 0:t.layoutEnabled())??!1}isLayoutRoot(){var t;return!this.layoutEnabled()||!((t=this.parentTransform())!=null&&t.layoutEnabled())}localToParent(){const t=super.localToParent(),e=this.offset();if(!e.exactlyEquals(g.zero)){const r=this.size().mul(e).scale(-.5);t.translateSelf(r.x,r.y)}return t}scalingRotationMatrix(){const t=new DOMMatrix;t.rotateSelf(0,0,this.rotation()),t.scaleSelf(this.scale.x(),this.scale.y());const e=this.offset();if(!e.exactlyEquals(g.zero)){const r=this.size().mul(e).scale(-.5);t.translateSelf(r.x,r.y)}return t}getComputedLayout(){return new V(this.element.getBoundingClientRect())}computedPosition(){this.requestLayoutUpdate();const t=this.getComputedLayout(),e=new g(t.x+t.width/2*this.offset.x(),t.y+t.height/2*this.offset.y()),r=this.parentTransform();if(r){const i=r.getComputedLayout();e.x-=i.x+(i.width-t.width)/2,e.y-=i.y+(i.height-t.height)/2}return e}computedSize(){return this.requestLayoutUpdate(),this.getComputedLayout().size}requestLayoutUpdate(){const t=this.parentTransform();this.appendedToView()?(t==null||t.requestFontUpdate(),this.updateLayout()):t.requestLayoutUpdate()}appendedToView(){const t=this.isLayoutRoot();return t&&this.view().element.append(this.element),t}updateLayout(){if(this.applyFont(),this.applyFlex(),this.layoutEnabled()){const t=this.layoutChildren();for(const e of t)e.updateLayout()}}layoutChildren(){const t=[...this.children()],e=[],r=[];for(;t.length;){const i=t.shift();i instanceof Sr?i.layoutEnabled()&&(e.push(i),r.push(i.element)):i&&t.unshift(...i.children())}return this.element.replaceChildren(...r),e}requestFontUpdate(){var t;this.appendedToView(),(t=this.parentTransform())==null||t.requestFontUpdate(),this.applyFont()}getCacheBBox(){return V.fromSizeCentered(this.computedSize())}draw(t){if(this.clip()){const e=this.computedSize();if(e.width===0||e.height===0)return;t.beginPath(),t.rect(e.width/-2,e.height/-2,e.width,e.height),t.closePath(),t.clip()}this.drawChildren(t)}drawOverlay(t,e){const r=this.computedSize(),i=r.mul(this.offset()).scale(.5).transformAsPoint(e),a=V.fromSizeCentered(r),h=a.transformCorners(e),u=a.addSpacing(this.padding().scale(-1)).transformCorners(e),v=a.addSpacing(this.margin()).transformCorners(e);t.beginPath(),pe(t,v),pe(t,h),t.closePath(),t.fillStyle="rgba(255,193,125,0.6)",t.fill("evenodd"),t.beginPath(),pe(t,h),pe(t,u),t.closePath(),t.fillStyle="rgba(180,255,147,0.6)",t.fill("evenodd"),t.beginPath(),pe(t,h),t.closePath(),t.lineWidth=1,t.strokeStyle="white",t.stroke(),t.beginPath(),bu(t,i),t.stroke()}getOriginDelta(t){const e=this.computedSize().scale(.5),r=this.offset().mul(e);return t===ot.Middle?r.flipped:su(t).mul(e).sub(r)}moveOffset(t){const e=this.computedSize().scale(.5),r=this.offset().mul(e),i=t.mul(e);this.offset(t),this.position(this.position().add(i).sub(r))}parsePixels(t){return t===null?"":`${t}px`}parseLength(t){return t===null?"":typeof t=="string"?t:`${t}px`}applyFlex(){this.element.style.position=this.isLayoutRoot()?"absolute":"relative";const t=this.desiredSize();this.element.style.width=this.parseLength(t.x),this.element.style.height=this.parseLength(t.y),this.element.style.maxWidth=this.parseLength(this.maxWidth()),this.element.style.minWidth=this.parseLength(this.minWidth()),this.element.style.maxHeight=this.parseLength(this.maxHeight()),this.element.style.minHeight=this.parseLength(this.minHeight()),this.element.style.aspectRatio=this.ratio()===null?"":this.ratio().toString(),this.element.style.marginTop=this.parsePixels(this.margin.top()),this.element.style.marginBottom=this.parsePixels(this.margin.bottom()),this.element.style.marginLeft=this.parsePixels(this.margin.left()),this.element.style.marginRight=this.parsePixels(this.margin.right()),this.element.style.paddingTop=this.parsePixels(this.padding.top()),this.element.style.paddingBottom=this.parsePixels(this.padding.bottom()),this.element.style.paddingLeft=this.parsePixels(this.padding.left()),this.element.style.paddingRight=this.parsePixels(this.padding.right()),this.element.style.flexDirection=this.direction(),this.element.style.flexBasis=this.parseLength(this.basis()),this.element.style.flexWrap=this.wrap(),this.element.style.justifyContent=this.justifyContent(),this.element.style.alignContent=this.alignContent(),this.element.style.alignItems=this.alignItems(),this.element.style.alignSelf=this.alignSelf(),this.element.style.columnGap=this.parseLength(this.gap.x()),this.element.style.rowGap=this.parseLength(this.gap.y()),this.sizeLockCounter()>0?(this.element.style.flexGrow="0",this.element.style.flexShrink="0"):(this.element.style.flexGrow=this.grow().toString(),this.element.style.flexShrink=this.shrink().toString())}applyFont(){if(this.element.style.fontFamily=this.fontFamily.isInitial()?"":this.fontFamily(),this.element.style.fontSize=this.fontSize.isInitial()?"":`${this.fontSize()}px`,this.element.style.fontStyle=this.fontStyle.isInitial()?"":this.fontStyle(),this.lineHeight.isInitial())this.element.style.lineHeight="";else{const t=this.lineHeight();this.element.style.lineHeight=typeof t=="string"?(parseFloat(t)/100).toString():`${t}px`}if(this.element.style.fontWeight=this.fontWeight.isInitial()?"":this.fontWeight().toString(),this.element.style.letterSpacing=this.letterSpacing.isInitial()?"":`${this.letterSpacing()}px`,this.element.style.textAlign=this.textAlign.isInitial()?"":this.textAlign(),this.textWrap.isInitial())this.element.style.whiteSpace="";else{const t=this.textWrap();typeof t=="boolean"?this.element.style.whiteSpace=t?"normal":"nowrap":this.element.style.whiteSpace=t}}dispose(){var t;super.dispose(),(t=this.sizeLockCounter)==null||t.context.dispose(),this.element&&(this.element.remove(),this.element.innerHTML=""),this.element=null,this.styles=null}hit(t){const e=t.transformAsPoint(this.localToParent().inverse());return this.cacheBBox().includes(e)?super.hit(t)??this:null}};A([I(null),Fi(Qc),R()],$.prototype,"layout",void 0);A([I(null),R()],$.prototype,"maxWidth",void 0);A([I(null),R()],$.prototype,"maxHeight",void 0);A([I(null),R()],$.prototype,"minWidth",void 0);A([I(null),R()],$.prototype,"minHeight",void 0);A([I(null),R()],$.prototype,"ratio",void 0);A([$r("margin")],$.prototype,"margin",void 0);A([$r("padding")],$.prototype,"padding",void 0);A([I("row"),R()],$.prototype,"direction",void 0);A([I(null),R()],$.prototype,"basis",void 0);A([I(0),R()],$.prototype,"grow",void 0);A([I(1),R()],$.prototype,"shrink",void 0);A([I("nowrap"),R()],$.prototype,"wrap",void 0);A([I("start"),R()],$.prototype,"justifyContent",void 0);A([I("normal"),R()],$.prototype,"alignContent",void 0);A([I("stretch"),R()],$.prototype,"alignItems",void 0);A([I("auto"),R()],$.prototype,"alignSelf",void 0);A([I(0),Jt({x:"columnGap",y:"rowGap"})],$.prototype,"gap",void 0);A([oe("font-family"),R()],$.prototype,"fontFamily",void 0);A([oe("font-size",parseFloat),R()],$.prototype,"fontSize",void 0);A([oe("font-style"),R()],$.prototype,"fontStyle",void 0);A([oe("font-weight",parseInt),R()],$.prototype,"fontWeight",void 0);A([oe("line-height",parseFloat),R()],$.prototype,"lineHeight",void 0);A([oe("letter-spacing",n=>n==="normal"?0:parseFloat(n)),R()],$.prototype,"letterSpacing",void 0);A([oe("white-space",n=>n==="pre"?"pre":n==="normal"),R()],$.prototype,"textWrap",void 0);A([I("inherit"),R()],$.prototype,"textDirection",void 0);A([oe("text-align"),R()],$.prototype,"textAlign",void 0);A([I({x:null,y:null}),Jt({x:"width",y:"height"})],$.prototype,"size",void 0);A([ft()],$.prototype,"tweenWidth",null);A([ft()],$.prototype,"tweenHeight",null);A([E()],$.prototype,"desiredSize",null);A([ft()],$.prototype,"tweenSize",null);A([Jt("offset")],$.prototype,"offset",void 0);A([Qt(ot.Middle)],$.prototype,"middle",void 0);A([Qt(ot.Top)],$.prototype,"top",void 0);A([Qt(ot.Bottom)],$.prototype,"bottom",void 0);A([Qt(ot.Left)],$.prototype,"left",void 0);A([Qt(ot.Right)],$.prototype,"right",void 0);A([Qt(ot.TopLeft)],$.prototype,"topLeft",void 0);A([Qt(ot.TopRight)],$.prototype,"topRight",void 0);A([Qt(ot.BottomLeft)],$.prototype,"bottomLeft",void 0);A([Qt(ot.BottomRight)],$.prototype,"bottomRight",void 0);A([I(!1),R()],$.prototype,"clip",void 0);A([I(0),R()],$.prototype,"sizeLockCounter",void 0);A([E()],$.prototype,"parentTransform",null);A([E()],$.prototype,"anchorPosition",null);A([E()],$.prototype,"layoutEnabled",null);A([E()],$.prototype,"isLayoutRoot",null);A([E()],$.prototype,"scalingRotationMatrix",null);A([E()],$.prototype,"computedPosition",null);A([E()],$.prototype,"computedSize",null);A([E()],$.prototype,"requestLayoutUpdate",null);A([E()],$.prototype,"appendedToView",null);A([E()],$.prototype,"updateLayout",null);A([E()],$.prototype,"layoutChildren",null);A([E()],$.prototype,"requestFontUpdate",null);A([E()],$.prototype,"applyFlex",null);A([E()],$.prototype,"applyFont",null);$=Sr=A([Ce("Layout")],$);function Qt(n){return(t,e)=>{R()(t,e),ke(!1)(t,e);const r=Se(t,e);r.parser=i=>new g(i),r.getter=function(){return this.computedSize().getOriginOffset(n).transformAsPoint(this.localToParent())},r.setter=function(i){return this.position(me(i,a=>this.getOriginDelta(n).transform(this.scalingRotationMatrix()).flipped.add(a))),this}}}rr($.prototype,n=>{n.element=document.createElement("div"),n.element.style.display="flex",n.element.style.boxSizing="border-box",n.styles=getComputedStyle(n.element)});var Pt=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let yt=class extends ${rippleSize(){return tu(this.rippleStrength(),0,50)}constructor(t){super(t),this.rippleStrength=je(0)}applyText(t){t.direction=this.textDirection(),this.element.dir=this.textDirection()}applyStyle(t){t.fillStyle=pn(this.fill(),t),t.strokeStyle=pn(this.stroke(),t),t.lineWidth=this.lineWidth(),t.lineJoin=this.lineJoin(),t.lineCap=this.lineCap(),t.setLineDash(this.lineDash()),t.lineDashOffset=this.lineDashOffset(),this.antialiased()||(t.filter="url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxmaWx0ZXIgaWQ9ImZpbHRlciIgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIj48ZmVDb21wb25lbnRUcmFuc2Zlcj48ZmVGdW5jUiB0eXBlPSJpZGVudGl0eSIvPjxmZUZ1bmNHIHR5cGU9ImlkZW50aXR5Ii8+PGZlRnVuY0IgdHlwZT0iaWRlbnRpdHkiLz48ZmVGdW5jQSB0eXBlPSJkaXNjcmV0ZSIgdGFibGVWYWx1ZXM9IjAgMSIvPjwvZmVDb21wb25lbnRUcmFuc2Zlcj48L2ZpbHRlcj48L3N2Zz4=#filter)")}draw(t){this.drawShape(t),this.clip()&&t.clip(this.getPath()),this.drawChildren(t)}drawShape(t){const e=this.getPath(),r=this.lineWidth()>0&&this.stroke()!==null,i=this.fill()!==null;t.save(),this.applyStyle(t),this.drawRipple(t),this.strokeFirst()?(r&&t.stroke(e),i&&t.fill(e)):(i&&t.fill(e),r&&t.stroke(e)),t.restore()}getCacheBBox(){return super.getCacheBBox().expand(this.lineWidth()/2)}getPath(){return new Path2D}getRipplePath(){return new Path2D}drawRipple(t){const e=this.rippleStrength();if(e>0){const r=this.getRipplePath();t.save(),t.globalAlpha*=tt(.54,0,e),t.fill(r),t.restore()}}*ripple(t=1){this.rippleStrength(0),yield*this.rippleStrength(1,t,eu),this.rippleStrength(0)}};Pt([Ni()],yt.prototype,"fill",void 0);Pt([Ni()],yt.prototype,"stroke",void 0);Pt([I(!1),R()],yt.prototype,"strokeFirst",void 0);Pt([I(0),R()],yt.prototype,"lineWidth",void 0);Pt([I("miter"),R()],yt.prototype,"lineJoin",void 0);Pt([I("butt"),R()],yt.prototype,"lineCap",void 0);Pt([I([]),R()],yt.prototype,"lineDash",void 0);Pt([I(0),R()],yt.prototype,"lineDashOffset",void 0);Pt([I(!0),R()],yt.prototype,"antialiased",void 0);Pt([E()],yt.prototype,"rippleSize",null);Pt([E()],yt.prototype,"getPath",null);Pt([ft()],yt.prototype,"ripple",null);yt=Pt([Ce("Shape")],yt);var zt=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let Tt=class extends yt{desiredSize(){return this.childrenBBox().size}constructor(t){super(t),this.canHaveSubpath=!1}percentageToDistance(t){return xt(0,this.baseArcLength(),this.startOffset()+this.offsetArcLength()*t)}distanceToPercentage(t){return(t-this.startOffset())/this.offsetArcLength()}baseArcLength(){return this.profile().arcLength}offsetArcLength(){const t=this.startOffset(),e=this.endOffset(),r=this.baseArcLength();return xt(0,r,r-t-e)}arcLength(){return this.offsetArcLength()*Math.abs(this.start()-this.end())}completion(){return Math.abs(this.start()-this.end())}processSubpath(t,e,r){}curveDrawingInfo(){const t=new Path2D;let e=new Path2D;const r=this.profile();let i=this.percentageToDistance(this.start()),a=this.percentageToDistance(this.end());i>a&&([i,a]=[a,i]);const h=a-i,u=Math.min(h/2,this.arrowSize());this.startArrow()&&(i+=u/2),this.endArrow()&&(a-=u/2);let v=0,y=null,C=null,F=null,H=null;for(const J of r.segments){const et=v;if(v+=J.arcLength,va)break}return this.closed()&&this.start.isInitial()&&this.end.isInitial()&&this.startOffset.isInitial()&&this.endOffset.isInitial()&&e.closePath(),this.processSubpath(e,y,F),t.addPath(e),{startPoint:y??g.zero,startTangent:C??g.right,endPoint:F??g.zero,endTangent:H??g.right,arrowSize:u,path:t,startOffset:i}}getPointAtDistance(t){return yi(this.profile(),t+this.startOffset())}getPointAtPercentage(t){return yi(this.profile(),this.percentageToDistance(t))}getComputedLayout(){return this.offsetComputedLayout(super.getComputedLayout())}offsetComputedLayout(t){return t.position=t.position.sub(this.childrenBBox().center),t}getPath(){return this.curveDrawingInfo().path}getCacheBBox(){const t=this.childrenBBox(),e=this.startArrow()||this.endArrow()?this.arrowSize():0,r=this.lineWidth(),i=this.lineWidthCoefficient();return t.expand(Math.max(0,e,r*i))}lineWidthCoefficient(){return this.lineCap()==="square"?.5*1.4143:.5}requiresProfile(){return!this.start.isInitial()||!this.startOffset.isInitial()||!this.startArrow.isInitial()||!this.end.isInitial()||!this.endOffset.isInitial()||!this.endArrow.isInitial()}drawShape(t){super.drawShape(t),(this.startArrow()||this.endArrow())&&this.drawArrows(t)}drawArrows(t){const{startPoint:e,startTangent:r,endPoint:i,endTangent:a,arrowSize:h}=this.curveDrawingInfo();h<.001||(t.save(),t.beginPath(),this.endArrow()&&this.drawArrow(t,i,a.flipped,h),this.startArrow()&&this.drawArrow(t,e,r,h),t.fillStyle=pn(this.stroke(),t),t.closePath(),t.fill(),t.restore())}drawArrow(t,e,r,i){const a=r.perpendicular,h=e.add(r.scale(-i/2));Lr(t,h),qt(t,h.add(r.add(a).scale(i))),qt(t,h.add(r.sub(a).scale(i))),qt(t,h),t.closePath()}};zt([I(!1),R()],Tt.prototype,"closed",void 0);zt([I(0),R()],Tt.prototype,"start",void 0);zt([I(0),R()],Tt.prototype,"startOffset",void 0);zt([I(!1),R()],Tt.prototype,"startArrow",void 0);zt([I(1),R()],Tt.prototype,"end",void 0);zt([I(0),R()],Tt.prototype,"endOffset",void 0);zt([I(!1),R()],Tt.prototype,"endArrow",void 0);zt([I(24),R()],Tt.prototype,"arrowSize",void 0);zt([E()],Tt.prototype,"arcLength",null);zt([E()],Tt.prototype,"curveDrawingInfo",null);Tt=zt([Ce("Curve")],Tt);class Pn{}class Ru extends Pn{constructor(t,e,r,i,a){super(),this.center=t,this.radius=e,this.from=r,this.to=i,this.counter=a,this.angle=Math.acos(xt(-1,1,r.dot(i))),this.length=Math.abs(this.angle*e);const h=new g(1,1).scale(e);this.points=[t.sub(h),t.add(h)]}get arcLength(){return this.length}draw(t,e,r){const i=this.counter?-1:1,a=this.from.radians+e*this.angle*i,h=this.to.radians-(1-r)*this.angle*i;Math.abs(this.angle)>1e-4&&t.arc(this.center.x,this.center.y,this.radius,a,h,this.counter);const u=g.fromRadians(a),v=g.fromRadians(h);return[{position:this.center.add(u.scale(this.radius)),tangent:this.counter?u:u.flipped,normal:this.counter?u.flipped:u},{position:this.center.add(v.scale(this.radius)),tangent:this.counter?v.flipped:v,normal:this.counter?v.flipped:v}]}getPoint(t){const e=this.counter?-1:1,r=this.from.radians+t*this.angle*e,i=g.fromRadians(r);return{position:this.center.add(i.scale(this.radius)),tangent:this.counter?i:i.flipped,normal:this.counter?i:i.flipped}}}class bt{static constant(t){return new bt(t)}static linear(t,e){return new bt(t,e)}static quadratic(t,e,r){return new bt(t,e,r)}static cubic(t,e,r,i){return new bt(t,e,r,i)}get degree(){return this.c3!==0?3:this.c2!==0?2:this.c1!==0?1:0}constructor(t,e,r,i){this.c0=t,this.c1=e??0,this.c2=r??0,this.c3=i??0}differentiate(t=1){switch(t){case 0:return this;case 1:return new bt(this.c1,2*this.c2,3*this.c3,0);case 2:return new bt(2*this.c2,6*this.c3,0,0);case 3:return new bt(6*this.c3,0,0,0);default:throw new Error("Unsupported derivative")}}eval(t,e=0){return e!==0?this.differentiate(e).eval(t):this.c3*(t*t*t)+this.c2*(t*t)+this.c1*t+this.c0}split(t){const e=1-t,r=new bt(this.c0,this.c1*t,this.c2*t*t,this.c3*t*t*t),i=new bt(this.eval(0),e*this.differentiate(1).eval(t),e*e/2*this.differentiate(2).eval(t),e*e*e/6*this.differentiate(3).eval(t));return[r,i]}roots(){switch(this.degree){case 3:return this.solveCubicRoots();case 2:return this.solveQuadraticRoots();case 1:return this.solveLinearRoot();case 0:return[];default:throw new Error(`Unsupported polynomial degree: ${this.degree}`)}}localExtrema(){return this.differentiate().roots()}localExtrema01(){const t=this.localExtrema(),e=[];for(let r=0;r=0&&i<=1&&e.push(t[r])}return e}outputRange01(){let t=[this.eval(0),this.eval(1)];const e=r=>{t[1]>t[0]?t=[Math.min(t[0],r),Math.max(t[1],r)]:t=[Math.min(t[1],r),Math.max(t[0],r)]};return this.localExtrema01().forEach(r=>e(this.eval(r))),t}solveCubicRoots(){const t=this.c0,e=this.c1,r=this.c2,i=this.c3,a=t*t,h=t*r,u=e*e,v=(3*h-u)/(3*a),y=(2*u*e-9*h*e+27*a*i)/(27*a*t),C=this.solveDepressedCubicRoots(v,y),F=H=>H-e/(3*t);switch(C.length){case 1:return[F(C[0])];case 2:return[F(C[0]),F(C[1])];case 3:return[F(C[0]),F(C[1]),F(C[2])];default:return[]}}solveDepressedCubicRoots(t,e){if(this.almostZero(t))return[Math.cbrt(-e)];const r=Math.PI*2,i=4*t*t*t+27*e*e;if(i<1e-5){const a=2*Math.sqrt(-t/3),h=3*e/(2*t)*Math.sqrt(-3/t),u=v=>a*Math.cos(1/3*Math.acos(xt(-1,1,h))-r/3*v);return h>=.9999?[u(0),u(2)]:h<=-.9999?[u(1),u(2)]:[u(0),u(1),u(2)]}if(i>0&&t<0){const a=.3333333333333333*Math.acosh(-3*Math.abs(e)/(2*t)*Math.sqrt(-3/t));return[-2*Math.sign(e)*Math.sqrt(-t/3)*Math.cosh(a)]}if(t>0){const a=.3333333333333333*Math.asinh(3*e/(2*t)*Math.sqrt(3/t));return[-2*Math.sqrt(t/3)*Math.sinh(a)]}return[]}solveQuadraticRoots(){const t=this.c2,e=this.c1,r=this.c0,i=e*e-4*t*r;if(this.almostZero(i))return[-e/(2*t)];if(i>=0){const a=Math.sqrt(i),h=(-e-a)/(2*t),u=(-e+a)/(2*t);return[Math.min(h,u),Math.max(h,u)]}return[]}solveLinearRoot(){return[-this.c0/this.c1]}almostZero(t){return Math.abs(0-t)<=Number.EPSILON}}class Ve{constructor(t,e,r,i){this.c0=t,this.c1=e,this.c2=r,this.c3=i,t instanceof bt?(this.x=t,this.y=e):i!==void 0?(this.x=new bt(t.x,e.x,r.x,i.x),this.y=new bt(t.y,e.y,r.y,i.y)):(this.x=new bt(t.x,e.x,r.x),this.y=new bt(t.y,e.y,r.y))}eval(t,e=0){return new g(this.x.differentiate(e).eval(t),this.y.differentiate(e).eval(t))}split(t){const[e,r]=this.x.split(t),[i,a]=this.y.split(t);return[new Ve(e,i),new Ve(r,a)]}differentiate(t=1){return new Ve(this.x.differentiate(t),this.y.differentiate(t))}evalDerivative(t){return this.differentiate().eval(t)}getBounds(){const t=this.x.outputRange01(),e=this.y.outputRange01();return V.fromPoints(new g(Math.min(...t),Math.max(...e)),new g(Math.max(...t),Math.min(...e)))}}class Pu{constructor(t,e=20){this.curve=t,this.sampledDistances=[],this.resample(e)}resample(t){this.sampledDistances=[0];let e=0,r=this.curve.eval(0).position;for(let i=1;i=i&&t<=a)return Kc(i,a,r/(e-1),(r+1)/(e-1),t)}return 1}}class Mu extends Pn{get arcLength(){return this.length}constructor(t,e){super(),this.curve=t,this.length=e,this.pointSampler=new Pu(this)}getBBox(){return this.curve.getBounds()}eval(t){const e=this.tangent(t);return{position:this.curve.eval(t),tangent:e,normal:e.perpendicular}}getPoint(t){const e=this.pointSampler.pointAtDistance(this.arcLength*t);return{position:e.position,tangent:e.tangent,normal:e.tangent.perpendicular}}transformPoints(t){return this.points.map(e=>e.transformAsPoint(t))}tangent(t){return this.curve.evalDerivative(t).normalized}draw(t,e=0,r=1,i=!0){let a=null,h=e,u=r,v=this.points;if(e!==0||r!==1){const F=this.length*e,H=this.length*r;h=this.pointSampler.distanceToT(F),u=this.pointSampler.distanceToT(H);const J=(u-h)/(1-h),[,et]=this.split(h);[a]=et.split(J),v=a.points}i&&Lr(t,v[0]),(a??this).doDraw(t);const y=this.tangent(h),C=this.tangent(u);return[{position:v[0],tangent:y,normal:y.perpendicular},{position:v.at(-1),tangent:C,normal:C.perpendicular}]}}var Lu=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class ne extends Mu{get points(){return[this.p0,this.p1,this.p2,this.p3]}constructor(t,e,r,i){super(new Ve(t,t.flipped.add(e).scale(3),t.scale(3).sub(e.scale(6)).add(r.scale(3)),t.flipped.add(e.scale(3)).sub(r.scale(3)).add(i)),ne.getLength(t,e,r,i)),this.p0=t,this.p1=e,this.p2=r,this.p3=i}split(t){const e=new g(this.p0.x+(this.p1.x-this.p0.x)*t,this.p0.y+(this.p1.y-this.p0.y)*t),r=new g(this.p1.x+(this.p2.x-this.p1.x)*t,this.p1.y+(this.p2.y-this.p1.y)*t),i=new g(this.p2.x+(this.p3.x-this.p2.x)*t,this.p2.y+(this.p3.y-this.p2.y)*t),a=new g(e.x+(r.x-e.x)*t,e.y+(r.y-e.y)*t),h=new g(r.x+(i.x-r.x)*t,r.y+(i.y-r.y)*t),u=new g(a.x+(h.x-a.x)*t,a.y+(h.y-a.y)*t),v=new ne(this.p0,e,a,u),y=new ne(u,h,i,this.p3);return[v,y]}doDraw(t){wu(t,this.p1,this.p2,this.p3)}static getLength(t,e,r,i){return ne.el.setAttribute("d",`M ${t.x} ${t.y} C ${e.x} ${e.y} ${r.x} ${r.y} ${i.x} ${i.y}`),ne.el.getTotalLength()}}Lu([Ci(()=>document.createElementNS("http://www.w3.org/2000/svg","path"))],ne,"el",void 0);class br extends Pn{constructor(t,e){super(),this.from=t,this.to=e,this.vector=e.sub(t),this.length=this.vector.magnitude,this.normal=this.vector.perpendicular.normalized.safe,this.points=[t,e]}get arcLength(){return this.length}draw(t,e=0,r=1,i=!1){const a=this.from.add(this.vector.scale(e)),h=this.from.add(this.vector.scale(r));return i&&Lr(t,a),qt(t,h),[{position:a,tangent:this.normal.flipped,normal:this.normal},{position:h,tangent:this.normal,normal:this.normal}]}getPoint(t){return{position:this.from.add(this.vector.scale(t)),tangent:this.normal.flipped,normal:this.normal}}}function $u(n,t,e,r){const i={arcLength:0,segments:[],minSin:1},a=se(t.top,t.right,t.left,n),h=se(t.right,t.top,t.bottom,n),u=se(t.bottom,t.left,t.right,n),v=se(t.left,t.bottom,t.top,n);let y=new g(n.left+a,n.top),C=new g(n.right-h,n.top);return Fe(i,new br(y,C)),y=new g(n.right,n.top+h),C=new g(n.right,n.bottom-u),h>0&&yr(i,y.addX(-h),h,g.down,g.right,e,r),Fe(i,new br(y,C)),y=new g(n.right-u,n.bottom),C=new g(n.left+v,n.bottom),u>0&&yr(i,y.addY(-u),u,g.right,g.up,e,r),Fe(i,new br(y,C)),y=new g(n.left,n.bottom-v),C=new g(n.left,n.top+a),v>0&&yr(i,y.addX(v),v,g.up,g.left,e,r),Fe(i,new br(y,C)),y=new g(n.left+a,n.top),a>0&&yr(i,y.addY(a),a,g.left,g.down,e,r),i}function Fe(n,t){n.segments.push(t),n.arcLength+=t.arcLength}function yr(n,t,e,r,i,a,h){const u=t.add(r.scale(e)),v=t.add(i.scale(e));a?Fe(n,new ne(u,u.add(i.scale(h*e)),v.add(r.scale(h*e)),v)):Fe(n,new Ru(t,e,r,i,!1))}var ir=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let Zt=class extends Tt{constructor(t){super(t)}profile(){return $u(this.childrenBBox(),this.radius(),this.smoothCorners(),this.cornerSharpness())}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}offsetComputedLayout(t){return t}childrenBBox(){return V.fromSizeCentered(this.computedSize())}getPath(){if(this.requiresProfile())return this.curveDrawingInfo().path;const t=new Path2D,e=this.radius(),r=this.smoothCorners(),i=this.cornerSharpness(),a=V.fromSizeCentered(this.size());return bi(t,a,e,r,i),t}getCacheBBox(){return super.getCacheBBox().expand(this.rippleSize())}getRipplePath(){const t=new Path2D,e=this.rippleSize(),r=this.radius().addScalar(e),i=this.smoothCorners(),a=this.cornerSharpness(),h=V.fromSizeCentered(this.size()).expand(e);return bi(t,h,r,i,a),t}};ir([$r("radius")],Zt.prototype,"radius",void 0);ir([I(!1),R()],Zt.prototype,"smoothCorners",void 0);ir([I(.6),R()],Zt.prototype,"cornerSharpness",void 0);ir([E()],Zt.prototype,"profile",null);Zt=ir([Ce("Rect")],Zt);var le=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class Et extends z{constructor({children:t,...e}){super(e),this.scene()||this.scene(new z({})),t&&this.scene().add(t)}getZoom(){return 1/this.scale.x()}setZoom(t){this.scale(me(t,e=>1/e))}getDefaultZoom(){return this.scale.x.context.getInitial()}*tweenZoom(t,e,r,i){const a=this.scale.x();yield*Dt(e,h=>{this.zoom(1/i(a,1/ye(t),r(h)))})}*reset(t,e=_t){yield*ve(this.position(Ye,t,e),this.zoom(Ye,t,e),this.rotation(Ye,t,e))}*centerOn(t,e,r=_t,i=g.lerp){const a=t instanceof z?t.absolutePosition().transformAsPoint(this.scene().worldToLocal()):t;yield*this.position(a,e,r,i)}*followCurve(t,e,r=_t){yield*Dt(e,i=>{const a=r(i),h=t.getPointAtPercentage(a).position.transformAsPoint(t.localToWorld());this.position(h)})}*followCurveReverse(t,e,r=_t){yield*Dt(e,i=>{const a=1-r(i),h=t.getPointAtPercentage(a).position.transformAsPoint(t.localToWorld());this.position(h)})}*followCurveWithRotation(t,e,r=_t){yield*Dt(e,i=>{const a=r(i),{position:h,normal:u}=t.getPointAtPercentage(a),v=h.transformAsPoint(t.localToWorld()),y=u.flipped.perpendicular.degrees;this.position(v),this.rotation(y)})}*followCurveWithRotationReverse(t,e,r=_t){yield*Dt(e,i=>{const a=1-r(i),{position:h,normal:u}=t.getPointAtPercentage(a),v=h.transformAsPoint(t.localToWorld()),y=u.flipped.perpendicular.degrees;this.position(v),this.rotation(y)})}transformContext(t){const e=this.localToParent().inverse();t.transform(e.a,e.b,e.c,e.d,e.e,e.f)}hit(t){const e=t.transformAsPoint(this.localToParent());return this.scene().hit(e)}drawChildren(t){this.scene().drawChildren(t)}static Stage({children:t,cameraRef:e,scene:r,...i}){const a=new Et({scene:r,children:t});return e==null||e(a),new Zt({clip:!0,...i,children:[a]})}}le([R()],Et.prototype,"scene",void 0);le([ke(!1),R()],Et.prototype,"zoom",void 0);le([ft()],Et.prototype,"reset",null);le([ft()],Et.prototype,"centerOn",null);le([ft()],Et.prototype,"followCurve",null);le([ft()],Et.prototype,"followCurveReverse",null);le([ft()],Et.prototype,"followCurveWithRotation",null);le([ft()],Et.prototype,"followCurveWithRotationReverse",null);var ar=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},gn;let xe=gn=class extends Zt{constructor(t){super({composite:!0,fontFamily:"Roboto",fontSize:48,lineHeight:"120%",textWrap:!1,fontStyle:"normal",...t}),this.view2D=this,gn.shadowRoot.append(this.element),this.applyFlex()}dispose(){this.removeChildren(),super.dispose()}render(t){this.computedSize(),this.computedPosition(),super.render(t)}findKey(t){return wr().getNode(t)??null}requestLayoutUpdate(){this.updateLayout()}requestFontUpdate(){this.applyFont()}view(){return this}};ar([I(Je.Paused),R()],xe.prototype,"playbackState",void 0);ar([I(0),R()],xe.prototype,"globalTime",void 0);ar([R()],xe.prototype,"assetHash",void 0);ar([Ci(()=>{const n="motion-canvas-2d-frame";let t=document.querySelector(`#${n}`);return t||(t=document.createElement("div"),t.id=n,t.style.position="absolute",t.style.pointerEvents="none",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.overflow="hidden",document.body.prepend(t)),t.shadowRoot??t.attachShadow({mode:"open"})})],xe,"shadowRoot",void 0);xe=gn=ar([Ce("View2D")],xe);var he=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},kr;let Rt=kr=class extends Zt{constructor(t){super(t),"src"in t||it().warn({message:"No source specified for the image",remarks:`The image won't be visible unless you specify a source:
import myImage from './example.png';
<Img src={myImage} />;
If you did this intentionally, and don't want to see this warning, set the src
property to null:
<Img src={null} />
Learn more about working with
images.
`,inspect:this.key})}desiredSize(){const t=super.desiredSize();if(t.x===null&&t.y===null){const e=this.image();return{x:e.naturalWidth,y:e.naturalHeight}}return t}image(){const t=this.src();let e="",r="";if(t){r=Mc(t);const a=new URL(r,window.location.origin);if(a.origin===window.location.origin){const h=this.view().assetHash();a.searchParams.set("asset-hash",h)}e=a.toString()}let i=kr.pool[r];return i||(i=document.createElement("img"),i.crossOrigin="anonymous",i.src=e,kr.pool[r]=i),i.complete||lt.collectPromise(new Promise((a,h)=>{i.addEventListener("load",a),i.addEventListener("error",()=>h(new mn({message:"Failed to load an image",remarks:`The src property was set to:
${t}
...which resolved to the following url:
${e}
Make sure that source is correct and that the image exists.
Learn more
about working with images.`,inspect:this.key})))})),i}imageCanvas(){const t=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});if(!t)throw new Error("Could not create an image canvas");return t}filledImageCanvas(){const t=this.imageCanvas(),e=this.image();return t.canvas.width=e.naturalWidth,t.canvas.height=e.naturalHeight,t.imageSmoothingEnabled=this.smoothing(),t.drawImage(e,0,0),t}draw(t){this.drawShape(t);const e=this.alpha();if(e>0){const r=V.fromSizeCentered(this.computedSize());t.save(),t.clip(this.getPath()),e<1&&(t.globalAlpha*=e),t.imageSmoothingEnabled=this.smoothing(),mu(t,this.image(),r),t.restore()}this.clip()&&t.clip(this.getPath()),this.drawChildren(t)}applyFlex(){super.applyFlex();const t=this.image();this.element.style.aspectRatio=(this.ratio()??t.naturalWidth/t.naturalHeight).toString()}getColorAtPoint(t){const e=this.computedSize(),r=this.naturalSize(),i=new g(t).add(this.computedSize().scale(.5)).mul(r.div(e).safe);return this.getPixelColor(i)}naturalSize(){const t=this.image();return new g(t.naturalWidth,t.naturalHeight)}getPixelColor(t){const e=this.filledImageCanvas(),r=new g(t),i=e.getImageData(r.x,r.y,1,1).data;return new Yt({r:i[0],g:i[1],b:i[2],a:i[3]/255})}collectAsyncResources(){super.collectAsyncResources(),this.image()}};Rt.pool={};he([R()],Rt.prototype,"src",void 0);he([I(1),R()],Rt.prototype,"alpha",void 0);he([I(!0),R()],Rt.prototype,"smoothing",void 0);he([E()],Rt.prototype,"image",null);he([E()],Rt.prototype,"imageCanvas",null);he([E()],Rt.prototype,"filledImageCanvas",null);he([E()],Rt.prototype,"naturalSize",null);Rt=kr=he([Ce("Img")],Rt);var Mn=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class _e extends Rt{constructor(t){super({...t,src:null})}svgUrl(){const t=this.icon().replace(":","/"),e=encodeURIComponent(this.color().hex());return`https://api.iconify.design/${t}.svg?color=${e}`}getSrc(){return this.svgUrl()}setSrc(t){t!==null&&it().warn("The Icon Component does not accept setting the `src`. If you need access to `src`, use '
` instead.")}}Mn([R()],_e.prototype,"icon",void 0);Mn([I("white"),Bi()],_e.prototype,"color",void 0);Mn([E()],_e.prototype,"svgUrl",null);class Iu extends Zc{constructor(t){super(t),this.view=null,this.registeredNodes=new Map,this.nodeCounters=new Map,this.assetHash=Date.now().toString(),this.recreateView()}getView(){return this.view}next(){var t;return(t=this.getView())==null||t.playbackState(this.playback.state).globalTime(this.playback.time),super.next()}draw(t){t.save(),this.renderLifecycle.dispatch([jt.BeforeRender,t]),t.save(),this.renderLifecycle.dispatch([jt.BeginRender,t]),this.getView().playbackState(this.playback.state).globalTime(this.playback.time),this.getView().render(t),this.renderLifecycle.dispatch([jt.FinishRender,t]),t.restore(),this.renderLifecycle.dispatch([jt.AfterRender,t]),t.restore()}reset(t){for(const e of this.registeredNodes.keys())try{this.registeredNodes.get(e).dispose()}catch(r){this.logger.error(r)}return this.registeredNodes.clear(),this.registeredNodes=new Map,this.nodeCounters.clear(),this.recreateView(),super.reset(t)}inspectPosition(t,e){return this.execute(()=>{var r;return((r=this.getView().hit(new g(t,e)))==null?void 0:r.key)??null})}validateInspection(t){var e;return((e=this.getNode(t))==null?void 0:e.key)??null}inspectAttributes(t){const e=this.getNode(t);if(!e)return null;const r={stack:e.creationStack,key:e.key};for(const{key:i,meta:a,signal:h}of e)a.inspectable&&(r[i]=h());return r}drawOverlay(t,e,r){const i=this.getNode(t);i&&this.execute(()=>{const a=this.getView().findAll(ji(Et)),h=[];for(const u of a){const v=u.scene();v&&(v===i||v.findFirst(y=>y===i))&&h.push(u)}if(h.length>0)for(const u of h){const v=u.parentToWorld(),y=u.localToParent().inverse(),C=i.localToWorld();i.drawOverlay(r,e.multiply(v).multiply(y).multiply(C))}else i.drawOverlay(r,e.multiply(i.localToWorld()))})}transformMousePosition(t,e){return new g(t,e).transformAsPoint(this.getView().localToParent().inverse())}registerNode(t,e){var h;const r=((h=t.constructor)==null?void 0:h.name)??"unknown",i=(this.nodeCounters.get(r)??0)+1;this.nodeCounters.set(r,i),e&&this.registeredNodes.has(e)&&(it().error({message:`Duplicated node key: "${e}".`,inspect:e,stack:new Error().stack}),e=void 0),e??(e=`${this.name}/${r}[${i}]`),this.registeredNodes.set(e,t);const a=this.registeredNodes;return[e,()=>a.delete(e)]}getNode(t){return typeof t!="string"?null:this.registeredNodes.get(t)??null}*getDetachedNodes(){for(const t of this.registeredNodes.values())!t.parent()&&t!==this.view&&(yield t)}recreateView(){this.execute(()=>{const t=this.getSize();this.view=new xe({position:t.scale(this.resolutionScale/2),scale:this.resolutionScale,assetHash:this.assetHash,size:t})})}}function Au(n){return{klass:Iu,config:n,stack:new Error().stack,meta:Vc(),plugins:["@motion-canvas/2d/editor"]}}let Ou="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='576'%20height='576'%20viewBox='0%200%20576%20576'%20fill='none'%3e%3cpath%20d='M287.5%20229L86%20344.5L287.5%20460L489%20344.5L287.5%20229Z'%20stroke='url(%23paint0_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='round'/%3e%3cpath%20d='M287.5%20116L86%20231.5L287.5%20347L489%20231.5L287.5%20116Z'%20stroke='url(%23paint1_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='round'/%3e%3cpath%20d='M86%20344L288%20229'%20stroke='url(%23paint2_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='bevel'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_102_7'%20x1='60'%20y1='341'%20x2='429.5'%20y2='344'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_102_7'%20x1='513.5'%20y1='231'%20x2='143.5'%20y2='231'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_102_7'%20x1='60'%20y1='344'%20x2='428.987'%20y2='341.811'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";const ge=Au(function*(n){n.fill("white");const t=Ge(),e=Ge(),r=Ge(),i=Ge(),a=Ge();n.add(Ee($,{layout:!0,direction:"row",size:"100%",padding:100,gap:0,alignItems:"center",justifyContent:"center",children:[Ee(Rt,{ref:t,src:Ou,width:"25%",offset:[1,2]}),Ee(_e,{ref:e,icon:"material-symbols-light:add-2-rounded",color:"#404040",width:"20%",margin:-10}),Ee(Rt,{ref:r,src:"https://motioncanvas.io/img/logo.svg",width:"25%",margin:-10}),Ee(_e,{ref:i,icon:"material-symbols-light:equal",color:"#404040",width:"20%",margin:-30}),Ee(_e,{ref:a,icon:"material-symbols-light:favorite",color:"#ff6470",width:"25%"})]}));let h=n.size().y*1.5;t().margin.bottom(h),e().margin.bottom(h),r().margin.bottom(h),i().margin.bottom(h),a().margin.bottom(h);const u={mass:.04,stiffness:10,damping:.85,initialVelocity:8};let v=function(y){return Ii(u,h,0,5,C=>{y().margin.bottom(C)})};yield*v(t),yield*v(e),yield*v(r),yield*v(i),yield*v(a),yield*Qe(1),yield*ve(t().opacity(0,1,qe),e().opacity(0,1,qe),r().opacity(0,1,qe),i().opacity(0,1,qe),a().opacity(0,1,qe)),yield*Qe(1)});ge.name="example";cu.attach(ge.meta);ge.onReplaced??(ge.onReplaced=new ie(ge.config));const zu={scenes:[ge]};let Ln;Ln??(Ln=new er("\0virtual:settings",!1));Ln.loadData({version:1,appearance:{color:"rgb(0,144,255)",font:!1,coordinates:!0},defaults:{background:"rgb(157,157,157)",size:{x:1920,y:1080}}});const Eu=Ln,Wu=Tc("project",{core:"3.17.2",two:"3.17.2",ui:"3.17.2",vitePlugin:"3.17.2"},[lu()],zu,hu,Eu);export{Wu as default};