mapillary-js
Version:
A WebGL interactive street imagery library
20 lines (18 loc) • 1.09 MB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).mapillary={})}(this,(function(e){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,i)};function i(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}function n(e,t,i,n){return new(i||(i=Promise))((function(r,s){function a(e){try{h(n.next(e))}catch(e){s(e)}}function o(e){try{h(n.throw(e))}catch(e){s(e)}}function h(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}h((n=n.apply(e,t||[])).next())}))}function r(e,t){var i,n,r,s,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,o])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,s=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return a}function o(e,t){for(var i=0,n=t.length,r=e.length;i<n;i++,r++)e[r]=t[i];return e}function h(e){return this instanceof h?(this.v=e,this):new h(e)}function c(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=i.apply(e,t||[]),s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){r[e]&&(n[e]=function(t){return new Promise((function(i,n){s.push([e,t,i,n])>1||o(e,t)}))})}function o(e,t){try{(i=r[e](t)).value instanceof h?Promise.resolve(i.value.v).then(c,l):u(s[0][2],i)}catch(e){u(s[0][3],e)}var i}function c(e){o("next",e)}function l(e){o("throw",e)}function u(e,t){e(t),s.shift(),s.length&&o(s[0][0],s[0][1])}}function l(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=s(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,r){(function(e,t,i,n){Promise.resolve(n).then((function(t){e({value:t,done:i})}),t)})(n,r,(t=e[i](t)).done,t.value)}))}}}function u(e){return"function"==typeof e}function d(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var p=d((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function m(e,t){if(e){var i=e.indexOf(t);0<=i&&e.splice(i,1)}}var f=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._teardowns=null}return e.prototype.unsubscribe=function(){var e,t,i,n,r;if(!this.closed){this.closed=!0;var h=this._parentage;if(h)if(this._parentage=null,Array.isArray(h))try{for(var c=s(h),l=c.next();!l.done;l=c.next()){l.value.remove(this)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else h.remove(this);var d=this.initialTeardown;if(u(d))try{d()}catch(e){r=e instanceof p?e.errors:[e]}var m=this._teardowns;if(m){this._teardowns=null;try{for(var f=s(m),g=f.next();!g.done;g=f.next()){var _=g.value;try{v(_)}catch(e){r=null!=r?r:[],e instanceof p?r=o(o([],a(r)),a(e.errors)):r.push(e)}}}catch(e){i={error:e}}finally{try{g&&!g.done&&(n=f.return)&&n.call(f)}finally{if(i)throw i.error}}}if(r)throw new p(r)}},e.prototype.add=function(t){var i;if(t&&t!==this)if(this.closed)v(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._teardowns=null!==(i=this._teardowns)&&void 0!==i?i:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&m(t,e)},e.prototype.remove=function(t){var i=this._teardowns;i&&m(i,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),g=f.EMPTY;function _(e){return e instanceof f||e&&"closed"in e&&u(e.remove)&&u(e.add)&&u(e.unsubscribe)}function v(e){u(e)?e():e.unsubscribe()}var y={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},b={setTimeout:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=b.delegate;return((null==i?void 0:i.setTimeout)||setTimeout).apply(void 0,o([],a(e)))},clearTimeout:function(e){var t=b.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function x(e){b.setTimeout((function(){throw e}))}function w(){}var M=S("C",void 0,void 0);function S(e,t,i){return{kind:e,value:t,error:i}}var T=null;function C(e){if(y.useDeprecatedSynchronousErrorHandling){var t=!T;if(t&&(T={errorThrown:!1,error:null}),e(),t){var i=T,n=i.errorThrown,r=i.error;if(T=null,n)throw r}}else e()}var E=function(e){function t(t){var i=e.call(this)||this;return i.isStopped=!1,t?(i.destination=t,_(t)&&t.add(i)):i.destination=L,i}return i(t,e),t.create=function(e,t,i){return new A(e,t,i)},t.prototype.next=function(e){this.isStopped?P(function(e){return S("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?P(S("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?P(M,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(f),A=function(e){function t(t,i,n){var r,s=e.call(this)||this;if(u(t))r=t;else if(t){var a;r=t.next,i=t.error,n=t.complete,s&&y.useDeprecatedNextContext?(a=Object.create(t)).unsubscribe=function(){return s.unsubscribe()}:a=t,r=null==r?void 0:r.bind(a),i=null==i?void 0:i.bind(a),n=null==n?void 0:n.bind(a)}return s.destination={next:r?I(r):w,error:I(null!=i?i:R),complete:n?I(n):w},s}return i(t,e),t}(E);function I(e,t){return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];try{e.apply(void 0,o([],a(t)))}catch(e){x(e)}}}function R(e){throw e}function P(e,t){var i=y.onStoppedNotification;i&&b.setTimeout((function(){return i(e,t)}))}var L={closed:!0,next:w,error:R,complete:w},D="function"==typeof Symbol&&Symbol.observable||"@@observable";function N(e){return e}function $(e){return 0===e.length?N:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var k=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var i=new e;return i.source=this,i.operator=t,i},e.prototype.subscribe=function(e,t,i){var n,r=this,s=(n=e)&&n instanceof E||function(e){return e&&u(e.next)&&u(e.error)&&u(e.complete)}(n)&&_(n)?e:new A(e,t,i);return C((function(){var e=r,t=e.operator,i=e.source;s.add(t?t.call(s,i):i?r._subscribe(s):r._trySubscribe(s))})),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var i=this;return new(t=O(t))((function(t,n){var r;r=i.subscribe((function(t){try{e(t)}catch(e){n(e),null==r||r.unsubscribe()}}),n,t)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[D]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return $(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=O(e))((function(e,i){var n;t.subscribe((function(e){return n=e}),(function(e){return i(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function O(e){var t;return null!==(t=null!=e?e:y.Promise)&&void 0!==t?t:Promise}function z(e){return u(null==e?void 0:e.lift)}function F(e){return function(t){if(z(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}var B=function(e){function t(t,i,n,r,s){var a=e.call(this,t)||this;return a.onFinalize=s,a._next=i?function(e){try{i(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=r?function(e){try{r(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return i(t,e),t.prototype.unsubscribe=function(){var t,i=this.closed;e.prototype.unsubscribe.call(this),!i&&(null===(t=this.onFinalize)||void 0===t||t.call(this))},t}(E);function U(){return F((function(e,t){var i=null;e._refCount++;var n=new B(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)i=null;else{var n=e._connection,r=i;i=null,!n||r&&n!==r||n.unsubscribe(),t.unsubscribe()}}));e.subscribe(n),n.closed||(i=e.connect())}))}var V=function(e){function t(t,i){var n=e.call(this)||this;return n.source=t,n.subjectFactory=i,n._subject=null,n._refCount=0,n._connection=null,z(t)&&(n.lift=t.lift),n}return i(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new f;var i=this.getSubject();t.add(this.source.subscribe(new B(i,void 0,(function(){e._teardown(),i.complete()}),(function(t){e._teardown(),i.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=f.EMPTY)}return t},t.prototype.refCount=function(){return U()(this)},t}(k),H=d((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),j=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return i(t,e),t.prototype.lift=function(e){var t=new G(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new H},t.prototype.next=function(e){var t=this;C((function(){var i,n;if(t._throwIfClosed(),!t.isStopped){var r=t.observers.slice();try{for(var a=s(r),o=a.next();!o.done;o=a.next()){o.value.next(e)}}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}}}))},t.prototype.error=function(e){var t=this;C((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var i=t.observers;i.length;)i.shift().error(e)}}))},t.prototype.complete=function(){var e=this;C((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,i=t.hasError,n=t.isStopped,r=t.observers;return i||n?g:(r.push(e),new f((function(){return m(r,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,i=t.hasError,n=t.thrownError,r=t.isStopped;i?e.error(n):r&&e.complete()},t.prototype.asObservable=function(){var e=new k;return e.source=this,e},t.create=function(e,t){return new G(e,t)},t}(k),G=function(e){function t(t,i){var n=e.call(this)||this;return n.destination=t,n.source=i,n}return i(t,e),t.prototype.next=function(e){var t,i;null===(i=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===i||i.call(t,e)},t.prototype.error=function(e){var t,i;null===(i=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===i||i.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,i;return null!==(i=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==i?i:g},t}(j),W=function(e){function t(t){var i=e.call(this)||this;return i._value=t,i}return i(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var i=e.prototype._subscribe.call(this,t);return!i.closed&&t.next(this._value),i},t.prototype.getValue=function(){var e=this,t=e.hasError,i=e.thrownError,n=e._value;if(t)throw i;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(j),q={now:function(){return(q.delegate||Date).now()},delegate:void 0},X=function(e){function t(t,i,n){void 0===t&&(t=1/0),void 0===i&&(i=1/0),void 0===n&&(n=q);var r=e.call(this)||this;return r._bufferSize=t,r._windowTime=i,r._timestampProvider=n,r._buffer=[],r._infiniteTimeWindow=!0,r._infiniteTimeWindow=i===1/0,r._bufferSize=Math.max(1,t),r._windowTime=Math.max(1,i),r}return i(t,e),t.prototype.next=function(t){var i=this,n=i.isStopped,r=i._buffer,s=i._infiniteTimeWindow,a=i._timestampProvider,o=i._windowTime;n||(r.push(t),!s&&r.push(a.now()+o)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),i=this._infiniteTimeWindow,n=this._buffer.slice(),r=0;r<n.length&&!e.closed;r+=i?1:2)e.next(n[r]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,i=e._timestampProvider,n=e._buffer,r=e._infiniteTimeWindow,s=(r?1:2)*t;if(t<1/0&&s<n.length&&n.splice(0,n.length-s),!r){for(var a=i.now(),o=0,h=1;h<n.length&&n[h]<=a;h+=2)o=h;o&&n.splice(0,o+1)}},t}(j),Z=function(e){function t(t,i){return e.call(this)||this}return i(t,e),t.prototype.schedule=function(e,t){return this},t}(f),Y={setInterval:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Y.delegate;return((null==i?void 0:i.setInterval)||setInterval).apply(void 0,o([],a(e)))},clearInterval:function(e){var t=Y.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},J=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.scheduler=t,n.work=i,n.pending=!1,n}return i(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var i=this.id,n=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(n,i,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(n,this.id,t),this},t.prototype.requestAsyncId=function(e,t,i){return void 0===i&&(i=0),Y.setInterval(e.flush.bind(e,this),i)},t.prototype.recycleAsyncId=function(e,t,i){if(void 0===i&&(i=0),null!=i&&this.delay===i&&!1===this.pending)return t;Y.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(e,t);if(i)return i;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var i,n=!1;try{this.work(e)}catch(e){n=!0,i=!!e&&e||new Error(e)}if(n)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,i=this.scheduler,n=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,m(n,this),null!=t&&(this.id=this.recycleAsyncId(i,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Z),K=function(){function e(t,i){void 0===i&&(i=e.now),this.schedulerActionCtor=t,this.now=i}return e.prototype.schedule=function(e,t,i){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(i,t)},e.now=q.now,e}(),Q=new(function(e){function t(t,i){void 0===i&&(i=K.now);var n=e.call(this,t,i)||this;return n.actions=[],n._active=!1,n._scheduled=void 0,n}return i(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var i;this._active=!0;do{if(i=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,i){for(;e=t.shift();)e.unsubscribe();throw i}}},t}(K))(J),ee=Q,te=new k((function(e){return e.complete()}));function ie(e){return e?function(e){return new k((function(t){return e.schedule((function(){return t.complete()}))}))}(e):te}function ne(e,t){return new k((function(i){var n=0;return t.schedule((function(){n===e.length?i.complete():(i.next(e[n++]),i.closed||this.schedule())}))}))}var re=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function se(e){return u(null==e?void 0:e.then)}var ae="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function oe(e,t,i,n){void 0===n&&(n=0);var r=t.schedule((function(){try{i.call(this)}catch(t){e.error(t)}}),n);return e.add(r),r}function he(e,t){if(!e)throw new Error("Iterable cannot be null");return new k((function(i){var n=new f;return n.add(t.schedule((function(){var r=e[Symbol.asyncIterator]();n.add(t.schedule((function(){var e=this;r.next().then((function(t){t.done?i.complete():(i.next(t.value),e.schedule())}))})))}))),n}))}function ce(e){return u(e[D])}function le(e){return u(null==e?void 0:e[ae])}function ue(e){return Symbol.asyncIterator&&u(null==e?void 0:e[Symbol.asyncIterator])}function de(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function pe(e){return c(this,arguments,(function(){var t,i,n;return r(this,(function(r){switch(r.label){case 0:t=e.getReader(),r.label=1;case 1:r.trys.push([1,,9,10]),r.label=2;case 2:return[4,h(t.read())];case 3:return i=r.sent(),n=i.value,i.done?[4,h(void 0)]:[3,5];case 4:return[2,r.sent()];case 5:return[4,h(n)];case 6:return[4,r.sent()];case 7:return r.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function me(e){return u(null==e?void 0:e.getReader)}function fe(e,t){if(null!=e){if(ce(e))return function(e,t){return new k((function(i){var n=new f;return n.add(t.schedule((function(){var r=e[D]();n.add(r.subscribe({next:function(e){n.add(t.schedule((function(){return i.next(e)})))},error:function(e){n.add(t.schedule((function(){return i.error(e)})))},complete:function(){n.add(t.schedule((function(){return i.complete()})))}}))}))),n}))}(e,t);if(re(e))return ne(e,t);if(se(e))return function(e,t){return new k((function(i){return t.schedule((function(){return e.then((function(e){i.add(t.schedule((function(){i.next(e),i.add(t.schedule((function(){return i.complete()})))})))}),(function(e){i.add(t.schedule((function(){return i.error(e)})))}))}))}))}(e,t);if(ue(e))return he(e,t);if(le(e))return function(e,t){return new k((function(i){var n;return i.add(t.schedule((function(){n=e[ae](),oe(i,t,(function(){var e=n.next(),t=e.value;e.done?i.complete():(i.next(t),this.schedule())}))}))),function(){return u(null==n?void 0:n.return)&&n.return()}}))}(e,t);if(me(e))return function(e,t){return he(pe(e),t)}(e,t)}throw de(e)}function ge(e,t){return t?fe(e,t):_e(e)}function _e(e){if(e instanceof k)return e;if(null!=e){if(ce(e))return n=e,new k((function(e){var t=n[D]();if(u(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(re(e))return ve(e);if(se(e))return i=e,new k((function(e){i.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,x)}));if(ue(e))return ye(e);if(le(e))return t=e,new k((function(e){var i,n;try{for(var r=s(t),a=r.next();!a.done;a=r.next()){var o=a.value;if(e.next(o),e.closed)return}}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}e.complete()}));if(me(e))return ye(pe(e))}var t,i,n;throw de(e)}function ve(e){return new k((function(t){for(var i=0;i<e.length&&!t.closed;i++)t.next(e[i]);t.complete()}))}function ye(e){return new k((function(t){(function(e,t){var i,s,a,o;return n(this,void 0,void 0,(function(){var n,h;return r(this,(function(r){switch(r.label){case 0:r.trys.push([0,5,6,11]),i=l(e),r.label=1;case 1:return[4,i.next()];case 2:if((s=r.sent()).done)return[3,4];if(n=s.value,t.next(n),t.closed)return[2];r.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return h=r.sent(),a={error:h},[3,11];case 6:return r.trys.push([6,,9,10]),s&&!s.done&&(o=i.return)?[4,o.call(i)]:[3,8];case 7:r.sent(),r.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function be(e,t){return t?ne(e,t):ve(e)}function xe(e){return e&&u(e.schedule)}function we(e){return e[e.length-1]}function Me(e){return u(we(e))?e.pop():void 0}function Se(e){return xe(we(e))?e.pop():void 0}function Te(e,t){return"number"==typeof we(e)?e.pop():t}function Ce(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Se(e);return i?ne(e,i):be(e)}function Ee(e,t){var i=u(e)?e:function(){return e},n=function(e){return e.error(i())};return new k(t?function(e){return t.schedule(n,0,e)}:n)}var Ae=d((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ie(e){return e instanceof Date&&!isNaN(e)}var Re=d((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function Pe(e,t){var i=Ie(e)?{first:e}:"number"==typeof e?{each:e}:e,n=i.first,r=i.each,s=i.with,a=void 0===s?Le:s,o=i.scheduler,h=void 0===o?null!=t?t:Q:o,c=i.meta,l=void 0===c?null:c;if(null==n&&null==r)throw new TypeError("No timeout provided.");return F((function(e,t){var i,s,o=null,c=0,u=function(e){s=oe(t,h,(function(){i.unsubscribe(),_e(a({meta:l,lastValue:o,seen:c})).subscribe(t)}),e)};i=e.subscribe(new B(t,(function(e){null==s||s.unsubscribe(),c++,t.next(o=e),r>0&&u(r)}),void 0,void 0,(function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),o=null}))),u(null!=n?"number"==typeof n?n:+n-h.now():r)}))}function Le(e){throw new Re(e)}function De(e,t){return F((function(i,n){var r=0;i.subscribe(new B(n,(function(i){n.next(e.call(t,i,r++))})))}))}var Ne=Array.isArray;function $e(e){return De((function(t){return function(e,t){return Ne(t)?e.apply(void 0,o([],a(t))):e(t)}(e,t)}))}var ke=Array.isArray,Oe=Object.getPrototypeOf,ze=Object.prototype,Fe=Object.keys;function Be(e){if(1===e.length){var t=e[0];if(ke(t))return{args:t,keys:null};if((n=t)&&"object"==typeof n&&Oe(n)===ze){var i=Fe(t);return{args:i.map((function(e){return t[e]})),keys:i}}}var n;return{args:e,keys:null}}function Ue(e,t){return e.reduce((function(e,i,n){return e[i]=t[n],e}),{})}function Ve(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Se(e),n=Me(e),r=Be(e),s=r.args,a=r.keys;if(0===s.length)return ge([],i);var o=new k(He(s,i,a?function(e){return Ue(a,e)}:N));return n?o.pipe($e(n)):o}function He(e,t,i){return void 0===i&&(i=N),function(n){je(t,(function(){for(var r=e.length,s=new Array(r),a=r,o=r,h=function(r){je(t,(function(){var h=ge(e[r],t),c=!1;h.subscribe(new B(n,(function(e){s[r]=e,c||(c=!0,o--),o||n.next(i(s.slice()))}),(function(){--a||n.complete()})))}),n)},c=0;c<r;c++)h(c)}),n)}}function je(e,t,i){e?i.add(e.schedule(t)):t()}function Ge(e,t,i,n,r,s,a,o){var h=[],c=0,l=0,u=!1,d=function(){!u||h.length||c||t.complete()},p=function(e){return c<n?m(e):h.push(e)},m=function(e){s&&t.next(e),c++;var o=!1;_e(i(e,l++)).subscribe(new B(t,(function(e){null==r||r(e),s?p(e):t.next(e)}),(function(){o=!0}),void 0,(function(){if(o)try{c--;for(var e=function(){var e=h.shift();a?t.add(a.schedule((function(){return m(e)}))):m(e)};h.length&&c<n;)e();d()}catch(e){t.error(e)}})))};return e.subscribe(new B(t,p,(function(){u=!0,d()}))),function(){null==o||o()}}function We(e,t,i){return void 0===i&&(i=1/0),u(t)?We((function(i,n){return De((function(e,r){return t(i,e,n,r)}))(_e(e(i,n)))}),i):("number"==typeof t&&(i=t),F((function(t,n){return Ge(t,n,e,i)})))}function qe(e){return void 0===e&&(e=1/0),We(N,e)}function Xe(){return qe(1)}function Ze(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Xe()(be(e,Se(e)))}var Ye=["addListener","removeListener"],Je=["addEventListener","removeEventListener"],Ke=["on","off"];function Qe(e,t,i,n){if(u(i)&&(n=i,i=void 0),n)return Qe(e,t,i).pipe($e(n));var r=a(function(e){return u(e.addEventListener)&&u(e.removeEventListener)}(e)?Je.map((function(n){return function(r){return e[n](t,r,i)}})):function(e){return u(e.addListener)&&u(e.removeListener)}(e)?Ye.map(et(e,t)):function(e){return u(e.on)&&u(e.off)}(e)?Ke.map(et(e,t)):[],2),s=r[0],o=r[1];if(!s&&re(e))return We((function(e){return Qe(e,t,i)}))(be(e));if(!s)throw new TypeError("Invalid event target");return new k((function(e){var t=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return e.next(1<t.length?t:t[0])};return s(t),function(){return o(t)}}))}function et(e,t){return function(i){return function(n){return e[i](t,n)}}}function tt(e,t,i){void 0===e&&(e=0),void 0===i&&(i=ee);var n=-1;return null!=t&&(xe(t)?i=t:n=t),new k((function(t){var r=Ie(e)?+e-i.now():e;r<0&&(r=0);var s=0;return i.schedule((function(){t.closed||(t.next(s++),0<=n?this.schedule(void 0,n):t.complete())}),r)}))}function it(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Se(e),n=Te(e,1/0),r=e;return r.length?1===r.length?_e(r[0]):qe(n)(be(r,i)):te}var nt=Array.isArray;function rt(e){return 1===e.length&&nt(e[0])?e[0]:e}function st(e,t){return F((function(i,n){var r=0;i.subscribe(new B(n,(function(i){return e.call(t,i,r++)&&n.next(i)})))}))}function at(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Me(e),n=rt(e);return n.length?new k((function(e){var t=n.map((function(){return[]})),r=n.map((function(){return!1}));e.add((function(){t=r=null}));for(var s=function(s){_e(n[s]).subscribe(new B(e,(function(n){if(t[s].push(n),t.every((function(e){return e.length}))){var h=t.map((function(e){return e.shift()}));e.next(i?i.apply(void 0,o([],a(h))):h),t.some((function(e,t){return!e.length&&r[t]}))&&e.complete()}}),(function(){r[s]=!0,!t[s].length&&e.complete()})))},h=0;!e.closed&&h<n.length;h++)s(h);return function(){t=r=null}})):te}function ot(e,t){return void 0===t&&(t=ee),i=function(){return tt(e,t)},F((function(e,t){var n=!1,r=null,s=null,a=!1,o=function(){if(null==s||s.unsubscribe(),s=null,n){n=!1;var e=r;r=null,t.next(e)}a&&t.complete()},h=function(){s=null,a&&t.complete()};e.subscribe(new B(t,(function(e){n=!0,r=e,s||_e(i(e)).subscribe(s=new B(t,o,h))}),(function(){a=!0,(!n||!s||s.closed)&&t.complete()})))}));var i}function ht(e,t){return void 0===t&&(t=null),t=null!=t?t:e,F((function(i,n){var r=[],a=0;i.subscribe(new B(n,(function(i){var o,h,c,l,u=null;a++%t==0&&r.push([]);try{for(var d=s(r),p=d.next();!p.done;p=d.next()){(_=p.value).push(i),e<=_.length&&(u=null!=u?u:[]).push(_)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(h=d.return)&&h.call(d)}finally{if(o)throw o.error}}if(u)try{for(var f=s(u),g=f.next();!g.done;g=f.next()){var _=g.value;m(r,_),n.next(_)}}catch(e){c={error:e}}finally{try{g&&!g.done&&(l=f.return)&&l.call(f)}finally{if(c)throw c.error}}}),(function(){var e,t;try{for(var i=s(r),a=i.next();!a.done;a=i.next()){var o=a.value;n.next(o)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}n.complete()}),void 0,(function(){r=null})))}))}function ct(e){return F((function(t,i){var n,r=null,s=!1;r=t.subscribe(new B(i,void 0,void 0,(function(a){n=_e(e(a,ct(e)(t))),r?(r.unsubscribe(),r=null,n.subscribe(i)):s=!0}))),s&&(r.unsubscribe(),r=null,n.subscribe(i))}))}function lt(e,t,i,n,r){return function(s,a){var o=i,h=t,c=0;s.subscribe(new B(a,(function(t){var i=c++;h=o?e(h,t,i):(o=!0,t),n&&a.next(h)}),r&&function(){o&&a.next(h),a.complete()}))}}function ut(e,t){return F(lt(e,t,arguments.length>=2,!1,!0))}function dt(e,t){return u(t)?We(e,t,1):We(e,1)}var pt={connector:function(){return new j}};function mt(e,t){void 0===t&&(t=pt);var i=t.connector;return F((function(t,n){var r,s=i();ge(e((r=s,new k((function(e){return r.subscribe(e)}))))).subscribe(n),n.add(t.subscribe(s))}))}function ft(e,t){return void 0===t&&(t=Q),F((function(i,n){var r=null,s=null,a=null,o=function(){if(r){r.unsubscribe(),r=null;var e=s;s=null,n.next(e)}};function h(){var i=a+e,s=t.now();if(s<i)return r=this.schedule(void 0,i-s),void n.add(r);o()}i.subscribe(new B(n,(function(i){s=i,a=t.now(),r||(r=t.schedule(h,e),n.add(r))}),(function(){o(),n.complete()}),void 0,(function(){s=r=null})))}))}function gt(e){return F((function(t,i){var n=!1;t.subscribe(new B(i,(function(e){n=!0,i.next(e)}),(function(){n||i.next(e),i.complete()})))}))}function _t(e){return e<=0?function(){return te}:F((function(t,i){var n=0;t.subscribe(new B(i,(function(t){++n<=e&&(i.next(t),e<=n&&i.complete())})))}))}function vt(e,t){return void 0===t&&(t=N),e=null!=e?e:yt,F((function(i,n){var r,s=!0;i.subscribe(new B(n,(function(i){var a=t(i);!s&&e(r,a)||(s=!1,r=a,n.next(i))})))}))}function yt(e,t){return e===t}function bt(e){return void 0===e&&(e=xt),F((function(t,i){var n=!1;t.subscribe(new B(i,(function(e){n=!0,i.next(e)}),(function(){return n?i.complete():i.error(e())})))}))}function xt(){return new Ae}function wt(e,t,i){return void 0===t&&(t=1/0),t=(t||0)<1?1/0:t,F((function(n,r){return Ge(n,r,e,t,void 0,!0,i)}))}function Mt(e){return F((function(t,i){try{t.subscribe(i)}finally{i.add(e)}}))}function St(e,t){var i=arguments.length>=2;return function(n){return n.pipe(e?st((function(t,i){return e(t,i,n)})):N,_t(1),i?gt(t):bt((function(){return new Ae})))}}function Tt(e){return e<=0?function(){return te}:F((function(t,i){var n=[];t.subscribe(new B(i,(function(t){n.push(t),e<n.length&&n.shift()}),(function(){var e,t;try{for(var r=s(n),a=r.next();!a.done;a=r.next()){var o=a.value;i.next(o)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.complete()}),void 0,(function(){n=null})))}))}function Ct(e,t){var i=arguments.length>=2;return function(n){return n.pipe(e?st((function(t,i){return e(t,i,n)})):N,Tt(1),i?gt(t):bt((function(){return new Ae})))}}function Et(e,t){var i=u(e)?e:function(){return e};return u(t)?mt(t,{connector:i}):function(e){return new V(e,i)}}function At(){return F((function(e,t){var i,n=!1;e.subscribe(new B(t,(function(e){var r=i;i=e,n&&t.next([r,e]),n=!0})))}))}function It(e){return e?function(t){return mt(e)(t)}:function(e){return Et(new j)(e)}}function Rt(e,t,i,n){i&&!u(i)&&(n=i);var r=u(i)?i:void 0;return function(i){return Et(new X(e,t,n),r)(i)}}function Pt(e){var t;void 0===e&&(e=1/0);var i=(t=e&&"object"==typeof e?e:{count:e}).count,n=void 0===i?1/0:i,r=t.delay,s=t.resetOnSuccess,a=void 0!==s&&s;return n<=0?N:F((function(e,t){var i,s=0,o=function(){var h=!1;i=e.subscribe(new B(t,(function(e){a&&(s=0),t.next(e)}),void 0,(function(e){if(s++<n){var a=function(){i?(i.unsubscribe(),i=null,o()):h=!0};if(null!=r){var c="number"==typeof r?tt(r):_e(r(e,s)),l=new B(t,(function(){l.unsubscribe(),a()}),(function(){t.complete()}));c.subscribe(l)}else a()}else t.error(e)}))),h&&(i.unsubscribe(),i=null,o())};o()}))}function Lt(e,t){return F(lt(e,t,arguments.length>=2,!0))}function Dt(e){void 0===e&&(e={});var t=e.connector,i=void 0===t?function(){return new j}:t,n=e.resetOnError,r=void 0===n||n,s=e.resetOnComplete,a=void 0===s||s,o=e.resetOnRefCountZero,h=void 0===o||o;return function(e){var t=null,n=null,s=null,o=0,c=!1,l=!1,u=function(){null==n||n.unsubscribe(),n=null},d=function(){u(),t=s=null,c=l=!1},p=function(){var e=t;d(),null==e||e.unsubscribe()};return F((function(e,m){o++,l||c||u();var f=s=null!=s?s:i();m.add((function(){0!==--o||l||c||(n=Nt(p,h))})),f.subscribe(m),t||(t=new A({next:function(e){return f.next(e)},error:function(e){l=!0,u(),n=Nt(d,r,e),f.error(e)},complete:function(){c=!0,u(),n=Nt(d,a),f.complete()}}),ge(e).subscribe(t))}))(e)}}function Nt(e,t){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];return!0===t?(e(),null):!1===t?null:t.apply(void 0,o([],a(i))).pipe(_t(1)).subscribe((function(){return e()}))}function $t(e){return st((function(t,i){return e<=i}))}function kt(e){return F((function(t,i){var n=!1,r=0;t.subscribe(new B(i,(function(t){return(n||(n=!e(t,r++)))&&i.next(t)})))}))}function Ot(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Se(e);return F((function(t,n){(i?Ze(e,t,i):Ze(e,t)).subscribe(n)}))}function zt(e,t){return F((function(i,n){var r=null,s=0,a=!1,o=function(){return a&&!r&&n.complete()};i.subscribe(new B(n,(function(i){null==r||r.unsubscribe();var a=0,h=s++;_e(e(i,h)).subscribe(r=new B(n,(function(e){return n.next(t?t(i,e,h,a++):e)}),(function(){r=null,o()})))}),(function(){a=!0,o()})))}))}function Ft(e){return F((function(t,i){_e(e).subscribe(new B(i,(function(){return i.complete()}),w)),!i.closed&&t.subscribe(i)}))}function Bt(e,t){return void 0===t&&(t=!1),F((function(i,n){var r=0;i.subscribe(new B(n,(function(i){var s=e(i,r++);(s||t)&&n.next(i),!s&&n.complete()})))}))}function Ut(e,t,i){var n=u(e)||t||i?{next:e,error:t,complete:i}:e;return n?F((function(e,t){var i;null===(i=n.subscribe)||void 0===i||i.call(n);var r=!0;e.subscribe(new B(t,(function(e){var i;null===(i=n.next)||void 0===i||i.call(n,e),t.next(e)}),(function(){var e;r=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()}),(function(e){var i;r=!1,null===(i=n.error)||void 0===i||i.call(n,e),t.error(e)}),(function(){var e,t;r&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)})))})):N}function Vt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Me(e);return F((function(t,n){for(var r=e.length,s=new Array(r),h=e.map((function(){return!1})),c=!1,l=function(t){_e(e[t]).subscribe(new B(n,(function(e){s[t]=e,c||h[t]||(h[t]=!0,(c=h.every(N))&&(h=null))}),w))},u=0;u<r;u++)l(u);t.subscribe(new B(n,(function(e){if(c){var t=o([e],a(s));n.next(i?i.apply(void 0,o([],a(t))):t)}})))}))}class Ht{createFilter(e){return new Function("node","return "+this._compile(e)+";")}_compile(e){if(null==e||e.length<=1)return"true";const t=e[0];return"("+("=="===t?this._compileComparisonOp("===",e[1],e[2],!1):"!="===t?this._compileComparisonOp("!==",e[1],e[2],!1):">"===t||">="===t||"<"===t||"<="===t?this._compileComparisonOp(t,e[1],e[2],!0):"in"===t?this._compileInOp(e[1],e.slice(2)):"!in"===t?this._compileNegation(this._compileInOp(e[1],e.slice(2))):"all"===t?this._compileLogicalOp(e.slice(1),"&&"):"true")+")"}_compare(e,t){return e<t?-1:e>t?1:0}_compileComparisonOp(e,t,i,n){const r=this._compilePropertyReference(t),s=JSON.stringify(i);return(n?"typeof "+r+"===typeof "+s+"&&":"")+r+e+s}_compileInOp(e,t){const i=this._compare;return JSON.stringify(t.sort(i))+".indexOf("+this._compilePropertyReference(e)+")!==-1"}_compileLogicalOp(e,t){const i=this._compile.bind(this);return e.map(i).join(t)}_compileNegation(e){return"!("+e+")"}_compilePropertyReference(e){return"node["+JSON.stringify(e)+"]"}}
/**
* @license
* Copyright 2010-2021 Three.js Authors
* SPDX-License-Identifier: MIT
*/const jt=100,Gt=301,Wt=302,qt=306,Xt=1e3,Zt=1001,Yt=1002,Jt=1003,Kt=1006,Qt=1008,ei=1009,ti=1012,ii=1014,ni=1015,ri=1016,si=1020,ai=1022,oi=1023,hi=1026,ci=1027,li=2300,ui=2301,di=2302,pi=2400,mi=2401,fi=2402,gi=2500,_i=3e3,vi=3001,yi=3007,bi=3002,xi=7680,wi=35044,Mi=35048,Si="300 es";class Ti{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const i=this._listeners[e];if(void 0!==i){const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const i=t.slice(0);for(let t=0,n=i.length;t<n;t++)i[t].call(this,e);e.target=null}}}let Ci=1234567;const Ei=Math.PI/180,Ai=180/Math.PI,Ii=[];for(let e=0;e<256;e++)Ii[e]=(e<16?"0":"")+e.toString(16);const Ri="undefined"!=typeof crypto&&"randomUUID"in crypto;function Pi(){if(Ri)return crypto.randomUUID().toUpperCase();const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Ii[255&e]+Ii[e>>8&255]+Ii[e>>16&255]+Ii[e>>24&255]+"-"+Ii[255&t]+Ii[t>>8&255]+"-"+Ii[t>>16&15|64]+Ii[t>>24&255]+"-"+Ii[63&i|128]+Ii[i>>8&255]+"-"+Ii[i>>16&255]+Ii[i>>24&255]+Ii[255&n]+Ii[n>>8&255]+Ii[n>>16&255]+Ii[n>>24&255]).toUpperCase()}function Li(e,t,i){return Math.max(t,Math.min(i,e))}function Di(e,t){return(e%t+t)%t}function Ni(e,t,i){return(1-i)*e+i*t}function $i(e){return 0==(e&e-1)&&0!==e}function ki(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Oi=Object.freeze({__proto__:null,DEG2RAD:Ei,RAD2DEG:Ai,generateUUID:Pi,clamp:Li,euclideanModulo:Di,mapLinear:function(e,t,i,n,r){return n+(e-t)*(r-n)/(i-t)},inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},lerp:Ni,damp:function(e,t,i,n){return Ni(e,t,1-Math.exp(-i*n))},pingpong:function(e,t=1){return t-Math.abs(Di(e,2*t)-t)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){return void 0!==e&&(Ci=e%2147483647),Ci=16807*Ci%2147483647,(Ci-1)/2147483646},degToRad:function(e){return e*Ei},radToDeg:function(e){return e*Ai},isPowerOfTwo:$i,ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:ki,setQuaternionFromProperEuler:function(e,t,i,n,r){const s=Math.cos,a=Math.sin,o=s(i/2),h=a(i/2),c=s((t+n)/2),l=a((t+n)/2),u=s((t-n)/2),d=a((t-n)/2),p=s((n-t)/2),m=a((n-t)/2);switch(r){case"XYX":e.set(o*l,h*u,h*d,o*c);break;case"YZY":e.set(h*d,o*l,h*u,o*c);break;case"ZXZ":e.set(h*u,h*d,o*l,o*c);break;case"XZX":e.set(o*l,h*m,h*p,o*c);break;case"YXY":e.set(h*p,o*l,h*m,o*c);break;case"ZYZ":e.set(h*m,h*p,o*l,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}});class zi{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*i-s*n+e.x,this.y=r*n+s*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}zi.prototype.isVector2=!0;class Fi{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,n,r,s,a,o,h){const c=this.elements;return c[0]=e,c[1]=n,c[2]=a,c[3]=t,c[4]=r,c[5]=o,c[6]=i,c[7]=s,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,n=t.elements,r=this.elements,s=i[0],a=i[3],o=i[6],h=i[1],c=i[4],l=i[7],u=i[2],d=i[5],p=i[8],m=n[0],f=n[3],g=n[6],_=n[1],v=n[4],y=n[7],b=n[2],x=n[5],w=n[8];return r[0]=s*m+a*_+o*b,r[3]=s*f+a*v+o*x,r[6]=s*g+a*y+o*w,r[1]=h*m+c*_+l*b,r[4]=h*f+c*v+l*x,r[7]=h*g+c*y+l*w,r[2]=u*m+d*_+p*b,r[5]=u*f+d*v+p*x,r[8]=u*g+d*y+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=e[6],h=e[7],c=e[8];return t*s*c-t*a*h-i*r*c+i*a*o+n*r*h-n*s*o}invert(){const e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=e[6],h=e[7],c=e[8],l=c*s-a*h,u=a*o-c*r,d=h*r-s*o,p=t*l+i*u+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=l*m,e[1]=(n*h-c*i)*m,e[2]=(a*i-n*s)*m,e[3]=u*m,e[4]=(c*t-n*o)*m,e[5]=(n*r-a*t)*m,e[6]=d*m,e[7]=(i*o-h*t)*m,e[8]=(s*t-i*r)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,r,s,a){const o=Math.cos(r),h=Math.sin(r);return this.set(i*o,i*h,-i*(o*s+h*a)+s+e,-n*h,n*o,-n*(-h*s+o*a)+a+t,0,0,1),this}scale(e,t){const i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){const t=Math.cos(e),i=Math.sin(e),n=this.elements,r=n[0],s=n[3],a=n[6],o=n[1],h=n[4],c=n[7];return n[0]=t*r+i*o,n[3]=t*s+i*h,n[6]=t*a+i*c,n[1]=-i*r+t*o,n[4]=-i*s+t*h,n[7]=-i*a+t*c,this}translate(e,t){const i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){const t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}function Bi(e){if(0===e.length)return-1/0;let t=e[0];for(let i=1,n=e.length;i<n;++i)e[i]>t&&(t=e[i]);return t}function Ui(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Vi(e,t=0){let i=3735928559^t,n=1103547991^t;for(let t,r=0;r<e.length;r++)t=e.charCodeAt(r),i=Math.imul(i^t,2654435761),n=Math.imul(n^t,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&n)+(i>>>0)}let Hi;Fi.prototype.isMatrix3=!0;class ji{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Hi&&(Hi=Ui("canvas")),Hi.width=e.width,Hi.height=e.height;const i=Hi.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Hi}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}}let Gi=0;class Wi extends Ti{constructor(e=Wi.DEFAULT_IMAGE,t=Wi.DEFAULT_MAPPING,i=1001,n=1001,r=1006,s=1008,a=1023,o=1009,h=1,c=3e3){super(),Object.defineProperty(this,"id",{value:Gi++}),this.uuid=Pi(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=s,this.anisotropy=h,this.format=a,this.internalFormat=null,this.type=o,this.offset=new zi(0,0),this.repeat=new zi(1,1),this.center=new zi(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Fi,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.se