function dc(n){return typeof n=="function"?n:()=>n}class vn{constructor(){this.subscribable=new wi(this),this.subscribers=new Set}subscribe(t){return this.subscribers.add(t),()=>this.unsubscribe(t)}unsubscribe(t){this.subscribers.delete(t)}clear(){this.subscribers.clear()}notifySubscribers(t){return[...this.subscribers].map(e=>e(t))}}class wi{constructor(t){this.dispatcher=t}subscribe(t){return this.dispatcher.subscribe(t)}unsubscribe(t){this.dispatcher.unsubscribe(t)}}class Ot extends vn{dispatch(t){this.notifySubscribers(t)}}class pc extends vn{constructor(){super(...arguments),this.value=!1}raise(){this.value||(this.value=!0,this.notifySubscribers())}reset(){this.value=!1}isRaised(){return this.value}subscribe(t){const e=super.subscribe(t);return this.value&&t(),e}}class ie extends vn{get current(){return this.value}set current(t){this.value=t,this.notifySubscribers(t)}constructor(t){super(),this.value=t,this.subscribable=new gc(this)}subscribe(t,e=!0){const r=super.subscribe(t);return e&&t(this.value),r}}class gc extends wi{get current(){return this.dispatcher.current}subscribe(t,e=!0){return this.dispatcher.subscribe(t,e)}}class Ct{get onChanged(){return this.value.subscribable}get onDisabled(){return this.disabled.subscribable}constructor(t,e){this.name=t,this.initial=e,this.type=void 0,this.spacing=!1,this.description="",this.disabled=new ie(!1),this.value=new ie(e)}get(){return this.value.current}set(t){this.value.current=this.parse(t)}parse(t){return t}serialize(){return this.value.current}clone(){return new this.constructor(this.name,this.get())}disable(t=!0){return this.disabled.current=t,this}space(t=!0){return this.spacing=t,this}describe(t){return this.description=t,this}}class vc extends Ct{get onFieldsChanged(){return this.event.subscribable}constructor(t,e){const r=new Map(Object.entries(e));super(t,Object.fromEntries(Array.from(r,([i,a])=>[i,a.get()]))),this.type=Object,this.ignoreChange=!1,this.customFields={},this.handleChange=()=>{this.ignoreChange||(this.value.current={...this.transform("get"),...this.customFields})},this.event=new ie([...r.values()]),this.fields=r;for(const[i,a]of this.fields)Object.defineProperty(this,i,{value:a}),a.onChanged.subscribe(this.handleChange)}set(t){this.ignoreChange=!0;for(const[e,r]of Object.entries(t)){const i=this.fields.get(e);i?i.set(r):this.customFields[e]=r}this.ignoreChange=!1,this.handleChange()}serialize(){return{...this.transform("serialize"),...this.customFields}}clone(){const t=new this.constructor(this.name,this.transform("clone"));return t.set(structuredClone(this.customFields)),t}transform(t){return Object.fromEntries(Array.from(this.fields,([r,i])=>[r,i[t]()]))}}const Xt=vc;class Cr extends Ct{constructor(){super(...arguments),this.type=Boolean}parse(t){return!!t}}class mn extends Error{constructor(t,e){typeof t=="string"?(super(t),this.remarks=e):(super(t.message),this.remarks=t.remarks,this.object=t.object,this.durationMs=t.durationMs,this.inspect=t.inspect)}}class mc{constructor(){this.resolveCurrent=null,this.current=null}async acquire(){for(;this.current;)await this.current;this.current=new Promise(t=>{this.resolveCurrent=t})}release(){var t;this.current=null,(t=this.resolveCurrent)==null||t.call(this),this.resolveCurrent=null}}const Rr=[];function bn(){const n=Rr.at(-1);if(!n)throw new Error("The scene is not available in the current context.");return n}function bc(n){Rr.push(n)}function yc(n){if(Rr.pop()!==n)throw new Error("startScene/endScene were called out of order.")}function it(){var n;return((n=Rr.at(-1))==null?void 0:n.logger)??console}const yn=[];function tr(){const n=yn.at(-1);if(!n)throw new mn("The thread is not available in the current context.",`<p><code>useThread()</code> can only be called from within generator functions.
      It&#39;s not available during rendering.</p>
`);return n}function li(n){yn.push(n)}function hi(n){if(yn.pop()!==n)throw new Error("startThread/endThread was called out of order.")}function He(n){return n[0].toUpperCase()+n.slice(1)}function Ge(){let n;return e=>{if(e!==void 0)n=e;else return n}}function xi(n){return{message:n.message,stack:n.stack,remarks:n.remarks}}const ci=[{value:.25,text:"0.25x (Quarter)"},{value:.5,text:"0.5x (Half)"},{value:1,text:"1.0x (Full)"},{value:2,text:"2.0x (Double)"}],wc=[{value:"srgb",text:"sRGB"},{value:"display-p3",text:"DCI-P3"}],ui=[{value:30,text:"30 FPS"},{value:60,text:"60 FPS"}];var It;(function(n){n.Error="error",n.Warn="warn",n.Info="info",n.Http="http",n.Verbose="verbose",n.Debug="debug",n.Silly="silly"})(It||(It={}));class xc{constructor(){this.logged=new Ot,this.history=[],this.profilers={}}get onLogged(){return this.logged.subscribable}log(t){this.logged.dispatch(t),this.history.push(t)}error(t){this.logLevel(It.Error,t)}warn(t){this.logLevel(It.Warn,t)}info(t){this.logLevel(It.Info,t)}http(t){this.logLevel(It.Http,t)}verbose(t){this.logLevel(It.Verbose,t)}debug(t){this.logLevel(It.Debug,t)}silly(t){this.logLevel(It.Silly,t)}logLevel(t,e){const r=typeof e=="string"?{message:e}:e;r.level=t,this.log(r)}profile(t,e){const r=performance.now();if(this.profilers[t]){const i=this.profilers[t];delete this.profilers[t];const a=e??{message:t};a.level??(a.level=It.Debug),a.durationMs=r-i,this.log(a);return}this.profilers[t]=r}}var Je;(function(n){n[n.Playing=0]="Playing",n[n.Rendering=1]="Rendering",n[n.Paused=2]="Paused",n[n.Presenting=3]="Presenting"})(Je||(Je={}));function Sc(n){const t={version:new Ct("version",1),shared:new Xt("General",{background:new fn("background",null),range:new Mr("range",[0,1/0]),size:new zi("resolution",new g(1920,1080)),audioOffset:new hn("audio offset",0)}),preview:new Xt("Preview",{fps:new hn("frame rate",30).setPresets(ui).setRange(1),resolutionScale:new be("scale",ci,1)}),rendering:new Xt("Rendering",{fps:new hn("frame rate",60).setPresets(ui).setRange(1),resolutionScale:new be("scale",ci,1),colorSpace:new be("color space",wc),exporter:new ou("exporter",n)})};return t.shared.audioOffset.disable(!n.audio),t}class kc extends Xt{constructor(t){super("project",Sc(t))}getFullPreviewSettings(){return{...this.shared.get(),...this.preview.get()}}getFullRenderingSettings(){return{...this.shared.get(),...this.rendering.get()}}}function Cc(){return new Xt("Application Settings",{version:new Ct("version",1),appearance:new Xt("Appearance",{color:new fn("accent color",new Yt("#33a6ff")).describe("The accent color for the user interface. (Leave empty to use the default color)"),font:new Cr("legacy font",!1).describe("Use the 'JetBrains Mono' font for the user interface."),coordinates:new Cr("coordinates",!0).describe("Display mouse coordinates within the preview window.")}),defaults:new Xt("Defaults",{background:new fn("background",null).describe("The default background color used in new projects."),size:new zi("resolution",new g(1920,1080)).describe("The default resolution used in new projects.")})})}function Tc(n,t,e,r,i,a,h=r.logger??new xc){const u=Cc();a.attach(u);const v={name:n,...r,plugins:e,versions:t,settings:u,logger:h};return v.meta=new kc(v),v.meta.shared.set(u.defaults.get()),v.experimentalFeatures??(v.experimentalFeatures=!1),i.attach(v.meta),v}function Rc(n,t){return{level:It.Error,message:n,remarks:(t??"")+`<p>This feature requires enabling the <code>experimentalFeatures</code> flag in your project
configuration:</p>
<pre class=""><code class="language-ts"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-title function_">makeProject</span>({
  <span class="hljs-attr">experimentalFeatures</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-comment">// ...</span>
});</code></pre><p><a href='https://motioncanvas.io/docs/experimental' target='_blank'>Learn more</a> about experimental
features.</p>
`}}const Pc=180/Math.PI,cn=Math.PI/180;function Mc(n){if(!Si()||n.startsWith("/cors-proxy/"))return n;const t=new URL(window.location.toString());try{const e=new URL(n,t);if(!e.protocol.startsWith("http")||t.host===e.host||!Lc(e.host))return n}catch{return n}return`/cors-proxy/${encodeURIComponent(n)}`}function Lc(n){const t=$c();if(t.length===0)return!0;for(const e of t)if(e.toLowerCase().trim()===n)return!0;return!1}function Si(){return!1}let mr;function $c(){return{}.VITEST!=="true"&&mr?[...mr]:(mr=function(){if(!Si()||!{VITE_MC_PROXY_ENABLED:"false",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1})return[];const t={}.VITE_MC_PROXY_ALLOW_LIST??"[]",e=JSON.parse(t);Array.isArray(e)||it().error("Parsed Allow List expected to be an Array, but is "+typeof e);const r=[];for(const i of e){if(typeof i!="string"){it().warn("Unexpected Value in Allow List: "+i+". Expected a String. Skipping.");continue}r.push(i)}return r}(),[...mr])}function fi(n,t,e){let r=0,i=n;t!==void 0&&(r=n,i=t),e=e===void 0?r<i?1:-1:e;const a=[];let h=Math.max(Math.ceil((i-r)/e),0),u=0;for(;h--;)a[u++]=r,r+=e;return a}function Ic(n){const t=bn(),e=tr();return t.timeEvents.register(n,e.time())}const wn=[];function ki(){const n=wn.at(-1);if(!n)throw new Error("The playback is not available in the current context.");return n}function Ac(n){wn.push(n)}function Oc(n){if(wn.pop()!==n)throw new Error("startPlayback/endPlayback were called out of order.")}function Vt(n,...t){const e={[n.name]:n},r=Object.getOwnPropertyDescriptor(e,n.name);if(r)for(let i=t.length-1;i>=0;i--)t[i](e,n.name,r)}const di=Symbol.for("@motion-canvas/core/decorators/UNINITIALIZED");function Ci(n){return(t,e)=>{let r=di;Object.defineProperty(t,e,{get(){return r===di&&(r=n.call(this)),r}})}}function ft(n){return function(t,e,r){r.value.prototype.name=n??e,r.value.prototype.threadable=!0}}Vt(ve,ft());function*ve(...n){for(const t of n)yield t;yield*Mi(...n)}Vt(zc,ft());function*zc(n,t){yield*Qe(Ic(n)),t&&(yield*t)}Vt(Qe,ft());function*Qe(n=0,t){const e=tr(),r=ki().framesToSeconds(1),i=e.time()+n;for(;i-r>e.fixed;)yield;e.time(i),t&&(yield*t)}Vt(Ti,ft());function*Ti(){}function pi(n,t){let e;return typeof n=="string"?(e=t(),Tr(e,n)):(e=n(),Tr(e,e)),e}function Ec(n){return n&&(typeof n=="object"||typeof n=="function")&&"toPromise"in n}function Ri(n){return n!==null&&typeof n=="object"&&Symbol.iterator in n&&"next"in n}function Tr(n,t){const e=Object.getPrototypeOf(n);e.threadable||(e.threadable=!0,e.name=typeof t=="string"?t:Pi(t))}function Pi(n){return Object.getPrototypeOf(n).name??null}class ln{get onDeferred(){return this.deferred.subscribable}get fixed(){return this.fixedTime}get canceled(){var t;return this.isCanceled||(((t=this.parent)==null?void 0:t.canceled)??!1)}get paused(){var t;return this.isPaused||(((t=this.parent)==null?void 0:t.paused)??!1)}get root(){var t;return((t=this.parent)==null?void 0:t.root)??this}constructor(t){this.runner=t,this.deferred=new Ot,this.children=[],this.time=je(0),this.parent=null,this.isCanceled=!1,this.isPaused=!1,this.fixedTime=0,this.queue=[],this.runner.task&&(it().error({message:`The generator "${Pi(this.runner)}" is already being executed by another thread.`,remarks:`<p>This usually happens when you mistakenly reuse a generator that is already
running.</p>
<p>For example, using <code>yield</code> here will run the opacity generator concurrently and
store it in the <code>task</code> variable (in case you want to cancel or await it later):</p>
<pre class=""><code class="language-ts"><span class="hljs-keyword">const</span> task = <span class="hljs-keyword">yield</span> <span class="hljs-title function_">rect</span>().<span class="hljs-title function_">opacity</span>(<span class="hljs-number">1</span>, <span class="hljs-number">1</span>);</code></pre><p>Trying to <code>yield</code> this task again will cause the current error:</p>
<pre class=""><code class="language-ts"><span class="hljs-keyword">yield</span> task;</code></pre><p>Passing it to other flow functions will also cause the error:</p>
<pre class=""><code class="language-ts"><span class="hljs-keyword">yield</span>* <span class="hljs-title function_">all</span>(task);</code></pre><p>Try to investigate your code looking for <code>yield</code> statements whose return value
is reused in this way. Here&#39;s an example of a common mistake:</p>
<pre class="wrong"><code class="language-ts"><span class="hljs-keyword">yield</span>* <span class="hljs-title function_">all</span>(
  <span class="hljs-keyword">yield</span> <span class="hljs-title function_">rect</span>().<span class="hljs-title function_">opacity</span>(<span class="hljs-number">1</span>, <span class="hljs-number">1</span>), 
  <span class="hljs-keyword">yield</span> <span class="hljs-title function_">rect</span>().<span class="hljs-title function_">x</span>(<span class="hljs-number">200</span>, <span class="hljs-number">1</span>),
);</code></pre><pre class="correct"><code class="language-ts"><span class="hljs-keyword">yield</span>* <span class="hljs-title function_">all</span>(
  <span class="hljs-title function_">rect</span>().<span class="hljs-title function_">opacity</span>(<span class="hljs-number">1</span>, <span class="hljs-number">1</span>), 
  <span class="hljs-title function_">rect</span>().<span class="hljs-title function_">x</span>(<span class="hljs-number">200</span>, <span class="hljs-number">1</span>),
);</code></pre>`}),this.runner=Ti()),this.runner.task=this}next(){if(this.paused)return{value:null,done:!1};li(this);const t=this.runner.next(this.value);return hi(this),this.value=null,t}update(t){this.paused||(this.time(this.time()+t),this.fixedTime+=t),this.children=this.children.filter(e=>!e.canceled)}spawn(t){return Ri(t)||(t=t()),this.queue.push(t),t}add(t){t.parent=this,t.isCanceled=!1,t.time(this.time()),t.fixedTime=this.fixedTime,this.children.push(t),Tr(t.runner,`unknown ${this.children.length}`)}drain(t){this.queue.forEach(t),this.queue=[]}cancel(){this.deferred.clear(),this.runner.return(),this.isCanceled=!0,this.parent=null,this.drain(t=>t.return())}pause(t){this.isPaused=t}runDeferred(){li(this),this.deferred.dispatch(),hi(this)}}Vt(Mi,ft());function*Mi(n,...t){let e=!0;typeof n=="boolean"?e=n:t.push(n);const r=tr(),i=t.map(u=>r.children.find(v=>v.runner===u)).filter(u=>u),a=r.time();let h;if(e){for(;i.find(u=>!u.canceled);)yield;h=Math.max(...i.map(u=>u.time()))}else{for(;!i.find(v=>v.canceled);)yield;const u=i.filter(v=>v.canceled);h=Math.min(...u.map(v=>v.time()))}r.time(Math.max(a,h))}function Fc(n){return typeof(n==null?void 0:n.then)=="function"}Vt(Li,ft());function*Li(n,t){const e=ki(),r=n();Tr(r,"root");const i=new ln(r);t==null||t(i);let a=[i];for(;a.length>0;){const h=[],u=[...a],v=e.deltaTime;for(;u.length>0;){const y=u.pop();if(!y||y.canceled)continue;const C=y.next();if(C.done){y.cancel();continue}if(Ri(C.value)){const F=new ln(C.value);y.value=C.value,y.add(F),u.push(y),u.push(F)}else C.value?(y.value=yield C.value,u.push(y)):(y.update(v),y.drain(F=>{const H=new ln(F);y.add(H),h.unshift(H)}),h.unshift(y))}a=[];for(const y of h)y.canceled||(a.push(y),y.runDeferred());a.length>0&&(yield)}}var jt;(function(n){n[n.BeforeRender=0]="BeforeRender",n[n.BeginRender=1]="BeginRender",n[n.FinishRender=2]="FinishRender",n[n.AfterRender=3]="AfterRender"})(jt||(jt={}));class _c{get onBeforeRender(){return this.beforeRender.subscribable}get onBeginRender(){return this.beginRender.subscribable}get onFinishRender(){return this.finishRender.subscribable}get onAfterRender(){return this.afterRender.subscribable}constructor(t){this.scene=t,this.beforeRender=new Ot,this.beginRender=new Ot,this.finishRender=new Ot,this.afterRender=new Ot,this.scene.onRenderLifecycle.subscribe(([e,r])=>{switch(e){case jt.BeforeRender:return this.beforeRender.dispatch(r);case jt.BeginRender:return this.beginRender.dispatch(r);case jt.FinishRender:return this.finishRender.dispatch(r);case jt.AfterRender:return this.afterRender.dispatch(r)}}),this.scene.onReset.subscribe(()=>{this.beforeRender.clear(),this.beginRender.clear(),this.finishRender.clear(),this.afterRender.clear()})}}class Ke{constructor(t){this.state=t,this.nextGauss=null}static createSeed(){return Math.floor(Math.random()*4294967296)}nextFloat(t=0,e=1){return tt(t,e,this.next())}nextInt(t=0,e=4294967296){let r=Math.floor(tt(t,e,this.next()));return r===e&&(r=t),r}gauss(t=0,e=1){let r=this.nextGauss;if(this.nextGauss=null,r===null){const i=this.next()*2*Math.PI,a=Math.sqrt(-2*Math.log(1-this.next()));r=Math.cos(i)*a,this.nextGauss=Math.sin(i)*a}return t+r*e}floatArray(t,e=0,r=1){return fi(t).map(()=>this.nextFloat(e,r))}intArray(t,e=0,r=4294967296){return fi(t).map(()=>this.nextInt(e,r))}spawn(){return new Ke(this.nextInt())}next(){this.state|=0,this.state=this.state+1831565813|0;let t=Math.imul(this.state^this.state>>>15,1|this.state);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}var mt;(function(n){n[n.Initial=0]="Initial",n[n.AfterTransitionIn=1]="AfterTransitionIn",n[n.CanTransitionOut=2]="CanTransitionOut",n[n.Finished=3]="Finished"})(mt||(mt={}));const Dc="resolution",jc="destinationTexture",Nc="sourceTexture",gi="time",Bc="deltaTime",Uc="framerate",Wc="sourceMatrix",Gc="destinationMatrix",qc=`#version 300 es

in vec2 position;

out vec2 screenUV;
out vec2 sourceUV;
out vec2 destinationUV;

uniform mat4 sourceMatrix;
uniform mat4 destinationMatrix;

void main() {
    vec2 position_source = position * 0.5 + 0.5;
    vec4 position_screen = sourceMatrix * vec4(position_source, 0, 1);

    screenUV = position_screen.xy;
    sourceUV = position_source;
    destinationUV = (destinationMatrix * position_screen).xy;

    gl_Position = (position_screen - 0.5) * 2.0;
}
`;class Xc{constructor(t,e){this.scene=t,this.sharedContext=e,this.gl=null,this.positionBuffer=null,this.sourceTexture=null,this.destinationTexture=null,this.positionLocation=0,this.quadPositions=new Float32Array([-1,1,-1,-1,1,1,1,-1]),this.handleReload=()=>{this.gl&&this.updateViewport()},t.onReloaded.subscribe(this.handleReload)}setup(t){this.gl=t,this.updateViewport(),this.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,this.quadPositions,t.STATIC_DRAW),t.vertexAttribPointer(this.positionLocation,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.positionLocation),this.sourceTexture=t.createTexture(),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.sourceTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.destinationTexture=t.createTexture(),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this.destinationTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}teardown(t){t.deleteBuffer(this.positionBuffer),t.disableVertexAttribArray(this.positionLocation),t.deleteTexture(this.sourceTexture),t.deleteTexture(this.destinationTexture),this.positionBuffer=null,this.sourceTexture=null,this.destinationTexture=null,this.gl=null}updateViewport(){if(this.gl){const t=this.scene.getRealSize();this.gl.canvas.width=t.width,this.gl.canvas.height=t.height,this.gl.viewport(0,0,t.width,t.height)}}getGL(){return this.gl??this.sharedContext.borrow(this)}getProgram(t){const e=this.sharedContext.getProgram(t,qc);if(!e)return null;const r=this.scene.getRealSize(),i=this.getGL();return i.useProgram(e),i.uniform1i(i.getUniformLocation(e,Nc),0),i.uniform1i(i.getUniformLocation(e,jc),1),i.uniform2f(i.getUniformLocation(e,Dc),r.x,r.y),i.uniform1f(i.getUniformLocation(e,Bc),this.scene.playback.deltaTime),i.uniform1f(i.getUniformLocation(e,Uc),this.scene.playback.fps),e}copyTextures(t,e){this.copyTexture(e,this.sourceTexture),this.copyTexture(t,this.destinationTexture)}clear(){const t=this.getGL();t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)}render(){const t=this.getGL();t.drawArrays(t.TRIANGLE_STRIP,0,4)}copyTexture(t,e){const r=this.getGL();r.bindTexture(r.TEXTURE_2D,e),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),r.generateMipmap(r.TEXTURE_2D)}}class Hc{get onChanged(){return this.slides.subscribable}constructor(t){this.scene=t,this.slides=new ie([]),this.lookup=new Map,this.collisionLookup=new Set,this.current=null,this.canResume=!1,this.waitsForId=null,this.targetId=null,this.handleReload=()=>{this.lookup.clear(),this.collisionLookup.clear(),this.current=null,this.waitsForId=null,this.targetId=null},this.handleReset=()=>{this.collisionLookup.clear(),this.current=null,this.waitsForId=null},this.handleRecalculated=()=>{this.slides.current=[...this.lookup.values()]},this.scene.onReloaded.subscribe(this.handleReload),this.scene.onReset.subscribe(this.handleReset),this.scene.onRecalculated.subscribe(this.handleRecalculated)}setTarget(t){this.targetId=t}resume(){this.canResume=!0}isWaitingFor(t){return this.waitsForId===t}isWaiting(){return this.waitsForId!==null}didHappen(t){var e;if(this.current===null)return!1;for(const r of this.lookup.keys()){if(r===t)return!0;if(r===((e=this.current)==null?void 0:e.id))return!1}return!1}getCurrent(){return this.current}register(t,e){if(this.waitsForId!==null)throw new Error(`The animation already waits for a slide: ${this.waitsForId}.`);const r=this.toId(t);this.scene.playback.state!==Je.Presenting&&(this.lookup.has(r)||this.lookup.set(r,{id:r,name:t,time:e,scene:this.scene,stack:new Error().stack}),this.collisionLookup.has(t)?this.scene.logger.warn({message:`A slide named "${t}" already exists.`,stack:new Error().stack}):this.collisionLookup.add(t)),this.waitsForId=r,this.current=this.lookup.get(r)??null,this.canResume=!1}shouldWait(t){const e=this.toId(t);if(this.waitsForId!==e)throw new Error(`The animation waits for a different slide: ${this.waitsForId}.`);if(!this.lookup.get(e))throw new Error(`Could not find the "${t}" slide.`);let i=this.canResume;return this.scene.playback.state!==Je.Presenting&&(i=e!==this.targetId),i&&(this.waitsForId=null),!i}toId(t){return`${this.scene.name}:${t}`}}class Yc{constructor(t){this.scene=t,this.signals={},this.variables={},this.handleReset=()=>{this.signals={}},t.onReset.subscribe(this.handleReset)}get(t,e){var r;return(r=this.signals)[t]??(r[t]=je(this.variables[t]??e)),()=>this.signals[t]()}updateSignals(t){this.variables=t,Object.keys(t).map(e=>{e in this.signals&&this.signals[e](t[e])})}}class Zc{get firstFrame(){return this.cache.current.firstFrame}get lastFrame(){return this.firstFrame+this.cache.current.duration}get onCacheChanged(){return this.cache.subscribable}get onReloaded(){return this.reloaded.subscribable}get onRecalculated(){return this.recalculated.subscribable}get onThreadChanged(){return this.thread.subscribable}get onRenderLifecycle(){return this.renderLifecycle.subscribable}get onReset(){return this.afterReset.subscribable}get LifecycleEvents(){return this.logger.warn("LifecycleEvents is deprecated. Use lifecycleEvents instead."),this.lifecycleEvents}get previous(){return this.previousScene}constructor(t){this.cache=new ie({firstFrame:0,transitionDuration:0,duration:0,lastFrame:0}),this.reloaded=new Ot,this.recalculated=new Ot,this.thread=new ie(null),this.renderLifecycle=new Ot,this.afterReset=new Ot,this.lifecycleEvents=new _c(this),this.previousScene=null,this.runner=null,this.state=mt.Initial,this.cached=!1,this.counters={},this.name=t.name,this.size=t.size,this.resolutionScale=t.resolutionScale,this.logger=t.logger,this.playback=t.playback,this.meta=t.meta,this.runnerFactory=t.config,this.creationStack=t.stack,this.experimentalFeatures=t.experimentalFeatures??!1,Vt(this.runnerFactory,ft(this.name)),this.timeEvents=new t.timeEventsClass(this),this.variables=new Yc(this),this.shaders=new Xc(this,t.sharedWebGLContext),this.slides=new Hc(this),this.random=new Ke(this.meta.seed.get()),this.previousOnTop=!1}update(){}async render(t){let e=0;do e++,await lt.consumePromises(),t.save(),t.clearRect(0,0,t.canvas.width,t.canvas.height),this.execute(()=>this.draw(t)),t.restore();while(lt.hasPromises()&&e<10);e>1&&this.logger.debug(`render iterations: ${e}`)}reload({config:t,size:e,stack:r,resolutionScale:i}={}){t&&(this.runnerFactory=t),e&&(this.size=e),i&&(this.resolutionScale=i),r&&(this.creationStack=r),this.cached=!1,this.reloaded.dispatch()}async recalculate(t){const e=this.cache.current;if(e.firstFrame=this.playback.frame,e.lastFrame=e.firstFrame+e.duration,this.isCached()){t(e.lastFrame),this.cache.current={...e};return}for(e.transitionDuration=-1,await this.reset();!this.canTransitionOut();)e.transitionDuration<0&&this.state===mt.AfterTransitionIn&&(e.transitionDuration=this.playback.frame-e.firstFrame),t(this.playback.frame+1),await this.next();e.transitionDuration===-1&&(e.transitionDuration=0),e.lastFrame=this.playback.frame,e.duration=e.lastFrame-e.firstFrame,await new Promise(r=>setTimeout(r,0)),this.cached=!0,this.cache.current={...e},this.recalculated.dispatch()}async next(){var e;if(!this.runner)return;let t=this.execute(()=>this.runner.next());for(this.update();t.value;){if(Ec(t.value)){const r=await t.value.toPromise();t=this.execute(()=>this.runner.next(r))}else if(Fc(t.value)){const r=await t.value;t=this.execute(()=>this.runner.next(r))}else this.logger.warn({message:"Invalid value yielded by the scene.",object:t.value}),t=this.execute(()=>this.runner.next(t.value));this.update()}if(lt.hasPromises()){const r=await lt.consumePromises();this.logger.error({message:"Tried to access an asynchronous property before the node was ready. Make sure to yield the node before accessing the property.",stack:r[0].stack,inspect:((e=r[0].owner)==null?void 0:e.key)??void 0})}t.done&&(this.state=mt.Finished)}async reset(t=null){this.counters={},this.previousScene=t,this.previousOnTop=!1,this.random=new Ke(this.meta.seed.get()),this.runner=Li(()=>this.runnerFactory(this.getView()),e=>{this.thread.current=e}),this.state=mt.AfterTransitionIn,this.afterReset.dispatch(),await this.next()}getSize(){return this.size}getRealSize(){return this.size.mul(this.resolutionScale)}isAfterTransitionIn(){return this.state===mt.AfterTransitionIn}canTransitionOut(){return this.state===mt.CanTransitionOut||this.state===mt.Finished}isFinished(){return this.state===mt.Finished}enterInitial(){this.state===mt.AfterTransitionIn?this.state=mt.Initial:this.logger.warn(`Scene ${this.name} entered initial in an unexpected state: ${this.state}`)}enterAfterTransitionIn(){this.state===mt.Initial?this.state=mt.AfterTransitionIn:this.logger.warn(`Scene ${this.name} transitioned in an unexpected state: ${this.state}`)}enterCanTransitionOut(){this.state===mt.AfterTransitionIn||this.state===mt.Initial?this.state=mt.CanTransitionOut:this.logger.warn(`Scene ${this.name} was marked as finished in an unexpected state: ${this.state}`)}isCached(){return this.cached}execute(t){let e;bc(this),Ac(this.playback);try{e=t()}finally{Oc(this.playback),yc(this)}return e}}function Vc(){return new Xt("scene",{version:new Ct("version",1),timeEvents:new Ct("time events",[]),seed:new Ct("seed",Ke.createSeed())})}function Jc(n,t,e){const r=[...n],i=[...t];if(i.length>=r.length){const a=Math.floor(i.length*e),h=Math.floor(tt(r.length-1,i.length,e));let u="";for(let v=0;v<i.length;v++)v<a?u+=i[v]:(r[v]||v<=h)&&(u+=r[v]??i[v]);return u}else{const a=Math.round(r.length*(1-e)),h=Math.floor(tt(r.length+1,i.length,e)),u=[];for(let v=r.length-1;v>=0;v--)v<a?u.unshift(r[v]):(i[v]||v<h)&&u.unshift(i[v]??r[v]);return u.join("")}}function De(n,t,e,r=!1){if(e===0)return n;if(e===1)return t;if(n==null||t==null){r||it().warn(`Attempting to lerp ${n} -> ${t} may result in unexpected behavior.`);return}if(typeof n=="number"&&typeof t=="number")return tt(n,t,e);if(typeof n=="string"&&typeof t=="string")return Jc(n,t,e);if(typeof n=="boolean"&&typeof t=="boolean")return e<.5?n:t;if("lerp"in n)return n.lerp(t,e);if(n&&t&&typeof n=="object"&&typeof t=="object")if(Array.isArray(n)&&Array.isArray(t)){if(n.length===t.length)return n.map((i,a)=>De(i,t[a],e))}else{let i=!1;if(!(n instanceof Map)&&!(t instanceof Map)&&(i=!0,n=new Map(Object.entries(n)),t=new Map(Object.entries(t))),n instanceof Map&&t instanceof Map){const a=new Map;for(const h of new Set([...n.keys(),...t.keys()])){const u=De(n.get(h),t.get(h),e,!0);u!==void 0&&a.set(h,u)}return i?Object.fromEntries(a):a}}return t}function Qc(n,t,e){return e<.5?n:t}function tt(n,t,e){return n+(t-n)*e}function Kc(n,t,e,r,i){return e+(i-n)*(r-e)/(t-n)}function xt(n,t,e){return e<n?n:e>t?t:e}function $i(n,t,e){let r=t;e>1?e=1/e:r=!r;const i=r?Math.acos(xt(-1,1,1-n)):Math.asin(n),a=tt(i,tt(0,Math.PI/2,n),e);let h=Math.sin(a),u=1-Math.cos(a);return t&&([h,u]=[u,h]),new g(h,u)}Vt(Ii,ft());function*Ii(n,t,e,r,i,a){const h=typeof r=="number"?r:.001;a=typeof r=="number"?a:i;const u=(ht,K)=>{typeof r=="function"?r(ht,K):typeof i=="function"&&i(ht,K)};if(n=n??{mass:.05,stiffness:10,damping:.5},n.mass<=0){it().error(new Error("Spring mass must be greater than 0."));return}if(n.stiffness<0){it().error(new Error("Spring stiffness must be greater or equal to 0."));return}if(n.damping<0){it().error(new Error("Spring damping must be greater or equal to 0."));return}const v=tr();let y=t,C=n.initialVelocity??0;const F=ht=>{if(n===null)return;const K=y-e,ce=-n.stiffness*K-n.damping*C;C+=ce/n.mass*ht,y+=C*ht},J=1/120;u(t,0);const et=v.time();let T=et,rt=!1;for(;!rt;){for(;T<v.fixed;){const ht=v.fixed-T;if(J>ht?(F(ht),T=v.fixed):(F(J),T+=J),Math.abs(e-y)<h&&Math.abs(C)<h){v.time(T),rt=!0;break}}rt||(u(y,v.fixed-et),yield)}u(e,v.fixed-et),a==null||a(e,v.fixed-et)}function qe(n,t=0,e=1){return n=1-Math.pow(1-n,3),tt(t,e,n)}function _t(n,t=0,e=1){return n=n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,tt(t,e,n)}function tu(n,t=0,e=1){return n=n===1?1:1-Math.pow(2,-10*n),tt(t,e,n)}function eu(n,t=0,e=1){return tt(t,e,n)}Vt(Dt,ft());function*Dt(n,t,e){const r=tr(),i=r.time(),a=r.time()+n;for(t(0,0);a>r.fixed;){const h=r.fixed-i,u=h/n;h>0&&t(u,h),yield}r.time(a),t(1,n),e==null||e(1,n)}class lt{static collectPromise(t,e=null){const r={promise:t,value:e,stack:new Error().stack},i=this.collectionStack.at(-1);return i&&(r.owner=i.owner),t.then(a=>{r.value=a,i==null||i.markDirty()}),this.promises.push(r),r}static hasPromises(){return this.promises.length>0}static async consumePromises(){const t=[...this.promises];return await Promise.all(t.map(e=>e.promise)),this.promises=this.promises.filter(e=>!t.includes(e)),t}constructor(t){this.owner=t,this.dependencies=new Set,this.event=new pc,this.markDirty=()=>this.event.raise(),this.invokable=this.invoke.bind(this),Object.defineProperty(this.invokable,"context",{value:this}),Object.defineProperty(this.invokable,"toPromise",{value:this.toPromise.bind(this)})}invoke(){}startCollecting(){if(lt.collectionSet.has(this))throw new mn("A circular dependency occurred between signals.",`This can happen when signals reference each other in a loop.
        Try using the attached stack trace to locate said loop.`);lt.collectionSet.add(this),lt.collectionStack.push(this)}finishCollecting(){if(lt.collectionSet.delete(this),lt.collectionStack.pop()!==this)throw new Error("collectStart/collectEnd was called out of order.")}clearDependencies(){this.dependencies.forEach(t=>t.unsubscribe(this.markDirty)),this.dependencies.clear()}collect(){const t=lt.collectionStack.at(-1);t&&(t.dependencies.add(this.event.subscribable),this.event.subscribe(t.markDirty))}dispose(){this.clearDependencies(),this.event.clear(),this.owner=null}async toPromise(){do await lt.consumePromises(),this.invokable();while(lt.hasPromises());return this.invokable}}lt.collectionSet=new Set;lt.collectionStack=[];lt.promises=[];const Ye=Symbol.for("@motion-canvas/core/signals/default");function Ht(n){return typeof n=="function"}function me(n,t){return Ht(n)?()=>t(n()):t(n)}function ye(n){return Ht(n)?n():n}class we extends lt{constructor(t,e,r=void 0,i=h=>h,a={}){super(r),this.initial=t,this.interpolation=e,this.parser=i,this.tweening=!1,Object.defineProperty(this.invokable,"reset",{value:this.reset.bind(this)}),Object.defineProperty(this.invokable,"save",{value:this.save.bind(this)}),Object.defineProperty(this.invokable,"isInitial",{value:this.isInitial.bind(this)}),this.initial!==void 0&&(this.current=this.initial,this.markDirty(),Ht(this.initial)||(this.last=this.parse(this.initial))),this.extensions={getter:this.getter.bind(this),setter:this.setter.bind(this),tweener:this.tweener.bind(this),...a}}toSignal(){return this.invokable}parse(t){return this.parser(t)}set(t){return this.extensions.setter(t),this.owner}setter(t){return t===Ye&&(t=this.initial),this.current===t?this.owner:(this.current=t,this.clearDependencies(),Ht(t)||(this.last=this.parse(t)),this.markDirty(),this.owner)}get(){return this.extensions.getter()}getter(){var t;if(this.event.isRaised()&&Ht(this.current)){this.clearDependencies(),this.startCollecting();try{this.last=this.parse(this.current())}catch(e){it().error({...xi(e),inspect:(t=this.owner)==null?void 0:t.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}invoke(t,e,r=_t,i=this.interpolation){return t===void 0?this.get():e===void 0?this.set(t):this.createQueue(r,i).to(t,e)}createQueue(t,e){const r=this.get(),i=[],a=pi("animation chain",function*(){for(;i.length>0;)yield*i.shift()});return a.to=(h,u,v=t,y=e)=>(t=v,e=y,i.push(this.tween(h,u,v,y)),a),a.back=(h,u=t,v=e)=>(t=u,e=v,i.push(this.tween(r,h,t,e)),a),a.wait=h=>(i.push(Qe(h)),a),a.run=h=>(i.push(h),a),a.do=h=>(i.push(pi(function*(){h()})),a),a}*tween(t,e,r,i){t===Ye&&(t=this.initial),this.tweening=!0,yield*this.extensions.tweener(t,e,r,i),this.set(t),this.tweening=!1}*tweener(t,e,r,i){const a=this.get();yield*Dt(e,h=>{this.set(i(a,this.parse(ye(t)),r(h)))})}dispose(){super.dispose(),this.initial=void 0,this.current=void 0,this.last=void 0}reset(){return this.initial!==void 0&&this.set(this.initial),this.owner}save(){return this.set(this.get())}isInitial(){return this.collect(),this.current===this.initial}getInitial(){return this.initial}raw(){return this.current}isTweening(){return this.tweening}}class Pr extends we{constructor(t,e,r,i,a=void 0,h={}){var u;super(void 0,i,a,e,h),this.entries=t,this.signals=[],this.parser=e;for(const v of t){let y,C;Array.isArray(v)?([y,C]=v,(u=C.context).owner??(u.owner=this)):(y=v,C=new we(me(r,F=>e(F)[v]),tt,a??this.invokable).toSignal()),this.signals.push([y,C]),Object.defineProperty(this.invokable,y,{value:C})}}toSignal(){return this.invokable}parse(t){return this.parser(t)}getter(){return this.parse(Object.fromEntries(this.signals.map(([t,e])=>[t,e()])))}setter(t){if(Ht(t))for(const[e,r]of this.signals)r(()=>this.parser(t())[e]);else{const e=this.parse(t);for(const[r,i]of this.signals)i(e[r])}return this.owner}reset(){for(const[,t]of this.signals)t.reset();return this.owner}save(){for(const[,t]of this.signals)t.save();return this.owner}isInitial(){for(const[,t]of this.signals)if(!t.isInitial())return!1;return!0}raw(){return Object.fromEntries(this.signals.map(([t,e])=>[t,e.context.raw()]))}}class ru extends lt{constructor(t,e){super(e),this.factory=t,this.markDirty()}toSignal(){return this.invokable}dispose(){super.dispose(),this.last=void 0}invoke(...t){var e;if(this.event.isRaised()){this.clearDependencies(),this.startCollecting();try{this.last=this.factory(...t)}catch(r){it().error({...xi(r),inspect:(e=this.owner)==null?void 0:e.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}}class Ai extends Pr{constructor(t,e,r,i,a=void 0,h={}){super(t,e,r,i,a,h),Object.defineProperty(this.invokable,"edit",{value:this.edit.bind(this)}),Object.defineProperty(this.invokable,"mul",{value:this.mul.bind(this)}),Object.defineProperty(this.invokable,"div",{value:this.div.bind(this)}),Object.defineProperty(this.invokable,"add",{value:this.add.bind(this)}),Object.defineProperty(this.invokable,"sub",{value:this.sub.bind(this)}),Object.defineProperty(this.invokable,"dot",{value:this.dot.bind(this)}),Object.defineProperty(this.invokable,"cross",{value:this.cross.bind(this)}),Object.defineProperty(this.invokable,"mod",{value:this.mod.bind(this)})}toSignal(){return this.invokable}edit(t,e,r,i){const a=t(this.get());return this.invoke(a,e,r,i)}mul(t,e,r,i){const a=h=>h.mul(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}div(t,e,r,i){const a=h=>h.div(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}add(t,e,r,i){const a=h=>h.add(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}sub(t,e,r,i){const a=h=>h.sub(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}dot(t,e,r,i){const a=h=>h.dot(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}cross(t,e,r,i){const a=h=>h.cross(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}mod(t,e,r,i){const a=h=>h.mod(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}}function nu(n,t){return new ru(n,t).toSignal()}function je(n,t=De,e){return new we(n,t,e).toSignal()}class At{static createSignal(t,e=At.lerp){return new Pr(["top","right","bottom","left"],r=>new At(r),t,e).toSignal()}static lerp(t,e,r){return new At(tt(t.top,e.top,r),tt(t.right,e.right,r),tt(t.bottom,e.bottom,r),tt(t.left,e.left,r))}get x(){return this.left+this.right}get y(){return this.top+this.bottom}constructor(t=0,e,r,i){if(this.top=0,this.right=0,this.bottom=0,this.left=0,t!=null){if(Array.isArray(t)&&(i=t[3],r=t[2],e=t[1],t=t[0]),typeof t=="number"){this.top=t,this.right=e!==void 0?e:t,this.bottom=r!==void 0?r:t,this.left=i!==void 0?i:e!==void 0?e:t;return}this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}}lerp(t,e){return At.lerp(this,t,e)}scale(t){return new At(this.top*t,this.right*t,this.bottom*t,this.left*t)}addScalar(t){return new At(this.top+t,this.right+t,this.bottom+t,this.left+t)}toSymbol(){return At.symbol}toString(){return`Spacing(${this.top}, ${this.right}, ${this.bottom}, ${this.left})`}toUniform(t,e){t.uniform4f(e,this.top,this.right,this.bottom,this.left)}serialize(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}}At.symbol=Symbol.for("@motion-canvas/core/types/Spacing");const Ze=1e-6;class at{static fromRotation(t){return at.identity.rotate(t)}static fromTranslation(t){return at.identity.translate(new g(t))}static fromScaling(t){return at.identity.scale(new g(t))}get x(){return new g(this.values[0],this.values[1])}get y(){return new g(this.values[2],this.values[3])}get scaleX(){return this.values[0]}set scaleX(t){this.values[0]=this.x.normalized.scale(t).x}get skewX(){return this.values[1]}set skewX(t){this.values[1]=t}get scaleY(){return this.values[3]}set scaleY(t){this.values[3]=this.y.normalized.scale(t).y}get skewY(){return this.values[2]}set skewY(t){this.values[2]=t}get translateX(){return this.values[4]}set translateX(t){this.values[4]=t}get translateY(){return this.values[5]}set translateY(t){this.values[5]=t}get rotation(){return g.degrees(this.values[0],this.values[1])}set rotation(t){const e=this.rotate(t-this.rotation);this.values[0]=e.values[0],this.values[1]=e.values[1],this.values[2]=e.values[2],this.values[3]=e.values[3]}get translation(){return new g(this.values[4],this.values[5])}set translation(t){const e=new g(t);this.values[4]=e.x,this.values[5]=e.y}get scaling(){return new g(this.values[0],this.values[3])}set scaling(t){const e=new g(t),r=new g(this.values[0],this.values[1]).normalized,i=new g(this.values[2],this.values[3]).normalized;this.values[0]=r.x*e.x,this.values[1]=r.y*e.y,this.values[2]=i.x*e.x,this.values[3]=i.y*e.y}get inverse(){const t=this.values[0],e=this.values[1],r=this.values[2],i=this.values[3],a=this.values[4],h=this.values[5];let u=t*i-e*r;return u?(u=1/u,new at(i*u,-e*u,-r*u,t*u,(r*h-i*a)*u,(e*a-t*h)*u)):null}get determinant(){return this.values[0]*this.values[3]-this.values[1]*this.values[2]}get domMatrix(){return new DOMMatrix([this.values[0],this.values[1],this.values[2],this.values[3],this.values[4],this.values[5]])}constructor(t,e,r,i,a,h){if(this.values=new Float32Array(6),arguments.length===0){this.values=new Float32Array([1,0,0,1,0,0]);return}if(arguments.length===6){this.values[0]=t,this.values[1]=e,this.values[2]=r,this.values[3]=i,this.values[4]=a,this.values[5]=h;return}if(t instanceof DOMMatrix){this.values[0]=t.m11,this.values[1]=t.m12,this.values[2]=t.m21,this.values[3]=t.m22,this.values[4]=t.m41,this.values[5]=t.m42;return}if(t instanceof at){this.values=t.values;return}if(Array.isArray(t)){if(t.length===2){this.values[0]=t[0],this.values[1]=t[1],this.values[2]=e[0],this.values[3]=e[1],this.values[4]=r[0],this.values[5]=r[1];return}if(t.length===3){const C=new g(t[0]),F=new g(t[1]),H=new g(t[2]);this.values[0]=C.x,this.values[1]=C.y,this.values[2]=F.x,this.values[3]=F.y,this.values[4]=H.x,this.values[5]=H.y;return}this.values[0]=t[0],this.values[1]=t[1],this.values[2]=t[2],this.values[3]=t[3],this.values[4]=t[4],this.values[5]=t[5];return}const u=new g(t),v=new g(e),y=new g(r);this.values[0]=u.x,this.values[1]=u.y,this.values[2]=v.x,this.values[3]=v.y,this.values[4]=y.x,this.values[5]=y.y}column(t){return new g(this.values[t*2],this.values[t*2+1])}row(t){return[this.values[t],this.values[t+2],this.values[t+4]]}mul(t){const e=this.values[0],r=this.values[1],i=this.values[2],a=this.values[3],h=this.values[4],u=this.values[5],v=t.values[0],y=t.values[1],C=t.values[2],F=t.values[3],H=t.values[4],J=t.values[5];return new at(e*v+i*y,r*v+a*y,e*C+i*F,r*C+a*F,e*H+i*J+h,r*H+a*J+u)}rotate(t,e=!0){e&&(t*=cn);const r=this.values[0],i=this.values[1],a=this.values[2],h=this.values[3],u=this.values[4],v=this.values[5],y=Math.sin(t),C=Math.cos(t);return new at(r*C+a*y,i*C+h*y,r*-y+a*C,i*-y+h*C,u,v)}scale(t){const e=new g(t);return new at(this.values[0]*e.x,this.values[1]*e.x,this.values[2]*e.y,this.values[3]*e.y,this.values[4],this.values[5])}mulScalar(t){return new at(this.values[0]*t,this.values[1]*t,this.values[2]*t,this.values[3]*t,this.values[4]*t,this.values[5]*t)}translate(t){const e=new g(t);return new at(this.values[0],this.values[1],this.values[2],this.values[3],this.values[0]*e.x+this.values[2]*e.y+this.values[4],this.values[1]*e.x+this.values[3]*e.y+this.values[5])}add(t){return new at(this.values[0]+t.values[0],this.values[1]+t.values[1],this.values[2]+t.values[2],this.values[3]+t.values[3],this.values[4]+t.values[4],this.values[5]+t.values[5])}sub(t){return new at(this.values[0]-t.values[0],this.values[1]-t.values[1],this.values[2]-t.values[2],this.values[3]-t.values[3],this.values[4]-t.values[4],this.values[5]-t.values[5])}toSymbol(){return at.symbol}toUniform(t,e){t.uniformMatrix3fv(e,!1,[this.values[0],this.values[1],0,this.values[2],this.values[3],0,this.values[4],this.values[5],1])}equals(t,e=Ze){return Math.abs(this.values[0]-t.values[0])<=e+Number.EPSILON&&Math.abs(this.values[1]-t.values[1])<=e+Number.EPSILON&&Math.abs(this.values[2]-t.values[2])<=e+Number.EPSILON&&Math.abs(this.values[3]-t.values[3])<=e+Number.EPSILON&&Math.abs(this.values[4]-t.values[4])<=e+Number.EPSILON&&Math.abs(this.values[5]-t.values[5])<=e+Number.EPSILON}exactlyEquals(t){return this.values[0]===t.values[0]&&this.values[1]===t.values[1]&&this.values[2]===t.values[2]&&this.values[3]===t.values[3]&&this.values[4]===t.values[4]&&this.values[5]===t.values[5]}}at.symbol=Symbol.for("@motion-canvas/core/types/Matrix2D");at.identity=new at(1,0,0,1,0,0);at.zero=new at(0,0,0,0,0,0);var vi;(function(n){n[n.Vertical=1]="Vertical",n[n.Horizontal=2]="Horizontal"})(vi||(vi={}));var St;(function(n){n[n.Top=4]="Top",n[n.Bottom=8]="Bottom",n[n.Left=16]="Left",n[n.Right=32]="Right"})(St||(St={}));var ot;(function(n){n[n.Middle=3]="Middle",n[n.Top=5]="Top",n[n.Bottom=9]="Bottom",n[n.Left=18]="Left",n[n.Right=34]="Right",n[n.TopLeft=20]="TopLeft",n[n.TopRight=36]="TopRight",n[n.BottomLeft=24]="BottomLeft",n[n.BottomRight=40]="BottomRight"})(ot||(ot={}));function su(n){if(n===ot.Middle)return g.zero;let t=0;n&St.Left?t=-1:n&St.Right&&(t=1);let e=0;return n&St.Top?e=-1:n&St.Bottom&&(e=1),new g(t,e)}class g{static createSignal(t,e=g.lerp,r){return new Ai(["x","y"],i=>new g(i),t,e,r).toSignal()}static lerp(t,e,r){let i,a;return typeof r=="number"?i=a=r:(i=r.x,a=r.y),new g(tt(t.x,e.x,i),tt(t.y,e.y,a))}static arcLerp(t,e,r,i=!1,a){return a??(a=t.sub(e).ctg),g.lerp(t,e,$i(r,i,a))}static createArcLerp(t,e){return(r,i,a)=>g.arcLerp(r,i,a,t,e)}static polarLerp(t,e,r,i=!1,a=g.zero){t=t.sub(a),e=e.sub(a);const h=t.degrees;let u=e.degrees;h>u!==i&&(u=u+(i?-360:360));const y=tt(h,u,r)*cn,C=tt(t.magnitude,e.magnitude,r);return new g(C*Math.cos(y)+a.x,C*Math.sin(y)+a.y)}static createPolarLerp(t=!1,e=g.zero){return(r,i,a)=>g.polarLerp(r,i,a,t,new g(e))}static fromOrigin(t){const e=new g;return t===ot.Middle||(t&St.Left?e.x=-1:t&St.Right&&(e.x=1),t&St.Top?e.y=-1:t&St.Bottom&&(e.y=1)),e}static fromScalar(t){return new g(t,t)}static fromRadians(t){return new g(Math.cos(t),Math.sin(t))}static fromDegrees(t){return g.fromRadians(t*cn)}static radians(t,e){return Math.atan2(e,t)}static degrees(t,e){return g.radians(t,e)*Pc}static magnitude(t,e){return Math.sqrt(t*t+e*e)}static squaredMagnitude(t,e){return t*t+e*e}static angleBetween(t,e){return Math.acos(xt(-1,1,t.dot(e)/(t.magnitude*e.magnitude)))*(t.cross(e)>=0?1:-1)}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}get magnitude(){return g.magnitude(this.x,this.y)}get squaredMagnitude(){return g.squaredMagnitude(this.x,this.y)}get normalized(){return this.scale(1/g.magnitude(this.x,this.y))}get safe(){return new g(isNaN(this.x)?0:this.x,isNaN(this.y)?0:this.y)}get flipped(){return new g(-this.x,-this.y)}get floored(){return new g(Math.floor(this.x),Math.floor(this.y))}get rounded(){return new g(Math.round(this.x),Math.round(this.y))}get ceiled(){return new g(Math.ceil(this.x),Math.ceil(this.y))}get perpendicular(){return new g(this.y,-this.x)}get radians(){return g.radians(this.x,this.y)}get degrees(){return g.degrees(this.x,this.y)}get ctg(){return this.x/this.y}constructor(t,e){if(this.x=0,this.y=0,t!=null){if(typeof t!="object"){this.x=t,this.y=e??t;return}if(Array.isArray(t)){this.x=t[0],this.y=t[1];return}if("width"in t){this.x=t.width,this.y=t.height;return}this.x=t.x,this.y=t.y}}lerp(t,e){return g.lerp(this,t,e)}getOriginOffset(t){const e=g.fromOrigin(t);return e.x*=this.x/2,e.y*=this.y/2,e}scale(t){return new g(this.x*t,this.y*t)}transformAsPoint(t){const e=new at(t);return new g(this.x*e.scaleX+this.y*e.skewY+e.translateX,this.x*e.skewX+this.y*e.scaleY+e.translateY)}transform(t){const e=new at(t);return new g(this.x*e.scaleX+this.y*e.skewY,this.x*e.skewX+this.y*e.scaleY)}mul(t){const e=new g(t);return new g(this.x*e.x,this.y*e.y)}div(t){const e=new g(t);return new g(this.x/e.x,this.y/e.y)}add(t){const e=new g(t);return new g(this.x+e.x,this.y+e.y)}sub(t){const e=new g(t);return new g(this.x-e.x,this.y-e.y)}dot(t){const e=new g(t);return this.x*e.x+this.y*e.y}cross(t){const e=new g(t);return this.x*e.y-this.y*e.x}mod(t){const e=new g(t);return new g(this.x%e.x,this.y%e.y)}rotate(t,e=g.zero){const r=new g(e),i=at.fromTranslation(r).rotate(t).translate(r.flipped);return this.transformAsPoint(i)}addX(t){return new g(this.x+t,this.y)}addY(t){return new g(this.x,this.y+t)}map(t){return new g(t(this.x,0),t(this.y,1))}toSymbol(){return g.symbol}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}toUniform(t,e){t.uniform2f(e,this.x,this.y)}serialize(){return{x:this.x,y:this.y}}exactlyEquals(t){return this.x===t.x&&this.y===t.y}equals(t,e=Ze){return Math.abs(this.x-t.x)<=e+Number.EPSILON&&Math.abs(this.y-t.y)<=e+Number.EPSILON}*[Symbol.iterator](){yield this.x,yield this.y}}g.symbol=Symbol.for("@motion-canvas/core/types/Vector2");g.zero=new g;g.one=new g(1,1);g.right=new g(1,0);g.left=new g(-1,0);g.up=new g(0,1);g.down=new g(0,-1);g.top=new g(0,-1);g.bottom=new g(0,1);g.topLeft=new g(-1,-1);g.topRight=new g(1,-1);g.bottomLeft=new g(-1,1);g.bottomRight=new g(1,1);class V{static createSignal(t,e=V.lerp){return new Pr(["x","y","width","height"],r=>new V(r),t,e).toSignal()}static lerp(t,e,r){let i,a,h,u;return typeof r=="number"?i=a=h=u=r:r instanceof g?(i=h=r.x,a=u=r.y):(i=r.x,a=r.y,h=r.width,u=r.height),new V(tt(t.x,e.x,i),tt(t.y,e.y,a),tt(t.width,e.width,h),tt(t.height,e.height,u))}static arcLerp(t,e,r,i=!1,a){return a??(a=(t.position.sub(e.position).ctg+t.size.sub(e.size).ctg)/2),V.lerp(t,e,$i(r,i,a))}static fromSizeCentered(t){return new V(-t.width/2,-t.height/2,t.width,t.height)}static fromPoints(...t){let e=1/0,r=1/0,i=-1/0,a=-1/0;for(const h of t)h.x>i&&(i=h.x),h.x<e&&(e=h.x),h.y>a&&(a=h.y),h.y<r&&(r=h.y);return new V(e,r,i-e,a-r)}static fromBBoxes(...t){let e=1/0,r=1/0,i=-1/0,a=-1/0;for(const h of t){const u=h.x+h.width;u>i&&(i=u),h.x<e&&(e=h.x);const v=h.y+h.height;v>a&&(a=v),h.y<r&&(r=h.y)}return new V(e,r,i-e,a-r)}lerp(t,e){return V.lerp(this,t,e)}get position(){return new g(this.x,this.y)}set position(t){this.x=t.x,this.y=t.y}get size(){return new g(this.width,this.height)}get center(){return new g(this.x+this.width/2,this.y+this.height/2)}get left(){return this.x}set left(t){this.width+=this.x-t,this.x=t}get right(){return this.x+this.width}set right(t){this.width=t-this.x}get top(){return this.y}set top(t){this.height+=this.y-t,this.y=t}get bottom(){return this.y+this.height}set bottom(t){this.height=t-this.y}get topLeft(){return this.position}get topRight(){return new g(this.x+this.width,this.y)}get bottomLeft(){return new g(this.x,this.y+this.height)}get bottomRight(){return new g(this.x+this.width,this.y+this.height)}get corners(){return[this.topLeft,this.topRight,this.bottomRight,this.bottomLeft]}get pixelPerfect(){return new V(Math.floor(this.x),Math.floor(this.y),Math.ceil(this.width+1),Math.ceil(this.height+1))}constructor(t,e=0,r=0,i=0){if(this.x=0,this.y=0,this.width=0,this.height=0,t!=null){if(typeof t=="number"){this.x=t,this.y=e,this.width=r,this.height=i;return}if(t instanceof g){this.x=t.x,this.y=t.y,e instanceof g&&(this.width=e.x,this.height=e.y);return}if(Array.isArray(t)){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3];return}this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}}transform(t){return new V(this.position.transformAsPoint(t),this.size.transform(t))}transformCorners(t){return this.corners.map(e=>e.transformAsPoint(t))}expand(t){const e=new At(t),r=new V(this);return r.left-=e.left,r.top-=e.top,r.right+=e.right,r.bottom+=e.bottom,r}addSpacing(t){return this.expand(t)}includes(t){return t.x>=this.x&&t.x<=this.x+this.width&&t.y>=this.y&&t.y<=this.y+this.height}intersects(t){return this.left<t.right&&this.right>t.left&&this.top<t.bottom&&this.bottom>t.top}intersection(t){const e=new V;return this.intersects(t)&&(e.left=Math.max(this.left,t.left),e.top=Math.max(this.top,t.top),e.right=Math.min(this.right,t.right),e.bottom=Math.min(this.bottom,t.bottom)),e}union(t){const e=new V;return e.left=Math.min(this.left,t.left),e.top=Math.min(this.top,t.top),e.right=Math.max(this.right,t.right),e.bottom=Math.max(this.bottom,t.bottom),e}toSymbol(){return V.symbol}toString(){return`BBox(${this.x}, ${this.y}, ${this.width}, ${this.height})`}toUniform(t,e){t.uniform4f(e,this.x,this.y,this.width,this.height)}serialize(){return{x:this.x,y:this.y,width:this.width,height:this.height}}}V.symbol=Symbol.for("@motion-canvas/core/types/Rect");var iu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Oi={exports:{}};/**
 * chroma.js - JavaScript library for color conversions
 *
 * Copyright (c) 2011-2019, Gregor Aisch
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * 3. The name Gregor Aisch may not be used to endorse or promote products
 * derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * -------------------------------------------------------
 *
 * chroma.js includes colors from colorbrewer2.org, which are released under
 * the following license:
 *
 * Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
 * and The Pennsylvania State University.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * ------------------------------------------------------
 *
 * Named colors are taken from X11 Color Names.
 * http://www.w3.org/TR/css3-color/#svg-color
 *
 * @preserve
 */(function(n,t){(function(e,r){n.exports=r()})(iu,function(){for(var e=function(s,o,l){return o===void 0&&(o=0),l===void 0&&(l=1),s<o?o:s>l?l:s},r=e,i=function(s){s._clipped=!1,s._unclipped=s.slice(0);for(var o=0;o<=3;o++)o<3?((s[o]<0||s[o]>255)&&(s._clipped=!0),s[o]=r(s[o],0,255)):o===3&&(s[o]=r(s[o],0,1));return s},a={},h=0,u=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];h<u.length;h+=1){var v=u[h];a["[object "+v+"]"]=v.toLowerCase()}var y=function(s){return a[Object.prototype.toString.call(s)]||"object"},C=y,F=function(s,o){return o===void 0&&(o=null),s.length>=3?Array.prototype.slice.call(s):C(s[0])=="object"&&o?o.split("").filter(function(l){return s[0][l]!==void 0}).map(function(l){return s[0][l]}):s[0]},H=y,J=function(s){if(s.length<2)return null;var o=s.length-1;return H(s[o])=="string"?s[o].toLowerCase():null},et=Math.PI,T={clip_rgb:i,limit:e,type:y,unpack:F,last:J,PI:et,TWOPI:et*2,PITHIRD:et/3,DEG2RAD:et/180,RAD2DEG:180/et},rt={format:{},autodetect:[]},ht=T.last,K=T.clip_rgb,ce=T.type,Ft=rt,$n=function(){for(var o=[],l=arguments.length;l--;)o[l]=arguments[l];var c=this;if(ce(o[0])==="object"&&o[0].constructor&&o[0].constructor===this.constructor)return o[0];var d=ht(o),p=!1;if(!d){p=!0,Ft.sorted||(Ft.autodetect=Ft.autodetect.sort(function(x,P){return P.p-x.p}),Ft.sorted=!0);for(var f=0,m=Ft.autodetect;f<m.length;f+=1){var b=m[f];if(d=b.test.apply(b,o),d)break}}if(Ft.format[d]){var w=Ft.format[d].apply(null,p?o:o.slice(0,-1));c._rgb=K(w)}else throw new Error("unknown format: "+o);c._rgb.length===3&&c._rgb.push(1)};$n.prototype.toString=function(){return ce(this.hex)=="function"?this.hex():"["+this._rgb.join(",")+"]"};var D=$n,or=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(or.Color,[null].concat(s)))};or.Color=D,or.version="2.4.2";var ct=or,Ui=T.unpack,In=Math.max,Wi=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Ui(s,"rgb"),c=l[0],d=l[1],p=l[2];c=c/255,d=d/255,p=p/255;var f=1-In(c,In(d,p)),m=f<1?1/(1-f):0,b=(1-c-f)*m,w=(1-d-f)*m,x=(1-p-f)*m;return[b,w,x,f]},Gi=Wi,qi=T.unpack,Xi=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=qi(s,"cmyk");var l=s[0],c=s[1],d=s[2],p=s[3],f=s.length>4?s[4]:1;return p===1?[0,0,0,f]:[l>=1?0:255*(1-l)*(1-p),c>=1?0:255*(1-c)*(1-p),d>=1?0:255*(1-d)*(1-p),f]},Hi=Xi,Yi=ct,An=D,On=rt,Zi=T.unpack,Vi=T.type,Ji=Gi;An.prototype.cmyk=function(){return Ji(this._rgb)},Yi.cmyk=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(An,[null].concat(s,["cmyk"])))},On.format.cmyk=Hi,On.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Zi(s,"cmyk"),Vi(s)==="array"&&s.length===4)return"cmyk"}});var Qi=T.unpack,Ki=T.last,Ir=function(s){return Math.round(s*100)/100},ta=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Qi(s,"hsla"),c=Ki(s)||"lsa";return l[0]=Ir(l[0]||0),l[1]=Ir(l[1]*100)+"%",l[2]=Ir(l[2]*100)+"%",c==="hsla"||l.length>3&&l[3]<1?(l[3]=l.length>3?l[3]:1,c="hsla"):l.length=3,c+"("+l.join(",")+")"},ea=ta,ra=T.unpack,na=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=ra(s,"rgba");var l=s[0],c=s[1],d=s[2];l/=255,c/=255,d/=255;var p=Math.min(l,c,d),f=Math.max(l,c,d),m=(f+p)/2,b,w;return f===p?(b=0,w=Number.NaN):b=m<.5?(f-p)/(f+p):(f-p)/(2-f-p),l==f?w=(c-d)/(f-p):c==f?w=2+(d-l)/(f-p):d==f&&(w=4+(l-c)/(f-p)),w*=60,w<0&&(w+=360),s.length>3&&s[3]!==void 0?[w,b,m,s[3]]:[w,b,m]},zn=na,sa=T.unpack,ia=T.last,aa=ea,oa=zn,Ar=Math.round,la=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=sa(s,"rgba"),c=ia(s)||"rgb";return c.substr(0,3)=="hsl"?aa(oa(l),c):(l[0]=Ar(l[0]),l[1]=Ar(l[1]),l[2]=Ar(l[2]),(c==="rgba"||l.length>3&&l[3]<1)&&(l[3]=l.length>3?l[3]:1,c="rgba"),c+"("+l.slice(0,c==="rgb"?3:4).join(",")+")")},ha=la,ca=T.unpack,Or=Math.round,ua=function(){for(var s,o=[],l=arguments.length;l--;)o[l]=arguments[l];o=ca(o,"hsl");var c=o[0],d=o[1],p=o[2],f,m,b;if(d===0)f=m=b=p*255;else{var w=[0,0,0],x=[0,0,0],P=p<.5?p*(1+d):p+d-p*d,S=2*p-P,L=c/360;w[0]=L+1/3,w[1]=L,w[2]=L-1/3;for(var M=0;M<3;M++)w[M]<0&&(w[M]+=1),w[M]>1&&(w[M]-=1),6*w[M]<1?x[M]=S+(P-S)*6*w[M]:2*w[M]<1?x[M]=P:3*w[M]<2?x[M]=S+(P-S)*(2/3-w[M])*6:x[M]=S;s=[Or(x[0]*255),Or(x[1]*255),Or(x[2]*255)],f=s[0],m=s[1],b=s[2]}return o.length>3?[f,m,b,o[3]]:[f,m,b,1]},En=ua,Fn=En,_n=rt,Dn=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,jn=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Nn=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Bn=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Un=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Wn=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Gn=Math.round,qn=function(s){s=s.toLowerCase().trim();var o;if(_n.format.named)try{return _n.format.named(s)}catch{}if(o=s.match(Dn)){for(var l=o.slice(1,4),c=0;c<3;c++)l[c]=+l[c];return l[3]=1,l}if(o=s.match(jn)){for(var d=o.slice(1,5),p=0;p<4;p++)d[p]=+d[p];return d}if(o=s.match(Nn)){for(var f=o.slice(1,4),m=0;m<3;m++)f[m]=Gn(f[m]*2.55);return f[3]=1,f}if(o=s.match(Bn)){for(var b=o.slice(1,5),w=0;w<3;w++)b[w]=Gn(b[w]*2.55);return b[3]=+b[3],b}if(o=s.match(Un)){var x=o.slice(1,4);x[1]*=.01,x[2]*=.01;var P=Fn(x);return P[3]=1,P}if(o=s.match(Wn)){var S=o.slice(1,4);S[1]*=.01,S[2]*=.01;var L=Fn(S);return L[3]=+o[4],L}};qn.test=function(s){return Dn.test(s)||jn.test(s)||Nn.test(s)||Bn.test(s)||Un.test(s)||Wn.test(s)};var fa=qn,da=ct,Xn=D,Hn=rt,pa=T.type,ga=ha,Yn=fa;Xn.prototype.css=function(s){return ga(this._rgb,s)},da.css=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Xn,[null].concat(s,["css"])))},Hn.format.css=Yn,Hn.autodetect.push({p:5,test:function(s){for(var o=[],l=arguments.length-1;l-- >0;)o[l]=arguments[l+1];if(!o.length&&pa(s)==="string"&&Yn.test(s))return"css"}});var Zn=D,va=ct,ma=rt,ba=T.unpack;ma.format.gl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=ba(s,"rgba");return l[0]*=255,l[1]*=255,l[2]*=255,l},va.gl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Zn,[null].concat(s,["gl"])))},Zn.prototype.gl=function(){var s=this._rgb;return[s[0]/255,s[1]/255,s[2]/255,s[3]]};var ya=T.unpack,wa=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=ya(s,"rgb"),c=l[0],d=l[1],p=l[2],f=Math.min(c,d,p),m=Math.max(c,d,p),b=m-f,w=b*100/255,x=f/(255-b)*100,P;return b===0?P=Number.NaN:(c===m&&(P=(d-p)/b),d===m&&(P=2+(p-c)/b),p===m&&(P=4+(c-d)/b),P*=60,P<0&&(P+=360)),[P,w,x]},xa=wa,Sa=T.unpack,ka=Math.floor,Ca=function(){for(var s,o,l,c,d,p,f=[],m=arguments.length;m--;)f[m]=arguments[m];f=Sa(f,"hcg");var b=f[0],w=f[1],x=f[2],P,S,L;x=x*255;var M=w*255;if(w===0)P=S=L=x;else{b===360&&(b=0),b>360&&(b-=360),b<0&&(b+=360),b/=60;var j=ka(b),U=b-j,G=x*(1-w),X=G+M*(1-U),gt=G+M*U,pt=G+M;switch(j){case 0:s=[pt,gt,G],P=s[0],S=s[1],L=s[2];break;case 1:o=[X,pt,G],P=o[0],S=o[1],L=o[2];break;case 2:l=[G,pt,gt],P=l[0],S=l[1],L=l[2];break;case 3:c=[G,X,pt],P=c[0],S=c[1],L=c[2];break;case 4:d=[gt,G,pt],P=d[0],S=d[1],L=d[2];break;case 5:p=[pt,G,X],P=p[0],S=p[1],L=p[2];break}}return[P,S,L,f.length>3?f[3]:1]},Ta=Ca,Ra=T.unpack,Pa=T.type,Ma=ct,Vn=D,Jn=rt,La=xa;Vn.prototype.hcg=function(){return La(this._rgb)},Ma.hcg=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Vn,[null].concat(s,["hcg"])))},Jn.format.hcg=Ta,Jn.autodetect.push({p:1,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Ra(s,"hcg"),Pa(s)==="array"&&s.length===3)return"hcg"}});var $a=T.unpack,Ia=T.last,lr=Math.round,Aa=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=$a(s,"rgba"),c=l[0],d=l[1],p=l[2],f=l[3],m=Ia(s)||"auto";f===void 0&&(f=1),m==="auto"&&(m=f<1?"rgba":"rgb"),c=lr(c),d=lr(d),p=lr(p);var b=c<<16|d<<8|p,w="000000"+b.toString(16);w=w.substr(w.length-6);var x="0"+lr(f*255).toString(16);switch(x=x.substr(x.length-2),m.toLowerCase()){case"rgba":return"#"+w+x;case"argb":return"#"+x+w;default:return"#"+w}},Qn=Aa,Oa=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,za=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Ea=function(s){if(s.match(Oa)){(s.length===4||s.length===7)&&(s=s.substr(1)),s.length===3&&(s=s.split(""),s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]);var o=parseInt(s,16),l=o>>16,c=o>>8&255,d=o&255;return[l,c,d,1]}if(s.match(za)){(s.length===5||s.length===9)&&(s=s.substr(1)),s.length===4&&(s=s.split(""),s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]+s[3]+s[3]);var p=parseInt(s,16),f=p>>24&255,m=p>>16&255,b=p>>8&255,w=Math.round((p&255)/255*100)/100;return[f,m,b,w]}throw new Error("unknown hex color: "+s)},Kn=Ea,Fa=ct,ts=D,_a=T.type,es=rt,Da=Qn;ts.prototype.hex=function(s){return Da(this._rgb,s)},Fa.hex=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(ts,[null].concat(s,["hex"])))},es.format.hex=Kn,es.autodetect.push({p:4,test:function(s){for(var o=[],l=arguments.length-1;l-- >0;)o[l]=arguments[l+1];if(!o.length&&_a(s)==="string"&&[3,4,5,6,7,8,9].indexOf(s.length)>=0)return"hex"}});var ja=T.unpack,rs=T.TWOPI,Na=Math.min,Ba=Math.sqrt,Ua=Math.acos,Wa=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=ja(s,"rgb"),c=l[0],d=l[1],p=l[2];c/=255,d/=255,p/=255;var f,m=Na(c,d,p),b=(c+d+p)/3,w=b>0?1-m/b:0;return w===0?f=NaN:(f=(c-d+(c-p))/2,f/=Ba((c-d)*(c-d)+(c-p)*(d-p)),f=Ua(f),p>d&&(f=rs-f),f/=rs),[f*360,w,b]},Ga=Wa,qa=T.unpack,zr=T.limit,Te=T.TWOPI,Er=T.PITHIRD,Re=Math.cos,Xa=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=qa(s,"hsi");var l=s[0],c=s[1],d=s[2],p,f,m;return isNaN(l)&&(l=0),isNaN(c)&&(c=0),l>360&&(l-=360),l<0&&(l+=360),l/=360,l<1/3?(m=(1-c)/3,p=(1+c*Re(Te*l)/Re(Er-Te*l))/3,f=1-(m+p)):l<2/3?(l-=1/3,p=(1-c)/3,f=(1+c*Re(Te*l)/Re(Er-Te*l))/3,m=1-(p+f)):(l-=2/3,f=(1-c)/3,m=(1+c*Re(Te*l)/Re(Er-Te*l))/3,p=1-(f+m)),p=zr(d*p*3),f=zr(d*f*3),m=zr(d*m*3),[p*255,f*255,m*255,s.length>3?s[3]:1]},Ha=Xa,Ya=T.unpack,Za=T.type,Va=ct,ns=D,ss=rt,Ja=Ga;ns.prototype.hsi=function(){return Ja(this._rgb)},Va.hsi=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(ns,[null].concat(s,["hsi"])))},ss.format.hsi=Ha,ss.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Ya(s,"hsi"),Za(s)==="array"&&s.length===3)return"hsi"}});var Qa=T.unpack,Ka=T.type,to=ct,is=D,as=rt,eo=zn;is.prototype.hsl=function(){return eo(this._rgb)},to.hsl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(is,[null].concat(s,["hsl"])))},as.format.hsl=En,as.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Qa(s,"hsl"),Ka(s)==="array"&&s.length===3)return"hsl"}});var ro=T.unpack,no=Math.min,so=Math.max,io=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=ro(s,"rgb");var l=s[0],c=s[1],d=s[2],p=no(l,c,d),f=so(l,c,d),m=f-p,b,w,x;return x=f/255,f===0?(b=Number.NaN,w=0):(w=m/f,l===f&&(b=(c-d)/m),c===f&&(b=2+(d-l)/m),d===f&&(b=4+(l-c)/m),b*=60,b<0&&(b+=360)),[b,w,x]},ao=io,oo=T.unpack,lo=Math.floor,ho=function(){for(var s,o,l,c,d,p,f=[],m=arguments.length;m--;)f[m]=arguments[m];f=oo(f,"hsv");var b=f[0],w=f[1],x=f[2],P,S,L;if(x*=255,w===0)P=S=L=x;else{b===360&&(b=0),b>360&&(b-=360),b<0&&(b+=360),b/=60;var M=lo(b),j=b-M,U=x*(1-w),G=x*(1-w*j),X=x*(1-w*(1-j));switch(M){case 0:s=[x,X,U],P=s[0],S=s[1],L=s[2];break;case 1:o=[G,x,U],P=o[0],S=o[1],L=o[2];break;case 2:l=[U,x,X],P=l[0],S=l[1],L=l[2];break;case 3:c=[U,G,x],P=c[0],S=c[1],L=c[2];break;case 4:d=[X,U,x],P=d[0],S=d[1],L=d[2];break;case 5:p=[x,U,G],P=p[0],S=p[1],L=p[2];break}}return[P,S,L,f.length>3?f[3]:1]},co=ho,uo=T.unpack,fo=T.type,po=ct,os=D,ls=rt,go=ao;os.prototype.hsv=function(){return go(this._rgb)},po.hsv=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(os,[null].concat(s,["hsv"])))},ls.format.hsv=co,ls.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=uo(s,"hsv"),fo(s)==="array"&&s.length===3)return"hsv"}});var hr={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Pe=hr,vo=T.unpack,hs=Math.pow,mo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=vo(s,"rgb"),c=l[0],d=l[1],p=l[2],f=bo(c,d,p),m=f[0],b=f[1],w=f[2],x=116*b-16;return[x<0?0:x,500*(m-b),200*(b-w)]},Fr=function(s){return(s/=255)<=.04045?s/12.92:hs((s+.055)/1.055,2.4)},_r=function(s){return s>Pe.t3?hs(s,1/3):s/Pe.t2+Pe.t0},bo=function(s,o,l){s=Fr(s),o=Fr(o),l=Fr(l);var c=_r((.4124564*s+.3575761*o+.1804375*l)/Pe.Xn),d=_r((.2126729*s+.7151522*o+.072175*l)/Pe.Yn),p=_r((.0193339*s+.119192*o+.9503041*l)/Pe.Zn);return[c,d,p]},cs=mo,Me=hr,yo=T.unpack,wo=Math.pow,xo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=yo(s,"lab");var l=s[0],c=s[1],d=s[2],p,f,m,b,w,x;return f=(l+16)/116,p=isNaN(c)?f:f+c/500,m=isNaN(d)?f:f-d/200,f=Me.Yn*jr(f),p=Me.Xn*jr(p),m=Me.Zn*jr(m),b=Dr(3.2404542*p-1.5371385*f-.4985314*m),w=Dr(-.969266*p+1.8760108*f+.041556*m),x=Dr(.0556434*p-.2040259*f+1.0572252*m),[b,w,x,s.length>3?s[3]:1]},Dr=function(s){return 255*(s<=.00304?12.92*s:1.055*wo(s,1/2.4)-.055)},jr=function(s){return s>Me.t1?s*s*s:Me.t2*(s-Me.t0)},us=xo,So=T.unpack,ko=T.type,Co=ct,fs=D,ds=rt,To=cs;fs.prototype.lab=function(){return To(this._rgb)},Co.lab=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(fs,[null].concat(s,["lab"])))},ds.format.lab=us,ds.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=So(s,"lab"),ko(s)==="array"&&s.length===3)return"lab"}});var Ro=T.unpack,Po=T.RAD2DEG,Mo=Math.sqrt,Lo=Math.atan2,$o=Math.round,Io=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Ro(s,"lab"),c=l[0],d=l[1],p=l[2],f=Mo(d*d+p*p),m=(Lo(p,d)*Po+360)%360;return $o(f*1e4)===0&&(m=Number.NaN),[c,f,m]},ps=Io,Ao=T.unpack,Oo=cs,zo=ps,Eo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Ao(s,"rgb"),c=l[0],d=l[1],p=l[2],f=Oo(c,d,p),m=f[0],b=f[1],w=f[2];return zo(m,b,w)},Fo=Eo,_o=T.unpack,Do=T.DEG2RAD,jo=Math.sin,No=Math.cos,Bo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=_o(s,"lch"),c=l[0],d=l[1],p=l[2];return isNaN(p)&&(p=0),p=p*Do,[c,No(p)*d,jo(p)*d]},gs=Bo,Uo=T.unpack,Wo=gs,Go=us,qo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Uo(s,"lch");var l=s[0],c=s[1],d=s[2],p=Wo(l,c,d),f=p[0],m=p[1],b=p[2],w=Go(f,m,b),x=w[0],P=w[1],S=w[2];return[x,P,S,s.length>3?s[3]:1]},vs=qo,Xo=T.unpack,Ho=vs,Yo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Xo(s,"hcl").reverse();return Ho.apply(void 0,l)},Zo=Yo,Vo=T.unpack,Jo=T.type,ms=ct,cr=D,Nr=rt,bs=Fo;cr.prototype.lch=function(){return bs(this._rgb)},cr.prototype.hcl=function(){return bs(this._rgb).reverse()},ms.lch=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(cr,[null].concat(s,["lch"])))},ms.hcl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(cr,[null].concat(s,["hcl"])))},Nr.format.lch=vs,Nr.format.hcl=Zo,["lch","hcl"].forEach(function(s){return Nr.autodetect.push({p:2,test:function(){for(var o=[],l=arguments.length;l--;)o[l]=arguments[l];if(o=Vo(o,s),Jo(o)==="array"&&o.length===3)return s}})});var Qo={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},ys=Qo,Ko=D,ws=rt,tl=T.type,Be=ys,el=Kn,rl=Qn;Ko.prototype.name=function(){for(var s=rl(this._rgb,"rgb"),o=0,l=Object.keys(Be);o<l.length;o+=1){var c=l[o];if(Be[c]===s)return c.toLowerCase()}return s},ws.format.named=function(s){if(s=s.toLowerCase(),Be[s])return el(Be[s]);throw new Error("unknown color name: "+s)},ws.autodetect.push({p:5,test:function(s){for(var o=[],l=arguments.length-1;l-- >0;)o[l]=arguments[l+1];if(!o.length&&tl(s)==="string"&&Be[s.toLowerCase()])return"named"}});var nl=T.unpack,sl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=nl(s,"rgb"),c=l[0],d=l[1],p=l[2];return(c<<16)+(d<<8)+p},il=sl,al=T.type,ol=function(s){if(al(s)=="number"&&s>=0&&s<=16777215){var o=s>>16,l=s>>8&255,c=s&255;return[o,l,c,1]}throw new Error("unknown num color: "+s)},ll=ol,hl=ct,xs=D,Ss=rt,cl=T.type,ul=il;xs.prototype.num=function(){return ul(this._rgb)},hl.num=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(xs,[null].concat(s,["num"])))},Ss.format.num=ll,Ss.autodetect.push({p:5,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s.length===1&&cl(s[0])==="number"&&s[0]>=0&&s[0]<=16777215)return"num"}});var fl=ct,Br=D,ks=rt,Cs=T.unpack,Ts=T.type,Rs=Math.round;Br.prototype.rgb=function(s){return s===void 0&&(s=!0),s===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Rs)},Br.prototype.rgba=function(s){return s===void 0&&(s=!0),this._rgb.slice(0,4).map(function(o,l){return l<3?s===!1?o:Rs(o):o})},fl.rgb=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Br,[null].concat(s,["rgb"])))},ks.format.rgb=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Cs(s,"rgba");return l[3]===void 0&&(l[3]=1),l},ks.autodetect.push({p:3,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Cs(s,"rgba"),Ts(s)==="array"&&(s.length===3||s.length===4&&Ts(s[3])=="number"&&s[3]>=0&&s[3]<=1))return"rgb"}});var ur=Math.log,dl=function(s){var o=s/100,l,c,d;return o<66?(l=255,c=o<6?0:-155.25485562709179-.44596950469579133*(c=o-2)+104.49216199393888*ur(c),d=o<20?0:-254.76935184120902+.8274096064007395*(d=o-10)+115.67994401066147*ur(d)):(l=351.97690566805693+.114206453784165*(l=o-55)-40.25366309332127*ur(l),c=325.4494125711974+.07943456536662342*(c=o-50)-28.0852963507957*ur(c),d=255),[l,c,d,1]},Ps=dl,pl=Ps,gl=T.unpack,vl=Math.round,ml=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];for(var l=gl(s,"rgb"),c=l[0],d=l[2],p=1e3,f=4e4,m=.4,b;f-p>m;){b=(f+p)*.5;var w=pl(b);w[2]/w[0]>=d/c?f=b:p=b}return vl(b)},bl=ml,Ur=ct,fr=D,Wr=rt,yl=bl;fr.prototype.temp=fr.prototype.kelvin=fr.prototype.temperature=function(){return yl(this._rgb)},Ur.temp=Ur.kelvin=Ur.temperature=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(fr,[null].concat(s,["temp"])))},Wr.format.temp=Wr.format.kelvin=Wr.format.temperature=Ps;var wl=T.unpack,Gr=Math.cbrt,xl=Math.pow,Sl=Math.sign,kl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=wl(s,"rgb"),c=l[0],d=l[1],p=l[2],f=[qr(c/255),qr(d/255),qr(p/255)],m=f[0],b=f[1],w=f[2],x=Gr(.4122214708*m+.5363325363*b+.0514459929*w),P=Gr(.2119034982*m+.6806995451*b+.1073969566*w),S=Gr(.0883024619*m+.2817188376*b+.6299787005*w);return[.2104542553*x+.793617785*P-.0040720468*S,1.9779984951*x-2.428592205*P+.4505937099*S,.0259040371*x+.7827717662*P-.808675766*S]},Ms=kl;function qr(s){var o=Math.abs(s);return o<.04045?s/12.92:(Sl(s)||1)*xl((o+.055)/1.055,2.4)}var Cl=T.unpack,dr=Math.pow,Tl=Math.sign,Rl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Cl(s,"lab");var l=s[0],c=s[1],d=s[2],p=dr(l+.3963377774*c+.2158037573*d,3),f=dr(l-.1055613458*c-.0638541728*d,3),m=dr(l-.0894841775*c-1.291485548*d,3);return[255*Xr(4.0767416621*p-3.3077115913*f+.2309699292*m),255*Xr(-1.2684380046*p+2.6097574011*f-.3413193965*m),255*Xr(-.0041960863*p-.7034186147*f+1.707614701*m),s.length>3?s[3]:1]},Ls=Rl;function Xr(s){var o=Math.abs(s);return o>.0031308?(Tl(s)||1)*(1.055*dr(o,1/2.4)-.055):s*12.92}var Pl=T.unpack,Ml=T.type,Ll=ct,$s=D,Is=rt,$l=Ms;$s.prototype.oklab=function(){return $l(this._rgb)},Ll.oklab=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply($s,[null].concat(s,["oklab"])))},Is.format.oklab=Ls,Is.autodetect.push({p:3,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Pl(s,"oklab"),Ml(s)==="array"&&s.length===3)return"oklab"}});var Il=T.unpack,Al=Ms,Ol=ps,zl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Il(s,"rgb"),c=l[0],d=l[1],p=l[2],f=Al(c,d,p),m=f[0],b=f[1],w=f[2];return Ol(m,b,w)},El=zl,Fl=T.unpack,_l=gs,Dl=Ls,jl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Fl(s,"lch");var l=s[0],c=s[1],d=s[2],p=_l(l,c,d),f=p[0],m=p[1],b=p[2],w=Dl(f,m,b),x=w[0],P=w[1],S=w[2];return[x,P,S,s.length>3?s[3]:1]},Nl=jl,Bl=T.unpack,Ul=T.type,Wl=ct,As=D,Os=rt,Gl=El;As.prototype.oklch=function(){return Gl(this._rgb)},Wl.oklch=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(As,[null].concat(s,["oklch"])))},Os.format.oklch=Nl,Os.autodetect.push({p:3,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Bl(s,"oklch"),Ul(s)==="array"&&s.length===3)return"oklch"}});var zs=D,ql=T.type;zs.prototype.alpha=function(s,o){return o===void 0&&(o=!1),s!==void 0&&ql(s)==="number"?o?(this._rgb[3]=s,this):new zs([this._rgb[0],this._rgb[1],this._rgb[2],s],"rgb"):this._rgb[3]};var Xl=D;Xl.prototype.clipped=function(){return this._rgb._clipped||!1};var ue=D,Hl=hr;ue.prototype.darken=function(s){s===void 0&&(s=1);var o=this,l=o.lab();return l[0]-=Hl.Kn*s,new ue(l,"lab").alpha(o.alpha(),!0)},ue.prototype.brighten=function(s){return s===void 0&&(s=1),this.darken(-s)},ue.prototype.darker=ue.prototype.darken,ue.prototype.brighter=ue.prototype.brighten;var Yl=D;Yl.prototype.get=function(s){var o=s.split("."),l=o[0],c=o[1],d=this[l]();if(c){var p=l.indexOf(c)-(l.substr(0,2)==="ok"?2:0);if(p>-1)return d[p];throw new Error("unknown channel "+c+" in mode "+l)}else return d};var Le=D,Zl=T.type,Vl=Math.pow,Jl=1e-7,Ql=20;Le.prototype.luminance=function(s){if(s!==void 0&&Zl(s)==="number"){if(s===0)return new Le([0,0,0,this._rgb[3]],"rgb");if(s===1)return new Le([255,255,255,this._rgb[3]],"rgb");var o=this.luminance(),l="rgb",c=Ql,d=function(f,m){var b=f.interpolate(m,.5,l),w=b.luminance();return Math.abs(s-w)<Jl||!c--?b:w>s?d(f,b):d(b,m)},p=(o>s?d(new Le([0,0,0]),this):d(this,new Le([255,255,255]))).rgb();return new Le(p.concat([this._rgb[3]]))}return Kl.apply(void 0,this._rgb.slice(0,3))};var Kl=function(s,o,l){return s=Hr(s),o=Hr(o),l=Hr(l),.2126*s+.7152*o+.0722*l},Hr=function(s){return s/=255,s<=.03928?s/12.92:Vl((s+.055)/1.055,2.4)},kt={},Es=D,Fs=T.type,pr=kt,_s=function(s,o,l){l===void 0&&(l=.5);for(var c=[],d=arguments.length-3;d-- >0;)c[d]=arguments[d+3];var p=c[0]||"lrgb";if(!pr[p]&&!c.length&&(p=Object.keys(pr)[0]),!pr[p])throw new Error("interpolation mode "+p+" is not defined");return Fs(s)!=="object"&&(s=new Es(s)),Fs(o)!=="object"&&(o=new Es(o)),pr[p](s,o,l).alpha(s.alpha()+l*(o.alpha()-s.alpha()))},Ds=D,th=_s;Ds.prototype.mix=Ds.prototype.interpolate=function(s,o){o===void 0&&(o=.5);for(var l=[],c=arguments.length-2;c-- >0;)l[c]=arguments[c+2];return th.apply(void 0,[this,s,o].concat(l))};var js=D;js.prototype.premultiply=function(s){s===void 0&&(s=!1);var o=this._rgb,l=o[3];return s?(this._rgb=[o[0]*l,o[1]*l,o[2]*l,l],this):new js([o[0]*l,o[1]*l,o[2]*l,l],"rgb")};var Yr=D,eh=hr;Yr.prototype.saturate=function(s){s===void 0&&(s=1);var o=this,l=o.lch();return l[1]+=eh.Kn*s,l[1]<0&&(l[1]=0),new Yr(l,"lch").alpha(o.alpha(),!0)},Yr.prototype.desaturate=function(s){return s===void 0&&(s=1),this.saturate(-s)};var Ns=D,Bs=T.type;Ns.prototype.set=function(s,o,l){l===void 0&&(l=!1);var c=s.split("."),d=c[0],p=c[1],f=this[d]();if(p){var m=d.indexOf(p)-(d.substr(0,2)==="ok"?2:0);if(m>-1){if(Bs(o)=="string")switch(o.charAt(0)){case"+":f[m]+=+o;break;case"-":f[m]+=+o;break;case"*":f[m]*=+o.substr(1);break;case"/":f[m]/=+o.substr(1);break;default:f[m]=+o}else if(Bs(o)==="number")f[m]=o;else throw new Error("unsupported value for Color.set");var b=new Ns(f,d);return l?(this._rgb=b._rgb,this):b}throw new Error("unknown channel "+p+" in mode "+d)}else return f};var rh=D,nh=function(s,o,l){var c=s._rgb,d=o._rgb;return new rh(c[0]+l*(d[0]-c[0]),c[1]+l*(d[1]-c[1]),c[2]+l*(d[2]-c[2]),"rgb")};kt.rgb=nh;var sh=D,Zr=Math.sqrt,$e=Math.pow,ih=function(s,o,l){var c=s._rgb,d=c[0],p=c[1],f=c[2],m=o._rgb,b=m[0],w=m[1],x=m[2];return new sh(Zr($e(d,2)*(1-l)+$e(b,2)*l),Zr($e(p,2)*(1-l)+$e(w,2)*l),Zr($e(f,2)*(1-l)+$e(x,2)*l),"rgb")};kt.lrgb=ih;var ah=D,oh=function(s,o,l){var c=s.lab(),d=o.lab();return new ah(c[0]+l*(d[0]-c[0]),c[1]+l*(d[1]-c[1]),c[2]+l*(d[2]-c[2]),"lab")};kt.lab=oh;var Us=D,Ie=function(s,o,l,c){var d,p,f,m;c==="hsl"?(f=s.hsl(),m=o.hsl()):c==="hsv"?(f=s.hsv(),m=o.hsv()):c==="hcg"?(f=s.hcg(),m=o.hcg()):c==="hsi"?(f=s.hsi(),m=o.hsi()):c==="lch"||c==="hcl"?(c="hcl",f=s.hcl(),m=o.hcl()):c==="oklch"&&(f=s.oklch().reverse(),m=o.oklch().reverse());var b,w,x,P,S,L;(c.substr(0,1)==="h"||c==="oklch")&&(d=f,b=d[0],x=d[1],S=d[2],p=m,w=p[0],P=p[1],L=p[2]);var M,j,U,G;return!isNaN(b)&&!isNaN(w)?(w>b&&w-b>180?G=w-(b+360):w<b&&b-w>180?G=w+360-b:G=w-b,j=b+l*G):isNaN(b)?isNaN(w)?j=Number.NaN:(j=w,(S==1||S==0)&&c!="hsv"&&(M=P)):(j=b,(L==1||L==0)&&c!="hsv"&&(M=x)),M===void 0&&(M=x+l*(P-x)),U=S+l*(L-S),c==="oklch"?new Us([U,M,j],c):new Us([j,M,U],c)},lh=Ie,Ws=function(s,o,l){return lh(s,o,l,"lch")};kt.lch=Ws,kt.hcl=Ws;var hh=D,ch=function(s,o,l){var c=s.num(),d=o.num();return new hh(c+l*(d-c),"num")};kt.num=ch;var uh=Ie,fh=function(s,o,l){return uh(s,o,l,"hcg")};kt.hcg=fh;var dh=Ie,ph=function(s,o,l){return dh(s,o,l,"hsi")};kt.hsi=ph;var gh=Ie,vh=function(s,o,l){return gh(s,o,l,"hsl")};kt.hsl=vh;var mh=Ie,bh=function(s,o,l){return mh(s,o,l,"hsv")};kt.hsv=bh;var yh=D,wh=function(s,o,l){var c=s.oklab(),d=o.oklab();return new yh(c[0]+l*(d[0]-c[0]),c[1]+l*(d[1]-c[1]),c[2]+l*(d[2]-c[2]),"oklab")};kt.oklab=wh;var xh=Ie,Sh=function(s,o,l){return xh(s,o,l,"oklch")};kt.oklch=Sh;var Vr=D,kh=T.clip_rgb,Jr=Math.pow,Qr=Math.sqrt,Kr=Math.PI,Gs=Math.cos,qs=Math.sin,Ch=Math.atan2,Th=function(s,o,l){o===void 0&&(o="lrgb"),l===void 0&&(l=null);var c=s.length;l||(l=Array.from(new Array(c)).map(function(){return 1}));var d=c/l.reduce(function(j,U){return j+U});if(l.forEach(function(j,U){l[U]*=d}),s=s.map(function(j){return new Vr(j)}),o==="lrgb")return Rh(s,l);for(var p=s.shift(),f=p.get(o),m=[],b=0,w=0,x=0;x<f.length;x++)if(f[x]=(f[x]||0)*l[0],m.push(isNaN(f[x])?0:l[0]),o.charAt(x)==="h"&&!isNaN(f[x])){var P=f[x]/180*Kr;b+=Gs(P)*l[0],w+=qs(P)*l[0]}var S=p.alpha()*l[0];s.forEach(function(j,U){var G=j.get(o);S+=j.alpha()*l[U+1];for(var X=0;X<f.length;X++)if(!isNaN(G[X]))if(m[X]+=l[U+1],o.charAt(X)==="h"){var gt=G[X]/180*Kr;b+=Gs(gt)*l[U+1],w+=qs(gt)*l[U+1]}else f[X]+=G[X]*l[U+1]});for(var L=0;L<f.length;L++)if(o.charAt(L)==="h"){for(var M=Ch(w/m[L],b/m[L])/Kr*180;M<0;)M+=360;for(;M>=360;)M-=360;f[L]=M}else f[L]=f[L]/m[L];return S/=c,new Vr(f,o).alpha(S>.99999?1:S,!0)},Rh=function(s,o){for(var l=s.length,c=[0,0,0,0],d=0;d<s.length;d++){var p=s[d],f=o[d]/l,m=p._rgb;c[0]+=Jr(m[0],2)*f,c[1]+=Jr(m[1],2)*f,c[2]+=Jr(m[2],2)*f,c[3]+=m[3]*f}return c[0]=Qr(c[0]),c[1]=Qr(c[1]),c[2]=Qr(c[2]),c[3]>.9999999&&(c[3]=1),new Vr(kh(c))},Mt=ct,Ae=T.type,Ph=Math.pow,tn=function(s){var o="rgb",l=Mt("#ccc"),c=0,d=[0,1],p=[],f=[0,0],m=!1,b=[],w=!1,x=0,P=1,S=!1,L={},M=!0,j=1,U=function(k){if(k=k||["#fff","#000"],k&&Ae(k)==="string"&&Mt.brewer&&Mt.brewer[k.toLowerCase()]&&(k=Mt.brewer[k.toLowerCase()]),Ae(k)==="array"){k.length===1&&(k=[k[0],k[0]]),k=k.slice(0);for(var O=0;O<k.length;O++)k[O]=Mt(k[O]);p.length=0;for(var B=0;B<k.length;B++)p.push(B/(k.length-1))}return wt(),b=k},G=function(k){if(m!=null){for(var O=m.length-1,B=0;B<O&&k>=m[B];)B++;return B-1}return 0},X=function(k){return k},gt=function(k){return k},pt=function(k,O){var B,N;if(O==null&&(O=!1),isNaN(k)||k===null)return l;if(O)N=k;else if(m&&m.length>2){var vt=G(k);N=vt/(m.length-2)}else P!==x?N=(k-x)/(P-x):N=1;N=gt(N),O||(N=X(N)),j!==1&&(N=Ph(N,j)),N=f[0]+N*(1-f[0]-f[1]),N=Math.min(1,Math.max(0,N));var nt=Math.floor(N*1e4);if(M&&L[nt])B=L[nt];else{if(Ae(b)==="array")for(var q=0;q<p.length;q++){var Y=p[q];if(N<=Y){B=b[q];break}if(N>=Y&&q===p.length-1){B=b[q];break}if(N>Y&&N<p[q+1]){N=(N-Y)/(p[q+1]-Y),B=Mt.interpolate(b[q],b[q+1],N,o);break}}else Ae(b)==="function"&&(B=b(N));M&&(L[nt]=B)}return B},wt=function(){return L={}};U(s);var W=function(k){var O=Mt(pt(k));return w&&O[w]?O[w]():O};return W.classes=function(k){if(k!=null){if(Ae(k)==="array")m=k,d=[k[0],k[k.length-1]];else{var O=Mt.analyze(d);k===0?m=[O.min,O.max]:m=Mt.limits(O,"e",k)}return W}return m},W.domain=function(k){if(!arguments.length)return d;x=k[0],P=k[k.length-1],p=[];var O=b.length;if(k.length===O&&x!==P)for(var B=0,N=Array.from(k);B<N.length;B+=1){var vt=N[B];p.push((vt-x)/(P-x))}else{for(var nt=0;nt<O;nt++)p.push(nt/(O-1));if(k.length>2){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?q<Y:q>Y;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=s<o,p=l?d?o+1:o-1:o,f=s;d?f<p:f>p;d?f++:f--)c.push(f);return c}var Ue=D,Lh=tn,$h=function(s){for(var o=[1,1],l=1;l<s;l++){for(var c=[1],d=1;d<=o.length;d++)c[d]=(o[d]||0)+o[d-1];o=c}return o},Ih=function(s){var o,l,c,d,p,f,m;if(s=s.map(function(S){return new Ue(S)}),s.length===2)o=s.map(function(S){return S.lab()}),p=o[0],f=o[1],d=function(S){var L=[0,1,2].map(function(M){return p[M]+S*(f[M]-p[M])});return new Ue(L,"lab")};else if(s.length===3)l=s.map(function(S){return S.lab()}),p=l[0],f=l[1],m=l[2],d=function(S){var L=[0,1,2].map(function(M){return(1-S)*(1-S)*p[M]+2*(1-S)*S*f[M]+S*S*m[M]});return new Ue(L,"lab")};else if(s.length===4){var b;c=s.map(function(S){return S.lab()}),p=c[0],f=c[1],m=c[2],b=c[3],d=function(S){var L=[0,1,2].map(function(M){return(1-S)*(1-S)*(1-S)*p[M]+3*(1-S)*(1-S)*S*f[M]+3*(1-S)*S*S*m[M]+S*S*S*b[M]});return new Ue(L,"lab")}}else if(s.length>=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,c<l.min&&(l.min=c),c>l.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<l;m++)f.push(c+m/l*(d-c));f.push(d)}else if(o.substr(0,1)==="l"){if(c<=0)throw new Error("Logarithmic scales are only possible for values > 0");var b=Math.LOG10E*Hs(c),w=Math.LOG10E*Hs(d);f.push(c);for(var x=1;x<l;x++)f.push(Kh(10,b+x/l*(w-b)));f.push(d)}else if(o.substr(0,1)==="q"){f.push(c);for(var P=1;P<l;P++){var S=(p.length-1)*P/l,L=tc(S);if(L===S)f.push(p[L]);else{var M=S-L;f.push(p[L]*(1-M)+p[L+1]*M)}}f.push(d)}else if(o.substr(0,1)==="k"){var j,U=p.length,G=new Array(U),X=new Array(l),gt=!0,pt=0,wt=null;wt=[],wt.push(c);for(var W=1;W<l;W++)wt.push(c+W/l*(d-c));for(wt.push(d);gt;){for(var k=0;k<l;k++)X[k]=0;for(var O=0;O<U;O++)for(var B=p[O],N=Number.MAX_VALUE,vt=void 0,nt=0;nt<l;nt++){var q=ec(wt[nt]-B);q<N&&(N=q,vt=nt),X[vt]++,G[O]=vt}for(var Y=new Array(l),Z=0;Z<l;Z++)Y[Z]=null;for(var Q=0;Q<U;Q++)j=G[Q],Y[j]===null?Y[j]=p[Q]:Y[j]+=p[Q];for(var $t=0;$t<l;$t++)Y[$t]*=1/X[$t];gt=!1;for(var ee=0;ee<l;ee++)if(Y[ee]!==wt[ee]){gt=!0;break}wt=Y,pt++,pt>200&&(gt=!1)}for(var re={},Oe=0;Oe<l;Oe++)re[Oe]=[];for(var ze=0;ze<U;ze++)j=G[ze],re[j].push(p[ze]);for(var Ut=[],fe=0;fe<l;fe++)Ut.push(re[fe][0]),Ut.push(re[fe][re[fe].length-1]);Ut=Ut.sort(function(an,on){return an-on}),f.push(Ut[0]);for(var We=1;We<Ut.length;We+=2){var de=Ut[We];!isNaN(de)&&f.indexOf(de)===-1&&f.push(de)}}return f},Vs={analyze:Ys,limits:Zs},Js=D,rc=function(s,o){s=new Js(s),o=new Js(o);var l=s.luminance(),c=o.luminance();return l>c?(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<ai.length;sn+=1){var oi=ai[sn];vr[oi.toLowerCase()]=vr[oi]}var uc=vr,dt=ct;dt.average=Th,dt.bezier=Ah,dt.blend=Bh,dt.cubehelix=Hh,dt.mix=dt.interpolate=_s,dt.random=Qh,dt.scale=tn,dt.analyze=Vs.analyze,dt.contrast=rc,dt.deltaE=ac,dt.distance=oc,dt.limits=Vs.limits,dt.valid=hc,dt.scales=cc,dt.colors=ys,dt.brewer=uc;var fc=dt;return fc})})(Oi);var st=Oi.exports;const Yt=(()=>(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&&e<this.min&&(e=this.min),this.max!==void 0&&e>this.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<n.length;e++)if(n[e].name!==t[e].name)return!1;return!0}const Cu=Symbol.for("@motion-canvas/2d/nodeName");function Ce(n){return function(t){t.prototype[Cu]=n}}function yi(n,t){const e=xt(0,n.arcLength,t);let r=0;for(const i of n.segments){const a=r;if(r+=i.arcLength,r>=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 <code>Node.children()</code> 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<r.length;a++){const h=r[a];if(h===this){const u=a+t;for(;a<u&&a+1<r.length;a++)i[a]=r[a+1]}i[a]=h}else for(let a=r.length-1;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&&a<h)return this;const u=h-a-1;return this.move(u)}moveAbove(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&&a>h)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,v<i)continue;const T=(i-et)/J.arcLength,rt=(a-et)/J.arcLength,ht=xt(0,1,T),K=xt(0,1,rt);this.canHaveSubpath&&F&&!J.getPoint(0).position.equals(F)&&(t.addPath(e),this.processSubpath(e,y,F),e=new Path2D,y=null);const[ce,Ft]=J.draw(e,ht,K,y===null);if(y===null&&(y=ce.position,C=ce.normal.flipped.perpendicular),F=Ft.position,H=Ft.normal.flipped.perpendicular,v>a)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<t.length;r++){const i=t[r];i>=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<t;i++){const a=i/(t-1),h=this.curve.eval(a),u=r.sub(h.position).magnitude;e+=u,this.sampledDistances.push(e),r=h.position}this.sampledDistances[this.sampledDistances.length-1]=this.curve.arcLength}pointAtDistance(t){return this.curve.eval(this.distanceToT(t))}distanceToT(t){const e=this.sampledDistances.length;t=xt(0,this.curve.arcLength,t);for(let r=0;r<e;r++){const i=this.sampledDistances[r],a=this.sampledDistances[r+1];if(t>=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:`<p>The image won&#39;t be visible unless you specify a source:</p>
<pre class=""><code class="language-tsx"><span class="hljs-keyword">import</span> myImage <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;./example.png&#x27;</span>;
<span class="hljs-comment">// ...</span>
<span class="language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">Img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">{myImage}</span> /&gt;</span></span>;</code></pre><p>If you did this intentionally, and don&#39;t want to see this warning, set the <code>src</code>
property to <code>null</code>:</p>
<pre class=""><code class="language-tsx">&lt;<span class="hljs-title class_">Img</span> src={<span class="hljs-literal">null</span>} /&gt;</code></pre><p><a href='https://motioncanvas.io/docs/media#images' target='_blank'>Learn more</a> about working with
images.</p>
`,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 <code>src</code> property was set to:
<pre><code>${t}</code></pre>
...which resolved to the following url:
<pre><code>${e}</code></pre>
Make sure that source is correct and that the image exists.<br/>
<a target='_blank' href='https://motioncanvas.io/docs/media#images'>Learn more</a>
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 '<Img/>` 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};
