(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();const Gr=!1;var Zr=Array.isArray,rs=Array.prototype.indexOf,Ft=Array.prototype.includes,Ut=Array.from,Jr=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,ns=Object.getOwnPropertyDescriptors,ss=Object.prototype,is=Array.prototype,$r=Object.getPrototypeOf,zr=Object.isExtensible;const as=()=>{};function os(t){for(var e=0;e<t.length;e++)t[e]()}function Qr(){var t,e,r=new Promise((n,s)=>{t=n,e=s});return{promise:r,resolve:t,reject:e}}const pe=2,dt=4,Wt=8,en=1<<24,Se=16,Fe=32,Ke=64,lr=128,Mr=256,Pe=512,le=1024,ae=2048,Me=4096,_e=8192,ce=16384,bt=32768,Rt=1<<25,vt=65536,Yt=1<<17,ls=1<<18,wt=1<<19,us=1<<20,qe=1<<25,jt=1<<21,ht=1<<22,We=1<<23,Tt=Symbol("$state"),tn=Symbol("component"),fs=Symbol("legacy props"),cs=Symbol(""),rn=Symbol("attributes"),ur=Symbol("class"),fr=Symbol("style"),cr=Symbol("text"),qt=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},hs=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),ds=1,vs=2,nn=4,ps=8,ms=16,_s=1,gs=4,bs=8,ws=16,ys=1,ks=2,sn={},oe=Symbol("uninitialized"),xs="http://www.w3.org/1999/xhtml";function Ms(){console.warn("https://svelte.dev/e/derived_inert")}function Es(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function an(t){return t===this.v}function Ss(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function on(t){return!Ss(t,this.v)}function ln(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ts(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function As(t,e,r){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Ps(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Fs(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Rs(t){throw new Error("https://svelte.dev/e/effect_orphan")}function Cs(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Os(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function qs(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Is(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function zs(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Ns(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let Ds=!1,he=null;function pt(t){he=t}function Ze(t,e=!1,r){he={p:he,i:!1,c:null,e:null,s:t,x:null,r:U,l:null}}function Je(t){var e=he,r=e.e;if(r!==null){e.e=null;for(var n of r)En(n)}return e.i=!0,he=e.p,Er(t)}function Er(t={}){return Jr(t,tn,{value:!0}),t}function un(){return!0}let ut=[];function Ls(){var t=ut;ut=[],os(t)}function Le(t){if(ut.length===0){var e=ut;queueMicrotask(()=>{e===ut&&Ls()})}ut.push(t)}const Vs=-7169;function ie(t,e){t.f=t.f&Vs|e}function Sr(t){(t.f&Pe)!==0||t.deps===null?ie(t,le):ie(t,Me)}function fn(t,e,r){(t.f&ae)!==0?e.add(t):(t.f&Me)!==0&&r.add(t),ie(t,le)}function It(t){var e=H,r=U;Ee(null),Ne(null);try{return t()}finally{Ee(e),Ne(r)}}function Ys(t,e,r,n){const s=Ct;var i=t.filter(h=>!h.settled),a=e.map(s);if(r.length===0&&i.length===0){n(a);return}var l=U,o=js(),f=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(h=>h.promise)):null;function d(h){if((l.f&ce)===0){o();try{n([...a,...h])}catch(m){Oe(m,l)}Bt()}}var v=cn();if(r.length===0){f.then(()=>d([])).finally(v);return}function p(){Promise.all(r.map(h=>Bs(h))).then(d).catch(h=>Oe(h,l)).finally(v)}f?f.then(()=>{if((l.f&ce)!==0){v();return}o(),p(),Bt()}):p()}function js(){var t=U,e=H,r=he,n=K;return function(i=!0){Ne(t),Ee(e),pt(r),i&&(t.f&ce)===0&&(n?.activate(),n?.apply())}}function Bt(t=!0){Ne(null),Ee(null),pt(null),t&&K?.deactivate()}function cn(){var t=U,e=t.b,r=K,n=!!e?.is_rendered();return e?.update_pending_count(1,r),r.increment(n,t),()=>{e?.update_pending_count(-1,r),r.decrement(n,t)}}function Ct(t){var e=pe|ae;return U!==null&&(U.f|=wt),{ctx:he,deps:null,effects:null,equals:an,f:e,fn:t,reactions:null,rv:0,v:oe,wv:0,parent:U,ac:null}}const Mt=Symbol("obsolete");function Bs(t,e,r){let n=U;n===null&&Ts();var s=void 0,i=it(oe),a=!H,l=new Set;return si(()=>{var o=U,f=Qr();s=f.promise;try{Promise.resolve(t()).then(f.resolve,h=>{h!==qt&&f.reject(h)}).finally(Bt)}catch(h){f.reject(h),Bt()}var d=K;if(a){if((o.f&bt)!==0)var v=cn();if(n.b?.is_rendered())d.async_deriveds.get(o)?.reject(Mt);else for(const h of l.values())h.reject(Mt);l.add(f),d.async_deriveds.set(o,f)}const p=(h,m=void 0)=>{v?.(),l.delete(f),m!==Mt&&(d.activate(),m?(i.f|=We,mt(i,m)):((i.f&We)!==0&&(i.f^=We),mt(i,h)),d.deactivate())};f.promise.then(p,h=>p(null,h||"unknown"))}),Mn(()=>{for(const o of l)o.reject(Mt)}),new Promise(o=>{function f(d){function v(){d===s?o(i):f(s)}d.then(v,v)}f(s)})}function ve(t){const e=Ct(t);return Cn(e),e}function hn(t){const e=Ct(t);return e.equals=on,e}function Hs(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)be(e[r])}}function Tr(t){var e,r=U,n=t.parent;if(!Ye&&n!==null&&t.v!==oe&&(n.f&(ce|_e))!==0)return Ms(),t.v;Ne(n);try{Hs(t),e=zn(t)}finally{Ne(r)}return e}function dn(t){var e=Tr(t);if(!t.equals(e)&&(t.wv=qn(),(!K?.is_fork||t.deps===null)&&(K!==null?(K.capture(t,e,!0),hr?.capture(t,e,!0)):t.v=e,t.deps===null))){ie(t,le);return}Ye||(Te!==null?(Fr()||K?.is_fork)&&Te.set(t,e):Sr(t))}function Xs(t){if(t.effects!==null)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&It(()=>{e.ac.abort(qt),e.ac=null}),e.fn!==null&&(e.teardown=as),Ot(e,0),Cr(e))}function vn(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&_t(e)}let tr=null,lt=null,K=null,hr=null,Te=null,dr=null,rr=!1,At=null,Vt=null;var Nr=0;let Us=1;class Ge{id=Us++;#e=!1;linked=!0;#s=null;#t=null;async_deriveds=new Map;current=new Map;previous=new Map;#o=new Set;#n=new Set;#a=0;#r=new Map;#l=null;#i=[];#m=[];#u=new Set;#f=new Set;#h=new Map;#_=new Set;is_fork=!1;#c=!1;constructor(){lt===null?tr=lt=this:(lt.#t=this,this.#s=lt),lt=this}#y(){if(this.is_fork)return!0;for(const n of this.#r.keys()){for(var e=n,r=!1;e.parent!==null;){if(this.#h.has(e)){r=!0;break}e=e.parent}if(!r)return!0}return!1}skip_effect(e){this.#h.has(e)||this.#h.set(e,{d:[],m:[]}),this.#_.delete(e)}unskip_effect(e,r=n=>this.schedule(n)){var n=this.#h.get(e);if(n){this.#h.delete(e);for(var s of n.d)ie(s,ae),r(s);for(s of n.m)ie(s,Me),r(s)}this.#_.add(e)}#k(){var e=[];for(const i of this.#i)if(!((i.f&ce)!==0||(i.f&(ae|Me))===0)){for(var r=i,n=!1;r.parent!==null;){r=r.parent;var s=r.f;if((s&(Ke|Fe))!==0){if((s&le)===0){n=!0;break}r.f^=le}}n||e.push(r)}return this.#i=[],e}#g(){this.#e=!0;for(const l of this.#u)this.#f.delete(l),ie(l,ae),this.schedule(l);for(const l of this.#f)ie(l,Me),this.schedule(l);this.apply();for(var e=At=[],r=[],n=Vt=[];this.#i.length>0;){Nr++>1e3&&(this.#p(),Ws());for(const l of this.#k())try{this.#b(l,e,r)}catch(o){throw _n(l),this.#y()||this.discard(),o}}if(K=null,n.length>0){var s=Ge.ensure();for(const l of n)s.schedule(l)}if(At=null,Vt=null,this.#y()){this.#v(r),this.#v(e);for(const[l,o]of this.#h)mn(l,o);n.length>0&&K.#g();return}const i=this.#d();if(i){this.#v(r),this.#v(e),i.#x(this);return}this.#u.clear(),this.#f.clear();for(const l of this.#o)l(this);this.#o.clear(),hr=this,Dr(r),Dr(e),hr=null,this.#l?.resolve();var a=K;if(this.#a===0&&(this.#i.length===0||a!==null)&&this.#p(),this.#i.length>0)if(a!==null){for(const l of this.#i)a.#i.push(l);this.#i=[]}else a=this;a!==null&&(Ie.clear(),a.#g())}#b(e,r,n){e.f^=le;for(var s=e.first;s!==null;){var i=s.f,a=(i&(Fe|Ke))!==0,l=a&&(i&le)!==0,o=l||(i&_e)!==0||this.#h.has(s);if(!o&&s.fn!==null){a?s.f^=le:(i&dt)!==0?r.push(s):Nt(s)&&((i&Se)!==0&&this.#f.add(s),_t(s));var f=s.first;if(f!==null){s=f;continue}}for(;s!==null;){var d=s.next;if(d!==null){s=d;break}s=s.parent}}}#d(){for(var e=this.#s;e!==null;){if(!e.is_fork){for(const[r,[,n]]of this.current)if(e.current.has(r)&&!n)return e}e=e.#s}return null}#x(e){for(const[n,s]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,s);for(const[n,s]of e.async_deriveds){const i=this.async_deriveds.get(n);i&&s.promise.then(i.resolve).catch(i.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#f);const r=n=>{var s=n.reactions;if(s!==null&&!((n.f&pe)!==0&&(n.f&(ae|Me))===0))for(const l of s){var i=l.f;if((i&pe)!==0)r(l);else{var a=l;i&(ht|Se)&&!this.async_deriveds.has(a)&&(this.#f.delete(a),ie(a,ae),this.schedule(a))}}};for(const n of this.current.keys())r(n);this.oncommit(()=>e.discard()),e.#p(),K=this,this.#g()}#v(e){for(var r=0;r<e.length;r+=1)fn(e[r],this.#u,this.#f)}capture(e,r,n=!1){e.v!==oe&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&We)===0&&(this.current.set(e,[r,n]),Te?.set(e,r)),this.is_fork||(e.v=r)}activate(){K=this}deactivate(){K=null,Te=null}flush(){try{rr=!0,K=this,this.#g()}finally{Nr=0,dr=null,At=null,Vt=null,rr=!1,K=null,Te=null,Ie.clear()}}discard(){for(const e of this.#n)e(this);this.#n.clear();for(const e of this.async_deriveds.values())e.reject(Mt);this.#p(),this.#l?.resolve()}register_created_effect(e){this.#m.push(e)}#w(){for(let v=tr;v!==null;v=v.#t){var e=v.id<this.id,r=[];for(const[p,[h,m]]of this.current){if(v.current.has(p)){var n=v.current.get(p)[0];if(e&&h!==n)v.current.set(p,[h,m]);else continue}r.push(p)}if(e)for(const[p,h]of this.async_deriveds){const m=v.async_deriveds.get(p);m&&h.promise.then(m.resolve).catch(m.reject)}var s=[...v.current.keys()].filter(p=>!v.current.get(p)[1]);if(!(!v.#e||s.length===0)){var i=s.filter(p=>!this.current.has(p));if(i.length===0)e&&v.discard();else if(r.length>0){if(e)for(const p of this.#_)v.unskip_effect(p,h=>{(h.f&(Se|ht))!==0?v.schedule(h):v.#v([h])});v.activate();var a=new Set,l=new Map;for(var o of r)pn(o,i,a,l);l=new Map;var f=[...v.current].filter(([p,h])=>{const m=this.current.get(p);return m?m[0]!==h[0]||m[1]!==h[1]:!0}).map(([p])=>p);if(f.length>0)for(const p of this.#m)(p.f&(ce|_e|Yt))===0&&Ar(p,f,l)&&((p.f&(ht|Se))!==0?(ie(p,ae),v.schedule(p)):v.#u.add(p));if(v.#i.length>0&&!v.#c){v.apply();for(var d of v.#k())v.#b(d,[],[])}v.deactivate()}}}}increment(e,r){if(this.#a+=1,e){let n=this.#r.get(r)??0;this.#r.set(r,n+1)}}decrement(e,r){if(this.#a-=1,e){let n=this.#r.get(r)??0;n===1?this.#r.delete(r):this.#r.set(r,n-1)}this.#c||(this.#c=!0,Le(()=>{this.#c=!1,this.linked&&this.flush()}))}transfer_effects(e,r){for(const n of e)this.#u.add(n);for(const n of r)this.#f.add(n);e.clear(),r.clear()}oncommit(e){this.#o.add(e)}ondiscard(e){this.#n.add(e)}settled(){return(this.#l??=Qr()).promise}static ensure(){if(K===null){const e=K=new Ge;rr||Le(()=>{e.#e||e.flush()})}return K}apply(){{Te=null;return}}schedule(e){if(dr=e,e.b?.is_pending&&(e.f&(dt|Wt|en))!==0&&(e.f&bt)===0){e.b.defer_effect(e);return}this.#i.push(e)}#p(){if(this.linked){var e=this.#s,r=this.#t;e===null?tr=r:e.#t=r,r===null?lt=e:r.#s=e,this.linked=!1}}}function Ws(){try{Cs()}catch(t){Oe(t,dr)}}let De=null;function Dr(t){var e=t.length;if(e!==0){for(var r=0;r<e;){var n=t[r++];if((n.f&(ce|_e))===0&&Nt(n)&&(De=new Set,_t(n),n.deps===null&&n.first===null&&n.nodes===null&&n.teardown===null&&n.ac===null&&Pn(n),De?.size>0)){Ie.clear();for(const s of De){if((s.f&(ce|_e))!==0)continue;const i=[s];let a=s.parent;for(;a!==null;)De.has(a)&&(De.delete(a),i.push(a)),a=a.parent;for(let l=i.length-1;l>=0;l--){const o=i[l];(o.f&(ce|_e))===0&&_t(o)}}De.clear()}}De=null}}function pn(t,e,r,n){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(const s of t.reactions){const i=s.f;(i&pe)!==0?pn(s,e,r,n):(i&(ht|Se))!==0&&(i&ae)===0&&Ar(s,e,n)&&(ie(s,ae),Pr(s))}}function Ar(t,e,r){const n=r.get(t);if(n!==void 0)return n;if(t.deps!==null)for(const s of t.deps){if(Ft.call(e,s))return!0;if((s.f&pe)!==0&&Ar(s,e,r))return r.set(s,!0),!0}return r.set(t,!1),!1}function Pr(t){K.schedule(t)}function mn(t,e){if(!((t.f&Fe)!==0&&(t.f&le)!==0)){(t.f&ae)!==0?e.d.push(t):(t.f&Me)!==0&&e.m.push(t),ie(t,le);for(var r=t.first;r!==null;)mn(r,e),r=r.next}}function _n(t){ie(t,le);for(var e=t.first;e!==null;)_n(e),e=e.next}let Ht=new Set;const Ie=new Map;let gn=!1;function it(t,e){var r={f:0,v:t,reactions:null,equals:an,rv:0,wv:0};return r}function N(t,e){const r=it(t);return Cn(r),r}function Ks(t,e=!1,r=!0){const n=it(t);return e||(n.equals=on),n}function I(t,e,r=!1){H!==null&&(!Ae||(H.f&Yt)!==0)&&un()&&(H.f&(pe|Se|ht|Yt))!==0&&(ze===null||!ze.has(t))&&zs();let n=r?me(e):e;return mt(t,n,Vt)}var et=null,vr=0;function mt(t,e,r=null){if(!t.equals(e)){Ye?Ie.set(t,e):Ie.has(t)||Ie.set(t,t.v);var n=Ge.ensure();if(n.capture(t,e),(t.f&pe)!==0){const s=t;(t.f&ae)!==0&&Tr(s),Te===null&&Sr(s)}t.wv=qn(),et=null,vr=0,bn(t,ae,r),et=null,U!==null&&(U.f&le)!==0&&(U.f&(Fe|Ke))===0&&(ke===null?oi([t]):ke.push(t)),!n.is_fork&&Ht.size>0&&!gn&&Gs()}return e}function Gs(){gn=!1;for(const t of Ht){(t.f&le)!==0&&ie(t,Me);let e;try{e=Nt(t)}catch{e=!0}e&&_t(t)}Ht.clear()}function Pt(t){I(t,t.v+1)}function bn(t,e,r){var n=t.reactions;if(n!==null){var s=n.length;if(vr+=s,vr>1e5&&et===null&&(et=new Set),et!==null){if(et.has(t))return;et.add(t)}for(var i=0;i<s;i++){var a=n[i],l=a.f,o=(l&ae)===0;if(o&&ie(a,e),(l&Yt)!==0)Ht.add(a);else if((l&pe)!==0){var f=a;Te?.delete(f),bn(f,Me,r)}else if(o){var d=a;(l&Se)!==0&&De!==null&&De.add(d),r!==null?r.push(d):Pr(d)}}}}function me(t){if(typeof t!="object"||t===null||Tt in t||tn in t)return t;const e=$r(t);if(e!==ss&&e!==is)return t;var r=new Map,n=Zr(t),s=N(0),i=st,a=l=>{if(st===i)return l();var o=H,f=st;Ee(null),Vr(i);var d=l();return Ee(o),Vr(f),d};return n&&r.set("length",N(t.length)),new Proxy(t,{defineProperty(l,o,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&qs();var d=r.get(o);return d===void 0?a(()=>{var v=N(f.value);return r.set(o,v),v}):I(d,f.value,!0),!0},deleteProperty(l,o){var f=r.get(o);if(f===void 0){if(o in l){const d=a(()=>N(oe));r.set(o,d),Pt(s)}}else I(f,oe),Pt(s);return!0},get(l,o,f){if(o===Tt)return t;var d=r.get(o),v=o in l;if(d===void 0&&(!v||ct(l,o)?.writable)&&(d=a(()=>{var h=me(v?l[o]:oe),m=N(h);return m}),r.set(o,d)),d!==void 0){var p=u(d);return p===oe?void 0:p}return Reflect.get(l,o,f)},getOwnPropertyDescriptor(l,o){this.has?.(l,o);var f=Reflect.getOwnPropertyDescriptor(l,o),d=r.get(o);if(d!==void 0){var v=u(d);if(v===oe)return;if(f&&"value"in f)f.value=v;else return{enumerable:!0,configurable:!0,value:v,writable:!0}}return f},has(l,o){if(o===Tt)return!0;var f=r.get(o),d=f!==void 0&&f.v!==oe||Reflect.has(l,o);if(f!==void 0||U!==null&&(!d||ct(l,o)?.writable)){f===void 0&&(f=a(()=>{var p=d?me(l[o]):oe,h=N(p);return h}),r.set(o,f));var v=u(f);if(v===oe)return!1}return d},set(l,o,f,d){var v=r.get(o),p=o in l;if(n&&o==="length")for(var h=f;h<v.v;h+=1){var m=r.get(h+"");m!==void 0?I(m,oe):h in l&&(m=a(()=>N(oe)),r.set(h+"",m))}if(v===void 0)(!p||ct(l,o)?.writable)&&(v=a(()=>N(void 0)),I(v,me(f)),r.set(o,v));else{p=v.v!==oe;var E=a(()=>me(f));I(v,E)}var c=Reflect.getOwnPropertyDescriptor(l,o);if(c?.set&&c.set.call(d,f),!p){if(n&&typeof o=="string"){var _=r.get("length"),y=Number(o);Number.isInteger(y)&&y>=_.v&&I(_,y+1)}Pt(s)}return!0},ownKeys(l){u(s);var o=Reflect.ownKeys(l).filter(v=>{var p=r.get(v);return p===void 0||p.v!==oe});for(var[f,d]of r)d.v!==oe&&!(f in l)&&o.push(f);return o},setPrototypeOf(){Is()}})}var pr,wn,yn,kn;function Zs(){if(pr===void 0){pr=window,wn=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;yn=ct(e,"firstChild").get,kn=ct(e,"nextSibling").get,zr(t)&&(t[ur]=void 0,t[rn]=null,t[fr]=void 0,t.__e=void 0),zr(r)&&(r[cr]=void 0)}}function rt(t=""){return document.createTextNode(t)}function at(t){return yn.call(t)}function zt(t){return kn.call(t)}function W(t,e){return at(t)}function Js(t,e=!1){{var r=at(t);return r instanceof Comment&&r.data===""?zt(r):r}}function B(t,e=!1){return at(t)}function k(t,e=1,r=!1){let n=t;for(;e--;)n=zt(n);return n}function $s(t){t.textContent=""}function xn(){return!1}function Qs(t,e,r){return r?document.createElement(t,{is:r}):document.createElement(t)}function ei(t){var e=U;if(e===null)return H.f|=We,t;if((e.f&bt)===0&&(e.f&dt)===0)throw t;Oe(t,e)}function Oe(t,e){if(t===sn)throw t;if(!(e!==null&&(e.f&ce)!==0)){for(;e!==null;){if((e.f&lr)!==0&&(e.f&(ce|Rt))===0){if((e.f&bt)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw t}}function ti(t){U===null&&(H===null&&Rs(),Fs()),Ye&&Ps()}function ri(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function je(t,e){var r=U;r!==null&&(r.f&_e)!==0&&(t|=_e);var n={ctx:he,deps:null,nodes:null,f:t|ae|Pe,first:null,fn:e,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};K?.register_created_effect(n);var s=n;if((t&dt)!==0)At!==null?At.push(n):Ge.ensure().schedule(n);else if(e!==null){try{_t(n)}catch(a){throw be(n),a}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&wt)===0&&(s=s.first,(t&Se)!==0&&(t&vt)!==0&&s!==null&&(s.f|=vt))}if(s!==null&&(s.parent=r,r!==null&&ri(s,r),H!==null&&(H.f&pe)!==0&&(t&Ke)===0)){var i=H;(i.effects??=[]).push(s)}return n}function Fr(){return H!==null&&!Ae}function Mn(t){const e=je(Wt,null);return ie(e,le),e.teardown=t,e}function Kt(t){ti();var e=U.f,r=!H&&(e&Fe)!==0&&he!==null&&!he.i;if(r){var n=he;(n.e??=[]).push(t)}else return En(t)}function En(t){return je(dt|us,t)}function ni(t){Ge.ensure();const e=je(Ke|wt,t);return(r={})=>new Promise(n=>{r.outro?nt(e,()=>{be(e),n(void 0)}):(be(e),n(void 0))})}function Sn(t){return je(dt,t)}function si(t){return je(ht|wt,t)}function Tn(t,e=0){return je(Wt|e,t)}function re(t,e=[],r=[],n=[]){Ys(n,e,r,s=>{je(Wt,()=>{t(...s.map(u))})})}function Rr(t,e=0){var r=je(Se|e,t);return r}function xe(t){return je(Fe|wt,t)}function An(t){var e=t.teardown;if(e!==null){const r=Ye,n=H;Lr(!0),Ee(null);try{e.call(null)}catch(s){Oe(s,t.parent)}finally{Lr(r),Ee(n)}}}function Cr(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){const s=r.ac;s!==null&&It(()=>{s.abort(qt)});var n=r.next;(r.f&Ke)!==0?r.parent=null:be(r,e),r=n}}function ii(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&Fe)===0&&be(e),e=r}}function be(t,e=!0){var r=!1;(e||(t.f&ls)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(ai(t.nodes.start,t.nodes.end),r=!0),t.f|=Rt,Cr(t,e&&!r),Ot(t,0);var n=t.nodes&&t.nodes.t;if(n!==null)for(const i of n)i.stop();An(t),t.f^=Rt,t.f|=ce;var s=t.parent;s!==null&&s.first!==null&&Pn(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function ai(t,e){for(;t!==null;){var r=t===e?null:zt(t);t.remove(),t=r}}function Pn(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function nt(t,e,r=!0){var n=[];t.f|=Mr,Fn(t,n,!0);var s=()=>{r&&be(t),e&&e()},i=n.length;if(i>0){var a=()=>--i||s();for(var l of n)l.out(a)}else s()}function Fn(t,e,r){if((t.f&_e)===0){t.f^=_e;var n=t.nodes&&t.nodes.t;if(n!==null)for(const l of n)(l.is_global||r)&&e.push(l);for(var s=t.first;s!==null;){var i=s.next;if((s.f&Ke)===0){var a=(s.f&vt)!==0||(s.f&Fe)!==0&&(t.f&Se)!==0;Fn(s,e,a?r:!1)}s=i}}}function Xt(t){t.f&=~Mr,Rn(t,!0)}function Rn(t,e){if((t.f&Mr)===0&&(t.f&_e)!==0){t.f^=_e,(t.f&le)===0&&(ie(t,ae),Ge.ensure().schedule(t));for(var r=t.first;r!==null;){var n=r.next,s=(r.f&vt)!==0||(r.f&Fe)!==0;Rn(r,s?e:!1),r=n}var i=t.nodes&&t.nodes.t;if(i!==null)for(const a of i)(a.is_global||e)&&a.in()}}function Or(t,e){if(t.nodes)for(var r=t.nodes.start,n=t.nodes.end;r!==null;){var s=r===n?null:zt(r);e.append(r),r=s}}let Ye=!1;function Lr(t){Ye=t}let H=null,Ae=!1;function Ee(t){H=t}let U=null;function Ne(t){U=t}let ze=null;function Cn(t){H!==null&&((H.f&jt)!==0||(H.f&pe)!==0)&&(ze??=new Set).add(t)}let ge=null,we=0,ke=null;function oi(t){ke=t}let On=1,tt=0,st=tt;function Vr(t){st=t}function qn(){return++On}function Nt(t){var e=t.f;if((e&ae)!==0)return!0;if((e&Me)!==0){for(var r=t.deps,n=r.length,s=0;s<n;s++){var i=r[s];if(Nt(i)&&dn(i),i.wv>t.wv)return!0}(e&Pe)!==0&&Te===null&&ie(t,le)}return!1}function In(t,e,r=!0){var n=t.reactions;if(n!==null&&!(ze!==null&&ze.has(t)))for(var s=0;s<n.length;s++){var i=n[s];(i.f&pe)!==0?In(i,e,!1):e===i&&(r?ie(i,ae):(i.f&le)!==0&&ie(i,Me),Pr(i))}}function zn(t){var e=ge,r=we,n=ke,s=H,i=ze,a=he,l=Ae,o=st,f=t.f;ge=null,we=0,ke=null,H=(f&(Fe|Ke))===0?t:null,ze=null,pt(t.ctx),Ae=!1,st=++tt,t.ac!==null&&(It(()=>{t.ac.abort(qt)}),t.ac=null);try{t.f|=jt;var d=t.fn,v=d();t.f|=bt;var p=Yr(t);if(un()&&ke!==null&&!Ae&&p!==null&&(t.f&(pe|Me|ae))===0)for(var h=0;h<ke.length;h++)In(ke[h],t);if(s!==null&&s!==t){if(tt++,s.deps!==null)for(let m=0;m<r;m+=1)s.deps[m].rv=tt;if(e!==null)for(const m of e)m.rv=tt;ke!==null&&(n===null?n=ke:n.push(...ke))}return(t.f&We)!==0&&(t.f^=We),v}catch(m){return Yr(t),ei(m)}finally{t.f^=jt,ge=e,we=r,ke=n,H=s,ze=i,pt(a),Ae=l,st=o}}function Yr(t){var e=t.deps,r=K?.is_fork;if(ge!==null){var n;if(r||Ot(t,we),e!==null&&we>0)for(e.length=we+ge.length,n=0;n<ge.length;n++)e[we+n]=ge[n];else t.deps=e=ge;if(Fr()&&(t.f&Pe)!==0)for(n=we;n<e.length;n++)(e[n].reactions??=[]).push(t)}else!r&&e!==null&&we<e.length&&(Ot(t,we),e.length=we);return e}function li(t,e){let r=e.reactions;if(r!==null){var n=rs.call(r,t);if(n!==-1){var s=r.length-1;s===0?r=e.reactions=null:(r[n]=r[s],r.pop())}}if(r===null&&(e.f&pe)!==0&&(ge===null||!Ft.call(ge,e))){var i=e;(i.f&Pe)!==0&&(i.f^=Pe),i.v!==oe&&Sr(i),i.ac!==null&&It(()=>{i.ac.abort(qt),i.ac=null,ie(i,ae)}),Xs(i),Ot(i,0)}}function Ot(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)li(t,r[n])}function _t(t){var e=t.f;if((e&ce)===0){ie(t,le);var r=U;U=t;try{(e&(Se|en))!==0?ii(t):Cr(t),An(t);var n=zn(t);t.teardown=typeof n=="function"?n:null,t.wv=On;var s;Gr&&Ds&&(t.f&ae)!==0&&t.deps}finally{U=r}}}function u(t){var e=t.f,r=(e&pe)!==0;if(H!==null&&!Ae){var n=U!==null&&(U.f&ce)!==0;if(!n&&(ze===null||!ze.has(t))){var s=H.deps;if((H.f&jt)!==0)t.rv<tt&&(t.rv=tt,ge===null&&s!==null&&s[we]===t?we++:ge===null?ge=[t]:ge.push(t));else{H.deps??=[],Ft.call(H.deps,t)||H.deps.push(t);var i=t.reactions;i===null?t.reactions=[H]:Ft.call(i,H)||i.push(H)}}}if(Ye&&Ie.has(t))return Ie.get(t);if(r){var a=t;if(Ye){var l=a.v;return((a.f&le)===0&&a.reactions!==null||Dn(a))&&(l=Tr(a)),Ie.set(a,l),l}var o=(a.f&Pe)===0&&!Ae&&H!==null&&(H.f&Pe)!==0,f=(a.f&bt)===0;Nt(a)&&(o&&(a.f|=Pe),dn(a)),o&&!f&&(vn(a),Nn(a))}if(Te?.has(t))return Te.get(t);if((t.f&We)!==0)throw t.v;return t.v}function Nn(t){if(t.f|=Pe,t.deps!==null)for(const r of t.deps){var e=r.reactions;e===null?r.reactions=[t]:Ft.call(e,t)||e.push(t),(r.f&pe)!==0&&(r.f&Pe)===0&&(vn(r),Nn(r))}}function Dn(t){if(t.v===oe)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Ie.has(e)||(e.f&pe)!==0&&Dn(e))return!0;return!1}function ot(t){var e=Ae;try{return Ae=!0,t()}finally{Ae=e}}const ui=["touchstart","touchmove"];function fi(t){return ui.includes(t)}const Et=Symbol("events"),Ln=new Set,mr=new Set;function ci(t,e,r,n={}){function s(i){if(n.capture||_r.call(e,i),!i.cancelBubble)return It(()=>r?.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?(s.__removed=!1,Le(()=>{s.__removed||e.addEventListener(t,s,n)})):e.addEventListener(t,s,n),s}function qr(t,e,r,n,s){var i={capture:n,passive:s},a=ci(t,e,r,i);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Mn(()=>{a.__removed=!0,e.removeEventListener(t,a,i)})}function X(t,e,r){(e[Et]??={})[t]=r}function yt(t){for(var e=0;e<t.length;e++)Ln.add(t[e]);for(var r of mr)r(t)}let nr=null,sr=!1;function _r(t){var e=this,r=e.ownerDocument,n=t.type,s=t.composedPath?.()||[],i=s[0]||t.target;nr=t,sr||(sr=!0,setTimeout(()=>{sr=!1,nr=null}));var a=0,l=nr===t&&t[Et];if(l){var o=s.indexOf(l);if(o!==-1&&(e===document||e===window)){t[Et]=e;return}var f=s.indexOf(e);if(f===-1)return;o<=f&&(a=o)}if(i=s[a]||t.target,i!==e){Jr(t,"currentTarget",{configurable:!0,get(){return i||r}});var d=H,v=U;Ee(null),Ne(null);try{for(var p,h=[];i!==null&&i!==e;){try{var m=i[Et]?.[n];m!=null&&(!i.disabled||t.target===i)&&m.call(i,t)}catch(E){p?h.push(E):p=E}if(t.cancelBubble)break;a++,i=a<s.length?s[a]:null}if(p){for(let E of h)queueMicrotask(()=>{throw E});throw p}}finally{t[Et]=e,delete t.currentTarget,Ee(d),Ne(v)}}}const hi=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function di(t){return hi?.createHTML(t)??t}function Vn(t){var e=Qs("template");return e.innerHTML=di(t.replaceAll("<!>","<!---->")),e.content}function gr(t,e){var r=U;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function se(t,e){var r=(e&ys)!==0,n=(e&ks)!==0,s,i=!t.startsWith("<!>");return()=>{s===void 0&&(s=Vn(i?t:"<!>"+t),r||(s=at(s)));var a=n||wn?document.importNode(s,!0):s.cloneNode(!0);if(r){var l=at(a),o=a.lastChild;gr(l,o)}else gr(a,a);return a}}function vi(t,e,r="svg"){var n=!t.startsWith("<!>"),s=`<${r}>${n?t:"<!>"+t}</${r}>`,i;return()=>{if(!i){var a=Vn(s),l=at(a);i=at(l)}var o=i.cloneNode(!0);return gr(o,o),o}}function pi(t,e){return vi(t,e,"svg")}function Q(t,e){t!==null&&t.before(e)}function mi(t){let e=0,r=it(0),n;return()=>{Fr()&&(u(r),Tn(()=>(e===0&&(n=ot(()=>t(()=>Pt(r)))),e+=1,()=>{Le(()=>{e-=1,e===0&&(n?.(),n=void 0,Pt(r))})})))}}var _i=vt|wt;function gi(t,e,r,n){new bi(t,e,r,n)}class bi{parent;is_pending=!1;transform_error;#e;#s=null;#t;#o;#n;#a=null;#r=null;#l=null;#i=null;#m=0;#u=0;#f=!1;#h=new Set;#_=new Set;#c=null;#y=mi(()=>(this.#c=it(this.#m),()=>{this.#c=null}));constructor(e,r,n,s){this.#e=e,this.#t=r,this.#o=i=>{var a=U;a.b=this,a.f|=lr,n(i)},this.parent=U.b,this.transform_error=s??this.parent?.transform_error??(i=>i),this.#n=Rr(()=>{this.#v()},_i)}#k(){try{this.#a=xe(()=>this.#o(this.#e))}catch(e){this.error(e)}}#g(e){const r=this.#t.failed,{reset:n,invoke_onerror:s}=this.#b(e);Le(s),r&&(this.#l=xe(()=>{r(this.#e,()=>e,()=>n)}))}#b(e){var r=!1,n=!1;const s=()=>{if(!this.#d()){if(r){Es();return}r=!0,n&&Ns(),this.#l!==null&&nt(this.#l,()=>{this.#l=null}),this.#p(()=>{this.#v()})}};return{reset:s,invoke_onerror:()=>{if(!this.#d())try{n=!0,this.#t.onerror?.(e,s),n=!1}catch(a){Oe(a,this.#n&&this.#n.parent)}}}}#d(){return(this.#n.f&(ce|Rt))!==0}#x(){const e=this.#t.pending;e&&(this.is_pending=!0,this.#r=xe(()=>e(this.#e)),Le(()=>{if(!this.#d()){var r=this.#i=document.createDocumentFragment(),n=rt(),s=!1;if(r.append(n),this.#a=this.#p(()=>{try{return xe(()=>this.#o(n))}catch(i){try{this.error(i),s=!0}catch(a){Oe(a,this.#n.parent)}return null}}),this.#a===null){this.#i=null,s&&this.#w(K);return}this.#u===0&&(this.#e.before(r),this.#i=null,nt(this.#r,()=>{this.#r=null}),this.#w(K))}}))}#v(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#m=0,this.#a=xe(()=>{this.#o(this.#e)}),this.#u>0){var e=this.#i=document.createDocumentFragment();Or(this.#a,e);const r=this.#t.pending;this.#r=xe(()=>r(this.#e))}else this.#w(K)}catch(r){this.error(r)}}#w(e){this.is_pending=!1,e.transfer_effects(this.#h,this.#_)}defer_effect(e){fn(e,this.#h,this.#_)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#p(e){var r=U,n=H,s=he;Ne(this.#n),Ee(this.#n),pt(this.#n.ctx);try{return Ge.ensure(),e()}finally{Ne(r),Ee(n),pt(s)}}#M(e,r){if(!this.has_pending_snippet()){this.parent&&this.parent.#M(e,r);return}this.#u+=e,this.#u===0&&(this.#w(r),this.#r&&nt(this.#r,()=>{this.#r=null}),this.#i&&(this.#e.before(this.#i),this.#i=null))}update_pending_count(e,r){this.#M(e,r),this.#m+=e,!(!this.#c||this.#f)&&(this.#f=!0,Le(()=>{this.#f=!1,this.#c&&mt(this.#c,this.#m)}))}get_effect_pending(){return this.#y(),u(this.#c)}error(e){if(e===sn||!this.#t.onerror&&!this.#t.failed)throw e;K?.is_fork?(this.#a&&K.skip_effect(this.#a),this.#r&&K.skip_effect(this.#r),this.#l&&K.skip_effect(this.#l),K.oncommit(()=>{this.#d()||this.#E(e)})):this.#E(e)}#E(e){this.#a&&(be(this.#a),this.#a=null),this.#r&&(be(this.#r),this.#r=null),this.#l&&(be(this.#l),this.#l=null);let r=this.#t.failed;const n=s=>{if(this.#d())return;const{reset:i,invoke_onerror:a}=this.#b(s);a(),r&&!this.#d()&&(this.#l=this.#p(()=>{try{return xe(()=>{var l=U;l.b=this,l.f|=lr,r(this.#e,()=>s,()=>i)})}catch(l){return Oe(l,this.#n.parent),null}}))};Le(()=>{if(!this.#d()){var s;try{s=this.transform_error(e)}catch(i){Oe(i,this.#n&&this.#n.parent);return}s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(n,i=>Oe(i,this.#n&&this.#n.parent)):n(s)}})}}function V(t,e){var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t[cr]??=t.nodeValue)&&(t[cr]=r,t.nodeValue=`${r}`)}function wi(t,e){return yi(t,e)}const Dt=new Map;function yi(t,{target:e,anchor:r,props:n={},events:s,context:i,intro:a=!0,transformError:l}){Zs();var o=void 0,f=ni(()=>{var d=r??e.appendChild(rt());gi(d,{pending:()=>{}},h=>{Ze({});var m=he;i&&(m.c=i),s&&(n.$$events=s),o=t(h,n)||Er(),Je()},l);var v=new Set,p=h=>{for(var m=0;m<h.length;m++){var E=h[m];if(!v.has(E)){v.add(E);var c=fi(E);for(const R of[e,document]){var _=Dt.get(R);_===void 0&&(_=new Map,Dt.set(R,_));var y=_.get(E);y===void 0?(R.addEventListener(E,_r,{passive:c}),_.set(E,1)):_.set(E,y+1)}}}};return p(Ut(Ln)),mr.add(p),()=>{for(var h of v)for(const c of[e,document]){var m=Dt.get(c),E=m.get(h);--E==0?(c.removeEventListener(h,_r),m.delete(h),m.size===0&&Dt.delete(c)):m.set(h,E)}mr.delete(p),d!==r&&d.parentNode?.removeChild(d)}});return ki.set(o,f),o}let ki=new WeakMap;class xi{anchor;#e=new Map;#s=new Map;#t=new Map;#o=new Set;#n=!0;constructor(e,r=!0){this.anchor=e,this.#n=r}#a=e=>{if(this.#e.has(e)){var r=this.#e.get(e),n=this.#s.get(r);if(n)Xt(n),this.#o.delete(r);else{var s=this.#t.get(r);s&&(Xt(s.effect),this.#s.set(r,s.effect),this.#t.delete(r),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),n=s.effect)}for(const[i,a]of this.#e){if(this.#e.delete(i),i===e)break;const l=this.#t.get(a);l&&(be(l.effect),this.#t.delete(a))}for(const[i,a]of this.#s){if(i===r||this.#o.has(i))continue;const l=()=>{if(Array.from(this.#e.values()).includes(i)){var f=document.createDocumentFragment();Or(a,f),f.append(rt()),this.#t.set(i,{effect:a,fragment:f})}else be(a);this.#o.delete(i),this.#s.delete(i)};this.#n||!n?(this.#o.add(i),nt(a,l,!1)):l()}}};#r=e=>{this.#e.delete(e);const r=Array.from(this.#e.values());for(const[n,s]of this.#t)r.includes(n)||(be(s.effect),this.#t.delete(n))};ensure(e,r){var n=K,s=xn();if(r&&!this.#s.has(e)&&!this.#t.has(e))if(s){var i=document.createDocumentFragment(),a=rt();i.append(a),this.#t.set(e,{effect:xe(()=>r(a)),fragment:i})}else this.#s.set(e,xe(()=>r(this.anchor)));if(this.#e.set(n,e),s){for(const[l,o]of this.#s)l===e?n.unskip_effect(o):n.skip_effect(o);for(const[l,o]of this.#t)l===e?n.unskip_effect(o.effect):n.skip_effect(o.effect);n.oncommit(this.#a),n.ondiscard(this.#r)}else this.#a(n)}}function ye(t,e,r=!1){var n=new xi(t),s=r?vt:0;function i(a,l){n.ensure(a,l)}Rr(()=>{var a=!1;e((l,o=0)=>{a=!0,i(o,l)}),a||i(-1,null)},s)}function Mi(t,e){return e}function Ei(t,e,r){for(var n=[],s=e.length,i,a=e.length,l=0;l<s;l++){let v=e[l];nt(v,()=>{if(i){if(i.pending.delete(v),i.done.add(v),i.pending.size===0){var p=t.outrogroups;br(t,Ut(i.done)),p.delete(i),p.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var o=n.length===0&&r!==null&&t.pending.size===0;if(o){var f=r,d=f.parentNode;$s(d),d.append(f),t.items.clear()}br(t,e,!o)}else i={pending:new Set(e),done:new Set},(t.outrogroups??=new Set).add(i)}function br(t,e,r=!0){var n;if(t.pending.size>0){n=new Set;for(const a of t.pending.values())for(const l of a)n.add(t.items.get(l).e)}for(var s=0;s<e.length;s++){var i=e[s];if(n?.has(i)){i.f|=qe;const a=document.createDocumentFragment();Or(i,a)}else be(e[s],r)}}var jr;function Ve(t,e,r,n,s,i=null){var a=t,l=new Map,o=(e&nn)!==0;if(o){var f=t;a=f.appendChild(rt())}var d=null,v=hn(()=>{var y=r();return Zr(y)?y:y==null?[]:Ut(y)}),p=new Map,h=!0;function m(y){if((_.effect.f&ce)===0){_.pending.delete(y);var R=u(v);_.fallback=d,Si(_,R,a,e,n),d!==null&&(R.length===0?(d.f&qe)===0?Xt(d):(d.f^=qe,St(d,null,a)):nt(d,()=>{d=null}))}}function E(y){_.pending.delete(y)}var c=Rr(()=>{for(var y=u(v),R=y.length,w=new Set,O=K,q=xn(),Y=0;Y<R;Y+=1){var ne=y[Y],P=n(ne,Y),D=h?null:l.get(P);D?(D.v&&mt(D.v,ne),D.i&&mt(D.i,Y),q&&O.unskip_effect(D.e)):(D=Ti(l,h?a:jr??=rt(),ne,P,Y,s,e,r),h||(D.e.f|=qe),l.set(P,D)),w.add(P)}if(R===0&&i&&!d&&(h?d=xe(()=>i(a)):(d=xe(()=>i(jr??=rt())),d.f|=qe)),R>w.size&&As(),!h)if(p.set(O,w),q){for(const[$,ue]of l)w.has($)||O.skip_effect(ue.e);O.oncommit(m),O.ondiscard(E)}else m(O);u(v)}),_={effect:c,items:l,pending:p,outrogroups:null,fallback:d};h=!1}function xt(t){for(;t!==null&&(t.f&Fe)===0;)t=t.next;return t}function Si(t,e,r,n,s){var i=(n&ps)!==0,a=e.length,l=t.items,o=xt(t.effect.first),f,d=null,v,p=[],h=[],m,E,c,_;if(i)for(_=0;_<a;_+=1)m=e[_],E=s(m,_),c=l.get(E).e,(c.f&qe)===0&&(c.nodes?.a?.measure(),(v??=new Set).add(c));for(_=0;_<a;_+=1){if(m=e[_],E=s(m,_),c=l.get(E).e,t.outrogroups!==null)for(const D of t.outrogroups)D.pending.delete(c),D.done.delete(c);if((c.f&_e)!==0&&(Xt(c),i&&(c.nodes?.a?.unfix(),(v??=new Set).delete(c))),(c.f&qe)!==0)if(c.f^=qe,c===o)St(c,null,r);else{var y=d?d.next:o;c===t.effect.last&&(t.effect.last=c.prev),c.prev&&(c.prev.next=c.next),c.next&&(c.next.prev=c.prev),Xe(t,d,c),Xe(t,c,y),St(c,y,r),d=c,p=[],h=[],o=xt(d.next);continue}if(c!==o){if(f!==void 0&&f.has(c)){if(p.length<h.length){var R=h[0],w;d=R.prev;var O=p[0],q=p[p.length-1];for(w=0;w<p.length;w+=1)St(p[w],R,r);for(w=0;w<h.length;w+=1)f.delete(h[w]);Xe(t,O.prev,q.next),Xe(t,d,O),Xe(t,q,R),o=R,d=q,_-=1,p=[],h=[]}else f.delete(c),St(c,o,r),Xe(t,c.prev,c.next),Xe(t,c,d===null?t.effect.first:d.next),Xe(t,d,c),d=c;continue}for(p=[],h=[];o!==null&&o!==c;)(f??=new Set).add(o),h.push(o),o=xt(o.next);if(o===null)continue}(c.f&qe)===0&&p.push(c),d=c,o=xt(c.next)}if(t.outrogroups!==null){for(const D of t.outrogroups)D.pending.size===0&&(br(t,Ut(D.done)),t.outrogroups?.delete(D));t.outrogroups.size===0&&(t.outrogroups=null)}if(o!==null||f!==void 0){var Y=[];if(f!==void 0)for(c of f)(c.f&_e)===0&&Y.push(c);for(;o!==null;)(o.f&_e)===0&&o!==t.fallback&&Y.push(o),o=xt(o.next);var ne=Y.length;if(ne>0){var P=(n&nn)!==0&&a===0?r:null;if(i){for(_=0;_<ne;_+=1)Y[_].nodes?.a?.measure();for(_=0;_<ne;_+=1)Y[_].nodes?.a?.fix()}Ei(t,Y,P)}}i&&Le(()=>{if(v!==void 0)for(c of v)c.nodes?.a?.apply()})}function Ti(t,e,r,n,s,i,a,l){var o=(a&ds)!==0?(a&ms)===0?Ks(r,!1,!1):it(r):null,f=(a&vs)!==0?it(s):null;return{v:o,i:f,e:xe(()=>(i(e,o??r,f??s,l),()=>{t.delete(n)}))}}function St(t,e,r){if(t.nodes)for(var n=t.nodes.start,s=t.nodes.end,i=e&&(e.f&qe)===0?e.nodes.start:r;n!==null;){var a=zt(n);if(i.before(n),n===s)return;n=a}}function Xe(t,e,r){e===null?t.effect.first=r:e.next=r,r===null?t.effect.last=e:r.prev=e}const Br=[...`
\r\f \v\uFEFF`];function Ai(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var s of Object.keys(r))if(r[s])n=n?n+" "+s:s;else if(n.length)for(var i=s.length,a=0;(a=n.indexOf(s,a))>=0;){var l=a+i;(a===0||Br.includes(n[a-1]))&&(l===n.length||Br.includes(n[l]))?n=(a===0?"":n.substring(0,a))+n.substring(l+1):a=l}}return n===""?null:n}function Hr(t,e=!1){var r=e?" !important;":";",n="";for(var s of Object.keys(t)){var i=t[s];i!=null&&i!==""&&(n+=" "+s+": "+i+r)}return n}function Pi(t,e){if(e){var r="",n,s;return Array.isArray(e)?(n=e[0],s=e[1]):n=e,n&&(r+=Hr(n)),s&&(r+=Hr(s,!0)),r=r.trim(),r===""?null:r}return String(t)}function Gt(t,e,r,n,s,i){var a=t[ur];if(a!==r||a===void 0){var l=Ai(r,n,i);l==null?t.removeAttribute("class"):t.className=l,t[ur]=r}else if(i&&s!==i)for(var o in i){var f=!!i[o];(s==null||f!==!!s[o])&&t.classList.toggle(o,f)}return i}function ir(t,e={},r,n){for(var s in r){var i=r[s];e[s]!==i&&(r[s]==null?t.style.removeProperty(s):t.style.setProperty(s,i,n))}}function ft(t,e,r,n){var s=t[fr];if(s!==e){var i=Pi(e,n);i==null?t.removeAttribute("style"):t.style.cssText=i,t[fr]=e}else n&&(Array.isArray(n)?(ir(t,r?.[0],n[0]),ir(t,r?.[1],n[1],"important")):ir(t,r,n));return n}const Fi=Symbol("is custom element"),Ri=Symbol("is html"),Ci=hs?"progress":"PROGRESS";function Xr(t,e){var r=Yn(t);r.value===(r.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!==Ci)||(t.value=e??"")}function b(t,e,r,n){var s=Yn(t);s[e]!==(s[e]=r)&&(e==="loading"&&(t[cs]=r),r==null?t.removeAttribute(e):typeof r!="string"&&Oi(t).has(e)?t[e]=r:t.setAttribute(e,r))}function Yn(t){return t[rn]??={[Fi]:t.nodeName.includes("-"),[Ri]:t.namespaceURI===xs}}var Ur=new Map;function Oi(t){var e=t.getAttribute("is")||t.nodeName,r=Ur.get(e);if(r)return r;Ur.set(e,r=new Set);for(var n,s=t,i=Element.prototype;i!==s;){n=ns(s);for(var a in n)n[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&r.add(a);s=$r(s)}return r}class Ir{#e=new WeakMap;#s;#t;static entries=new WeakMap;constructor(e){this.#t=e}observe(e,r){var n=this.#e.get(e)||new Set;return n.add(r),this.#e.set(e,n),this.#o().observe(e,this.#t),()=>{var s=this.#e.get(e);s.delete(r),s.size===0&&(this.#e.delete(e),this.#s.unobserve(e))}}#o(){return this.#s??(this.#s=new ResizeObserver(e=>{for(var r of e){Ir.entries.set(r.target,r);for(var n of this.#e.get(r.target)||[])n(r)}}))}}var qi=new Ir({box:"border-box"});function Ii(t,e,r){var n=qi.observe(t,()=>r(t[e]));Sn(()=>(ot(()=>r(t[e])),n))}function ar(t,e){return t===e||t?.[Tt]===e}function gt(t=Er(),e,r,n){var s=he.r,i=U;return Sn(()=>{var a,l;return Tn(()=>{a=l,l=[],ot(()=>{ar(r(...l),t)||(e(t,...l),a&&ar(r(...a),t)&&e(null,...a))})}),()=>{let o=i;for(;o!==s&&o.parent!==null&&o.parent.f&Rt;)o=o.parent;const f=()=>{l&&ar(r(...l),t)&&e(null,...l)},d=o.teardown;o.teardown=()=>{f(),d?.()}}}),t}let Lt=!1;function zi(t){var e=Lt;try{return Lt=!1,[t(),Lt]}finally{Lt=e}}function Ue(t,e,r,n){var s=!0,i=(r&bs)!==0,a=(r&ws)!==0,l=n,o=!0,f=void 0,d=()=>a&&s?(f??=Ct(n),u(f)):(o&&(o=!1,l=a?ot(n):n),l);let v;if(i){var p=Tt in t||fs in t;v=ct(t,e)?.set??(p&&e in t?w=>t[e]=w:void 0)}var h,m=!1;i?[h,m]=zi(()=>t[e]):h=t[e],h===void 0&&n!==void 0&&(h=d(),v&&(Os(),v(h)));var E;if(E=()=>{var w=t[e];return w===void 0?d():(o=!0,w)},(r&gs)===0)return E;if(v){var c=t.$$legacy;return(function(w,O){return arguments.length>0?((!O||c||m)&&v(O?E():w),w):E()})}var _=!1,y=((r&_s)!==0?Ct:hn)(()=>(_=!1,E()));i&&u(y);var R=U;return(function(w,O){if(arguments.length>0){const q=O?u(y):i?me(w):w;return I(y,q),_=!0,l!==void 0&&(l=q),w}return Ye&&_||(R.f&ce)!==0?y.v:u(y)})}function Zt(t){he===null&&ln(),Kt(()=>{const e=ot(t);if(typeof e=="function")return e})}function Ni(t){he===null&&ln(),Zt(()=>()=>ot(t))}const wr=1,yr={Webp:1,Jpeg:2,Rgba:3},jn=16;function Di(t){if(t.byteLength<jn)return null;const e=new DataView(t),r=e.getUint8(8);return r<1||r>4?null:{frame:e.getUint32(0,!0),width:e.getUint16(4,!0),height:e.getUint16(6,!0),format:r,len:e.getUint32(12,!0)}}const Li={[yr.Jpeg]:"image/jpeg",[yr.Webp]:"image/webp"};async function Vi(t){const e=Di(t);if(!e)return null;const r=new Uint8Array(t,jn,e.len);let n;if(e.format===yr.Rgba){const s=new ImageData(new Uint8ClampedArray(r),e.width,e.height);n=await createImageBitmap(s)}else n=await createImageBitmap(new Blob([r],{type:Li[e.format]}));return{header:e,image:n}}function Yi(t,e,r){const n=new URL(t,r);return n.protocol==="http:"&&(n.protocol="ws:"),n.protocol==="https:"&&(n.protocol="wss:"),e&&n.searchParams.set("token",e),n.toString()}function ji(t,e,r){return Math.min(r,e*2**Math.max(0,t-1))}class Bi{kind="ws";ws=null;handlers=null;attempt=0;timer=null;closed=!1;latestFrame=-1;decodeChain=Promise.resolve();url;min;max;WS;constructor(e){const r=typeof location<"u"?location.href:"http://127.0.0.1/";this.url=Yi(e.url,e.token,r),this.min=e.minDelayMs??250,this.max=e.maxDelayMs??5e3,this.WS=e.WebSocketImpl??WebSocket}connect(e){this.handlers=e,this.closed=!1,this.open()}open(){const e=this.handlers;if(!e||this.closed)return;e.status(this.attempt===0?{state:"connecting"}:{state:"reconnecting",attempt:this.attempt,delayMs:0});const r=new this.WS(this.url);r.binaryType="arraybuffer",this.ws=r,r.onopen=()=>{this.attempt=0,e.status({state:"open"})},r.onmessage=n=>{if(typeof n.data=="string"){let i;try{i=JSON.parse(n.data)}catch{return}this.decodeChain=this.decodeChain.then(()=>e.event(i));return}const s=n.data;this.decodeChain=this.decodeChain.then(async()=>{const i=await Vi(s);i&&(this.latestFrame=i.header.frame,e.frame(i))})},r.onclose=()=>{if(this.ws=null,this.closed)return;this.attempt+=1;const n=ji(this.attempt,this.min,this.max);e.status({state:"reconnecting",attempt:this.attempt,delayMs:n}),this.timer=setTimeout(()=>this.open(),n)},r.onerror=()=>r.close()}send(e){this.ws?.readyState===1&&this.ws.send(JSON.stringify(e))}close(){this.closed=!0,this.timer&&clearTimeout(this.timer),this.ws?.close(),this.handlers?.status({state:"closed",reason:"closed by editor"})}get lastFrame(){return this.latestFrame}}class Hi{kind="mock";h=null;frame=0;playing=null;viewport={w:640,h:360};selected=null;sent=[];fps=30;size=[1920,1080];scenes=[{name:"intro",start:0,frames:60},{name:"outro",start:60,frames:60}];metas={intro:{version:1,markers:{beat:1},eases:{slide:[.65,0,.35,1]},tunables:{speed:1.5}},outro:{version:1,markers:{fade:.5},eases:{},tunables:{}}};get total(){return 120}connect(e){this.h=e,e.status({state:"connecting"}),queueMicrotask(()=>e.status({state:"open"}))}emit(e){this.h?.event(e)}inject(e){this.emit(e)}markers(){return Object.entries(this.metas).flatMap(([e,r])=>Object.entries(r.markers??{}).map(([n,s])=>({scene:e,name:n,time:s})))}timeline(){this.emit({type:"Timeline",frames:this.total,markers:this.markers(),scenes:this.scenes,audio_waveform:Array.from({length:240},(e,r)=>Math.abs(Math.sin(r/7))*.8)})}squareX(e){return 200+e/this.total*1400}async show(){const e=this.frame;this.emit({type:"Frame",index:e});const[r,n]=this.size,s=Math.min(this.viewport.w/r,this.viewport.h/n,1),i=Math.max(1,Math.round(r*s)),a=Math.max(1,Math.round(n*s));let l=null;if(typeof OffscreenCanvas<"u"){const o=new OffscreenCanvas(i,a),f=o.getContext("2d");f.fillStyle="#141414",f.fillRect(0,0,i,a),f.fillStyle="#e13238",f.fillRect((this.squareX(e)-100)*s,440*s,200*s,200*s),f.fillStyle="#fff",f.font=`${Math.round(48*s)}px sans-serif`,f.fillText(`frame ${e}`,40*s,80*s),l=o.transferToImageBitmap()}if(l){const o={header:{frame:e,width:i,height:a,format:3,len:i*a*4},image:l};this.h?.frame(o)}if(this.selected!==null){const o=this.squareX(e);this.emit({type:"Signals",node_id:this.selected,values:[{name:"x",value:(o-960).toFixed(3)},{name:"y",value:"0.000"},{name:"fill",value:"#e13238ff"}],bounds:[o-100,440,o+100,440,o+100,640,o-100,640]})}}send(e){switch(this.sent.push(e),e.type){case"Hello":if(e.protocol_version!==wr){this.emit({type:"Error",kind:"Incompatible",message:"protocol mismatch",spans:[]});return}this.emit({type:"Ready",protocol_version:wr,engine_version:"mock",fps:this.fps,size:this.size,scenes:this.scenes});for(const[r,n]of Object.entries(this.metas))this.emit({type:"MetaChanged",scene:r,meta:n});this.timeline(),this.emit({type:"Tree",nodes:[{id:0,parent:null,kind:"Group",name:"view"},{id:1,parent:0,kind:"Rect",name:"square"}]}),this.show();break;case"Seek":this.frame=Math.max(0,Math.min(this.total-1,e.frame)),this.show();break;case"Step":this.stopPlayback(),this.frame=Math.max(0,Math.min(this.total-1,this.frame+e.delta)),this.emit({type:"Playback",playing:!1,frame:this.frame}),this.show();break;case"Play":this.stopPlayback(),this.emit({type:"Playback",playing:!0,frame:this.frame}),this.playing=setInterval(()=>{this.frame=(this.frame+1)%this.total,this.show()},1e3/this.fps);break;case"Pause":this.stopPlayback(),this.emit({type:"Playback",playing:!1,frame:this.frame});break;case"SetViewport":this.viewport={w:e.w*e.dpr,h:e.h*e.dpr},this.show();break;case"SetMarker":{const r=e.scene??Object.keys(this.metas).find(s=>e.name in(this.metas[s]?.markers??{})),n=r?this.metas[r]:void 0;if(!r||!n){this.emit({type:"Error",kind:"Meta",message:`no marker named \`${e.name}\``,spans:[]});return}n.markers={...n.markers,[e.name]:e.time},this.emit({type:"MetaChanged",scene:r,meta:n}),this.timeline(),this.show();break}case"SetEase":case"SetTunable":{const r=this.metas.intro;e.type==="SetEase"?r.eases={...r.eases,[e.name]:e.value}:r.tunables={...r.tunables,[e.name]:e.value},this.emit({type:"MetaChanged",scene:"intro",meta:r}),this.show();break}case"Pick":{const r=this.squareX(this.frame),n=Math.abs(e.x-r)<=100&&Math.abs(e.y-540)<=100;this.selected=n?1:null,this.emit({type:"Selected",node_id:this.selected}),this.show();break}case"Select":this.selected=e.node_id??null,this.emit({type:"Selected",node_id:this.selected}),this.show();break}}stopPlayback(){this.playing!==null&&clearInterval(this.playing),this.playing=null}close(){this.stopPlayback(),this.h?.status({state:"closed",reason:"closed"})}}const Xi="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Xi);const Ui={"app.title":"oxframe","conn.connecting":"Connecting…","conn.open":"Connected","conn.reconnecting":"Reconnecting…","conn.closed":"Disconnected","status.building":"Building…","status.reloaded":"Reloaded","status.incompatible":"Version mismatch","error.build":"Build failed","error.runtime":"Runtime error","error.meta":"Could not apply the edit","error.incompatible":"Incompatible versions","error.dismiss":"Dismiss","error.previous":"The previous version keeps running.","transport.play":"Play (Space)","transport.pause":"Pause (Space)","transport.prev":"Previous frame (←, Shift+← for 10)","transport.next":"Next frame (→, Shift+→ for 10)","transport.start":"Go to start (Home)","transport.end":"Go to end (End)","timeline.label":"Timeline","timeline.marker":"Marker {name} at {time} s. Drag or use ←/→ to move.","timeline.addMarker":"Add marker at playhead (M)","inspector.tree":"Scene","inspector.signals":"Signals","inspector.noSelection":"Click a node in the viewport or the tree.","inspector.tunables":"Tunables","inspector.eases":"Eases","inspector.none":"None yet — use tune!() and ease!() in your scene.","curve.title":"Ease “{name}”","curve.presets":"Presets","curve.close":"Close","viewport.label":"Preview","viewport.axes":"Axes","viewport.fit":"Fit (double-click)","theme.toggle":"Toggle light/dark theme","help.title":"Shortcuts","help.keys":"Space play/pause · ←/→ step · Shift+←/→ 10 frames · Home/End · M marker · wheel zoom · Alt/middle-drag pan"},Wi=Ui;function C(t,e={}){return Wi[t].replace(/\{(\w+)\}/g,(r,n)=>String(e[n]??`{${n}}`))}var Ki=se('<span class="chip ok svelte-yic9pk" data-testid="reloaded"> </span>'),Gi=se('<span class="dim svelte-yic9pk"> </span>'),Zi=se('<header class="svelte-yic9pk"><strong class="logo svelte-yic9pk"> </strong> <span role="status" aria-live="polite" data-testid="status"><span class="dot svelte-yic9pk" aria-hidden="true"></span> </span> <!> <span class="spacer svelte-yic9pk"></span> <!> <button> </button> <button>1:1</button> <button> </button> <span class="help svelte-yic9pk">?</span></header>');function Ji(t,e){Ze(e,!0);let r=Ue(e,"editor",7);const n=ve(()=>{const w=r().connection;if(r().error?.kind==="Incompatible")return{cls:"bad",text:C("status.incompatible")};if(r().building)return{cls:"busy",text:C("status.building")};switch(w.state){case"open":return{cls:"ok",text:C("conn.open")};case"connecting":return{cls:"busy",text:C("conn.connecting")};case"reconnecting":return{cls:"busy",text:C("conn.reconnecting")};default:return{cls:"bad",text:C("conn.closed")}}});let s=N(!1);Kt(()=>{if(!r().reloadedAt)return;I(s,!0);const w=setTimeout(()=>I(s,!1),1500);return()=>clearTimeout(w)});var i=Zi(),a=W(i),l=B(a,!0),o=k(a,2),f=k(W(o),1,!0),d=k(o,2);{var v=w=>{var O=Ki(),q=B(O,!0);re(Y=>V(q,Y),[()=>C("status.reloaded")]),Q(w,O)};ye(d,w=>{u(s)&&w(v)})}var p=k(d,4);{var h=w=>{var O=Gi(),q=B(O);re(()=>V(q,`engine ${r().engineVersion??""} · ${r().size[0]??""}×${r().size[1]??""} · ${r().fps??""} fps`)),Q(w,O)};ye(p,w=>{r().engineVersion&&w(h)})}var m=k(p,2),E=B(m,!0),c=k(m,2),_=k(c,2),y=B(_,!0),R=k(_,2);re((w,O,q,Y,ne,P,D,$)=>{V(l,w),Gt(o,1,`chip ${u(n).cls??""}`,"svelte-yic9pk"),V(f,u(n).text),b(m,"aria-pressed",r().showAxes),b(m,"title",O),V(E,q),b(c,"title",Y),b(_,"title",ne),b(_,"aria-label",P),V(y,e.theme==="dark"?"☾":"☀"),b(R,"title",D),b(R,"aria-label",$)},[()=>C("app.title"),()=>C("viewport.axes"),()=>C("viewport.axes"),()=>C("viewport.fit"),()=>C("theme.toggle"),()=>C("theme.toggle"),()=>C("help.keys"),()=>C("help.keys")]),X("click",m,()=>r().showAxes=!r().showAxes),X("click",c,()=>r().resetView()),X("click",_,function(...w){e.onToggleTheme?.apply(this,w)}),Q(t,i),Je()}yt(["click"]);function kr(t,e,r,n,s){const a=Math.min(e.w/t[0],e.h/t[1])*r;return{scale:a,ox:e.w/2-t[0]*a/2+n,oy:e.h/2-t[1]*a/2+s}}function Bn(t,e,r){return[(e-t.ox)/t.scale,(r-t.oy)/t.scale]}function xr(t,e,r){return[t.ox+e*t.scale,t.oy+r*t.scale]}function $i(t,e,r,n,s,i,a,l){const o=kr(t,e,r,n,s),[f,d]=Bn(o,a,l),v=kr(t,e,i,0,0),[p,h]=xr(v,f,d);return{panX:a-p,panY:l-h}}var Qi=se('<div class="viewport svelte-10js0q2" data-testid="viewport"><canvas class="svelte-10js0q2"></canvas> <span class="zoom svelte-10js0q2" aria-live="off"> </span></div>');function ea(t,e){Ze(e,!0);let r,n,s=N(me({w:0,h:0}));const i=ve(()=>kr(e.editor.size,u(s),e.editor.zoom,e.editor.panX,e.editor.panY));Zt(()=>{const c=new ResizeObserver(([_])=>{if(!_)return;const{width:y,height:R}=_.contentRect;I(s,{w:Math.round(y),h:Math.round(R)},!0),e.editor.setViewport(u(s).w,u(s).h)});return c.observe(r),()=>c.disconnect()}),Kt(()=>{const c=n?.getContext("2d");if(!c)return;const _=typeof devicePixelRatio=="number"?devicePixelRatio:1,{w:y,h:R}=u(s);(n.width!==Math.round(y*_)||n.height!==Math.round(R*_))&&(n.width=Math.round(y*_),n.height=Math.round(R*_)),c.setTransform(_,0,0,_,0,0),c.clearRect(0,0,y,R);const[w,O]=e.editor.size,q=u(i),Y=e.editor.image;c.fillStyle="#000",c.fillRect(q.ox,q.oy,w*q.scale,O*q.scale),Y&&(c.imageSmoothingQuality="high",c.drawImage(Y,q.ox,q.oy,w*q.scale,O*q.scale));const ne=getComputedStyle(r).getPropertyValue("--m-accent")||"#6cb2eb";if(e.editor.showAxes){const[D,$]=xr(q,w/2,O/2);c.strokeStyle="rgba(255,255,255,0.25)",c.lineWidth=1,c.setLineDash([4,4]),c.beginPath(),c.moveTo(q.ox,$+.5),c.lineTo(q.ox+w*q.scale,$+.5),c.moveTo(D+.5,q.oy),c.lineTo(D+.5,q.oy+O*q.scale),c.stroke(),c.setLineDash([])}const P=e.editor.bounds;if(P&&e.editor.selected!==null){c.strokeStyle=ne,c.lineWidth=2,c.beginPath();for(let D=0;D<4;D++){const[$,ue]=xr(q,P[2*D],P[2*D+1]);D===0?c.moveTo($,ue):c.lineTo($,ue)}c.closePath(),c.stroke()}});let a=null;function l(c){const _=n.getBoundingClientRect();return[c.clientX-_.left,c.clientY-_.top]}function o(c){n.setPointerCapture(c.pointerId),a={x:c.clientX,y:c.clientY,px:e.editor.panX,py:e.editor.panY,moved:!1}}function f(c){if(!a)return;const _=c.clientX-a.x,y=c.clientY-a.y;Math.abs(_)+Math.abs(y)>3&&(a.moved=!0),a.moved&&(c.altKey||c.buttons===4||c.buttons===2)&&e.editor.setZoom(e.editor.zoom,a.px+_,a.py+y)}function d(c){const _=a;if(a=null,!_||_.moved||c.button!==0)return;const[y,R]=l(c),[w,O]=Bn(u(i),y,R),[q,Y]=e.editor.size;if(w<0||O<0||w>q||O>Y){e.editor.select(null);return}e.editor.pick(w,O)}function v(c){c.preventDefault();const[_,y]=l(c),R=Math.exp(-c.deltaY*.0015),w=Math.max(.1,Math.min(16,e.editor.zoom*R)),O=$i(e.editor.size,u(s),e.editor.zoom,e.editor.panX,e.editor.panY,w,_,y);e.editor.setZoom(w,O.panX,O.panY)}var p=Qi(),h=W(p);gt(h,c=>n=c,()=>n);var m=k(h,2),E=B(m);gt(p,c=>r=c,()=>r),re(c=>{b(h,"data-frame",e.editor.imageFrame),b(h,"aria-label",`frame ${e.editor.imageFrame??""}`),V(E,`${c??""}%`)},[()=>Math.round(e.editor.zoom*100)]),X("pointerdown",h,o),X("pointermove",h,f),X("pointerup",h,d),qr("wheel",h,v),X("dblclick",h,()=>e.editor.resetView()),X("contextmenu",h,c=>c.preventDefault()),Q(t,p),Je()}yt(["pointerdown","pointermove","pointerup","dblclick","contextmenu"]);const Hn="oxframe-editor-view";function ta(t){const e=new URLSearchParams(t.replace(/^#/,"")),r=o=>{const f=e.get(o);if(f===null||f==="")return;const d=Number(f);return Number.isFinite(d)?d:void 0},n={},s=r("f");s!==void 0&&(n.frame=Math.max(0,Math.round(s)));const i=r("z");i!==void 0&&i>0&&(n.zoom=i);const a=r("px");a!==void 0&&(n.panX=a);const l=r("py");if(l!==void 0&&(n.panY=l),e.has("s")){const o=r("s");n.selected=o===void 0?null:o}return n}function ra(t){const e=new URLSearchParams;return e.set("f",String(t.frame)),t.zoom!==1&&e.set("z",t.zoom.toFixed(3)),(t.panX!==0||t.panY!==0)&&(e.set("px",t.panX.toFixed(1)),e.set("py",t.panY.toFixed(1))),t.selected!==null&&e.set("s",String(t.selected)),`#${e.toString()}`}function na(){let t={};try{t=JSON.parse(sessionStorage.getItem(Hn)??"{}")}catch{t={}}return{...t,...ta(typeof location>"u"?"":location.hash)}}function sa(t){try{sessionStorage.setItem(Hn,JSON.stringify(t))}catch{}typeof history<"u"&&history.replaceState(history.state,"",`${location.pathname}${location.search}${ra(t)}`)}class ia{constructor(e,r={}){if(this.backend=e,this.persistEnabled=r.persist??!0,this.uiVersion=r.uiVersion??"0.1.0",this.persistEnabled){const n=na();this.restoredFrame=n.frame??null,this.zoom=n.zoom??1,this.panX=n.panX??0,this.panY=n.panY??0,this.selected=n.selected??null}}backend;#e=N(me({state:"connecting"}));get connection(){return u(this.#e)}set connection(e){I(this.#e,e,!0)}#s=N(!1);get ready(){return u(this.#s)}set ready(e){I(this.#s,e,!0)}#t=N("");get engineVersion(){return u(this.#t)}set engineVersion(e){I(this.#t,e,!0)}#o=N(60);get fps(){return u(this.#o)}set fps(e){I(this.#o,e,!0)}#n=N(me([1920,1080]));get size(){return u(this.#n)}set size(e){I(this.#n,e,!0)}#a=N(0);get frames(){return u(this.#a)}set frames(e){I(this.#a,e,!0)}#r=N(0);get frame(){return u(this.#r)}set frame(e){I(this.#r,e,!0)}#l=N(!1);get playing(){return u(this.#l)}set playing(e){I(this.#l,e,!0)}#i=N(me([]));get scenes(){return u(this.#i)}set scenes(e){I(this.#i,e,!0)}#m=N(me([]));get markers(){return u(this.#m)}set markers(e){I(this.#m,e,!0)}#u=N(null);get waveform(){return u(this.#u)}set waveform(e){I(this.#u,e)}#f=N(me({}));get metas(){return u(this.#f)}set metas(e){I(this.#f,e,!0)}#h=N(me([]));get tree(){return u(this.#h)}set tree(e){I(this.#h,e,!0)}#_=N(null);get selected(){return u(this.#_)}set selected(e){I(this.#_,e,!0)}#c=N(me([]));get signals(){return u(this.#c)}set signals(e){I(this.#c,e,!0)}#y=N(null);get bounds(){return u(this.#y)}set bounds(e){I(this.#y,e,!0)}#k=N(!1);get building(){return u(this.#k)}set building(e){I(this.#k,e,!0)}#g=N(0);get reloadedAt(){return u(this.#g)}set reloadedAt(e){I(this.#g,e,!0)}#b=N(null);get error(){return u(this.#b)}set error(e){I(this.#b,e,!0)}#d=N(null);get image(){return u(this.#d)}set image(e){I(this.#d,e)}#x=N(-1);get imageFrame(){return u(this.#x)}set imageFrame(e){I(this.#x,e,!0)}#v=N(1);get zoom(){return u(this.#v)}set zoom(e){I(this.#v,e,!0)}#w=N(0);get panX(){return u(this.#w)}set panX(e){I(this.#w,e,!0)}#p=N(0);get panY(){return u(this.#p)}set panY(e){I(this.#p,e,!0)}#M=N(!0);get showAxes(){return u(this.#M)}set showAxes(e){I(this.#M,e,!0)}viewport={w:0,h:0};#E=N(null);get selectedMarker(){return u(this.#E)}set selectedMarker(e){I(this.#E,e,!0)}#S=N(null);get editingEase(){return u(this.#S)}set editingEase(e){I(this.#S,e,!0)}restoredFrame=null;persistEnabled;uiVersion;start(){this.backend.connect({event:e=>this.handle(e),frame:e=>this.onFrame(e),status:e=>this.onStatus(e)})}stop(){this.backend.close()}send(e){this.backend.send(e)}onStatus(e){this.connection=e,e.state==="open"?this.send({type:"Hello",protocol_version:wr,ui_version:this.uiVersion}):(this.ready=!1,this.playing=!1)}onFrame(e){this.image?.close?.(),this.image=e.image,this.imageFrame=e.header.frame}handle(e){switch(e.type){case"Ready":this.ready=!0,this.engineVersion=e.engine_version,this.fps=e.fps,this.size=e.size,this.scenes=e.scenes,this.building=!1,this.error?.kind==="Incompatible"&&(this.error=null),this.resync();break;case"Reloaded":this.reloadedAt=Date.now(),this.building=!1,this.error=null,this.resync();break;case"Building":this.building=!0;break;case"Error":this.building=!1,this.error={kind:e.kind,message:e.message,spans:e.spans??[]};break;case"Frame":this.frame=e.index,this.savePersist();break;case"Playback":this.playing=e.playing,this.frame=e.frame;break;case"Timeline":this.frames=e.frames,this.markers=e.markers,this.scenes=e.scenes,e.audio_waveform&&(this.waveform=e.audio_waveform);break;case"Tree":this.tree=e.nodes;break;case"Signals":e.node_id===this.selected&&(this.signals=e.values,this.bounds=e.bounds??null);break;case"Selected":this.selected=e.node_id,e.node_id===null&&(this.signals=[],this.bounds=null),this.savePersist();break;case"MetaChanged":this.metas={...this.metas,[e.scene]:e.meta},this.error?.kind==="Meta"&&(this.error=null);break}}resync(){this.viewport.w>0&&this.sendViewport();const e=this.restoredFrame??this.frame;this.restoredFrame=null,this.send({type:"Seek",frame:e}),this.selected!==null&&this.send({type:"Select",node_id:this.selected})}get lastFrame(){return Math.max(0,this.frames-1)}seek(e){const r=Math.max(0,Math.min(this.lastFrame,Math.round(e)));this.frame=r,this.send({type:"Seek",frame:r})}play(){this.send({type:"Play"})}pause(){this.send({type:"Pause"})}togglePlay(){this.playing?this.pause():this.play()}step(e){this.send({type:"Step",delta:e})}setViewport(e,r){this.viewport={w:e,h:r},this.sendViewport()}sendViewport(){const e=typeof devicePixelRatio=="number"?devicePixelRatio:1;this.send({type:"SetViewport",w:Math.max(1,Math.round(this.viewport.w*this.zoom)),h:Math.max(1,Math.round(this.viewport.h*this.zoom)),dpr:e})}setZoom(e,r=this.panX,n=this.panY){const s=Math.max(.1,Math.min(16,e)),i=Math.abs(s-this.zoom)>1e-6;this.zoom=s,this.panX=r,this.panY=n,i&&this.viewport.w>0&&this.sendViewport(),this.savePersist()}resetView(){this.setZoom(1,0,0)}sceneStart(e){const r=this.scenes.find(n=>n.name===e);return r?r.start/this.fps:0}sceneAt(e){return[...this.scenes].reverse().find(r=>r.start<=e)??this.scenes[0]}markerFrame(e){return Math.round((this.sceneStart(e.scene)+e.time)*this.fps)}moveMarker(e,r,n){const s=Math.max(0,n/this.fps-this.sceneStart(e));this.send({type:"SetMarker",name:r,time:Number(s.toFixed(6)),scene:e})}markerAtPlayhead(){const e=this.sceneAt(this.frame);if(!e)return;if(this.selectedMarker){this.moveMarker(this.selectedMarker.scene,this.selectedMarker.name,this.frame);return}const r=new Set(this.markers.filter(i=>i.scene===e.name).map(i=>i.name));let n=1;for(;r.has(`marker-${n}`);)n+=1;const s=`marker-${n}`;this.moveMarker(e.name,s,this.frame),this.selectedMarker={scene:e.name,name:s}}setEase(e,r){this.send({type:"SetEase",name:e,value:r})}setTunable(e,r){this.send({type:"SetTunable",name:e,value:r})}pick(e,r){this.send({type:"Pick",x:e,y:r})}select(e){this.selected=e,this.send({type:"Select",node_id:e})}dismissError(){this.error=null}savePersist(){this.persistEnabled&&sa({frame:this.frame,zoom:this.zoom,panX:this.panX,panY:this.panY,selected:this.selected})}}function Wr(t,e){const r=t/Math.max(1,e),n=Math.floor(r/60),s=Math.floor(r%60),i=t%Math.max(1,e);return`${n}:${String(s).padStart(2,"0")}.${String(i).padStart(2,"0")}`}var aa=se('<div class="scene svelte-112n2zp"><span> </span></div>'),oa=se('<button><span class="flag svelte-112n2zp"> </span></button>'),la=se('<section class="timeline svelte-112n2zp"><div class="transport svelte-112n2zp"><button>⏮</button> <button>◀︎</button> <button class="play svelte-112n2zp" data-testid="play"> </button> <button>▶︎</button> <button>⏭</button> <span class="time svelte-112n2zp" data-testid="time"> </span> <span class="frame svelte-112n2zp" data-testid="frame"> </span> <span class="spacer svelte-112n2zp"></span> <button>+ M</button></div> <div class="track svelte-112n2zp" role="slider" tabindex="0" data-testid="track"><div class="scenes svelte-112n2zp"></div> <canvas class="wave svelte-112n2zp" aria-hidden="true"></canvas> <!> <div class="playhead svelte-112n2zp" aria-hidden="true"></div></div></section>');function ua(t,e){Ze(e,!0);let r=Ue(e,"editor",7),n,s,i=N(0);const a=ve(()=>Math.max(1,r().frames)),l=g=>g/Math.max(1,u(a)-1)*u(i),o=g=>{const S=n.getBoundingClientRect(),j=Math.min(1,Math.max(0,(g-S.left)/Math.max(1,S.width)));return Math.round(j*(u(a)-1))};let f=!1,d=null;function v(g){d=g,requestAnimationFrame(()=>{d!==null&&r().seek(d),d=null})}function p(g){g.target.dataset.marker||(f=!0,n.setPointerCapture(g.pointerId),r().playing&&r().pause(),v(o(g.clientX)))}function h(g){f&&v(o(g.clientX))}function m(){f=!1}let E=N(null);const c=g=>u(E)&&u(E).m.name===g.name&&u(E).m.scene===g.scene?u(E).frame:r().markerFrame(g);function _(g,S){g.stopPropagation(),g.target.setPointerCapture(g.pointerId),r().selectedMarker={scene:S.scene,name:S.name},I(E,{m:S,frame:r().markerFrame(S)},!0)}function y(g){u(E)&&I(E,{...u(E),frame:o(g.clientX)},!0)}function R(){if(!u(E))return;const{m:g,frame:S}=u(E);I(E,null),S!==r().markerFrame(g)&&r().moveMarker(g.scene,g.name,S)}function w(g,S){const j=g.key==="ArrowLeft"?-1:g.key==="ArrowRight"?1:0;j?(g.preventDefault(),r().moveMarker(S.scene,S.name,r().markerFrame(S)+j*(g.shiftKey?10:1))):g.key==="Enter"&&r().seek(r().markerFrame(S))}Kt(()=>{const g=r().waveform,S=s?.getContext("2d");if(!S)return;const j=devicePixelRatio||1,A=28;if(s.width=Math.max(1,Math.round(u(i)*j)),s.height=Math.round(A*j),S.setTransform(j,0,0,j,0,0),S.clearRect(0,0,u(i),A),!g||g.length===0)return;S.fillStyle=getComputedStyle(s).getPropertyValue("--m-wave")||"#4b5563";const M=g.length;for(let z=0;z<u(i);z++){const J=g[Math.min(M-1,Math.floor(z/u(i)*M))]??0,G=Math.max(1,J*A);S.fillRect(z,(A-G)/2,1,G)}});var O=la(),q=W(O),Y=W(q),ne=k(Y,2),P=k(ne,2),D=B(P,!0),$=k(P,2),ue=k($,2),Re=k(ue,2),Ce=B(Re,!0),$e=k(Re,2),Be=B($e),He=k($e,4),de=k(q,2);b(de,"aria-valuemin",0);var x=W(de);Ve(x,21,()=>r().scenes,g=>g.name,(g,S)=>{var j=aa();let A;var M=W(j),z=B(M,!0);re((J,G)=>{b(j,"title",u(S).name),A=ft(j,"",A,{left:J,width:G}),V(z,u(S).name)},[()=>`${l(u(S).start)??""}px`,()=>`${Math.max(0,l(u(S).start+u(S).frames-1)-l(u(S).start))}px`]),Q(g,j)});var T=k(x,2);let F;gt(T,g=>s=g,()=>s);var L=k(T,2);Ve(L,17,()=>r().markers,g=>g.scene+"/"+g.name,(g,S)=>{const j=ve(()=>c(u(S))),A=ve(()=>r().selectedMarker?.name===u(S).name&&r().selectedMarker?.scene===u(S).scene);var M=oa();let z,J;var G=W(M),te=B(G,!0);re((fe,Qe,kt)=>{z=Gt(M,1,"marker svelte-112n2zp",null,z,{selected:u(A)}),b(M,"data-marker",u(S).name),b(M,"data-testid",`marker-${u(S).name??""}`),b(M,"aria-label",fe),b(M,"title",`${u(S).name??""} · ${Qe??""} s`),J=ft(M,"",J,{left:kt}),V(te,u(S).name)},[()=>C("timeline.marker",{name:u(S).name,time:(u(j)/r().fps).toFixed(2)}),()=>(u(j)/r().fps).toFixed(2),()=>`${l(u(j))??""}px`]),X("pointerdown",M,fe=>_(fe,u(S))),X("pointermove",M,y),X("pointerup",M,R),X("keydown",M,fe=>w(fe,u(S))),qr("focus",M,()=>r().selectedMarker={scene:u(S).scene,name:u(S).name}),Q(g,M)});var ee=k(L,2);let Z;gt(de,g=>n=g,()=>n),re((g,S,j,A,M,z,J,G,te,fe,Qe,kt,Jt,$t,Qt,er)=>{b(O,"aria-label",g),b(Y,"title",S),b(Y,"aria-label",j),b(ne,"title",A),b(ne,"aria-label",M),b(P,"title",z),b(P,"aria-label",J),V(D,r().playing?"❚❚":"▶"),b($,"title",G),b($,"aria-label",te),b(ue,"title",fe),b(ue,"aria-label",Qe),V(Ce,kt),V(Be,`${r().frame??""} / ${r().lastFrame??""}`),b(He,"title",Jt),b(de,"aria-label",$t),b(de,"aria-valuemax",r().lastFrame),b(de,"aria-valuenow",r().frame),b(de,"aria-valuetext",Qt),F=ft(T,"",F,{width:`${u(i)??""}px`}),Z=ft(ee,"",Z,{left:er})},[()=>C("timeline.label"),()=>C("transport.start"),()=>C("transport.start"),()=>C("transport.prev"),()=>C("transport.prev"),()=>r().playing?C("transport.pause"):C("transport.play"),()=>r().playing?C("transport.pause"):C("transport.play"),()=>C("transport.next"),()=>C("transport.next"),()=>C("transport.end"),()=>C("transport.end"),()=>Wr(r().frame,r().fps),()=>C("timeline.addMarker"),()=>C("timeline.label"),()=>Wr(r().frame,r().fps),()=>`${l(r().frame)??""}px`]),X("click",Y,()=>r().seek(0)),X("click",ne,()=>r().step(-1)),X("click",P,()=>r().togglePlay()),X("click",$,()=>r().step(1)),X("click",ue,()=>r().seek(r().lastFrame)),X("click",He,()=>r().markerAtPlayhead()),X("pointerdown",de,p),X("pointermove",de,h),X("pointerup",de,m),Ii(de,"clientWidth",g=>I(i,g)),Q(t,O),Je()}yt(["click","pointerdown","pointermove","pointerup","keydown"]);var fa=se('<span class="name"> </span>'),ca=se('<li role="treeitem"><button><span class="kind svelte-gu3dqx"> </span> <!> <span class="id svelte-gu3dqx"> </span></button></li>'),or=se('<p class="dim svelte-gu3dqx"> </p>'),ha=se('<span class="swatch svelte-gu3dqx"></span>'),da=se('<tr><th scope="row" class="svelte-gu3dqx"> </th><td class="svelte-gu3dqx"><!> </td></tr>'),va=se('<table data-testid="signals" class="svelte-gu3dqx"><tbody></tbody></table>'),pa=se('<label class="tunable svelte-gu3dqx"><span class="svelte-gu3dqx"> </span> <input type="range"/> <input type="number"/></label>'),ma=se('<button class="ease svelte-gu3dqx"><svg viewBox="-2 -2 28 28" width="28" height="28" aria-hidden="true" class="svelte-gu3dqx"><path fill="none" stroke="currentColor" stroke-width="2"></path></svg> <span> </span> <code class="svelte-gu3dqx"> </code></button>'),_a=se('<aside class="inspector svelte-gu3dqx"><section class="svelte-gu3dqx"><h2 class="svelte-gu3dqx"> </h2> <ul class="tree svelte-gu3dqx" role="tree" data-testid="tree"></ul></section> <section class="svelte-gu3dqx"><h2 class="svelte-gu3dqx"> </h2> <!></section> <section class="svelte-gu3dqx"><h2 class="svelte-gu3dqx"> </h2> <!> <!></section> <section class="svelte-gu3dqx"><h2 class="svelte-gu3dqx"> </h2> <!> <!></section></aside>');function ga(t,e){Ze(e,!0);let r=Ue(e,"editor",7);const n=ve(()=>{const x=new Map(r().tree.map(F=>[F.id,F])),T=F=>{let L=0,ee=F.parent;for(;ee!=null&&L<64;)L+=1,ee=x.get(ee)?.parent??null;return L};return r().tree.map(F=>({n:F,depth:T(F)}))}),s=ve(()=>Object.entries(r().metas).flatMap(([x,T])=>Object.entries(T.tunables??{}).map(([F,L])=>({scene:x,name:F,value:L})))),i=ve(()=>Object.entries(r().metas).flatMap(([x,T])=>Object.entries(T.eases??{}).map(([F,L])=>({scene:x,name:F,value:L}))));function a(x){const T=x===0?10:Math.abs(x)*2,F=x>=0?0:x-T,L=x>=0?Math.max(x*2,1):x+T;return[F,L,(L-F)/200]}const l=new Map;function o(x,T){clearTimeout(l.get(x)),l.set(x,setTimeout(()=>r().setTunable(x,T),60))}const f=new Map;function d(x,T){return f.has(x)||f.set(x,a(T)),f.get(x)}function v(x){const[T=0,F=0,L=1,ee=1]=x,Z=24;return`M0 ${Z} C${T*Z} ${Z-F*Z} ${L*Z} ${Z-ee*Z} ${Z} 0`}var p=_a(),h=W(p),m=W(h),E=B(m,!0),c=k(m,2);Ve(c,21,()=>u(n),({n:x,depth:T})=>x.id,(x,T)=>{let F=()=>u(T).n,L=()=>u(T).depth;var ee=ca(),Z=W(ee);let g,S;var j=W(Z),A=B(j,!0),M=k(j,2);{var z=te=>{var fe=fa(),Qe=B(fe,!0);re(()=>V(Qe,F().name)),Q(te,fe)};ye(M,te=>{F().name&&te(z)})}var J=k(M,2),G=B(J);re(()=>{b(ee,"aria-selected",r().selected===F().id),g=Gt(Z,1,"node svelte-gu3dqx",null,g,{sel:r().selected===F().id}),S=ft(Z,"",S,{"padding-left":`${8+L()*12}px`}),V(A,F().kind),V(G,`#${F().id??""}`)}),X("click",Z,()=>r().select(F().id===r().selected?null:F().id)),Q(x,ee)});var _=k(h,2),y=W(_),R=B(y,!0),w=k(y,2);{var O=x=>{var T=or(),F=B(T,!0);re(L=>V(F,L),[()=>C("inspector.noSelection")]),Q(x,T)},q=x=>{var T=va(),F=W(T);Ve(F,21,()=>r().signals,L=>L.name,(L,ee)=>{var Z=da(),g=W(Z),S=B(g,!0),j=k(g),A=W(j);{var M=G=>{var te=ha();let fe;re(()=>fe=ft(te,"",fe,{background:u(ee).value})),Q(G,te)},z=ve(()=>/^#[0-9a-f]{8}$/i.test(u(ee).value));ye(A,G=>{u(z)&&G(M)})}var J=k(A);re(()=>{V(S,u(ee).name),V(J,` ${u(ee).value??""}`)}),Q(L,Z)}),Q(x,T)};ye(w,x=>{r().selected===null?x(O):x(q,-1)})}var Y=k(_,2),ne=W(Y),P=B(ne,!0),D=k(ne,2);{var $=x=>{var T=or(),F=B(T,!0);re(L=>V(F,L),[()=>C("inspector.none")]),Q(x,T)};ye(D,x=>{u(s).length===0&&x($)})}var ue=k(D,2);Ve(ue,17,()=>u(s),x=>x.scene+x.name,(x,T)=>{const F=ve(()=>{const[j,A,M]=d(u(T).name,u(T).value);return{min:j,max:A,step:M}});var L=pa(),ee=W(L),Z=B(ee,!0),g=k(ee,2),S=k(g,2);re(()=>{V(Z,u(T).name),b(g,"min",u(F).min),b(g,"max",u(F).max),b(g,"step",u(F).step),Xr(g,u(T).value),b(g,"data-testid",`tunable-${u(T).name??""}`),b(S,"step",u(F).step),Xr(S,u(T).value),b(S,"aria-label",`${u(T).name??""} value`)}),X("input",g,j=>o(u(T).name,+j.currentTarget.value)),X("change",S,j=>r().setTunable(u(T).name,+j.currentTarget.value)),Q(x,L)});var Re=k(Y,2),Ce=W(Re),$e=B(Ce,!0),Be=k(Ce,2);{var He=x=>{var T=or(),F=B(T,!0);re(L=>V(F,L),[()=>C("inspector.none")]),Q(x,T)};ye(Be,x=>{u(i).length===0&&x(He)})}var de=k(Be,2);Ve(de,17,()=>u(i),x=>x.scene+x.name,(x,T)=>{var F=ma(),L=W(F),ee=B(L),Z=k(L,2),g=B(Z,!0),S=k(Z,2),j=B(S,!0);re((A,M)=>{b(F,"data-testid",`ease-${u(T).name??""}`),b(ee,"d",A),V(g,u(T).name),V(j,M)},[()=>v(u(T).value),()=>u(T).value.map(A=>A.toFixed(2)).join(", ")]),X("click",F,()=>r().editingEase={scene:u(T).scene,name:u(T).name}),Q(x,F)}),re((x,T,F,L)=>{V(E,x),V(R,T),V(P,F),V($e,L)},[()=>C("inspector.tree"),()=>C("inspector.signals"),()=>C("inspector.tunables"),()=>C("inspector.eases")]),Q(t,p),Je()}yt(["click","input","change"]);var ba=se('<span class="dim svelte-1qw5yfa"> </span>'),wa=se("<li><code> </code> </li>"),ya=se('<ul class="svelte-1qw5yfa"></ul>'),ka=se('<div class="overlay svelte-1qw5yfa" role="alert" data-testid="error-overlay"><header class="svelte-1qw5yfa"><strong class="svelte-1qw5yfa"> </strong> <!> <button class="svelte-1qw5yfa"> </button></header> <!> <pre class="svelte-1qw5yfa"> </pre></div>');function xa(t,e){Ze(e,!0);const r=ve(()=>e.editor.error),n=ve(()=>u(r).kind==="Build"?C("error.build"):u(r).kind==="Incompatible"?C("error.incompatible"):u(r).kind==="Meta"?C("error.meta"):C("error.runtime"));var s=ka(),i=W(s),a=W(i),l=B(a,!0),o=k(a,2);{var f=c=>{var _=ba(),y=B(_,!0);re(R=>V(y,R),[()=>C("error.previous")]),Q(c,_)};ye(o,c=>{u(r).kind==="Build"&&c(f)})}var d=k(o,2),v=B(d,!0),p=k(i,2);{var h=c=>{var _=ya();Ve(_,21,()=>u(r).spans,Mi,(y,R)=>{var w=wa(),O=W(w),q=B(O),Y=k(O);re(()=>{V(q,`${u(R).file??""}:${u(R).line??""}:${u(R).column??""}`),V(Y,` ${u(R).message??""}`)}),Q(y,w)}),Q(c,_)};ye(p,c=>{u(r).spans.length&&c(h)})}var m=k(p,2),E=B(m,!0);re(c=>{V(l,u(n)),V(v,c),V(E,u(r).message)},[()=>C("error.dismiss")]),X("click",d,()=>e.editor.dismissError()),Q(t,s),Je()}yt(["click"]);function Ma(t,e,r,n){const s=3*t,i=3*(r-t)-s,a=1-s-i,l=3*e,o=3*(n-e)-l,f=1-l-o,d=h=>((a*h+i)*h+s)*h,v=h=>((f*h+o)*h+l)*h,p=h=>(3*a*h+2*i)*h+s;return h=>{if(h<=0)return 0;if(h>=1)return 1;let m=h;for(let _=0;_<8;_++){const y=d(m)-h;if(Math.abs(y)<1e-7)return v(m);const R=p(m);if(Math.abs(R)<1e-6)break;m=Math.min(1,Math.max(0,m-y/R))}let E=0,c=1;m=h;for(let _=0;_<40;_++){const y=d(m);if(Math.abs(y-h)<1e-7)break;y<h?E=m:c=m,m=(E+c)/2}return v(m)}}const Kr={linear:[0,0,1,1],ease:[.25,.1,.25,1],"in-out-cubic":[.65,0,.35,1],"in-cubic":[.32,0,.67,0],"out-cubic":[.33,1,.68,1],"in-out-sine":[.37,0,.63,1],"in-out-expo":[.87,0,.13,1],"out-back":[.34,1.56,.64,1],"in-out-back":[.68,-.6,.32,1.6]};var Ea=pi('<circle r="8" class="handle svelte-12hhbkq" tabindex="0" role="slider"></circle>'),Sa=se("<option> </option>"),Ta=se('<div class="backdrop svelte-12hhbkq" role="presentation"></div> <div class="dialog svelte-12hhbkq" role="dialog" aria-modal="true" data-testid="curve-editor"><header class="svelte-12hhbkq"><strong> </strong> <button> </button></header> <svg role="group" class="svelte-12hhbkq"><rect class="unit svelte-12hhbkq"></rect><line class="arm svelte-12hhbkq"></line><line class="arm svelte-12hhbkq"></line><path class="curve svelte-12hhbkq"></path><circle r="4" class="fixed svelte-12hhbkq"></circle><circle r="4" class="fixed svelte-12hhbkq"></circle><!><circle r="5" class="dot svelte-12hhbkq"></circle></svg> <div class="row svelte-12hhbkq"><label> <select><option>—</option><!></select></label> <code class="svelte-12hhbkq"> </code></div></div>',1);function Aa(t,e){Ze(e,!0);let r=Ue(e,"editor",7);const n=ve(()=>r().editingEase),s=ve(()=>r().metas[u(n).scene]?.eases?.[u(n).name]??[.65,0,.35,1]);let i=ve(()=>[u(s)[0]??0,u(s)[1]??0,u(s)[2]??1,u(s)[3]??1]);const a=240,l=20,o=A=>l+A*a,f=A=>l+(1.5-A)*(a/2),d=(A,M)=>[Math.min(1,Math.max(0,(A-l)/a)),Math.min(1.5,Math.max(-.5,1.5-(M-l)/(a/2)))];let v,p=null,h;function m(){clearTimeout(h),h=setTimeout(()=>r().setEase(u(n).name,[...u(i)]),80)}function E(A){if(p===null)return;const M=v.getBoundingClientRect(),z=(l*2+a)/M.width,[J,G]=d((A.clientX-M.left)*z,(A.clientY-M.top)*z),te=[...u(i)];te[p*2]=Number(J.toFixed(3)),te[p*2+1]=Number(G.toFixed(3)),I(i,te),m()}function c(A,M){const z=A.shiftKey?.1:.01,G={ArrowLeft:[-z,0],ArrowRight:[z,0],ArrowUp:[0,z],ArrowDown:[0,-z]}[A.key];if(!G)return;A.preventDefault();const te=[...u(i)];te[M*2]=Math.min(1,Math.max(0,te[M*2]+G[0])),te[M*2+1]=Math.min(1.5,Math.max(-.5,te[M*2+1]+G[1])),I(i,te),m()}const _=ve(()=>`M${o(0)} ${f(0)} C${o(u(i)[0])} ${f(u(i)[1])} ${o(u(i)[2])} ${f(u(i)[3])} ${o(1)} ${f(1)}`);let y=N(0);Zt(()=>{let A=0;const M=performance.now(),z=J=>{const G=(J-M)/1400%1.4;I(y,Ma(...u(i))(Math.min(1,G)),!0),A=requestAnimationFrame(z)};return A=requestAnimationFrame(z),()=>cancelAnimationFrame(A)});var R=Ta(),w=Js(R),O=k(w,2),q=W(O),Y=W(q),ne=B(Y,!0),P=k(Y,2),D=B(P,!0),$=k(q,2);b($,"viewBox","0 0 280 280");var ue=W($);b(ue,"width",a),b(ue,"height",a/2);var Re=k(ue),Ce=k(Re),$e=k(Ce),Be=k($e),He=k(Be),de=k(He);Ve(de,16,()=>[0,1],A=>A,(A,M)=>{var z=Ea();re((J,G,te,fe)=>{b(z,"cx",J),b(z,"cy",G),b(z,"aria-label",`control point ${M+1}`),b(z,"aria-valuetext",`${te??""}, ${fe??""}`),b(z,"aria-valuenow",u(i)[M*2+1]),b(z,"data-testid",`handle-${M??""}`)},[()=>o(u(i)[M*2]),()=>f(u(i)[M*2+1]),()=>u(i)[M*2].toFixed(2),()=>u(i)[M*2+1].toFixed(2)]),X("pointerdown",z,J=>{p=M,v.setPointerCapture(J.pointerId)}),X("keydown",z,J=>c(J,M)),Q(A,z)});var x=k(de);b(x,"cy",a+l*2-6),gt($,A=>v=A,()=>v);var T=k($,2),F=W(T),L=W(F),ee=k(L),Z=W(ee);Z.value=Z.__value="";var g=k(Z);Ve(g,16,()=>Object.keys(Kr),A=>A,(A,M)=>{var z=Sa(),J=B(z,!0),G={};re(()=>{V(J,M),G!==(G=M)&&(z.value=(z.__value=G)??"")}),Q(A,z)});var S=k(F,2),j=B(S);re((A,M,z,J,G,te,fe,Qe,kt,Jt,$t,Qt,er,Gn,Zn,Jn,$n,Qn,es,ts)=>{b(O,"aria-label",A),V(ne,M),V(D,z),b(ue,"x",J),b(ue,"y",G),b(Re,"x1",te),b(Re,"y1",fe),b(Re,"x2",Qe),b(Re,"y2",kt),b(Ce,"x1",Jt),b(Ce,"y1",$t),b(Ce,"x2",Qt),b(Ce,"y2",er),b($e,"d",u(_)),b(Be,"cx",Gn),b(Be,"cy",Zn),b(He,"cx",Jn),b(He,"cy",$n),b(x,"cx",Qn),V(L,`${es??""} `),V(j,`[${ts??""}]`)},[()=>C("curve.title",{name:u(n).name}),()=>C("curve.title",{name:u(n).name}),()=>C("curve.close"),()=>o(0),()=>f(1),()=>o(0),()=>f(0),()=>o(u(i)[0]),()=>f(u(i)[1]),()=>o(1),()=>f(1),()=>o(u(i)[2]),()=>f(u(i)[3]),()=>o(0),()=>f(0),()=>o(1),()=>f(1),()=>o(u(y)),()=>C("curve.presets"),()=>u(i).map(A=>A.toFixed(2)).join(", ")]),X("click",w,()=>r().editingEase=null),X("click",P,()=>r().editingEase=null),X("pointermove",$,E),X("pointerup",$,()=>p=null),X("change",ee,A=>{const M=Kr[A.currentTarget.value];M&&(I(i,[...M]),m())}),Q(t,R),Je()}yt(["click","pointermove","pointerup","pointerdown","keydown","change"]);var Pa=se('<div data-testid="editor" tabindex="-1"><!> <main class="svelte-1ctqrjb"><section class="stage svelte-1ctqrjb"><!> <!></section> <!></main> <!> <!></div>');function Fa(t,e){Ze(e,!0);let r=Ue(e,"editor",7),n=Ue(e,"autostart",3,!0),s=Ue(e,"compact",3,!1),i=Ue(e,"scopedKeys",3,!1),a;function l(){try{const P=localStorage.getItem("oxframe-theme");if(P==="dark"||P==="light")return P}catch{}return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}let o=N(me(ot(()=>e.theme)??l()));function f(){I(o,u(o)==="dark"?"light":"dark",!0);try{localStorage.setItem("oxframe-theme",u(o))}catch{}}Zt(()=>{n()&&r().start()}),Ni(()=>{n()&&r().stop()});function d(P){const D=P.target;if(i()&&!a?.contains(document.activeElement)||D&&(D.closest("input, textarea, select, [contenteditable]")||D.isContentEditable)||D?.dataset.marker&&(P.key==="ArrowLeft"||P.key==="ArrowRight"))return;const $=P.shiftKey?10:1;switch(P.key){case" ":r().togglePlay();break;case"ArrowLeft":r().step(-$);break;case"ArrowRight":r().step($);break;case"Home":r().seek(0);break;case"End":r().seek(r().lastFrame);break;case"m":case"M":r().markerAtPlayhead();break;case"Escape":r().editingEase?r().editingEase=null:r().error?r().dismissError():r().selectedMarker=null;break;default:return}P.preventDefault()}var v=Pa();qr("keydown",pr,d);let p;var h=W(v);{var m=P=>{Ji(P,{get editor(){return r()},get theme(){return u(o)},onToggleTheme:f})};ye(h,P=>{s()||P(m)})}var E=k(h,2),c=W(E),_=W(c);ea(_,{get editor(){return r()}});var y=k(_,2);{var R=P=>{xa(P,{get editor(){return r()}})};ye(y,P=>{r().error&&P(R)})}var w=k(c,2);{var O=P=>{ga(P,{get editor(){return r()}})};ye(w,P=>{s()||P(O)})}var q=k(E,2);ua(q,{get editor(){return r()}});var Y=k(q,2);{var ne=P=>{Aa(P,{get editor(){return r()}})};ye(Y,P=>{r().editingEase&&P(ne)})}gt(v,P=>a=P,()=>a),re(P=>{p=Gt(v,1,"oxframe-editor svelte-1ctqrjb",null,p,{compact:s()}),b(v,"data-theme",u(o)),b(c,"aria-label",P)},[()=>C("viewport.label")]),Q(t,v),Je()}const Xn=new URLSearchParams(location.search),Un=window.__OXFRAME_CONFIG__??{},Ra=Xn.get("backend")??Un.backend??"ws",Wn=Ra==="mock"?new Hi:new Bi({url:Un.url??"/ws",token:Xn.get("token")??void 0}),Kn=new ia(Wn,{uiVersion:"0.1.0"});window.__oxframe={editor:Kn,backend:Wn};wi(Fa,{target:document.getElementById("app"),props:{editor:Kn}});