@quick-threejs/reactive 0.1.26 → 0.1.28
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ci=Object.defineProperty;var Si=(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)=>Si(t,typeof e!="symbol"?e+"":e,r);const O=require("three");var zr=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 Ei(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 Fr={};/*! *****************************************************************************
|
|
2
2
|
Copyright (C) Microsoft. All rights reserved.
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
4
|
this file except in compliance with the License. You may obtain a copy of the
|
|
@@ -11,7 +11,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
11
11
|
|
|
12
12
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
13
|
and limitations under the License.
|
|
14
|
-
***************************************************************************** */var Fr;function Ei(){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(f,v){Object.defineProperty(u,f,{configurable:!0,writable:!0,value:v}),l&&l(f,v)}}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,f={create:c?function(){return jt(Object.create(null))}:u?function(){return jt({__proto__:null})}:function(){return jt({})},has:l?function(h,d){return i.call(h,d)}:function(h,d){return d in h},get:l?function(h,d){return i.call(h,d)?h[d]:void 0}:function(h,d){return h[d]}},v=Object.getPrototypeOf(Function),w=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:yi(),F=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:_i(),A=typeof WeakMap=="function"?WeakMap:bi(),L=s?Symbol.for("@reflect-metadata:registry"):void 0,_=pi(),S=mi(_);function P(h,d,m,C){if(I(m)){if(!Mr(h))throw new TypeError;if(!Rr(d))throw new TypeError;return ne(h,d)}else{if(!Mr(h))throw new TypeError;if(!K(d))throw new TypeError;if(!K(C)&&!I(C)&&!De(C))throw new TypeError;return De(C)&&(C=void 0),m=ce(m),B(h,d,m,C)}}r("decorate",P);function R(h,d){function m(C,x){if(!K(C))throw new TypeError;if(!I(x)&&!fi(x))throw new TypeError;ue(h,d,C,x)}return m}r("metadata",R);function g(h,d,m,C){if(!K(m))throw new TypeError;return I(C)||(C=ce(C)),ue(h,d,m,C)}r("defineMetadata",g);function b(h,d,m){if(!K(d))throw new TypeError;return I(m)||(m=ce(m)),Q(h,d,m)}r("hasMetadata",b);function D(h,d,m){if(!K(d))throw new TypeError;return I(m)||(m=ce(m)),he(h,d,m)}r("hasOwnMetadata",D);function U(h,d,m){if(!K(d))throw new TypeError;return I(m)||(m=ce(m)),it(h,d,m)}r("getMetadata",U);function y(h,d,m){if(!K(d))throw new TypeError;return I(m)||(m=ce(m)),$e(h,d,m)}r("getOwnMetadata",y);function $(h,d){if(!K(h))throw new TypeError;return I(d)||(d=ce(d)),xe(h,d)}r("getMetadataKeys",$);function k(h,d){if(!K(h))throw new TypeError;return I(d)||(d=ce(d)),Er(h,d)}r("getOwnMetadataKeys",k);function H(h,d,m){if(!K(d))throw new TypeError;if(I(m)||(m=ce(m)),!K(d))throw new TypeError;I(m)||(m=ce(m));var C=Ue(d,m,!1);return I(C)?!1:C.OrdinaryDeleteMetadata(h,d,m)}r("deleteMetadata",H);function ne(h,d){for(var m=h.length-1;m>=0;--m){var C=h[m],x=C(d);if(!I(x)&&!De(x)){if(!Rr(x))throw new TypeError;d=x}}return d}function B(h,d,m,C){for(var x=h.length-1;x>=0;--x){var ee=h[x],X=ee(d,m,C);if(!I(X)&&!De(X)){if(!K(X))throw new TypeError;C=X}}return C}function Q(h,d,m){var C=he(h,d,m);if(C)return!0;var x=Rt(d);return De(x)?!1:Q(h,x,m)}function he(h,d,m){var C=Ue(d,m,!1);return I(C)?!1:Tr(C.OrdinaryHasOwnMetadata(h,d,m))}function it(h,d,m){var C=he(h,d,m);if(C)return $e(h,d,m);var x=Rt(d);if(!De(x))return it(h,x,m)}function $e(h,d,m){var C=Ue(d,m,!1);if(!I(C))return C.OrdinaryGetOwnMetadata(h,d,m)}function ue(h,d,m,C){var x=Ue(m,C,!0);x.OrdinaryDefineOwnMetadata(h,d,m,C)}function xe(h,d){var m=Er(h,d),C=Rt(h);if(C===null)return m;var x=xe(C,d);if(x.length<=0)return m;if(m.length<=0)return x;for(var ee=new F,X=[],W=0,E=m;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(h,d){var m=Ue(h,d,!1);return m?m.OrdinaryOwnMetadataKeys(h,d):[]}function Or(h){if(h===null)return 1;switch(typeof h){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return h===null?1:6;default:return 6}}function I(h){return h===void 0}function De(h){return h===null}function ui(h){return typeof h=="symbol"}function K(h){return typeof h=="object"?h!==null:typeof h=="function"}function ci(h,d){switch(Or(h)){case 0:return h;case 1:return h;case 2:return h;case 3:return h;case 4:return h;case 5:return h}var m="string",C=jr(h,o);if(C!==void 0){var x=C.call(h,m);if(K(x))throw new TypeError;return x}return li(h)}function li(h,d){var m,C;{var x=h.toString;if(st(x)){var C=x.call(h);if(!K(C))return C}var m=h.valueOf;if(st(m)){var C=m.call(h);if(!K(C))return C}}throw new TypeError}function Tr(h){return!!h}function hi(h){return""+h}function ce(h){var d=ci(h);return ui(d)?d:hi(d)}function Mr(h){return Array.isArray?Array.isArray(h):h instanceof Object?h instanceof Array:Object.prototype.toString.call(h)==="[object Array]"}function st(h){return typeof h=="function"}function Rr(h){return typeof h=="function"}function fi(h){switch(Or(h)){case 3:return!0;case 4:return!0;default:return!1}}function Mt(h,d){return h===d||h!==h&&d!==d}function jr(h,d){var m=h[d];if(m!=null){if(!st(m))throw new TypeError;return m}}function $r(h){var d=jr(h,a);if(!st(d))throw new TypeError;var m=d.call(h);if(!K(m))throw new TypeError;return m}function xr(h){return h.value}function Dr(h){var d=h.next();return d.done?!1:d}function Ar(h){var d=h.return;d&&d.call(h)}function Rt(h){var d=Object.getPrototypeOf(h);if(typeof h!="function"||h===v||d!==v)return d;var m=h.prototype,C=m&&Object.getPrototypeOf(m);if(C==null||C===Object.prototype)return d;var x=C.constructor;return typeof x!="function"||x===h?d:x}function di(){var h;!I(L)&&typeof n.Reflect<"u"&&!(L in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(h=vi(n.Reflect));var d,m,C,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 h===j:break;case I(d):d=j;break;case d===j:break;case I(m):m=j;break;case m===j:break;default:C===void 0&&(C=new F),C.add(j);break}}function W(j,N){if(!I(d)){if(d.isProviderFor(j,N))return d;if(!I(m)){if(m.isProviderFor(j,N))return d;if(!I(C))for(var V=$r(C);;){var Z=Dr(V);if(!Z)return;var ae=xr(Z);if(ae.isProviderFor(j,N))return Ar(V),ae}}}if(!I(h)&&h.isProviderFor(j,N))return h}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||m===j||!I(C)&&C.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 pi(){var h;return!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&(h=n.Reflect[L]),I(h)&&(h=di()),!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,L,{enumerable:!1,configurable:!1,writable:!1,value:h}),h}function mi(h){var d=new A,m={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(m),m;function C(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),!h.setProvider(T,M,m))throw N.delete(M),V&&d.delete(T),new Error("Wrong provider for target.")}return Z}function x(T,M,j){var N=C(M,j,!1);return I(N)?!1:Tr(N.has(T))}function ee(T,M,j){var N=C(M,j,!1);if(!I(N))return N.get(T)}function X(T,M,j,N){var V=C(j,N,!0);V.set(T,M)}function W(T,M){var j=[],N=C(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 wi=xr(kr);try{j[ae]=wi}catch(gi){try{Ar(Z)}finally{throw gi}}ae++}}function E(T,M,j){var N=C(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 vi(h){var d=h.defineMetadata,m=h.hasOwnMetadata,C=h.getOwnMetadata,x=h.getOwnMetadataKeys,ee=h.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:m,OrdinaryGetOwnMetadata:C,OrdinaryOwnMetadataKeys:x,OrdinaryDeleteMetadata:ee};return W}function Ue(h,d,m){var C=_.getProvider(h,d);if(!I(C))return C;if(m){if(_.setProvider(h,d,S))return S;throw new Error("Illegal state.")}}function yi(){var h={},d=[],m=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}(),C=function(){function W(){this._keys=[],this._values=[],this._cacheKey=h,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--,Mt(E,this._cacheKey)&&(this._cacheKey=h,this._cacheIndex=-2),!0}return!1},W.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=h,this._cacheIndex=-2},W.prototype.keys=function(){return new m(this._keys,this._values,x)},W.prototype.values=function(){return new m(this._keys,this._values,ee)},W.prototype.entries=function(){return new m(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(!Mt(this._cacheKey,E)){this._cacheIndex=-1;for(var M=0;M<this._keys.length;M++)if(Mt(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 C;function x(W,E){return W}function ee(W,E){return E}function X(W,E){return[W,E]}}function _i(){var h=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(m){return this._map.has(m)},d.prototype.add=function(m){return this._map.set(m,m),this},d.prototype.delete=function(m){return this._map.delete(m)},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 h}function bi(){var h=16,d=f.create(),m=C();return function(){function E(){this._key=C()}return E.prototype.has=function(T){var M=x(T,!1);return M!==void 0?f.has(M,this._key):!1},E.prototype.get=function(T){var M=x(T,!1);return M!==void 0?f.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=C()},E}();function C(){var E;do E="@@WeakMap@@"+W();while(f.has(d,E));return d[E]=!0,E}function x(E,T){if(!i.call(E,m)){if(!T)return;Object.defineProperty(E,m,{value:f.create()})}return E[m]}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(h);E[6]=E[6]&79|64,E[8]=E[8]&191|128;for(var T="",M=0;M<h;++M){var j=E[M];(M===4||M===6||M===8)&&(T+="-"),j<16&&(T+="0"),T+=j.toString(16).toLowerCase()}return T}}function jt(h){return h.__=void 0,delete h.__,h}})}(t||(t={})),zr}Ei();var Yt;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Yt||(Yt={}));const te=Yt;/*! *****************************************************************************
|
|
14
|
+
***************************************************************************** */var Lr;function Oi(){if(Lr)return Fr;Lr=1;var t;return function(e){(function(r){var n=typeof globalThis=="object"?globalThis:typeof zr=="object"?zr: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(f,v){Object.defineProperty(u,f,{configurable:!0,writable:!0,value:v}),l&&l(f,v)}}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,f={create:c?function(){return jt(Object.create(null))}:u?function(){return jt({__proto__:null})}:function(){return jt({})},has:l?function(h,d){return i.call(h,d)}:function(h,d){return d in h},get:l?function(h,d){return i.call(h,d)?h[d]:void 0}:function(h,d){return h[d]}},v=Object.getPrototypeOf(Function),w=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:_i(),F=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:bi(),A=typeof WeakMap=="function"?WeakMap:wi(),L=s?Symbol.for("@reflect-metadata:registry"):void 0,_=mi(),S=vi(_);function P(h,d,m,C){if(I(m)){if(!Rr(h))throw new TypeError;if(!jr(d))throw new TypeError;return ne(h,d)}else{if(!Rr(h))throw new TypeError;if(!K(d))throw new TypeError;if(!K(C)&&!I(C)&&!De(C))throw new TypeError;return De(C)&&(C=void 0),m=ce(m),B(h,d,m,C)}}r("decorate",P);function R(h,d){function m(C,x){if(!K(C))throw new TypeError;if(!I(x)&&!di(x))throw new TypeError;ue(h,d,C,x)}return m}r("metadata",R);function g(h,d,m,C){if(!K(m))throw new TypeError;return I(C)||(C=ce(C)),ue(h,d,m,C)}r("defineMetadata",g);function b(h,d,m){if(!K(d))throw new TypeError;return I(m)||(m=ce(m)),Q(h,d,m)}r("hasMetadata",b);function D(h,d,m){if(!K(d))throw new TypeError;return I(m)||(m=ce(m)),he(h,d,m)}r("hasOwnMetadata",D);function U(h,d,m){if(!K(d))throw new TypeError;return I(m)||(m=ce(m)),it(h,d,m)}r("getMetadata",U);function y(h,d,m){if(!K(d))throw new TypeError;return I(m)||(m=ce(m)),$e(h,d,m)}r("getOwnMetadata",y);function $(h,d){if(!K(h))throw new TypeError;return I(d)||(d=ce(d)),xe(h,d)}r("getMetadataKeys",$);function k(h,d){if(!K(h))throw new TypeError;return I(d)||(d=ce(d)),Or(h,d)}r("getOwnMetadataKeys",k);function H(h,d,m){if(!K(d))throw new TypeError;if(I(m)||(m=ce(m)),!K(d))throw new TypeError;I(m)||(m=ce(m));var C=Ue(d,m,!1);return I(C)?!1:C.OrdinaryDeleteMetadata(h,d,m)}r("deleteMetadata",H);function ne(h,d){for(var m=h.length-1;m>=0;--m){var C=h[m],x=C(d);if(!I(x)&&!De(x)){if(!jr(x))throw new TypeError;d=x}}return d}function B(h,d,m,C){for(var x=h.length-1;x>=0;--x){var ee=h[x],X=ee(d,m,C);if(!I(X)&&!De(X)){if(!K(X))throw new TypeError;C=X}}return C}function Q(h,d,m){var C=he(h,d,m);if(C)return!0;var x=Rt(d);return De(x)?!1:Q(h,x,m)}function he(h,d,m){var C=Ue(d,m,!1);return I(C)?!1:Mr(C.OrdinaryHasOwnMetadata(h,d,m))}function it(h,d,m){var C=he(h,d,m);if(C)return $e(h,d,m);var x=Rt(d);if(!De(x))return it(h,x,m)}function $e(h,d,m){var C=Ue(d,m,!1);if(!I(C))return C.OrdinaryGetOwnMetadata(h,d,m)}function ue(h,d,m,C){var x=Ue(m,C,!0);x.OrdinaryDefineOwnMetadata(h,d,m,C)}function xe(h,d){var m=Or(h,d),C=Rt(h);if(C===null)return m;var x=xe(C,d);if(x.length<=0)return m;if(m.length<=0)return x;for(var ee=new F,X=[],W=0,E=m;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 Or(h,d){var m=Ue(h,d,!1);return m?m.OrdinaryOwnMetadataKeys(h,d):[]}function Tr(h){if(h===null)return 1;switch(typeof h){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return h===null?1:6;default:return 6}}function I(h){return h===void 0}function De(h){return h===null}function ci(h){return typeof h=="symbol"}function K(h){return typeof h=="object"?h!==null:typeof h=="function"}function li(h,d){switch(Tr(h)){case 0:return h;case 1:return h;case 2:return h;case 3:return h;case 4:return h;case 5:return h}var m="string",C=$r(h,o);if(C!==void 0){var x=C.call(h,m);if(K(x))throw new TypeError;return x}return hi(h)}function hi(h,d){var m,C;{var x=h.toString;if(st(x)){var C=x.call(h);if(!K(C))return C}var m=h.valueOf;if(st(m)){var C=m.call(h);if(!K(C))return C}}throw new TypeError}function Mr(h){return!!h}function fi(h){return""+h}function ce(h){var d=li(h);return ci(d)?d:fi(d)}function Rr(h){return Array.isArray?Array.isArray(h):h instanceof Object?h instanceof Array:Object.prototype.toString.call(h)==="[object Array]"}function st(h){return typeof h=="function"}function jr(h){return typeof h=="function"}function di(h){switch(Tr(h)){case 3:return!0;case 4:return!0;default:return!1}}function Mt(h,d){return h===d||h!==h&&d!==d}function $r(h,d){var m=h[d];if(m!=null){if(!st(m))throw new TypeError;return m}}function xr(h){var d=$r(h,a);if(!st(d))throw new TypeError;var m=d.call(h);if(!K(m))throw new TypeError;return m}function Dr(h){return h.value}function Ar(h){var d=h.next();return d.done?!1:d}function kr(h){var d=h.return;d&&d.call(h)}function Rt(h){var d=Object.getPrototypeOf(h);if(typeof h!="function"||h===v||d!==v)return d;var m=h.prototype,C=m&&Object.getPrototypeOf(m);if(C==null||C===Object.prototype)return d;var x=C.constructor;return typeof x!="function"||x===h?d:x}function pi(){var h;!I(L)&&typeof n.Reflect<"u"&&!(L in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(h=yi(n.Reflect));var d,m,C,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 h===j:break;case I(d):d=j;break;case d===j:break;case I(m):m=j;break;case m===j:break;default:C===void 0&&(C=new F),C.add(j);break}}function W(j,N){if(!I(d)){if(d.isProviderFor(j,N))return d;if(!I(m)){if(m.isProviderFor(j,N))return d;if(!I(C))for(var V=xr(C);;){var Z=Ar(V);if(!Z)return;var ae=Dr(Z);if(ae.isProviderFor(j,N))return kr(V),ae}}}if(!I(h)&&h.isProviderFor(j,N))return h}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||m===j||!I(C)&&C.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 h;return!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&(h=n.Reflect[L]),I(h)&&(h=pi()),!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,L,{enumerable:!1,configurable:!1,writable:!1,value:h}),h}function vi(h){var d=new A,m={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(m),m;function C(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),!h.setProvider(T,M,m))throw N.delete(M),V&&d.delete(T),new Error("Wrong provider for target.")}return Z}function x(T,M,j){var N=C(M,j,!1);return I(N)?!1:Mr(N.has(T))}function ee(T,M,j){var N=C(M,j,!1);if(!I(N))return N.get(T)}function X(T,M,j,N){var V=C(j,N,!0);V.set(T,M)}function W(T,M){var j=[],N=C(T,M,!1);if(I(N))return j;for(var V=N.keys(),Z=xr(V),ae=0;;){var Ir=Ar(Z);if(!Ir)return j.length=ae,j;var gi=Dr(Ir);try{j[ae]=gi}catch(Pi){try{kr(Z)}finally{throw Pi}}ae++}}function E(T,M,j){var N=C(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 yi(h){var d=h.defineMetadata,m=h.hasOwnMetadata,C=h.getOwnMetadata,x=h.getOwnMetadataKeys,ee=h.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:m,OrdinaryGetOwnMetadata:C,OrdinaryOwnMetadataKeys:x,OrdinaryDeleteMetadata:ee};return W}function Ue(h,d,m){var C=_.getProvider(h,d);if(!I(C))return C;if(m){if(_.setProvider(h,d,S))return S;throw new Error("Illegal state.")}}function _i(){var h={},d=[],m=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}(),C=function(){function W(){this._keys=[],this._values=[],this._cacheKey=h,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--,Mt(E,this._cacheKey)&&(this._cacheKey=h,this._cacheIndex=-2),!0}return!1},W.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=h,this._cacheIndex=-2},W.prototype.keys=function(){return new m(this._keys,this._values,x)},W.prototype.values=function(){return new m(this._keys,this._values,ee)},W.prototype.entries=function(){return new m(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(!Mt(this._cacheKey,E)){this._cacheIndex=-1;for(var M=0;M<this._keys.length;M++)if(Mt(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 C;function x(W,E){return W}function ee(W,E){return E}function X(W,E){return[W,E]}}function bi(){var h=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(m){return this._map.has(m)},d.prototype.add=function(m){return this._map.set(m,m),this},d.prototype.delete=function(m){return this._map.delete(m)},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 h}function wi(){var h=16,d=f.create(),m=C();return function(){function E(){this._key=C()}return E.prototype.has=function(T){var M=x(T,!1);return M!==void 0?f.has(M,this._key):!1},E.prototype.get=function(T){var M=x(T,!1);return M!==void 0?f.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=C()},E}();function C(){var E;do E="@@WeakMap@@"+W();while(f.has(d,E));return d[E]=!0,E}function x(E,T){if(!i.call(E,m)){if(!T)return;Object.defineProperty(E,m,{value:f.create()})}return E[m]}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(h);E[6]=E[6]&79|64,E[8]=E[8]&191|128;for(var T="",M=0;M<h;++M){var j=E[M];(M===4||M===6||M===8)&&(T+="-"),j<16&&(T+="0"),T+=j.toString(16).toLowerCase()}return T}}function jt(h){return h.__=void 0,delete h.__,h}})}(t||(t={})),Fr}Oi();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
15
|
Copyright (c) Microsoft Corporation.
|
|
16
16
|
|
|
17
17
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -24,11 +24,11 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
24
24
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
25
25
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
26
|
PERFORMANCE OF THIS SOFTWARE.
|
|
27
|
-
***************************************************************************** */var
|
|
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 mr(t,e){Zt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Ti(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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,[])).next())})}function Mi(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 ot(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 vt(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 Oe(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(vt(arguments[e]));return t}var Gt="injectionTokens";function Ri(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 ji(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,Oe(s))}};return this.reflectMethods.forEach(n),r},t}();function Ae(t){return typeof t=="string"||typeof t=="symbol"}function $i(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function Wr(t){return typeof t=="object"&&"token"in t&&"transform"in t}function xi(t){return typeof t=="function"||t instanceof $n}function ft(t){return!!t.useToken}function dt(t){return t.useValue!=null}function Di(t){return jn(t)||dt(t)||ft(t)||Qt(t)}var vr=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}(),Ai=function(t){mr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(vr),Nr=function(){function t(){this.scopedResolutions=new Map}return t}();function ki(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}function Ii(t,e,r){return r===void 0&&(r=" "),Oe([t],e.message.split(`
|
|
28
28
|
`).map(function(n){return r+n})).join(`
|
|
29
|
-
`)}function Ii(t,e,r){var n=vt(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=n[1],s=i===void 0?null:i,o=Ai(s,e);return ki("Cannot inject the dependency "+o+' of "'+t.name+'" constructor. Reason:',r)}function zi(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Fi=function(t){pr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(mr),Li=function(t){pr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(mr),Wi=function(){function t(){this.preResolution=new Fi,this.postResolution=new Li}return t}(),$n=new Map,Ni=function(){function t(e){this.parent=e,this._registry=new Di,this.interceptors=new Wi,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(xi(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! "+Oe(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)||Gt(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(),Ae(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(),Ae(e)){if(Ae(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&&!Ae(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&&Ae(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($i(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=ot(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=ot(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):Rn(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):Gt(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&&Ae(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=ot(this._registry.entries()),i=n.next();!i.done;i=n.next()){var s=vt(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=ot(this._registry.entries()),s=i.next();!s.done;s=i.next()){var o=vt(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 Oi(this,void 0,void 0,function(){var e;return Ti(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 jn)return e.createProxy(function(s){return n.resolve(s,r)});var i=function(){var s=$n.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,Oe([void 0],o)))}();return zi(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 ji(i)?Lr(i)?i.multiple?(o=n.resolve(i.transform)).transform.apply(o,Oe([n.resolveAll(i.token)],i.transformArgs)):(a=n.resolve(i.transform)).transform.apply(a,Oe([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,Oe([n.resolve(i.token,e)],i.transformArgs)):n.resolve(i,e)}catch(u){throw new Error(Ii(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}(),vr=new Ni;function z(t){return Ri(t)}function xn(){return function(t){$n.set(t,Mi(t))}}function G(){return function(t){xn()(t),vr.registerSingleton(t)}}function Et(t,e){return function(r){xn()(r),vr.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 Ui=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],yr=["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 Dn{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 An extends Dn{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 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{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 Hi{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 qi="CONTAINER",zn="LOADER_SERIALIZED_LOAD";var Qt=function(t,e){return Qt=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])},Qt(t,e)};function Xe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Qt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Vi(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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})}function Fn(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 Ie(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 Te(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 ke(t){return this instanceof ke?(this.v=t,this):new ke(t)}function Yi(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,f)}}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){v(s[0][3],A)}}function u(w){w.value instanceof ke?Promise.resolve(w.value.v).then(l,f):v(s[0][2],w)}function l(w){c("next",w)}function f(w){c("throw",w)}function v(w,F){w(F),s.shift(),s.length&&c(s[0][0],s[0][1])}}function Bi(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 Ie=="function"?Ie(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 Ln(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 $t=Ln(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
29
|
+
`)}function zi(t,e,r){var n=vt(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=n[1],s=i===void 0?null:i,o=ki(s,e);return Ii("Cannot inject the dependency "+o+' of "'+t.name+'" constructor. Reason:',r)}function Fi(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Li=function(t){mr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(vr),Wi=function(t){mr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(vr),Ni=function(){function t(){this.preResolution=new Li,this.postResolution=new Wi}return t}(),xn=new Map,Ui=function(){function t(e){this.parent=e,this._registry=new Ai,this.interceptors=new Ni,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(Di(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! "+Oe(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(),Ae(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(),Ae(e)){if(Ae(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&&!Ae(r)&&(n=r),this.register(e,{useClass:n},{lifecycle:te.Singleton})},t.prototype.resolve=function(e,r){r===void 0&&(r=new Nr),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&Ae(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(xi(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=ot(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=ot(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 Nr),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&Ae(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=ot(this._registry.entries()),i=n.next();!i.done;i=n.next()){var s=vt(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=ot(this._registry.entries()),s=i.next();!s.done;s=i.next()){var o=vt(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 Ti(this,void 0,void 0,function(){var e;return Mi(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,Oe([void 0],o)))}();return Fi(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 $i(i)?Wr(i)?i.multiple?(o=n.resolve(i.transform)).transform.apply(o,Oe([n.resolveAll(i.token)],i.transformArgs)):(a=n.resolve(i.transform)).transform.apply(a,Oe([n.resolve(i.token,e)],i.transformArgs)):i.multiple?n.resolveAll(i.token):n.resolve(i.token,e):Wr(i)?(c=n.resolve(i.transform,e)).transform.apply(c,Oe([n.resolve(i.token,e)],i.transformArgs)):n.resolve(i,e)}catch(u){throw new Error(zi(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 ji(t)}function Dn(){return function(t){xn.set(t,Ri(t))}}function G(){return function(t){Dn()(t),yr.registerSingleton(t)}}function Et(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 Hi=["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 qi{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 Vi="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 Xe(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 Yi(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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}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 Ie(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 Te(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 ke(t){return this instanceof ke?(this.v=t,this):new ke(t)}function Bi(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,f)}}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){v(s[0][3],A)}}function u(w){w.value instanceof ke?Promise.resolve(w.value.v).then(l,f):v(s[0][2],w)}function l(w){c("next",w)}function f(w){c("throw",w)}function v(w,F){w(F),s.shift(),s.length&&c(s[0][0],s[0][1])}}function Zi(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 Ie=="function"?Ie(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 $t=Wn(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
30
30
|
`+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
|
31
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function Kt(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Je=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=Ie(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 $t?A.errors:[A]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var v=Ie(f),w=v.next();!w.done;w=v.next()){var F=w.value;try{Nr(F)}catch(A){s=s??[],A instanceof $t?s=Te(Te([],_e(s)),_e(A.errors)):s.push(A)}}}catch(A){n={error:A}}finally{try{w&&!w.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}}if(s)throw new $t(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)&&Kt(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&Kt(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Wn=Je.EMPTY;function Nn(t){return t instanceof Je||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},Hn={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Te([t,e],_e(r)))},clearTimeout:function(t){var e=Hn.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function qn(t){Hn.setTimeout(function(){throw t})}function Ur(){}function pt(t){t()}var _r=function(t){Xe(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Nn(r)&&r.add(n)):n.destination=Ki,n}return e.create=function(r,n,i){return new Ze(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}(Je),Zi=Function.prototype.bind;function xt(t,e){return Zi.call(t,e)}var Gi=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){at(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){at(n)}else at(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){at(r)}},t}(),Ze=function(t){Xe(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&&xt(r.next,a),error:r.error&&xt(r.error,a),complete:r.complete&&xt(r.complete,a)}):o=r}return s.destination=new Gi(o),s}return e}(_r);function at(t){qn(t)}function Qi(t){throw t}var Ki={closed:!0,next:Ur,error:Qi,complete:Ur},br=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Vn(t){return t}function Xi(t){return t.length===0?Vn: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=es(e)?e:new Ze(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=Hr(r),new r(function(i,s){var o=new Ze({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[br]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Xi(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=Hr(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 Hr(t){var e;return(e=t??Un.Promise)!==null&&e!==void 0?e:Promise}function Ji(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function es(t){return t&&t instanceof _r||Ji(t)&&Nn(t)}function ts(t){return Y(t==null?void 0:t.lift)}function Ne(t){return function(e){if(ts(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 ze(t,e,r,n,i){return new rs(t,e,r,n,i)}var rs=function(t){Xe(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}(_r),ns={now:function(){return performance.now()},delegate:void 0},Xt={schedule:function(t){var e=requestAnimationFrame,r=cancelAnimationFrame,n=Xt.delegate;n&&(e=n.requestAnimationFrame,r=n.cancelAnimationFrame);var i=e(function(s){r=void 0,t(s)});return new Je(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,Te([],_e(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,Te([],_e(t)))},delegate:void 0};function is(t){return t?Yn(t):ss}function Yn(t){return new le(function(e){var r=t||ns,n=r.now(),i=0,s=function(){e.closed||(i=Xt.requestAnimationFrame(function(o){i=0;var a=r.now();e.next({timestamp:t?a:o,elapsed:a-n}),s()}))};return s(),function(){i&&Xt.cancelAnimationFrame(i)}})}var ss=Yn(),os=Ln(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),et=function(t){Xe(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 os},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=Ie(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?Wn:(this.currentObservers=null,a.push(r),new Je(function(){n.currentObservers=null,Kt(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){Xe(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:Wn},e}(et),Bn=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function as(t){return Y(t==null?void 0:t.then)}function us(t){return Y(t[br])}function cs(t){return Symbol.asyncIterator&&Y(t==null?void 0:t[Symbol.asyncIterator])}function ls(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 hs(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var fs=hs();function ds(t){return Y(t==null?void 0:t[fs])}function ps(t){return Yi(this,arguments,function(){var r,n,i,s;return Fn(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,ke(r.read())];case 3:return n=o.sent(),i=n.value,s=n.done,s?[4,ke(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,ke(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 ms(t){return Y(t==null?void 0:t.getReader)}function tt(t){if(t instanceof le)return t;if(t!=null){if(us(t))return vs(t);if(Bn(t))return ys(t);if(as(t))return _s(t);if(cs(t))return Zn(t);if(ds(t))return bs(t);if(ms(t))return ws(t)}throw ls(t)}function vs(t){return new le(function(e){var r=t[br]();if(Y(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ys(t){return new le(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function _s(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,qn)})}function bs(t){return new le(function(e){var r,n;try{for(var i=Ie(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 Zn(t){return new le(function(e){gs(t,e).catch(function(r){return e.error(r)})})}function ws(t){return Zn(ps(t))}function gs(t,e){var r,n,i,s;return Vi(this,void 0,void 0,function(){var o,a;return Fn(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Bi(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 rt(t,e){return Ne(function(r,n){var i=0;r.subscribe(ze(n,function(s){n.next(t.call(e,s,i++))}))})}var Ps=Array.isArray;function Cs(t,e){return Ps(e)?t.apply(void 0,Te([],_e(e))):t(e)}function Ss(t){return rt(function(e){return Cs(t,e)})}function Es(t,e,r,n,i,s,o,a){var c=[],u=0,l=0,f=!1,v=function(){f&&!c.length&&!u&&e.complete()},w=function(A){return u<n?F(A):c.push(A)},F=function(A){u++;var L=!1;tt(r(A,l++)).subscribe(ze(e,function(_){e.next(_)},function(){L=!0},void 0,function(){if(L)try{u--;for(var _=function(){var S=c.shift();o||F(S)};c.length&&u<n;)_();v()}catch(S){e.error(S)}}))};return t.subscribe(ze(e,w,function(){f=!0,v()})),function(){}}function Gn(t,e,r){return r===void 0&&(r=1/0),Y(e)?Gn(function(n,i){return rt(function(s,o){return e(n,s,i,o)})(tt(t(n,i)))},r):(typeof e=="number"&&(r=e),Ne(function(n,i){return Es(n,i,t,r)}))}var Os=["addListener","removeListener"],Ts=["addEventListener","removeEventListener"],Ms=["on","off"];function _t(t,e,r,n){if(Y(r)&&(n=r,r=void 0),n)return _t(t,e,r).pipe(Ss(n));var i=_e($s(t)?Ts.map(function(a){return function(c){return t[a](e,c,r)}}):Rs(t)?Os.map(Vr(t,e)):js(t)?Ms.map(Vr(t,e)):[],2),s=i[0],o=i[1];if(!s&&Bn(t))return Gn(function(a){return _t(a,e,r)})(tt(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 Rs(t){return Y(t.addListener)&&Y(t.removeListener)}function js(t){return Y(t.on)&&Y(t.off)}function $s(t){return Y(t.addEventListener)&&Y(t.removeEventListener)}function ye(t,e){return Ne(function(r,n){var i=0;r.subscribe(ze(n,function(s){return t.call(e,s,i++)&&n.next(s)}))})}function wr(t){t===void 0&&(t={});var e=t.connector,r=e===void 0?function(){return new et}: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,f,v,w=0,F=!1,A=!1,L=function(){f==null||f.unsubscribe(),f=void 0},_=function(){L(),l=v=void 0,F=A=!1},S=function(){var P=l;_(),P==null||P.unsubscribe()};return Ne(function(P,R){w++,!A&&!F&&L();var g=v=v??r();R.add(function(){w--,w===0&&!A&&!F&&(f=Dt(S,c))}),g.subscribe(R),!l&&w>0&&(l=new Ze({next:function(b){return g.next(b)},error:function(b){A=!0,L(),f=Dt(_,i,b),g.error(b)},complete:function(){F=!0,L(),f=Dt(_,o),g.complete()}}),tt(P).subscribe(l))})(u)}}function Dt(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 Ze({next:function(){i.unsubscribe(),t()}});return tt(e.apply(void 0,Te([],_e(r)))).subscribe(i)}}function xs(t,e){return e===void 0&&(e=!1),Ne(function(r,n){var i=0;r.subscribe(ze(n,function(s){var o=t(s,i++);(o||e)&&n.next(s),!o&&n.complete()}))})}function Ds(t,e,r){var n=Y(t)||e||r?{next:t,error:e,complete:r}:t;return n?Ne(function(i,s){var o;(o=n.subscribe)===null||o===void 0||o.call(n);var a=!0;i.subscribe(ze(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)}))}):Vn}var we={},fe={},ge={},Yr;function Qn(){if(Yr)return ge;Yr=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.DefaultSerializer=ge.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)}}}ge.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 ge.DefaultSerializer={deserialize(n){return r(n)?e.deserialize(n):n},serialize(n){return n instanceof Error?e.serialize(n):n}},ge}var Br;function Ge(){if(Br)return fe;Br=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.serialize=fe.deserialize=fe.registerSerializer=void 0;const t=Qn();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 At={},de={},Pe={},Zr;function As(){if(Zr)return Pe;Zr=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.getBundleURL=Pe.getBaseURL=void 0;let t;function e(){return t||(t=r()),t}Pe.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 Pe.getBaseURL=n,Pe}var Gr;function Kn(){if(Gr)return de;Gr=1,Object.defineProperty(de,"__esModule",{value:!0}),de.isWorkerRuntime=de.getWorkerImplementation=de.defaultPoolSize=void 0;const t=As();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,f){var v,w;typeof l=="string"&&f&&f._baseURL?l=new URL(l,f._baseURL):typeof l=="string"&&!e(l)&&t.getBundleURL().match(/^file:\/\//i)&&(l=new URL(l,t.getBundleURL().replace(/\/[^\/]+$/,"/")),(!((v=f==null?void 0:f.CORSWorkaround)!==null&&v!==void 0)||v)&&(l=r(`importScripts(${JSON.stringify(l)});`))),typeof l=="string"&&e(l)&&(!((w=f==null?void 0:f.CORSWorkaround)!==null&&w!==void 0)||w)&&(l=r(`importScripts(${JSON.stringify(l)});`)),super(l,f)}}class c extends a{constructor(l,f){const v=window.URL.createObjectURL(l);super(v,f)}static fromText(l,f){const v=new window.Blob([l],{type:"text/javascript"});return new c(v,f)}}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={},ut={exports:{}},kt,Qr;function ks(){if(Qr)return kt;Qr=1;var t=1e3,e=t*60,r=e*60,n=r*24,i=n*7,s=n*365.25;kt=function(l,f){f=f||{};var v=typeof l;if(v==="string"&&l.length>0)return o(l);if(v==="number"&&isFinite(l))return f.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 f=/^(-?(?:\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(f){var v=parseFloat(f[1]),w=(f[2]||"ms").toLowerCase();switch(w){case"years":case"year":case"yrs":case"yr":case"y":return v*s;case"weeks":case"week":case"w":return v*i;case"days":case"day":case"d":return v*n;case"hours":case"hour":case"hrs":case"hr":case"h":return v*r;case"minutes":case"minute":case"mins":case"min":case"m":return v*e;case"seconds":case"second":case"secs":case"sec":case"s":return v*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return v;default:return}}}}function a(l){var f=Math.abs(l);return f>=n?Math.round(l/n)+"d":f>=r?Math.round(l/r)+"h":f>=e?Math.round(l/e)+"m":f>=t?Math.round(l/t)+"s":l+"ms"}function c(l){var f=Math.abs(l);return f>=n?u(l,f,n,"day"):f>=r?u(l,f,r,"hour"):f>=e?u(l,f,e,"minute"):f>=t?u(l,f,t,"second"):l+" ms"}function u(l,f,v,w){var F=f>=v*1.5;return Math.round(l/v)+" "+w+(F?"s":"")}return kt}var It,Kr;function Is(){if(Kr)return It;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=ks(),n.destroy=l,Object.keys(e).forEach(f=>{n[f]=e[f]}),n.names=[],n.skips=[],n.formatters={};function r(f){let v=0;for(let w=0;w<f.length;w++)v=(v<<5)-v+f.charCodeAt(w),v|=0;return n.colors[Math.abs(v)%n.colors.length]}n.selectColor=r;function n(f){let v,w=null,F,A;function L(..._){if(!L.enabled)return;const S=L,P=Number(new Date),R=P-(v||P);S.diff=R,S.prev=v,S.curr=P,v=P,_[0]=n.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let g=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(D,U)=>{if(D==="%%")return"%";g++;const y=n.formatters[U];if(typeof y=="function"){const $=_[g];D=y.call(S,$),_.splice(g,1),g--}return D}),n.formatArgs.call(S,_),(S.log||n.log).apply(S,_)}return L.namespace=f,L.useColors=n.useColors(),L.color=n.selectColor(f),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(f)),A),set:_=>{w=_}}),typeof n.init=="function"&&n.init(L),L}function i(f,v){const w=n(this.namespace+(typeof v>"u"?":":v)+f);return w.log=this.log,w}function s(f){n.save(f),n.namespaces=f,n.names=[],n.skips=[];let v;const w=(typeof f=="string"?f:"").split(/[\s,]+/),F=w.length;for(v=0;v<F;v++)w[v]&&(f=w[v].replace(/\*/g,".*?"),f[0]==="-"?n.skips.push(new RegExp("^"+f.slice(1)+"$")):n.names.push(new RegExp("^"+f+"$")))}function o(){const f=[...n.names.map(c),...n.skips.map(c).map(v=>"-"+v)].join(",");return n.enable(""),f}function a(f){if(f[f.length-1]==="*")return!0;let v,w;for(v=0,w=n.skips.length;v<w;v++)if(n.skips[v].test(f))return!1;for(v=0,w=n.names.length;v<w;v++)if(n.names[v].test(f))return!0;return!1}function c(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}function u(f){return f instanceof Error?f.stack||f.message:f}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 It=t,It}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,f=0;c[0].replace(/%[a-zA-Z%]/g,v=>{v!=="%%"&&(l++,v==="%c"&&(f=l))}),c.splice(f,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=Is()(e);const{formatters:a}=t.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(ut,ut.exports)),ut.exports}var zs=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};class Ot{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(()=>zs(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 Xn=()=>typeof Symbol=="function",nt=t=>Xn()&&!!Symbol[t],Pr=t=>nt(t)?Symbol[t]:"@@"+t;nt("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const Fs=Pr("iterator"),Jt=Pr("observable"),Jn=Pr("species");function bt(t,e){const r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function He(t){let e=t.constructor;return e!==void 0&&(e=e[Jn],e===null&&(e=void 0)),e!==void 0?e:re}function Ls(t){return t instanceof re}function Fe(t){Fe.log?Fe.log(t):setTimeout(()=>{throw t},0)}function mt(t){Promise.resolve().then(()=>{try{t()}catch(e){Fe(e)}})}function ei(t){const e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{const r=bt(e,"unsubscribe");r&&r.call(e)}}catch(r){Fe(r)}}function er(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Ws(t){const e=t._queue;if(e){t._queue=void 0,t._state="ready";for(const r of e)if(ti(t,r.type,r.value),t._state==="closed")break}}function ti(t,e,r){t._state="running";const n=t._observer;try{const i=n?bt(n,e):void 0;switch(e){case"next":i&&i.call(n,r);break;case"error":if(er(t),i)i.call(n,r);else throw r;break;case"complete":er(t),i&&i.call(n);break}}catch(i){Fe(i)}t._state==="closed"?ei(t):t._state==="running"&&(t._state="ready")}function zt(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}],mt(()=>Ws(t));return}ti(t,e,r)}}class Ns{constructor(e,r){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const n=new Us(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"&&(er(this),ei(this))}}class Us{constructor(e){this._subscription=e}get closed(){return this._subscription._state==="closed"}next(e){zt(this._subscription,"next",e)}error(e){zt(this._subscription,"error",e)}complete(){zt(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 Ns(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=He(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=He(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=He(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=He(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=He(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()}})}[Jt](){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=bt(e,Jt);if(n){const i=n.call(e);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Ls(i)&&i.constructor===r?i:new r(s=>i.subscribe(s))}if(nt("iterator")){const i=bt(e,Fs);if(i)return new r(s=>{mt(()=>{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=>{mt(()=>{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=>{mt(()=>{if(!n.closed){for(const i of e)if(n.next(i),n.closed)return;n.complete()}})})}static get[Jn](){return this}}Xn()&&Object.defineProperty(re,Symbol("extensions"),{value:{symbol:Jt,hostReportError:Fe},configurable:!0});function je(t){typeof t=="function"?t():t&&typeof t.unsubscribe=="function"&&t.unsubscribe()}var Hs=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function qs(t){return e=>new re(r=>{const n=new Ot(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Hs(this,void 0,void 0,function*(){(yield t(s))&&o(s)}))}});return()=>je(i)})}function Vs(t){return t&&nt("asyncIterator")&&t[Symbol.asyncIterator]}function Ys(t){return t&&nt("iterator")&&t[Symbol.iterator]}var Bs=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},Zs=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 Gs(t){return e=>new re(r=>{const n=new Ot(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Bs(this,void 0,void 0,function*(){var a,c;const u=yield t(s);if(Ys(u)||Vs(u))try{for(var l=Zs(u),f;f=yield l.next(),!f.done;){const v=f.value;o(v)}}catch(v){a={error:v}}finally{try{f&&!f.done&&(c=l.return)&&(yield c.call(l))}finally{if(a)throw a.error}}else u.map(v=>o(v))}))}});return()=>je(i)})}function Qs(t){return new re(e=>{let r=0;const n=setInterval(()=>{e.next(r++)},t);return()=>clearInterval(n)})}var Ks=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function Xs(t){return e=>new re(r=>{const n=new Ot(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Ks(this,void 0,void 0,function*(){const a=yield t(s);o(a)}))}});return()=>je(i)})}function Js(...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=>je(s))};return i})}class ri 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 eo(t){const e=new ri;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&&(je(r),r=void 0)}})}var to=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function ro(t,e){return r=>new re(n=>{let i,s=0;const o=new Ot(n),a=r.subscribe({complete(){o.complete()},error(c){o.error(c)},next(c){o.schedule(u=>to(this,void 0,void 0,function*(){i=yield t(s===0?typeof e>"u"?c:e:i,c,s++),u(i)}))}});return()=>je(a)})}const no=Object.freeze(Object.defineProperty({__proto__:null,Observable:re,Subject:ri,filter:qs,flatMap:Gs,interval:Qs,map:Xs,merge:Js,multicast:eo,scan:ro,unsubscribe:je},Symbol.toStringTag,{value:"Module"})),Tt=Si(no);var qe={},Jr;function io(){if(Jr)return qe;Jr=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.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 qe.allSettled=t,qe}var Ft={},en;function so(){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={}))}(Ft)),Ft}var Ve={},oe={},tn;function Cr(){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 ni(){if(rn)return Ve;rn=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.Thread=void 0;const t=Cr();function e(r){throw Error(r)}return Ve.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]()}},Ve}var nn;function oo(){return nn||(nn=1,function(t){var e=Ce&&Ce.__awaiter||function(_,S,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 U(k){try{$(R.next(k))}catch(H){D(H)}}function y(k){try{$(R.throw(k))}catch(H){D(H)}}function $(k){k.done?b(k.value):g(k.value).then(U,y)}$((R=R.apply(_,S||[])).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=Tt,s=io(),o=Kn(),a=so();Object.defineProperty(t,"PoolEventType",{enumerable:!0,get:function(){return a.PoolEventType}});const c=ni();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return c.Thread}});let u=1;function l(_){const S=[];for(let P=0;P<_;P++)S.push(P);return S}function f(_){return new Promise(S=>setTimeout(S,_))}function v(_,S){return _.reduce((P,R)=>[...P,...S(R)],[])}function w(_){return _.replace(/\W/g," ").trim().replace(/\s+/g,"-")}function F(_,S){return l(S).map(()=>({init:_(),runningTasks:[]}))}class A{constructor(S,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(S,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:S=1}=this.options;return this.workers.find(P=>P.runningTasks.length<S)}runPoolTask(S,P){return e(this,void 0,void 0,function*(){const R=this.workers.indexOf(S)+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 S.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(S,P){return e(this,void 0,void 0,function*(){const R=e(this,void 0,void 0,function*(){const g=()=>{S.runningTasks=S.runningTasks.filter(b=>b!==R)};yield f(0);try{yield this.runPoolTask(S,P)}finally{g(),this.isClosing||this.scheduleWork()}});S.runningTasks.push(R)})}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const S=this.findIdlingWorker();if(!S)return;const P=this.taskQueue.shift();if(!P){this.debug("Task queue is empty"),this.eventSubject.next({type:a.PoolEventType.taskQueueDrained});return}this.run(S,P)}taskCompletion(S){return new Promise((P,R)=>{const g=this.events().subscribe(b=>{b.type===a.PoolEventType.taskCompleted&&b.taskID===S?(g.unsubscribe(),P(b.returnValue)):b.type===a.PoolEventType.taskFailed&&b.taskID===S?(g.unsubscribe(),R(b.error)):b.type===a.PoolEventType.terminated&&(g.unsubscribe(),R(Error("Pool has been terminated before task was run.")))})})}settled(S=!1){return e(this,void 0,void 0,function*(){const P=()=>v(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]):S&&this.taskQueue.length===0?(yield s.allSettled(P()),R):(yield new Promise((b,D)=>{const U=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained&&(U.unsubscribe(),b(void 0))},error:D})}),yield s.allSettled(P()),g.unsubscribe(),R)})}completed(S=!1){return e(this,void 0,void 0,function*(){const P=this.settled(S),R=new Promise((b,D)=>{const U=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained?(U.unsubscribe(),b(P)):y.type===a.PoolEventType.taskFailed&&(U.unsubscribe(),D(y.error))},error:D})}),g=yield Promise.race([P,R]);if(g.length>0)throw g[0]})}events(){return this.eventObservable}queue(S){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:S,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(S){return e(this,void 0,void 0,function*(){this.isClosing=!0,S||(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(_,S){return new A(_,S)}L.EventType=a.PoolEventType,t.Pool=L}(Ce)),Ce}var pe={},Ye={},sn;function ao(){if(sn)return Ye;sn=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.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 Ye.createPromiseWithResolver=e,Ye}var Lt={},on;function uo(){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={}))}(Lt)),Lt}var me={},Be={},an;function co(){if(an)return Be;an=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.ObservablePromise=void 0;const t=Tt,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,f=Object.assign(Object.assign({},u),{complete(){u.complete(),l.onCompletion()},error(v){u.error(v),l.onError(v)},next(v){u.next(v),l.onNext(v)}});try{return this.initHasRun=!0,c(f)}catch(v){f.error(v)}}),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,f=u||i;let v=!1;return new Promise((w,F)=>{const A=_=>{if(!v){v=!0;try{w(f(_))}catch(S){F(S)}}},L=_=>{try{w(l(_))}catch(S){A(S)}};if(this.initHasRun||this.subscribe({error:A}),this.state==="fulfilled")return w(l(this.firstValue));if(this.state==="rejected")return v=!0,w(f(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=v=>{u.next(v),u.complete()},f=v=>{u.error(v)};c.then(l,f)}):super.from(c)}}return Be.ObservablePromise=o,Be}var Se={},un;function wt(){if(un)return Se;un=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.Transfer=Se.isTransferDescriptor=void 0;const t=Cr();function e(i){return!(!i||typeof i!="object")}function r(i){return i&&typeof i=="object"&&i[t.$transferable]}Se.isTransferDescriptor=r;function n(i,s){if(!s){if(!e(i))throw Error();s=[i]}return{[t.$transferable]:!0,send:i,transferables:s}}return Se.Transfer=n,Se}var Wt={},cn;function ii(){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={}))}(Wt)),Wt}var ln;function lo(){if(ln)return me;ln=1;var t=me&&me.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(me,"__esModule",{value:!0}),me.createProxyModule=me.createProxyFunction=void 0;const e=t(gr()),r=Tt,n=Ge(),i=co(),s=wt(),o=ii(),a=e.default("threads:master:messages");let c=1;const u=_=>Array.from(new Set(_)),l=_=>_&&_.type===o.WorkerMessageType.error,f=_=>_&&_.type===o.WorkerMessageType.result,v=_=>_&&_.type===o.WorkerMessageType.running;function w(_,S){return new r.Observable(P=>{let R;const g=b=>{if(a("Message from worker:",b.data),!(!b.data||b.data.uid!==S)){if(v(b.data))R=b.data.resultType;else if(f(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:S};_.postMessage(b)}_.removeEventListener("message",g)}})}function F(_){if(_.length===0)return{args:[],transferables:[]};const S=[],P=[];for(const R of _)s.isTransferDescriptor(R)?(S.push(n.serialize(R.send)),P.push(...R.transferables)):S.push(n.serialize(R));return{args:S,transferables:P.length===0?P:u(P)}}function A(_,S){return(...P)=>{const R=c++,{args:g,transferables:b}=F(P),D={type:o.MasterMessageType.run,uid:R,method:S,args:g};a("Sending command to run function to worker:",D);try{_.postMessage(D,b)}catch(U){return i.ObservablePromise.from(Promise.reject(U))}return i.ObservablePromise.from(r.multicast(w(_,R)))}}me.createProxyFunction=A;function L(_,S){const P={};for(const R of S)P[R]=A(_,R);return P}return me.createProxyModule=L,me}var hn;function ho(){if(hn)return pe;hn=1;var t=pe&&pe.__awaiter||function(g,b,D,U){function y($){return $ instanceof D?$:new D(function(k){k($)})}return new(D||(D=Promise))(function($,k){function H(Q){try{B(U.next(Q))}catch(he){k(he)}}function ne(Q){try{B(U.throw(Q))}catch(he){k(he)}}function B(Q){Q.done?$(Q.value):y(Q.value).then(H,ne)}B((U=U.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=Tt,i=Ge(),s=ao(),o=Cr(),a=uo(),c=lo(),u=r.default("threads:master:messages"),l=r.default("threads:master:spawn"),f=r.default("threads:master:thread-utils"),v=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 U;const y=new Promise((k,H)=>{U=setTimeout(()=>H(Error(D)),b)}),$=yield Promise.race([g,y]);return clearTimeout(U),$})}function L(g){return new Promise((b,D)=>{const U=y=>{u("Message from worker before finishing initialization:",y.data),v(y.data)?(g.removeEventListener("message",U),b(y.data)):w(y.data)&&(g.removeEventListener("message",U),D(i.deserialize(y.data.error)))};g.addEventListener("message",U)})}function _(g,b){return new n.Observable(D=>{const U=$=>{const k={type:a.WorkerEventType.message,data:$.data};D.next(k)},y=$=>{f("Unhandled promise rejection event in thread:",$);const k={type:a.WorkerEventType.internalError,error:Error($.reason)};D.next(k)};g.addEventListener("message",U),g.addEventListener("unhandledrejection",y),b.then(()=>{const $={type:a.WorkerEventType.termination};g.removeEventListener("message",U),g.removeEventListener("unhandledrejection",y),D.next($),D.complete()})})}function S(g){const[b,D]=s.createPromiseWithResolver();return{terminate:()=>t(this,void 0,void 0,function*(){f("Terminating worker"),yield g.terminate(),D()}),termination:b}}function P(g,b,D,U){const y=D.filter($=>$.type===a.WorkerEventType.internalError).map($=>$.error);return Object.assign(g,{[o.$errors]:y,[o.$events]:D,[o.$terminate]:U,[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}=S(g),H=_(g,$);if(y.type==="function"){const ne=c.createProxyFunction(g);return P(ne,g,H,k)}else if(y.type==="module"){const ne=c.createProxyModule(g,y.methods);return P(ne,g,H,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 fo(){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=Kn();Object.defineProperty(t,"isWorkerRuntime",{enumerable:!0,get:function(){return e.isWorkerRuntime}});var r=oo();Object.defineProperty(t,"Pool",{enumerable:!0,get:function(){return r.Pool}});var n=ho();Object.defineProperty(t,"spawn",{enumerable:!0,get:function(){return n.spawn}});var i=ni();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return i.Thread}}),t.BlobWorker=e.getWorkerImplementation().blob,t.Worker=e.getWorkerImplementation().default}(At)),At}var Ee={},Nt,dn;function po(){return dn||(dn=1,Nt=t=>t?typeof Symbol.observable=="symbol"&&typeof t[Symbol.observable]=="function"?t===t[Symbol.observable]():typeof t["@@observable"]=="function"?t===t["@@observable"]():!1:!1),Nt}var ct={},pn;function mo(){if(pn)return ct;pn=1,Object.defineProperty(ct,"__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 ct.default={isWorkerRuntime:t,postMessageToMaster:e,subscribeToMasterMessages:r},ct}var mn;function si(){return mn||(mn=1,function(t){var e=Ee&&Ee.__awaiter||function(y,$,k,H){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{$e(H.next(ue))}catch(xe){Q(xe)}}function it(ue){try{$e(H.throw(ue))}catch(xe){Q(xe)}}function $e(ue){ue.done?B(ue.value):ne(ue.value).then(he,it)}$e((H=H.apply(y,$||[])).next())})},r=Ee&&Ee.__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(po()),i=Ge(),s=wt(),o=ii(),a=r(mo());var c=Ge();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return c.registerSerializer}});var u=wt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return u.Transfer}}),t.isWorkerRuntime=a.default.isWorkerRuntime;let l=!1;const f=new Map,v=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 S(y){const $={type:o.WorkerMessageType.init,exposed:{type:"module",methods:y}};a.default.postMessageToMaster($)}function P(y,$){const{payload:k,transferables:H}=L($),ne={type:o.WorkerMessageType.error,uid:y,error:i.serialize(k)};a.default.postMessageToMaster(ne,H)}function R(y,$,k){const{payload:H,transferables:ne}=L(k),B={type:o.WorkerMessageType.result,uid:y,complete:$?!0:void 0,payload:H};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.
|
|
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 Je=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=Ie(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 $t?A.errors:[A]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var v=Ie(f),w=v.next();!w.done;w=v.next()){var F=w.value;try{Ur(F)}catch(A){s=s??[],A instanceof $t?s=Te(Te([],_e(s)),_e(A.errors)):s.push(A)}}}catch(A){n={error:A}}finally{try{w&&!w.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}}if(s)throw new $t(s)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Ur(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=Je.EMPTY;function Un(t){return t instanceof Je||t&&"closed"in t&&Y(t.remove)&&Y(t.add)&&Y(t.unsubscribe)}function Ur(t){Y(t)?t():t.unsubscribe()}var Hn={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,Te([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){Xe(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Un(r)&&r.add(n)):n.destination=Xi,n}return e.create=function(r,n,i){return new Ze(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}(Je),Gi=Function.prototype.bind;function xt(t,e){return Gi.call(t,e)}var Qi=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){at(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){at(n)}else at(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){at(r)}},t}(),Ze=function(t){Xe(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&&Hn.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return s.unsubscribe()},o={next:r.next&&xt(r.next,a),error:r.error&&xt(r.error,a),complete:r.complete&&xt(r.complete,a)}):o=r}return s.destination=new Qi(o),s}return e}(br);function at(t){Vn(t)}function Ki(t){throw t}var Xi={closed:!0,next:Hr,error:Ki,complete:Hr},wr=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Yn(t){return t}function Ji(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=ts(e)?e:new Ze(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=qr(r),new r(function(i,s){var o=new Ze({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 Ji(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=qr(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 qr(t){var e;return(e=t??Hn.Promise)!==null&&e!==void 0?e:Promise}function es(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function ts(t){return t&&t instanceof br||es(t)&&Un(t)}function rs(t){return Y(t==null?void 0:t.lift)}function Ne(t){return function(e){if(rs(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 ze(t,e,r,n,i){return new ns(t,e,r,n,i)}var ns=function(t){Xe(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),is={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 Je(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,Te([],_e(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,Te([],_e(t)))},delegate:void 0};function ss(t){return t?Bn(t):os}function Bn(t){return new le(function(e){var r=t||is,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 os=Bn(),as=Wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),et=function(t){Xe(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 Vr(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new as},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=Ie(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 Je(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 Vr(r,n)},e}(le),Vr=function(t){Xe(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}(et),Zn=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function us(t){return Y(t==null?void 0:t.then)}function cs(t){return Y(t[wr])}function ls(t){return Symbol.asyncIterator&&Y(t==null?void 0:t[Symbol.asyncIterator])}function hs(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 fs(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ds=fs();function ps(t){return Y(t==null?void 0:t[ds])}function ms(t){return Bi(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,ke(r.read())];case 3:return n=o.sent(),i=n.value,s=n.done,s?[4,ke(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,ke(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 vs(t){return Y(t==null?void 0:t.getReader)}function tt(t){if(t instanceof le)return t;if(t!=null){if(cs(t))return ys(t);if(Zn(t))return _s(t);if(us(t))return bs(t);if(ls(t))return Gn(t);if(ps(t))return ws(t);if(vs(t))return gs(t)}throw hs(t)}function ys(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 _s(t){return new le(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function bs(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 ws(t){return new le(function(e){var r,n;try{for(var i=Ie(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){Ps(t,e).catch(function(r){return e.error(r)})})}function gs(t){return Gn(ms(t))}function Ps(t,e){var r,n,i,s;return Yi(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=Zi(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 rt(t,e){return Ne(function(r,n){var i=0;r.subscribe(ze(n,function(s){n.next(t.call(e,s,i++))}))})}var Cs=Array.isArray;function Ss(t,e){return Cs(e)?t.apply(void 0,Te([],_e(e))):t(e)}function Es(t){return rt(function(e){return Ss(t,e)})}function Os(t,e,r,n,i,s,o,a){var c=[],u=0,l=0,f=!1,v=function(){f&&!c.length&&!u&&e.complete()},w=function(A){return u<n?F(A):c.push(A)},F=function(A){u++;var L=!1;tt(r(A,l++)).subscribe(ze(e,function(_){e.next(_)},function(){L=!0},void 0,function(){if(L)try{u--;for(var _=function(){var S=c.shift();o||F(S)};c.length&&u<n;)_();v()}catch(S){e.error(S)}}))};return t.subscribe(ze(e,w,function(){f=!0,v()})),function(){}}function Qn(t,e,r){return r===void 0&&(r=1/0),Y(e)?Qn(function(n,i){return rt(function(s,o){return e(n,s,i,o)})(tt(t(n,i)))},r):(typeof e=="number"&&(r=e),Ne(function(n,i){return Os(n,i,t,r)}))}var Ts=["addListener","removeListener"],Ms=["addEventListener","removeEventListener"],Rs=["on","off"];function _t(t,e,r,n){if(Y(r)&&(n=r,r=void 0),n)return _t(t,e,r).pipe(Es(n));var i=_e(xs(t)?Ms.map(function(a){return function(c){return t[a](e,c,r)}}):js(t)?Ts.map(Yr(t,e)):$s(t)?Rs.map(Yr(t,e)):[],2),s=i[0],o=i[1];if(!s&&Zn(t))return Qn(function(a){return _t(a,e,r)})(tt(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 Yr(t,e){return function(r){return function(n){return t[r](e,n)}}}function js(t){return Y(t.addListener)&&Y(t.removeListener)}function $s(t){return Y(t.on)&&Y(t.off)}function xs(t){return Y(t.addEventListener)&&Y(t.removeEventListener)}function ye(t,e){return Ne(function(r,n){var i=0;r.subscribe(ze(n,function(s){return t.call(e,s,i++)&&n.next(s)}))})}function gr(t){t===void 0&&(t={});var e=t.connector,r=e===void 0?function(){return new et}: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,f,v,w=0,F=!1,A=!1,L=function(){f==null||f.unsubscribe(),f=void 0},_=function(){L(),l=v=void 0,F=A=!1},S=function(){var P=l;_(),P==null||P.unsubscribe()};return Ne(function(P,R){w++,!A&&!F&&L();var g=v=v??r();R.add(function(){w--,w===0&&!A&&!F&&(f=Dt(S,c))}),g.subscribe(R),!l&&w>0&&(l=new Ze({next:function(b){return g.next(b)},error:function(b){A=!0,L(),f=Dt(_,i,b),g.error(b)},complete:function(){F=!0,L(),f=Dt(_,o),g.complete()}}),tt(P).subscribe(l))})(u)}}function Dt(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 Ze({next:function(){i.unsubscribe(),t()}});return tt(e.apply(void 0,Te([],_e(r)))).subscribe(i)}}function Ds(t,e){return e===void 0&&(e=!1),Ne(function(r,n){var i=0;r.subscribe(ze(n,function(s){var o=t(s,i++);(o||e)&&n.next(s),!o&&n.complete()}))})}function As(t,e,r){var n=Y(t)||e||r?{next:t,error:e,complete:r}:t;return n?Ne(function(i,s){var o;(o=n.subscribe)===null||o===void 0||o.call(n);var a=!0;i.subscribe(ze(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 we={},fe={},ge={},Br;function Kn(){if(Br)return ge;Br=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.DefaultSerializer=ge.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)}}}ge.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 ge.DefaultSerializer={deserialize(n){return r(n)?e.deserialize(n):n},serialize(n){return n instanceof Error?e.serialize(n):n}},ge}var Zr;function Ge(){if(Zr)return fe;Zr=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 At={},de={},Pe={},Gr;function ks(){if(Gr)return Pe;Gr=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.getBundleURL=Pe.getBaseURL=void 0;let t;function e(){return t||(t=r()),t}Pe.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 Pe.getBaseURL=n,Pe}var Qr;function Xn(){if(Qr)return de;Qr=1,Object.defineProperty(de,"__esModule",{value:!0}),de.isWorkerRuntime=de.getWorkerImplementation=de.defaultPoolSize=void 0;const t=ks();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,f){var v,w;typeof l=="string"&&f&&f._baseURL?l=new URL(l,f._baseURL):typeof l=="string"&&!e(l)&&t.getBundleURL().match(/^file:\/\//i)&&(l=new URL(l,t.getBundleURL().replace(/\/[^\/]+$/,"/")),(!((v=f==null?void 0:f.CORSWorkaround)!==null&&v!==void 0)||v)&&(l=r(`importScripts(${JSON.stringify(l)});`))),typeof l=="string"&&e(l)&&(!((w=f==null?void 0:f.CORSWorkaround)!==null&&w!==void 0)||w)&&(l=r(`importScripts(${JSON.stringify(l)});`)),super(l,f)}}class c extends a{constructor(l,f){const v=window.URL.createObjectURL(l);super(v,f)}static fromText(l,f){const v=new window.Blob([l],{type:"text/javascript"});return new c(v,f)}}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={},ut={exports:{}},kt,Kr;function Is(){if(Kr)return kt;Kr=1;var t=1e3,e=t*60,r=e*60,n=r*24,i=n*7,s=n*365.25;kt=function(l,f){f=f||{};var v=typeof l;if(v==="string"&&l.length>0)return o(l);if(v==="number"&&isFinite(l))return f.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 f=/^(-?(?:\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(f){var v=parseFloat(f[1]),w=(f[2]||"ms").toLowerCase();switch(w){case"years":case"year":case"yrs":case"yr":case"y":return v*s;case"weeks":case"week":case"w":return v*i;case"days":case"day":case"d":return v*n;case"hours":case"hour":case"hrs":case"hr":case"h":return v*r;case"minutes":case"minute":case"mins":case"min":case"m":return v*e;case"seconds":case"second":case"secs":case"sec":case"s":return v*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return v;default:return}}}}function a(l){var f=Math.abs(l);return f>=n?Math.round(l/n)+"d":f>=r?Math.round(l/r)+"h":f>=e?Math.round(l/e)+"m":f>=t?Math.round(l/t)+"s":l+"ms"}function c(l){var f=Math.abs(l);return f>=n?u(l,f,n,"day"):f>=r?u(l,f,r,"hour"):f>=e?u(l,f,e,"minute"):f>=t?u(l,f,t,"second"):l+" ms"}function u(l,f,v,w){var F=f>=v*1.5;return Math.round(l/v)+" "+w+(F?"s":"")}return kt}var It,Xr;function zs(){if(Xr)return It;Xr=1;function t(e){n.debug=n,n.default=n,n.coerce=u,n.disable=o,n.enable=s,n.enabled=a,n.humanize=Is(),n.destroy=l,Object.keys(e).forEach(f=>{n[f]=e[f]}),n.names=[],n.skips=[],n.formatters={};function r(f){let v=0;for(let w=0;w<f.length;w++)v=(v<<5)-v+f.charCodeAt(w),v|=0;return n.colors[Math.abs(v)%n.colors.length]}n.selectColor=r;function n(f){let v,w=null,F,A;function L(..._){if(!L.enabled)return;const S=L,P=Number(new Date),R=P-(v||P);S.diff=R,S.prev=v,S.curr=P,v=P,_[0]=n.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let g=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(D,U)=>{if(D==="%%")return"%";g++;const y=n.formatters[U];if(typeof y=="function"){const $=_[g];D=y.call(S,$),_.splice(g,1),g--}return D}),n.formatArgs.call(S,_),(S.log||n.log).apply(S,_)}return L.namespace=f,L.useColors=n.useColors(),L.color=n.selectColor(f),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(f)),A),set:_=>{w=_}}),typeof n.init=="function"&&n.init(L),L}function i(f,v){const w=n(this.namespace+(typeof v>"u"?":":v)+f);return w.log=this.log,w}function s(f){n.save(f),n.namespaces=f,n.names=[],n.skips=[];let v;const w=(typeof f=="string"?f:"").split(/[\s,]+/),F=w.length;for(v=0;v<F;v++)w[v]&&(f=w[v].replace(/\*/g,".*?"),f[0]==="-"?n.skips.push(new RegExp("^"+f.slice(1)+"$")):n.names.push(new RegExp("^"+f+"$")))}function o(){const f=[...n.names.map(c),...n.skips.map(c).map(v=>"-"+v)].join(",");return n.enable(""),f}function a(f){if(f[f.length-1]==="*")return!0;let v,w;for(v=0,w=n.skips.length;v<w;v++)if(n.skips[v].test(f))return!1;for(v=0,w=n.names.length;v<w;v++)if(n.names[v].test(f))return!0;return!1}function c(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}function u(f){return f instanceof Error?f.stack||f.message:f}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 It=t,It}var Jr;function Pr(){return Jr||(Jr=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,f=0;c[0].replace(/%[a-zA-Z%]/g,v=>{v!=="%%"&&(l++,v==="%c"&&(f=l))}),c.splice(f,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=zs()(e);const{formatters:a}=t.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(ut,ut.exports)),ut.exports}var Fs=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};class Ot{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(()=>Fs(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",nt=t=>Jn()&&!!Symbol[t],Cr=t=>nt(t)?Symbol[t]:"@@"+t;nt("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const Ls=Cr("iterator"),er=Cr("observable"),ei=Cr("species");function bt(t,e){const r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function He(t){let e=t.constructor;return e!==void 0&&(e=e[ei],e===null&&(e=void 0)),e!==void 0?e:re}function Ws(t){return t instanceof re}function Fe(t){Fe.log?Fe.log(t):setTimeout(()=>{throw t},0)}function mt(t){Promise.resolve().then(()=>{try{t()}catch(e){Fe(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=bt(e,"unsubscribe");r&&r.call(e)}}catch(r){Fe(r)}}function tr(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Ns(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?bt(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){Fe(i)}t._state==="closed"?ti(t):t._state==="running"&&(t._state="ready")}function zt(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}],mt(()=>Ns(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 Hs(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 Hs{constructor(e){this._subscription=e}get closed(){return this._subscription._state==="closed"}next(e){zt(this._subscription,"next",e)}error(e){zt(this._subscription,"error",e)}complete(){zt(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=He(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=He(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=He(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=He(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=He(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=bt(e,er);if(n){const i=n.call(e);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Ws(i)&&i.constructor===r?i:new r(s=>i.subscribe(s))}if(nt("iterator")){const i=bt(e,Ls);if(i)return new r(s=>{mt(()=>{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=>{mt(()=>{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=>{mt(()=>{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:Fe},configurable:!0});function je(t){typeof t=="function"?t():t&&typeof t.unsubscribe=="function"&&t.unsubscribe()}var qs=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function Vs(t){return e=>new re(r=>{const n=new Ot(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>qs(this,void 0,void 0,function*(){(yield t(s))&&o(s)}))}});return()=>je(i)})}function Ys(t){return t&&nt("asyncIterator")&&t[Symbol.asyncIterator]}function Bs(t){return t&&nt("iterator")&&t[Symbol.iterator]}var Zs=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},Gs=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 Qs(t){return e=>new re(r=>{const n=new Ot(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Zs(this,void 0,void 0,function*(){var a,c;const u=yield t(s);if(Bs(u)||Ys(u))try{for(var l=Gs(u),f;f=yield l.next(),!f.done;){const v=f.value;o(v)}}catch(v){a={error:v}}finally{try{f&&!f.done&&(c=l.return)&&(yield c.call(l))}finally{if(a)throw a.error}}else u.map(v=>o(v))}))}});return()=>je(i)})}function Ks(t){return new re(e=>{let r=0;const n=setInterval(()=>{e.next(r++)},t);return()=>clearInterval(n)})}var Xs=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function Js(t){return e=>new re(r=>{const n=new Ot(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Xs(this,void 0,void 0,function*(){const a=yield t(s);o(a)}))}});return()=>je(i)})}function eo(...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=>je(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 to(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&&(je(r),r=void 0)}})}var ro=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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function no(t,e){return r=>new re(n=>{let i,s=0;const o=new Ot(n),a=r.subscribe({complete(){o.complete()},error(c){o.error(c)},next(c){o.schedule(u=>ro(this,void 0,void 0,function*(){i=yield t(s===0?typeof e>"u"?c:e:i,c,s++),u(i)}))}});return()=>je(a)})}const io=Object.freeze(Object.defineProperty({__proto__:null,Observable:re,Subject:ni,filter:Vs,flatMap:Qs,interval:Ks,map:Js,merge:eo,multicast:to,scan:no,unsubscribe:je},Symbol.toStringTag,{value:"Module"})),Tt=Ei(io);var qe={},en;function so(){if(en)return qe;en=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.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 qe.allSettled=t,qe}var Ft={},tn;function oo(){return tn||(tn=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={}))}(Ft)),Ft}var Ve={},oe={},rn;function Sr(){return rn||(rn=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 nn;function ii(){if(nn)return Ve;nn=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.Thread=void 0;const t=Sr();function e(r){throw Error(r)}return Ve.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]()}},Ve}var sn;function ao(){return sn||(sn=1,function(t){var e=Ce&&Ce.__awaiter||function(_,S,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 U(k){try{$(R.next(k))}catch(H){D(H)}}function y(k){try{$(R.throw(k))}catch(H){D(H)}}function $(k){k.done?b(k.value):g(k.value).then(U,y)}$((R=R.apply(_,S||[])).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(Pr()),i=Tt,s=so(),o=Xn(),a=oo();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 S=[];for(let P=0;P<_;P++)S.push(P);return S}function f(_){return new Promise(S=>setTimeout(S,_))}function v(_,S){return _.reduce((P,R)=>[...P,...S(R)],[])}function w(_){return _.replace(/\W/g," ").trim().replace(/\s+/g,"-")}function F(_,S){return l(S).map(()=>({init:_(),runningTasks:[]}))}class A{constructor(S,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(S,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:S=1}=this.options;return this.workers.find(P=>P.runningTasks.length<S)}runPoolTask(S,P){return e(this,void 0,void 0,function*(){const R=this.workers.indexOf(S)+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 S.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(S,P){return e(this,void 0,void 0,function*(){const R=e(this,void 0,void 0,function*(){const g=()=>{S.runningTasks=S.runningTasks.filter(b=>b!==R)};yield f(0);try{yield this.runPoolTask(S,P)}finally{g(),this.isClosing||this.scheduleWork()}});S.runningTasks.push(R)})}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const S=this.findIdlingWorker();if(!S)return;const P=this.taskQueue.shift();if(!P){this.debug("Task queue is empty"),this.eventSubject.next({type:a.PoolEventType.taskQueueDrained});return}this.run(S,P)}taskCompletion(S){return new Promise((P,R)=>{const g=this.events().subscribe(b=>{b.type===a.PoolEventType.taskCompleted&&b.taskID===S?(g.unsubscribe(),P(b.returnValue)):b.type===a.PoolEventType.taskFailed&&b.taskID===S?(g.unsubscribe(),R(b.error)):b.type===a.PoolEventType.terminated&&(g.unsubscribe(),R(Error("Pool has been terminated before task was run.")))})})}settled(S=!1){return e(this,void 0,void 0,function*(){const P=()=>v(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]):S&&this.taskQueue.length===0?(yield s.allSettled(P()),R):(yield new Promise((b,D)=>{const U=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained&&(U.unsubscribe(),b(void 0))},error:D})}),yield s.allSettled(P()),g.unsubscribe(),R)})}completed(S=!1){return e(this,void 0,void 0,function*(){const P=this.settled(S),R=new Promise((b,D)=>{const U=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained?(U.unsubscribe(),b(P)):y.type===a.PoolEventType.taskFailed&&(U.unsubscribe(),D(y.error))},error:D})}),g=yield Promise.race([P,R]);if(g.length>0)throw g[0]})}events(){return this.eventObservable}queue(S){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:S,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(S){return e(this,void 0,void 0,function*(){this.isClosing=!0,S||(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(_,S){return new A(_,S)}L.EventType=a.PoolEventType,t.Pool=L}(Ce)),Ce}var pe={},Ye={},on;function uo(){if(on)return Ye;on=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.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 Ye.createPromiseWithResolver=e,Ye}var Lt={},an;function co(){return an||(an=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={}))}(Lt)),Lt}var me={},Be={},un;function lo(){if(un)return Be;un=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.ObservablePromise=void 0;const t=Tt,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,f=Object.assign(Object.assign({},u),{complete(){u.complete(),l.onCompletion()},error(v){u.error(v),l.onError(v)},next(v){u.next(v),l.onNext(v)}});try{return this.initHasRun=!0,c(f)}catch(v){f.error(v)}}),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,f=u||i;let v=!1;return new Promise((w,F)=>{const A=_=>{if(!v){v=!0;try{w(f(_))}catch(S){F(S)}}},L=_=>{try{w(l(_))}catch(S){A(S)}};if(this.initHasRun||this.subscribe({error:A}),this.state==="fulfilled")return w(l(this.firstValue));if(this.state==="rejected")return v=!0,w(f(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=v=>{u.next(v),u.complete()},f=v=>{u.error(v)};c.then(l,f)}):super.from(c)}}return Be.ObservablePromise=o,Be}var Se={},cn;function wt(){if(cn)return Se;cn=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.Transfer=Se.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]}Se.isTransferDescriptor=r;function n(i,s){if(!s){if(!e(i))throw Error();s=[i]}return{[t.$transferable]:!0,send:i,transferables:s}}return Se.Transfer=n,Se}var Wt={},ln;function si(){return ln||(ln=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={}))}(Wt)),Wt}var hn;function ho(){if(hn)return me;hn=1;var t=me&&me.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(me,"__esModule",{value:!0}),me.createProxyModule=me.createProxyFunction=void 0;const e=t(Pr()),r=Tt,n=Ge(),i=lo(),s=wt(),o=si(),a=e.default("threads:master:messages");let c=1;const u=_=>Array.from(new Set(_)),l=_=>_&&_.type===o.WorkerMessageType.error,f=_=>_&&_.type===o.WorkerMessageType.result,v=_=>_&&_.type===o.WorkerMessageType.running;function w(_,S){return new r.Observable(P=>{let R;const g=b=>{if(a("Message from worker:",b.data),!(!b.data||b.data.uid!==S)){if(v(b.data))R=b.data.resultType;else if(f(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:S};_.postMessage(b)}_.removeEventListener("message",g)}})}function F(_){if(_.length===0)return{args:[],transferables:[]};const S=[],P=[];for(const R of _)s.isTransferDescriptor(R)?(S.push(n.serialize(R.send)),P.push(...R.transferables)):S.push(n.serialize(R));return{args:S,transferables:P.length===0?P:u(P)}}function A(_,S){return(...P)=>{const R=c++,{args:g,transferables:b}=F(P),D={type:o.MasterMessageType.run,uid:R,method:S,args:g};a("Sending command to run function to worker:",D);try{_.postMessage(D,b)}catch(U){return i.ObservablePromise.from(Promise.reject(U))}return i.ObservablePromise.from(r.multicast(w(_,R)))}}me.createProxyFunction=A;function L(_,S){const P={};for(const R of S)P[R]=A(_,R);return P}return me.createProxyModule=L,me}var fn;function fo(){if(fn)return pe;fn=1;var t=pe&&pe.__awaiter||function(g,b,D,U){function y($){return $ instanceof D?$:new D(function(k){k($)})}return new(D||(D=Promise))(function($,k){function H(Q){try{B(U.next(Q))}catch(he){k(he)}}function ne(Q){try{B(U.throw(Q))}catch(he){k(he)}}function B(Q){Q.done?$(Q.value):y(Q.value).then(H,ne)}B((U=U.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(Pr()),n=Tt,i=Ge(),s=uo(),o=Sr(),a=co(),c=ho(),u=r.default("threads:master:messages"),l=r.default("threads:master:spawn"),f=r.default("threads:master:thread-utils"),v=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 U;const y=new Promise((k,H)=>{U=setTimeout(()=>H(Error(D)),b)}),$=yield Promise.race([g,y]);return clearTimeout(U),$})}function L(g){return new Promise((b,D)=>{const U=y=>{u("Message from worker before finishing initialization:",y.data),v(y.data)?(g.removeEventListener("message",U),b(y.data)):w(y.data)&&(g.removeEventListener("message",U),D(i.deserialize(y.data.error)))};g.addEventListener("message",U)})}function _(g,b){return new n.Observable(D=>{const U=$=>{const k={type:a.WorkerEventType.message,data:$.data};D.next(k)},y=$=>{f("Unhandled promise rejection event in thread:",$);const k={type:a.WorkerEventType.internalError,error:Error($.reason)};D.next(k)};g.addEventListener("message",U),g.addEventListener("unhandledrejection",y),b.then(()=>{const $={type:a.WorkerEventType.termination};g.removeEventListener("message",U),g.removeEventListener("unhandledrejection",y),D.next($),D.complete()})})}function S(g){const[b,D]=s.createPromiseWithResolver();return{terminate:()=>t(this,void 0,void 0,function*(){f("Terminating worker"),yield g.terminate(),D()}),termination:b}}function P(g,b,D,U){const y=D.filter($=>$.type===a.WorkerEventType.internalError).map($=>$.error);return Object.assign(g,{[o.$errors]:y,[o.$events]:D,[o.$terminate]:U,[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}=S(g),H=_(g,$);if(y.type==="function"){const ne=c.createProxyFunction(g);return P(ne,g,H,k)}else if(y.type==="module"){const ne=c.createProxyModule(g,y.methods);return P(ne,g,H,k)}else{const ne=y.type;throw Error(`Worker init message states unexpected type of expose(): ${ne}`)}})}return pe.spawn=R,pe}var dn;function po(){return dn||(dn=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=ao();Object.defineProperty(t,"Pool",{enumerable:!0,get:function(){return r.Pool}});var n=fo();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}(At)),At}var Ee={},Nt,pn;function mo(){return pn||(pn=1,Nt=t=>t?typeof Symbol.observable=="symbol"&&typeof t[Symbol.observable]=="function"?t===t[Symbol.observable]():typeof t["@@observable"]=="function"?t===t["@@observable"]():!1:!1),Nt}var ct={},mn;function vo(){if(mn)return ct;mn=1,Object.defineProperty(ct,"__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 ct.default={isWorkerRuntime:t,postMessageToMaster:e,subscribeToMasterMessages:r},ct}var vn;function oi(){return vn||(vn=1,function(t){var e=Ee&&Ee.__awaiter||function(y,$,k,H){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{$e(H.next(ue))}catch(xe){Q(xe)}}function it(ue){try{$e(H.throw(ue))}catch(xe){Q(xe)}}function $e(ue){ue.done?B(ue.value):ne(ue.value).then(he,it)}$e((H=H.apply(y,$||[])).next())})},r=Ee&&Ee.__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=Ge(),s=wt(),o=si(),a=r(vo());var c=Ge();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return c.registerSerializer}});var u=wt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return u.Transfer}}),t.isWorkerRuntime=a.default.isWorkerRuntime;let l=!1;const f=new Map,v=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 S(y){const $={type:o.WorkerMessageType.init,exposed:{type:"module",methods:y}};a.default.postMessageToMaster($)}function P(y,$){const{payload:k,transferables:H}=L($),ne={type:o.WorkerMessageType.error,uid:y,error:i.serialize(k)};a.default.postMessageToMaster(ne,H)}function R(y,$,k){const{payload:H,transferables:ne}=L(k),B={type:o.WorkerMessageType.result,uid:y,complete:$?!0:void 0,payload:H};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
33
|
Latest error:`,$,`
|
|
34
|
-
Original error:`,y)}}function D(y,$,k){return e(this,void 0,void 0,function*(){let H;try{H=$(...k)}catch(B){return P(y,B)}const ne=F(H)?"observable":"promise";if(g(y,ne),F(H)){const B=H.subscribe(Q=>R(y,!1,i.serialize(Q)),Q=>{P(y,i.serialize(Q)),f.delete(y)},()=>{R(y,!0),f.delete(y)});f.set(y,B)}else try{const B=yield H;R(y,!0,i.serialize(B))}catch(B){P(y,i.serialize(B))}})}function U(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");S($)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${y}`);a.default.subscribeToMasterMessages($=>{if(v($)){const k=$.uid,H=f.get(k);H&&(H.unsubscribe(),f.delete(k))}})}t.expose=U,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)}))}(Ee)),Ee}var vn;function vo(){return vn||(vn=1,function(t){var e=we&&we.__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=we&&we.__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=Ge();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return n.registerSerializer}}),r(fo(),t);var i=si();Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return i.expose}});var s=Qn();Object.defineProperty(t,"DefaultSerializer",{enumerable:!0,get:function(){return s.DefaultSerializer}});var o=wt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return o.Transfer}})}(we)),we}var yo=vo();const be=Mn(yo);be.registerSerializer;const _o=be.spawn;be.BlobWorker;be.DefaultSerializer;be.Pool;const bo=be.Thread;be.Transfer;const wo=be.Worker;var go=Object.defineProperty,Po=(t,e,r)=>e in t?go(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,se=(t,e,r)=>Po(t,typeof e!="symbol"?e+"":e,r);class Co 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 So=()=>{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}},Eo=()=>So()-1,Oo="TERMINATE_THREAD_FROM_WORKER";let To=-1;class Mo{constructor(e){se(this,"_handleTerminate"),se(this,"_handleError"),se(this,"_task"),se(this,"id",To+=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)===Oo&&this.terminate()}async run(e){var r;try{const{payload:n,options:i}=e;return this.idle=!1,this.worker=new wo(n.path,{type:"module",...i==null?void 0:i.worker}),this.thread=await _o(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 bo.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 Ro{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 Mo({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 jo=(t,e)=>new Ro(Eo(),!!e),$o=t=>t===void 0,xo=t=>typeof t=="boolean",Do=t=>!!t&&typeof t=="function",Ao=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})},ko=(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},Io=(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},tr=(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 Qe=class{constructor(){p(this,"_canvas");p(this,"proxyReceiver",new Co);p(this,"initialized",!1)}get canvas(){return this._canvas}set canvas(t){t.style={width:t.width+"",height:t.height+""},this._canvas=t}};Qe=Lo([G()],Qe);var Wo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Uo=(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},Ho=(t,e)=>(r,n)=>e(r,n,t);let gt=class extends kn{constructor(t){super(),this._service=t;for(const e of yr)this[`${e}$$`]=new et,this[`${e}$`]=this[`${e}$$`].pipe(),this[e]=r=>{this._service.proxyReceiver.handleEvent({...r,type:r.type||e}),this[`${e}$$`].next(r)}}};gt=Uo([G(),Ho(0,z(Qe))],gt);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 Pt=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}};Pt=Yo([G()],Pt);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 Le=class{constructor(t){p(this,"beforeStep$$",new et);p(this,"_previousTime",0);p(this,"beforeStep$",this.beforeStep$$.asObservable());p(this,"step$",is().pipe(Ds(({elapsed:t})=>{var e;this._previousTime!==t&&((e=this.beforeStep$$)==null||e.next(tr(this._service,[])),this._previousTime=t)}),ye(()=>this._service.enabled),xs(()=>this._service.enabled),rt(()=>tr(this._service,[])),wr()));this._service=t}};Le=Go([G(),Qo(0,z(Pt))],Le);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},yn=(t,e)=>(r,n)=>e(r,n,t);let rr=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$}};rr=Jo([G(),yn(0,z(Le)),yn(1,z(Pt))],rr);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 Me=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}};Me=ra([G()],Me);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,"miniCamera");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)}initDefaultCamera(t){if(this.removeCamera(),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))}setMiniCamera(){this.removeMiniCamera(),this.miniCamera=new O.PerspectiveCamera(75,this._sizesService.width/this._sizesService.height,.1,500),this.miniCamera.position.z=10,this.miniCamera.position.x=-5}removeCamera(){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)}removeMiniCamera(){this.miniCamera instanceof O.Camera&&(this.miniCamera.clearViewOffset(),this.miniCamera.clear(),this.miniCamera=void 0)}};Re=sa([G(),oa(0,z(Me))],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},_n=(t,e)=>(r,n)=>e(r,n,t);let nr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};nr=ca([G(),_n(0,z(Le)),_n(1,z(Re))],nr);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 ir=class{constructor(t,e,r){this._sizesService=t,this._controller=e,this._service=r}init(t){this._service.initDefaultCamera(),t&&this._service.setMiniCamera(),this._controller.step$.subscribe(()=>{var e,r;this._service.enabled&&(this._service.aspectRatio=this._sizesService.aspect,(this._service.instance instanceof O.PerspectiveCamera||this._service.instance instanceof O.OrthographicCamera)&&((e=this._service.instance)==null||e.updateProjectionMatrix()),(r=this._service.miniCamera)==null||r.updateProjectionMatrix())})}dispose(){this._service.removeCamera(),this._service.removeMiniCamera()}aspectRatio(t){return t&&(this._service.aspectRatio=t),this._service.aspectRatio}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}instance(t){return t&&(this._service.instance=t),this._service.instance}miniCamera(t){return t&&(this._service.miniCamera=t),this._service.miniCamera}position(t){return t&&(this._service.position=t),this._service.position}quaternion(t){return t&&(this._service.quaternion=t),this._service.quaternion}};ir=fa([G(),Ut(0,z(Me)),Ut(1,z(nr)),Ut(2,z(Re))],ir);var da=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,ma=(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 Ke=class{constructor(){p(this,"scene",new O.Scene);p(this,"enabled",!0)}};Ke=ma([G()],Ke);const bn={type:"change"},Sr={type:"start"},oi={type:"end"},lt=new O.Ray,wn=new O.Plane,va=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},Ht=1e-6;class gn 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.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=_a.bind(this),this._onPointerDown=ya.bind(this),this._onPointerUp=ba.bind(this),this._onContextMenu=Oa.bind(this),this._onMouseWheel=Pa.bind(this),this._onKeyDown=Ca.bind(this),this._onTouchStart=Sa.bind(this),this._onTouchMove=Ea.bind(this),this._onMouseDown=wa.bind(this),this._onMouseMove=ga.bind(this),this._interceptControlDown=Ta.bind(this),this._interceptControlUp=Ma.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(bn),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):(lt.origin.copy(this.object.position),lt.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(lt.direction))<va?this.object.lookAt(this.target):(wn.setFromNormalAndCoplanarPoint(this.object.up,this.target),lt.intersectPlane(wn,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)>Ht||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ht||this._lastTargetPosition.distanceToSquared(this.target)>Ht?(this.dispatchEvent(bn),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.rotateSpeed/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.rotateSpeed/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.rotateSpeed/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.rotateSpeed/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 ya(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 _a(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function ba(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(oi),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(Sr)}function ga(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 Pa(t){this.enabled===!1||this.enableZoom===!1||this.state!==q.NONE||(t.preventDefault(),this.dispatchEvent(Sr),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(oi))}function Ca(t){this.enabled!==!1&&this._handleKeyDown(t)}function Sa(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(Sr)}function Ea(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 Oa(t){this.enabled!==!1&&t.preventDefault()}function Ta(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Ma(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}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},qt=(t,e)=>(r,n)=>e(r,n,t);let Ct=class{constructor(t,e,r){p(this,"enabled",!0);p(this,"cameraControls");p(this,"miniCameraControls");p(this,"cameraHelper");p(this,"axesHelper");p(this,"gridHelper");this._appService=t,this._cameraService=e,this._worldService=r}_setCameraOrbitControl(){var t;this.cameraControls&&((t=this.cameraControls)==null||t.dispose(),this.cameraControls=void 0),!(!this.enabled||!(this._cameraService.instance instanceof O.Camera))&&this._cameraService.instance instanceof O.Camera&&(this.cameraControls=new gn(this._cameraService.instance,this._appService.proxyReceiver),this.cameraControls.rotateSpeed=.1,this.cameraControls.enableDamping=!0)}_setMiniCameraOrbitControls(){this.miniCameraControls&&(this.miniCameraControls.dispose(),this.miniCameraControls=void 0),!(!this.enabled||!this._cameraService.miniCamera)&&(this.miniCameraControls=new gn(this._cameraService.miniCamera,this._appService.proxyReceiver),this.miniCameraControls.rotateSpeed=.15,this.miniCameraControls.enableDamping=!0)}_setCameraHelper(){this.cameraHelper&&(this._worldService.scene.remove(this.cameraHelper),this.cameraHelper=void 0),this.enabled&&this._cameraService.instance&&(this.cameraHelper=new O.CameraHelper(this._cameraService.instance),this._worldService.scene.add(this.cameraHelper))}_setAxesHelper(t){const e=new O.AxesHelper(t);this._worldService.scene.add(e)}_setGridHelper(t){const e=new O.GridHelper(t,t);this._worldService.scene.add(e)}activate(t){this._setCameraOrbitControl(),this._setMiniCameraOrbitControls(),this._setCameraHelper(),typeof(t==null?void 0:t.axesSizes)=="number"&&this._setAxesHelper(t.axesSizes),typeof(t==null?void 0:t.gridSizes)=="number"&&this._setGridHelper(t.gridSizes)}update(){var t,e;(t=this.cameraControls)==null||t.update(),(e=this.miniCameraControls)==null||e.update()}deactivate(){this.cameraHelper&&(this._worldService.scene.remove(this.cameraHelper),this.cameraHelper=void 0),this.cameraControls&&(this.cameraControls.dispose(),this.cameraControls=void 0),this.miniCameraControls&&(this.miniCameraControls.dispose(),this.miniCameraControls=void 0)}};Ct=$a([G(),qt(0,z(Qe)),qt(1,z(Re)),qt(2,z(Ke))],Ct);var ai=Object.defineProperty,xa=Object.getOwnPropertyDescriptor,Da=(t,e,r)=>e in t?ai(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Aa=(t,e,r,n)=>{for(var i=n>1?void 0:n?xa(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&&ai(e,r,i),i},ht=(t,e)=>(r,n)=>e(r,n,t),ka=(t,e,r)=>Da(t,e+"",r);let We=class{constructor(t,e,r,n){p(this,"enabled",!0);p(this,"instance");this._worldService=t,this._cameraService=e,this._sizesService=r,this._debugComponent=n}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(We.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),this._debugComponent.enabled&&this._cameraService.miniCamera&&(this.instance.setScissorTest(!0),this.instance.setViewport(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),this.instance.setScissor(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),this.instance.render(this._worldService.scene,this._cameraService.miniCamera),this.instance.setScissorTest(!1)))}};ka(We,"RENDERER_PIXEL_RATIO",1);We=Aa([G(),ht(0,z(Ke)),ht(1,z(Re)),ht(2,z(Me)),ht(3,z(Ct))],We);var Ia=Object.defineProperty,za=Object.getOwnPropertyDescriptor,Fa=(t,e,r,n)=>{for(var i=n>1?void 0:n?za(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&&Ia(e,r,i),i},Pn=(t,e)=>(r,n)=>e(r,n,t);let St=class{constructor(t,e){p(this,"resize$");this._appController=t,this._service=e,this.resize$=this._appController.resize$$.pipe(ye(()=>this._service.enabled))}};St=Fa([G(),Pn(0,z(gt)),Pn(1,z(Me))],St);var La=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,Na=(t,e,r,n)=>{for(var i=n>1?void 0:n?Wa(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},Vt=(t,e)=>(r,n)=>e(r,n,t);let sr=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))}};sr=Na([G(),Vt(0,z(We)),Vt(1,z(Le)),Vt(2,z(St))],sr);var Ua=Object.defineProperty,Ha=Object.getOwnPropertyDescriptor,qa=(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&&Ua(e,r,i),i},Cn=(t,e)=>(r,n)=>e(r,n,t);let or=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}};or=qa([G(),Cn(0,z(sr)),Cn(1,z(We))],or);var Va=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,Ba=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ya(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&&Va(e,r,i),i},Sn=(t,e)=>(r,n)=>e(r,n,t);let ar=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$}};ar=Ba([G(),Sn(0,z(St)),Sn(1,z(Me))],ar);var Za=Object.defineProperty,Ga=Object.getOwnPropertyDescriptor,Qa=(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&&Za(e,r,i),i},Ka=(t,e)=>(r,n)=>e(r,n,t);let ur=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}};ur=Qa([G(),Ka(0,z(Ke))],ur);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},En=(t,e)=>(r,n)=>e(r,n,t);let cr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};cr=eu([G(),En(0,z(Le)),En(1,z(Re))],cr);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},On=(t,e)=>(r,n)=>e(r,n,t);let lr=class{constructor(t,e){this._service=t,this._controller=e,this._controller.step$.subscribe(()=>{this._service.update()})}step$(){return this._controller.step$}init(t){this._service.activate(t)}axesHelper(){return this._service.axesHelper}cameraControls(){return this._service.cameraControls}cameraHelper(){return this._service.cameraHelper}enabled(t){return t&&(this._service.enabled=t),this._service.enabled}gridHelper(){return this._service.gridHelper}miniCameraControls(){return this._service.miniCameraControls}dispose(){this._service.deactivate()}};lr=nu([G(),On(0,z(Ct)),On(1,z(cr))],lr);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 hr=class{constructor(){p(this,"load$",_t(self,"message").pipe(ye(t=>{var e,r,n;return((e=t.data)==null?void 0:e.token)===zn&&!!((n=(r=t.data)==null?void 0:r.payload)!=null&&n.resource)}),rt(t=>{const{payload:e}=t.data||{};if(e!=null&&e.resource&&e.source.type==="gltfModel"){const r=e.resource,n=ko(r==null?void 0:r.scene);return{...e,resource:{...r,scene:n}}}return e}),wr()));p(this,"loadCompleted$",this.load$.pipe(ye(t=>(t==null?void 0:t.toLoadCount)===t.loadedCount)))}};hr=ou([Et(te.ResolutionScoped)],hr);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};let fr=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)}};fr=cu([Et(te.ResolutionScoped)],fr);var lu=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,fu=(t,e,r,n)=>{for(var i=n>1?void 0:n?hu(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&&lu(e,r,i),i},Tn=(t,e)=>(r,n)=>e(r,n,t);let dr=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())}};dr=fu([G(),Tn(0,z(hr)),Tn(1,z(fr))],dr);var du=Object.defineProperty,pu=Object.getOwnPropertyDescriptor,mu=(t,e,r,n)=>{for(var i=n>1?void 0:n?pu(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&&du(e,r,i),i},ve=(t,e)=>(r,n)=>e(r,n,t);exports.AppModule=class extends In{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(){yr.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(e.withMiniCamera),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([Et(te.ContainerScoped),ve(0,z(gt)),ve(1,z(Qe)),ve(2,z(rr)),ve(3,z(ar)),ve(4,z(ir)),ve(5,z(ur)),ve(6,z(or)),ve(7,z(dr)),ve(8,z(lr))],exports.AppModule);exports.A=$o;exports.AppProxyEventHandlersBlueprint=In;exports.C=jo;exports.CONTAINER_TOKEN=qi;exports.D=xo;exports.DefaultCameraType=yt;exports.J=Io;exports.KEYBOARD_EVENT_CODES=Ui;exports.LOADER_SERIALIZED_LOAD_TOKEN=zn;exports.Lifecycle=te;exports.PROXY_EVENT_LISTENERS=yr;exports.ProxyEventHandlersBlueprint=kn;exports.ProxyEventObservablesBlueprint=An;exports.ProxyEventSubjectsBlueprint=Dn;exports.Q=Do;exports.RegisterProxyEventHandlersBlueprint=Hi;exports.Subject=et;exports.U=tr;exports.W=Ao;exports.filter=ye;exports.fromEvent=_t;exports.getDefaultExportFromCjs=Mn;exports.inject=z;exports.instance=vr;exports.map=rt;exports.requireWorker=si;exports.scoped=Et;exports.share=wr;exports.singleton=G;
|
|
34
|
+
Original error:`,y)}}function D(y,$,k){return e(this,void 0,void 0,function*(){let H;try{H=$(...k)}catch(B){return P(y,B)}const ne=F(H)?"observable":"promise";if(g(y,ne),F(H)){const B=H.subscribe(Q=>R(y,!1,i.serialize(Q)),Q=>{P(y,i.serialize(Q)),f.delete(y)},()=>{R(y,!0),f.delete(y)});f.set(y,B)}else try{const B=yield H;R(y,!0,i.serialize(B))}catch(B){P(y,i.serialize(B))}})}function U(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");S($)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${y}`);a.default.subscribeToMasterMessages($=>{if(v($)){const k=$.uid,H=f.get(k);H&&(H.unsubscribe(),f.delete(k))}})}t.expose=U,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)}))}(Ee)),Ee}var yn;function yo(){return yn||(yn=1,function(t){var e=we&&we.__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=we&&we.__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=Ge();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return n.registerSerializer}}),r(po(),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=wt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return o.Transfer}})}(we)),we}var _o=yo();const be=Rn(_o);be.registerSerializer;const bo=be.spawn;be.BlobWorker;be.DefaultSerializer;be.Pool;const wo=be.Thread;be.Transfer;const go=be.Worker;var Po=Object.defineProperty,Co=(t,e,r)=>e in t?Po(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 So 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 Eo=()=>{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}},Oo=()=>Eo()-1,To="TERMINATE_THREAD_FROM_WORKER";let Mo=-1;class Ro{constructor(e){se(this,"_handleTerminate"),se(this,"_handleError"),se(this,"_task"),se(this,"id",Mo+=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)===To&&this.terminate()}async run(e){var r;try{const{payload:n,options:i}=e;return this.idle=!1,this.worker=new go(n.path,{type:"module",...i==null?void 0:i.worker}),this.thread=await bo(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 wo.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 jo{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 Ro({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 $o=(t,e)=>new jo(Oo(),!!e),xo=t=>t===void 0,Do=t=>typeof t=="boolean",Ao=t=>!!t&&typeof t=="function",ko=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})},Ut=(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},Io=(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 Qe=class{constructor(){p(this,"_canvas");p(this,"proxyReceiver",new So);p(this,"initialized",!1)}get canvas(){return this._canvas}set canvas(t){t.style={width:t.width+"",height:t.height+""},this._canvas=t}};Qe=Lo([G()],Qe);var Wo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Uo=(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},Ho=(t,e)=>(r,n)=>e(r,n,t);let gt=class extends In{constructor(t){super(),this._service=t;for(const e of _r)this[`${e}$$`]=new et,this[`${e}$`]=this[`${e}$$`].pipe(),this[e]=r=>{this._service.proxyReceiver.handleEvent({...r,type:r.type||e}),this[`${e}$$`].next(r)}}};gt=Uo([G(),Ho(0,z(Qe))],gt);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 Pt=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}};Pt=Yo([G()],Pt);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 Le=class{constructor(t){p(this,"beforeStep$$",new et);p(this,"_previousTime",0);p(this,"beforeStep$",this.beforeStep$$.asObservable());p(this,"step$",ss().pipe(As(({elapsed:t})=>{var e;this._previousTime!==t&&((e=this.beforeStep$$)==null||e.next(rr(this._service,[])),this._previousTime=t)}),ye(()=>this._service.enabled),Ds(()=>this._service.enabled),rt(()=>rr(this._service,[])),gr()));this._service=t}};Le=Go([G(),Qo(0,z(Pt))],Le);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(Le)),_n(1,z(Pt))],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 Me=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}};Me=ra([G()],Me);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,"miniCamera");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)}initDefaultCamera(t){if(this.removeCamera(),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))}setMiniCamera(){this.removeMiniCamera(),this.miniCamera=new O.PerspectiveCamera(75,this._sizesService.width/this._sizesService.height,.1,500),this.miniCamera.position.z=10,this.miniCamera.position.x=-5}removeCamera(){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)}removeMiniCamera(){this.miniCamera instanceof O.Camera&&(this.miniCamera.clearViewOffset(),this.miniCamera.clear(),this.miniCamera=void 0)}};Re=sa([G(),oa(0,z(Me))],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(Le)),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},Ht=(t,e)=>(r,n)=>e(r,n,t);let sr=class{constructor(t,e,r){this._sizesService=t,this._controller=e,this._service=r}init(t){this._service.initDefaultCamera(),t&&this._service.setMiniCamera(),this._controller.step$.subscribe(()=>{var e,r;this._service.enabled&&(this._service.aspectRatio=this._sizesService.aspect,(this._service.instance instanceof O.PerspectiveCamera||this._service.instance instanceof O.OrthographicCamera)&&((e=this._service.instance)==null||e.updateProjectionMatrix()),(r=this._service.miniCamera)==null||r.updateProjectionMatrix())})}dispose(){this._service.removeCamera(),this._service.removeMiniCamera()}aspectRatio(t){return t&&(this._service.aspectRatio=t),this._service.aspectRatio}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}instance(t){return t&&(this._service.instance=t),this._service.instance}miniCamera(t){return t&&(this._service.miniCamera=t),this._service.miniCamera}position(t){return t&&(this._service.position=t),this._service.position}quaternion(t){return t&&(this._service.quaternion=t),this._service.quaternion}};sr=fa([G(),Ht(0,z(Me)),Ht(1,z(ir)),Ht(2,z(Re))],sr);var da=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,ma=(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 Ke=class{constructor(){p(this,"scene",new O.Scene);p(this,"enabled",!0)}};Ke=ma([G()],Ke);const wn={type:"change"},Er={type:"start"},ai={type:"end"},lt=new O.Ray,gn=new O.Plane,va=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},qt=1e-6;class Pn 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.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=_a.bind(this),this._onPointerDown=ya.bind(this),this._onPointerUp=ba.bind(this),this._onContextMenu=Oa.bind(this),this._onMouseWheel=Pa.bind(this),this._onKeyDown=Ca.bind(this),this._onTouchStart=Sa.bind(this),this._onTouchMove=Ea.bind(this),this._onMouseDown=wa.bind(this),this._onMouseMove=ga.bind(this),this._interceptControlDown=Ta.bind(this),this._interceptControlUp=Ma.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(wn),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):(lt.origin.copy(this.object.position),lt.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(lt.direction))<va?this.object.lookAt(this.target):(gn.setFromNormalAndCoplanarPoint(this.object.up,this.target),lt.intersectPlane(gn,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)>qt||8*(1-this._lastQuaternion.dot(this.object.quaternion))>qt||this._lastTargetPosition.distanceToSquared(this.target)>qt?(this.dispatchEvent(wn),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.rotateSpeed/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.rotateSpeed/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.rotateSpeed/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.rotateSpeed/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 ya(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 _a(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function ba(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(ai),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(Er)}function ga(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 Pa(t){this.enabled===!1||this.enableZoom===!1||this.state!==q.NONE||(t.preventDefault(),this.dispatchEvent(Er),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(ai))}function Ca(t){this.enabled!==!1&&this._handleKeyDown(t)}function Sa(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(Er)}function Ea(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 Oa(t){this.enabled!==!1&&t.preventDefault()}function Ta(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Ma(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}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},Vt=(t,e)=>(r,n)=>e(r,n,t);let Ct=class{constructor(t,e,r){p(this,"enabled",!0);p(this,"cameraControls");p(this,"miniCameraControls");p(this,"cameraHelper");p(this,"axesHelper");p(this,"gridHelper");this._appService=t,this._cameraService=e,this._worldService=r}_setCameraOrbitControl(){var t;this.cameraControls&&((t=this.cameraControls)==null||t.dispose(),this.cameraControls=void 0),!(!this.enabled||!(this._cameraService.instance instanceof O.Camera))&&this._cameraService.instance instanceof O.Camera&&(this.cameraControls=new Pn(this._cameraService.instance,this._appService.proxyReceiver),this.cameraControls.rotateSpeed=.1,this.cameraControls.enableDamping=!0)}_setMiniCameraOrbitControls(){this.miniCameraControls&&(this.miniCameraControls.dispose(),this.miniCameraControls=void 0),!(!this.enabled||!this._cameraService.miniCamera)&&(this.miniCameraControls=new Pn(this._cameraService.miniCamera,this._appService.proxyReceiver),this.miniCameraControls.rotateSpeed=.15,this.miniCameraControls.enableDamping=!0)}_setCameraHelper(){this.cameraHelper&&(this._worldService.scene.remove(this.cameraHelper),this.cameraHelper=void 0),this.enabled&&this._cameraService.instance&&(this.cameraHelper=new O.CameraHelper(this._cameraService.instance),this._worldService.scene.add(this.cameraHelper))}_setAxesHelper(t){const e=new O.AxesHelper(t);this._worldService.scene.add(e)}_setGridHelper(t){const e=new O.GridHelper(t,t);this._worldService.scene.add(e)}activate(t){this._setCameraOrbitControl(),this._setMiniCameraOrbitControls(),this._setCameraHelper(),typeof(t==null?void 0:t.axesSizes)=="number"&&this._setAxesHelper(t.axesSizes),typeof(t==null?void 0:t.gridSizes)=="number"&&this._setGridHelper(t.gridSizes)}update(){var t,e;(t=this.cameraControls)==null||t.update(),(e=this.miniCameraControls)==null||e.update()}deactivate(){this.cameraHelper&&(this._worldService.scene.remove(this.cameraHelper),this.cameraHelper=void 0),this.cameraControls&&(this.cameraControls.dispose(),this.cameraControls=void 0),this.miniCameraControls&&(this.miniCameraControls.dispose(),this.miniCameraControls=void 0)}};Ct=$a([G(),Vt(0,z(Qe)),Vt(1,z(Re)),Vt(2,z(Ke))],Ct);var ui=Object.defineProperty,xa=Object.getOwnPropertyDescriptor,Da=(t,e,r)=>e in t?ui(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Aa=(t,e,r,n)=>{for(var i=n>1?void 0:n?xa(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},ht=(t,e)=>(r,n)=>e(r,n,t),ka=(t,e,r)=>Da(t,e+"",r);let We=class{constructor(t,e,r,n){p(this,"enabled",!0);p(this,"instance");this._worldService=t,this._cameraService=e,this._sizesService=r,this._debugComponent=n}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(We.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),this._debugComponent.enabled&&this._cameraService.miniCamera&&(this.instance.setScissorTest(!0),this.instance.setViewport(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),this.instance.setScissor(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),this.instance.render(this._worldService.scene,this._cameraService.miniCamera),this.instance.setScissorTest(!1)))}};ka(We,"RENDERER_PIXEL_RATIO",1);We=Aa([G(),ht(0,z(Ke)),ht(1,z(Re)),ht(2,z(Me)),ht(3,z(Ct))],We);var Ia=Object.defineProperty,za=Object.getOwnPropertyDescriptor,Fa=(t,e,r,n)=>{for(var i=n>1?void 0:n?za(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&&Ia(e,r,i),i},Cn=(t,e)=>(r,n)=>e(r,n,t);let St=class{constructor(t,e){p(this,"resize$");this._appController=t,this._service=e,this.resize$=this._appController.resize$$.pipe(ye(()=>this._service.enabled))}};St=Fa([G(),Cn(0,z(gt)),Cn(1,z(Me))],St);var La=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,Na=(t,e,r,n)=>{for(var i=n>1?void 0:n?Wa(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},Yt=(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=Na([G(),Yt(0,z(We)),Yt(1,z(Le)),Yt(2,z(St))],or);var Ua=Object.defineProperty,Ha=Object.getOwnPropertyDescriptor,qa=(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&&Ua(e,r,i),i},Sn=(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=qa([G(),Sn(0,z(or)),Sn(1,z(We))],ar);var Va=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,Ba=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ya(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&&Va(e,r,i),i},En=(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=Ba([G(),En(0,z(St)),En(1,z(Me))],ur);var Za=Object.defineProperty,Ga=Object.getOwnPropertyDescriptor,Qa=(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&&Za(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=Qa([G(),Ka(0,z(Ke))],cr);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 lr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};lr=eu([G(),On(0,z(Le)),On(1,z(Re))],lr);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 hr=class{constructor(t,e){this._service=t,this._controller=e,this._controller.step$.subscribe(()=>{this._service.update()})}step$(){return this._controller.step$}init(t){this._service.activate(t)}axesHelper(){return this._service.axesHelper}cameraControls(){return this._service.cameraControls}cameraHelper(){return this._service.cameraHelper}enabled(t){return t&&(this._service.enabled=t),this._service.enabled}gridHelper(){return this._service.gridHelper}miniCameraControls(){return this._service.miniCameraControls}dispose(){this._service.deactivate()}};hr=nu([G(),Tn(0,z(Ct)),Tn(1,z(lr))],hr);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 fr=class{constructor(){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)}),rt(t=>{var r,n,i;const{payload:e}=t.data||{};if(e!=null&&e.resource&&e.source.type==="gltfModel"){const s=e.resource,o=(r=s.animations)==null?void 0:r.map(l=>O.AnimationClip.parse(l)),a=(n=s.cameras)==null?void 0:n.map(l=>Ut(l)),c=Ut((s==null?void 0:s.scene)||""),u=(i=s.scenes)==null?void 0:i.map(l=>Ut(l));return{...e,resource:{...s,animations:o,cameras:a,scene:c,scenes:u}}}return e}),gr()));p(this,"loadCompleted$",this.load$.pipe(ye(t=>(t==null?void 0:t.toLoadCount)===t.loadedCount)))}};fr=ou([Et(te.ResolutionScoped)],fr);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};let dr=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)}};dr=cu([Et(te.ResolutionScoped)],dr);var lu=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,fu=(t,e,r,n)=>{for(var i=n>1?void 0:n?hu(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&&lu(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=fu([G(),Mn(0,z(fr)),Mn(1,z(dr))],pr);var du=Object.defineProperty,pu=Object.getOwnPropertyDescriptor,mu=(t,e,r,n)=>{for(var i=n>1?void 0:n?pu(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&&du(e,r,i),i},ve=(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(e.withMiniCamera),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([Et(te.ContainerScoped),ve(0,z(gt)),ve(1,z(Qe)),ve(2,z(nr)),ve(3,z(ur)),ve(4,z(sr)),ve(5,z(cr)),ve(6,z(ar)),ve(7,z(pr)),ve(8,z(hr))],exports.AppModule);exports.A=xo;exports.AppProxyEventHandlersBlueprint=zn;exports.C=$o;exports.CONTAINER_TOKEN=Vi;exports.D=Do;exports.DefaultCameraType=yt;exports.J=Io;exports.KEYBOARD_EVENT_CODES=Hi;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=Ao;exports.RegisterProxyEventHandlersBlueprint=qi;exports.Subject=et;exports.U=rr;exports.W=ko;exports.filter=ye;exports.fromEvent=_t;exports.getDefaultExportFromCjs=Rn;exports.inject=z;exports.instance=yr;exports.map=rt;exports.requireWorker=oi;exports.scoped=Et;exports.share=gr;exports.singleton=G;
|