@spearwolf/shadow-objects 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
@file @spearwolf/shadow-objects - a reactive entity-component framework that feels at home in the shadows
|
|
3
3
|
@author Wolfger Schramm <wolfger@spearwolf.de>
|
|
4
|
-
@version 0.
|
|
4
|
+
@version 0.16.0+bundle.20250326
|
|
5
5
|
|
|
6
6
|
Copyright 2025 Wolfger Schramm
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ See the License for the specific language governing permissions and
|
|
|
18
18
|
limitations under the License.
|
|
19
19
|
|
|
20
20
|
*/
|
|
21
|
-
var ee="*",Qt=1,vt=2,wt=4,D=Symbol.for("eventize"),Ns="[eventize]",$e=s=>s===ee,Yt=s=>{switch(typeof s){case"string":case"symbol":return!0;default:return!1}},Kt=typeof console<"u",Ds=Kt?console[console.warn?"warn":"log"].bind(console,Ns):()=>{},$s=(s,e,t)=>(Object.defineProperty(s,e,{value:t,configurable:!0}),s),Is=0,Jt=class{static publish(s){s.sort((e,t)=>e.order-t.order).forEach(e=>e.emit())}events=new Map;eventNames=new Set;add(s){Array.isArray(s)?s.forEach(e=>this.eventNames.add(e)):this.eventNames.add(s)}remove(s){Array.isArray(s)?s.forEach(e=>this.eventNames.delete(e)):this.eventNames.delete(s),this.clear(s)}clear(s){Array.isArray(s)?s.forEach(e=>this.events.delete(e)):this.events.delete(s)}retain(s,e){this.eventNames.has(s)&&this.events.set(s,{args:e,order:Is++})}isKnown(s){return this.eventNames.has(s)}emit(s,e,t=[]){if($e(s))this.eventNames.forEach(r=>this.emit(r,e,t));else if(this.events.has(s)){let{order:r,args:i}=this.events.get(s);t.push({order:r,emit:()=>e.apply(s,i)})}return t}},mt=(s,e,t,r)=>{if(typeof e=="function"){let i=e.apply(s,t);i!=null&&r?.(i)}},Ws=(s,e,t,r)=>mt(e,e.emit,[s].concat(t),r),Fs=s=>{switch(typeof s){case"function":return Qt;case"string":case"symbol":return vt;case"object":return wt}},Us=0,Vs=()=>++Us,Xt=class{id;eventName;isCatchEmAll;priority;listener;listenerObject;listenerType;callAfterApply;isRemoved;refCount;constructor(s,e,t,r=null){this.id=Vs(),this.eventName=s,this.isCatchEmAll=$e(s),this.listener=t,this.listenerObject=r,this.priority=e,this.listenerType=Fs(t),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(s,e=null){if(s===this)return!0;let t=typeof s;return t==="number"&&s===this.id?!0:e===null&&(t==="string"||t==="symbol")?s===ee||s===this.eventName:this.listener===s&&this.listenerObject===e}apply(s,e,t){if(this.isRemoved)return;let{listener:r,listenerObject:i}=this;switch(this.listenerType){case Qt:mt(i,r,e,t),this.callAfterApply&&this.callAfterApply();break;case vt:mt(i,i[r],e,t),this.callAfterApply&&this.callAfterApply();break;case wt:{let n=r[s];if(this.isCatchEmAll||this.eventName===s){if(typeof n=="function"){let o=n.apply(r,e);o!=null&&t?.(o)}else Ws(s,r,e,t);this.callAfterApply&&this.callAfterApply()}break}}}},zs=(s,e)=>s.priority!==e.priority?e.priority-s.priority:s.id-e.id,Gt=s=>s?.slice(0),qt=(s,e)=>{let t=s.indexOf(e);t>-1&&s.splice(t,1)},Bs=s=>s===wt||s===vt,bt=(s,e,t)=>{let r=s.findIndex(i=>i.isEqual(e,t));r>-1&&(s[r].isRemoved=!0,s.splice(r,1))},De=(s,e,t)=>{let r=[];for(let i of s)(e==null&&i.listenerObject===t||i.eventName===e&&i.listener===t)&&r.push(i);for(let i of r)bt(s,i,void 0)},yt=s=>{s&&(s.forEach(e=>{e.isRemoved=!0}),s.length=0)},Gs=(s,e)=>s.listenerType===e.listenerType?s.priority===e.priority&&s.eventName===e.eventName&&s.listenerObject===e.listenerObject&&s.listener===e.listener:!1,qs=(s,e)=>{if(Bs(s.listenerType))return e.find(t=>Gs(s,t))},Hs=(s,e)=>{let t=qs(s,e);return t?(t.refCount+=1,t):(e.push(s),e.sort(zs),s)},Qs=class{namedListeners;catchEmAllListeners;getListenersForEventName=s=>{let e=this.namedListeners.get(s);return e||(e=[],this.namedListeners.set(s,e)),e};constructor(){this.namedListeners=new Map,this.catchEmAllListeners=[]}add(s){return Hs(s,s.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(s.eventName))}remove(s,e,t=!1){e==null&&Array.isArray(s)?s.forEach(r=>this.remove(r,null,t)):s==null||e==null&&$e(s)?this.removeAllListeners():e==null&&Yt(s)?yt(this.namedListeners.get(s)):s instanceof Xt?s.isRemoved||(s.refCount-=1,s.refCount<1&&(s.isRemoved=!0,this.namedListeners.forEach(r=>qt(r,s)),qt(this.catchEmAllListeners,s))):t?$e(s)?De(this.catchEmAllListeners,ee,s):this.namedListeners.forEach(r=>De(r,s,e)):(this.namedListeners.forEach(r=>{bt(r,s,e),De(r,void 0,s)}),bt(this.catchEmAllListeners,s,e),De(this.catchEmAllListeners,void 0,s))}removeAllListeners(){this.namedListeners.forEach(s=>yt(s)),this.namedListeners.clear(),yt(this.catchEmAllListeners)}forEach(s,e){let t=Gt(this.catchEmAllListeners),r=Gt(this.namedListeners.get(s));if(s===ee||!r||r.length===0)t.forEach(e);else if(t.length===0)r.forEach(e);else{let i=r.length,n=t.length,o=0,l=0;for(;o<i||l<n;){if(o<i){let a=r[o];if(l>=n||a.priority>=t[l].priority){e(a),++o;continue}}l<n&&(e(t[l]),++l)}}}getSubscriptionCount(){let s=this.catchEmAllListeners.length;for(let e of this.namedListeners.values())s+=e.length;return s}},te=s=>!!(s&&s[D]);function be(s){if(te(s))return s;let e=new Qs,t=new Jt;return $s(s,D,{keeper:t,store:e}),s}var ve={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},Ys=(s,e,t,r,i,n,o)=>{let l=s.add(new Xt(t,r,i,n));return e.emit(t,l,o),l},Ks=(s,e,t,r)=>{let i=t.length,n=typeof t[0],o,l,a,h;if(i>=2&&i<=3&&n==="number"?(o=ee,[l,a,h]=t):i>=3&&i<=4&&typeof t[1]=="number"?[o,l,a,h]=t:(l=ve.Default,n==="string"||n==="symbol"||Array.isArray(t[0])?[o,a,h]=t:(o=ee,[a,h]=t)),!a&&Kt)throw Ds("called with insufficient arguments!",t),"subscribeTo() called with insufficient arguments!";let u=d=>E=>Ys(s,e,E,d,a,h,r);return Array.isArray(o)?o.map(d=>Array.isArray(d)?u(d[1])(d[0]):u(l)(d)):u(l)(o)},Zt=(s,e,t)=>{let r=[],i=Ks(s,e,t,r);return Jt.publish(r),i},Ht=s=>e=>{e.callAfterApply=()=>{s?.()}},es=(s,e)=>Object.assign(()=>y(s,e),Array.isArray(e)?{listeners:e}:{listener:e}),ts=(s,e,t,r)=>{let{store:i,keeper:n}=s[D];Array.isArray(e)?e.forEach(o=>{i.forEach(o,l=>l.apply(o,t,r)),n.retain(o,t)}):e!==ee&&(i.forEach(e,o=>{o.apply(e,t,r)}),n.retain(e,t))},g=(s,...e)=>{let t=be(s),{store:r,keeper:i}=t[D];return es(t,Zt(r,i,e))},v=(s,...e)=>{let t=be(s),{store:r,keeper:i}=t[D],n=Zt(r,i,e),o=es(t,n),l=!1,a=()=>{l||(o(),l=!0)};return Array.isArray(n)?n.forEach(Ht(a)):Ht(a)(n),a},le=(s,e)=>new Promise(t=>{v(s,e,t)}),y=(s,e,t)=>{if(!te(s))throw new Error("object is not eventized");let{store:r,keeper:i}=s[D],n=typeof e,o=t!=null&&(n==="string"||n==="symbol");r.remove(e,t,o),Array.isArray(e)?i.remove(e.filter(l=>typeof l=="string")):Yt(e)&&i.remove(e)},c=(s,e,...t)=>{if(!te(s))throw new Error("object is not eventized");ts(s,e,t)},Js=(s,e,...t)=>{if(!te(s))throw new Error("object is not eventized");let r=[];return ts(s,e,t,i=>{r.push(i)}),r=r.map(i=>Array.isArray(i)?Promise.all(i):Promise.resolve(i)),r.length>0?Promise.all(r):Promise.resolve()},$=(s,e)=>{let t=be(s),{keeper:r}=t[D];r.add(e)},U=(s,e)=>{if(!te(s))throw new Error("object is not eventized");let{keeper:t}=s[D];t.clear(e)},w=(()=>{let s=(e={})=>be(e);return s.inject=(e={})=>(e=be(e),Object.assign(e,{on:(...t)=>g(e,...t),once:(...t)=>v(e,...t),onceAsync:t=>le(e,t),off:(t,r)=>y(e,t,r),emit:(t,...r)=>c(e,t,...r),emitAsync:(t,...r)=>Js(e,t,...r),retain:t=>$(e,t),retainClear:t=>U(e,t)}),e),s.is=te,s})();var Et=s=>te(s)?s[D]?.store?.getSubscriptionCount()??0:0;var V=w(),L=w(),z=w();var se=class{static current;#e=new Set;batch(e){this.#e.add(e)}run(){c(z,Array.from(this.#e))}},ss=()=>se.current;function k(s){let e=se.current;e?e=void 0:e=se.current=new se;try{s()}finally{e&&(se.current=void 0,e.run())}}var Ct=0;function St(s){Ct++;try{s()}finally{Ct--}}function Ie(){return Ct>0}var T=Symbol.for("signal"),re=Symbol.for("effect"),xt=Symbol.for("destroySignal"),kt=Symbol.for("createEffect"),rs=Symbol.for("destroyEffect"),ue="value",At="mute",Tt="unmute",B="destroy";var G=new Map,O=class s{#e=new Set;#t=new Set;#s=new Map;#i=new WeakMap;#r=new Map;#n=new Set;#a=new Set;#o;static get(e){if(e!=null)return e instanceof s?e:G.get(e)}static findOrCreate(e){if(e==null)throw new Error("Cannot create a group with a null object");return new s(e)}static destroy(e){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),s.delete(e)}static delete(e){G.get(e)?.clear()}static clear(){for(let e of G.values())e.destroy();G.clear()}constructor(e){if(e!=null&&e instanceof s)return e;if(e??=this,G.has(e))return G.get(e);G.set(e,this),w(this)}attachGroup(e){if(e===this)throw new Error("Cannot attach a group to itself");return this.#e.add(e),e.#o&&e.#o!==this&&e.#o.#e.delete(e),e.#o=this,e}detachGroup(e){return e!==this&&this.#e.has(e)&&(this.#e.delete(e),e.#o=void 0),e}attachSignal(e){let t=m(e);if(t?.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return t&&this.#t.add(t),e}attachSignalByName(e,t){if(t){this.attachSignal(t);let r=m(t);this.#s.set(e,r),this.#r.has(e)?this.#r.get(e).push(r):this.#r.set(e,[r]),this.#i.has(r)?this.#i.get(r).add(e):this.#i.set(r,new Set([e]))}else this.#s.delete(e);return t}hasSignal(e){return this.#s.has(e)||this.#o?.hasSignal(e)}signal(e){return this.#s.get(e)?.object??this.#o?.signal(e)}detachSignal(e){let t=m(e);if(t&&(this.#t.delete(t),this.#i.has(t))){let r=this.#i.get(t);for(let i of r)if(this.#r.has(i)){let n=this.#r.get(i);n.splice(n.indexOf(t),1),n.length===0?(this.#s.delete(i),this.#r.delete(i)):this.#s.get(i)===t&&this.#s.set(i,n.at(-1))}r.clear(),this.#i.delete(t)}return e}attachEffect(e){return this.#n.add(e),e}runEffects(){for(let e of this.#n)e.run();for(let e of this.#e)e.runEffects()}attachLink(e){if(e?.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return e&&this.#a.add(e),e}detachLink(e){return e&&this.#a.delete(e),e}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){c(this,B,this),y(this);for(let e of this.#e)e.destroy();for(let e of this.#n)e.destroy();for(let e of this.#t)S(e);for(let e of this.#a)e.destroy();this.#e.clear(),this.#t.clear(),this.#s.clear(),this.#r.clear(),this.#n.clear(),this.#a.clear(),this.#o?.detachGroup(this),G.delete(this)}};var We=class{[re];constructor(e){this[re]=e,v(e,ce.Destroy,()=>{this[re]=void 0})}run=()=>this[re]?.run();destroy=()=>{this[re]?.destroy(),this[re]=void 0}};var fe=class{#e;#t;constructor(e="id",t=1){this.#e=e,this.#t=t}make(){return Symbol(`${this.#e}${this.#t++}`)}};var Ot=[],Fe=()=>Ot.at(-1),is=(s,e)=>{Ot.push(s);try{return e()}finally{Ot.pop()}};var Xs=s=>s!=null&&typeof s.then=="function",ce=class s{static idGen=new fe("ef");static Destroy="destroy";static count=0;id;callback;#e;#t=new Set;#s=new Set;parentEffect;childEffects=[];curChildEffectSlot=0;autorun=!0;shouldRun=!0;#i;#r=!1;constructor(e,t){w(this),this.callback=e;let r;t?.attach!=null&&(r=O.findOrCreate(t.attach),r.attachEffect(this)),this.autorun=t?.autorun??!0,this.#i=t?.dependencies?t.dependencies.map(i=>{switch(typeof i){case"string":case"symbol":return r.signal(i);default:return i}}):void 0,this.id=s.idGen.make(),g(z,this.id,"recall",this),++s.count}hasStaticDeps(){return this.#i!=null&&this.#i.length>0}saveSignalsFromDeps(){for(let e of this.#i)this.whenSignalIsRead(m(e).id)}static createEffect(e,t,r){let i=Array.isArray(t)?t:void 0,n=i?r??{dependencies:i}:t;n&&i&&(n.dependencies=i);let o,l=Fe();return l!=null?(o=l.getCurrentChildEffect(),o==null&&(o=new s(e,n),l.attachChildEffect(o),c(z,kt,o)),l.curChildEffectSlot++):(o=new s(e,n),c(z,kt,o)),o.hasStaticDeps()?o.saveSignalsFromDeps():o.autorun&&o.run(),new We(o)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(e){this.childEffects.push(e),this.parentEffect=this}run=()=>{if(this.#r||!this.shouldRun)return;let e=ss();e?e.batch(this.id):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,this.hasStaticDeps()?this.#e=this.callback():this.#e=is(this,this.callback))};recall(){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(e){this.#t.has(e)||(this.#t.add(e),g(V,e,"recall",this),v(L,e,xt,this))}[xt](e){!this.#s.has(e)&&this.#t.has(e)&&(this.#s.add(e),y(V,e,this),this.#s.size===this.#t.size&&this.destroy())}runCleanupCallback(){if(this.#e!=null){let e=this.#e;this.#e=void 0,Xs(e)?Promise.resolve(e).then(t=>{typeof t=="function"&&t()}):e()}}destroy=()=>{this.#r||(c(this,s.Destroy,this),y(this),c(z,rs,this),this.runCleanupCallback(),y(V,this),y(z,this),y(L,this),this.#r=!0,this.#t.clear(),this.#s.clear(),this.childEffects.forEach(e=>{e.destroy()}),this.childEffects.length=0,--s.count)}};var b=(...s)=>ce.createEffect(...s);var we=new WeakMap,Zs=s=>{let e=we.get(s);return e||(e={},we.set(s,e)),e},A=(s,e)=>we.get(s)?.signals?.get(e);var ns=(s,e,t)=>{let r=Zs(s);r.signals??=new Map,r.signals.set(e,t)};function Ee(...s){for(let e of s)if(we.has(e)){let t=we.get(e);if(t.signals){for(let r of t.signals.values())S(r);t.signals.clear(),t.signals=void 0}}}function os(s){let e=m(de(s)?s:A(...s));e!=null&&!e.muted&&!e.destroyed&&Ue(e.id,e.value,{touch:!0})}function ie(s){return de(s)?m(s)?.value:m(A(...s))?.value}var Ve=class{[T];constructor(e){this[T]=e}get get(){return this[T].reader}get set(){return this[T].writer}get value(){return ie(this.get)}set value(e){this.set(e)}onChange(e){let{destroy:t}=b(()=>e(this.value),[this.get]);return t}get muted(){return this[T].muted}set muted(e){this[T].muted=e}touch(){os(this)}destroy(){S(this)}};var er=new fe("si");function as(s){Ie()||Fe()?.whenSignalIsRead(s)}function Ue(s,e,t){Ie()||c(V,s,e,t)}var de=s=>s!=null&&s[T]!=null,tr=s=>{let e=t=>(t?b(()=>(s.destroyed||as(s.id),t(s.value)),[e]):s.destroyed||(s.beforeRead?.(),as(s.id)),s.value);return Object.defineProperty(e,T,{value:s}),e},ze=class s{static instanceCount=0;id;lazy;get[T](){return this}compare;beforeRead;muted=!1;destroyed=!1;#e=void 0;get value(){return this.lazy&&(this.#e=this.valueFn(),this.valueFn=void 0,this.lazy=!1),this.#e}set value(e){this.#e=e}valueFn;reader;writer=(e,t)=>{let r=t?.lazy??!1,n=t?.compare??this.compare??((l,a)=>l===a);if((r!==this.lazy||r&&e!==this.valueFn||!r&&!n(e,this.#e))&&(r?(this.#e=void 0,this.valueFn=e,this.lazy=!0):(this.#e=e,this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){Ue(this.id,this.#e);return}(t?.touch??!1)&&Ue(this.id,this.#e,{touch:!0})};object;constructor(e,t){this.id=er.make(),++s.instanceCount,this.lazy=e,this.lazy?(this.value=void 0,this.valueFn=t):(this.value=t,this.valueFn=void 0),this.reader=tr(this),this.object=new Ve(this)}},m=s=>s?.[T];function f(s=void 0,e){let t;if(de(s))t=m(s);else{let r=e?.lazy??!1;t=new ze(r,s),t.beforeRead=e?.beforeRead,t.compare=e?.compare}return e?.attach!=null&&O.findOrCreate(e.attach).attachSignal(t),t.object}var S=(...s)=>{for(let e of s){let t=m(e);t!=null&&!t.destroyed&&(t.destroyed=!0,t.beforeRead=void 0,--ze.instanceCount,c(L,t.id,t.id))}};function Pt(s,e){let t=f(),r=e?.attach!=null?O.findOrCreate(e.attach):void 0;r!=null&&(e?.name?r.attachSignalByName(e.name,t):r.attachSignal(t));let i=b(()=>t.set(s()),{autorun:!1,attach:r}),n=m(t);return n.beforeRead=i.run,v(L,n.id,i.destroy),t.get}var Be=class{#e=!1;#t;source;lastValue;isDestroyed=!1;constructor(e){w(this),this.source=m(e),this.#t=g(V,this.source.id,(t,r)=>{!this.#e&&!this.isDestroyed&&(r?.touch===!0?this.touch():this.write())}),v(L,this.source.id,()=>this.destroy())}attach(e){let t=O.findOrCreate(e);return t.attachLink(this),v(this,B,()=>{t.detachLink(this)}),t}nextValue(){return new Promise((e,t)=>{let r=[],i=()=>r.forEach(n=>{n()});r.push(v(this,ue,n=>{i(),e(n)}),v(this,B,()=>{i(),t()}))})}async*asyncValues(e){let t=0;for(;!this.isDestroyed;)try{let r=await this.nextValue();if(e&&e(r,t++))break;$(this,ue),yield r}catch{break}U(this,ue)}destroy(){this.isDestroyed||(this.#t?.(),this.#t=void 0,c(this,B,this),U(this,ue),y(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return this.#e}mute(){return!this.isDestroyed&&!this.#e&&(this.#e=!0,c(this,At,this)),this}unmute(){return!this.isDestroyed&&this.#e&&(this.#e=!1,c(this,Tt,this)),this}toggle(){return this.isDestroyed||(this.#e=!this.#e,c(this,this.#e?At:Tt,this)),this.#e}updateValue(e){if(!this.#e&&!this.isDestroyed){let{value:t}=this.source;e(t),c(this,ue,t),this.lastValue=t}}},Ge=class extends Be{target;constructor(e,t){super(e),this.target=m(t),v(L,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(e=>{this.target.writer(e,{touch:!0})}),this}write(){this.updateValue(e=>{this.target.writer(e)})}},qe=class extends Be{target;constructor(e,t){super(e),this.target=t,this.touch()}touch(){return this.updateValue(e=>{this.target(e)}),this}write(){this.updateValue(e=>{this.target(e)})}};var He=new Map;function q(s,e,t){let r=m(s),i;if(He.has(r)){i=He.get(r);let h=m(e)??e;if(i.has(h))return i.get(h)}else i=new Map,He.set(r,i);let n=m(e),o=n!=null?new Ge(s,n):new qe(s,e),l=t?.attach;l&&o.attach(l);let a=n??e;return i.set(a,o),v(o,B,()=>{i.delete(a),i.size===0&&He.delete(r)}),o}var Qe=class s{static fromProps(e,t){let r=new s,i=t?t.map(n=>[n,e[n]]):Object.entries(e);for(let[n,o]of i)r.#e.set(n,f(o));return r}#e=new Map;keys(){return this.#e.keys()}signals(){return this.#e.values()}entries(){return this.#e.entries()}clear(){for(let e of this.#e.values())e.destroy();this.#e.clear()}has(e){return this.#e.has(e)}get(e){if(!this.#e.has(e)){let t=f();return this.#e.set(e,t),t}return this.#e.get(e)}update(e){e.size&&k(()=>{for(let[t,r]of e.entries())this.get(t).set(r)})}updateFromProps(e,t){k(()=>{let r=t?t.map(i=>[i,e[i]]):Object.entries(e);for(let[i,n]of r)this.get(i).set(n)})}};var _;(function(s){s[s.StructuralChanges=1]="StructuralChanges",s[s.ContentUpdates=2]="ContentUpdates",s[s.Removal=3]="Removal"})(_||(_={}));var p;(function(s){s[s.CreateEntities=1]="CreateEntities",s[s.DestroyEntities=2]="DestroyEntities",s[s.SetParent=3]="SetParent",s[s.UpdateOrder=4]="UpdateOrder",s[s.ChangeProperties=5]="ChangeProperties",s[s.ChangeToken=6]="ChangeToken",s[s.SendEvents=7]="SendEvents"})(p||(p={}));var ne=Symbol.for("ShadowEntsGlobalNS"),I="#void",hs="contextLost",ls="configure",us="changeTrail",cs="destroy",fs="loaded",ds="appliedChangeTrail",ps="importedModule",gs="destroyed",pe="messageToView",ys=16e3,ms=16e3,bs=4e3,vs=1e3,Rt="shadowObjects";function ws(s,e){s.indexOf(e)===-1&&s.push(e)}function Mt(s,e){let t=s.indexOf(e);t!==-1&&s.splice(t,1),s.push(e)}function H(s,e){let t=s.indexOf(e);t!==-1&&s.splice(t,1)}var oe=s=>typeof s=="string"?s.trim()||ne:typeof s=="symbol"?s:ne;var Ce="#root",Se=class{#e;get uuid(){return this.#e}#t=0;constructor(e){this.#e=e}#s=!0;#i=0;#r=0;hasChanges(){return this.#t>0}get isNew(){return this.#s}get isCreated(){return this.#i>0&&this.#i>this.#r}get isDestroyed(){return this.#r>0&&this.#r>=this.#i}#n=I;#a;#o=0;#u;#h;#l;create(e=I,t,r=0){this.#t++,this.#i++,this.#u=e,this.#h=t??Ce,this.#l=r||void 0}destroy(){this.#r++,this.#t++}clear(){this.#t=0,this.#s=!1,this.#u=void 0,this.#h=void 0,this.#l=void 0,this.#f.clear(),this.#g.length=0,this.#p.length=0,this.#d.clear()}changeToken(e){e===this.#n?this.#u=void 0:(this.#u=e,this.#t++)}setParent(e){e===this.#a?this.#h=void 0:(this.#h=e??Ce,this.#t++)}changeOrder(e){e===this.#o?this.#l=void 0:(this.#l=e,this.#t++)}#c=new Map;#f=new Map;#g=[];changeProperty(e,t,r){let i=this.#c.get(e);r==null&&t!==i||r!=null&&!r(t,i)?(this.#f.set(e,t),Mt(this.#g,e),this.#t++):(this.#f.delete(e),H(this.#g,e))}removeProperty(e){let t=this.#c.has(e);this.#f.has(e)?(this.#f.delete(e),t||H(this.#g,e)):t&&(Mt(this.#g,e),this.#t++)}#p=[];#d=new Set;createEvent(e,t,r){this.#p.push({type:e,data:t}),r?.forEach(i=>this.#d.add(i)),this.#t++}transferEventsTo(e){this.#p.length>0&&(e.#p.push(...this.#p),this.#p.length=0),this.#d.size>0&&(e.#d=new Set([...e.#d,...this.#d]),this.#d.clear())}buildChangeTrail(e,t){let{isNew:r,isCreated:i,isDestroyed:n}=this;if(!(r&&n))switch(t){case _.StructuralChanges:r?e.push(this.makeCreateEntityChange()):n||(this.#h!==void 0&&!(this.#h===Ce&&this.#a===void 0)?e.push(this.makeSetParentChange()):this.#l!==void 0&&this.#l!==this.#o&&e.push(this.makeUpdateOrderChange()),this.#u!==void 0&&this.#u!==this.#n&&e.push(this.makeChangeToken()));break;case _.ContentUpdates:!r&&i&&this.#g.length>0&&e.push(this.makeChangePropertyChange()),this.#p.length>0&&e.push(this.makeEvents());break;case _.Removal:n&&e.push(this.makeDestroyEntityChange());break}}makeEvents(){let e={type:p.SendEvents,uuid:this.#e,events:this.#p.slice(0)};return this.#d.size>0&&(e.transferables=Array.from(this.#d)),e}makeCreateEntityChange(){let e={type:p.CreateEntities,uuid:this.#e,token:this.#u};if(this.#n=this.#u,this.#h!==void 0){let t=this.#h===Ce?void 0:this.#h;this.#a=t,t!==void 0&&(e.parentUuid=t)}return this.#f.size>0&&(e.properties=Array.from(this.#f.entries()).filter(([,t])=>t!==void 0),e.properties.forEach(([t,r])=>this.#c.set(t,r))),this.#l!==void 0&&this.#l!==this.#o&&(e.order=this.#o=this.#l),e}makeDestroyEntityChange(){return{type:p.DestroyEntities,uuid:this.#e}}makeSetParentChange(){this.#a=this.#h===Ce?void 0:this.#h;let e={type:p.SetParent,uuid:this.#e,parentUuid:this.#a};return this.#l!==void 0&&this.#l!==this.#o&&(e.order=this.#o=this.#l),e}makeUpdateOrderChange(){return this.#o=this.#l??0,{type:p.UpdateOrder,uuid:this.#e,order:this.#o}}makeChangeToken(){return this.#n=this.#u??I,{type:p.ChangeToken,uuid:this.#e,token:this.#n}}makeChangePropertyChange(){let e=this.#g.map(t=>{if(this.#f.has(t)){let r=this.#f.get(t);return this.#c.set(t,r),[t,r]}else return this.#c.delete(t),[t,void 0]});return{type:p.ChangeProperties,uuid:this.#e,properties:e}}};var Es=s=>{if(!(s===void 0||s.length===0))return s.filter(e=>e.length===1||e[1]!==void 0)},Lt=(s,e)=>{if(s===e||e===void 0)return s;if(s===void 0)return Es(e);for(let[t,r]of e){let i=s.find(([n])=>n===t);i===void 0?s.push([t,r]):i[1]=r}return Es(s)};var Ye=class{#e=new Map;get[Symbol.iterator](){return this.#e.entries.bind(this.#e)}clear(){this.#e.clear()}isEmpty(){return this.#e.size===0}hasComponentState(e){return this.#e.has(e)}getComponentState(e){return this.#e.get(e)}write(e){for(let t of e)if(t.type===p.CreateEntities)this.createEntity(t);else if(this.#e.has(t.uuid))switch(t.type){case p.DestroyEntities:this.destroyEntity(t);break;case p.SetParent:this.setParent(t);break;case p.UpdateOrder:this.updateOrder(t);break;case p.ChangeToken:this.changeToken(t);break;case p.ChangeProperties:this.changeProperties(t);break}}changeProperties({uuid:e,properties:t}){let r=this.getComponentState(e);r.properties=Lt(r.properties,t)}changeToken({uuid:e,token:t}){this.getComponentState(e).token=t||I}updateOrder({uuid:e,order:t}){this.getComponentState(e).order=t??0}setParent({uuid:e,parentUuid:t,order:r}){let i=this.getComponentState(e);i.parentUuid=t,i.order=r??0}destroyEntity({uuid:e}){this.#e.delete(e)}createEntity({uuid:e,token:t,parentUuid:r,order:i,properties:n}){this.#e.set(e,{token:t||I,parentUuid:r,order:i??0,properties:Lt(void 0,n)})}};var M=class s{static{this.ReRequestParentRoots="re-request-parent-roots"}static getContextsMap(){return globalThis.__shadowEntsContexts==null&&(globalThis.__shadowEntsContexts=new Map),globalThis.__shadowEntsContexts}static get(e){let t=oe(e),r=s.getContextsMap();return r.has(t)?r.get(t):new s(t)}#e=new Map;#t=[];#s=new Ye;constructor(e=ne){let t=oe(e),r=s.getContextsMap();if(r.has(t))return r.get(t);this.ns=t,r.set(t,this)}addComponent(e){let t;this.#e.has(e.uuid)?(t=this.#e.get(e.uuid),t.component=e,t.children=[]):(t={component:e,children:[],changes:new Se(e.uuid),propIsEqual:void 0},this.#e.set(e.uuid,t)),t.changes.create(e.token,e.parent?.uuid,e.order),e.parent?(this.addToChildren(e.parent,e),t.changes.setParent(e.parent.uuid)):this.#n(e,this.#t),this.#a=void 0}hasComponent(e){return this.#e.has(e.uuid)}hasComponents(){return this.#e.size>0}isRootComponent(e){return this.#t.includes(e.uuid)}destroyComponent(e){if(this.hasComponent(e)){let t=this.#e.get(e.uuid);t.children.slice(0).forEach(r=>this.#e.get(r)?.component.removeFromParent()),t.changes.destroy(),this.#a=void 0}}getChildren(e){return this.#e.get(e.uuid)?.children.map(t=>this.#e.get(t).component)??[]}removeFromParent(e,t){if(this.hasComponent(t)){let r=this.#e.get(e),i=this.#e.get(t.uuid),n=i.children.indexOf(e);n!==-1&&(i.children.splice(n,1),r.changes.setParent(void 0)),this.#n(r.component,this.#t),this.#a=void 0}}moveToRoot(e){let t=this.#e.get(e);t&&(t.changes?.setParent(void 0),this.#n(t.component,this.#t)),this.#a=void 0}changeToken(e,t){this.#e.get(e.uuid)?.changes.changeToken(t)}isChildOf(e,t){return this.hasComponent(t)?this.#e.get(t.uuid).children.includes(e.uuid):!1}addToChildren(e,t){let r=this.#e.get(e.uuid);if(r)this.#n(t,r.children),this.#e.get(t.uuid)?.changes.setParent(e.uuid),H(this.#t,t.uuid),this.#a=void 0;else throw new Error(`the view component ${e.uuid} cannot have a child added to it because the component do not exist!`)}removeSubTree(e){let t=this.#e.get(e);t&&(t.children.slice(0).forEach(r=>this.removeSubTree(r)),this.destroyComponent(t.component),this.#i(e))}setProperty(e,t,r,i){let n=this.#e.get(e.uuid);return n!=null?(i!=null?(n.propIsEqual??=new Map,n.propIsEqual.set(t,i)):n.propIsEqual?.has(t)&&n.propIsEqual.delete(t),n.changes.changeProperty(t,r,i)):!1}removeProperty(e,t){this.#e.get(e.uuid)?.changes.removeProperty(t)}changeOrder(e){if(e.parent){let t=this.#e.get(e.parent.uuid);H(t.children,e.uuid),this.#n(e,t.children)}else H(this.#t,e.uuid),this.#n(e,this.#t);this.#e.get(e.uuid)?.changes.changeOrder(e.order),this.#a=void 0}traverseLevelOrderBFS(){return this.#o().map(e=>e.component)}dispatchShadowObjectsEvent(e,t,r,i){this.#e.get(e.uuid)?.changes.createEvent(t,r,i)}broadcastEvent(e,t=void 0){for(let r of this.traverseLevelOrderBFS())r.dispatchEvent(e,t,!1)}dispatchMessage(e,t,r=void 0,i=!1){this.#e.get(e)?.component.dispatchEvent(t,r,i)}dispatchReRequestParentRoots(){for(let e of this.#t)this.dispatchMessage(e,s.ReRequestParentRoots)}buildChangeTrails(e=!0){let t=[];if(!this.hasComponents())return t;let r=this.#r();for(let i of r)i.buildChangeTrail(t,_.StructuralChanges);for(let i of r)i.buildChangeTrail(t,_.ContentUpdates);for(let i of r)i.buildChangeTrail(t,_.Removal),(i.isDestroyed||i.isNew&&!i.isCreated)&&this.#i(i.uuid),e&&i.clear();return this.#s.write(t),t}reCreateChanges(){if(!this.#s.isEmpty()){this.buildChangeTrails(!1);for(let[e,t]of this.#s){let r=this.#e.get(e);if(r){let i=new Se(e);if(i.create(t.token,t.parentUuid,t.order),t.properties)for(let[n,o]of t.properties)i.changeProperty(n,o,r.propIsEqual?.get(n));r.changes.transferEventsTo(i),r.changes.clear(),r.changes=i}}this.#s.clear(),this.broadcastEvent(hs)}}clear(){if(this.#a=void 0,this.#s.clear(),this.#t.slice(0).forEach(e=>this.removeSubTree(e)),this.#t.length!==0)throw new Error("component-context panic: #rootComponents is not empty!");if(this.#e.size!==0)throw new Error("component-context panic: #components is not empty!")}#i(e){this.#e.has(e)&&(this.#e.delete(e),H(this.#t,e),this.#a=void 0)}#r(){return this.#o().filter(e=>e.changes.hasChanges()).map(e=>e.changes)}#n(e,t){if(t.length===0){t.push(e.uuid);return}if(t.includes(e.uuid))return;let r=t.length,i=new Array(r);if(i[0]=this.#e.get(t[0]).component,e.order<i[0].order){t.unshift(e.uuid);return}if(r===1){t.push(e.uuid);return}let n=r-1;if(i[n]=this.#e.get(t[n]).component,e.order>=i[n].order){t.push(e.uuid);return}if(r===2){t.splice(1,0,e.uuid);return}for(let o=n-1;o>=1;o--)if(i[o]=this.#e.get(t[o]).component,e.order>=i[o].order){t.splice(o+1,0,e.uuid);return}}#a;#o(){if(this.#a)return this.#a;let e=new Map,t=(r,i)=>{let n=this.#e.get(r);if(n!=null){e.has(i)?e.get(i).push(n):e.set(i,[n]);for(let o of n.children)t(o,i+1)}};return this.#t.forEach(r=>t(r,0)),this.#a=Array.from(e.entries()).sort((r,i)=>r[0]-i[0]).map(([,r])=>r).flat(),this.#a}};function xe(s,e,t,r,i,n){function o(me){if(me!==void 0&&typeof me!="function")throw new TypeError("Function expected");return me}for(var l=r.kind,a=l==="getter"?"get":l==="setter"?"set":"value",h=!e&&s?r.static?s:s.prototype:null,u=e||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),d,E=!1,ae=t.length-1;ae>=0;ae--){var Ne={};for(var he in r)Ne[he]=he==="access"?{}:r[he];for(var he in r.access)Ne.access[he]=r.access[he];Ne.addInitializer=function(me){if(E)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(me||null))};var Z=(0,t[ae])(l==="accessor"?{get:u.get,set:u.set}:u[a],Ne);if(l==="accessor"){if(Z===void 0)continue;if(Z===null||typeof Z!="object")throw new TypeError("Object expected");(d=o(Z.get))&&(u.get=d),(d=o(Z.set))&&(u.set=d),(d=o(Z.init))&&i.unshift(d)}else(d=o(Z))&&(l==="field"?i.unshift(d):u[a]=d)}h&&Object.defineProperty(h,r.name,u),E=!0}function Q(s,e,t){for(var r=arguments.length>2,i=0;i<e.length;i++)t=r?e[i].call(s,t):e[i].call(s);return r?t:void 0}function ke(s){return function(e,t){let r=s?.name||t.name,i=!!(s?.readAsValue??!1);return{get(){let n=A(this,r);if(n)return i?n.value:n.get()},set(n){A(this,r)?.set(n)},init(n){let o=f(n,s);return ns(this,r,o),O.findOrCreate(this).attachSignalByName(r,o),o.value}}}}var R="ConsoleLogger",P=`${R}Storage`,sr=!!(globalThis.location?.host?.startsWith("localhost")??!1),Te="localStorage"in globalThis,Ke=Symbol.for(R),Cs=!1,Ss=s=>{if(typeof s=="boolean")return s;switch(s.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},jt=s=>[Te?R:void 0,...Array.isArray(s)?s:[s]].filter(Boolean).join(".");function _t(s,e=void 0,t){let r=jt(s),i=Te?localStorage.getItem(r):globalThis[P]?.[r];return i!=null?e(i):t}function Ae(s,e){Te?localStorage.setItem(jt(s),e):(globalThis[P]==null&&(globalThis[P]={},console.debug(`${R}: Initialize`,{[P]:globalThis[P]})),globalThis[P][jt(s)]=e)}var x=class s{static{this.sharedConfig={enable:sr,debug:!1,info:!0,warn:!0,"styles.debug":"color: #111; background: #999; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.info":"color: #020; background: #8a8; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.warn":"color: #fa0; background: #a98; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.error":"color: #ff0; background: #a00; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em"}}static get isEnabled(){return s.sharedConfig.enable}static get isDebug(){return s.sharedConfig.enable&&s.sharedConfig.debug}static{this.sharedStyles={get debug(){return s.sharedConfig["styles.debug"]},set debug(e){s.sharedConfig["styles.debug"]=e},get info(){return s.sharedConfig["styles.info"]},set info(e){s.sharedConfig["styles.info"]=e},get warn(){return s.sharedConfig["styles.warn"]},set warn(e){s.sharedConfig["styles.warn"]=e},get error(){return s.sharedConfig["styles.error"]},set error(e){s.sharedConfig["styles.error"]=e}}}static loadConfig(){Te?(["enable","debug","info","warn"].forEach(e=>{this.sharedConfig[e]=_t(e,Ss,this.sharedConfig[e])}),["debug","info","warn","error"].forEach(e=>{this.sharedStyles[e]=_t(["styles",e],void 0,this.sharedStyles[e])}),s.isDebug&&console.debug(`${R}: Load config from localStorage`,s.sharedConfig),globalThis[R]?.[Ke]||(globalThis[R]??={[Ke]:!0,get enable(){return s.sharedConfig.enable},set enable(e){s.sharedConfig.enable=e,Ae("enable",e?"true":"false")},get debug(){return s.sharedConfig.debug},set debug(e){s.sharedConfig.debug=e,Ae("debug",e?"true":"false")},get info(){return s.sharedConfig.info},set info(e){s.sharedConfig.info=e,Ae("info",e?"true":"false")},get warn(){return s.sharedConfig.warn},set warn(e){s.sharedConfig.warn=e,Ae("warn",e?"true":"false")}})):globalThis[P]?.[Ke]||(globalThis[P]={[Ke]:!0,...s.sharedConfig,...globalThis[P]},s.sharedConfig=globalThis[P],s.isDebug&&console.debug(`${R}: Load config from ${P}`,globalThis[P]))}constructor(e){this.enable=!0,this.namespace=(e||"").trim()||R,Cs||(s.loadConfig(),Cs=!0);let t=[this.namespace,"enable"];this.enable=_t(t,Ss,this.enable),Ae(t,Te?this.enable?"true":"false":this.enable)}get isEnabled(){return this.enable&&s.sharedConfig.enable}get isDebug(){return this.isEnabled&&s.sharedConfig.debug}get isInfo(){return this.isEnabled&&s.sharedConfig.info}get isWarn(){return this.isEnabled&&s.sharedConfig.warn}debug(...e){this.#e("debug",s.sharedStyles.debug,e)}info(...e){this.#e("info",s.sharedStyles.info,e)}warn(...e){this.#e("warn",s.sharedStyles.warn,e)}error(...e){this.#e("error",s.sharedStyles.error,e)}#e(e,t,r){console[e](`%c${this.namespace}`,t,...r)}};var j=(()=>{var s;let e,t=[],r=[],i,n=[],o=[];return class W{static{let a=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[ke()],i=[ke()],xe(this,null,e,{kind:"accessor",name:"viewReady",static:!1,private:!1,access:{has:h=>"viewReady"in h,get:h=>h.viewReady,set:(h,u)=>{h.viewReady=u}},metadata:a},t,r),xe(this,null,i,{kind:"accessor",name:"proxyReady",static:!1,private:!1,access:{has:h=>"proxyReady"in h,get:h=>h.proxyReady,set:(h,u)=>{h.proxyReady=u}},metadata:a},n,o),a&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a})}static{this.AfterSync="afterSync"}static{this.ContextLost="contextLost"}static{this.ContextCreated="contextCreated"}static get(a){if(a!=null)return globalThis.__shadowEnvs?.get(a)}#e;#t;#s;#i;#r;#n;#a;get viewReady(){return this.#a}set viewReady(a){this.#a=a}#o;get proxyReady(){return this.#o}set proxyReady(a){this.#o=a}#u;get isDestroyed(){return this.#u}constructor(){this.#s=!1,this.#i=!1,this.#r=!1,this.logger=new x("ShadowEnv"),this.ns$=f(),this.#a=Q(this,t,!1),this.#o=(Q(this,r),Q(this,n,!1)),this.#u=(Q(this,o),!1),this.ready=async()=>this.isReady?this:le(this,W.ContextCreated),this.#h=()=>{this.#s&&this.#l()},$(this,W.ContextCreated),g(this,W.ContextLost,ve.AAA,()=>{U(this,W.ContextCreated)}),b(()=>{if(this.viewReady&&this.proxyReady)return this.view.reCreateChanges(),c(this,W.ContextCreated,this),this.#i&&(this.#i=!1,this.#l()),()=>{c(this,W.ContextLost,this)}},[A(this,"viewReady"),A(this,"proxyReady")])}get view(){return this.#e}set view(a){a!==this.#e&&(this.#e&&this.#e.ns&&globalThis.__shadowEnvs&&globalThis.__shadowEnvs.delete(this.#e.ns),this.#e=a??void 0,this.#e&&this.#e.ns&&(globalThis.__shadowEnvs??=new Map,globalThis.__shadowEnvs.has(this.#e.ns)&&globalThis.__shadowEnvs.get(this.#e.ns)!==this&&this.logger.isWarn&&this.logger.warn("overwrite a namespace already in use",this.#e.ns,globalThis.__shadowEnvs.get(this.#e.ns)),globalThis.__shadowEnvs.set(this.#e.ns,this)),this.viewReady=!!a)}get envProxy(){return this.#t}set envProxy(a){if(a!==this.#t){let h=this.#t;this.#t=a??void 0,this.#t&&(this.#t.onMessageToView=this.#c.bind(this)),h&&h.destroy(),this.proxyReady=!1,a?.start().then(()=>{this.proxyReady=!0}).catch(u=>{this.logger.error("failed to start envProxy",u),this.proxyReady=!1})}}get isReady(){return!!(this.#e&&this.#t&&this.proxyReady&&!this.isDestroyed)}sync(){if(!this.isReady){this.#i=!0;return}this.#s||(this.#s=!0,queueMicrotask(this.#h))}syncWait(){return this.#r=!0,this.sync(),this.#n?this.#n:(this.#n=le(this,W.AfterSync).then(a=>(this.#n=void 0,a)),this.#n)}destroy(){let a=this.#e?.ns;this.envProxy?.destroy(),this.envProxy=void 0,this.view=void 0,a&&globalThis.__shadowEnvs.has(a)&&globalThis.__shadowEnvs.get(a)===this&&globalThis.__shadowEnvs.delete(a),Ee(this),y(this),this.#u=!0,Object.freeze(this)}#h;async#l(){if(this.#s=!1,this.isReady){let a=this.view.buildChangeTrails();if(a.length>0)try{let h=this.#r;this.#r=!1,await this.envProxy.applyChangeTrail(a,h)}catch(h){this.logger.error("failed to apply change trail",h)}finally{c(this,W.AfterSync,a)}}}#c(a){this.logger.isDebug&&this.logger.debug("onMessageToView",a.type,a.data),this.view?.dispatchMessage(a.uuid,a.type,a.data,a.traverseChildren)}}})();var C=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],rr=()=>{let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(C[s&255]+C[s>>8&255]+C[s>>16&255]+C[s>>24&255]+"-"+C[e&255]+C[e>>8&255]+"-"+C[e>>16&15|64]+C[e>>24&255]+"-"+C[t&63|128]+C[t>>8&255]+"-"+C[t>>16&255]+C[t>>24&255]+C[r&255]+C[r>>8&255]+C[r>>16&255]+C[r>>24&255]).toLowerCase()},xs=()=>globalThis?.crypto?.randomUUID?.()??rr();var Oe=class extends Error{constructor(e){super(e),this.name="ViewComponentError"}},Je=class s{#e;#t;#s;#i;#r=0;get uuid(){return this.#e}get token(){return this.#t}set token(e){e??=I,e!==this.#t&&(this.#t=e,this.#s?.changeToken(this,e))}get parent(){return this.#i}set parent(e){if(e){if(e.#s!==this.#s)throw new Oe("cannot set parent from different context");e.addChild(this)}else this.removeFromParent()}get context(){return this.#s}set context(e){this.#s!=e&&(this.#s&&this.destroy(),this.#s=e,e&&e.addComponent(this))}get order(){return this.#r}set order(e){let t=this.#r;this.#r=e??0,t!==this.#r&&this.#s.changeOrder(this)}constructor(e,t){w(this),t instanceof s&&(t={parent:t}),this.#e=t?.uuid??xs(),this.#t=e,this.#r=t?.order??0,this.#i=t?.parent;let r=t?.context??M.get();if(this.#i&&this.#i.#s!==r)throw new Oe("cannot set parent from different context");this.context=r}isChildOf(e){return this.#i===e}removeFromParent(){this.#i?(this.#s?.removeFromParent(this.uuid,this.#i),this.#i=void 0):this.#s?.moveToRoot(this.uuid)}addChild(e){if(e.#s!==this.#s)throw new Oe("cannot add a child from another context");e.isChildOf(this)||(e.removeFromParent(),e.#i=this,this.#s.addToChildren(this,e))}setProperty(e,t,r){this.#s.setProperty(this,e,t,r)}removeProperty(e){this.#s.removeProperty(this,e)}dispatchShadowObjectsEvent(e,t,r){this.#s.dispatchShadowObjectsEvent(this,e,t,r)}dispatchEvent(e,t,r){if(c(this,e,t),r)for(let i of this.#s.getChildren(this))i.dispatchEvent(e,t,r)}destroy(){this.removeFromParent(),this.#s?.destroyComponent(this),this.#s=void 0}};var Xe="shaeRequestEntParent",Ze="shaeReRequestEntParent",ks="shae-worker",et="shae-ent",As="shae-prop",Y="token",K="ns",tt="local",Ts="no-autostart",st="no-structured-clone",N="auto-sync",rt="src",it="name",nt="value",ot="type",at="no-trim";var Pe=new Set(["on","true","yes","local","1"]);var Os=s=>oe(s.getAttribute(K)),Re=(s,e)=>{if(s.hasAttribute(e)){let t=s.getAttribute(e)?.trim()?.toLowerCase()||"1";return Pe.has(t)}return!1};var Ps=(s,e)=>{e.set(Os(s))},Nt=new Set,Dt=!1,ir=s=>{Nt.add(s),Dt||(Dt=!0,queueMicrotask(()=>{Dt=!1;for(let e of Nt)j.get(e)?.sync();Nt.clear()}))},J=class extends HTMLElement{static{this.observedAttributes=[K]}get ns(){return this.ns$.value}set ns(e){typeof e=="symbol"?this.ns$.set(e):this.ns$.set(oe(e))}constructor(){super(),this.isShaeElement=!0,this.ns$=f(ne),this.ns$.onChange(e=>{typeof e=="string"&&e.length>0?this.getAttribute(K)!==e&&this.setAttribute(K,e):this.removeAttribute(K)}),Ps(this,this.ns$)}attributeChangedCallback(e){e===K&&Ps(this,this.ns$)}syncShadowObjects(){ir(this.ns)}};var ht=class extends J{static{this.observedAttributes=[...J.observedAttributes,Y]}get componentContext(){return this.componentContext$.value}get viewComponent(){return this.viewComponent$.value}get uuid(){return this.viewComponent?.uuid}get token(){return this.token$.value}set token(e){this.token$.set(e)}#e;constructor(){super(),this.isShaeEntElement=!0,this.componentContext$=f(),this.viewComponent$=f(),this.token$=f(),this.#n=!0,this.#f=()=>{let e=this.findShadowRootHost();e!=null&&this.dispatchEvent(new CustomEvent(Ze,{bubbles:!0,composed:!0,detail:{requester:this,shadowRootHost:e}}))},this.#g=e=>{let t=e.detail?.requester;if(t===this||!t?.isShaeEntElement||t.ns!==this.ns)return;e.detail?.shadowRootHost&&this.#h()},this.#p=e=>{let t=e.detail?.requester;t!==this&&t?.isShaeEntElement&&t.ns===this.ns&&(e.stopPropagation(),t.#c(this))},this.ns$.onChange(e=>{this.componentContext$.set(M.get(e)),this.isConnected&&this.#h()}),this.#d(),this.token$.onChange(e=>{e==null?this.removeAttribute(Y):this.getAttribute(Y)!==e&&this.setAttribute(Y,e)}),b(()=>{let e=this.viewComponent$.get();if(e){let t=g(e,M.ReRequestParentRoots,()=>this.#u()),r=e.context?.ns;return()=>{t(),e.destroy(),r&&r!==this.ns?j.get(r)?.sync():this.syncShadowObjects()}}}),this.token$.onChange(e=>{let t=this.viewComponent$.value;t&&(t.token=e,this.syncShadowObjects())})}#t;#s(){this.#t?.();let e=this.componentContext$.onChange(t=>{let r=this.token$.value,i=this.viewComponent$.value;i?i.context=t:t&&(i=new Je(r,{context:t}),this.viewComponent$.set(i)),this.syncShadowObjects()});this.#t=()=>{e()}}#i(){this.#t?.(),this.#t=void 0}#r;#n;findShadowRootHost(){if(this.#n){this.#n=!1;let e=this;for(;e;){if(e.parentElement==null){let t=e.parentNode;t&&(this.#r=t.host);break}e=e.parentElement}}return this.#r}getParentNodeForObserver(){let e=this.parentNode;return e||(e.host??e)}connectedCallback(){this.#n=!0,this.addEventListener("slotchange",this.#f,{capture:!1,passive:!1}),this.addEventListener(Xe,this.#p,{capture:!1,passive:!1}),this.#s(),St(()=>this.#d()),this.componentContext==null&&this.componentContext$.set(M.get(this.ns)),this.#h(),this.componentContext?.dispatchReRequestParentRoots(),this.#a(),this.syncShadowObjects()}#a(){this.#o();let e=this.getParentNodeForObserver();e&&(this.#e=new MutationObserver((t,r)=>{for(let{target:i,removedNodes:n}of t)if(i===e){for(let o of n)if(o===this){this.#o(),this.onParentChanged(this.getParentNodeForObserver(),e);break}}}),this.#e.observe(e,{childList:!0,subtree:!1,attributes:!1}))}onParentChanged(e,t){this.#c(void 0),this.#h()}#o(){this.#e?.disconnect(),this.#e=void 0}attributeChangedCallback(e){super.attributeChangedCallback(e),e===Y&&this.#d()}disconnectedCallback(){this.#n=!0,this.#o(),this.removeEventListener("slotchange",this.#f,{capture:!1}),this.removeEventListener(Xe,this.#p,{capture:!1}),this.#c(void 0),this.componentContext$.set(void 0),this.syncShadowObjects(),this.#i()}#u(){this.isConnected&&(this.#c(void 0),this.#h())}#h(){this.dispatchEvent(new CustomEvent(Xe,{bubbles:!0,composed:!0,detail:{requester:this}}))}#l;#c(e){if(this.entParentNode!==e)if(this.entParentNode&&this.entParentNode.removeEventListener(Ze,this.#g,{capture:!1}),this.entParentNode=e,this.entParentNode&&this.entParentNode.addEventListener(Ze,this.#g,{capture:!1,passive:!1}),this.#l?.(),this.#l=void 0,e){let t=b(()=>{let r=this.viewComponent$.get();if(r){let i=e.viewComponent$.get();r.parent=i&&i.context===r.context?i:void 0,r.parent==null&&queueMicrotask(()=>{this.#h()}),this.syncShadowObjects()}});this.#l=()=>t.destroy()}else{let t=this.viewComponent;t.parent&&(t.parent=void 0,this.syncShadowObjects())}}#f;#g;#p;#d(){if(this.hasAttribute(Y)){let e=this.getAttribute(Y)?.trim()||void 0;this.token$.set(e)}}};customElements.define(et,ht);var nr=s=>{let e=s.parentElement;for(;e;){if(e.isShaeEntElement)return e;e=e.parentElement}},or=new Set(["string","text","number","bigint","float","int","integer","hex","hexadecimal","oct","octal","bin","binary","bool","boolean","[]","text[]","string[]","number[]","float[]","int[]","integer[]","hex[]","hexadecimal[]","oct[]","octal[]","bin[]","binary[]","bool[]","boolean[]","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","bigint64array","biguint64array","json"]),lt=class extends HTMLElement{static{this.observedAttributes=[it,nt,ot,at]}get name(){return this.name$.value}get value(){return this.valueOut$.value}set value(e){this.valueIn$.set(e)}get shouldTrim(){return this.shouldTrim$.value}get entNode(){return this.entNode$.value}set entNode(e){this.entNode$.set(e)}get viewComponent(){return this.viewComponent$.value}constructor(){super(),this.isShaeEntElement=!0,this.entNode$=f(),this.viewComponent$=f(),this.name$=f(),this.valueIn$=f(),this.valueOut$=f(),this.type$=f(),this.shouldTrim$=f(!0),this.logger=new x("ShaePropElement"),this.#e=()=>{this.entNode$.set(nr(this))},this.#t=()=>{queueMicrotask(()=>{this.isConnected||this.entNode$.set(void 0)})},this.#s=()=>{this.name$.set(this.getAttribute(it)?.trim()??void 0)},this.#i=()=>{this.valueIn$.set(this.getAttribute(nt))},this.#r=()=>{let e=this.getAttribute(ot)?.trim().toLowerCase();e&&!or.has(e)&&(this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${e}"`,{shaeProp:this}),e=void 0),this.type$.set(e)},this.#n=()=>{this.shouldTrim$.set(!Re(this,at))},this.entNode$.onChange(e=>{if(e){let t=q(e.viewComponent$,this.viewComponent$);return()=>{t.destroy()}}else this.viewComponent$.set(void 0)}),b(()=>{let e=this.viewComponent$.get();if(e){let t=this.name$.get();if(t){let r=this.valueOut$.get();this.logger.isDebug&&this.logger.debug(`[${this.name}] view-component set-property`,t,r,e.uuid,{viewComponent:e,shaeProp:this}),e.setProperty(t,r),this.isConnected&&this.entNode?.syncShadowObjects()}}}),b(()=>{let e=this.type$.get(),t=this.shouldTrim$.get(),r=this.valueIn$.get();if(t&&typeof r=="string"&&(r=r.trim()),r=r||void 0,r!=null&&typeof r=="string"&&e)switch(e){case"string":case"text":break;case"number":r=Number(r);break;case"bigint":r=BigInt(r);break;case"float":r=parseFloat(r);break;case"int":case"integer":r=parseInt(r,10);break;case"hex":case"hexadecimal":r=parseInt(r,16);break;case"oct":case"octal":r=parseInt(r,8);break;case"bin":case"binary":r=parseInt(r,2);break;case"bool":case"boolean":r=Pe.has(r.toLowerCase());break;case"[]":case"text[]":case"string[]":r=r.split(/\W+/);break;case"number[]":r=r.split(/\W+/).map(i=>Number(i));break;case"float[]":r=r.split(/\W+/).map(i=>parseFloat(i));break;case"int[]":case"integer[]":r=r.split(/\W+/).map(i=>parseInt(i));break;case"hex[]":case"hexadecimal[]":r=r.split(/\W+/).map(i=>parseInt(i,16));break;case"oct[]":case"octal[]":r=r.split(/\W+/).map(i=>parseInt(i,8));break;case"bin[]":case"binary[]":r=r.split(/\W+/).map(i=>parseInt(i,2));break;case"bool[]":case"boolean[]":r=r.split(/\W+/).map(i=>Pe.has(i.toLowerCase()));break;case"int8array":r=new Int8Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint8array":r=new Uint8Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint8clampedarray":r=new Uint8ClampedArray(r.split(/\W+/).map(i=>Number(i)));break;case"int16array":r=new Int16Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint16array":r=new Uint16Array(r.split(/\W+/).map(i=>Number(i)));break;case"int32array":r=new Int32Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint32array":r=new Uint32Array(r.split(/\W+/).map(i=>Number(i)));break;case"float32array":r=new Float32Array(r.split(/\W+/).map(i=>Number(i)));break;case"float64array":r=new Float64Array(r.split(/\W+/).map(i=>Number(i)));break;case"bigint64array":r=new BigInt64Array(r.split(/\W+/).map(i=>BigInt(i)));break;case"biguint64array":r=new BigUint64Array(r.split(/\W+/).map(i=>BigInt(i)));break;case"json":r=JSON.parse(r);break;default:this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${e}"`,{value:r,shaeProp:this})}this.valueOut$.set(r)}),k(()=>{this.#s(),this.#i(),this.#r(),this.#n()})}connectedCallback(){k(()=>{this.#e(),this.#s(),this.#i(),this.#r(),this.#n()})}attributeChangedCallback(e){switch(e){case it:this.#s();break;case nt:this.#i();break;case ot:this.#r();break;case at:this.#n();break}}disconnectedCallback(){this.#t()}#e;#t;#s;#i;#r;#n};customElements.whenDefined(et).then(()=>customElements.define(As,lt));var ut,$t=null,ge=class{static{this.OnFrame=Symbol("onFrame")}#e=0;#t=0;constructor(){if($t)return $t;w(this),$t=this}start(e){if(e!=null)return Et(this)===0&&this.#i(),g(this,ut.OnFrame,e),this.#t++,()=>{this.stop(e)}}stop(e){y(this,ut.OnFrame,e),Et(this)===0&&this.#r()}#s=e=>{c(this,ut.OnFrame,e),this.#i()};#i(){this.#e=requestAnimationFrame(this.#s)}#r(){cancelAnimationFrame(this.#e),this.#e=0}};ut=ge;var ye="value",It=(()=>{let s,e=[],t=[];return class{static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;s=[ke({name:ye})],xe(this,null,s,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:n=>"value"in n,get:n=>n.value,set:(n,o)=>{n.value=o}},metadata:i},e,t),i&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static{this.Value=ye}#e;#t;#s;get value(){return this.#s}set value(i){this.#s=i}constructor(i){this.#e=[],this.#s=Q(this,e,void 0),this.value$=Q(this,t),$(this,ye),this.value$=A(this,ye),this.value$.onChange(n=>c(this,ye,n)),i&&this.add(...i)}add(...i){for(let n of i)this.#e.push(n);this.#r()}pop(){this.#e.pop(),this.#r()}clear(){this.#e.length=0,this.#i()}dispose(){this.clear(),U(this,ye),y(this),Ee(this),this.value$.destroy()}#i(){this.#t?.destroy(),this.#t=void 0}#r(){this.#i(),this.#t=b(()=>{for(let i of this.#e){let n=ie(i);if(n!=null){this.value=n;return}}this.value=void 0},this.#e),this.#t.run()}}})();var Wt="onCreate",X="onDestroy",Rs="onParentChanged",Ms="onViewEvent";var Ft=new Map,Ut=!1,ar=(s,e)=>{Ft.set(s,e),Ut||(Ut=!0,queueMicrotask(()=>{Ut=!1;let t=Array.from(Ft.entries());Ft.clear();for(let[r,i]of t)r.set(i)}))},ct=class{#e;#t;#s=new Qe;#i=new Map;#r;#n;#a=new Set;#o=[];#u=0;get kernel(){return this.#e}get uuid(){return this.#t}get order(){return this.#u}set order(e){this.#u!==e&&(this.#u=e,this.#r&&this.parent.resortChildren())}get parentUuid(){return this.#r||void 0}set parentUuid(e){this.#r!==e&&(this.removeFromParent(),this.#r=e||void 0,this.#n=e?this.#e.getEntity(e):void 0,this.#n&&this.#n.addChild(this))}get parent(){return!this.#n&&this.#r&&(this.#n=this.#e.getEntity(this.#r)),this.#n}set parent(e){this.parentUuid=e?.uuid}get hasParent(){return!!this.#r}get children(){return this.#o}constructor(e,t){this.#e=e,this.#t=t,v(this,X,ve.Min,this)}traverse(e){e(this);for(let t of this.#o)t.traverse(e)}onDestroy(){this.#s.clear(),y(this);for(let e of this.#i.values())e.unsubscribePathValue(),e.unsubscribeParent?.(),e.valuePath.dispose(),e.inherited.destroy(),e.provide.destroy(),e.context.destroy();this.#r=void 0,this.#n=void 0,this.#a.clear(),this.#o.length=0}addChild(e){if(this.#o.length===0){this.#a.add(e.uuid),this.#o.push(e);return}if(this.#a.has(e.uuid))throw new Error(`child with uuid: ${e.uuid} already exists! parentUuid: ${this.uuid}`);this.#a.add(e.uuid),this.#o.push(e),this.resortChildren();for(let[,t]of e.#i)e.#c(t)}resortChildren(){this.#o.sort((e,t)=>e.order-t.order)}removeChild(e){this.#a.has(e.uuid)&&(this.#a.delete(e.uuid),this.#o.splice(this.#o.indexOf(e),1))}removeFromParent(){if(this.#n){this.#n.removeChild(this),this.#n=void 0,this.#r=void 0;for(let[,e]of this.#i)e.unsubscribeParent&&(e.unsubscribeParent(),e.unsubscribeParent=void 0)}}reSubscribeToParentContexts(){for(let[,e]of this.#i)this.#c(e)}dispatchMessageToView(e,t,r,i=!1){this.#e.dispatchMessageToView({uuid:this.#t,type:e,data:t,transferables:r,traverseChildren:i})}dispatchViewEvents(e){for(let{type:t,data:r}of e)c(this,Ms,t,r)}dispatchViewEvent(e,t){this.dispatchViewEvents([{type:e,data:t}])}#h(e){return this.#s.get(e)}getPropertyReader(e){return this.#h(e).get}getPropertyWriter(e){return this.#h(e).set}setProperties(e){k(()=>{for(let[t,r]of e)this.setProperty(t,r)})}setProperty(e,t){this.getPropertyWriter(e)(t)}getProperty(e){return ie(this.getPropertyReader(e))}propKeys(){return Array.from(this.#s.keys())}propEntries(){return Array.from(this.#s.entries()).map(([e,t])=>[e,t.value])}hasContext(e){return this.#i.has(e)}useContext(e){return this.#l(e).context.get}provideContext(e){return this.#l(e).provide}#l(e){if(this.#i.has(e))return this.#i.get(e);let t=f(),r=f(),i=f(),n=new It([r,t]),o=g(n,It.Value,a=>{ar(i,a)}),l={name:e,inherited:t,provide:r,context:i,valuePath:n,unsubscribePathValue:o};return this.#i.set(e,l),this.#c(l),l}#c(e){if(e.unsubscribeParent?.(),e.unsubscribeParent=void 0,this.parent){let t=this.parent.#l(e.name),r=q(t.context,e.inherited);e.unsubscribeParent=()=>{r.destroy()}}else e.inherited.set(void 0)}};var Me=class{static get(e){return e??hr}#e=new Map;#t=new Map;define(e,t){this.#e.has(e)?ws(this.#e.get(e).constructors,t):this.#e.set(e,{token:e,constructors:[t]})}appendRoute(e,t){if(this.#t.has(e)){let r=this.#t.get(e);for(let i of t)r.add(i)}else this.#t.set(e,new Set(t))}clearRoute(e){this.#t.delete(e)}findTokensByRoute(e){let t=new Set([e]),r=this.#t.has(e)?[...this.#t.get(e)]:[];for(;r.length;){let i=r.shift();t.has(i)||(t.add(i),this.#t.has(i)&&r.push(...Array.from(this.#t.get(i)).filter(n=>!t.has(n))))}return Array.from(t)}findConstructors(e){let t=this.findTokensByRoute(e),r=new Set;for(let i of t){let n=this.#e.get(i);if(n)for(let o of n.constructors)r.add(o)}return r.size>0?Array.from(r):void 0}hasToken(e){return this.#e.has(e)}hasRoute(e){return this.#t.has(e)}clear(){this.#e.clear(),this.#t.clear()}},hr=new Me;var F;(function(s){s[s.CreateAndDestroy=0]="CreateAndDestroy",s[s.JustCreate=1]="JustCreate",s[s.DestroyOnly=2]="DestroyOnly"})(F||(F={}));var Ls=s=>s.displayName||s.name,ft=class{#e;#t;#s;#i;#r;constructor(e){this.logger=new x("Kernel"),this.#e=new Map,this.#t=new Set,this.#r=!0,w(this),this.registry=Me.get(e)}getEntity(e){let t=this.#e.get(e)?.entity;if(!t)throw new Error(`entity with uuid "${e}" not found!`);return t}hasEntity(e){return this.#e.has(e)}traverseLevelOrderBFS(e=!1){if(this.#r){let t=new Map,r=(i,n)=>{let o=this.getEntity(i);t.has(n)?t.get(n).push(o):t.set(n,[o]);for(let l of o.children)r(l.uuid,n+1)};this.#t.forEach(i=>r(i,0)),this.#s=Array.from(t.entries()).sort((i,n)=>i[0]-n[0]).map(([,i])=>i).flat(),this.#i=this.#s.slice().reverse(),this.#r=!1}return e?this.#i:this.#s}getEntityGraph(){return Array.from(this.#t).map(e=>this.getEntityGraphNode(e))}getEntityGraphNode(e){if(!this.#e.has(e))return;let{token:t,entity:r}=this.#e.get(e);return{token:t,entity:r,props:Object.fromEntries(r.propEntries()),children:r.children.map(i=>this.getEntityGraphNode(i.uuid))}}upgradeEntities(){for(let e of this.traverseLevelOrderBFS(!0))this.updateShadowObjects(e.uuid,F.DestroyOnly);for(let e of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(e.uuid,F.JustCreate)}run(e){k(()=>{for(let t of e.changeTrail)this.parse(t)})}parse(e){switch(e.type){case p.CreateEntities:this.createEntity(e.uuid,e.token,e.parentUuid,e.order,e.properties),this.#r=!0;break;case p.DestroyEntities:this.destroyEntity(e.uuid),this.#r=!0;break;case p.SetParent:this.setParent(e.uuid,e.parentUuid,e.order),this.#r=!0;break;case p.UpdateOrder:this.updateOrder(e.uuid,e.order),this.#r=!0;break;case p.ChangeProperties:this.changeProperties(e.uuid,e.properties);break;case p.ChangeToken:this.changeToken(e.uuid,e.token);break;case p.SendEvents:this.dispatchEventsToEntity(e.uuid,e.events);break}}createEntity(e,t,r,i=0,n){let o=new ct(this,e);o.order=i;let l={token:t,entity:o,usedConstructors:new Map};this.#e.set(e,l),r&&(o.parentUuid=r),o.hasParent||this.#t.add(e),n&&o.setProperties(n),this.createShadowObjects(e)}destroyEntity(e){if(!this.#e.has(e))return;let{entity:t,usedConstructors:r}=this.#e.get(e);t.removeFromParent(),c(t,X,this),r.clear(),this.#e.delete(t.uuid),this.#t.delete(t.uuid)}setParent(e,t,r=0){let i=this.getEntity(e);i.parentUuid===t&&i.order===r||(i.removeFromParent(),i.order=r,i.parentUuid=t,i.hasParent?this.#t.delete(e):this.#t.add(e),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:e,parentUuid:t,order:r,entity:i}),c(i,Rs,i)}))}updateOrder(e,t){this.getEntity(e).order=t}dispatchEventsToEntity(e,t){this.getEntity(e)?.dispatchViewEvents(t)}changeProperties(e,t){this.getEntity(e).setProperties(t)}changeToken(e,t){if(!this.#e.has(e))return;let r=this.#e.get(e);r.token!==t&&(r.token=t,this.updateShadowObjects(e))}dispatchMessageToView(e){queueMicrotask(()=>{c(this,pe,e)})}updateShadowObjects(e,t=F.CreateAndDestroy){let r=this.#e.get(e),i=new Set(this.registry.findConstructors(r.token)),n=t===F.CreateAndDestroy||t===F.DestroyOnly,o=t===F.CreateAndDestroy||t===F.JustCreate;if(n){for(let[l,a]of r.usedConstructors)if(!i.has(l)){r.usedConstructors.delete(l);for(let h of a)this.destroyShadowObject(h,r.entity)}}if(o)for(let l of i)r.usedConstructors.has(l)||this.constructShadowObject(l,r)}constructShadowObject(e,t){let r=new Set,i=new Set,n=new Map,o=new Map,l=new Map,a=w(new e({entity:t.entity,provideContext(h,u,d){let E=o.get(h);if(E===void 0){E=f(u,d?{compare:d}:void 0),o.set(h,E);let ae=q(E,t.entity.provideContext(h));i.add(ae.destroy.bind(ae))}return E},useContext(h,u){let d=n.get(h);if(d===void 0){d=f(void 0,u?{compare:u}:void 0).get,n.set(h,d);let E=q(t.entity.useContext(h),d);i.add(E.destroy.bind(E))}return d},useProperty(h,u){let d=l.get(h);if(d===void 0){d=f(void 0,u?{compare:u}:void 0).get,l.set(h,d);let E=q(t.entity.getPropertyReader(h),d);i.add(E.destroy.bind(E))}return d},createEffect(...h){let u=b(...h);return i.add(u.destroy),u},createSignal(...h){let u=f(...h);return i.add(()=>{S(u)}),u},createMemo(...h){let u=Pt(...h);return i.add(()=>{S(u)}),u},on(...h){let u=g(...h);return i.add(u),u},once(...h){let u=v(...h);return i.add(u),u},onDestroy(h){r.add(h)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",Ls(e),{shadowObject:a,entity:t.entity}),v(a,X,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",Ls(e),{shadowObject:a,entity:t.entity});for(let u of r)u();for(let u of i)u();for(let u of n.values())S(u);for(let u of l.values())S(u);for(let u of o.values())S(u);r.clear(),i.clear(),n.clear(),l.clear(),o.clear();let h=t.usedConstructors.get(e);h&&(h.delete(a),h.size===0&&t.usedConstructors.delete(e))}),t.usedConstructors.has(e)?t.usedConstructors.get(e).add(a):t.usedConstructors.set(e,new Set([a])),this.attachShadowObject(a,t.entity),a}createShadowObjects(e){let t=this.#e.get(e);this.registry.findConstructors(t.token)?.forEach(r=>{this.constructShadowObject(r,t)})}findShadowObjects(e){if(!this.#e.has(e))return[];let{usedConstructors:t}=this.#e.get(e);return Array.from(new Set(Array.from(t.values()).map(r=>Array.from(r)).flat()))}attachShadowObject(e,t){g(t,e),typeof e[Wt]=="function"&&e[Wt](t)}destroyShadowObject(e,t){typeof e[X]=="function"&&e[X](t),c(e,X,t),y(t,e)}destroy(){for(let e of this.traverseLevelOrderBFS().reverse())this.destroyEntity(e.uuid)}};async function Vt(s,e,t,r=!0){if(t.has(e)){console.warn("importModule: skipping already imported module",e);return}else t.add(e);e.extends&&await Promise.all(e.extends.map(n=>Vt(s,n,t,!1)));let{registry:i}=s;if(e.define)for(let[n,o]of Object.entries(e.define))i.define(n,o);if(e.routes)for(let[n,o]of Object.entries(e.routes))i.appendRoute(n,o);await(e.initialize?.({define:(n,o)=>i.define(n,o),kernel:s,registry:i})??Promise.resolve()),r&&s.upgradeEntities()}var dt=s=>(typeof s=="string"&&(s=new URL(s,globalThis.location.href)),s.toString());function _s(s){return s.map(e=>{if(e.transferables&&e.transferables.length>0){let{transferables:t,...r}=e;return structuredClone(r,{transfer:t})}else return structuredClone(e)})}var pt=class{#e;get registry(){return this.kernel.registry}constructor(e){this.#e=new Set,this.isLocalEnv=!0,this.disableStructuredClone=!1,this.kernel=new ft(e),g(this.kernel,pe,t=>{if(this.onMessageToView!=null){let{type:r,uuid:i,traverseChildren:n}=t,o=structuredClone(t.data,{transfer:t.transferables});this.onMessageToView({type:r,uuid:i,data:o,traverseChildren:n})}})}start(){return Promise.resolve()}applyChangeTrail(e,t){let r={changeTrail:this.disableStructuredClone?e:_s(e)},i;try{this.kernel.run(r),i=Promise.resolve()}catch(n){i=Promise.reject(n)}return i}async importScript(e){let t=await import(dt(e));t[Rt]&&await this.importModule(t[Rt])}async importModule(e){return Vt(this.kernel,e,this.#e)}destroy(){this.kernel.destroy(),this.registry.clear(),this.#e.clear()}};function zt(s){let e=new Blob([s],{type:"text/javascript"}),t=URL.createObjectURL(e),r=new Worker(t);return URL.revokeObjectURL(t),r}function Bt(){return zt('var js=Object.defineProperty;var Ye=Object.getOwnPropertySymbols;var Mt=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable;var Ms=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Dt=e=>{throw TypeError(e)};var it=(e,t,s)=>t in e?js(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,at=(e,t)=>{for(var s in t||(t={}))Mt.call(t,s)&&it(e,s,t[s]);if(Ye)for(var s of Ye(t))Tt.call(t,s)&&it(e,s,t[s]);return e};var Lt=(e,t)=>{var s={};for(var r in e)Mt.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(e!=null&&Ye)for(var r of Ye(e))t.indexOf(r)<0&&Tt.call(e,r)&&(s[r]=e[r]);return s};var u=(e,t,s)=>it(e,typeof t!="symbol"?t+"":t,s),nt=(e,t,s)=>t.has(e)||Dt("Cannot "+s);var i=(e,t,s)=>(nt(e,t,"read from private field"),s?s.call(e):t.get(e)),f=(e,t,s)=>t.has(e)?Dt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),g=(e,t,s,r)=>(nt(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),b=(e,t,s)=>(nt(e,t,"access private method"),s);var Rt=(e,t,s,r)=>({set _(a){g(e,t,a,s)},get _(){return i(e,t,r)}});var ot=function(e,t){this[0]=e,this[1]=t},Nt=(e,t,s)=>{var r=(n,h,l,d)=>{try{var p=s[n](h),c=(h=p.value)instanceof ot,v=p.done;Promise.resolve(c?h[0]:h).then(E=>c?r(n==="return"?n:"next",h[1]?{done:E.done,value:E.value}:E,l,d):l({value:E,done:v})).catch(E=>r("throw",E,l,d))}catch(E){d(E)}},a=n=>o[n]=h=>new Promise((l,d)=>r(n,h,l,d)),o={};return s=s.apply(e,t),o[Ms("asyncIterator")]=()=>o,a("next"),a("throw"),a("return"),o};var xt;(function(e){e[e.StructuralChanges=1]="StructuralChanges",e[e.ContentUpdates=2]="ContentUpdates",e[e.Removal=3]="Removal"})(xt||(xt={}));var q;(function(e){e[e.CreateEntities=1]="CreateEntities",e[e.DestroyEntities=2]="DestroyEntities",e[e.SetParent=3]="SetParent",e[e.UpdateOrder=4]="UpdateOrder",e[e.ChangeProperties=5]="ChangeProperties",e[e.ChangeToken=6]="ChangeToken",e[e.SendEvents=7]="SendEvents"})(q||(q={}));var Lr=Symbol.for("ShadowEntsGlobalNS"),Ts="configure",Ds="changeTrail",Ls="destroy",Rs="loaded",Vt="appliedChangeTrail",ht="importedModule",Ns="destroyed",yt="messageToView",lt="shadowObjects",N="ConsoleLogger",M=`${N}Storage`,Zt,Xt,_t,xs=!!((_t=(Xt=(Zt=globalThis.location)==null?void 0:Zt.host)==null?void 0:Xt.startsWith("localhost"))!=null&&_t),Ve="localStorage"in globalThis,He=Symbol.for(N),Ft=!1,zt=e=>{if(typeof e=="boolean")return e;switch(e.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},pt=e=>[Ve?N:void 0,...Array.isArray(e)?e:[e]].filter(Boolean).join(".");function dt(e,t=void 0,s){var o;let r=pt(e),a=Ve?localStorage.getItem(r):(o=globalThis[M])==null?void 0:o[r];return a!=null?t(a):s}function Te(e,t){Ve?localStorage.setItem(pt(e),t):(globalThis[M]==null&&(globalThis[M]={},console.debug(`${N}: Initialize`,{[M]:globalThis[M]})),globalThis[M][pt(e)]=t)}var oe,Le,y,Vs=(y=class{constructor(t){f(this,oe);this.enable=!0,this.namespace=(t||"").trim()||N,Ft||(y.loadConfig(),Ft=!0);let s=[this.namespace,"enable"];this.enable=dt(s,zt,this.enable),Te(s,Ve?this.enable?"true":"false":this.enable)}static get isEnabled(){return y.sharedConfig.enable}static get isDebug(){return y.sharedConfig.enable&&y.sharedConfig.debug}static loadConfig(){var t,s,r;Ve?(["enable","debug","info","warn"].forEach(a=>{this.sharedConfig[a]=dt(a,zt,this.sharedConfig[a])}),["debug","info","warn","error"].forEach(a=>{this.sharedStyles[a]=dt(["styles",a],void 0,this.sharedStyles[a])}),y.isDebug&&console.debug(`${N}: Load config from localStorage`,y.sharedConfig),(t=globalThis[N])!=null&&t[He]||((s=globalThis[N])!=null||(globalThis[N]={[He]:!0,get enable(){return y.sharedConfig.enable},set enable(a){y.sharedConfig.enable=a,Te("enable",a?"true":"false")},get debug(){return y.sharedConfig.debug},set debug(a){y.sharedConfig.debug=a,Te("debug",a?"true":"false")},get info(){return y.sharedConfig.info},set info(a){y.sharedConfig.info=a,Te("info",a?"true":"false")},get warn(){return y.sharedConfig.warn},set warn(a){y.sharedConfig.warn=a,Te("warn",a?"true":"false")}}))):(r=globalThis[M])!=null&&r[He]||(globalThis[M]=at(at({[He]:!0},y.sharedConfig),globalThis[M]),y.sharedConfig=globalThis[M],y.isDebug&&console.debug(`${N}: Load config from ${M}`,globalThis[M]))}get isEnabled(){return this.enable&&y.sharedConfig.enable}get isDebug(){return this.isEnabled&&y.sharedConfig.debug}get isInfo(){return this.isEnabled&&y.sharedConfig.info}get isWarn(){return this.isEnabled&&y.sharedConfig.warn}debug(...t){b(this,oe,Le).call(this,"debug",y.sharedStyles.debug,t)}info(...t){b(this,oe,Le).call(this,"info",y.sharedStyles.info,t)}warn(...t){b(this,oe,Le).call(this,"warn",y.sharedStyles.warn,t)}error(...t){b(this,oe,Le).call(this,"error",y.sharedStyles.error,t)}},oe=new WeakSet,Le=function(t,s,r){console[t](`%c${this.namespace}`,s,...r)},y.sharedConfig={enable:xs,debug:!1,info:!0,warn:!0,"styles.debug":"color: #111; background: #999; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.info":"color: #020; background: #8a8; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.warn":"color: #fa0; background: #a98; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.error":"color: #ff0; background: #a00; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em"},y.sharedStyles={get debug(){return y.sharedConfig["styles.debug"]},set debug(t){y.sharedConfig["styles.debug"]=t},get info(){return y.sharedConfig["styles.info"]},set info(t){y.sharedConfig["styles.info"]=t},get warn(){return y.sharedConfig["styles.warn"]},set warn(t){y.sharedConfig["styles.warn"]=t},get error(){return y.sharedConfig["styles.error"]},set error(t){y.sharedConfig["styles.error"]=t}},y),ye="*",hs=1,At=2,kt=4,ae=Symbol.for("eventize"),Fs="[eventize]",tt=e=>e===ye,ls=e=>{switch(typeof e){case"string":case"symbol":return!0;default:return!1}},ds=typeof console<"u",zs=ds?console[console.warn?"warn":"log"].bind(console,Fs):()=>{},Is=(e,t,s)=>(Object.defineProperty(e,t,{value:s,configurable:!0}),e),Us=0,us=class{constructor(){u(this,"events",new Map);u(this,"eventNames",new Set)}static publish(e){e.sort((t,s)=>t.order-s.order).forEach(t=>t.emit())}add(e){Array.isArray(e)?e.forEach(t=>this.eventNames.add(t)):this.eventNames.add(e)}remove(e){Array.isArray(e)?e.forEach(t=>this.eventNames.delete(t)):this.eventNames.delete(e),this.clear(e)}clear(e){Array.isArray(e)?e.forEach(t=>this.events.delete(t)):this.events.delete(e)}retain(e,t){this.eventNames.has(e)&&this.events.set(e,{args:t,order:Us++})}isKnown(e){return this.eventNames.has(e)}emit(e,t,s=[]){if(tt(e))this.eventNames.forEach(r=>this.emit(r,t,s));else if(this.events.has(e)){let{order:r,args:a}=this.events.get(e);s.push({order:r,emit:()=>t.apply(e,a)})}return s}},vt=(e,t,s,r)=>{if(typeof t=="function"){let a=t.apply(e,s);a!=null&&(r==null||r(a))}},Gs=(e,t,s,r)=>vt(t,t.emit,[e].concat(s),r),$s=e=>{switch(typeof e){case"function":return hs;case"string":case"symbol":return At;case"object":return kt}},Bs=0,Ws=()=>++Bs,cs=class{constructor(e,t,s,r=null){u(this,"id");u(this,"eventName");u(this,"isCatchEmAll");u(this,"priority");u(this,"listener");u(this,"listenerObject");u(this,"listenerType");u(this,"callAfterApply");u(this,"isRemoved");u(this,"refCount");this.id=Ws(),this.eventName=e,this.isCatchEmAll=tt(e),this.listener=s,this.listenerObject=r,this.priority=t,this.listenerType=$s(s),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(e,t=null){if(e===this)return!0;let s=typeof e;return s==="number"&&e===this.id?!0:t===null&&(s==="string"||s==="symbol")?e===ye||e===this.eventName:this.listener===e&&this.listenerObject===t}apply(e,t,s){if(this.isRemoved)return;let{listener:r,listenerObject:a}=this;switch(this.listenerType){case hs:vt(a,r,t,s),this.callAfterApply&&this.callAfterApply();break;case At:vt(a,a[r],t,s),this.callAfterApply&&this.callAfterApply();break;case kt:{let o=r[e];if(this.isCatchEmAll||this.eventName===e){if(typeof o=="function"){let n=o.apply(r,t);n!=null&&(s==null||s(n))}else Gs(e,r,t,s);this.callAfterApply&&this.callAfterApply()}break}}}},qs=(e,t)=>e.priority!==t.priority?t.priority-e.priority:e.id-t.id,It=e=>e==null?void 0:e.slice(0),Ut=(e,t)=>{let s=e.indexOf(t);s>-1&&e.splice(s,1)},Js=e=>e===kt||e===At,bt=(e,t,s)=>{let r=e.findIndex(a=>a.isEqual(t,s));r>-1&&(e[r].isRemoved=!0,e.splice(r,1))},Qe=(e,t,s)=>{let r=[];for(let a of e)(t==null&&a.listenerObject===s||a.eventName===t&&a.listener===s)&&r.push(a);for(let a of r)bt(e,a,void 0)},ut=e=>{e&&(e.forEach(t=>{t.isRemoved=!0}),e.length=0)},Ks=(e,t)=>e.listenerType===t.listenerType?e.priority===t.priority&&e.eventName===t.eventName&&e.listenerObject===t.listenerObject&&e.listener===t.listener:!1,Ys=(e,t)=>{if(Js(e.listenerType))return t.find(s=>Ks(e,s))},Hs=(e,t)=>{let s=Ys(e,t);return s?(s.refCount+=1,s):(t.push(e),t.sort(qs),e)},Qs=class{constructor(){u(this,"namedListeners");u(this,"catchEmAllListeners");u(this,"getListenersForEventName",e=>{let t=this.namedListeners.get(e);return t||(t=[],this.namedListeners.set(e,t)),t});this.namedListeners=new Map,this.catchEmAllListeners=[]}add(e){return Hs(e,e.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(e.eventName))}remove(e,t,s=!1){t==null&&Array.isArray(e)?e.forEach(r=>this.remove(r,null,s)):e==null||t==null&&tt(e)?this.removeAllListeners():t==null&&ls(e)?ut(this.namedListeners.get(e)):e instanceof cs?e.isRemoved||(e.refCount-=1,e.refCount<1&&(e.isRemoved=!0,this.namedListeners.forEach(r=>Ut(r,e)),Ut(this.catchEmAllListeners,e))):s?tt(e)?Qe(this.catchEmAllListeners,ye,e):this.namedListeners.forEach(r=>Qe(r,e,t)):(this.namedListeners.forEach(r=>{bt(r,e,t),Qe(r,void 0,e)}),bt(this.catchEmAllListeners,e,t),Qe(this.catchEmAllListeners,void 0,e))}removeAllListeners(){this.namedListeners.forEach(e=>ut(e)),this.namedListeners.clear(),ut(this.catchEmAllListeners)}forEach(e,t){let s=It(this.catchEmAllListeners),r=It(this.namedListeners.get(e));if(e===ye||!r||r.length===0)s.forEach(t);else if(s.length===0)r.forEach(t);else{let a=r.length,o=s.length,n=0,h=0;for(;n<a||h<o;){if(n<a){let l=r[n];if(h>=o||l.priority>=s[h].priority){t(l),++n;continue}}h<o&&(t(s[h]),++h)}}}getSubscriptionCount(){let e=this.catchEmAllListeners.length;for(let t of this.namedListeners.values())e+=t.length;return e}},je=e=>!!(e&&e[ae]);function Fe(e){if(je(e))return e;let t=new Qs,s=new us;return Is(e,ae,{keeper:s,store:t}),e}var fs={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},Zs=(e,t,s,r,a,o,n)=>{let h=e.add(new cs(s,r,a,o));return t.emit(s,h,n),h},Xs=(e,t,s,r)=>{let a=s.length,o=typeof s[0],n,h,l,d;if(a>=2&&a<=3&&o==="number"?(n=ye,[h,l,d]=s):a>=3&&a<=4&&typeof s[1]=="number"?[n,h,l,d]=s:(h=fs.Default,o==="string"||o==="symbol"||Array.isArray(s[0])?[n,l,d]=s:(n=ye,[l,d]=s)),!l&&ds)throw zs("called with insufficient arguments!",s),"subscribeTo() called with insufficient arguments!";let p=c=>v=>Zs(e,t,v,c,l,d,r);return Array.isArray(n)?n.map(c=>Array.isArray(c)?p(c[1])(c[0]):p(h)(c)):p(h)(n)},gs=(e,t,s)=>{let r=[],a=Xs(e,t,s,r);return us.publish(r),a},Gt=e=>t=>{t.callAfterApply=()=>{e==null||e()}},ys=(e,t)=>Object.assign(()=>T(e,t),Array.isArray(t)?{listeners:t}:{listener:t}),ps=(e,t,s,r)=>{let{store:a,keeper:o}=e[ae];Array.isArray(t)?t.forEach(n=>{a.forEach(n,h=>h.apply(n,s,r)),o.retain(n,s)}):t!==ye&&(a.forEach(t,n=>{n.apply(t,s,r)}),o.retain(t,s))},se=(e,...t)=>{let s=Fe(e),{store:r,keeper:a}=s[ae];return ys(s,gs(r,a,t))},k=(e,...t)=>{let s=Fe(e),{store:r,keeper:a}=s[ae],o=gs(r,a,t),n=ys(s,o),h=!1,l=()=>{h||(n(),h=!0)};return Array.isArray(o)?o.forEach(Gt(l)):Gt(l)(o),l},_s=(e,t)=>new Promise(s=>{k(e,t,s)}),T=(e,t,s)=>{if(!je(e))throw new Error("object is not eventized");let{store:r,keeper:a}=e[ae],o=typeof t,n=s!=null&&(o==="string"||o==="symbol");r.remove(t,s,n),Array.isArray(t)?a.remove(t.filter(h=>typeof h=="string")):ls(t)&&a.remove(t)},m=(e,t,...s)=>{if(!je(e))throw new Error("object is not eventized");ps(e,t,s)},er=(e,t,...s)=>{if(!je(e))throw new Error("object is not eventized");let r=[];return ps(e,t,s,a=>{r.push(a)}),r=r.map(a=>Array.isArray(a)?Promise.all(a):Promise.resolve(a)),r.length>0?Promise.all(r):Promise.resolve()},Ot=(e,t)=>{let s=Fe(e),{keeper:r}=s[ae];r.add(t)},st=(e,t)=>{if(!je(e))throw new Error("object is not eventized");let{keeper:s}=e[ae];s.clear(t)},re=(()=>{let e=(t={})=>Fe(t);return e.inject=(t={})=>(t=Fe(t),Object.assign(t,{on:(...s)=>se(t,...s),once:(...s)=>k(t,...s),onceAsync:s=>_s(t,s),off:(s,r)=>T(t,s,r),emit:(s,...r)=>m(t,s,...r),emitAsync:(s,...r)=>er(t,s,...r),retain:s=>Ot(t,s),retainClear:s=>st(t,s)}),t),e.is=je,e})(),Ne=re(),Pe=re(),me=re(),gt,Ue,Re=(gt=class{constructor(){f(this,Ue,new Set)}batch(e){i(this,Ue).add(e)}run(){m(me,Array.from(i(this,Ue)))}},Ue=new WeakMap,u(gt,"current"),gt),tr=()=>Re.current;function rt(e){let t=Re.current;t?t=void 0:t=Re.current=new Re;try{e()}finally{t&&(Re.current=void 0,t.run())}}var sr=0;function vs(){return sr>0}var W=Symbol.for("signal"),ve=Symbol.for("effect"),$t=Symbol.for("destroySignal"),Bt=Symbol.for("createEffect"),rr=Symbol.for("destroyEffect"),De="value",Wt="mute",qt="unmute",xe="destroy",Z=new Map,U,he,x,K,G,le,de,V,Q,qe=(Q=class{constructor(t){f(this,U,new Set);f(this,he,new Set);f(this,x,new Map);f(this,K,new WeakMap);f(this,G,new Map);f(this,le,new Set);f(this,de,new Set);f(this,V);if(t!=null&&t instanceof Q)return t;if(t!=null||(t=this),Z.has(t))return Z.get(t);Z.set(t,this),re(this)}static get(t){if(t!=null)return t instanceof Q?t:Z.get(t)}static findOrCreate(t){if(t==null)throw new Error("Cannot create a group with a null object");return new Q(t)}static destroy(t){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),Q.delete(t)}static delete(t){var s;(s=Z.get(t))==null||s.clear()}static clear(){for(let t of Z.values())t.destroy();Z.clear()}attachGroup(t){if(t===this)throw new Error("Cannot attach a group to itself");return i(this,U).add(t),i(t,V)&&i(t,V)!==this&&i(i(t,V),U).delete(t),g(t,V,this),t}detachGroup(t){return t!==this&&i(this,U).has(t)&&(i(this,U).delete(t),g(t,V,void 0)),t}attachSignal(t){let s=C(t);if(s!=null&&s.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return s&&i(this,he).add(s),t}attachSignalByName(t,s){if(s){this.attachSignal(s);let r=C(s);i(this,x).set(t,r),i(this,G).has(t)?i(this,G).get(t).push(r):i(this,G).set(t,[r]),i(this,K).has(r)?i(this,K).get(r).add(t):i(this,K).set(r,new Set([t]))}else i(this,x).delete(t);return s}hasSignal(t){var s;return i(this,x).has(t)||((s=i(this,V))==null?void 0:s.hasSignal(t))}signal(t){var s,r,a;return(a=(s=i(this,x).get(t))==null?void 0:s.object)!=null?a:(r=i(this,V))==null?void 0:r.signal(t)}detachSignal(t){let s=C(t);if(s&&(i(this,he).delete(s),i(this,K).has(s))){let r=i(this,K).get(s);for(let a of r)if(i(this,G).has(a)){let o=i(this,G).get(a);o.splice(o.indexOf(s),1),o.length===0?(i(this,x).delete(a),i(this,G).delete(a)):i(this,x).get(a)===s&&i(this,x).set(a,o.at(-1))}r.clear(),i(this,K).delete(s)}return t}attachEffect(t){return i(this,le).add(t),t}runEffects(){for(let t of i(this,le))t.run();for(let t of i(this,U))t.runEffects()}attachLink(t){if(t!=null&&t.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return t&&i(this,de).add(t),t}detachLink(t){return t&&i(this,de).delete(t),t}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){var t;m(this,xe,this),T(this);for(let s of i(this,U))s.destroy();for(let s of i(this,le))s.destroy();for(let s of i(this,he))X(s);for(let s of i(this,de))s.destroy();i(this,U).clear(),i(this,he).clear(),i(this,x).clear(),i(this,G).clear(),i(this,le).clear(),i(this,de).clear(),(t=i(this,V))==null||t.detachGroup(this),Z.delete(this)}},U=new WeakMap,he=new WeakMap,x=new WeakMap,K=new WeakMap,G=new WeakMap,le=new WeakMap,de=new WeakMap,V=new WeakMap,Q),es,ir=(es=ve,class{constructor(e){u(this,es);u(this,"run",()=>{var e;return(e=this[ve])==null?void 0:e.run()});u(this,"destroy",()=>{var e;(e=this[ve])==null||e.destroy(),this[ve]=void 0});this[ve]=e,k(e,ws.Destroy,()=>{this[ve]=void 0})}}),Ge,$e,ts,bs=(ts=class{constructor(e="id",t=1){f(this,Ge);f(this,$e);g(this,Ge,e),g(this,$e,t)}make(){return Symbol(`${i(this,Ge)}${Rt(this,$e)._++}`)}},Ge=new WeakMap,$e=new WeakMap,ts),mt=[],ms=()=>mt.at(-1),ar=(e,t)=>{mt.push(e);try{return t()}finally{mt.pop()}},nr=e=>e!=null&&typeof e.then=="function",A,_,ee,ue,ce,Ce,ws=(A=class{constructor(t,s){u(this,"id");u(this,"callback");f(this,_);f(this,ee,new Set);f(this,ue,new Set);u(this,"parentEffect");u(this,"childEffects",[]);u(this,"curChildEffectSlot",0);u(this,"autorun",!0);u(this,"shouldRun",!0);f(this,ce);f(this,Ce,!1);u(this,"run",()=>{if(i(this,Ce)||!this.shouldRun)return;let t=tr();t?t.batch(this.id):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,this.hasStaticDeps()?g(this,_,this.callback()):g(this,_,ar(this,this.callback)))});u(this,"destroy",()=>{i(this,Ce)||(m(this,A.Destroy,this),T(this),m(me,rr,this),this.runCleanupCallback(),T(Ne,this),T(me,this),T(Pe,this),g(this,Ce,!0),i(this,ee).clear(),i(this,ue).clear(),this.childEffects.forEach(t=>{t.destroy()}),this.childEffects.length=0,--A.count)});var a;re(this),this.callback=t;let r;(s==null?void 0:s.attach)!=null&&(r=qe.findOrCreate(s.attach),r.attachEffect(this)),this.autorun=(a=s==null?void 0:s.autorun)!=null?a:!0,g(this,ce,s!=null&&s.dependencies?s.dependencies.map(o=>{switch(typeof o){case"string":case"symbol":return r.signal(o);default:return o}}):void 0),this.id=A.idGen.make(),se(me,this.id,"recall",this),++A.count}hasStaticDeps(){return i(this,ce)!=null&&i(this,ce).length>0}saveSignalsFromDeps(){for(let t of i(this,ce))this.whenSignalIsRead(C(t).id)}static createEffect(t,s,r){let a=Array.isArray(s)?s:void 0,o=a?r!=null?r:{dependencies:a}:s;o&&a&&(o.dependencies=a);let n,h=ms();return h!=null?(n=h.getCurrentChildEffect(),n==null&&(n=new A(t,o),h.attachChildEffect(n),m(me,Bt,n)),h.curChildEffectSlot++):(n=new A(t,o),m(me,Bt,n)),n.hasStaticDeps()?n.saveSignalsFromDeps():n.autorun&&n.run(),new ir(n)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(t){this.childEffects.push(t),this.parentEffect=this}recall(){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(t){i(this,ee).has(t)||(i(this,ee).add(t),se(Ne,t,"recall",this),k(Pe,t,$t,this))}[$t](t){!i(this,ue).has(t)&&i(this,ee).has(t)&&(i(this,ue).add(t),T(Ne,t,this),i(this,ue).size===i(this,ee).size&&this.destroy())}runCleanupCallback(){if(i(this,_)!=null){let t=i(this,_);g(this,_,void 0),nr(t)?Promise.resolve(t).then(s=>{typeof s=="function"&&s()}):t()}}},_=new WeakMap,ee=new WeakMap,ue=new WeakMap,ce=new WeakMap,Ce=new WeakMap,u(A,"idGen",new bs("ef")),u(A,"Destroy","destroy"),u(A,"count",0),A),Je=(...e)=>ws.createEffect(...e),ze=new WeakMap,or=e=>{let t=ze.get(e);return t||(t={},ze.set(e,t)),t},Ie=(e,t)=>{var s,r;return(r=(s=ze.get(e))==null?void 0:s.signals)==null?void 0:r.get(t)},hr=(e,t,s)=>{var a;let r=or(e);(a=r.signals)!=null||(r.signals=new Map),r.signals.set(t,s)};function lr(...e){for(let t of e)if(ze.has(t)){let s=ze.get(t);if(s.signals){for(let r of s.signals.values())X(r);s.signals.clear(),s.signals=void 0}}}function dr(e){let t=C(jt(e)?e:Ie(...e));t!=null&&!t.muted&&!t.destroyed&&wt(t.id,t.value,{touch:!0})}function Pt(e){var t,s;return jt(e)?(t=C(e))==null?void 0:t.value:(s=C(Ie(...e)))==null?void 0:s.value}var ss,ur=(ss=W,class{constructor(e){u(this,ss);this[W]=e}get get(){return this[W].reader}get set(){return this[W].writer}get value(){return Pt(this.get)}set value(e){this.set(e)}onChange(e){let{destroy:t}=Je(()=>e(this.value),[this.get]);return t}get muted(){return this[W].muted}set muted(e){this[W].muted=e}touch(){dr(this)}destroy(){X(this)}}),cr=new bs("si");function Jt(e){var t;vs()||((t=ms())==null||t.whenSignalIsRead(e))}function wt(e,t,s){vs()||m(Ne,e,t,s)}var jt=e=>e!=null&&e[W]!=null,fr=e=>{let t=s=>{var r;return s?Je(()=>(e.destroyed||Jt(e.id),s(e.value)),[t]):e.destroyed||((r=e.beforeRead)==null||r.call(e),Jt(e.id)),e.value};return Object.defineProperty(t,W,{value:e}),t},fe,F,Cs=(fe=class{constructor(t,s){u(this,"id");u(this,"lazy");u(this,"compare");u(this,"beforeRead");u(this,"muted",!1);u(this,"destroyed",!1);f(this,F);u(this,"valueFn");u(this,"reader");u(this,"writer",(t,s)=>{var o,n,h,l;let r=(o=s==null?void 0:s.lazy)!=null?o:!1,a=(h=(n=s==null?void 0:s.compare)!=null?n:this.compare)!=null?h:(d,p)=>d===p;if((r!==this.lazy||r&&t!==this.valueFn||!r&&!a(t,i(this,F)))&&(r?(g(this,F,void 0),this.valueFn=t,this.lazy=!0):(g(this,F,t),this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){wt(this.id,i(this,F));return}(l=s==null?void 0:s.touch)!=null&&l&&wt(this.id,i(this,F),{touch:!0})});u(this,"object");this.id=cr.make(),++fe.instanceCount,this.lazy=t,this.lazy?(this.value=void 0,this.valueFn=s):(this.value=s,this.valueFn=void 0),this.reader=fr(this),this.object=new ur(this)}get[W](){return this}get value(){return this.lazy&&(g(this,F,this.valueFn()),this.valueFn=void 0,this.lazy=!1),i(this,F)}set value(t){g(this,F,t)}},F=new WeakMap,u(fe,"instanceCount",0),fe),C=e=>e==null?void 0:e[W];function I(e=void 0,t){var r;let s;if(jt(e))s=C(e);else{let a=(r=t==null?void 0:t.lazy)!=null?r:!1;s=new Cs(a,e),s.beforeRead=t==null?void 0:t.beforeRead,s.compare=t==null?void 0:t.compare}return(t==null?void 0:t.attach)!=null&&qe.findOrCreate(t.attach).attachSignal(s),s.object}var X=(...e)=>{for(let t of e){let s=C(t);s!=null&&!s.destroyed&&(s.destroyed=!0,s.beforeRead=void 0,--Cs.instanceCount,m(Pe,s.id,s.id))}};function gr(e,t){let s=I(),r=(t==null?void 0:t.attach)!=null?qe.findOrCreate(t.attach):void 0;r!=null&&(t!=null&&t.name?r.attachSignalByName(t.name,s):r.attachSignal(s));let a=Je(()=>s.set(e()),{autorun:!1,attach:r}),o=C(s);return o.beforeRead=a.run,k(Pe,o.id,a.destroy),s.get}var S,Ee,rs,Es=(rs=class{constructor(e){f(this,S,!1);f(this,Ee);u(this,"source");u(this,"lastValue");u(this,"isDestroyed",!1);re(this),this.source=C(e),g(this,Ee,se(Ne,this.source.id,(t,s)=>{!i(this,S)&&!this.isDestroyed&&((s==null?void 0:s.touch)===!0?this.touch():this.write())})),k(Pe,this.source.id,()=>this.destroy())}attach(e){let t=qe.findOrCreate(e);return t.attachLink(this),k(this,xe,()=>{t.detachLink(this)}),t}nextValue(){return new Promise((e,t)=>{let s=[],r=()=>s.forEach(a=>{a()});s.push(k(this,De,a=>{r(),e(a)}),k(this,xe,()=>{r(),t()}))})}asyncValues(e){return Nt(this,null,function*(){let t=0;for(;!this.isDestroyed;)try{let s=yield new ot(this.nextValue());if(e&&e(s,t++))break;Ot(this,De),yield s}catch(s){break}st(this,De)})}destroy(){var e;this.isDestroyed||((e=i(this,Ee))==null||e.call(this),g(this,Ee,void 0),m(this,xe,this),st(this,De),T(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return i(this,S)}mute(){return!this.isDestroyed&&!i(this,S)&&(g(this,S,!0),m(this,Wt,this)),this}unmute(){return!this.isDestroyed&&i(this,S)&&(g(this,S,!1),m(this,qt,this)),this}toggle(){return this.isDestroyed||(g(this,S,!i(this,S)),m(this,i(this,S)?Wt:qt,this)),i(this,S)}updateValue(e){if(!i(this,S)&&!this.isDestroyed){let{value:t}=this.source;e(t),m(this,De,t),this.lastValue=t}}},S=new WeakMap,Ee=new WeakMap,rs),yr=class extends Es{constructor(t,s){super(t);u(this,"target");this.target=C(s),k(Pe,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(t=>{this.target.writer(t,{touch:!0})}),this}write(){this.updateValue(t=>{this.target.writer(t)})}},pr=class extends Es{constructor(t,s){super(t);u(this,"target");this.target=s,this.touch()}touch(){return this.updateValue(t=>{this.target(t)}),this}write(){this.updateValue(t=>{this.target(t)})}},Ze=new Map;function Xe(e,t,s){var d;let r=C(e),a;if(Ze.has(r)){a=Ze.get(r);let p=(d=C(t))!=null?d:t;if(a.has(p))return a.get(p)}else a=new Map,Ze.set(r,a);let o=C(t),n=o!=null?new yr(e,o):new pr(e,t),h=s==null?void 0:s.attach;h&&n.attach(h);let l=o!=null?o:t;return a.set(l,n),k(n,xe,()=>{a.delete(l),a.size===0&&Ze.delete(r)}),n}var O,Se,vr=(Se=class{constructor(){f(this,O,new Map)}static fromProps(t,s){let r=new Se,a=s?s.map(o=>[o,t[o]]):Object.entries(t);for(let[o,n]of a)i(r,O).set(o,I(n));return r}keys(){return i(this,O).keys()}signals(){return i(this,O).values()}entries(){return i(this,O).entries()}clear(){for(let t of i(this,O).values())t.destroy();i(this,O).clear()}has(t){return i(this,O).has(t)}get(t){if(!i(this,O).has(t)){let s=I();return i(this,O).set(t,s),s}return i(this,O).get(t)}update(t){t.size&&rt(()=>{for(let[s,r]of t.entries())this.get(s).set(r)})}updateFromProps(t,s){rt(()=>{let r=s?s.map(a=>[a,t[a]]):Object.entries(t);for(let[a,o]of r)this.get(a).set(o)})}},O=new WeakMap,Se);function br(e,t,s,r,a,o){function n(Me){if(Me!==void 0&&typeof Me!="function")throw new TypeError("Function expected");return Me}for(var h=r.kind,l=h==="getter"?"get":h==="setter"?"set":"value",d=!t&&e?r.static?e:e.prototype:null,p=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),c,v=!1,E=s.length-1;E>=0;E--){var Ke={};for(var pe in r)Ke[pe]=pe==="access"?{}:r[pe];for(var pe in r.access)Ke.access[pe]=r.access[pe];Ke.addInitializer=function(Me){if(v)throw new TypeError("Cannot add initializers after decoration has completed");o.push(n(Me||null))};var ne=(0,s[E])(h==="accessor"?{get:p.get,set:p.set}:p[l],Ke);if(h==="accessor"){if(ne===void 0)continue;if(ne===null||typeof ne!="object")throw new TypeError("Object expected");(c=n(ne.get))&&(p.get=c),(c=n(ne.set))&&(p.set=c),(c=n(ne.init))&&a.unshift(c)}else(c=n(ne))&&(h==="field"?a.unshift(c):p[l]=c)}d&&Object.defineProperty(d,r.name,p),v=!0}function Kt(e,t,s){for(var r=arguments.length>2,a=0;a<t.length;a++)s=r?t[a].call(e,s):t[a].call(e);return r?s:void 0}function mr(e){return function(t,s){var o;let r=(e==null?void 0:e.name)||s.name,a=!!((o=e==null?void 0:e.readAsValue)!=null&&o);return{get(){let n=Ie(this,r);if(n)return a?n.value:n.get()},set(n){var h;(h=Ie(this,r))==null||h.set(n)},init(n){let h=I(n,e);return hr(this,r,h),qe.findOrCreate(this).attachSignalByName(r,h),h.value}}}}var be="value",Yt=(()=>{var r,a,o,n,Ct,Et,d;let e,t=[],s=[];return d=class{constructor(c){f(this,n);f(this,r);f(this,a);f(this,o);g(this,r,[]),g(this,o,Kt(this,t,void 0)),this.value$=Kt(this,s),Ot(this,be),this.value$=Ie(this,be),this.value$.onChange(v=>m(this,be,v)),c&&this.add(...c)}get value(){return i(this,o)}set value(c){g(this,o,c)}add(...c){for(let v of c)i(this,r).push(v);b(this,n,Et).call(this)}pop(){i(this,r).pop(),b(this,n,Et).call(this)}clear(){i(this,r).length=0,b(this,n,Ct).call(this)}dispose(){this.clear(),st(this,be),T(this),lr(this),this.value$.destroy()}},r=new WeakMap,a=new WeakMap,o=new WeakMap,n=new WeakSet,Ct=function(){var c;(c=i(this,a))==null||c.destroy(),g(this,a,void 0)},Et=function(){b(this,n,Ct).call(this),g(this,a,Je(()=>{for(let c of i(this,r)){let v=Pt(c);if(v!=null){this.value=v;return}}this.value=void 0},i(this,r))),i(this,a).run()},(()=>{let c=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[mr({name:be})],br(d,null,e,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:v=>"value"in v,get:v=>v.value,set:(v,E)=>{v.value=E}},metadata:c},t,s),c&&Object.defineProperty(d,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:c})})(),d.Value=be,d})(),Ht="onCreate",we="onDestroy",wr="onParentChanged",Cr="onViewEvent",ct=new Map,ft=!1,Er=(e,t)=>{ct.set(e,t),ft||(ft=!0,queueMicrotask(()=>{ft=!1;let s=Array.from(ct.entries());ct.clear();for(let[r,a]of s)r.set(a)}))},te,Ae,ge,z,L,P,Y,R,ke,D,St,_e,et,is,Sr=(is=class{constructor(e,t){f(this,D);f(this,te);f(this,Ae);f(this,ge,new vr);f(this,z,new Map);f(this,L);f(this,P);f(this,Y,new Set);f(this,R,[]);f(this,ke,0);g(this,te,e),g(this,Ae,t),k(this,we,fs.Min,this)}get kernel(){return i(this,te)}get uuid(){return i(this,Ae)}get order(){return i(this,ke)}set order(e){i(this,ke)!==e&&(g(this,ke,e),i(this,L)&&this.parent.resortChildren())}get parentUuid(){return i(this,L)||void 0}set parentUuid(e){i(this,L)!==e&&(this.removeFromParent(),g(this,L,e||void 0),g(this,P,e?i(this,te).getEntity(e):void 0),i(this,P)&&i(this,P).addChild(this))}get parent(){return!i(this,P)&&i(this,L)&&g(this,P,i(this,te).getEntity(i(this,L))),i(this,P)}set parent(e){this.parentUuid=e==null?void 0:e.uuid}get hasParent(){return!!i(this,L)}get children(){return i(this,R)}traverse(e){e(this);for(let t of i(this,R))t.traverse(e)}onDestroy(){var e;i(this,ge).clear(),T(this);for(let t of i(this,z).values())t.unsubscribePathValue(),(e=t.unsubscribeParent)==null||e.call(t),t.valuePath.dispose(),t.inherited.destroy(),t.provide.destroy(),t.context.destroy();g(this,L,void 0),g(this,P,void 0),i(this,Y).clear(),i(this,R).length=0}addChild(e){var t;if(i(this,R).length===0){i(this,Y).add(e.uuid),i(this,R).push(e);return}if(i(this,Y).has(e.uuid))throw new Error(`child with uuid: ${e.uuid} already exists! parentUuid: ${this.uuid}`);i(this,Y).add(e.uuid),i(this,R).push(e),this.resortChildren();for(let[,s]of i(e,z))b(t=e,D,et).call(t,s)}resortChildren(){i(this,R).sort((e,t)=>e.order-t.order)}removeChild(e){i(this,Y).has(e.uuid)&&(i(this,Y).delete(e.uuid),i(this,R).splice(i(this,R).indexOf(e),1))}removeFromParent(){if(i(this,P)){i(this,P).removeChild(this),g(this,P,void 0),g(this,L,void 0);for(let[,e]of i(this,z))e.unsubscribeParent&&(e.unsubscribeParent(),e.unsubscribeParent=void 0)}}reSubscribeToParentContexts(){for(let[,e]of i(this,z))b(this,D,et).call(this,e)}dispatchMessageToView(e,t,s,r=!1){i(this,te).dispatchMessageToView({uuid:i(this,Ae),type:e,data:t,transferables:s,traverseChildren:r})}dispatchViewEvents(e){for(let{type:t,data:s}of e)m(this,Cr,t,s)}dispatchViewEvent(e,t){this.dispatchViewEvents([{type:e,data:t}])}getPropertyReader(e){return b(this,D,St).call(this,e).get}getPropertyWriter(e){return b(this,D,St).call(this,e).set}setProperties(e){rt(()=>{for(let[t,s]of e)this.setProperty(t,s)})}setProperty(e,t){this.getPropertyWriter(e)(t)}getProperty(e){return Pt(this.getPropertyReader(e))}propKeys(){return Array.from(i(this,ge).keys())}propEntries(){return Array.from(i(this,ge).entries()).map(([e,t])=>[e,t.value])}hasContext(e){return i(this,z).has(e)}useContext(e){return b(this,D,_e).call(this,e).context.get}provideContext(e){return b(this,D,_e).call(this,e).provide}},te=new WeakMap,Ae=new WeakMap,ge=new WeakMap,z=new WeakMap,L=new WeakMap,P=new WeakMap,Y=new WeakMap,R=new WeakMap,ke=new WeakMap,D=new WeakSet,St=function(e){return i(this,ge).get(e)},_e=function(e){if(i(this,z).has(e))return i(this,z).get(e);let t=I(),s=I(),r=I(),a=new Yt([s,t]),o=se(a,Yt.Value,h=>{Er(r,h)}),n={name:e,inherited:t,provide:s,context:r,valuePath:a,unsubscribePathValue:o};return i(this,z).set(e,n),b(this,D,et).call(this,n),n},et=function(e){var t,s;if((t=e.unsubscribeParent)==null||t.call(e),e.unsubscribeParent=void 0,this.parent){let r=b(s=this.parent,D,_e).call(s,e.name),a=Xe(r.context,e.inherited);e.unsubscribeParent=()=>{a.destroy()}}else e.inherited.set(void 0)},is);function Ar(e,t){e.indexOf(t)===-1&&e.push(t)}var H,j,as,Ss=(as=class{constructor(){f(this,H,new Map);f(this,j,new Map)}static get(e){return e!=null?e:kr}define(e,t){i(this,H).has(e)?Ar(i(this,H).get(e).constructors,t):i(this,H).set(e,{token:e,constructors:[t]})}appendRoute(e,t){if(i(this,j).has(e)){let s=i(this,j).get(e);for(let r of t)s.add(r)}else i(this,j).set(e,new Set(t))}clearRoute(e){i(this,j).delete(e)}findTokensByRoute(e){let t=new Set([e]),s=i(this,j).has(e)?[...i(this,j).get(e)]:[];for(;s.length;){let r=s.shift();t.has(r)||(t.add(r),i(this,j).has(r)&&s.push(...Array.from(i(this,j).get(r)).filter(a=>!t.has(a))))}return Array.from(t)}findConstructors(e){let t=this.findTokensByRoute(e),s=new Set;for(let r of t){let a=i(this,H).get(r);if(a)for(let o of a.constructors)s.add(o)}return s.size>0?Array.from(s):void 0}hasToken(e){return i(this,H).has(e)}hasRoute(e){return i(this,j).has(e)}clear(){i(this,H).clear(),i(this,j).clear()}},H=new WeakMap,j=new WeakMap,as),kr=new Ss,J;(function(e){e[e.CreateAndDestroy=0]="CreateAndDestroy",e[e.JustCreate=1]="JustCreate",e[e.DestroyOnly=2]="DestroyOnly"})(J||(J={}));var Qt=e=>e.displayName||e.name,w,$,Oe,Be,B,ns,Or=(ns=class{constructor(e){f(this,w);f(this,$);f(this,Oe);f(this,Be);f(this,B);this.logger=new Vs("Kernel"),g(this,w,new Map),g(this,$,new Set),g(this,B,!0),re(this),this.registry=Ss.get(e)}getEntity(e){var s;let t=(s=i(this,w).get(e))==null?void 0:s.entity;if(!t)throw new Error(`entity with uuid "${e}" not found!`);return t}hasEntity(e){return i(this,w).has(e)}traverseLevelOrderBFS(e=!1){if(i(this,B)){let t=new Map,s=(r,a)=>{let o=this.getEntity(r);t.has(a)?t.get(a).push(o):t.set(a,[o]);for(let n of o.children)s(n.uuid,a+1)};i(this,$).forEach(r=>s(r,0)),g(this,Oe,Array.from(t.entries()).sort((r,a)=>r[0]-a[0]).map(([,r])=>r).flat()),g(this,Be,i(this,Oe).slice().reverse()),g(this,B,!1)}return e?i(this,Be):i(this,Oe)}getEntityGraph(){return Array.from(i(this,$)).map(e=>this.getEntityGraphNode(e))}getEntityGraphNode(e){if(!i(this,w).has(e))return;let{token:t,entity:s}=i(this,w).get(e);return{token:t,entity:s,props:Object.fromEntries(s.propEntries()),children:s.children.map(r=>this.getEntityGraphNode(r.uuid))}}upgradeEntities(){for(let e of this.traverseLevelOrderBFS(!0))this.updateShadowObjects(e.uuid,J.DestroyOnly);for(let e of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(e.uuid,J.JustCreate)}run(e){rt(()=>{for(let t of e.changeTrail)this.parse(t)})}parse(e){switch(e.type){case q.CreateEntities:this.createEntity(e.uuid,e.token,e.parentUuid,e.order,e.properties),g(this,B,!0);break;case q.DestroyEntities:this.destroyEntity(e.uuid),g(this,B,!0);break;case q.SetParent:this.setParent(e.uuid,e.parentUuid,e.order),g(this,B,!0);break;case q.UpdateOrder:this.updateOrder(e.uuid,e.order),g(this,B,!0);break;case q.ChangeProperties:this.changeProperties(e.uuid,e.properties);break;case q.ChangeToken:this.changeToken(e.uuid,e.token);break;case q.SendEvents:this.dispatchEventsToEntity(e.uuid,e.events);break}}createEntity(e,t,s,r=0,a){let o=new Sr(this,e);o.order=r;let n={token:t,entity:o,usedConstructors:new Map};i(this,w).set(e,n),s&&(o.parentUuid=s),o.hasParent||i(this,$).add(e),a&&o.setProperties(a),this.createShadowObjects(e)}destroyEntity(e){if(!i(this,w).has(e))return;let{entity:t,usedConstructors:s}=i(this,w).get(e);t.removeFromParent(),m(t,we,this),s.clear(),i(this,w).delete(t.uuid),i(this,$).delete(t.uuid)}setParent(e,t,s=0){let r=this.getEntity(e);r.parentUuid===t&&r.order===s||(r.removeFromParent(),r.order=s,r.parentUuid=t,r.hasParent?i(this,$).delete(e):i(this,$).add(e),r.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:e,parentUuid:t,order:s,entity:r}),m(r,wr,r)}))}updateOrder(e,t){this.getEntity(e).order=t}dispatchEventsToEntity(e,t){var s;(s=this.getEntity(e))==null||s.dispatchViewEvents(t)}changeProperties(e,t){this.getEntity(e).setProperties(t)}changeToken(e,t){if(!i(this,w).has(e))return;let s=i(this,w).get(e);s.token!==t&&(s.token=t,this.updateShadowObjects(e))}dispatchMessageToView(e){queueMicrotask(()=>{m(this,yt,e)})}updateShadowObjects(e,t=J.CreateAndDestroy){let s=i(this,w).get(e),r=new Set(this.registry.findConstructors(s.token)),a=t===J.CreateAndDestroy||t===J.DestroyOnly,o=t===J.CreateAndDestroy||t===J.JustCreate;if(a){for(let[n,h]of s.usedConstructors)if(!r.has(n)){s.usedConstructors.delete(n);for(let l of h)this.destroyShadowObject(l,s.entity)}}if(o)for(let n of r)s.usedConstructors.has(n)||this.constructShadowObject(n,s)}constructShadowObject(e,t){let s=new Set,r=new Set,a=new Map,o=new Map,n=new Map,h=re(new e({entity:t.entity,provideContext(l,d,p){let c=o.get(l);if(c===void 0){c=I(d,p?{compare:p}:void 0),o.set(l,c);let v=Xe(c,t.entity.provideContext(l));r.add(v.destroy.bind(v))}return c},useContext(l,d){let p=a.get(l);if(p===void 0){p=I(void 0,d?{compare:d}:void 0).get,a.set(l,p);let c=Xe(t.entity.useContext(l),p);r.add(c.destroy.bind(c))}return p},useProperty(l,d){let p=n.get(l);if(p===void 0){p=I(void 0,d?{compare:d}:void 0).get,n.set(l,p);let c=Xe(t.entity.getPropertyReader(l),p);r.add(c.destroy.bind(c))}return p},createEffect(...l){let d=Je(...l);return r.add(d.destroy),d},createSignal(...l){let d=I(...l);return r.add(()=>{X(d)}),d},createMemo(...l){let d=gr(...l);return r.add(()=>{X(d)}),d},on(...l){let d=se(...l);return r.add(d),d},once(...l){let d=k(...l);return r.add(d),d},onDestroy(l){s.add(l)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",Qt(e),{shadowObject:h,entity:t.entity}),k(h,we,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",Qt(e),{shadowObject:h,entity:t.entity});for(let d of s)d();for(let d of r)d();for(let d of a.values())X(d);for(let d of n.values())X(d);for(let d of o.values())X(d);s.clear(),r.clear(),a.clear(),n.clear(),o.clear();let l=t.usedConstructors.get(e);l&&(l.delete(h),l.size===0&&t.usedConstructors.delete(e))}),t.usedConstructors.has(e)?t.usedConstructors.get(e).add(h):t.usedConstructors.set(e,new Set([h])),this.attachShadowObject(h,t.entity),h}createShadowObjects(e){var s;let t=i(this,w).get(e);(s=this.registry.findConstructors(t.token))==null||s.forEach(r=>{this.constructShadowObject(r,t)})}findShadowObjects(e){if(!i(this,w).has(e))return[];let{usedConstructors:t}=i(this,w).get(e);return Array.from(new Set(Array.from(t.values()).map(s=>Array.from(s)).flat()))}attachShadowObject(e,t){se(t,e),typeof e[Ht]=="function"&&e[Ht](t)}destroyShadowObject(e,t){typeof e[we]=="function"&&e[we](t),m(e,we,t),T(t,e)}destroy(){for(let e of this.traverseLevelOrderBFS().reverse())this.destroyEntity(e.uuid)}},w=new WeakMap,$=new WeakMap,Oe=new WeakMap,Be=new WeakMap,B=new WeakMap,ns);async function As(e,t,s,r=!0){var o,n;if(s.has(t)){console.warn("importModule: skipping already imported module",t);return}else s.add(t);t.extends&&await Promise.all(t.extends.map(h=>As(e,h,s,!1)));let{registry:a}=e;if(t.define)for(let[h,l]of Object.entries(t.define))a.define(h,l);if(t.routes)for(let[h,l]of Object.entries(t.routes))a.appendRoute(h,l);await((n=(o=t.initialize)==null?void 0:o.call(t,{define:(h,l)=>a.define(h,l),kernel:e,registry:a}))!=null?n:Promise.resolve()),r&&e.upgradeEntities()}var Pr=e=>(typeof e=="string"&&(e=new URL(e,globalThis.location.href)),e.toString()),We,ie,ks,Os,Ps,os,jr=(os=class{constructor(e){f(this,ie);f(this,We,new Set);var t,s;this.kernel=(t=e==null?void 0:e.kernel)!=null?t:new Or,this.postMessage=(s=e==null?void 0:e.postMessage)!=null?s:self.postMessage.bind(self),se(this.kernel,yt,"onMessageToView",this)}route(e){var t;switch(e.data.type){case Ts:b(this,ie,ks).call(this,e.data);break;case Ds:b(this,ie,Os).call(this,e.data);break;case Ls:b(this,ie,Ps).call(this,e.data);break;default:console.warn("[MessageRouter] unknown message",(t=e.data.type)!=null?t:e.data)}}onMessageToView(e){let r=e,{transferables:t}=r,s=Lt(r,["transferables"]);this.postMessage({type:yt,data:s},{transfer:t})}},We=new WeakMap,ie=new WeakSet,ks=async function(e){try{let t=await import(Pr(e.importModule));t[lt]?(await As(this.kernel,t[lt],i(this,We)),this.postMessage({type:ht,url:e.importModule})):this.postMessage({type:ht,url:e.importModule,error:`module has no "${lt}" export`})}catch(t){console.error("[MessageRouter] failed to import module",t),this.postMessage({type:ht,url:e.importModule,error:`${t}`})}},Os=function(e){try{this.kernel.run(e)}catch(t){console.error("[MessageRouter] failed to apply change trail",t),this.postMessage({type:Vt,serial:e.serial,error:t.toString()})}e.serial&&this.postMessage({type:Vt,serial:e.serial})},Ps=function(e){console.debug("[MessageRouter] on destroy",e),T(this.kernel,this),i(this,We).clear(),this.postMessage({type:Ns})},os),Mr=class{constructor(){this.onmessage=e=>{var t;e.data.type===N?globalThis[M]=e.data.config:((t=this.router)!=null||(this.router=new jr),this.router.route(e))}}start(){self.addEventListener("message",this.onmessage),self.postMessage({type:Rs})}};console.debug("@spearwolf/shadow-objects/WorkerRuntime: hello!");var Tr=new Mr;Tr.start();\n/*! Bundled license information:\n\n@spearwolf/eventize/lib/index.mjs:\n (*!\n =============================================================================\n @spearwolf/eventize 4.0.1+build.20240804\n \u2014 https://github.com/spearwolf/eventize.git\n =============================================================================\n \n Copyright 2015-2024 Wolfger Schramm\n \n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n *)\n*/\n')}var js=()=>new Bt;var Le=(s,e,t=1e3,r)=>new Promise((i,n)=>{let o,l,a=()=>{clearTimeout(o),s.removeEventListener("message",l)};t!==0&&t!==1/0&&(o=setTimeout(()=>{a(),n(new Error(`Timeout waiting for message of type: ${e}`))},t)),l=h=>{if(h.data.type===e)try{(!r||r(h.data))&&(a(),i())}catch(u){a(),n(u.toString())}},s.addEventListener("message",l)});var lr=s=>{let e;if(s!=null&&Array.isArray(s))for(let t of s)t.transferables&&(e?e=[...e,...t.transferables]:e=t.transferables,delete t.transferables);return e},gt=class s{static{this.WorkerLoaded="workerLoaded"}#e;#t;#s;get isDestroyed(){return this.#t}get workerLoaded(){return le(this,s.WorkerLoaded)}constructor(){this.#t=!1,this.#s=0,this.logger=new x("RemoteWorkerEnv"),$(this,s.WorkerLoaded)}async start(){if(this.#e)return this.logger.isWarn&&this.logger.warn("already started"),this.workerLoaded.then(()=>{if(this.isDestroyed)throw"worker was destroyed"});let e=this.#e=js();this.configureConsoleLogger(e);try{if(await Le(e,fs,ys),this.isDestroyed)throw"worker was destroyed";e.addEventListener("message",this.onMessageFromWorker.bind(this)),queueMicrotask(()=>{c(this,s.WorkerLoaded,this)})}catch(t){throw this.logger.error("failed to start",t),this.#e=void 0,t}}applyChangeTrail(e,t){let r=lr(e),i={type:us,changeTrail:e},n=++this.#s;return t&&(i.serial=n),this.#e.postMessage(i,r),t?Le(this.#e,ds,bs,o=>{if(o.error)throw o.error;return o.serial===n}):Promise.resolve()}importScript(e){return e=dt(e),this.#e.postMessage({type:ls,importModule:e}),Le(this.#e,ps,ms,t=>{if(t.error)throw t.error;return t.url===e})}destroy(){if(!this.#e)return;let e=this.#e;this.#e=void 0,this.#t=!0,e.postMessage({type:cs}),Le(e,gs,vs).finally(()=>{e.terminate()})}onMessageFromWorker(e){e.data?.type===pe?this.onMessageToView?.(e.data.data):this.logger.isDebug&&this.logger.debug("message from worker",e)}configureConsoleLogger(e){let t=`${R}.RemoteWorkerEnv.workerConfig`,r=JSON.parse(localStorage.getItem(t)??"{}");this.logger.isInfo&&this.logger.info("load console-logger worker config",{localStorageKey:t,workerConfig:r}),e.postMessage({type:R,config:{...x.sharedConfig,enable:this.logger.isEnabled,...r,...x.isEnabled?{}:{enable:!1}}})}};var _e,je=class extends J{static{this.observedAttributes=[...J.observedAttributes,tt,rt,st]}static{this.DefaultAutoSync="frame"}#e;#t;#s;#i;#r;constructor(){super(),this.isShaeWorkerElement=!0,this.shadowEnv=new j,this.logger=new x("ShaeWorkerElement"),this.autostart=!0,this.isConnected$=f(!1),this.autoSync$=f(_e.DefaultAutoSync),this.src$=f(""),this.#e=!1,this.#t=!1,this.ns$.onChange(e=>{this.shadowEnv.view=M.get(e)}),g(this.shadowEnv,j.ContextCreated,()=>{this.#r?.run(),this.dispatchEvent(new CustomEvent(j.ContextCreated.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),g(this.shadowEnv,j.ContextLost,()=>{this.dispatchEvent(new CustomEvent(j.ContextLost.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),this.autoSync$.onChange(e=>{let t=this.hasAttribute(N),r=t?this.getAttribute(N):void 0;e===_e.DefaultAutoSync?t&&r!==e&&this.setAttribute(N,e):r!==e&&this.setAttribute(N,e)}),this.#o(),this.#n()}#n(){this.#r=b(()=>{let e=this.src$.get();e&&this.importScript(e)},{autorun:!1})}get shouldAutostart(){return this.autostart&&!Re(this,Ts)}get autoSync(){return this.autoSync$.value}set autoSync(e){typeof e!="string"&&(e=e?_e.DefaultAutoSync:"no"),this.autoSync$.set(`${e}`.trim().toLowerCase())}get frameLoop(){return this.#s??=new ge,this.#s}[ge.OnFrame](){this.syncShadowObjects()}async importScript(e){if(!e)throw new Error("src is blank");let t=await this.shadowEnv.ready();return this.logger.isInfo&&this.logger.info("shadowEnv importScript:",e,{shadowEnv:t}),await t.envProxy.importScript(e),this}connectedCallback(){k(()=>{this.hasAttribute(N)&&this.autoSync$.set(this.getAttribute(N)),this.isConnected$.set(!0)}),this.shouldAutostart&&this.start()}disconnectedCallback(){this.isConnected$.set(!1),this.#a()}attributeChangedCallback(e){if(super.attributeChangedCallback(e),e===tt&&this.shadowEnv.envProxy!=null)throw new Error('Changing the "local" attribute after the shadowEnv has been created is not supported.');if(e===st&&this.#u(),e===N&&(this.autoSync=this.hasAttribute(N)?this.getAttribute(N):!0),e===rt){let t=(this.getAttribute(rt)||"").trim();this.src$.set(t),this.shadowEnv.isReady&&this.#r?.run()}}start(){if(!this.#t){if(this.#e=!1,this.shadowEnv.view??=M.get(this.ns),this.shadowEnv.envProxy==null){let e=Re(this,tt)?new pt:new gt;this.shadowEnv.envProxy=e,this.#u()}this.#t=!0}return this.shadowEnv.ready()}destroy(){this.#i?.destroy(),this.#r?.destroy(),S(this.isConnected$,this.autoSync$,this.src$),this.shadowEnv.envProxy=void 0,this.shadowEnv.destroy()}#a(){this.#e||(this.#e=!0,queueMicrotask(()=>{this.#e&&this.destroy()}))}#o(){this.#i=b(()=>{if(this.isConnected$.get()){let e=(this.autoSync$.get()||_e.DefaultAutoSync).trim().toLowerCase(),t;if(["true","yes","on","frame","auto-sync"].includes(e))return this.logger.isDebug&&this.logger.debug("auto-sync",e,this),this.frameLoop.start(this),()=>{this.frameLoop.stop(this)};if(e.toLowerCase().endsWith("fps")){let r=parseInt(e,10);r>0?t=Math.floor(1e3/r):this.logger.isWarn&&this.logger.warn(`invalid auto-sync value: ${e}`)}else t=parseInt(e,10),isNaN(t)&&(t=void 0,["false","no","off"].includes(e)||this.logger.error(`invalid auto-sync value: ${e}`));if(t!==void 0&&t>0){this.logger.isDebug&&this.logger.debug("auto-sync interval (ms)",t,this);let r=setInterval(()=>{this.syncShadowObjects()},t);return()=>{clearInterval(r)}}else this.logger.isDebug&&this.logger.debug("auto-sync off",this)}},[this.autoSync$,this.isConnected$])}#u(){let e=this.shadowEnv.envProxy;e?.isLocalEnv&&(e.disableStructuredClone=this.hasAttribute(st))}};_e=je;customElements.define(ks,je);globalThis.SHADOW_ENTS_BUNDLE_LOADED=!0;
|
|
21
|
+
var ee="*",Qt=1,vt=2,wt=4,D=Symbol.for("eventize"),Ns="[eventize]",$e=s=>s===ee,Yt=s=>{switch(typeof s){case"string":case"symbol":return!0;default:return!1}},Kt=typeof console<"u",Ds=Kt?console[console.warn?"warn":"log"].bind(console,Ns):()=>{},$s=(s,e,t)=>(Object.defineProperty(s,e,{value:t,configurable:!0}),s),Is=0,Jt=class{static publish(s){s.sort((e,t)=>e.order-t.order).forEach(e=>e.emit())}events=new Map;eventNames=new Set;add(s){Array.isArray(s)?s.forEach(e=>this.eventNames.add(e)):this.eventNames.add(s)}remove(s){Array.isArray(s)?s.forEach(e=>this.eventNames.delete(e)):this.eventNames.delete(s),this.clear(s)}clear(s){Array.isArray(s)?s.forEach(e=>this.events.delete(e)):this.events.delete(s)}retain(s,e){this.eventNames.has(s)&&this.events.set(s,{args:e,order:Is++})}isKnown(s){return this.eventNames.has(s)}emit(s,e,t=[]){if($e(s))this.eventNames.forEach(r=>this.emit(r,e,t));else if(this.events.has(s)){let{order:r,args:i}=this.events.get(s);t.push({order:r,emit:()=>e.apply(s,i)})}return t}},mt=(s,e,t,r)=>{if(typeof e=="function"){let i=e.apply(s,t);i!=null&&r?.(i)}},Ws=(s,e,t,r)=>mt(e,e.emit,[s].concat(t),r),Fs=s=>{switch(typeof s){case"function":return Qt;case"string":case"symbol":return vt;case"object":return wt}},Us=0,Vs=()=>++Us,Xt=class{id;eventName;isCatchEmAll;priority;listener;listenerObject;listenerType;callAfterApply;isRemoved;refCount;constructor(s,e,t,r=null){this.id=Vs(),this.eventName=s,this.isCatchEmAll=$e(s),this.listener=t,this.listenerObject=r,this.priority=e,this.listenerType=Fs(t),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(s,e=null){if(s===this)return!0;let t=typeof s;return t==="number"&&s===this.id?!0:e===null&&(t==="string"||t==="symbol")?s===ee||s===this.eventName:this.listener===s&&this.listenerObject===e}apply(s,e,t){if(this.isRemoved)return;let{listener:r,listenerObject:i}=this;switch(this.listenerType){case Qt:mt(i,r,e,t),this.callAfterApply&&this.callAfterApply();break;case vt:mt(i,i[r],e,t),this.callAfterApply&&this.callAfterApply();break;case wt:{let n=r[s];if(this.isCatchEmAll||this.eventName===s){if(typeof n=="function"){let o=n.apply(r,e);o!=null&&t?.(o)}else Ws(s,r,e,t);this.callAfterApply&&this.callAfterApply()}break}}}},zs=(s,e)=>s.priority!==e.priority?e.priority-s.priority:s.id-e.id,Gt=s=>s?.slice(0),qt=(s,e)=>{let t=s.indexOf(e);t>-1&&s.splice(t,1)},Bs=s=>s===wt||s===vt,bt=(s,e,t)=>{let r=s.findIndex(i=>i.isEqual(e,t));r>-1&&(s[r].isRemoved=!0,s.splice(r,1))},De=(s,e,t)=>{let r=[];for(let i of s)(e==null&&i.listenerObject===t||i.eventName===e&&i.listener===t)&&r.push(i);for(let i of r)bt(s,i,void 0)},yt=s=>{s&&(s.forEach(e=>{e.isRemoved=!0}),s.length=0)},Gs=(s,e)=>s.listenerType===e.listenerType?s.priority===e.priority&&s.eventName===e.eventName&&s.listenerObject===e.listenerObject&&s.listener===e.listener:!1,qs=(s,e)=>{if(Bs(s.listenerType))return e.find(t=>Gs(s,t))},Hs=(s,e)=>{let t=qs(s,e);return t?(t.refCount+=1,t):(e.push(s),e.sort(zs),s)},Qs=class{namedListeners;catchEmAllListeners;getListenersForEventName=s=>{let e=this.namedListeners.get(s);return e||(e=[],this.namedListeners.set(s,e)),e};constructor(){this.namedListeners=new Map,this.catchEmAllListeners=[]}add(s){return Hs(s,s.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(s.eventName))}remove(s,e,t=!1){e==null&&Array.isArray(s)?s.forEach(r=>this.remove(r,null,t)):s==null||e==null&&$e(s)?this.removeAllListeners():e==null&&Yt(s)?yt(this.namedListeners.get(s)):s instanceof Xt?s.isRemoved||(s.refCount-=1,s.refCount<1&&(s.isRemoved=!0,this.namedListeners.forEach(r=>qt(r,s)),qt(this.catchEmAllListeners,s))):t?$e(s)?De(this.catchEmAllListeners,ee,s):this.namedListeners.forEach(r=>De(r,s,e)):(this.namedListeners.forEach(r=>{bt(r,s,e),De(r,void 0,s)}),bt(this.catchEmAllListeners,s,e),De(this.catchEmAllListeners,void 0,s))}removeAllListeners(){this.namedListeners.forEach(s=>yt(s)),this.namedListeners.clear(),yt(this.catchEmAllListeners)}forEach(s,e){let t=Gt(this.catchEmAllListeners),r=Gt(this.namedListeners.get(s));if(s===ee||!r||r.length===0)t.forEach(e);else if(t.length===0)r.forEach(e);else{let i=r.length,n=t.length,o=0,l=0;for(;o<i||l<n;){if(o<i){let a=r[o];if(l>=n||a.priority>=t[l].priority){e(a),++o;continue}}l<n&&(e(t[l]),++l)}}}getSubscriptionCount(){let s=this.catchEmAllListeners.length;for(let e of this.namedListeners.values())s+=e.length;return s}},te=s=>!!(s&&s[D]);function ve(s){if(te(s))return s;let e=new Qs,t=new Jt;return $s(s,D,{keeper:t,store:e}),s}var se={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},Ys=(s,e,t,r,i,n,o)=>{let l=s.add(new Xt(t,r,i,n));return e.emit(t,l,o),l},Ks=(s,e,t,r)=>{let i=t.length,n=typeof t[0],o,l,a,h;if(i>=2&&i<=3&&n==="number"?(o=ee,[l,a,h]=t):i>=3&&i<=4&&typeof t[1]=="number"?[o,l,a,h]=t:(l=se.Default,n==="string"||n==="symbol"||Array.isArray(t[0])?[o,a,h]=t:(o=ee,[a,h]=t)),!a&&Kt)throw Ds("called with insufficient arguments!",t),"subscribeTo() called with insufficient arguments!";let u=d=>E=>Ys(s,e,E,d,a,h,r);return Array.isArray(o)?o.map(d=>Array.isArray(d)?u(d[1])(d[0]):u(l)(d)):u(l)(o)},Zt=(s,e,t)=>{let r=[],i=Ks(s,e,t,r);return Jt.publish(r),i},Ht=s=>e=>{e.callAfterApply=()=>{s?.()}},es=(s,e)=>Object.assign(()=>y(s,e),Array.isArray(e)?{listeners:e}:{listener:e}),ts=(s,e,t,r)=>{let{store:i,keeper:n}=s[D];Array.isArray(e)?e.forEach(o=>{i.forEach(o,l=>l.apply(o,t,r)),n.retain(o,t)}):e!==ee&&(i.forEach(e,o=>{o.apply(e,t,r)}),n.retain(e,t))},g=(s,...e)=>{let t=ve(s),{store:r,keeper:i}=t[D];return es(t,Zt(r,i,e))},v=(s,...e)=>{let t=ve(s),{store:r,keeper:i}=t[D],n=Zt(r,i,e),o=es(t,n),l=!1,a=()=>{l||(o(),l=!0)};return Array.isArray(n)?n.forEach(Ht(a)):Ht(a)(n),a},ue=(s,e)=>new Promise(t=>{v(s,e,t)}),y=(s,e,t)=>{if(!te(s))throw new Error("object is not eventized");let{store:r,keeper:i}=s[D],n=typeof e,o=t!=null&&(n==="string"||n==="symbol");r.remove(e,t,o),Array.isArray(e)?i.remove(e.filter(l=>typeof l=="string")):Yt(e)&&i.remove(e)},c=(s,e,...t)=>{if(!te(s))throw new Error("object is not eventized");ts(s,e,t)},Js=(s,e,...t)=>{if(!te(s))throw new Error("object is not eventized");let r=[];return ts(s,e,t,i=>{r.push(i)}),r=r.map(i=>Array.isArray(i)?Promise.all(i):Promise.resolve(i)),r.length>0?Promise.all(r):Promise.resolve()},$=(s,e)=>{let t=ve(s),{keeper:r}=t[D];r.add(e)},U=(s,e)=>{if(!te(s))throw new Error("object is not eventized");let{keeper:t}=s[D];t.clear(e)},w=(()=>{let s=(e={})=>ve(e);return s.inject=(e={})=>(e=ve(e),Object.assign(e,{on:(...t)=>g(e,...t),once:(...t)=>v(e,...t),onceAsync:t=>ue(e,t),off:(t,r)=>y(e,t,r),emit:(t,...r)=>c(e,t,...r),emitAsync:(t,...r)=>Js(e,t,...r),retain:t=>$(e,t),retainClear:t=>U(e,t)}),e),s.is=te,s})();var Et=s=>te(s)?s[D]?.store?.getSubscriptionCount()??0:0;var V=w(),L=w(),z=w();var re=class{static current;#e=new Set;batch(e){this.#e.add(e)}run(){c(z,Array.from(this.#e))}},ss=()=>re.current;function k(s){let e=re.current;e?e=void 0:e=re.current=new re;try{s()}finally{e&&(re.current=void 0,e.run())}}var Ct=0;function St(s){Ct++;try{s()}finally{Ct--}}function Ie(){return Ct>0}var T=Symbol.for("signal"),ie=Symbol.for("effect"),xt=Symbol.for("destroySignal"),kt=Symbol.for("createEffect"),rs=Symbol.for("destroyEffect"),ce="value",At="mute",Tt="unmute",B="destroy";var G=new Map,O=class s{#e=new Set;#t=new Set;#s=new Map;#i=new WeakMap;#r=new Map;#n=new Set;#a=new Set;#o;static get(e){if(e!=null)return e instanceof s?e:G.get(e)}static findOrCreate(e){if(e==null)throw new Error("Cannot create a group with a null object");return new s(e)}static destroy(e){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),s.delete(e)}static delete(e){G.get(e)?.clear()}static clear(){for(let e of G.values())e.destroy();G.clear()}constructor(e){if(e!=null&&e instanceof s)return e;if(e??=this,G.has(e))return G.get(e);G.set(e,this),w(this)}attachGroup(e){if(e===this)throw new Error("Cannot attach a group to itself");return this.#e.add(e),e.#o&&e.#o!==this&&e.#o.#e.delete(e),e.#o=this,e}detachGroup(e){return e!==this&&this.#e.has(e)&&(this.#e.delete(e),e.#o=void 0),e}attachSignal(e){let t=m(e);if(t?.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return t&&this.#t.add(t),e}attachSignalByName(e,t){if(t){this.attachSignal(t);let r=m(t);this.#s.set(e,r),this.#r.has(e)?this.#r.get(e).push(r):this.#r.set(e,[r]),this.#i.has(r)?this.#i.get(r).add(e):this.#i.set(r,new Set([e]))}else this.#s.delete(e);return t}hasSignal(e){return this.#s.has(e)||this.#o?.hasSignal(e)}signal(e){return this.#s.get(e)?.object??this.#o?.signal(e)}detachSignal(e){let t=m(e);if(t&&(this.#t.delete(t),this.#i.has(t))){let r=this.#i.get(t);for(let i of r)if(this.#r.has(i)){let n=this.#r.get(i);n.splice(n.indexOf(t),1),n.length===0?(this.#s.delete(i),this.#r.delete(i)):this.#s.get(i)===t&&this.#s.set(i,n.at(-1))}r.clear(),this.#i.delete(t)}return e}attachEffect(e){return this.#n.add(e),e}runEffects(){for(let e of this.#n)e.run();for(let e of this.#e)e.runEffects()}attachLink(e){if(e?.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return e&&this.#a.add(e),e}detachLink(e){return e&&this.#a.delete(e),e}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){c(this,B,this),y(this);for(let e of this.#e)e.destroy();for(let e of this.#n)e.destroy();for(let e of this.#t)S(e);for(let e of this.#a)e.destroy();this.#e.clear(),this.#t.clear(),this.#s.clear(),this.#r.clear(),this.#n.clear(),this.#a.clear(),this.#o?.detachGroup(this),G.delete(this)}};var We=class{[ie];constructor(e){this[ie]=e,v(e,fe.Destroy,()=>{this[ie]=void 0})}run=()=>this[ie]?.run();destroy=()=>{this[ie]?.destroy(),this[ie]=void 0}};var de=class{#e;#t;constructor(e="id",t=1){this.#e=e,this.#t=t}make(){return Symbol(`${this.#e}${this.#t++}`)}};var Ot=[],Fe=()=>Ot.at(-1),is=(s,e)=>{Ot.push(s);try{return e()}finally{Ot.pop()}};var Xs=s=>s!=null&&typeof s.then=="function",fe=class s{static idGen=new de("ef");static Destroy="destroy";static count=0;id;callback;#e;#t=new Set;#s=new Set;parentEffect;childEffects=[];curChildEffectSlot=0;autorun=!0;shouldRun=!0;#i;#r=!1;constructor(e,t){w(this),this.callback=e;let r;t?.attach!=null&&(r=O.findOrCreate(t.attach),r.attachEffect(this)),this.autorun=t?.autorun??!0,this.#i=t?.dependencies?t.dependencies.map(i=>{switch(typeof i){case"string":case"symbol":return r.signal(i);default:return i}}):void 0,this.id=s.idGen.make(),g(z,this.id,"recall",this),++s.count}hasStaticDeps(){return this.#i!=null&&this.#i.length>0}saveSignalsFromDeps(){for(let e of this.#i)this.whenSignalIsRead(m(e).id)}static createEffect(e,t,r){let i=Array.isArray(t)?t:void 0,n=i?r??{dependencies:i}:t;n&&i&&(n.dependencies=i);let o,l=Fe();return l!=null?(o=l.getCurrentChildEffect(),o==null&&(o=new s(e,n),l.attachChildEffect(o),c(z,kt,o)),l.curChildEffectSlot++):(o=new s(e,n),c(z,kt,o)),o.hasStaticDeps()?o.saveSignalsFromDeps():o.autorun&&o.run(),new We(o)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(e){this.childEffects.push(e),this.parentEffect=this}run=()=>{if(this.#r||!this.shouldRun)return;let e=ss();e?e.batch(this.id):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,this.hasStaticDeps()?this.#e=this.callback():this.#e=is(this,this.callback))};recall(){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(e){this.#t.has(e)||(this.#t.add(e),g(V,e,"recall",this),v(L,e,xt,this))}[xt](e){!this.#s.has(e)&&this.#t.has(e)&&(this.#s.add(e),y(V,e,this),this.#s.size===this.#t.size&&this.destroy())}runCleanupCallback(){if(this.#e!=null){let e=this.#e;this.#e=void 0,Xs(e)?Promise.resolve(e).then(t=>{typeof t=="function"&&t()}):e()}}destroy=()=>{this.#r||(c(this,s.Destroy,this),y(this),c(z,rs,this),this.runCleanupCallback(),y(V,this),y(z,this),y(L,this),this.#r=!0,this.#t.clear(),this.#s.clear(),this.childEffects.forEach(e=>{e.destroy()}),this.childEffects.length=0,--s.count)}};var b=(...s)=>fe.createEffect(...s);var we=new WeakMap,Zs=s=>{let e=we.get(s);return e||(e={},we.set(s,e)),e},A=(s,e)=>we.get(s)?.signals?.get(e);var ns=(s,e,t)=>{let r=Zs(s);r.signals??=new Map,r.signals.set(e,t)};function Ee(...s){for(let e of s)if(we.has(e)){let t=we.get(e);if(t.signals){for(let r of t.signals.values())S(r);t.signals.clear(),t.signals=void 0}}}function os(s){let e=m(pe(s)?s:A(...s));e!=null&&!e.muted&&!e.destroyed&&Ue(e.id,e.value,{touch:!0})}function ne(s){return pe(s)?m(s)?.value:m(A(...s))?.value}var Ve=class{[T];constructor(e){this[T]=e}get get(){return this[T].reader}get set(){return this[T].writer}get value(){return ne(this.get)}set value(e){this.set(e)}onChange(e){let{destroy:t}=b(()=>e(this.value),[this.get]);return t}get muted(){return this[T].muted}set muted(e){this[T].muted=e}touch(){os(this)}destroy(){S(this)}};var er=new de("si");function as(s){Ie()||Fe()?.whenSignalIsRead(s)}function Ue(s,e,t){Ie()||c(V,s,e,t)}var pe=s=>s!=null&&s[T]!=null,tr=s=>{let e=t=>(t?b(()=>(s.destroyed||as(s.id),t(s.value)),[e]):s.destroyed||(s.beforeRead?.(),as(s.id)),s.value);return Object.defineProperty(e,T,{value:s}),e},ze=class s{static instanceCount=0;id;lazy;get[T](){return this}compare;beforeRead;muted=!1;destroyed=!1;#e=void 0;get value(){return this.lazy&&(this.#e=this.valueFn(),this.valueFn=void 0,this.lazy=!1),this.#e}set value(e){this.#e=e}valueFn;reader;writer=(e,t)=>{let r=t?.lazy??!1,n=t?.compare??this.compare??((l,a)=>l===a);if((r!==this.lazy||r&&e!==this.valueFn||!r&&!n(e,this.#e))&&(r?(this.#e=void 0,this.valueFn=e,this.lazy=!0):(this.#e=e,this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){Ue(this.id,this.#e);return}(t?.touch??!1)&&Ue(this.id,this.#e,{touch:!0})};object;constructor(e,t){this.id=er.make(),++s.instanceCount,this.lazy=e,this.lazy?(this.value=void 0,this.valueFn=t):(this.value=t,this.valueFn=void 0),this.reader=tr(this),this.object=new Ve(this)}},m=s=>s?.[T];function f(s=void 0,e){let t;if(pe(s))t=m(s);else{let r=e?.lazy??!1;t=new ze(r,s),t.beforeRead=e?.beforeRead,t.compare=e?.compare}return e?.attach!=null&&O.findOrCreate(e.attach).attachSignal(t),t.object}var S=(...s)=>{for(let e of s){let t=m(e);t!=null&&!t.destroyed&&(t.destroyed=!0,t.beforeRead=void 0,--ze.instanceCount,c(L,t.id,t.id))}};function Pt(s,e){let t=f(),r=e?.attach!=null?O.findOrCreate(e.attach):void 0;r!=null&&(e?.name?r.attachSignalByName(e.name,t):r.attachSignal(t));let i=b(()=>t.set(s()),{autorun:!1,attach:r}),n=m(t);return n.beforeRead=i.run,v(L,n.id,i.destroy),t.get}var Be=class{#e=!1;#t;source;lastValue;isDestroyed=!1;constructor(e){w(this),this.source=m(e),this.#t=g(V,this.source.id,(t,r)=>{!this.#e&&!this.isDestroyed&&(r?.touch===!0?this.touch():this.write())}),v(L,this.source.id,()=>this.destroy())}attach(e){let t=O.findOrCreate(e);return t.attachLink(this),v(this,B,()=>{t.detachLink(this)}),t}nextValue(){return new Promise((e,t)=>{let r=[],i=()=>r.forEach(n=>{n()});r.push(v(this,ce,n=>{i(),e(n)}),v(this,B,()=>{i(),t()}))})}async*asyncValues(e){let t=0;for(;!this.isDestroyed;)try{let r=await this.nextValue();if(e&&e(r,t++))break;$(this,ce),yield r}catch{break}U(this,ce)}destroy(){this.isDestroyed||(this.#t?.(),this.#t=void 0,c(this,B,this),U(this,ce),y(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return this.#e}mute(){return!this.isDestroyed&&!this.#e&&(this.#e=!0,c(this,At,this)),this}unmute(){return!this.isDestroyed&&this.#e&&(this.#e=!1,c(this,Tt,this)),this}toggle(){return this.isDestroyed||(this.#e=!this.#e,c(this,this.#e?At:Tt,this)),this.#e}updateValue(e){if(!this.#e&&!this.isDestroyed){let{value:t}=this.source;e(t),c(this,ce,t),this.lastValue=t}}},Ge=class extends Be{target;constructor(e,t){super(e),this.target=m(t),v(L,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(e=>{this.target.writer(e,{touch:!0})}),this}write(){this.updateValue(e=>{this.target.writer(e)})}},qe=class extends Be{target;constructor(e,t){super(e),this.target=t,this.touch()}touch(){return this.updateValue(e=>{this.target(e)}),this}write(){this.updateValue(e=>{this.target(e)})}};var He=new Map;function q(s,e,t){let r=m(s),i;if(He.has(r)){i=He.get(r);let h=m(e)??e;if(i.has(h))return i.get(h)}else i=new Map,He.set(r,i);let n=m(e),o=n!=null?new Ge(s,n):new qe(s,e),l=t?.attach;l&&o.attach(l);let a=n??e;return i.set(a,o),v(o,B,()=>{i.delete(a),i.size===0&&He.delete(r)}),o}var Qe=class s{static fromProps(e,t){let r=new s,i=t?t.map(n=>[n,e[n]]):Object.entries(e);for(let[n,o]of i)r.#e.set(n,f(o));return r}#e=new Map;keys(){return this.#e.keys()}signals(){return this.#e.values()}entries(){return this.#e.entries()}clear(){for(let e of this.#e.values())e.destroy();this.#e.clear()}has(e){return this.#e.has(e)}get(e){if(!this.#e.has(e)){let t=f();return this.#e.set(e,t),t}return this.#e.get(e)}update(e){e.size&&k(()=>{for(let[t,r]of e.entries())this.get(t).set(r)})}updateFromProps(e,t){k(()=>{let r=t?t.map(i=>[i,e[i]]):Object.entries(e);for(let[i,n]of r)this.get(i).set(n)})}};var _;(function(s){s[s.StructuralChanges=1]="StructuralChanges",s[s.ContentUpdates=2]="ContentUpdates",s[s.Removal=3]="Removal"})(_||(_={}));var p;(function(s){s[s.CreateEntities=1]="CreateEntities",s[s.DestroyEntities=2]="DestroyEntities",s[s.SetParent=3]="SetParent",s[s.UpdateOrder=4]="UpdateOrder",s[s.ChangeProperties=5]="ChangeProperties",s[s.ChangeToken=6]="ChangeToken",s[s.SendEvents=7]="SendEvents"})(p||(p={}));var oe=Symbol.for("ShadowEntsGlobalNS"),I="#void",hs="contextLost",ls="configure",us="changeTrail",cs="destroy",fs="loaded",ds="appliedChangeTrail",ps="importedModule",gs="destroyed",ge="messageToView",ys=16e3,ms=16e3,bs=4e3,vs=1e3,Rt="shadowObjects";function ws(s,e){s.indexOf(e)===-1&&s.push(e)}function Mt(s,e){let t=s.indexOf(e);t!==-1&&s.splice(t,1),s.push(e)}function H(s,e){let t=s.indexOf(e);t!==-1&&s.splice(t,1)}var ae=s=>typeof s=="string"?s.trim()||oe:typeof s=="symbol"?s:oe;var Ce="#root",Se=class{#e;get uuid(){return this.#e}#t=0;constructor(e){this.#e=e}#s=!0;#i=0;#r=0;hasChanges(){return this.#t>0}get isNew(){return this.#s}get isCreated(){return this.#i>0&&this.#i>this.#r}get isDestroyed(){return this.#r>0&&this.#r>=this.#i}#n=I;#a;#o=0;#u;#h;#l;create(e=I,t,r=0){this.#t++,this.#i++,this.#u=e,this.#h=t??Ce,this.#l=r||void 0}destroy(){this.#r++,this.#t++}clear(){this.#t=0,this.#s=!1,this.#u=void 0,this.#h=void 0,this.#l=void 0,this.#f.clear(),this.#g.length=0,this.#p.length=0,this.#d.clear()}changeToken(e){e===this.#n?this.#u=void 0:(this.#u=e,this.#t++)}setParent(e){e===this.#a?this.#h=void 0:(this.#h=e??Ce,this.#t++)}changeOrder(e){e===this.#o?this.#l=void 0:(this.#l=e,this.#t++)}#c=new Map;#f=new Map;#g=[];changeProperty(e,t,r){let i=this.#c.get(e);r==null&&t!==i||r!=null&&!r(t,i)?(this.#f.set(e,t),Mt(this.#g,e),this.#t++):(this.#f.delete(e),H(this.#g,e))}removeProperty(e){let t=this.#c.has(e);this.#f.has(e)?(this.#f.delete(e),t||H(this.#g,e)):t&&(Mt(this.#g,e),this.#t++)}#p=[];#d=new Set;createEvent(e,t,r){this.#p.push({type:e,data:t}),r?.forEach(i=>this.#d.add(i)),this.#t++}transferEventsTo(e){this.#p.length>0&&(e.#p.push(...this.#p),this.#p.length=0),this.#d.size>0&&(e.#d=new Set([...e.#d,...this.#d]),this.#d.clear())}buildChangeTrail(e,t){let{isNew:r,isCreated:i,isDestroyed:n}=this;if(!(r&&n))switch(t){case _.StructuralChanges:r?e.push(this.makeCreateEntityChange()):n||(this.#h!==void 0&&!(this.#h===Ce&&this.#a===void 0)?e.push(this.makeSetParentChange()):this.#l!==void 0&&this.#l!==this.#o&&e.push(this.makeUpdateOrderChange()),this.#u!==void 0&&this.#u!==this.#n&&e.push(this.makeChangeToken()));break;case _.ContentUpdates:!r&&i&&this.#g.length>0&&e.push(this.makeChangePropertyChange()),this.#p.length>0&&e.push(this.makeEvents());break;case _.Removal:n&&e.push(this.makeDestroyEntityChange());break}}makeEvents(){let e={type:p.SendEvents,uuid:this.#e,events:this.#p.slice(0)};return this.#d.size>0&&(e.transferables=Array.from(this.#d)),e}makeCreateEntityChange(){let e={type:p.CreateEntities,uuid:this.#e,token:this.#u};if(this.#n=this.#u,this.#h!==void 0){let t=this.#h===Ce?void 0:this.#h;this.#a=t,t!==void 0&&(e.parentUuid=t)}return this.#f.size>0&&(e.properties=Array.from(this.#f.entries()).filter(([,t])=>t!==void 0),e.properties.forEach(([t,r])=>this.#c.set(t,r))),this.#l!==void 0&&this.#l!==this.#o&&(e.order=this.#o=this.#l),e}makeDestroyEntityChange(){return{type:p.DestroyEntities,uuid:this.#e}}makeSetParentChange(){this.#a=this.#h===Ce?void 0:this.#h;let e={type:p.SetParent,uuid:this.#e,parentUuid:this.#a};return this.#l!==void 0&&this.#l!==this.#o&&(e.order=this.#o=this.#l),e}makeUpdateOrderChange(){return this.#o=this.#l??0,{type:p.UpdateOrder,uuid:this.#e,order:this.#o}}makeChangeToken(){return this.#n=this.#u??I,{type:p.ChangeToken,uuid:this.#e,token:this.#n}}makeChangePropertyChange(){let e=this.#g.map(t=>{if(this.#f.has(t)){let r=this.#f.get(t);return this.#c.set(t,r),[t,r]}else return this.#c.delete(t),[t,void 0]});return{type:p.ChangeProperties,uuid:this.#e,properties:e}}};var Es=s=>{if(!(s===void 0||s.length===0))return s.filter(e=>e.length===1||e[1]!==void 0)},Lt=(s,e)=>{if(s===e||e===void 0)return s;if(s===void 0)return Es(e);for(let[t,r]of e){let i=s.find(([n])=>n===t);i===void 0?s.push([t,r]):i[1]=r}return Es(s)};var Ye=class{#e=new Map;get[Symbol.iterator](){return this.#e.entries.bind(this.#e)}clear(){this.#e.clear()}isEmpty(){return this.#e.size===0}hasComponentState(e){return this.#e.has(e)}getComponentState(e){return this.#e.get(e)}write(e){for(let t of e)if(t.type===p.CreateEntities)this.createEntity(t);else if(this.#e.has(t.uuid))switch(t.type){case p.DestroyEntities:this.destroyEntity(t);break;case p.SetParent:this.setParent(t);break;case p.UpdateOrder:this.updateOrder(t);break;case p.ChangeToken:this.changeToken(t);break;case p.ChangeProperties:this.changeProperties(t);break}}changeProperties({uuid:e,properties:t}){let r=this.getComponentState(e);r.properties=Lt(r.properties,t)}changeToken({uuid:e,token:t}){this.getComponentState(e).token=t||I}updateOrder({uuid:e,order:t}){this.getComponentState(e).order=t??0}setParent({uuid:e,parentUuid:t,order:r}){let i=this.getComponentState(e);i.parentUuid=t,i.order=r??0}destroyEntity({uuid:e}){this.#e.delete(e)}createEntity({uuid:e,token:t,parentUuid:r,order:i,properties:n}){this.#e.set(e,{token:t||I,parentUuid:r,order:i??0,properties:Lt(void 0,n)})}};var M=class s{static{this.ReRequestParentRoots="re-request-parent-roots"}static getContextsMap(){return globalThis.__shadowEntsContexts==null&&(globalThis.__shadowEntsContexts=new Map),globalThis.__shadowEntsContexts}static get(e){let t=ae(e),r=s.getContextsMap();return r.has(t)?r.get(t):new s(t)}#e=new Map;#t=[];#s=new Ye;constructor(e=oe){let t=ae(e),r=s.getContextsMap();if(r.has(t))return r.get(t);this.ns=t,r.set(t,this)}addComponent(e){let t;this.#e.has(e.uuid)?(t=this.#e.get(e.uuid),t.component=e,t.children=[]):(t={component:e,children:[],changes:new Se(e.uuid),propIsEqual:void 0},this.#e.set(e.uuid,t)),t.changes.create(e.token,e.parent?.uuid,e.order),e.parent?(this.addToChildren(e.parent,e),t.changes.setParent(e.parent.uuid)):this.#n(e,this.#t),this.#a=void 0}hasComponent(e){return this.#e.has(e.uuid)}hasComponents(){return this.#e.size>0}isRootComponent(e){return this.#t.includes(e.uuid)}destroyComponent(e){if(this.hasComponent(e)){let t=this.#e.get(e.uuid);t.children.slice(0).forEach(r=>this.#e.get(r)?.component.removeFromParent()),t.changes.destroy(),this.#a=void 0}}getChildren(e){return this.#e.get(e.uuid)?.children.map(t=>this.#e.get(t).component)??[]}removeFromParent(e,t){if(this.hasComponent(t)){let r=this.#e.get(e),i=this.#e.get(t.uuid),n=i.children.indexOf(e);n!==-1&&(i.children.splice(n,1),r.changes.setParent(void 0)),this.#n(r.component,this.#t),this.#a=void 0}}moveToRoot(e){let t=this.#e.get(e);t&&(t.changes?.setParent(void 0),this.#n(t.component,this.#t)),this.#a=void 0}changeToken(e,t){this.#e.get(e.uuid)?.changes.changeToken(t)}isChildOf(e,t){return this.hasComponent(t)?this.#e.get(t.uuid).children.includes(e.uuid):!1}addToChildren(e,t){let r=this.#e.get(e.uuid);if(r)this.#n(t,r.children),this.#e.get(t.uuid)?.changes.setParent(e.uuid),H(this.#t,t.uuid),this.#a=void 0;else throw new Error(`the view component ${e.uuid} cannot have a child added to it because the component do not exist!`)}removeSubTree(e){let t=this.#e.get(e);t&&(t.children.slice(0).forEach(r=>this.removeSubTree(r)),this.destroyComponent(t.component),this.#i(e))}setProperty(e,t,r,i){let n=this.#e.get(e.uuid);return n!=null?(i!=null?(n.propIsEqual??=new Map,n.propIsEqual.set(t,i)):n.propIsEqual?.has(t)&&n.propIsEqual.delete(t),n.changes.changeProperty(t,r,i)):!1}removeProperty(e,t){this.#e.get(e.uuid)?.changes.removeProperty(t)}changeOrder(e){if(e.parent){let t=this.#e.get(e.parent.uuid);H(t.children,e.uuid),this.#n(e,t.children)}else H(this.#t,e.uuid),this.#n(e,this.#t);this.#e.get(e.uuid)?.changes.changeOrder(e.order),this.#a=void 0}traverseLevelOrderBFS(){return this.#o().map(e=>e.component)}dispatchShadowObjectsEvent(e,t,r,i){this.#e.get(e.uuid)?.changes.createEvent(t,r,i)}broadcastEvent(e,t=void 0){for(let r of this.traverseLevelOrderBFS())r.dispatchEvent(e,t,!1)}dispatchMessage(e,t,r=void 0,i=!1){this.#e.get(e)?.component.dispatchEvent(t,r,i)}dispatchReRequestParentRoots(){for(let e of this.#t)this.dispatchMessage(e,s.ReRequestParentRoots)}buildChangeTrails(e=!0){let t=[];if(!this.hasComponents())return t;let r=this.#r();for(let i of r)i.buildChangeTrail(t,_.StructuralChanges);for(let i of r)i.buildChangeTrail(t,_.ContentUpdates);for(let i of r)i.buildChangeTrail(t,_.Removal),(i.isDestroyed||i.isNew&&!i.isCreated)&&this.#i(i.uuid),e&&i.clear();return this.#s.write(t),t}reCreateChanges(){if(!this.#s.isEmpty()){this.buildChangeTrails(!1);for(let[e,t]of this.#s){let r=this.#e.get(e);if(r){let i=new Se(e);if(i.create(t.token,t.parentUuid,t.order),t.properties)for(let[n,o]of t.properties)i.changeProperty(n,o,r.propIsEqual?.get(n));r.changes.transferEventsTo(i),r.changes.clear(),r.changes=i}}this.#s.clear(),this.broadcastEvent(hs)}}clear(){if(this.#a=void 0,this.#s.clear(),this.#t.slice(0).forEach(e=>this.removeSubTree(e)),this.#t.length!==0)throw new Error("component-context panic: #rootComponents is not empty!");if(this.#e.size!==0)throw new Error("component-context panic: #components is not empty!")}#i(e){this.#e.has(e)&&(this.#e.delete(e),H(this.#t,e),this.#a=void 0)}#r(){return this.#o().filter(e=>e.changes.hasChanges()).map(e=>e.changes)}#n(e,t){if(t.length===0){t.push(e.uuid);return}if(t.includes(e.uuid))return;let r=t.length,i=new Array(r);if(i[0]=this.#e.get(t[0]).component,e.order<i[0].order){t.unshift(e.uuid);return}if(r===1){t.push(e.uuid);return}let n=r-1;if(i[n]=this.#e.get(t[n]).component,e.order>=i[n].order){t.push(e.uuid);return}if(r===2){t.splice(1,0,e.uuid);return}for(let o=n-1;o>=1;o--)if(i[o]=this.#e.get(t[o]).component,e.order>=i[o].order){t.splice(o+1,0,e.uuid);return}}#a;#o(){if(this.#a)return this.#a;let e=new Map,t=(r,i)=>{let n=this.#e.get(r);if(n!=null){e.has(i)?e.get(i).push(n):e.set(i,[n]);for(let o of n.children)t(o,i+1)}};return this.#t.forEach(r=>t(r,0)),this.#a=Array.from(e.entries()).sort((r,i)=>r[0]-i[0]).map(([,r])=>r).flat(),this.#a}};function xe(s,e,t,r,i,n){function o(be){if(be!==void 0&&typeof be!="function")throw new TypeError("Function expected");return be}for(var l=r.kind,a=l==="getter"?"get":l==="setter"?"set":"value",h=!e&&s?r.static?s:s.prototype:null,u=e||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),d,E=!1,he=t.length-1;he>=0;he--){var Ne={};for(var le in r)Ne[le]=le==="access"?{}:r[le];for(var le in r.access)Ne.access[le]=r.access[le];Ne.addInitializer=function(be){if(E)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(be||null))};var Z=(0,t[he])(l==="accessor"?{get:u.get,set:u.set}:u[a],Ne);if(l==="accessor"){if(Z===void 0)continue;if(Z===null||typeof Z!="object")throw new TypeError("Object expected");(d=o(Z.get))&&(u.get=d),(d=o(Z.set))&&(u.set=d),(d=o(Z.init))&&i.unshift(d)}else(d=o(Z))&&(l==="field"?i.unshift(d):u[a]=d)}h&&Object.defineProperty(h,r.name,u),E=!0}function Q(s,e,t){for(var r=arguments.length>2,i=0;i<e.length;i++)t=r?e[i].call(s,t):e[i].call(s);return r?t:void 0}function ke(s){return function(e,t){let r=s?.name||t.name,i=!!(s?.readAsValue??!1);return{get(){let n=A(this,r);if(n)return i?n.value:n.get()},set(n){A(this,r)?.set(n)},init(n){let o=f(n,s);return ns(this,r,o),O.findOrCreate(this).attachSignalByName(r,o),o.value}}}}var R="ConsoleLogger",P=`${R}Storage`,sr=!!(globalThis.location?.host?.startsWith("localhost")??!1),Te="localStorage"in globalThis,Ke=Symbol.for(R),Cs=!1,Ss=s=>{if(typeof s=="boolean")return s;switch(s.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},jt=s=>[Te?R:void 0,...Array.isArray(s)?s:[s]].filter(Boolean).join(".");function _t(s,e=void 0,t){let r=jt(s),i=Te?localStorage.getItem(r):globalThis[P]?.[r];return i!=null?e(i):t}function Ae(s,e){Te?localStorage.setItem(jt(s),e):(globalThis[P]==null&&(globalThis[P]={},console.debug(`${R}: Initialize`,{[P]:globalThis[P]})),globalThis[P][jt(s)]=e)}var x=class s{static{this.sharedConfig={enable:sr,debug:!1,info:!0,warn:!0,"styles.debug":"color: #111; background: #999; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.info":"color: #020; background: #8a8; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.warn":"color: #fa0; background: #a98; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.error":"color: #ff0; background: #a00; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em"}}static get isEnabled(){return s.sharedConfig.enable}static get isDebug(){return s.sharedConfig.enable&&s.sharedConfig.debug}static{this.sharedStyles={get debug(){return s.sharedConfig["styles.debug"]},set debug(e){s.sharedConfig["styles.debug"]=e},get info(){return s.sharedConfig["styles.info"]},set info(e){s.sharedConfig["styles.info"]=e},get warn(){return s.sharedConfig["styles.warn"]},set warn(e){s.sharedConfig["styles.warn"]=e},get error(){return s.sharedConfig["styles.error"]},set error(e){s.sharedConfig["styles.error"]=e}}}static loadConfig(){Te?(["enable","debug","info","warn"].forEach(e=>{this.sharedConfig[e]=_t(e,Ss,this.sharedConfig[e])}),["debug","info","warn","error"].forEach(e=>{this.sharedStyles[e]=_t(["styles",e],void 0,this.sharedStyles[e])}),s.isDebug&&console.debug(`${R}: Load config from localStorage`,s.sharedConfig),globalThis[R]?.[Ke]||(globalThis[R]??={[Ke]:!0,get enable(){return s.sharedConfig.enable},set enable(e){s.sharedConfig.enable=e,Ae("enable",e?"true":"false")},get debug(){return s.sharedConfig.debug},set debug(e){s.sharedConfig.debug=e,Ae("debug",e?"true":"false")},get info(){return s.sharedConfig.info},set info(e){s.sharedConfig.info=e,Ae("info",e?"true":"false")},get warn(){return s.sharedConfig.warn},set warn(e){s.sharedConfig.warn=e,Ae("warn",e?"true":"false")}})):globalThis[P]?.[Ke]||(globalThis[P]={[Ke]:!0,...s.sharedConfig,...globalThis[P]},s.sharedConfig=globalThis[P],s.isDebug&&console.debug(`${R}: Load config from ${P}`,globalThis[P]))}constructor(e){this.enable=!0,this.namespace=(e||"").trim()||R,Cs||(s.loadConfig(),Cs=!0);let t=[this.namespace,"enable"];this.enable=_t(t,Ss,this.enable),Ae(t,Te?this.enable?"true":"false":this.enable)}get isEnabled(){return this.enable&&s.sharedConfig.enable}get isDebug(){return this.isEnabled&&s.sharedConfig.debug}get isInfo(){return this.isEnabled&&s.sharedConfig.info}get isWarn(){return this.isEnabled&&s.sharedConfig.warn}debug(...e){this.#e("debug",s.sharedStyles.debug,e)}info(...e){this.#e("info",s.sharedStyles.info,e)}warn(...e){this.#e("warn",s.sharedStyles.warn,e)}error(...e){this.#e("error",s.sharedStyles.error,e)}#e(e,t,r){console[e](`%c${this.namespace}`,t,...r)}};var j=(()=>{var s;let e,t=[],r=[],i,n=[],o=[];return class W{static{let a=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[ke()],i=[ke()],xe(this,null,e,{kind:"accessor",name:"viewReady",static:!1,private:!1,access:{has:h=>"viewReady"in h,get:h=>h.viewReady,set:(h,u)=>{h.viewReady=u}},metadata:a},t,r),xe(this,null,i,{kind:"accessor",name:"proxyReady",static:!1,private:!1,access:{has:h=>"proxyReady"in h,get:h=>h.proxyReady,set:(h,u)=>{h.proxyReady=u}},metadata:a},n,o),a&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a})}static{this.AfterSync="afterSync"}static{this.ContextLost="contextLost"}static{this.ContextCreated="contextCreated"}static get(a){if(a!=null)return globalThis.__shadowEnvs?.get(a)}#e;#t;#s;#i;#r;#n;#a;get viewReady(){return this.#a}set viewReady(a){this.#a=a}#o;get proxyReady(){return this.#o}set proxyReady(a){this.#o=a}#u;get isDestroyed(){return this.#u}constructor(){this.#s=!1,this.#i=!1,this.#r=!1,this.logger=new x("ShadowEnv"),this.ns$=f(),this.#a=Q(this,t,!1),this.#o=(Q(this,r),Q(this,n,!1)),this.#u=(Q(this,o),!1),this.ready=async()=>this.isReady?this:ue(this,W.ContextCreated),this.#h=()=>{this.#s&&this.#l()},$(this,W.ContextCreated),g(this,W.ContextLost,se.AAA,()=>{U(this,W.ContextCreated)}),b(()=>{if(this.viewReady&&this.proxyReady)return this.view.reCreateChanges(),c(this,W.ContextCreated,this),this.#i&&(this.#i=!1,this.#l()),()=>{c(this,W.ContextLost,this)}},[A(this,"viewReady"),A(this,"proxyReady")])}get view(){return this.#e}set view(a){a!==this.#e&&(this.#e&&this.#e.ns&&globalThis.__shadowEnvs&&globalThis.__shadowEnvs.delete(this.#e.ns),this.#e=a??void 0,this.#e&&this.#e.ns&&(globalThis.__shadowEnvs??=new Map,globalThis.__shadowEnvs.has(this.#e.ns)&&globalThis.__shadowEnvs.get(this.#e.ns)!==this&&this.logger.isWarn&&this.logger.warn("overwrite a namespace already in use",this.#e.ns,globalThis.__shadowEnvs.get(this.#e.ns)),globalThis.__shadowEnvs.set(this.#e.ns,this)),this.viewReady=!!a)}get envProxy(){return this.#t}set envProxy(a){if(a!==this.#t){let h=this.#t;this.#t=a??void 0,this.#t&&(this.#t.onMessageToView=this.#c.bind(this)),h&&h.destroy(),this.proxyReady=!1,a?.start().then(()=>{this.proxyReady=!0}).catch(u=>{this.logger.error("failed to start envProxy",u),this.proxyReady=!1})}}get isReady(){return!!(this.#e&&this.#t&&this.proxyReady&&!this.isDestroyed)}sync(){if(!this.isReady){this.#i=!0;return}this.#s||(this.#s=!0,queueMicrotask(this.#h))}syncWait(){return this.#r=!0,this.sync(),this.#n?this.#n:(this.#n=ue(this,W.AfterSync).then(a=>(this.#n=void 0,a)),this.#n)}destroy(){let a=this.#e?.ns;this.envProxy?.destroy(),this.envProxy=void 0,this.view=void 0,a&&globalThis.__shadowEnvs.has(a)&&globalThis.__shadowEnvs.get(a)===this&&globalThis.__shadowEnvs.delete(a),Ee(this),y(this),this.#u=!0,Object.freeze(this)}#h;async#l(){if(this.#s=!1,this.isReady){let a=this.view.buildChangeTrails();if(a.length>0)try{let h=this.#r;this.#r=!1,await this.envProxy.applyChangeTrail(a,h)}catch(h){this.logger.error("failed to apply change trail",h)}finally{c(this,W.AfterSync,a)}}}#c(a){this.logger.isDebug&&this.logger.debug("onMessageToView",a.type,a.data),this.view?.dispatchMessage(a.uuid,a.type,a.data,a.traverseChildren)}}})();var C=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],rr=()=>{let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(C[s&255]+C[s>>8&255]+C[s>>16&255]+C[s>>24&255]+"-"+C[e&255]+C[e>>8&255]+"-"+C[e>>16&15|64]+C[e>>24&255]+"-"+C[t&63|128]+C[t>>8&255]+"-"+C[t>>16&255]+C[t>>24&255]+C[r&255]+C[r>>8&255]+C[r>>16&255]+C[r>>24&255]).toLowerCase()},xs=()=>globalThis?.crypto?.randomUUID?.()??rr();var Oe=class extends Error{constructor(e){super(e),this.name="ViewComponentError"}},Je=class s{#e;#t;#s;#i;#r=0;get uuid(){return this.#e}get token(){return this.#t}set token(e){e??=I,e!==this.#t&&(this.#t=e,this.#s?.changeToken(this,e))}get parent(){return this.#i}set parent(e){if(e){if(e.#s!==this.#s)throw new Oe("cannot set parent from different context");e.addChild(this)}else this.removeFromParent()}get context(){return this.#s}set context(e){this.#s!=e&&(this.#s&&this.destroy(),this.#s=e,e&&e.addComponent(this))}get order(){return this.#r}set order(e){let t=this.#r;this.#r=e??0,t!==this.#r&&this.#s.changeOrder(this)}constructor(e,t){w(this),t instanceof s&&(t={parent:t}),this.#e=t?.uuid??xs(),this.#t=e,this.#r=t?.order??0,this.#i=t?.parent;let r=t?.context??M.get();if(this.#i&&this.#i.#s!==r)throw new Oe("cannot set parent from different context");this.context=r}isChildOf(e){return this.#i===e}removeFromParent(){this.#i?(this.#s?.removeFromParent(this.uuid,this.#i),this.#i=void 0):this.#s?.moveToRoot(this.uuid)}addChild(e){if(e.#s!==this.#s)throw new Oe("cannot add a child from another context");e.isChildOf(this)||(e.removeFromParent(),e.#i=this,this.#s.addToChildren(this,e))}setProperty(e,t,r){this.#s.setProperty(this,e,t,r)}removeProperty(e){this.#s.removeProperty(this,e)}dispatchShadowObjectsEvent(e,t,r){this.#s.dispatchShadowObjectsEvent(this,e,t,r)}dispatchEvent(e,t,r){if(c(this,e,t),r)for(let i of this.#s.getChildren(this))i.dispatchEvent(e,t,r)}destroy(){this.removeFromParent(),this.#s?.destroyComponent(this),this.#s=void 0}};var Xe="shaeRequestEntParent",Ze="shaeReRequestEntParent",ks="shae-worker",et="shae-ent",As="shae-prop",Y="token",K="ns",tt="local",Ts="no-autostart",st="no-structured-clone",N="auto-sync",rt="src",it="name",nt="value",ot="type",at="no-trim";var Pe=new Set(["on","true","yes","local","1"]);var Os=s=>ae(s.getAttribute(K)),Re=(s,e)=>{if(s.hasAttribute(e)){let t=s.getAttribute(e)?.trim()?.toLowerCase()||"1";return Pe.has(t)}return!1};var Ps=(s,e)=>{e.set(Os(s))},Nt=new Set,Dt=!1,ir=s=>{Nt.add(s),Dt||(Dt=!0,queueMicrotask(()=>{Dt=!1;for(let e of Nt)j.get(e)?.sync();Nt.clear()}))},J=class extends HTMLElement{static{this.observedAttributes=[K]}get ns(){return this.ns$.value}set ns(e){typeof e=="symbol"?this.ns$.set(e):this.ns$.set(ae(e))}constructor(){super(),this.isShaeElement=!0,this.ns$=f(oe),this.ns$.onChange(e=>{typeof e=="string"&&e.length>0?this.getAttribute(K)!==e&&this.setAttribute(K,e):this.removeAttribute(K)}),Ps(this,this.ns$)}attributeChangedCallback(e){e===K&&Ps(this,this.ns$)}syncShadowObjects(){ir(this.ns)}};var ht=class extends J{static{this.observedAttributes=[...J.observedAttributes,Y]}get componentContext(){return this.componentContext$.value}get viewComponent(){return this.viewComponent$.value}get uuid(){return this.viewComponent?.uuid}get token(){return this.token$.value}set token(e){this.token$.set(e)}#e;constructor(){super(),this.isShaeEntElement=!0,this.componentContext$=f(),this.viewComponent$=f(),this.token$=f(),this.#n=!0,this.#f=()=>{let e=this.findShadowRootHost();e!=null&&this.dispatchEvent(new CustomEvent(Ze,{bubbles:!0,composed:!0,detail:{requester:this,shadowRootHost:e}}))},this.#g=e=>{let t=e.detail?.requester;if(t===this||!t?.isShaeEntElement||t.ns!==this.ns)return;e.detail?.shadowRootHost&&this.#h()},this.#p=e=>{let t=e.detail?.requester;t!==this&&t?.isShaeEntElement&&t.ns===this.ns&&(e.stopPropagation(),t.#c(this))},this.ns$.onChange(e=>{this.componentContext$.set(M.get(e)),this.isConnected&&this.#h()}),this.#d(),this.token$.onChange(e=>{e==null?this.removeAttribute(Y):this.getAttribute(Y)!==e&&this.setAttribute(Y,e)}),b(()=>{let e=this.viewComponent$.get();if(e){let t=g(e,M.ReRequestParentRoots,()=>this.#u()),r=e.context?.ns;return()=>{t(),e.destroy(),r&&r!==this.ns?j.get(r)?.sync():this.syncShadowObjects()}}}),this.token$.onChange(e=>{let t=this.viewComponent$.value;t&&(t.token=e,this.syncShadowObjects())})}#t;#s(){this.#t?.();let e=this.componentContext$.onChange(t=>{let r=this.token$.value,i=this.viewComponent$.value;i?i.context=t:t&&(i=new Je(r,{context:t}),this.viewComponent$.set(i)),this.syncShadowObjects()});this.#t=()=>{e()}}#i(){this.#t?.(),this.#t=void 0}#r;#n;findShadowRootHost(){if(this.#n){this.#n=!1;let e=this;for(;e;){if(e.parentElement==null){let t=e.parentNode;t&&(this.#r=t.host);break}e=e.parentElement}}return this.#r}getParentNodeForObserver(){let e=this.parentNode;return e||(e.host??e)}connectedCallback(){this.#n=!0,this.addEventListener("slotchange",this.#f,{capture:!1,passive:!1}),this.addEventListener(Xe,this.#p,{capture:!1,passive:!1}),this.#s(),St(()=>this.#d()),this.componentContext==null&&this.componentContext$.set(M.get(this.ns)),this.#h(),this.componentContext?.dispatchReRequestParentRoots(),this.#a(),this.syncShadowObjects()}#a(){this.#o();let e=this.getParentNodeForObserver();e&&(this.#e=new MutationObserver((t,r)=>{for(let{target:i,removedNodes:n}of t)if(i===e){for(let o of n)if(o===this){this.#o(),this.onParentChanged(this.getParentNodeForObserver(),e);break}}}),this.#e.observe(e,{childList:!0,subtree:!1,attributes:!1}))}onParentChanged(e,t){this.#c(void 0),this.#h()}#o(){this.#e?.disconnect(),this.#e=void 0}attributeChangedCallback(e){super.attributeChangedCallback(e),e===Y&&this.#d()}disconnectedCallback(){this.#n=!0,this.#o(),this.removeEventListener("slotchange",this.#f,{capture:!1}),this.removeEventListener(Xe,this.#p,{capture:!1}),this.#c(void 0),this.componentContext$.set(void 0),this.syncShadowObjects(),this.#i()}#u(){this.isConnected&&(this.#c(void 0),this.#h())}#h(){this.dispatchEvent(new CustomEvent(Xe,{bubbles:!0,composed:!0,detail:{requester:this}}))}#l;#c(e){if(this.entParentNode!==e)if(this.entParentNode&&this.entParentNode.removeEventListener(Ze,this.#g,{capture:!1}),this.entParentNode=e,this.entParentNode&&this.entParentNode.addEventListener(Ze,this.#g,{capture:!1,passive:!1}),this.#l?.(),this.#l=void 0,e){let t=b(()=>{let r=this.viewComponent$.get();if(r){let i=e.viewComponent$.get();r.parent=i&&i.context===r.context?i:void 0,r.parent==null&&queueMicrotask(()=>{this.#h()}),this.syncShadowObjects()}});this.#l=()=>t.destroy()}else{let t=this.viewComponent;t.parent&&(t.parent=void 0,this.syncShadowObjects())}}#f;#g;#p;#d(){if(this.hasAttribute(Y)){let e=this.getAttribute(Y)?.trim()||void 0;this.token$.set(e)}}};customElements.define(et,ht);var nr=s=>{let e=s.parentElement;for(;e;){if(e.isShaeEntElement)return e;e=e.parentElement}},or=new Set(["string","text","number","bigint","float","int","integer","hex","hexadecimal","oct","octal","bin","binary","bool","boolean","[]","text[]","string[]","number[]","float[]","int[]","integer[]","hex[]","hexadecimal[]","oct[]","octal[]","bin[]","binary[]","bool[]","boolean[]","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","bigint64array","biguint64array","json"]),lt=class extends HTMLElement{static{this.observedAttributes=[it,nt,ot,at]}get name(){return this.name$.value}get value(){return this.valueOut$.value}set value(e){this.valueIn$.set(e)}get shouldTrim(){return this.shouldTrim$.value}get entNode(){return this.entNode$.value}set entNode(e){this.entNode$.set(e)}get viewComponent(){return this.viewComponent$.value}constructor(){super(),this.isShaeEntElement=!0,this.entNode$=f(),this.viewComponent$=f(),this.name$=f(),this.valueIn$=f(),this.valueOut$=f(),this.type$=f(),this.shouldTrim$=f(!0),this.logger=new x("ShaePropElement"),this.#e=()=>{this.entNode$.set(nr(this))},this.#t=()=>{queueMicrotask(()=>{this.isConnected||this.entNode$.set(void 0)})},this.#s=()=>{this.name$.set(this.getAttribute(it)?.trim()??void 0)},this.#i=()=>{this.valueIn$.set(this.getAttribute(nt))},this.#r=()=>{let e=this.getAttribute(ot)?.trim().toLowerCase();e&&!or.has(e)&&(this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${e}"`,{shaeProp:this}),e=void 0),this.type$.set(e)},this.#n=()=>{this.shouldTrim$.set(!Re(this,at))},this.entNode$.onChange(e=>{if(e){let t=q(e.viewComponent$,this.viewComponent$);return()=>{t.destroy()}}else this.viewComponent$.set(void 0)}),b(()=>{let e=this.viewComponent$.get();if(e){let t=this.name$.get();if(t){let r=this.valueOut$.get();this.logger.isDebug&&this.logger.debug(`[${this.name}] view-component set-property`,t,r,e.uuid,{viewComponent:e,shaeProp:this}),e.setProperty(t,r),this.isConnected&&this.entNode?.syncShadowObjects()}}}),b(()=>{let e=this.type$.get(),t=this.shouldTrim$.get(),r=this.valueIn$.get();if(t&&typeof r=="string"&&(r=r.trim()),r=r||void 0,r!=null&&typeof r=="string"&&e)switch(e){case"string":case"text":break;case"number":r=Number(r);break;case"bigint":r=BigInt(r);break;case"float":r=parseFloat(r);break;case"int":case"integer":r=parseInt(r,10);break;case"hex":case"hexadecimal":r=parseInt(r,16);break;case"oct":case"octal":r=parseInt(r,8);break;case"bin":case"binary":r=parseInt(r,2);break;case"bool":case"boolean":r=Pe.has(r.toLowerCase());break;case"[]":case"text[]":case"string[]":r=r.split(/\W+/);break;case"number[]":r=r.split(/\W+/).map(i=>Number(i));break;case"float[]":r=r.split(/\W+/).map(i=>parseFloat(i));break;case"int[]":case"integer[]":r=r.split(/\W+/).map(i=>parseInt(i));break;case"hex[]":case"hexadecimal[]":r=r.split(/\W+/).map(i=>parseInt(i,16));break;case"oct[]":case"octal[]":r=r.split(/\W+/).map(i=>parseInt(i,8));break;case"bin[]":case"binary[]":r=r.split(/\W+/).map(i=>parseInt(i,2));break;case"bool[]":case"boolean[]":r=r.split(/\W+/).map(i=>Pe.has(i.toLowerCase()));break;case"int8array":r=new Int8Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint8array":r=new Uint8Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint8clampedarray":r=new Uint8ClampedArray(r.split(/\W+/).map(i=>Number(i)));break;case"int16array":r=new Int16Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint16array":r=new Uint16Array(r.split(/\W+/).map(i=>Number(i)));break;case"int32array":r=new Int32Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint32array":r=new Uint32Array(r.split(/\W+/).map(i=>Number(i)));break;case"float32array":r=new Float32Array(r.split(/\W+/).map(i=>Number(i)));break;case"float64array":r=new Float64Array(r.split(/\W+/).map(i=>Number(i)));break;case"bigint64array":r=new BigInt64Array(r.split(/\W+/).map(i=>BigInt(i)));break;case"biguint64array":r=new BigUint64Array(r.split(/\W+/).map(i=>BigInt(i)));break;case"json":r=JSON.parse(r);break;default:this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${e}"`,{value:r,shaeProp:this})}this.valueOut$.set(r)}),k(()=>{this.#s(),this.#i(),this.#r(),this.#n()})}connectedCallback(){k(()=>{this.#e(),this.#s(),this.#i(),this.#r(),this.#n()})}attributeChangedCallback(e){switch(e){case it:this.#s();break;case nt:this.#i();break;case ot:this.#r();break;case at:this.#n();break}}disconnectedCallback(){this.#t()}#e;#t;#s;#i;#r;#n};customElements.whenDefined(et).then(()=>customElements.define(As,lt));var ut,$t=null,ye=class{static{this.OnFrame=Symbol("onFrame")}#e=0;#t=0;constructor(){if($t)return $t;w(this),$t=this}start(e){if(e!=null)return Et(this)===0&&this.#i(),g(this,ut.OnFrame,e),this.#t++,()=>{this.stop(e)}}stop(e){y(this,ut.OnFrame,e),Et(this)===0&&this.#r()}#s=e=>{c(this,ut.OnFrame,e),this.#i()};#i(){this.#e=requestAnimationFrame(this.#s)}#r(){cancelAnimationFrame(this.#e),this.#e=0}};ut=ye;var me="value",It=(()=>{let s,e=[],t=[];return class{static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;s=[ke({name:me})],xe(this,null,s,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:n=>"value"in n,get:n=>n.value,set:(n,o)=>{n.value=o}},metadata:i},e,t),i&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static{this.Value=me}#e;#t;#s;get value(){return this.#s}set value(i){this.#s=i}constructor(i){this.#e=[],this.#s=Q(this,e,void 0),this.value$=Q(this,t),$(this,me),this.value$=A(this,me),this.value$.onChange(n=>c(this,me,n)),i&&this.add(...i)}add(...i){for(let n of i)this.#e.push(n);this.#r()}pop(){this.#e.pop(),this.#r()}clear(){this.#e.length=0,this.#i()}dispose(){this.clear(),U(this,me),y(this),Ee(this),this.value$.destroy()}#i(){this.#t?.destroy(),this.#t=void 0}#r(){this.#i(),this.#t=b(()=>{for(let i of this.#e){let n=ne(i);if(n!=null){this.value=n;return}}this.value=void 0},this.#e),this.#t.run()}}})();var Wt="onCreate",X="onDestroy",Rs="onParentChanged",Ms="onViewEvent";var Ft=new Map,Ut=!1,ar=(s,e)=>{Ft.set(s,e),Ut||(Ut=!0,queueMicrotask(()=>{Ut=!1;let t=Array.from(Ft.entries());Ft.clear();for(let[r,i]of t)r.set(i)}))},ct=class{#e;#t;#s=new Qe;#i=new Map;#r;#n;#a=new Set;#o=[];#u=0;get kernel(){return this.#e}get uuid(){return this.#t}get order(){return this.#u}set order(e){this.#u!==e&&(this.#u=e,this.#r&&this.parent.resortChildren())}get parentUuid(){return this.#r||void 0}set parentUuid(e){this.#r!==e&&(this.removeFromParent(),this.#r=e||void 0,this.#n=e?this.#e.getEntity(e):void 0,this.#n&&this.#n.addChild(this))}get parent(){return!this.#n&&this.#r&&(this.#n=this.#e.getEntity(this.#r)),this.#n}set parent(e){this.parentUuid=e?.uuid}get hasParent(){return!!this.#r}get children(){return this.#o}constructor(e,t){this.#e=e,this.#t=t,v(this,X,se.Min,this)}traverse(e){e(this);for(let t of this.#o)t.traverse(e)}onDestroy(){this.#s.clear(),y(this);for(let e of this.#i.values())e.context.set(void 0),e.unsubscribePathValue(),e.unsubscribeParent?.(),e.valuePath.dispose(),e.inherited.destroy(),e.provide.destroy(),e.context.destroy();this.#r=void 0,this.#n=void 0,this.#a.clear(),this.#o.length=0}addChild(e){if(this.#o.length===0){this.#a.add(e.uuid),this.#o.push(e);return}if(this.#a.has(e.uuid))throw new Error(`child with uuid: ${e.uuid} already exists! parentUuid: ${this.uuid}`);this.#a.add(e.uuid),this.#o.push(e),this.resortChildren();for(let[,t]of e.#i)e.#c(t)}resortChildren(){this.#o.sort((e,t)=>e.order-t.order)}removeChild(e){this.#a.has(e.uuid)&&(this.#a.delete(e.uuid),this.#o.splice(this.#o.indexOf(e),1))}removeFromParent(){if(this.#n){this.#n.removeChild(this),this.#n=void 0,this.#r=void 0;for(let[,e]of this.#i)e.unsubscribeParent&&(e.unsubscribeParent(),e.unsubscribeParent=void 0)}}reSubscribeToParentContexts(){for(let[,e]of this.#i)this.#c(e)}dispatchMessageToView(e,t,r,i=!1){this.#e.dispatchMessageToView({uuid:this.#t,type:e,data:t,transferables:r,traverseChildren:i})}dispatchViewEvents(e){for(let{type:t,data:r}of e)c(this,Ms,t,r)}dispatchViewEvent(e,t){this.dispatchViewEvents([{type:e,data:t}])}#h(e){return this.#s.get(e)}getPropertyReader(e){return this.#h(e).get}getPropertyWriter(e){return this.#h(e).set}setProperties(e){k(()=>{for(let[t,r]of e)this.setProperty(t,r)})}setProperty(e,t){this.getPropertyWriter(e)(t)}getProperty(e){return ne(this.getPropertyReader(e))}propKeys(){return Array.from(this.#s.keys())}propEntries(){return Array.from(this.#s.entries()).map(([e,t])=>[e,t.value])}hasContext(e){return this.#i.has(e)}useContext(e){return this.#l(e).context.get}provideContext(e){return this.#l(e).provide}#l(e){if(this.#i.has(e))return this.#i.get(e);let t=f(),r=f(),i=f(),n=new It([r,t]),o=g(n,It.Value,a=>{ar(i,a)}),l={name:e,inherited:t,provide:r,context:i,valuePath:n,unsubscribePathValue:o};return this.#i.set(e,l),this.#c(l),l}#c(e){if(e.unsubscribeParent?.(),e.unsubscribeParent=void 0,this.parent){let t=this.parent.#l(e.name),r=q(t.context,e.inherited);e.unsubscribeParent=()=>{r.destroy()}}else e.inherited.set(void 0)}};var Me=class{static get(e){return e??hr}#e=new Map;#t=new Map;define(e,t){this.#e.has(e)?ws(this.#e.get(e).constructors,t):this.#e.set(e,{token:e,constructors:[t]})}appendRoute(e,t){if(this.#t.has(e)){let r=this.#t.get(e);for(let i of t)r.add(i)}else this.#t.set(e,new Set(t))}clearRoute(e){this.#t.delete(e)}findTokensByRoute(e){let t=new Set([e]),r=this.#t.has(e)?[...this.#t.get(e)]:[];for(;r.length;){let i=r.shift();t.has(i)||(t.add(i),this.#t.has(i)&&r.push(...Array.from(this.#t.get(i)).filter(n=>!t.has(n))))}return Array.from(t)}findConstructors(e){let t=this.findTokensByRoute(e),r=new Set;for(let i of t){let n=this.#e.get(i);if(n)for(let o of n.constructors)r.add(o)}return r.size>0?Array.from(r):void 0}hasToken(e){return this.#e.has(e)}hasRoute(e){return this.#t.has(e)}clear(){this.#e.clear(),this.#t.clear()}},hr=new Me;var F;(function(s){s[s.CreateAndDestroy=0]="CreateAndDestroy",s[s.JustCreate=1]="JustCreate",s[s.DestroyOnly=2]="DestroyOnly"})(F||(F={}));var Ls=s=>s.displayName||s.name,ft=class{#e;#t;#s;#i;#r;constructor(e){this.logger=new x("Kernel"),this.#e=new Map,this.#t=new Set,this.#r=!0,w(this),this.registry=Me.get(e)}getEntity(e){let t=this.#e.get(e)?.entity;if(!t)throw new Error(`entity with uuid "${e}" not found!`);return t}hasEntity(e){return this.#e.has(e)}traverseLevelOrderBFS(e=!1){if(this.#r){let t=new Map,r=(i,n)=>{let o=this.getEntity(i);t.has(n)?t.get(n).push(o):t.set(n,[o]);for(let l of o.children)r(l.uuid,n+1)};this.#t.forEach(i=>r(i,0)),this.#s=Array.from(t.entries()).sort((i,n)=>i[0]-n[0]).map(([,i])=>i).flat(),this.#i=this.#s.slice().reverse(),this.#r=!1}return e?this.#i:this.#s}getEntityGraph(){return Array.from(this.#t).map(e=>this.getEntityGraphNode(e))}getEntityGraphNode(e){if(!this.#e.has(e))return;let{token:t,entity:r}=this.#e.get(e);return{token:t,entity:r,props:Object.fromEntries(r.propEntries()),children:r.children.map(i=>this.getEntityGraphNode(i.uuid))}}upgradeEntities(){for(let e of this.traverseLevelOrderBFS(!0))this.updateShadowObjects(e.uuid,F.DestroyOnly);for(let e of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(e.uuid,F.JustCreate)}run(e){this.logger.isDebug&&this.logger.debug("sync",e),k(()=>{for(let t of e.changeTrail)this.parse(t)})}parse(e){switch(e.type){case p.CreateEntities:this.createEntity(e.uuid,e.token,e.parentUuid,e.order,e.properties),this.#r=!0;break;case p.DestroyEntities:this.destroyEntity(e.uuid),this.#r=!0;break;case p.SetParent:this.setParent(e.uuid,e.parentUuid,e.order),this.#r=!0;break;case p.UpdateOrder:this.updateOrder(e.uuid,e.order),this.#r=!0;break;case p.ChangeProperties:this.changeProperties(e.uuid,e.properties);break;case p.ChangeToken:this.changeToken(e.uuid,e.token);break;case p.SendEvents:this.dispatchEventsToEntity(e.uuid,e.events);break}}createEntity(e,t,r,i=0,n){let o=new ct(this,e);o.order=i;let l={token:t,entity:o,usedConstructors:new Map};this.#e.set(e,l),r&&(o.parentUuid=r),o.hasParent||this.#t.add(e),n&&o.setProperties(n),this.createShadowObjects(e)}destroyEntity(e){if(!this.#e.has(e))return;let{entity:t,usedConstructors:r}=this.#e.get(e);t.removeFromParent(),c(t,X,this),r.clear(),this.#e.delete(t.uuid),this.#t.delete(t.uuid)}setParent(e,t,r=0){let i=this.getEntity(e);i.parentUuid===t&&i.order===r||(i.removeFromParent(),i.order=r,i.parentUuid=t,i.hasParent?this.#t.delete(e):this.#t.add(e),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:e,parentUuid:t,order:r,entity:i}),c(i,Rs,i)}))}updateOrder(e,t){this.getEntity(e).order=t}dispatchEventsToEntity(e,t){this.getEntity(e)?.dispatchViewEvents(t)}changeProperties(e,t){this.getEntity(e).setProperties(t)}changeToken(e,t){if(!this.#e.has(e))return;let r=this.#e.get(e);r.token!==t&&(r.token=t,this.updateShadowObjects(e))}dispatchMessageToView(e){queueMicrotask(()=>{c(this,ge,e)})}updateShadowObjects(e,t=F.CreateAndDestroy){let r=this.#e.get(e),i=new Set(this.registry.findConstructors(r.token)),n=t===F.CreateAndDestroy||t===F.DestroyOnly,o=t===F.CreateAndDestroy||t===F.JustCreate;if(n){for(let[l,a]of r.usedConstructors)if(!i.has(l)){r.usedConstructors.delete(l);for(let h of a)this.destroyShadowObject(h,r.entity)}}if(o)for(let l of i)r.usedConstructors.has(l)||this.constructShadowObject(l,r)}constructShadowObject(e,t){let r=new Set,i=new Set,n=new Map,o=new Map,l=new Map,a=w(new e({entity:t.entity,provideContext(h,u,d){let E=o.get(h);if(E===void 0){E=f(u,d?{compare:d}:void 0),o.set(h,E);let he=q(E,t.entity.provideContext(h));i.add(he.destroy.bind(he))}return E},useContext(h,u){let d=n.get(h);if(d===void 0){d=f(void 0,u?{compare:u}:void 0).get,n.set(h,d);let E=q(t.entity.useContext(h),d);i.add(E.destroy.bind(E))}return d},useProperty(h,u){let d=l.get(h);if(d===void 0){d=f(void 0,u?{compare:u}:void 0).get,l.set(h,d);let E=q(t.entity.getPropertyReader(h),d);i.add(E.destroy.bind(E))}return d},createEffect(...h){let u=b(...h);return i.add(u.destroy),u},createSignal(...h){let u=f(...h);return i.add(()=>{S(u)}),u},createMemo(...h){let u=Pt(...h);return i.add(()=>{S(u)}),u},on(...h){let u=g(...h);return i.add(u),u},once(...h){let u=v(...h);return i.add(u),u},onDestroy(h){r.add(h)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",Ls(e),{shadowObject:a,entity:t.entity}),v(t.entity,X,se.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",Ls(e),{shadowObject:a,entity:t.entity});for(let u of r)u();for(let u of i)u();for(let u of n.values())S(u);for(let u of l.values())S(u);for(let u of o.values())S(u);r.clear(),i.clear(),n.clear(),l.clear(),o.clear();let h=t.usedConstructors.get(e);h&&(h.delete(a),h.size===0&&t.usedConstructors.delete(e))}),t.usedConstructors.has(e)?t.usedConstructors.get(e).add(a):t.usedConstructors.set(e,new Set([a])),this.attachShadowObject(a,t.entity),a}createShadowObjects(e){let t=this.#e.get(e);this.registry.findConstructors(t.token)?.forEach(r=>{this.constructShadowObject(r,t)})}findShadowObjects(e){if(!this.#e.has(e))return[];let{usedConstructors:t}=this.#e.get(e);return Array.from(new Set(Array.from(t.values()).map(r=>Array.from(r)).flat()))}attachShadowObject(e,t){g(t,e),typeof e[Wt]=="function"&&e[Wt](t)}destroyShadowObject(e,t){typeof e[X]=="function"&&e[X](t),c(e,X,t),y(t,e)}destroy(){for(let e of this.traverseLevelOrderBFS().reverse())this.destroyEntity(e.uuid)}};async function Vt(s,e,t,r=!0){if(t.has(e)){console.warn("importModule: skipping already imported module",e);return}else t.add(e);e.extends&&await Promise.all(e.extends.map(n=>Vt(s,n,t,!1)));let{registry:i}=s;if(e.define)for(let[n,o]of Object.entries(e.define))i.define(n,o);if(e.routes)for(let[n,o]of Object.entries(e.routes))i.appendRoute(n,o);await(e.initialize?.({define:(n,o)=>i.define(n,o),kernel:s,registry:i})??Promise.resolve()),r&&s.upgradeEntities()}var dt=s=>(typeof s=="string"&&(s=new URL(s,globalThis.location.href)),s.toString());function _s(s){return s.map(e=>{if(e.transferables&&e.transferables.length>0){let{transferables:t,...r}=e;return structuredClone(r,{transfer:t})}else return structuredClone(e)})}var pt=class{#e;get registry(){return this.kernel.registry}constructor(e){this.#e=new Set,this.isLocalEnv=!0,this.disableStructuredClone=!1,this.kernel=new ft(e),g(this.kernel,ge,t=>{if(this.onMessageToView!=null){let{type:r,uuid:i,traverseChildren:n}=t,o=structuredClone(t.data,{transfer:t.transferables});this.onMessageToView({type:r,uuid:i,data:o,traverseChildren:n})}})}start(){return Promise.resolve()}applyChangeTrail(e,t){let r={changeTrail:this.disableStructuredClone?e:_s(e)},i;try{this.kernel.run(r),i=Promise.resolve()}catch(n){i=Promise.reject(n)}return i}async importScript(e){let t=await import(dt(e));t[Rt]&&await this.importModule(t[Rt])}async importModule(e){return Vt(this.kernel,e,this.#e)}destroy(){this.kernel.destroy(),this.registry.clear(),this.#e.clear()}};function zt(s){let e=new Blob([s],{type:"text/javascript"}),t=URL.createObjectURL(e),r=new Worker(t);return URL.revokeObjectURL(t),r}function Bt(){return zt('var js=Object.defineProperty;var Ye=Object.getOwnPropertySymbols;var Tt=Object.prototype.hasOwnProperty,Dt=Object.prototype.propertyIsEnumerable;var Ms=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Lt=e=>{throw TypeError(e)};var it=(e,t,s)=>t in e?js(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,at=(e,t)=>{for(var s in t||(t={}))Tt.call(t,s)&&it(e,s,t[s]);if(Ye)for(var s of Ye(t))Dt.call(t,s)&&it(e,s,t[s]);return e};var Rt=(e,t)=>{var s={};for(var r in e)Tt.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(e!=null&&Ye)for(var r of Ye(e))t.indexOf(r)<0&&Dt.call(e,r)&&(s[r]=e[r]);return s};var u=(e,t,s)=>it(e,typeof t!="symbol"?t+"":t,s),nt=(e,t,s)=>t.has(e)||Lt("Cannot "+s);var i=(e,t,s)=>(nt(e,t,"read from private field"),s?s.call(e):t.get(e)),f=(e,t,s)=>t.has(e)?Lt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),g=(e,t,s,r)=>(nt(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),b=(e,t,s)=>(nt(e,t,"access private method"),s);var Nt=(e,t,s,r)=>({set _(a){g(e,t,a,s)},get _(){return i(e,t,r)}});var ot=function(e,t){this[0]=e,this[1]=t},xt=(e,t,s)=>{var r=(n,h,l,d)=>{try{var p=s[n](h),c=(h=p.value)instanceof ot,v=p.done;Promise.resolve(c?h[0]:h).then(E=>c?r(n==="return"?n:"next",h[1]?{done:E.done,value:E.value}:E,l,d):l({value:E,done:v})).catch(E=>r("throw",E,l,d))}catch(E){d(E)}},a=n=>o[n]=h=>new Promise((l,d)=>r(n,h,l,d)),o={};return s=s.apply(e,t),o[Ms("asyncIterator")]=()=>o,a("next"),a("throw"),a("return"),o};var Vt;(function(e){e[e.StructuralChanges=1]="StructuralChanges",e[e.ContentUpdates=2]="ContentUpdates",e[e.Removal=3]="Removal"})(Vt||(Vt={}));var q;(function(e){e[e.CreateEntities=1]="CreateEntities",e[e.DestroyEntities=2]="DestroyEntities",e[e.SetParent=3]="SetParent",e[e.UpdateOrder=4]="UpdateOrder",e[e.ChangeProperties=5]="ChangeProperties",e[e.ChangeToken=6]="ChangeToken",e[e.SendEvents=7]="SendEvents"})(q||(q={}));var Lr=Symbol.for("ShadowEntsGlobalNS"),Ts="configure",Ds="changeTrail",Ls="destroy",Rs="loaded",Ft="appliedChangeTrail",ht="importedModule",Ns="destroyed",yt="messageToView",lt="shadowObjects",N="ConsoleLogger",M=`${N}Storage`,Xt,_t,es,xs=!!((es=(_t=(Xt=globalThis.location)==null?void 0:Xt.host)==null?void 0:_t.startsWith("localhost"))!=null&&es),Ve="localStorage"in globalThis,He=Symbol.for(N),zt=!1,It=e=>{if(typeof e=="boolean")return e;switch(e.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},pt=e=>[Ve?N:void 0,...Array.isArray(e)?e:[e]].filter(Boolean).join(".");function dt(e,t=void 0,s){var o;let r=pt(e),a=Ve?localStorage.getItem(r):(o=globalThis[M])==null?void 0:o[r];return a!=null?t(a):s}function Te(e,t){Ve?localStorage.setItem(pt(e),t):(globalThis[M]==null&&(globalThis[M]={},console.debug(`${N}: Initialize`,{[M]:globalThis[M]})),globalThis[M][pt(e)]=t)}var oe,Le,y,Vs=(y=class{constructor(t){f(this,oe);this.enable=!0,this.namespace=(t||"").trim()||N,zt||(y.loadConfig(),zt=!0);let s=[this.namespace,"enable"];this.enable=dt(s,It,this.enable),Te(s,Ve?this.enable?"true":"false":this.enable)}static get isEnabled(){return y.sharedConfig.enable}static get isDebug(){return y.sharedConfig.enable&&y.sharedConfig.debug}static loadConfig(){var t,s,r;Ve?(["enable","debug","info","warn"].forEach(a=>{this.sharedConfig[a]=dt(a,It,this.sharedConfig[a])}),["debug","info","warn","error"].forEach(a=>{this.sharedStyles[a]=dt(["styles",a],void 0,this.sharedStyles[a])}),y.isDebug&&console.debug(`${N}: Load config from localStorage`,y.sharedConfig),(t=globalThis[N])!=null&&t[He]||((s=globalThis[N])!=null||(globalThis[N]={[He]:!0,get enable(){return y.sharedConfig.enable},set enable(a){y.sharedConfig.enable=a,Te("enable",a?"true":"false")},get debug(){return y.sharedConfig.debug},set debug(a){y.sharedConfig.debug=a,Te("debug",a?"true":"false")},get info(){return y.sharedConfig.info},set info(a){y.sharedConfig.info=a,Te("info",a?"true":"false")},get warn(){return y.sharedConfig.warn},set warn(a){y.sharedConfig.warn=a,Te("warn",a?"true":"false")}}))):(r=globalThis[M])!=null&&r[He]||(globalThis[M]=at(at({[He]:!0},y.sharedConfig),globalThis[M]),y.sharedConfig=globalThis[M],y.isDebug&&console.debug(`${N}: Load config from ${M}`,globalThis[M]))}get isEnabled(){return this.enable&&y.sharedConfig.enable}get isDebug(){return this.isEnabled&&y.sharedConfig.debug}get isInfo(){return this.isEnabled&&y.sharedConfig.info}get isWarn(){return this.isEnabled&&y.sharedConfig.warn}debug(...t){b(this,oe,Le).call(this,"debug",y.sharedStyles.debug,t)}info(...t){b(this,oe,Le).call(this,"info",y.sharedStyles.info,t)}warn(...t){b(this,oe,Le).call(this,"warn",y.sharedStyles.warn,t)}error(...t){b(this,oe,Le).call(this,"error",y.sharedStyles.error,t)}},oe=new WeakSet,Le=function(t,s,r){console[t](`%c${this.namespace}`,s,...r)},y.sharedConfig={enable:xs,debug:!1,info:!0,warn:!0,"styles.debug":"color: #111; background: #999; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.info":"color: #020; background: #8a8; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.warn":"color: #fa0; background: #a98; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.error":"color: #ff0; background: #a00; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em"},y.sharedStyles={get debug(){return y.sharedConfig["styles.debug"]},set debug(t){y.sharedConfig["styles.debug"]=t},get info(){return y.sharedConfig["styles.info"]},set info(t){y.sharedConfig["styles.info"]=t},get warn(){return y.sharedConfig["styles.warn"]},set warn(t){y.sharedConfig["styles.warn"]=t},get error(){return y.sharedConfig["styles.error"]},set error(t){y.sharedConfig["styles.error"]=t}},y),ye="*",ls=1,At=2,kt=4,ae=Symbol.for("eventize"),Fs="[eventize]",tt=e=>e===ye,ds=e=>{switch(typeof e){case"string":case"symbol":return!0;default:return!1}},us=typeof console<"u",zs=us?console[console.warn?"warn":"log"].bind(console,Fs):()=>{},Is=(e,t,s)=>(Object.defineProperty(e,t,{value:s,configurable:!0}),e),Us=0,cs=class{constructor(){u(this,"events",new Map);u(this,"eventNames",new Set)}static publish(e){e.sort((t,s)=>t.order-s.order).forEach(t=>t.emit())}add(e){Array.isArray(e)?e.forEach(t=>this.eventNames.add(t)):this.eventNames.add(e)}remove(e){Array.isArray(e)?e.forEach(t=>this.eventNames.delete(t)):this.eventNames.delete(e),this.clear(e)}clear(e){Array.isArray(e)?e.forEach(t=>this.events.delete(t)):this.events.delete(e)}retain(e,t){this.eventNames.has(e)&&this.events.set(e,{args:t,order:Us++})}isKnown(e){return this.eventNames.has(e)}emit(e,t,s=[]){if(tt(e))this.eventNames.forEach(r=>this.emit(r,t,s));else if(this.events.has(e)){let{order:r,args:a}=this.events.get(e);s.push({order:r,emit:()=>t.apply(e,a)})}return s}},vt=(e,t,s,r)=>{if(typeof t=="function"){let a=t.apply(e,s);a!=null&&(r==null||r(a))}},Gs=(e,t,s,r)=>vt(t,t.emit,[e].concat(s),r),$s=e=>{switch(typeof e){case"function":return ls;case"string":case"symbol":return At;case"object":return kt}},Bs=0,Ws=()=>++Bs,fs=class{constructor(e,t,s,r=null){u(this,"id");u(this,"eventName");u(this,"isCatchEmAll");u(this,"priority");u(this,"listener");u(this,"listenerObject");u(this,"listenerType");u(this,"callAfterApply");u(this,"isRemoved");u(this,"refCount");this.id=Ws(),this.eventName=e,this.isCatchEmAll=tt(e),this.listener=s,this.listenerObject=r,this.priority=t,this.listenerType=$s(s),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(e,t=null){if(e===this)return!0;let s=typeof e;return s==="number"&&e===this.id?!0:t===null&&(s==="string"||s==="symbol")?e===ye||e===this.eventName:this.listener===e&&this.listenerObject===t}apply(e,t,s){if(this.isRemoved)return;let{listener:r,listenerObject:a}=this;switch(this.listenerType){case ls:vt(a,r,t,s),this.callAfterApply&&this.callAfterApply();break;case At:vt(a,a[r],t,s),this.callAfterApply&&this.callAfterApply();break;case kt:{let o=r[e];if(this.isCatchEmAll||this.eventName===e){if(typeof o=="function"){let n=o.apply(r,t);n!=null&&(s==null||s(n))}else Gs(e,r,t,s);this.callAfterApply&&this.callAfterApply()}break}}}},qs=(e,t)=>e.priority!==t.priority?t.priority-e.priority:e.id-t.id,Ut=e=>e==null?void 0:e.slice(0),Gt=(e,t)=>{let s=e.indexOf(t);s>-1&&e.splice(s,1)},Js=e=>e===kt||e===At,bt=(e,t,s)=>{let r=e.findIndex(a=>a.isEqual(t,s));r>-1&&(e[r].isRemoved=!0,e.splice(r,1))},Qe=(e,t,s)=>{let r=[];for(let a of e)(t==null&&a.listenerObject===s||a.eventName===t&&a.listener===s)&&r.push(a);for(let a of r)bt(e,a,void 0)},ut=e=>{e&&(e.forEach(t=>{t.isRemoved=!0}),e.length=0)},Ks=(e,t)=>e.listenerType===t.listenerType?e.priority===t.priority&&e.eventName===t.eventName&&e.listenerObject===t.listenerObject&&e.listener===t.listener:!1,Ys=(e,t)=>{if(Js(e.listenerType))return t.find(s=>Ks(e,s))},Hs=(e,t)=>{let s=Ys(e,t);return s?(s.refCount+=1,s):(t.push(e),t.sort(qs),e)},Qs=class{constructor(){u(this,"namedListeners");u(this,"catchEmAllListeners");u(this,"getListenersForEventName",e=>{let t=this.namedListeners.get(e);return t||(t=[],this.namedListeners.set(e,t)),t});this.namedListeners=new Map,this.catchEmAllListeners=[]}add(e){return Hs(e,e.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(e.eventName))}remove(e,t,s=!1){t==null&&Array.isArray(e)?e.forEach(r=>this.remove(r,null,s)):e==null||t==null&&tt(e)?this.removeAllListeners():t==null&&ds(e)?ut(this.namedListeners.get(e)):e instanceof fs?e.isRemoved||(e.refCount-=1,e.refCount<1&&(e.isRemoved=!0,this.namedListeners.forEach(r=>Gt(r,e)),Gt(this.catchEmAllListeners,e))):s?tt(e)?Qe(this.catchEmAllListeners,ye,e):this.namedListeners.forEach(r=>Qe(r,e,t)):(this.namedListeners.forEach(r=>{bt(r,e,t),Qe(r,void 0,e)}),bt(this.catchEmAllListeners,e,t),Qe(this.catchEmAllListeners,void 0,e))}removeAllListeners(){this.namedListeners.forEach(e=>ut(e)),this.namedListeners.clear(),ut(this.catchEmAllListeners)}forEach(e,t){let s=Ut(this.catchEmAllListeners),r=Ut(this.namedListeners.get(e));if(e===ye||!r||r.length===0)s.forEach(t);else if(s.length===0)r.forEach(t);else{let a=r.length,o=s.length,n=0,h=0;for(;n<a||h<o;){if(n<a){let l=r[n];if(h>=o||l.priority>=s[h].priority){t(l),++n;continue}}h<o&&(t(s[h]),++h)}}}getSubscriptionCount(){let e=this.catchEmAllListeners.length;for(let t of this.namedListeners.values())e+=t.length;return e}},je=e=>!!(e&&e[ae]);function Fe(e){if(je(e))return e;let t=new Qs,s=new cs;return Is(e,ae,{keeper:s,store:t}),e}var Ot={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},Zs=(e,t,s,r,a,o,n)=>{let h=e.add(new fs(s,r,a,o));return t.emit(s,h,n),h},Xs=(e,t,s,r)=>{let a=s.length,o=typeof s[0],n,h,l,d;if(a>=2&&a<=3&&o==="number"?(n=ye,[h,l,d]=s):a>=3&&a<=4&&typeof s[1]=="number"?[n,h,l,d]=s:(h=Ot.Default,o==="string"||o==="symbol"||Array.isArray(s[0])?[n,l,d]=s:(n=ye,[l,d]=s)),!l&&us)throw zs("called with insufficient arguments!",s),"subscribeTo() called with insufficient arguments!";let p=c=>v=>Zs(e,t,v,c,l,d,r);return Array.isArray(n)?n.map(c=>Array.isArray(c)?p(c[1])(c[0]):p(h)(c)):p(h)(n)},gs=(e,t,s)=>{let r=[],a=Xs(e,t,s,r);return cs.publish(r),a},$t=e=>t=>{t.callAfterApply=()=>{e==null||e()}},ys=(e,t)=>Object.assign(()=>T(e,t),Array.isArray(t)?{listeners:t}:{listener:t}),ps=(e,t,s,r)=>{let{store:a,keeper:o}=e[ae];Array.isArray(t)?t.forEach(n=>{a.forEach(n,h=>h.apply(n,s,r)),o.retain(n,s)}):t!==ye&&(a.forEach(t,n=>{n.apply(t,s,r)}),o.retain(t,s))},se=(e,...t)=>{let s=Fe(e),{store:r,keeper:a}=s[ae];return ys(s,gs(r,a,t))},k=(e,...t)=>{let s=Fe(e),{store:r,keeper:a}=s[ae],o=gs(r,a,t),n=ys(s,o),h=!1,l=()=>{h||(n(),h=!0)};return Array.isArray(o)?o.forEach($t(l)):$t(l)(o),l},_s=(e,t)=>new Promise(s=>{k(e,t,s)}),T=(e,t,s)=>{if(!je(e))throw new Error("object is not eventized");let{store:r,keeper:a}=e[ae],o=typeof t,n=s!=null&&(o==="string"||o==="symbol");r.remove(t,s,n),Array.isArray(t)?a.remove(t.filter(h=>typeof h=="string")):ds(t)&&a.remove(t)},m=(e,t,...s)=>{if(!je(e))throw new Error("object is not eventized");ps(e,t,s)},er=(e,t,...s)=>{if(!je(e))throw new Error("object is not eventized");let r=[];return ps(e,t,s,a=>{r.push(a)}),r=r.map(a=>Array.isArray(a)?Promise.all(a):Promise.resolve(a)),r.length>0?Promise.all(r):Promise.resolve()},Pt=(e,t)=>{let s=Fe(e),{keeper:r}=s[ae];r.add(t)},st=(e,t)=>{if(!je(e))throw new Error("object is not eventized");let{keeper:s}=e[ae];s.clear(t)},re=(()=>{let e=(t={})=>Fe(t);return e.inject=(t={})=>(t=Fe(t),Object.assign(t,{on:(...s)=>se(t,...s),once:(...s)=>k(t,...s),onceAsync:s=>_s(t,s),off:(s,r)=>T(t,s,r),emit:(s,...r)=>m(t,s,...r),emitAsync:(s,...r)=>er(t,s,...r),retain:s=>Pt(t,s),retainClear:s=>st(t,s)}),t),e.is=je,e})(),Ne=re(),Pe=re(),me=re(),gt,Ue,Re=(gt=class{constructor(){f(this,Ue,new Set)}batch(e){i(this,Ue).add(e)}run(){m(me,Array.from(i(this,Ue)))}},Ue=new WeakMap,u(gt,"current"),gt),tr=()=>Re.current;function rt(e){let t=Re.current;t?t=void 0:t=Re.current=new Re;try{e()}finally{t&&(Re.current=void 0,t.run())}}var sr=0;function vs(){return sr>0}var W=Symbol.for("signal"),ve=Symbol.for("effect"),Bt=Symbol.for("destroySignal"),Wt=Symbol.for("createEffect"),rr=Symbol.for("destroyEffect"),De="value",qt="mute",Jt="unmute",xe="destroy",Z=new Map,U,he,x,K,G,le,de,V,Q,qe=(Q=class{constructor(t){f(this,U,new Set);f(this,he,new Set);f(this,x,new Map);f(this,K,new WeakMap);f(this,G,new Map);f(this,le,new Set);f(this,de,new Set);f(this,V);if(t!=null&&t instanceof Q)return t;if(t!=null||(t=this),Z.has(t))return Z.get(t);Z.set(t,this),re(this)}static get(t){if(t!=null)return t instanceof Q?t:Z.get(t)}static findOrCreate(t){if(t==null)throw new Error("Cannot create a group with a null object");return new Q(t)}static destroy(t){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),Q.delete(t)}static delete(t){var s;(s=Z.get(t))==null||s.clear()}static clear(){for(let t of Z.values())t.destroy();Z.clear()}attachGroup(t){if(t===this)throw new Error("Cannot attach a group to itself");return i(this,U).add(t),i(t,V)&&i(t,V)!==this&&i(i(t,V),U).delete(t),g(t,V,this),t}detachGroup(t){return t!==this&&i(this,U).has(t)&&(i(this,U).delete(t),g(t,V,void 0)),t}attachSignal(t){let s=C(t);if(s!=null&&s.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return s&&i(this,he).add(s),t}attachSignalByName(t,s){if(s){this.attachSignal(s);let r=C(s);i(this,x).set(t,r),i(this,G).has(t)?i(this,G).get(t).push(r):i(this,G).set(t,[r]),i(this,K).has(r)?i(this,K).get(r).add(t):i(this,K).set(r,new Set([t]))}else i(this,x).delete(t);return s}hasSignal(t){var s;return i(this,x).has(t)||((s=i(this,V))==null?void 0:s.hasSignal(t))}signal(t){var s,r,a;return(a=(s=i(this,x).get(t))==null?void 0:s.object)!=null?a:(r=i(this,V))==null?void 0:r.signal(t)}detachSignal(t){let s=C(t);if(s&&(i(this,he).delete(s),i(this,K).has(s))){let r=i(this,K).get(s);for(let a of r)if(i(this,G).has(a)){let o=i(this,G).get(a);o.splice(o.indexOf(s),1),o.length===0?(i(this,x).delete(a),i(this,G).delete(a)):i(this,x).get(a)===s&&i(this,x).set(a,o.at(-1))}r.clear(),i(this,K).delete(s)}return t}attachEffect(t){return i(this,le).add(t),t}runEffects(){for(let t of i(this,le))t.run();for(let t of i(this,U))t.runEffects()}attachLink(t){if(t!=null&&t.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return t&&i(this,de).add(t),t}detachLink(t){return t&&i(this,de).delete(t),t}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){var t;m(this,xe,this),T(this);for(let s of i(this,U))s.destroy();for(let s of i(this,le))s.destroy();for(let s of i(this,he))X(s);for(let s of i(this,de))s.destroy();i(this,U).clear(),i(this,he).clear(),i(this,x).clear(),i(this,G).clear(),i(this,le).clear(),i(this,de).clear(),(t=i(this,V))==null||t.detachGroup(this),Z.delete(this)}},U=new WeakMap,he=new WeakMap,x=new WeakMap,K=new WeakMap,G=new WeakMap,le=new WeakMap,de=new WeakMap,V=new WeakMap,Q),ts,ir=(ts=ve,class{constructor(e){u(this,ts);u(this,"run",()=>{var e;return(e=this[ve])==null?void 0:e.run()});u(this,"destroy",()=>{var e;(e=this[ve])==null||e.destroy(),this[ve]=void 0});this[ve]=e,k(e,ws.Destroy,()=>{this[ve]=void 0})}}),Ge,$e,ss,bs=(ss=class{constructor(e="id",t=1){f(this,Ge);f(this,$e);g(this,Ge,e),g(this,$e,t)}make(){return Symbol(`${i(this,Ge)}${Nt(this,$e)._++}`)}},Ge=new WeakMap,$e=new WeakMap,ss),mt=[],ms=()=>mt.at(-1),ar=(e,t)=>{mt.push(e);try{return t()}finally{mt.pop()}},nr=e=>e!=null&&typeof e.then=="function",A,_,ee,ue,ce,Ce,ws=(A=class{constructor(t,s){u(this,"id");u(this,"callback");f(this,_);f(this,ee,new Set);f(this,ue,new Set);u(this,"parentEffect");u(this,"childEffects",[]);u(this,"curChildEffectSlot",0);u(this,"autorun",!0);u(this,"shouldRun",!0);f(this,ce);f(this,Ce,!1);u(this,"run",()=>{if(i(this,Ce)||!this.shouldRun)return;let t=tr();t?t.batch(this.id):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,this.hasStaticDeps()?g(this,_,this.callback()):g(this,_,ar(this,this.callback)))});u(this,"destroy",()=>{i(this,Ce)||(m(this,A.Destroy,this),T(this),m(me,rr,this),this.runCleanupCallback(),T(Ne,this),T(me,this),T(Pe,this),g(this,Ce,!0),i(this,ee).clear(),i(this,ue).clear(),this.childEffects.forEach(t=>{t.destroy()}),this.childEffects.length=0,--A.count)});var a;re(this),this.callback=t;let r;(s==null?void 0:s.attach)!=null&&(r=qe.findOrCreate(s.attach),r.attachEffect(this)),this.autorun=(a=s==null?void 0:s.autorun)!=null?a:!0,g(this,ce,s!=null&&s.dependencies?s.dependencies.map(o=>{switch(typeof o){case"string":case"symbol":return r.signal(o);default:return o}}):void 0),this.id=A.idGen.make(),se(me,this.id,"recall",this),++A.count}hasStaticDeps(){return i(this,ce)!=null&&i(this,ce).length>0}saveSignalsFromDeps(){for(let t of i(this,ce))this.whenSignalIsRead(C(t).id)}static createEffect(t,s,r){let a=Array.isArray(s)?s:void 0,o=a?r!=null?r:{dependencies:a}:s;o&&a&&(o.dependencies=a);let n,h=ms();return h!=null?(n=h.getCurrentChildEffect(),n==null&&(n=new A(t,o),h.attachChildEffect(n),m(me,Wt,n)),h.curChildEffectSlot++):(n=new A(t,o),m(me,Wt,n)),n.hasStaticDeps()?n.saveSignalsFromDeps():n.autorun&&n.run(),new ir(n)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(t){this.childEffects.push(t),this.parentEffect=this}recall(){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(t){i(this,ee).has(t)||(i(this,ee).add(t),se(Ne,t,"recall",this),k(Pe,t,Bt,this))}[Bt](t){!i(this,ue).has(t)&&i(this,ee).has(t)&&(i(this,ue).add(t),T(Ne,t,this),i(this,ue).size===i(this,ee).size&&this.destroy())}runCleanupCallback(){if(i(this,_)!=null){let t=i(this,_);g(this,_,void 0),nr(t)?Promise.resolve(t).then(s=>{typeof s=="function"&&s()}):t()}}},_=new WeakMap,ee=new WeakMap,ue=new WeakMap,ce=new WeakMap,Ce=new WeakMap,u(A,"idGen",new bs("ef")),u(A,"Destroy","destroy"),u(A,"count",0),A),Je=(...e)=>ws.createEffect(...e),ze=new WeakMap,or=e=>{let t=ze.get(e);return t||(t={},ze.set(e,t)),t},Ie=(e,t)=>{var s,r;return(r=(s=ze.get(e))==null?void 0:s.signals)==null?void 0:r.get(t)},hr=(e,t,s)=>{var a;let r=or(e);(a=r.signals)!=null||(r.signals=new Map),r.signals.set(t,s)};function lr(...e){for(let t of e)if(ze.has(t)){let s=ze.get(t);if(s.signals){for(let r of s.signals.values())X(r);s.signals.clear(),s.signals=void 0}}}function dr(e){let t=C(Mt(e)?e:Ie(...e));t!=null&&!t.muted&&!t.destroyed&&wt(t.id,t.value,{touch:!0})}function jt(e){var t,s;return Mt(e)?(t=C(e))==null?void 0:t.value:(s=C(Ie(...e)))==null?void 0:s.value}var rs,ur=(rs=W,class{constructor(e){u(this,rs);this[W]=e}get get(){return this[W].reader}get set(){return this[W].writer}get value(){return jt(this.get)}set value(e){this.set(e)}onChange(e){let{destroy:t}=Je(()=>e(this.value),[this.get]);return t}get muted(){return this[W].muted}set muted(e){this[W].muted=e}touch(){dr(this)}destroy(){X(this)}}),cr=new bs("si");function Kt(e){var t;vs()||((t=ms())==null||t.whenSignalIsRead(e))}function wt(e,t,s){vs()||m(Ne,e,t,s)}var Mt=e=>e!=null&&e[W]!=null,fr=e=>{let t=s=>{var r;return s?Je(()=>(e.destroyed||Kt(e.id),s(e.value)),[t]):e.destroyed||((r=e.beforeRead)==null||r.call(e),Kt(e.id)),e.value};return Object.defineProperty(t,W,{value:e}),t},fe,F,Cs=(fe=class{constructor(t,s){u(this,"id");u(this,"lazy");u(this,"compare");u(this,"beforeRead");u(this,"muted",!1);u(this,"destroyed",!1);f(this,F);u(this,"valueFn");u(this,"reader");u(this,"writer",(t,s)=>{var o,n,h,l;let r=(o=s==null?void 0:s.lazy)!=null?o:!1,a=(h=(n=s==null?void 0:s.compare)!=null?n:this.compare)!=null?h:(d,p)=>d===p;if((r!==this.lazy||r&&t!==this.valueFn||!r&&!a(t,i(this,F)))&&(r?(g(this,F,void 0),this.valueFn=t,this.lazy=!0):(g(this,F,t),this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){wt(this.id,i(this,F));return}(l=s==null?void 0:s.touch)!=null&&l&&wt(this.id,i(this,F),{touch:!0})});u(this,"object");this.id=cr.make(),++fe.instanceCount,this.lazy=t,this.lazy?(this.value=void 0,this.valueFn=s):(this.value=s,this.valueFn=void 0),this.reader=fr(this),this.object=new ur(this)}get[W](){return this}get value(){return this.lazy&&(g(this,F,this.valueFn()),this.valueFn=void 0,this.lazy=!1),i(this,F)}set value(t){g(this,F,t)}},F=new WeakMap,u(fe,"instanceCount",0),fe),C=e=>e==null?void 0:e[W];function I(e=void 0,t){var r;let s;if(Mt(e))s=C(e);else{let a=(r=t==null?void 0:t.lazy)!=null?r:!1;s=new Cs(a,e),s.beforeRead=t==null?void 0:t.beforeRead,s.compare=t==null?void 0:t.compare}return(t==null?void 0:t.attach)!=null&&qe.findOrCreate(t.attach).attachSignal(s),s.object}var X=(...e)=>{for(let t of e){let s=C(t);s!=null&&!s.destroyed&&(s.destroyed=!0,s.beforeRead=void 0,--Cs.instanceCount,m(Pe,s.id,s.id))}};function gr(e,t){let s=I(),r=(t==null?void 0:t.attach)!=null?qe.findOrCreate(t.attach):void 0;r!=null&&(t!=null&&t.name?r.attachSignalByName(t.name,s):r.attachSignal(s));let a=Je(()=>s.set(e()),{autorun:!1,attach:r}),o=C(s);return o.beforeRead=a.run,k(Pe,o.id,a.destroy),s.get}var S,Ee,is,Es=(is=class{constructor(e){f(this,S,!1);f(this,Ee);u(this,"source");u(this,"lastValue");u(this,"isDestroyed",!1);re(this),this.source=C(e),g(this,Ee,se(Ne,this.source.id,(t,s)=>{!i(this,S)&&!this.isDestroyed&&((s==null?void 0:s.touch)===!0?this.touch():this.write())})),k(Pe,this.source.id,()=>this.destroy())}attach(e){let t=qe.findOrCreate(e);return t.attachLink(this),k(this,xe,()=>{t.detachLink(this)}),t}nextValue(){return new Promise((e,t)=>{let s=[],r=()=>s.forEach(a=>{a()});s.push(k(this,De,a=>{r(),e(a)}),k(this,xe,()=>{r(),t()}))})}asyncValues(e){return xt(this,null,function*(){let t=0;for(;!this.isDestroyed;)try{let s=yield new ot(this.nextValue());if(e&&e(s,t++))break;Pt(this,De),yield s}catch(s){break}st(this,De)})}destroy(){var e;this.isDestroyed||((e=i(this,Ee))==null||e.call(this),g(this,Ee,void 0),m(this,xe,this),st(this,De),T(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return i(this,S)}mute(){return!this.isDestroyed&&!i(this,S)&&(g(this,S,!0),m(this,qt,this)),this}unmute(){return!this.isDestroyed&&i(this,S)&&(g(this,S,!1),m(this,Jt,this)),this}toggle(){return this.isDestroyed||(g(this,S,!i(this,S)),m(this,i(this,S)?qt:Jt,this)),i(this,S)}updateValue(e){if(!i(this,S)&&!this.isDestroyed){let{value:t}=this.source;e(t),m(this,De,t),this.lastValue=t}}},S=new WeakMap,Ee=new WeakMap,is),yr=class extends Es{constructor(t,s){super(t);u(this,"target");this.target=C(s),k(Pe,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(t=>{this.target.writer(t,{touch:!0})}),this}write(){this.updateValue(t=>{this.target.writer(t)})}},pr=class extends Es{constructor(t,s){super(t);u(this,"target");this.target=s,this.touch()}touch(){return this.updateValue(t=>{this.target(t)}),this}write(){this.updateValue(t=>{this.target(t)})}},Ze=new Map;function Xe(e,t,s){var d;let r=C(e),a;if(Ze.has(r)){a=Ze.get(r);let p=(d=C(t))!=null?d:t;if(a.has(p))return a.get(p)}else a=new Map,Ze.set(r,a);let o=C(t),n=o!=null?new yr(e,o):new pr(e,t),h=s==null?void 0:s.attach;h&&n.attach(h);let l=o!=null?o:t;return a.set(l,n),k(n,xe,()=>{a.delete(l),a.size===0&&Ze.delete(r)}),n}var O,Se,vr=(Se=class{constructor(){f(this,O,new Map)}static fromProps(t,s){let r=new Se,a=s?s.map(o=>[o,t[o]]):Object.entries(t);for(let[o,n]of a)i(r,O).set(o,I(n));return r}keys(){return i(this,O).keys()}signals(){return i(this,O).values()}entries(){return i(this,O).entries()}clear(){for(let t of i(this,O).values())t.destroy();i(this,O).clear()}has(t){return i(this,O).has(t)}get(t){if(!i(this,O).has(t)){let s=I();return i(this,O).set(t,s),s}return i(this,O).get(t)}update(t){t.size&&rt(()=>{for(let[s,r]of t.entries())this.get(s).set(r)})}updateFromProps(t,s){rt(()=>{let r=s?s.map(a=>[a,t[a]]):Object.entries(t);for(let[a,o]of r)this.get(a).set(o)})}},O=new WeakMap,Se);function br(e,t,s,r,a,o){function n(Me){if(Me!==void 0&&typeof Me!="function")throw new TypeError("Function expected");return Me}for(var h=r.kind,l=h==="getter"?"get":h==="setter"?"set":"value",d=!t&&e?r.static?e:e.prototype:null,p=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),c,v=!1,E=s.length-1;E>=0;E--){var Ke={};for(var pe in r)Ke[pe]=pe==="access"?{}:r[pe];for(var pe in r.access)Ke.access[pe]=r.access[pe];Ke.addInitializer=function(Me){if(v)throw new TypeError("Cannot add initializers after decoration has completed");o.push(n(Me||null))};var ne=(0,s[E])(h==="accessor"?{get:p.get,set:p.set}:p[l],Ke);if(h==="accessor"){if(ne===void 0)continue;if(ne===null||typeof ne!="object")throw new TypeError("Object expected");(c=n(ne.get))&&(p.get=c),(c=n(ne.set))&&(p.set=c),(c=n(ne.init))&&a.unshift(c)}else(c=n(ne))&&(h==="field"?a.unshift(c):p[l]=c)}d&&Object.defineProperty(d,r.name,p),v=!0}function Yt(e,t,s){for(var r=arguments.length>2,a=0;a<t.length;a++)s=r?t[a].call(e,s):t[a].call(e);return r?s:void 0}function mr(e){return function(t,s){var o;let r=(e==null?void 0:e.name)||s.name,a=!!((o=e==null?void 0:e.readAsValue)!=null&&o);return{get(){let n=Ie(this,r);if(n)return a?n.value:n.get()},set(n){var h;(h=Ie(this,r))==null||h.set(n)},init(n){let h=I(n,e);return hr(this,r,h),qe.findOrCreate(this).attachSignalByName(r,h),h.value}}}}var be="value",Ht=(()=>{var r,a,o,n,Ct,Et,d;let e,t=[],s=[];return d=class{constructor(c){f(this,n);f(this,r);f(this,a);f(this,o);g(this,r,[]),g(this,o,Yt(this,t,void 0)),this.value$=Yt(this,s),Pt(this,be),this.value$=Ie(this,be),this.value$.onChange(v=>m(this,be,v)),c&&this.add(...c)}get value(){return i(this,o)}set value(c){g(this,o,c)}add(...c){for(let v of c)i(this,r).push(v);b(this,n,Et).call(this)}pop(){i(this,r).pop(),b(this,n,Et).call(this)}clear(){i(this,r).length=0,b(this,n,Ct).call(this)}dispose(){this.clear(),st(this,be),T(this),lr(this),this.value$.destroy()}},r=new WeakMap,a=new WeakMap,o=new WeakMap,n=new WeakSet,Ct=function(){var c;(c=i(this,a))==null||c.destroy(),g(this,a,void 0)},Et=function(){b(this,n,Ct).call(this),g(this,a,Je(()=>{for(let c of i(this,r)){let v=jt(c);if(v!=null){this.value=v;return}}this.value=void 0},i(this,r))),i(this,a).run()},(()=>{let c=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[mr({name:be})],br(d,null,e,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:v=>"value"in v,get:v=>v.value,set:(v,E)=>{v.value=E}},metadata:c},t,s),c&&Object.defineProperty(d,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:c})})(),d.Value=be,d})(),Qt="onCreate",we="onDestroy",wr="onParentChanged",Cr="onViewEvent",ct=new Map,ft=!1,Er=(e,t)=>{ct.set(e,t),ft||(ft=!0,queueMicrotask(()=>{ft=!1;let s=Array.from(ct.entries());ct.clear();for(let[r,a]of s)r.set(a)}))},te,Ae,ge,z,L,P,Y,R,ke,D,St,_e,et,as,Sr=(as=class{constructor(e,t){f(this,D);f(this,te);f(this,Ae);f(this,ge,new vr);f(this,z,new Map);f(this,L);f(this,P);f(this,Y,new Set);f(this,R,[]);f(this,ke,0);g(this,te,e),g(this,Ae,t),k(this,we,Ot.Min,this)}get kernel(){return i(this,te)}get uuid(){return i(this,Ae)}get order(){return i(this,ke)}set order(e){i(this,ke)!==e&&(g(this,ke,e),i(this,L)&&this.parent.resortChildren())}get parentUuid(){return i(this,L)||void 0}set parentUuid(e){i(this,L)!==e&&(this.removeFromParent(),g(this,L,e||void 0),g(this,P,e?i(this,te).getEntity(e):void 0),i(this,P)&&i(this,P).addChild(this))}get parent(){return!i(this,P)&&i(this,L)&&g(this,P,i(this,te).getEntity(i(this,L))),i(this,P)}set parent(e){this.parentUuid=e==null?void 0:e.uuid}get hasParent(){return!!i(this,L)}get children(){return i(this,R)}traverse(e){e(this);for(let t of i(this,R))t.traverse(e)}onDestroy(){var e;i(this,ge).clear(),T(this);for(let t of i(this,z).values())t.context.set(void 0),t.unsubscribePathValue(),(e=t.unsubscribeParent)==null||e.call(t),t.valuePath.dispose(),t.inherited.destroy(),t.provide.destroy(),t.context.destroy();g(this,L,void 0),g(this,P,void 0),i(this,Y).clear(),i(this,R).length=0}addChild(e){var t;if(i(this,R).length===0){i(this,Y).add(e.uuid),i(this,R).push(e);return}if(i(this,Y).has(e.uuid))throw new Error(`child with uuid: ${e.uuid} already exists! parentUuid: ${this.uuid}`);i(this,Y).add(e.uuid),i(this,R).push(e),this.resortChildren();for(let[,s]of i(e,z))b(t=e,D,et).call(t,s)}resortChildren(){i(this,R).sort((e,t)=>e.order-t.order)}removeChild(e){i(this,Y).has(e.uuid)&&(i(this,Y).delete(e.uuid),i(this,R).splice(i(this,R).indexOf(e),1))}removeFromParent(){if(i(this,P)){i(this,P).removeChild(this),g(this,P,void 0),g(this,L,void 0);for(let[,e]of i(this,z))e.unsubscribeParent&&(e.unsubscribeParent(),e.unsubscribeParent=void 0)}}reSubscribeToParentContexts(){for(let[,e]of i(this,z))b(this,D,et).call(this,e)}dispatchMessageToView(e,t,s,r=!1){i(this,te).dispatchMessageToView({uuid:i(this,Ae),type:e,data:t,transferables:s,traverseChildren:r})}dispatchViewEvents(e){for(let{type:t,data:s}of e)m(this,Cr,t,s)}dispatchViewEvent(e,t){this.dispatchViewEvents([{type:e,data:t}])}getPropertyReader(e){return b(this,D,St).call(this,e).get}getPropertyWriter(e){return b(this,D,St).call(this,e).set}setProperties(e){rt(()=>{for(let[t,s]of e)this.setProperty(t,s)})}setProperty(e,t){this.getPropertyWriter(e)(t)}getProperty(e){return jt(this.getPropertyReader(e))}propKeys(){return Array.from(i(this,ge).keys())}propEntries(){return Array.from(i(this,ge).entries()).map(([e,t])=>[e,t.value])}hasContext(e){return i(this,z).has(e)}useContext(e){return b(this,D,_e).call(this,e).context.get}provideContext(e){return b(this,D,_e).call(this,e).provide}},te=new WeakMap,Ae=new WeakMap,ge=new WeakMap,z=new WeakMap,L=new WeakMap,P=new WeakMap,Y=new WeakMap,R=new WeakMap,ke=new WeakMap,D=new WeakSet,St=function(e){return i(this,ge).get(e)},_e=function(e){if(i(this,z).has(e))return i(this,z).get(e);let t=I(),s=I(),r=I(),a=new Ht([s,t]),o=se(a,Ht.Value,h=>{Er(r,h)}),n={name:e,inherited:t,provide:s,context:r,valuePath:a,unsubscribePathValue:o};return i(this,z).set(e,n),b(this,D,et).call(this,n),n},et=function(e){var t,s;if((t=e.unsubscribeParent)==null||t.call(e),e.unsubscribeParent=void 0,this.parent){let r=b(s=this.parent,D,_e).call(s,e.name),a=Xe(r.context,e.inherited);e.unsubscribeParent=()=>{a.destroy()}}else e.inherited.set(void 0)},as);function Ar(e,t){e.indexOf(t)===-1&&e.push(t)}var H,j,ns,Ss=(ns=class{constructor(){f(this,H,new Map);f(this,j,new Map)}static get(e){return e!=null?e:kr}define(e,t){i(this,H).has(e)?Ar(i(this,H).get(e).constructors,t):i(this,H).set(e,{token:e,constructors:[t]})}appendRoute(e,t){if(i(this,j).has(e)){let s=i(this,j).get(e);for(let r of t)s.add(r)}else i(this,j).set(e,new Set(t))}clearRoute(e){i(this,j).delete(e)}findTokensByRoute(e){let t=new Set([e]),s=i(this,j).has(e)?[...i(this,j).get(e)]:[];for(;s.length;){let r=s.shift();t.has(r)||(t.add(r),i(this,j).has(r)&&s.push(...Array.from(i(this,j).get(r)).filter(a=>!t.has(a))))}return Array.from(t)}findConstructors(e){let t=this.findTokensByRoute(e),s=new Set;for(let r of t){let a=i(this,H).get(r);if(a)for(let o of a.constructors)s.add(o)}return s.size>0?Array.from(s):void 0}hasToken(e){return i(this,H).has(e)}hasRoute(e){return i(this,j).has(e)}clear(){i(this,H).clear(),i(this,j).clear()}},H=new WeakMap,j=new WeakMap,ns),kr=new Ss,J;(function(e){e[e.CreateAndDestroy=0]="CreateAndDestroy",e[e.JustCreate=1]="JustCreate",e[e.DestroyOnly=2]="DestroyOnly"})(J||(J={}));var Zt=e=>e.displayName||e.name,w,$,Oe,Be,B,os,Or=(os=class{constructor(e){f(this,w);f(this,$);f(this,Oe);f(this,Be);f(this,B);this.logger=new Vs("Kernel"),g(this,w,new Map),g(this,$,new Set),g(this,B,!0),re(this),this.registry=Ss.get(e)}getEntity(e){var s;let t=(s=i(this,w).get(e))==null?void 0:s.entity;if(!t)throw new Error(`entity with uuid "${e}" not found!`);return t}hasEntity(e){return i(this,w).has(e)}traverseLevelOrderBFS(e=!1){if(i(this,B)){let t=new Map,s=(r,a)=>{let o=this.getEntity(r);t.has(a)?t.get(a).push(o):t.set(a,[o]);for(let n of o.children)s(n.uuid,a+1)};i(this,$).forEach(r=>s(r,0)),g(this,Oe,Array.from(t.entries()).sort((r,a)=>r[0]-a[0]).map(([,r])=>r).flat()),g(this,Be,i(this,Oe).slice().reverse()),g(this,B,!1)}return e?i(this,Be):i(this,Oe)}getEntityGraph(){return Array.from(i(this,$)).map(e=>this.getEntityGraphNode(e))}getEntityGraphNode(e){if(!i(this,w).has(e))return;let{token:t,entity:s}=i(this,w).get(e);return{token:t,entity:s,props:Object.fromEntries(s.propEntries()),children:s.children.map(r=>this.getEntityGraphNode(r.uuid))}}upgradeEntities(){for(let e of this.traverseLevelOrderBFS(!0))this.updateShadowObjects(e.uuid,J.DestroyOnly);for(let e of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(e.uuid,J.JustCreate)}run(e){this.logger.isDebug&&this.logger.debug("sync",e),rt(()=>{for(let t of e.changeTrail)this.parse(t)})}parse(e){switch(e.type){case q.CreateEntities:this.createEntity(e.uuid,e.token,e.parentUuid,e.order,e.properties),g(this,B,!0);break;case q.DestroyEntities:this.destroyEntity(e.uuid),g(this,B,!0);break;case q.SetParent:this.setParent(e.uuid,e.parentUuid,e.order),g(this,B,!0);break;case q.UpdateOrder:this.updateOrder(e.uuid,e.order),g(this,B,!0);break;case q.ChangeProperties:this.changeProperties(e.uuid,e.properties);break;case q.ChangeToken:this.changeToken(e.uuid,e.token);break;case q.SendEvents:this.dispatchEventsToEntity(e.uuid,e.events);break}}createEntity(e,t,s,r=0,a){let o=new Sr(this,e);o.order=r;let n={token:t,entity:o,usedConstructors:new Map};i(this,w).set(e,n),s&&(o.parentUuid=s),o.hasParent||i(this,$).add(e),a&&o.setProperties(a),this.createShadowObjects(e)}destroyEntity(e){if(!i(this,w).has(e))return;let{entity:t,usedConstructors:s}=i(this,w).get(e);t.removeFromParent(),m(t,we,this),s.clear(),i(this,w).delete(t.uuid),i(this,$).delete(t.uuid)}setParent(e,t,s=0){let r=this.getEntity(e);r.parentUuid===t&&r.order===s||(r.removeFromParent(),r.order=s,r.parentUuid=t,r.hasParent?i(this,$).delete(e):i(this,$).add(e),r.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:e,parentUuid:t,order:s,entity:r}),m(r,wr,r)}))}updateOrder(e,t){this.getEntity(e).order=t}dispatchEventsToEntity(e,t){var s;(s=this.getEntity(e))==null||s.dispatchViewEvents(t)}changeProperties(e,t){this.getEntity(e).setProperties(t)}changeToken(e,t){if(!i(this,w).has(e))return;let s=i(this,w).get(e);s.token!==t&&(s.token=t,this.updateShadowObjects(e))}dispatchMessageToView(e){queueMicrotask(()=>{m(this,yt,e)})}updateShadowObjects(e,t=J.CreateAndDestroy){let s=i(this,w).get(e),r=new Set(this.registry.findConstructors(s.token)),a=t===J.CreateAndDestroy||t===J.DestroyOnly,o=t===J.CreateAndDestroy||t===J.JustCreate;if(a){for(let[n,h]of s.usedConstructors)if(!r.has(n)){s.usedConstructors.delete(n);for(let l of h)this.destroyShadowObject(l,s.entity)}}if(o)for(let n of r)s.usedConstructors.has(n)||this.constructShadowObject(n,s)}constructShadowObject(e,t){let s=new Set,r=new Set,a=new Map,o=new Map,n=new Map,h=re(new e({entity:t.entity,provideContext(l,d,p){let c=o.get(l);if(c===void 0){c=I(d,p?{compare:p}:void 0),o.set(l,c);let v=Xe(c,t.entity.provideContext(l));r.add(v.destroy.bind(v))}return c},useContext(l,d){let p=a.get(l);if(p===void 0){p=I(void 0,d?{compare:d}:void 0).get,a.set(l,p);let c=Xe(t.entity.useContext(l),p);r.add(c.destroy.bind(c))}return p},useProperty(l,d){let p=n.get(l);if(p===void 0){p=I(void 0,d?{compare:d}:void 0).get,n.set(l,p);let c=Xe(t.entity.getPropertyReader(l),p);r.add(c.destroy.bind(c))}return p},createEffect(...l){let d=Je(...l);return r.add(d.destroy),d},createSignal(...l){let d=I(...l);return r.add(()=>{X(d)}),d},createMemo(...l){let d=gr(...l);return r.add(()=>{X(d)}),d},on(...l){let d=se(...l);return r.add(d),d},once(...l){let d=k(...l);return r.add(d),d},onDestroy(l){s.add(l)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",Zt(e),{shadowObject:h,entity:t.entity}),k(t.entity,we,Ot.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",Zt(e),{shadowObject:h,entity:t.entity});for(let d of s)d();for(let d of r)d();for(let d of a.values())X(d);for(let d of n.values())X(d);for(let d of o.values())X(d);s.clear(),r.clear(),a.clear(),n.clear(),o.clear();let l=t.usedConstructors.get(e);l&&(l.delete(h),l.size===0&&t.usedConstructors.delete(e))}),t.usedConstructors.has(e)?t.usedConstructors.get(e).add(h):t.usedConstructors.set(e,new Set([h])),this.attachShadowObject(h,t.entity),h}createShadowObjects(e){var s;let t=i(this,w).get(e);(s=this.registry.findConstructors(t.token))==null||s.forEach(r=>{this.constructShadowObject(r,t)})}findShadowObjects(e){if(!i(this,w).has(e))return[];let{usedConstructors:t}=i(this,w).get(e);return Array.from(new Set(Array.from(t.values()).map(s=>Array.from(s)).flat()))}attachShadowObject(e,t){se(t,e),typeof e[Qt]=="function"&&e[Qt](t)}destroyShadowObject(e,t){typeof e[we]=="function"&&e[we](t),m(e,we,t),T(t,e)}destroy(){for(let e of this.traverseLevelOrderBFS().reverse())this.destroyEntity(e.uuid)}},w=new WeakMap,$=new WeakMap,Oe=new WeakMap,Be=new WeakMap,B=new WeakMap,os);async function As(e,t,s,r=!0){var o,n;if(s.has(t)){console.warn("importModule: skipping already imported module",t);return}else s.add(t);t.extends&&await Promise.all(t.extends.map(h=>As(e,h,s,!1)));let{registry:a}=e;if(t.define)for(let[h,l]of Object.entries(t.define))a.define(h,l);if(t.routes)for(let[h,l]of Object.entries(t.routes))a.appendRoute(h,l);await((n=(o=t.initialize)==null?void 0:o.call(t,{define:(h,l)=>a.define(h,l),kernel:e,registry:a}))!=null?n:Promise.resolve()),r&&e.upgradeEntities()}var Pr=e=>(typeof e=="string"&&(e=new URL(e,globalThis.location.href)),e.toString()),We,ie,ks,Os,Ps,hs,jr=(hs=class{constructor(e){f(this,ie);f(this,We,new Set);var t,s;this.kernel=(t=e==null?void 0:e.kernel)!=null?t:new Or,this.postMessage=(s=e==null?void 0:e.postMessage)!=null?s:self.postMessage.bind(self),se(this.kernel,yt,"onMessageToView",this)}route(e){var t;switch(e.data.type){case Ts:b(this,ie,ks).call(this,e.data);break;case Ds:b(this,ie,Os).call(this,e.data);break;case Ls:b(this,ie,Ps).call(this,e.data);break;default:console.warn("[MessageRouter] unknown message",(t=e.data.type)!=null?t:e.data)}}onMessageToView(e){let r=e,{transferables:t}=r,s=Rt(r,["transferables"]);this.postMessage({type:yt,data:s},{transfer:t})}},We=new WeakMap,ie=new WeakSet,ks=async function(e){try{let t=await import(Pr(e.importModule));t[lt]?(await As(this.kernel,t[lt],i(this,We)),this.postMessage({type:ht,url:e.importModule})):this.postMessage({type:ht,url:e.importModule,error:`module has no "${lt}" export`})}catch(t){console.error("[MessageRouter] failed to import module",t),this.postMessage({type:ht,url:e.importModule,error:`${t}`})}},Os=function(e){try{this.kernel.run(e)}catch(t){console.error("[MessageRouter] failed to apply change trail",t),this.postMessage({type:Ft,serial:e.serial,error:t.toString()})}e.serial&&this.postMessage({type:Ft,serial:e.serial})},Ps=function(e){console.debug("[MessageRouter] on destroy",e),T(this.kernel,this),i(this,We).clear(),this.postMessage({type:Ns})},hs),Mr=class{constructor(){this.onmessage=e=>{var t;e.data.type===N?globalThis[M]=e.data.config:((t=this.router)!=null||(this.router=new jr),this.router.route(e))}}start(){self.addEventListener("message",this.onmessage),self.postMessage({type:Rs})}};console.debug("@spearwolf/shadow-objects/WorkerRuntime: hello!");var Tr=new Mr;Tr.start();\n/*! Bundled license information:\n\n@spearwolf/eventize/lib/index.mjs:\n (*!\n =============================================================================\n @spearwolf/eventize 4.0.1+build.20240804\n \u2014 https://github.com/spearwolf/eventize.git\n =============================================================================\n \n Copyright 2015-2024 Wolfger Schramm\n \n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n *)\n*/\n')}var js=()=>new Bt;var Le=(s,e,t=1e3,r)=>new Promise((i,n)=>{let o,l,a=()=>{clearTimeout(o),s.removeEventListener("message",l)};t!==0&&t!==1/0&&(o=setTimeout(()=>{a(),n(new Error(`Timeout waiting for message of type: ${e}`))},t)),l=h=>{if(h.data.type===e)try{(!r||r(h.data))&&(a(),i())}catch(u){a(),n(u.toString())}},s.addEventListener("message",l)});var lr=s=>{let e;if(s!=null&&Array.isArray(s))for(let t of s)t.transferables&&(e?e=[...e,...t.transferables]:e=t.transferables,delete t.transferables);return e},gt=class s{static{this.WorkerLoaded="workerLoaded"}#e;#t;#s;get isDestroyed(){return this.#t}get workerLoaded(){return ue(this,s.WorkerLoaded)}constructor(){this.#t=!1,this.#s=0,this.logger=new x("RemoteWorkerEnv"),$(this,s.WorkerLoaded)}async start(){if(this.#e)return this.logger.isWarn&&this.logger.warn("already started"),this.workerLoaded.then(()=>{if(this.isDestroyed)throw"worker was destroyed"});let e=this.#e=js();this.configureConsoleLogger(e);try{if(await Le(e,fs,ys),this.isDestroyed)throw"worker was destroyed";e.addEventListener("message",this.onMessageFromWorker.bind(this)),queueMicrotask(()=>{c(this,s.WorkerLoaded,this)})}catch(t){throw this.logger.error("failed to start",t),this.#e=void 0,t}}applyChangeTrail(e,t){let r=lr(e),i={type:us,changeTrail:e},n=++this.#s;return t&&(i.serial=n),this.#e.postMessage(i,r),t?Le(this.#e,ds,bs,o=>{if(o.error)throw o.error;return o.serial===n}):Promise.resolve()}importScript(e){return e=dt(e),this.#e.postMessage({type:ls,importModule:e}),Le(this.#e,ps,ms,t=>{if(t.error)throw t.error;return t.url===e})}destroy(){if(!this.#e)return;let e=this.#e;this.#e=void 0,this.#t=!0,e.postMessage({type:cs}),Le(e,gs,vs).finally(()=>{e.terminate()})}onMessageFromWorker(e){e.data?.type===ge?this.onMessageToView?.(e.data.data):this.logger.isDebug&&this.logger.debug("message from worker",e)}configureConsoleLogger(e){let t=`${R}.RemoteWorkerEnv.workerConfig`,r=JSON.parse(localStorage.getItem(t)??"{}");this.logger.isInfo&&this.logger.info("load console-logger worker config",{localStorageKey:t,workerConfig:r}),e.postMessage({type:R,config:{...x.sharedConfig,enable:this.logger.isEnabled,...r,...x.isEnabled?{}:{enable:!1}}})}};var _e,je=class extends J{static{this.observedAttributes=[...J.observedAttributes,tt,rt,st]}static{this.DefaultAutoSync="frame"}#e;#t;#s;#i;#r;constructor(){super(),this.isShaeWorkerElement=!0,this.shadowEnv=new j,this.logger=new x("ShaeWorkerElement"),this.autostart=!0,this.isConnected$=f(!1),this.autoSync$=f(_e.DefaultAutoSync),this.src$=f(""),this.#e=!1,this.#t=!1,this.ns$.onChange(e=>{this.shadowEnv.view=M.get(e)}),g(this.shadowEnv,j.ContextCreated,()=>{this.#r?.run(),this.dispatchEvent(new CustomEvent(j.ContextCreated.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),g(this.shadowEnv,j.ContextLost,()=>{this.dispatchEvent(new CustomEvent(j.ContextLost.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),this.autoSync$.onChange(e=>{let t=this.hasAttribute(N),r=t?this.getAttribute(N):void 0;e===_e.DefaultAutoSync?t&&r!==e&&this.setAttribute(N,e):r!==e&&this.setAttribute(N,e)}),this.#o(),this.#n()}#n(){this.#r=b(()=>{let e=this.src$.get();e&&this.importScript(e)},{autorun:!1})}get shouldAutostart(){return this.autostart&&!Re(this,Ts)}get autoSync(){return this.autoSync$.value}set autoSync(e){typeof e!="string"&&(e=e?_e.DefaultAutoSync:"no"),this.autoSync$.set(`${e}`.trim().toLowerCase())}get frameLoop(){return this.#s??=new ye,this.#s}[ye.OnFrame](){this.syncShadowObjects()}async importScript(e){if(!e)throw new Error("src is blank");let t=await this.shadowEnv.ready();return this.logger.isInfo&&this.logger.info("shadowEnv importScript:",e,{shadowEnv:t}),await t.envProxy.importScript(e),this}connectedCallback(){k(()=>{this.hasAttribute(N)&&this.autoSync$.set(this.getAttribute(N)),this.isConnected$.set(!0)}),this.shouldAutostart&&this.start()}disconnectedCallback(){this.isConnected$.set(!1),this.#a()}attributeChangedCallback(e){if(super.attributeChangedCallback(e),e===tt&&this.shadowEnv.envProxy!=null)throw new Error('Changing the "local" attribute after the shadowEnv has been created is not supported.');if(e===st&&this.#u(),e===N&&(this.autoSync=this.hasAttribute(N)?this.getAttribute(N):!0),e===rt){let t=(this.getAttribute(rt)||"").trim();this.src$.set(t),this.shadowEnv.isReady&&this.#r?.run()}}start(){if(!this.#t){if(this.#e=!1,this.shadowEnv.view??=M.get(this.ns),this.shadowEnv.envProxy==null){let e=Re(this,tt)?new pt:new gt;this.shadowEnv.envProxy=e,this.#u()}this.#t=!0}return this.shadowEnv.ready()}destroy(){this.#i?.destroy(),this.#r?.destroy(),S(this.isConnected$,this.autoSync$,this.src$),this.shadowEnv.envProxy=void 0,this.shadowEnv.destroy()}#a(){this.#e||(this.#e=!0,queueMicrotask(()=>{this.#e&&this.destroy()}))}#o(){this.#i=b(()=>{if(this.isConnected$.get()){let e=(this.autoSync$.get()||_e.DefaultAutoSync).trim().toLowerCase(),t;if(["true","yes","on","frame","auto-sync"].includes(e))return this.logger.isDebug&&this.logger.debug("auto-sync",e,this),this.frameLoop.start(this),()=>{this.frameLoop.stop(this)};if(e.toLowerCase().endsWith("fps")){let r=parseInt(e,10);r>0?t=Math.floor(1e3/r):this.logger.isWarn&&this.logger.warn(`invalid auto-sync value: ${e}`)}else t=parseInt(e,10),isNaN(t)&&(t=void 0,["false","no","off"].includes(e)||this.logger.error(`invalid auto-sync value: ${e}`));if(t!==void 0&&t>0){this.logger.isDebug&&this.logger.debug("auto-sync interval (ms)",t,this);let r=setInterval(()=>{this.syncShadowObjects()},t);return()=>{clearInterval(r)}}else this.logger.isDebug&&this.logger.debug("auto-sync off",this)}},[this.autoSync$,this.isConnected$])}#u(){let e=this.shadowEnv.envProxy;e?.isLocalEnv&&(e.disableStructuredClone=this.hasAttribute(st))}};_e=je;customElements.define(ks,je);globalThis.SHADOW_ENTS_BUNDLE_LOADED=!0;
|
|
22
22
|
/*! Bundled license information:
|
|
23
23
|
|
|
24
24
|
@spearwolf/eventize/lib/index.mjs:
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../src/entities/Entity.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,MAAM,EAGN,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAInC,KAAK,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AA+BvC;;;;;;GAMG;AACH,qBAAa,MAAM;;IAejB,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAOtB;IAED,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED,IAAI,UA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
import { emit, eventize, off, on, once, Priority } from '@spearwolf/eventize';
|
|
2
2
|
import { batch, createEffect, createMemo, createSignal, destroySignal, link, Signal, } from '@spearwolf/signalize';
|
|
3
3
|
import { ComponentChangeType, MessageToView } from '../constants.js';
|
|
4
4
|
import { ConsoleLogger } from '../utils/ConsoleLogger.js';
|
|
@@ -94,6 +94,9 @@ export class Kernel {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
run(event) {
|
|
97
|
+
if (this.logger.isDebug) {
|
|
98
|
+
this.logger.debug('sync', event);
|
|
99
|
+
}
|
|
97
100
|
batch(() => {
|
|
98
101
|
for (const entry of event.changeTrail) {
|
|
99
102
|
this.parse(entry);
|
|
@@ -238,6 +241,7 @@ export class Kernel {
|
|
|
238
241
|
const propertyReaders = new Map();
|
|
239
242
|
const shadowObject = eventize(new constructor({
|
|
240
243
|
entity: entry.entity,
|
|
244
|
+
// TODO provideContext(.. {global: true}) or provideGlobalContext(...)?
|
|
241
245
|
provideContext(name, initialValue, compare) {
|
|
242
246
|
let ctxProvider = contextProviders.get(name);
|
|
243
247
|
if (ctxProvider === undefined) {
|
|
@@ -248,6 +252,7 @@ export class Kernel {
|
|
|
248
252
|
}
|
|
249
253
|
return ctxProvider;
|
|
250
254
|
},
|
|
255
|
+
// TODO useContext(.. {skipSelf: true}) - to get context from parent entity and skip the current entity
|
|
251
256
|
useContext(name, compare) {
|
|
252
257
|
let ctxReader = contextReaders.get(name);
|
|
253
258
|
if (ctxReader === undefined) {
|
|
@@ -306,7 +311,7 @@ export class Kernel {
|
|
|
306
311
|
if (this.logger.isInfo) {
|
|
307
312
|
this.logger.info('create shadow-object', getDisplayName(constructor), { shadowObject, entity: entry.entity });
|
|
308
313
|
}
|
|
309
|
-
once(
|
|
314
|
+
once(entry.entity, onDestroy, Priority.Low, () => {
|
|
310
315
|
if (this.logger.isInfo) {
|
|
311
316
|
this.logger.info('destroy shadow-object', getDisplayName(constructor), { shadowObject, entity: entry.entity });
|
|
312
317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