@quick-threejs/reactive 0.1.31 → 0.1.33

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/dist/worker.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./app.module-BaIoj4QA.js");var g=n.requireWorker();const o=n.getDefaultExportFromCjs(g),T=o.expose;o.registerSerializer;o.Transfer;const h=a=>{const r=n.instance.createChildContainer();r.register(n.CONTAINER_TOKEN,{useValue:r});const e=r.resolve(n.AppModule),d={container:r,module:e},l={};n.PROXY_EVENT_LISTENERS.forEach(t=>{var i,s;l[t]=(s=(i=e[t])==null?void 0:i.bind)==null?void 0:s.call(i,e)});const c=t=>{var u,E,f,m,b;if(!((u=t.data)!=null&&u.canvas)||e.isInitialized())return;const i=!!((E=t.data)!=null&&E.startTimer),s=!!((f=t.data)!=null&&f.withMiniCamera),S=!!((m=t.data)!=null&&m.fullScreen);e.init({...t.data,startTimer:i,withMiniCamera:s,fullScreen:S}),(b=a==null?void 0:a.onReady)==null||b.call(a,d),self==null||self.removeEventListener("message",c)};return self==null||self.addEventListener("message",c),T({...l,isInitialized:e.isInitialized.bind(e),dispose:e.dispose.bind(e),beforeStep$:e.beforeStep$.bind(e),step$:e.step$.bind(e)}),d};exports.launchApp=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./app.module-BmmoQ8ZO.js");var S=r.requireWorker();const o=r.getDefaultExportFromCjs(S),R=o.expose;o.registerSerializer;o.Transfer;const C=i=>{const a=r.instance.createChildContainer();a.register(r.CONTAINER_TOKEN,{useValue:a});const e=a.resolve(r.AppModule),d={container:a,module:e},c={};r.PROXY_EVENT_LISTENERS.forEach(t=>{var n,s;c[t]=(s=(n=e[t])==null?void 0:n.bind)==null?void 0:s.call(n,e)});const l=t=>{var g,u,f,E,b;if(!((g=t.data)!=null&&g.canvas)||e.getIsInitialized())return;const n=!!((u=t.data)!=null&&u.startTimer),s=!!((f=t.data)!=null&&f.withMiniCamera),m=!!((E=t.data)!=null&&E.fullScreen);e.init({...t.data,startTimer:n,withMiniCamera:s,fullScreen:m}),(b=i==null?void 0:i.onReady)==null||b.call(i,d),self==null||self.removeEventListener("message",l)};return self==null||self.addEventListener("message",l),R({...c,getProxyReceiver:e.getProxyReceiver.bind(e),getCanvas:e.getCanvas.bind(e),getIsInitialized:e.getIsInitialized.bind(e),getBeforeStep$:e.getBeforeStep$.bind(e),getBeforeRender$:e.getBeforeRender$.bind(e),getStep$:e.getStep$.bind(e),getAfterRender$:e.getAfterRender$.bind(e),dispose:e.dispose.bind(e)}),d};exports.launchApp=C;
package/dist/worker.mjs CHANGED
@@ -1,35 +1,39 @@
1
- import { r as h, p as x, d as C, h as S, k as T, a as g } from "./app.module-BbeIDure.mjs";
2
- var I = h();
3
- const r = /* @__PURE__ */ x(I), N = r.expose;
4
- r.registerSerializer;
5
- r.Transfer;
6
- const z = (i) => {
7
- const s = C.createChildContainer();
8
- s.register(S, { useValue: s });
9
- const e = s.resolve(T), o = { container: s, module: e }, d = {};
10
- g.forEach((t) => {
11
- var a, n;
12
- d[t] = (n = (a = e[t]) == null ? void 0 : a.bind) == null ? void 0 : n.call(a, e);
1
+ import { r as R, p as b, d as x, h as C, k as I, a as S } from "./app.module-WohiJuEI.mjs";
2
+ var $ = R();
3
+ const s = /* @__PURE__ */ b($), h = s.expose;
4
+ s.registerSerializer;
5
+ s.Transfer;
6
+ const T = (a) => {
7
+ const n = x.createChildContainer();
8
+ n.register(C, { useValue: n });
9
+ const e = n.resolve(I), d = { container: n, module: e }, o = {};
10
+ S.forEach((t) => {
11
+ var r, i;
12
+ o[t] = (i = (r = e[t]) == null ? void 0 : r.bind) == null ? void 0 : i.call(r, e);
13
13
  });
14
14
  const c = (t) => {
15
- var l, E, f, m, u;
16
- if (!((l = t.data) != null && l.canvas) || e.isInitialized()) return;
17
- const a = !!((E = t.data) != null && E.startTimer), n = !!((f = t.data) != null && f.withMiniCamera), b = !!((m = t.data) != null && m.fullScreen);
15
+ var g, l, f, E, m;
16
+ if (!((g = t.data) != null && g.canvas) || e.getIsInitialized()) return;
17
+ const r = !!((l = t.data) != null && l.startTimer), i = !!((f = t.data) != null && f.withMiniCamera), u = !!((E = t.data) != null && E.fullScreen);
18
18
  e.init({
19
19
  ...t.data,
20
- startTimer: a,
21
- withMiniCamera: n,
22
- fullScreen: b
23
- }), (u = i == null ? void 0 : i.onReady) == null || u.call(i, o), self == null || self.removeEventListener("message", c);
20
+ startTimer: r,
21
+ withMiniCamera: i,
22
+ fullScreen: u
23
+ }), (m = a == null ? void 0 : a.onReady) == null || m.call(a, d), self == null || self.removeEventListener("message", c);
24
24
  };
25
- return self == null || self.addEventListener("message", c), N({
26
- ...d,
27
- isInitialized: e.isInitialized.bind(e),
28
- dispose: e.dispose.bind(e),
29
- beforeStep$: e.beforeStep$.bind(e),
30
- step$: e.step$.bind(e)
31
- }), o;
25
+ return self == null || self.addEventListener("message", c), h({
26
+ ...o,
27
+ getProxyReceiver: e.getProxyReceiver.bind(e),
28
+ getCanvas: e.getCanvas.bind(e),
29
+ getIsInitialized: e.getIsInitialized.bind(e),
30
+ getBeforeStep$: e.getBeforeStep$.bind(e),
31
+ getBeforeRender$: e.getBeforeRender$.bind(e),
32
+ getStep$: e.getStep$.bind(e),
33
+ getAfterRender$: e.getAfterRender$.bind(e),
34
+ dispose: e.dispose.bind(e)
35
+ }), d;
32
36
  };
33
37
  export {
34
- z as launchApp
38
+ T as launchApp
35
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quick-threejs/reactive",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "Reactively quick start a three.js app ⚡️",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,34 +0,0 @@
1
- "use strict";var Ci=Object.defineProperty;var Ei=(t,e,r)=>e in t?Ci(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>Ei(t,typeof e!="symbol"?e+"":e,r);const O=require("three");var Ir=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Oi(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var zr={};/*! *****************************************************************************
2
- Copyright (C) Microsoft. All rights reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
- this file except in compliance with the License. You may obtain a copy of the
5
- License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
- MERCHANTABLITY OR NON-INFRINGEMENT.
11
-
12
- See the Apache Version 2.0 License for specific language governing permissions
13
- and limitations under the License.
14
- ***************************************************************************** */var Fr;function Ti(){if(Fr)return zr;Fr=1;var t;return function(e){(function(r){var n=typeof globalThis=="object"?globalThis:typeof Ir=="object"?Ir:typeof self=="object"?self:typeof this=="object"?this:c(),i=s(e);typeof n.Reflect<"u"&&(i=s(n.Reflect,i)),r(i,n),typeof n.Reflect>"u"&&(n.Reflect=e);function s(u,l){return function(h,m){Object.defineProperty(u,h,{configurable:!0,writable:!0,value:m}),l&&l(h,m)}}function o(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return o()||a()}})(function(r,n){var i=Object.prototype.hasOwnProperty,s=typeof Symbol=="function",o=s&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=s&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",u={__proto__:[]}instanceof Array,l=!c&&!u,h={create:c?function(){return $t(Object.create(null))}:u?function(){return $t({__proto__:null})}:function(){return $t({})},has:l?function(f,d){return i.call(f,d)}:function(f,d){return d in f},get:l?function(f,d){return i.call(f,d)?f[d]:void 0}:function(f,d){return f[d]}},m=Object.getPrototypeOf(Function),w=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:bi(),F=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:wi(),A=typeof WeakMap=="function"?WeakMap:gi(),L=s?Symbol.for("@reflect-metadata:registry"):void 0,_=mi(),C=yi(_);function P(f,d,v,S){if(I(v)){if(!Mr(f))throw new TypeError;if(!Rr(d))throw new TypeError;return ne(f,d)}else{if(!Mr(f))throw new TypeError;if(!K(d))throw new TypeError;if(!K(S)&&!I(S)&&!Ae(S))throw new TypeError;return Ae(S)&&(S=void 0),v=ce(v),B(f,d,v,S)}}r("decorate",P);function R(f,d){function v(S,x){if(!K(S))throw new TypeError;if(!I(x)&&!pi(x))throw new TypeError;ue(f,d,S,x)}return v}r("metadata",R);function g(f,d,v,S){if(!K(v))throw new TypeError;return I(S)||(S=ce(S)),ue(f,d,v,S)}r("defineMetadata",g);function b(f,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),Q(f,d,v)}r("hasMetadata",b);function D(f,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),he(f,d,v)}r("hasOwnMetadata",D);function H(f,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),st(f,d,v)}r("getMetadata",H);function y(f,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),xe(f,d,v)}r("getOwnMetadata",y);function $(f,d){if(!K(f))throw new TypeError;return I(d)||(d=ce(d)),De(f,d)}r("getMetadataKeys",$);function k(f,d){if(!K(f))throw new TypeError;return I(d)||(d=ce(d)),Er(f,d)}r("getOwnMetadataKeys",k);function U(f,d,v){if(!K(d))throw new TypeError;if(I(v)||(v=ce(v)),!K(d))throw new TypeError;I(v)||(v=ce(v));var S=Ue(d,v,!1);return I(S)?!1:S.OrdinaryDeleteMetadata(f,d,v)}r("deleteMetadata",U);function ne(f,d){for(var v=f.length-1;v>=0;--v){var S=f[v],x=S(d);if(!I(x)&&!Ae(x)){if(!Rr(x))throw new TypeError;d=x}}return d}function B(f,d,v,S){for(var x=f.length-1;x>=0;--x){var ee=f[x],X=ee(d,v,S);if(!I(X)&&!Ae(X)){if(!K(X))throw new TypeError;S=X}}return S}function Q(f,d,v){var S=he(f,d,v);if(S)return!0;var x=jt(d);return Ae(x)?!1:Q(f,x,v)}function he(f,d,v){var S=Ue(d,v,!1);return I(S)?!1:Tr(S.OrdinaryHasOwnMetadata(f,d,v))}function st(f,d,v){var S=he(f,d,v);if(S)return xe(f,d,v);var x=jt(d);if(!Ae(x))return st(f,x,v)}function xe(f,d,v){var S=Ue(d,v,!1);if(!I(S))return S.OrdinaryGetOwnMetadata(f,d,v)}function ue(f,d,v,S){var x=Ue(v,S,!0);x.OrdinaryDefineOwnMetadata(f,d,v,S)}function De(f,d){var v=Er(f,d),S=jt(f);if(S===null)return v;var x=De(S,d);if(x.length<=0)return v;if(v.length<=0)return x;for(var ee=new F,X=[],W=0,E=v;W<E.length;W++){var T=E[W],M=ee.has(T);M||(ee.add(T),X.push(T))}for(var j=0,N=x;j<N.length;j++){var T=N[j],M=ee.has(T);M||(ee.add(T),X.push(T))}return X}function Er(f,d){var v=Ue(f,d,!1);return v?v.OrdinaryOwnMetadataKeys(f,d):[]}function Or(f){if(f===null)return 1;switch(typeof f){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return f===null?1:6;default:return 6}}function I(f){return f===void 0}function Ae(f){return f===null}function li(f){return typeof f=="symbol"}function K(f){return typeof f=="object"?f!==null:typeof f=="function"}function hi(f,d){switch(Or(f)){case 0:return f;case 1:return f;case 2:return f;case 3:return f;case 4:return f;case 5:return f}var v="string",S=jr(f,o);if(S!==void 0){var x=S.call(f,v);if(K(x))throw new TypeError;return x}return fi(f)}function fi(f,d){var v,S;{var x=f.toString;if(ot(x)){var S=x.call(f);if(!K(S))return S}var v=f.valueOf;if(ot(v)){var S=v.call(f);if(!K(S))return S}}throw new TypeError}function Tr(f){return!!f}function di(f){return""+f}function ce(f){var d=hi(f);return li(d)?d:di(d)}function Mr(f){return Array.isArray?Array.isArray(f):f instanceof Object?f instanceof Array:Object.prototype.toString.call(f)==="[object Array]"}function ot(f){return typeof f=="function"}function Rr(f){return typeof f=="function"}function pi(f){switch(Or(f)){case 3:return!0;case 4:return!0;default:return!1}}function Rt(f,d){return f===d||f!==f&&d!==d}function jr(f,d){var v=f[d];if(v!=null){if(!ot(v))throw new TypeError;return v}}function $r(f){var d=jr(f,a);if(!ot(d))throw new TypeError;var v=d.call(f);if(!K(v))throw new TypeError;return v}function xr(f){return f.value}function Dr(f){var d=f.next();return d.done?!1:d}function Ar(f){var d=f.return;d&&d.call(f)}function jt(f){var d=Object.getPrototypeOf(f);if(typeof f!="function"||f===m||d!==m)return d;var v=f.prototype,S=v&&Object.getPrototypeOf(v);if(S==null||S===Object.prototype)return d;var x=S.constructor;return typeof x!="function"||x===f?d:x}function vi(){var f;!I(L)&&typeof n.Reflect<"u"&&!(L in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(f=_i(n.Reflect));var d,v,S,x=new A,ee={registerProvider:X,getProvider:E,setProvider:M};return ee;function X(j){if(!Object.isExtensible(ee))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case f===j:break;case I(d):d=j;break;case d===j:break;case I(v):v=j;break;case v===j:break;default:S===void 0&&(S=new F),S.add(j);break}}function W(j,N){if(!I(d)){if(d.isProviderFor(j,N))return d;if(!I(v)){if(v.isProviderFor(j,N))return d;if(!I(S))for(var V=$r(S);;){var Z=Dr(V);if(!Z)return;var ae=xr(Z);if(ae.isProviderFor(j,N))return Ar(V),ae}}}if(!I(f)&&f.isProviderFor(j,N))return f}function E(j,N){var V=x.get(j),Z;return I(V)||(Z=V.get(N)),I(Z)&&(Z=W(j,N),I(Z)||(I(V)&&(V=new w,x.set(j,V)),V.set(N,Z))),Z}function T(j){if(I(j))throw new TypeError;return d===j||v===j||!I(S)&&S.has(j)}function M(j,N,V){if(!T(V))throw new Error("Metadata provider not registered.");var Z=E(j,N);if(Z!==V){if(!I(Z))return!1;var ae=x.get(j);I(ae)&&(ae=new w,x.set(j,ae)),ae.set(N,V)}return!0}}function mi(){var f;return!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&(f=n.Reflect[L]),I(f)&&(f=vi()),!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,L,{enumerable:!1,configurable:!1,writable:!1,value:f}),f}function yi(f){var d=new A,v={isProviderFor:function(T,M){var j=d.get(T);return I(j)?!1:j.has(M)},OrdinaryDefineOwnMetadata:X,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:ee,OrdinaryOwnMetadataKeys:W,OrdinaryDeleteMetadata:E};return _.registerProvider(v),v;function S(T,M,j){var N=d.get(T),V=!1;if(I(N)){if(!j)return;N=new w,d.set(T,N),V=!0}var Z=N.get(M);if(I(Z)){if(!j)return;if(Z=new w,N.set(M,Z),!f.setProvider(T,M,v))throw N.delete(M),V&&d.delete(T),new Error("Wrong provider for target.")}return Z}function x(T,M,j){var N=S(M,j,!1);return I(N)?!1:Tr(N.has(T))}function ee(T,M,j){var N=S(M,j,!1);if(!I(N))return N.get(T)}function X(T,M,j,N){var V=S(j,N,!0);V.set(T,M)}function W(T,M){var j=[],N=S(T,M,!1);if(I(N))return j;for(var V=N.keys(),Z=$r(V),ae=0;;){var kr=Dr(Z);if(!kr)return j.length=ae,j;var Pi=xr(kr);try{j[ae]=Pi}catch(Si){try{Ar(Z)}finally{throw Si}}ae++}}function E(T,M,j){var N=S(M,j,!1);if(I(N)||!N.delete(T))return!1;if(N.size===0){var V=d.get(M);I(V)||(V.delete(j),V.size===0&&d.delete(V))}return!0}}function _i(f){var d=f.defineMetadata,v=f.hasOwnMetadata,S=f.getOwnMetadata,x=f.getOwnMetadataKeys,ee=f.deleteMetadata,X=new A,W={isProviderFor:function(E,T){var M=X.get(E);return!I(M)&&M.has(T)?!0:x(E,T).length?(I(M)&&(M=new F,X.set(E,M)),M.add(T),!0):!1},OrdinaryDefineOwnMetadata:d,OrdinaryHasOwnMetadata:v,OrdinaryGetOwnMetadata:S,OrdinaryOwnMetadataKeys:x,OrdinaryDeleteMetadata:ee};return W}function Ue(f,d,v){var S=_.getProvider(f,d);if(!I(S))return S;if(v){if(_.setProvider(f,d,C))return C;throw new Error("Illegal state.")}}function bi(){var f={},d=[],v=function(){function W(E,T,M){this._index=0,this._keys=E,this._values=T,this._selector=M}return W.prototype["@@iterator"]=function(){return this},W.prototype[a]=function(){return this},W.prototype.next=function(){var E=this._index;if(E>=0&&E<this._keys.length){var T=this._selector(this._keys[E],this._values[E]);return E+1>=this._keys.length?(this._index=-1,this._keys=d,this._values=d):this._index++,{value:T,done:!1}}return{value:void 0,done:!0}},W.prototype.throw=function(E){throw this._index>=0&&(this._index=-1,this._keys=d,this._values=d),E},W.prototype.return=function(E){return this._index>=0&&(this._index=-1,this._keys=d,this._values=d),{value:E,done:!0}},W}(),S=function(){function W(){this._keys=[],this._values=[],this._cacheKey=f,this._cacheIndex=-2}return Object.defineProperty(W.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),W.prototype.has=function(E){return this._find(E,!1)>=0},W.prototype.get=function(E){var T=this._find(E,!1);return T>=0?this._values[T]:void 0},W.prototype.set=function(E,T){var M=this._find(E,!0);return this._values[M]=T,this},W.prototype.delete=function(E){var T=this._find(E,!1);if(T>=0){for(var M=this._keys.length,j=T+1;j<M;j++)this._keys[j-1]=this._keys[j],this._values[j-1]=this._values[j];return this._keys.length--,this._values.length--,Rt(E,this._cacheKey)&&(this._cacheKey=f,this._cacheIndex=-2),!0}return!1},W.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=f,this._cacheIndex=-2},W.prototype.keys=function(){return new v(this._keys,this._values,x)},W.prototype.values=function(){return new v(this._keys,this._values,ee)},W.prototype.entries=function(){return new v(this._keys,this._values,X)},W.prototype["@@iterator"]=function(){return this.entries()},W.prototype[a]=function(){return this.entries()},W.prototype._find=function(E,T){if(!Rt(this._cacheKey,E)){this._cacheIndex=-1;for(var M=0;M<this._keys.length;M++)if(Rt(this._keys[M],E)){this._cacheIndex=M;break}}return this._cacheIndex<0&&T&&(this._cacheIndex=this._keys.length,this._keys.push(E),this._values.push(void 0)),this._cacheIndex},W}();return S;function x(W,E){return W}function ee(W,E){return E}function X(W,E){return[W,E]}}function wi(){var f=function(){function d(){this._map=new w}return Object.defineProperty(d.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),d.prototype.has=function(v){return this._map.has(v)},d.prototype.add=function(v){return this._map.set(v,v),this},d.prototype.delete=function(v){return this._map.delete(v)},d.prototype.clear=function(){this._map.clear()},d.prototype.keys=function(){return this._map.keys()},d.prototype.values=function(){return this._map.keys()},d.prototype.entries=function(){return this._map.entries()},d.prototype["@@iterator"]=function(){return this.keys()},d.prototype[a]=function(){return this.keys()},d}();return f}function gi(){var f=16,d=h.create(),v=S();return function(){function E(){this._key=S()}return E.prototype.has=function(T){var M=x(T,!1);return M!==void 0?h.has(M,this._key):!1},E.prototype.get=function(T){var M=x(T,!1);return M!==void 0?h.get(M,this._key):void 0},E.prototype.set=function(T,M){var j=x(T,!0);return j[this._key]=M,this},E.prototype.delete=function(T){var M=x(T,!1);return M!==void 0?delete M[this._key]:!1},E.prototype.clear=function(){this._key=S()},E}();function S(){var E;do E="@@WeakMap@@"+W();while(h.has(d,E));return d[E]=!0,E}function x(E,T){if(!i.call(E,v)){if(!T)return;Object.defineProperty(E,v,{value:h.create()})}return E[v]}function ee(E,T){for(var M=0;M<T;++M)E[M]=Math.random()*255|0;return E}function X(E){if(typeof Uint8Array=="function"){var T=new Uint8Array(E);return typeof crypto<"u"?crypto.getRandomValues(T):typeof msCrypto<"u"?msCrypto.getRandomValues(T):ee(T,E),T}return ee(new Array(E),E)}function W(){var E=X(f);E[6]=E[6]&79|64,E[8]=E[8]&191|128;for(var T="",M=0;M<f;++M){var j=E[M];(M===4||M===6||M===8)&&(T+="-"),j<16&&(T+="0"),T+=j.toString(16).toLowerCase()}return T}}function $t(f){return f.__=void 0,delete f.__,f}})}(t||(t={})),zr}Ti();var Bt;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Bt||(Bt={}));const te=Bt;/*! *****************************************************************************
15
- Copyright (c) Microsoft Corporation.
16
-
17
- Permission to use, copy, modify, and/or distribute this software for any
18
- purpose with or without fee is hereby granted.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
21
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
22
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
23
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
24
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26
- PERFORMANCE OF THIS SOFTWARE.
27
- ***************************************************************************** */var Zt=function(t,e){return Zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Zt(t,e)};function vr(t,e){Zt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Mi(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,[])).next())})}function Ri(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function at(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function mt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Te(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(mt(arguments[e]));return t}var Gt="injectionTokens";function ji(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(Gt,t)||{};return Object.keys(r).forEach(function(n){e[+n]=r[n]}),e}function $i(t,e){return function(r,n,i){var s=Reflect.getOwnMetadata(Gt,r)||{};s[i]=t,Reflect.defineMetadata(Gt,s,r)}}function jn(t){return!!t.useClass}function Qt(t){return!!t.useFactory}var $n=function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var r=this,n={},i=!1,s,o=function(){return i||(s=e(r.wrap()),i=!0),s};return new Proxy(n,this.createHandler(o))},t.prototype.createHandler=function(e){var r={},n=function(i){r[i]=function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];s[0]=e();var a=Reflect[i];return a.apply(void 0,Te(s))}};return this.reflectMethods.forEach(n),r},t}();function ke(t){return typeof t=="string"||typeof t=="symbol"}function xi(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function Lr(t){return typeof t=="object"&&"token"in t&&"transform"in t}function Di(t){return typeof t=="function"||t instanceof $n}function ft(t){return!!t.useToken}function dt(t){return t.useValue!=null}function Ai(t){return jn(t)||dt(t)||ft(t)||Qt(t)}var mr=function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var r=this._registryMap.get(e);return r[r.length-1]||null},t.prototype.set=function(e,r){this.ensure(e),this._registryMap.get(e).push(r)},t.prototype.setAll=function(e,r){this._registryMap.set(e,r)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t}(),ki=function(t){vr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(mr),Wr=function(){function t(){this.scopedResolutions=new Map}return t}();function Ii(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}function zi(t,e,r){return r===void 0&&(r=" "),Te([t],e.message.split(`
28
- `).map(function(n){return r+n})).join(`
29
- `)}function Fi(t,e,r){var n=mt(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=n[1],s=i===void 0?null:i,o=Ii(s,e);return zi("Cannot inject the dependency "+o+' of "'+t.name+'" constructor. Reason:',r)}function Li(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Wi=function(t){vr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(mr),Ni=function(t){vr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(mr),Hi=function(){function t(){this.preResolution=new Wi,this.postResolution=new Ni}return t}(),xn=new Map,Ui=function(){function t(e){this.parent=e,this._registry=new ki,this.interceptors=new Hi,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,n){n===void 0&&(n={lifecycle:te.Transient}),this.ensureNotDisposed();var i;if(Ai(r)?i=r:i={useClass:r},ft(i))for(var s=[e],o=i;o!=null;){var a=o.useToken;if(s.includes(a))throw new Error("Token registration cycle detected! "+Te(s,[a]).join(" -> "));s.push(a);var c=this._registry.get(a);c&&ft(c.provider)?o=c.provider:o=null}if((n.lifecycle===te.Singleton||n.lifecycle==te.ContainerScoped||n.lifecycle==te.ResolutionScoped)&&(dt(i)||Qt(i)))throw new Error('Cannot use lifecycle "'+te[n.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:n}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),ke(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),ke(e)){if(ke(r))return this.register(e,{useToken:r},{lifecycle:te.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:te.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var n=e;return r&&!ke(r)&&(n=r),this.register(e,{useClass:n},{lifecycle:te.Singleton})},t.prototype.resolve=function(e,r){r===void 0&&(r=new Wr),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&ke(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),n){var i=this.resolveRegistration(n,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(Di(e)){var i=this.construct(e,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var n,i;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var o=at(this.interceptors.preResolution.getAll(e)),a=o.next();!a.done;a=o.next()){var c=a.value;c.options.frequency!="Once"&&s.push(c),c.callback(e,r)}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.interceptors.preResolution.setAll(e,s)}},t.prototype.executePostResolutionInterceptor=function(e,r,n){var i,s;if(this.interceptors.postResolution.has(e)){var o=[];try{for(var a=at(this.interceptors.postResolution.getAll(e)),c=a.next();!c.done;c=a.next()){var u=c.value;u.options.frequency!="Once"&&o.push(u),u.callback(e,r,n)}}catch(l){i={error:l}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,o)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===te.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var n=e.options.lifecycle===te.Singleton,i=e.options.lifecycle===te.ContainerScoped,s=n||i,o;return dt(e.provider)?o=e.provider.useValue:ft(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):jn(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):Qt(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,r),e.options.lifecycle===te.ResolutionScoped&&r.scopedResolutions.set(e,o),o},t.prototype.resolveAll=function(e,r){var n=this;r===void 0&&(r=new Wr),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&ke(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),i){var s=i.map(function(a){return n.resolveRegistration(a,r)});return this.executePostResolutionInterceptor(e,s,"All"),s}var o=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,o,"All"),o},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var n=at(this._registry.entries()),i=n.next();!i.done;i=n.next()){var s=mt(i.value,2),o=s[0],a=s[1];this._registry.setAll(o,a.filter(function(c){return!dt(c.provider)}).map(function(c){return c.instance=void 0,c}))}}catch(c){e={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var n=new t(this);try{for(var i=at(this._registry.entries()),s=i.next();!s.done;s=i.next()){var o=mt(s.value,2),a=o[0],c=o[1];c.some(function(u){var l=u.options;return l.lifecycle===te.ContainerScoped})&&n._registry.setAll(a,c.map(function(u){return u.options.lifecycle===te.ContainerScoped?{provider:u.provider,options:u.options}:u}))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},t.prototype.beforeResolution=function(e,r,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:n})},t.prototype.afterResolution=function(e,r,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:n})},t.prototype.dispose=function(){return Mi(this,void 0,void 0,function(){var e;return Ri(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(n){var i=n.dispose();i&&e.push(i)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var n=this;if(e instanceof $n)return e.createProxy(function(s){return n.resolve(s,r)});var i=function(){var s=xn.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var o=s.map(n.resolveParams(r,e));return new(e.bind.apply(e,Te([void 0],o)))}();return Li(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,r){var n=this;return function(i,s){var o,a,c;try{return xi(i)?Lr(i)?i.multiple?(o=n.resolve(i.transform)).transform.apply(o,Te([n.resolveAll(i.token)],i.transformArgs)):(a=n.resolve(i.transform)).transform.apply(a,Te([n.resolve(i.token,e)],i.transformArgs)):i.multiple?n.resolveAll(i.token):n.resolve(i.token,e):Lr(i)?(c=n.resolve(i.transform,e)).transform.apply(c,Te([n.resolve(i.token,e)],i.transformArgs)):n.resolve(i,e)}catch(u){throw new Error(Fi(r,s,u))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),yr=new Ui;function z(t){return $i(t)}function Dn(){return function(t){xn.set(t,ji(t))}}function G(){return function(t){Dn()(t),yr.registerSingleton(t)}}function Ot(t,e){return function(r){Dn()(r),yr.register(r,r,{lifecycle:t})}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);const qi=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],_r=["contextmenu","resize","mousedown","mousemove","mouseup","pointerdown","pointermove","pointercancel","pointerup","touchstart","touchmove","touchend","wheel","keydown"];var yt=(t=>(t[t.PERSPECTIVE=0]="PERSPECTIVE",t[t.ORTHOGRAPHIC=1]="ORTHOGRAPHIC",t))(yt||{});class An{constructor(){p(this,"contextmenu$$");p(this,"resize$$");p(this,"mousedown$$");p(this,"mousemove$$");p(this,"mouseup$$");p(this,"pointerdown$$");p(this,"pointermove$$");p(this,"pointercancel$$");p(this,"pointerup$$");p(this,"touchstart$$");p(this,"touchmove$$");p(this,"touchend$$");p(this,"wheel$$");p(this,"keydown$$")}}class kn extends An{constructor(){super(...arguments);p(this,"contextmenu$");p(this,"resize$");p(this,"mousedown$");p(this,"mousemove$");p(this,"mouseup$");p(this,"pointerdown$");p(this,"pointermove$");p(this,"pointercancel$");p(this,"pointerup$");p(this,"touchstart$");p(this,"touchmove$");p(this,"touchend$");p(this,"wheel$");p(this,"keydown$")}}class In extends kn{constructor(){super(...arguments);p(this,"contextmenu");p(this,"resize");p(this,"mousedown");p(this,"mousemove");p(this,"mouseup");p(this,"pointerdown");p(this,"pointermove");p(this,"pointercancel");p(this,"pointerup");p(this,"touchstart");p(this,"touchmove");p(this,"touchend");p(this,"wheel");p(this,"keydown")}}class zn{constructor(){p(this,"contextmenu$");p(this,"resize$");p(this,"mousedown$");p(this,"mousemove$");p(this,"mouseup$");p(this,"pointerdown$");p(this,"pointermove$");p(this,"pointercancel$");p(this,"pointerup$");p(this,"touchstart$");p(this,"touchmove$");p(this,"touchend$");p(this,"wheel$");p(this,"keydown$");p(this,"contextmenu");p(this,"resize");p(this,"mousedown");p(this,"mousemove");p(this,"mouseup");p(this,"pointerdown");p(this,"pointermove");p(this,"pointercancel");p(this,"pointerup");p(this,"touchstart");p(this,"touchmove");p(this,"touchend");p(this,"wheel");p(this,"keydown")}}class Vi{constructor(){p(this,"contextmenu$");p(this,"resize$");p(this,"mousedown$");p(this,"mousemove$");p(this,"mouseup$");p(this,"pointerdown$");p(this,"pointermove$");p(this,"pointercancel$");p(this,"pointerup$");p(this,"touchstart$");p(this,"touchmove$");p(this,"touchend$");p(this,"wheel$");p(this,"keydown$")}}const Yi="CONTAINER",Fn="LOADER_SERIALIZED_LOAD";var Kt=function(t,e){return Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Kt(t,e)};function et(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Kt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Bi(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})}function Ln(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ze(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _e(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Me(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function Ie(t){return this instanceof Ie?(this.v=t,this):new Ie(t)}function Zi(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(w){return function(F){return Promise.resolve(F).then(w,h)}}function a(w,F){n[w]&&(i[w]=function(A){return new Promise(function(L,_){s.push([w,A,L,_])>1||c(w,A)})},F&&(i[w]=F(i[w])))}function c(w,F){try{u(n[w](F))}catch(A){m(s[0][3],A)}}function u(w){w.value instanceof Ie?Promise.resolve(w.value.v).then(l,h):m(s[0][2],w)}function l(w){c("next",w)}function h(w){c("throw",w)}function m(w,F){w(F),s.shift(),s.length&&c(s[0][0],s[0][1])}}function Gi(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof ze=="function"?ze(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function Y(t){return typeof t=="function"}function Wn(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var xt=Wn(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
30
- `+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
31
- `):"",this.name="UnsubscriptionError",this.errors=r}});function Xt(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var tt=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=ze(o),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(A){e={error:A}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else o.remove(this);var l=this.initialTeardown;if(Y(l))try{l()}catch(A){s=A instanceof xt?A.errors:[A]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var m=ze(h),w=m.next();!w.done;w=m.next()){var F=w.value;try{Nr(F)}catch(A){s=s??[],A instanceof xt?s=Me(Me([],_e(s)),_e(A.errors)):s.push(A)}}}catch(A){n={error:A}}finally{try{w&&!w.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}}if(s)throw new xt(s)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Nr(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&Xt(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&Xt(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Nn=tt.EMPTY;function Hn(t){return t instanceof tt||t&&"closed"in t&&Y(t.remove)&&Y(t.add)&&Y(t.unsubscribe)}function Nr(t){Y(t)?t():t.unsubscribe()}var Un={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},qn={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Me([t,e],_e(r)))},clearTimeout:function(t){var e=qn.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Vn(t){qn.setTimeout(function(){throw t})}function Hr(){}function pt(t){t()}var br=function(t){et(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Hn(r)&&r.add(n)):n.destination=Ji,n}return e.create=function(r,n,i){return new Qe(r,n,i)},e.prototype.next=function(r){this.isStopped||this._next(r)},e.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(tt),Qi=Function.prototype.bind;function Dt(t,e){return Qi.call(t,e)}var Ki=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){ut(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){ut(n)}else ut(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){ut(r)}},t}(),Qe=function(t){et(e,t);function e(r,n,i){var s=t.call(this)||this,o;if(Y(r)||!r)o={next:r??void 0,error:n??void 0,complete:i??void 0};else{var a;s&&Un.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return s.unsubscribe()},o={next:r.next&&Dt(r.next,a),error:r.error&&Dt(r.error,a),complete:r.complete&&Dt(r.complete,a)}):o=r}return s.destination=new Ki(o),s}return e}(br);function ut(t){Vn(t)}function Xi(t){throw t}var Ji={closed:!0,next:Hr,error:Xi,complete:Hr},wr=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Yn(t){return t}function es(t){return t.length===0?Yn:t.length===1?t[0]:function(r){return t.reduce(function(n,i){return i(n)},r)}}var le=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var i=this,s=rs(e)?e:new Qe(e,r,n);return pt(function(){var o=i,a=o.operator,c=o.source;s.add(a?a.call(s,c):c?i._subscribe(s):i._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=Ur(r),new r(function(i,s){var o=new Qe({next:function(a){try{e(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:i});n.subscribe(o)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[wr]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return es(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=Ur(e),new e(function(n,i){var s;r.subscribe(function(o){return s=o},function(o){return i(o)},function(){return n(s)})})},t.create=function(e){return new t(e)},t}();function Ur(t){var e;return(e=t??Un.Promise)!==null&&e!==void 0?e:Promise}function ts(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function rs(t){return t&&t instanceof br||ts(t)&&Hn(t)}function ns(t){return Y(t==null?void 0:t.lift)}function He(t){return function(e){if(ns(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Fe(t,e,r,n,i){return new is(t,e,r,n,i)}var is=function(t){et(e,t);function e(r,n,i,s,o,a){var c=t.call(this,r)||this;return c.onFinalize=o,c.shouldUnsubscribe=a,c._next=n?function(u){try{n(u)}catch(l){r.error(l)}}:t.prototype._next,c._error=s?function(u){try{s(u)}catch(l){r.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(u){r.error(u)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},e}(br),ss={now:function(){return performance.now()},delegate:void 0},Jt={schedule:function(t){var e=requestAnimationFrame,r=cancelAnimationFrame,n=Jt.delegate;n&&(e=n.requestAnimationFrame,r=n.cancelAnimationFrame);var i=e(function(s){r=void 0,t(s)});return new tt(function(){return r==null?void 0:r(i)})},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return requestAnimationFrame.apply(void 0,Me([],_e(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,Me([],_e(t)))},delegate:void 0};function os(t){return t?Bn(t):as}function Bn(t){return new le(function(e){var r=t||ss,n=r.now(),i=0,s=function(){e.closed||(i=Jt.requestAnimationFrame(function(o){i=0;var a=r.now();e.next({timestamp:t?a:o,elapsed:a-n}),s()}))};return s(),function(){i&&Jt.cancelAnimationFrame(i)}})}var as=Bn(),us=Wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),rt=function(t){et(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new qr(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new us},e.prototype.next=function(r){var n=this;pt(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var o=ze(n.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}}})},e.prototype.error=function(r){var n=this;pt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},e.prototype.complete=function(){var r=this;pt(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,i=this,s=i.hasError,o=i.isStopped,a=i.observers;return s||o?Nn:(this.currentObservers=null,a.push(r),new tt(function(){n.currentObservers=null,Xt(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,s=n.thrownError,o=n.isStopped;i?r.error(s):o&&r.complete()},e.prototype.asObservable=function(){var r=new le;return r.source=this,r},e.create=function(r,n){return new qr(r,n)},e}(le),qr=function(t){et(e,t);function e(r,n){var i=t.call(this)||this;return i.destination=r,i.source=n,i}return e.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},e.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:Nn},e}(rt),Zn=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function cs(t){return Y(t==null?void 0:t.then)}function ls(t){return Y(t[wr])}function hs(t){return Symbol.asyncIterator&&Y(t==null?void 0:t[Symbol.asyncIterator])}function fs(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ds(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ps=ds();function vs(t){return Y(t==null?void 0:t[ps])}function ms(t){return Zi(this,arguments,function(){var r,n,i,s;return Ln(this,function(o){switch(o.label){case 0:r=t.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,Ie(r.read())];case 3:return n=o.sent(),i=n.value,s=n.done,s?[4,Ie(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Ie(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function ys(t){return Y(t==null?void 0:t.getReader)}function nt(t){if(t instanceof le)return t;if(t!=null){if(ls(t))return _s(t);if(Zn(t))return bs(t);if(cs(t))return ws(t);if(hs(t))return Gn(t);if(vs(t))return gs(t);if(ys(t))return Ps(t)}throw fs(t)}function _s(t){return new le(function(e){var r=t[wr]();if(Y(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function bs(t){return new le(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function ws(t){return new le(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,Vn)})}function gs(t){return new le(function(e){var r,n;try{for(var i=ze(t),s=i.next();!s.done;s=i.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.complete()})}function Gn(t){return new le(function(e){Ss(t,e).catch(function(r){return e.error(r)})})}function Ps(t){return Gn(ms(t))}function Ss(t,e){var r,n,i,s;return Bi(this,void 0,void 0,function(){var o,a;return Ln(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Gi(t),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Le(t,e){return He(function(r,n){var i=0;r.subscribe(Fe(n,function(s){n.next(t.call(e,s,i++))}))})}var Cs=Array.isArray;function Es(t,e){return Cs(e)?t.apply(void 0,Me([],_e(e))):t(e)}function Os(t){return Le(function(e){return Es(t,e)})}function Ts(t,e,r,n,i,s,o,a){var c=[],u=0,l=0,h=!1,m=function(){h&&!c.length&&!u&&e.complete()},w=function(A){return u<n?F(A):c.push(A)},F=function(A){u++;var L=!1;nt(r(A,l++)).subscribe(Fe(e,function(_){e.next(_)},function(){L=!0},void 0,function(){if(L)try{u--;for(var _=function(){var C=c.shift();o||F(C)};c.length&&u<n;)_();m()}catch(C){e.error(C)}}))};return t.subscribe(Fe(e,w,function(){h=!0,m()})),function(){}}function Qn(t,e,r){return r===void 0&&(r=1/0),Y(e)?Qn(function(n,i){return Le(function(s,o){return e(n,s,i,o)})(nt(t(n,i)))},r):(typeof e=="number"&&(r=e),He(function(n,i){return Ts(n,i,t,r)}))}var Ms=["addListener","removeListener"],Rs=["addEventListener","removeEventListener"],js=["on","off"];function _t(t,e,r,n){if(Y(r)&&(n=r,r=void 0),n)return _t(t,e,r).pipe(Os(n));var i=_e(Ds(t)?Rs.map(function(a){return function(c){return t[a](e,c,r)}}):$s(t)?Ms.map(Vr(t,e)):xs(t)?js.map(Vr(t,e)):[],2),s=i[0],o=i[1];if(!s&&Zn(t))return Qn(function(a){return _t(a,e,r)})(nt(t));if(!s)throw new TypeError("Invalid event target");return new le(function(a){var c=function(){for(var u=[],l=0;l<arguments.length;l++)u[l]=arguments[l];return a.next(1<u.length?u:u[0])};return s(c),function(){return o(c)}})}function Vr(t,e){return function(r){return function(n){return t[r](e,n)}}}function $s(t){return Y(t.addListener)&&Y(t.removeListener)}function xs(t){return Y(t.on)&&Y(t.off)}function Ds(t){return Y(t.addEventListener)&&Y(t.removeEventListener)}function ye(t,e){return He(function(r,n){var i=0;r.subscribe(Fe(n,function(s){return t.call(e,s,i++)&&n.next(s)}))})}function bt(t){t===void 0&&(t={});var e=t.connector,r=e===void 0?function(){return new rt}:e,n=t.resetOnError,i=n===void 0?!0:n,s=t.resetOnComplete,o=s===void 0?!0:s,a=t.resetOnRefCountZero,c=a===void 0?!0:a;return function(u){var l,h,m,w=0,F=!1,A=!1,L=function(){h==null||h.unsubscribe(),h=void 0},_=function(){L(),l=m=void 0,F=A=!1},C=function(){var P=l;_(),P==null||P.unsubscribe()};return He(function(P,R){w++,!A&&!F&&L();var g=m=m??r();R.add(function(){w--,w===0&&!A&&!F&&(h=At(C,c))}),g.subscribe(R),!l&&w>0&&(l=new Qe({next:function(b){return g.next(b)},error:function(b){A=!0,L(),h=At(_,i,b),g.error(b)},complete:function(){F=!0,L(),h=At(_,o),g.complete()}}),nt(P).subscribe(l))})(u)}}function At(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(e===!0){t();return}if(e!==!1){var i=new Qe({next:function(){i.unsubscribe(),t()}});return nt(e.apply(void 0,Me([],_e(r)))).subscribe(i)}}function As(t,e){return e===void 0&&(e=!1),He(function(r,n){var i=0;r.subscribe(Fe(n,function(s){var o=t(s,i++);(o||e)&&n.next(s),!o&&n.complete()}))})}function ks(t,e,r){var n=Y(t)||e||r?{next:t,error:e,complete:r}:t;return n?He(function(i,s){var o;(o=n.subscribe)===null||o===void 0||o.call(n);var a=!0;i.subscribe(Fe(s,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),s.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),s.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),s.error(c)},function(){var c,u;a&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Yn}var ge={},fe={},Pe={},Yr;function Kn(){if(Yr)return Pe;Yr=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.DefaultSerializer=Pe.extendSerializer=void 0;function t(n,i){const s=n.deserialize.bind(n),o=n.serialize.bind(n);return{deserialize(a){return i.deserialize(a,s)},serialize(a){return i.serialize(a,o)}}}Pe.extendSerializer=t;const e={deserialize(n){return Object.assign(Error(n.message),{name:n.name,stack:n.stack})},serialize(n){return{__error_marker:"$$error",message:n.message,name:n.name,stack:n.stack}}},r=n=>n&&typeof n=="object"&&"__error_marker"in n&&n.__error_marker==="$$error";return Pe.DefaultSerializer={deserialize(n){return r(n)?e.deserialize(n):n},serialize(n){return n instanceof Error?e.serialize(n):n}},Pe}var Br;function Ke(){if(Br)return fe;Br=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.serialize=fe.deserialize=fe.registerSerializer=void 0;const t=Kn();let e=t.DefaultSerializer;function r(s){e=t.extendSerializer(e,s)}fe.registerSerializer=r;function n(s){return e.deserialize(s)}fe.deserialize=n;function i(s){return e.serialize(s)}return fe.serialize=i,fe}var kt={},de={},Se={},Zr;function Is(){if(Zr)return Se;Zr=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.getBundleURL=Se.getBaseURL=void 0;let t;function e(){return t||(t=r()),t}Se.getBundleURL=e;function r(){try{throw new Error}catch(i){const s=(""+i.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(s)return n(s[0])}return"/"}function n(i){return(""+i).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/,"$1")+"/"}return Se.getBaseURL=n,Se}var Gr;function Xn(){if(Gr)return de;Gr=1,Object.defineProperty(de,"__esModule",{value:!0}),de.isWorkerRuntime=de.getWorkerImplementation=de.defaultPoolSize=void 0;const t=Is();de.defaultPoolSize=typeof navigator<"u"&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;const e=a=>/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a);function r(a){const c=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(c)}function n(){if(typeof Worker>"u")return class{constructor(){throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.")}};class a extends Worker{constructor(l,h){var m,w;typeof l=="string"&&h&&h._baseURL?l=new URL(l,h._baseURL):typeof l=="string"&&!e(l)&&t.getBundleURL().match(/^file:\/\//i)&&(l=new URL(l,t.getBundleURL().replace(/\/[^\/]+$/,"/")),(!((m=h==null?void 0:h.CORSWorkaround)!==null&&m!==void 0)||m)&&(l=r(`importScripts(${JSON.stringify(l)});`))),typeof l=="string"&&e(l)&&(!((w=h==null?void 0:h.CORSWorkaround)!==null&&w!==void 0)||w)&&(l=r(`importScripts(${JSON.stringify(l)});`)),super(l,h)}}class c extends a{constructor(l,h){const m=window.URL.createObjectURL(l);super(m,h)}static fromText(l,h){const m=new window.Blob([l],{type:"text/javascript"});return new c(m,h)}}return{blob:c,default:a}}let i;function s(){return i||(i=n()),i}de.getWorkerImplementation=s;function o(){const a=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!a)}return de.isWorkerRuntime=o,de}var Ce={},ct={exports:{}},It,Qr;function zs(){if(Qr)return It;Qr=1;var t=1e3,e=t*60,r=e*60,n=r*24,i=n*7,s=n*365.25;It=function(l,h){h=h||{};var m=typeof l;if(m==="string"&&l.length>0)return o(l);if(m==="number"&&isFinite(l))return h.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(h){var m=parseFloat(h[1]),w=(h[2]||"ms").toLowerCase();switch(w){case"years":case"year":case"yrs":case"yr":case"y":return m*s;case"weeks":case"week":case"w":return m*i;case"days":case"day":case"d":return m*n;case"hours":case"hour":case"hrs":case"hr":case"h":return m*r;case"minutes":case"minute":case"mins":case"min":case"m":return m*e;case"seconds":case"second":case"secs":case"sec":case"s":return m*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function a(l){var h=Math.abs(l);return h>=n?Math.round(l/n)+"d":h>=r?Math.round(l/r)+"h":h>=e?Math.round(l/e)+"m":h>=t?Math.round(l/t)+"s":l+"ms"}function c(l){var h=Math.abs(l);return h>=n?u(l,h,n,"day"):h>=r?u(l,h,r,"hour"):h>=e?u(l,h,e,"minute"):h>=t?u(l,h,t,"second"):l+" ms"}function u(l,h,m,w){var F=h>=m*1.5;return Math.round(l/m)+" "+w+(F?"s":"")}return It}var zt,Kr;function Fs(){if(Kr)return zt;Kr=1;function t(e){n.debug=n,n.default=n,n.coerce=u,n.disable=o,n.enable=s,n.enabled=a,n.humanize=zs(),n.destroy=l,Object.keys(e).forEach(h=>{n[h]=e[h]}),n.names=[],n.skips=[],n.formatters={};function r(h){let m=0;for(let w=0;w<h.length;w++)m=(m<<5)-m+h.charCodeAt(w),m|=0;return n.colors[Math.abs(m)%n.colors.length]}n.selectColor=r;function n(h){let m,w=null,F,A;function L(..._){if(!L.enabled)return;const C=L,P=Number(new Date),R=P-(m||P);C.diff=R,C.prev=m,C.curr=P,m=P,_[0]=n.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let g=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(D,H)=>{if(D==="%%")return"%";g++;const y=n.formatters[H];if(typeof y=="function"){const $=_[g];D=y.call(C,$),_.splice(g,1),g--}return D}),n.formatArgs.call(C,_),(C.log||n.log).apply(C,_)}return L.namespace=h,L.useColors=n.useColors(),L.color=n.selectColor(h),L.extend=i,L.destroy=n.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(F!==n.namespaces&&(F=n.namespaces,A=n.enabled(h)),A),set:_=>{w=_}}),typeof n.init=="function"&&n.init(L),L}function i(h,m){const w=n(this.namespace+(typeof m>"u"?":":m)+h);return w.log=this.log,w}function s(h){n.save(h),n.namespaces=h,n.names=[],n.skips=[];let m;const w=(typeof h=="string"?h:"").split(/[\s,]+/),F=w.length;for(m=0;m<F;m++)w[m]&&(h=w[m].replace(/\*/g,".*?"),h[0]==="-"?n.skips.push(new RegExp("^"+h.slice(1)+"$")):n.names.push(new RegExp("^"+h+"$")))}function o(){const h=[...n.names.map(c),...n.skips.map(c).map(m=>"-"+m)].join(",");return n.enable(""),h}function a(h){if(h[h.length-1]==="*")return!0;let m,w;for(m=0,w=n.skips.length;m<w;m++)if(n.skips[m].test(h))return!1;for(m=0,w=n.names.length;m<w;m++)if(n.names[m].test(h))return!0;return!1}function c(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}function u(h){return h instanceof Error?h.stack||h.message:h}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return zt=t,zt}var Xr;function gr(){return Xr||(Xr=1,function(t,e){e.formatArgs=n,e.save=i,e.load=s,e.useColors=r,e.storage=o(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,h=0;c[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(l++,m==="%c"&&(h=l))}),c.splice(h,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function s(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function o(){try{return localStorage}catch{}}t.exports=Fs()(e);const{formatters:a}=t.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(ct,ct.exports)),ct.exports}var Ls=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};class Tt{constructor(e){this._baseObserver=e,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch(e=>this._baseObserver.error(e))}error(e){this._baseObserver.error(e)}schedule(e){const r=Promise.all(this._pendingPromises),n=[],i=o=>n.push(o),s=Promise.resolve().then(()=>Ls(this,void 0,void 0,function*(){yield r,yield e(i),this._pendingPromises.delete(s);for(const o of n)this._baseObserver.next(o)})).catch(o=>{this._pendingPromises.delete(s),this._baseObserver.error(o)});this._pendingPromises.add(s)}}const Jn=()=>typeof Symbol=="function",it=t=>Jn()&&!!Symbol[t],Pr=t=>it(t)?Symbol[t]:"@@"+t;it("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const Ws=Pr("iterator"),er=Pr("observable"),ei=Pr("species");function wt(t,e){const r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function qe(t){let e=t.constructor;return e!==void 0&&(e=e[ei],e===null&&(e=void 0)),e!==void 0?e:re}function Ns(t){return t instanceof re}function We(t){We.log?We.log(t):setTimeout(()=>{throw t},0)}function vt(t){Promise.resolve().then(()=>{try{t()}catch(e){We(e)}})}function ti(t){const e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{const r=wt(e,"unsubscribe");r&&r.call(e)}}catch(r){We(r)}}function tr(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Hs(t){const e=t._queue;if(e){t._queue=void 0,t._state="ready";for(const r of e)if(ri(t,r.type,r.value),t._state==="closed")break}}function ri(t,e,r){t._state="running";const n=t._observer;try{const i=n?wt(n,e):void 0;switch(e){case"next":i&&i.call(n,r);break;case"error":if(tr(t),i)i.call(n,r);else throw r;break;case"complete":tr(t),i&&i.call(n);break}}catch(i){We(i)}t._state==="closed"?ti(t):t._state==="running"&&(t._state="ready")}function Ft(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue=t._queue||[],t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],vt(()=>Hs(t));return}ri(t,e,r)}}class Us{constructor(e,r){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const n=new qs(this);try{this._cleanup=r.call(void 0,n)}catch(i){n.error(i)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(tr(this),ti(this))}}class qs{constructor(e){this._subscription=e}get closed(){return this._subscription._state==="closed"}next(e){Ft(this._subscription,"next",e)}error(e){Ft(this._subscription,"error",e)}complete(){Ft(this._subscription,"complete")}}class re{constructor(e){if(!(this instanceof re))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,r,n){return(typeof e!="object"||e===null)&&(e={next:e,error:r,complete:n}),new Us(e,this._subscriber)}pipe(e,...r){let n=this;for(const i of[e,...r])n=i(n);return n}tap(e,r,n){const i=typeof e!="object"||e===null?{next:e,error:r,complete:n}:e;return new re(s=>this.subscribe({next(o){i.next&&i.next(o),s.next(o)},error(o){i.error&&i.error(o),s.error(o)},complete(){i.complete&&i.complete(),s.complete()},start(o){i.start&&i.start(o)}}))}forEach(e){return new Promise((r,n)=>{if(typeof e!="function"){n(new TypeError(e+" is not a function"));return}function i(){s.unsubscribe(),r(void 0)}const s=this.subscribe({next(o){try{e(o,i)}catch(a){n(a),s.unsubscribe()}},error(o){n(o)},complete(){r(void 0)}})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=qe(this);return new r(n=>this.subscribe({next(i){let s=i;try{s=e(i)}catch(o){return n.error(o)}n.next(s)},error(i){n.error(i)},complete(){n.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=qe(this);return new r(n=>this.subscribe({next(i){try{if(!e(i))return}catch(s){return n.error(s)}n.next(i)},error(i){n.error(i)},complete(){n.complete()}}))}reduce(e,r){if(typeof e!="function")throw new TypeError(e+" is not a function");const n=qe(this),i=arguments.length>1;let s=!1,o=r;return new n(a=>this.subscribe({next(c){const u=!s;if(s=!0,!u||i)try{o=e(o,c)}catch(l){return a.error(l)}else o=c},error(c){a.error(c)},complete(){if(!s&&!i)return a.error(new TypeError("Cannot reduce an empty sequence"));a.next(o),a.complete()}}))}concat(...e){const r=qe(this);return new r(n=>{let i,s=0;function o(a){i=a.subscribe({next(c){n.next(c)},error(c){n.error(c)},complete(){s===e.length?(i=void 0,n.complete()):o(r.from(e[s++]))}})}return o(this),()=>{i&&(i.unsubscribe(),i=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=qe(this);return new r(n=>{const i=[],s=this.subscribe({next(a){let c;if(e)try{c=e(a)}catch(l){return n.error(l)}else c=a;const u=r.from(c).subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){const l=i.indexOf(u);l>=0&&i.splice(l,1),o()}});i.push(u)},error(a){n.error(a)},complete(){o()}});function o(){s.closed&&i.length===0&&n.complete()}return()=>{i.forEach(a=>a.unsubscribe()),s.unsubscribe()}})}[er](){return this}static from(e){const r=typeof this=="function"?this:re;if(e==null)throw new TypeError(e+" is not an object");const n=wt(e,er);if(n){const i=n.call(e);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Ns(i)&&i.constructor===r?i:new r(s=>i.subscribe(s))}if(it("iterator")){const i=wt(e,Ws);if(i)return new r(s=>{vt(()=>{if(!s.closed){for(const o of i.call(e))if(s.next(o),s.closed)return;s.complete()}})})}if(Array.isArray(e))return new r(i=>{vt(()=>{if(!i.closed){for(const s of e)if(i.next(s),i.closed)return;i.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){const r=typeof this=="function"?this:re;return new r(n=>{vt(()=>{if(!n.closed){for(const i of e)if(n.next(i),n.closed)return;n.complete()}})})}static get[ei](){return this}}Jn()&&Object.defineProperty(re,Symbol("extensions"),{value:{symbol:er,hostReportError:We},configurable:!0});function $e(t){typeof t=="function"?t():t&&typeof t.unsubscribe=="function"&&t.unsubscribe()}var Vs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function Ys(t){return e=>new re(r=>{const n=new Tt(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Vs(this,void 0,void 0,function*(){(yield t(s))&&o(s)}))}});return()=>$e(i)})}function Bs(t){return t&&it("asyncIterator")&&t[Symbol.asyncIterator]}function Zs(t){return t&&it("iterator")&&t[Symbol.iterator]}var Gs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},Qs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}};function Ks(t){return e=>new re(r=>{const n=new Tt(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Gs(this,void 0,void 0,function*(){var a,c;const u=yield t(s);if(Zs(u)||Bs(u))try{for(var l=Qs(u),h;h=yield l.next(),!h.done;){const m=h.value;o(m)}}catch(m){a={error:m}}finally{try{h&&!h.done&&(c=l.return)&&(yield c.call(l))}finally{if(a)throw a.error}}else u.map(m=>o(m))}))}});return()=>$e(i)})}function Xs(t){return new re(e=>{let r=0;const n=setInterval(()=>{e.next(r++)},t);return()=>clearInterval(n)})}var Js=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function eo(t){return e=>new re(r=>{const n=new Tt(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Js(this,void 0,void 0,function*(){const a=yield t(s);o(a)}))}});return()=>$e(i)})}function to(...t){return t.length===0?re.from([]):new re(e=>{let r=0;const n=t.map(s=>s.subscribe({error(o){e.error(o),i()},next(o){e.next(o)},complete(){++r===t.length&&(e.complete(),i())}})),i=()=>{n.forEach(s=>$e(s))};return i})}class ni extends re{constructor(){super(e=>(this._observers.add(e),()=>this._observers.delete(e))),this._observers=new Set}next(e){for(const r of this._observers)r.next(e)}error(e){for(const r of this._observers)r.error(e)}complete(){for(const e of this._observers)e.complete()}}function ro(t){const e=new ni;let r,n=0;return new re(i=>{r||(r=t.subscribe(e));const s=e.subscribe(i);return n++,()=>{n--,s.unsubscribe(),n===0&&($e(r),r=void 0)}})}var no=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function io(t,e){return r=>new re(n=>{let i,s=0;const o=new Tt(n),a=r.subscribe({complete(){o.complete()},error(c){o.error(c)},next(c){o.schedule(u=>no(this,void 0,void 0,function*(){i=yield t(s===0?typeof e>"u"?c:e:i,c,s++),u(i)}))}});return()=>$e(a)})}const so=Object.freeze(Object.defineProperty({__proto__:null,Observable:re,Subject:ni,filter:Ys,flatMap:Ks,interval:Xs,map:eo,merge:to,multicast:ro,scan:io,unsubscribe:$e},Symbol.toStringTag,{value:"Module"})),Mt=Oi(so);var Ve={},Jr;function oo(){if(Jr)return Ve;Jr=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.allSettled=void 0;function t(e){return Promise.all(e.map(r=>{const n=o=>({status:"fulfilled",value:o}),i=o=>({status:"rejected",reason:o}),s=Promise.resolve(r);try{return s.then(n,i)}catch(o){return Promise.reject(o)}}))}return Ve.allSettled=t,Ve}var Lt={},en;function ao(){return en||(en=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.PoolEventType=void 0,function(e){e.initialized="initialized",e.taskCanceled="taskCanceled",e.taskCompleted="taskCompleted",e.taskFailed="taskFailed",e.taskQueued="taskQueued",e.taskQueueDrained="taskQueueDrained",e.taskStart="taskStart",e.terminated="terminated"}(t.PoolEventType||(t.PoolEventType={}))}(Lt)),Lt}var Ye={},oe={},tn;function Sr(){return tn||(tn=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.$worker=oe.$transferable=oe.$terminate=oe.$events=oe.$errors=void 0,oe.$errors=Symbol("thread.errors"),oe.$events=Symbol("thread.events"),oe.$terminate=Symbol("thread.terminate"),oe.$transferable=Symbol("thread.transferable"),oe.$worker=Symbol("thread.worker")),oe}var rn;function ii(){if(rn)return Ye;rn=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.Thread=void 0;const t=Sr();function e(r){throw Error(r)}return Ye.Thread={errors(r){return r[t.$errors]||e("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},events(r){return r[t.$events]||e("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},terminate(r){return r[t.$terminate]()}},Ye}var nn;function uo(){return nn||(nn=1,function(t){var e=Ce&&Ce.__awaiter||function(_,C,P,R){function g(b){return b instanceof P?b:new P(function(D){D(b)})}return new(P||(P=Promise))(function(b,D){function H(k){try{$(R.next(k))}catch(U){D(U)}}function y(k){try{$(R.throw(k))}catch(U){D(U)}}function $(k){k.done?b(k.value):g(k.value).then(H,y)}$((R=R.apply(_,C||[])).next())})},r=Ce&&Ce.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(t,"__esModule",{value:!0}),t.Pool=t.Thread=t.PoolEventType=void 0;const n=r(gr()),i=Mt,s=oo(),o=Xn(),a=ao();Object.defineProperty(t,"PoolEventType",{enumerable:!0,get:function(){return a.PoolEventType}});const c=ii();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return c.Thread}});let u=1;function l(_){const C=[];for(let P=0;P<_;P++)C.push(P);return C}function h(_){return new Promise(C=>setTimeout(C,_))}function m(_,C){return _.reduce((P,R)=>[...P,...C(R)],[])}function w(_){return _.replace(/\W/g," ").trim().replace(/\s+/g,"-")}function F(_,C){return l(C).map(()=>({init:_(),runningTasks:[]}))}class A{constructor(C,P){this.eventSubject=new i.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];const R=typeof P=="number"?{size:P}:P||{},{size:g=o.defaultPoolSize}=R;this.debug=n.default(`threads:pool:${w(R.name||String(u++))}`),this.options=R,this.workers=F(C,g),this.eventObservable=i.multicast(i.Observable.from(this.eventSubject)),Promise.all(this.workers.map(b=>b.init)).then(()=>this.eventSubject.next({type:a.PoolEventType.initialized,size:this.workers.length}),b=>{this.debug("Error while initializing pool worker:",b),this.eventSubject.error(b),this.initErrors.push(b)})}findIdlingWorker(){const{concurrency:C=1}=this.options;return this.workers.find(P=>P.runningTasks.length<C)}runPoolTask(C,P){return e(this,void 0,void 0,function*(){const R=this.workers.indexOf(C)+1;this.debug(`Running task #${P.id} on worker #${R}...`),this.eventSubject.next({type:a.PoolEventType.taskStart,taskID:P.id,workerID:R});try{const g=yield P.run(yield C.init);this.debug(`Task #${P.id} completed successfully`),this.eventSubject.next({type:a.PoolEventType.taskCompleted,returnValue:g,taskID:P.id,workerID:R})}catch(g){this.debug(`Task #${P.id} failed`),this.eventSubject.next({type:a.PoolEventType.taskFailed,taskID:P.id,error:g,workerID:R})}})}run(C,P){return e(this,void 0,void 0,function*(){const R=e(this,void 0,void 0,function*(){const g=()=>{C.runningTasks=C.runningTasks.filter(b=>b!==R)};yield h(0);try{yield this.runPoolTask(C,P)}finally{g(),this.isClosing||this.scheduleWork()}});C.runningTasks.push(R)})}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const C=this.findIdlingWorker();if(!C)return;const P=this.taskQueue.shift();if(!P){this.debug("Task queue is empty"),this.eventSubject.next({type:a.PoolEventType.taskQueueDrained});return}this.run(C,P)}taskCompletion(C){return new Promise((P,R)=>{const g=this.events().subscribe(b=>{b.type===a.PoolEventType.taskCompleted&&b.taskID===C?(g.unsubscribe(),P(b.returnValue)):b.type===a.PoolEventType.taskFailed&&b.taskID===C?(g.unsubscribe(),R(b.error)):b.type===a.PoolEventType.terminated&&(g.unsubscribe(),R(Error("Pool has been terminated before task was run.")))})})}settled(C=!1){return e(this,void 0,void 0,function*(){const P=()=>m(this.workers,b=>b.runningTasks),R=[],g=this.eventObservable.subscribe(b=>{b.type===a.PoolEventType.taskFailed&&R.push(b.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):C&&this.taskQueue.length===0?(yield s.allSettled(P()),R):(yield new Promise((b,D)=>{const H=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained&&(H.unsubscribe(),b(void 0))},error:D})}),yield s.allSettled(P()),g.unsubscribe(),R)})}completed(C=!1){return e(this,void 0,void 0,function*(){const P=this.settled(C),R=new Promise((b,D)=>{const H=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained?(H.unsubscribe(),b(P)):y.type===a.PoolEventType.taskFailed&&(H.unsubscribe(),D(y.error))},error:D})}),g=yield Promise.race([P,R]);if(g.length>0)throw g[0]})}events(){return this.eventObservable}queue(C){const{maxQueuedJobs:P=1/0}=this.options;if(this.isClosing)throw Error("Cannot schedule pool tasks after terminate() has been called.");if(this.initErrors.length>0)throw this.initErrors[0];const R=this.nextTaskID++,g=this.taskCompletion(R);g.catch(D=>{this.debug(`Task #${R} errored:`,D)});const b={id:R,run:C,cancel:()=>{this.taskQueue.indexOf(b)!==-1&&(this.taskQueue=this.taskQueue.filter(D=>D!==b),this.eventSubject.next({type:a.PoolEventType.taskCanceled,taskID:b.id}))},then:g.then.bind(g)};if(this.taskQueue.length>=P)throw Error(`Maximum number of pool tasks queued. Refusing to queue another one.
32
- This usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.`);return this.debug(`Queueing task #${b.id}...`),this.taskQueue.push(b),this.eventSubject.next({type:a.PoolEventType.taskQueued,taskID:b.id}),this.scheduleWork(),b}terminate(C){return e(this,void 0,void 0,function*(){this.isClosing=!0,C||(yield this.completed(!0)),this.eventSubject.next({type:a.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(P=>e(this,void 0,void 0,function*(){return c.Thread.terminate(yield P.init)})))})}}A.EventType=a.PoolEventType;function L(_,C){return new A(_,C)}L.EventType=a.PoolEventType,t.Pool=L}(Ce)),Ce}var pe={},Be={},sn;function co(){if(sn)return Be;sn=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.createPromiseWithResolver=void 0;const t=()=>{};function e(){let r=!1,n,i=t;return[new Promise(a=>{r?a(n):i=a}),a=>{r=!0,n=a,i(n)}]}return Be.createPromiseWithResolver=e,Be}var Wt={},on;function lo(){return on||(on=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerEventType=void 0,function(e){e.internalError="internalError",e.message="message",e.termination="termination"}(t.WorkerEventType||(t.WorkerEventType={}))}(Wt)),Wt}var ve={},Ze={},an;function ho(){if(an)return Ze;an=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.ObservablePromise=void 0;const t=Mt,e=()=>{},r=a=>a,n=a=>Promise.resolve().then(a);function i(a){throw a}function s(a){return a&&typeof a.then=="function"}class o extends t.Observable{constructor(c){super(u=>{const l=this,h=Object.assign(Object.assign({},u),{complete(){u.complete(),l.onCompletion()},error(m){u.error(m),l.onError(m)},next(m){u.next(m),l.onNext(m)}});try{return this.initHasRun=!0,c(h)}catch(m){h.error(m)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(c){this.firstValueSet||(this.firstValue=c,this.firstValueSet=!0)}onError(c){this.state="rejected",this.rejection=c;for(const u of this.rejectionCallbacks)n(()=>u(c))}onCompletion(){this.state="fulfilled";for(const c of this.fulfillmentCallbacks)n(()=>c(this.firstValue))}then(c,u){const l=c||r,h=u||i;let m=!1;return new Promise((w,F)=>{const A=_=>{if(!m){m=!0;try{w(h(_))}catch(C){F(C)}}},L=_=>{try{w(l(_))}catch(C){A(C)}};if(this.initHasRun||this.subscribe({error:A}),this.state==="fulfilled")return w(l(this.firstValue));if(this.state==="rejected")return m=!0,w(h(this.rejection));this.fulfillmentCallbacks.push(L),this.rejectionCallbacks.push(A)})}catch(c){return this.then(void 0,c)}finally(c){const u=c||e;return this.then(l=>(u(),l),()=>u())}static from(c){return s(c)?new o(u=>{const l=m=>{u.next(m),u.complete()},h=m=>{u.error(m)};c.then(l,h)}):super.from(c)}}return Ze.ObservablePromise=o,Ze}var Ee={},un;function gt(){if(un)return Ee;un=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.Transfer=Ee.isTransferDescriptor=void 0;const t=Sr();function e(i){return!(!i||typeof i!="object")}function r(i){return i&&typeof i=="object"&&i[t.$transferable]}Ee.isTransferDescriptor=r;function n(i,s){if(!s){if(!e(i))throw Error();s=[i]}return{[t.$transferable]:!0,send:i,transferables:s}}return Ee.Transfer=n,Ee}var Nt={},cn;function si(){return cn||(cn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerMessageType=t.MasterMessageType=void 0,function(e){e.cancel="cancel",e.run="run"}(t.MasterMessageType||(t.MasterMessageType={})),function(e){e.error="error",e.init="init",e.result="result",e.running="running",e.uncaughtError="uncaughtError"}(t.WorkerMessageType||(t.WorkerMessageType={}))}(Nt)),Nt}var ln;function fo(){if(ln)return ve;ln=1;var t=ve&&ve.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(ve,"__esModule",{value:!0}),ve.createProxyModule=ve.createProxyFunction=void 0;const e=t(gr()),r=Mt,n=Ke(),i=ho(),s=gt(),o=si(),a=e.default("threads:master:messages");let c=1;const u=_=>Array.from(new Set(_)),l=_=>_&&_.type===o.WorkerMessageType.error,h=_=>_&&_.type===o.WorkerMessageType.result,m=_=>_&&_.type===o.WorkerMessageType.running;function w(_,C){return new r.Observable(P=>{let R;const g=b=>{if(a("Message from worker:",b.data),!(!b.data||b.data.uid!==C)){if(m(b.data))R=b.data.resultType;else if(h(b.data))R==="promise"?(typeof b.data.payload<"u"&&P.next(n.deserialize(b.data.payload)),P.complete(),_.removeEventListener("message",g)):(b.data.payload&&P.next(n.deserialize(b.data.payload)),b.data.complete&&(P.complete(),_.removeEventListener("message",g)));else if(l(b.data)){const D=n.deserialize(b.data.error);P.error(D),_.removeEventListener("message",g)}}};return _.addEventListener("message",g),()=>{if(R==="observable"||!R){const b={type:o.MasterMessageType.cancel,uid:C};_.postMessage(b)}_.removeEventListener("message",g)}})}function F(_){if(_.length===0)return{args:[],transferables:[]};const C=[],P=[];for(const R of _)s.isTransferDescriptor(R)?(C.push(n.serialize(R.send)),P.push(...R.transferables)):C.push(n.serialize(R));return{args:C,transferables:P.length===0?P:u(P)}}function A(_,C){return(...P)=>{const R=c++,{args:g,transferables:b}=F(P),D={type:o.MasterMessageType.run,uid:R,method:C,args:g};a("Sending command to run function to worker:",D);try{_.postMessage(D,b)}catch(H){return i.ObservablePromise.from(Promise.reject(H))}return i.ObservablePromise.from(r.multicast(w(_,R)))}}ve.createProxyFunction=A;function L(_,C){const P={};for(const R of C)P[R]=A(_,R);return P}return ve.createProxyModule=L,ve}var hn;function po(){if(hn)return pe;hn=1;var t=pe&&pe.__awaiter||function(g,b,D,H){function y($){return $ instanceof D?$:new D(function(k){k($)})}return new(D||(D=Promise))(function($,k){function U(Q){try{B(H.next(Q))}catch(he){k(he)}}function ne(Q){try{B(H.throw(Q))}catch(he){k(he)}}function B(Q){Q.done?$(Q.value):y(Q.value).then(U,ne)}B((H=H.apply(g,b||[])).next())})},e=pe&&pe.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(pe,"__esModule",{value:!0}),pe.spawn=void 0;const r=e(gr()),n=Mt,i=Ke(),s=co(),o=Sr(),a=lo(),c=fo(),u=r.default("threads:master:messages"),l=r.default("threads:master:spawn"),h=r.default("threads:master:thread-utils"),m=g=>g&&g.type==="init",w=g=>g&&g.type==="uncaughtError",F=typeof process<"u"&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function A(g,b,D){return t(this,void 0,void 0,function*(){let H;const y=new Promise((k,U)=>{H=setTimeout(()=>U(Error(D)),b)}),$=yield Promise.race([g,y]);return clearTimeout(H),$})}function L(g){return new Promise((b,D)=>{const H=y=>{u("Message from worker before finishing initialization:",y.data),m(y.data)?(g.removeEventListener("message",H),b(y.data)):w(y.data)&&(g.removeEventListener("message",H),D(i.deserialize(y.data.error)))};g.addEventListener("message",H)})}function _(g,b){return new n.Observable(D=>{const H=$=>{const k={type:a.WorkerEventType.message,data:$.data};D.next(k)},y=$=>{h("Unhandled promise rejection event in thread:",$);const k={type:a.WorkerEventType.internalError,error:Error($.reason)};D.next(k)};g.addEventListener("message",H),g.addEventListener("unhandledrejection",y),b.then(()=>{const $={type:a.WorkerEventType.termination};g.removeEventListener("message",H),g.removeEventListener("unhandledrejection",y),D.next($),D.complete()})})}function C(g){const[b,D]=s.createPromiseWithResolver();return{terminate:()=>t(this,void 0,void 0,function*(){h("Terminating worker"),yield g.terminate(),D()}),termination:b}}function P(g,b,D,H){const y=D.filter($=>$.type===a.WorkerEventType.internalError).map($=>$.error);return Object.assign(g,{[o.$errors]:y,[o.$events]:D,[o.$terminate]:H,[o.$worker]:b})}function R(g,b){return t(this,void 0,void 0,function*(){l("Initializing new thread");const D=b&&b.timeout?b.timeout:F,y=(yield A(L(g),D,`Timeout: Did not receive an init message from worker after ${D}ms. Make sure the worker calls expose().`)).exposed,{termination:$,terminate:k}=C(g),U=_(g,$);if(y.type==="function"){const ne=c.createProxyFunction(g);return P(ne,g,U,k)}else if(y.type==="module"){const ne=c.createProxyModule(g,y.methods);return P(ne,g,U,k)}else{const ne=y.type;throw Error(`Worker init message states unexpected type of expose(): ${ne}`)}})}return pe.spawn=R,pe}var fn;function vo(){return fn||(fn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Worker=t.BlobWorker=t.isWorkerRuntime=t.Thread=t.spawn=t.Pool=void 0;const e=Xn();Object.defineProperty(t,"isWorkerRuntime",{enumerable:!0,get:function(){return e.isWorkerRuntime}});var r=uo();Object.defineProperty(t,"Pool",{enumerable:!0,get:function(){return r.Pool}});var n=po();Object.defineProperty(t,"spawn",{enumerable:!0,get:function(){return n.spawn}});var i=ii();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return i.Thread}}),t.BlobWorker=e.getWorkerImplementation().blob,t.Worker=e.getWorkerImplementation().default}(kt)),kt}var Oe={},Ht,dn;function mo(){return dn||(dn=1,Ht=t=>t?typeof Symbol.observable=="symbol"&&typeof t[Symbol.observable]=="function"?t===t[Symbol.observable]():typeof t["@@observable"]=="function"?t===t["@@observable"]():!1:!1),Ht}var lt={},pn;function yo(){if(pn)return lt;pn=1,Object.defineProperty(lt,"__esModule",{value:!0});const t=function(){const i=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!i)},e=function(i,s){self.postMessage(i,s)},r=function(i){const s=a=>{i(a.data)},o=()=>{self.removeEventListener("message",s)};return self.addEventListener("message",s),o};return lt.default={isWorkerRuntime:t,postMessageToMaster:e,subscribeToMasterMessages:r},lt}var vn;function oi(){return vn||(vn=1,function(t){var e=Oe&&Oe.__awaiter||function(y,$,k,U){function ne(B){return B instanceof k?B:new k(function(Q){Q(B)})}return new(k||(k=Promise))(function(B,Q){function he(ue){try{xe(U.next(ue))}catch(De){Q(De)}}function st(ue){try{xe(U.throw(ue))}catch(De){Q(De)}}function xe(ue){ue.done?B(ue.value):ne(ue.value).then(he,st)}xe((U=U.apply(y,$||[])).next())})},r=Oe&&Oe.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(t,"__esModule",{value:!0}),t.expose=t.isWorkerRuntime=t.Transfer=t.registerSerializer=void 0;const n=r(mo()),i=Ke(),s=gt(),o=si(),a=r(yo());var c=Ke();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return c.registerSerializer}});var u=gt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return u.Transfer}}),t.isWorkerRuntime=a.default.isWorkerRuntime;let l=!1;const h=new Map,m=y=>y&&y.type===o.MasterMessageType.cancel,w=y=>y&&y.type===o.MasterMessageType.run,F=y=>n.default(y)||A(y);function A(y){return y&&typeof y=="object"&&typeof y.subscribe=="function"}function L(y){return s.isTransferDescriptor(y)?{payload:y.send,transferables:y.transferables}:{payload:y,transferables:void 0}}function _(){const y={type:o.WorkerMessageType.init,exposed:{type:"function"}};a.default.postMessageToMaster(y)}function C(y){const $={type:o.WorkerMessageType.init,exposed:{type:"module",methods:y}};a.default.postMessageToMaster($)}function P(y,$){const{payload:k,transferables:U}=L($),ne={type:o.WorkerMessageType.error,uid:y,error:i.serialize(k)};a.default.postMessageToMaster(ne,U)}function R(y,$,k){const{payload:U,transferables:ne}=L(k),B={type:o.WorkerMessageType.result,uid:y,complete:$?!0:void 0,payload:U};a.default.postMessageToMaster(B,ne)}function g(y,$){const k={type:o.WorkerMessageType.running,uid:y,resultType:$};a.default.postMessageToMaster(k)}function b(y){try{const $={type:o.WorkerMessageType.uncaughtError,error:i.serialize(y)};a.default.postMessageToMaster($)}catch($){console.error(`Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.
33
- Latest error:`,$,`
34
- Original error:`,y)}}function D(y,$,k){return e(this,void 0,void 0,function*(){let U;try{U=$(...k)}catch(B){return P(y,B)}const ne=F(U)?"observable":"promise";if(g(y,ne),F(U)){const B=U.subscribe(Q=>R(y,!1,i.serialize(Q)),Q=>{P(y,i.serialize(Q)),h.delete(y)},()=>{R(y,!0),h.delete(y)});h.set(y,B)}else try{const B=yield U;R(y,!0,i.serialize(B))}catch(B){P(y,i.serialize(B))}})}function H(y){if(!a.default.isWorkerRuntime())throw Error("expose() called in the master thread.");if(l)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(l=!0,typeof y=="function")a.default.subscribeToMasterMessages($=>{w($)&&!$.method&&D($.uid,y,$.args.map(i.deserialize))}),_();else if(typeof y=="object"&&y){a.default.subscribeToMasterMessages(k=>{w(k)&&k.method&&D(k.uid,y[k.method],k.args.map(i.deserialize))});const $=Object.keys(y).filter(k=>typeof y[k]=="function");C($)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${y}`);a.default.subscribeToMasterMessages($=>{if(m($)){const k=$.uid,U=h.get(k);U&&(U.unsubscribe(),h.delete(k))}})}t.expose=H,typeof self<"u"&&typeof self.addEventListener=="function"&&a.default.isWorkerRuntime()&&(self.addEventListener("error",y=>{setTimeout(()=>b(y.error||y),250)}),self.addEventListener("unhandledrejection",y=>{const $=y.reason;$&&typeof $.message=="string"&&setTimeout(()=>b($),250)})),typeof process<"u"&&typeof process.on=="function"&&a.default.isWorkerRuntime()&&(process.on("uncaughtException",y=>{setTimeout(()=>b(y),250)}),process.on("unhandledRejection",y=>{y&&typeof y.message=="string"&&setTimeout(()=>b(y),250)}))}(Oe)),Oe}var mn;function _o(){return mn||(mn=1,function(t){var e=ge&&ge.__createBinding||(Object.create?function(a,c,u,l){l===void 0&&(l=u),Object.defineProperty(a,l,{enumerable:!0,get:function(){return c[u]}})}:function(a,c,u,l){l===void 0&&(l=u),a[l]=c[u]}),r=ge&&ge.__exportStar||function(a,c){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(c,u)&&e(c,a,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.Transfer=t.DefaultSerializer=t.expose=t.registerSerializer=void 0;var n=Ke();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return n.registerSerializer}}),r(vo(),t);var i=oi();Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return i.expose}});var s=Kn();Object.defineProperty(t,"DefaultSerializer",{enumerable:!0,get:function(){return s.DefaultSerializer}});var o=gt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return o.Transfer}})}(ge)),ge}var bo=_o();const we=Rn(bo);we.registerSerializer;const wo=we.spawn;we.BlobWorker;we.DefaultSerializer;we.Pool;const go=we.Thread;we.Transfer;const Po=we.Worker;var So=Object.defineProperty,Co=(t,e,r)=>e in t?So(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,se=(t,e,r)=>Co(t,typeof e!="symbol"?e+"":e,r);class Eo extends O.EventDispatcher{constructor(){super(),se(this,"style",{}),se(this,"width",0),se(this,"height",0),se(this,"left",0),se(this,"top",0),this.getRootNode=this.getRootNode.bind(this),this.handleEvent=this.handleEvent.bind(this)}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getRootNode(){return this}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height}}handleEvent(e){if(e.type==="resize"){this.left=e.left??0,this.top=e.top??0,this.width=e.width??0,this.height=e.height??0;return}e.preventDefault=()=>{},e.stopPropagation=()=>{},this.dispatchEvent(e)}focus(){}}const Oo=()=>{try{if(window){if(navigator!=null&&navigator.hardwareConcurrency)return navigator.hardwareConcurrency;throw new Error("Unable to determine the number of cores")}else return require("os").cpus().length}catch(t){return console.error("🛑 Unable to detect available cores",t),2}},To=()=>Oo()-1,Mo="TERMINATE_THREAD_FROM_WORKER";let Ro=-1;class jo{constructor(e){se(this,"_handleTerminate"),se(this,"_handleError"),se(this,"_task"),se(this,"id",Ro+=1),se(this,"idle",!0),se(this,"worker"),se(this,"thread"),this._handleTerminate=e==null?void 0:e.onTerminate,this._handleError=e==null?void 0:e.onError}_handleMessages(e){var r;e instanceof MessageEvent&&((r=e.data)==null?void 0:r.token)===Mo&&this.terminate()}async run(e){var r;try{const{payload:n,options:i}=e;return this.idle=!1,this.worker=new Po(n.path,{type:"module",...i==null?void 0:i.worker}),this.thread=await wo(this.worker,{timeout:1e4,...i==null?void 0:i.spawn}),this._task=e,this.worker.postMessage(n.subject,n.transferSubject),this.worker.addEventListener("message",this._handleMessages.bind(this)),{worker:this.worker,thread:this.thread}}catch(n){(r=this._handleError)==null||r.call(this,n);return}}get task(){return this._task}async terminate(){var e,r,n;(e=this.worker)==null||e.removeEventListener("message",this._handleMessages.bind(this)),this.thread&&await go.terminate(this.thread),await((r=this.worker)==null?void 0:r.terminate()),this.worker=void 0,this.thread=void 0,this._task=void 0,this.idle=!0,(n=this._handleTerminate)==null||n.call(this)}}class $o{constructor(e,r,n){se(this,"_workerThreads",[]),se(this,"_tasksQueue",[]),this.maxWorkersCount=e,this.debugMode=r,this.onWorkerThreadRun=n;for(let i=0;i<this.maxWorkersCount;i++)this._workerThreads.push(this._createWorkerThread())}_handleWorkerThreadTerminate(e){this.debugMode&&console.log(`WorkerThread #${e.id} freed`),this.runNext()}_handleWorkerThreadError(e,r){console.error(`Error from worker #${r.id}:`,e),this.runNext()}_createWorkerThread(){const e=new jo({onTerminate:()=>this._handleWorkerThreadTerminate(e),onError:r=>this._handleWorkerThreadError(r,e)});return e}get workerThreads(){return this._workerThreads}get tasksQueue(){return this._tasksQueue}get nextAvailableWorkerThread(){return this._workerThreads.find(e=>e.idle)}getAvailableWorkerThreads(e=!1){return this._workerThreads.filter(r=>e?!r.idle:r.idle)}async runNext(){if(!this.nextAvailableWorkerThread||this._tasksQueue.length===0)return;const e=this._tasksQueue.shift();e&&await this.run(e)}async run(e,r=!1){var n;if(r){const o=this._createWorkerThread();return this.debugMode&&console.log(`Running On Untracked Thread #${o==null?void 0:o.id}. Task:`,e),[await o.run(e),!1]}const i=this.nextAvailableWorkerThread;if(!i)return this._tasksQueue.push(e),this.debugMode&&console.log("Queued Thread Task:",e),[void 0,!0];this.debugMode&&console.log(`Running On Thread #${i==null?void 0:i.id}. Task:`,e);const s=await i.run(e);return(n=this.onWorkerThreadRun)==null||n.call(this,i),[s,!1]}async terminateAll(){this._tasksQueue=[],await Promise.all(this._workerThreads.map(e=>e.terminate()))}}const xo=(t,e)=>new $o(To(),!!e),Do=t=>t===void 0,Ao=t=>typeof t=="boolean",ko=t=>!!t&&typeof t=="function",Io=t=>{var e,r;const n=t.toJSON();return JSON.stringify({...n,object:{...n.object,position:["x","y","z"].map(i=>t.position[i]),rotation:["x","y","z","order"].map(i=>t.rotation[i]),children:((r=(e=n==null?void 0:n.object)==null?void 0:e.children)==null?void 0:r.map((i,s)=>({...typeof i=="object"?i:typeof i=="string"?JSON.parse(i):{},position:["x","y","z"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.position[o]}),rotation:["x","y","z","order"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.rotation[o]})})))??[]},isSerialized:!0})},yn=(t,e=new O.ObjectLoader)=>{const r=JSON.parse(t);if(r!=null&&r.metadata&&r.object&&r.isSerialized){const n=e.parse(r);return n.position.set(...r.object.position),n.rotation.set(...r.object.rotation),n.children.map((i,s)=>{i.position.set(...r.object.children[s].position)}),n.children.map((i,s)=>{i.rotation.set(...r.object.children[s].rotation)}),n}return r},ai=(t,e)=>{const r={type:t==null?void 0:t.type};for(const n of e)t[n]!==void 0&&(r[n]=t[n]);return r},rr=(t,e)=>{const r={type:t==null?void 0:t.type};for(const[n,i]of Object.entries(t))e.includes(n)||(r[n]=i);return r};var zo=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Lo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Fo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&zo(e,r,i),i};let Xe=class{constructor(){p(this,"_canvas");p(this,"proxyReceiver",new Eo);p(this,"initialized",!1)}get canvas(){return this._canvas}set canvas(t){t.style={width:t.width+"",height:t.height+""},this._canvas=t}};Xe=Lo([G()],Xe);var Wo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Ho=(t,e,r,n)=>{for(var i=n>1?void 0:n?No(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Wo(e,r,i),i},Uo=(t,e)=>(r,n)=>e(r,n,t);let Pt=class extends In{constructor(t){super(),this._service=t;for(const e of _r)this[`${e}$$`]=new rt,this[`${e}$`]=this[`${e}$$`].pipe(),this[e]=r=>{this._service.proxyReceiver.handleEvent({...r,type:r.type||e}),this[`${e}$$`].next(r)}}};Pt=Ho([G(),Uo(0,z(Xe))],Pt);var qo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,Yo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Vo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&qo(e,r,i),i};let St=class{constructor(){p(this,"frame",1e3/60);p(this,"initialTime",Date.now());p(this,"currentTime",0);p(this,"deltaTime",0);p(this,"deltaRatio",0);p(this,"elapsedTime",0);p(this,"enabled",!1)}step(){const t=Date.now();this.deltaTime=t-this.currentTime,this.currentTime=t,this.elapsedTime=t-this.initialTime,this.deltaRatio=this.deltaTime/this.frame}};St=Yo([G()],St);var Bo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,Go=(t,e,r,n)=>{for(var i=n>1?void 0:n?Zo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Bo(e,r,i),i},Qo=(t,e)=>(r,n)=>e(r,n,t);let Ne=class{constructor(t){p(this,"beforeStep$$",new rt);p(this,"_previousTime",0);p(this,"beforeStep$",this.beforeStep$$.asObservable());p(this,"step$",os().pipe(ks(({elapsed:t})=>{var e;this._previousTime!==t&&((e=this.beforeStep$$)==null||e.next(rr(this._service,[])),this._previousTime=t)}),ye(()=>this._service.enabled),As(()=>this._service.enabled),Le(()=>rr(this._service,[])),bt()));this._service=t}};Ne=Go([G(),Qo(0,z(St))],Ne);var Ko=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Jo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Xo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ko(e,r,i),i},_n=(t,e)=>(r,n)=>e(r,n,t);let nr=class{constructor(t,e){p(this,"_initialAnimationFrameId");p(this,"_subscriptions",[]);this._controller=t,this._service=e,this._subscriptions.push(this._controller.step$.subscribe(this._service.step.bind(this._service)))}init(t){this.enabled(t)}frame(){return this._service.frame}deltaTime(t){return typeof t=="number"&&(this._service.deltaTime=t),this._service.deltaTime}deltaRatio(t){return typeof t=="number"&&(this._service.deltaRatio=t),this._service.deltaRatio}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}dispose(){this._initialAnimationFrameId!==void 0&&cancelAnimationFrame(this._initialAnimationFrameId),this._service.enabled=!1}beforeStep$(){return this._controller.beforeStep$}step$(){return this._controller.step$}};nr=Jo([G(),_n(0,z(Ne)),_n(1,z(St))],nr);var ea=Object.defineProperty,ta=Object.getOwnPropertyDescriptor,ra=(t,e,r,n)=>{for(var i=n>1?void 0:n?ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ea(e,r,i),i};let be=class{constructor(){p(this,"width",0);p(this,"height",0);p(this,"aspect",0);p(this,"pixelRatio",0);p(this,"frustrum",5);p(this,"enabled",!0)}init(t,e){this.height=Number(t.height??this.height),this.width=Number(t.width??this.width),this.aspect=this.width/this.height,this.enabled=e===void 0?!0:!!e}};be=ra([G()],be);var na=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,sa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ia(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&na(e,r,i),i},oa=(t,e)=>(r,n)=>e(r,n,t);let Re=class{constructor(t){p(this,"instance");p(this,"enabled",!0);this._sizesService=t}set aspectRatio(t){var e;this.instance instanceof O.PerspectiveCamera&&(this.instance.aspect=t),(this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&((e=this.instance)==null||e.updateProjectionMatrix())}set quaternion(t){var e;(e=this.instance)==null||e.quaternion.copy(t)}set position(t){var e;(e=this.instance)==null||e.position.copy(t)}set rotation(t){var e;(e=this.instance)==null||e.rotation.copy(t)}init(t){if(this.dispose(),t===yt.PERSPECTIVE||t===void 0){this.instance=new O.PerspectiveCamera(70,this._sizesService.width/this._sizesService.height,1e-4,100),this.instance.position.z=8;return}t===yt.ORTHOGRAPHIC&&(this.instance=new O.OrthographicCamera(-this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.frustrum/2,-this._sizesService.frustrum/2,-50,50))}dispose(){this.instance instanceof O.Camera&&((this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&this.instance.clearViewOffset(),this.instance.clear(),this.instance=void 0)}};Re=sa([G(),oa(0,z(be))],Re);var aa=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,ca=(t,e,r,n)=>{for(var i=n>1?void 0:n?ua(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&aa(e,r,i),i},bn=(t,e)=>(r,n)=>e(r,n,t);let ir=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};ir=ca([G(),bn(0,z(Ne)),bn(1,z(Re))],ir);var la=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,fa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ha(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&la(e,r,i),i},Ut=(t,e)=>(r,n)=>e(r,n,t);let sr=class{constructor(t,e,r){p(this,"_subscriptions",[]);this._sizesService=t,this._controller=e,this._service=r}init(){this._service.init(),this._subscriptions.push(this._controller.step$.subscribe(()=>{var t;this._service.enabled&&(this._service.aspectRatio=this._sizesService.aspect,(this._service.instance instanceof O.PerspectiveCamera||this._service.instance instanceof O.OrthographicCamera)&&((t=this._service.instance)==null||t.updateProjectionMatrix()))}))}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}aspectRatio(t){return t&&(this._service.aspectRatio=t),this._service.aspectRatio}instance(t){return t&&(this._service.instance=t),this._service.instance}position(t){return t&&(this._service.position=t),this._service.position}quaternion(t){return t&&(this._service.quaternion=t),this._service.quaternion}dispose(){this._subscriptions.forEach(t=>t.unsubscribe()),this._service.dispose()}};sr=fa([G(),Ut(0,z(be)),Ut(1,z(ir)),Ut(2,z(Re))],sr);var da=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,va=(t,e,r,n)=>{for(var i=n>1?void 0:n?pa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&da(e,r,i),i};let Je=class{constructor(){p(this,"scene",new O.Scene);p(this,"enabled",!0)}};Je=va([G()],Je);var ui=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,ya=(t,e,r)=>e in t?ui(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ma(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ui(e,r,i),i},qt=(t,e)=>(r,n)=>e(r,n,t),ba=(t,e,r)=>ya(t,e+"",r);let je=class{constructor(t,e,r){p(this,"enabled",!0);p(this,"instance");this._worldService=t,this._cameraService=e,this._sizesService=r}setWebGLRenderer(t){this.instance=new O.WebGLRenderer({canvas:t,context:t.getContext("webgl2",{stencil:!0,powerPreference:"high-performance"}),powerPreference:"high-performance",depth:!0,antialias:!0}),this.instance.autoClear=!1,this.instance.setPixelRatio(je.RENDERER_PIXEL_RATIO),this.instance.setClearColor(0,0),this.instance.shadowMap.enabled=!0,this.instance.shadowMap.type=O.PCFSoftShadowMap,this.instance.outputColorSpace=O.SRGBColorSpace,this.instance.toneMapping=O.CineonToneMapping,this.instance.toneMappingExposure=1.75}setSize(t,e){var r;(r=this.instance)==null||r.setSize(t,e)}render(){this.enabled&&this._cameraService.instance instanceof O.Camera&&this.instance instanceof O.WebGLRenderer&&(this.instance.setViewport(0,0,this._sizesService.width,this._sizesService.height),this.instance.render(this._worldService.scene,this._cameraService.instance))}};ba(je,"RENDERER_PIXEL_RATIO",1);je=_a([G(),qt(0,z(Je)),qt(1,z(Re)),qt(2,z(be))],je);var wa=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,Pa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ga(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&wa(e,r,i),i},wn=(t,e)=>(r,n)=>e(r,n,t);let Ct=class{constructor(t,e){p(this,"resize$");this._appController=t,this._service=e,this.resize$=this._appController.resize$$.pipe(ye(()=>this._service.enabled))}};Ct=Pa([G(),wn(0,z(Pt)),wn(1,z(be))],Ct);var Sa=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,Ea=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ca(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Sa(e,r,i),i},Vt=(t,e)=>(r,n)=>e(r,n,t);let or=class{constructor(t,e,r){p(this,"step$");p(this,"resize$");this._service=t,this.timerController=e,this.sizesController=r,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled)),this.resize$=this.sizesController.resize$.pipe(ye(()=>this._service.enabled))}};or=Ea([G(),Vt(0,z(je)),Vt(1,z(Ne)),Vt(2,z(Ct))],or);var Oa=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,Ma=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Oa(e,r,i),i},gn=(t,e)=>(r,n)=>e(r,n,t);let ar=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.step$.subscribe(()=>this._service.render()),this._controller.resize$.subscribe(e=>this._service.setSize(e.windowWidth,e.windowHeight)),this._service.setWebGLRenderer(t)}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}instance(){return this._service.instance}setSize(t){return this._service.setSize(t.x,t.y)}render(){return this._service.render()}dispose(){var t;(t=this._service.instance)==null||t.dispose(),this._service.instance=void 0}};ar=Ma([G(),gn(0,z(or)),gn(1,z(je))],ar);var Ra=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,$a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ra(e,r,i),i},Pn=(t,e)=>(r,n)=>e(r,n,t);let ur=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.resize$.subscribe(e=>{this._service.width=e.windowWidth,this._service.height=e.windowHeight,this._service.aspect=e.windowWidth/e.windowHeight}),this._service.init(t)}dispose(){}aspect(t){return typeof t=="number"&&(this._service.aspect=t),this._service.aspect}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}frustrum(t){return typeof t=="number"&&(this._service.frustrum=t),this._service.frustrum}height(t){return typeof t=="number"&&(this._service.height=t),this._service.height}pixelRatio(t){return typeof t=="number"&&(this._service.pixelRatio=t),this._service.pixelRatio}width(t){return typeof t=="number"&&(this._service.width=t),this._service.width}resize$(){return this._controller.resize$}};ur=$a([G(),Pn(0,z(Ct)),Pn(1,z(be))],ur);var xa=Object.defineProperty,Da=Object.getOwnPropertyDescriptor,Aa=(t,e,r,n)=>{for(var i=n>1?void 0:n?Da(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&xa(e,r,i),i},ka=(t,e)=>(r,n)=>e(r,n,t);let cr=class{constructor(t){this._service=t}init(){}dispose(){}scene(t){return t instanceof O.Scene&&(this._service.scene=t),this._service.scene}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}};cr=Aa([G(),ka(0,z(Je))],cr);const Sn={type:"change"},Cr={type:"start"},ci={type:"end"},ht=new O.Ray,Cn=new O.Plane,Ia=Math.cos(70*O.MathUtils.DEG2RAD),J=new O.Vector3,ie=2*Math.PI,q={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Yt=1e-6;class En extends O.Controls{constructor(e,r=null){super(e,r),this.state=q.NONE,this.enabled=!0,this.target=new O.Vector3,this.cursor=new O.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:O.MOUSE.ROTATE,MIDDLE:O.MOUSE.DOLLY,RIGHT:O.MOUSE.PAN},this.touches={ONE:O.TOUCH.ROTATE,TWO:O.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new O.Vector3,this._lastQuaternion=new O.Quaternion,this._lastTargetPosition=new O.Vector3,this._quat=new O.Quaternion().setFromUnitVectors(e.up,new O.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new O.Spherical,this._sphericalDelta=new O.Spherical,this._scale=1,this._panOffset=new O.Vector3,this._rotateStart=new O.Vector2,this._rotateEnd=new O.Vector2,this._rotateDelta=new O.Vector2,this._panStart=new O.Vector2,this._panEnd=new O.Vector2,this._panDelta=new O.Vector2,this._dollyStart=new O.Vector2,this._dollyEnd=new O.Vector2,this._dollyDelta=new O.Vector2,this._dollyDirection=new O.Vector3,this._mouse=new O.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Fa.bind(this),this._onPointerDown=za.bind(this),this._onPointerUp=La.bind(this),this._onContextMenu=Ya.bind(this),this._onMouseWheel=Ha.bind(this),this._onKeyDown=Ua.bind(this),this._onTouchStart=qa.bind(this),this._onTouchMove=Va.bind(this),this._onMouseDown=Wa.bind(this),this._onMouseMove=Na.bind(this),this._interceptControlDown=Ba.bind(this),this._interceptControlUp=Za.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Sn),this.update(),this.state=q.NONE}update(e=null){const r=this.object.position;J.copy(r).sub(this.target),J.applyQuaternion(this._quat),this._spherical.setFromVector3(J),this.autoRotate&&this.state===q.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=ie:n>Math.PI&&(n-=ie),i<-Math.PI?i+=ie:i>Math.PI&&(i-=ie),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(J.setFromSpherical(this._spherical),J.applyQuaternion(this._quatInverse),r.copy(this.target).add(J),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=J.length();o=this._clampDistance(a*this._scale);const c=a-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const a=new O.Vector3(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const u=new O.Vector3(this._mouse.x,this._mouse.y,0);u.unproject(this.object),this.object.position.sub(u).add(a),this.object.updateMatrixWorld(),o=J.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(ht.origin.copy(this.object.position),ht.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ht.direction))<Ia?this.object.lookAt(this.target):(Cn.setFromNormalAndCoplanarPoint(this.object.up,this.target),ht.intersectPlane(Cn,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Yt||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Yt||this._lastTargetPosition.distanceToSquared(this.target)>Yt?(this.dispatchEvent(Sn),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ie/60*this.autoRotateSpeed*e:ie/60/60*this.autoRotateSpeed}_getZoomScale(e){const r=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*r)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,r){J.setFromMatrixColumn(r,0),J.multiplyScalar(-e),this._panOffset.add(J)}_panUp(e,r){this.screenSpacePanning===!0?J.setFromMatrixColumn(r,1):(J.setFromMatrixColumn(r,0),J.crossVectors(this.object.up,J)),J.multiplyScalar(e),this._panOffset.add(J)}_pan(e,r){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;J.copy(i).sub(this.target);let s=J.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*r*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,r){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,s=r-n.top,o=n.width,a=n.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let r=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),r=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),r=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),r=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),r=!0;break}r&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+r.x)*.5,a=(e.pageY+r.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId){this._pointers.splice(r,1);return}}_isTrackingPointer(e){for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId)return!0;return!1}_trackPointer(e){let r=this._pointerPositions[e.pointerId];r===void 0&&(r=new O.Vector2,this._pointerPositions[e.pointerId]=r),r.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const r=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[r]}_customWheelEvent(e){const r=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(r){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function za(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function Fa(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function La(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(ci),this.state=q.NONE;break;case 1:const e=this._pointers[0],r=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:r.x,pageY:r.y});break}}function Wa(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case O.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=q.DOLLY;break;case O.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}break;case O.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Cr)}function Na(t){switch(this.state){case q.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case q.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case q.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function Ha(t){this.enabled===!1||this.enableZoom===!1||this.state!==q.NONE||(t.preventDefault(),this.dispatchEvent(Cr),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(ci))}function Ua(t){this.enabled!==!1&&this._handleKeyDown(t)}function qa(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case O.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=q.TOUCH_ROTATE;break;case O.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=q.TOUCH_PAN;break;default:this.state=q.NONE}break;case 2:switch(this.touches.TWO){case O.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=q.TOUCH_DOLLY_PAN;break;case O.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=q.TOUCH_DOLLY_ROTATE;break;default:this.state=q.NONE}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Cr)}function Va(t){switch(this._trackPointer(t),this.state){case q.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case q.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case q.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case q.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=q.NONE}}function Ya(t){this.enabled!==!1&&t.preventDefault()}function Ba(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Za(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var Ga=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,Ka=(t,e,r,n)=>{for(var i=n>1?void 0:n?Qa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ga(e,r,i),i},Ge=(t,e)=>(r,n)=>e(r,n,t);let lr=class{constructor(t,e,r,n,i){p(this,"enabled",!1);p(this,"cameraControls");p(this,"miniCamera");p(this,"miniCameraControls");p(this,"cameraHelper");p(this,"axesHelper");p(this,"gridHelper");this._appService=t,this._sizesService=e,this._rendererService=r,this._cameraService=n,this._worldService=i}_renderMiniCamera(){var t,e,r,n,i;!this.enabled||!this.miniCamera||((t=this._rendererService.instance)==null||t.setScissorTest(!0),(e=this._rendererService.instance)==null||e.setViewport(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(r=this._rendererService.instance)==null||r.setScissor(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(n=this._rendererService.instance)==null||n.render(this._worldService.scene,this.miniCamera),(i=this._rendererService.instance)==null||i.setScissorTest(!1))}initMiniCamera(){this.disposeMiniCamera(),this.enabled&&(this.miniCamera=new O.PerspectiveCamera(75,this._sizesService.width/this._sizesService.height,.1,500),this.miniCamera.position.z=10,this.miniCamera.position.x=-5)}initOrbitControl(){var t;this.cameraControls&&((t=this.cameraControls)==null||t.dispose()),!(!this.enabled||!(this._cameraService.instance instanceof O.Camera))&&this._cameraService.instance instanceof O.Camera&&(this.cameraControls=new En(this._cameraService.instance,this._appService.proxyReceiver),this.cameraControls.rotateSpeed=.1,this.cameraControls.enableDamping=!0)}initMiniCameraOrbitControls(){this.miniCameraControls&&this.miniCameraControls.dispose(),!(!this.enabled||!this.miniCamera)&&(this.miniCameraControls=new En(this.miniCamera,this._appService.proxyReceiver),this.miniCameraControls.rotateSpeed=.15,this.miniCameraControls.enableDamping=!0)}initCameraHelper(){this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),!(!this.enabled||!this._cameraService.instance)&&(this.cameraHelper=new O.CameraHelper(this._cameraService.instance),this._worldService.scene.add(this.cameraHelper))}initAxesHelper(t){if(!this.enabled)return;const e=new O.AxesHelper(t);this._worldService.scene.add(e)}initGridHelper(t){if(this.gridHelper&&this._worldService.scene.remove(this.gridHelper),!this.enabled)return;const e=new O.GridHelper(t,t);this._worldService.scene.add(e)}disposeMiniCamera(){this.miniCamera instanceof O.Camera&&(this.miniCamera.clearViewOffset(),this.miniCamera.clear(),this.miniCamera=void 0)}update(){var t,e;(t=this.cameraControls)==null||t.update(),(e=this.miniCameraControls)==null||e.update(),this._renderMiniCamera()}dispose(){var t,e,r,n,i;this.disposeMiniCamera(),(t=this.cameraControls)==null||t.dispose(),this.cameraControls=void 0,(e=this.miniCameraControls)==null||e.dispose(),this.miniCameraControls=void 0,this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),(r=this.cameraHelper)==null||r.dispose(),this.cameraHelper=void 0,this.axesHelper&&this._worldService.scene.remove(this.axesHelper),(n=this.axesHelper)==null||n.dispose(),this.axesHelper=void 0,this.gridHelper&&this._worldService.scene.remove(this.gridHelper),(i=this.gridHelper)==null||i.dispose(),this.gridHelper=void 0}};lr=Ka([G(),Ge(0,z(Xe)),Ge(1,z(be)),Ge(2,z(je)),Ge(3,z(Re)),Ge(4,z(Je))],lr);var Xa=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,eu=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Xa(e,r,i),i},On=(t,e)=>(r,n)=>e(r,n,t);let hr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};hr=eu([G(),On(0,z(Ne)),On(1,z(Re))],hr);var tu=Object.defineProperty,ru=Object.getOwnPropertyDescriptor,nu=(t,e,r,n)=>{for(var i=n>1?void 0:n?ru(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&tu(e,r,i),i},Tn=(t,e)=>(r,n)=>e(r,n,t);let fr=class{constructor(t,e){p(this,"_subscriptions",[]);this._service=t,this._controller=e}init(t){this._service.enabled=!!t.enableDebug,this._service.enabled&&(t.withMiniCamera&&this._service.initMiniCamera(),t.enableControls&&(this._service.initOrbitControl(),this._service.initMiniCameraOrbitControls()),t.withCameraHelper&&this._service.initCameraHelper(),typeof(t==null?void 0:t.axesSizes)=="number"&&this._service.initAxesHelper(t.axesSizes),typeof(t==null?void 0:t.gridSizes)=="number"&&this._service.initGridHelper(t.gridSizes),this._subscriptions.push(this._controller.step$.subscribe(()=>{this._service.update()})))}enabled(t){return t&&(this._service.enabled=t),this._service.enabled}miniCamera(t){return t&&(this._service.miniCamera=t),this._service.miniCamera}getAxesHelper(){return this._service.axesHelper}getCameraControls(){return this._service.cameraControls}getCameraHelper(){return this._service.cameraHelper}getGridHelper(){return this._service.gridHelper}getMiniCameraControls(){return this._service.miniCameraControls}getStep$(){return this._controller.step$}dispose(){this._service.dispose(),this._subscriptions.forEach(t=>t.unsubscribe())}};fr=nu([G(),Tn(0,z(lr)),Tn(1,z(hr))],fr);var iu=Object.defineProperty,su=Object.getOwnPropertyDescriptor,ou=(t,e,r,n)=>{for(var i=n>1?void 0:n?su(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&iu(e,r,i),i};let Et=class{constructor(){p(this,"loadedResources",{});p(this,"toLoadCount",0);p(this,"loadedCount",0)}handleLoad(t){const{source:e,resource:r,loadedCount:n,toLoadCount:i}=t;r&&(this.loadedResources[e.name]=r,this.toLoadCount=n,this.loadedCount=i)}};Et=ou([Ot(te.ResolutionScoped)],Et);var au=Object.defineProperty,uu=Object.getOwnPropertyDescriptor,cu=(t,e,r,n)=>{for(var i=n>1?void 0:n?uu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&au(e,r,i),i},lu=(t,e)=>(r,n)=>e(r,n,t);let dr=class{constructor(t){p(this,"load$",_t(self,"message").pipe(ye(t=>{var e,r,n;return((e=t.data)==null?void 0:e.token)===Fn&&!!((n=(r=t.data)==null?void 0:r.payload)!=null&&n.resource)}),Le(t=>{var r,n,i,s;const{payload:e}=t.data||{};if(((r=e==null?void 0:e.source)==null?void 0:r.type)==="gltf"){const o=e.resource,a=(n=o.animations)==null?void 0:n.map(h=>O.AnimationClip.parse(h)),c=(i=o.cameras)==null?void 0:i.map(h=>yn(h)),u=(s=o.scenes)==null?void 0:s.map(h=>yn(h)),l=u==null?void 0:u[0];return{...e,resource:{...o,animations:a,cameras:c,scene:l,scenes:u}}}return e}),bt()));p(this,"loadCompleted$",this.load$.pipe(ye(t=>!!t&&t.toLoadCount===t.loadedCount),Le(()=>ai(this._service,["loadedCount","loadedResources","toLoadCount"])),bt()));this._service=t}};dr=cu([Ot(te.ResolutionScoped),lu(0,z(Et))],dr);var hu=Object.defineProperty,fu=Object.getOwnPropertyDescriptor,du=(t,e,r,n)=>{for(var i=n>1?void 0:n?fu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&hu(e,r,i),i},Mn=(t,e)=>(r,n)=>e(r,n,t);let pr=class{constructor(t,e){p(this,"_subscriptions",[]);this._controller=t,this._service=e}init(){this._subscriptions.push(this._controller.load$.subscribe(this._service.handleLoad.bind(this._service)))}getLoadedResources(){return this._service.loadedResources}getLoadedCount(){return this._service.loadedCount}getToLoadCount(){return this._service.toLoadCount}getLoad$(){return this._controller.load$}getLoadCompleted$(){return this._controller.loadCompleted$}dispose(){this._subscriptions.forEach(t=>t.unsubscribe())}};pr=du([G(),Mn(0,z(dr)),Mn(1,z(Et))],pr);var pu=Object.defineProperty,vu=Object.getOwnPropertyDescriptor,mu=(t,e,r,n)=>{for(var i=n>1?void 0:n?vu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&pu(e,r,i),i},me=(t,e)=>(r,n)=>e(r,n,t);exports.AppModule=class extends zn{constructor(e,r,n,i,s,o,a,c,u){super(),this._controller=e,this._service=r,this.timer=n,this.sizes=i,this.camera=s,this.world=o,this.renderer=a,this.loader=c,this.debug=u,this._initProxyEvents()}_initProxyEvents(){_r.forEach(e=>{this[`${e}$`]=()=>{var r;return(r=this._controller)==null?void 0:r[`${e}$`]},this[e]=r=>{var n,i;return(i=(n=this._controller)==null?void 0:n[e])==null?void 0:i.call(n,r)}})}init(e){this._service.initialized||!(e!=null&&e.canvas)||!(this._service.canvas=e.canvas)||(this._service.initialized=!0,this.sizes.init(this._service.canvas),this.camera.init(),this.world.init(),this.renderer.init(this._service.canvas),this.timer.init(e.startTimer),this.loader.init(),this.debug.init(e))}isInitialized(){return this._service.initialized}beforeStep$(){return this.timer.beforeStep$()}step$(){return this.timer.step$()}dispose(){this.sizes.dispose(),this.camera.dispose(),this.world.dispose(),this.renderer.dispose(),this.timer.dispose(),this.loader.dispose(),this.debug.dispose()}};exports.AppModule=mu([Ot(te.ContainerScoped),me(0,z(Pt)),me(1,z(Xe)),me(2,z(nr)),me(3,z(ur)),me(4,z(sr)),me(5,z(cr)),me(6,z(ar)),me(7,z(pr)),me(8,z(fr))],exports.AppModule);exports.A=Do;exports.AppProxyEventHandlersBlueprint=zn;exports.C=xo;exports.CONTAINER_TOKEN=Yi;exports.D=Ao;exports.DefaultCameraType=yt;exports.J=ai;exports.KEYBOARD_EVENT_CODES=qi;exports.LOADER_SERIALIZED_LOAD_TOKEN=Fn;exports.Lifecycle=te;exports.PROXY_EVENT_LISTENERS=_r;exports.ProxyEventHandlersBlueprint=In;exports.ProxyEventObservablesBlueprint=kn;exports.ProxyEventSubjectsBlueprint=An;exports.Q=ko;exports.RegisterProxyEventHandlersBlueprint=Vi;exports.Subject=rt;exports.U=rr;exports.W=Io;exports.filter=ye;exports.fromEvent=_t;exports.getDefaultExportFromCjs=Rn;exports.inject=z;exports.instance=yr;exports.map=Le;exports.requireWorker=oi;exports.scoped=Ot;exports.share=bt;exports.singleton=G;