oxframe-cli 0.24.1

The `oxframe` command: create, preview with hot reload, render and check oxframe projects
1
2
3
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(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 r(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}})();const qr=!1;var Or=Array.isArray,Os=Array.prototype.indexOf,sn=Array.prototype.includes,Tn=Array.from,zr=Object.defineProperty,Ot=Object.getOwnPropertyDescriptor,zs=Object.getOwnPropertyDescriptors,Is=Object.prototype,Ds=Array.prototype,Ir=Object.getPrototypeOf,gr=Object.isExtensible;const Ls=()=>{};function Us(n){for(var e=0;e<n.length;e++)n[e]()}function Dr(){var n,e,t=new Promise((r,s)=>{n=r,e=s});return{promise:t,resolve:n,reject:e}}const Fe=2,Lt=4,Pn=8,Lr=1<<24,We=16,Ze=32,yt=64,jn=128,rr=256,Ge=512,ke=1024,be=2048,He=4096,qe=8192,Te=16384,Vt=32768,an=1<<25,Ut=65536,yn=1<<17,js=1<<18,Yt=1<<19,Bs=1<<20,et=1<<25,wn=1<<21,zt=1<<22,gt=1<<23,en=Symbol("$state"),Ur=Symbol("component"),Hs=Symbol("legacy props"),Vs=Symbol(""),jr=Symbol("attributes"),Bn=Symbol("class"),Hn=Symbol("style"),Vn=Symbol("text"),gn=Symbol("form reset"),fn=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Ys=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),Ws=1,Xs=2,Br=4,Ks=8,Gs=16,Zs=1,Js=4,Qs=8,ei=16,ti=1,ni=2,Hr={},we=Symbol("uninitialized"),ri="http://www.w3.org/1999/xhtml";function si(){console.warn("https://svelte.dev/e/derived_inert")}function ii(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Vr(n){return n===this.v}function ai(n,e){return n!=n?e==e:n!==e||n!==null&&typeof n=="object"||typeof n=="function"}function Yr(n){return!ai(n,this.v)}function Wr(n){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function oi(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function li(n,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function ci(n){throw new Error("https://svelte.dev/e/effect_in_teardown")}function ui(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function fi(n){throw new Error("https://svelte.dev/e/effect_orphan")}function di(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function hi(n){throw new Error("https://svelte.dev/e/props_invalid_value")}function vi(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function pi(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function mi(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function gi(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let _i=!1,Pe=null;function jt(n){Pe=n}function it(n,e=!1,t){Pe={p:Pe,i:!1,c:null,e:null,s:n,x:null,r:oe,l:null}}function at(n){var e=Pe,t=e.e;if(t!==null){e.e=null;for(var r of t)fs(r)}return e.i=!0,Pe=e.p,sr(n)}function sr(n={}){return zr(n,Ur,{value:!0}),n}function Xr(){return!0}let Mt=[];function Kr(){var n=Mt;Mt=[],Us(n)}function ut(n){if(Mt.length===0&&!tn){var e=Mt;queueMicrotask(()=>{e===Mt&&Kr()})}Mt.push(n)}function bi(){for(;Mt.length>0;)Kr()}const yi=-7169;function ge(n,e){n.f=n.f&yi|e}function ir(n){(n.f&Ge)!==0||n.deps===null?ge(n,ke):ge(n,He)}function Gr(n,e,t){(n.f&be)!==0?e.add(n):(n.f&He)!==0&&t.add(n),ge(n,ke)}let _r=!1;function wi(){_r||(_r=!0,document.addEventListener("reset",n=>{Promise.resolve().then(()=>{if(!n.defaultPrevented)for(const e of n.target.elements)e[gn]?.()})},{capture:!0}))}function Wt(n){var e=ie,t=oe;Ve(null),st(null);try{return n()}finally{Ve(e),st(t)}}function xi(n,e,t,r=t){n.addEventListener(e,()=>Wt(t));const s=n[gn];s?n[gn]=()=>{s(),r(!0)}:n[gn]=()=>r(!0),wi()}function ki(n,e,t,r){const s=on;var i=n.filter(f=>!f.settled),o=e.map(s);if(t.length===0&&i.length===0){r(o);return}var c=oe,l=Mi(),u=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(f=>f.promise)):null;function h(f){if((c.f&Te)===0){l();try{r([...o,...f])}catch(m){Qe(m,c)}xn()}}var d=Zr();if(t.length===0){u.then(()=>h([])).finally(d);return}function v(){Promise.all(t.map(f=>Ei(f))).then(h).catch(f=>Qe(f,c)).finally(d)}u?u.then(()=>{if((c.f&Te)!==0){d();return}l(),v(),xn()}):v()}function Mi(){var n=oe,e=ie,t=Pe,r=ne;return function(i=!0){st(n),Ve(e),jt(t),i&&(n.f&Te)===0&&(r?.activate(),r?.apply())}}function xn(n=!0){st(null),Ve(null),jt(null),n&&ne?.deactivate()}function Zr(){var n=oe,e=n.b,t=ne,r=!!e?.is_rendered();return e?.update_pending_count(1,t),t.increment(r,n),()=>{e?.update_pending_count(-1,t),t.decrement(r,n)}}function on(n){var e=Fe|be;return oe!==null&&(oe.f|=Yt),{ctx:Pe,deps:null,effects:null,equals:Vr,f:e,fn:n,reactions:null,rv:0,v:we,wv:0,parent:oe,ac:null}}const Zt=Symbol("obsolete");function Ei(n,e,t){let r=oe;r===null&&oi();var s=void 0,i=Tt(we),o=!ie,c=new Set;return Li(()=>{var l=oe,u=Dr();s=u.promise;try{Promise.resolve(n()).then(u.resolve,f=>{f!==fn&&u.reject(f)}).finally(xn)}catch(f){u.reject(f),xn()}var h=ne;if(o){if((l.f&Vt)!==0)var d=Zr();if(r.b?.is_rendered())h.async_deriveds.get(l)?.reject(Zt);else for(const f of c.values())f.reject(Zt);c.add(u),h.async_deriveds.set(l,u)}const v=(f,m=void 0)=>{d?.(),c.delete(u),m!==Zt&&(h.activate(),m?(i.f|=gt,Bt(i,m)):((i.f&gt)!==0&&(i.f^=gt),Bt(i,f)),h.deactivate())};u.promise.then(v,f=>v(null,f||"unknown"))}),us(()=>{for(const l of c)l.reject(Zt)}),new Promise(l=>{function u(h){function d(){h===s?l(i):u(s)}h.then(d,d)}u(s)})}function de(n){const e=on(n);return gs(e),e}function Jr(n){const e=on(n);return e.equals=Yr,e}function Si(n){var e=n.effects;if(e!==null){n.effects=null;for(var t=0;t<e.length;t+=1)Le(e[t])}}function ar(n){var e,t=oe,r=n.parent;if(!ht&&r!==null&&n.v!==we&&(r.f&(Te|qe))!==0)return si(),n.v;st(r);try{Si(n),e=ws(n)}finally{st(t)}return e}function Qr(n){var e=ar(n);if(!n.equals(e)&&(n.wv=bs(),(!ne?.is_fork||n.deps===null)&&(ne!==null?(ne.capture(n,e,!0),It?.capture(n,e,!0)):n.v=e,n.deps===null))){ge(n,ke);return}ht||(Xe!==null?(cr()||ne?.is_fork)&&Xe.set(n,e):ir(n))}function Ai(n){if(n.effects!==null)for(const e of n.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&Wt(()=>{e.ac.abort(fn),e.ac=null}),e.fn!==null&&(e.teardown=Ls),un(e,0),dr(e))}function es(n){if(n.effects!==null)for(const e of n.effects)e.teardown&&e.fn!==null&&Ht(e)}let Cn=null,Nt=null,ne=null,It=null,Xe=null,Yn=null,tn=!1,Fn=!1,nn=null,_n=null;var br=0;let Ti=1;class wt{id=Ti++;#e=!1;linked=!0;#s=null;#t=null;async_deriveds=new Map;current=new Map;previous=new Map;#o=new Set;#r=new Set;#a=0;#n=new Map;#l=null;#i=[];#m=[];#c=new Set;#u=new Set;#d=new Map;#g=new Set;is_fork=!1;#f=!1;constructor(){Nt===null?Cn=Nt=this:(Nt.#t=this,this.#s=Nt),Nt=this}#w(){if(this.is_fork)return!0;for(const r of this.#n.keys()){for(var e=r,t=!1;e.parent!==null;){if(this.#d.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#d.has(e)||this.#d.set(e,{d:[],m:[]}),this.#g.delete(e)}unskip_effect(e,t=r=>this.schedule(r)){var r=this.#d.get(e);if(r){this.#d.delete(e);for(var s of r.d)ge(s,be),t(s);for(s of r.m)ge(s,He),t(s)}this.#g.add(e)}#x(){var e=[];for(const i of this.#i)if(!((i.f&Te)!==0||(i.f&(be|He))===0)){for(var t=i,r=!1;t.parent!==null;){t=t.parent;var s=t.f;if((s&(yt|Ze))!==0){if((s&ke)===0){r=!0;break}t.f^=ke}}r||e.push(t)}return this.#i=[],e}#_(){this.#e=!0;for(const c of this.#c)this.#u.delete(c),ge(c,be),this.schedule(c);for(const c of this.#u)ge(c,He),this.schedule(c);this.apply();for(var e=nn=[],t=[],r=_n=[];this.#i.length>0;){br++>1e3&&(this.#p(),Ci());for(const c of this.#x())try{this.#b(c,e,t)}catch(l){throw rs(c),this.#w()||this.discard(),l}}if(ne=null,r.length>0){var s=wt.ensure();for(const c of r)s.schedule(c)}if(nn=null,_n=null,this.#w()){this.#v(t),this.#v(e);for(const[c,l]of this.#d)ns(c,l);r.length>0&&ne.#_();return}const i=this.#h();if(i){this.#v(t),this.#v(e),i.#k(this);return}this.#c.clear(),this.#u.clear();for(const c of this.#o)c(this);this.#o.clear(),It=this,yr(t),yr(e),It=null,this.#l?.resolve();var o=ne;if(this.#a===0&&(this.#i.length===0||o!==null)&&this.#p(),this.#i.length>0)if(o!==null){for(const c of this.#i)o.#i.push(c);this.#i=[]}else o=this;o!==null&&(nt.clear(),o.#_())}#b(e,t,r){e.f^=ke;for(var s=e.first;s!==null;){var i=s.f,o=(i&(Ze|yt))!==0,c=o&&(i&ke)!==0,l=c||(i&qe)!==0||this.#d.has(s);if(!l&&s.fn!==null){o?s.f^=ke:(i&Lt)!==0?t.push(s):hn(s)&&((i&We)!==0&&this.#u.add(s),Ht(s));var u=s.first;if(u!==null){s=u;continue}}for(;s!==null;){var h=s.next;if(h!==null){s=h;break}s=s.parent}}}#h(){for(var e=this.#s;e!==null;){if(!e.is_fork){for(const[t,[,r]]of this.current)if(e.current.has(t)&&!r)return e}e=e.#s}return null}#k(e){for(const[r,s]of e.current)!this.previous.has(r)&&e.previous.has(r)&&this.previous.set(r,e.previous.get(r)),this.current.set(r,s);for(const[r,s]of e.async_deriveds){const i=this.async_deriveds.get(r);i&&s.promise.then(i.resolve).catch(i.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#c,e.#u);const t=r=>{var s=r.reactions;if(s!==null&&!((r.f&Fe)!==0&&(r.f&(be|He))===0))for(const c of s){var i=c.f;if((i&Fe)!==0)t(c);else{var o=c;i&(zt|We)&&!this.async_deriveds.has(o)&&(this.#u.delete(o),ge(o,be),this.schedule(o))}}};for(const r of this.current.keys())t(r);this.oncommit(()=>e.discard()),e.#p(),ne=this,this.#_()}#v(e){for(var t=0;t<e.length;t+=1)Gr(e[t],this.#c,this.#u)}capture(e,t,r=!1){e.v!==we&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&gt)===0&&(this.current.set(e,[t,r]),Xe?.set(e,t)),this.is_fork||(e.v=t)}activate(){ne=this}deactivate(){ne=null,Xe=null}flush(){try{Fn=!0,ne=this,this.#_()}finally{br=0,Yn=null,nn=null,_n=null,Fn=!1,ne=null,Xe=null,nt.clear()}}discard(){for(const e of this.#r)e(this);this.#r.clear();for(const e of this.async_deriveds.values())e.reject(Zt);this.#p(),this.#l?.resolve()}register_created_effect(e){this.#m.push(e)}#y(){for(let d=Cn;d!==null;d=d.#t){var e=d.id<this.id,t=[];for(const[v,[f,m]]of this.current){if(d.current.has(v)){var r=d.current.get(v)[0];if(e&&f!==r)d.current.set(v,[f,m]);else continue}t.push(v)}if(e)for(const[v,f]of this.async_deriveds){const m=d.async_deriveds.get(v);m&&f.promise.then(m.resolve).catch(m.reject)}var s=[...d.current.keys()].filter(v=>!d.current.get(v)[1]);if(!(!d.#e||s.length===0)){var i=s.filter(v=>!this.current.has(v));if(i.length===0)e&&d.discard();else if(t.length>0){if(e)for(const v of this.#g)d.unskip_effect(v,f=>{(f.f&(We|zt))!==0?d.schedule(f):d.#v([f])});d.activate();var o=new Set,c=new Map;for(var l of t)ts(l,i,o,c);c=new Map;var u=[...d.current].filter(([v,f])=>{const m=this.current.get(v);return m?m[0]!==f[0]||m[1]!==f[1]:!0}).map(([v])=>v);if(u.length>0)for(const v of this.#m)(v.f&(Te|qe|yn))===0&&or(v,u,c)&&((v.f&(zt|We))!==0?(ge(v,be),d.schedule(v)):d.#c.add(v));if(d.#i.length>0&&!d.#f){d.apply();for(var h of d.#x())d.#b(h,[],[])}d.deactivate()}}}}increment(e,t){if(this.#a+=1,e){let r=this.#n.get(t)??0;this.#n.set(t,r+1)}}decrement(e,t){if(this.#a-=1,e){let r=this.#n.get(t)??0;r===1?this.#n.delete(t):this.#n.set(t,r-1)}this.#f||(this.#f=!0,ut(()=>{this.#f=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(const r of e)this.#c.add(r);for(const r of t)this.#u.add(r);e.clear(),t.clear()}oncommit(e){this.#o.add(e)}ondiscard(e){this.#r.add(e)}settled(){return(this.#l??=Dr()).promise}static ensure(){if(ne===null){const e=ne=new wt;!Fn&&!tn&&ut(()=>{e.#e||e.flush()})}return ne}apply(){{Xe=null;return}}schedule(e){if(Yn=e,e.b?.is_pending&&(e.f&(Lt|Pn|Lr))!==0&&(e.f&Vt)===0){e.b.defer_effect(e);return}this.#i.push(e)}#p(){if(this.linked){var e=this.#s,t=this.#t;e===null?Cn=t:e.#t=t,t===null?Nt=e:t.#s=e,this.linked=!1}}}function Pi(n){var e=tn,t=It;It=null,tn=!0;try{for(var r;;){if(bi(),ne===null)return r;ne.flush()}}finally{tn=e,It=t}}function Ci(){try{di()}catch(n){Qe(n,Yn)}}let ct=null;function yr(n){var e=n.length;if(e!==0){for(var t=0;t<e;){var r=n[t++];if((r.f&(Te|qe))===0&&hn(r)&&(ct=new Set,Ht(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&vs(r),ct?.size>0)){nt.clear();for(const s of ct){if((s.f&(Te|qe))!==0)continue;const i=[s];let o=s.parent;for(;o!==null;)ct.has(o)&&(ct.delete(o),i.push(o)),o=o.parent;for(let c=i.length-1;c>=0;c--){const l=i[c];(l.f&(Te|qe))===0&&Ht(l)}}ct.clear()}}ct=null}}function ts(n,e,t,r){if(!t.has(n)&&(t.add(n),n.reactions!==null))for(const s of n.reactions){const i=s.f;(i&Fe)!==0?ts(s,e,t,r):(i&(zt|We))!==0&&(i&be)===0&&or(s,e,r)&&(ge(s,be),lr(s))}}function or(n,e,t){const r=t.get(n);if(r!==void 0)return r;if(n.deps!==null)for(const s of n.deps){if(sn.call(e,s))return!0;if((s.f&Fe)!==0&&or(s,e,t))return t.set(s,!0),!0}return t.set(n,!1),!1}function lr(n){ne.schedule(n)}function ns(n,e){if(!((n.f&Ze)!==0&&(n.f&ke)!==0)){(n.f&be)!==0?e.d.push(n):(n.f&He)!==0&&e.m.push(n),ge(n,ke);for(var t=n.first;t!==null;)ns(t,e),t=t.next}}function rs(n){ge(n,ke);for(var e=n.first;e!==null;)rs(e),e=e.next}let kn=new Set;const nt=new Map;let ss=!1;function Tt(n,e){var t={f:0,v:n,reactions:null,equals:Vr,rv:0,wv:0};return t}function D(n,e){const t=Tt(n);return gs(t),t}function Fi(n,e=!1,t=!0){const r=Tt(n);return e||(r.equals=Yr),r}function C(n,e,t=!1){ie!==null&&(!Ke||(ie.f&yn)!==0)&&Xr()&&(ie.f&(Fe|We|zt|yn))!==0&&(rt===null||!rt.has(n))&&mi();let r=t?xe(e):e;return Bt(n,r,_n)}var kt=null,Wn=0;function Bt(n,e,t=null){if(!n.equals(e)){ht?nt.set(n,e):nt.has(n)||nt.set(n,n.v);var r=wt.ensure();if(r.capture(n,e),(n.f&Fe)!==0){const s=n;(n.f&be)!==0&&ar(s),Xe===null&&ir(s)}n.wv=bs(),kt=null,Wn=0,is(n,be,t),kt=null,oe!==null&&(oe.f&ke)!==0&&(oe.f&(Ze|yt))===0&&(je===null?Bi([n]):je.push(n)),!r.is_fork&&kn.size>0&&!ss&&Ri()}return e}function Ri(){ss=!1;for(const n of kn){(n.f&ke)!==0&&ge(n,He);let e;try{e=hn(n)}catch{e=!0}e&&Ht(n)}kn.clear()}function rn(n){C(n,n.v+1)}function is(n,e,t){var r=n.reactions;if(r!==null){var s=r.length;if(Wn+=s,Wn>1e5&&kt===null&&(kt=new Set),kt!==null){if(kt.has(n))return;kt.add(n)}for(var i=0;i<s;i++){var o=r[i],c=o.f,l=(c&be)===0;if(l&&ge(o,e),(c&yn)!==0)kn.add(o);else if((c&Fe)!==0){var u=o;Xe?.delete(u),is(u,He,t)}else if(l){var h=o;(c&We)!==0&&ct!==null&&ct.add(h),t!==null?t.push(h):lr(h)}}}}function xe(n){if(typeof n!="object"||n===null||en in n||Ur in n)return n;const e=Ir(n);if(e!==Is&&e!==Ds)return n;var t=new Map,r=Or(n),s=D(0),i=At,o=c=>{if(At===i)return c();var l=ie,u=At;Ve(null),xr(i);var h=c();return Ve(l),xr(u),h};return r&&t.set("length",D(n.length)),new Proxy(n,{defineProperty(c,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&vi();var h=t.get(l);return h===void 0?o(()=>{var d=D(u.value);return t.set(l,d),d}):C(h,u.value,!0),!0},deleteProperty(c,l){var u=t.get(l);if(u===void 0){if(l in c){const h=o(()=>D(we));t.set(l,h),rn(s)}}else C(u,we),rn(s);return!0},get(c,l,u){if(l===en)return n;var h=t.get(l),d=l in c;if(h===void 0&&(!d||Ot(c,l)?.writable)&&(h=o(()=>{var f=xe(d?c[l]:we),m=D(f);return m}),t.set(l,h)),h!==void 0){var v=a(h);return v===we?void 0:v}return Reflect.get(c,l,u)},getOwnPropertyDescriptor(c,l){this.has?.(c,l);var u=Reflect.getOwnPropertyDescriptor(c,l),h=t.get(l);if(h!==void 0){var d=a(h);if(d===we)return;if(u&&"value"in u)u.value=d;else return{enumerable:!0,configurable:!0,value:d,writable:!0}}return u},has(c,l){if(l===en)return!0;var u=t.get(l),h=u!==void 0&&u.v!==we||Reflect.has(c,l);if(u!==void 0||oe!==null&&(!h||Ot(c,l)?.writable)){u===void 0&&(u=o(()=>{var v=h?xe(c[l]):we,f=D(v);return f}),t.set(l,u));var d=a(u);if(d===we)return!1}return h},set(c,l,u,h){var d=t.get(l),v=l in c;if(r&&l==="length")for(var f=u;f<d.v;f+=1){var m=t.get(f+"");m!==void 0?C(m,we):f in c&&(m=o(()=>D(we)),t.set(f+"",m))}if(d===void 0)(!v||Ot(c,l)?.writable)&&(d=o(()=>D(void 0)),C(d,xe(u)),t.set(l,d));else{v=d.v!==we;var q=o(()=>xe(u));C(d,q)}var b=Reflect.getOwnPropertyDescriptor(c,l);if(b?.set&&b.set.call(h,u),!v){if(r&&typeof l=="string"){var M=t.get("length"),N=Number(l);Number.isInteger(N)&&N>=M.v&&C(M,N+1)}rn(s)}return!0},ownKeys(c){a(s);var l=Reflect.ownKeys(c).filter(d=>{var v=t.get(d);return v===void 0||v.v!==we});for(var[u,h]of t)h.v!==we&&!(u in c)&&l.push(u);return l},setPrototypeOf(){pi()}})}var ln,as,os,ls;function Ni(){if(ln===void 0){ln=window,as=/Firefox/.test(navigator.userAgent);var n=Element.prototype,e=Node.prototype,t=Text.prototype;os=Ot(e,"firstChild").get,ls=Ot(e,"nextSibling").get,gr(n)&&(n[Bn]=void 0,n[jr]=null,n[Hn]=void 0,n.__e=void 0),gr(t)&&(t[Vn]=void 0)}}function _t(n=""){return document.createTextNode(n)}function Pt(n){return os.call(n)}function dn(n){return ls.call(n)}function V(n,e){return Pt(n)}function cn(n,e=!1){{var t=Pt(n);return t instanceof Comment&&t.data===""?dn(t):t}}function Y(n,e=!1){return Pt(n)}function _(n,e=1,t=!1){let r=n;for(;e--;)r=dn(r);return r}function $i(n){n.textContent=""}function cs(){return!1}function qi(n,e,t){return t?document.createElement(n,{is:t}):document.createElement(n)}function Oi(n){var e=oe;if(e===null)return ie.f|=gt,n;if((e.f&Vt)===0&&(e.f&Lt)===0)throw n;Qe(n,e)}function Qe(n,e){if(n===Hr)throw n;if(!(e!==null&&(e.f&Te)!==0)){for(;e!==null;){if((e.f&jn)!==0&&(e.f&(Te|an))===0){if((e.f&Vt)===0)throw n;try{e.b.error(n);return}catch(t){n=t}}e=e.parent}throw n}}function zi(n){oe===null&&(ie===null&&fi(),ui()),ht&&ci()}function Ii(n,e){var t=e.last;t===null?e.last=e.first=n:(t.next=n,n.prev=t,e.last=n)}function vt(n,e){var t=oe;t!==null&&(t.f&qe)!==0&&(n|=qe);var r={ctx:Pe,deps:null,nodes:null,f:n|be|Ge,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};ne?.register_created_effect(r);var s=r;if((n&Lt)!==0)nn!==null?nn.push(r):wt.ensure().schedule(r);else if(e!==null){try{Ht(r)}catch(o){throw Le(r),o}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&Yt)===0&&(s=s.first,(n&We)!==0&&(n&Ut)!==0&&s!==null&&(s.f|=Ut))}if(s!==null&&(s.parent=t,t!==null&&Ii(s,t),ie!==null&&(ie.f&Fe)!==0&&(n&yt)===0)){var i=ie;(i.effects??=[]).push(s)}return r}function cr(){return ie!==null&&!Ke}function us(n){const e=vt(Pn,null);return ge(e,ke),e.teardown=n,e}function bt(n){zi();var e=oe.f,t=!ie&&(e&Ze)!==0&&Pe!==null&&!Pe.i;if(t){var r=Pe;(r.e??=[]).push(n)}else return fs(n)}function fs(n){return vt(Lt|Bs,n)}function Di(n){wt.ensure();const e=vt(yt|Yt,n);return(t={})=>new Promise(r=>{t.outro?St(e,()=>{Le(e),r(void 0)}):(Le(e),r(void 0))})}function ds(n){return vt(Lt,n)}function Li(n){return vt(zt|Yt,n)}function ur(n,e=0){return vt(Pn|e,n)}function Q(n,e=[],t=[],r=[]){ki(r,e,t,s=>{vt(Pn,()=>{n(...s.map(a))})})}function fr(n,e=0){var t=vt(We|e,n);return t}function Be(n){return vt(Ze|Yt,n)}function hs(n){var e=n.teardown;if(e!==null){const t=ht,r=ie;wr(!0),Ve(null);try{e.call(null)}catch(s){Qe(s,n.parent)}finally{wr(t),Ve(r)}}}function dr(n,e=!1){var t=n.first;for(n.first=n.last=null;t!==null;){const s=t.ac;s!==null&&Wt(()=>{s.abort(fn)});var r=t.next;(t.f&yt)!==0?t.parent=null:Le(t,e),t=r}}function Ui(n){for(var e=n.first;e!==null;){var t=e.next;(e.f&Ze)===0&&Le(e),e=t}}function Le(n,e=!0){var t=!1;(e||(n.f&js)!==0)&&n.nodes!==null&&n.nodes.end!==null&&(ji(n.nodes.start,n.nodes.end),t=!0),n.f|=an,dr(n,e&&!t),un(n,0);var r=n.nodes&&n.nodes.t;if(r!==null)for(const i of r)i.stop();hs(n),n.f^=an,n.f|=Te;var s=n.parent;s!==null&&s.first!==null&&vs(n),n.next=n.prev=n.teardown=n.ctx=n.deps=n.fn=n.nodes=n.ac=n.b=null}function ji(n,e){for(;n!==null;){var t=n===e?null:dn(n);n.remove(),n=t}}function vs(n){var e=n.parent,t=n.prev,r=n.next;t!==null&&(t.next=r),r!==null&&(r.prev=t),e!==null&&(e.first===n&&(e.first=r),e.last===n&&(e.last=t))}function St(n,e,t=!0){var r=[];n.f|=rr,ps(n,r,!0);var s=()=>{t&&Le(n),e&&e()},i=r.length;if(i>0){var o=()=>--i||s();for(var c of r)c.out(o)}else s()}function ps(n,e,t){if((n.f&qe)===0){n.f^=qe;var r=n.nodes&&n.nodes.t;if(r!==null)for(const c of r)(c.is_global||t)&&e.push(c);for(var s=n.first;s!==null;){var i=s.next;if((s.f&yt)===0){var o=(s.f&Ut)!==0||(s.f&Ze)!==0&&(n.f&We)!==0;ps(s,e,o?t:!1)}s=i}}}function Mn(n){n.f&=~rr,ms(n,!0)}function ms(n,e){if((n.f&rr)===0&&(n.f&qe)!==0){n.f^=qe,(n.f&ke)===0&&(ge(n,be),wt.ensure().schedule(n));for(var t=n.first;t!==null;){var r=t.next,s=(t.f&Ut)!==0||(t.f&Ze)!==0;ms(t,s?e:!1),t=r}var i=n.nodes&&n.nodes.t;if(i!==null)for(const o of i)(o.is_global||e)&&o.in()}}function hr(n,e){if(n.nodes)for(var t=n.nodes.start,r=n.nodes.end;t!==null;){var s=t===r?null:dn(t);e.append(t),t=s}}let ht=!1;function wr(n){ht=n}let ie=null,Ke=!1;function Ve(n){ie=n}let oe=null;function st(n){oe=n}let rt=null;function gs(n){ie!==null&&((ie.f&wn)!==0||(ie.f&Fe)!==0)&&(rt??=new Set).add(n)}let Ie=null,Ue=0,je=null;function Bi(n){je=n}let _s=1,Et=0,At=Et;function xr(n){At=n}function bs(){return++_s}function hn(n){var e=n.f;if((e&be)!==0)return!0;if((e&He)!==0){for(var t=n.deps,r=t.length,s=0;s<r;s++){var i=t[s];if(hn(i)&&Qr(i),i.wv>n.wv)return!0}(e&Ge)!==0&&Xe===null&&ge(n,ke)}return!1}function ys(n,e,t=!0){var r=n.reactions;if(r!==null&&!(rt!==null&&rt.has(n)))for(var s=0;s<r.length;s++){var i=r[s];(i.f&Fe)!==0?ys(i,e,!1):e===i&&(t?ge(i,be):(i.f&ke)!==0&&ge(i,He),lr(i))}}function ws(n){var e=Ie,t=Ue,r=je,s=ie,i=rt,o=Pe,c=Ke,l=At,u=n.f;Ie=null,Ue=0,je=null,ie=(u&(Ze|yt))===0?n:null,rt=null,jt(n.ctx),Ke=!1,At=++Et,n.ac!==null&&(Wt(()=>{n.ac.abort(fn)}),n.ac=null);try{n.f|=wn;var h=n.fn,d=h();n.f|=Vt;var v=kr(n);if(Xr()&&je!==null&&!Ke&&v!==null&&(n.f&(Fe|He|be))===0)for(var f=0;f<je.length;f++)ys(je[f],n);if(s!==null&&s!==n){if(Et++,s.deps!==null)for(let m=0;m<t;m+=1)s.deps[m].rv=Et;if(e!==null)for(const m of e)m.rv=Et;je!==null&&(r===null?r=je:r.push(...je))}return(n.f&gt)!==0&&(n.f^=gt),d}catch(m){return kr(n),Oi(m)}finally{n.f^=wn,Ie=e,Ue=t,je=r,ie=s,rt=i,jt(o),Ke=c,At=l}}function kr(n){var e=n.deps,t=ne?.is_fork;if(Ie!==null){var r;if(t||un(n,Ue),e!==null&&Ue>0)for(e.length=Ue+Ie.length,r=0;r<Ie.length;r++)e[Ue+r]=Ie[r];else n.deps=e=Ie;if(cr()&&(n.f&Ge)!==0)for(r=Ue;r<e.length;r++)(e[r].reactions??=[]).push(n)}else!t&&e!==null&&Ue<e.length&&(un(n,Ue),e.length=Ue);return e}function Hi(n,e){let t=e.reactions;if(t!==null){var r=Os.call(t,n);if(r!==-1){var s=t.length-1;s===0?t=e.reactions=null:(t[r]=t[s],t.pop())}}if(t===null&&(e.f&Fe)!==0&&(Ie===null||!sn.call(Ie,e))){var i=e;(i.f&Ge)!==0&&(i.f^=Ge),i.v!==we&&ir(i),i.ac!==null&&Wt(()=>{i.ac.abort(fn),i.ac=null,ge(i,be)}),Ai(i),un(i,0)}}function un(n,e){var t=n.deps;if(t!==null)for(var r=e;r<t.length;r++)Hi(n,t[r])}function Ht(n){var e=n.f;if((e&Te)===0){ge(n,ke);var t=oe;oe=n;try{(e&(We|Lr))!==0?Ui(n):dr(n),hs(n);var r=ws(n);n.teardown=typeof r=="function"?r:null,n.wv=_s;var s;qr&&_i&&(n.f&be)!==0&&n.deps}finally{oe=t}}}async function Vi(){await Promise.resolve(),Pi()}function a(n){var e=n.f,t=(e&Fe)!==0;if(ie!==null&&!Ke){var r=oe!==null&&(oe.f&Te)!==0;if(!r&&(rt===null||!rt.has(n))){var s=ie.deps;if((ie.f&wn)!==0)n.rv<Et&&(n.rv=Et,Ie===null&&s!==null&&s[Ue]===n?Ue++:Ie===null?Ie=[n]:Ie.push(n));else{ie.deps??=[],sn.call(ie.deps,n)||ie.deps.push(n);var i=n.reactions;i===null?n.reactions=[ie]:sn.call(i,ie)||i.push(ie)}}}if(ht&&nt.has(n))return nt.get(n);if(t){var o=n;if(ht){var c=o.v;return((o.f&ke)===0&&o.reactions!==null||ks(o))&&(c=ar(o)),nt.set(o,c),c}var l=(o.f&Ge)===0&&!Ke&&ie!==null&&(ie.f&Ge)!==0,u=(o.f&Vt)===0;hn(o)&&(l&&(o.f|=Ge),Qr(o)),l&&!u&&(es(o),xs(o))}if(Xe?.has(n))return Xe.get(n);if((n.f&gt)!==0)throw n.v;return n.v}function xs(n){if(n.f|=Ge,n.deps!==null)for(const t of n.deps){var e=t.reactions;e===null?t.reactions=[n]:sn.call(e,n)||e.push(n),(t.f&Fe)!==0&&(t.f&Ge)===0&&(es(t),xs(t))}}function ks(n){if(n.v===we)return!0;if(n.deps===null)return!1;for(const e of n.deps)if(nt.has(e)||(e.f&Fe)!==0&&ks(e))return!0;return!1}function pt(n){var e=Ke;try{return Ke=!0,n()}finally{Ke=e}}const Yi=["touchstart","touchmove"];function Wi(n){return Yi.includes(n)}const Jt=Symbol("events"),Ms=new Set,Xn=new Set;function Xi(n,e,t,r={}){function s(i){if(r.capture||Kn.call(e,i),!i.cancelBubble)return Wt(()=>t?.call(this,i))}return n.startsWith("pointer")||n.startsWith("touch")||n==="wheel"?(s.__removed=!1,ut(()=>{s.__removed||e.addEventListener(n,s,r)})):e.addEventListener(n,s,r),s}function Ct(n,e,t,r,s){var i={capture:r,passive:s},o=Xi(n,e,t,i);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&us(()=>{o.__removed=!0,e.removeEventListener(n,o,i)})}function H(n,e,t){(e[Jt]??={})[n]=t}function xt(n){for(var e=0;e<n.length;e++)Ms.add(n[e]);for(var t of Xn)t(n)}let Rn=null,Nn=!1;function Kn(n){var e=this,t=e.ownerDocument,r=n.type,s=n.composedPath?.()||[],i=s[0]||n.target;Rn=n,Nn||(Nn=!0,setTimeout(()=>{Nn=!1,Rn=null}));var o=0,c=Rn===n&&n[Jt];if(c){var l=s.indexOf(c);if(l!==-1&&(e===document||e===window)){n[Jt]=e;return}var u=s.indexOf(e);if(u===-1)return;l<=u&&(o=l)}if(i=s[o]||n.target,i!==e){zr(n,"currentTarget",{configurable:!0,get(){return i||t}});var h=ie,d=oe;Ve(null),st(null);try{for(var v,f=[];i!==null&&i!==e;){try{var m=i[Jt]?.[r];m!=null&&(!i.disabled||n.target===i)&&m.call(i,n)}catch(q){v?f.push(q):v=q}if(n.cancelBubble)break;o++,i=o<s.length?s[o]:null}if(v){for(let q of f)queueMicrotask(()=>{throw q});throw v}}finally{n[Jt]=e,delete n.currentTarget,Ve(h),st(d)}}}const Ki=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:n=>n});function Gi(n){return Ki?.createHTML(n)??n}function Es(n){var e=qi("template");return e.innerHTML=Gi(n.replaceAll("<!>","<!---->")),e.content}function En(n,e){var t=oe;t.nodes===null&&(t.nodes={start:n,end:e,a:null,t:null})}function K(n,e){var t=(e&ti)!==0,r=(e&ni)!==0,s,i=!n.startsWith("<!>");return()=>{s===void 0&&(s=Es(i?n:"<!>"+n),t||(s=Pt(s)));var o=r||as?document.importNode(s,!0):s.cloneNode(!0);if(t){var c=Pt(o),l=o.lastChild;En(c,l)}else En(o,o);return o}}function Zi(n,e,t="svg"){var r=!n.startsWith("<!>"),s=`<${t}>${r?n:"<!>"+n}</${t}>`,i;return()=>{if(!i){var o=Es(s),c=Pt(o);i=Pt(c)}var l=i.cloneNode(!0);return En(l,l),l}}function vr(n,e){return Zi(n,e,"svg")}function Gn(n=""){{var e=_t(n+"");return En(e,e),e}}function U(n,e){n!==null&&n.before(e)}function Ji(n){let e=0,t=Tt(0),r;return()=>{cr()&&(a(t),ur(()=>(e===0&&(r=pt(()=>n(()=>rn(t)))),e+=1,()=>{ut(()=>{e-=1,e===0&&(r?.(),r=void 0,rn(t))})})))}}var Qi=Ut|Yt;function ea(n,e,t,r){new ta(n,e,t,r)}class ta{parent;is_pending=!1;transform_error;#e;#s=null;#t;#o;#r;#a=null;#n=null;#l=null;#i=null;#m=0;#c=0;#u=!1;#d=new Set;#g=new Set;#f=null;#w=Ji(()=>(this.#f=Tt(this.#m),()=>{this.#f=null}));constructor(e,t,r,s){this.#e=e,this.#t=t,this.#o=i=>{var o=oe;o.b=this,o.f|=jn,r(i)},this.parent=oe.b,this.transform_error=s??this.parent?.transform_error??(i=>i),this.#r=fr(()=>{this.#v()},Qi)}#x(){try{this.#a=Be(()=>this.#o(this.#e))}catch(e){this.error(e)}}#_(e){const t=this.#t.failed,{reset:r,invoke_onerror:s}=this.#b(e);ut(s),t&&(this.#l=Be(()=>{t(this.#e,()=>e,()=>r)}))}#b(e){var t=!1,r=!1;const s=()=>{if(!this.#h()){if(t){ii();return}t=!0,r&&gi(),this.#l!==null&&St(this.#l,()=>{this.#l=null}),this.#p(()=>{this.#v()})}};return{reset:s,invoke_onerror:()=>{if(!this.#h())try{r=!0,this.#t.onerror?.(e,s),r=!1}catch(o){Qe(o,this.#r&&this.#r.parent)}}}}#h(){return(this.#r.f&(Te|an))!==0}#k(){const e=this.#t.pending;e&&(this.is_pending=!0,this.#n=Be(()=>e(this.#e)),ut(()=>{if(!this.#h()){var t=this.#i=document.createDocumentFragment(),r=_t(),s=!1;if(t.append(r),this.#a=this.#p(()=>{try{return Be(()=>this.#o(r))}catch(i){try{this.error(i),s=!0}catch(o){Qe(o,this.#r.parent)}return null}}),this.#a===null){this.#i=null,s&&this.#y(ne);return}this.#c===0&&(this.#e.before(t),this.#i=null,St(this.#n,()=>{this.#n=null}),this.#y(ne))}}))}#v(){try{if(this.is_pending=this.has_pending_snippet(),this.#c=0,this.#m=0,this.#a=Be(()=>{this.#o(this.#e)}),this.#c>0){var e=this.#i=document.createDocumentFragment();hr(this.#a,e);const t=this.#t.pending;this.#n=Be(()=>t(this.#e))}else this.#y(ne)}catch(t){this.error(t)}}#y(e){this.is_pending=!1,e.transfer_effects(this.#d,this.#g)}defer_effect(e){Gr(e,this.#d,this.#g)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#p(e){var t=oe,r=ie,s=Pe;st(this.#r),Ve(this.#r),jt(this.#r.ctx);try{return wt.ensure(),e()}finally{st(t),Ve(r),jt(s)}}#M(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#M(e,t);return}this.#c+=e,this.#c===0&&(this.#y(t),this.#n&&St(this.#n,()=>{this.#n=null}),this.#i&&(this.#e.before(this.#i),this.#i=null))}update_pending_count(e,t){this.#M(e,t),this.#m+=e,!(!this.#f||this.#u)&&(this.#u=!0,ut(()=>{this.#u=!1,this.#f&&Bt(this.#f,this.#m)}))}get_effect_pending(){return this.#w(),a(this.#f)}error(e){if(e===Hr||!this.#t.onerror&&!this.#t.failed)throw e;ne?.is_fork?(this.#a&&ne.skip_effect(this.#a),this.#n&&ne.skip_effect(this.#n),this.#l&&ne.skip_effect(this.#l),ne.oncommit(()=>{this.#h()||this.#E(e)})):this.#E(e)}#E(e){this.#a&&(Le(this.#a),this.#a=null),this.#n&&(Le(this.#n),this.#n=null),this.#l&&(Le(this.#l),this.#l=null);let t=this.#t.failed;const r=s=>{if(this.#h())return;const{reset:i,invoke_onerror:o}=this.#b(s);o(),t&&!this.#h()&&(this.#l=this.#p(()=>{try{return Be(()=>{var c=oe;c.b=this,c.f|=jn,t(this.#e,()=>s,()=>i)})}catch(c){return Qe(c,this.#r.parent),null}}))};ut(()=>{if(!this.#h()){var s;try{s=this.transform_error(e)}catch(i){Qe(i,this.#r&&this.#r.parent);return}s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(r,i=>Qe(i,this.#r&&this.#r.parent)):r(s)}})}}function j(n,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(n[Vn]??=n.nodeValue)&&(n[Vn]=t,n.nodeValue=`${t}`)}function $n(n,e){return na(n,e)}const pn=new Map;function na(n,{target:e,anchor:t,props:r={},events:s,context:i,intro:o=!0,transformError:c}){Ni();var l=void 0,u=Di(()=>{var h=t??e.appendChild(_t());ea(h,{pending:()=>{}},f=>{it({});var m=Pe;i&&(m.c=i),s&&(r.$$events=s),l=n(f,r)||sr(),at()},c);var d=new Set,v=f=>{for(var m=0;m<f.length;m++){var q=f[m];if(!d.has(q)){d.add(q);var b=Wi(q);for(const S of[e,document]){var M=pn.get(S);M===void 0&&(M=new Map,pn.set(S,M));var N=M.get(q);N===void 0?(S.addEventListener(q,Kn,{passive:b}),M.set(q,1)):M.set(q,N+1)}}}};return v(Tn(Ms)),Xn.add(v),()=>{for(var f of d)for(const b of[e,document]){var m=pn.get(b),q=m.get(f);--q==0?(b.removeEventListener(f,Kn),m.delete(f),m.size===0&&pn.delete(b)):m.set(f,q)}Xn.delete(v),h!==t&&h.parentNode?.removeChild(h)}});return ra.set(l,u),l}let ra=new WeakMap;class sa{anchor;#e=new Map;#s=new Map;#t=new Map;#o=new Set;#r=!0;constructor(e,t=!0){this.anchor=e,this.#r=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),r=this.#s.get(t);if(r)Mn(r),this.#o.delete(t);else{var s=this.#t.get(t);s&&(Mn(s.effect),this.#s.set(t,s.effect),this.#t.delete(t),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),r=s.effect)}for(const[i,o]of this.#e){if(this.#e.delete(i),i===e)break;const c=this.#t.get(o);c&&(Le(c.effect),this.#t.delete(o))}for(const[i,o]of this.#s){if(i===t||this.#o.has(i))continue;const c=()=>{if(Array.from(this.#e.values()).includes(i)){var u=document.createDocumentFragment();hr(o,u),u.append(_t()),this.#t.set(i,{effect:o,fragment:u})}else Le(o);this.#o.delete(i),this.#s.delete(i)};this.#r||!r?(this.#o.add(i),St(o,c,!1)):c()}}};#n=e=>{this.#e.delete(e);const t=Array.from(this.#e.values());for(const[r,s]of this.#t)t.includes(r)||(Le(s.effect),this.#t.delete(r))};ensure(e,t){var r=ne,s=cs();if(t&&!this.#s.has(e)&&!this.#t.has(e))if(s){var i=document.createDocumentFragment(),o=_t();i.append(o),this.#t.set(e,{effect:Be(()=>t(o)),fragment:i})}else this.#s.set(e,Be(()=>t(this.anchor)));if(this.#e.set(r,e),s){for(const[c,l]of this.#s)c===e?r.unskip_effect(l):r.skip_effect(l);for(const[c,l]of this.#t)c===e?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(this.#a),r.ondiscard(this.#n)}else this.#a(r)}}function ce(n,e,t=!1){var r=new sa(n),s=t?Ut:0;function i(o,c){r.ensure(o,c)}fr(()=>{var o=!1;e((c,l=0)=>{o=!0,i(l,c)}),o||i(-1,null)},s)}function ia(n,e){return e}function aa(n,e,t){for(var r=[],s=e.length,i,o=e.length,c=0;c<s;c++){let d=e[c];St(d,()=>{if(i){if(i.pending.delete(d),i.done.add(d),i.pending.size===0){var v=n.outrogroups;Zn(n,Tn(i.done)),v.delete(i),v.size===0&&(n.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=r.length===0&&t!==null&&n.pending.size===0;if(l){var u=t,h=u.parentNode;$i(h),h.append(u),n.items.clear()}Zn(n,e,!l)}else i={pending:new Set(e),done:new Set},(n.outrogroups??=new Set).add(i)}function Zn(n,e,t=!0){var r;if(n.pending.size>0){r=new Set;for(const o of n.pending.values())for(const c of o)r.add(n.items.get(c).e)}for(var s=0;s<e.length;s++){var i=e[s];if(r?.has(i)){i.f|=et;const o=document.createDocumentFragment();hr(i,o)}else Le(e[s],t)}}var Mr;function De(n,e,t,r,s,i=null){var o=n,c=new Map,l=(e&Br)!==0;if(l){var u=n;o=u.appendChild(_t())}var h=null,d=Jr(()=>{var N=t();return Or(N)?N:N==null?[]:Tn(N)}),v=new Map,f=!0;function m(N){if((M.effect.f&Te)===0){M.pending.delete(N);var S=a(d);M.fallback=h,oa(M,S,o,e,r),h!==null&&(S.length===0?(h.f&et)===0?Mn(h):(h.f^=et,Qt(h,null,o)):St(h,()=>{h=null}))}}function q(N){M.pending.delete(N)}var b=fr(()=>{for(var N=a(d),S=N.length,$=new Set,J=ne,O=cs(),z=0;z<S;z+=1){var ee=N[z],ue=r(ee,z),P=f?null:c.get(ue);P?(P.v&&Bt(P.v,ee),P.i&&Bt(P.i,z),O&&J.unskip_effect(P.e)):(P=la(c,f?o:Mr??=_t(),ee,ue,z,s,e,t),f||(P.e.f|=et),c.set(ue,P)),$.add(ue)}if(S===0&&i&&!h&&(f?h=Be(()=>i(o)):(h=Be(()=>i(Mr??=_t())),h.f|=et)),S>$.size&&li(),!f)if(v.set(J,$),O){for(const[G,re]of c)$.has(G)||J.skip_effect(re.e);J.oncommit(m),J.ondiscard(q)}else m(J);a(d)}),M={effect:b,items:c,pending:v,outrogroups:null,fallback:h};f=!1}function Gt(n){for(;n!==null&&(n.f&Ze)===0;)n=n.next;return n}function oa(n,e,t,r,s){var i=(r&Ks)!==0,o=e.length,c=n.items,l=Gt(n.effect.first),u,h=null,d,v=[],f=[],m,q,b,M;if(i)for(M=0;M<o;M+=1)m=e[M],q=s(m,M),b=c.get(q).e,(b.f&et)===0&&(b.nodes?.a?.measure(),(d??=new Set).add(b));for(M=0;M<o;M+=1){if(m=e[M],q=s(m,M),b=c.get(q).e,n.outrogroups!==null)for(const P of n.outrogroups)P.pending.delete(b),P.done.delete(b);if((b.f&qe)!==0&&(Mn(b),i&&(b.nodes?.a?.unfix(),(d??=new Set).delete(b))),(b.f&et)!==0)if(b.f^=et,b===l)Qt(b,null,t);else{var N=h?h.next:l;b===n.effect.last&&(n.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),mt(n,h,b),mt(n,b,N),Qt(b,N,t),h=b,v=[],f=[],l=Gt(h.next);continue}if(b!==l){if(u!==void 0&&u.has(b)){if(v.length<f.length){var S=f[0],$;h=S.prev;var J=v[0],O=v[v.length-1];for($=0;$<v.length;$+=1)Qt(v[$],S,t);for($=0;$<f.length;$+=1)u.delete(f[$]);mt(n,J.prev,O.next),mt(n,h,J),mt(n,O,S),l=S,h=O,M-=1,v=[],f=[]}else u.delete(b),Qt(b,l,t),mt(n,b.prev,b.next),mt(n,b,h===null?n.effect.first:h.next),mt(n,h,b),h=b;continue}for(v=[],f=[];l!==null&&l!==b;)(u??=new Set).add(l),f.push(l),l=Gt(l.next);if(l===null)continue}(b.f&et)===0&&v.push(b),h=b,l=Gt(b.next)}if(n.outrogroups!==null){for(const P of n.outrogroups)P.pending.size===0&&(Zn(n,Tn(P.done)),n.outrogroups?.delete(P));n.outrogroups.size===0&&(n.outrogroups=null)}if(l!==null||u!==void 0){var z=[];if(u!==void 0)for(b of u)(b.f&qe)===0&&z.push(b);for(;l!==null;)(l.f&qe)===0&&l!==n.fallback&&z.push(l),l=Gt(l.next);var ee=z.length;if(ee>0){var ue=(r&Br)!==0&&o===0?t:null;if(i){for(M=0;M<ee;M+=1)z[M].nodes?.a?.measure();for(M=0;M<ee;M+=1)z[M].nodes?.a?.fix()}aa(n,z,ue)}}i&&ut(()=>{if(d!==void 0)for(b of d)b.nodes?.a?.apply()})}function la(n,e,t,r,s,i,o,c){var l=(o&Ws)!==0?(o&Gs)===0?Fi(t,!1,!1):Tt(t):null,u=(o&Xs)!==0?Tt(s):null;return{v:l,i:u,e:Be(()=>(i(e,l??t,u??s,c),()=>{n.delete(r)}))}}function Qt(n,e,t){if(n.nodes)for(var r=n.nodes.start,s=n.nodes.end,i=e&&(e.f&et)===0?e.nodes.start:t;r!==null;){var o=dn(r);if(i.before(r),r===s)return;r=o}}function mt(n,e,t){e===null?n.effect.first=t:e.next=t,t===null?n.effect.last=e:t.prev=e}const Er=[...` 	
\r\f \v\uFEFF`];function ca(n,e,t){var r=n==null?"":""+n;if(e&&(r=r?r+" "+e:e),t){for(var s of Object.keys(t))if(t[s])r=r?r+" "+s:s;else if(r.length)for(var i=s.length,o=0;(o=r.indexOf(s,o))>=0;){var c=o+i;(o===0||Er.includes(r[o-1]))&&(c===r.length||Er.includes(r[c]))?r=(o===0?"":r.substring(0,o))+r.substring(c+1):o=c}}return r===""?null:r}function Sr(n,e=!1){var t=e?" !important;":";",r="";for(var s of Object.keys(n)){var i=n[s];i!=null&&i!==""&&(r+=" "+s+": "+i+t)}return r}function ua(n,e){if(e){var t="",r,s;return Array.isArray(e)?(r=e[0],s=e[1]):r=e,r&&(t+=Sr(r)),s&&(t+=Sr(s,!0)),t=t.trim(),t===""?null:t}return String(n)}function ft(n,e,t,r,s,i){var o=n[Bn];if(o!==t||o===void 0){var c=ca(t,r,i);c==null?n.removeAttribute("class"):n.className=c,n[Bn]=t}else if(i&&s!==i)for(var l in i){var u=!!i[l];(s==null||u!==!!s[l])&&n.classList.toggle(l,u)}return i}function qn(n,e={},t,r){for(var s in t){var i=t[s];e[s]!==i&&(t[s]==null?n.style.removeProperty(s):n.style.setProperty(s,i,r))}}function $e(n,e,t,r){var s=n[Hn];if(s!==e){var i=ua(e,r);i==null?n.removeAttribute("style"):n.style.cssText=i,n[Hn]=e}else r&&(Array.isArray(r)?(qn(n,t?.[0],r[0]),qn(n,t?.[1],r[1],"important")):qn(n,t,r));return r}const fa=Symbol("is custom element"),da=Symbol("is html"),ha=Ys?"progress":"PROGRESS";function Ar(n,e){var t=Ss(n);t.value===(t.value=e??void 0)||n.value===e&&(e!==0||n.nodeName!==ha)||(n.value=e??"")}function x(n,e,t,r){var s=Ss(n);s[e]!==(s[e]=t)&&(e==="loading"&&(n[Vs]=t),t==null?n.removeAttribute(e):typeof t!="string"&&va(n).has(e)?n[e]=t:n.setAttribute(e,t))}function Ss(n){return n[jr]??={[fa]:n.nodeName.includes("-"),[da]:n.namespaceURI===ri}}var Tr=new Map;function va(n){var e=n.getAttribute("is")||n.nodeName,t=Tr.get(e);if(t)return t;Tr.set(e,t=new Set);for(var r,s=n,i=Element.prototype;i!==s;){r=zs(s);for(var o in r)r[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&t.add(o);s=Ir(s)}return t}function pa(n,e,t=e){var r=new WeakSet;xi(n,"input",async s=>{var i=s?n.defaultValue:n.value;if(i=On(n)?zn(i):i,t(i),ne!==null&&r.add(ne),await Vi(),i!==(i=e())){var o=n.selectionStart,c=n.selectionEnd,l=n.value.length;if(n.value=i??"",c!==null){var u=n.value.length;o===c&&c===l&&u>l?(n.selectionStart=u,n.selectionEnd=u):(n.selectionStart=o,n.selectionEnd=Math.min(c,u))}}}),pt(e)==null&&n.value&&(t(On(n)?zn(n.value):n.value),ne!==null&&r.add(ne)),ur(()=>{var s=e();if(n===document.activeElement){var i=ne;if(r.has(i))return}On(n)&&s===zn(n.value)||n.type==="date"&&!s&&!n.value||s!==n.value&&(n.value=s??"")})}function On(n){var e=n.type;return e==="number"||e==="range"}function zn(n){return n===""?null:+n}class pr{#e=new WeakMap;#s;#t;static entries=new WeakMap;constructor(e){this.#t=e}observe(e,t){var r=this.#e.get(e)||new Set;return r.add(t),this.#e.set(e,r),this.#o().observe(e,this.#t),()=>{var s=this.#e.get(e);s.delete(t),s.size===0&&(this.#e.delete(e),this.#s.unobserve(e))}}#o(){return this.#s??(this.#s=new ResizeObserver(e=>{for(var t of e){pr.entries.set(t.target,t);for(var r of this.#e.get(t.target)||[])r(t)}}))}}var ma=new pr({box:"border-box"});function ga(n,e,t){var r=ma.observe(n,()=>t(n[e]));ds(()=>(pt(()=>t(n[e])),r))}function In(n,e){return n===e||n?.[en]===e}function dt(n=sr(),e,t,r){var s=Pe.r,i=oe;return ds(()=>{var o,c;return ur(()=>{o=c,c=[],pt(()=>{In(t(...c),n)||(e(n,...c),o&&In(t(...o),n)&&e(null,...o))})}),()=>{let l=i;for(;l!==s&&l.parent!==null&&l.parent.f&an;)l=l.parent;const u=()=>{c&&In(t(...c),n)&&e(null,...c)},h=l.teardown;l.teardown=()=>{u(),h?.()}}}),n}let mn=!1;function _a(n){var e=mn;try{return mn=!1,[n(),mn]}finally{mn=e}}function tt(n,e,t,r){var s=!0,i=(t&Qs)!==0,o=(t&ei)!==0,c=r,l=!0,u=void 0,h=()=>o&&s?(u??=on(r),a(u)):(l&&(l=!1,c=o?pt(r):r),c);let d;if(i){var v=en in n||Hs in n;d=Ot(n,e)?.set??(v&&e in n?$=>n[e]=$:void 0)}var f,m=!1;i?[f,m]=_a(()=>n[e]):f=n[e],f===void 0&&r!==void 0&&(f=h(),d&&(hi(),d(f)));var q;if(q=()=>{var $=n[e];return $===void 0?h():(l=!0,$)},(t&Js)===0)return q;if(d){var b=n.$$legacy;return(function($,J){return arguments.length>0?((!J||b||m)&&d(J?q():$),$):q()})}var M=!1,N=((t&Zs)!==0?on:Jr)(()=>(M=!1,q()));i&&a(N);var S=oe;return(function($,J){if(arguments.length>0){const O=J?a(N):i?xe($):$;return C(N,O),M=!0,c!==void 0&&(c=O),$}return ht&&M||(S.f&Te)!==0?N.v:a(N)})}function Xt(n){Pe===null&&Wr(),bt(()=>{const e=pt(n);if(typeof e=="function")return e})}function As(n){Pe===null&&Wr(),Xt(()=>()=>pt(n))}const Jn=1,Dt={Webp:1,Jpeg:2,Rgba:3,Surface:4,Pcm:5},Sn=16;function Ts(n){if(n.byteLength<Sn)return null;const e=new DataView(n),t=e.getUint8(8);return t<1||t>5?null:{frame:e.getUint32(0,!0),width:e.getUint16(4,!0),height:e.getUint16(6,!0),format:t,len:e.getUint32(12,!0)}}const ba={[Dt.Jpeg]:"image/jpeg",[Dt.Webp]:"image/webp"};async function ya(n){const e=Ts(n);if(!e||e.format===Dt.Pcm||e.format===Dt.Surface)return null;const t=new Uint8Array(n,Sn,e.len);let r;if(e.format===Dt.Rgba){const s=new ImageData(new Uint8ClampedArray(t),e.width,e.height);r=await createImageBitmap(s)}else r=await createImageBitmap(new Blob([t],{type:ba[e.format]}));return{header:e,image:r}}function wa(n,e,t){const r=new URL(n,t);return r.protocol==="http:"&&(r.protocol="ws:"),r.protocol==="https:"&&(r.protocol="wss:"),e&&r.searchParams.set("token",e),r.toString()}const xa=4401,Ps="unauthorized";function ka(n,e,t){return Math.min(t,e*2**Math.max(0,n-1))}class Ma{kind="ws";ws=null;handlers=null;attempt=0;timer=null;closed=!1;latestFrame=-1;decodeChain=Promise.resolve();url;min;max;WS;constructor(e){const t=typeof location<"u"?location.href:"http://127.0.0.1/";this.url=wa(e.url,e.token,t),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 t=new this.WS(this.url);t.binaryType="arraybuffer",this.ws=t,t.onopen=()=>{this.attempt=0,e.status({state:"open"})},t.onmessage=r=>{if(typeof r.data=="string"){let o;try{o=JSON.parse(r.data)}catch{return}this.decodeChain=this.decodeChain.then(()=>e.event(o));return}const s=r.data,i=Ts(s);if(i?.format===Dt.Pcm){const o=Math.min(s.byteLength,Sn+i.len),c=s.slice(Sn,o);this.decodeChain=this.decodeChain.then(()=>e.audio?.({rate:i.width,pcm:c}));return}this.decodeChain=this.decodeChain.then(async()=>{const o=await ya(s);o&&(this.latestFrame=o.header.frame,e.frame(o))})},t.onclose=r=>{if(this.ws=null,this.closed)return;if(r?.code===xa){this.closed=!0,e.status({state:"closed",reason:Ps});return}this.attempt+=1;const s=ka(this.attempt,this.min,this.max);e.status({state:"reconnecting",attempt:this.attempt,delayMs:s}),this.timer=setTimeout(()=>this.open(),s)},t.onerror=()=>t.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 Ea{kind="mock";h=null;frame=0;playing=null;viewport={w:640,h:360};selected=null;sent=[];notes=[];fps=30;size=[1920,1080];scenes=[{name:"intro",start:0,frames:60,transition:0,transition_at:0},{name:"outro",start:60,frames:60,transition:0,transition_at:0}];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"}),this.emitNotes()})}emit(e){this.h?.event(e)}noteEdit(e){if(e.type==="NoteAdd"){const t=this.notes.reduce((i,o)=>Math.max(i,o.id),0)+1,{crop_png:r,...s}=e;delete s.type,this.notes.push({...s,id:t,status:"open",crop:r?`${t}.png`:void 0,created:0})}else if(e.type==="NoteSet"){const t=this.notes.find(r=>r.id===e.id);t&&e.status&&(t.status=e.status,delete t.taken)}else if(e.type==="NoteDelete")this.notes=this.notes.filter(t=>t.id!==e.id);else return!1;return this.emitNotes(),!0}emitNotes(){this.emit({type:"Notes",notes:this.notes})}inject(e){this.emit(e)}markers(){return Object.entries(this.metas).flatMap(([e,t])=>Object.entries(t.markers??{}).map(([r,s])=>({scene:e,name:r,time:s})))}timeline(){this.emit({type:"Timeline",frames:this.total,markers:this.markers(),scenes:this.scenes,audio_waveform:Array.from({length:240},(e,t)=>Math.abs(Math.sin(t/7))*.8),slides:[{scene:"intro",frame:30,notes:"Say hello."},{scene:"intro",frame:59,notes:"The square moves."},{scene:"outro",frame:119,notes:""}]})}squareX(e){return 200+e/this.total*1400}async show(){const e=this.frame;this.emit({type:"Frame",index:e});const[t,r]=this.size,s=Math.min(this.viewport.w/t,this.viewport.h/r,1),i=Math.max(1,Math.round(t*s)),o=Math.max(1,Math.round(r*s));let c=null;if(typeof OffscreenCanvas<"u"){const l=new OffscreenCanvas(i,o),u=l.getContext("2d");u.fillStyle="#141414",u.fillRect(0,0,i,o),u.fillStyle="#e13238",u.fillRect((this.squareX(e)-100)*s,440*s,200*s,200*s),u.fillStyle="#fff",u.font=`${Math.round(48*s)}px sans-serif`,u.fillText(`frame ${e}`,40*s,80*s),c=l.transferToImageBitmap()}if(c){const l={header:{frame:e,width:i,height:o,format:3,len:i*o*4},image:c};this.h?.frame(l)}if(this.selected!==null){const l=this.squareX(e);this.emit({type:"Signals",node_id:this.selected,values:[{name:"x",value:(l-960).toFixed(3)},{name:"y",value:"0.000"},{name:"fill",value:"#e13238ff"}],bounds:[l-100,440,l+100,440,l+100,640,l-100,640]})}}send(e){if(this.sent.push(e),!this.noteEdit(e))switch(e.type){case"Hello":if(e.protocol_version!==Jn){this.emit({type:"Error",kind:"Incompatible",message:"protocol mismatch",spans:[]});return}this.emit({type:"Ready",protocol_version:Jn,engine_version:"mock",fps:this.fps,size:this.size,scenes:this.scenes});for(const[t,r]of Object.entries(this.metas))this.emit({type:"MetaChanged",scene:t,meta:r});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 t=e.scene??Object.keys(this.metas).find(s=>e.name in(this.metas[s]?.markers??{})),r=t?this.metas[t]:void 0;if(!t||!r){this.emit({type:"Error",kind:"Meta",message:`no marker named \`${e.name}\``,spans:[]});return}r.markers={...r.markers,[e.name]:e.time},this.emit({type:"MetaChanged",scene:t,meta:r}),this.timeline(),this.show();break}case"SetEase":case"SetTunable":{const t=this.metas.intro;e.type==="SetEase"?t.eases={...t.eases,[e.name]:e.value}:t.tunables={...t.tunables,[e.name]:e.value},this.emit({type:"MetaChanged",scene:"intro",meta:t}),this.show();break}case"Pick":{const t=this.squareX(this.frame),r=Math.abs(e.x-t)<=100&&Math.abs(e.y-540)<=100;this.selected=r?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;case"SetTransition":{const t=this.scenes.find(r=>r.name===e.scene);if(!t){this.emit({type:"Error",kind:"Meta",message:`no scene named \`${e.scene}\``,spans:[]});return}t.transition=Math.max(0,Math.round(e.seconds*this.fps)),this.timeline(),this.show();break}}}stopPlayback(){this.playing!==null&&clearInterval(this.playing),this.playing=null}close(){this.stopPlayback(),this.h?.status({state:"closed",reason:"closed"})}}const Sa="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Sa);const Aa={"app.title":"oxframe","conn.connecting":"Connecting…","conn.open":"Connected","conn.reconnecting":"Reconnecting…","conn.closed":"Disconnected","conn.unauthorized":"Link expired: open the URL printed by `oxframe dev`","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 (, or < for 10)","transport.next":"Next frame (. or > 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)","timeline.transition":"Transition into {name}, {seconds} s. Drag the right edge to change it.","timeline.soundtrack":"Soundtrack {name}","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 · ←/→ 5 s · Shift+←/→ 1 s · ,/. frame · </> 10 frames · Home/End · M marker · wheel zoom · Alt/middle-drag pan"},Ta=Aa;function B(n,e={}){return Ta[n].replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}var Pa=K('<span class="chip ok svelte-yic9pk" data-testid="reloaded"> </span>'),Ca=K('<span class="dim svelte-yic9pk"> </span>'),Fa=K('<button class="comment" title="Mark something in the frame and write a note for the agent (C)" data-testid="comment-mode">Comment</button>'),Ra=K('<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 Na(n,e){it(e,!0);let t=tt(e,"editor",7);const r=de(()=>{const O=t().connection;if(t().error?.kind==="Incompatible")return{cls:"bad",text:B("status.incompatible")};if(t().building)return{cls:"busy",text:B("status.building")};switch(O.state){case"open":return{cls:"ok",text:B("conn.open")};case"connecting":return{cls:"busy",text:B("conn.connecting")};case"reconnecting":return{cls:"busy",text:B("conn.reconnecting")};default:return{cls:"bad",text:O.reason===Ps?B("conn.unauthorized"):B("conn.closed")}}});let s=D(!1);bt(()=>{if(!t().reloadedAt)return;C(s,!0);const O=setTimeout(()=>C(s,!1),1500);return()=>clearTimeout(O)});var i=Ra(),o=V(i),c=Y(o,!0),l=_(o,2),u=_(V(l),1,!0),h=_(l,2);{var d=O=>{var z=Pa(),ee=Y(z,!0);Q(ue=>j(ee,ue),[()=>B("status.reloaded")]),U(O,z)};ce(h,O=>{a(s)&&O(d)})}var v=_(h,4);{var f=O=>{var z=Ca(),ee=Y(z);Q(()=>j(ee,`engine ${t().engineVersion??""} · ${t().size[0]??""}×${t().size[1]??""} · ${t().fps??""} fps`)),U(O,z)};ce(v,O=>{t().engineVersion&&O(f)})}var m=_(v,2);{var q=O=>{var z=Fa();Q(()=>x(z,"aria-pressed",t().commenting)),H("click",z,()=>t().toggleCommenting()),U(O,z)};ce(m,O=>{t().notes!==null&&O(q)})}var b=_(m,2),M=Y(b,!0),N=_(b,2),S=_(N,2),$=Y(S,!0),J=_(S,2);Q((O,z,ee,ue,P,G,re,Oe)=>{j(c,O),ft(l,1,`chip ${a(r).cls??""}`,"svelte-yic9pk"),j(u,a(r).text),x(b,"aria-pressed",t().showAxes),x(b,"title",z),j(M,ee),x(N,"title",ue),x(S,"title",P),x(S,"aria-label",G),j($,e.theme==="dark"?"☾":"☀"),x(J,"title",re),x(J,"aria-label",Oe)},[()=>B("app.title"),()=>B("viewport.axes"),()=>B("viewport.axes"),()=>B("viewport.fit"),()=>B("theme.toggle"),()=>B("theme.toggle"),()=>B("help.keys"),()=>B("help.keys")]),H("click",b,()=>t().showAxes=!t().showAxes),H("click",N,()=>t().resetView()),H("click",S,function(...O){e.onToggleTheme?.apply(this,O)}),U(n,i),at()}xt(["click"]);function Qn(n,e,t,r,s){const o=Math.min(e.w/n[0],e.h/n[1])*t;return{scale:o,ox:e.w/2-n[0]*o/2+r,oy:e.h/2-n[1]*o/2+s}}function bn(n,e,t){return[(e-n.ox)/n.scale,(t-n.oy)/n.scale]}function $t(n,e,t){return[n.ox+e*n.scale,n.oy+t*n.scale]}function $a(n,e,t,r,s,i,o,c){const l=Qn(n,e,t,r,s),[u,h]=bn(l,o,c),d=Qn(n,e,i,0,0),[v,f]=$t(d,u,h);return{panX:o-v,panY:c-f}}function qa(n,e){const[t,r]=e,s=i=>Math.round(i*10)/10;return[s(n[0]-t/2),s(n[1]-r/2),s(n[2]-t/2),s(n[3]-r/2)]}function Oa(n,e){const[t,r]=e;return[n[0]+t/2,n[1]+r/2,n[2]+t/2,n[3]+r/2]}function er(n,e,t,r){return[Math.min(n,t),Math.min(e,r),Math.max(n,t),Math.max(e,r)]}async function za(n,e,t){if(typeof OffscreenCanvas>"u")return;const[r,s]=e,i=n.width/r,o=48,c=Math.max(0,t[0]-o),l=Math.max(0,t[1]-o),u=Math.min(r,t[2]+o),h=Math.min(s,t[3]+o),d=Math.max(1,Math.round((u-c)*i)),v=Math.max(1,Math.round((h-l)*i)),f=new OffscreenCanvas(d,v),m=f.getContext("2d");if(!m)return;m.drawImage(n,c*i,l*i,d,v,0,0,d,v),m.strokeStyle="#ff3b6b",m.lineWidth=Math.max(2,3*i),m.strokeRect((t[0]-c)*i,(t[1]-l)*i,(t[2]-t[0])*i,(t[3]-t[1])*i);const q=await f.convertToBlob({type:"image/png"}),b=new Uint8Array(await q.arrayBuffer());let M="";for(let N=0;N<b.length;N+=32768)M+=String.fromCharCode(...b.subarray(N,N+32768));return btoa(M)}function Ia(n,e,t){const r=.5/Math.max(1,t);return e>=n.time[0]-r&&e<=n.time[1]+r}var Da=K('<div class="note-area svelte-10js0q2"><span class="note-badge svelte-10js0q2"> </span></div>'),La=K('<div class="note-area drafting svelte-10js0q2"></div>'),Ua=K('<span class="dim svelte-10js0q2"> </span>'),ja=K('<div class="note-area drafting svelte-10js0q2"></div> <form class="note-form svelte-10js0q2" data-testid="note-form"><div class="note-meta svelte-10js0q2"> <!></div> <textarea rows="3" placeholder="What should change? (Ctrl+Enter to send)" aria-label="Note for the agent" data-testid="note-text" class="svelte-10js0q2"></textarea> <div class="note-actions svelte-10js0q2"><button type="button" title="Move the playhead, then press to cover the time up to it">Until playhead</button> <span class="spacer svelte-10js0q2"></span> <button type="button">Cancel</button> <button type="submit" class="primary svelte-10js0q2" data-testid="note-save">Add note</button></div></form>',1),Ba=vr('<svg viewBox="0 0 24 24" aria-hidden="true" class="svelte-10js0q2"><rect x="6" y="5" width="4" height="14" rx="1"></rect><rect x="14" y="5" width="4" height="14" rx="1"></rect></svg>'),Ha=vr('<svg viewBox="0 0 24 24" aria-hidden="true" class="svelte-10js0q2"><path d="M8 5.5v13l11-6.5z"></path></svg>'),Va=K('<button data-testid="center-play"><!></button>'),Ya=K('<div data-testid="viewport"><canvas class="svelte-10js0q2"></canvas> <!> <!> <!> <!> <span class="zoom svelte-10js0q2" aria-live="off"> </span></div>');function Wa(n,e){it(e,!0);let t=tt(e,"editor",7),r,s,i=D(xe({w:0,h:0}));const o=de(()=>Qn(t().size,a(i),t().zoom,t().panX,t().panY));Xt(()=>{const g=new ResizeObserver(([F])=>{if(!F)return;const{width:W,height:w}=F.contentRect;C(i,{w:Math.round(W),h:Math.round(w)},!0),t().setViewport(a(i).w,a(i).h)});return g.observe(r),()=>g.disconnect()}),bt(()=>{const g=s?.getContext("2d");if(!g)return;const F=typeof devicePixelRatio=="number"?devicePixelRatio:1,{w:W,h:w}=a(i);(s.width!==Math.round(W*F)||s.height!==Math.round(w*F))&&(s.width=Math.round(W*F),s.height=Math.round(w*F)),g.setTransform(F,0,0,F,0,0),g.clearRect(0,0,W,w);const[E,A]=t().size,T=a(o),I=t().image;g.fillStyle="#000",g.fillRect(T.ox,T.oy,E*T.scale,A*T.scale),I&&(g.imageSmoothingQuality="high",g.drawImage(I,T.ox,T.oy,E*T.scale,A*T.scale));const X=getComputedStyle(r).getPropertyValue("--m-accent")||"#6cb2eb";if(t().showAxes){const[R,k]=$t(T,E/2,A/2);g.strokeStyle="rgba(255,255,255,0.25)",g.lineWidth=1,g.setLineDash([4,4]),g.beginPath(),g.moveTo(T.ox,k+.5),g.lineTo(T.ox+E*T.scale,k+.5),g.moveTo(R+.5,T.oy),g.lineTo(R+.5,T.oy+A*T.scale),g.stroke(),g.setLineDash([])}const se=t().bounds;if(se&&t().selected!==null){g.strokeStyle=X,g.lineWidth=2,g.beginPath();for(let R=0;R<4;R++){const[k,L]=$t(T,se[2*R],se[2*R+1]);R===0?g.moveTo(k,L):g.lineTo(k,L)}g.closePath(),g.stroke()}});const c=de(()=>$t(a(o),t().size[0]/2,t().size[1]/2));let l=D(!1),u;function h(){C(l,!0),clearTimeout(u),u=setTimeout(()=>C(l,!1),1500)}let d=null,v=D(null);function f(g){const[F,W]=$t(a(o),g[0],g[1]),[w,E]=$t(a(o),g[2],g[3]);return{left:F,top:W,width:Math.max(2,w-F),height:Math.max(2,E-W)}}const m=de(()=>(t().notes??[]).filter(g=>g.status==="open"&&g.bounds&&Ia(g,t().time,t().fps)));let q=D(null);bt(()=>{t().draft&&a(q)?.focus()});function b(g){g.key==="Enter"&&(g.ctrlKey||g.metaKey)?(g.preventDefault(),t().saveDraft()):g.key==="Escape"&&(g.preventDefault(),t().draft=null)}function M(g){const F=s.getBoundingClientRect();return[g.clientX-F.left,g.clientY-F.top]}function N(g){s.setPointerCapture(g.pointerId),d={x:g.clientX,y:g.clientY,px:t().panX,py:t().panY,moved:!1}}function S(g){if(h(),!d)return;const F=g.clientX-d.x,W=g.clientY-d.y;Math.abs(F)+Math.abs(W)>3&&(d.moved=!0);const w=g.altKey||g.buttons===4||g.buttons===2;if(d.moved&&w)t().setZoom(t().zoom,d.px+F,d.py+W);else if(d.moved&&t().commenting){const E=s.getBoundingClientRect(),[A,T]=bn(a(o),d.x-E.left,d.y-E.top),[I,X]=bn(a(o),g.clientX-E.left,g.clientY-E.top),[se,R]=t().size,k=(L,ae)=>Math.max(0,Math.min(ae,L));C(v,er(k(A,se),k(T,R),k(I,se),k(X,R)),!0)}}function $(g){const F=d;d=null;const W=a(v);if(C(v,null),t().commenting&&W&&g.button===0){W[2]-W[0]>8&&W[3]-W[1]>8&&t().startDraft(W);return}if(!F||F.moved||g.button!==0)return;const[w,E]=M(g),[A,T]=bn(a(o),w,E),[I,X]=t().size;if(A<0||T<0||A>I||T>X){t().select(null);return}t().commenting?t().startDraftAt(A,T):t().pick(A,T)}function J(g){g.preventDefault();const[F,W]=M(g),w=Math.exp(-g.deltaY*.0015),E=Math.max(.1,Math.min(16,t().zoom*w)),A=$a(t().size,a(i),t().zoom,t().panX,t().panY,E,F,W);t().setZoom(E,A.panX,A.panY)}var O=Ya();let z;var ee=V(O);dt(ee,g=>s=g,()=>s);var ue=_(ee,2);De(ue,17,()=>a(m),g=>g.id,(g,F)=>{const W=de(()=>f(Oa(a(F).bounds,t().size)));var w=Da();let E;var A=V(w),T=Y(A,!0);Q(()=>{x(w,"data-testid",`note-area-${a(F).id??""}`),E=$e(w,"",E,{left:`${a(W).left??""}px`,top:`${a(W).top??""}px`,width:`${a(W).width??""}px`,height:`${a(W).height??""}px`}),x(A,"title",a(F).text),j(T,a(F).id)}),U(g,w)});var P=_(ue,2);{var G=g=>{const F=de(()=>f(a(v)));var W=La();let w;Q(()=>w=$e(W,"",w,{left:`${a(F).left??""}px`,top:`${a(F).top??""}px`,width:`${a(F).width??""}px`,height:`${a(F).height??""}px`})),U(g,W)};ce(P,g=>{a(v)&&g(G)})}var re=_(P,2);{var Oe=g=>{const F=de(()=>t().draft),W=de(()=>f(a(F).rect));var w=ja(),E=cn(w);let A;var T=_(E,2);let I;var X=V(T),se=V(X),R=_(se);{var k=ve=>{var y=Ua(),p=Y(y,!0);Q(()=>j(p,a(F).node.source)),U(ve,y)};ce(R,ve=>{a(F).node?.source&&ve(k)})}var L=_(X,2);dt(L,ve=>C(q,ve),()=>a(q));var ae=_(L,2),le=V(ae),he=_(le,4),Ee=_(he,2);Q((ve,y,p,te,fe)=>{A=$e(E,"",A,{left:`${a(W).left??""}px`,top:`${a(W).top??""}px`,width:`${a(W).width??""}px`,height:`${a(W).height??""}px`}),I=$e(T,"",I,{left:ve,top:y}),j(se,`${(a(F).node?a(F).node.label:"Area")??""} · ${p??""}${te??""} s `),Ee.disabled=fe},[()=>`${Math.max(8,Math.min(a(i).w-328,a(W).left))}px`,()=>`${Math.min(a(i).h-170,a(W).top+a(W).height+8)}px`,()=>a(F).time[0].toFixed(2),()=>a(F).time[1]>a(F).time[0]?`–${a(F).time[1].toFixed(2)}`:"",()=>!a(F).text.trim()]),Ct("submit",T,ve=>{ve.preventDefault(),t().saveDraft()}),H("keydown",L,b),pa(L,()=>a(F).text,ve=>a(F).text=ve),H("click",le,()=>t().draftUntilPlayhead()),H("click",he,()=>t().draft=null),U(g,w)};ce(re,g=>{t().draft&&g(Oe)})}var Re=_(re,2);{var Ye=g=>{var F=Va();let W,w;var E=V(F);{var A=I=>{var X=Ba();U(I,X)},T=I=>{var X=Ha();U(I,X)};ce(E,I=>{t().playing?I(A):I(T,-1)})}Q(()=>{W=ft(F,1,"center-play svelte-10js0q2",null,W,{shown:!t().playing||a(l)}),x(F,"aria-label",t().playing?"Pause":"Play"),x(F,"title",`${t().playing?"Pause":"Play"} (Space)`),w=$e(F,"",w,{left:`${a(c)[0]??""}px`,top:`${a(c)[1]??""}px`})}),H("click",F,()=>t().togglePlay()),H("pointermove",F,h),H("dblclick",F,I=>I.stopPropagation()),U(g,F)};ce(Re,g=>{t().ready&&t().frames>0&&!t().commenting&&g(Ye)})}var ze=_(Re,2),ot=Y(ze);dt(O,g=>r=g,()=>r),Q(g=>{z=ft(O,1,"viewport svelte-10js0q2",null,z,{commenting:t().commenting}),x(ee,"data-frame",t().imageFrame),x(ee,"aria-label",`frame ${t().imageFrame??""}`),j(ot,`${g??""}%`)},[()=>Math.round(t().zoom*100)]),H("pointerdown",ee,N),H("pointermove",ee,S),H("pointerup",ee,$),Ct("wheel",ee,J),H("dblclick",ee,()=>t().resetView()),H("contextmenu",ee,g=>g.preventDefault()),U(n,O),at()}xt(["pointerdown","pointermove","pointerup","dblclick","contextmenu","keydown","click"]);const qt=48e3,Xa=.45,Ka=.25,Pr=.89;function An(n){const e=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\"));return e>=0?n.slice(e+1):n}function Cr(n){const e=An(n);return/^[A-Za-z0-9._-]+\.(wav|mp3|ogg|flac)$/.test(e)?`/audio/${e}`:null}function Dn(n,e){return String.fromCharCode(n.getUint8(e),n.getUint8(e+1),n.getUint8(e+2),n.getUint8(e+3))}function Ga(n){if(n.byteLength<44)return null;const e=new DataView(n);if(Dn(e,0)!=="RIFF"||Dn(e,8)!=="WAVE")return null;let t=12,r=0,s=0,i=0,o=0,c=null;for(;t+8<=e.byteLength;){const v=Dn(e,t),f=e.getUint32(t+4,!0),m=t+8;if(m+f>e.byteLength)break;v==="fmt "&&f>=16?(r=e.getUint16(m,!0),s=e.getUint16(m+2,!0),i=e.getUint32(m+4,!0),o=e.getUint16(m+14,!0)):v==="data"&&(c=n.slice(m,m+f)),t=m+f+f%2}if(r!==1||!c||s<1||i<1||o!==16&&o!==8)return null;const l=o/8,u=Math.floor(c.byteLength/(l*s)),h=new Float32Array(u),d=new DataView(c);for(let v=0;v<u;v++){let f=0;for(let m=0;m<s;m++){const q=(v*s+m)*l;f+=o===16?d.getInt16(q,!0)/32768:(d.getUint8(q)-128)/128}h[v]=f/s}return{rate:i,samples:h}}function Za(n,e){const t=Math.max(1,Math.ceil(Math.max(0,e)*qt)),r=new Float32Array(t),s=new Uint8Array(t);for(const o of n)o.priority&&Fr(o,t,c=>{s[c]=1});for(const o of n)Fr(o,t,(c,l)=>{const u=o.music?Xa*(s[c]?Ka:1):1;r[c]=(r[c]??0)+l*u});let i=0;for(let o=0;o<t;o++)i=Math.max(i,Math.abs(r[o]??0));if(i>Pr){const o=Pr/i;for(let c=0;c<t;c++)r[c]=(r[c]??0)*o}return r}function Fr(n,e,t){const r=Math.round(n.start*qt),s=n.seconds>0?Math.round(n.seconds*qt):Math.ceil(n.samples.length*qt/Math.max(1,n.rate)),i=n.rate/qt;for(let o=0;o<s;o++){const c=r+o;if(c<0||c>=e)continue;const l=Math.floor(o*i);if(l>=n.samples.length)break;t(c,n.samples[l]??0)}}const Rr=new Map;function Ja(n){const e=Rr.get(n);if(e)return e;const t=(async()=>{try{const r=await fetch(n);return r.ok?Ga(await r.arrayBuffer()):null}catch{return null}})();return Rr.set(n,t),t}function Qa(n,e){const t=Math.max(1,e),r=new Array(t).fill(0);if(n.length===0)return r;for(let s=0;s<t;s++){const i=Math.floor(s*n.length/t),o=Math.max(i+1,Math.floor((s+1)*n.length/t));let c=0;for(let l=i;l<o&&l<n.length;l++)c=Math.max(c,Math.abs(n[l]??0));r[s]=c}return r}const Cs="oxframe-editor-view";function eo(n){const e=new URLSearchParams(n.replace(/^#/,"")),t=l=>{const u=e.get(l);if(u===null||u==="")return;const h=Number(u);return Number.isFinite(h)?h:void 0},r={},s=t("f");s!==void 0&&(r.frame=Math.max(0,Math.round(s)));const i=t("z");i!==void 0&&i>0&&(r.zoom=i);const o=t("px");o!==void 0&&(r.panX=o);const c=t("py");if(c!==void 0&&(r.panY=c),e.has("s")){const l=t("s");r.selected=l===void 0?null:l}return r}const to=new Set(["f","z","px","py","s"]);function no(n){return n.replace(/^#/,"").split("&").filter(e=>e!==""&&!to.has(e.split("=")[0]))}function ro(n,e=[]){const t=new URLSearchParams;return t.set("f",String(n.frame)),n.zoom!==1&&t.set("z",n.zoom.toFixed(3)),(n.panX!==0||n.panY!==0)&&(t.set("px",n.panX.toFixed(1)),t.set("py",n.panY.toFixed(1))),n.selected!==null&&t.set("s",String(n.selected)),`#${[...e,t.toString()].join("&")}`}function so(){let n={};try{n=JSON.parse(sessionStorage.getItem(Cs)??"{}")}catch{n={}}return{...n,...eo(typeof location>"u"?"":location.hash)}}function io(n){try{sessionStorage.setItem(Cs,JSON.stringify(n))}catch{}typeof history<"u"&&history.replaceState(history.state,"",`${location.pathname}${location.search}${ro(n,no(location.hash))}`)}const ao=15e3;function oo(){return typeof performance>"u"?!1:performance.getEntriesByType?.("navigation")[0]?.type==="reload"}class lo{constructor(e,t={}){if(this.backend=e,this.persistEnabled=t.persist??!0,this.uiVersion=t.uiVersion??"0.1.0",this.persistEnabled){const r=so();this.restoredFrame=oo()?0:r.frame??null,this.zoom=r.zoom??1,this.panX=r.panX??0,this.panY=r.panY??0,this.selected=r.selected??null}}backend;#e=D(xe({state:"connecting"}));get connection(){return a(this.#e)}set connection(e){C(this.#e,e,!0)}#s=D(!1);get ready(){return a(this.#s)}set ready(e){C(this.#s,e,!0)}#t=D("");get engineVersion(){return a(this.#t)}set engineVersion(e){C(this.#t,e,!0)}#o=D(60);get fps(){return a(this.#o)}set fps(e){C(this.#o,e,!0)}#r=D(xe([1920,1080]));get size(){return a(this.#r)}set size(e){C(this.#r,e,!0)}#a=D(0);get frames(){return a(this.#a)}set frames(e){C(this.#a,e,!0)}#n=D(0);get frame(){return a(this.#n)}set frame(e){C(this.#n,e,!0)}#l=D(!1);get playing(){return a(this.#l)}set playing(e){C(this.#l,e,!0)}#i=D(xe([]));get scenes(){return a(this.#i)}set scenes(e){C(this.#i,e,!0)}#m=D(xe([]));get markers(){return a(this.#m)}set markers(e){C(this.#m,e,!0)}#c=D(null);get waveform(){return a(this.#c)}set waveform(e){C(this.#c,e)}#u=D(xe([]));get clips(){return a(this.#u)}set clips(e){C(this.#u,e,!0)}#d=D(xe([]));get slides(){return a(this.#d)}set slides(e){C(this.#d,e,!0)}#g=D(xe({}));get metas(){return a(this.#g)}set metas(e){C(this.#g,e,!0)}#f=D(xe([]));get tree(){return a(this.#f)}set tree(e){C(this.#f,e,!0)}#w=D(null);get selected(){return a(this.#w)}set selected(e){C(this.#w,e,!0)}#x=D(xe([]));get signals(){return a(this.#x)}set signals(e){C(this.#x,e,!0)}#_=D(null);get bounds(){return a(this.#_)}set bounds(e){C(this.#_,e,!0)}#b=D(!1);get building(){return a(this.#b)}set building(e){C(this.#b,e,!0)}#h=D(0);get reloadedAt(){return a(this.#h)}set reloadedAt(e){C(this.#h,e,!0)}#k=D(null);get error(){return a(this.#k)}set error(e){C(this.#k,e,!0)}#v=D(null);get image(){return a(this.#v)}set image(e){C(this.#v,e)}#y=D(-1);get imageFrame(){return a(this.#y)}set imageFrame(e){C(this.#y,e,!0)}#p=D(1);get zoom(){return a(this.#p)}set zoom(e){C(this.#p,e,!0)}#M=D(0);get panX(){return a(this.#M)}set panX(e){C(this.#M,e,!0)}#E=D(0);get panY(){return a(this.#E)}set panY(e){C(this.#E,e,!0)}#S=D(!0);get showAxes(){return a(this.#S)}set showAxes(e){C(this.#S,e,!0)}viewport={w:0,h:0};#A=D(null);get selectedMarker(){return a(this.#A)}set selectedMarker(e){C(this.#A,e,!0)}#T=D(null);get editingEase(){return a(this.#T)}set editingEase(e){C(this.#T,e,!0)}#P=D(null);get notes(){return a(this.#P)}set notes(e){C(this.#P,e,!0)}#C=D(!1);get commenting(){return a(this.#C)}set commenting(e){C(this.#C,e,!0)}#F=D(null);get draft(){return a(this.#F)}set draft(e){C(this.#F,e,!0)}draftPick=null;restoredFrame=null;rewoundAt=-1/0;persistEnabled;uiVersion;pcm=null;pcmFromEngine=!1;audioGen=0;audioCtx=null;audioNode=null;start(){this.backend.connect({event:e=>this.handle(e),frame:e=>this.onFrame(e),status:e=>this.onStatus(e),audio:e=>this.onPcm(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:Jn,ui_version:this.uiVersion}),this.send({type:"Pause"})):(this.ready=!1,this.playing=!1,this.stopAudio())}onFrame(e){this.image?.close?.(),this.image=e.image,this.imageFrame=e.header.frame}handle(e){const t=e;if(t.type==="Notes"){this.notes=t.notes??[];return}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":{const r=this.playing;this.playing=!1,this.reloadedAt=Date.now(),this.building=!1,this.error=null,this.stopAudio(),this.pcm=null,this.pcmFromEngine=!1,this.audioGen++,this.waveform=null,this.clips=[],this.reloadedAt-this.rewoundAt>=ao&&(this.rewoundAt=this.reloadedAt,this.restoredFrame=0),this.restoredFrame??=this.frame,this.resync(),r&&this.play();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.playing&&e.index<this.frame&&this.startAudio(e.index),this.frame=e.index,this.savePersist();break;case"Playback":this.playing=e.playing,this.frame=e.frame,e.playing?this.startAudio(e.frame):this.stopAudio();break;case"Timeline":this.frames=e.frames,this.markers=e.markers,this.scenes=e.scenes,this.clips=e.audio_clips??[],this.slides=e.slides??[],e.audio_waveform&&(this.waveform=e.audio_waveform),this.loadHostedAudio();break;case"Tree":this.tree=e.nodes;break;case"Signals":e.node_id===this.selected&&(this.signals=e.values,this.bounds=e.bounds??null,this.draftPick&&e.bounds&&this.draftFromNode(e.node_id,e.bounds));break;case"Selected":if(this.selected=e.node_id,e.node_id===null&&this.draftPick){const{x:r,y:s}=this.draftPick;this.draftPick=null,this.startDraft(er(r-60,s-60,r+60,s+60))}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),this.loadHostedAudio();break}}resync(){this.viewport.w>0&&this.sendViewport();const e=this.restoredFrame??this.frame;this.restoredFrame=null,this.frame=e,this.send({type:"Seek",frame:e}),this.selected!==null&&this.send({type:"Select",node_id:this.selected})}restart(){this.pause(),this.playing=!1,this.restoredFrame=0,this.seek(0),this.savePersist()}get lastFrame(){return Math.max(0,this.frames-1)}seek(e){const t=Math.max(0,Math.min(this.lastFrame,Math.round(e)));this.frame=t,this.send({type:"Seek",frame:t}),this.playing&&this.startAudio(t)}seekBy(e){this.seek(this.frame+Math.round(e*this.fps))}onPcm(e){const t=new Int16Array(e.pcm),r=new Float32Array(t.length);for(let s=0;s<t.length;s++)r[s]=(t[s]??0)/32768;this.pcmFromEngine=!0,this.audioGen++,this.pcm={rate:e.rate,samples:r},this.playing&&this.startAudio(this.frame)}async loadHostedAudio(){if(this.pcmFromEngine||this.frames<=0||typeof fetch!="function")return;const e=this.hostedPlan();if(e.length===0)return;const t=++this.audioGen,r=new Map;for(const c of e){const l=Cr(c.file);if(!l||r.has(l))continue;const u=await Ja(l);u&&r.set(l,u)}if(t!==this.audioGen||this.pcmFromEngine)return;const s=[];for(const c of e){const l=r.get(Cr(c.file)??"");l&&s.push({samples:l.samples,rate:l.rate,start:c.start,seconds:c.seconds,music:c.music,priority:c.priority})}if(s.length===0)return;const i=this.frames/Math.max(1,this.fps),o=Za(s,i);this.pcm={rate:qt,samples:o},(!this.waveform||this.waveform.length===0)&&(this.waveform=Qa(o,Math.min(this.frames,4096))),this.playing&&this.startAudio(this.frame)}hostedPlan(){const e=[],t=new Set;for(const r of Object.values(this.metas)){const s=r.audio?.file;if(!s)continue;const i=An(s);t.has(i)||(t.add(i),e.push({file:s,start:r.audio?.offset??0,seconds:0,music:!0,priority:!1}))}for(const r of this.clips)r.text||e.push({file:r.name,start:r.start,seconds:r.seconds,music:!1,priority:r.priority});return e}startAudio(e){this.stopAudio();const t=this.pcm;if(!t||t.samples.length===0||typeof AudioContext>"u")return;this.audioCtx??=new AudioContext;const r=this.audioCtx.createBuffer(1,t.samples.length,t.rate);r.getChannelData(0).set(t.samples);const s=this.audioCtx.createBufferSource();s.buffer=r,s.connect(this.audioCtx.destination);const i=Math.max(0,Math.min(r.duration,e/Math.max(1,this.fps)));s.start(0,i),this.audioNode=s}stopAudio(){const e=this.audioNode;if(this.audioNode=null,!!e)try{e.stop()}catch{}}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,t){this.viewport={w:e,h:t},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,t=this.panX,r=this.panY){const s=Math.max(.1,Math.min(16,e)),i=Math.abs(s-this.zoom)>1e-6;this.zoom=s,this.panX=t,this.panY=r,i&&this.viewport.w>0&&this.sendViewport(),this.savePersist()}resetView(){this.setZoom(1,0,0)}sceneStart(e){const t=this.scenes.find(r=>r.name===e);return t?t.start/this.fps:0}sceneAt(e){return[...this.scenes].reverse().find(t=>t.start<=e)??this.scenes[0]}markerFrame(e){return Math.round((this.sceneStart(e.scene)+e.time)*this.fps)}moveMarker(e,t,r){const s=Math.max(0,r/this.fps-this.sceneStart(e));this.send({type:"SetMarker",name:t,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 t=new Set(this.markers.filter(i=>i.scene===e.name).map(i=>i.name));let r=1;for(;t.has(`marker-${r}`);)r+=1;const s=`marker-${r}`;this.moveMarker(e.name,s,this.frame),this.selectedMarker={scene:e.name,name:s}}setEase(e,t){this.send({type:"SetEase",name:e,value:t})}setTunable(e,t){this.send({type:"SetTunable",name:e,value:t})}setTransition(e,t){this.send({type:"SetTransition",scene:e,seconds:Number(Math.max(0,t).toFixed(6))})}pick(e,t){this.send({type:"Pick",x:e,y:t})}select(e){this.selected=e,this.send({type:"Select",node_id:e})}get time(){return this.frame/Math.max(1,this.fps)}toggleCommenting(){this.commenting=!this.commenting,this.draft=null,this.draftPick=null,this.commenting&&this.playing&&this.pause()}startDraft(e,t){const r=Number(this.time.toFixed(3));this.draft={rect:e,time:[r,r],node:t,text:""}}startDraftAt(e,t){this.draftPick={x:e,y:t},this.pick(e,t)}draftFromNode(e,t){this.draftPick=null;const r=[t[0],t[2],t[4],t[6]],s=[t[1],t[3],t[5],t[7]],i=this.tree.find(c=>c.id===e),o=i?i.name??i.kind:`#${e}`;this.startDraft(er(Math.min(...r),Math.min(...s),Math.max(...r),Math.max(...s)),{id:e,label:o,source:i?.source})}draftUntilPlayhead(){if(!this.draft)return;const e=Number(this.time.toFixed(3)),t=this.draft.time[0];this.draft.time=[Math.min(t,e),Math.max(t,e)]}async saveDraft(){const e=this.draft;if(!e||!e.text.trim())return;this.draft=null;const t=this.image?await za(this.image,this.size,e.rect).catch(()=>{}):void 0,r=this.scenes.find(s=>this.frame>=s.start&&this.frame<s.start+s.frames);this.sendCli({type:"NoteAdd",text:e.text.trim(),time:e.time,scene:r?.name,node:e.node?.label,source:e.node?.source,bounds:qa(e.rect,this.size),crop_png:t})}setNoteStatus(e,t){this.sendCli({type:"NoteSet",id:e,status:t})}deleteNote(e){this.sendCli({type:"NoteDelete",id:e})}goToNote(e){this.seek(Math.round(e.time[0]*this.fps))}noteCropUrl(e){if(!e.crop||typeof location>"u")return null;const t=new URLSearchParams(location.search).get("token")??"";return`/notes/${encodeURIComponent(e.crop)}?token=${encodeURIComponent(t)}`}sendCli(e){this.backend.send(e)}dismissError(){this.error=null}savePersist(){this.persistEnabled&&io({frame:this.frame,zoom:this.zoom,panX:this.panX,panY:this.panY,selected:this.selected})}}function Nr(n,e){const t=n/Math.max(1,e),r=Math.floor(t/60),s=Math.floor(t%60),i=n%Math.max(1,e);return`${r}:${String(s).padStart(2,"0")}.${String(i).padStart(2,"0")}`}var co=K('<div class="transition svelte-112n2zp"><button class="trim svelte-112n2zp"></button></div>'),uo=K('<div class="scene svelte-112n2zp"><span> </span></div> <!>',1),fo=K('<div class="clip music svelte-112n2zp" data-testid="audio-track"><span class="svelte-112n2zp"> </span></div>'),ho=K('<div data-testid="audio-clip"><span class="svelte-112n2zp"> </span></div>'),vo=K('<button class="note-span svelte-112n2zp"></button>'),po=K('<button><span class="flag svelte-112n2zp"> </span></button>'),mo=K('<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 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 go(n,e){it(e,!0);let t=tt(e,"editor",7),r,s,i=D(0);const o=de(()=>Math.max(1,t().frames)),c=de(()=>{const y=[],p=new Set;for(const te of Object.values(t().metas)){const fe=te.audio?.file;if(!fe)continue;const Z=An(fe);p.has(Z)||(p.add(Z),y.push({name:Z,file:fe,start:te.audio?.offset??0}))}return y}),l=y=>y/Math.max(1,a(o)-1)*a(i),u=y=>{const p=r.getBoundingClientRect(),te=Math.min(1,Math.max(0,(y-p.left)/Math.max(1,p.width)));return Math.round(te*(a(o)-1))};let h=!1,d=!1,v=null;function f(y){v=y,requestAnimationFrame(()=>{v!==null&&t().seek(v),v=null})}function m(y){const p=y.target;p.dataset.marker||p.closest("[data-transition]")||(h=!0,r.setPointerCapture(y.pointerId),d=t().playing,d&&t().pause(),f(u(y.clientX)))}function q(y){h&&f(u(y.clientX))}function b(){h&&(h=!1,d&&(d=!1,requestAnimationFrame(()=>t().play())))}let M=D(null);const N=y=>a(M)&&a(M).m.name===y.name&&a(M).m.scene===y.scene?a(M).frame:t().markerFrame(y);function S(y,p){y.stopPropagation(),y.target.setPointerCapture(y.pointerId),t().selectedMarker={scene:p.scene,name:p.name},C(M,{m:p,frame:t().markerFrame(p)},!0)}function $(y){a(M)&&C(M,{...a(M),frame:u(y.clientX)},!0)}function J(){if(!a(M))return;const{m:y,frame:p}=a(M);C(M,null),p!==t().markerFrame(y)&&t().moveMarker(y.scene,y.name,p)}function O(y,p){const te=y.key==="ArrowLeft"?-1:y.key==="ArrowRight"?1:0;te?(y.preventDefault(),t().moveMarker(p.scene,p.name,t().markerFrame(p)+te*(y.shiftKey?10:1))):y.key==="Enter"&&t().seek(t().markerFrame(p))}let z=D(null);const ee=y=>a(z)&&a(z).name===y.name?a(z).frames:y.transition??0;function ue(y,p){y.stopPropagation(),y.currentTarget.setPointerCapture(y.pointerId),C(z,{name:p.name,frames:p.transition??0},!0)}function P(y,p){if(!a(z)||a(z).name!==p.name)return;const te=p.start+(p.transition_at??0);C(z,{name:p.name,frames:Math.max(0,u(y.clientX)-te)},!0)}function G(y){if(!a(z)||a(z).name!==y.name)return;const p=a(z).frames;C(z,null),p!==(y.transition??0)&&t().setTransition(y.name,p/t().fps)}bt(()=>{const y=t().waveform,p=s?.getContext("2d");if(!p)return;const te=devicePixelRatio||1,fe=28;if(s.width=Math.max(1,Math.round(a(i)*te)),s.height=Math.round(fe*te),p.setTransform(te,0,0,te,0,0),p.clearRect(0,0,a(i),fe),!y||y.length===0)return;p.fillStyle=getComputedStyle(s).getPropertyValue("--m-wave")||"#4b5563";const Z=y.length;for(let me=0;me<a(i);me++){const ye=y[Math.min(Z-1,Math.floor(me/a(i)*Z))]??0,Me=Math.max(ye>.02?2:1,Math.pow(ye,.55)*fe);p.fillRect(me,(fe-Me)/2,1,Me)}});var re=mo(),Oe=V(re),Re=V(Oe),Ye=_(Re,2),ze=_(Ye,2),ot=Y(ze,!0),g=_(ze,2),F=_(g,2),W=_(F,2),w=Y(W,!0),E=_(W,2),A=Y(E),T=_(E,4),I=_(Oe,2);let X;x(I,"aria-valuemin",0);var se=V(I);De(se,21,()=>t().scenes,y=>y.name,(y,p)=>{var te=uo(),fe=cn(te);let Z;var me=V(fe),ye=Y(me,!0),Me=_(fe,2);{var Ce=Ne=>{var Ae=co();let Ft;var Je=Y(Ae);Q((lt,Kt,vn,pe)=>{x(Ae,"data-transition",a(p).name),x(Ae,"data-testid",`transition-${a(p).name??""}`),x(Ae,"title",lt),Ft=$e(Ae,"",Ft,{left:Kt,width:vn}),x(Je,"data-transition",a(p).name),x(Je,"aria-label",pe)},[()=>B("timeline.transition",{name:a(p).name,seconds:(ee(a(p))/t().fps).toFixed(2)}),()=>`${l(a(p).start+(a(p).transition_at??0))??""}px`,()=>`${Math.max(8,l(a(p).start+(a(p).transition_at??0)+ee(a(p)))-l(a(p).start+(a(p).transition_at??0)))}px`,()=>B("timeline.transition",{name:a(p).name,seconds:(ee(a(p))/t().fps).toFixed(2)})]),H("pointerdown",Je,lt=>ue(lt,a(p))),H("pointermove",Je,lt=>P(lt,a(p))),H("pointerup",Je,()=>G(a(p))),U(Ne,Ae)},Se=de(()=>ee(a(p))>0);ce(Me,Ne=>{a(Se)&&Ne(Ce)})}Q((Ne,Ae)=>{x(fe,"title",a(p).name),Z=$e(fe,"",Z,{left:Ne,width:Ae}),j(ye,a(p).name)},[()=>`${l(a(p).start)??""}px`,()=>`${Math.max(0,l(a(p).start+a(p).frames-1)-l(a(p).start))}px`]),U(y,te)});var R=_(se,2);De(R,17,()=>a(c),y=>y.name,(y,p,te,fe)=>{var Z=fo();let me;var ye=V(Z),Me=Y(ye,!0);Q((Ce,Se,Ne)=>{x(Z,"title",Ce),me=$e(Z,"",me,{left:Se,width:Ne}),j(Me,a(p).name)},[()=>B("timeline.soundtrack",{name:a(p).file}),()=>`${l(a(p).start*t().fps)??""}px`,()=>`${Math.max(2,a(i)-l(a(p).start*t().fps))}px`]),U(y,Z)});var k=_(R,2);De(k,19,()=>t().clips,(y,p)=>y.name+":"+p,(y,p)=>{var te=ho();let fe,Z;var me=V(te),ye=Y(me,!0);Q((Me,Ce,Se)=>{fe=ft(te,1,"clip svelte-112n2zp",null,fe,{effect:a(c).length>0,priority:a(p).priority}),x(te,"title",a(p).text??a(p).name),Z=$e(te,"",Z,{left:Me,width:Ce}),j(ye,Se)},[()=>`${l(a(p).start*t().fps)??""}px`,()=>`${Math.max(2,l((a(p).start+a(p).seconds)*t().fps)-l(a(p).start*t().fps))}px`,()=>a(p).text??An(a(p).name)]),U(y,te)});var L=_(k,2);let ae;dt(L,y=>s=y,()=>s);var le=_(L,2);De(le,17,()=>(t().notes??[]).filter(y=>y.status==="open"),y=>y.id,(y,p)=>{const te=de(()=>Math.round(a(p).time[0]*t().fps)),fe=de(()=>Math.round(a(p).time[1]*t().fps));var Z=vo();let me;Q((ye,Me,Ce)=>{x(Z,"title",`#${a(p).id??""} · ${a(p).text??""}`),x(Z,"aria-label",`Note ${a(p).id??""} at ${ye??""} s: ${a(p).text??""}`),x(Z,"data-testid",`note-tick-${a(p).id??""}`),me=$e(Z,"",me,{left:Me,width:Ce})},[()=>a(p).time[0].toFixed(2),()=>`${l(a(te))??""}px`,()=>`${Math.max(6,l(a(fe))-l(a(te)))}px`]),H("click",Z,()=>t().goToNote(a(p))),U(y,Z)});var he=_(le,2);De(he,17,()=>t().markers,y=>y.scene+"/"+y.name,(y,p)=>{const te=de(()=>N(a(p))),fe=de(()=>t().selectedMarker?.name===a(p).name&&t().selectedMarker?.scene===a(p).scene);var Z=po();let me,ye;var Me=V(Z),Ce=Y(Me,!0);Q((Se,Ne,Ae)=>{me=ft(Z,1,"marker svelte-112n2zp",null,me,{selected:a(fe)}),x(Z,"data-marker",a(p).name),x(Z,"data-testid",`marker-${a(p).name??""}`),x(Z,"aria-label",Se),x(Z,"title",`${a(p).name??""} · ${Ne??""} s`),ye=$e(Z,"",ye,{left:Ae}),j(Ce,a(p).name)},[()=>B("timeline.marker",{name:a(p).name,time:(a(te)/t().fps).toFixed(2)}),()=>(a(te)/t().fps).toFixed(2),()=>`${l(a(te))??""}px`]),H("pointerdown",Z,Se=>S(Se,a(p))),H("pointermove",Z,$),H("pointerup",Z,J),H("keydown",Z,Se=>O(Se,a(p))),Ct("focus",Z,()=>t().selectedMarker={scene:a(p).scene,name:a(p).name}),U(y,Z)});var Ee=_(he,2);let ve;dt(I,y=>r=y,()=>r),Q((y,p,te,fe,Z,me,ye,Me,Ce,Se,Ne,Ae,Ft,Je,lt,Kt)=>{x(re,"aria-label",y),x(Re,"title",p),x(Re,"aria-label",te),x(Ye,"title",fe),x(Ye,"aria-label",Z),x(ze,"title",me),x(ze,"aria-label",ye),j(ot,t().playing?"❚❚":"▶"),x(g,"title",Me),x(g,"aria-label",Ce),x(F,"title",Se),x(F,"aria-label",Ne),j(w,Ae),j(A,`${t().frame??""} / ${t().lastFrame??""}`),x(T,"title",Ft),X=ft(I,1,"track svelte-112n2zp",null,X,{"with-music":a(c).length>0}),x(I,"aria-label",Je),x(I,"aria-valuemax",t().lastFrame),x(I,"aria-valuenow",t().frame),x(I,"aria-valuetext",lt),ae=$e(L,"",ae,{width:`${a(i)??""}px`}),ve=$e(Ee,"",ve,{left:Kt})},[()=>B("timeline.label"),()=>B("transport.start"),()=>B("transport.start"),()=>B("transport.prev"),()=>B("transport.prev"),()=>t().playing?B("transport.pause"):B("transport.play"),()=>t().playing?B("transport.pause"):B("transport.play"),()=>B("transport.next"),()=>B("transport.next"),()=>B("transport.end"),()=>B("transport.end"),()=>Nr(t().frame,t().fps),()=>B("timeline.addMarker"),()=>B("timeline.label"),()=>Nr(t().frame,t().fps),()=>`${l(t().frame)??""}px`]),H("click",Re,()=>t().seek(0)),H("click",Ye,()=>t().step(-1)),H("click",ze,()=>t().togglePlay()),H("click",g,()=>t().step(1)),H("click",F,()=>t().seek(t().lastFrame)),H("click",T,()=>t().markerAtPlayhead()),H("pointerdown",I,m),H("pointermove",I,q),H("pointerup",I,b),Ct("pointercancel",I,b),ga(I,"clientWidth",y=>C(i,y)),U(n,re),at()}xt(["click","pointerdown","pointermove","pointerup","keydown"]);var _o=K(`<p class="dim svelte-gu3dqx">Press <kbd>C</kbd>, then click or drag in the frame. An agent running <code>oxframe notes wait</code> picks a note up at once; <code>oxframe check</code> gives open
          notes to the agent first.</p>`),bo=K('<img loading="lazy" class="svelte-gu3dqx"/>'),yo=K('<p class="note-reply svelte-gu3dqx"> </p>'),wo=K('<span class="note-agent svelte-gu3dqx">agent is on it</span> <button title="Hand the note back to the agent, for instance after answering its question">Send back</button>',1),xo=K("<button>Resolve</button>"),ko=K('<span class="dim svelte-gu3dqx">done</span> <button>Reopen</button>',1),Mo=K('<li><button class="note-go svelte-gu3dqx" title="Go to the note"><span class="note-id svelte-gu3dqx"> </span> <!></button> <p class="note-text svelte-gu3dqx"> </p> <!> <!> <div class="note-row svelte-gu3dqx"><!> <!> <button>Delete</button></div></li>'),Eo=K('<ol class="notes svelte-gu3dqx"></ol>'),So=K('<section data-testid="notes" class="svelte-gu3dqx"><h2 class="svelte-gu3dqx">Notes for the agent</h2> <!></section>'),Ao=K('<span class="name"> </span>'),To=K('<li role="treeitem"><button><span class="kind svelte-gu3dqx"> </span> <!> <span class="id svelte-gu3dqx"> </span></button></li>'),Ln=K('<p class="dim svelte-gu3dqx"> </p>'),Po=K('<span class="swatch svelte-gu3dqx"></span>'),Co=K('<tr><th scope="row" class="svelte-gu3dqx"> </th><td class="svelte-gu3dqx"><!> </td></tr>'),Fo=K('<table data-testid="signals" class="svelte-gu3dqx"><tbody></tbody></table>'),Ro=K('<label class="tunable svelte-gu3dqx"><span class="svelte-gu3dqx"> </span> <input type="range"/> <input type="number"/></label>'),No=K('<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>'),$o=K('<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 qo(n,e){it(e,!0);let t=tt(e,"editor",7);const r=de(()=>{const w=new Map(t().tree.map(A=>[A.id,A])),E=A=>{let T=0,I=A.parent;for(;I!=null&&T<64;)T+=1,I=w.get(I)?.parent??null;return T};return t().tree.map(A=>({n:A,depth:E(A)}))}),s=de(()=>Object.entries(t().metas).flatMap(([w,E])=>Object.entries(E.tunables??{}).map(([A,T])=>({scene:w,name:A,value:T})))),i=de(()=>Object.entries(t().metas).flatMap(([w,E])=>Object.entries(E.eases??{}).map(([A,T])=>({scene:w,name:A,value:T}))));function o(w){const E=w===0?10:Math.abs(w)*2,A=w>=0?0:w-E,T=w>=0?Math.max(w*2,1):w+E;return[A,T,(T-A)/200]}const c=new Map;function l(w,E){clearTimeout(c.get(w)),c.set(w,setTimeout(()=>t().setTunable(w,E),60))}const u=new Map;function h(w,E){return u.has(w)||u.set(w,o(E)),u.get(w)}function d(w){const[E=0,A=0,T=1,I=1]=w,X=24;return`M0 ${X} C${E*X} ${X-A*X} ${T*X} ${X-I*X} ${X} 0`}var v=$o(),f=V(v);{var m=w=>{var E=So(),A=_(V(E),2);{var T=X=>{var se=_o();U(X,se)},I=X=>{var se=Eo();De(se,21,()=>t().notes,R=>R.id,(R,k)=>{const L=de(()=>t().noteCropUrl(a(k))),ae=de(()=>a(k).status==="open"&&a(k).taken);var le=Mo();let he;var Ee=V(le),ve=V(Ee),y=Y(ve),p=_(ve),te=_(p);{var fe=pe=>{var _e=Gn();Q(()=>j(_e,`· ${a(k).node??""}`)),U(pe,_e)};ce(te,pe=>{a(k).node&&pe(fe)})}var Z=_(Ee,2),me=Y(Z,!0),ye=_(Z,2);{var Me=pe=>{var _e=bo();Q(()=>{x(_e,"src",a(L)),x(_e,"alt",`The marked area of note ${a(k).id??""}`)}),U(pe,_e)};ce(ye,pe=>{a(L)&&pe(Me)})}var Ce=_(ye,2);{var Se=pe=>{var _e=yo(),Rt=Y(_e);Q(()=>{x(_e,"data-testid",`note-reply-${a(k).id??""}`),j(Rt,`↳ ${a(k).reply??""}`)}),U(pe,_e)};ce(Ce,pe=>{a(k).reply&&pe(Se)})}var Ne=_(Ce,2),Ae=V(Ne);{var Ft=pe=>{var _e=wo(),Rt=cn(_e),qs=_(Rt,2);Q(()=>x(Rt,"data-testid",`note-taken-${a(k).id??""}`)),H("click",qs,()=>t().setNoteStatus(a(k).id,"open")),U(pe,_e)};ce(Ae,pe=>{a(ae)&&pe(Ft)})}var Je=_(Ae,2);{var lt=pe=>{var _e=xo();H("click",_e,()=>t().setNoteStatus(a(k).id,"done")),U(pe,_e)},Kt=pe=>{var _e=ko(),Rt=_(cn(_e),2);H("click",Rt,()=>t().setNoteStatus(a(k).id,"open")),U(pe,_e)};ce(Je,pe=>{a(k).status==="open"?pe(lt):pe(Kt,-1)})}var vn=_(Je,2);Q((pe,_e)=>{x(le,"data-testid",`note-${a(k).id??""}`),he=ft(le,1,"svelte-gu3dqx",null,he,{done:a(k).status==="done",taken:a(ae)}),j(y,`#${a(k).id??""}`),j(p,` ${pe??""}${_e??""} s `),j(me,a(k).text),x(vn,"aria-label",`Delete note ${a(k).id??""}`)},[()=>a(k).time[0].toFixed(2),()=>a(k).time[1]>a(k).time[0]?`–${a(k).time[1].toFixed(2)}`:""]),H("click",Ee,()=>t().goToNote(a(k))),H("click",vn,()=>t().deleteNote(a(k).id)),U(R,le)}),U(X,se)};ce(A,X=>{t().notes.length===0?X(T):X(I,-1)})}U(w,E)};ce(f,w=>{t().notes!==null&&w(m)})}var q=_(f,2),b=V(q),M=Y(b,!0),N=_(b,2);De(N,21,()=>a(r),({n:w,depth:E})=>w.id,(w,E)=>{let A=()=>a(E).n,T=()=>a(E).depth;var I=To(),X=V(I);let se,R;var k=V(X),L=Y(k,!0),ae=_(k,2);{var le=ve=>{var y=Ao(),p=Y(y,!0);Q(()=>j(p,A().name)),U(ve,y)};ce(ae,ve=>{A().name&&ve(le)})}var he=_(ae,2),Ee=Y(he);Q(()=>{x(I,"aria-selected",t().selected===A().id),se=ft(X,1,"node svelte-gu3dqx",null,se,{sel:t().selected===A().id}),R=$e(X,"",R,{"padding-left":`${8+T()*12}px`}),j(L,A().kind),j(Ee,`#${A().id??""}`)}),H("click",X,()=>t().select(A().id===t().selected?null:A().id)),U(w,I)});var S=_(q,2),$=V(S),J=Y($,!0),O=_($,2);{var z=w=>{var E=Ln(),A=Y(E,!0);Q(T=>j(A,T),[()=>B("inspector.noSelection")]),U(w,E)},ee=w=>{var E=Fo(),A=V(E);De(A,21,()=>t().signals,T=>T.name,(T,I)=>{var X=Co(),se=V(X),R=Y(se,!0),k=_(se),L=V(k);{var ae=Ee=>{var ve=Po();let y;Q(()=>y=$e(ve,"",y,{background:a(I).value})),U(Ee,ve)},le=de(()=>/^#[0-9a-f]{8}$/i.test(a(I).value));ce(L,Ee=>{a(le)&&Ee(ae)})}var he=_(L);Q(()=>{j(R,a(I).name),j(he,` ${a(I).value??""}`)}),U(T,X)}),U(w,E)};ce(O,w=>{t().selected===null?w(z):w(ee,-1)})}var ue=_(S,2),P=V(ue),G=Y(P,!0),re=_(P,2);{var Oe=w=>{var E=Ln(),A=Y(E,!0);Q(T=>j(A,T),[()=>B("inspector.none")]),U(w,E)};ce(re,w=>{a(s).length===0&&w(Oe)})}var Re=_(re,2);De(Re,17,()=>a(s),w=>w.scene+w.name,(w,E)=>{const A=de(()=>{const[k,L,ae]=h(a(E).name,a(E).value);return{min:k,max:L,step:ae}});var T=Ro(),I=V(T),X=Y(I,!0),se=_(I,2),R=_(se,2);Q(()=>{j(X,a(E).name),x(se,"min",a(A).min),x(se,"max",a(A).max),x(se,"step",a(A).step),Ar(se,a(E).value),x(se,"data-testid",`tunable-${a(E).name??""}`),x(R,"step",a(A).step),Ar(R,a(E).value),x(R,"aria-label",`${a(E).name??""} value`)}),H("input",se,k=>l(a(E).name,+k.currentTarget.value)),H("change",R,k=>t().setTunable(a(E).name,+k.currentTarget.value)),U(w,T)});var Ye=_(ue,2),ze=V(Ye),ot=Y(ze,!0),g=_(ze,2);{var F=w=>{var E=Ln(),A=Y(E,!0);Q(T=>j(A,T),[()=>B("inspector.none")]),U(w,E)};ce(g,w=>{a(i).length===0&&w(F)})}var W=_(g,2);De(W,17,()=>a(i),w=>w.scene+w.name,(w,E)=>{var A=No(),T=V(A),I=Y(T),X=_(T,2),se=Y(X,!0),R=_(X,2),k=Y(R,!0);Q((L,ae)=>{x(A,"data-testid",`ease-${a(E).name??""}`),x(I,"d",L),j(se,a(E).name),j(k,ae)},[()=>d(a(E).value),()=>a(E).value.map(L=>L.toFixed(2)).join(", ")]),H("click",A,()=>t().editingEase={scene:a(E).scene,name:a(E).name}),U(w,A)}),Q((w,E,A,T)=>{j(M,w),j(J,E),j(G,A),j(ot,T)},[()=>B("inspector.tree"),()=>B("inspector.signals"),()=>B("inspector.tunables"),()=>B("inspector.eases")]),U(n,v),at()}xt(["click","input","change"]);var Oo=K('<span class="dim svelte-1qw5yfa"> </span>'),zo=K("<li><code> </code> </li>"),Io=K('<ul class="svelte-1qw5yfa"></ul>'),Do=K('<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 Lo(n,e){it(e,!0);const t=de(()=>e.editor.error),r=de(()=>a(t).kind==="Build"?B("error.build"):a(t).kind==="Incompatible"?B("error.incompatible"):a(t).kind==="Meta"?B("error.meta"):B("error.runtime"));var s=Do(),i=V(s),o=V(i),c=Y(o,!0),l=_(o,2);{var u=b=>{var M=Oo(),N=Y(M,!0);Q(S=>j(N,S),[()=>B("error.previous")]),U(b,M)};ce(l,b=>{a(t).kind==="Build"&&b(u)})}var h=_(l,2),d=Y(h,!0),v=_(i,2);{var f=b=>{var M=Io();De(M,21,()=>a(t).spans,ia,(N,S)=>{var $=zo(),J=V($),O=Y(J),z=_(J);Q(()=>{j(O,`${a(S).file??""}:${a(S).line??""}:${a(S).column??""}`),j(z,` ${a(S).message??""}`)}),U(N,$)}),U(b,M)};ce(v,b=>{a(t).spans.length&&b(f)})}var m=_(v,2),q=Y(m,!0);Q(b=>{j(c,a(r)),j(d,b),j(q,a(t).message)},[()=>B("error.dismiss")]),H("click",h,()=>e.editor.dismissError()),U(n,s),at()}xt(["click"]);function Uo(n,e,t,r){const s=3*n,i=3*(t-n)-s,o=1-s-i,c=3*e,l=3*(r-e)-c,u=1-c-l,h=f=>((o*f+i)*f+s)*f,d=f=>((u*f+l)*f+c)*f,v=f=>(3*o*f+2*i)*f+s;return f=>{if(f<=0)return 0;if(f>=1)return 1;let m=f;for(let M=0;M<8;M++){const N=h(m)-f;if(Math.abs(N)<1e-7)return d(m);const S=v(m);if(Math.abs(S)<1e-6)break;m=Math.min(1,Math.max(0,m-N/S))}let q=0,b=1;m=f;for(let M=0;M<40;M++){const N=h(m);if(Math.abs(N-f)<1e-7)break;N<f?q=m:b=m,m=(q+b)/2}return d(m)}}const $r={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 jo=vr('<circle r="8" class="handle svelte-12hhbkq" tabindex="0" role="slider"></circle>'),Bo=K("<option> </option>"),Ho=K('<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 Vo(n,e){it(e,!0);let t=tt(e,"editor",7);const r=de(()=>t().editingEase),s=de(()=>t().metas[a(r).scene]?.eases?.[a(r).name]??[.65,0,.35,1]);let i=de(()=>[a(s)[0]??0,a(s)[1]??0,a(s)[2]??1,a(s)[3]??1]);const o=240,c=20,l=R=>c+R*o,u=R=>c+(1.5-R)*(o/2),h=(R,k)=>[Math.min(1,Math.max(0,(R-c)/o)),Math.min(1.5,Math.max(-.5,1.5-(k-c)/(o/2)))];let d,v=null,f;function m(){clearTimeout(f),f=setTimeout(()=>t().setEase(a(r).name,[...a(i)]),80)}function q(R){if(v===null)return;const k=d.getBoundingClientRect(),L=(c*2+o)/k.width,[ae,le]=h((R.clientX-k.left)*L,(R.clientY-k.top)*L),he=[...a(i)];he[v*2]=Number(ae.toFixed(3)),he[v*2+1]=Number(le.toFixed(3)),C(i,he),m()}function b(R,k){const L=R.shiftKey?.1:.01,le={ArrowLeft:[-L,0],ArrowRight:[L,0],ArrowUp:[0,L],ArrowDown:[0,-L]}[R.key];if(!le)return;R.preventDefault();const he=[...a(i)];he[k*2]=Math.min(1,Math.max(0,he[k*2]+le[0])),he[k*2+1]=Math.min(1.5,Math.max(-.5,he[k*2+1]+le[1])),C(i,he),m()}const M=de(()=>`M${l(0)} ${u(0)} C${l(a(i)[0])} ${u(a(i)[1])} ${l(a(i)[2])} ${u(a(i)[3])} ${l(1)} ${u(1)}`);let N=D(0);Xt(()=>{let R=0;const k=performance.now(),L=ae=>{const le=(ae-k)/1400%1.4;C(N,Uo(...a(i))(Math.min(1,le)),!0),R=requestAnimationFrame(L)};return R=requestAnimationFrame(L),()=>cancelAnimationFrame(R)});var S=Ho(),$=cn(S),J=_($,2),O=V(J),z=V(O),ee=Y(z,!0),ue=_(z,2),P=Y(ue,!0),G=_(O,2);x(G,"viewBox","0 0 280 280");var re=V(G);x(re,"width",o),x(re,"height",o/2);var Oe=_(re),Re=_(Oe),Ye=_(Re),ze=_(Ye),ot=_(ze),g=_(ot);De(g,16,()=>[0,1],R=>R,(R,k)=>{var L=jo();Q((ae,le,he,Ee)=>{x(L,"cx",ae),x(L,"cy",le),x(L,"aria-label",`control point ${k+1}`),x(L,"aria-valuetext",`${he??""}, ${Ee??""}`),x(L,"aria-valuenow",a(i)[k*2+1]),x(L,"data-testid",`handle-${k??""}`)},[()=>l(a(i)[k*2]),()=>u(a(i)[k*2+1]),()=>a(i)[k*2].toFixed(2),()=>a(i)[k*2+1].toFixed(2)]),H("pointerdown",L,ae=>{v=k,d.setPointerCapture(ae.pointerId)}),H("keydown",L,ae=>b(ae,k)),U(R,L)});var F=_(g);x(F,"cy",o+c*2-6),dt(G,R=>d=R,()=>d);var W=_(G,2),w=V(W),E=V(w),A=_(E),T=V(A);T.value=T.__value="";var I=_(T);De(I,16,()=>Object.keys($r),R=>R,(R,k)=>{var L=Bo(),ae=Y(L,!0),le={};Q(()=>{j(ae,k),le!==(le=k)&&(L.value=(L.__value=le)??"")}),U(R,L)});var X=_(w,2),se=Y(X);Q((R,k,L,ae,le,he,Ee,ve,y,p,te,fe,Z,me,ye,Me,Ce,Se,Ne,Ae)=>{x(J,"aria-label",R),j(ee,k),j(P,L),x(re,"x",ae),x(re,"y",le),x(Oe,"x1",he),x(Oe,"y1",Ee),x(Oe,"x2",ve),x(Oe,"y2",y),x(Re,"x1",p),x(Re,"y1",te),x(Re,"x2",fe),x(Re,"y2",Z),x(Ye,"d",a(M)),x(ze,"cx",me),x(ze,"cy",ye),x(ot,"cx",Me),x(ot,"cy",Ce),x(F,"cx",Se),j(E,`${Ne??""} `),j(se,`[${Ae??""}]`)},[()=>B("curve.title",{name:a(r).name}),()=>B("curve.title",{name:a(r).name}),()=>B("curve.close"),()=>l(0),()=>u(1),()=>l(0),()=>u(0),()=>l(a(i)[0]),()=>u(a(i)[1]),()=>l(1),()=>u(1),()=>l(a(i)[2]),()=>u(a(i)[3]),()=>l(0),()=>u(0),()=>l(1),()=>u(1),()=>l(a(N)),()=>B("curve.presets"),()=>a(i).map(R=>R.toFixed(2)).join(", ")]),H("click",$,()=>t().editingEase=null),H("click",ue,()=>t().editingEase=null),H("pointermove",G,q),H("pointerup",G,()=>v=null),H("change",A,R=>{const k=$r[R.currentTarget.value];k&&(C(i,[...k]),m())}),U(n,S),at()}xt(["click","pointermove","pointerup","pointerdown","keydown","change"]);var Yo=K('<div data-testid="editor" tabindex="-1"><!> <main class="svelte-1ctqrjb"><section class="stage svelte-1ctqrjb"><!> <!></section> <!></main> <!> <!></div>');function Wo(n,e){it(e,!0);let t=tt(e,"editor",7),r=tt(e,"autostart",3,!0),s=tt(e,"compact",3,!1),i=tt(e,"scopedKeys",3,!1),o;function c(){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 l=D(xe(pt(()=>e.theme)??c()));function u(){C(l,a(l)==="dark"?"light":"dark",!0);try{localStorage.setItem("oxframe-theme",a(l))}catch{}document.documentElement.dataset.theme=a(l),window.dispatchEvent(new CustomEvent("oxframe-theme",{detail:a(l)}))}const h=P=>{const G=P.detail;(G==="dark"||G==="light")&&C(l,G,!0)};Xt(()=>{window.addEventListener("oxframe-theme",h),r()&&t().start()}),As(()=>{typeof window<"u"&&window.removeEventListener("oxframe-theme",h),r()&&t().stop()});function d(P){const G=P.target;if(i()&&!o?.contains(document.activeElement)||G&&(G.closest("input, textarea, select, [contenteditable]")||G.isContentEditable)||G?.dataset.marker&&(P.key==="ArrowLeft"||P.key==="ArrowRight"))return;const re=P.shiftKey?1:5;switch(P.key){case" ":t().togglePlay();break;case"ArrowLeft":t().seekBy(-re);break;case"ArrowRight":t().seekBy(re);break;case",":t().step(-1);break;case".":t().step(1);break;case"<":t().step(-10);break;case">":t().step(10);break;case"Home":t().seek(0);break;case"End":t().seek(t().lastFrame);break;case"m":case"M":t().markerAtPlayhead();break;case"c":case"C":if(t().notes===null||P.ctrlKey||P.metaKey)return;t().toggleCommenting();break;case"Escape":t().draft?t().draft=null:t().commenting?t().toggleCommenting():t().editingEase?t().editingEase=null:t().error?t().dismissError():t().selectedMarker=null;break;default:return}P.preventDefault()}var v=Yo();Ct("keydown",ln,d);let f;var m=V(v);{var q=P=>{Na(P,{get editor(){return t()},get theme(){return a(l)},onToggleTheme:u})};ce(m,P=>{s()||P(q)})}var b=_(m,2),M=V(b),N=V(M);Wa(N,{get editor(){return t()}});var S=_(N,2);{var $=P=>{Lo(P,{get editor(){return t()}})};ce(S,P=>{t().error&&P($)})}var J=_(M,2);{var O=P=>{qo(P,{get editor(){return t()}})};ce(J,P=>{s()||P(O)})}var z=_(b,2);go(z,{get editor(){return t()}});var ee=_(z,2);{var ue=P=>{Vo(P,{get editor(){return t()}})};ce(ee,P=>{t().editingEase&&P(ue)})}dt(v,P=>o=P,()=>o),Q(P=>{f=ft(v,1,"oxframe-editor svelte-1ctqrjb",null,f,{compact:s()}),x(v,"data-theme",a(l)),x(M,"aria-label",P)},[()=>B("viewport.label")]),U(n,v),at()}const Fs="oxframe-present";class Xo{constructor(e){this.editor=e}editor;#e=D(-1);get index(){return a(this.#e)}set index(e){C(this.#e,e,!0)}target=null;channel=null;get stops(){return this.editor.slides.length>0?this.editor.slides:this.editor.scenes.filter(e=>e.frames>0).map(e=>({scene:e.name,frame:e.start+e.frames-1,notes:""}))}get total(){return this.stops.length}frameOf(e){return e<0?0:this.stops[e]?.frame??this.editor.lastFrame}next(){if(this.target!==null){this.land(this.target);return}if(this.index+1>=this.total)return;this.index+=1;const e=this.frameOf(this.index);if(e<=this.editor.frame){this.land(e);return}this.target=e,this.editor.play(),this.broadcast()}prev(){this.target=null,this.index=Math.max(-1,this.index-1),this.editor.pause(),this.editor.seek(this.frameOf(this.index)),this.broadcast()}first(){this.target=null,this.index=-1,this.editor.pause(),this.editor.seek(0),this.broadcast()}onFrame(e){this.target!==null&&e>=this.target&&this.land(this.target)}land(e){this.target=null,this.editor.pause(),this.editor.seek(e),this.broadcast()}status(){const e=r=>this.stops[r]?.notes??"",t=this.target!==null?this.index:this.index+1;return{index:this.index,total:this.total,notes:e(t),nextNotes:e(t+1),playing:this.target!==null}}connect(){if(typeof BroadcastChannel>"u")return()=>{};const e=new BroadcastChannel(Fs);return this.channel=e,e.onmessage=t=>{const r=t.data;r.type==="next"?this.next():r.type==="prev"?this.prev():r.type==="first"?this.first():r.type==="hello"&&this.broadcast()},()=>{e.close(),this.channel=null}}broadcast(){this.channel?.postMessage({type:"status",status:this.status()})}}function Rs(n){switch(n){case"ArrowRight":case"ArrowDown":case"PageDown":case" ":case"Enter":return"next";case"ArrowLeft":case"ArrowUp":case"PageUp":case"Backspace":return"prev";case"Home":return"first";default:return null}}var Ko=K('<p class="hint svelte-n614vz">→ next · ← back · F full screen · N notes</p>'),Go=K('<p class="error svelte-n614vz" role="alert"> </p>'),Zo=K('<div class="present svelte-n614vz" data-testid="present" role="presentation"><canvas class="svelte-n614vz"></canvas> <div class="counter svelte-n614vz" data-testid="present-counter"> </div> <!> <!></div>');function Jo(n,e){it(e,!0);let t=tt(e,"autostart",3,!0);const r=new Xo(pt(()=>e.editor));let s,i,o=D(xe({w:0,h:0})),c=D(!0);Xt(()=>{t()&&e.editor.start();const S=r.connect(),$=new ResizeObserver(([O])=>{if(!O)return;const{width:z,height:ee}=O.contentRect;C(o,{w:Math.round(z),h:Math.round(ee)},!0),e.editor.setViewport(a(o).w,a(o).h)});$.observe(s);const J=setTimeout(()=>C(c,!1),4e3);return()=>{$.disconnect(),S(),clearTimeout(J)}}),As(()=>{t()&&e.editor.stop()}),bt(()=>{r.onFrame(e.editor.frame)}),bt(()=>{e.editor.slides,r.broadcast()}),bt(()=>{const S=i?.getContext("2d");if(!S)return;const $=typeof devicePixelRatio=="number"?devicePixelRatio:1,{w:J,h:O}=a(o);(i.width!==Math.round(J*$)||i.height!==Math.round(O*$))&&(i.width=Math.round(J*$),i.height=Math.round(O*$)),S.setTransform($,0,0,$,0,0),S.fillStyle="#000",S.fillRect(0,0,J,O);const[z,ee]=e.editor.size,ue=Math.min(J/z,O/ee),[P,G]=[z*ue,ee*ue],re=e.editor.image;re&&(S.imageSmoothingQuality="high",S.drawImage(re,(J-P)/2,(O-G)/2,P,G))});function l(S){if(S.key==="f"||S.key==="F")u();else if(S.key==="n"||S.key==="N")h();else{const $=Rs(S.key);if(!$)return;r[$]()}S.preventDefault()}async function u(){document.fullscreenElement?await document.exitFullscreen():await s.requestFullscreen?.()}function h(){const S=new URL(location.href);S.searchParams.set("present","notes"),window.open(S.toString(),"oxframe-notes","width=720,height=520")}var d=Zo();Ct("keydown",ln,l);var v=V(d);dt(v,S=>i=S,()=>i);var f=_(v,2),m=Y(f),q=_(f,2);{var b=S=>{var $=Ko();U(S,$)};ce(q,S=>{a(c)&&S(b)})}var M=_(q,2);{var N=S=>{var $=Go(),J=Y($,!0);Q(()=>j(J,e.editor.error.message)),U(S,$)};ce(M,S=>{e.editor.error&&S(N)})}dt(d,S=>s=S,()=>s),Q(()=>j(m,`${r.index+1} / ${r.total??""}`)),H("click",d,()=>r.next()),U(n,d),at()}xt(["click"]);var Qo=K('<div class="notes svelte-18gf6mg" data-testid="present-notes"><header class="svelte-18gf6mg"><span class="slide svelte-18gf6mg" data-testid="present-notes-counter"><!></span> <span class="timer svelte-18gf6mg" data-testid="present-timer"> </span> <button type="button" class="svelte-18gf6mg">Reset timer</button></header> <section><h2 class="svelte-18gf6mg">Now</h2> <p class="text svelte-18gf6mg" data-testid="present-notes-now"> </p></section> <section class="next svelte-18gf6mg"><h2 class="svelte-18gf6mg">Next</h2> <p class="text svelte-18gf6mg"> </p></section> <footer class="svelte-18gf6mg"><button type="button" class="svelte-18gf6mg">← Back</button> <button type="button" class="svelte-18gf6mg">Next →</button></footer></div>');function el(n,e){it(e,!0);let t=D(null),r=D(null),s=D(xe(Date.now())),i=null;Xt(()=>{if(typeof BroadcastChannel>"u")return;i=new BroadcastChannel(Fs),i.onmessage=re=>{re.data.type==="status"&&(C(t,re.data.status,!0),a(r)===null&&a(t).index>=0&&C(r,Date.now(),!0))},o({type:"hello"});const G=setInterval(()=>C(s,Date.now(),!0),500);return()=>{clearInterval(G),i?.close()}});function o(G){i?.postMessage(G)}function c(G){const re=Rs(G.key);re&&(o({type:re}),G.preventDefault())}const l=de(()=>{if(a(r)===null)return"0:00";const G=Math.floor((a(s)-a(r))/1e3);return`${Math.floor(G/60)}:${String(G%60).padStart(2,"0")}`});var u=Qo();Ct("keydown",ln,c);var h=V(u),d=V(h),v=V(d);{var f=G=>{var re=Gn();Q(()=>j(re,`Stop ${a(t).index+1} of ${a(t).total??""}`)),U(G,re)},m=G=>{var re=Gn("Waiting for the presentation…");U(G,re)};ce(v,G=>{a(t)?G(f):G(m,-1)})}var q=_(d,2),b=Y(q,!0),M=_(q,2),N=_(h,2),S=_(V(N),2),$=Y(S,!0),J=_(N,2),O=_(V(J),2),z=Y(O,!0),ee=_(J,2),ue=V(ee),P=_(ue,2);Q(()=>{j(b,a(l)),j($,a(t)?.notes||"—"),j(z,a(t)?.nextNotes||"—")}),H("click",M,()=>C(r,Date.now(),!0)),H("click",ue,()=>o({type:"prev"})),H("click",P,()=>o({type:"next"})),U(n,u),at()}xt(["click"]);const mr=new URLSearchParams(location.search),Ns=window.__OXFRAME_CONFIG__??{},tl=mr.get("backend")??Ns.backend??"ws",$s=tl==="mock"?new Ea:new Ma({url:Ns.url??"/ws",token:mr.get("token")??void 0}),tr=mr.get("present"),nr=new lo($s,{uiVersion:"0.2.2",persist:tr===null});window.__oxframe={editor:nr,backend:$s};const Un=document.getElementById("app");tr==="notes"?$n(el,{target:Un}):tr!==null?$n(Jo,{target:Un,props:{editor:nr}}):$n(Wo,{target:Un,props:{editor:nr}});