@quick-threejs/reactive 0.1.31 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app.module-BbeIDure.mjs → app.module-DSL-GqOC.mjs} +13 -7
- package/dist/{app.module-BaIoj4QA.js → app.module-DtXUGy5w.js} +1 -1
- package/dist/core/app/app.module.d.ts +6 -4
- package/dist/core/app/app.service.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/main.mjs +2 -2
- package/dist/worker.js +1 -1
- package/dist/worker.mjs +26 -24
- package/package.json +1 -1
|
@@ -4915,7 +4915,7 @@ let nt = class {
|
|
|
4915
4915
|
constructor() {
|
|
4916
4916
|
p(this, "_canvas");
|
|
4917
4917
|
p(this, "proxyReceiver", new Yo());
|
|
4918
|
-
p(this, "
|
|
4918
|
+
p(this, "isInitialized", !1);
|
|
4919
4919
|
}
|
|
4920
4920
|
get canvas() {
|
|
4921
4921
|
return this._canvas;
|
|
@@ -6089,18 +6089,24 @@ let In = class extends ls {
|
|
|
6089
6089
|
};
|
|
6090
6090
|
});
|
|
6091
6091
|
}
|
|
6092
|
-
|
|
6093
|
-
|
|
6092
|
+
getProxyReceiver() {
|
|
6093
|
+
return this._service.proxyReceiver;
|
|
6094
6094
|
}
|
|
6095
|
-
|
|
6096
|
-
return this._service.
|
|
6095
|
+
getCanvas() {
|
|
6096
|
+
return this._service.canvas;
|
|
6097
6097
|
}
|
|
6098
|
-
|
|
6098
|
+
getIsInitialized() {
|
|
6099
|
+
return this._service.isInitialized;
|
|
6100
|
+
}
|
|
6101
|
+
getBeforeStep$() {
|
|
6099
6102
|
return this.timer.beforeStep$();
|
|
6100
6103
|
}
|
|
6101
|
-
|
|
6104
|
+
getStep$() {
|
|
6102
6105
|
return this.timer.step$();
|
|
6103
6106
|
}
|
|
6107
|
+
init(t) {
|
|
6108
|
+
this._service.isInitialized || !(t != null && t.canvas) || !(this._service.canvas = t.canvas) || (this._service.isInitialized = !0, this.sizes.init(this._service.canvas), this.camera.init(), this.world.init(), this.renderer.init(this._service.canvas), this.timer.init(t.startTimer), this.loader.init(), this.debug.init(t));
|
|
6109
|
+
}
|
|
6104
6110
|
dispose() {
|
|
6105
6111
|
this.sizes.dispose(), this.camera.dispose(), this.world.dispose(), this.renderer.dispose(), this.timer.dispose(), this.loader.dispose(), this.debug.dispose();
|
|
6106
6112
|
}
|
|
@@ -31,4 +31,4 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
31
31
|
`):"",this.name="UnsubscriptionError",this.errors=r}});function Xt(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var tt=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=ze(o),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(A){e={error:A}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else o.remove(this);var l=this.initialTeardown;if(Y(l))try{l()}catch(A){s=A instanceof xt?A.errors:[A]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var m=ze(h),w=m.next();!w.done;w=m.next()){var F=w.value;try{Nr(F)}catch(A){s=s??[],A instanceof xt?s=Me(Me([],_e(s)),_e(A.errors)):s.push(A)}}}catch(A){n={error:A}}finally{try{w&&!w.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}}if(s)throw new xt(s)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Nr(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&Xt(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&Xt(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Nn=tt.EMPTY;function Hn(t){return t instanceof tt||t&&"closed"in t&&Y(t.remove)&&Y(t.add)&&Y(t.unsubscribe)}function Nr(t){Y(t)?t():t.unsubscribe()}var Un={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},qn={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Me([t,e],_e(r)))},clearTimeout:function(t){var e=qn.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Vn(t){qn.setTimeout(function(){throw t})}function Hr(){}function pt(t){t()}var br=function(t){et(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Hn(r)&&r.add(n)):n.destination=Ji,n}return e.create=function(r,n,i){return new Qe(r,n,i)},e.prototype.next=function(r){this.isStopped||this._next(r)},e.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(tt),Qi=Function.prototype.bind;function Dt(t,e){return Qi.call(t,e)}var Ki=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){ut(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){ut(n)}else ut(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){ut(r)}},t}(),Qe=function(t){et(e,t);function e(r,n,i){var s=t.call(this)||this,o;if(Y(r)||!r)o={next:r??void 0,error:n??void 0,complete:i??void 0};else{var a;s&&Un.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return s.unsubscribe()},o={next:r.next&&Dt(r.next,a),error:r.error&&Dt(r.error,a),complete:r.complete&&Dt(r.complete,a)}):o=r}return s.destination=new Ki(o),s}return e}(br);function ut(t){Vn(t)}function Xi(t){throw t}var Ji={closed:!0,next:Hr,error:Xi,complete:Hr},wr=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Yn(t){return t}function es(t){return t.length===0?Yn:t.length===1?t[0]:function(r){return t.reduce(function(n,i){return i(n)},r)}}var le=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var i=this,s=rs(e)?e:new Qe(e,r,n);return pt(function(){var o=i,a=o.operator,c=o.source;s.add(a?a.call(s,c):c?i._subscribe(s):i._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=Ur(r),new r(function(i,s){var o=new Qe({next:function(a){try{e(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:i});n.subscribe(o)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[wr]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return es(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=Ur(e),new e(function(n,i){var s;r.subscribe(function(o){return s=o},function(o){return i(o)},function(){return n(s)})})},t.create=function(e){return new t(e)},t}();function Ur(t){var e;return(e=t??Un.Promise)!==null&&e!==void 0?e:Promise}function ts(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function rs(t){return t&&t instanceof br||ts(t)&&Hn(t)}function ns(t){return Y(t==null?void 0:t.lift)}function He(t){return function(e){if(ns(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Fe(t,e,r,n,i){return new is(t,e,r,n,i)}var is=function(t){et(e,t);function e(r,n,i,s,o,a){var c=t.call(this,r)||this;return c.onFinalize=o,c.shouldUnsubscribe=a,c._next=n?function(u){try{n(u)}catch(l){r.error(l)}}:t.prototype._next,c._error=s?function(u){try{s(u)}catch(l){r.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(u){r.error(u)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},e}(br),ss={now:function(){return performance.now()},delegate:void 0},Jt={schedule:function(t){var e=requestAnimationFrame,r=cancelAnimationFrame,n=Jt.delegate;n&&(e=n.requestAnimationFrame,r=n.cancelAnimationFrame);var i=e(function(s){r=void 0,t(s)});return new tt(function(){return r==null?void 0:r(i)})},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return requestAnimationFrame.apply(void 0,Me([],_e(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,Me([],_e(t)))},delegate:void 0};function os(t){return t?Bn(t):as}function Bn(t){return new le(function(e){var r=t||ss,n=r.now(),i=0,s=function(){e.closed||(i=Jt.requestAnimationFrame(function(o){i=0;var a=r.now();e.next({timestamp:t?a:o,elapsed:a-n}),s()}))};return s(),function(){i&&Jt.cancelAnimationFrame(i)}})}var as=Bn(),us=Wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),rt=function(t){et(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new qr(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new us},e.prototype.next=function(r){var n=this;pt(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var o=ze(n.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}}})},e.prototype.error=function(r){var n=this;pt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},e.prototype.complete=function(){var r=this;pt(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,i=this,s=i.hasError,o=i.isStopped,a=i.observers;return s||o?Nn:(this.currentObservers=null,a.push(r),new tt(function(){n.currentObservers=null,Xt(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,s=n.thrownError,o=n.isStopped;i?r.error(s):o&&r.complete()},e.prototype.asObservable=function(){var r=new le;return r.source=this,r},e.create=function(r,n){return new qr(r,n)},e}(le),qr=function(t){et(e,t);function e(r,n){var i=t.call(this)||this;return i.destination=r,i.source=n,i}return e.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},e.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:Nn},e}(rt),Zn=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function cs(t){return Y(t==null?void 0:t.then)}function ls(t){return Y(t[wr])}function hs(t){return Symbol.asyncIterator&&Y(t==null?void 0:t[Symbol.asyncIterator])}function fs(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ds(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ps=ds();function vs(t){return Y(t==null?void 0:t[ps])}function ms(t){return Zi(this,arguments,function(){var r,n,i,s;return Ln(this,function(o){switch(o.label){case 0:r=t.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,Ie(r.read())];case 3:return n=o.sent(),i=n.value,s=n.done,s?[4,Ie(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Ie(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function ys(t){return Y(t==null?void 0:t.getReader)}function nt(t){if(t instanceof le)return t;if(t!=null){if(ls(t))return _s(t);if(Zn(t))return bs(t);if(cs(t))return ws(t);if(hs(t))return Gn(t);if(vs(t))return gs(t);if(ys(t))return Ps(t)}throw fs(t)}function _s(t){return new le(function(e){var r=t[wr]();if(Y(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function bs(t){return new le(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function ws(t){return new le(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,Vn)})}function gs(t){return new le(function(e){var r,n;try{for(var i=ze(t),s=i.next();!s.done;s=i.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.complete()})}function Gn(t){return new le(function(e){Ss(t,e).catch(function(r){return e.error(r)})})}function Ps(t){return Gn(ms(t))}function Ss(t,e){var r,n,i,s;return Bi(this,void 0,void 0,function(){var o,a;return Ln(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Gi(t),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Le(t,e){return He(function(r,n){var i=0;r.subscribe(Fe(n,function(s){n.next(t.call(e,s,i++))}))})}var Cs=Array.isArray;function Es(t,e){return Cs(e)?t.apply(void 0,Me([],_e(e))):t(e)}function Os(t){return Le(function(e){return Es(t,e)})}function Ts(t,e,r,n,i,s,o,a){var c=[],u=0,l=0,h=!1,m=function(){h&&!c.length&&!u&&e.complete()},w=function(A){return u<n?F(A):c.push(A)},F=function(A){u++;var L=!1;nt(r(A,l++)).subscribe(Fe(e,function(_){e.next(_)},function(){L=!0},void 0,function(){if(L)try{u--;for(var _=function(){var C=c.shift();o||F(C)};c.length&&u<n;)_();m()}catch(C){e.error(C)}}))};return t.subscribe(Fe(e,w,function(){h=!0,m()})),function(){}}function Qn(t,e,r){return r===void 0&&(r=1/0),Y(e)?Qn(function(n,i){return Le(function(s,o){return e(n,s,i,o)})(nt(t(n,i)))},r):(typeof e=="number"&&(r=e),He(function(n,i){return Ts(n,i,t,r)}))}var Ms=["addListener","removeListener"],Rs=["addEventListener","removeEventListener"],js=["on","off"];function _t(t,e,r,n){if(Y(r)&&(n=r,r=void 0),n)return _t(t,e,r).pipe(Os(n));var i=_e(Ds(t)?Rs.map(function(a){return function(c){return t[a](e,c,r)}}):$s(t)?Ms.map(Vr(t,e)):xs(t)?js.map(Vr(t,e)):[],2),s=i[0],o=i[1];if(!s&&Zn(t))return Qn(function(a){return _t(a,e,r)})(nt(t));if(!s)throw new TypeError("Invalid event target");return new le(function(a){var c=function(){for(var u=[],l=0;l<arguments.length;l++)u[l]=arguments[l];return a.next(1<u.length?u:u[0])};return s(c),function(){return o(c)}})}function Vr(t,e){return function(r){return function(n){return t[r](e,n)}}}function $s(t){return Y(t.addListener)&&Y(t.removeListener)}function xs(t){return Y(t.on)&&Y(t.off)}function Ds(t){return Y(t.addEventListener)&&Y(t.removeEventListener)}function ye(t,e){return He(function(r,n){var i=0;r.subscribe(Fe(n,function(s){return t.call(e,s,i++)&&n.next(s)}))})}function bt(t){t===void 0&&(t={});var e=t.connector,r=e===void 0?function(){return new rt}:e,n=t.resetOnError,i=n===void 0?!0:n,s=t.resetOnComplete,o=s===void 0?!0:s,a=t.resetOnRefCountZero,c=a===void 0?!0:a;return function(u){var l,h,m,w=0,F=!1,A=!1,L=function(){h==null||h.unsubscribe(),h=void 0},_=function(){L(),l=m=void 0,F=A=!1},C=function(){var P=l;_(),P==null||P.unsubscribe()};return He(function(P,R){w++,!A&&!F&&L();var g=m=m??r();R.add(function(){w--,w===0&&!A&&!F&&(h=At(C,c))}),g.subscribe(R),!l&&w>0&&(l=new Qe({next:function(b){return g.next(b)},error:function(b){A=!0,L(),h=At(_,i,b),g.error(b)},complete:function(){F=!0,L(),h=At(_,o),g.complete()}}),nt(P).subscribe(l))})(u)}}function At(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(e===!0){t();return}if(e!==!1){var i=new Qe({next:function(){i.unsubscribe(),t()}});return nt(e.apply(void 0,Me([],_e(r)))).subscribe(i)}}function As(t,e){return e===void 0&&(e=!1),He(function(r,n){var i=0;r.subscribe(Fe(n,function(s){var o=t(s,i++);(o||e)&&n.next(s),!o&&n.complete()}))})}function ks(t,e,r){var n=Y(t)||e||r?{next:t,error:e,complete:r}:t;return n?He(function(i,s){var o;(o=n.subscribe)===null||o===void 0||o.call(n);var a=!0;i.subscribe(Fe(s,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),s.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),s.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),s.error(c)},function(){var c,u;a&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Yn}var ge={},fe={},Pe={},Yr;function Kn(){if(Yr)return Pe;Yr=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.DefaultSerializer=Pe.extendSerializer=void 0;function t(n,i){const s=n.deserialize.bind(n),o=n.serialize.bind(n);return{deserialize(a){return i.deserialize(a,s)},serialize(a){return i.serialize(a,o)}}}Pe.extendSerializer=t;const e={deserialize(n){return Object.assign(Error(n.message),{name:n.name,stack:n.stack})},serialize(n){return{__error_marker:"$$error",message:n.message,name:n.name,stack:n.stack}}},r=n=>n&&typeof n=="object"&&"__error_marker"in n&&n.__error_marker==="$$error";return Pe.DefaultSerializer={deserialize(n){return r(n)?e.deserialize(n):n},serialize(n){return n instanceof Error?e.serialize(n):n}},Pe}var Br;function Ke(){if(Br)return fe;Br=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.serialize=fe.deserialize=fe.registerSerializer=void 0;const t=Kn();let e=t.DefaultSerializer;function r(s){e=t.extendSerializer(e,s)}fe.registerSerializer=r;function n(s){return e.deserialize(s)}fe.deserialize=n;function i(s){return e.serialize(s)}return fe.serialize=i,fe}var kt={},de={},Se={},Zr;function Is(){if(Zr)return Se;Zr=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.getBundleURL=Se.getBaseURL=void 0;let t;function e(){return t||(t=r()),t}Se.getBundleURL=e;function r(){try{throw new Error}catch(i){const s=(""+i.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(s)return n(s[0])}return"/"}function n(i){return(""+i).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/,"$1")+"/"}return Se.getBaseURL=n,Se}var Gr;function Xn(){if(Gr)return de;Gr=1,Object.defineProperty(de,"__esModule",{value:!0}),de.isWorkerRuntime=de.getWorkerImplementation=de.defaultPoolSize=void 0;const t=Is();de.defaultPoolSize=typeof navigator<"u"&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;const e=a=>/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a);function r(a){const c=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(c)}function n(){if(typeof Worker>"u")return class{constructor(){throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.")}};class a extends Worker{constructor(l,h){var m,w;typeof l=="string"&&h&&h._baseURL?l=new URL(l,h._baseURL):typeof l=="string"&&!e(l)&&t.getBundleURL().match(/^file:\/\//i)&&(l=new URL(l,t.getBundleURL().replace(/\/[^\/]+$/,"/")),(!((m=h==null?void 0:h.CORSWorkaround)!==null&&m!==void 0)||m)&&(l=r(`importScripts(${JSON.stringify(l)});`))),typeof l=="string"&&e(l)&&(!((w=h==null?void 0:h.CORSWorkaround)!==null&&w!==void 0)||w)&&(l=r(`importScripts(${JSON.stringify(l)});`)),super(l,h)}}class c extends a{constructor(l,h){const m=window.URL.createObjectURL(l);super(m,h)}static fromText(l,h){const m=new window.Blob([l],{type:"text/javascript"});return new c(m,h)}}return{blob:c,default:a}}let i;function s(){return i||(i=n()),i}de.getWorkerImplementation=s;function o(){const a=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!a)}return de.isWorkerRuntime=o,de}var Ce={},ct={exports:{}},It,Qr;function zs(){if(Qr)return It;Qr=1;var t=1e3,e=t*60,r=e*60,n=r*24,i=n*7,s=n*365.25;It=function(l,h){h=h||{};var m=typeof l;if(m==="string"&&l.length>0)return o(l);if(m==="number"&&isFinite(l))return h.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(h){var m=parseFloat(h[1]),w=(h[2]||"ms").toLowerCase();switch(w){case"years":case"year":case"yrs":case"yr":case"y":return m*s;case"weeks":case"week":case"w":return m*i;case"days":case"day":case"d":return m*n;case"hours":case"hour":case"hrs":case"hr":case"h":return m*r;case"minutes":case"minute":case"mins":case"min":case"m":return m*e;case"seconds":case"second":case"secs":case"sec":case"s":return m*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function a(l){var h=Math.abs(l);return h>=n?Math.round(l/n)+"d":h>=r?Math.round(l/r)+"h":h>=e?Math.round(l/e)+"m":h>=t?Math.round(l/t)+"s":l+"ms"}function c(l){var h=Math.abs(l);return h>=n?u(l,h,n,"day"):h>=r?u(l,h,r,"hour"):h>=e?u(l,h,e,"minute"):h>=t?u(l,h,t,"second"):l+" ms"}function u(l,h,m,w){var F=h>=m*1.5;return Math.round(l/m)+" "+w+(F?"s":"")}return It}var zt,Kr;function Fs(){if(Kr)return zt;Kr=1;function t(e){n.debug=n,n.default=n,n.coerce=u,n.disable=o,n.enable=s,n.enabled=a,n.humanize=zs(),n.destroy=l,Object.keys(e).forEach(h=>{n[h]=e[h]}),n.names=[],n.skips=[],n.formatters={};function r(h){let m=0;for(let w=0;w<h.length;w++)m=(m<<5)-m+h.charCodeAt(w),m|=0;return n.colors[Math.abs(m)%n.colors.length]}n.selectColor=r;function n(h){let m,w=null,F,A;function L(..._){if(!L.enabled)return;const C=L,P=Number(new Date),R=P-(m||P);C.diff=R,C.prev=m,C.curr=P,m=P,_[0]=n.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let g=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(D,H)=>{if(D==="%%")return"%";g++;const y=n.formatters[H];if(typeof y=="function"){const $=_[g];D=y.call(C,$),_.splice(g,1),g--}return D}),n.formatArgs.call(C,_),(C.log||n.log).apply(C,_)}return L.namespace=h,L.useColors=n.useColors(),L.color=n.selectColor(h),L.extend=i,L.destroy=n.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(F!==n.namespaces&&(F=n.namespaces,A=n.enabled(h)),A),set:_=>{w=_}}),typeof n.init=="function"&&n.init(L),L}function i(h,m){const w=n(this.namespace+(typeof m>"u"?":":m)+h);return w.log=this.log,w}function s(h){n.save(h),n.namespaces=h,n.names=[],n.skips=[];let m;const w=(typeof h=="string"?h:"").split(/[\s,]+/),F=w.length;for(m=0;m<F;m++)w[m]&&(h=w[m].replace(/\*/g,".*?"),h[0]==="-"?n.skips.push(new RegExp("^"+h.slice(1)+"$")):n.names.push(new RegExp("^"+h+"$")))}function o(){const h=[...n.names.map(c),...n.skips.map(c).map(m=>"-"+m)].join(",");return n.enable(""),h}function a(h){if(h[h.length-1]==="*")return!0;let m,w;for(m=0,w=n.skips.length;m<w;m++)if(n.skips[m].test(h))return!1;for(m=0,w=n.names.length;m<w;m++)if(n.names[m].test(h))return!0;return!1}function c(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}function u(h){return h instanceof Error?h.stack||h.message:h}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return zt=t,zt}var Xr;function gr(){return Xr||(Xr=1,function(t,e){e.formatArgs=n,e.save=i,e.load=s,e.useColors=r,e.storage=o(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,h=0;c[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(l++,m==="%c"&&(h=l))}),c.splice(h,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function s(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function o(){try{return localStorage}catch{}}t.exports=Fs()(e);const{formatters:a}=t.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(ct,ct.exports)),ct.exports}var Ls=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};class Tt{constructor(e){this._baseObserver=e,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch(e=>this._baseObserver.error(e))}error(e){this._baseObserver.error(e)}schedule(e){const r=Promise.all(this._pendingPromises),n=[],i=o=>n.push(o),s=Promise.resolve().then(()=>Ls(this,void 0,void 0,function*(){yield r,yield e(i),this._pendingPromises.delete(s);for(const o of n)this._baseObserver.next(o)})).catch(o=>{this._pendingPromises.delete(s),this._baseObserver.error(o)});this._pendingPromises.add(s)}}const Jn=()=>typeof Symbol=="function",it=t=>Jn()&&!!Symbol[t],Pr=t=>it(t)?Symbol[t]:"@@"+t;it("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const Ws=Pr("iterator"),er=Pr("observable"),ei=Pr("species");function wt(t,e){const r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function qe(t){let e=t.constructor;return e!==void 0&&(e=e[ei],e===null&&(e=void 0)),e!==void 0?e:re}function Ns(t){return t instanceof re}function We(t){We.log?We.log(t):setTimeout(()=>{throw t},0)}function vt(t){Promise.resolve().then(()=>{try{t()}catch(e){We(e)}})}function ti(t){const e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{const r=wt(e,"unsubscribe");r&&r.call(e)}}catch(r){We(r)}}function tr(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Hs(t){const e=t._queue;if(e){t._queue=void 0,t._state="ready";for(const r of e)if(ri(t,r.type,r.value),t._state==="closed")break}}function ri(t,e,r){t._state="running";const n=t._observer;try{const i=n?wt(n,e):void 0;switch(e){case"next":i&&i.call(n,r);break;case"error":if(tr(t),i)i.call(n,r);else throw r;break;case"complete":tr(t),i&&i.call(n);break}}catch(i){We(i)}t._state==="closed"?ti(t):t._state==="running"&&(t._state="ready")}function Ft(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue=t._queue||[],t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],vt(()=>Hs(t));return}ri(t,e,r)}}class Us{constructor(e,r){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const n=new qs(this);try{this._cleanup=r.call(void 0,n)}catch(i){n.error(i)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(tr(this),ti(this))}}class qs{constructor(e){this._subscription=e}get closed(){return this._subscription._state==="closed"}next(e){Ft(this._subscription,"next",e)}error(e){Ft(this._subscription,"error",e)}complete(){Ft(this._subscription,"complete")}}class re{constructor(e){if(!(this instanceof re))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,r,n){return(typeof e!="object"||e===null)&&(e={next:e,error:r,complete:n}),new Us(e,this._subscriber)}pipe(e,...r){let n=this;for(const i of[e,...r])n=i(n);return n}tap(e,r,n){const i=typeof e!="object"||e===null?{next:e,error:r,complete:n}:e;return new re(s=>this.subscribe({next(o){i.next&&i.next(o),s.next(o)},error(o){i.error&&i.error(o),s.error(o)},complete(){i.complete&&i.complete(),s.complete()},start(o){i.start&&i.start(o)}}))}forEach(e){return new Promise((r,n)=>{if(typeof e!="function"){n(new TypeError(e+" is not a function"));return}function i(){s.unsubscribe(),r(void 0)}const s=this.subscribe({next(o){try{e(o,i)}catch(a){n(a),s.unsubscribe()}},error(o){n(o)},complete(){r(void 0)}})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=qe(this);return new r(n=>this.subscribe({next(i){let s=i;try{s=e(i)}catch(o){return n.error(o)}n.next(s)},error(i){n.error(i)},complete(){n.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=qe(this);return new r(n=>this.subscribe({next(i){try{if(!e(i))return}catch(s){return n.error(s)}n.next(i)},error(i){n.error(i)},complete(){n.complete()}}))}reduce(e,r){if(typeof e!="function")throw new TypeError(e+" is not a function");const n=qe(this),i=arguments.length>1;let s=!1,o=r;return new n(a=>this.subscribe({next(c){const u=!s;if(s=!0,!u||i)try{o=e(o,c)}catch(l){return a.error(l)}else o=c},error(c){a.error(c)},complete(){if(!s&&!i)return a.error(new TypeError("Cannot reduce an empty sequence"));a.next(o),a.complete()}}))}concat(...e){const r=qe(this);return new r(n=>{let i,s=0;function o(a){i=a.subscribe({next(c){n.next(c)},error(c){n.error(c)},complete(){s===e.length?(i=void 0,n.complete()):o(r.from(e[s++]))}})}return o(this),()=>{i&&(i.unsubscribe(),i=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=qe(this);return new r(n=>{const i=[],s=this.subscribe({next(a){let c;if(e)try{c=e(a)}catch(l){return n.error(l)}else c=a;const u=r.from(c).subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){const l=i.indexOf(u);l>=0&&i.splice(l,1),o()}});i.push(u)},error(a){n.error(a)},complete(){o()}});function o(){s.closed&&i.length===0&&n.complete()}return()=>{i.forEach(a=>a.unsubscribe()),s.unsubscribe()}})}[er](){return this}static from(e){const r=typeof this=="function"?this:re;if(e==null)throw new TypeError(e+" is not an object");const n=wt(e,er);if(n){const i=n.call(e);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Ns(i)&&i.constructor===r?i:new r(s=>i.subscribe(s))}if(it("iterator")){const i=wt(e,Ws);if(i)return new r(s=>{vt(()=>{if(!s.closed){for(const o of i.call(e))if(s.next(o),s.closed)return;s.complete()}})})}if(Array.isArray(e))return new r(i=>{vt(()=>{if(!i.closed){for(const s of e)if(i.next(s),i.closed)return;i.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){const r=typeof this=="function"?this:re;return new r(n=>{vt(()=>{if(!n.closed){for(const i of e)if(n.next(i),n.closed)return;n.complete()}})})}static get[ei](){return this}}Jn()&&Object.defineProperty(re,Symbol("extensions"),{value:{symbol:er,hostReportError:We},configurable:!0});function $e(t){typeof t=="function"?t():t&&typeof t.unsubscribe=="function"&&t.unsubscribe()}var Vs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function Ys(t){return e=>new re(r=>{const n=new Tt(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Vs(this,void 0,void 0,function*(){(yield t(s))&&o(s)}))}});return()=>$e(i)})}function Bs(t){return t&&it("asyncIterator")&&t[Symbol.asyncIterator]}function Zs(t){return t&&it("iterator")&&t[Symbol.iterator]}var Gs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},Qs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}};function Ks(t){return e=>new re(r=>{const n=new Tt(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Gs(this,void 0,void 0,function*(){var a,c;const u=yield t(s);if(Zs(u)||Bs(u))try{for(var l=Qs(u),h;h=yield l.next(),!h.done;){const m=h.value;o(m)}}catch(m){a={error:m}}finally{try{h&&!h.done&&(c=l.return)&&(yield c.call(l))}finally{if(a)throw a.error}}else u.map(m=>o(m))}))}});return()=>$e(i)})}function Xs(t){return new re(e=>{let r=0;const n=setInterval(()=>{e.next(r++)},t);return()=>clearInterval(n)})}var Js=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function eo(t){return e=>new re(r=>{const n=new Tt(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Js(this,void 0,void 0,function*(){const a=yield t(s);o(a)}))}});return()=>$e(i)})}function to(...t){return t.length===0?re.from([]):new re(e=>{let r=0;const n=t.map(s=>s.subscribe({error(o){e.error(o),i()},next(o){e.next(o)},complete(){++r===t.length&&(e.complete(),i())}})),i=()=>{n.forEach(s=>$e(s))};return i})}class ni extends re{constructor(){super(e=>(this._observers.add(e),()=>this._observers.delete(e))),this._observers=new Set}next(e){for(const r of this._observers)r.next(e)}error(e){for(const r of this._observers)r.error(e)}complete(){for(const e of this._observers)e.complete()}}function ro(t){const e=new ni;let r,n=0;return new re(i=>{r||(r=t.subscribe(e));const s=e.subscribe(i);return n++,()=>{n--,s.unsubscribe(),n===0&&($e(r),r=void 0)}})}var no=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function io(t,e){return r=>new re(n=>{let i,s=0;const o=new Tt(n),a=r.subscribe({complete(){o.complete()},error(c){o.error(c)},next(c){o.schedule(u=>no(this,void 0,void 0,function*(){i=yield t(s===0?typeof e>"u"?c:e:i,c,s++),u(i)}))}});return()=>$e(a)})}const so=Object.freeze(Object.defineProperty({__proto__:null,Observable:re,Subject:ni,filter:Ys,flatMap:Ks,interval:Xs,map:eo,merge:to,multicast:ro,scan:io,unsubscribe:$e},Symbol.toStringTag,{value:"Module"})),Mt=Oi(so);var Ve={},Jr;function oo(){if(Jr)return Ve;Jr=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.allSettled=void 0;function t(e){return Promise.all(e.map(r=>{const n=o=>({status:"fulfilled",value:o}),i=o=>({status:"rejected",reason:o}),s=Promise.resolve(r);try{return s.then(n,i)}catch(o){return Promise.reject(o)}}))}return Ve.allSettled=t,Ve}var Lt={},en;function ao(){return en||(en=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.PoolEventType=void 0,function(e){e.initialized="initialized",e.taskCanceled="taskCanceled",e.taskCompleted="taskCompleted",e.taskFailed="taskFailed",e.taskQueued="taskQueued",e.taskQueueDrained="taskQueueDrained",e.taskStart="taskStart",e.terminated="terminated"}(t.PoolEventType||(t.PoolEventType={}))}(Lt)),Lt}var Ye={},oe={},tn;function Sr(){return tn||(tn=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.$worker=oe.$transferable=oe.$terminate=oe.$events=oe.$errors=void 0,oe.$errors=Symbol("thread.errors"),oe.$events=Symbol("thread.events"),oe.$terminate=Symbol("thread.terminate"),oe.$transferable=Symbol("thread.transferable"),oe.$worker=Symbol("thread.worker")),oe}var rn;function ii(){if(rn)return Ye;rn=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.Thread=void 0;const t=Sr();function e(r){throw Error(r)}return Ye.Thread={errors(r){return r[t.$errors]||e("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},events(r){return r[t.$events]||e("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},terminate(r){return r[t.$terminate]()}},Ye}var nn;function uo(){return nn||(nn=1,function(t){var e=Ce&&Ce.__awaiter||function(_,C,P,R){function g(b){return b instanceof P?b:new P(function(D){D(b)})}return new(P||(P=Promise))(function(b,D){function H(k){try{$(R.next(k))}catch(U){D(U)}}function y(k){try{$(R.throw(k))}catch(U){D(U)}}function $(k){k.done?b(k.value):g(k.value).then(H,y)}$((R=R.apply(_,C||[])).next())})},r=Ce&&Ce.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(t,"__esModule",{value:!0}),t.Pool=t.Thread=t.PoolEventType=void 0;const n=r(gr()),i=Mt,s=oo(),o=Xn(),a=ao();Object.defineProperty(t,"PoolEventType",{enumerable:!0,get:function(){return a.PoolEventType}});const c=ii();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return c.Thread}});let u=1;function l(_){const C=[];for(let P=0;P<_;P++)C.push(P);return C}function h(_){return new Promise(C=>setTimeout(C,_))}function m(_,C){return _.reduce((P,R)=>[...P,...C(R)],[])}function w(_){return _.replace(/\W/g," ").trim().replace(/\s+/g,"-")}function F(_,C){return l(C).map(()=>({init:_(),runningTasks:[]}))}class A{constructor(C,P){this.eventSubject=new i.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];const R=typeof P=="number"?{size:P}:P||{},{size:g=o.defaultPoolSize}=R;this.debug=n.default(`threads:pool:${w(R.name||String(u++))}`),this.options=R,this.workers=F(C,g),this.eventObservable=i.multicast(i.Observable.from(this.eventSubject)),Promise.all(this.workers.map(b=>b.init)).then(()=>this.eventSubject.next({type:a.PoolEventType.initialized,size:this.workers.length}),b=>{this.debug("Error while initializing pool worker:",b),this.eventSubject.error(b),this.initErrors.push(b)})}findIdlingWorker(){const{concurrency:C=1}=this.options;return this.workers.find(P=>P.runningTasks.length<C)}runPoolTask(C,P){return e(this,void 0,void 0,function*(){const R=this.workers.indexOf(C)+1;this.debug(`Running task #${P.id} on worker #${R}...`),this.eventSubject.next({type:a.PoolEventType.taskStart,taskID:P.id,workerID:R});try{const g=yield P.run(yield C.init);this.debug(`Task #${P.id} completed successfully`),this.eventSubject.next({type:a.PoolEventType.taskCompleted,returnValue:g,taskID:P.id,workerID:R})}catch(g){this.debug(`Task #${P.id} failed`),this.eventSubject.next({type:a.PoolEventType.taskFailed,taskID:P.id,error:g,workerID:R})}})}run(C,P){return e(this,void 0,void 0,function*(){const R=e(this,void 0,void 0,function*(){const g=()=>{C.runningTasks=C.runningTasks.filter(b=>b!==R)};yield h(0);try{yield this.runPoolTask(C,P)}finally{g(),this.isClosing||this.scheduleWork()}});C.runningTasks.push(R)})}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const C=this.findIdlingWorker();if(!C)return;const P=this.taskQueue.shift();if(!P){this.debug("Task queue is empty"),this.eventSubject.next({type:a.PoolEventType.taskQueueDrained});return}this.run(C,P)}taskCompletion(C){return new Promise((P,R)=>{const g=this.events().subscribe(b=>{b.type===a.PoolEventType.taskCompleted&&b.taskID===C?(g.unsubscribe(),P(b.returnValue)):b.type===a.PoolEventType.taskFailed&&b.taskID===C?(g.unsubscribe(),R(b.error)):b.type===a.PoolEventType.terminated&&(g.unsubscribe(),R(Error("Pool has been terminated before task was run.")))})})}settled(C=!1){return e(this,void 0,void 0,function*(){const P=()=>m(this.workers,b=>b.runningTasks),R=[],g=this.eventObservable.subscribe(b=>{b.type===a.PoolEventType.taskFailed&&R.push(b.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):C&&this.taskQueue.length===0?(yield s.allSettled(P()),R):(yield new Promise((b,D)=>{const H=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained&&(H.unsubscribe(),b(void 0))},error:D})}),yield s.allSettled(P()),g.unsubscribe(),R)})}completed(C=!1){return e(this,void 0,void 0,function*(){const P=this.settled(C),R=new Promise((b,D)=>{const H=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained?(H.unsubscribe(),b(P)):y.type===a.PoolEventType.taskFailed&&(H.unsubscribe(),D(y.error))},error:D})}),g=yield Promise.race([P,R]);if(g.length>0)throw g[0]})}events(){return this.eventObservable}queue(C){const{maxQueuedJobs:P=1/0}=this.options;if(this.isClosing)throw Error("Cannot schedule pool tasks after terminate() has been called.");if(this.initErrors.length>0)throw this.initErrors[0];const R=this.nextTaskID++,g=this.taskCompletion(R);g.catch(D=>{this.debug(`Task #${R} errored:`,D)});const b={id:R,run:C,cancel:()=>{this.taskQueue.indexOf(b)!==-1&&(this.taskQueue=this.taskQueue.filter(D=>D!==b),this.eventSubject.next({type:a.PoolEventType.taskCanceled,taskID:b.id}))},then:g.then.bind(g)};if(this.taskQueue.length>=P)throw Error(`Maximum number of pool tasks queued. Refusing to queue another one.
|
|
32
32
|
This usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.`);return this.debug(`Queueing task #${b.id}...`),this.taskQueue.push(b),this.eventSubject.next({type:a.PoolEventType.taskQueued,taskID:b.id}),this.scheduleWork(),b}terminate(C){return e(this,void 0,void 0,function*(){this.isClosing=!0,C||(yield this.completed(!0)),this.eventSubject.next({type:a.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(P=>e(this,void 0,void 0,function*(){return c.Thread.terminate(yield P.init)})))})}}A.EventType=a.PoolEventType;function L(_,C){return new A(_,C)}L.EventType=a.PoolEventType,t.Pool=L}(Ce)),Ce}var pe={},Be={},sn;function co(){if(sn)return Be;sn=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.createPromiseWithResolver=void 0;const t=()=>{};function e(){let r=!1,n,i=t;return[new Promise(a=>{r?a(n):i=a}),a=>{r=!0,n=a,i(n)}]}return Be.createPromiseWithResolver=e,Be}var Wt={},on;function lo(){return on||(on=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerEventType=void 0,function(e){e.internalError="internalError",e.message="message",e.termination="termination"}(t.WorkerEventType||(t.WorkerEventType={}))}(Wt)),Wt}var ve={},Ze={},an;function ho(){if(an)return Ze;an=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.ObservablePromise=void 0;const t=Mt,e=()=>{},r=a=>a,n=a=>Promise.resolve().then(a);function i(a){throw a}function s(a){return a&&typeof a.then=="function"}class o extends t.Observable{constructor(c){super(u=>{const l=this,h=Object.assign(Object.assign({},u),{complete(){u.complete(),l.onCompletion()},error(m){u.error(m),l.onError(m)},next(m){u.next(m),l.onNext(m)}});try{return this.initHasRun=!0,c(h)}catch(m){h.error(m)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(c){this.firstValueSet||(this.firstValue=c,this.firstValueSet=!0)}onError(c){this.state="rejected",this.rejection=c;for(const u of this.rejectionCallbacks)n(()=>u(c))}onCompletion(){this.state="fulfilled";for(const c of this.fulfillmentCallbacks)n(()=>c(this.firstValue))}then(c,u){const l=c||r,h=u||i;let m=!1;return new Promise((w,F)=>{const A=_=>{if(!m){m=!0;try{w(h(_))}catch(C){F(C)}}},L=_=>{try{w(l(_))}catch(C){A(C)}};if(this.initHasRun||this.subscribe({error:A}),this.state==="fulfilled")return w(l(this.firstValue));if(this.state==="rejected")return m=!0,w(h(this.rejection));this.fulfillmentCallbacks.push(L),this.rejectionCallbacks.push(A)})}catch(c){return this.then(void 0,c)}finally(c){const u=c||e;return this.then(l=>(u(),l),()=>u())}static from(c){return s(c)?new o(u=>{const l=m=>{u.next(m),u.complete()},h=m=>{u.error(m)};c.then(l,h)}):super.from(c)}}return Ze.ObservablePromise=o,Ze}var Ee={},un;function gt(){if(un)return Ee;un=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.Transfer=Ee.isTransferDescriptor=void 0;const t=Sr();function e(i){return!(!i||typeof i!="object")}function r(i){return i&&typeof i=="object"&&i[t.$transferable]}Ee.isTransferDescriptor=r;function n(i,s){if(!s){if(!e(i))throw Error();s=[i]}return{[t.$transferable]:!0,send:i,transferables:s}}return Ee.Transfer=n,Ee}var Nt={},cn;function si(){return cn||(cn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerMessageType=t.MasterMessageType=void 0,function(e){e.cancel="cancel",e.run="run"}(t.MasterMessageType||(t.MasterMessageType={})),function(e){e.error="error",e.init="init",e.result="result",e.running="running",e.uncaughtError="uncaughtError"}(t.WorkerMessageType||(t.WorkerMessageType={}))}(Nt)),Nt}var ln;function fo(){if(ln)return ve;ln=1;var t=ve&&ve.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(ve,"__esModule",{value:!0}),ve.createProxyModule=ve.createProxyFunction=void 0;const e=t(gr()),r=Mt,n=Ke(),i=ho(),s=gt(),o=si(),a=e.default("threads:master:messages");let c=1;const u=_=>Array.from(new Set(_)),l=_=>_&&_.type===o.WorkerMessageType.error,h=_=>_&&_.type===o.WorkerMessageType.result,m=_=>_&&_.type===o.WorkerMessageType.running;function w(_,C){return new r.Observable(P=>{let R;const g=b=>{if(a("Message from worker:",b.data),!(!b.data||b.data.uid!==C)){if(m(b.data))R=b.data.resultType;else if(h(b.data))R==="promise"?(typeof b.data.payload<"u"&&P.next(n.deserialize(b.data.payload)),P.complete(),_.removeEventListener("message",g)):(b.data.payload&&P.next(n.deserialize(b.data.payload)),b.data.complete&&(P.complete(),_.removeEventListener("message",g)));else if(l(b.data)){const D=n.deserialize(b.data.error);P.error(D),_.removeEventListener("message",g)}}};return _.addEventListener("message",g),()=>{if(R==="observable"||!R){const b={type:o.MasterMessageType.cancel,uid:C};_.postMessage(b)}_.removeEventListener("message",g)}})}function F(_){if(_.length===0)return{args:[],transferables:[]};const C=[],P=[];for(const R of _)s.isTransferDescriptor(R)?(C.push(n.serialize(R.send)),P.push(...R.transferables)):C.push(n.serialize(R));return{args:C,transferables:P.length===0?P:u(P)}}function A(_,C){return(...P)=>{const R=c++,{args:g,transferables:b}=F(P),D={type:o.MasterMessageType.run,uid:R,method:C,args:g};a("Sending command to run function to worker:",D);try{_.postMessage(D,b)}catch(H){return i.ObservablePromise.from(Promise.reject(H))}return i.ObservablePromise.from(r.multicast(w(_,R)))}}ve.createProxyFunction=A;function L(_,C){const P={};for(const R of C)P[R]=A(_,R);return P}return ve.createProxyModule=L,ve}var hn;function po(){if(hn)return pe;hn=1;var t=pe&&pe.__awaiter||function(g,b,D,H){function y($){return $ instanceof D?$:new D(function(k){k($)})}return new(D||(D=Promise))(function($,k){function U(Q){try{B(H.next(Q))}catch(he){k(he)}}function ne(Q){try{B(H.throw(Q))}catch(he){k(he)}}function B(Q){Q.done?$(Q.value):y(Q.value).then(U,ne)}B((H=H.apply(g,b||[])).next())})},e=pe&&pe.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(pe,"__esModule",{value:!0}),pe.spawn=void 0;const r=e(gr()),n=Mt,i=Ke(),s=co(),o=Sr(),a=lo(),c=fo(),u=r.default("threads:master:messages"),l=r.default("threads:master:spawn"),h=r.default("threads:master:thread-utils"),m=g=>g&&g.type==="init",w=g=>g&&g.type==="uncaughtError",F=typeof process<"u"&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function A(g,b,D){return t(this,void 0,void 0,function*(){let H;const y=new Promise((k,U)=>{H=setTimeout(()=>U(Error(D)),b)}),$=yield Promise.race([g,y]);return clearTimeout(H),$})}function L(g){return new Promise((b,D)=>{const H=y=>{u("Message from worker before finishing initialization:",y.data),m(y.data)?(g.removeEventListener("message",H),b(y.data)):w(y.data)&&(g.removeEventListener("message",H),D(i.deserialize(y.data.error)))};g.addEventListener("message",H)})}function _(g,b){return new n.Observable(D=>{const H=$=>{const k={type:a.WorkerEventType.message,data:$.data};D.next(k)},y=$=>{h("Unhandled promise rejection event in thread:",$);const k={type:a.WorkerEventType.internalError,error:Error($.reason)};D.next(k)};g.addEventListener("message",H),g.addEventListener("unhandledrejection",y),b.then(()=>{const $={type:a.WorkerEventType.termination};g.removeEventListener("message",H),g.removeEventListener("unhandledrejection",y),D.next($),D.complete()})})}function C(g){const[b,D]=s.createPromiseWithResolver();return{terminate:()=>t(this,void 0,void 0,function*(){h("Terminating worker"),yield g.terminate(),D()}),termination:b}}function P(g,b,D,H){const y=D.filter($=>$.type===a.WorkerEventType.internalError).map($=>$.error);return Object.assign(g,{[o.$errors]:y,[o.$events]:D,[o.$terminate]:H,[o.$worker]:b})}function R(g,b){return t(this,void 0,void 0,function*(){l("Initializing new thread");const D=b&&b.timeout?b.timeout:F,y=(yield A(L(g),D,`Timeout: Did not receive an init message from worker after ${D}ms. Make sure the worker calls expose().`)).exposed,{termination:$,terminate:k}=C(g),U=_(g,$);if(y.type==="function"){const ne=c.createProxyFunction(g);return P(ne,g,U,k)}else if(y.type==="module"){const ne=c.createProxyModule(g,y.methods);return P(ne,g,U,k)}else{const ne=y.type;throw Error(`Worker init message states unexpected type of expose(): ${ne}`)}})}return pe.spawn=R,pe}var fn;function vo(){return fn||(fn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Worker=t.BlobWorker=t.isWorkerRuntime=t.Thread=t.spawn=t.Pool=void 0;const e=Xn();Object.defineProperty(t,"isWorkerRuntime",{enumerable:!0,get:function(){return e.isWorkerRuntime}});var r=uo();Object.defineProperty(t,"Pool",{enumerable:!0,get:function(){return r.Pool}});var n=po();Object.defineProperty(t,"spawn",{enumerable:!0,get:function(){return n.spawn}});var i=ii();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return i.Thread}}),t.BlobWorker=e.getWorkerImplementation().blob,t.Worker=e.getWorkerImplementation().default}(kt)),kt}var Oe={},Ht,dn;function mo(){return dn||(dn=1,Ht=t=>t?typeof Symbol.observable=="symbol"&&typeof t[Symbol.observable]=="function"?t===t[Symbol.observable]():typeof t["@@observable"]=="function"?t===t["@@observable"]():!1:!1),Ht}var lt={},pn;function yo(){if(pn)return lt;pn=1,Object.defineProperty(lt,"__esModule",{value:!0});const t=function(){const i=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!i)},e=function(i,s){self.postMessage(i,s)},r=function(i){const s=a=>{i(a.data)},o=()=>{self.removeEventListener("message",s)};return self.addEventListener("message",s),o};return lt.default={isWorkerRuntime:t,postMessageToMaster:e,subscribeToMasterMessages:r},lt}var vn;function oi(){return vn||(vn=1,function(t){var e=Oe&&Oe.__awaiter||function(y,$,k,U){function ne(B){return B instanceof k?B:new k(function(Q){Q(B)})}return new(k||(k=Promise))(function(B,Q){function he(ue){try{xe(U.next(ue))}catch(De){Q(De)}}function st(ue){try{xe(U.throw(ue))}catch(De){Q(De)}}function xe(ue){ue.done?B(ue.value):ne(ue.value).then(he,st)}xe((U=U.apply(y,$||[])).next())})},r=Oe&&Oe.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(t,"__esModule",{value:!0}),t.expose=t.isWorkerRuntime=t.Transfer=t.registerSerializer=void 0;const n=r(mo()),i=Ke(),s=gt(),o=si(),a=r(yo());var c=Ke();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return c.registerSerializer}});var u=gt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return u.Transfer}}),t.isWorkerRuntime=a.default.isWorkerRuntime;let l=!1;const h=new Map,m=y=>y&&y.type===o.MasterMessageType.cancel,w=y=>y&&y.type===o.MasterMessageType.run,F=y=>n.default(y)||A(y);function A(y){return y&&typeof y=="object"&&typeof y.subscribe=="function"}function L(y){return s.isTransferDescriptor(y)?{payload:y.send,transferables:y.transferables}:{payload:y,transferables:void 0}}function _(){const y={type:o.WorkerMessageType.init,exposed:{type:"function"}};a.default.postMessageToMaster(y)}function C(y){const $={type:o.WorkerMessageType.init,exposed:{type:"module",methods:y}};a.default.postMessageToMaster($)}function P(y,$){const{payload:k,transferables:U}=L($),ne={type:o.WorkerMessageType.error,uid:y,error:i.serialize(k)};a.default.postMessageToMaster(ne,U)}function R(y,$,k){const{payload:U,transferables:ne}=L(k),B={type:o.WorkerMessageType.result,uid:y,complete:$?!0:void 0,payload:U};a.default.postMessageToMaster(B,ne)}function g(y,$){const k={type:o.WorkerMessageType.running,uid:y,resultType:$};a.default.postMessageToMaster(k)}function b(y){try{const $={type:o.WorkerMessageType.uncaughtError,error:i.serialize(y)};a.default.postMessageToMaster($)}catch($){console.error(`Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.
|
|
33
33
|
Latest error:`,$,`
|
|
34
|
-
Original error:`,y)}}function D(y,$,k){return e(this,void 0,void 0,function*(){let U;try{U=$(...k)}catch(B){return P(y,B)}const ne=F(U)?"observable":"promise";if(g(y,ne),F(U)){const B=U.subscribe(Q=>R(y,!1,i.serialize(Q)),Q=>{P(y,i.serialize(Q)),h.delete(y)},()=>{R(y,!0),h.delete(y)});h.set(y,B)}else try{const B=yield U;R(y,!0,i.serialize(B))}catch(B){P(y,i.serialize(B))}})}function H(y){if(!a.default.isWorkerRuntime())throw Error("expose() called in the master thread.");if(l)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(l=!0,typeof y=="function")a.default.subscribeToMasterMessages($=>{w($)&&!$.method&&D($.uid,y,$.args.map(i.deserialize))}),_();else if(typeof y=="object"&&y){a.default.subscribeToMasterMessages(k=>{w(k)&&k.method&&D(k.uid,y[k.method],k.args.map(i.deserialize))});const $=Object.keys(y).filter(k=>typeof y[k]=="function");C($)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${y}`);a.default.subscribeToMasterMessages($=>{if(m($)){const k=$.uid,U=h.get(k);U&&(U.unsubscribe(),h.delete(k))}})}t.expose=H,typeof self<"u"&&typeof self.addEventListener=="function"&&a.default.isWorkerRuntime()&&(self.addEventListener("error",y=>{setTimeout(()=>b(y.error||y),250)}),self.addEventListener("unhandledrejection",y=>{const $=y.reason;$&&typeof $.message=="string"&&setTimeout(()=>b($),250)})),typeof process<"u"&&typeof process.on=="function"&&a.default.isWorkerRuntime()&&(process.on("uncaughtException",y=>{setTimeout(()=>b(y),250)}),process.on("unhandledRejection",y=>{y&&typeof y.message=="string"&&setTimeout(()=>b(y),250)}))}(Oe)),Oe}var mn;function _o(){return mn||(mn=1,function(t){var e=ge&&ge.__createBinding||(Object.create?function(a,c,u,l){l===void 0&&(l=u),Object.defineProperty(a,l,{enumerable:!0,get:function(){return c[u]}})}:function(a,c,u,l){l===void 0&&(l=u),a[l]=c[u]}),r=ge&&ge.__exportStar||function(a,c){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(c,u)&&e(c,a,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.Transfer=t.DefaultSerializer=t.expose=t.registerSerializer=void 0;var n=Ke();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return n.registerSerializer}}),r(vo(),t);var i=oi();Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return i.expose}});var s=Kn();Object.defineProperty(t,"DefaultSerializer",{enumerable:!0,get:function(){return s.DefaultSerializer}});var o=gt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return o.Transfer}})}(ge)),ge}var bo=_o();const we=Rn(bo);we.registerSerializer;const wo=we.spawn;we.BlobWorker;we.DefaultSerializer;we.Pool;const go=we.Thread;we.Transfer;const Po=we.Worker;var So=Object.defineProperty,Co=(t,e,r)=>e in t?So(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,se=(t,e,r)=>Co(t,typeof e!="symbol"?e+"":e,r);class Eo extends O.EventDispatcher{constructor(){super(),se(this,"style",{}),se(this,"width",0),se(this,"height",0),se(this,"left",0),se(this,"top",0),this.getRootNode=this.getRootNode.bind(this),this.handleEvent=this.handleEvent.bind(this)}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getRootNode(){return this}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height}}handleEvent(e){if(e.type==="resize"){this.left=e.left??0,this.top=e.top??0,this.width=e.width??0,this.height=e.height??0;return}e.preventDefault=()=>{},e.stopPropagation=()=>{},this.dispatchEvent(e)}focus(){}}const Oo=()=>{try{if(window){if(navigator!=null&&navigator.hardwareConcurrency)return navigator.hardwareConcurrency;throw new Error("Unable to determine the number of cores")}else return require("os").cpus().length}catch(t){return console.error("🛑 Unable to detect available cores",t),2}},To=()=>Oo()-1,Mo="TERMINATE_THREAD_FROM_WORKER";let Ro=-1;class jo{constructor(e){se(this,"_handleTerminate"),se(this,"_handleError"),se(this,"_task"),se(this,"id",Ro+=1),se(this,"idle",!0),se(this,"worker"),se(this,"thread"),this._handleTerminate=e==null?void 0:e.onTerminate,this._handleError=e==null?void 0:e.onError}_handleMessages(e){var r;e instanceof MessageEvent&&((r=e.data)==null?void 0:r.token)===Mo&&this.terminate()}async run(e){var r;try{const{payload:n,options:i}=e;return this.idle=!1,this.worker=new Po(n.path,{type:"module",...i==null?void 0:i.worker}),this.thread=await wo(this.worker,{timeout:1e4,...i==null?void 0:i.spawn}),this._task=e,this.worker.postMessage(n.subject,n.transferSubject),this.worker.addEventListener("message",this._handleMessages.bind(this)),{worker:this.worker,thread:this.thread}}catch(n){(r=this._handleError)==null||r.call(this,n);return}}get task(){return this._task}async terminate(){var e,r,n;(e=this.worker)==null||e.removeEventListener("message",this._handleMessages.bind(this)),this.thread&&await go.terminate(this.thread),await((r=this.worker)==null?void 0:r.terminate()),this.worker=void 0,this.thread=void 0,this._task=void 0,this.idle=!0,(n=this._handleTerminate)==null||n.call(this)}}class $o{constructor(e,r,n){se(this,"_workerThreads",[]),se(this,"_tasksQueue",[]),this.maxWorkersCount=e,this.debugMode=r,this.onWorkerThreadRun=n;for(let i=0;i<this.maxWorkersCount;i++)this._workerThreads.push(this._createWorkerThread())}_handleWorkerThreadTerminate(e){this.debugMode&&console.log(`WorkerThread #${e.id} freed`),this.runNext()}_handleWorkerThreadError(e,r){console.error(`Error from worker #${r.id}:`,e),this.runNext()}_createWorkerThread(){const e=new jo({onTerminate:()=>this._handleWorkerThreadTerminate(e),onError:r=>this._handleWorkerThreadError(r,e)});return e}get workerThreads(){return this._workerThreads}get tasksQueue(){return this._tasksQueue}get nextAvailableWorkerThread(){return this._workerThreads.find(e=>e.idle)}getAvailableWorkerThreads(e=!1){return this._workerThreads.filter(r=>e?!r.idle:r.idle)}async runNext(){if(!this.nextAvailableWorkerThread||this._tasksQueue.length===0)return;const e=this._tasksQueue.shift();e&&await this.run(e)}async run(e,r=!1){var n;if(r){const o=this._createWorkerThread();return this.debugMode&&console.log(`Running On Untracked Thread #${o==null?void 0:o.id}. Task:`,e),[await o.run(e),!1]}const i=this.nextAvailableWorkerThread;if(!i)return this._tasksQueue.push(e),this.debugMode&&console.log("Queued Thread Task:",e),[void 0,!0];this.debugMode&&console.log(`Running On Thread #${i==null?void 0:i.id}. Task:`,e);const s=await i.run(e);return(n=this.onWorkerThreadRun)==null||n.call(this,i),[s,!1]}async terminateAll(){this._tasksQueue=[],await Promise.all(this._workerThreads.map(e=>e.terminate()))}}const xo=(t,e)=>new $o(To(),!!e),Do=t=>t===void 0,Ao=t=>typeof t=="boolean",ko=t=>!!t&&typeof t=="function",Io=t=>{var e,r;const n=t.toJSON();return JSON.stringify({...n,object:{...n.object,position:["x","y","z"].map(i=>t.position[i]),rotation:["x","y","z","order"].map(i=>t.rotation[i]),children:((r=(e=n==null?void 0:n.object)==null?void 0:e.children)==null?void 0:r.map((i,s)=>({...typeof i=="object"?i:typeof i=="string"?JSON.parse(i):{},position:["x","y","z"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.position[o]}),rotation:["x","y","z","order"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.rotation[o]})})))??[]},isSerialized:!0})},yn=(t,e=new O.ObjectLoader)=>{const r=JSON.parse(t);if(r!=null&&r.metadata&&r.object&&r.isSerialized){const n=e.parse(r);return n.position.set(...r.object.position),n.rotation.set(...r.object.rotation),n.children.map((i,s)=>{i.position.set(...r.object.children[s].position)}),n.children.map((i,s)=>{i.rotation.set(...r.object.children[s].rotation)}),n}return r},ai=(t,e)=>{const r={type:t==null?void 0:t.type};for(const n of e)t[n]!==void 0&&(r[n]=t[n]);return r},rr=(t,e)=>{const r={type:t==null?void 0:t.type};for(const[n,i]of Object.entries(t))e.includes(n)||(r[n]=i);return r};var zo=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Lo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Fo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&zo(e,r,i),i};let Xe=class{constructor(){p(this,"_canvas");p(this,"proxyReceiver",new Eo);p(this,"initialized",!1)}get canvas(){return this._canvas}set canvas(t){t.style={width:t.width+"",height:t.height+""},this._canvas=t}};Xe=Lo([G()],Xe);var Wo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Ho=(t,e,r,n)=>{for(var i=n>1?void 0:n?No(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Wo(e,r,i),i},Uo=(t,e)=>(r,n)=>e(r,n,t);let Pt=class extends In{constructor(t){super(),this._service=t;for(const e of _r)this[`${e}$$`]=new rt,this[`${e}$`]=this[`${e}$$`].pipe(),this[e]=r=>{this._service.proxyReceiver.handleEvent({...r,type:r.type||e}),this[`${e}$$`].next(r)}}};Pt=Ho([G(),Uo(0,z(Xe))],Pt);var qo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,Yo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Vo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&qo(e,r,i),i};let St=class{constructor(){p(this,"frame",1e3/60);p(this,"initialTime",Date.now());p(this,"currentTime",0);p(this,"deltaTime",0);p(this,"deltaRatio",0);p(this,"elapsedTime",0);p(this,"enabled",!1)}step(){const t=Date.now();this.deltaTime=t-this.currentTime,this.currentTime=t,this.elapsedTime=t-this.initialTime,this.deltaRatio=this.deltaTime/this.frame}};St=Yo([G()],St);var Bo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,Go=(t,e,r,n)=>{for(var i=n>1?void 0:n?Zo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Bo(e,r,i),i},Qo=(t,e)=>(r,n)=>e(r,n,t);let Ne=class{constructor(t){p(this,"beforeStep$$",new rt);p(this,"_previousTime",0);p(this,"beforeStep$",this.beforeStep$$.asObservable());p(this,"step$",os().pipe(ks(({elapsed:t})=>{var e;this._previousTime!==t&&((e=this.beforeStep$$)==null||e.next(rr(this._service,[])),this._previousTime=t)}),ye(()=>this._service.enabled),As(()=>this._service.enabled),Le(()=>rr(this._service,[])),bt()));this._service=t}};Ne=Go([G(),Qo(0,z(St))],Ne);var Ko=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Jo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Xo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ko(e,r,i),i},_n=(t,e)=>(r,n)=>e(r,n,t);let nr=class{constructor(t,e){p(this,"_initialAnimationFrameId");p(this,"_subscriptions",[]);this._controller=t,this._service=e,this._subscriptions.push(this._controller.step$.subscribe(this._service.step.bind(this._service)))}init(t){this.enabled(t)}frame(){return this._service.frame}deltaTime(t){return typeof t=="number"&&(this._service.deltaTime=t),this._service.deltaTime}deltaRatio(t){return typeof t=="number"&&(this._service.deltaRatio=t),this._service.deltaRatio}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}dispose(){this._initialAnimationFrameId!==void 0&&cancelAnimationFrame(this._initialAnimationFrameId),this._service.enabled=!1}beforeStep$(){return this._controller.beforeStep$}step$(){return this._controller.step$}};nr=Jo([G(),_n(0,z(Ne)),_n(1,z(St))],nr);var ea=Object.defineProperty,ta=Object.getOwnPropertyDescriptor,ra=(t,e,r,n)=>{for(var i=n>1?void 0:n?ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ea(e,r,i),i};let be=class{constructor(){p(this,"width",0);p(this,"height",0);p(this,"aspect",0);p(this,"pixelRatio",0);p(this,"frustrum",5);p(this,"enabled",!0)}init(t,e){this.height=Number(t.height??this.height),this.width=Number(t.width??this.width),this.aspect=this.width/this.height,this.enabled=e===void 0?!0:!!e}};be=ra([G()],be);var na=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,sa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ia(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&na(e,r,i),i},oa=(t,e)=>(r,n)=>e(r,n,t);let Re=class{constructor(t){p(this,"instance");p(this,"enabled",!0);this._sizesService=t}set aspectRatio(t){var e;this.instance instanceof O.PerspectiveCamera&&(this.instance.aspect=t),(this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&((e=this.instance)==null||e.updateProjectionMatrix())}set quaternion(t){var e;(e=this.instance)==null||e.quaternion.copy(t)}set position(t){var e;(e=this.instance)==null||e.position.copy(t)}set rotation(t){var e;(e=this.instance)==null||e.rotation.copy(t)}init(t){if(this.dispose(),t===yt.PERSPECTIVE||t===void 0){this.instance=new O.PerspectiveCamera(70,this._sizesService.width/this._sizesService.height,1e-4,100),this.instance.position.z=8;return}t===yt.ORTHOGRAPHIC&&(this.instance=new O.OrthographicCamera(-this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.frustrum/2,-this._sizesService.frustrum/2,-50,50))}dispose(){this.instance instanceof O.Camera&&((this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&this.instance.clearViewOffset(),this.instance.clear(),this.instance=void 0)}};Re=sa([G(),oa(0,z(be))],Re);var aa=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,ca=(t,e,r,n)=>{for(var i=n>1?void 0:n?ua(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&aa(e,r,i),i},bn=(t,e)=>(r,n)=>e(r,n,t);let ir=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};ir=ca([G(),bn(0,z(Ne)),bn(1,z(Re))],ir);var la=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,fa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ha(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&la(e,r,i),i},Ut=(t,e)=>(r,n)=>e(r,n,t);let sr=class{constructor(t,e,r){p(this,"_subscriptions",[]);this._sizesService=t,this._controller=e,this._service=r}init(){this._service.init(),this._subscriptions.push(this._controller.step$.subscribe(()=>{var t;this._service.enabled&&(this._service.aspectRatio=this._sizesService.aspect,(this._service.instance instanceof O.PerspectiveCamera||this._service.instance instanceof O.OrthographicCamera)&&((t=this._service.instance)==null||t.updateProjectionMatrix()))}))}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}aspectRatio(t){return t&&(this._service.aspectRatio=t),this._service.aspectRatio}instance(t){return t&&(this._service.instance=t),this._service.instance}position(t){return t&&(this._service.position=t),this._service.position}quaternion(t){return t&&(this._service.quaternion=t),this._service.quaternion}dispose(){this._subscriptions.forEach(t=>t.unsubscribe()),this._service.dispose()}};sr=fa([G(),Ut(0,z(be)),Ut(1,z(ir)),Ut(2,z(Re))],sr);var da=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,va=(t,e,r,n)=>{for(var i=n>1?void 0:n?pa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&da(e,r,i),i};let Je=class{constructor(){p(this,"scene",new O.Scene);p(this,"enabled",!0)}};Je=va([G()],Je);var ui=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,ya=(t,e,r)=>e in t?ui(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ma(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ui(e,r,i),i},qt=(t,e)=>(r,n)=>e(r,n,t),ba=(t,e,r)=>ya(t,e+"",r);let je=class{constructor(t,e,r){p(this,"enabled",!0);p(this,"instance");this._worldService=t,this._cameraService=e,this._sizesService=r}setWebGLRenderer(t){this.instance=new O.WebGLRenderer({canvas:t,context:t.getContext("webgl2",{stencil:!0,powerPreference:"high-performance"}),powerPreference:"high-performance",depth:!0,antialias:!0}),this.instance.autoClear=!1,this.instance.setPixelRatio(je.RENDERER_PIXEL_RATIO),this.instance.setClearColor(0,0),this.instance.shadowMap.enabled=!0,this.instance.shadowMap.type=O.PCFSoftShadowMap,this.instance.outputColorSpace=O.SRGBColorSpace,this.instance.toneMapping=O.CineonToneMapping,this.instance.toneMappingExposure=1.75}setSize(t,e){var r;(r=this.instance)==null||r.setSize(t,e)}render(){this.enabled&&this._cameraService.instance instanceof O.Camera&&this.instance instanceof O.WebGLRenderer&&(this.instance.setViewport(0,0,this._sizesService.width,this._sizesService.height),this.instance.render(this._worldService.scene,this._cameraService.instance))}};ba(je,"RENDERER_PIXEL_RATIO",1);je=_a([G(),qt(0,z(Je)),qt(1,z(Re)),qt(2,z(be))],je);var wa=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,Pa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ga(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&wa(e,r,i),i},wn=(t,e)=>(r,n)=>e(r,n,t);let Ct=class{constructor(t,e){p(this,"resize$");this._appController=t,this._service=e,this.resize$=this._appController.resize$$.pipe(ye(()=>this._service.enabled))}};Ct=Pa([G(),wn(0,z(Pt)),wn(1,z(be))],Ct);var Sa=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,Ea=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ca(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Sa(e,r,i),i},Vt=(t,e)=>(r,n)=>e(r,n,t);let or=class{constructor(t,e,r){p(this,"step$");p(this,"resize$");this._service=t,this.timerController=e,this.sizesController=r,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled)),this.resize$=this.sizesController.resize$.pipe(ye(()=>this._service.enabled))}};or=Ea([G(),Vt(0,z(je)),Vt(1,z(Ne)),Vt(2,z(Ct))],or);var Oa=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,Ma=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Oa(e,r,i),i},gn=(t,e)=>(r,n)=>e(r,n,t);let ar=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.step$.subscribe(()=>this._service.render()),this._controller.resize$.subscribe(e=>this._service.setSize(e.windowWidth,e.windowHeight)),this._service.setWebGLRenderer(t)}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}instance(){return this._service.instance}setSize(t){return this._service.setSize(t.x,t.y)}render(){return this._service.render()}dispose(){var t;(t=this._service.instance)==null||t.dispose(),this._service.instance=void 0}};ar=Ma([G(),gn(0,z(or)),gn(1,z(je))],ar);var Ra=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,$a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ra(e,r,i),i},Pn=(t,e)=>(r,n)=>e(r,n,t);let ur=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.resize$.subscribe(e=>{this._service.width=e.windowWidth,this._service.height=e.windowHeight,this._service.aspect=e.windowWidth/e.windowHeight}),this._service.init(t)}dispose(){}aspect(t){return typeof t=="number"&&(this._service.aspect=t),this._service.aspect}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}frustrum(t){return typeof t=="number"&&(this._service.frustrum=t),this._service.frustrum}height(t){return typeof t=="number"&&(this._service.height=t),this._service.height}pixelRatio(t){return typeof t=="number"&&(this._service.pixelRatio=t),this._service.pixelRatio}width(t){return typeof t=="number"&&(this._service.width=t),this._service.width}resize$(){return this._controller.resize$}};ur=$a([G(),Pn(0,z(Ct)),Pn(1,z(be))],ur);var xa=Object.defineProperty,Da=Object.getOwnPropertyDescriptor,Aa=(t,e,r,n)=>{for(var i=n>1?void 0:n?Da(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&xa(e,r,i),i},ka=(t,e)=>(r,n)=>e(r,n,t);let cr=class{constructor(t){this._service=t}init(){}dispose(){}scene(t){return t instanceof O.Scene&&(this._service.scene=t),this._service.scene}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}};cr=Aa([G(),ka(0,z(Je))],cr);const Sn={type:"change"},Cr={type:"start"},ci={type:"end"},ht=new O.Ray,Cn=new O.Plane,Ia=Math.cos(70*O.MathUtils.DEG2RAD),J=new O.Vector3,ie=2*Math.PI,q={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Yt=1e-6;class En extends O.Controls{constructor(e,r=null){super(e,r),this.state=q.NONE,this.enabled=!0,this.target=new O.Vector3,this.cursor=new O.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:O.MOUSE.ROTATE,MIDDLE:O.MOUSE.DOLLY,RIGHT:O.MOUSE.PAN},this.touches={ONE:O.TOUCH.ROTATE,TWO:O.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new O.Vector3,this._lastQuaternion=new O.Quaternion,this._lastTargetPosition=new O.Vector3,this._quat=new O.Quaternion().setFromUnitVectors(e.up,new O.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new O.Spherical,this._sphericalDelta=new O.Spherical,this._scale=1,this._panOffset=new O.Vector3,this._rotateStart=new O.Vector2,this._rotateEnd=new O.Vector2,this._rotateDelta=new O.Vector2,this._panStart=new O.Vector2,this._panEnd=new O.Vector2,this._panDelta=new O.Vector2,this._dollyStart=new O.Vector2,this._dollyEnd=new O.Vector2,this._dollyDelta=new O.Vector2,this._dollyDirection=new O.Vector3,this._mouse=new O.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Fa.bind(this),this._onPointerDown=za.bind(this),this._onPointerUp=La.bind(this),this._onContextMenu=Ya.bind(this),this._onMouseWheel=Ha.bind(this),this._onKeyDown=Ua.bind(this),this._onTouchStart=qa.bind(this),this._onTouchMove=Va.bind(this),this._onMouseDown=Wa.bind(this),this._onMouseMove=Na.bind(this),this._interceptControlDown=Ba.bind(this),this._interceptControlUp=Za.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Sn),this.update(),this.state=q.NONE}update(e=null){const r=this.object.position;J.copy(r).sub(this.target),J.applyQuaternion(this._quat),this._spherical.setFromVector3(J),this.autoRotate&&this.state===q.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=ie:n>Math.PI&&(n-=ie),i<-Math.PI?i+=ie:i>Math.PI&&(i-=ie),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(J.setFromSpherical(this._spherical),J.applyQuaternion(this._quatInverse),r.copy(this.target).add(J),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=J.length();o=this._clampDistance(a*this._scale);const c=a-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const a=new O.Vector3(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const u=new O.Vector3(this._mouse.x,this._mouse.y,0);u.unproject(this.object),this.object.position.sub(u).add(a),this.object.updateMatrixWorld(),o=J.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(ht.origin.copy(this.object.position),ht.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ht.direction))<Ia?this.object.lookAt(this.target):(Cn.setFromNormalAndCoplanarPoint(this.object.up,this.target),ht.intersectPlane(Cn,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Yt||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Yt||this._lastTargetPosition.distanceToSquared(this.target)>Yt?(this.dispatchEvent(Sn),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ie/60*this.autoRotateSpeed*e:ie/60/60*this.autoRotateSpeed}_getZoomScale(e){const r=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*r)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,r){J.setFromMatrixColumn(r,0),J.multiplyScalar(-e),this._panOffset.add(J)}_panUp(e,r){this.screenSpacePanning===!0?J.setFromMatrixColumn(r,1):(J.setFromMatrixColumn(r,0),J.crossVectors(this.object.up,J)),J.multiplyScalar(e),this._panOffset.add(J)}_pan(e,r){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;J.copy(i).sub(this.target);let s=J.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*r*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,r){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,s=r-n.top,o=n.width,a=n.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let r=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),r=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),r=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),r=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),r=!0;break}r&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+r.x)*.5,a=(e.pageY+r.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId){this._pointers.splice(r,1);return}}_isTrackingPointer(e){for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId)return!0;return!1}_trackPointer(e){let r=this._pointerPositions[e.pointerId];r===void 0&&(r=new O.Vector2,this._pointerPositions[e.pointerId]=r),r.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const r=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[r]}_customWheelEvent(e){const r=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(r){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function za(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function Fa(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function La(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(ci),this.state=q.NONE;break;case 1:const e=this._pointers[0],r=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:r.x,pageY:r.y});break}}function Wa(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case O.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=q.DOLLY;break;case O.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}break;case O.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Cr)}function Na(t){switch(this.state){case q.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case q.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case q.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function Ha(t){this.enabled===!1||this.enableZoom===!1||this.state!==q.NONE||(t.preventDefault(),this.dispatchEvent(Cr),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(ci))}function Ua(t){this.enabled!==!1&&this._handleKeyDown(t)}function qa(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case O.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=q.TOUCH_ROTATE;break;case O.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=q.TOUCH_PAN;break;default:this.state=q.NONE}break;case 2:switch(this.touches.TWO){case O.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=q.TOUCH_DOLLY_PAN;break;case O.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=q.TOUCH_DOLLY_ROTATE;break;default:this.state=q.NONE}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Cr)}function Va(t){switch(this._trackPointer(t),this.state){case q.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case q.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case q.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case q.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=q.NONE}}function Ya(t){this.enabled!==!1&&t.preventDefault()}function Ba(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Za(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var Ga=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,Ka=(t,e,r,n)=>{for(var i=n>1?void 0:n?Qa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ga(e,r,i),i},Ge=(t,e)=>(r,n)=>e(r,n,t);let lr=class{constructor(t,e,r,n,i){p(this,"enabled",!1);p(this,"cameraControls");p(this,"miniCamera");p(this,"miniCameraControls");p(this,"cameraHelper");p(this,"axesHelper");p(this,"gridHelper");this._appService=t,this._sizesService=e,this._rendererService=r,this._cameraService=n,this._worldService=i}_renderMiniCamera(){var t,e,r,n,i;!this.enabled||!this.miniCamera||((t=this._rendererService.instance)==null||t.setScissorTest(!0),(e=this._rendererService.instance)==null||e.setViewport(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(r=this._rendererService.instance)==null||r.setScissor(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(n=this._rendererService.instance)==null||n.render(this._worldService.scene,this.miniCamera),(i=this._rendererService.instance)==null||i.setScissorTest(!1))}initMiniCamera(){this.disposeMiniCamera(),this.enabled&&(this.miniCamera=new O.PerspectiveCamera(75,this._sizesService.width/this._sizesService.height,.1,500),this.miniCamera.position.z=10,this.miniCamera.position.x=-5)}initOrbitControl(){var t;this.cameraControls&&((t=this.cameraControls)==null||t.dispose()),!(!this.enabled||!(this._cameraService.instance instanceof O.Camera))&&this._cameraService.instance instanceof O.Camera&&(this.cameraControls=new En(this._cameraService.instance,this._appService.proxyReceiver),this.cameraControls.rotateSpeed=.1,this.cameraControls.enableDamping=!0)}initMiniCameraOrbitControls(){this.miniCameraControls&&this.miniCameraControls.dispose(),!(!this.enabled||!this.miniCamera)&&(this.miniCameraControls=new En(this.miniCamera,this._appService.proxyReceiver),this.miniCameraControls.rotateSpeed=.15,this.miniCameraControls.enableDamping=!0)}initCameraHelper(){this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),!(!this.enabled||!this._cameraService.instance)&&(this.cameraHelper=new O.CameraHelper(this._cameraService.instance),this._worldService.scene.add(this.cameraHelper))}initAxesHelper(t){if(!this.enabled)return;const e=new O.AxesHelper(t);this._worldService.scene.add(e)}initGridHelper(t){if(this.gridHelper&&this._worldService.scene.remove(this.gridHelper),!this.enabled)return;const e=new O.GridHelper(t,t);this._worldService.scene.add(e)}disposeMiniCamera(){this.miniCamera instanceof O.Camera&&(this.miniCamera.clearViewOffset(),this.miniCamera.clear(),this.miniCamera=void 0)}update(){var t,e;(t=this.cameraControls)==null||t.update(),(e=this.miniCameraControls)==null||e.update(),this._renderMiniCamera()}dispose(){var t,e,r,n,i;this.disposeMiniCamera(),(t=this.cameraControls)==null||t.dispose(),this.cameraControls=void 0,(e=this.miniCameraControls)==null||e.dispose(),this.miniCameraControls=void 0,this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),(r=this.cameraHelper)==null||r.dispose(),this.cameraHelper=void 0,this.axesHelper&&this._worldService.scene.remove(this.axesHelper),(n=this.axesHelper)==null||n.dispose(),this.axesHelper=void 0,this.gridHelper&&this._worldService.scene.remove(this.gridHelper),(i=this.gridHelper)==null||i.dispose(),this.gridHelper=void 0}};lr=Ka([G(),Ge(0,z(Xe)),Ge(1,z(be)),Ge(2,z(je)),Ge(3,z(Re)),Ge(4,z(Je))],lr);var Xa=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,eu=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Xa(e,r,i),i},On=(t,e)=>(r,n)=>e(r,n,t);let hr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};hr=eu([G(),On(0,z(Ne)),On(1,z(Re))],hr);var tu=Object.defineProperty,ru=Object.getOwnPropertyDescriptor,nu=(t,e,r,n)=>{for(var i=n>1?void 0:n?ru(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&tu(e,r,i),i},Tn=(t,e)=>(r,n)=>e(r,n,t);let fr=class{constructor(t,e){p(this,"_subscriptions",[]);this._service=t,this._controller=e}init(t){this._service.enabled=!!t.enableDebug,this._service.enabled&&(t.withMiniCamera&&this._service.initMiniCamera(),t.enableControls&&(this._service.initOrbitControl(),this._service.initMiniCameraOrbitControls()),t.withCameraHelper&&this._service.initCameraHelper(),typeof(t==null?void 0:t.axesSizes)=="number"&&this._service.initAxesHelper(t.axesSizes),typeof(t==null?void 0:t.gridSizes)=="number"&&this._service.initGridHelper(t.gridSizes),this._subscriptions.push(this._controller.step$.subscribe(()=>{this._service.update()})))}enabled(t){return t&&(this._service.enabled=t),this._service.enabled}miniCamera(t){return t&&(this._service.miniCamera=t),this._service.miniCamera}getAxesHelper(){return this._service.axesHelper}getCameraControls(){return this._service.cameraControls}getCameraHelper(){return this._service.cameraHelper}getGridHelper(){return this._service.gridHelper}getMiniCameraControls(){return this._service.miniCameraControls}getStep$(){return this._controller.step$}dispose(){this._service.dispose(),this._subscriptions.forEach(t=>t.unsubscribe())}};fr=nu([G(),Tn(0,z(lr)),Tn(1,z(hr))],fr);var iu=Object.defineProperty,su=Object.getOwnPropertyDescriptor,ou=(t,e,r,n)=>{for(var i=n>1?void 0:n?su(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&iu(e,r,i),i};let Et=class{constructor(){p(this,"loadedResources",{});p(this,"toLoadCount",0);p(this,"loadedCount",0)}handleLoad(t){const{source:e,resource:r,loadedCount:n,toLoadCount:i}=t;r&&(this.loadedResources[e.name]=r,this.toLoadCount=n,this.loadedCount=i)}};Et=ou([Ot(te.ResolutionScoped)],Et);var au=Object.defineProperty,uu=Object.getOwnPropertyDescriptor,cu=(t,e,r,n)=>{for(var i=n>1?void 0:n?uu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&au(e,r,i),i},lu=(t,e)=>(r,n)=>e(r,n,t);let dr=class{constructor(t){p(this,"load$",_t(self,"message").pipe(ye(t=>{var e,r,n;return((e=t.data)==null?void 0:e.token)===Fn&&!!((n=(r=t.data)==null?void 0:r.payload)!=null&&n.resource)}),Le(t=>{var r,n,i,s;const{payload:e}=t.data||{};if(((r=e==null?void 0:e.source)==null?void 0:r.type)==="gltf"){const o=e.resource,a=(n=o.animations)==null?void 0:n.map(h=>O.AnimationClip.parse(h)),c=(i=o.cameras)==null?void 0:i.map(h=>yn(h)),u=(s=o.scenes)==null?void 0:s.map(h=>yn(h)),l=u==null?void 0:u[0];return{...e,resource:{...o,animations:a,cameras:c,scene:l,scenes:u}}}return e}),bt()));p(this,"loadCompleted$",this.load$.pipe(ye(t=>!!t&&t.toLoadCount===t.loadedCount),Le(()=>ai(this._service,["loadedCount","loadedResources","toLoadCount"])),bt()));this._service=t}};dr=cu([Ot(te.ResolutionScoped),lu(0,z(Et))],dr);var hu=Object.defineProperty,fu=Object.getOwnPropertyDescriptor,du=(t,e,r,n)=>{for(var i=n>1?void 0:n?fu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&hu(e,r,i),i},Mn=(t,e)=>(r,n)=>e(r,n,t);let pr=class{constructor(t,e){p(this,"_subscriptions",[]);this._controller=t,this._service=e}init(){this._subscriptions.push(this._controller.load$.subscribe(this._service.handleLoad.bind(this._service)))}getLoadedResources(){return this._service.loadedResources}getLoadedCount(){return this._service.loadedCount}getToLoadCount(){return this._service.toLoadCount}getLoad$(){return this._controller.load$}getLoadCompleted$(){return this._controller.loadCompleted$}dispose(){this._subscriptions.forEach(t=>t.unsubscribe())}};pr=du([G(),Mn(0,z(dr)),Mn(1,z(Et))],pr);var pu=Object.defineProperty,vu=Object.getOwnPropertyDescriptor,mu=(t,e,r,n)=>{for(var i=n>1?void 0:n?vu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&pu(e,r,i),i},me=(t,e)=>(r,n)=>e(r,n,t);exports.AppModule=class extends zn{constructor(e,r,n,i,s,o,a,c,u){super(),this._controller=e,this._service=r,this.timer=n,this.sizes=i,this.camera=s,this.world=o,this.renderer=a,this.loader=c,this.debug=u,this._initProxyEvents()}_initProxyEvents(){_r.forEach(e=>{this[`${e}$`]=()=>{var r;return(r=this._controller)==null?void 0:r[`${e}$`]},this[e]=r=>{var n,i;return(i=(n=this._controller)==null?void 0:n[e])==null?void 0:i.call(n,r)}})}init(e){this._service.initialized||!(e!=null&&e.canvas)||!(this._service.canvas=e.canvas)||(this._service.initialized=!0,this.sizes.init(this._service.canvas),this.camera.init(),this.world.init(),this.renderer.init(this._service.canvas),this.timer.init(e.startTimer),this.loader.init(),this.debug.init(e))}isInitialized(){return this._service.initialized}beforeStep$(){return this.timer.beforeStep$()}step$(){return this.timer.step$()}dispose(){this.sizes.dispose(),this.camera.dispose(),this.world.dispose(),this.renderer.dispose(),this.timer.dispose(),this.loader.dispose(),this.debug.dispose()}};exports.AppModule=mu([Ot(te.ContainerScoped),me(0,z(Pt)),me(1,z(Xe)),me(2,z(nr)),me(3,z(ur)),me(4,z(sr)),me(5,z(cr)),me(6,z(ar)),me(7,z(pr)),me(8,z(fr))],exports.AppModule);exports.A=Do;exports.AppProxyEventHandlersBlueprint=zn;exports.C=xo;exports.CONTAINER_TOKEN=Yi;exports.D=Ao;exports.DefaultCameraType=yt;exports.J=ai;exports.KEYBOARD_EVENT_CODES=qi;exports.LOADER_SERIALIZED_LOAD_TOKEN=Fn;exports.Lifecycle=te;exports.PROXY_EVENT_LISTENERS=_r;exports.ProxyEventHandlersBlueprint=In;exports.ProxyEventObservablesBlueprint=kn;exports.ProxyEventSubjectsBlueprint=An;exports.Q=ko;exports.RegisterProxyEventHandlersBlueprint=Vi;exports.Subject=rt;exports.U=rr;exports.W=Io;exports.filter=ye;exports.fromEvent=_t;exports.getDefaultExportFromCjs=Rn;exports.inject=z;exports.instance=yr;exports.map=Le;exports.requireWorker=oi;exports.scoped=Ot;exports.share=bt;exports.singleton=G;
|
|
34
|
+
Original error:`,y)}}function D(y,$,k){return e(this,void 0,void 0,function*(){let U;try{U=$(...k)}catch(B){return P(y,B)}const ne=F(U)?"observable":"promise";if(g(y,ne),F(U)){const B=U.subscribe(Q=>R(y,!1,i.serialize(Q)),Q=>{P(y,i.serialize(Q)),h.delete(y)},()=>{R(y,!0),h.delete(y)});h.set(y,B)}else try{const B=yield U;R(y,!0,i.serialize(B))}catch(B){P(y,i.serialize(B))}})}function H(y){if(!a.default.isWorkerRuntime())throw Error("expose() called in the master thread.");if(l)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(l=!0,typeof y=="function")a.default.subscribeToMasterMessages($=>{w($)&&!$.method&&D($.uid,y,$.args.map(i.deserialize))}),_();else if(typeof y=="object"&&y){a.default.subscribeToMasterMessages(k=>{w(k)&&k.method&&D(k.uid,y[k.method],k.args.map(i.deserialize))});const $=Object.keys(y).filter(k=>typeof y[k]=="function");C($)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${y}`);a.default.subscribeToMasterMessages($=>{if(m($)){const k=$.uid,U=h.get(k);U&&(U.unsubscribe(),h.delete(k))}})}t.expose=H,typeof self<"u"&&typeof self.addEventListener=="function"&&a.default.isWorkerRuntime()&&(self.addEventListener("error",y=>{setTimeout(()=>b(y.error||y),250)}),self.addEventListener("unhandledrejection",y=>{const $=y.reason;$&&typeof $.message=="string"&&setTimeout(()=>b($),250)})),typeof process<"u"&&typeof process.on=="function"&&a.default.isWorkerRuntime()&&(process.on("uncaughtException",y=>{setTimeout(()=>b(y),250)}),process.on("unhandledRejection",y=>{y&&typeof y.message=="string"&&setTimeout(()=>b(y),250)}))}(Oe)),Oe}var mn;function _o(){return mn||(mn=1,function(t){var e=ge&&ge.__createBinding||(Object.create?function(a,c,u,l){l===void 0&&(l=u),Object.defineProperty(a,l,{enumerable:!0,get:function(){return c[u]}})}:function(a,c,u,l){l===void 0&&(l=u),a[l]=c[u]}),r=ge&&ge.__exportStar||function(a,c){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(c,u)&&e(c,a,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.Transfer=t.DefaultSerializer=t.expose=t.registerSerializer=void 0;var n=Ke();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return n.registerSerializer}}),r(vo(),t);var i=oi();Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return i.expose}});var s=Kn();Object.defineProperty(t,"DefaultSerializer",{enumerable:!0,get:function(){return s.DefaultSerializer}});var o=gt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return o.Transfer}})}(ge)),ge}var bo=_o();const we=Rn(bo);we.registerSerializer;const wo=we.spawn;we.BlobWorker;we.DefaultSerializer;we.Pool;const go=we.Thread;we.Transfer;const Po=we.Worker;var So=Object.defineProperty,Co=(t,e,r)=>e in t?So(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,se=(t,e,r)=>Co(t,typeof e!="symbol"?e+"":e,r);class Eo extends O.EventDispatcher{constructor(){super(),se(this,"style",{}),se(this,"width",0),se(this,"height",0),se(this,"left",0),se(this,"top",0),this.getRootNode=this.getRootNode.bind(this),this.handleEvent=this.handleEvent.bind(this)}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getRootNode(){return this}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height}}handleEvent(e){if(e.type==="resize"){this.left=e.left??0,this.top=e.top??0,this.width=e.width??0,this.height=e.height??0;return}e.preventDefault=()=>{},e.stopPropagation=()=>{},this.dispatchEvent(e)}focus(){}}const Oo=()=>{try{if(window){if(navigator!=null&&navigator.hardwareConcurrency)return navigator.hardwareConcurrency;throw new Error("Unable to determine the number of cores")}else return require("os").cpus().length}catch(t){return console.error("🛑 Unable to detect available cores",t),2}},To=()=>Oo()-1,Mo="TERMINATE_THREAD_FROM_WORKER";let Ro=-1;class jo{constructor(e){se(this,"_handleTerminate"),se(this,"_handleError"),se(this,"_task"),se(this,"id",Ro+=1),se(this,"idle",!0),se(this,"worker"),se(this,"thread"),this._handleTerminate=e==null?void 0:e.onTerminate,this._handleError=e==null?void 0:e.onError}_handleMessages(e){var r;e instanceof MessageEvent&&((r=e.data)==null?void 0:r.token)===Mo&&this.terminate()}async run(e){var r;try{const{payload:n,options:i}=e;return this.idle=!1,this.worker=new Po(n.path,{type:"module",...i==null?void 0:i.worker}),this.thread=await wo(this.worker,{timeout:1e4,...i==null?void 0:i.spawn}),this._task=e,this.worker.postMessage(n.subject,n.transferSubject),this.worker.addEventListener("message",this._handleMessages.bind(this)),{worker:this.worker,thread:this.thread}}catch(n){(r=this._handleError)==null||r.call(this,n);return}}get task(){return this._task}async terminate(){var e,r,n;(e=this.worker)==null||e.removeEventListener("message",this._handleMessages.bind(this)),this.thread&&await go.terminate(this.thread),await((r=this.worker)==null?void 0:r.terminate()),this.worker=void 0,this.thread=void 0,this._task=void 0,this.idle=!0,(n=this._handleTerminate)==null||n.call(this)}}class $o{constructor(e,r,n){se(this,"_workerThreads",[]),se(this,"_tasksQueue",[]),this.maxWorkersCount=e,this.debugMode=r,this.onWorkerThreadRun=n;for(let i=0;i<this.maxWorkersCount;i++)this._workerThreads.push(this._createWorkerThread())}_handleWorkerThreadTerminate(e){this.debugMode&&console.log(`WorkerThread #${e.id} freed`),this.runNext()}_handleWorkerThreadError(e,r){console.error(`Error from worker #${r.id}:`,e),this.runNext()}_createWorkerThread(){const e=new jo({onTerminate:()=>this._handleWorkerThreadTerminate(e),onError:r=>this._handleWorkerThreadError(r,e)});return e}get workerThreads(){return this._workerThreads}get tasksQueue(){return this._tasksQueue}get nextAvailableWorkerThread(){return this._workerThreads.find(e=>e.idle)}getAvailableWorkerThreads(e=!1){return this._workerThreads.filter(r=>e?!r.idle:r.idle)}async runNext(){if(!this.nextAvailableWorkerThread||this._tasksQueue.length===0)return;const e=this._tasksQueue.shift();e&&await this.run(e)}async run(e,r=!1){var n;if(r){const o=this._createWorkerThread();return this.debugMode&&console.log(`Running On Untracked Thread #${o==null?void 0:o.id}. Task:`,e),[await o.run(e),!1]}const i=this.nextAvailableWorkerThread;if(!i)return this._tasksQueue.push(e),this.debugMode&&console.log("Queued Thread Task:",e),[void 0,!0];this.debugMode&&console.log(`Running On Thread #${i==null?void 0:i.id}. Task:`,e);const s=await i.run(e);return(n=this.onWorkerThreadRun)==null||n.call(this,i),[s,!1]}async terminateAll(){this._tasksQueue=[],await Promise.all(this._workerThreads.map(e=>e.terminate()))}}const xo=(t,e)=>new $o(To(),!!e),Do=t=>t===void 0,Ao=t=>typeof t=="boolean",ko=t=>!!t&&typeof t=="function",Io=t=>{var e,r;const n=t.toJSON();return JSON.stringify({...n,object:{...n.object,position:["x","y","z"].map(i=>t.position[i]),rotation:["x","y","z","order"].map(i=>t.rotation[i]),children:((r=(e=n==null?void 0:n.object)==null?void 0:e.children)==null?void 0:r.map((i,s)=>({...typeof i=="object"?i:typeof i=="string"?JSON.parse(i):{},position:["x","y","z"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.position[o]}),rotation:["x","y","z","order"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.rotation[o]})})))??[]},isSerialized:!0})},yn=(t,e=new O.ObjectLoader)=>{const r=JSON.parse(t);if(r!=null&&r.metadata&&r.object&&r.isSerialized){const n=e.parse(r);return n.position.set(...r.object.position),n.rotation.set(...r.object.rotation),n.children.map((i,s)=>{i.position.set(...r.object.children[s].position)}),n.children.map((i,s)=>{i.rotation.set(...r.object.children[s].rotation)}),n}return r},ai=(t,e)=>{const r={type:t==null?void 0:t.type};for(const n of e)t[n]!==void 0&&(r[n]=t[n]);return r},rr=(t,e)=>{const r={type:t==null?void 0:t.type};for(const[n,i]of Object.entries(t))e.includes(n)||(r[n]=i);return r};var zo=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Lo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Fo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&zo(e,r,i),i};let Xe=class{constructor(){p(this,"_canvas");p(this,"proxyReceiver",new Eo);p(this,"isInitialized",!1)}get canvas(){return this._canvas}set canvas(t){t.style={width:t.width+"",height:t.height+""},this._canvas=t}};Xe=Lo([G()],Xe);var Wo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Ho=(t,e,r,n)=>{for(var i=n>1?void 0:n?No(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Wo(e,r,i),i},Uo=(t,e)=>(r,n)=>e(r,n,t);let Pt=class extends In{constructor(t){super(),this._service=t;for(const e of _r)this[`${e}$$`]=new rt,this[`${e}$`]=this[`${e}$$`].pipe(),this[e]=r=>{this._service.proxyReceiver.handleEvent({...r,type:r.type||e}),this[`${e}$$`].next(r)}}};Pt=Ho([G(),Uo(0,z(Xe))],Pt);var qo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,Yo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Vo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&qo(e,r,i),i};let St=class{constructor(){p(this,"frame",1e3/60);p(this,"initialTime",Date.now());p(this,"currentTime",0);p(this,"deltaTime",0);p(this,"deltaRatio",0);p(this,"elapsedTime",0);p(this,"enabled",!1)}step(){const t=Date.now();this.deltaTime=t-this.currentTime,this.currentTime=t,this.elapsedTime=t-this.initialTime,this.deltaRatio=this.deltaTime/this.frame}};St=Yo([G()],St);var Bo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,Go=(t,e,r,n)=>{for(var i=n>1?void 0:n?Zo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Bo(e,r,i),i},Qo=(t,e)=>(r,n)=>e(r,n,t);let Ne=class{constructor(t){p(this,"beforeStep$$",new rt);p(this,"_previousTime",0);p(this,"beforeStep$",this.beforeStep$$.asObservable());p(this,"step$",os().pipe(ks(({elapsed:t})=>{var e;this._previousTime!==t&&((e=this.beforeStep$$)==null||e.next(rr(this._service,[])),this._previousTime=t)}),ye(()=>this._service.enabled),As(()=>this._service.enabled),Le(()=>rr(this._service,[])),bt()));this._service=t}};Ne=Go([G(),Qo(0,z(St))],Ne);var Ko=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Jo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Xo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ko(e,r,i),i},_n=(t,e)=>(r,n)=>e(r,n,t);let nr=class{constructor(t,e){p(this,"_initialAnimationFrameId");p(this,"_subscriptions",[]);this._controller=t,this._service=e,this._subscriptions.push(this._controller.step$.subscribe(this._service.step.bind(this._service)))}init(t){this.enabled(t)}frame(){return this._service.frame}deltaTime(t){return typeof t=="number"&&(this._service.deltaTime=t),this._service.deltaTime}deltaRatio(t){return typeof t=="number"&&(this._service.deltaRatio=t),this._service.deltaRatio}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}dispose(){this._initialAnimationFrameId!==void 0&&cancelAnimationFrame(this._initialAnimationFrameId),this._service.enabled=!1}beforeStep$(){return this._controller.beforeStep$}step$(){return this._controller.step$}};nr=Jo([G(),_n(0,z(Ne)),_n(1,z(St))],nr);var ea=Object.defineProperty,ta=Object.getOwnPropertyDescriptor,ra=(t,e,r,n)=>{for(var i=n>1?void 0:n?ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ea(e,r,i),i};let be=class{constructor(){p(this,"width",0);p(this,"height",0);p(this,"aspect",0);p(this,"pixelRatio",0);p(this,"frustrum",5);p(this,"enabled",!0)}init(t,e){this.height=Number(t.height??this.height),this.width=Number(t.width??this.width),this.aspect=this.width/this.height,this.enabled=e===void 0?!0:!!e}};be=ra([G()],be);var na=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,sa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ia(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&na(e,r,i),i},oa=(t,e)=>(r,n)=>e(r,n,t);let Re=class{constructor(t){p(this,"instance");p(this,"enabled",!0);this._sizesService=t}set aspectRatio(t){var e;this.instance instanceof O.PerspectiveCamera&&(this.instance.aspect=t),(this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&((e=this.instance)==null||e.updateProjectionMatrix())}set quaternion(t){var e;(e=this.instance)==null||e.quaternion.copy(t)}set position(t){var e;(e=this.instance)==null||e.position.copy(t)}set rotation(t){var e;(e=this.instance)==null||e.rotation.copy(t)}init(t){if(this.dispose(),t===yt.PERSPECTIVE||t===void 0){this.instance=new O.PerspectiveCamera(70,this._sizesService.width/this._sizesService.height,1e-4,100),this.instance.position.z=8;return}t===yt.ORTHOGRAPHIC&&(this.instance=new O.OrthographicCamera(-this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.frustrum/2,-this._sizesService.frustrum/2,-50,50))}dispose(){this.instance instanceof O.Camera&&((this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&this.instance.clearViewOffset(),this.instance.clear(),this.instance=void 0)}};Re=sa([G(),oa(0,z(be))],Re);var aa=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,ca=(t,e,r,n)=>{for(var i=n>1?void 0:n?ua(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&aa(e,r,i),i},bn=(t,e)=>(r,n)=>e(r,n,t);let ir=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};ir=ca([G(),bn(0,z(Ne)),bn(1,z(Re))],ir);var la=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,fa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ha(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&la(e,r,i),i},Ut=(t,e)=>(r,n)=>e(r,n,t);let sr=class{constructor(t,e,r){p(this,"_subscriptions",[]);this._sizesService=t,this._controller=e,this._service=r}init(){this._service.init(),this._subscriptions.push(this._controller.step$.subscribe(()=>{var t;this._service.enabled&&(this._service.aspectRatio=this._sizesService.aspect,(this._service.instance instanceof O.PerspectiveCamera||this._service.instance instanceof O.OrthographicCamera)&&((t=this._service.instance)==null||t.updateProjectionMatrix()))}))}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}aspectRatio(t){return t&&(this._service.aspectRatio=t),this._service.aspectRatio}instance(t){return t&&(this._service.instance=t),this._service.instance}position(t){return t&&(this._service.position=t),this._service.position}quaternion(t){return t&&(this._service.quaternion=t),this._service.quaternion}dispose(){this._subscriptions.forEach(t=>t.unsubscribe()),this._service.dispose()}};sr=fa([G(),Ut(0,z(be)),Ut(1,z(ir)),Ut(2,z(Re))],sr);var da=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,va=(t,e,r,n)=>{for(var i=n>1?void 0:n?pa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&da(e,r,i),i};let Je=class{constructor(){p(this,"scene",new O.Scene);p(this,"enabled",!0)}};Je=va([G()],Je);var ui=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,ya=(t,e,r)=>e in t?ui(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ma(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ui(e,r,i),i},qt=(t,e)=>(r,n)=>e(r,n,t),ba=(t,e,r)=>ya(t,e+"",r);let je=class{constructor(t,e,r){p(this,"enabled",!0);p(this,"instance");this._worldService=t,this._cameraService=e,this._sizesService=r}setWebGLRenderer(t){this.instance=new O.WebGLRenderer({canvas:t,context:t.getContext("webgl2",{stencil:!0,powerPreference:"high-performance"}),powerPreference:"high-performance",depth:!0,antialias:!0}),this.instance.autoClear=!1,this.instance.setPixelRatio(je.RENDERER_PIXEL_RATIO),this.instance.setClearColor(0,0),this.instance.shadowMap.enabled=!0,this.instance.shadowMap.type=O.PCFSoftShadowMap,this.instance.outputColorSpace=O.SRGBColorSpace,this.instance.toneMapping=O.CineonToneMapping,this.instance.toneMappingExposure=1.75}setSize(t,e){var r;(r=this.instance)==null||r.setSize(t,e)}render(){this.enabled&&this._cameraService.instance instanceof O.Camera&&this.instance instanceof O.WebGLRenderer&&(this.instance.setViewport(0,0,this._sizesService.width,this._sizesService.height),this.instance.render(this._worldService.scene,this._cameraService.instance))}};ba(je,"RENDERER_PIXEL_RATIO",1);je=_a([G(),qt(0,z(Je)),qt(1,z(Re)),qt(2,z(be))],je);var wa=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,Pa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ga(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&wa(e,r,i),i},wn=(t,e)=>(r,n)=>e(r,n,t);let Ct=class{constructor(t,e){p(this,"resize$");this._appController=t,this._service=e,this.resize$=this._appController.resize$$.pipe(ye(()=>this._service.enabled))}};Ct=Pa([G(),wn(0,z(Pt)),wn(1,z(be))],Ct);var Sa=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,Ea=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ca(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Sa(e,r,i),i},Vt=(t,e)=>(r,n)=>e(r,n,t);let or=class{constructor(t,e,r){p(this,"step$");p(this,"resize$");this._service=t,this.timerController=e,this.sizesController=r,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled)),this.resize$=this.sizesController.resize$.pipe(ye(()=>this._service.enabled))}};or=Ea([G(),Vt(0,z(je)),Vt(1,z(Ne)),Vt(2,z(Ct))],or);var Oa=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,Ma=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Oa(e,r,i),i},gn=(t,e)=>(r,n)=>e(r,n,t);let ar=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.step$.subscribe(()=>this._service.render()),this._controller.resize$.subscribe(e=>this._service.setSize(e.windowWidth,e.windowHeight)),this._service.setWebGLRenderer(t)}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}instance(){return this._service.instance}setSize(t){return this._service.setSize(t.x,t.y)}render(){return this._service.render()}dispose(){var t;(t=this._service.instance)==null||t.dispose(),this._service.instance=void 0}};ar=Ma([G(),gn(0,z(or)),gn(1,z(je))],ar);var Ra=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,$a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ra(e,r,i),i},Pn=(t,e)=>(r,n)=>e(r,n,t);let ur=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.resize$.subscribe(e=>{this._service.width=e.windowWidth,this._service.height=e.windowHeight,this._service.aspect=e.windowWidth/e.windowHeight}),this._service.init(t)}dispose(){}aspect(t){return typeof t=="number"&&(this._service.aspect=t),this._service.aspect}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}frustrum(t){return typeof t=="number"&&(this._service.frustrum=t),this._service.frustrum}height(t){return typeof t=="number"&&(this._service.height=t),this._service.height}pixelRatio(t){return typeof t=="number"&&(this._service.pixelRatio=t),this._service.pixelRatio}width(t){return typeof t=="number"&&(this._service.width=t),this._service.width}resize$(){return this._controller.resize$}};ur=$a([G(),Pn(0,z(Ct)),Pn(1,z(be))],ur);var xa=Object.defineProperty,Da=Object.getOwnPropertyDescriptor,Aa=(t,e,r,n)=>{for(var i=n>1?void 0:n?Da(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&xa(e,r,i),i},ka=(t,e)=>(r,n)=>e(r,n,t);let cr=class{constructor(t){this._service=t}init(){}dispose(){}scene(t){return t instanceof O.Scene&&(this._service.scene=t),this._service.scene}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}};cr=Aa([G(),ka(0,z(Je))],cr);const Sn={type:"change"},Cr={type:"start"},ci={type:"end"},ht=new O.Ray,Cn=new O.Plane,Ia=Math.cos(70*O.MathUtils.DEG2RAD),J=new O.Vector3,ie=2*Math.PI,q={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Yt=1e-6;class En extends O.Controls{constructor(e,r=null){super(e,r),this.state=q.NONE,this.enabled=!0,this.target=new O.Vector3,this.cursor=new O.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:O.MOUSE.ROTATE,MIDDLE:O.MOUSE.DOLLY,RIGHT:O.MOUSE.PAN},this.touches={ONE:O.TOUCH.ROTATE,TWO:O.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new O.Vector3,this._lastQuaternion=new O.Quaternion,this._lastTargetPosition=new O.Vector3,this._quat=new O.Quaternion().setFromUnitVectors(e.up,new O.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new O.Spherical,this._sphericalDelta=new O.Spherical,this._scale=1,this._panOffset=new O.Vector3,this._rotateStart=new O.Vector2,this._rotateEnd=new O.Vector2,this._rotateDelta=new O.Vector2,this._panStart=new O.Vector2,this._panEnd=new O.Vector2,this._panDelta=new O.Vector2,this._dollyStart=new O.Vector2,this._dollyEnd=new O.Vector2,this._dollyDelta=new O.Vector2,this._dollyDirection=new O.Vector3,this._mouse=new O.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Fa.bind(this),this._onPointerDown=za.bind(this),this._onPointerUp=La.bind(this),this._onContextMenu=Ya.bind(this),this._onMouseWheel=Ha.bind(this),this._onKeyDown=Ua.bind(this),this._onTouchStart=qa.bind(this),this._onTouchMove=Va.bind(this),this._onMouseDown=Wa.bind(this),this._onMouseMove=Na.bind(this),this._interceptControlDown=Ba.bind(this),this._interceptControlUp=Za.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Sn),this.update(),this.state=q.NONE}update(e=null){const r=this.object.position;J.copy(r).sub(this.target),J.applyQuaternion(this._quat),this._spherical.setFromVector3(J),this.autoRotate&&this.state===q.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=ie:n>Math.PI&&(n-=ie),i<-Math.PI?i+=ie:i>Math.PI&&(i-=ie),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(J.setFromSpherical(this._spherical),J.applyQuaternion(this._quatInverse),r.copy(this.target).add(J),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=J.length();o=this._clampDistance(a*this._scale);const c=a-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const a=new O.Vector3(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const u=new O.Vector3(this._mouse.x,this._mouse.y,0);u.unproject(this.object),this.object.position.sub(u).add(a),this.object.updateMatrixWorld(),o=J.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(ht.origin.copy(this.object.position),ht.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ht.direction))<Ia?this.object.lookAt(this.target):(Cn.setFromNormalAndCoplanarPoint(this.object.up,this.target),ht.intersectPlane(Cn,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Yt||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Yt||this._lastTargetPosition.distanceToSquared(this.target)>Yt?(this.dispatchEvent(Sn),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ie/60*this.autoRotateSpeed*e:ie/60/60*this.autoRotateSpeed}_getZoomScale(e){const r=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*r)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,r){J.setFromMatrixColumn(r,0),J.multiplyScalar(-e),this._panOffset.add(J)}_panUp(e,r){this.screenSpacePanning===!0?J.setFromMatrixColumn(r,1):(J.setFromMatrixColumn(r,0),J.crossVectors(this.object.up,J)),J.multiplyScalar(e),this._panOffset.add(J)}_pan(e,r){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;J.copy(i).sub(this.target);let s=J.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*r*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,r){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,s=r-n.top,o=n.width,a=n.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let r=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),r=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),r=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),r=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),r=!0;break}r&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+r.x)*.5,a=(e.pageY+r.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId){this._pointers.splice(r,1);return}}_isTrackingPointer(e){for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId)return!0;return!1}_trackPointer(e){let r=this._pointerPositions[e.pointerId];r===void 0&&(r=new O.Vector2,this._pointerPositions[e.pointerId]=r),r.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const r=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[r]}_customWheelEvent(e){const r=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(r){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function za(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function Fa(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function La(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(ci),this.state=q.NONE;break;case 1:const e=this._pointers[0],r=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:r.x,pageY:r.y});break}}function Wa(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case O.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=q.DOLLY;break;case O.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}break;case O.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Cr)}function Na(t){switch(this.state){case q.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case q.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case q.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function Ha(t){this.enabled===!1||this.enableZoom===!1||this.state!==q.NONE||(t.preventDefault(),this.dispatchEvent(Cr),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(ci))}function Ua(t){this.enabled!==!1&&this._handleKeyDown(t)}function qa(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case O.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=q.TOUCH_ROTATE;break;case O.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=q.TOUCH_PAN;break;default:this.state=q.NONE}break;case 2:switch(this.touches.TWO){case O.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=q.TOUCH_DOLLY_PAN;break;case O.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=q.TOUCH_DOLLY_ROTATE;break;default:this.state=q.NONE}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Cr)}function Va(t){switch(this._trackPointer(t),this.state){case q.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case q.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case q.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case q.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=q.NONE}}function Ya(t){this.enabled!==!1&&t.preventDefault()}function Ba(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Za(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var Ga=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,Ka=(t,e,r,n)=>{for(var i=n>1?void 0:n?Qa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ga(e,r,i),i},Ge=(t,e)=>(r,n)=>e(r,n,t);let lr=class{constructor(t,e,r,n,i){p(this,"enabled",!1);p(this,"cameraControls");p(this,"miniCamera");p(this,"miniCameraControls");p(this,"cameraHelper");p(this,"axesHelper");p(this,"gridHelper");this._appService=t,this._sizesService=e,this._rendererService=r,this._cameraService=n,this._worldService=i}_renderMiniCamera(){var t,e,r,n,i;!this.enabled||!this.miniCamera||((t=this._rendererService.instance)==null||t.setScissorTest(!0),(e=this._rendererService.instance)==null||e.setViewport(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(r=this._rendererService.instance)==null||r.setScissor(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(n=this._rendererService.instance)==null||n.render(this._worldService.scene,this.miniCamera),(i=this._rendererService.instance)==null||i.setScissorTest(!1))}initMiniCamera(){this.disposeMiniCamera(),this.enabled&&(this.miniCamera=new O.PerspectiveCamera(75,this._sizesService.width/this._sizesService.height,.1,500),this.miniCamera.position.z=10,this.miniCamera.position.x=-5)}initOrbitControl(){var t;this.cameraControls&&((t=this.cameraControls)==null||t.dispose()),!(!this.enabled||!(this._cameraService.instance instanceof O.Camera))&&this._cameraService.instance instanceof O.Camera&&(this.cameraControls=new En(this._cameraService.instance,this._appService.proxyReceiver),this.cameraControls.rotateSpeed=.1,this.cameraControls.enableDamping=!0)}initMiniCameraOrbitControls(){this.miniCameraControls&&this.miniCameraControls.dispose(),!(!this.enabled||!this.miniCamera)&&(this.miniCameraControls=new En(this.miniCamera,this._appService.proxyReceiver),this.miniCameraControls.rotateSpeed=.15,this.miniCameraControls.enableDamping=!0)}initCameraHelper(){this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),!(!this.enabled||!this._cameraService.instance)&&(this.cameraHelper=new O.CameraHelper(this._cameraService.instance),this._worldService.scene.add(this.cameraHelper))}initAxesHelper(t){if(!this.enabled)return;const e=new O.AxesHelper(t);this._worldService.scene.add(e)}initGridHelper(t){if(this.gridHelper&&this._worldService.scene.remove(this.gridHelper),!this.enabled)return;const e=new O.GridHelper(t,t);this._worldService.scene.add(e)}disposeMiniCamera(){this.miniCamera instanceof O.Camera&&(this.miniCamera.clearViewOffset(),this.miniCamera.clear(),this.miniCamera=void 0)}update(){var t,e;(t=this.cameraControls)==null||t.update(),(e=this.miniCameraControls)==null||e.update(),this._renderMiniCamera()}dispose(){var t,e,r,n,i;this.disposeMiniCamera(),(t=this.cameraControls)==null||t.dispose(),this.cameraControls=void 0,(e=this.miniCameraControls)==null||e.dispose(),this.miniCameraControls=void 0,this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),(r=this.cameraHelper)==null||r.dispose(),this.cameraHelper=void 0,this.axesHelper&&this._worldService.scene.remove(this.axesHelper),(n=this.axesHelper)==null||n.dispose(),this.axesHelper=void 0,this.gridHelper&&this._worldService.scene.remove(this.gridHelper),(i=this.gridHelper)==null||i.dispose(),this.gridHelper=void 0}};lr=Ka([G(),Ge(0,z(Xe)),Ge(1,z(be)),Ge(2,z(je)),Ge(3,z(Re)),Ge(4,z(Je))],lr);var Xa=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,eu=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Xa(e,r,i),i},On=(t,e)=>(r,n)=>e(r,n,t);let hr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};hr=eu([G(),On(0,z(Ne)),On(1,z(Re))],hr);var tu=Object.defineProperty,ru=Object.getOwnPropertyDescriptor,nu=(t,e,r,n)=>{for(var i=n>1?void 0:n?ru(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&tu(e,r,i),i},Tn=(t,e)=>(r,n)=>e(r,n,t);let fr=class{constructor(t,e){p(this,"_subscriptions",[]);this._service=t,this._controller=e}init(t){this._service.enabled=!!t.enableDebug,this._service.enabled&&(t.withMiniCamera&&this._service.initMiniCamera(),t.enableControls&&(this._service.initOrbitControl(),this._service.initMiniCameraOrbitControls()),t.withCameraHelper&&this._service.initCameraHelper(),typeof(t==null?void 0:t.axesSizes)=="number"&&this._service.initAxesHelper(t.axesSizes),typeof(t==null?void 0:t.gridSizes)=="number"&&this._service.initGridHelper(t.gridSizes),this._subscriptions.push(this._controller.step$.subscribe(()=>{this._service.update()})))}enabled(t){return t&&(this._service.enabled=t),this._service.enabled}miniCamera(t){return t&&(this._service.miniCamera=t),this._service.miniCamera}getAxesHelper(){return this._service.axesHelper}getCameraControls(){return this._service.cameraControls}getCameraHelper(){return this._service.cameraHelper}getGridHelper(){return this._service.gridHelper}getMiniCameraControls(){return this._service.miniCameraControls}getStep$(){return this._controller.step$}dispose(){this._service.dispose(),this._subscriptions.forEach(t=>t.unsubscribe())}};fr=nu([G(),Tn(0,z(lr)),Tn(1,z(hr))],fr);var iu=Object.defineProperty,su=Object.getOwnPropertyDescriptor,ou=(t,e,r,n)=>{for(var i=n>1?void 0:n?su(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&iu(e,r,i),i};let Et=class{constructor(){p(this,"loadedResources",{});p(this,"toLoadCount",0);p(this,"loadedCount",0)}handleLoad(t){const{source:e,resource:r,loadedCount:n,toLoadCount:i}=t;r&&(this.loadedResources[e.name]=r,this.toLoadCount=n,this.loadedCount=i)}};Et=ou([Ot(te.ResolutionScoped)],Et);var au=Object.defineProperty,uu=Object.getOwnPropertyDescriptor,cu=(t,e,r,n)=>{for(var i=n>1?void 0:n?uu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&au(e,r,i),i},lu=(t,e)=>(r,n)=>e(r,n,t);let dr=class{constructor(t){p(this,"load$",_t(self,"message").pipe(ye(t=>{var e,r,n;return((e=t.data)==null?void 0:e.token)===Fn&&!!((n=(r=t.data)==null?void 0:r.payload)!=null&&n.resource)}),Le(t=>{var r,n,i,s;const{payload:e}=t.data||{};if(((r=e==null?void 0:e.source)==null?void 0:r.type)==="gltf"){const o=e.resource,a=(n=o.animations)==null?void 0:n.map(h=>O.AnimationClip.parse(h)),c=(i=o.cameras)==null?void 0:i.map(h=>yn(h)),u=(s=o.scenes)==null?void 0:s.map(h=>yn(h)),l=u==null?void 0:u[0];return{...e,resource:{...o,animations:a,cameras:c,scene:l,scenes:u}}}return e}),bt()));p(this,"loadCompleted$",this.load$.pipe(ye(t=>!!t&&t.toLoadCount===t.loadedCount),Le(()=>ai(this._service,["loadedCount","loadedResources","toLoadCount"])),bt()));this._service=t}};dr=cu([Ot(te.ResolutionScoped),lu(0,z(Et))],dr);var hu=Object.defineProperty,fu=Object.getOwnPropertyDescriptor,du=(t,e,r,n)=>{for(var i=n>1?void 0:n?fu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&hu(e,r,i),i},Mn=(t,e)=>(r,n)=>e(r,n,t);let pr=class{constructor(t,e){p(this,"_subscriptions",[]);this._controller=t,this._service=e}init(){this._subscriptions.push(this._controller.load$.subscribe(this._service.handleLoad.bind(this._service)))}getLoadedResources(){return this._service.loadedResources}getLoadedCount(){return this._service.loadedCount}getToLoadCount(){return this._service.toLoadCount}getLoad$(){return this._controller.load$}getLoadCompleted$(){return this._controller.loadCompleted$}dispose(){this._subscriptions.forEach(t=>t.unsubscribe())}};pr=du([G(),Mn(0,z(dr)),Mn(1,z(Et))],pr);var pu=Object.defineProperty,vu=Object.getOwnPropertyDescriptor,mu=(t,e,r,n)=>{for(var i=n>1?void 0:n?vu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&pu(e,r,i),i},me=(t,e)=>(r,n)=>e(r,n,t);exports.AppModule=class extends zn{constructor(e,r,n,i,s,o,a,c,u){super(),this._controller=e,this._service=r,this.timer=n,this.sizes=i,this.camera=s,this.world=o,this.renderer=a,this.loader=c,this.debug=u,this._initProxyEvents()}_initProxyEvents(){_r.forEach(e=>{this[`${e}$`]=()=>{var r;return(r=this._controller)==null?void 0:r[`${e}$`]},this[e]=r=>{var n,i;return(i=(n=this._controller)==null?void 0:n[e])==null?void 0:i.call(n,r)}})}getProxyReceiver(){return this._service.proxyReceiver}getCanvas(){return this._service.canvas}getIsInitialized(){return this._service.isInitialized}getBeforeStep$(){return this.timer.beforeStep$()}getStep$(){return this.timer.step$()}init(e){this._service.isInitialized||!(e!=null&&e.canvas)||!(this._service.canvas=e.canvas)||(this._service.isInitialized=!0,this.sizes.init(this._service.canvas),this.camera.init(),this.world.init(),this.renderer.init(this._service.canvas),this.timer.init(e.startTimer),this.loader.init(),this.debug.init(e))}dispose(){this.sizes.dispose(),this.camera.dispose(),this.world.dispose(),this.renderer.dispose(),this.timer.dispose(),this.loader.dispose(),this.debug.dispose()}};exports.AppModule=mu([Ot(te.ContainerScoped),me(0,z(Pt)),me(1,z(Xe)),me(2,z(nr)),me(3,z(ur)),me(4,z(sr)),me(5,z(cr)),me(6,z(ar)),me(7,z(pr)),me(8,z(fr))],exports.AppModule);exports.A=Do;exports.AppProxyEventHandlersBlueprint=zn;exports.C=xo;exports.CONTAINER_TOKEN=Yi;exports.D=Ao;exports.DefaultCameraType=yt;exports.J=ai;exports.KEYBOARD_EVENT_CODES=qi;exports.LOADER_SERIALIZED_LOAD_TOKEN=Fn;exports.Lifecycle=te;exports.PROXY_EVENT_LISTENERS=_r;exports.ProxyEventHandlersBlueprint=In;exports.ProxyEventObservablesBlueprint=kn;exports.ProxyEventSubjectsBlueprint=An;exports.Q=ko;exports.RegisterProxyEventHandlersBlueprint=Vi;exports.Subject=rt;exports.U=rr;exports.W=Io;exports.filter=ye;exports.fromEvent=_t;exports.getDefaultExportFromCjs=Rn;exports.inject=z;exports.instance=yr;exports.map=Le;exports.requireWorker=oi;exports.scoped=Ot;exports.share=bt;exports.singleton=G;
|
|
@@ -22,9 +22,10 @@ export declare class AppModule extends AppProxyEventHandlersBlueprint implements
|
|
|
22
22
|
readonly debug: DebugModule;
|
|
23
23
|
constructor(_controller: AppController, _service: AppService, timer: TimerModule, sizes: SizesModule, camera: CameraModule, world: WorldModule, renderer: RendererModule, loader: LoaderModule, debug: DebugModule);
|
|
24
24
|
private _initProxyEvents;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
getProxyReceiver(): import('@quick-threejs/utils').ProxyReceiver<Record<string, unknown>>;
|
|
26
|
+
getCanvas(): import('../../common').OffscreenCanvasWithStyle | undefined;
|
|
27
|
+
getIsInitialized(): boolean;
|
|
28
|
+
getBeforeStep$(): Observable<import('@quick-threejs/utils').NonNever<{
|
|
28
29
|
readonly frame: number;
|
|
29
30
|
readonly initialTime: number;
|
|
30
31
|
currentTime: number;
|
|
@@ -34,8 +35,9 @@ export declare class AppModule extends AppProxyEventHandlersBlueprint implements
|
|
|
34
35
|
enabled: boolean;
|
|
35
36
|
step: never;
|
|
36
37
|
}>>;
|
|
37
|
-
|
|
38
|
+
getStep$(): Observable<Omit<import('./timer/timer.service').TimerService, never> & {
|
|
38
39
|
type?: string;
|
|
39
40
|
}>;
|
|
41
|
+
init(props: AppModulePropsMessageEvent["data"]): void;
|
|
40
42
|
dispose(): void;
|
|
41
43
|
}
|
|
@@ -3,7 +3,7 @@ import { OffscreenCanvasWithStyle } from '../../common/interfaces';
|
|
|
3
3
|
export declare class AppService {
|
|
4
4
|
private _canvas?;
|
|
5
5
|
readonly proxyReceiver: ProxyReceiver<Record<string, unknown>>;
|
|
6
|
-
|
|
6
|
+
isInitialized: boolean;
|
|
7
7
|
get canvas(): OffscreenCanvasWithStyle | undefined;
|
|
8
8
|
set canvas(canvas: OffscreenCanvasWithStyle | OffscreenCanvas);
|
|
9
9
|
}
|
package/dist/main.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var re=Object.defineProperty;var ie=(o,t,e)=>t in o?re(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var E=(o,t,e)=>ie(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./app.module-
|
|
1
|
+
"use strict";var re=Object.defineProperty;var ie=(o,t,e)=>t in o?re(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var E=(o,t,e)=>ie(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./app.module-DtXUGy5w.js"),d=require("three");class U{constructor(){E(this,"location");E(this,"initOnConstruct");E(this,"canvas");E(this,"fullScreen");E(this,"defaultCamera");E(this,"startTimer");E(this,"loaderDataSources",[]);E(this,"loadResourcesOnInit");E(this,"enableDebug");E(this,"enableControls");E(this,"axesSizes");E(this,"gridSizes");E(this,"withMiniCamera");E(this,"withCameraHelper");E(this,"onReady")}}class oe{constructor(){E(this,"onReady")}}function Q(o,t){if(t===d.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(t===d.TriangleFanDrawMode||t===d.TriangleStripDrawMode){let e=o.getIndex();if(e===null){const r=[],a=o.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)r.push(c);o.setIndex(r),e=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}const n=e.count-2,s=[];if(t===d.TriangleFanDrawMode)for(let r=1;r<=n;r++)s.push(e.getX(0)),s.push(e.getX(r)),s.push(e.getX(r+1));else for(let r=0;r<n;r++)r%2===0?(s.push(e.getX(r)),s.push(e.getX(r+1)),s.push(e.getX(r+2))):(s.push(e.getX(r+2)),s.push(e.getX(r+1)),s.push(e.getX(r)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=o.clone();return i.setIndex(s),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),o}const K=new WeakMap;class ae extends d.Loader{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,s){const i=new d.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(t,r=>{this.parse(r,e,s)},n,s)}parse(t,e,n=()=>{}){this.decodeDracoFile(t,e,null,null,d.SRGBColorSpace,n).catch(n)}decodeDracoFile(t,e,n,s,i=d.LinearSRGBColorSpace,r=()=>{}){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:i};return this.decodeGeometry(t,a).then(e).catch(r)}decodeGeometry(t,e){const n=JSON.stringify(e);if(K.has(t)){const c=K.get(t);if(c.key===n)return c.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const i=this.workerNextTaskID++,r=t.byteLength,a=this._getWorker(i,r).then(c=>(s=c,new Promise((l,h)=>{s._callbacks[i]={resolve:l,reject:h},s.postMessage({type:"decode",id:i,taskConfig:e,buffer:t},[t])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{s&&i&&this._releaseTask(s,i)}),K.set(t,{key:n,promise:a}),a}_createGeometry(t){const e=new d.BufferGeometry;t.index&&e.setIndex(new d.BufferAttribute(t.index.array,1));for(let n=0;n<t.attributes.length;n++){const s=t.attributes[n],i=s.name,r=s.array,a=s.itemSize,c=new d.BufferAttribute(r,a);i==="color"&&(this._assignVertexColorSpace(c,s.vertexColorSpace),c.normalized=!(r instanceof Float32Array)),e.setAttribute(i,c)}return e}_assignVertexColorSpace(t,e){if(e!==d.SRGBColorSpace)return;const n=new d.Color;for(let s=0,i=t.count;s<i;s++)n.fromBufferAttribute(t,s),d.ColorManagement.toWorkingColorSpace(n,d.SRGBColorSpace),t.setXYZ(s,n.r,n.g,n.b)}_loadLibrary(t,e){const n=new d.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((s,i)=>{n.load(t,s,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then(n=>{const s=n[0];t||(this.decoderConfig.wasmBinary=n[1]);const i=ce.toString(),r=["/* draco decoder */",s,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join(`
|
|
2
2
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(i){const r=i.data;switch(r.type){case"decode":s._callbacks[r.id].resolve(r);break;case"error":s._callbacks[r.id].reject(r);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,i){return s._taskLoad>i._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function ce(){let o,t;onmessage=function(r){const a=r.data;switch(a.type){case"init":o=a.decoderConfig,t=new Promise(function(h){o.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(o)});break;case"decode":const c=a.buffer,l=a.taskConfig;t.then(h=>{const u=h.draco,f=new u.Decoder;try{const p=e(u,f,new Int8Array(c),l),g=p.attributes.map(_=>_.array.buffer);p.index&&g.push(p.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:p},g)}catch(p){console.error(p),self.postMessage({type:"error",id:a.id,error:p.message})}finally{u.destroy(f)}});break}};function e(r,a,c,l){const h=l.attributeIDs,u=l.attributeTypes;let f,p;const g=a.GetEncodedGeometryType(c);if(g===r.TRIANGULAR_MESH)f=new r.Mesh,p=a.DecodeArrayToMesh(c,c.byteLength,f);else if(g===r.POINT_CLOUD)f=new r.PointCloud,p=a.DecodeArrayToPointCloud(c,c.byteLength,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const _={index:null,attributes:[]};for(const A in h){const T=self[u[A]];let w,L;if(l.useUniqueIDs)L=h[A],w=a.GetAttributeByUniqueId(f,L);else{if(L=a.GetAttributeId(f,r[h[A]]),L===-1)continue;w=a.GetAttribute(f,L)}const y=s(r,a,f,A,T,w);A==="color"&&(y.vertexColorSpace=l.vertexColorSpace),_.attributes.push(y)}return g===r.TRIANGULAR_MESH&&(_.index=n(r,a,f)),r.destroy(f),_}function n(r,a,c){const h=c.num_faces()*3,u=h*4,f=r._malloc(u);a.GetTrianglesUInt32Array(c,u,f);const p=new Uint32Array(r.HEAPF32.buffer,f,h).slice();return r._free(f),{array:p,itemSize:1}}function s(r,a,c,l,h,u){const f=u.num_components(),g=c.num_points()*f,_=g*h.BYTES_PER_ELEMENT,A=i(r,h),T=r._malloc(_);a.GetAttributeDataArrayForAllPoints(c,u,A,_,T);const w=new h(r.HEAPF32.buffer,T,g).slice();return r._free(T),{name:l,array:w,itemSize:f}}function i(r,a){switch(a){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32}}}class le extends d.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new pe(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new Le(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new Se(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new _e(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new ye(e)}),this.register(function(e){return new we(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new be(e)}),this.register(function(e){return new Me(e)})}load(t,e,n,s){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const l=d.LoaderUtils.extractUrlBase(t);r=d.LoaderUtils.resolveURL(l,this.path)}else r=d.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(l){s?s(l):console.error(l),i.manager.itemError(t),i.manager.itemEnd(t)},c=new d.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(t,function(l){try{i.parse(l,r,function(h){e(h),i.manager.itemEnd(t)},a)}catch(h){a(h)}},n,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,s){let i;const r={},a={},c=new TextDecoder;if(typeof t=="string")i=JSON.parse(t);else if(t instanceof ArrayBuffer)if(c.decode(new Uint8Array(t,0,4))===se){try{r[R.KHR_BINARY_GLTF]=new Ce(t)}catch(u){s&&s(u);return}i=JSON.parse(r[R.KHR_BINARY_GLTF].content)}else i=JSON.parse(c.decode(t));else i=t;if(i.asset===void 0||i.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new je(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,r[u.name]=!0}if(i.extensionsUsed)for(let h=0;h<i.extensionsUsed.length;++h){const u=i.extensionsUsed[h],f=i.extensionsRequired||[];switch(u){case R.KHR_MATERIALS_UNLIT:r[u]=new he;break;case R.KHR_DRACO_MESH_COMPRESSION:r[u]=new ve(i,this.dracoLoader);break;case R.KHR_TEXTURE_TRANSFORM:r[u]=new Oe;break;case R.KHR_MESH_QUANTIZATION:r[u]=new Ie;break;default:f.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(r),l.setPlugins(a),l.parse(n,s)}parseAsync(t,e){const n=this;return new Promise(function(s,i){n.parse(t,e,s,i)})}}function ue(){let o={};return{get:function(t){return o[t]},add:function(t,e){o[t]=e},remove:function(t){delete o[t]},removeAll:function(){o={}}}}const R={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class de{constructor(t){this.parser=t,this.name=R.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,s=e.length;n<s;n++){const i=e[n];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let s=e.cache.get(n);if(s)return s;const i=e.json,c=((i.extensions&&i.extensions[this.name]||{}).lights||[])[t];let l;const h=new d.Color(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],d.LinearSRGBColorSpace);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new d.DirectionalLight(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new d.PointLight(h),l.distance=u;break;case"spot":l=new d.SpotLight(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),l.decay=2,M(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=e.createUniqueName(c.name||"light_"+t),s=Promise.resolve(l),e.cache.add(n,s),s}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,i=n.json.nodes[t],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(c){return n._getNodeRef(e.cache,a,c)})}}class he{constructor(){this.name=R.KHR_MATERIALS_UNLIT}getMaterialType(){return d.MeshBasicMaterial}extendParams(t,e,n){const s=[];t.color=new d.Color(1,1,1),t.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;t.color.setRGB(r[0],r[1],r[2],d.LinearSRGBColorSpace),t.opacity=r[3]}i.baseColorTexture!==void 0&&s.push(n.assignTexture(t,"map",i.baseColorTexture,d.SRGBColorSpace))}return Promise.all(s)}}class fe{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name].emissiveStrength;return i!==void 0&&(e.emissiveIntensity=i),Promise.resolve()}}class pe{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];if(r.clearcoatFactor!==void 0&&(e.clearcoat=r.clearcoatFactor),r.clearcoatTexture!==void 0&&i.push(n.assignTexture(e,"clearcoatMap",r.clearcoatTexture)),r.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=r.clearcoatRoughnessFactor),r.clearcoatRoughnessTexture!==void 0&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),r.clearcoatNormalTexture!==void 0&&(i.push(n.assignTexture(e,"clearcoatNormalMap",r.clearcoatNormalTexture)),r.clearcoatNormalTexture.scale!==void 0)){const a=r.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new d.Vector2(a,a)}return Promise.all(i)}}class me{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_DISPERSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name];return e.dispersion=i.dispersion!==void 0?i.dispersion:0,Promise.resolve()}}class ge{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return r.iridescenceFactor!==void 0&&(e.iridescence=r.iridescenceFactor),r.iridescenceTexture!==void 0&&i.push(n.assignTexture(e,"iridescenceMap",r.iridescenceTexture)),r.iridescenceIor!==void 0&&(e.iridescenceIOR=r.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),r.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),r.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),r.iridescenceThicknessTexture!==void 0&&i.push(n.assignTexture(e,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(i)}}class Ae{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_SHEEN}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[];e.sheenColor=new d.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const r=s.extensions[this.name];if(r.sheenColorFactor!==void 0){const a=r.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace)}return r.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=r.sheenRoughnessFactor),r.sheenColorTexture!==void 0&&i.push(n.assignTexture(e,"sheenColorMap",r.sheenColorTexture,d.SRGBColorSpace)),r.sheenRoughnessTexture!==void 0&&i.push(n.assignTexture(e,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(i)}}class Te{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return r.transmissionFactor!==void 0&&(e.transmission=r.transmissionFactor),r.transmissionTexture!==void 0&&i.push(n.assignTexture(e,"transmissionMap",r.transmissionTexture)),Promise.all(i)}}class _e{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_VOLUME}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];e.thickness=r.thicknessFactor!==void 0?r.thicknessFactor:0,r.thicknessTexture!==void 0&&i.push(n.assignTexture(e,"thicknessMap",r.thicknessTexture)),e.attenuationDistance=r.attenuationDistance||1/0;const a=r.attenuationColor||[1,1,1];return e.attenuationColor=new d.Color().setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace),Promise.all(i)}}class Re{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_IOR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name];return e.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}}class Ee{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_SPECULAR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];e.specularIntensity=r.specularFactor!==void 0?r.specularFactor:1,r.specularTexture!==void 0&&i.push(n.assignTexture(e,"specularIntensityMap",r.specularTexture));const a=r.specularColorFactor||[1,1,1];return e.specularColor=new d.Color().setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace),r.specularColorTexture!==void 0&&i.push(n.assignTexture(e,"specularColorMap",r.specularColorTexture,d.SRGBColorSpace)),Promise.all(i)}}class we{constructor(t){this.parser=t,this.name=R.EXT_MATERIALS_BUMP}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return e.bumpScale=r.bumpFactor!==void 0?r.bumpFactor:1,r.bumpTexture!==void 0&&i.push(n.assignTexture(e,"bumpMap",r.bumpTexture)),Promise.all(i)}}class ye{constructor(t){this.parser=t,this.name=R.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,s=n.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],r=s.extensions[this.name];return r.anisotropyStrength!==void 0&&(e.anisotropy=r.anisotropyStrength),r.anisotropyRotation!==void 0&&(e.anisotropyRotation=r.anisotropyRotation),r.anisotropyTexture!==void 0&&i.push(n.assignTexture(e,"anisotropyMap",r.anisotropyTexture)),Promise.all(i)}}class Le{constructor(t){this.parser=t,this.name=R.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,n=e.json,s=n.textures[t];if(!s.extensions||!s.extensions[this.name])return null;const i=s.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,i.source,r)}}class xe{constructor(t){this.parser=t,this.name=R.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,s=n.json,i=s.textures[t];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=s.images[r.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(t,r.source,c);if(s.extensionsRequired&&s.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Se{constructor(t){this.parser=t,this.name=R.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,s=n.json,i=s.textures[t];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=s.images[r.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(t,r.source,c);if(s.extensionsRequired&&s.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class be{constructor(t){this.name=R.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const s=n.extensions[this.name],i=this.parser.getDependency("buffer",s.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const c=s.byteOffset||0,l=s.byteLength||0,h=s.count,u=s.byteStride,f=new Uint8Array(a,c,l);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(h,u,f,s.mode,s.filter).then(function(p){return p.buffer}):r.ready.then(function(){const p=new ArrayBuffer(h*u);return r.decodeGltfBuffer(new Uint8Array(p),h,u,f,s.mode,s.filter),p})})}else return null}}class Me{constructor(t){this.name=R.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const s=e.meshes[n.mesh];for(const l of s.primitives)if(l.mode!==x.TRIANGLES&&l.mode!==x.TRIANGLE_STRIP&&l.mode!==x.TRIANGLE_FAN&&l.mode!==void 0)return null;const r=n.extensions[this.name].attributes,a=[],c={};for(const l in r)a.push(this.parser.getDependency("accessor",r[l]).then(h=>(c[l]=h,c[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(l=>{const h=l.pop(),u=h.isGroup?h.children:[h],f=l[0].count,p=[];for(const g of u){const _=new d.Matrix4,A=new d.Vector3,T=new d.Quaternion,w=new d.Vector3(1,1,1),L=new d.InstancedMesh(g.geometry,g.material,f);for(let y=0;y<f;y++)c.TRANSLATION&&A.fromBufferAttribute(c.TRANSLATION,y),c.ROTATION&&T.fromBufferAttribute(c.ROTATION,y),c.SCALE&&w.fromBufferAttribute(c.SCALE,y),L.setMatrixAt(y,_.compose(A,T,w));for(const y in c)if(y==="_COLOR_0"){const b=c[y];L.instanceColor=new d.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else y!=="TRANSLATION"&&y!=="ROTATION"&&y!=="SCALE"&&g.geometry.setAttribute(y,c[y]);d.Object3D.prototype.copy.call(L,g),this.parser.assignFinalMaterial(L),p.push(L)}return h.isGroup?(h.clear(),h.add(...p),h):p[0]}))}}const se="glTF",k=12,J={JSON:1313821514,BIN:5130562};class Ce{constructor(t){this.name=R.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,k),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==se)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-k,i=new DataView(t,k);let r=0;for(;r<s;){const a=i.getUint32(r,!0);r+=4;const c=i.getUint32(r,!0);if(r+=4,c===J.JSON){const l=new Uint8Array(t,k+r,a);this.content=n.decode(l)}else if(c===J.BIN){const l=k+r;this.body=t.slice(l,l+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class ve{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=R.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,s=this.dracoLoader,i=t.extensions[this.name].bufferView,r=t.extensions[this.name].attributes,a={},c={},l={};for(const h in r){const u=$[h]||h.toLowerCase();a[u]=r[h]}for(const h in t.attributes){const u=$[h]||h.toLowerCase();if(r[h]!==void 0){const f=n.accessors[t.attributes[h]],p=P[f.componentType];l[u]=p.name,c[u]=f.normalized===!0}}return e.getDependency("bufferView",i).then(function(h){return new Promise(function(u,f){s.decodeDracoFile(h,function(p){for(const g in p.attributes){const _=p.attributes[g],A=c[g];A!==void 0&&(_.normalized=A)}u(p)},a,l,d.LinearSRGBColorSpace,f)})})}}class Oe{constructor(){this.name=R.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class Ie{constructor(){this.name=R.KHR_MESH_QUANTIZATION}}class ne extends d.Interpolant{constructor(t,e,n,s){super(t,e,n,s)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,i=t*s*3+s;for(let r=0;r!==s;r++)e[r]=n[i+r];return e}interpolate_(t,e,n,s){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,c=a*2,l=a*3,h=s-e,u=(n-e)/h,f=u*u,p=f*u,g=t*l,_=g-l,A=-2*p+3*f,T=p-f,w=1-A,L=T-f+u;for(let y=0;y!==a;y++){const b=r[_+y+a],C=r[_+y+c]*h,S=r[g+y+a],D=r[g+y]*h;i[y]=w*b+L*C+A*S+T*D}return i}}const Ne=new d.Quaternion;class Pe extends ne{interpolate_(t,e,n,s){const i=super.interpolate_(t,e,n,s);return Ne.fromArray(i).normalize().toArray(i),i}}const x={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},P={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Z={9728:d.NearestFilter,9729:d.LinearFilter,9984:d.NearestMipmapNearestFilter,9985:d.LinearMipmapNearestFilter,9986:d.NearestMipmapLinearFilter,9987:d.LinearMipmapLinearFilter},ee={33071:d.ClampToEdgeWrapping,33648:d.MirroredRepeatWrapping,10497:d.RepeatWrapping},V={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},De={CUBICSPLINE:void 0,LINEAR:d.InterpolateLinear,STEP:d.InterpolateDiscrete},z={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function ke(o){return o.DefaultMaterial===void 0&&(o.DefaultMaterial=new d.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:d.FrontSide})),o.DefaultMaterial}function I(o,t,e){for(const n in e.extensions)o[n]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=e.extensions[n])}function M(o,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(o.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Fe(o,t,e){let n=!1,s=!1,i=!1;for(let l=0,h=t.length;l<h;l++){const u=t[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(s=!0),u.COLOR_0!==void 0&&(i=!0),n&&s&&i)break}if(!n&&!s&&!i)return Promise.resolve(o);const r=[],a=[],c=[];for(let l=0,h=t.length;l<h;l++){const u=t[l];if(n){const f=u.POSITION!==void 0?e.getDependency("accessor",u.POSITION):o.attributes.position;r.push(f)}if(s){const f=u.NORMAL!==void 0?e.getDependency("accessor",u.NORMAL):o.attributes.normal;a.push(f)}if(i){const f=u.COLOR_0!==void 0?e.getDependency("accessor",u.COLOR_0):o.attributes.color;c.push(f)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(c)]).then(function(l){const h=l[0],u=l[1],f=l[2];return n&&(o.morphAttributes.position=h),s&&(o.morphAttributes.normal=u),i&&(o.morphAttributes.color=f),o.morphTargetsRelative=!0,o})}function Be(o,t){if(o.updateMorphTargets(),t.weights!==void 0)for(let e=0,n=t.weights.length;e<n;e++)o.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(o.morphTargetInfluences.length===e.length){o.morphTargetDictionary={};for(let n=0,s=e.length;n<s;n++)o.morphTargetDictionary[e[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function He(o){let t;const e=o.extensions&&o.extensions[R.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+X(e.attributes):t=o.indices+":"+X(o.attributes)+":"+o.mode,o.targets!==void 0)for(let n=0,s=o.targets.length;n<s;n++)t+=":"+X(o.targets[n]);return t}function X(o){let t="";const e=Object.keys(o).sort();for(let n=0,s=e.length;n<s;n++)t+=e[n]+":"+o[e[n]]+";";return t}function q(o){switch(o){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Ge(o){return o.search(/\.jpe?g($|\?)/i)>0||o.search(/^data\:image\/jpeg/)===0?"image/jpeg":o.search(/\.webp($|\?)/i)>0||o.search(/^data\:image\/webp/)===0?"image/webp":o.search(/\.ktx2($|\?)/i)>0||o.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Ue=new d.Matrix4;class je{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new ue,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,s=-1,i=!1,r=-1;if(typeof navigator<"u"){const a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;const c=a.match(/Version\/(\d+)/);s=n&&c?parseInt(c[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&s<17||i&&r<98?this.textureLoader=new d.TextureLoader(this.options.manager):this.textureLoader=new d.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new d.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,s=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(r){const a={scene:r[0][s.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:s.asset,parser:n,userData:{}};return I(i,a,s),M(a,s),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){for(const c of a.scenes)c.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let s=0,i=e.length;s<i;s++){const r=e[s].joints;for(let a=0,c=r.length;a<c;a++)t[r[a]].isBone=!0}for(let s=0,i=t.length;s<i;s++){const r=t[s];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const s=n.clone(),i=(r,a)=>{const c=this.associations.get(r);c!=null&&this.associations.set(a,c);for(const[l,h]of r.children.entries())i(h,a.children[l])};return i(n,s),s.name+="_instance_"+t.uses[e]++,s}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const s=t(e[n]);if(s)return s}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let s=0;s<e.length;s++){const i=t(e[s]);i&&n.push(i)}return n}getDependency(t,e){const n=t+":"+e;let s=this.cache.get(n);if(!s){switch(t){case"scene":s=this.loadScene(e);break;case"node":s=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":s=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":s=this.loadAccessor(e);break;case"bufferView":s=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":s=this.loadBuffer(e);break;case"material":s=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":s=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":s=this.loadSkin(e);break;case"animation":s=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":s=this.loadCamera(e);break;default:if(s=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(t,e)}),!s)throw new Error("Unknown type: "+t);break}this.cache.add(n,s)}return s}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,s=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(s.map(function(i,r){return n.getDependency(t,r)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[R.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(i,r){n.load(d.LoaderUtils.resolveURL(e.uri,s.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(n){const s=e.byteLength||0,i=e.byteOffset||0;return n.slice(i,i+s)})}loadAccessor(t){const e=this,n=this.json,s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0){const r=V[s.type],a=P[s.componentType],c=s.normalized===!0,l=new a(s.count*r);return Promise.resolve(new d.BufferAttribute(l,r,c))}const i=[];return s.bufferView!==void 0?i.push(this.getDependency("bufferView",s.bufferView)):i.push(null),s.sparse!==void 0&&(i.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],c=V[s.type],l=P[s.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,f=s.byteOffset||0,p=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,g=s.normalized===!0;let _,A;if(p&&p!==u){const T=Math.floor(f/p),w="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+T+":"+s.count;let L=e.cache.get(w);L||(_=new l(a,T*p,s.count*p/h),L=new d.InterleavedBuffer(_,p/h),e.cache.add(w,L)),A=new d.InterleavedBufferAttribute(L,c,f%p/h,g)}else a===null?_=new l(s.count*c):_=new l(a,f,s.count*c),A=new d.BufferAttribute(_,c,g);if(s.sparse!==void 0){const T=V.SCALAR,w=P[s.sparse.indices.componentType],L=s.sparse.indices.byteOffset||0,y=s.sparse.values.byteOffset||0,b=new w(r[1],L,s.sparse.count*T),C=new l(r[2],y,s.sparse.count*c);a!==null&&(A=new d.BufferAttribute(A.array.slice(),A.itemSize,A.normalized)),A.normalized=!1;for(let S=0,D=b.length;S<D;S++){const v=b[S];if(A.setX(v,C[S*c]),c>=2&&A.setY(v,C[S*c+1]),c>=3&&A.setZ(v,C[S*c+2]),c>=4&&A.setW(v,C[S*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}A.normalized=g}return A})}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t].source,r=e.images[i];let a=this.textureLoader;if(r.uri){const c=n.manager.getHandler(r.uri);c!==null&&(a=c)}return this.loadTextureImage(t,i,a)}loadTextureImage(t,e,n){const s=this,i=this.json,r=i.textures[t],a=i.images[e],c=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(e,n).then(function(h){h.flipY=!1,h.name=r.name||a.name||"",h.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(h.name=a.uri);const f=(i.samplers||{})[r.sampler]||{};return h.magFilter=Z[f.magFilter]||d.LinearFilter,h.minFilter=Z[f.minFilter]||d.LinearMipmapLinearFilter,h.wrapS=ee[f.wrapS]||d.RepeatWrapping,h.wrapT=ee[f.wrapT]||d.RepeatWrapping,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==d.NearestFilter&&h.minFilter!==d.LinearFilter,s.associations.set(h,{textures:t}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(t,e){const n=this,s=this.json,i=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(u=>u.clone());const r=s.images[t],a=self.URL||self.webkitURL;let c=r.uri||"",l=!1;if(r.bufferView!==void 0)c=n.getDependency("bufferView",r.bufferView).then(function(u){l=!0;const f=new Blob([u],{type:r.mimeType});return c=a.createObjectURL(f),c});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const h=Promise.resolve(c).then(function(u){return new Promise(function(f,p){let g=f;e.isImageBitmapLoader===!0&&(g=function(_){const A=new d.Texture(_);A.needsUpdate=!0,f(A)}),e.load(d.LoaderUtils.resolveURL(u,i.path),g,void 0,p)})}).then(function(u){return l===!0&&a.revokeObjectURL(c),M(u,r),u.userData.mimeType=r.mimeType||Ge(r.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[t]=h,h}assignTexture(t,e,n,s){const i=this;return this.getDependency("texture",n.index).then(function(r){if(!r)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(r=r.clone(),r.channel=n.texCoord),i.extensions[R.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[R.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const c=i.associations.get(r);r=i.extensions[R.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,c)}}return s!==void 0&&(r.colorSpace=s),t[e]=r,r})}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const s=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new d.PointsMaterial,d.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(a,c)),n=c}else if(t.isLine){const a="LineBasicMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new d.LineBasicMaterial,d.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(a,c)),n=c}if(s||i||r){let a="ClonedMaterial:"+n.uuid+":";s&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=n.clone(),i&&(c.vertexColors=!0),r&&(c.flatShading=!0),s&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(a,c),this.associations.set(c,this.associations.get(n))),n=c}t.material=n}getMaterialType(){return d.MeshStandardMaterial}loadMaterial(t){const e=this,n=this.json,s=this.extensions,i=n.materials[t];let r;const a={},c=i.extensions||{},l=[];if(c[R.KHR_MATERIALS_UNLIT]){const u=s[R.KHR_MATERIALS_UNLIT];r=u.getMaterialType(),l.push(u.extendParams(a,i,e))}else{const u=i.pbrMetallicRoughness||{};if(a.color=new d.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],d.LinearSRGBColorSpace),a.opacity=f[3]}u.baseColorTexture!==void 0&&l.push(e.assignTexture(a,"map",u.baseColorTexture,d.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(e.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),l.push(e.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),r=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(t)}),l.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(t,a)})))}i.doubleSided===!0&&(a.side=d.DoubleSide);const h=i.alphaMode||z.OPAQUE;if(h===z.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===z.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==d.MeshBasicMaterial&&(l.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new d.Vector2(1,1),i.normalTexture.scale!==void 0)){const u=i.normalTexture.scale;a.normalScale.set(u,u)}if(i.occlusionTexture!==void 0&&r!==d.MeshBasicMaterial&&(l.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==d.MeshBasicMaterial){const u=i.emissiveFactor;a.emissive=new d.Color().setRGB(u[0],u[1],u[2],d.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&r!==d.MeshBasicMaterial&&l.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,d.SRGBColorSpace)),Promise.all(l).then(function(){const u=new r(a);return i.name&&(u.name=i.name),M(u,i),e.associations.set(u,{materials:t}),i.extensions&&I(s,u,i),u})}createUniqueName(t){const e=d.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,s=this.primitiveCache;function i(a){return n[R.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(c){return te(c,a,e)})}const r=[];for(let a=0,c=t.length;a<c;a++){const l=t[a],h=He(l),u=s[h];if(u)r.push(u.promise);else{let f;l.extensions&&l.extensions[R.KHR_DRACO_MESH_COMPRESSION]?f=i(l):f=te(new d.BufferGeometry,l,e),s[h]={primitive:l,promise:f},r.push(f)}}return Promise.all(r)}loadMesh(t){const e=this,n=this.json,s=this.extensions,i=n.meshes[t],r=i.primitives,a=[];for(let c=0,l=r.length;c<l;c++){const h=r[c].material===void 0?ke(this.cache):this.getDependency("material",r[c].material);a.push(h)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(c){const l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let p=0,g=h.length;p<g;p++){const _=h[p],A=r[p];let T;const w=l[p];if(A.mode===x.TRIANGLES||A.mode===x.TRIANGLE_STRIP||A.mode===x.TRIANGLE_FAN||A.mode===void 0)T=i.isSkinnedMesh===!0?new d.SkinnedMesh(_,w):new d.Mesh(_,w),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),A.mode===x.TRIANGLE_STRIP?T.geometry=Q(T.geometry,d.TriangleStripDrawMode):A.mode===x.TRIANGLE_FAN&&(T.geometry=Q(T.geometry,d.TriangleFanDrawMode));else if(A.mode===x.LINES)T=new d.LineSegments(_,w);else if(A.mode===x.LINE_STRIP)T=new d.Line(_,w);else if(A.mode===x.LINE_LOOP)T=new d.LineLoop(_,w);else if(A.mode===x.POINTS)T=new d.Points(_,w);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(T.geometry.morphAttributes).length>0&&Be(T,i),T.name=e.createUniqueName(i.name||"mesh_"+t),M(T,i),A.extensions&&I(s,T,A),e.assignFinalMaterial(T),u.push(T)}for(let p=0,g=u.length;p<g;p++)e.associations.set(u[p],{meshes:t,primitives:p});if(u.length===1)return i.extensions&&I(s,u[0],i),u[0];const f=new d.Group;i.extensions&&I(s,f,i),e.associations.set(f,{meshes:t});for(let p=0,g=u.length;p<g;p++)f.add(u[p]);return f})}loadCamera(t){let e;const n=this.json.cameras[t],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?e=new d.PerspectiveCamera(d.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(e=new d.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),M(e,n),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],n=[];for(let s=0,i=e.joints.length;s<i;s++)n.push(this._loadNodeShallow(e.joints[s]));return e.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){const i=s.pop(),r=s,a=[],c=[];for(let l=0,h=r.length;l<h;l++){const u=r[l];if(u){a.push(u);const f=new d.Matrix4;i!==null&&f.fromArray(i.array,l*16),c.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[l])}return new d.Skeleton(a,c)})}loadAnimation(t){const e=this.json,n=this,s=e.animations[t],i=s.name?s.name:"animation_"+t,r=[],a=[],c=[],l=[],h=[];for(let u=0,f=s.channels.length;u<f;u++){const p=s.channels[u],g=s.samplers[p.sampler],_=p.target,A=_.node,T=s.parameters!==void 0?s.parameters[g.input]:g.input,w=s.parameters!==void 0?s.parameters[g.output]:g.output;_.node!==void 0&&(r.push(this.getDependency("node",A)),a.push(this.getDependency("accessor",T)),c.push(this.getDependency("accessor",w)),l.push(g),h.push(_))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){const f=u[0],p=u[1],g=u[2],_=u[3],A=u[4],T=[];for(let w=0,L=f.length;w<L;w++){const y=f[w],b=p[w],C=g[w],S=_[w],D=A[w];if(y===void 0)continue;y.updateMatrix&&y.updateMatrix();const v=n._createAnimationTracks(y,b,C,S,D);if(v)for(let j=0;j<v.length;j++)T.push(v[j])}return new d.AnimationClip(i,void 0,T)})}createNodeMesh(t){const e=this.json,n=this,s=e.nodes[t];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(i){const r=n._getNodeRef(n.meshCache,s.mesh,i);return s.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let c=0,l=s.weights.length;c<l;c++)a.morphTargetInfluences[c]=s.weights[c]}),r})}loadNode(t){const e=this.json,n=this,s=e.nodes[t],i=n._loadNodeShallow(t),r=[],a=s.children||[];for(let l=0,h=a.length;l<h;l++)r.push(n.getDependency("node",a[l]));const c=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([i,Promise.all(r),c]).then(function(l){const h=l[0],u=l[1],f=l[2];f!==null&&h.traverse(function(p){p.isSkinnedMesh&&p.bind(f,Ue)});for(let p=0,g=u.length;p<g;p++)h.add(u[p]);return h})}_loadNodeShallow(t){const e=this.json,n=this.extensions,s=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const i=e.nodes[t],r=i.name?s.createUniqueName(i.name):"",a=[],c=s._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(t)});return c&&a.push(c),i.camera!==void 0&&a.push(s.getDependency("camera",i.camera).then(function(l){return s._getNodeRef(s.cameraCache,i.camera,l)})),s._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(t)}).forEach(function(l){a.push(l)}),this.nodeCache[t]=Promise.all(a).then(function(l){let h;if(i.isBone===!0?h=new d.Bone:l.length>1?h=new d.Group:l.length===1?h=l[0]:h=new d.Object3D,h!==l[0])for(let u=0,f=l.length;u<f;u++)h.add(l[u]);if(i.name&&(h.userData.name=i.name,h.name=r),M(h,i),i.extensions&&I(n,h,i),i.matrix!==void 0){const u=new d.Matrix4;u.fromArray(i.matrix),h.applyMatrix4(u)}else i.translation!==void 0&&h.position.fromArray(i.translation),i.rotation!==void 0&&h.quaternion.fromArray(i.rotation),i.scale!==void 0&&h.scale.fromArray(i.scale);return s.associations.has(h)||s.associations.set(h,{}),s.associations.get(h).nodes=t,h}),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],s=this,i=new d.Group;n.name&&(i.name=s.createUniqueName(n.name)),M(i,n),n.extensions&&I(e,i,n);const r=n.nodes||[],a=[];for(let c=0,l=r.length;c<l;c++)a.push(s.getDependency("node",r[c]));return Promise.all(a).then(function(c){for(let h=0,u=c.length;h<u;h++)i.add(c[h]);const l=h=>{const u=new Map;for(const[f,p]of s.associations)(f instanceof d.Material||f instanceof d.Texture)&&u.set(f,p);return h.traverse(f=>{const p=s.associations.get(f);p!=null&&u.set(f,p)}),u};return s.associations=l(i),i})}_createAnimationTracks(t,e,n,s,i){const r=[],a=t.name?t.name:t.uuid,c=[];O[i.path]===O.weights?t.traverse(function(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}):c.push(a);let l;switch(O[i.path]){case O.weights:l=d.NumberKeyframeTrack;break;case O.rotation:l=d.QuaternionKeyframeTrack;break;case O.position:case O.scale:l=d.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:l=d.NumberKeyframeTrack;break;case 2:case 3:default:l=d.VectorKeyframeTrack;break}break}const h=s.interpolation!==void 0?De[s.interpolation]:d.InterpolateLinear,u=this._getArrayFromAccessor(n);for(let f=0,p=c.length;f<p;f++){const g=new l(c[f]+"."+O[i.path],e.array,u,h);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),r.push(g)}return r}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const n=q(e.constructor),s=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)s[i]=e[i]*n;e=s}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(n){const s=this instanceof d.QuaternionKeyframeTrack?Pe:ne;return new s(this.times,this.values,this.getValueSize()/3,n)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ke(o,t,e){const n=t.attributes,s=new d.Box3;if(n.POSITION!==void 0){const a=e.json.accessors[n.POSITION],c=a.min,l=a.max;if(c!==void 0&&l!==void 0){if(s.set(new d.Vector3(c[0],c[1],c[2]),new d.Vector3(l[0],l[1],l[2])),a.normalized){const h=q(P[a.componentType]);s.min.multiplyScalar(h),s.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=t.targets;if(i!==void 0){const a=new d.Vector3,c=new d.Vector3;for(let l=0,h=i.length;l<h;l++){const u=i[l];if(u.POSITION!==void 0){const f=e.json.accessors[u.POSITION],p=f.min,g=f.max;if(p!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(g[2]))),f.normalized){const _=q(P[f.componentType]);c.multiplyScalar(_)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(a)}o.boundingBox=s;const r=new d.Sphere;s.getCenter(r.center),r.radius=s.min.distanceTo(s.max)/2,o.boundingSphere=r}function te(o,t,e){const n=t.attributes,s=[];function i(r,a){return e.getDependency("accessor",r).then(function(c){o.setAttribute(a,c)})}for(const r in n){const a=$[r]||r.toLowerCase();a in o.attributes||s.push(i(n[r],a))}if(t.indices!==void 0&&!o.index){const r=e.getDependency("accessor",t.indices).then(function(a){o.setIndex(a)});s.push(r)}return d.ColorManagement.workingColorSpace!==d.LinearSRGBColorSpace&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${d.ColorManagement.workingColorSpace}" not supported.`),M(o,t),Ke(o,t,e),Promise.all(s).then(function(){return t.targets!==void 0?Fe(o,t.targets,e):o})}var Ve=Object.defineProperty,ze=Object.getOwnPropertyDescriptor,Xe=(o,t,e,n)=>{for(var s=n>1?void 0:n?ze(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&Ve(t,e,s),s};let F=class{constructor(){E(this,"workerPool",m.C(void 0,!0));E(this,"canvas");E(this,"worker");E(this,"thread")}init(o){this.worker=o.worker,this.thread=o.thread}};F=Xe([m.singleton()],F);var We=Object.defineProperty,$e=Object.getOwnPropertyDescriptor,qe=(o,t,e,n)=>{for(var s=n>1?void 0:n?$e(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&We(t,e,s),s},Ye=(o,t)=>(e,n)=>t(e,n,o);let Y=class extends m.ProxyEventHandlersBlueprint{constructor(t){super();E(this,"canvas");this._service=t}init(t){this.canvas=t;for(const e of m.PROXY_EVENT_LISTENERS){const n=e.startsWith("mouse")||e.startsWith("pointer")||e.startsWith("touch")?this.mouseEventHandler:e.startsWith("key")?this.keyEventHandler:e==="resize"?this.uiEventHandler:e==="wheel"?this.wheelEventHandler:this.preventDefaultHandler;this[`${e}$`]=m.fromEvent(e==="resize"?window:t,e).pipe(m.map(n.bind(this)),m.filter(s=>!(e==="keydown"&&!s))),this[`${e}$`].subscribe(s=>{var i,r;(r=(i=this._service.thread)==null?void 0:i[e])==null||r.call(i,s)})}}preventDefaultHandler(t){return t.preventDefault(),{type:t.type}}getScreenSizes(){return{width:this.canvas.width,height:this.canvas.height,windowWidth:(window==null?void 0:window.innerWidth)??0,windowHeight:(window==null?void 0:window.innerHeight)??0}}uiEventHandler(t){const e=this.canvas.getBoundingClientRect();return{...this.getScreenSizes(),type:t.type,top:e.top,left:e.left}}mouseEventHandler(t){return{...this.getScreenSizes(),...m.J(t,["ctrlKey","metaKey","shiftKey","button","pointerType","clientX","clientY","pageX","pageY"])}}touchEventHandler(t){const e=[],n={type:t.type,touches:e};for(let s=0;s<t.touches.length;++s){const i=t.touches[s];e.push({pageX:(i==null?void 0:i.pageX)??0,pageY:(i==null?void 0:i.pageY)??0})}return{...this.getScreenSizes(),...n}}wheelEventHandler(t){return t.preventDefault(),{...this.getScreenSizes(),...m.J(t,["deltaX","deltaY"])}}keyEventHandler(t){if(m.KEYBOARD_EVENT_CODES.includes(t.code))return t.preventDefault(),{...this.getScreenSizes(),...m.J(t,["ctrlKey","metaKey","shiftKey","keyCode"])}}};Y=qe([m.singleton(),Ye(0,m.inject(F))],Y);var Qe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Ze=(o,t,e,n)=>{for(var s=n>1?void 0:n?Je(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&Qe(t,e,s),s};let B=class{constructor(){E(this,"loadingManager",new d.LoadingManager);E(this,"loaders",{});E(this,"sources",[]);E(this,"loadedResources",{});E(this,"toLoadCount",0);E(this,"loadedCount",0)}get videoLoader(){return{load:(o,t)=>{const e=document.createElement("video");e.muted=!0,e.loop=!0,e.crossOrigin="anonymous",e.controls=!1,e.playsInline=!0,e.src=o,e.autoplay=!0;const n=async()=>{t(e),e.removeEventListener("canplaythrough",n)};e.addEventListener("canplaythrough",n)}}}_initLoaders(){this.loaders.dracoLoader=new ae(this.loadingManager),this.loaders.audioLoader=new d.AudioLoader(this.loadingManager),this.loaders.gltfLoader=new le(this.loadingManager),this.loaders.imageLoader=new d.ImageBitmapLoader(this.loadingManager),this.loaders.videoLoader=this.videoLoader}_initSources(o){this.sources=o,this.toLoadCount=this.sources.length,this.loadedCount=0}init(o=[]){this._initLoaders(),this._initSources(o)}setDracoDecoder(o){var t;this.loaders.dracoLoader&&(this.loaders.dracoLoader.setDecoderPath(o??"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),(t=this.loaders.gltfLoader)==null||t.setDRACOLoader(this.loaders.dracoLoader))}handleLoad({source:o,resource:t,toLoadCount:e,loadedCount:n}){t&&(this.loadedResources[o.name]=t,this.loadedCount=n,this.toLoadCount=e)}load(o){var e,n,s,i;const t=this.sources[0];if(t){o==null||o(t);for(const r of this.sources){if(this.loadedResources[r.name]||typeof r.path!="string")return;r.type==="gltf"&&((e=this.loaders.gltfLoader)==null||e.load(r.path,a=>o==null?void 0:o(r,a))),r.type==="audio"&&((n=this.loaders.audioLoader)==null||n.load(r.path,a=>{o==null||o(r,a)})),r.type==="image"&&((s=this.loaders.imageLoader)==null||s.load(r.path,a=>{o==null||o(r,a)})),r.type==="video"&&((i=this.loaders.videoLoader)==null||i.load(r.path,a=>o==null?void 0:o(r,a)))}}}};B=Ze([m.singleton()],B);var et=Object.defineProperty,tt=Object.getOwnPropertyDescriptor,st=(o,t,e,n)=>{for(var s=n>1?void 0:n?tt(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&et(t,e,s),s},nt=(o,t)=>(e,n)=>t(e,n,o);let H=class{constructor(o){E(this,"load$$",new m.Subject);E(this,"load$",this.load$$.pipe(m.map(o=>({...o,loadedCount:o.resource?this._service.loadedCount+1:this._service.loadedCount,toLoadCount:this._service.toLoadCount})),m.share()));E(this,"serializedLoad$",this.load$.pipe(m.map(o=>{var e,n,s;let t=o.resource;if((e=o==null?void 0:o.resource)!=null&&e.parser){const i=o.resource,r=i.scenes.map(a=>m.W(a));t={animations:(o==null?void 0:o.resource).animations.map(a=>a.toJSON()),cameras:i.cameras.map(a=>m.W(a)),parser:{json:i.parser.json},scene:r==null?void 0:r[0],scenes:r,userData:i.userData}}return((n=o==null?void 0:o.source)==null?void 0:n.type)==="audio"&&o.resource instanceof AudioBuffer&&(t={arrayBuffer:o.resource.getChannelData(0),length:o.resource.length,sampleRate:o.resource.sampleRate,duration:o.resource.duration}),((s=o==null?void 0:o.source)==null?void 0:s.type)==="video"&&o.resource instanceof HTMLVideoElement&&(t={...m.J(o.resource,["autoplay","baseURI","controls","crossOrigin","currentTime","defaultMuted","disablePictureInPicture","draggable","duration","ended","height","hidden","loop","muted","nodeName","nodeType","paused","playbackRate","playsInline","poster","preload","readyState","seeking","spellcheck","src","tabIndex","translate","videoHeight","videoWidth","volume","width"]),buffered:o.resource.buffered.length,error:o.resource.error?m.U(o.resource.error,[]):{},played:o.resource.played.length,seekable:o.resource.seekable.length,textTracks:o.resource.textTracks.length}),{...o,resource:t}}),m.share()));E(this,"loadCompleted$",this.load$.pipe(m.filter(o=>o.toLoadCount===o.loadedCount),m.map(()=>m.J(this._service,["loadedCount","loadedResources","toLoadCount"])),m.share()));this._service=o}};H=st([m.singleton(),nt(0,m.inject(B))],H);var rt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,ot=(o,t,e,n)=>{for(var s=n>1?void 0:n?it(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&rt(t,e,s),s},W=(o,t)=>(e,n)=>t(e,n,o);let G=class{constructor(o,t,e){E(this,"_subscriptions",[]);this._controller=o,this._service=t,this._props=e,this._subscriptions.push(this._controller.load$.subscribe(this._service.handleLoad.bind(this._service)))}_listenToLoad(o,t){this._controller.load$$.next({source:o,resource:t})}init(o=[]){this._service.init(o),this._service.setDracoDecoder(),[void 0,!0].includes(this._props.loadResourcesOnInit)&&this.load()}load(){this._service.load(this._listenToLoad.bind(this))}getLoadedResources(){return this._service.loadedResources}getLoaders(){return this._service.loaders}getSources(){return this._service.sources}getLoadedCount(){return this._service.loadedCount}getToLoadCount(){return this._service.toLoadCount}getLoad$(){return this._controller.load$}getLoadCompleted$(){return this._controller.loadCompleted$}setDracoDecoder(o){this._service.setDracoDecoder(o)}dispose(){this._controller.load$$.complete()}};G=ot([m.singleton(),W(0,m.inject(H)),W(1,m.inject(B)),W(2,m.inject(U))],G);m.instance.resolve(G);var at=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,lt=(o,t,e,n)=>{for(var s=n>1?void 0:n?ct(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(s=(n?r(t,e,s):r(s))||s);return n&&s&&at(t,e,s),s},N=(o,t)=>(e,n)=>t(e,n,o);exports.RegisterModule=class extends m.RegisterProxyEventHandlersBlueprint{constructor(e,n,s,i,r,a){super();E(this,"initialized",!1);this._service=e,this._controller=n,this._loaderController=s,this.props=i,this.loader=r,this.container=a,this.props.initOnConstruct&&this.init()}async _initCanvas(){try{if(this.props.canvas instanceof HTMLCanvasElement&&(this._service.canvas=this.props.canvas),typeof this.props.canvas=="string"){const e=document.querySelector(this.props.canvas);e instanceof HTMLCanvasElement&&(this._service.canvas=e)}this._service.canvas||(this._service.canvas=document.createElement("canvas"),this._service.canvas.dataset.reactive="true",document.body.appendChild(this._service.canvas))}catch(e){console.error(`🛑 Unable to initialize the canvas:
|
|
3
3
|
${e instanceof Error?e.message:"Something went wrong"}`)}}async _initService(){this._service.init({worker:this._service.worker,thread:this._service.thread})}async _initController(){var e,n;if(!this._service.canvas)throw new Error("Canvas element is not initialized.");this._controller.init(this._service.canvas),!(!this._service.thread||!this._service.worker)&&this.props.fullScreen&&((n=(e=this._service.thread)==null?void 0:e.resize)==null||n.call(e,{...this._controller.uiEventHandler({type:"resize"})}))}async _initWorkerThread(){if(!this._service.canvas)throw new Error("Canvas element is not initialized.");const e=this._service.canvas.transferControlToOffscreen();e.width=this._service.canvas.clientWidth,e.height=this._service.canvas.clientHeight;const[n,s]=await this._service.workerPool.run({payload:{path:this.props.location,subject:{...m.U(this.props,["canvas","location","onReady","loaderDataSources"]),canvas:e},transferSubject:[e]}});if(!n||s)throw new Error("Unable to retrieve the worker-thread info.");this._service.worker=n.worker,this._service.thread=n.thread}async _initObservableProxyEvents(){m.PROXY_EVENT_LISTENERS.forEach(e=>this[`${e}$`]=()=>{var n;return(n=this._controller)==null?void 0:n[`${e}$`]})}async _initLoader(){this.loader.init(this.props.loaderDataSources),this._loaderController.serializedLoad$.subscribe(e=>{var n,s;if(e.resource instanceof ArrayBuffer)return(n=this._service.worker)==null?void 0:n.postMessage(e.resource,[e.resource]);(s=this._service.worker)==null||s.postMessage({token:m.LOADER_SERIALIZED_LOAD_TOKEN,payload:e})})}isInitialized(){return this.initialized}async init(){var e,n;this.initialized||(await this._initCanvas(),await this._initWorkerThread(),await this._initService(),await this._initController(),await this._initObservableProxyEvents(),await this._initLoader(),(n=(e=this.props).onReady)==null||n.call(e,{module:this,container:this.container}))}canvas(){return this._service.canvas}thread(){return this._service.thread}worker(){return this._service.worker}workerPool(){return this._service.workerPool}async dispose(){var e;await this._service.workerPool.terminateAll(),((e=this._service.canvas)==null?void 0:e.dataset.reactive)==="true"&&(this._service.canvas.remove(),this._service.canvas=void 0),this.initialized=!1}};exports.RegisterModule=lt([m.scoped(m.Lifecycle.ContainerScoped),N(0,m.inject(F)),N(1,m.inject(Y)),N(2,m.inject(H)),N(3,m.inject(U)),N(4,m.inject(G)),N(5,m.inject(m.CONTAINER_TOKEN))],exports.RegisterModule);const ut=o=>{if(typeof(o==null?void 0:o.location)!="string"&&!((o==null?void 0:o.location)instanceof URL))throw new Error("Invalid register props detected. location path is required");const t=m.instance.createChildContainer();o.initOnConstruct=m.A(o.initOnConstruct)||!m.D(o.initOnConstruct)?!0:o.initOnConstruct,o.defaultCamera=o!=null&&o.defaultCamera&&o.defaultCamera in m.DefaultCameraType?o.defaultCamera:m.DefaultCameraType.PERSPECTIVE,o.withMiniCamera=m.A(o.withMiniCamera)||!m.D(o.withMiniCamera)?!1:o.withMiniCamera,o.startTimer=m.A(o.startTimer)||!m.D(o.startTimer)?!0:o.startTimer,o.fullScreen=m.A(o.fullScreen)||!m.D(o.fullScreen)?!0:o.fullScreen,o.onReady=m.Q(o.onReady)?o.onReady:void 0,t.register(m.CONTAINER_TOKEN,{useValue:t}),t.register(U,{useValue:o});const e=t.resolve(exports.RegisterModule);return e.initialized=!0,{container:t,module:e}};Object.defineProperty(exports,"AppModule",{enumerable:!0,get:()=>m.AppModule});exports.AppProxyEventHandlersBlueprint=m.AppProxyEventHandlersBlueprint;exports.CONTAINER_TOKEN=m.CONTAINER_TOKEN;exports.DefaultCameraType=m.DefaultCameraType;exports.KEYBOARD_EVENT_CODES=m.KEYBOARD_EVENT_CODES;exports.LOADER_SERIALIZED_LOAD_TOKEN=m.LOADER_SERIALIZED_LOAD_TOKEN;exports.PROXY_EVENT_LISTENERS=m.PROXY_EVENT_LISTENERS;exports.ProxyEventHandlersBlueprint=m.ProxyEventHandlersBlueprint;exports.ProxyEventObservablesBlueprint=m.ProxyEventObservablesBlueprint;exports.ProxyEventSubjectsBlueprint=m.ProxyEventSubjectsBlueprint;exports.RegisterProxyEventHandlersBlueprint=m.RegisterProxyEventHandlersBlueprint;exports.LaunchAppProps=oe;exports.RegisterPropsBlueprint=U;exports.register=ut;
|
package/dist/main.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var $e = Object.defineProperty;
|
|
2
2
|
var qe = (o, e, t) => e in o ? $e(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
3
|
var _ = (o, e, t) => qe(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { s as z, C as Ye, P as Qe, a as Me, f as Je, m as $, b as Ie, J as j, K as Ze, i as L, S as et, c as se, W as _e, U as Oe, d as Ne, e as tt, L as st, R as nt, g as rt, h as Pe, A as X, D as W, j as Re, Q as it } from "./app.module-
|
|
5
|
-
import { k as Zs, o as en, n as tn, l as sn } from "./app.module-
|
|
4
|
+
import { s as z, C as Ye, P as Qe, a as Me, f as Je, m as $, b as Ie, J as j, K as Ze, i as L, S as et, c as se, W as _e, U as Oe, d as Ne, e as tt, L as st, R as nt, g as rt, h as Pe, A as X, D as W, j as Re, Q as it } from "./app.module-DSL-GqOC.mjs";
|
|
5
|
+
import { k as Zs, o as en, n as tn, l as sn } from "./app.module-DSL-GqOC.mjs";
|
|
6
6
|
import { TrianglesDrawMode as ot, TriangleFanDrawMode as ue, TriangleStripDrawMode as De, Loader as ke, FileLoader as q, SRGBColorSpace as N, LinearSRGBColorSpace as S, BufferGeometry as Fe, BufferAttribute as K, Color as P, ColorManagement as de, LoaderUtils as V, SpotLight as at, PointLight as ct, DirectionalLight as lt, MeshBasicMaterial as B, MeshPhysicalMaterial as v, Vector2 as He, Matrix4 as Y, Vector3 as F, Quaternion as Ue, InstancedMesh as ut, InstancedBufferAttribute as dt, Object3D as Ge, TextureLoader as ht, ImageBitmapLoader as Be, InterleavedBuffer as ft, InterleavedBufferAttribute as pt, LinearFilter as he, LinearMipmapLinearFilter as je, RepeatWrapping as fe, NearestFilter as Ke, PointsMaterial as mt, Material as ne, LineBasicMaterial as gt, MeshStandardMaterial as Ve, DoubleSide as At, PropertyBinding as Tt, SkinnedMesh as _t, Mesh as Rt, LineSegments as Et, Line as wt, LineLoop as xt, Points as yt, Group as re, PerspectiveCamera as Lt, MathUtils as bt, OrthographicCamera as St, Skeleton as vt, AnimationClip as Ct, Bone as Mt, InterpolateLinear as ze, NearestMipmapNearestFilter as It, LinearMipmapNearestFilter as Ot, NearestMipmapLinearFilter as Nt, ClampToEdgeWrapping as Pt, MirroredRepeatWrapping as Dt, InterpolateDiscrete as kt, FrontSide as Ft, Texture as Ee, VectorKeyframeTrack as we, NumberKeyframeTrack as xe, QuaternionKeyframeTrack as ye, Box3 as Ht, Sphere as Ut, Interpolant as Gt, LoadingManager as Bt, AudioLoader as jt } from "three";
|
|
7
7
|
class Te {
|
|
8
8
|
constructor() {
|
package/dist/worker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./app.module-DtXUGy5w.js");var b=a.requireWorker();const o=a.getDefaultExportFromCjs(b),C=o.expose;o.registerSerializer;o.Transfer;const I=i=>{const r=a.instance.createChildContainer();r.register(a.CONTAINER_TOKEN,{useValue:r});const e=r.resolve(a.AppModule),d={container:r,module:e},c={};a.PROXY_EVENT_LISTENERS.forEach(t=>{var n,s;c[t]=(s=(n=e[t])==null?void 0:n.bind)==null?void 0:s.call(n,e)});const l=t=>{var g,u,E,f,m;if(!((g=t.data)!=null&&g.canvas)||e.getIsInitialized())return;const n=!!((u=t.data)!=null&&u.startTimer),s=!!((E=t.data)!=null&&E.withMiniCamera),S=!!((f=t.data)!=null&&f.fullScreen);e.init({...t.data,startTimer:n,withMiniCamera:s,fullScreen:S}),(m=i==null?void 0:i.onReady)==null||m.call(i,d),self==null||self.removeEventListener("message",l)};return self==null||self.addEventListener("message",l),C({...c,getProxyReceiver:e.getProxyReceiver.bind(e),getCanvas:e.getCanvas.bind(e),getIsInitialized:e.getIsInitialized.bind(e),getBeforeStep$:e.getBeforeStep$.bind(e),getStep$:e.getStep$.bind(e),dispose:e.dispose.bind(e)}),d};exports.launchApp=I;
|
package/dist/worker.mjs
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const e =
|
|
10
|
-
|
|
11
|
-
var a,
|
|
12
|
-
d[t] = (
|
|
1
|
+
import { r as x, p as C, d as I, h as S, k as b, a as h } from "./app.module-DSL-GqOC.mjs";
|
|
2
|
+
var v = x();
|
|
3
|
+
const s = /* @__PURE__ */ C(v), T = s.expose;
|
|
4
|
+
s.registerSerializer;
|
|
5
|
+
s.Transfer;
|
|
6
|
+
const N = (n) => {
|
|
7
|
+
const i = I.createChildContainer();
|
|
8
|
+
i.register(S, { useValue: i });
|
|
9
|
+
const e = i.resolve(b), o = { container: i, module: e }, d = {};
|
|
10
|
+
h.forEach((t) => {
|
|
11
|
+
var a, r;
|
|
12
|
+
d[t] = (r = (a = e[t]) == null ? void 0 : a.bind) == null ? void 0 : r.call(a, e);
|
|
13
13
|
});
|
|
14
14
|
const c = (t) => {
|
|
15
|
-
var l, E, f, m
|
|
16
|
-
if (!((l = t.data) != null && l.canvas) || e.
|
|
17
|
-
const a = !!((
|
|
15
|
+
var l, g, E, f, m;
|
|
16
|
+
if (!((l = t.data) != null && l.canvas) || e.getIsInitialized()) return;
|
|
17
|
+
const a = !!((g = t.data) != null && g.startTimer), r = !!((E = t.data) != null && E.withMiniCamera), u = !!((f = t.data) != null && f.fullScreen);
|
|
18
18
|
e.init({
|
|
19
19
|
...t.data,
|
|
20
20
|
startTimer: a,
|
|
21
|
-
withMiniCamera:
|
|
22
|
-
fullScreen:
|
|
23
|
-
}), (
|
|
21
|
+
withMiniCamera: r,
|
|
22
|
+
fullScreen: u
|
|
23
|
+
}), (m = n == null ? void 0 : n.onReady) == null || m.call(n, o), self == null || self.removeEventListener("message", c);
|
|
24
24
|
};
|
|
25
|
-
return self == null || self.addEventListener("message", c),
|
|
25
|
+
return self == null || self.addEventListener("message", c), T({
|
|
26
26
|
...d,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
getProxyReceiver: e.getProxyReceiver.bind(e),
|
|
28
|
+
getCanvas: e.getCanvas.bind(e),
|
|
29
|
+
getIsInitialized: e.getIsInitialized.bind(e),
|
|
30
|
+
getBeforeStep$: e.getBeforeStep$.bind(e),
|
|
31
|
+
getStep$: e.getStep$.bind(e),
|
|
32
|
+
dispose: e.dispose.bind(e)
|
|
31
33
|
}), o;
|
|
32
34
|
};
|
|
33
35
|
export {
|
|
34
|
-
|
|
36
|
+
N as launchApp
|
|
35
37
|
};
|