=Z&&G===p.length-1){N=b[G];break}if(B>Z&&B2){var G=S.map(function(V,J){return J/(S.length-1)}),Z=S.map(function(V){return(V-x)/(R-x)});Z.every(function(V,J){return G[J]===V})||(dt=function(V){if(V<=0||V>=1)return V;for(var J=0;V>=Z[J+1];)J++;var $t=(V-Z[J])/(Z[J+1]-Z[J]),Jt=G[J]+$t*(G[J+1]-G[J]);return Jt})}}return d=[x,R],U},U.mode=function(S){return arguments.length?(o=S,yt(),U):o},U.range=function(S,z){return W(S),U},U.out=function(S){return w=S,U},U.spread=function(S){return arguments.length?(u=S,U):u},U.correctLightness=function(S){return S==null&&(S=!0),C=S,yt(),C?H=function(z){for(var N=ft(0,!0).lab()[0],B=ft(1,!0).lab()[0],pt=N>B,K=ft(z,!0).lab()[0],G=N+(B-N)*z,Z=K-G,V=0,J=1,$t=20;Math.abs(Z)>.01&&$t-- >0;)(function(){return pt&&(Z*=-1),Z<0?(V=z,z+=(J-z)*.5):(J=z,z+=(V-z)*.5),K=ft(z,!0).lab()[0],Z=K-G})();return z}:H=function(z){return z},U},U.padding=function(S){return S!=null?(Le(S)==="number"&&(S=[S,S]),f=S,U):f},U.colors=function(S,z){arguments.length<2&&(z="hex");var N=[];if(arguments.length===0)N=b.slice(0);else if(S===1)N=[U(.5)];else if(S>1){var B=d[0],pt=d[1]-B;N=xh(0,S,!1).map(function(J){return U(B+J/(S-1)*pt)})}else{s=[];var K=[];if(v&&v.length>2)for(var G=1,Z=v.length,V=1<=Z;V?GZ;V?G++:G--)K.push((v[G-1]+v[G])*.5);else K=d;N=K.map(function(J){return U(J)})}return Rt[z]&&(N=N.map(function(J){return J[z]()})),N},U.cache=function(S){return S!=null?(M=S,U):M},U.gamma=function(S){return S!=null?(j=S,U):j},U.nodata=function(S){return S!=null?(l=Rt(S),U):l},U};function xh(s,o,l){for(var u=[],d=sp;d?f++:f--)u.push(f);return u}var We=D,Ch=Vr,Sh=function(s){for(var o=[1,1],l=1;l=5){var w,x,R;w=s.map(function(C){return C.lab()}),R=s.length-1,x=Sh(R),d=function(C){var $=1-C,M=[0,1,2].map(function(j){return w.reduce(function(W,q,H){return W+x[H]*Math.pow($,R-H)*Math.pow(C,H)*q[j]},0)});return new We(M,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return d},Th=function(s){var o=kh(s);return o.scale=function(){return Ch(o)},o},Jr=ot,Mt=function(s,o,l){if(!Mt[l])throw new Error("unknown blend mode "+l);return Mt[l](s,o)},Zt=function(s){return function(o,l){var u=Jr(l).rgb(),d=Jr(o).rgb();return Jr.rgb(s(u,d))}},Vt=function(s){return function(o,l){var u=[];return u[0]=s(o[0],l[0]),u[1]=s(o[1],l[1]),u[2]=s(o[2],l[2]),u}},Ph=function(s){return s},Rh=function(s,o){return s*o/255},Mh=function(s,o){return s>o?o:s},$h=function(s,o){return s>o?s:o},Lh=function(s,o){return 255*(1-(1-s/255)*(1-o/255))},Ah=function(s,o){return o<128?2*s*o/255:255*(1-2*(1-s/255)*(1-o/255))},Oh=function(s,o){return 255*(1-(1-o/255)/(s/255))},zh=function(s,o){return s===255?255:(s=255*(o/255)/(1-s/255),s>255?255:s)};Mt.normal=Zt(Vt(Ph)),Mt.multiply=Zt(Vt(Rh)),Mt.screen=Zt(Vt(Lh)),Mt.overlay=Zt(Vt(Ah)),Mt.darken=Zt(Vt(Mh)),Mt.lighten=Zt(Vt($h)),Mt.dodge=Zt(Vt(zh)),Mt.burn=Zt(Vt(Oh));for(var Ih=Mt,Qr=T.type,Fh=T.clip_rgb,Eh=T.TWOPI,_h=Math.pow,Dh=Math.sin,jh=Math.cos,Nn=ot,Bh=function(s,o,l,u,d){s===void 0&&(s=300),o===void 0&&(o=-1.5),l===void 0&&(l=1),u===void 0&&(u=1),d===void 0&&(d=[0,1]);var p=0,f;Qr(d)==="array"?f=d[1]-d[0]:(f=0,d=[d,d]);var v=function(b){var w=Eh*((s+120)/360+o*b),x=_h(d[0]+f*b,u),R=p!==0?l[0]+b*p:l,C=R*x*(1-x)/2,$=jh(w),M=Dh(w),j=x+C*(-.14861*$+1.78277*M),W=x+C*(-.29227*$-.90649*M),q=x+C*(1.97294*$);return Nn(Fh([j*255,W*255,q*255,1]))};return v.start=function(b){return b==null?s:(s=b,v)},v.rotations=function(b){return b==null?o:(o=b,v)},v.gamma=function(b){return b==null?u:(u=b,v)},v.hue=function(b){return b==null?l:(l=b,Qr(l)==="array"?(p=l[1]-l[0],p===0&&(l=l[1])):p=0,v)},v.lightness=function(b){return b==null?d:(Qr(b)==="array"?(d=b,f=b[1]-b[0]):(d=[b,b],f=0),v)},v.scale=function(){return Nn.scale(v)},v.hue(l),v},Nh=D,Wh="0123456789abcdef",Uh=Math.floor,qh=Math.random,Gh=function(){for(var s="#",o=0;o<6;o++)s+=Wh.charAt(Uh(qh()*16));return new Nh(s,"hex")},Kr=y,Wn=Math.log,Xh=Math.pow,Hh=Math.floor,Yh=Math.abs,Un=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 Kr(s)==="object"&&(s=Object.values(s)),s.forEach(function(u){o&&Kr(u)==="object"&&(u=u[o]),u!=null&&!isNaN(u)&&(l.values.push(u),l.sum+=u,ul.max&&(l.max=u),l.count+=1)}),l.domain=[l.min,l.max],l.limits=function(u,d){return qn(l,u,d)},l},qn=function(s,o,l){o===void 0&&(o="equal"),l===void 0&&(l=7),Kr(s)=="array"&&(s=Un(s));var u=s.min,d=s.max,p=s.values.sort(function(es,rs){return es-rs});if(l===1)return[u,d];var f=[];if(o.substr(0,1)==="c"&&(f.push(u),f.push(d)),o.substr(0,1)==="e"){f.push(u);for(var v=1;v 0");var b=Math.LOG10E*Wn(u),w=Math.LOG10E*Wn(d);f.push(u);for(var x=1;x200&&(dt=!1)}for(var Qt={},Ae=0;Aeu?(l+.05)/(u+.05):(u+.05)/(l+.05)},Hn=D,Bt=Math.sqrt,lt=Math.pow,Vh=Math.min,Jh=Math.max,Yn=Math.atan2,Zn=Math.abs,fr=Math.cos,Vn=Math.sin,Qh=Math.exp,Jn=Math.PI,Kh=function(s,o,l,u,d){l===void 0&&(l=1),u===void 0&&(u=1),d===void 0&&(d=1);var p=function(fe){return 360*fe/(2*Jn)},f=function(fe){return 2*Jn*fe/360};s=new Hn(s),o=new Hn(o);var v=Array.from(s.lab()),b=v[0],w=v[1],x=v[2],R=Array.from(o.lab()),C=R[0],$=R[1],M=R[2],j=(b+C)/2,W=Bt(lt(w,2)+lt(x,2)),q=Bt(lt($,2)+lt(M,2)),H=(W+q)/2,dt=.5*(1-Bt(lt(H,7)/(lt(H,7)+lt(25,7)))),ft=w*(1+dt),yt=$*(1+dt),U=Bt(lt(ft,2)+lt(x,2)),S=Bt(lt(yt,2)+lt(M,2)),z=(U+S)/2,N=p(Yn(x,ft)),B=p(Yn(M,yt)),pt=N>=0?N:N+360,K=B>=0?B:B+360,G=Zn(pt-K)>180?(pt+K+360)/2:(pt+K)/2,Z=1-.17*fr(f(G-30))+.24*fr(f(2*G))+.32*fr(f(3*G+6))-.2*fr(f(4*G-63)),V=K-pt;V=Zn(V)<=180?V:K<=pt?V+360:V-360,V=2*Bt(U*S)*Vn(f(V)/2);var J=C-b,$t=S-U,Jt=1+.015*lt(j-50,2)/Bt(20+lt(j-50,2)),Qt=1+.045*z,Ae=1+.015*z*Z,Oe=30*Qh(-lt((G-275)/25,2)),Nt=2*Bt(lt(z,7)/(lt(z,7)+lt(25,7))),ce=-Nt*Vn(2*f(Oe)),Ue=Bt(lt(J/(l*Jt),2)+lt($t/(u*Qt),2)+lt(V/(d*Ae),2)+ce*($t/(u*Qt))*(V/(d*Ae)));return Jh(0,Vh(100,Ue))},Qn=D,tu=function(s,o,l){l===void 0&&(l="lab"),s=new Qn(s),o=new Qn(o);var u=s.get(l),d=o.get(l),p=0;for(var f in u){var v=(u[f]||0)-(d[f]||0);p+=v*v}return Math.sqrt(p)},eu=D,ru=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];try{return new(Function.prototype.bind.apply(eu,[null].concat(s))),!0}catch{return!1}},Kn=ot,ti=Vr,su={cool:function(){return ti([Kn.hsl(180,1,.9),Kn.hsl(250,.7,.4)])},hot:function(){return ti(["#000","#f00","#ff0","#fff"]).mode("rgb")}},dr={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"]},ts=0,ei=Object.keys(dr);ts(et.Color.symbol=et.Color.prototype.symbol=Symbol.for("@motion-canvas/core/types/Color"),et.Color.lerp=et.Color.prototype.lerp=(n,t,e,r="lch")=>{typeof n=="string"&&(n=new et.Color(n)),typeof t=="string"&&(t=new et.Color(t));const i=n instanceof et.Color,a=t instanceof et.Color;return i||(n=a?t.alpha(0):new et.Color("rgba(0, 0, 0, 0)")),a||(t=i?n.alpha(0):new et.Color("rgba(0, 0, 0, 0)")),et.mix(n,t,e,r)},et.Color.createLerp=et.Color.prototype.createLerp=n=>(t,e,r)=>et.Color.lerp(t,e,r,n),et.Color.createSignal=(n,t=et.Color.lerp)=>new be(n,t,void 0,e=>new et.Color(e)).toSignal(),et.Color.prototype.toSymbol=()=>et.Color.symbol,et.Color.prototype.toUniform=function(n,t){n.uniform4fv(t,this.gl())},et.Color.prototype.serialize=function(){return this.css()},et.Color.prototype.lerp=function(n,t,e){return et.Color.lerp(this,n,t,e)},et.Color))();function Ju(n,t){return g.fromDegrees(n).transform(t).degrees}function is(n,t){return g.magnitude(t.m11,t.m12)*n}class as extends kt{constructor(){super(...arguments),this.type=se.symbol}parse(t){return t===null?null:new se(t)}serialize(){var t;return((t=this.value.current)==null?void 0:t.serialize())??null}}class ve extends kt{constructor(t,e,r=(i=>(i=e[0])==null?void 0:i.value)()){super(t,r),this.options=e,this.type=ve.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]}}ve.symbol=Symbol.for("@motion-canvas/core/meta/EnumMetaField");class Qu extends kt{get onFieldsChanged(){return this.fields.subscribable}get options(){return this.optionFields[this.current]}constructor(t,e,r=0){var c,m;const i=e.plugins.flatMap(y=>{var k;return((k=y.exporters)==null?void 0:k.call(y,e))??[]}),a=i.map(y=>y.meta(e)),h=new ve("exporter",i.map(y=>({value:y.id,text:y.displayName})),(c=i[r])==null?void 0:c.id);super(t,{name:h.get(),options:(m=a[r])==null?void 0:m.get()}),this.current=r,this.type=Object,this.handleChange=()=>{var F,X,Q;const y=this.exporterField.get(),k=Math.max(this.exporters.findIndex(at=>at.id===y),0);this.current!==k&&((F=this.options)==null||F.onChanged.unsubscribe(this.handleChange),this.current=k,(X=this.options)==null||X.onChanged.subscribe(this.handleChange,!1),this.fields.current=this.options?[this.exporterField,this.options]:[this.exporterField]),this.value.current={name:this.exporterField.get(),options:((Q=this.options)==null?void 0:Q.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 re([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 qe;class Je{constructor(t,e=!1){this.name=t,this.source=e,this.lock=new uu,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(qe.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 qe.sourceLookup[e],i(`Connection timeout when updating metadata for ${this.name}`)},1e3),qe.sourceLookup[e]=()=>{delete qe.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}}qe=Je;Je.sourceLookup={};class ns extends kt{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 Sr extends kt{constructor(){super(...arguments),this.type=Sr.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-He,t/i-He,e/i-He)}parseRange(t,e=this.value.current[0],r=this.value.current[1]){return e=wt(0,t,e),r=wt(0,t,r??1/0),e>r&&([e,r]=[r,e]),r>=t&&(r=1/0),[e,r]}}Sr.symbol=Symbol.for("@motion-canvas/core/meta/RangeMetaField");class Mi extends kt{constructor(){super(...arguments),this.type=g.symbol}parse(t){return new g(t)}serialize(){return this.value.current.serialize()}}class je{static meta(t){return new Gt(this.displayName,{fastStart:new br("fast start",!0),includeAudio:new br("include audio",!0).disable(!t.audio)})}static async create(t,e){return new je(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.")}}je.id="@motion-canvas/ffmpeg";je.displayName="Video (FFmpeg)";je.response=new Ot;const Ku=au({name:"ffmpeg-plugin",exporters(){return[je]}});let ms;ms??(ms=new Je("project",!1));ms.loadData({version:0,shared:{background:"rgba(255,0,0,0)",range:[0,null],size:{x:1920,y:1080},audioOffset:0},preview:{fps:30,resolutionScale:1},rendering:{fps:60,resolutionScale:1,colorSpace:"srgb",exporter:{name:"@motion-canvas/core/image-sequence",options:{fileType:"image/png",quality:100,groupByScene:!1}}}});const tc=ms;let bs;bs??(bs=new Je("example",!1));bs.loadData({version:0,timeEvents:[],seed:3712781475});const ec=bs;function rc(n){var t;return!!((t=n.prototype)!=null&&t.isClass)}const sc=Symbol.for("@motion-canvas/2d/fragment");function nc(n,t,e){const{ref:r,children:i,...a}=t,h=Array.isArray(i)?i.flat():i;if(n===sc)return h;if(rc(n)){const c=new n({...a,children:h,key:e});return r==null||r(c),c}else return n({...a,ref:r,children:h,key:e})}const fi={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 ic{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=De(this.props.value,tt,this)}isActive(){return this.value()!==this.props.default}serialize(t){let e=this.value();return this.props.transform&&(e=is(e,t)),`${this.props.name}(${e*this.props.scale}${this.props.unit})`}}const Wt=Symbol.for("@motion-canvas/2d/decorators/initializers");function Qe(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 ac(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)=>{Qe(n,e=>{const r=Object.getPrototypeOf(e)[t];e[t]=Yu(r.bind(e),e)})}}function os(n={},t,e){const r={};if(e&&t){const i=n.setter??(t==null?void 0:t[`set${Ge(e)}`]);i&&(r.setter=i.bind(t));const a=n.getter??(t==null?void 0:t[`get${Ge(e)}`]);a&&(r.getter=a.bind(t));const h=n.tweener??(t==null?void 0:t[`tween${Ge(e)}`]);h&&(r.tweener=h.bind(t))}return r}const Ut=Symbol.for("@motion-canvas/2d/decorators/properties");function we(n,t){var e;return((e=n[Ut])==null?void 0:e[t])??null}function ys(n,t){let e;return n[Ut]?n[Ut]&&!Object.prototype.hasOwnProperty.call(n,Ut)?n[Ut]=e=Object.fromEntries(Object.entries(n[Ut]).map(([r,i])=>[r,{...i}])):e=n[Ut]:n[Ut]=e={},e[t]??(e[t]={cloneable:!0,inspectable:!0,compoundEntries:[]}),e[t]}function $i(n){return n&&typeof n=="object"?n[Ut]??{}:{}}function ws(n,t){ac(n);for(const[e,r]of Object.entries($i(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 P(){return(n,t)=>{const e=ys(n,t);Qe(n,r=>{var c;let i=e.default;const a=r[`getDefault${Ge(t)}`];a&&(i=()=>a.call(r,e.default));const h=new be(i,e.interpolationFunction??_e,r,(c=e.parser)==null?void 0:c.bind(r),os(e,r,t));r[t]=h.toSignal()})}}function A(n){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.default=n}}function Li(n){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.interpolationFunction=n}}function xs(n){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.parser=n}}function Ke(n){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.parser=i=>new n(i),"lerp"in n&&(r.interpolationFunction??(r.interpolationFunction=n.lerp))}}function xe(n=!0){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.cloneable=n}}function Ai(n=!0){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.inspectable=n}}function Oi(n,t=Cr){return(e,r)=>{const i=ys(e,r);i.compound=!0,i.compoundEntries=Object.entries(n),Qe(e,a=>{if(!i.parser){vt().error(`Missing parser decorator for "${r.toString()}"`);return}const h=i.default,c=i.parser.bind(a),m=new t(i.compoundEntries.map(([y,k])=>{const F=new be(ge(h,X=>c(X)[y]),tt,a,void 0,os(void 0,a,k)).toSignal();return[y,F]}),c,h,i.interpolationFunction??_e,a,os(i,a,r));a[r]=m.toSignal()})}}function Ht(n){return(t,e)=>{Oi(typeof n=="object"?n:{x:n?`${n}X`:"x",y:n?`${n}Y`:"y"},Pi)(t,e),Ke(g)(t,e)}}var oe=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 c=n.length-1;c>=0;c--)(h=n[c])&&(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 jt{constructor(t){ws(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(me(r),new se(me(i)).serialize());return e}}oe([A("linear"),P()],jt.prototype,"type",void 0);oe([Ht("from")],jt.prototype,"from",void 0);oe([Ht("to")],jt.prototype,"to",void 0);oe([A(0),P()],jt.prototype,"angle",void 0);oe([A(0),P()],jt.prototype,"fromRadius",void 0);oe([A(0),P()],jt.prototype,"toRadius",void 0);oe([A([]),P()],jt.prototype,"stops",void 0);oe([E()],jt.prototype,"canvasGradient",null);var Cs=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 c=n.length-1;c>=0;c--)(h=n[c])&&(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 tr{constructor(t){ws(this,t)}canvasPattern(t){return t.createPattern(this.image(),this.repetition())}}Cs([P()],tr.prototype,"image",void 0);Cs([A(null),P()],tr.prototype,"repetition",void 0);Cs([E()],tr.prototype,"canvasPattern",null);function oc(n){return n===null?null:n instanceof jt||n instanceof tr?n:new se(n)}function ls(n,t){return n===null?"":n instanceof se?n.serialize():n instanceof jt?n.canvasGradient(t):n instanceof tr?n.canvasPattern(t)??"":""}function di(n,t,e,r,i){if(e.top===0&&e.right===0&&e.bottom===0&&e.left===0){lc(n,t);return}const a=ee(e.top,e.right,e.left,t),h=ee(e.right,e.top,e.bottom,t),c=ee(e.bottom,e.left,e.right,t),m=ee(e.left,e.bottom,e.top,t);if(r){const y=k=>{const F=k*i;return k-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-c),n.bezierCurveTo(t.right,t.bottom-y(c),t.right-y(c),t.bottom,t.right-c,t.bottom),n.lineTo(t.left+m,t.bottom),n.bezierCurveTo(t.left+y(m),t.bottom,t.left,t.bottom-y(m),t.left,t.bottom-m),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,c),n.arcTo(t.left,t.bottom,t.left,t.top,m),n.arcTo(t.left,t.top,t.right,t.top,a)}function ee(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 lc(n,t){n.rect(t.x,t.y,t.width,t.height)}function kr(n,t){n.moveTo(t.x,t.y)}function qt(n,t){n.lineTo(t.x,t.y)}function de(n,t){if(!(t.length<2)){kr(n,t[0]);for(const e of t.slice(1))qt(n,e)}}function hc(n,t,e=8){qt(n,t.addY(-e)),qt(n,t.addY(e)),qt(n,t),qt(n,t.addX(-e)),uc(n,t,e)}function uc(n,t,e,r=0,i=Math.PI*2,a=!1){n.arc(t.x,t.y,e,r,i,a)}function cc(n,t,e,r){n.bezierCurveTo(t.x,t.y,e.x,e.y,r.x,r.y)}function zi(n){return t=>t instanceof n}function Ii(){return(n,t)=>{P()(n,t),xs(oc)(n,t),Li(se.lerp)(n,t),A(null)(n,t)}}function fc(){return(n,t)=>{P()(n,t),Ke(se)(n,t)}}function le(n,t=e=>e){return(e,r)=>{e[`getDefault${Ge(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 dc extends be{constructor(t,e){super(t,_e,e);for(const r in fi){const i=fi[r];Object.defineProperty(this.invokable,r,{value:(a,h,c=Et)=>{var y,k,F;if(a===void 0)return((k=(y=this.get())==null?void 0:y.find(X=>X.name===i.name))==null?void 0:k.value())??i.default??0;let m=(F=this.get())==null?void 0:F.find(X=>X.name===i.name);return m||(m=new ic(i),this.set([...this.get(),m])),h===void 0?(m.value(a),this.owner):m.value(a,h,c)}})}}*tweener(t,e,r){const i=this.get(),a=me(t);if(gc(i,a)){yield*Fe(...i.map((m,y)=>m.value(a[y].value(),e,r))),this.set(a);return}for(const m of a)m.value(m.default);const h=a.map(m=>m.value.context.raw()),c=i.length>0&&a.length>0?e/2:e;i.length>0&&(yield*Fe(...i.map(m=>m.value(m.default,c,r)))),this.set(a),a.length>0&&(yield*Fe(...a.map((m,y)=>m.value(h[y],c,r))))}}function pc(){return(n,t)=>{const e=ys(n,t);Qe(n,r=>{r[t]=new dc(e.default??[],r).toSignal()})}}function gc(n,t){if(n.length!==t.length)return!1;for(let e=0;e=e){const h=(e-a)/i.arcLength;return i.getPoint(wt(0,1,h))}}return{position:g.zero,tangent:g.up,normal:g.up}}function Tr(n){return(t,e)=>{Oi({top:n?`${n}Top`:"top",right:n?`${n}Right`:"right",bottom:n?`${n}Bottom`:"bottom",left:n?`${n}Left`:"left"})(t,e),Ke(At)(t,e)}}function mc(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=[],!fs().experimentalFeatures&&t.length>0&&(t=[],vt().log({...wu("Node uses experimental shaders."),inspect:this.key})),t}function gr(){return fs()}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 c=n.length-1;c>=0;c--)(h=n[c])&&(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},vr;let I=vr=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(ge(t,e=>new g(e).transformAsPoint(this.worldToParent())))}getAbsoluteRotation(){const t=this.localToWorld();return g.degrees(t.m11,t.m12)}setAbsoluteRotation(t){this.rotation(ge(t,e=>Ju(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(ge(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=me(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),!Xt(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 Xt(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=De(0),this.stateStack=[],this.realChildren=[],this.hasSpawnedChildren=!1,this.parent=De(null),this.properties=$i(this);const a=gr();[this.key,this.unregister]=a.registerNode(this,r),this.view2D=a.getView(),this.creationStack=new Error().stack,ws(this,i),e&&vt().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 vr&&(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 c=a+t;for(;a>c&&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 vt().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 c=h-a+1;return this.move(c)}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};Xt(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,c]of i.compoundEntries){if(c in e)continue;const m=a[h];m.context.isInitial()||(e[c]=m.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 vr&&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 Y}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 c=h.fullCacheBBox(),m=h.localToParent();i.push(...c.corners.map(y=>y.transformAsPoint(m)))}return Y.fromPoints(...i).addSpacing(r)}fullCacheBBox(){const t=this.compositeToLocal(),e=this.shadowOffset().transform(t),r=is(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=Y.fromSizeCentered(this.view().size()).expand(this.view().cachePadding()),e=Y.fromPoints(...t.transformCorners(this.view().localToWorld())),r=Y.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 Y(g.zero,gr().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=is(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,X;const r=this.shaders();if(r.length===0)return null;const i=gr(),a=i.getRealSize(),h=this.parentWorldSpaceCacheBBox(),c=new DOMMatrix().scaleSelf(a.width/h.width,a.height/-h.height).translateSelf(h.x/-a.width,h.y/a.height-1),m=this.worldSpaceCacheBBox(),y=new DOMMatrix().scaleSelf(a.width/m.width,a.height/-m.height).translateSelf(m.x/-a.width,m.y/a.height-1).invertSelf(),k=i.shaders.getGL();i.shaders.copyTextures(t,e),i.shaders.clear();for(const Q of r){const at=i.shaders.getProgram(Q.fragment);if(at){if(Q.uniforms)for(const[T,st]of Object.entries(Q.uniforms)){const Pt=k.getUniformLocation(at,T);if(Pt===null)continue;const nt=me(st);typeof nt=="number"?k.uniform1f(Pt,nt):"toUniform"in nt?nt.toUniform(k,Pt):nt.length===1?k.uniform1f(Pt,nt[0]):nt.length===2?k.uniform2f(Pt,nt[0],nt[1]):nt.length===3?k.uniform3f(Pt,nt[0],nt[1],nt[2]):nt.length===4&&k.uniform4f(Pt,nt[0],nt[1],nt[2],nt[3])}k.uniform1f(k.getUniformLocation(at,ui),this.view2D.globalTime()),k.uniform1i(k.getUniformLocation(at,ui),i.playback.frame),k.uniformMatrix4fv(k.getUniformLocation(at,Iu),!1,y.toFloat32Array()),k.uniformMatrix4fv(k.getUniformLocation(at,Fu),!1,c.toFloat32Array()),(F=Q.setup)==null||F.call(Q,k,at),i.shaders.render(),(X=Q.teardown)==null||X.call(Q,k,at)}}return k.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(),de(t,r),t.closePath(),t.stroke(),t.strokeStyle="blue",t.beginPath(),de(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 ht.consumePromises(),this.collectAsyncResources();while(ht.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=Et){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 Fe(...i)}save(){this.stateStack.push(this.getState())}restore(t,e=Et){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}};_([Ht()],I.prototype,"position",void 0);_([Ke(g),xe(!1),P()],I.prototype,"absolutePosition",void 0);_([A(0),P()],I.prototype,"rotation",void 0);_([xe(!1),P()],I.prototype,"absoluteRotation",void 0);_([A(g.one),Ht("scale")],I.prototype,"scale",void 0);_([A(g.zero),Ht("skew")],I.prototype,"skew",void 0);_([Ke(g),xe(!1),P()],I.prototype,"absoluteScale",void 0);_([A(0),P()],I.prototype,"zIndex",void 0);_([A(!1),P()],I.prototype,"cache",void 0);_([Tr("cachePadding")],I.prototype,"cachePadding",void 0);_([A(!1),P()],I.prototype,"composite",void 0);_([A("source-over"),P()],I.prototype,"compositeOperation",void 0);_([ut()],I.prototype,"tweenCompositeOperation",null);_([A(1),xs(n=>wt(0,1,n)),P()],I.prototype,"opacity",void 0);_([E()],I.prototype,"absoluteOpacity",null);_([pc()],I.prototype,"filters",void 0);_([A("#0000"),fc()],I.prototype,"shadowColor",void 0);_([A(0),P()],I.prototype,"shadowBlur",void 0);_([Ht("shadowOffset")],I.prototype,"shadowOffset",void 0);_([A([]),xs(mc),P()],I.prototype,"shaders",void 0);_([E()],I.prototype,"hasFilters",null);_([E()],I.prototype,"hasShadow",null);_([E()],I.prototype,"filterString",null);_([Ai(!1),xe(!1),P()],I.prototype,"spawner",void 0);_([Ai(!1),xe(!1),P()],I.prototype,"children",void 0);_([E()],I.prototype,"spawnedChildren",null);_([E()],I.prototype,"sortedChildren",null);_([E()],I.prototype,"localToWorld",null);_([E()],I.prototype,"worldToLocal",null);_([E()],I.prototype,"worldToParent",null);_([E()],I.prototype,"parentToWorld",null);_([E()],I.prototype,"localToParent",null);_([E()],I.prototype,"compositeToWorld",null);_([E()],I.prototype,"compositeRoot",null);_([E()],I.prototype,"compositeToLocal",null);_([E()],I.prototype,"cacheCanvas",null);_([E()],I.prototype,"cachedCanvas",null);_([E()],I.prototype,"cacheBBox",null);_([E()],I.prototype,"fullCacheBBox",null);_([E()],I.prototype,"worldSpaceCacheBBox",null);_([E()],I.prototype,"parentWorldSpaceCacheBBox",null);I=vr=_([Ce("Node")],I);I.prototype.isClass=!0;var O=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 c=n.length-1;c>=0;c--)(h=n[c])&&(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},mr;let L=mr=class extends I{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 c;h?c=this.size.x():c=a;let m;h?(this.size.x(t),m=this.size.x()):m=t,this.size.x(c),h&&this.lockSize(),yield*_t(e,y=>this.size.x(i(c,m,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 c;h?c=this.size.y():c=a;let m;h?(this.size.y(t),m=this.size.y()):m=t,this.size.y(c),h&&this.lockSize(),yield*_t(e,y=>this.size.y(i(c,m,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 c;typeof t=="object"&&typeof t.x=="number"&&typeof t.y=="number"?c=new g(t):(this.size(t),c=this.size()),this.size(h),this.lockSize(),yield*_t(e,m=>this.size(i(h,c,r(m)))),this.releaseSize(),this.size(t)}cardinalPoint(t){switch(t){case it.TopLeft:return this.topLeft;case it.TopRight:return this.topRight;case it.BottomLeft:return this.bottomLeft;case it.BottomRight:return this.bottomRight;case it.Top:case xt.Top:return this.top;case it.Bottom:case xt.Bottom:return this.bottom;case it.Left:case xt.Left:return this.left;case it.Right:case xt.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(zi(mr))}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 Y(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 mr?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 Y.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=Y.fromSizeCentered(r),h=a.transformCorners(e),c=a.addSpacing(this.padding().scale(-1)).transformCorners(e),m=a.addSpacing(this.margin()).transformCorners(e);t.beginPath(),de(t,m),de(t,h),t.closePath(),t.fillStyle="rgba(255,193,125,0.6)",t.fill("evenodd"),t.beginPath(),de(t,h),de(t,c),t.closePath(),t.fillStyle="rgba(180,255,147,0.6)",t.fill("evenodd"),t.beginPath(),de(t,h),t.closePath(),t.lineWidth=1,t.strokeStyle="white",t.stroke(),t.beginPath(),hc(t,i),t.stroke()}getOriginDelta(t){const e=this.computedSize().scale(.5),r=this.offset().mul(e);return t===it.Middle?r.flipped:Zu(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}};O([A(null),Li(Uu),P()],L.prototype,"layout",void 0);O([A(null),P()],L.prototype,"maxWidth",void 0);O([A(null),P()],L.prototype,"maxHeight",void 0);O([A(null),P()],L.prototype,"minWidth",void 0);O([A(null),P()],L.prototype,"minHeight",void 0);O([A(null),P()],L.prototype,"ratio",void 0);O([Tr("margin")],L.prototype,"margin",void 0);O([Tr("padding")],L.prototype,"padding",void 0);O([A("row"),P()],L.prototype,"direction",void 0);O([A(null),P()],L.prototype,"basis",void 0);O([A(0),P()],L.prototype,"grow",void 0);O([A(1),P()],L.prototype,"shrink",void 0);O([A("nowrap"),P()],L.prototype,"wrap",void 0);O([A("start"),P()],L.prototype,"justifyContent",void 0);O([A("normal"),P()],L.prototype,"alignContent",void 0);O([A("stretch"),P()],L.prototype,"alignItems",void 0);O([A("auto"),P()],L.prototype,"alignSelf",void 0);O([A(0),Ht({x:"columnGap",y:"rowGap"})],L.prototype,"gap",void 0);O([le("font-family"),P()],L.prototype,"fontFamily",void 0);O([le("font-size",parseFloat),P()],L.prototype,"fontSize",void 0);O([le("font-style"),P()],L.prototype,"fontStyle",void 0);O([le("font-weight",parseInt),P()],L.prototype,"fontWeight",void 0);O([le("line-height",parseFloat),P()],L.prototype,"lineHeight",void 0);O([le("letter-spacing",n=>n==="normal"?0:parseFloat(n)),P()],L.prototype,"letterSpacing",void 0);O([le("white-space",n=>n==="pre"?"pre":n==="normal"),P()],L.prototype,"textWrap",void 0);O([A("inherit"),P()],L.prototype,"textDirection",void 0);O([le("text-align"),P()],L.prototype,"textAlign",void 0);O([A({x:null,y:null}),Ht({x:"width",y:"height"})],L.prototype,"size",void 0);O([ut()],L.prototype,"tweenWidth",null);O([ut()],L.prototype,"tweenHeight",null);O([E()],L.prototype,"desiredSize",null);O([ut()],L.prototype,"tweenSize",null);O([Ht("offset")],L.prototype,"offset",void 0);O([Yt(it.Middle)],L.prototype,"middle",void 0);O([Yt(it.Top)],L.prototype,"top",void 0);O([Yt(it.Bottom)],L.prototype,"bottom",void 0);O([Yt(it.Left)],L.prototype,"left",void 0);O([Yt(it.Right)],L.prototype,"right",void 0);O([Yt(it.TopLeft)],L.prototype,"topLeft",void 0);O([Yt(it.TopRight)],L.prototype,"topRight",void 0);O([Yt(it.BottomLeft)],L.prototype,"bottomLeft",void 0);O([Yt(it.BottomRight)],L.prototype,"bottomRight",void 0);O([A(!1),P()],L.prototype,"clip",void 0);O([A(0),P()],L.prototype,"sizeLockCounter",void 0);O([E()],L.prototype,"parentTransform",null);O([E()],L.prototype,"anchorPosition",null);O([E()],L.prototype,"layoutEnabled",null);O([E()],L.prototype,"isLayoutRoot",null);O([E()],L.prototype,"scalingRotationMatrix",null);O([E()],L.prototype,"computedPosition",null);O([E()],L.prototype,"computedSize",null);O([E()],L.prototype,"requestLayoutUpdate",null);O([E()],L.prototype,"appendedToView",null);O([E()],L.prototype,"updateLayout",null);O([E()],L.prototype,"layoutChildren",null);O([E()],L.prototype,"requestFontUpdate",null);O([E()],L.prototype,"applyFlex",null);O([E()],L.prototype,"applyFont",null);L=mr=O([Ce("Layout")],L);function Yt(n){return(t,e)=>{P()(t,e),xe(!1)(t,e);const r=we(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(ge(i,a=>this.getOriginDelta(n).transform(this.scalingRotationMatrix()).flipped.add(a))),this}}}Qe(L.prototype,n=>{n.element=document.createElement("div"),n.element.style.display="flex",n.element.style.boxSizing="border-box",n.styles=getComputedStyle(n.element)});var Tt=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 c=n.length-1;c>=0;c--)(h=n[c])&&(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 bt=class extends L{rippleSize(){return Gu(this.rippleStrength(),0,50)}constructor(t){super(t),this.rippleStrength=De(0)}applyText(t){t.direction=this.textDirection(),this.element.dir=this.textDirection()}applyStyle(t){t.fillStyle=ls(this.fill(),t),t.strokeStyle=ls(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,Xu),this.rippleStrength(0)}};Tt([Ii()],bt.prototype,"fill",void 0);Tt([Ii()],bt.prototype,"stroke",void 0);Tt([A(!1),P()],bt.prototype,"strokeFirst",void 0);Tt([A(0),P()],bt.prototype,"lineWidth",void 0);Tt([A("miter"),P()],bt.prototype,"lineJoin",void 0);Tt([A("butt"),P()],bt.prototype,"lineCap",void 0);Tt([A([]),P()],bt.prototype,"lineDash",void 0);Tt([A(0),P()],bt.prototype,"lineDashOffset",void 0);Tt([A(!0),P()],bt.prototype,"antialiased",void 0);Tt([E()],bt.prototype,"rippleSize",null);Tt([E()],bt.prototype,"getPath",null);Tt([ut()],bt.prototype,"ripple",null);bt=Tt([Ce("Shape")],bt);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 c=n.length-1;c>=0;c--)(h=n[c])&&(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 Ct=class extends bt{desiredSize(){return this.childrenBBox().size}constructor(t){super(t),this.canHaveSubpath=!1}percentageToDistance(t){return wt(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 wt(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,c=Math.min(h/2,this.arrowSize());this.startArrow()&&(i+=c/2),this.endArrow()&&(a-=c/2);let m=0,y=null,k=null,F=null,X=null;for(const Q of r.segments){const at=m;if(m+=Q.arcLength,ma)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:k??g.right,endPoint:F??g.zero,endTangent:X??g.right,arrowSize:c,path:t,startOffset:i}}getPointAtDistance(t){return pi(this.profile(),t+this.startOffset())}getPointAtPercentage(t){return pi(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=ls(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));kr(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([A(!1),P()],Ct.prototype,"closed",void 0);zt([A(0),P()],Ct.prototype,"start",void 0);zt([A(0),P()],Ct.prototype,"startOffset",void 0);zt([A(!1),P()],Ct.prototype,"startArrow",void 0);zt([A(1),P()],Ct.prototype,"end",void 0);zt([A(0),P()],Ct.prototype,"endOffset",void 0);zt([A(!1),P()],Ct.prototype,"endArrow",void 0);zt([A(24),P()],Ct.prototype,"arrowSize",void 0);zt([E()],Ct.prototype,"arcLength",null);zt([E()],Ct.prototype,"curveDrawingInfo",null);Ct=zt([Ce("Curve")],Ct);class Pr{}class bc extends Pr{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(wt(-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 c=g.fromRadians(a),m=g.fromRadians(h);return[{position:this.center.add(c.scale(this.radius)),tangent:this.counter?c:c.flipped,normal:this.counter?c.flipped:c},{position:this.center.add(m.scale(this.radius)),tangent:this.counter?m.flipped:m,normal:this.counter?m.flipped:m}]}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 mt{static constant(t){return new mt(t)}static linear(t,e){return new mt(t,e)}static quadratic(t,e,r){return new mt(t,e,r)}static cubic(t,e,r,i){return new mt(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 mt(this.c1,2*this.c2,3*this.c3,0);case 2:return new mt(2*this.c2,6*this.c3,0,0);case 3:return new mt(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 mt(this.c0,this.c1*t,this.c2*t*t,this.c3*t*t*t),i=new mt(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,c=e*e,m=(3*h-c)/(3*a),y=(2*c*e-9*h*e+27*a*i)/(27*a*t),k=this.solveDepressedCubicRoots(m,y),F=X=>X-e/(3*t);switch(k.length){case 1:return[F(k[0])];case 2:return[F(k[0]),F(k[1])];case 3:return[F(k[0]),F(k[1]),F(k[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),c=m=>a*Math.cos(1/3*Math.acos(wt(-1,1,h))-r/3*m);return h>=.9999?[c(0),c(2)]:h<=-.9999?[c(1),c(2)]:[c(0),c(1),c(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),c=(-e+a)/(2*t);return[Math.min(h,c),Math.max(h,c)]}return[]}solveLinearRoot(){return[-this.c0/this.c1]}almostZero(t){return Math.abs(0-t)<=Number.EPSILON}}class Ye{constructor(t,e,r,i){this.c0=t,this.c1=e,this.c2=r,this.c3=i,t instanceof mt?(this.x=t,this.y=e):i!==void 0?(this.x=new mt(t.x,e.x,r.x,i.x),this.y=new mt(t.y,e.y,r.y,i.y)):(this.x=new mt(t.x,e.x,r.x),this.y=new mt(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 Ye(e,i),new Ye(r,a)]}differentiate(t=1){return new Ye(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 Y.fromPoints(new g(Math.min(...t),Math.max(...e)),new g(Math.max(...t),Math.min(...e)))}}class yc{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 qu(i,a,r/(e-1),(r+1)/(e-1),t)}return 1}}class wc extends Pr{get arcLength(){return this.length}constructor(t,e){super(),this.curve=t,this.length=e,this.pointSampler=new yc(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,c=r,m=this.points;if(e!==0||r!==1){const F=this.length*e,X=this.length*r;h=this.pointSampler.distanceToT(F),c=this.pointSampler.distanceToT(X);const Q=(c-h)/(1-h),[,at]=this.split(h);[a]=at.split(Q),m=a.points}i&&kr(t,m[0]),(a??this).doDraw(t);const y=this.tangent(h),k=this.tangent(c);return[{position:m[0],tangent:y,normal:y.perpendicular},{position:m.at(-1),tangent:k,normal:k.perpendicular}]}}var xc=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 c=n.length-1;c>=0;c--)(h=n[c])&&(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 Kt extends wc{get points(){return[this.p0,this.p1,this.p2,this.p3]}constructor(t,e,r,i){super(new Ye(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)),Kt.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),c=new g(a.x+(h.x-a.x)*t,a.y+(h.y-a.y)*t),m=new Kt(this.p0,e,a,c),y=new Kt(c,h,i,this.p3);return[m,y]}doDraw(t){cc(t,this.p1,this.p2,this.p3)}static getLength(t,e,r,i){return Kt.el.setAttribute("d",`M ${t.x} ${t.y} C ${e.x} ${e.y} ${r.x} ${r.y} ${i.x} ${i.y}`),Kt.el.getTotalLength()}}xc([gs(()=>document.createElementNS("http://www.w3.org/2000/svg","path"))],Kt,"el",void 0);class ze extends Pr{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&&kr(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 Cc(n,t,e,r){const i={arcLength:0,segments:[],minSin:1},a=ee(t.top,t.right,t.left,n),h=ee(t.right,t.top,t.bottom,n),c=ee(t.bottom,t.left,t.right,n),m=ee(t.left,t.bottom,t.top,n);let y=new g(n.left+a,n.top),k=new g(n.right-h,n.top);return Ie(i,new ze(y,k)),y=new g(n.right,n.top+h),k=new g(n.right,n.bottom-c),h>0&&pr(i,y.addX(-h),h,g.down,g.right,e,r),Ie(i,new ze(y,k)),y=new g(n.right-c,n.bottom),k=new g(n.left+m,n.bottom),c>0&&pr(i,y.addY(-c),c,g.right,g.up,e,r),Ie(i,new ze(y,k)),y=new g(n.left,n.bottom-m),k=new g(n.left,n.top+a),m>0&&pr(i,y.addX(m),m,g.up,g.left,e,r),Ie(i,new ze(y,k)),y=new g(n.left+a,n.top),a>0&&pr(i,y.addY(a),a,g.left,g.down,e,r),i}function Ie(n,t){n.segments.push(t),n.arcLength+=t.arcLength}function pr(n,t,e,r,i,a,h){const c=t.add(r.scale(e)),m=t.add(i.scale(e));a?Ie(n,new Kt(c,c.add(i.scale(h*e)),m.add(r.scale(h*e)),m)):Ie(n,new bc(t,e,r,i,!1))}var er=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 c=n.length-1;c>=0;c--)(h=n[c])&&(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 ne=class extends Ct{constructor(t){super(t)}profile(){return Cc(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 Y.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=Y.fromSizeCentered(this.size());return di(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=Y.fromSizeCentered(this.size()).expand(e);return di(t,h,r,i,a),t}};er([Tr("radius")],ne.prototype,"radius",void 0);er([A(!1),P()],ne.prototype,"smoothCorners",void 0);er([A(.6),P()],ne.prototype,"cornerSharpness",void 0);er([E()],ne.prototype,"profile",null);ne=er([Ce("Rect")],ne);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 c=n.length-1;c>=0;c--)(h=n[c])&&(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 It extends I{constructor({children:t,...e}){super(e),this.scene()||this.scene(new I({})),t&&this.scene().add(t)}getZoom(){return 1/this.scale.x()}setZoom(t){this.scale(ge(t,e=>1/e))}getDefaultZoom(){return this.scale.x.context.getInitial()}*tweenZoom(t,e,r,i){const a=this.scale.x();yield*_t(e,h=>{this.zoom(1/i(a,1/me(t),r(h)))})}*reset(t,e=Et){yield*Fe(this.position(Xe,t,e),this.zoom(Xe,t,e),this.rotation(Xe,t,e))}*centerOn(t,e,r=Et,i=g.lerp){const a=t instanceof I?t.absolutePosition().transformAsPoint(this.scene().worldToLocal()):t;yield*this.position(a,e,r,i)}*followCurve(t,e,r=Et){yield*_t(e,i=>{const a=r(i),h=t.getPointAtPercentage(a).position.transformAsPoint(t.localToWorld());this.position(h)})}*followCurveReverse(t,e,r=Et){yield*_t(e,i=>{const a=1-r(i),h=t.getPointAtPercentage(a).position.transformAsPoint(t.localToWorld());this.position(h)})}*followCurveWithRotation(t,e,r=Et){yield*_t(e,i=>{const a=r(i),{position:h,normal:c}=t.getPointAtPercentage(a),m=h.transformAsPoint(t.localToWorld()),y=c.flipped.perpendicular.degrees;this.position(m),this.rotation(y)})}*followCurveWithRotationReverse(t,e,r=Et){yield*_t(e,i=>{const a=1-r(i),{position:h,normal:c}=t.getPointAtPercentage(a),m=h.transformAsPoint(t.localToWorld()),y=c.flipped.perpendicular.degrees;this.position(m),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 It({scene:r,children:t});return e==null||e(a),new ne({clip:!0,...i,children:[a]})}}he([P()],It.prototype,"scene",void 0);he([xe(!1),P()],It.prototype,"zoom",void 0);he([ut()],It.prototype,"reset",null);he([ut()],It.prototype,"centerOn",null);he([ut()],It.prototype,"followCurve",null);he([ut()],It.prototype,"followCurveReverse",null);he([ut()],It.prototype,"followCurveWithRotation",null);he([ut()],It.prototype,"followCurveWithRotationReverse",null);var rr=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 c=n.length-1;c>=0;c--)(h=n[c])&&(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},hs;let ie=hs=class extends ne{constructor(t){super({composite:!0,fontFamily:"Roboto",fontSize:48,lineHeight:"120%",textWrap:!1,fontStyle:"normal",...t}),this.view2D=this,hs.shadowRoot.append(this.element),this.applyFlex()}dispose(){this.removeChildren(),super.dispose()}render(t){this.computedSize(),this.computedPosition(),super.render(t)}findKey(t){return gr().getNode(t)??null}requestLayoutUpdate(){this.updateLayout()}requestFontUpdate(){this.applyFont()}view(){return this}};rr([A(Ze.Paused),P()],ie.prototype,"playbackState",void 0);rr([A(0),P()],ie.prototype,"globalTime",void 0);rr([P()],ie.prototype,"assetHash",void 0);rr([gs(()=>{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"})})],ie,"shadowRoot",void 0);ie=hs=rr([Ce("View2D")],ie);var Sc=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 c=n.length-1;c>=0;c--)(h=n[c])&&(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 Ee extends Pr{constructor(t,e,r,i,a,h){super(),this.startPoint=t,this.radius=e,this.xAxisRotationDegree=r,this.largeArcFlag=i,this.sweepFlag=a,this.endPoint=h,this.xAxisRotation=this.xAxisRotationDegree*te,this.radius=new g(Math.abs(e.x),Math.abs(e.y));const c=t.sub(h).div(2).transform(rt.fromRotation(-r).domMatrix),m=c.x*c.x/(e.x*e.x)+c.y*c.y/(e.y*e.y);if(m>1){const Q=Math.sqrt(m);e.x=Q*e.x,e.y=Q*e.y}const y=new g(e.ctg*c.y,e.perpendicular.ctg*c.x).scale(Math.sqrt(1/(c.x*c.x/(e.x*e.x)+c.y*c.y/(e.y*e.y))-1)*(i===a?-1:1));this.xAxisRotationMatrix=rt.fromRotation(r).domMatrix,this.center=y.transform(this.xAxisRotationMatrix).add(t.add(h).div(2));const k=c.sub(y).div(e),F=c.scale(-1).sub(y).div(e);this.startAngle=k.radians,this.deltaAngle=g.angleBetween(k,F)%(Math.PI*2),this.sweepFlag===0&&this.deltaAngle>0&&(this.deltaAngle-=Math.PI*2),this.sweepFlag===1&&this.deltaAngle<0&&(this.deltaAngle+=Math.PI*2),Ee.el.setAttribute("d",`M ${this.startPoint.x} ${this.startPoint.y} A ${this.radius.x} ${this.radius.y} ${this.xAxisRotationDegree} ${this.largeArcFlag} ${this.sweepFlag} ${this.endPoint.x} ${this.endPoint.y}`),this.length=Ee.el.getTotalLength();const X=new Y(Ee.el.getBBox());this.points=[X.topLeft,X.bottomRight]}getAnglePosition(t){return this.radius.mul(g.fromRadians(t)).transform(this.xAxisRotationMatrix).add(this.center)}getAngleDerivative(t){return new g(-this.radius.x*Math.sin(t),this.radius.y*Math.cos(t)).transform(this.xAxisRotationMatrix)}draw(t,e,r,i){const a=this.startAngle+this.deltaAngle*e,h=this.startAngle+this.deltaAngle*r,c=this.getPoint(e),m=this.getPoint(r);return i&&t.moveTo(c.position.x,c.position.y),t.ellipse(this.center.x,this.center.y,this.radius.x,this.radius.y,this.xAxisRotation,a,h,this.sweepFlag===0),[c,m]}getPoint(t){const e=this.startAngle+t*this.deltaAngle,r=this.getAngleDerivative(e).normalized;return{position:t===0?this.startPoint:t===1?this.endPoint:this.getAnglePosition(e),tangent:r,normal:r.perpendicular}}get arcLength(){return this.length}}Sc([gs(()=>{const n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t=document.createElementNS("http://www.w3.org/2000/svg","path");return n.appendChild(t),ie.shadowRoot.appendChild(n),t})],Ee,"el",void 0);function kc(n,t,e,r,i=!1){const a={arcLength:0,minSin:1,segments:[]};if(et+Math.PI*2){const k=Math.floor((e-t)/(Math.PI*2));e-=Math.PI*2*k}const h=(t+e)/2,c=n.mul(g.fromRadians(t)),m=n.mul(g.fromRadians(e)),y=n.mul(g.fromRadians(h)).scale(i?-1:1);return r&&us(a,new ze(g.zero,c)),gi(a,n,c,y,t,h,i),gi(a,n,y,m,h,e,i),r&&us(a,new ze(m,g.zero)),a}function us(n,t){n.segments.push(t),n.arcLength+=t.arcLength}function gi(n,t,e,r,i,a,h){const c=Math.abs(i-a)<=180?1:0,m=i>a?0:1,y=h?0:1;us(n,new Ee(e,t,0,0,c^y^m,r))}var sr=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 c=n.length-1;c>=0;c--)(h=n[c])&&(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 ye=class extends Ct{constructor(t){super(t)}profile(){return kc(this.size().scale(.5),this.startAngle()*te,this.endAngle()*te,this.closed(),this.counterclockwise())}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}offsetComputedLayout(t){return t}childrenBBox(){return Y.fromSizeCentered(this.computedSize())}getPath(){return this.requiresProfile()?this.curveDrawingInfo().path:this.createPath()}getRipplePath(){return this.createPath(this.rippleSize())}getCacheBBox(){return super.getCacheBBox().expand(this.rippleSize())}createPath(t=0){const e=new Path2D,r=this.startAngle()*te;let i=this.endAngle()*te;const a=this.size().scale(.5).add(t),h=this.closed();if(i>r+Math.PI*2){const c=Math.floor((i-r)/(Math.PI*2));i-=Math.PI*2*c}return h&&e.moveTo(0,0),e.ellipse(0,0,a.x,a.y,0,r,i,this.counterclockwise()),h&&e.closePath(),e}};sr([A(0),P()],ye.prototype,"startAngle",void 0);sr([A(360),P()],ye.prototype,"endAngle",void 0);sr([A(!1),P()],ye.prototype,"counterclockwise",void 0);sr([E()],ye.prototype,"profile",null);ye=sr([Ce("Circle")],ye);class Tc extends Bu{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([Dt.BeforeRender,t]),t.save(),this.renderLifecycle.dispatch([Dt.BeginRender,t]),this.getView().playbackState(this.playback.state).globalTime(this.playback.time),this.getView().render(t),this.renderLifecycle.dispatch([Dt.FinishRender,t]),t.restore(),this.renderLifecycle.dispatch([Dt.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(zi(It)),h=[];for(const c of a){const m=c.scene();m&&(m===i||m.findFirst(y=>y===i))&&h.push(c)}if(h.length>0)for(const c of h){const m=c.parentToWorld(),y=c.localToParent().inverse(),k=i.localToWorld();i.drawOverlay(r,e.multiply(m).multiply(y).multiply(k))}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)&&(vt().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 ie({position:t.scale(this.resolutionScale/2),scale:this.resolutionScale,assetHash:this.assetHash,size:t})})}}function Pc(n){return{klass:Tc,config:n,stack:new Error().stack,meta:Nu(),plugins:["@motion-canvas/2d/editor"]}}const pe=Pc(function*(n){const t=du();n.add(nc(ye,{ref:t,size:320,fill:"lightseagreen"})),yield*t().scale(2,2).to(1,2)});pe.name="example";ec.attach(pe.meta);pe.onReplaced??(pe.onReplaced=new re(pe.config));const Rc={scenes:[pe]};let Ss;Ss??(Ss=new Je("\0virtual:settings",!1));Ss.loadData({version:1,appearance:{color:"rgb(0,144,255)",font:!1,coordinates:!0},defaults:{background:"rgba(255,0,0,0)",size:{x:1920,y:1080}}});const Mc=Ss,Ec=yu("project",{core:"3.17.2",two:"3.17.2",ui:"3.17.2",vitePlugin:"3.17.2"},[Ku()],Rc,tc,Mc);export{Ec as default};