@mapxus/mapxus-visual-jp 2.0.0-rc.2 → 2.0.0-rc.3
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/mapxus-visual.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Available under the MIT License
|
|
6
6
|
* ECMAScript compliant, uniform cross-browser split method
|
|
7
7
|
*/
|
|
8
|
-
var ht=function(e){var t,i=String.prototype.split,r=/()??/.exec("")[1]===e;return t=function(t,n,o){if("[object RegExp]"!==Object.prototype.toString.call(n))return i.call(t,n,o);var a,s,c,h,u=[],l=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),p=0;n=new RegExp(n.source,l+"g");for(t+="",r||(a=new RegExp("^"+n.source+"$(?!\\s)",l)),o=o===e?-1>>>0:o>>>0;(s=n.exec(t))&&!((c=s.index+s[0].length)>p&&(u.push(t.slice(p,s.index)),!r&&s.length>1&&s[0].replace(a,function(){for(var t=1;t<arguments.length-2;t++)arguments[t]===e&&(s[t]=e)}),s.length>1&&s.index<t.length&&Array.prototype.push.apply(u,s.slice(1)),h=s[0].length,p=c,u.length>=o));)n.lastIndex===s.index&&n.lastIndex++;return p===t.length?!h&&n.test("")||u.push(""):u.push(t.slice(p)),u.length>o?u.slice(0,o):u},t}(),ut=ht,lt=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,pt=/^\.|#/,dt=function(e,t){if(!e)return"DIV";var i,r,n,o,a=!t.hasOwnProperty("id"),s=ut(e,lt),c=null;pt.test(s[1])&&(c="DIV");for(o=0;o<s.length;o++)(r=s[o])&&(n=r.charAt(0),c?"."===n?(i=i||[]).push(r.substring(1,r.length)):"#"===n&&a&&(t.id=r.substring(1,r.length)):c=r);i&&(t.className&&i.push(t.className),t.className=i.join(" "));return t.namespace?c:c.toUpperCase()};var ft=mt;function mt(e){if(!(this instanceof mt))return new mt(e);this.value=e}mt.prototype.hook=function(e,t){e[t]!==this.value&&(e[t]=this.value)};var gt="undefined"!=typeof window?window:void 0!==u?u:{};var vt=function(e,t){if(e in gt)return gt[e];return gt[e]=t,t},_t=function(e,t,i){var r="__INDIVIDUAL_ONE_VERSION_"+e,n=vt(r+"_ENFORCE_SINGLETON",t);if(n!==t)throw new Error("Can only have one copy of "+e+".\nYou already have version "+n+" installed.\nThis means you cannot install version "+t);return vt(r,i)};_t("ev-store","7");var yt="__EV_STORE_KEY@7";var bt=function(e){var t=e[yt];t||(t=e[yt]={});return t},xt=wt;function wt(e){if(!(this instanceof wt))return new wt(e);this.value=e}wt.prototype.hook=function(e,t){bt(e)[t.substr(3)]=this.value},wt.prototype.unhook=function(e,t){bt(e)[t.substr(3)]=void 0};var At=C,St=it,Mt=st,Et=L,Tt=k,Ct=B,It=q,Pt=F,Rt=dt,Nt=ft,Ot=xt;function Lt(e,t,i,r){if("string"==typeof e)t.push(new Mt(e));else if("number"==typeof e)t.push(new Mt(String(e)));else if(Dt(e))t.push(e);else{if(!At(e)){if(null==e)return;throw o={foreignObject:e,parentVnode:{tagName:i,properties:r}},(a=new Error).type="virtual-hyperscript.unexpected.virtual-element",a.message="Unexpected virtual child passed to h().\nExpected a VNode / Vthunk / VWidget / string but:\ngot:\n"+kt(o.foreignObject)+".\nThe parent vnode is:\n"+kt(o.parentVnode),a.foreignObject=o.foreignObject,a.parentVnode=o.parentVnode,a}for(var n=0;n<e.length;n++)Lt(e[n],t,i,r)}var o,a}function Dt(e){return Et(e)||Tt(e)||Ct(e)||Pt(e)}function kt(e){try{return JSON.stringify(e,null," ")}catch(t){return String(e)}}var Bt={diff:me,patch:Xe,h:function(e,t,i){var r,n,o,a,s=[];!i&&(c=t,"string"==typeof c||At(c)||Dt(c))&&(i=t,n={});var c;r=Rt(e,n=n||t||{}),n.hasOwnProperty("key")&&(o=n.key,n.key=void 0);n.hasOwnProperty("namespace")&&(a=n.namespace,n.namespace=void 0);"INPUT"!==r||a||!n.hasOwnProperty("value")||void 0===n.value||It(n.value)||(n.value=Nt(n.value));(function(e){for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];if(It(i))continue;"ev-"===t.substr(0,3)&&(e[t]=Ot(i))}})(n),null!=i&&Lt(i,s,r,n);return new St(r,n,s,o,a)},create:Pe,VNode:it,VText:st},Ft=function(e,t){return Ft=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},Ft(e,t)};function jt(e,t){function i(){this.constructor=e}Ft(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function zt(e){return"function"==typeof e}var Vt=!1,$t={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack;Vt=e},get useDeprecatedSynchronousErrorHandling(){return Vt}};function Ut(e){setTimeout(function(){throw e})}var Gt={closed:!0,next:function(e){},error:function(e){if($t.useDeprecatedSynchronousErrorHandling)throw e;Ut(e)},complete:function(){}},Ht=Array.isArray||function(e){return e&&"number"==typeof e.length};function qt(e){return null!==e&&"object"==typeof e}function Wt(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}Wt.prototype=Object.create(Error.prototype);var Qt=Wt,Yt=function(){function e(e){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,e&&(this._unsubscribe=e)}return e.prototype.unsubscribe=function(){var e,t=!1;if(!this.closed){var i=this,r=i._parent,n=i._parents,o=i._unsubscribe,a=i._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var s=-1,c=n?n.length:0;r;)r.remove(this),r=++s<c&&n[s]||null;if(zt(o))try{o.call(this)}catch(i){t=!0,e=i instanceof Qt?Xt(i.errors):[i]}if(Ht(a))for(s=-1,c=a.length;++s<c;){var h=a[s];if(qt(h))try{h.unsubscribe()}catch(i){t=!0,e=e||[],i instanceof Qt?e=e.concat(Xt(i.errors)):e.push(i)}}if(t)throw new Qt(e)}},e.prototype.add=function(t){var i=t;switch(typeof t){case"function":i=new e(t);case"object":if(i===this||i.closed||"function"!=typeof i.unsubscribe)return i;if(this.closed)return i.unsubscribe(),i;if(!(i instanceof e)){var r=i;(i=new e)._subscriptions=[r]}break;default:if(!t)return e.EMPTY;throw new Error("unrecognized teardown "+t+" added to Subscription.")}if(i._addParent(this)){var n=this._subscriptions;n?n.push(i):this._subscriptions=[i]}return i},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var i=t.indexOf(e);-1!==i&&t.splice(i,1)}},e.prototype._addParent=function(e){var t=this._parent,i=this._parents;return t!==e&&(t?i?-1===i.indexOf(e)&&(i.push(e),!0):(this._parents=[e],!0):(this._parent=e,!0))},e.EMPTY=function(e){return e.closed=!0,e}(new e),e}();function Xt(e){return e.reduce(function(e,t){return e.concat(t instanceof Qt?t.errors:t)},[])}var Zt="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),Kt=function(e){function t(i,r,n){var o=e.call(this)||this;switch(o.syncErrorValue=null,o.syncErrorThrown=!1,o.syncErrorThrowable=!1,o.isStopped=!1,arguments.length){case 0:o.destination=Gt;break;case 1:if(!i){o.destination=Gt;break}if("object"==typeof i){i instanceof t?(o.syncErrorThrowable=i.syncErrorThrowable,o.destination=i,i.add(o)):(o.syncErrorThrowable=!0,o.destination=new Jt(o,i));break}default:o.syncErrorThrowable=!0,o.destination=new Jt(o,i,r,n)}return o}return jt(t,e),t.prototype[Zt]=function(){return this},t.create=function(e,i,r){var n=new t(e,i,r);return n.syncErrorThrowable=!1,n},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this))},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var e=this._parent,t=this._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=e,this._parents=t,this},t}(Yt),Jt=function(e){function t(t,i,r,n){var o,a=e.call(this)||this;a._parentSubscriber=t;var s=a;return zt(i)?o=i:i&&(o=i.next,r=i.error,n=i.complete,i!==Gt&&(zt((s=Object.create(i)).unsubscribe)&&a.add(s.unsubscribe.bind(s)),s.unsubscribe=a.unsubscribe.bind(a))),a._context=s,a._next=o,a._error=r,a._complete=n,a}return jt(t,e),t.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;$t.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},t.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,i=$t.useDeprecatedSynchronousErrorHandling;if(this._error)i&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)i?(t.syncErrorValue=e,t.syncErrorThrown=!0):Ut(e),this.unsubscribe();else{if(this.unsubscribe(),i)throw e;Ut(e)}}},t.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var i=function(){return e._complete.call(e._context)};$t.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,i),this.unsubscribe()):(this.__tryOrUnsub(i),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),$t.useDeprecatedSynchronousErrorHandling)throw e;Ut(e)}},t.prototype.__tryOrSetError=function(e,t,i){if(!$t.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,i)}catch(t){return $t.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(Ut(t),!0)}return!1},t.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},t}(Kt);var ei="function"==typeof Symbol&&Symbol.observable||"@@observable";function ti(){}var ii=function(){function e(e){this._isScalar=!1,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 r=this.operator,n=function(e,t,i){if(e){if(e instanceof Kt)return e;if(e[Zt])return e[Zt]()}return e||t||i?new Kt(e,t,i):new Kt(Gt)}(e,t,i);if(r?n.add(r.call(n,this.source)):n.add(this.source||$t.useDeprecatedSynchronousErrorHandling&&!n.syncErrorThrowable?this._subscribe(n):this._trySubscribe(n)),$t.useDeprecatedSynchronousErrorHandling&&n.syncErrorThrowable&&(n.syncErrorThrowable=!1,n.syncErrorThrown))throw n.syncErrorValue;return n},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){$t.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),!function(e){for(;e;){var t=e,i=t.closed,r=t.destination,n=t.isStopped;if(i||n)return!1;e=r&&r instanceof Kt?r:null}return!0}(e)?console.warn(t):e.error(t)}},e.prototype.forEach=function(e,t){var i=this;return new(t=ri(t))(function(t,r){var n;n=i.subscribe(function(t){try{e(t)}catch(e){r(e),n&&n.unsubscribe()}},r,t)})},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[ei]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return 0===t.length?this:((e=t)?1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}:ti)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ri(e))(function(e,i){var r;t.subscribe(function(e){return r=e},function(e){return i(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function ri(e){if(e||(e=Promise),!e)throw new Error("no Promise impl found");return e}function ni(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}ni.prototype=Object.create(Error.prototype);var oi=ni,ai=function(e){function t(t,i){var r=e.call(this)||this;return r.subject=t,r.subscriber=i,r.closed=!1,r}return jt(t,e),t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var i=t.indexOf(this.subscriber);-1!==i&&t.splice(i,1)}}},t}(Yt),si=function(e){function t(t){var i=e.call(this,t)||this;return i.destination=t,i}return jt(t,e),t}(Kt),ci=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return jt(t,e),t.prototype[Zt]=function(){return new si(this)},t.prototype.lift=function(e){var t=new hi(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new oi;if(!this.isStopped)for(var t=this.observers,i=t.length,r=t.slice(),n=0;n<i;n++)r[n].next(e)},t.prototype.error=function(e){if(this.closed)throw new oi;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,i=t.length,r=t.slice(),n=0;n<i;n++)r[n].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new oi;this.isStopped=!0;for(var e=this.observers,t=e.length,i=e.slice(),r=0;r<t;r++)i[r].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(this.closed)throw new oi;return e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){if(this.closed)throw new oi;return this.hasError?(e.error(this.thrownError),Yt.EMPTY):this.isStopped?(e.complete(),Yt.EMPTY):(this.observers.push(e),new ai(this,e))},t.prototype.asObservable=function(){var e=new ii;return e.source=this,e},t.create=function(e,t){return new hi(e,t)},t}(ii),hi=function(e){function t(t,i){var r=e.call(this)||this;return r.destination=t,r.source=i,r}return jt(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):Yt.EMPTY},t}(ci);function ui(){return function(e){return e.lift(new li(e))}}var li=function(){function e(e){this.connectable=e}return e.prototype.call=function(e,t){var i=this.connectable;i._refCount++;var r=new pi(e,i),n=t.subscribe(r);return r.closed||(r.connection=i.connect()),n},e}(),pi=function(e){function t(t,i){var r=e.call(this,t)||this;return r.connectable=i,r}return jt(t,e),t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._refCount;if(t<=0)this.connection=null;else if(e._refCount=t-1,t>1)this.connection=null;else{var i=this.connection,r=e._connection;this.connection=null,!r||i&&r!==i||r.unsubscribe()}}else this.connection=null},t}(Kt),di=function(e){function t(t,i){var r=e.call(this)||this;return r.source=t,r.subjectFactory=i,r._refCount=0,r._isComplete=!1,r}return jt(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.connect=function(){var e=this._connection;return e||(this._isComplete=!1,(e=this._connection=new Yt).add(this.source.subscribe(new mi(this.getSubject(),this))),e.closed?(this._connection=null,e=Yt.EMPTY):this._connection=e),e},t.prototype.refCount=function(){return ui()(this)},t}(ii).prototype,fi={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:di._subscribe},_isComplete:{value:di._isComplete,writable:!0},getSubject:{value:di.getSubject},connect:{value:di.connect},refCount:{value:di.refCount}},mi=function(e){function t(t,i){var r=e.call(this,t)||this;return r.connectable=i,r}return jt(t,e),t.prototype._error=function(t){this._unsubscribe(),e.prototype._error.call(this,t)},t.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._connection;e._refCount=0,e._subject=null,e._connection=null,t&&t.unsubscribe()}},t}(si),gi=function(e){function t(t){var i=e.call(this)||this;return i._value=t,i}return jt(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var i=e.prototype._subscribe.call(this,t);return i&&!i.closed&&t.next(this._value),i},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new oi;return this._value},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(ci),vi=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.scheduler=t,r.work=i,r.pending=!1,r}return jt(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,r=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(r,i,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,i){return void 0===i&&(i=0),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;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=!1,r=void 0;try{this.work(e)}catch(e){i=!0,r=!!e&&e||new Error(e)}if(i)return this.unsubscribe(),r},t.prototype._unsubscribe=function(){var e=this.id,t=this.scheduler,i=t.actions,r=i.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&i.splice(r,1),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null},t}(function(e){function t(t,i){return e.call(this)||this}return jt(t,e),t.prototype.schedule=function(e,t){return this},t}(Yt)),_i=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.scheduler=t,r.work=i,r}return jt(t,e),t.prototype.schedule=function(t,i){return void 0===i&&(i=0),i>0?e.prototype.schedule.call(this,t,i):(this.delay=i,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,i){return i>0||this.closed?e.prototype.execute.call(this,t,i):this._execute(t,i)},t.prototype.requestAsyncId=function(t,i,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?e.prototype.requestAsyncId.call(this,t,i,r):t.flush(this)},t}(vi),yi=function(){function e(t,i){void 0===i&&(i=e.now),this.SchedulerAction=t,this.now=i}return e.prototype.schedule=function(e,t,i){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(i,t)},e.now=function(){return Date.now()},e}(),bi=function(e){function t(i,r){void 0===r&&(r=yi.now);var n=e.call(this,i,function(){return t.delegate&&t.delegate!==n?t.delegate.now():r()})||this;return n.actions=[],n.active=!1,n.scheduled=void 0,n}return jt(t,e),t.prototype.schedule=function(i,r,n){return void 0===r&&(r=0),t.delegate&&t.delegate!==this?t.delegate.schedule(i,r,n):e.prototype.schedule.call(this,i,r,n)},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}(yi),xi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return jt(t,e),t}(bi),wi=new xi(_i),Ai=new ii(function(e){return e.complete()});function Si(e){return e?function(e){return new ii(function(t){return e.schedule(function(){return t.complete()})})}(e):Ai}function Mi(e){return e&&"function"==typeof e.schedule}var Ei=function(e){return function(t){for(var i=0,r=e.length;i<r&&!t.closed;i++)t.next(e[i]);t.closed||t.complete()}};function Ti(e,t){return new ii(t?function(i){var r=new Yt,n=0;return r.add(t.schedule(function(){n!==e.length?(i.next(e[n++]),i.closed||r.add(this.schedule())):i.complete()})),r}:Ei(e))}function Ci(e){var t=new ii(function(t){t.next(e),t.complete()});return t._isScalar=!0,t.value=e,t}function Ii(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[e.length-1];switch(Mi(i)?e.pop():i=void 0,e.length){case 0:return Si(i);case 1:return i?Ti(e,i):Ci(e[0]);default:return Ti(e,i)}}function Pi(e,t){return new ii(t?function(i){return t.schedule(Ri,0,{error:e,subscriber:i})}:function(t){return t.error(e)})}function Ri(e){var t=e.error;e.subscriber.error(t)}var Ni=function(){function e(e,t,i){this.kind=e,this.value=t,this.error=i,this.hasValue="N"===e}return e.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}},e.prototype.do=function(e,t,i){switch(this.kind){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return i&&i()}},e.prototype.accept=function(e,t,i){return e&&"function"==typeof e.next?this.observe(e):this.do(e,t,i)},e.prototype.toObservable=function(){switch(this.kind){case"N":return Ii(this.value);case"E":return Pi(this.error);case"C":return Si()}throw new Error("unexpected notification kind value")},e.createNext=function(t){return void 0!==t?new e("N",t):e.undefinedValueNotification},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e.undefinedValueNotification=new e("N",void 0),e}(),Oi=function(e){function t(t,i,r){void 0===r&&(r=0);var n=e.call(this,t)||this;return n.scheduler=i,n.delay=r,n}return jt(t,e),t.dispatch=function(e){var t=e.notification,i=e.destination;t.observe(i),this.unsubscribe()},t.prototype.scheduleMessage=function(e){this.destination.add(this.scheduler.schedule(t.dispatch,this.delay,new Li(e,this.destination)))},t.prototype._next=function(e){this.scheduleMessage(Ni.createNext(e))},t.prototype._error=function(e){this.scheduleMessage(Ni.createError(e)),this.unsubscribe()},t.prototype._complete=function(){this.scheduleMessage(Ni.createComplete()),this.unsubscribe()},t}(Kt),Li=function(){return function(e,t){this.notification=e,this.destination=t}}(),Di=function(e){function t(t,i,r){void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===i&&(i=Number.POSITIVE_INFINITY);var n=e.call(this)||this;return n.scheduler=r,n._events=[],n._infiniteTimeWindow=!1,n._bufferSize=t<1?1:t,n._windowTime=i<1?1:i,i===Number.POSITIVE_INFINITY?(n._infiniteTimeWindow=!0,n.next=n.nextInfiniteTimeWindow):n.next=n.nextTimeWindow,n}return jt(t,e),t.prototype.nextInfiniteTimeWindow=function(t){var i=this._events;i.push(t),i.length>this._bufferSize&&i.shift(),e.prototype.next.call(this,t)},t.prototype.nextTimeWindow=function(t){this._events.push(new ki(this._getNow(),t)),this._trimBufferThenGetEvents(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){var t,i=this._infiniteTimeWindow,r=i?this._events:this._trimBufferThenGetEvents(),n=this.scheduler,o=r.length;if(this.closed)throw new oi;if(this.isStopped||this.hasError?t=Yt.EMPTY:(this.observers.push(e),t=new ai(this,e)),n&&e.add(e=new Oi(e,n)),i)for(var a=0;a<o&&!e.closed;a++)e.next(r[a]);else for(a=0;a<o&&!e.closed;a++)e.next(r[a].value);return this.hasError?e.error(this.thrownError):this.isStopped&&e.complete(),t},t.prototype._getNow=function(){return(this.scheduler||wi).now()},t.prototype._trimBufferThenGetEvents=function(){for(var e=this._getNow(),t=this._bufferSize,i=this._windowTime,r=this._events,n=r.length,o=0;o<n&&!(e-r[o].time<i);)o++;return n>t&&(o=Math.max(o,n-t)),o>0&&r.splice(0,o),r},t}(ci),ki=function(){return function(e,t){this.time=e,this.value=t}}(),Bi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.value=null,t.hasNext=!1,t.hasCompleted=!1,t}return jt(t,e),t.prototype._subscribe=function(t){return this.hasError?(t.error(this.thrownError),Yt.EMPTY):this.hasCompleted&&this.hasNext?(t.next(this.value),t.complete(),Yt.EMPTY):e.prototype._subscribe.call(this,t)},t.prototype.next=function(e){this.hasCompleted||(this.value=e,this.hasNext=!0)},t.prototype.error=function(t){this.hasCompleted||e.prototype.error.call(this,t)},t.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&e.prototype.next.call(this,this.value),e.prototype.complete.call(this)},t}(ci),Fi=new bi(vi);function ji(e){return e}function zi(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}zi.prototype=Object.create(Error.prototype);var Vi=zi;function $i(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}$i.prototype=Object.create(Error.prototype);var Ui=$i;function Gi(e,t){return function(i){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return i.lift(new Hi(e,t))}}var Hi=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new qi(e,this.project,this.thisArg))},e}(),qi=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.project=i,n.count=0,n.thisArg=r||n,n}return jt(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(Kt),Wi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return jt(t,e),t.prototype.notifyNext=function(e,t,i,r,n){this.destination.next(t)},t.prototype.notifyError=function(e,t){this.destination.error(e)},t.prototype.notifyComplete=function(e){this.destination.complete()},t}(Kt),Qi=function(e){function t(t,i,r){var n=e.call(this)||this;return n.parent=t,n.outerValue=i,n.outerIndex=r,n.index=0,n}return jt(t,e),t.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},t.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},t}(Kt),Yi=function(e){return function(t){return e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,Ut),t}};function Xi(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var Zi=Xi(),Ki=function(e){return function(t){for(var i=e[Zi]();;){var r=i.next();if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof i.return&&t.add(function(){i.return&&i.return()}),t}},Ji=function(e){return function(t){var i=e[ei]();if("function"!=typeof i.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return i.subscribe(t)}},er=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function tr(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}var ir=function(e){if(e instanceof ii)return function(t){return e._isScalar?(t.next(e.value),void t.complete()):e.subscribe(t)};if(e&&"function"==typeof e[ei])return Ji(e);if(er(e))return Ei(e);if(tr(e))return Yi(e);if(e&&"function"==typeof e[Zi])return Ki(e);var t=qt(e)?"an invalid object":"'"+e+"'";throw new TypeError("You provided "+t+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")};function rr(e,t,i,r,n){if(void 0===n&&(n=new Qi(e,i,r)),!n.closed)return ir(t)(n)}var nr={};function or(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=null,r=null;return Mi(e[e.length-1])&&(r=e.pop()),"function"==typeof e[e.length-1]&&(i=e.pop()),1===e.length&&Ht(e[0])&&(e=e[0]),Ti(e,r).lift(new ar(i))}var ar=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new sr(e,this.resultSelector))},e}(),sr=function(e){function t(t,i){var r=e.call(this,t)||this;return r.resultSelector=i,r.active=0,r.values=[],r.observables=[],r}return jt(t,e),t.prototype._next=function(e){this.values.push(nr),this.observables.push(e)},t.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{this.active=t,this.toRespond=t;for(var i=0;i<t;i++){var r=e[i];this.add(rr(this,r,r,i))}}},t.prototype.notifyComplete=function(e){0==(this.active-=1)&&this.destination.complete()},t.prototype.notifyNext=function(e,t,i,r,n){var o=this.values,a=o[i],s=this.toRespond?a===nr?--this.toRespond:this.toRespond:0;o[i]=t,0===s&&(this.resultSelector?this._tryResultSelector(o):this.destination.next(o.slice()))},t.prototype._tryResultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(Wi);function cr(e,t){if(!t)return e instanceof ii?e:new ii(ir(e));if(null!=e){if(function(e){return e&&"function"==typeof e[ei]}(e))return function(e,t){return new ii(t?function(i){var r=new Yt;return r.add(t.schedule(function(){var n=e[ei]();r.add(n.subscribe({next:function(e){r.add(t.schedule(function(){return i.next(e)}))},error:function(e){r.add(t.schedule(function(){return i.error(e)}))},complete:function(){r.add(t.schedule(function(){return i.complete()}))}}))})),r}:Ji(e))}(e,t);if(tr(e))return function(e,t){return new ii(t?function(i){var r=new Yt;return r.add(t.schedule(function(){return e.then(function(e){r.add(t.schedule(function(){i.next(e),r.add(t.schedule(function(){return i.complete()}))}))},function(e){r.add(t.schedule(function(){return i.error(e)}))})})),r}:Yi(e))}(e,t);if(er(e))return Ti(e,t);if(function(e){return e&&"function"==typeof e[Zi]}(e)||"string"==typeof e)return function(e,t){if(!e)throw new Error("Iterable cannot be null");return new ii(t?function(i){var r,n=new Yt;return n.add(function(){r&&"function"==typeof r.return&&r.return()}),n.add(t.schedule(function(){r=e[Zi](),n.add(t.schedule(function(){if(!i.closed){var e,t;try{var n=r.next();e=n.value,t=n.done}catch(e){return void i.error(e)}t?i.complete():(i.next(e),this.schedule())}}))})),n}:Ki(e))}(e,t)}throw new TypeError((null!==e&&typeof e||e)+" is not observable")}function hr(e,t,i){return void 0===i&&(i=Number.POSITIVE_INFINITY),"function"==typeof t?function(r){return r.pipe(hr(function(i,r){return cr(e(i,r)).pipe(Gi(function(e,n){return t(i,e,r,n)}))},i))}:("number"==typeof t&&(i=t),function(t){return t.lift(new ur(e,i))})}var ur=function(){function e(e,t){void 0===t&&(t=Number.POSITIVE_INFINITY),this.project=e,this.concurrent=t}return e.prototype.call=function(e,t){return t.subscribe(new lr(e,this.project,this.concurrent))},e}(),lr=function(e){function t(t,i,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var n=e.call(this,t)||this;return n.project=i,n.concurrent=r,n.hasCompleted=!1,n.buffer=[],n.active=0,n.index=0,n}return jt(t,e),t.prototype._next=function(e){this.active<this.concurrent?this._tryNext(e):this.buffer.push(e)},t.prototype._tryNext=function(e){var t,i=this.index++;try{t=this.project(e,i)}catch(e){return void this.destination.error(e)}this.active++,this._innerSub(t,e,i)},t.prototype._innerSub=function(e,t,i){var r=new Qi(this,void 0,void 0);this.destination.add(r),rr(this,e,t,i,r)},t.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},t.prototype.notifyNext=function(e,t,i,r,n){this.destination.next(t)},t.prototype.notifyComplete=function(e){var t=this.buffer;this.remove(e),this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},t}(Wi);function pr(e){return void 0===e&&(e=Number.POSITIVE_INFINITY),hr(ji,e)}function dr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return pr(1)(Ii.apply(void 0,e))}function fr(e,t,i,r){return zt(i)&&(r=i,i=void 0),r?fr(e,t,i).pipe(Gi(function(e){return Ht(e)?r.apply(void 0,e):r(e)})):new ii(function(r){mr(e,t,function(e){arguments.length>1?r.next(Array.prototype.slice.call(arguments)):r.next(e)},r,i)})}function mr(e,t,i,r,n){var o;if(function(e){return e&&"function"==typeof e.addEventListener&&"function"==typeof e.removeEventListener}(e)){var a=e;e.addEventListener(t,i,n),o=function(){return a.removeEventListener(t,i,n)}}else if(function(e){return e&&"function"==typeof e.on&&"function"==typeof e.off}(e)){var s=e;e.on(t,i),o=function(){return s.off(t,i)}}else if(function(e){return e&&"function"==typeof e.addListener&&"function"==typeof e.removeListener}(e)){var c=e;e.addListener(t,i),o=function(){return c.removeListener(t,i)}}else{if(!e||!e.length)throw new TypeError("Invalid event target");for(var h=0,u=e.length;h<u;h++)mr(e[h],t,i,r,n)}r.add(o)}function gr(e){return!Ht(e)&&e-parseFloat(e)+1>=0}function vr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Number.POSITIVE_INFINITY,r=null,n=e[e.length-1];return Mi(n)?(r=e.pop(),e.length>1&&"number"==typeof e[e.length-1]&&(i=e.pop())):"number"==typeof n&&(i=e.pop()),null===r&&1===e.length&&e[0]instanceof ii?e[0]:pr(i)(Ti(e,r))}function _r(e){var t=e.index,i=e.period,r=e.subscriber;if(r.next(t),!r.closed){if(-1===i)return r.complete();e.index=t+1,this.schedule(e,i)}}function yr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[e.length-1];return"function"==typeof i&&e.pop(),Ti(e,void 0).lift(new xr(i))}var br,xr=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new wr(e,this.resultSelector))},e}(),wr=function(e){function t(t,i,r){void 0===r&&(r=Object.create(null));var n=e.call(this,t)||this;return n.iterators=[],n.active=0,n.resultSelector="function"==typeof i?i:null,n.values=r,n}return jt(t,e),t.prototype._next=function(e){var t=this.iterators;Ht(e)?t.push(new Sr(e)):"function"==typeof e[Zi]?t.push(new Ar(e[Zi]())):t.push(new Mr(this.destination,this,e))},t.prototype._complete=function(){var e=this.iterators,t=e.length;if(this.unsubscribe(),0!==t){this.active=t;for(var i=0;i<t;i++){var r=e[i];if(r.stillUnsubscribed)this.destination.add(r.subscribe(r,i));else this.active--}}else this.destination.complete()},t.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},t.prototype.checkIterators=function(){for(var e=this.iterators,t=e.length,i=this.destination,r=0;r<t;r++){if("function"==typeof(a=e[r]).hasValue&&!a.hasValue())return}var n=!1,o=[];for(r=0;r<t;r++){var a,s=(a=e[r]).next();if(a.hasCompleted()&&(n=!0),s.done)return void i.complete();o.push(s.value)}this.resultSelector?this._tryresultSelector(o):i.next(o),n&&i.complete()},t.prototype._tryresultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(Kt),Ar=function(){function e(e){this.iterator=e,this.nextResult=e.next()}return e.prototype.hasValue=function(){return!0},e.prototype.next=function(){var e=this.nextResult;return this.nextResult=this.iterator.next(),e},e.prototype.hasCompleted=function(){var e=this.nextResult;return e&&e.done},e}(),Sr=function(){function e(e){this.array=e,this.index=0,this.length=0,this.length=e.length}return e.prototype[Zi]=function(){return this},e.prototype.next=function(e){var t=this.index++,i=this.array;return t<this.length?{value:i[t],done:!1}:{value:null,done:!0}},e.prototype.hasValue=function(){return this.array.length>this.index},e.prototype.hasCompleted=function(){return this.array.length===this.index},e}(),Mr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.parent=i,n.observable=r,n.stillUnsubscribed=!0,n.buffer=[],n.isComplete=!1,n}return jt(t,e),t.prototype[Zi]=function(){return this},t.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},t.prototype.hasValue=function(){return this.buffer.length>0},t.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},t.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},t.prototype.notifyNext=function(e,t,i,r,n){this.buffer.push(t),this.parent.checkIterators()},t.prototype.subscribe=function(e,t){return rr(this,this.observable,this,t)},t}(Wi);function Er(e,t){return void 0===t&&(t=null),function(i){return i.lift(new Tr(e,t))}}e.RenderMode=void 0,(br=e.RenderMode||(e.RenderMode={}))[br.Letterbox=0]="Letterbox",br[br.Fill=1]="Fill";var Tr=function(){function e(e,t){this.bufferSize=e,this.startBufferEvery=t,this.subscriberClass=t&&e!==t?Ir:Cr}return e.prototype.call=function(e,t){return t.subscribe(new this.subscriberClass(e,this.bufferSize,this.startBufferEvery))},e}(),Cr=function(e){function t(t,i){var r=e.call(this,t)||this;return r.bufferSize=i,r.buffer=[],r}return jt(t,e),t.prototype._next=function(e){var t=this.buffer;t.push(e),t.length==this.bufferSize&&(this.destination.next(t),this.buffer=[])},t.prototype._complete=function(){var t=this.buffer;t.length>0&&this.destination.next(t),e.prototype._complete.call(this)},t}(Kt),Ir=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.bufferSize=i,n.startBufferEvery=r,n.buffers=[],n.count=0,n}return jt(t,e),t.prototype._next=function(e){var t=this,i=t.bufferSize,r=t.startBufferEvery,n=t.buffers,o=t.count;this.count++,o%r===0&&n.push([]);for(var a=n.length;a--;){var s=n[a];s.push(e),s.length===i&&(n.splice(a,1),this.destination.next(s))}},t.prototype._complete=function(){for(var t=this.buffers,i=this.destination;t.length>0;){var r=t.shift();r.length>0&&i.next(r)}e.prototype._complete.call(this)},t}(Kt);var Pr=function(){function e(e){this.closingSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new Rr(e,this.closingSelector))},e}(),Rr=function(e){function t(t,i){var r=e.call(this,t)||this;return r.closingSelector=i,r.subscribing=!1,r.openBuffer(),r}return jt(t,e),t.prototype._next=function(e){this.buffer.push(e)},t.prototype._complete=function(){var t=this.buffer;t&&this.destination.next(t),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},t.prototype.notifyNext=function(e,t,i,r,n){this.openBuffer()},t.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},t.prototype.openBuffer=function(){var e=this.closingSubscription;e&&(this.remove(e),e.unsubscribe());var t,i=this.buffer;this.buffer&&this.destination.next(i),this.buffer=[];try{t=(0,this.closingSelector)()}catch(e){return this.error(e)}e=new Yt,this.closingSubscription=e,this.add(e),this.subscribing=!0,e.add(rr(this,t)),this.subscribing=!1},t}(Wi);function Nr(e){return function(t){var i=new Or(e),r=t.lift(i);return i.caught=r}}var Or=function(){function e(e){this.selector=e}return e.prototype.call=function(e,t){return t.subscribe(new Lr(e,this.selector,this.caught))},e}(),Lr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.selector=i,n.caught=r,n}return jt(t,e),t.prototype.error=function(t){if(!this.isStopped){var i=void 0;try{i=this.selector(t,this.caught)}catch(t){return void e.prototype.error.call(this,t)}this._unsubscribeAndRecycle();var r=new Qi(this,void 0,void 0);this.add(r),rr(this,i,void 0,void 0,r)}},t}(Wi);function Dr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=null;return"function"==typeof e[e.length-1]&&(i=e.pop()),1===e.length&&Ht(e[0])&&(e=e[0].slice()),function(t){return t.lift.call(cr([t].concat(e)),new ar(i))}}function kr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(dr.apply(void 0,[t].concat(e)))}}function Br(e,t){return void 0===t&&(t=Fi),function(i){return i.lift(new Fr(e,t))}}var Fr=function(){function e(e,t){this.dueTime=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new jr(e,this.dueTime,this.scheduler))},e}(),jr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.dueTime=i,n.scheduler=r,n.debouncedSubscription=null,n.lastValue=null,n.hasValue=!1,n}return jt(t,e),t.prototype._next=function(e){this.clearDebounce(),this.lastValue=e,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(zr,this.dueTime,this))},t.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},t.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var e=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(e)}},t.prototype.clearDebounce=function(){var e=this.debouncedSubscription;null!==e&&(this.remove(e),e.unsubscribe(),this.debouncedSubscription=null)},t}(Kt);function zr(e){e.debouncedNext()}function Vr(e){return void 0===e&&(e=null),function(t){return t.lift(new $r(e))}}var $r=function(){function e(e){this.defaultValue=e}return e.prototype.call=function(e,t){return t.subscribe(new Ur(e,this.defaultValue))},e}(),Ur=function(e){function t(t,i){var r=e.call(this,t)||this;return r.defaultValue=i,r.isEmpty=!0,r}return jt(t,e),t.prototype._next=function(e){this.isEmpty=!1,this.destination.next(e)},t.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},t}(Kt);function Gr(e,t){void 0===t&&(t=Fi);var i,r=(i=e)instanceof Date&&!isNaN(+i)?+e-t.now():Math.abs(e);return function(e){return e.lift(new Hr(r,t))}}var Hr=function(){function e(e,t){this.delay=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new qr(e,this.delay,this.scheduler))},e}(),qr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.delay=i,n.scheduler=r,n.queue=[],n.active=!1,n.errored=!1,n}return jt(t,e),t.dispatch=function(e){for(var t=e.source,i=t.queue,r=e.scheduler,n=e.destination;i.length>0&&i[0].time-r.now()<=0;)i.shift().notification.observe(n);if(i.length>0){var o=Math.max(0,i[0].time-r.now());this.schedule(e,o)}else this.unsubscribe(),t.active=!1},t.prototype._schedule=function(e){this.active=!0,this.destination.add(e.schedule(t.dispatch,this.delay,{source:this,destination:this.destination,scheduler:e}))},t.prototype.scheduleNotification=function(e){if(!0!==this.errored){var t=this.scheduler,i=new Wr(t.now()+this.delay,e);this.queue.push(i),!1===this.active&&this._schedule(t)}},t.prototype._next=function(e){this.scheduleNotification(Ni.createNext(e))},t.prototype._error=function(e){this.errored=!0,this.queue=[],this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.scheduleNotification(Ni.createComplete()),this.unsubscribe()},t}(Kt),Wr=function(){return function(e,t){this.time=e,this.notification=t}}();var Qr=function(){function e(e,t){this.keySelector=e,this.flushes=t}return e.prototype.call=function(e,t){return t.subscribe(new Yr(e,this.keySelector,this.flushes))},e}(),Yr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.keySelector=i,n.values=new Set,r&&n.add(rr(n,r)),n}return jt(t,e),t.prototype.notifyNext=function(e,t,i,r,n){this.values.clear()},t.prototype.notifyError=function(e,t){this._error(e)},t.prototype._next=function(e){this.keySelector?this._useKeySelector(e):this._finalizeNext(e,e)},t.prototype._useKeySelector=function(e){var t,i=this.destination;try{t=this.keySelector(e)}catch(e){return void i.error(e)}this._finalizeNext(t,e)},t.prototype._finalizeNext=function(e,t){var i=this.values;i.has(e)||(i.add(e),this.destination.next(t))},t}(Wi);function Xr(e,t){return function(i){return i.lift(new Zr(e,t))}}var Zr=function(){function e(e,t){this.compare=e,this.keySelector=t}return e.prototype.call=function(e,t){return t.subscribe(new Kr(e,this.compare,this.keySelector))},e}(),Kr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.keySelector=r,n.hasKey=!1,"function"==typeof i&&(n.compare=i),n}return jt(t,e),t.prototype.compare=function(e,t){return e===t},t.prototype._next=function(e){var t;try{var i=this.keySelector;t=i?i(e):e}catch(e){return this.destination.error(e)}var r=!1;if(this.hasKey)try{r=(0,this.compare)(this.key,t)}catch(e){return this.destination.error(e)}else this.hasKey=!0;r||(this.key=t,this.destination.next(e))},t}(Kt);function Jr(e,t){return function(i){return i.lift(new en(e,t))}}var en=function(){function e(e,t){this.predicate=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new tn(e,this.predicate,this.thisArg))},e}(),tn=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.predicate=i,n.thisArg=r,n.count=0,n}return jt(t,e),t.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},t}(Kt);function rn(e,t,i){return function(r){return r.lift(new nn(e,t,i))}}var nn=function(){function e(e,t,i){this.nextOrObserver=e,this.error=t,this.complete=i}return e.prototype.call=function(e,t){return t.subscribe(new on(e,this.nextOrObserver,this.error,this.complete))},e}(),on=function(e){function t(t,i,r,n){var o=e.call(this,t)||this;return o._tapNext=ti,o._tapError=ti,o._tapComplete=ti,o._tapError=r||ti,o._tapComplete=n||ti,zt(i)?(o._context=o,o._tapNext=i):i&&(o._context=i,o._tapNext=i.next||ti,o._tapError=i.error||ti,o._tapComplete=i.complete||ti),o}return jt(t,e),t.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.next(e)},t.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.error(e)},t.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()},t}(Kt),an=function(e){return void 0===e&&(e=sn),rn({hasValue:!1,next:function(){this.hasValue=!0},complete:function(){if(!this.hasValue)throw e()}})};function sn(){return new Ui}function cn(e){return function(t){return 0===e?Si():t.lift(new hn(e))}}var hn=function(){function e(e){if(this.total=e,this.total<0)throw new Vi}return e.prototype.call=function(e,t){return t.subscribe(new un(e,this.total))},e}(),un=function(e){function t(t,i){var r=e.call(this,t)||this;return r.total=i,r.count=0,r}return jt(t,e),t.prototype._next=function(e){var t=this.total,i=++this.count;i<=t&&(this.destination.next(e),i===t&&(this.destination.complete(),this.unsubscribe()))},t}(Kt);function ln(e,t,i){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===i&&(i=void 0),t=(t||0)<1?Number.POSITIVE_INFINITY:t,function(r){return r.lift(new pn(e,t,i))}}var pn=function(){function e(e,t,i){this.project=e,this.concurrent=t,this.scheduler=i}return e.prototype.call=function(e,t){return t.subscribe(new dn(e,this.project,this.concurrent,this.scheduler))},e}(),dn=function(e){function t(t,i,r,n){var o=e.call(this,t)||this;return o.project=i,o.concurrent=r,o.scheduler=n,o.index=0,o.active=0,o.hasCompleted=!1,r<Number.POSITIVE_INFINITY&&(o.buffer=[]),o}return jt(t,e),t.dispatch=function(e){var t=e.subscriber,i=e.result,r=e.value,n=e.index;t.subscribeToProjection(i,r,n)},t.prototype._next=function(e){var i=this.destination;if(i.closed)this._complete();else{var r=this.index++;if(this.active<this.concurrent){i.next(e);try{var n=(0,this.project)(e,r);if(this.scheduler){var o={subscriber:this,result:n,value:e,index:r};this.destination.add(this.scheduler.schedule(t.dispatch,0,o))}else this.subscribeToProjection(n,e,r)}catch(e){i.error(e)}}else this.buffer.push(e)}},t.prototype.subscribeToProjection=function(e,t,i){this.active++,this.destination.add(rr(this,e,t,i))},t.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},t.prototype.notifyNext=function(e,t,i,r,n){this._next(t)},t.prototype.notifyComplete=function(e){var t=this.buffer;this.destination.remove(e),this.active--,t&&t.length>0&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},t}(Wi);function fn(e){return function(t){return t.lift(new mn(e))}}var mn=function(){function e(e){this.callback=e}return e.prototype.call=function(e,t){return t.subscribe(new gn(e,this.callback))},e}(),gn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.add(new Yt(i)),r}return jt(t,e),t}(Kt);function vn(e,t){var i=arguments.length>=2;return function(r){return r.pipe(e?Jr(function(t,i){return e(t,i,r)}):ji,cn(1),i?Vr(t):an(function(){return new Ui}))}}var _n=function(){function e(e){if(this.total=e,this.total<0)throw new Vi}return e.prototype.call=function(e,t){return t.subscribe(new yn(e,this.total))},e}(),yn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.total=i,r.ring=new Array,r.count=0,r}return jt(t,e),t.prototype._next=function(e){var t=this.ring,i=this.total,r=this.count++;t.length<i?t.push(e):t[r%i]=e},t.prototype._complete=function(){var e=this.destination,t=this.count;if(t>0)for(var i=this.count>=this.total?this.total:this.count,r=this.ring,n=0;n<i;n++){var o=t++%i;e.next(r[o])}e.complete()},t}(Kt);function bn(e,t){var i=arguments.length>=2;return function(r){return r.pipe(e?Jr(function(t,i){return e(t,i,r)}):ji,(n=1,function(e){return 0===n?Si():e.lift(new _n(n))}),i?Vr(t):an(function(){return new Ui}));var n}}function xn(e,t){var i=!1;return arguments.length>=2&&(i=!0),function(r){return r.lift(new wn(e,t,i))}}var wn=function(){function e(e,t,i){void 0===i&&(i=!1),this.accumulator=e,this.seed=t,this.hasSeed=i}return e.prototype.call=function(e,t){return t.subscribe(new An(e,this.accumulator,this.seed,this.hasSeed))},e}(),An=function(e){function t(t,i,r,n){var o=e.call(this,t)||this;return o.accumulator=i,o._seed=r,o.hasSeed=n,o.index=0,o}return jt(t,e),Object.defineProperty(t.prototype,"seed",{get:function(){return this._seed},set:function(e){this.hasSeed=!0,this._seed=e},enumerable:!0,configurable:!0}),t.prototype._next=function(e){if(this.hasSeed)return this._tryNext(e);this.seed=e,this.destination.next(e)},t.prototype._tryNext=function(e){var t,i=this.index++;try{t=this.accumulator(this.seed,e,i)}catch(e){this.destination.error(e)}this.seed=t,this.destination.next(t)},t}(Kt);function Sn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(vr.apply(void 0,[t].concat(e)))}}function Mn(e,t){return function(i){var r;if(r="function"==typeof e?e:function(){return e},"function"==typeof t)return i.lift(new En(r,t));var n=Object.create(i,fi);return n.source=i,n.subjectFactory=r,n}}var En=function(){function e(e,t){this.subjectFactory=e,this.selector=t}return e.prototype.call=function(e,t){var i=this.selector,r=this.subjectFactory(),n=i(r).subscribe(e);return n.add(t.subscribe(r)),n},e}();function Tn(){return function(e){return e.lift(new Cn)}}var Cn=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new In(e))},e}(),In=function(e){function t(t){var i=e.call(this,t)||this;return i.hasPrev=!1,i}return jt(t,e),t.prototype._next=function(e){this.hasPrev?this.destination.next([this.prev,e]):this.hasPrev=!0,this.prev=e},t}(Kt);function Pn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e.length;if(0===i)throw new Error("list of properties cannot be empty.");return function(t){return Gi(function(e,t){var i=function(i){for(var r=i,n=0;n<t;n++){var o=r[e[n]];if(void 0===o)return;r=o}return r};return i}(e,i))(t)}}function Rn(e,t,i,r){i&&"function"!=typeof i&&(r=i);var n="function"==typeof i?i:void 0,o=new Di(e,t,r);return function(e){return Mn(function(){return o},n)(e)}}var Nn=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var i=new On(e),r=t.subscribe(i);return r.add(rr(i,this.notifier)),r},e}(),On=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hasValue=!1,t}return jt(t,e),t.prototype._next=function(e){this.value=e,this.hasValue=!0},t.prototype.notifyNext=function(e,t,i,r,n){this.emitValue()},t.prototype.notifyComplete=function(){this.emitValue()},t.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},t}(Wi);function Ln(){return new ci}function Dn(){return function(e){return ui()(Mn(Ln)(e))}}function kn(e){return function(t){return t.lift(new Bn(e))}}var Bn=function(){function e(e){this.total=e}return e.prototype.call=function(e,t){return t.subscribe(new Fn(e,this.total))},e}(),Fn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.total=i,r.count=0,r}return jt(t,e),t.prototype._next=function(e){++this.count>this.total&&this.destination.next(e)},t}(Kt);function jn(e){return function(t){return t.lift(new zn(e))}}var zn=function(){function e(e){this.predicate=e}return e.prototype.call=function(e,t){return t.subscribe(new Vn(e,this.predicate))},e}(),Vn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.predicate=i,r.skipping=!0,r.index=0,r}return jt(t,e),t.prototype._next=function(e){var t=this.destination;this.skipping&&this.tryCallPredicate(e),this.skipping||t.next(e)},t.prototype.tryCallPredicate=function(e){try{var t=this.predicate(e,this.index++);this.skipping=Boolean(t)}catch(e){this.destination.error(e)}},t}(Kt);function $n(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var i=e[e.length-1];Mi(i)?e.pop():i=null;var r=e.length;return dr(1!==r||i?r>0?Ti(e,i):Si(i):Ci(e[0]),t)}}function Un(e,t){return"function"==typeof t?function(i){return i.pipe(Un(function(i,r){return cr(e(i,r)).pipe(Gi(function(e,n){return t(i,e,r,n)}))}))}:function(t){return t.lift(new Gn(e))}}var Gn=function(){function e(e){this.project=e}return e.prototype.call=function(e,t){return t.subscribe(new Hn(e,this.project))},e}(),Hn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.project=i,r.index=0,r}return jt(t,e),t.prototype._next=function(e){var t,i=this.index++;try{t=this.project(e,i)}catch(e){return void this.destination.error(e)}this._innerSub(t,e,i)},t.prototype._innerSub=function(e,t,i){var r=this.innerSubscription;r&&r.unsubscribe();var n=new Qi(this,void 0,void 0);this.destination.add(n),this.innerSubscription=rr(this,e,t,i,n)},t.prototype._complete=function(){var t=this.innerSubscription;t&&!t.closed||e.prototype._complete.call(this),this.unsubscribe()},t.prototype._unsubscribe=function(){this.innerSubscription=null},t.prototype.notifyComplete=function(t){this.destination.remove(t),this.innerSubscription=null,this.isStopped&&e.prototype._complete.call(this)},t.prototype.notifyNext=function(e,t,i,r,n){this.destination.next(t)},t}(Wi);function qn(e){return function(t){return t.lift(new Wn(e))}}var Wn=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var i=new Qn(e),r=rr(i,this.notifier);return r&&!i.seenValue?(i.add(r),t.subscribe(i)):i},e}(),Qn=function(e){function t(t){var i=e.call(this,t)||this;return i.seenValue=!1,i}return jt(t,e),t.prototype.notifyNext=function(e,t,i,r,n){this.seenValue=!0,this.complete()},t.prototype.notifyComplete=function(){},t}(Wi);var Yn=function(){function e(e,t){this.predicate=e,this.inclusive=t}return e.prototype.call=function(e,t){return t.subscribe(new Xn(e,this.predicate,this.inclusive))},e}(),Xn=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.predicate=i,n.inclusive=r,n.index=0,n}return jt(t,e),t.prototype._next=function(e){var t,i=this.destination;try{t=this.predicate(e,this.index++)}catch(e){return void i.error(e)}this.nextOrComplete(e,t)},t.prototype.nextOrComplete=function(e,t){var i=this.destination;Boolean(t)?i.next(e):(this.inclusive&&i.next(e),i.complete())},t}(Kt),Zn={leading:!0,trailing:!1};var Kn=function(){function e(e,t,i,r){this.duration=e,this.scheduler=t,this.leading=i,this.trailing=r}return e.prototype.call=function(e,t){return t.subscribe(new Jn(e,this.duration,this.scheduler,this.leading,this.trailing))},e}(),Jn=function(e){function t(t,i,r,n,o){var a=e.call(this,t)||this;return a.duration=i,a.scheduler=r,a.leading=n,a.trailing=o,a._hasTrailingValue=!1,a._trailingValue=null,a}return jt(t,e),t.prototype._next=function(e){this.throttled?this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(eo,this.duration,{subscriber:this})),this.leading&&this.destination.next(e))},t.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},t.prototype.clearThrottle=function(){var e=this.throttled;e&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),e.unsubscribe(),this.remove(e),this.throttled=null)},t}(Kt);function eo(e){e.subscriber.clearThrottle()}function to(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var i;"function"==typeof e[e.length-1]&&(i=e.pop());var r=e;return t.lift(new ao(r,i))}}var io,ro,no,oo,ao=function(){function e(e,t){this.observables=e,this.project=t}return e.prototype.call=function(e,t){return t.subscribe(new so(e,this.observables,this.project))},e}(),so=function(e){function t(t,i,r){var n=e.call(this,t)||this;n.observables=i,n.project=r,n.toRespond=[];var o=i.length;n.values=new Array(o);for(var a=0;a<o;a++)n.toRespond.push(a);for(a=0;a<o;a++){var s=i[a];n.add(rr(n,s,s,a))}return n}return jt(t,e),t.prototype.notifyNext=function(e,t,i,r,n){this.values[i]=t;var o=this.toRespond;if(o.length>0){var a=o.indexOf(i);-1!==a&&o.splice(a,1)}},t.prototype.notifyComplete=function(){},t.prototype._next=function(e){if(0===this.toRespond.length){var t=[e].concat(this.values);this.project?this._tryProject(t):this.destination.next(t)}},t.prototype._tryProject=function(e){var t;try{t=this.project.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(Wi);function co(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(yr.apply(void 0,[t].concat(e)))}}class ho{constructor(t,i,r){this._adaptiveOperation$=new ci,this._render$=new ci,this._renderAdaptive$=new ci,this._renderService=i,this._currentFrame$=r;let n=Bt.create(Bt.h("div.domRenderer",[]));t.appendChild(n),this._offset$=this._adaptiveOperation$.pipe(xn((e,t)=>t(e),{elementHeight:t.offsetHeight,elementWidth:t.offsetWidth,imageAspect:0,renderMode:e.RenderMode.Fill}),Jr(e=>e.imageAspect>0&&e.elementWidth>0&&e.elementHeight>0),Gi(t=>{let i=t.elementWidth/t.elementHeight,r=t.imageAspect/i,n=0,o=0;return t.renderMode===e.RenderMode.Letterbox?t.imageAspect>i?n=t.elementHeight*(1-1/r)/2:o=t.elementWidth*(1-r)/2:t.imageAspect>i?o=-t.elementWidth*(r-1)/2:n=-t.elementHeight*(1/r-1)/2,{bottom:n,left:o,right:o,top:n}})),this._currentFrame$.pipe(Jr(e=>null!=e.state.currentNode),Xr((e,t)=>e===t,e=>e.state.currentNode.key),Gi(e=>e.state.currentTransform.basicAspect),Gi(e=>t=>(t.imageAspect=e,t))).subscribe(this._adaptiveOperation$),this._renderAdaptive$.pipe(xn((e,t)=>(null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e),{}),Dr(this._offset$),Gi(e=>{let t=M.exports.values(e[0]),i=e[1],r={style:{bottom:i.bottom+"px",left:i.left+"px","pointer-events":"none",position:"absolute",right:i.right+"px",top:i.top+"px"}};return{name:"adaptiveDomRenderer",vnode:Bt.h("div.adaptiveDomRenderer",r,t)}})).subscribe(this._render$),this._vNode$=this._render$.pipe(xn((e,t)=>(null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e),{}),Gi(e=>{let t=M.exports.values(e);return Bt.h("div.domRenderer",t)})),this._vPatch$=this._vNode$.pipe(xn((e,t)=>(e.vpatch=Bt.diff(e.vnode,t),e.vnode=t,e),{vnode:Bt.h("div.domRenderer",[]),vpatch:null}),Pn("vpatch")),this._element$=this._vPatch$.pipe(xn((e,t)=>Bt.patch(e,t),n),Rn(1),ui()),this._element$.subscribe(()=>{}),this._renderService.size$.pipe(Gi(e=>t=>(t.elementWidth=e.width,t.elementHeight=e.height,t))).subscribe(this._adaptiveOperation$),this._renderService.renderMode$.pipe(Gi(e=>t=>(t.renderMode=e,t))).subscribe(this._adaptiveOperation$)}get element$(){return this._element$}get render$(){return this._render$}get renderAdaptive$(){return this._renderAdaptive$}clear(e){this._renderAdaptive$.next({name:e,vnode:null}),this._render$.next({name:e,vnode:null})}}!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground"}(io||(io={}));class uo{constructor(e){this._document=e||document}get document(){return this._document}createElement(e,t,i){const r=this._document.createElement(e);return t&&(r.className=t),i&&i.appendChild(r),r}}class lo{constructor(){this._events={}}on(e,t){this._events[e]=this._events[e]||[],this._events[e].push(t)}off(e,t){if(e)if(this._listens(e))delete this._events[e];else{let i=this._events[e].indexOf(t);i>=0&&this._events[e].splice(i,1),this._events[e].length&&delete this._events[e]}else this._events={}}fire(e,t){if(this._listens(e))for(let i of this._events[e])i.call(this,t)}_listens(e){return!(!this._events||!this._events[e])}}e.ImageSize=void 0,(ro=e.ImageSize||(e.ImageSize={}))[ro.Size320=320]="Size320",ro[ro.Size640=640]="Size640",ro[ro.Size1024=1024]="Size1024",ro[ro.Size2048=2048]="Size2048";class po{static get baseImageSize(){return po._baseImageSize}static get basePanoramaSize(){return po._basePanoramaSize}static get maxImageSize(){return po._maxImageSize}static setOptions(t){po._baseImageSize=null!=t.baseImageSize?t.baseImageSize:e.ImageSize.Size640,po._basePanoramaSize=null!=t.basePanoramaSize?t.basePanoramaSize:e.ImageSize.Size2048,po._maxImageSize=null!=t.maxImageSize?t.maxImageSize:e.ImageSize.Size2048}}class fo{static get domain(){return"visual-tiles-jp.mapxus.com"}static get tileScheme(){return"https"}static get tileDomain(){return`${fo.domain}/tiles`}static get thumbnailDomain(){return`${fo.domain}/previews`}static get meshDomain(){return`${fo.domain}/meshs`}static get origin(){return"visual.webgl"}static get authUrl(){return"https://map-api.mapxus.co.jp/sc/api/v1/apikeys/auth"}static thumbnail(e,t=2048){return`${fo.tileScheme}://${fo.thumbnailDomain}/${e}/thumbnails/thumb-${t}.jpg`}static protoMesh(e){return`${fo.tileScheme}://${fo.meshDomain}/${e}`}static graphqlModel(){return"https://map-api.mapxus.co.jp/vis/graphql"}}class mo{constructor(e,t,i){this._renderFrame$=new ci,this._renderCameraOperation$=new ci,this._render$=new ci,this._clear$=new ci,this._renderOperation$=new ci,this._rendererOperation$=new ci,this._eraserOperation$=new ci,this._renderService=t,this._dom=i||new uo,this._renderer$=this._rendererOperation$.pipe(xn((e,t)=>t(e),{needsRender:!1,renderer:null})),this._renderCollection$=this._renderOperation$.pipe(xn((e,t)=>t(e),{}),Dn()),this._renderCamera$=this._renderCameraOperation$.pipe(xn((e,t)=>t(e),{frameId:-1,needsRender:!1,perspective:null})),this._eraser$=this._eraserOperation$.pipe($n(e=>e),xn((e,t)=>t(e),{needsRender:!1})),or([this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$],(e,t,i,r)=>({camera:i,eraser:r,renderer:e,renders:Object.keys(t).map(e=>t[e])})).pipe(Jr(e=>{let t=e.renderer.needsRender||e.camera.needsRender||e.eraser.needsRender,i=e.camera.frameId;for(let r of e.renders){if(r.frameId!==i)return!1;t=t||r.needsRender}return t}),Xr((e,t)=>e===t,e=>e.eraser.needsRender?-1:e.camera.frameId)).subscribe(e=>{e.renderer.needsRender=!1,e.camera.needsRender=!1,e.eraser.needsRender=!1;let t=e.camera.perspective,i=[],r=[];for(let t of e.renders)t.stage===io.Background?i.push(t.render):t.stage===io.Foreground&&r.push(t.render);let n=e.renderer.renderer;n.clear();for(let e of i)e(t,n);n.clearDepth();for(let e of r)e(t,n)}),this._renderFrame$.pipe(Gi(e=>t=>(t.frameId=e.frameId,t.perspective=e.perspective,!0===e.changed&&(t.needsRender=!0),t))).subscribe(this._renderCameraOperation$),this._renderFrameSubscribe(),vr(this._render$.pipe(Gi(e=>t=>(t[e.name]=e.render,t))),this._clear$.pipe(Gi(e=>t=>(delete t[e],t)))).subscribe(this._renderOperation$),this._webGLRenderer$=this._render$.pipe(vn(),Gi(i=>{const r=this._dom.createElement("canvas","Beeview-js-canvas");r.style.position="absolute",r.setAttribute("tabindex","0"),e.appendChild(r);const n=t.element,o=new p.exports.WebGLRenderer({canvas:r});return o.setPixelRatio(window.devicePixelRatio),o.setSize(n.offsetWidth,n.offsetHeight),o.setClearColor(new p.exports.Color(2105376),1),o.autoClear=!1,o}),Rn(1),ui()),this._webGLRenderer$.subscribe(()=>{}),vr(this._webGLRenderer$.pipe(vn(),Gi(e=>t=>(t.needsRender=!0,t.renderer=e,t))),this._renderService.size$.pipe(Gi(e=>t=>(null==t.renderer||(t.renderer.setSize(e.width,e.height),t.needsRender=!0),t))),this._clear$.pipe(Gi(e=>e=>(null==e.renderer||(e.needsRender=!0),e)))).subscribe(this._rendererOperation$);let r=this._renderCollection$.pipe(Jr(e=>0===Object.keys(e).length),Dn());r.subscribe(e=>{null!=this._renderFrameSubscription&&(this._renderFrameSubscription.unsubscribe(),this._renderFrameSubscription=null,this._renderFrameSubscribe())}),r.pipe(Gi(e=>e=>(e.needsRender=!0,e))).subscribe(this._eraserOperation$)}get render$(){return this._render$}get webGLRenderer$(){return this._webGLRenderer$}clear(e){this._clear$.next(e)}_renderFrameSubscribe(){this._render$.pipe(vn(),Gi(e=>e=>(e.needsRender=!0,e))).subscribe(e=>{this._renderCameraOperation$.next(e)}),this._renderFrameSubscription=this._render$.pipe(vn(),hr(e=>this._renderService.renderCameraFrame$)).subscribe(this._renderFrame$)}}class go{constructor(e,t,i){this.alpha=-1,this.zoom=0,this._frameId=-1,this._changed=!1,this._changedForFrame=-1,this.currentAspect=1,this.currentPano=!1,this.previousAspect=1,this.previousPano=!1,this.renderMode=i,this._spatial=new y,this._camera=new g;const r=this._getPerspectiveCameraAspect(e,t);this._perspective=new p.exports.PerspectiveCamera(50,r,.4,1e4),this._perspective.matrixAutoUpdate=!1,this._rotation={phi:0,theta:0}}get camera(){return this._camera}get changed(){return this.frameId===this._changedForFrame}get frameId(){return this._frameId}set frameId(e){this._frameId=e,this._changed&&(this._changed=!1,this._changedForFrame=e)}get perspective(){return this._perspective}get rotation(){return this._rotation}getTilt(){return 90-this._spatial.radToDeg(this._rotation.theta)}updateAspect(e,t){const i=this._getPerspectiveCameraAspect(e,t);this._perspective.aspect=i,this._changed=!0}updateProjection(){let e=this._getAspect(this.currentAspect,this.currentPano,this.perspective.aspect),t=this._getAspect(this.previousAspect,this.previousPano,this.perspective.aspect),i=(1-this.alpha)*t+this.alpha*e,r=this._getVerticalFov(i,this._camera.focal,this.zoom);this._perspective.fov=r,this._perspective.updateProjectionMatrix(),this._changed=!0}updatePerspective(e){this._perspective.up.copy(e.up),this._perspective.position.copy(e.position),this._perspective.lookAt(e.lookat),this._perspective.updateMatrix(),this._perspective.updateMatrixWorld(!1),this._changed=!0}updateRotation(e){this._rotation=this._getRotation(e)}_getVerticalFov(e,t,i){return 2*Math.atan(.5/(Math.pow(2,i)*e*t))*180/Math.PI}_getAspect(t,i,r){if(i)return 1;let n=Math.max(1,1/t);return(this.renderMode===e.RenderMode.Letterbox?t>r:t<r)?n*r:n*t}_getPerspectiveCameraAspect(e,t){return 0===e?0:e/t}_getRotation(e){let t=e.lookat.clone().sub(e.position),i=e.up.clone(),r=t.clone().dot(i),n=t.clone().sub(i.clone().multiplyScalar(r));return{phi:Math.atan2(n.y,n.x),theta:Math.PI/2-this._spatial.angleToPlane(t.toArray(),[0,0,1])}}}class vo{constructor(t,i,r){this._element=t,this._currentFrame$=i,this._spatial=new y,r=null!=r?r:e.RenderMode.Fill,this._panWithoutInertia$=new ci,this._pan$=new ci,this._resize$=new ci,this._renderCameraOperation$=new ci,this._size$=new gi({height:this._element.offsetHeight,width:this._element.offsetWidth}),this._resize$.pipe(Gi(()=>({height:this._element.offsetHeight,width:this._element.offsetWidth}))).subscribe(this._size$),this._renderMode$=new gi(r),this._renderCameraHolder$=this._renderCameraOperation$.pipe($n(e=>e),xn((e,t)=>t(e),new go(this._element.offsetWidth,this._element.offsetHeight,r)),Rn(1),ui()),this._renderCameraFrame$=this._currentFrame$.pipe(to(this._renderCameraHolder$,(e,t)=>[e,t]),rn(e=>{let t=e[0],i=e[1],r=t.state.camera;if(i.alpha!==t.state.alpha||i.zoom!==t.state.zoom||i.camera.diff(r)>1e-9){let e=t.state.currentTransform,n=null!=t.state.previousTransform?t.state.previousTransform:t.state.currentTransform,o=null!=t.state.previousNode?t.state.previousNode:t.state.currentNode;i.currentAspect=e.basicAspect,i.currentPano=t.state.currentNode.pano,i.previousAspect=n.basicAspect,i.previousPano=o.pano,i.alpha=t.state.alpha,i.zoom=t.state.zoom,i.camera.copy(r),i.updatePerspective(r),i.updateRotation(r),i.updateProjection()}i.frameId=t.id}),Gi(e=>e[1]),Rn(1),ui()),this._renderCamera$=this._renderCameraFrame$.pipe(Jr(e=>e.changed),Rn(1),ui()),this._bearing$=this._renderCamera$.pipe(Gi(e=>{let t=this._spatial.radToDeg(this._spatial.azimuthalToBearing(e.rotation.phi));return this._spatial.wrap(t,0,360)}),Rn(1),ui()),this._size$.pipe(kn(1),Gi(e=>t=>(t.updateAspect(e.width,e.height),t.updateProjection(),t))).subscribe(this._renderCameraOperation$),this._renderMode$.pipe(kn(1),Gi(e=>t=>(t.renderMode=e,t.updateProjection(),t))).subscribe(this._renderCameraOperation$),this._bearing$.subscribe(()=>{}),this._renderCameraHolder$.subscribe(()=>{}),this._size$.subscribe(()=>{}),this._renderMode$.subscribe(()=>{}),this._renderCamera$.subscribe(()=>{}),this._renderCameraFrame$.subscribe(()=>{})}get bearing$(){return this._bearing$}get panWithoutInertia$(){return this._panWithoutInertia$}get pan$(){return this._pan$}get element(){return this._element}get resize$(){return this._resize$}get size$(){return this._size$}get renderMode$(){return this._renderMode$}get renderCameraFrame$(){return this._renderCameraFrame$}get renderCamera$(){return this._renderCamera$}}e.Alignment=void 0,(no=e.Alignment||(e.Alignment={}))[no.Bottom=0]="Bottom",no[no.BottomLeft=1]="BottomLeft",no[no.BottomRight=2]="BottomRight",no[no.Center=3]="Center",no[no.Left=4]="Left",no[no.Right=5]="Right",no[no.Top=6]="Top",no[no.TopLeft=7]="TopLeft",no[no.TopRight=8]="TopRight";class _o{constructor(e,t){this._graphService=e,this._stateService=t,this._started=!1}get started(){return this._started}start(){this._started||(this._uncacheSubscription=this._stateService.currentState$.pipe(Xr(void 0,e=>e.state.currentNode.key),Gi(e=>e.state.trajectory.map(e=>e.key)),Er(1,5),Un(e=>{let t=e[0];return this._graphService.uncache$(t)})).subscribe(()=>{}),this._started=!0)}stop(){this._started&&(this._uncacheSubscription.unsubscribe(),this._uncacheSubscription=null,this._started=!1)}}class yo{constructor(e,t){this._components={};for(const i in yo.registeredComponents){if(!yo.registeredComponents.hasOwnProperty(i))continue;const r=yo.registeredComponents[i];this._components[i]={active:!1,component:new r(i,e,t)}}this._coverComponent=new yo.registeredCoverComponent("cover",e,t),this._coverComponent.activate(),this._coverActivated=!0}static register(e){void 0===yo.registeredComponents[e.componentName]&&(yo.registeredComponents[e.componentName]=e)}static registerCover(e){yo.registeredCoverComponent=e}get coverActivated(){return this._coverActivated}activateCover(){if(!this._coverActivated){this._coverActivated=!0;for(let e of M.exports.values(this._components))e.active&&e.component.deactivate()}}deactivateCover(){if(this._coverActivated){this._coverActivated=!1;for(let e of M.exports.values(this._components))e.active&&e.component.activate()}}activate(e){this._checkName(e),this._components[e].active=!0,this._coverActivated||this.get(e).activate()}configure(e,t){this._checkName(e),this.get(e).configure(t)}deactivate(e){this._checkName(e),this._components[e].active=!1,this._coverActivated||this.get(e).deactivate()}resize(){for(let e of M.exports.values(this._components))e.component.resize()}get(e){return this._components[e].component}getCover(){return this._coverComponent}_checkName(e){if(!(e in this._components))throw new f(`Component does not exist: ${e}`)}}yo.registeredComponents={},e.CoverState=void 0,(oo=e.CoverState||(e.CoverState={}))[oo.Hidden=0]="Hidden",oo[oo.Loading=1]="Loading",oo[oo.Visible=2]="Visible";class bo{constructor(t,i,r,n,o,a){this._container=t,this._observer=r,this._navigator=i,this._options=null!=o?o:{},this._key=n,this._navigable=null==n,this._componentService=a||new yo(this._container,this._navigator),this._coverComponent=this._componentService.getCover(),this._initializeComponents(),n?(this._initilizeCoverComponent(),this._subscribeCoverComponent()):this._navigator.movedToKey$.pipe(vn(e=>null!=e)).subscribe(t=>{this._key=t,this._componentService.deactivateCover(),this._coverComponent.configure({key:this._key,state:e.CoverState.Hidden}),this._subscribeCoverComponent(),this._navigator.stateService.start(),this._observer.startEmit()})}get navigable(){return this._navigable}get(e){return this._componentService.get(e)}activate(e){this._componentService.activate(e)}activateCover(){this._coverComponent.configure({state:e.CoverState.Visible})}deactivate(e){this._componentService.deactivate(e)}deactivateCover(){this._coverComponent.configure({state:e.CoverState.Loading})}resize(){this._componentService.resize()}_initializeComponents(){let e=this._options;this._uFalse(e.background,"background"),this._uFalse(e.debug,"debug"),this._uFalse(e.image,"image"),this._uFalse(e.navigation,"navigation"),this._uFalse(e.popup,"popup"),this._uFalse(e.route,"route"),this._uFalse(e.slider,"slider"),this._uFalse(e.tag,"tag"),this._uFalse(e.sequence,"sequence"),this._uFalse(e.direction,"direction"),this._uFalse(e.marker,"marker"),this._uTrue(e.cache,"cache"),this._uTrue(e.path,"path"),this._uTrue(e.bearing,"bearing"),this._uTrue(e.imagePlane,"imagePlane"),this._uTrue(e.keyboard,"keyboard"),this._uTrue(e.loading,"loading"),this._uTrue(e.mouse,"mouse")}_initilizeCoverComponent(){let e=this._options;this._coverComponent.configure({key:this._key}),void 0===e.cover||e.cover?this.activateCover():this.deactivateCover()}_setNavigable(e){this._navigable!==e&&(this._navigable=e,this._observer.navigable$.next(e))}_subscribeCoverComponent(){this._coverComponent.configuration$.subscribe(t=>{t.state===e.CoverState.Loading?this._navigator.stateService.currentKey$.pipe(vn(),Un(e=>{const i=null==e||e!==t.key;return i&&this._setNavigable(!1),i?this._navigator.moveToKey$(t.key):this._navigator.stateService.currentNode$.pipe(vn())})).subscribe(t=>{this._navigator.stateService.start(),this._observer.startEmit(),this._coverComponent.configure({state:e.CoverState.Hidden}),this._componentService.deactivateCover(),this._setNavigable(!0)},t=>{console.error("Failed to deactivate cover.",t),this._coverComponent.configure({state:e.CoverState.Visible})}):t.state===e.CoverState.Visible&&(this._observer.stopEmit(),this._navigator.stateService.stop(),this._componentService.activateCover(),this._setNavigable(null==t.key))})}_uFalse(e,t){void 0!==e?"boolean"!=typeof e?(this._componentService.configure(t,e),this._componentService.activate(t)):e?this._componentService.activate(t):this._componentService.deactivate(t):this._componentService.deactivate(t)}_uTrue(e,t){void 0!==e?"boolean"!=typeof e?(this._componentService.configure(t,e),this._componentService.activate(t)):e?this._componentService.activate(t):this._componentService.deactivate(t):this._componentService.activate(t)}}class xo{constructor(e){this._keyDown$=fr(e,"keydown")}get keyDown$(){return this._keyDown$}}class wo{constructor(e,t,i,r,n){this._canvasContainer=t,this._domContainer=i,this._viewportCoords=null!=n?n:new _,this._activeSubject$=new gi(!1),this._active$=this._activeSubject$.pipe(Xr(),Mn(new Di(1)),ui()),this._claimMouse$=new ci,this._claimWheel$=new ci,this._deferPixelClaims$=new ci,this._deferPixels$=this._deferPixelClaims$.pipe(xn((e,t)=>(null==t.deferPixels?delete e[t.name]:e[t.name]=t.deferPixels,e),{}),Gi(e=>{let t=-1;for(const i in e){if(!e.hasOwnProperty(i))continue;const r=e[i];r>t&&(t=r)}return t}),$n(-1),Mn(new Di(1)),ui()),this._deferPixels$.subscribe(()=>{}),this._documentMouseMove$=fr(r,"mousemove"),this._documentMouseUp$=fr(r,"mouseup"),this._mouseDown$=fr(t,"mousedown"),this._mouseLeave$=fr(t,"mouseleave"),this._mouseMove$=fr(t,"mousemove"),this._mouseUp$=fr(t,"mouseup"),this._mouseOut$=fr(t,"mouseout"),this._mouseOver$=fr(t,"mouseover"),this._domMouseDown$=fr(i,"mousedown"),this._domMouseMove$=fr(i,"mousemove"),this._click$=fr(t,"click"),this._contextMenu$=fr(t,"contextmenu"),this._dblClick$=vr(fr(e,"click"),fr(t,"dblclick")).pipe(Er(3,1),Jr(e=>{const i=e[0],r=e[1],n=e[2];return"click"===i.type&&"click"===r.type&&"dblclick"===n.type&&i.target.parentNode===t&&r.target.parentNode===t}),Gi(e=>e[2]),Dn()),vr(this._domMouseDown$,this._domMouseMove$,this._dblClick$,this._contextMenu$).subscribe(e=>{e.preventDefault()}),this._mouseWheel$=vr(fr(t,"wheel"),fr(i,"wheel")).pipe(Dn()),this._consistentContextMenu$=vr(this._mouseDown$,this._mouseMove$,this._mouseOut$,this._mouseUp$,this._contextMenu$).pipe(Er(3,1),Jr(e=>"mousedown"===e[0].type&&"contextmenu"===e[1].type&&"mouseup"===e[2].type),Gi(e=>e[1]),Dn());const o=vr(fr(window,"blur"),this._documentMouseUp$.pipe(Jr(e=>0===e.button))).pipe(Dn()),a=this._createMouseDragInitiate$(this._mouseDown$,o,!0).pipe(Dn());this._mouseDragStart$=this._createMouseDragStart$(a).pipe(Dn()),this._mouseDrag$=this._createMouseDrag$(a,o).pipe(Dn()),this._mouseDragEnd$=this._createMouseDragEnd$(this._mouseDragStart$,o).pipe(Dn());const s=this._createMouseDragInitiate$(this._domMouseDown$,o,!1).pipe(Dn());this._domMouseDragStart$=this._createMouseDragStart$(s).pipe(Dn()),this._domMouseDrag$=this._createMouseDrag$(s,o).pipe(Dn()),this._domMouseDragEnd$=this._createMouseDragEnd$(this._domMouseDragStart$,o).pipe(Dn()),this._proximateClick$=this._mouseDown$.pipe(Un(e=>this._click$.pipe(qn(this._createDeferredMouseMove$(e,this._documentMouseMove$)),cn(1))),Mn(new ci),ui()),this._staticClick$=this._mouseDown$.pipe(Un(e=>this._click$.pipe(qn(this._documentMouseMove$),cn(1))),Mn(new ci),ui()),this._mouseDragStart$.subscribe(),this._mouseDrag$.subscribe(),this._mouseDragEnd$.subscribe(),this._domMouseDragStart$.subscribe(),this._domMouseDrag$.subscribe(),this._domMouseDragEnd$.subscribe(),this._staticClick$.subscribe(),this._mouseOwner$=this._createOwner$(this._claimMouse$).pipe(Mn(new Di(1)),ui()),this._wheelOwner$=this._createOwner$(this._claimWheel$).pipe(Mn(new Di(1)),ui()),this._mouseOwner$.subscribe(()=>{}),this._wheelOwner$.subscribe(()=>{})}get active$(){return this._active$}get activate$(){return this._activeSubject$}get documentMouseMove$(){return this._documentMouseMove$}get documentMouseUp$(){return this._documentMouseUp$}get domMouseDragStart$(){return this._domMouseDragStart$}get domMouseDrag$(){return this._domMouseDrag$}get domMouseDragEnd$(){return this._domMouseDragEnd$}get domMouseDown$(){return this._domMouseDown$}get domMouseMove$(){return this._domMouseMove$}get mouseOwner$(){return this._mouseOwner$}get mouseDown$(){return this._mouseDown$}get mouseMove$(){return this._mouseMove$}get mouseLeave$(){return this._mouseLeave$}get mouseOut$(){return this._mouseOut$}get mouseOver$(){return this._mouseOver$}get mouseUp$(){return this._mouseUp$}get click$(){return this._click$}get dblClick$(){return this._dblClick$}get contextMenu$(){return this._consistentContextMenu$}get mouseWheel$(){return this._mouseWheel$}get mouseDragStart$(){return this._mouseDragStart$}get mouseDrag$(){return this._mouseDrag$}get mouseDragEnd$(){return this._mouseDragEnd$}get proximateClick$(){return this._proximateClick$}get staticClick$(){return this._staticClick$}claimMouse(e,t){this._claimMouse$.next({name:e,zindex:t})}unclaimMouse(e){this._claimMouse$.next({name:e,zindex:null})}deferPixels(e,t){this._deferPixelClaims$.next({name:e,deferPixels:t})}undeferPixels(e){this._deferPixelClaims$.next({name:e,deferPixels:null})}claimWheel(e,t){this._claimWheel$.next({name:e,zindex:t})}unclaimWheel(e){this._claimWheel$.next({name:e,zindex:null})}filtered$(e,t){return this._filtered(e,t,this._mouseOwner$)}filteredWheel$(e,t){return this._filtered(e,t,this._wheelOwner$)}_createDeferredMouseMove$(e,t){return t.pipe(Gi(t=>{const i=t.clientX-e.clientX,r=t.clientY-e.clientY;return[t,Math.sqrt(i*i+r*r)]}),to(this._deferPixels$),Jr(([[e,t],i])=>t>i),Gi(([[e,t],i])=>e))}_createMouseDrag$(e,t){return e.pipe(Gi(([e,t])=>t),Un(e=>Ii(e).pipe(kr(this._documentMouseMove$),qn(t))))}_createMouseDragEnd$(e,t){return e.pipe(Un(e=>t.pipe(vn())))}_createMouseDragStart$(e){return e.pipe(Gi(([e,t])=>e))}_createMouseDragInitiate$(e,t,i){return e.pipe(Jr(e=>0===e.button),Un(e=>or(Ii(e),i?this._createDeferredMouseMove$(e,this._documentMouseMove$):this._documentMouseMove$).pipe(qn(t),cn(1))))}_createOwner$(e){return e.pipe(xn((e,t)=>(null==t.zindex?delete e[t.name]:e[t.name]=t.zindex,e),{}),Gi(e=>{let t=null,i=-1;for(const r in e)e.hasOwnProperty(r)&&e[r]>i&&(i=e[r],t=r);return t}),$n(null))}_filtered(e,t,i){return t.pipe(to(i),Jr(([t,i])=>i===e),Gi(([e,t])=>e))}}class Ao{constructor(e,t){this._canvasContainer=e,this._domContainer=t,this._activeSubject$=new gi(!1),this._active$=this._activeSubject$.pipe(Xr(),Mn(new Di(1)),ui()),fr(t,"touchmove").subscribe(e=>{e.preventDefault()}),this._touchStart$=fr(e,"touchstart"),this._touchMove$=fr(e,"touchmove"),this._touchEnd$=fr(e,"touchend"),this._touchCancel$=fr(e,"touchcancel");const i=this._touchStart$.pipe(Jr(e=>1===e.touches.length&&1===e.targetTouches.length),Dn());var r;this._doubleTap$=i.pipe((r=()=>i.pipe(vn(),Un(e=>function(e,t,i){void 0===e&&(e=0);var r=-1;return gr(t)?r=Number(t)<1?1:Number(t):Mi(t)&&(i=t),Mi(i)||(i=Fi),new ii(function(t){var n=gr(e)?e:+e-i.now();return i.schedule(_r,n,{index:0,period:r,subscriber:t})})}(300).pipe(Sn(i),cn(1)))),function(e){return e.lift(new Pr(r))}),Jr(e=>2===e.length),Gi(e=>e[e.length-1]),Dn()),this._doubleTap$.subscribe(e=>{e.preventDefault()}),this._singleTouchMove$=this._touchMove$.pipe(Jr(e=>1===e.touches.length&&1===e.targetTouches.length),Dn());let n=vr(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(Jr(e=>1===e.touches.length&&1===e.targetTouches.length)),o=vr(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(Jr(e=>e.touches.length>=1)),a=vr(this._touchEnd$,this._touchCancel$).pipe(Jr(e=>0===e.touches.length));this._singleTouchDragStart$=n.pipe(hr(e=>this._singleTouchMove$.pipe(qn(vr(a,o)),cn(1)))),this._singleTouchDragEnd$=n.pipe(hr(e=>vr(a,o).pipe(vn()))),this._singleTouchDrag$=n.pipe(Un(e=>this._singleTouchMove$.pipe(kn(1),qn(vr(o,a)))));let s=vr(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=s.pipe(Jr(e=>2===e.touches.length&&2===e.targetTouches.length)),this._pinchEnd$=s.pipe(Jr(e=>2!==e.touches.length||2!==e.targetTouches.length)),this._pinchOperation$=new ci,this._pinch$=this._pinchOperation$.pipe(xn((e,t)=>t(e),{changeX:0,changeY:0,clientX:0,clientY:0,distance:0,distanceChange:0,distanceX:0,distanceY:0,originalEvent:null,pageX:0,pageY:0,screenX:0,screenY:0,touch1:null,touch2:null})),this._touchMove$.pipe(Jr(e=>2===e.touches.length&&2===e.targetTouches.length),Gi(e=>t=>{let i=e.touches[0],r=e.touches[1],n=Math.min(i.clientX,r.clientX),o=Math.max(i.clientX,r.clientX),a=Math.min(i.clientY,r.clientY),s=n+(o-n)/2,c=a+(Math.max(i.clientY,r.clientY)-a)/2,h=s+i.pageX-i.clientX,u=c+i.pageY-i.clientY,l=s+i.screenX-i.clientX,p=c+i.screenY-i.clientY,d=Math.abs(i.clientX-r.clientX),f=Math.abs(i.clientY-r.clientY),m=Math.sqrt(d*d+f*f),g=m-t.distance;return{changeX:d-t.distanceX,changeY:f-t.distanceY,clientX:s,clientY:c,distance:m,distanceChange:g,distanceX:d,distanceY:f,originalEvent:e,pageX:h,pageY:u,screenX:l,screenY:p,touch1:i,touch2:r}})).subscribe(this._pinchOperation$),this._pinchChange$=this._pinchStart$.pipe(Un(e=>this._pinch$.pipe(kn(1),qn(this._pinchEnd$))))}get active$(){return this._active$}get activate$(){return this._activeSubject$}get doubleTap$(){return this._doubleTap$}get touchStart$(){return this._touchStart$}get touchMove$(){return this._touchMove$}get touchEnd$(){return this._touchEnd$}get touchCancel$(){return this._touchCancel$}get singleTouchDragStart$(){return this._singleTouchDragStart$}get singleTouchDrag$(){return this._singleTouchDrag$}get singleTouchDragEnd$(){return this._singleTouchDragEnd$}get pinch$(){return this._pinchChange$}get pinchStart$(){return this._pinchStart$}get pinchEnd$(){return this._pinchEnd$}}class So{set json(e){this._json=e}set image(e){this._image=e,this._texture=new p.exports.Texture(this._image),this._texture.minFilter=p.exports.NearestFilter}get loaded(){return!(!this._image||!this._json)}getGLSprite(e){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");let t=this._json[e];if(!t)return console.warn("Sprite with key"+e+"does not exist in sprite definition."),new p.exports.Object3D;let i=this._texture.clone();i.needsUpdate=!0;let r=this._image.width,n=this._image.height;i.offset.x=t.x/r,i.offset.y=(n-t.y-t.height)/n,i.repeat.x=t.width/r,i.repeat.y=t.height/n;let o=new p.exports.SpriteMaterial({map:i});return new p.exports.Sprite(o)}getDOMSprite(t,i){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==i&&(i=e.Alignment.Center);let r=this._json[t];if(!r)return console.warn("Sprite with key"+t+"does not exist in sprite definition."),Bt.h("div",{},[]);let n=r.y,o=r.x+r.width,a=r.y+r.height,s=r.x,c=-r.x,h=-r.y,u=this._image.height,l=this._image.width;switch(i){case e.Alignment.Bottom:case e.Alignment.Center:case e.Alignment.Top:c-=r.width/2;break;case e.Alignment.BottomLeft:case e.Alignment.Left:case e.Alignment.TopLeft:c-=r.width;case e.Alignment.BottomRight:case e.Alignment.Right:case e.Alignment.BottomRight:}switch(i){case e.Alignment.Center:case e.Alignment.Left:case e.Alignment.Right:h-=r.height/2;break;case e.Alignment.Top:case e.Alignment.TopLeft:case e.Alignment.TopRight:h-=r.height;case e.Alignment.Bottom:case e.Alignment.BottomLeft:case e.Alignment.BottomRight:}let p=1/r.pixelRatio;n*=p,o*=p,a*=p,s*=p,c*=p,h*=p,u*=p,l*=p;let d={src:this._image.src,style:{clip:`rect(${n}px, ${o}px, ${a}px, ${s}px)`,height:`${u}px`,left:`${c}px`,position:"absolute",top:`${h}px`,width:`${l}px`}};return Bt.h("img",d,[])}}class Mo{constructor(e){if(this._retina=window.devicePixelRatio>1,this._spriteAtlasOperation$=new ci,this._spriteAtlas$=this._spriteAtlasOperation$.pipe($n(e=>e),xn((e,t)=>t(e),new So),Mn(new Di(1)),ui()),this._spriteAtlas$.subscribe(()=>{}),null==e)return;let t=this._retina?"@2x":"",i=new XMLHttpRequest;i.open("GET",e+t+".png",!0),i.custom&&i.custom.xhr&&(i=i.custom.xhr),i.responseType="arraybuffer",i.onload=()=>{let e=new Image;e.onload=()=>{this._spriteAtlasOperation$.next(t=>(t.image=e,t))};let t=new Blob([i.response]);e.src=window.URL.createObjectURL(t)},i.onerror=i=>{console.error(new Error(`Failed to fetch sprite sheet (${e}${t}.png)`))},i.send();let r=new XMLHttpRequest;r.open("GET",e+t+".json",!0),r.custom&&r.custom.xhr&&(r=r.custom.xhr),r.responseType="text",r.onload=()=>{let e=JSON.parse(r.response);this._spriteAtlasOperation$.next(t=>(t.json=e,t))},r.onerror=i=>{console.error(new Error(`Failed to fetch sheet (${e}${t}.json)`))},r.send()}get spriteAtlas$(){return this._spriteAtlas$}}class Eo{constructor(e,t,i,r){if(this.id=e,this._dom=r||new uo,this._container=this._dom.document.getElementById(e),!this._container)throw new Error(`Container '${e}' not found.`);this._container.classList.add("beeview-js"),this._canvasContainer=this._dom.createElement("div","beeview-js-interactive",this._container),this._domContainer=this._dom.createElement("div","beeview-js-dom",this._container),this.renderService=new vo(this._container,t.currentState$,i.renderMode),this.glRenderer=new mo(this._canvasContainer,this.renderService,this._dom),this.domRenderer=new ho(this._domContainer,this.renderService,t.currentState$),this.keyboardService=new xo(this._canvasContainer),this.mouseService=new wo(this._container,this._canvasContainer,this._domContainer,document),this.touchService=new Ao(this._canvasContainer,this._domContainer),this.spriteService=new Mo(i.sprite)}get element(){return this._container}get canvasContainer(){return this._canvasContainer}}class To{constructor(e,t){this._geoCoords=e||new v,this._viewportCoords=t||new _}basicToCanvas(e,t,i,r){return this._viewportCoords.basicToCanvas(e[0],e[1],t,r,i.perspective)}canvasToBasic(e,t,i,r){let n=this._viewportCoords.canvasToBasic(e[0],e[1],t,r,i.perspective);return(n[0]<0||n[0]>1||n[1]<0||n[1]>1)&&(n=null),n}eventToUnprojection(e,t,i,r,n){const o=this._viewportCoords.canvasPosition(e,t);return this.canvasToUnprojection(o,t,i,r,n)}canvasToUnprojection(e,t,i,r,n){const o=e[0],a=e[1],[s,c]=this._viewportCoords.canvasToViewport(o,a,t),h=new p.exports.Vector3(s,c,1).unproject(i.perspective);let u=n.projectBasic(h.toArray());(u[0]<0||u[0]>1||u[1]<0||u[1]>1)&&(u=null);const l=h.clone().sub(i.camera.position).normalize(),d=-2/l.z;let f=null;if(d>0&&d<100&&u){const e=l.clone().multiplyScalar(d).add(i.camera.position),t=this._geoCoords.enuToGeodetic(e.x,e.y,e.z,r.lat,r.lon,r.alt).slice(0,2);f={lat:t[0],lon:t[1]}}return{basicPoint:u,latLon:f,pixelPoint:[o,a]}}cameraToLngLat(e,t){const i=e.camera.position,[r,n]=this._geoCoords.enuToGeodetic(i.x,i.y,i.z,t.lat,t.lon,t.alt);return{lat:r,lon:n}}}class Co{}Co.fov="fov",Co.position="position",Co.pov="pov",Co.bearingchanged="bearingchanged",Co.panwithoutinertiachanged="panwithoutinertiachanged",Co.panchanged="panchanged",Co.click="click",Co.contextmenu="contextmenu",Co.dblclick="dblclick",Co.loadingchanged="loadingchanged",Co.mousedown="mousedown",Co.mousemove="mousemove",Co.mouseout="mouseout",Co.mouseover="mouseover",Co.mouseup="mouseup",Co.moveend="moveend",Co.movestart="movestart",Co.navigablechanged="navigablechanged",Co.nodechanged="nodechanged",Co.sequenceedgeschanged="sequenceedgeschanged",Co.spatialedgeschanged="spatialedgeschanged";class Io{constructor(e,t,i){this._container=i,this._eventEmitter=e,this._navigator=t,this._projection=new To,this._started=!1,this._navigable$=new ci,this._navigable$.subscribe(e=>{this._eventEmitter.fire(Co.navigablechanged,e)}),this._navigator.loadingService.loading$.subscribe(e=>{this._eventEmitter.fire(Co.loadingchanged,e)})}get started(){return this._started}get navigable$(){return this._navigable$}get projection(){return this._projection}projectBasic$(e){return or(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(vn(),Gi(([t,i])=>{const r=this._projection.basicToCanvas(e,this._container.element,t,i);return[Math.round(r[0]),Math.round(r[1])]}))}startEmit(){if(this._started)return;this._started=!0,this._currentNodeSubscription=this._navigator.stateService.currentNodeExternal$.subscribe(e=>{this.setFilter(["==","floorId",e.floorId]),this._eventEmitter.fire(Co.nodechanged,e)}),this._sequenceEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(Un(e=>e.sequenceEdges$)).subscribe(e=>{this._eventEmitter.fire(Co.sequenceedgeschanged,e)}),this._spatialEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(Un(e=>e.spatialEdges$)).subscribe(e=>{this._eventEmitter.fire(Co.spatialedgeschanged,e)}),this._moveSubscription=or(this._navigator.stateService.inMotion$,this._container.mouseService.active$,this._container.touchService.active$).pipe(Gi(e=>e[0]||e[1]||e[2]),Xr()).subscribe(e=>{e?this._eventEmitter.fire(Co.movestart,null):this._eventEmitter.fire(Co.moveend,null)}),this._bearingSubscription=this._container.renderService.bearing$.pipe(function(e,t,i){return void 0===t&&(t=Fi),void 0===i&&(i=Zn),function(r){return r.lift(new Kn(e,t,i.leading,i.trailing))}}(100),Xr((e,t)=>Math.abs(t-e)<1)).subscribe(e=>{this._eventEmitter.fire(Co.bearingchanged,e)}),this._panToWithoutInertiaSubscription=this._container.renderService.panWithoutInertia$.subscribe(e=>{this._eventEmitter.fire(Co.panwithoutinertiachanged,e)}),this._panToSubscription=this._container.renderService.pan$.subscribe(e=>{this._eventEmitter.fire(Co.panchanged,e)});const e=this._container.mouseService.active$.pipe(Un(e=>e?Si():this._container.mouseService.mouseMove$));this._viewerMouseEventSubscription=vr(this._mapMouseEvent$(Co.click,this._container.mouseService.staticClick$),this._mapMouseEvent$(Co.contextmenu,this._container.mouseService.contextMenu$),this._mapMouseEvent$(Co.dblclick,this._container.mouseService.dblClick$),this._mapMouseEvent$(Co.mousedown,this._container.mouseService.mouseDown$),this._mapMouseEvent$(Co.mousemove,e),this._mapMouseEvent$(Co.mouseout,this._container.mouseService.mouseOut$),this._mapMouseEvent$(Co.mouseover,this._container.mouseService.mouseOver$),this._mapMouseEvent$(Co.mouseup,this._container.mouseService.mouseUp$)).pipe(to(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$),Gi(([[e,t],i,r,n])=>{const o=this._projection.eventToUnprojection(t,this._container.element,i,r,n);return{basicPoint:o.basicPoint,latLon:o.latLon,originalEvent:t,pixelPoint:o.pixelPoint,target:this._eventEmitter,type:e}})).subscribe(e=>{this._eventEmitter.fire(e.type,e)}),this._positionSubscription=this._container.renderService.renderCamera$.pipe(Xr(([e,t],[i,r])=>this._closeTo(e,i,.01)&&this._closeTo(t,r,.01),e=>e.camera.position.toArray())).subscribe(()=>{this._eventEmitter.fire(Co.position,null)}),this._referenceSubscription=this._navigator.stateService.reference$.subscribe(()=>{this._eventEmitter.fire(Co.position,null)}),this._povSubscription=this._container.renderService.renderCamera$.pipe(Xr(([e,t],[i,r])=>this._closeTo(e,i,.001)&&this._closeTo(t,r,.001),e=>[e.rotation.phi,e.rotation.theta])).subscribe(()=>{this._eventEmitter.fire(Co.pov,null)}),this._fovSubscription=this._container.renderService.renderCamera$.pipe(Xr((e,t)=>this._closeTo(e,t,.01),e=>e.perspective.fov)).subscribe(()=>{this._eventEmitter.fire(Co.fov,null)})}stopEmit(){this.started&&(this._started=!1,this._referenceSubscription.unsubscribe(),this._positionSubscription.unsubscribe(),this._povSubscription.unsubscribe(),this._fovSubscription.unsubscribe(),this._bearingSubscription.unsubscribe(),this._panToWithoutInertiaSubscription.unsubscribe(),this._panToSubscription.unsubscribe(),this._currentNodeSubscription.unsubscribe(),this._moveSubscription.unsubscribe(),this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._viewerMouseEventSubscription.unsubscribe(),this._bearingSubscription=null,this._currentNodeSubscription=null,this._moveSubscription=null,this._sequenceEdgesSubscription=null,this._spatialEdgesSubscription=null,this._viewerMouseEventSubscription=null)}unproject$(e){return or(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$).pipe(vn(),Gi(([t,i,r])=>this._projection.canvasToUnprojection(e,this._container.element,t,i,r).latLon))}unprojectBasic$(e){return or(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(vn(),Gi(([t,i])=>this._projection.canvasToBasic(e,this._container.element,t,i)))}setFilter(e){return new Promise((t,i)=>{this._navigator.setFilter$(e).subscribe(()=>{t(void 0)},e=>{i(e)})})}_closeTo(e,t,i){return Math.abs(e-t)<=i}_mapMouseEvent$(e,t){return t.pipe(Gi(t=>[e,t]))}}class Po{constructor(){this._loadersSubject$=new ci,this._loaders$=this._loadersSubject$.pipe(xn((e,t)=>(void 0!==t.task&&(e[t.task]=t.loading),e),{}),$n({}),Mn(new Di(1)),ui())}get loading$(){return this._loaders$.pipe(Gi(e=>M.exports.reduce(e,(e,t)=>e||t,!1)),Br(100),Xr())}taskLoading$(e){return this._loaders$.pipe(Gi(t=>!!t[e]),Br(100),Xr())}startLoading(e){this._loadersSubject$.next({loading:!0,task:e})}stopLoading(e){this._loadersSubject$.next({loading:!1,task:e})}}class Ro{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,r){const n=this._compilePropertyReference(t),o=JSON.stringify(i);return(r?"typeof "+n+"===typeof "+o+"&&":"")+n+e+o}_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)+"]"}}class No{constructor(e){this._cache=null,this._core=e,this._fill=null}get assetsCached(){return null!=this._core&&null!=this._fill&&null!=this._cache&&null!=this._cache.image&&null!=this._cache.mesh}get cache(){return this._cache}get alt(){return this._fill.calt}get ca(){return null!=this._fill.cca?this._fill.cca:this._fill.ca}get capturedAt(){return this._fill.captured_at}get computedCA(){return this._fill.cca}get computedLatLon(){return this._core.cl}get focal(){return this._fill.cfocal}get full(){return null!=this._fill}get fullPano(){return null!=this._fill.gpano&&0===this._fill.gpano.CroppedAreaLeftPixels&&0===this._fill.gpano.CroppedAreaTopPixels&&this._fill.gpano.CroppedAreaImageWidthPixels===this._fill.gpano.FullPanoWidthPixels&&this._fill.gpano.CroppedAreaImageHeightPixels===this._fill.gpano.FullPanoHeightPixels}get gpano(){return this._fill.gpano}get height(){return this._fill.height}get image(){return this._cache.image}get key(){return this._core.key}get latLon(){return null!=this._core.l?this._core.l:this._core.cl}get loadStatus(){return this._cache.loadStatus}get merged(){return null!=this._fill&&null!=this._fill.merge_version&&this._fill.merge_version>0}get mergeCC(){return this._fill.merge_cc}get mergeVersion(){return this._fill.merge_version}get mesh(){return this._cache.mesh}get orientation(){return this._fill.orientation}get originalCA(){return this._fill.ca}get originalLatLon(){return this._core.l}get pano(){return null!=this._fill.gpano&&null!=this._fill.gpano.FullPanoWidthPixels}get projectKey(){return null!=this._fill.project?this._fill.project.key:null}get rotation(){return this._fill.c_rotation}get translation(){return this._fill.c_translation}get scale(){return this._fill.atomic_scale}get sequenceKey(){return this._core.sequence.key}get sequenceEdges(){return this._cache.sequenceEdges}get sequenceEdges$(){return this._cache.sequenceEdges$}get spatialEdges(){return this._cache.spatialEdges}get spatialEdges$(){return this._cache.spatialEdges$}get userKey(){return this._fill.user.key}get username(){return this._fill.user.username}get tags(){return this._fill.tags}get width(){return this._fill.width}get date(){return this._fill.date}get floor(){return this._fill.floor}get floorId(){return this._fill.floor.id}get building(){return this._fill.building}cacheAssets$(){return this._cache.cacheAssets$(this.key,this.pano,this.merged).pipe(Gi(e=>this))}cacheImage$(e){return this._cache.cacheImage$(this.key,e).pipe(Gi(e=>this))}cacheSequenceEdges(e){this._cache.cacheSequenceEdges(e)}cacheSpatialEdges(e){this._cache.cacheSpatialEdges(e)}dispose(){null!=this._cache&&(this._cache.dispose(),this._cache=null),this._core=null,this._fill=null}initializeCache(e){if(null!=this._cache)throw new Error(`Node cache already initialized (${this.key}).`);this._cache=e}makeFull(e){if(null==e)throw new Error("Fill can not be null.");this._fill=e}resetSequenceEdges(){this._cache.resetSequenceEdges()}resetSpatialEdges(){this._cache.resetSpatialEdges()}uncache(){null!=this._cache&&(this._cache.dispose(),this._cache=null)}}var Oo={
|
|
8
|
+
var ht=function(e){var t,i=String.prototype.split,r=/()??/.exec("")[1]===e;return t=function(t,n,o){if("[object RegExp]"!==Object.prototype.toString.call(n))return i.call(t,n,o);var a,s,c,h,u=[],l=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),p=0;n=new RegExp(n.source,l+"g");for(t+="",r||(a=new RegExp("^"+n.source+"$(?!\\s)",l)),o=o===e?-1>>>0:o>>>0;(s=n.exec(t))&&!((c=s.index+s[0].length)>p&&(u.push(t.slice(p,s.index)),!r&&s.length>1&&s[0].replace(a,function(){for(var t=1;t<arguments.length-2;t++)arguments[t]===e&&(s[t]=e)}),s.length>1&&s.index<t.length&&Array.prototype.push.apply(u,s.slice(1)),h=s[0].length,p=c,u.length>=o));)n.lastIndex===s.index&&n.lastIndex++;return p===t.length?!h&&n.test("")||u.push(""):u.push(t.slice(p)),u.length>o?u.slice(0,o):u},t}(),ut=ht,lt=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,pt=/^\.|#/,dt=function(e,t){if(!e)return"DIV";var i,r,n,o,a=!t.hasOwnProperty("id"),s=ut(e,lt),c=null;pt.test(s[1])&&(c="DIV");for(o=0;o<s.length;o++)(r=s[o])&&(n=r.charAt(0),c?"."===n?(i=i||[]).push(r.substring(1,r.length)):"#"===n&&a&&(t.id=r.substring(1,r.length)):c=r);i&&(t.className&&i.push(t.className),t.className=i.join(" "));return t.namespace?c:c.toUpperCase()};var ft=mt;function mt(e){if(!(this instanceof mt))return new mt(e);this.value=e}mt.prototype.hook=function(e,t){e[t]!==this.value&&(e[t]=this.value)};var gt="undefined"!=typeof window?window:void 0!==u?u:{};var vt=function(e,t){if(e in gt)return gt[e];return gt[e]=t,t},_t=function(e,t,i){var r="__INDIVIDUAL_ONE_VERSION_"+e,n=vt(r+"_ENFORCE_SINGLETON",t);if(n!==t)throw new Error("Can only have one copy of "+e+".\nYou already have version "+n+" installed.\nThis means you cannot install version "+t);return vt(r,i)};_t("ev-store","7");var yt="__EV_STORE_KEY@7";var bt=function(e){var t=e[yt];t||(t=e[yt]={});return t},xt=wt;function wt(e){if(!(this instanceof wt))return new wt(e);this.value=e}wt.prototype.hook=function(e,t){bt(e)[t.substr(3)]=this.value},wt.prototype.unhook=function(e,t){bt(e)[t.substr(3)]=void 0};var At=C,St=it,Mt=st,Et=L,Tt=k,Ct=B,It=q,Pt=F,Rt=dt,Nt=ft,Ot=xt;function Lt(e,t,i,r){if("string"==typeof e)t.push(new Mt(e));else if("number"==typeof e)t.push(new Mt(String(e)));else if(Dt(e))t.push(e);else{if(!At(e)){if(null==e)return;throw o={foreignObject:e,parentVnode:{tagName:i,properties:r}},(a=new Error).type="virtual-hyperscript.unexpected.virtual-element",a.message="Unexpected virtual child passed to h().\nExpected a VNode / Vthunk / VWidget / string but:\ngot:\n"+kt(o.foreignObject)+".\nThe parent vnode is:\n"+kt(o.parentVnode),a.foreignObject=o.foreignObject,a.parentVnode=o.parentVnode,a}for(var n=0;n<e.length;n++)Lt(e[n],t,i,r)}var o,a}function Dt(e){return Et(e)||Tt(e)||Ct(e)||Pt(e)}function kt(e){try{return JSON.stringify(e,null," ")}catch(t){return String(e)}}var Bt={diff:me,patch:Xe,h:function(e,t,i){var r,n,o,a,s=[];!i&&(c=t,"string"==typeof c||At(c)||Dt(c))&&(i=t,n={});var c;r=Rt(e,n=n||t||{}),n.hasOwnProperty("key")&&(o=n.key,n.key=void 0);n.hasOwnProperty("namespace")&&(a=n.namespace,n.namespace=void 0);"INPUT"!==r||a||!n.hasOwnProperty("value")||void 0===n.value||It(n.value)||(n.value=Nt(n.value));(function(e){for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];if(It(i))continue;"ev-"===t.substr(0,3)&&(e[t]=Ot(i))}})(n),null!=i&&Lt(i,s,r,n);return new St(r,n,s,o,a)},create:Pe,VNode:it,VText:st},Ft=function(e,t){return Ft=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},Ft(e,t)};function jt(e,t){function i(){this.constructor=e}Ft(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function zt(e){return"function"==typeof e}var Vt=!1,$t={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack;Vt=e},get useDeprecatedSynchronousErrorHandling(){return Vt}};function Ut(e){setTimeout(function(){throw e})}var Gt={closed:!0,next:function(e){},error:function(e){if($t.useDeprecatedSynchronousErrorHandling)throw e;Ut(e)},complete:function(){}},Ht=Array.isArray||function(e){return e&&"number"==typeof e.length};function qt(e){return null!==e&&"object"==typeof e}function Wt(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}Wt.prototype=Object.create(Error.prototype);var Qt=Wt,Yt=function(){function e(e){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,e&&(this._unsubscribe=e)}return e.prototype.unsubscribe=function(){var e,t=!1;if(!this.closed){var i=this,r=i._parent,n=i._parents,o=i._unsubscribe,a=i._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var s=-1,c=n?n.length:0;r;)r.remove(this),r=++s<c&&n[s]||null;if(zt(o))try{o.call(this)}catch(i){t=!0,e=i instanceof Qt?Xt(i.errors):[i]}if(Ht(a))for(s=-1,c=a.length;++s<c;){var h=a[s];if(qt(h))try{h.unsubscribe()}catch(i){t=!0,e=e||[],i instanceof Qt?e=e.concat(Xt(i.errors)):e.push(i)}}if(t)throw new Qt(e)}},e.prototype.add=function(t){var i=t;switch(typeof t){case"function":i=new e(t);case"object":if(i===this||i.closed||"function"!=typeof i.unsubscribe)return i;if(this.closed)return i.unsubscribe(),i;if(!(i instanceof e)){var r=i;(i=new e)._subscriptions=[r]}break;default:if(!t)return e.EMPTY;throw new Error("unrecognized teardown "+t+" added to Subscription.")}if(i._addParent(this)){var n=this._subscriptions;n?n.push(i):this._subscriptions=[i]}return i},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var i=t.indexOf(e);-1!==i&&t.splice(i,1)}},e.prototype._addParent=function(e){var t=this._parent,i=this._parents;return t!==e&&(t?i?-1===i.indexOf(e)&&(i.push(e),!0):(this._parents=[e],!0):(this._parent=e,!0))},e.EMPTY=function(e){return e.closed=!0,e}(new e),e}();function Xt(e){return e.reduce(function(e,t){return e.concat(t instanceof Qt?t.errors:t)},[])}var Zt="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),Kt=function(e){function t(i,r,n){var o=e.call(this)||this;switch(o.syncErrorValue=null,o.syncErrorThrown=!1,o.syncErrorThrowable=!1,o.isStopped=!1,arguments.length){case 0:o.destination=Gt;break;case 1:if(!i){o.destination=Gt;break}if("object"==typeof i){i instanceof t?(o.syncErrorThrowable=i.syncErrorThrowable,o.destination=i,i.add(o)):(o.syncErrorThrowable=!0,o.destination=new Jt(o,i));break}default:o.syncErrorThrowable=!0,o.destination=new Jt(o,i,r,n)}return o}return jt(t,e),t.prototype[Zt]=function(){return this},t.create=function(e,i,r){var n=new t(e,i,r);return n.syncErrorThrowable=!1,n},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this))},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var e=this._parent,t=this._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=e,this._parents=t,this},t}(Yt),Jt=function(e){function t(t,i,r,n){var o,a=e.call(this)||this;a._parentSubscriber=t;var s=a;return zt(i)?o=i:i&&(o=i.next,r=i.error,n=i.complete,i!==Gt&&(zt((s=Object.create(i)).unsubscribe)&&a.add(s.unsubscribe.bind(s)),s.unsubscribe=a.unsubscribe.bind(a))),a._context=s,a._next=o,a._error=r,a._complete=n,a}return jt(t,e),t.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;$t.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},t.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,i=$t.useDeprecatedSynchronousErrorHandling;if(this._error)i&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)i?(t.syncErrorValue=e,t.syncErrorThrown=!0):Ut(e),this.unsubscribe();else{if(this.unsubscribe(),i)throw e;Ut(e)}}},t.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var i=function(){return e._complete.call(e._context)};$t.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,i),this.unsubscribe()):(this.__tryOrUnsub(i),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),$t.useDeprecatedSynchronousErrorHandling)throw e;Ut(e)}},t.prototype.__tryOrSetError=function(e,t,i){if(!$t.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,i)}catch(t){return $t.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(Ut(t),!0)}return!1},t.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},t}(Kt);var ei="function"==typeof Symbol&&Symbol.observable||"@@observable";function ti(){}var ii=function(){function e(e){this._isScalar=!1,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 r=this.operator,n=function(e,t,i){if(e){if(e instanceof Kt)return e;if(e[Zt])return e[Zt]()}return e||t||i?new Kt(e,t,i):new Kt(Gt)}(e,t,i);if(r?n.add(r.call(n,this.source)):n.add(this.source||$t.useDeprecatedSynchronousErrorHandling&&!n.syncErrorThrowable?this._subscribe(n):this._trySubscribe(n)),$t.useDeprecatedSynchronousErrorHandling&&n.syncErrorThrowable&&(n.syncErrorThrowable=!1,n.syncErrorThrown))throw n.syncErrorValue;return n},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){$t.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),!function(e){for(;e;){var t=e,i=t.closed,r=t.destination,n=t.isStopped;if(i||n)return!1;e=r&&r instanceof Kt?r:null}return!0}(e)?console.warn(t):e.error(t)}},e.prototype.forEach=function(e,t){var i=this;return new(t=ri(t))(function(t,r){var n;n=i.subscribe(function(t){try{e(t)}catch(e){r(e),n&&n.unsubscribe()}},r,t)})},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[ei]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return 0===t.length?this:((e=t)?1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}:ti)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ri(e))(function(e,i){var r;t.subscribe(function(e){return r=e},function(e){return i(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function ri(e){if(e||(e=Promise),!e)throw new Error("no Promise impl found");return e}function ni(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}ni.prototype=Object.create(Error.prototype);var oi=ni,ai=function(e){function t(t,i){var r=e.call(this)||this;return r.subject=t,r.subscriber=i,r.closed=!1,r}return jt(t,e),t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var i=t.indexOf(this.subscriber);-1!==i&&t.splice(i,1)}}},t}(Yt),si=function(e){function t(t){var i=e.call(this,t)||this;return i.destination=t,i}return jt(t,e),t}(Kt),ci=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return jt(t,e),t.prototype[Zt]=function(){return new si(this)},t.prototype.lift=function(e){var t=new hi(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new oi;if(!this.isStopped)for(var t=this.observers,i=t.length,r=t.slice(),n=0;n<i;n++)r[n].next(e)},t.prototype.error=function(e){if(this.closed)throw new oi;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,i=t.length,r=t.slice(),n=0;n<i;n++)r[n].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new oi;this.isStopped=!0;for(var e=this.observers,t=e.length,i=e.slice(),r=0;r<t;r++)i[r].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(this.closed)throw new oi;return e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){if(this.closed)throw new oi;return this.hasError?(e.error(this.thrownError),Yt.EMPTY):this.isStopped?(e.complete(),Yt.EMPTY):(this.observers.push(e),new ai(this,e))},t.prototype.asObservable=function(){var e=new ii;return e.source=this,e},t.create=function(e,t){return new hi(e,t)},t}(ii),hi=function(e){function t(t,i){var r=e.call(this)||this;return r.destination=t,r.source=i,r}return jt(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):Yt.EMPTY},t}(ci);function ui(){return function(e){return e.lift(new li(e))}}var li=function(){function e(e){this.connectable=e}return e.prototype.call=function(e,t){var i=this.connectable;i._refCount++;var r=new pi(e,i),n=t.subscribe(r);return r.closed||(r.connection=i.connect()),n},e}(),pi=function(e){function t(t,i){var r=e.call(this,t)||this;return r.connectable=i,r}return jt(t,e),t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._refCount;if(t<=0)this.connection=null;else if(e._refCount=t-1,t>1)this.connection=null;else{var i=this.connection,r=e._connection;this.connection=null,!r||i&&r!==i||r.unsubscribe()}}else this.connection=null},t}(Kt),di=function(e){function t(t,i){var r=e.call(this)||this;return r.source=t,r.subjectFactory=i,r._refCount=0,r._isComplete=!1,r}return jt(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.connect=function(){var e=this._connection;return e||(this._isComplete=!1,(e=this._connection=new Yt).add(this.source.subscribe(new mi(this.getSubject(),this))),e.closed?(this._connection=null,e=Yt.EMPTY):this._connection=e),e},t.prototype.refCount=function(){return ui()(this)},t}(ii).prototype,fi={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:di._subscribe},_isComplete:{value:di._isComplete,writable:!0},getSubject:{value:di.getSubject},connect:{value:di.connect},refCount:{value:di.refCount}},mi=function(e){function t(t,i){var r=e.call(this,t)||this;return r.connectable=i,r}return jt(t,e),t.prototype._error=function(t){this._unsubscribe(),e.prototype._error.call(this,t)},t.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._connection;e._refCount=0,e._subject=null,e._connection=null,t&&t.unsubscribe()}},t}(si),gi=function(e){function t(t){var i=e.call(this)||this;return i._value=t,i}return jt(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var i=e.prototype._subscribe.call(this,t);return i&&!i.closed&&t.next(this._value),i},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new oi;return this._value},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(ci),vi=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.scheduler=t,r.work=i,r.pending=!1,r}return jt(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,r=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(r,i,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,i){return void 0===i&&(i=0),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;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=!1,r=void 0;try{this.work(e)}catch(e){i=!0,r=!!e&&e||new Error(e)}if(i)return this.unsubscribe(),r},t.prototype._unsubscribe=function(){var e=this.id,t=this.scheduler,i=t.actions,r=i.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&i.splice(r,1),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null},t}(function(e){function t(t,i){return e.call(this)||this}return jt(t,e),t.prototype.schedule=function(e,t){return this},t}(Yt)),_i=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.scheduler=t,r.work=i,r}return jt(t,e),t.prototype.schedule=function(t,i){return void 0===i&&(i=0),i>0?e.prototype.schedule.call(this,t,i):(this.delay=i,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,i){return i>0||this.closed?e.prototype.execute.call(this,t,i):this._execute(t,i)},t.prototype.requestAsyncId=function(t,i,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?e.prototype.requestAsyncId.call(this,t,i,r):t.flush(this)},t}(vi),yi=function(){function e(t,i){void 0===i&&(i=e.now),this.SchedulerAction=t,this.now=i}return e.prototype.schedule=function(e,t,i){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(i,t)},e.now=function(){return Date.now()},e}(),bi=function(e){function t(i,r){void 0===r&&(r=yi.now);var n=e.call(this,i,function(){return t.delegate&&t.delegate!==n?t.delegate.now():r()})||this;return n.actions=[],n.active=!1,n.scheduled=void 0,n}return jt(t,e),t.prototype.schedule=function(i,r,n){return void 0===r&&(r=0),t.delegate&&t.delegate!==this?t.delegate.schedule(i,r,n):e.prototype.schedule.call(this,i,r,n)},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}(yi),xi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return jt(t,e),t}(bi),wi=new xi(_i),Ai=new ii(function(e){return e.complete()});function Si(e){return e?function(e){return new ii(function(t){return e.schedule(function(){return t.complete()})})}(e):Ai}function Mi(e){return e&&"function"==typeof e.schedule}var Ei=function(e){return function(t){for(var i=0,r=e.length;i<r&&!t.closed;i++)t.next(e[i]);t.closed||t.complete()}};function Ti(e,t){return new ii(t?function(i){var r=new Yt,n=0;return r.add(t.schedule(function(){n!==e.length?(i.next(e[n++]),i.closed||r.add(this.schedule())):i.complete()})),r}:Ei(e))}function Ci(e){var t=new ii(function(t){t.next(e),t.complete()});return t._isScalar=!0,t.value=e,t}function Ii(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[e.length-1];switch(Mi(i)?e.pop():i=void 0,e.length){case 0:return Si(i);case 1:return i?Ti(e,i):Ci(e[0]);default:return Ti(e,i)}}function Pi(e,t){return new ii(t?function(i){return t.schedule(Ri,0,{error:e,subscriber:i})}:function(t){return t.error(e)})}function Ri(e){var t=e.error;e.subscriber.error(t)}var Ni=function(){function e(e,t,i){this.kind=e,this.value=t,this.error=i,this.hasValue="N"===e}return e.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}},e.prototype.do=function(e,t,i){switch(this.kind){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return i&&i()}},e.prototype.accept=function(e,t,i){return e&&"function"==typeof e.next?this.observe(e):this.do(e,t,i)},e.prototype.toObservable=function(){switch(this.kind){case"N":return Ii(this.value);case"E":return Pi(this.error);case"C":return Si()}throw new Error("unexpected notification kind value")},e.createNext=function(t){return void 0!==t?new e("N",t):e.undefinedValueNotification},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e.undefinedValueNotification=new e("N",void 0),e}(),Oi=function(e){function t(t,i,r){void 0===r&&(r=0);var n=e.call(this,t)||this;return n.scheduler=i,n.delay=r,n}return jt(t,e),t.dispatch=function(e){var t=e.notification,i=e.destination;t.observe(i),this.unsubscribe()},t.prototype.scheduleMessage=function(e){this.destination.add(this.scheduler.schedule(t.dispatch,this.delay,new Li(e,this.destination)))},t.prototype._next=function(e){this.scheduleMessage(Ni.createNext(e))},t.prototype._error=function(e){this.scheduleMessage(Ni.createError(e)),this.unsubscribe()},t.prototype._complete=function(){this.scheduleMessage(Ni.createComplete()),this.unsubscribe()},t}(Kt),Li=function(){return function(e,t){this.notification=e,this.destination=t}}(),Di=function(e){function t(t,i,r){void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===i&&(i=Number.POSITIVE_INFINITY);var n=e.call(this)||this;return n.scheduler=r,n._events=[],n._infiniteTimeWindow=!1,n._bufferSize=t<1?1:t,n._windowTime=i<1?1:i,i===Number.POSITIVE_INFINITY?(n._infiniteTimeWindow=!0,n.next=n.nextInfiniteTimeWindow):n.next=n.nextTimeWindow,n}return jt(t,e),t.prototype.nextInfiniteTimeWindow=function(t){var i=this._events;i.push(t),i.length>this._bufferSize&&i.shift(),e.prototype.next.call(this,t)},t.prototype.nextTimeWindow=function(t){this._events.push(new ki(this._getNow(),t)),this._trimBufferThenGetEvents(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){var t,i=this._infiniteTimeWindow,r=i?this._events:this._trimBufferThenGetEvents(),n=this.scheduler,o=r.length;if(this.closed)throw new oi;if(this.isStopped||this.hasError?t=Yt.EMPTY:(this.observers.push(e),t=new ai(this,e)),n&&e.add(e=new Oi(e,n)),i)for(var a=0;a<o&&!e.closed;a++)e.next(r[a]);else for(a=0;a<o&&!e.closed;a++)e.next(r[a].value);return this.hasError?e.error(this.thrownError):this.isStopped&&e.complete(),t},t.prototype._getNow=function(){return(this.scheduler||wi).now()},t.prototype._trimBufferThenGetEvents=function(){for(var e=this._getNow(),t=this._bufferSize,i=this._windowTime,r=this._events,n=r.length,o=0;o<n&&!(e-r[o].time<i);)o++;return n>t&&(o=Math.max(o,n-t)),o>0&&r.splice(0,o),r},t}(ci),ki=function(){return function(e,t){this.time=e,this.value=t}}(),Bi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.value=null,t.hasNext=!1,t.hasCompleted=!1,t}return jt(t,e),t.prototype._subscribe=function(t){return this.hasError?(t.error(this.thrownError),Yt.EMPTY):this.hasCompleted&&this.hasNext?(t.next(this.value),t.complete(),Yt.EMPTY):e.prototype._subscribe.call(this,t)},t.prototype.next=function(e){this.hasCompleted||(this.value=e,this.hasNext=!0)},t.prototype.error=function(t){this.hasCompleted||e.prototype.error.call(this,t)},t.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&e.prototype.next.call(this,this.value),e.prototype.complete.call(this)},t}(ci),Fi=new bi(vi);function ji(e){return e}function zi(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}zi.prototype=Object.create(Error.prototype);var Vi=zi;function $i(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}$i.prototype=Object.create(Error.prototype);var Ui=$i;function Gi(e,t){return function(i){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return i.lift(new Hi(e,t))}}var Hi=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new qi(e,this.project,this.thisArg))},e}(),qi=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.project=i,n.count=0,n.thisArg=r||n,n}return jt(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(Kt),Wi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return jt(t,e),t.prototype.notifyNext=function(e,t,i,r,n){this.destination.next(t)},t.prototype.notifyError=function(e,t){this.destination.error(e)},t.prototype.notifyComplete=function(e){this.destination.complete()},t}(Kt),Qi=function(e){function t(t,i,r){var n=e.call(this)||this;return n.parent=t,n.outerValue=i,n.outerIndex=r,n.index=0,n}return jt(t,e),t.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},t.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},t}(Kt),Yi=function(e){return function(t){return e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,Ut),t}};function Xi(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var Zi=Xi(),Ki=function(e){return function(t){for(var i=e[Zi]();;){var r=i.next();if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof i.return&&t.add(function(){i.return&&i.return()}),t}},Ji=function(e){return function(t){var i=e[ei]();if("function"!=typeof i.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return i.subscribe(t)}},er=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function tr(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}var ir=function(e){if(e instanceof ii)return function(t){return e._isScalar?(t.next(e.value),void t.complete()):e.subscribe(t)};if(e&&"function"==typeof e[ei])return Ji(e);if(er(e))return Ei(e);if(tr(e))return Yi(e);if(e&&"function"==typeof e[Zi])return Ki(e);var t=qt(e)?"an invalid object":"'"+e+"'";throw new TypeError("You provided "+t+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")};function rr(e,t,i,r,n){if(void 0===n&&(n=new Qi(e,i,r)),!n.closed)return ir(t)(n)}var nr={};function or(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=null,r=null;return Mi(e[e.length-1])&&(r=e.pop()),"function"==typeof e[e.length-1]&&(i=e.pop()),1===e.length&&Ht(e[0])&&(e=e[0]),Ti(e,r).lift(new ar(i))}var ar=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new sr(e,this.resultSelector))},e}(),sr=function(e){function t(t,i){var r=e.call(this,t)||this;return r.resultSelector=i,r.active=0,r.values=[],r.observables=[],r}return jt(t,e),t.prototype._next=function(e){this.values.push(nr),this.observables.push(e)},t.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{this.active=t,this.toRespond=t;for(var i=0;i<t;i++){var r=e[i];this.add(rr(this,r,r,i))}}},t.prototype.notifyComplete=function(e){0==(this.active-=1)&&this.destination.complete()},t.prototype.notifyNext=function(e,t,i,r,n){var o=this.values,a=o[i],s=this.toRespond?a===nr?--this.toRespond:this.toRespond:0;o[i]=t,0===s&&(this.resultSelector?this._tryResultSelector(o):this.destination.next(o.slice()))},t.prototype._tryResultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(Wi);function cr(e,t){if(!t)return e instanceof ii?e:new ii(ir(e));if(null!=e){if(function(e){return e&&"function"==typeof e[ei]}(e))return function(e,t){return new ii(t?function(i){var r=new Yt;return r.add(t.schedule(function(){var n=e[ei]();r.add(n.subscribe({next:function(e){r.add(t.schedule(function(){return i.next(e)}))},error:function(e){r.add(t.schedule(function(){return i.error(e)}))},complete:function(){r.add(t.schedule(function(){return i.complete()}))}}))})),r}:Ji(e))}(e,t);if(tr(e))return function(e,t){return new ii(t?function(i){var r=new Yt;return r.add(t.schedule(function(){return e.then(function(e){r.add(t.schedule(function(){i.next(e),r.add(t.schedule(function(){return i.complete()}))}))},function(e){r.add(t.schedule(function(){return i.error(e)}))})})),r}:Yi(e))}(e,t);if(er(e))return Ti(e,t);if(function(e){return e&&"function"==typeof e[Zi]}(e)||"string"==typeof e)return function(e,t){if(!e)throw new Error("Iterable cannot be null");return new ii(t?function(i){var r,n=new Yt;return n.add(function(){r&&"function"==typeof r.return&&r.return()}),n.add(t.schedule(function(){r=e[Zi](),n.add(t.schedule(function(){if(!i.closed){var e,t;try{var n=r.next();e=n.value,t=n.done}catch(e){return void i.error(e)}t?i.complete():(i.next(e),this.schedule())}}))})),n}:Ki(e))}(e,t)}throw new TypeError((null!==e&&typeof e||e)+" is not observable")}function hr(e,t,i){return void 0===i&&(i=Number.POSITIVE_INFINITY),"function"==typeof t?function(r){return r.pipe(hr(function(i,r){return cr(e(i,r)).pipe(Gi(function(e,n){return t(i,e,r,n)}))},i))}:("number"==typeof t&&(i=t),function(t){return t.lift(new ur(e,i))})}var ur=function(){function e(e,t){void 0===t&&(t=Number.POSITIVE_INFINITY),this.project=e,this.concurrent=t}return e.prototype.call=function(e,t){return t.subscribe(new lr(e,this.project,this.concurrent))},e}(),lr=function(e){function t(t,i,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var n=e.call(this,t)||this;return n.project=i,n.concurrent=r,n.hasCompleted=!1,n.buffer=[],n.active=0,n.index=0,n}return jt(t,e),t.prototype._next=function(e){this.active<this.concurrent?this._tryNext(e):this.buffer.push(e)},t.prototype._tryNext=function(e){var t,i=this.index++;try{t=this.project(e,i)}catch(e){return void this.destination.error(e)}this.active++,this._innerSub(t,e,i)},t.prototype._innerSub=function(e,t,i){var r=new Qi(this,void 0,void 0);this.destination.add(r),rr(this,e,t,i,r)},t.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},t.prototype.notifyNext=function(e,t,i,r,n){this.destination.next(t)},t.prototype.notifyComplete=function(e){var t=this.buffer;this.remove(e),this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},t}(Wi);function pr(e){return void 0===e&&(e=Number.POSITIVE_INFINITY),hr(ji,e)}function dr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return pr(1)(Ii.apply(void 0,e))}function fr(e,t,i,r){return zt(i)&&(r=i,i=void 0),r?fr(e,t,i).pipe(Gi(function(e){return Ht(e)?r.apply(void 0,e):r(e)})):new ii(function(r){mr(e,t,function(e){arguments.length>1?r.next(Array.prototype.slice.call(arguments)):r.next(e)},r,i)})}function mr(e,t,i,r,n){var o;if(function(e){return e&&"function"==typeof e.addEventListener&&"function"==typeof e.removeEventListener}(e)){var a=e;e.addEventListener(t,i,n),o=function(){return a.removeEventListener(t,i,n)}}else if(function(e){return e&&"function"==typeof e.on&&"function"==typeof e.off}(e)){var s=e;e.on(t,i),o=function(){return s.off(t,i)}}else if(function(e){return e&&"function"==typeof e.addListener&&"function"==typeof e.removeListener}(e)){var c=e;e.addListener(t,i),o=function(){return c.removeListener(t,i)}}else{if(!e||!e.length)throw new TypeError("Invalid event target");for(var h=0,u=e.length;h<u;h++)mr(e[h],t,i,r,n)}r.add(o)}function gr(e){return!Ht(e)&&e-parseFloat(e)+1>=0}function vr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Number.POSITIVE_INFINITY,r=null,n=e[e.length-1];return Mi(n)?(r=e.pop(),e.length>1&&"number"==typeof e[e.length-1]&&(i=e.pop())):"number"==typeof n&&(i=e.pop()),null===r&&1===e.length&&e[0]instanceof ii?e[0]:pr(i)(Ti(e,r))}function _r(e){var t=e.index,i=e.period,r=e.subscriber;if(r.next(t),!r.closed){if(-1===i)return r.complete();e.index=t+1,this.schedule(e,i)}}function yr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[e.length-1];return"function"==typeof i&&e.pop(),Ti(e,void 0).lift(new xr(i))}var br,xr=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new wr(e,this.resultSelector))},e}(),wr=function(e){function t(t,i,r){void 0===r&&(r=Object.create(null));var n=e.call(this,t)||this;return n.iterators=[],n.active=0,n.resultSelector="function"==typeof i?i:null,n.values=r,n}return jt(t,e),t.prototype._next=function(e){var t=this.iterators;Ht(e)?t.push(new Sr(e)):"function"==typeof e[Zi]?t.push(new Ar(e[Zi]())):t.push(new Mr(this.destination,this,e))},t.prototype._complete=function(){var e=this.iterators,t=e.length;if(this.unsubscribe(),0!==t){this.active=t;for(var i=0;i<t;i++){var r=e[i];if(r.stillUnsubscribed)this.destination.add(r.subscribe(r,i));else this.active--}}else this.destination.complete()},t.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},t.prototype.checkIterators=function(){for(var e=this.iterators,t=e.length,i=this.destination,r=0;r<t;r++){if("function"==typeof(a=e[r]).hasValue&&!a.hasValue())return}var n=!1,o=[];for(r=0;r<t;r++){var a,s=(a=e[r]).next();if(a.hasCompleted()&&(n=!0),s.done)return void i.complete();o.push(s.value)}this.resultSelector?this._tryresultSelector(o):i.next(o),n&&i.complete()},t.prototype._tryresultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(Kt),Ar=function(){function e(e){this.iterator=e,this.nextResult=e.next()}return e.prototype.hasValue=function(){return!0},e.prototype.next=function(){var e=this.nextResult;return this.nextResult=this.iterator.next(),e},e.prototype.hasCompleted=function(){var e=this.nextResult;return e&&e.done},e}(),Sr=function(){function e(e){this.array=e,this.index=0,this.length=0,this.length=e.length}return e.prototype[Zi]=function(){return this},e.prototype.next=function(e){var t=this.index++,i=this.array;return t<this.length?{value:i[t],done:!1}:{value:null,done:!0}},e.prototype.hasValue=function(){return this.array.length>this.index},e.prototype.hasCompleted=function(){return this.array.length===this.index},e}(),Mr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.parent=i,n.observable=r,n.stillUnsubscribed=!0,n.buffer=[],n.isComplete=!1,n}return jt(t,e),t.prototype[Zi]=function(){return this},t.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},t.prototype.hasValue=function(){return this.buffer.length>0},t.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},t.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},t.prototype.notifyNext=function(e,t,i,r,n){this.buffer.push(t),this.parent.checkIterators()},t.prototype.subscribe=function(e,t){return rr(this,this.observable,this,t)},t}(Wi);function Er(e,t){return void 0===t&&(t=null),function(i){return i.lift(new Tr(e,t))}}e.RenderMode=void 0,(br=e.RenderMode||(e.RenderMode={}))[br.Letterbox=0]="Letterbox",br[br.Fill=1]="Fill";var Tr=function(){function e(e,t){this.bufferSize=e,this.startBufferEvery=t,this.subscriberClass=t&&e!==t?Ir:Cr}return e.prototype.call=function(e,t){return t.subscribe(new this.subscriberClass(e,this.bufferSize,this.startBufferEvery))},e}(),Cr=function(e){function t(t,i){var r=e.call(this,t)||this;return r.bufferSize=i,r.buffer=[],r}return jt(t,e),t.prototype._next=function(e){var t=this.buffer;t.push(e),t.length==this.bufferSize&&(this.destination.next(t),this.buffer=[])},t.prototype._complete=function(){var t=this.buffer;t.length>0&&this.destination.next(t),e.prototype._complete.call(this)},t}(Kt),Ir=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.bufferSize=i,n.startBufferEvery=r,n.buffers=[],n.count=0,n}return jt(t,e),t.prototype._next=function(e){var t=this,i=t.bufferSize,r=t.startBufferEvery,n=t.buffers,o=t.count;this.count++,o%r===0&&n.push([]);for(var a=n.length;a--;){var s=n[a];s.push(e),s.length===i&&(n.splice(a,1),this.destination.next(s))}},t.prototype._complete=function(){for(var t=this.buffers,i=this.destination;t.length>0;){var r=t.shift();r.length>0&&i.next(r)}e.prototype._complete.call(this)},t}(Kt);var Pr=function(){function e(e){this.closingSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new Rr(e,this.closingSelector))},e}(),Rr=function(e){function t(t,i){var r=e.call(this,t)||this;return r.closingSelector=i,r.subscribing=!1,r.openBuffer(),r}return jt(t,e),t.prototype._next=function(e){this.buffer.push(e)},t.prototype._complete=function(){var t=this.buffer;t&&this.destination.next(t),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},t.prototype.notifyNext=function(e,t,i,r,n){this.openBuffer()},t.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},t.prototype.openBuffer=function(){var e=this.closingSubscription;e&&(this.remove(e),e.unsubscribe());var t,i=this.buffer;this.buffer&&this.destination.next(i),this.buffer=[];try{t=(0,this.closingSelector)()}catch(e){return this.error(e)}e=new Yt,this.closingSubscription=e,this.add(e),this.subscribing=!0,e.add(rr(this,t)),this.subscribing=!1},t}(Wi);function Nr(e){return function(t){var i=new Or(e),r=t.lift(i);return i.caught=r}}var Or=function(){function e(e){this.selector=e}return e.prototype.call=function(e,t){return t.subscribe(new Lr(e,this.selector,this.caught))},e}(),Lr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.selector=i,n.caught=r,n}return jt(t,e),t.prototype.error=function(t){if(!this.isStopped){var i=void 0;try{i=this.selector(t,this.caught)}catch(t){return void e.prototype.error.call(this,t)}this._unsubscribeAndRecycle();var r=new Qi(this,void 0,void 0);this.add(r),rr(this,i,void 0,void 0,r)}},t}(Wi);function Dr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=null;return"function"==typeof e[e.length-1]&&(i=e.pop()),1===e.length&&Ht(e[0])&&(e=e[0].slice()),function(t){return t.lift.call(cr([t].concat(e)),new ar(i))}}function kr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(dr.apply(void 0,[t].concat(e)))}}function Br(e,t){return void 0===t&&(t=Fi),function(i){return i.lift(new Fr(e,t))}}var Fr=function(){function e(e,t){this.dueTime=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new jr(e,this.dueTime,this.scheduler))},e}(),jr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.dueTime=i,n.scheduler=r,n.debouncedSubscription=null,n.lastValue=null,n.hasValue=!1,n}return jt(t,e),t.prototype._next=function(e){this.clearDebounce(),this.lastValue=e,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(zr,this.dueTime,this))},t.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},t.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var e=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(e)}},t.prototype.clearDebounce=function(){var e=this.debouncedSubscription;null!==e&&(this.remove(e),e.unsubscribe(),this.debouncedSubscription=null)},t}(Kt);function zr(e){e.debouncedNext()}function Vr(e){return void 0===e&&(e=null),function(t){return t.lift(new $r(e))}}var $r=function(){function e(e){this.defaultValue=e}return e.prototype.call=function(e,t){return t.subscribe(new Ur(e,this.defaultValue))},e}(),Ur=function(e){function t(t,i){var r=e.call(this,t)||this;return r.defaultValue=i,r.isEmpty=!0,r}return jt(t,e),t.prototype._next=function(e){this.isEmpty=!1,this.destination.next(e)},t.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},t}(Kt);function Gr(e,t){void 0===t&&(t=Fi);var i,r=(i=e)instanceof Date&&!isNaN(+i)?+e-t.now():Math.abs(e);return function(e){return e.lift(new Hr(r,t))}}var Hr=function(){function e(e,t){this.delay=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new qr(e,this.delay,this.scheduler))},e}(),qr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.delay=i,n.scheduler=r,n.queue=[],n.active=!1,n.errored=!1,n}return jt(t,e),t.dispatch=function(e){for(var t=e.source,i=t.queue,r=e.scheduler,n=e.destination;i.length>0&&i[0].time-r.now()<=0;)i.shift().notification.observe(n);if(i.length>0){var o=Math.max(0,i[0].time-r.now());this.schedule(e,o)}else this.unsubscribe(),t.active=!1},t.prototype._schedule=function(e){this.active=!0,this.destination.add(e.schedule(t.dispatch,this.delay,{source:this,destination:this.destination,scheduler:e}))},t.prototype.scheduleNotification=function(e){if(!0!==this.errored){var t=this.scheduler,i=new Wr(t.now()+this.delay,e);this.queue.push(i),!1===this.active&&this._schedule(t)}},t.prototype._next=function(e){this.scheduleNotification(Ni.createNext(e))},t.prototype._error=function(e){this.errored=!0,this.queue=[],this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.scheduleNotification(Ni.createComplete()),this.unsubscribe()},t}(Kt),Wr=function(){return function(e,t){this.time=e,this.notification=t}}();var Qr=function(){function e(e,t){this.keySelector=e,this.flushes=t}return e.prototype.call=function(e,t){return t.subscribe(new Yr(e,this.keySelector,this.flushes))},e}(),Yr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.keySelector=i,n.values=new Set,r&&n.add(rr(n,r)),n}return jt(t,e),t.prototype.notifyNext=function(e,t,i,r,n){this.values.clear()},t.prototype.notifyError=function(e,t){this._error(e)},t.prototype._next=function(e){this.keySelector?this._useKeySelector(e):this._finalizeNext(e,e)},t.prototype._useKeySelector=function(e){var t,i=this.destination;try{t=this.keySelector(e)}catch(e){return void i.error(e)}this._finalizeNext(t,e)},t.prototype._finalizeNext=function(e,t){var i=this.values;i.has(e)||(i.add(e),this.destination.next(t))},t}(Wi);function Xr(e,t){return function(i){return i.lift(new Zr(e,t))}}var Zr=function(){function e(e,t){this.compare=e,this.keySelector=t}return e.prototype.call=function(e,t){return t.subscribe(new Kr(e,this.compare,this.keySelector))},e}(),Kr=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.keySelector=r,n.hasKey=!1,"function"==typeof i&&(n.compare=i),n}return jt(t,e),t.prototype.compare=function(e,t){return e===t},t.prototype._next=function(e){var t;try{var i=this.keySelector;t=i?i(e):e}catch(e){return this.destination.error(e)}var r=!1;if(this.hasKey)try{r=(0,this.compare)(this.key,t)}catch(e){return this.destination.error(e)}else this.hasKey=!0;r||(this.key=t,this.destination.next(e))},t}(Kt);function Jr(e,t){return function(i){return i.lift(new en(e,t))}}var en=function(){function e(e,t){this.predicate=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new tn(e,this.predicate,this.thisArg))},e}(),tn=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.predicate=i,n.thisArg=r,n.count=0,n}return jt(t,e),t.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},t}(Kt);function rn(e,t,i){return function(r){return r.lift(new nn(e,t,i))}}var nn=function(){function e(e,t,i){this.nextOrObserver=e,this.error=t,this.complete=i}return e.prototype.call=function(e,t){return t.subscribe(new on(e,this.nextOrObserver,this.error,this.complete))},e}(),on=function(e){function t(t,i,r,n){var o=e.call(this,t)||this;return o._tapNext=ti,o._tapError=ti,o._tapComplete=ti,o._tapError=r||ti,o._tapComplete=n||ti,zt(i)?(o._context=o,o._tapNext=i):i&&(o._context=i,o._tapNext=i.next||ti,o._tapError=i.error||ti,o._tapComplete=i.complete||ti),o}return jt(t,e),t.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.next(e)},t.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.error(e)},t.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()},t}(Kt),an=function(e){return void 0===e&&(e=sn),rn({hasValue:!1,next:function(){this.hasValue=!0},complete:function(){if(!this.hasValue)throw e()}})};function sn(){return new Ui}function cn(e){return function(t){return 0===e?Si():t.lift(new hn(e))}}var hn=function(){function e(e){if(this.total=e,this.total<0)throw new Vi}return e.prototype.call=function(e,t){return t.subscribe(new un(e,this.total))},e}(),un=function(e){function t(t,i){var r=e.call(this,t)||this;return r.total=i,r.count=0,r}return jt(t,e),t.prototype._next=function(e){var t=this.total,i=++this.count;i<=t&&(this.destination.next(e),i===t&&(this.destination.complete(),this.unsubscribe()))},t}(Kt);function ln(e,t,i){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===i&&(i=void 0),t=(t||0)<1?Number.POSITIVE_INFINITY:t,function(r){return r.lift(new pn(e,t,i))}}var pn=function(){function e(e,t,i){this.project=e,this.concurrent=t,this.scheduler=i}return e.prototype.call=function(e,t){return t.subscribe(new dn(e,this.project,this.concurrent,this.scheduler))},e}(),dn=function(e){function t(t,i,r,n){var o=e.call(this,t)||this;return o.project=i,o.concurrent=r,o.scheduler=n,o.index=0,o.active=0,o.hasCompleted=!1,r<Number.POSITIVE_INFINITY&&(o.buffer=[]),o}return jt(t,e),t.dispatch=function(e){var t=e.subscriber,i=e.result,r=e.value,n=e.index;t.subscribeToProjection(i,r,n)},t.prototype._next=function(e){var i=this.destination;if(i.closed)this._complete();else{var r=this.index++;if(this.active<this.concurrent){i.next(e);try{var n=(0,this.project)(e,r);if(this.scheduler){var o={subscriber:this,result:n,value:e,index:r};this.destination.add(this.scheduler.schedule(t.dispatch,0,o))}else this.subscribeToProjection(n,e,r)}catch(e){i.error(e)}}else this.buffer.push(e)}},t.prototype.subscribeToProjection=function(e,t,i){this.active++,this.destination.add(rr(this,e,t,i))},t.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},t.prototype.notifyNext=function(e,t,i,r,n){this._next(t)},t.prototype.notifyComplete=function(e){var t=this.buffer;this.destination.remove(e),this.active--,t&&t.length>0&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},t}(Wi);function fn(e){return function(t){return t.lift(new mn(e))}}var mn=function(){function e(e){this.callback=e}return e.prototype.call=function(e,t){return t.subscribe(new gn(e,this.callback))},e}(),gn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.add(new Yt(i)),r}return jt(t,e),t}(Kt);function vn(e,t){var i=arguments.length>=2;return function(r){return r.pipe(e?Jr(function(t,i){return e(t,i,r)}):ji,cn(1),i?Vr(t):an(function(){return new Ui}))}}var _n=function(){function e(e){if(this.total=e,this.total<0)throw new Vi}return e.prototype.call=function(e,t){return t.subscribe(new yn(e,this.total))},e}(),yn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.total=i,r.ring=new Array,r.count=0,r}return jt(t,e),t.prototype._next=function(e){var t=this.ring,i=this.total,r=this.count++;t.length<i?t.push(e):t[r%i]=e},t.prototype._complete=function(){var e=this.destination,t=this.count;if(t>0)for(var i=this.count>=this.total?this.total:this.count,r=this.ring,n=0;n<i;n++){var o=t++%i;e.next(r[o])}e.complete()},t}(Kt);function bn(e,t){var i=arguments.length>=2;return function(r){return r.pipe(e?Jr(function(t,i){return e(t,i,r)}):ji,(n=1,function(e){return 0===n?Si():e.lift(new _n(n))}),i?Vr(t):an(function(){return new Ui}));var n}}function xn(e,t){var i=!1;return arguments.length>=2&&(i=!0),function(r){return r.lift(new wn(e,t,i))}}var wn=function(){function e(e,t,i){void 0===i&&(i=!1),this.accumulator=e,this.seed=t,this.hasSeed=i}return e.prototype.call=function(e,t){return t.subscribe(new An(e,this.accumulator,this.seed,this.hasSeed))},e}(),An=function(e){function t(t,i,r,n){var o=e.call(this,t)||this;return o.accumulator=i,o._seed=r,o.hasSeed=n,o.index=0,o}return jt(t,e),Object.defineProperty(t.prototype,"seed",{get:function(){return this._seed},set:function(e){this.hasSeed=!0,this._seed=e},enumerable:!0,configurable:!0}),t.prototype._next=function(e){if(this.hasSeed)return this._tryNext(e);this.seed=e,this.destination.next(e)},t.prototype._tryNext=function(e){var t,i=this.index++;try{t=this.accumulator(this.seed,e,i)}catch(e){this.destination.error(e)}this.seed=t,this.destination.next(t)},t}(Kt);function Sn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(vr.apply(void 0,[t].concat(e)))}}function Mn(e,t){return function(i){var r;if(r="function"==typeof e?e:function(){return e},"function"==typeof t)return i.lift(new En(r,t));var n=Object.create(i,fi);return n.source=i,n.subjectFactory=r,n}}var En=function(){function e(e,t){this.subjectFactory=e,this.selector=t}return e.prototype.call=function(e,t){var i=this.selector,r=this.subjectFactory(),n=i(r).subscribe(e);return n.add(t.subscribe(r)),n},e}();function Tn(){return function(e){return e.lift(new Cn)}}var Cn=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new In(e))},e}(),In=function(e){function t(t){var i=e.call(this,t)||this;return i.hasPrev=!1,i}return jt(t,e),t.prototype._next=function(e){this.hasPrev?this.destination.next([this.prev,e]):this.hasPrev=!0,this.prev=e},t}(Kt);function Pn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e.length;if(0===i)throw new Error("list of properties cannot be empty.");return function(t){return Gi(function(e,t){var i=function(i){for(var r=i,n=0;n<t;n++){var o=r[e[n]];if(void 0===o)return;r=o}return r};return i}(e,i))(t)}}function Rn(e,t,i,r){i&&"function"!=typeof i&&(r=i);var n="function"==typeof i?i:void 0,o=new Di(e,t,r);return function(e){return Mn(function(){return o},n)(e)}}var Nn=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var i=new On(e),r=t.subscribe(i);return r.add(rr(i,this.notifier)),r},e}(),On=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hasValue=!1,t}return jt(t,e),t.prototype._next=function(e){this.value=e,this.hasValue=!0},t.prototype.notifyNext=function(e,t,i,r,n){this.emitValue()},t.prototype.notifyComplete=function(){this.emitValue()},t.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},t}(Wi);function Ln(){return new ci}function Dn(){return function(e){return ui()(Mn(Ln)(e))}}function kn(e){return function(t){return t.lift(new Bn(e))}}var Bn=function(){function e(e){this.total=e}return e.prototype.call=function(e,t){return t.subscribe(new Fn(e,this.total))},e}(),Fn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.total=i,r.count=0,r}return jt(t,e),t.prototype._next=function(e){++this.count>this.total&&this.destination.next(e)},t}(Kt);function jn(e){return function(t){return t.lift(new zn(e))}}var zn=function(){function e(e){this.predicate=e}return e.prototype.call=function(e,t){return t.subscribe(new Vn(e,this.predicate))},e}(),Vn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.predicate=i,r.skipping=!0,r.index=0,r}return jt(t,e),t.prototype._next=function(e){var t=this.destination;this.skipping&&this.tryCallPredicate(e),this.skipping||t.next(e)},t.prototype.tryCallPredicate=function(e){try{var t=this.predicate(e,this.index++);this.skipping=Boolean(t)}catch(e){this.destination.error(e)}},t}(Kt);function $n(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var i=e[e.length-1];Mi(i)?e.pop():i=null;var r=e.length;return dr(1!==r||i?r>0?Ti(e,i):Si(i):Ci(e[0]),t)}}function Un(e,t){return"function"==typeof t?function(i){return i.pipe(Un(function(i,r){return cr(e(i,r)).pipe(Gi(function(e,n){return t(i,e,r,n)}))}))}:function(t){return t.lift(new Gn(e))}}var Gn=function(){function e(e){this.project=e}return e.prototype.call=function(e,t){return t.subscribe(new Hn(e,this.project))},e}(),Hn=function(e){function t(t,i){var r=e.call(this,t)||this;return r.project=i,r.index=0,r}return jt(t,e),t.prototype._next=function(e){var t,i=this.index++;try{t=this.project(e,i)}catch(e){return void this.destination.error(e)}this._innerSub(t,e,i)},t.prototype._innerSub=function(e,t,i){var r=this.innerSubscription;r&&r.unsubscribe();var n=new Qi(this,void 0,void 0);this.destination.add(n),this.innerSubscription=rr(this,e,t,i,n)},t.prototype._complete=function(){var t=this.innerSubscription;t&&!t.closed||e.prototype._complete.call(this),this.unsubscribe()},t.prototype._unsubscribe=function(){this.innerSubscription=null},t.prototype.notifyComplete=function(t){this.destination.remove(t),this.innerSubscription=null,this.isStopped&&e.prototype._complete.call(this)},t.prototype.notifyNext=function(e,t,i,r,n){this.destination.next(t)},t}(Wi);function qn(e){return function(t){return t.lift(new Wn(e))}}var Wn=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var i=new Qn(e),r=rr(i,this.notifier);return r&&!i.seenValue?(i.add(r),t.subscribe(i)):i},e}(),Qn=function(e){function t(t){var i=e.call(this,t)||this;return i.seenValue=!1,i}return jt(t,e),t.prototype.notifyNext=function(e,t,i,r,n){this.seenValue=!0,this.complete()},t.prototype.notifyComplete=function(){},t}(Wi);var Yn=function(){function e(e,t){this.predicate=e,this.inclusive=t}return e.prototype.call=function(e,t){return t.subscribe(new Xn(e,this.predicate,this.inclusive))},e}(),Xn=function(e){function t(t,i,r){var n=e.call(this,t)||this;return n.predicate=i,n.inclusive=r,n.index=0,n}return jt(t,e),t.prototype._next=function(e){var t,i=this.destination;try{t=this.predicate(e,this.index++)}catch(e){return void i.error(e)}this.nextOrComplete(e,t)},t.prototype.nextOrComplete=function(e,t){var i=this.destination;Boolean(t)?i.next(e):(this.inclusive&&i.next(e),i.complete())},t}(Kt),Zn={leading:!0,trailing:!1};var Kn=function(){function e(e,t,i,r){this.duration=e,this.scheduler=t,this.leading=i,this.trailing=r}return e.prototype.call=function(e,t){return t.subscribe(new Jn(e,this.duration,this.scheduler,this.leading,this.trailing))},e}(),Jn=function(e){function t(t,i,r,n,o){var a=e.call(this,t)||this;return a.duration=i,a.scheduler=r,a.leading=n,a.trailing=o,a._hasTrailingValue=!1,a._trailingValue=null,a}return jt(t,e),t.prototype._next=function(e){this.throttled?this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(eo,this.duration,{subscriber:this})),this.leading&&this.destination.next(e))},t.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},t.prototype.clearThrottle=function(){var e=this.throttled;e&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),e.unsubscribe(),this.remove(e),this.throttled=null)},t}(Kt);function eo(e){e.subscriber.clearThrottle()}function to(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var i;"function"==typeof e[e.length-1]&&(i=e.pop());var r=e;return t.lift(new ao(r,i))}}var io,ro,no,oo,ao=function(){function e(e,t){this.observables=e,this.project=t}return e.prototype.call=function(e,t){return t.subscribe(new so(e,this.observables,this.project))},e}(),so=function(e){function t(t,i,r){var n=e.call(this,t)||this;n.observables=i,n.project=r,n.toRespond=[];var o=i.length;n.values=new Array(o);for(var a=0;a<o;a++)n.toRespond.push(a);for(a=0;a<o;a++){var s=i[a];n.add(rr(n,s,s,a))}return n}return jt(t,e),t.prototype.notifyNext=function(e,t,i,r,n){this.values[i]=t;var o=this.toRespond;if(o.length>0){var a=o.indexOf(i);-1!==a&&o.splice(a,1)}},t.prototype.notifyComplete=function(){},t.prototype._next=function(e){if(0===this.toRespond.length){var t=[e].concat(this.values);this.project?this._tryProject(t):this.destination.next(t)}},t.prototype._tryProject=function(e){var t;try{t=this.project.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(Wi);function co(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(yr.apply(void 0,[t].concat(e)))}}class ho{constructor(t,i,r){this._adaptiveOperation$=new ci,this._render$=new ci,this._renderAdaptive$=new ci,this._renderService=i,this._currentFrame$=r;let n=Bt.create(Bt.h("div.domRenderer",[]));t.appendChild(n),this._offset$=this._adaptiveOperation$.pipe(xn((e,t)=>t(e),{elementHeight:t.offsetHeight,elementWidth:t.offsetWidth,imageAspect:0,renderMode:e.RenderMode.Fill}),Jr(e=>e.imageAspect>0&&e.elementWidth>0&&e.elementHeight>0),Gi(t=>{let i=t.elementWidth/t.elementHeight,r=t.imageAspect/i,n=0,o=0;return t.renderMode===e.RenderMode.Letterbox?t.imageAspect>i?n=t.elementHeight*(1-1/r)/2:o=t.elementWidth*(1-r)/2:t.imageAspect>i?o=-t.elementWidth*(r-1)/2:n=-t.elementHeight*(1/r-1)/2,{bottom:n,left:o,right:o,top:n}})),this._currentFrame$.pipe(Jr(e=>null!=e.state.currentNode),Xr((e,t)=>e===t,e=>e.state.currentNode.key),Gi(e=>e.state.currentTransform.basicAspect),Gi(e=>t=>(t.imageAspect=e,t))).subscribe(this._adaptiveOperation$),this._renderAdaptive$.pipe(xn((e,t)=>(null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e),{}),Dr(this._offset$),Gi(e=>{let t=M.exports.values(e[0]),i=e[1],r={style:{bottom:i.bottom+"px",left:i.left+"px","pointer-events":"none",position:"absolute",right:i.right+"px",top:i.top+"px"}};return{name:"adaptiveDomRenderer",vnode:Bt.h("div.adaptiveDomRenderer",r,t)}})).subscribe(this._render$),this._vNode$=this._render$.pipe(xn((e,t)=>(null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e),{}),Gi(e=>{let t=M.exports.values(e);return Bt.h("div.domRenderer",t)})),this._vPatch$=this._vNode$.pipe(xn((e,t)=>(e.vpatch=Bt.diff(e.vnode,t),e.vnode=t,e),{vnode:Bt.h("div.domRenderer",[]),vpatch:null}),Pn("vpatch")),this._element$=this._vPatch$.pipe(xn((e,t)=>Bt.patch(e,t),n),Rn(1),ui()),this._element$.subscribe(()=>{}),this._renderService.size$.pipe(Gi(e=>t=>(t.elementWidth=e.width,t.elementHeight=e.height,t))).subscribe(this._adaptiveOperation$),this._renderService.renderMode$.pipe(Gi(e=>t=>(t.renderMode=e,t))).subscribe(this._adaptiveOperation$)}get element$(){return this._element$}get render$(){return this._render$}get renderAdaptive$(){return this._renderAdaptive$}clear(e){this._renderAdaptive$.next({name:e,vnode:null}),this._render$.next({name:e,vnode:null})}}!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground"}(io||(io={}));class uo{constructor(e){this._document=e||document}get document(){return this._document}createElement(e,t,i){const r=this._document.createElement(e);return t&&(r.className=t),i&&i.appendChild(r),r}}class lo{constructor(){this._events={}}on(e,t){this._events[e]=this._events[e]||[],this._events[e].push(t)}off(e,t){if(e)if(this._listens(e))delete this._events[e];else{let i=this._events[e].indexOf(t);i>=0&&this._events[e].splice(i,1),this._events[e].length&&delete this._events[e]}else this._events={}}fire(e,t){if(this._listens(e))for(let i of this._events[e])i.call(this,t)}_listens(e){return!(!this._events||!this._events[e])}}e.ImageSize=void 0,(ro=e.ImageSize||(e.ImageSize={}))[ro.Size320=320]="Size320",ro[ro.Size640=640]="Size640",ro[ro.Size1024=1024]="Size1024",ro[ro.Size2048=2048]="Size2048";class po{static get baseImageSize(){return po._baseImageSize}static get basePanoramaSize(){return po._basePanoramaSize}static get maxImageSize(){return po._maxImageSize}static setOptions(t){po._baseImageSize=null!=t.baseImageSize?t.baseImageSize:e.ImageSize.Size640,po._basePanoramaSize=null!=t.basePanoramaSize?t.basePanoramaSize:e.ImageSize.Size2048,po._maxImageSize=null!=t.maxImageSize?t.maxImageSize:e.ImageSize.Size2048}}class fo{static get domain(){return"visual-tiles.mapxus.co.jp"}static get tileScheme(){return"https"}static get tileDomain(){return`${fo.domain}/tiles`}static get thumbnailDomain(){return`${fo.domain}/previews`}static get meshDomain(){return`${fo.domain}/meshs`}static get origin(){return"visual.webgl"}static get authUrl(){return"https://map-api.mapxus.co.jp/sc/api/v1/apikeys/auth"}static thumbnail(e,t=2048){return`${fo.tileScheme}://${fo.thumbnailDomain}/${e}/thumbnails/thumb-${t}.jpg`}static protoMesh(e){return`${fo.tileScheme}://${fo.meshDomain}/${e}`}static graphqlModel(){return"https://map-api.mapxus.co.jp/vis/graphql"}}class mo{constructor(e,t,i){this._renderFrame$=new ci,this._renderCameraOperation$=new ci,this._render$=new ci,this._clear$=new ci,this._renderOperation$=new ci,this._rendererOperation$=new ci,this._eraserOperation$=new ci,this._renderService=t,this._dom=i||new uo,this._renderer$=this._rendererOperation$.pipe(xn((e,t)=>t(e),{needsRender:!1,renderer:null})),this._renderCollection$=this._renderOperation$.pipe(xn((e,t)=>t(e),{}),Dn()),this._renderCamera$=this._renderCameraOperation$.pipe(xn((e,t)=>t(e),{frameId:-1,needsRender:!1,perspective:null})),this._eraser$=this._eraserOperation$.pipe($n(e=>e),xn((e,t)=>t(e),{needsRender:!1})),or([this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$],(e,t,i,r)=>({camera:i,eraser:r,renderer:e,renders:Object.keys(t).map(e=>t[e])})).pipe(Jr(e=>{let t=e.renderer.needsRender||e.camera.needsRender||e.eraser.needsRender,i=e.camera.frameId;for(let r of e.renders){if(r.frameId!==i)return!1;t=t||r.needsRender}return t}),Xr((e,t)=>e===t,e=>e.eraser.needsRender?-1:e.camera.frameId)).subscribe(e=>{e.renderer.needsRender=!1,e.camera.needsRender=!1,e.eraser.needsRender=!1;let t=e.camera.perspective,i=[],r=[];for(let t of e.renders)t.stage===io.Background?i.push(t.render):t.stage===io.Foreground&&r.push(t.render);let n=e.renderer.renderer;n.clear();for(let e of i)e(t,n);n.clearDepth();for(let e of r)e(t,n)}),this._renderFrame$.pipe(Gi(e=>t=>(t.frameId=e.frameId,t.perspective=e.perspective,!0===e.changed&&(t.needsRender=!0),t))).subscribe(this._renderCameraOperation$),this._renderFrameSubscribe(),vr(this._render$.pipe(Gi(e=>t=>(t[e.name]=e.render,t))),this._clear$.pipe(Gi(e=>t=>(delete t[e],t)))).subscribe(this._renderOperation$),this._webGLRenderer$=this._render$.pipe(vn(),Gi(i=>{const r=this._dom.createElement("canvas","Beeview-js-canvas");r.style.position="absolute",r.setAttribute("tabindex","0"),e.appendChild(r);const n=t.element,o=new p.exports.WebGLRenderer({canvas:r});return o.setPixelRatio(window.devicePixelRatio),o.setSize(n.offsetWidth,n.offsetHeight),o.setClearColor(new p.exports.Color(2105376),1),o.autoClear=!1,o}),Rn(1),ui()),this._webGLRenderer$.subscribe(()=>{}),vr(this._webGLRenderer$.pipe(vn(),Gi(e=>t=>(t.needsRender=!0,t.renderer=e,t))),this._renderService.size$.pipe(Gi(e=>t=>(null==t.renderer||(t.renderer.setSize(e.width,e.height),t.needsRender=!0),t))),this._clear$.pipe(Gi(e=>e=>(null==e.renderer||(e.needsRender=!0),e)))).subscribe(this._rendererOperation$);let r=this._renderCollection$.pipe(Jr(e=>0===Object.keys(e).length),Dn());r.subscribe(e=>{null!=this._renderFrameSubscription&&(this._renderFrameSubscription.unsubscribe(),this._renderFrameSubscription=null,this._renderFrameSubscribe())}),r.pipe(Gi(e=>e=>(e.needsRender=!0,e))).subscribe(this._eraserOperation$)}get render$(){return this._render$}get webGLRenderer$(){return this._webGLRenderer$}clear(e){this._clear$.next(e)}_renderFrameSubscribe(){this._render$.pipe(vn(),Gi(e=>e=>(e.needsRender=!0,e))).subscribe(e=>{this._renderCameraOperation$.next(e)}),this._renderFrameSubscription=this._render$.pipe(vn(),hr(e=>this._renderService.renderCameraFrame$)).subscribe(this._renderFrame$)}}class go{constructor(e,t,i){this.alpha=-1,this.zoom=0,this._frameId=-1,this._changed=!1,this._changedForFrame=-1,this.currentAspect=1,this.currentPano=!1,this.previousAspect=1,this.previousPano=!1,this.renderMode=i,this._spatial=new y,this._camera=new g;const r=this._getPerspectiveCameraAspect(e,t);this._perspective=new p.exports.PerspectiveCamera(50,r,.4,1e4),this._perspective.matrixAutoUpdate=!1,this._rotation={phi:0,theta:0}}get camera(){return this._camera}get changed(){return this.frameId===this._changedForFrame}get frameId(){return this._frameId}set frameId(e){this._frameId=e,this._changed&&(this._changed=!1,this._changedForFrame=e)}get perspective(){return this._perspective}get rotation(){return this._rotation}getTilt(){return 90-this._spatial.radToDeg(this._rotation.theta)}updateAspect(e,t){const i=this._getPerspectiveCameraAspect(e,t);this._perspective.aspect=i,this._changed=!0}updateProjection(){let e=this._getAspect(this.currentAspect,this.currentPano,this.perspective.aspect),t=this._getAspect(this.previousAspect,this.previousPano,this.perspective.aspect),i=(1-this.alpha)*t+this.alpha*e,r=this._getVerticalFov(i,this._camera.focal,this.zoom);this._perspective.fov=r,this._perspective.updateProjectionMatrix(),this._changed=!0}updatePerspective(e){this._perspective.up.copy(e.up),this._perspective.position.copy(e.position),this._perspective.lookAt(e.lookat),this._perspective.updateMatrix(),this._perspective.updateMatrixWorld(!1),this._changed=!0}updateRotation(e){this._rotation=this._getRotation(e)}_getVerticalFov(e,t,i){return 2*Math.atan(.5/(Math.pow(2,i)*e*t))*180/Math.PI}_getAspect(t,i,r){if(i)return 1;let n=Math.max(1,1/t);return(this.renderMode===e.RenderMode.Letterbox?t>r:t<r)?n*r:n*t}_getPerspectiveCameraAspect(e,t){return 0===e?0:e/t}_getRotation(e){let t=e.lookat.clone().sub(e.position),i=e.up.clone(),r=t.clone().dot(i),n=t.clone().sub(i.clone().multiplyScalar(r));return{phi:Math.atan2(n.y,n.x),theta:Math.PI/2-this._spatial.angleToPlane(t.toArray(),[0,0,1])}}}class vo{constructor(t,i,r){this._element=t,this._currentFrame$=i,this._spatial=new y,r=null!=r?r:e.RenderMode.Fill,this._panWithoutInertia$=new ci,this._pan$=new ci,this._resize$=new ci,this._renderCameraOperation$=new ci,this._size$=new gi({height:this._element.offsetHeight,width:this._element.offsetWidth}),this._resize$.pipe(Gi(()=>({height:this._element.offsetHeight,width:this._element.offsetWidth}))).subscribe(this._size$),this._renderMode$=new gi(r),this._renderCameraHolder$=this._renderCameraOperation$.pipe($n(e=>e),xn((e,t)=>t(e),new go(this._element.offsetWidth,this._element.offsetHeight,r)),Rn(1),ui()),this._renderCameraFrame$=this._currentFrame$.pipe(to(this._renderCameraHolder$,(e,t)=>[e,t]),rn(e=>{let t=e[0],i=e[1],r=t.state.camera;if(i.alpha!==t.state.alpha||i.zoom!==t.state.zoom||i.camera.diff(r)>1e-9){let e=t.state.currentTransform,n=null!=t.state.previousTransform?t.state.previousTransform:t.state.currentTransform,o=null!=t.state.previousNode?t.state.previousNode:t.state.currentNode;i.currentAspect=e.basicAspect,i.currentPano=t.state.currentNode.pano,i.previousAspect=n.basicAspect,i.previousPano=o.pano,i.alpha=t.state.alpha,i.zoom=t.state.zoom,i.camera.copy(r),i.updatePerspective(r),i.updateRotation(r),i.updateProjection()}i.frameId=t.id}),Gi(e=>e[1]),Rn(1),ui()),this._renderCamera$=this._renderCameraFrame$.pipe(Jr(e=>e.changed),Rn(1),ui()),this._bearing$=this._renderCamera$.pipe(Gi(e=>{let t=this._spatial.radToDeg(this._spatial.azimuthalToBearing(e.rotation.phi));return this._spatial.wrap(t,0,360)}),Rn(1),ui()),this._size$.pipe(kn(1),Gi(e=>t=>(t.updateAspect(e.width,e.height),t.updateProjection(),t))).subscribe(this._renderCameraOperation$),this._renderMode$.pipe(kn(1),Gi(e=>t=>(t.renderMode=e,t.updateProjection(),t))).subscribe(this._renderCameraOperation$),this._bearing$.subscribe(()=>{}),this._renderCameraHolder$.subscribe(()=>{}),this._size$.subscribe(()=>{}),this._renderMode$.subscribe(()=>{}),this._renderCamera$.subscribe(()=>{}),this._renderCameraFrame$.subscribe(()=>{})}get bearing$(){return this._bearing$}get panWithoutInertia$(){return this._panWithoutInertia$}get pan$(){return this._pan$}get element(){return this._element}get resize$(){return this._resize$}get size$(){return this._size$}get renderMode$(){return this._renderMode$}get renderCameraFrame$(){return this._renderCameraFrame$}get renderCamera$(){return this._renderCamera$}}e.Alignment=void 0,(no=e.Alignment||(e.Alignment={}))[no.Bottom=0]="Bottom",no[no.BottomLeft=1]="BottomLeft",no[no.BottomRight=2]="BottomRight",no[no.Center=3]="Center",no[no.Left=4]="Left",no[no.Right=5]="Right",no[no.Top=6]="Top",no[no.TopLeft=7]="TopLeft",no[no.TopRight=8]="TopRight";class _o{constructor(e,t){this._graphService=e,this._stateService=t,this._started=!1}get started(){return this._started}start(){this._started||(this._uncacheSubscription=this._stateService.currentState$.pipe(Xr(void 0,e=>e.state.currentNode.key),Gi(e=>e.state.trajectory.map(e=>e.key)),Er(1,5),Un(e=>{let t=e[0];return this._graphService.uncache$(t)})).subscribe(()=>{}),this._started=!0)}stop(){this._started&&(this._uncacheSubscription.unsubscribe(),this._uncacheSubscription=null,this._started=!1)}}class yo{constructor(e,t){this._components={};for(const i in yo.registeredComponents){if(!yo.registeredComponents.hasOwnProperty(i))continue;const r=yo.registeredComponents[i];this._components[i]={active:!1,component:new r(i,e,t)}}this._coverComponent=new yo.registeredCoverComponent("cover",e,t),this._coverComponent.activate(),this._coverActivated=!0}static register(e){void 0===yo.registeredComponents[e.componentName]&&(yo.registeredComponents[e.componentName]=e)}static registerCover(e){yo.registeredCoverComponent=e}get coverActivated(){return this._coverActivated}activateCover(){if(!this._coverActivated){this._coverActivated=!0;for(let e of M.exports.values(this._components))e.active&&e.component.deactivate()}}deactivateCover(){if(this._coverActivated){this._coverActivated=!1;for(let e of M.exports.values(this._components))e.active&&e.component.activate()}}activate(e){this._checkName(e),this._components[e].active=!0,this._coverActivated||this.get(e).activate()}configure(e,t){this._checkName(e),this.get(e).configure(t)}deactivate(e){this._checkName(e),this._components[e].active=!1,this._coverActivated||this.get(e).deactivate()}resize(){for(let e of M.exports.values(this._components))e.component.resize()}get(e){return this._components[e].component}getCover(){return this._coverComponent}_checkName(e){if(!(e in this._components))throw new f(`Component does not exist: ${e}`)}}yo.registeredComponents={},e.CoverState=void 0,(oo=e.CoverState||(e.CoverState={}))[oo.Hidden=0]="Hidden",oo[oo.Loading=1]="Loading",oo[oo.Visible=2]="Visible";class bo{constructor(t,i,r,n,o,a){this._container=t,this._observer=r,this._navigator=i,this._options=null!=o?o:{},this._key=n,this._navigable=null==n,this._componentService=a||new yo(this._container,this._navigator),this._coverComponent=this._componentService.getCover(),this._initializeComponents(),n?(this._initilizeCoverComponent(),this._subscribeCoverComponent()):this._navigator.movedToKey$.pipe(vn(e=>null!=e)).subscribe(t=>{this._key=t,this._componentService.deactivateCover(),this._coverComponent.configure({key:this._key,state:e.CoverState.Hidden}),this._subscribeCoverComponent(),this._navigator.stateService.start(),this._observer.startEmit()})}get navigable(){return this._navigable}get(e){return this._componentService.get(e)}activate(e){this._componentService.activate(e)}activateCover(){this._coverComponent.configure({state:e.CoverState.Visible})}deactivate(e){this._componentService.deactivate(e)}deactivateCover(){this._coverComponent.configure({state:e.CoverState.Loading})}resize(){this._componentService.resize()}_initializeComponents(){let e=this._options;this._uFalse(e.background,"background"),this._uFalse(e.debug,"debug"),this._uFalse(e.image,"image"),this._uFalse(e.navigation,"navigation"),this._uFalse(e.popup,"popup"),this._uFalse(e.route,"route"),this._uFalse(e.slider,"slider"),this._uFalse(e.tag,"tag"),this._uFalse(e.sequence,"sequence"),this._uFalse(e.direction,"direction"),this._uFalse(e.marker,"marker"),this._uTrue(e.cache,"cache"),this._uTrue(e.path,"path"),this._uTrue(e.bearing,"bearing"),this._uTrue(e.imagePlane,"imagePlane"),this._uTrue(e.keyboard,"keyboard"),this._uTrue(e.loading,"loading"),this._uTrue(e.mouse,"mouse")}_initilizeCoverComponent(){let e=this._options;this._coverComponent.configure({key:this._key}),void 0===e.cover||e.cover?this.activateCover():this.deactivateCover()}_setNavigable(e){this._navigable!==e&&(this._navigable=e,this._observer.navigable$.next(e))}_subscribeCoverComponent(){this._coverComponent.configuration$.subscribe(t=>{t.state===e.CoverState.Loading?this._navigator.stateService.currentKey$.pipe(vn(),Un(e=>{const i=null==e||e!==t.key;return i&&this._setNavigable(!1),i?this._navigator.moveToKey$(t.key):this._navigator.stateService.currentNode$.pipe(vn())})).subscribe(t=>{this._navigator.stateService.start(),this._observer.startEmit(),this._coverComponent.configure({state:e.CoverState.Hidden}),this._componentService.deactivateCover(),this._setNavigable(!0)},t=>{console.error("Failed to deactivate cover.",t),this._coverComponent.configure({state:e.CoverState.Visible})}):t.state===e.CoverState.Visible&&(this._observer.stopEmit(),this._navigator.stateService.stop(),this._componentService.activateCover(),this._setNavigable(null==t.key))})}_uFalse(e,t){void 0!==e?"boolean"!=typeof e?(this._componentService.configure(t,e),this._componentService.activate(t)):e?this._componentService.activate(t):this._componentService.deactivate(t):this._componentService.deactivate(t)}_uTrue(e,t){void 0!==e?"boolean"!=typeof e?(this._componentService.configure(t,e),this._componentService.activate(t)):e?this._componentService.activate(t):this._componentService.deactivate(t):this._componentService.activate(t)}}class xo{constructor(e){this._keyDown$=fr(e,"keydown")}get keyDown$(){return this._keyDown$}}class wo{constructor(e,t,i,r,n){this._canvasContainer=t,this._domContainer=i,this._viewportCoords=null!=n?n:new _,this._activeSubject$=new gi(!1),this._active$=this._activeSubject$.pipe(Xr(),Mn(new Di(1)),ui()),this._claimMouse$=new ci,this._claimWheel$=new ci,this._deferPixelClaims$=new ci,this._deferPixels$=this._deferPixelClaims$.pipe(xn((e,t)=>(null==t.deferPixels?delete e[t.name]:e[t.name]=t.deferPixels,e),{}),Gi(e=>{let t=-1;for(const i in e){if(!e.hasOwnProperty(i))continue;const r=e[i];r>t&&(t=r)}return t}),$n(-1),Mn(new Di(1)),ui()),this._deferPixels$.subscribe(()=>{}),this._documentMouseMove$=fr(r,"mousemove"),this._documentMouseUp$=fr(r,"mouseup"),this._mouseDown$=fr(t,"mousedown"),this._mouseLeave$=fr(t,"mouseleave"),this._mouseMove$=fr(t,"mousemove"),this._mouseUp$=fr(t,"mouseup"),this._mouseOut$=fr(t,"mouseout"),this._mouseOver$=fr(t,"mouseover"),this._domMouseDown$=fr(i,"mousedown"),this._domMouseMove$=fr(i,"mousemove"),this._click$=fr(t,"click"),this._contextMenu$=fr(t,"contextmenu"),this._dblClick$=vr(fr(e,"click"),fr(t,"dblclick")).pipe(Er(3,1),Jr(e=>{const i=e[0],r=e[1],n=e[2];return"click"===i.type&&"click"===r.type&&"dblclick"===n.type&&i.target.parentNode===t&&r.target.parentNode===t}),Gi(e=>e[2]),Dn()),vr(this._domMouseDown$,this._domMouseMove$,this._dblClick$,this._contextMenu$).subscribe(e=>{e.preventDefault()}),this._mouseWheel$=vr(fr(t,"wheel"),fr(i,"wheel")).pipe(Dn()),this._consistentContextMenu$=vr(this._mouseDown$,this._mouseMove$,this._mouseOut$,this._mouseUp$,this._contextMenu$).pipe(Er(3,1),Jr(e=>"mousedown"===e[0].type&&"contextmenu"===e[1].type&&"mouseup"===e[2].type),Gi(e=>e[1]),Dn());const o=vr(fr(window,"blur"),this._documentMouseUp$.pipe(Jr(e=>0===e.button))).pipe(Dn()),a=this._createMouseDragInitiate$(this._mouseDown$,o,!0).pipe(Dn());this._mouseDragStart$=this._createMouseDragStart$(a).pipe(Dn()),this._mouseDrag$=this._createMouseDrag$(a,o).pipe(Dn()),this._mouseDragEnd$=this._createMouseDragEnd$(this._mouseDragStart$,o).pipe(Dn());const s=this._createMouseDragInitiate$(this._domMouseDown$,o,!1).pipe(Dn());this._domMouseDragStart$=this._createMouseDragStart$(s).pipe(Dn()),this._domMouseDrag$=this._createMouseDrag$(s,o).pipe(Dn()),this._domMouseDragEnd$=this._createMouseDragEnd$(this._domMouseDragStart$,o).pipe(Dn()),this._proximateClick$=this._mouseDown$.pipe(Un(e=>this._click$.pipe(qn(this._createDeferredMouseMove$(e,this._documentMouseMove$)),cn(1))),Mn(new ci),ui()),this._staticClick$=this._mouseDown$.pipe(Un(e=>this._click$.pipe(qn(this._documentMouseMove$),cn(1))),Mn(new ci),ui()),this._mouseDragStart$.subscribe(),this._mouseDrag$.subscribe(),this._mouseDragEnd$.subscribe(),this._domMouseDragStart$.subscribe(),this._domMouseDrag$.subscribe(),this._domMouseDragEnd$.subscribe(),this._staticClick$.subscribe(),this._mouseOwner$=this._createOwner$(this._claimMouse$).pipe(Mn(new Di(1)),ui()),this._wheelOwner$=this._createOwner$(this._claimWheel$).pipe(Mn(new Di(1)),ui()),this._mouseOwner$.subscribe(()=>{}),this._wheelOwner$.subscribe(()=>{})}get active$(){return this._active$}get activate$(){return this._activeSubject$}get documentMouseMove$(){return this._documentMouseMove$}get documentMouseUp$(){return this._documentMouseUp$}get domMouseDragStart$(){return this._domMouseDragStart$}get domMouseDrag$(){return this._domMouseDrag$}get domMouseDragEnd$(){return this._domMouseDragEnd$}get domMouseDown$(){return this._domMouseDown$}get domMouseMove$(){return this._domMouseMove$}get mouseOwner$(){return this._mouseOwner$}get mouseDown$(){return this._mouseDown$}get mouseMove$(){return this._mouseMove$}get mouseLeave$(){return this._mouseLeave$}get mouseOut$(){return this._mouseOut$}get mouseOver$(){return this._mouseOver$}get mouseUp$(){return this._mouseUp$}get click$(){return this._click$}get dblClick$(){return this._dblClick$}get contextMenu$(){return this._consistentContextMenu$}get mouseWheel$(){return this._mouseWheel$}get mouseDragStart$(){return this._mouseDragStart$}get mouseDrag$(){return this._mouseDrag$}get mouseDragEnd$(){return this._mouseDragEnd$}get proximateClick$(){return this._proximateClick$}get staticClick$(){return this._staticClick$}claimMouse(e,t){this._claimMouse$.next({name:e,zindex:t})}unclaimMouse(e){this._claimMouse$.next({name:e,zindex:null})}deferPixels(e,t){this._deferPixelClaims$.next({name:e,deferPixels:t})}undeferPixels(e){this._deferPixelClaims$.next({name:e,deferPixels:null})}claimWheel(e,t){this._claimWheel$.next({name:e,zindex:t})}unclaimWheel(e){this._claimWheel$.next({name:e,zindex:null})}filtered$(e,t){return this._filtered(e,t,this._mouseOwner$)}filteredWheel$(e,t){return this._filtered(e,t,this._wheelOwner$)}_createDeferredMouseMove$(e,t){return t.pipe(Gi(t=>{const i=t.clientX-e.clientX,r=t.clientY-e.clientY;return[t,Math.sqrt(i*i+r*r)]}),to(this._deferPixels$),Jr(([[e,t],i])=>t>i),Gi(([[e,t],i])=>e))}_createMouseDrag$(e,t){return e.pipe(Gi(([e,t])=>t),Un(e=>Ii(e).pipe(kr(this._documentMouseMove$),qn(t))))}_createMouseDragEnd$(e,t){return e.pipe(Un(e=>t.pipe(vn())))}_createMouseDragStart$(e){return e.pipe(Gi(([e,t])=>e))}_createMouseDragInitiate$(e,t,i){return e.pipe(Jr(e=>0===e.button),Un(e=>or(Ii(e),i?this._createDeferredMouseMove$(e,this._documentMouseMove$):this._documentMouseMove$).pipe(qn(t),cn(1))))}_createOwner$(e){return e.pipe(xn((e,t)=>(null==t.zindex?delete e[t.name]:e[t.name]=t.zindex,e),{}),Gi(e=>{let t=null,i=-1;for(const r in e)e.hasOwnProperty(r)&&e[r]>i&&(i=e[r],t=r);return t}),$n(null))}_filtered(e,t,i){return t.pipe(to(i),Jr(([t,i])=>i===e),Gi(([e,t])=>e))}}class Ao{constructor(e,t){this._canvasContainer=e,this._domContainer=t,this._activeSubject$=new gi(!1),this._active$=this._activeSubject$.pipe(Xr(),Mn(new Di(1)),ui()),fr(t,"touchmove").subscribe(e=>{e.preventDefault()}),this._touchStart$=fr(e,"touchstart"),this._touchMove$=fr(e,"touchmove"),this._touchEnd$=fr(e,"touchend"),this._touchCancel$=fr(e,"touchcancel");const i=this._touchStart$.pipe(Jr(e=>1===e.touches.length&&1===e.targetTouches.length),Dn());var r;this._doubleTap$=i.pipe((r=()=>i.pipe(vn(),Un(e=>function(e,t,i){void 0===e&&(e=0);var r=-1;return gr(t)?r=Number(t)<1?1:Number(t):Mi(t)&&(i=t),Mi(i)||(i=Fi),new ii(function(t){var n=gr(e)?e:+e-i.now();return i.schedule(_r,n,{index:0,period:r,subscriber:t})})}(300).pipe(Sn(i),cn(1)))),function(e){return e.lift(new Pr(r))}),Jr(e=>2===e.length),Gi(e=>e[e.length-1]),Dn()),this._doubleTap$.subscribe(e=>{e.preventDefault()}),this._singleTouchMove$=this._touchMove$.pipe(Jr(e=>1===e.touches.length&&1===e.targetTouches.length),Dn());let n=vr(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(Jr(e=>1===e.touches.length&&1===e.targetTouches.length)),o=vr(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(Jr(e=>e.touches.length>=1)),a=vr(this._touchEnd$,this._touchCancel$).pipe(Jr(e=>0===e.touches.length));this._singleTouchDragStart$=n.pipe(hr(e=>this._singleTouchMove$.pipe(qn(vr(a,o)),cn(1)))),this._singleTouchDragEnd$=n.pipe(hr(e=>vr(a,o).pipe(vn()))),this._singleTouchDrag$=n.pipe(Un(e=>this._singleTouchMove$.pipe(kn(1),qn(vr(o,a)))));let s=vr(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=s.pipe(Jr(e=>2===e.touches.length&&2===e.targetTouches.length)),this._pinchEnd$=s.pipe(Jr(e=>2!==e.touches.length||2!==e.targetTouches.length)),this._pinchOperation$=new ci,this._pinch$=this._pinchOperation$.pipe(xn((e,t)=>t(e),{changeX:0,changeY:0,clientX:0,clientY:0,distance:0,distanceChange:0,distanceX:0,distanceY:0,originalEvent:null,pageX:0,pageY:0,screenX:0,screenY:0,touch1:null,touch2:null})),this._touchMove$.pipe(Jr(e=>2===e.touches.length&&2===e.targetTouches.length),Gi(e=>t=>{let i=e.touches[0],r=e.touches[1],n=Math.min(i.clientX,r.clientX),o=Math.max(i.clientX,r.clientX),a=Math.min(i.clientY,r.clientY),s=n+(o-n)/2,c=a+(Math.max(i.clientY,r.clientY)-a)/2,h=s+i.pageX-i.clientX,u=c+i.pageY-i.clientY,l=s+i.screenX-i.clientX,p=c+i.screenY-i.clientY,d=Math.abs(i.clientX-r.clientX),f=Math.abs(i.clientY-r.clientY),m=Math.sqrt(d*d+f*f),g=m-t.distance;return{changeX:d-t.distanceX,changeY:f-t.distanceY,clientX:s,clientY:c,distance:m,distanceChange:g,distanceX:d,distanceY:f,originalEvent:e,pageX:h,pageY:u,screenX:l,screenY:p,touch1:i,touch2:r}})).subscribe(this._pinchOperation$),this._pinchChange$=this._pinchStart$.pipe(Un(e=>this._pinch$.pipe(kn(1),qn(this._pinchEnd$))))}get active$(){return this._active$}get activate$(){return this._activeSubject$}get doubleTap$(){return this._doubleTap$}get touchStart$(){return this._touchStart$}get touchMove$(){return this._touchMove$}get touchEnd$(){return this._touchEnd$}get touchCancel$(){return this._touchCancel$}get singleTouchDragStart$(){return this._singleTouchDragStart$}get singleTouchDrag$(){return this._singleTouchDrag$}get singleTouchDragEnd$(){return this._singleTouchDragEnd$}get pinch$(){return this._pinchChange$}get pinchStart$(){return this._pinchStart$}get pinchEnd$(){return this._pinchEnd$}}class So{set json(e){this._json=e}set image(e){this._image=e,this._texture=new p.exports.Texture(this._image),this._texture.minFilter=p.exports.NearestFilter}get loaded(){return!(!this._image||!this._json)}getGLSprite(e){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");let t=this._json[e];if(!t)return console.warn("Sprite with key"+e+"does not exist in sprite definition."),new p.exports.Object3D;let i=this._texture.clone();i.needsUpdate=!0;let r=this._image.width,n=this._image.height;i.offset.x=t.x/r,i.offset.y=(n-t.y-t.height)/n,i.repeat.x=t.width/r,i.repeat.y=t.height/n;let o=new p.exports.SpriteMaterial({map:i});return new p.exports.Sprite(o)}getDOMSprite(t,i){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==i&&(i=e.Alignment.Center);let r=this._json[t];if(!r)return console.warn("Sprite with key"+t+"does not exist in sprite definition."),Bt.h("div",{},[]);let n=r.y,o=r.x+r.width,a=r.y+r.height,s=r.x,c=-r.x,h=-r.y,u=this._image.height,l=this._image.width;switch(i){case e.Alignment.Bottom:case e.Alignment.Center:case e.Alignment.Top:c-=r.width/2;break;case e.Alignment.BottomLeft:case e.Alignment.Left:case e.Alignment.TopLeft:c-=r.width;case e.Alignment.BottomRight:case e.Alignment.Right:case e.Alignment.BottomRight:}switch(i){case e.Alignment.Center:case e.Alignment.Left:case e.Alignment.Right:h-=r.height/2;break;case e.Alignment.Top:case e.Alignment.TopLeft:case e.Alignment.TopRight:h-=r.height;case e.Alignment.Bottom:case e.Alignment.BottomLeft:case e.Alignment.BottomRight:}let p=1/r.pixelRatio;n*=p,o*=p,a*=p,s*=p,c*=p,h*=p,u*=p,l*=p;let d={src:this._image.src,style:{clip:`rect(${n}px, ${o}px, ${a}px, ${s}px)`,height:`${u}px`,left:`${c}px`,position:"absolute",top:`${h}px`,width:`${l}px`}};return Bt.h("img",d,[])}}class Mo{constructor(e){if(this._retina=window.devicePixelRatio>1,this._spriteAtlasOperation$=new ci,this._spriteAtlas$=this._spriteAtlasOperation$.pipe($n(e=>e),xn((e,t)=>t(e),new So),Mn(new Di(1)),ui()),this._spriteAtlas$.subscribe(()=>{}),null==e)return;let t=this._retina?"@2x":"",i=new XMLHttpRequest;i.open("GET",e+t+".png",!0),i.custom&&i.custom.xhr&&(i=i.custom.xhr),i.responseType="arraybuffer",i.onload=()=>{let e=new Image;e.onload=()=>{this._spriteAtlasOperation$.next(t=>(t.image=e,t))};let t=new Blob([i.response]);e.src=window.URL.createObjectURL(t)},i.onerror=i=>{console.error(new Error(`Failed to fetch sprite sheet (${e}${t}.png)`))},i.send();let r=new XMLHttpRequest;r.open("GET",e+t+".json",!0),r.custom&&r.custom.xhr&&(r=r.custom.xhr),r.responseType="text",r.onload=()=>{let e=JSON.parse(r.response);this._spriteAtlasOperation$.next(t=>(t.json=e,t))},r.onerror=i=>{console.error(new Error(`Failed to fetch sheet (${e}${t}.json)`))},r.send()}get spriteAtlas$(){return this._spriteAtlas$}}class Eo{constructor(e,t,i,r){if(this.id=e,this._dom=r||new uo,this._container=this._dom.document.getElementById(e),!this._container)throw new Error(`Container '${e}' not found.`);this._container.classList.add("beeview-js"),this._canvasContainer=this._dom.createElement("div","beeview-js-interactive",this._container),this._domContainer=this._dom.createElement("div","beeview-js-dom",this._container),this.renderService=new vo(this._container,t.currentState$,i.renderMode),this.glRenderer=new mo(this._canvasContainer,this.renderService,this._dom),this.domRenderer=new ho(this._domContainer,this.renderService,t.currentState$),this.keyboardService=new xo(this._canvasContainer),this.mouseService=new wo(this._container,this._canvasContainer,this._domContainer,document),this.touchService=new Ao(this._canvasContainer,this._domContainer),this.spriteService=new Mo(i.sprite)}get element(){return this._container}get canvasContainer(){return this._canvasContainer}}class To{constructor(e,t){this._geoCoords=e||new v,this._viewportCoords=t||new _}basicToCanvas(e,t,i,r){return this._viewportCoords.basicToCanvas(e[0],e[1],t,r,i.perspective)}canvasToBasic(e,t,i,r){let n=this._viewportCoords.canvasToBasic(e[0],e[1],t,r,i.perspective);return(n[0]<0||n[0]>1||n[1]<0||n[1]>1)&&(n=null),n}eventToUnprojection(e,t,i,r,n){const o=this._viewportCoords.canvasPosition(e,t);return this.canvasToUnprojection(o,t,i,r,n)}canvasToUnprojection(e,t,i,r,n){const o=e[0],a=e[1],[s,c]=this._viewportCoords.canvasToViewport(o,a,t),h=new p.exports.Vector3(s,c,1).unproject(i.perspective);let u=n.projectBasic(h.toArray());(u[0]<0||u[0]>1||u[1]<0||u[1]>1)&&(u=null);const l=h.clone().sub(i.camera.position).normalize(),d=-2/l.z;let f=null;if(d>0&&d<100&&u){const e=l.clone().multiplyScalar(d).add(i.camera.position),t=this._geoCoords.enuToGeodetic(e.x,e.y,e.z,r.lat,r.lon,r.alt).slice(0,2);f={lat:t[0],lon:t[1]}}return{basicPoint:u,latLon:f,pixelPoint:[o,a]}}cameraToLngLat(e,t){const i=e.camera.position,[r,n]=this._geoCoords.enuToGeodetic(i.x,i.y,i.z,t.lat,t.lon,t.alt);return{lat:r,lon:n}}}class Co{}Co.fov="fov",Co.position="position",Co.pov="pov",Co.bearingchanged="bearingchanged",Co.panwithoutinertiachanged="panwithoutinertiachanged",Co.panchanged="panchanged",Co.click="click",Co.contextmenu="contextmenu",Co.dblclick="dblclick",Co.loadingchanged="loadingchanged",Co.mousedown="mousedown",Co.mousemove="mousemove",Co.mouseout="mouseout",Co.mouseover="mouseover",Co.mouseup="mouseup",Co.moveend="moveend",Co.movestart="movestart",Co.navigablechanged="navigablechanged",Co.nodechanged="nodechanged",Co.sequenceedgeschanged="sequenceedgeschanged",Co.spatialedgeschanged="spatialedgeschanged";class Io{constructor(e,t,i){this._container=i,this._eventEmitter=e,this._navigator=t,this._projection=new To,this._started=!1,this._navigable$=new ci,this._navigable$.subscribe(e=>{this._eventEmitter.fire(Co.navigablechanged,e)}),this._navigator.loadingService.loading$.subscribe(e=>{this._eventEmitter.fire(Co.loadingchanged,e)})}get started(){return this._started}get navigable$(){return this._navigable$}get projection(){return this._projection}projectBasic$(e){return or(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(vn(),Gi(([t,i])=>{const r=this._projection.basicToCanvas(e,this._container.element,t,i);return[Math.round(r[0]),Math.round(r[1])]}))}startEmit(){if(this._started)return;this._started=!0,this._currentNodeSubscription=this._navigator.stateService.currentNodeExternal$.subscribe(e=>{this.setFilter(["==","floorId",e.floorId]),this._eventEmitter.fire(Co.nodechanged,e)}),this._sequenceEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(Un(e=>e.sequenceEdges$)).subscribe(e=>{this._eventEmitter.fire(Co.sequenceedgeschanged,e)}),this._spatialEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(Un(e=>e.spatialEdges$)).subscribe(e=>{this._eventEmitter.fire(Co.spatialedgeschanged,e)}),this._moveSubscription=or(this._navigator.stateService.inMotion$,this._container.mouseService.active$,this._container.touchService.active$).pipe(Gi(e=>e[0]||e[1]||e[2]),Xr()).subscribe(e=>{e?this._eventEmitter.fire(Co.movestart,null):this._eventEmitter.fire(Co.moveend,null)}),this._bearingSubscription=this._container.renderService.bearing$.pipe(function(e,t,i){return void 0===t&&(t=Fi),void 0===i&&(i=Zn),function(r){return r.lift(new Kn(e,t,i.leading,i.trailing))}}(100),Xr((e,t)=>Math.abs(t-e)<1)).subscribe(e=>{this._eventEmitter.fire(Co.bearingchanged,e)}),this._panToWithoutInertiaSubscription=this._container.renderService.panWithoutInertia$.subscribe(e=>{this._eventEmitter.fire(Co.panwithoutinertiachanged,e)}),this._panToSubscription=this._container.renderService.pan$.subscribe(e=>{this._eventEmitter.fire(Co.panchanged,e)});const e=this._container.mouseService.active$.pipe(Un(e=>e?Si():this._container.mouseService.mouseMove$));this._viewerMouseEventSubscription=vr(this._mapMouseEvent$(Co.click,this._container.mouseService.staticClick$),this._mapMouseEvent$(Co.contextmenu,this._container.mouseService.contextMenu$),this._mapMouseEvent$(Co.dblclick,this._container.mouseService.dblClick$),this._mapMouseEvent$(Co.mousedown,this._container.mouseService.mouseDown$),this._mapMouseEvent$(Co.mousemove,e),this._mapMouseEvent$(Co.mouseout,this._container.mouseService.mouseOut$),this._mapMouseEvent$(Co.mouseover,this._container.mouseService.mouseOver$),this._mapMouseEvent$(Co.mouseup,this._container.mouseService.mouseUp$)).pipe(to(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$),Gi(([[e,t],i,r,n])=>{const o=this._projection.eventToUnprojection(t,this._container.element,i,r,n);return{basicPoint:o.basicPoint,latLon:o.latLon,originalEvent:t,pixelPoint:o.pixelPoint,target:this._eventEmitter,type:e}})).subscribe(e=>{this._eventEmitter.fire(e.type,e)}),this._positionSubscription=this._container.renderService.renderCamera$.pipe(Xr(([e,t],[i,r])=>this._closeTo(e,i,.01)&&this._closeTo(t,r,.01),e=>e.camera.position.toArray())).subscribe(()=>{this._eventEmitter.fire(Co.position,null)}),this._referenceSubscription=this._navigator.stateService.reference$.subscribe(()=>{this._eventEmitter.fire(Co.position,null)}),this._povSubscription=this._container.renderService.renderCamera$.pipe(Xr(([e,t],[i,r])=>this._closeTo(e,i,.001)&&this._closeTo(t,r,.001),e=>[e.rotation.phi,e.rotation.theta])).subscribe(()=>{this._eventEmitter.fire(Co.pov,null)}),this._fovSubscription=this._container.renderService.renderCamera$.pipe(Xr((e,t)=>this._closeTo(e,t,.01),e=>e.perspective.fov)).subscribe(()=>{this._eventEmitter.fire(Co.fov,null)})}stopEmit(){this.started&&(this._started=!1,this._referenceSubscription.unsubscribe(),this._positionSubscription.unsubscribe(),this._povSubscription.unsubscribe(),this._fovSubscription.unsubscribe(),this._bearingSubscription.unsubscribe(),this._panToWithoutInertiaSubscription.unsubscribe(),this._panToSubscription.unsubscribe(),this._currentNodeSubscription.unsubscribe(),this._moveSubscription.unsubscribe(),this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._viewerMouseEventSubscription.unsubscribe(),this._bearingSubscription=null,this._currentNodeSubscription=null,this._moveSubscription=null,this._sequenceEdgesSubscription=null,this._spatialEdgesSubscription=null,this._viewerMouseEventSubscription=null)}unproject$(e){return or(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$).pipe(vn(),Gi(([t,i,r])=>this._projection.canvasToUnprojection(e,this._container.element,t,i,r).latLon))}unprojectBasic$(e){return or(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(vn(),Gi(([t,i])=>this._projection.canvasToBasic(e,this._container.element,t,i)))}setFilter(e){return new Promise((t,i)=>{this._navigator.setFilter$(e).subscribe(()=>{t(void 0)},e=>{i(e)})})}_closeTo(e,t,i){return Math.abs(e-t)<=i}_mapMouseEvent$(e,t){return t.pipe(Gi(t=>[e,t]))}}class Po{constructor(){this._loadersSubject$=new ci,this._loaders$=this._loadersSubject$.pipe(xn((e,t)=>(void 0!==t.task&&(e[t.task]=t.loading),e),{}),$n({}),Mn(new Di(1)),ui())}get loading$(){return this._loaders$.pipe(Gi(e=>M.exports.reduce(e,(e,t)=>e||t,!1)),Br(100),Xr())}taskLoading$(e){return this._loaders$.pipe(Gi(t=>!!t[e]),Br(100),Xr())}startLoading(e){this._loadersSubject$.next({loading:!0,task:e})}stopLoading(e){this._loadersSubject$.next({loading:!1,task:e})}}class Ro{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,r){const n=this._compilePropertyReference(t),o=JSON.stringify(i);return(r?"typeof "+n+"===typeof "+o+"&&":"")+n+e+o}_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)+"]"}}class No{constructor(e){this._cache=null,this._core=e,this._fill=null}get assetsCached(){return null!=this._core&&null!=this._fill&&null!=this._cache&&null!=this._cache.image&&null!=this._cache.mesh}get cache(){return this._cache}get alt(){return this._fill.calt}get ca(){return null!=this._fill.cca?this._fill.cca:this._fill.ca}get capturedAt(){return this._fill.captured_at}get computedCA(){return this._fill.cca}get computedLatLon(){return this._core.cl}get focal(){return this._fill.cfocal}get full(){return null!=this._fill}get fullPano(){return null!=this._fill.gpano&&0===this._fill.gpano.CroppedAreaLeftPixels&&0===this._fill.gpano.CroppedAreaTopPixels&&this._fill.gpano.CroppedAreaImageWidthPixels===this._fill.gpano.FullPanoWidthPixels&&this._fill.gpano.CroppedAreaImageHeightPixels===this._fill.gpano.FullPanoHeightPixels}get gpano(){return this._fill.gpano}get height(){return this._fill.height}get image(){return this._cache.image}get key(){return this._core.key}get latLon(){return null!=this._core.l?this._core.l:this._core.cl}get loadStatus(){return this._cache.loadStatus}get merged(){return null!=this._fill&&null!=this._fill.merge_version&&this._fill.merge_version>0}get mergeCC(){return this._fill.merge_cc}get mergeVersion(){return this._fill.merge_version}get mesh(){return this._cache.mesh}get orientation(){return this._fill.orientation}get originalCA(){return this._fill.ca}get originalLatLon(){return this._core.l}get pano(){return null!=this._fill.gpano&&null!=this._fill.gpano.FullPanoWidthPixels}get projectKey(){return null!=this._fill.project?this._fill.project.key:null}get rotation(){return this._fill.c_rotation}get translation(){return this._fill.c_translation}get scale(){return this._fill.atomic_scale}get sequenceKey(){return this._core.sequence.key}get sequenceEdges(){return this._cache.sequenceEdges}get sequenceEdges$(){return this._cache.sequenceEdges$}get spatialEdges(){return this._cache.spatialEdges}get spatialEdges$(){return this._cache.spatialEdges$}get userKey(){return this._fill.user.key}get username(){return this._fill.user.username}get tags(){return this._fill.tags}get width(){return this._fill.width}get date(){return this._fill.date}get floor(){return this._fill.floor}get floorId(){return this._fill.floor.id}get building(){return this._fill.building}cacheAssets$(){return this._cache.cacheAssets$(this.key,this.pano,this.merged).pipe(Gi(e=>this))}cacheImage$(e){return this._cache.cacheImage$(this.key,e).pipe(Gi(e=>this))}cacheSequenceEdges(e){this._cache.cacheSequenceEdges(e)}cacheSpatialEdges(e){this._cache.cacheSpatialEdges(e)}dispose(){null!=this._cache&&(this._cache.dispose(),this._cache=null),this._core=null,this._fill=null}initializeCache(e){if(null!=this._cache)throw new Error(`Node cache already initialized (${this.key}).`);this._cache=e}makeFull(e){if(null==e)throw new Error("Fill can not be null.");this._fill=e}resetSequenceEdges(){this._cache.resetSequenceEdges()}resetSpatialEdges(){this._cache.resetSpatialEdges()}uncache(){null!=this._cache&&(this._cache.dispose(),this._cache=null)}}var Oo={
|
|
9
9
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
10
|
read:function(e,t,i,r,n){var o,a,s=8*n-r-1,c=(1<<s)-1,h=c>>1,u=-7,l=i?n-1:0,p=i?-1:1,d=e[t+l];for(l+=p,o=d&(1<<-u)-1,d>>=-u,u+=s;u>0;o=256*o+e[t+l],l+=p,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+l],l+=p,u-=8);if(0===o)o=1-h;else{if(o===c)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=h}return(d?-1:1)*a*Math.pow(2,o-r)},write:function(e,t,i,r,n,o){var a,s,c,h=8*o-n-1,u=(1<<h)-1,l=u>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=u?(s=0,a=u):a+l>=1?(s=(t*c-1)*Math.pow(2,n),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,n),a=0));n>=8;e[i+d]=255&s,d+=f,s/=256,n-=8);for(a=a<<n|s,h+=n;h>0;e[i+d]=255&a,d+=f,a/=256,h-=8);e[i+d-f]|=128*m}},Lo=ko,Do=Oo;function ko(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}ko.Varint=0,ko.Fixed64=1,ko.Bytes=2,ko.Fixed32=5;var Bo=4294967296,Fo=1/Bo;function jo(e){return e.type===ko.Bytes?e.readVarint()+e.pos:e.pos+1}function zo(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Vo(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function $o(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function Uo(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function Go(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function Ho(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function qo(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function Wo(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function Qo(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function Yo(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function Xo(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function Zo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function Ko(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function Jo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}ko.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,e(n,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Zo(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Jo(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Zo(this.buf,this.pos)+Zo(this.buf,this.pos+4)*Bo;return this.pos+=8,e},readSFixed64:function(){var e=Zo(this.buf,this.pos)+Jo(this.buf,this.pos+4)*Bo;return this.pos+=8,e},readFloat:function(){var e=Do.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Do.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(n=o[i.pos++],r=(112&n)>>4,n<128)return zo(e,r,t);if(n=o[i.pos++],r|=(127&n)<<3,n<128)return zo(e,r,t);if(n=o[i.pos++],r|=(127&n)<<10,n<128)return zo(e,r,t);if(n=o[i.pos++],r|=(127&n)<<17,n<128)return zo(e,r,t);if(n=o[i.pos++],r|=(127&n)<<24,n<128)return zo(e,r,t);if(n=o[i.pos++],r|=(1&n)<<31,n<128)return zo(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,i){var r="",n=t;for(;n<i;){var o,a,s,c=e[n],h=null,u=c>239?4:c>223?3:c>191?2:1;if(n+u>i)break;1===u?c<128&&(h=c):2===u?128==(192&(o=e[n+1]))&&(h=(31&c)<<6|63&o)<=127&&(h=null):3===u?(o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&((h=(15&c)<<12|(63&o)<<6|63&a)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((h=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,r+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),r+=String.fromCharCode(h),n+=u}return r}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var i=jo(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=jo(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=jo(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=jo(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=jo(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=jo(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=jo(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=jo(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=jo(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===ko.Varint)for(;this.buf[this.pos++]>127;);else if(t===ko.Bytes)this.pos=this.readVarint()+this.pos;else if(t===ko.Fixed32)this.pos+=4;else{if(t!==ko.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Ko(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Ko(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Ko(this.buf,-1&e,this.pos),Ko(this.buf,Math.floor(e*Fo),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Ko(this.buf,-1&e,this.pos),Ko(this.buf,Math.floor(e*Fo),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r;e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0));if(e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){var i=(7&e)<<4;if(t.buf[t.pos++]|=i|((e>>>=3)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;t.buf[t.pos++]=127&e}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,o=0;o<t.length;o++){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&Vo(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),Do.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Do.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&Vo(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,ko.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){this.writeMessage(e,$o,t)},writePackedSVarint:function(e,t){this.writeMessage(e,Uo,t)},writePackedBoolean:function(e,t){this.writeMessage(e,qo,t)},writePackedFloat:function(e,t){this.writeMessage(e,Go,t)},writePackedDouble:function(e,t){this.writeMessage(e,Ho,t)},writePackedFixed32:function(e,t){this.writeMessage(e,Wo,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,Qo,t)},writePackedFixed64:function(e,t){this.writeMessage(e,Yo,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,Xo,t)},writeBytesField:function(e,t){this.writeTag(e,ko.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,ko.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,ko.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,ko.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,ko.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,ko.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,ko.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,ko.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,ko.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,ko.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var ea=i({__proto__:null,default:Lo},[Lo]);class ta{static read(e){return new ea(e).readFields(ta._readMeshField,{faces:[],vertices:[]})}static _readMeshField(e,t,i){1===e?t.vertices.push(i.readFloat()):2===e&&t.faces.push(i.readVarint())}}class ia{static set(e,t,i){this.cache[e]={etag:t,img:i}}static get(e){var t;return null!==(t=this.cache[e])&&void 0!==t?t:null}static getEtag(e){const t=this.get(e);return t?t.etag:null}static getimg(e){const t=this.get(e);return t?t.img:null}static remove(e){delete this.cache[e]}static clear(){this.cache={}}}ia.cache={};var ra=function(e,t,i,r){return new(i||(i=Promise))(function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class na{constructor(){this._disposed=!1,this._image=null,this._loadStatus={loaded:0,total:0},this._mesh=null,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$=new ci,this._sequenceEdges$=this._sequenceEdgesChanged$.pipe($n(this._sequenceEdges),Mn(new Di(1)),ui()),this._sequenceEdgesSubscription=this._sequenceEdges$.subscribe(()=>{}),this._spatialEdgesChanged$=new ci,this._spatialEdges$=this._spatialEdgesChanged$.pipe($n(this._spatialEdges),Mn(new Di(1)),ui()),this._spatialEdgesSubscription=this._spatialEdges$.subscribe(()=>{}),this._cachingAssets$=null}get image(){return this._image}get loadStatus(){return this._loadStatus}get mesh(){return this._mesh}get sequenceEdges(){return this._sequenceEdges}get sequenceEdges$(){return this._sequenceEdges$}get spatialEdges(){return this._spatialEdges}get spatialEdges$(){return this._spatialEdges$}cacheAssets$(e,t,i){return null!=this._cachingAssets$||(this._cachingAssets$=or(this._cacheImage$(e),e=>(this._loadStatus.loaded=0,this._loadStatus.total=0,this._mesh={faces:[],vertices:[]},e&&(this._image=e.object,this._loadStatus.loaded+=e.loaded.loaded,this._loadStatus.total+=e.loaded.total),this)).pipe(fn(()=>{this._cachingAssets$=null}),Mn(new Di(1)),ui())),this._cachingAssets$}cacheImage$(e,t){return null!=this._image&&t<=Math.max(this._image.width,this._image.height)?Ii(this):this._cacheImage$(e).pipe(vn(e=>null!=e.object),rn(e=>{this._disposeImage(),this._image=e.object}),Gi(e=>this))}cacheSequenceEdges(e){this._sequenceEdges={cached:!0,edges:e},this._sequenceEdgesChanged$.next(this._sequenceEdges)}cacheSpatialEdges(e){this._spatialEdges={cached:!0,edges:e},this._spatialEdgesChanged$.next(this._spatialEdges)}dispose(){this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._disposeImage(),this._mesh=null,this._loadStatus.loaded=0,this._loadStatus.total=0,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges),this._spatialEdgesChanged$.next(this._spatialEdges),this._disposed=!0,null!=this._imageRequest&&this._imageRequest.abort(),null!=this._meshRequest&&this._meshRequest.abort()}resetSequenceEdges(){this._sequenceEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges)}resetSpatialEdges(){this._spatialEdges={cached:!1,edges:[]},this._spatialEdgesChanged$.next(this._spatialEdges)}_cacheImage$(e){return ii.create(i=>ra(this,void 0,void 0,function*(){const r=yield t.getToken();let n=new XMLHttpRequest;n.open("GET",fo.thumbnail(e),!0),n.setRequestHeader("Accept","image/jpeg"),n.setRequestHeader("token",r);const o=`etag:${e}`,a=ia.getEtag(o);a&&n.setRequestHeader("If-None-Match",a),n.custom&&n.custom.xhr&&(n=n.custom.xhr),n.responseType="arraybuffer",n.timeout=15e3,n.onload=t=>{if(304===n.status){this._imageRequest=null;const r=ia.getimg(o);return void(r?(i.next({loaded:{loaded:t.loaded,total:t.total},object:r}),i.complete()):i.error(new Error(`No cached image available for ${e}`)))}if(200!==n.status)return this._imageRequest=null,void i.error(new Error(`Failed to fetch image (${e}). Status: ${n.status}, ${n.statusText}`));const r=n.getResponseHeader("etag");let a=new Image;a.crossOrigin="Anonymous",a.onload=n=>{if(this._imageRequest=null,this._disposed)return window.URL.revokeObjectURL(a.src),void i.error(new Error(`Image load was aborted (${e})`));ia.set(e,r,a),i.next({loaded:{loaded:t.loaded,total:t.total},object:a}),i.complete()},a.onerror=t=>{this._imageRequest=null,i.error(new Error(`Failed to load image (${e})`))};let s=new Blob([n.response]);a.src=window.URL.createObjectURL(s)},n.onprogress=e=>{this._disposed||i.next({loaded:{loaded:e.loaded,total:e.total},object:null})},n.onerror=t=>{this._imageRequest=null,i.error(new Error(`Failed to fetch image (${e})`))},n.ontimeout=t=>{this._imageRequest=null,i.error(new Error(`Image request timed out (${e})`))},n.onabort=t=>{this._imageRequest=null,i.error(new Error(`Image request was aborted (${e})`))},this._imageRequest=n,n.send(null)}))}_cacheMesh$(e,t){return ii.create(i=>{if(!t)return i.next(this._createEmptyMeshLoadStatus()),void i.complete();let r=new XMLHttpRequest;r.open("GET",fo.protoMesh(e),!0),r.setRequestHeader("Accept","application/mesh"),r.custom&&r.custom.xhr&&(r=r.custom.xhr),r.responseType="arraybuffer",r.timeout=15e3,r.onload=e=>{this._meshRequest=null,this._disposed||(200!==r.status||ta.read(new Buffer(r.response)),i.next({loaded:{loaded:e.loaded,total:e.total},object:{faces:[],vertices:[]}}),i.complete())},r.onprogress=e=>{this._disposed||i.next({loaded:{loaded:e.loaded,total:e.total},object:null})},r.onerror=e=>{this._meshRequest=null,i.next(this._createEmptyMeshLoadStatus()),i.complete()},r.ontimeout=e=>{this._meshRequest=null,i.next(this._createEmptyMeshLoadStatus()),i.complete()},r.onabort=e=>{this._meshRequest=null},this._meshRequest=r,r.send(null)})}_createEmptyMeshLoadStatus(){return{loaded:{loaded:0,total:0},object:{faces:[],vertices:[]}}}_disposeImage(){null!=this._image&&window.URL.revokeObjectURL(this._image.src),this._image=null}}class oa{constructor(e){this._key=e.key,this._keys=e.keys,this._country=e.country,this._city=e.city,this._building=e.building,this._floor=e.floor,this._loopLine=e.loop_line}get key(){return this._key}get keys(){return this._keys}get country(){return this._country}get city(){return this._city}get building(){return this._building}get floor(){return this._floor}get floorVersion(){return this._loopLine}dispose(){this._key=null,this._keys=null}findNextKey(e){let t=M.exports.indexOf(this._keys,e);return t+1>=this._keys.length||-1===t?null:this._keys[t+1]}findPrevKey(e){let t=M.exports.indexOf(this._keys,e);return 0===t||-1===t?null:this._keys[t-1]}}var aa,sa={exports:{}};!function(e){var t={base32:"0123456789bcdefghjkmnpqrstuvwxyz",encode:function(e,i,r){if(void 0===r){for(var n=1;n<=12;n++){var o=t.encode(e,i,n),a=t.decode(o);if(a.lat==e&&a.lon==i)return o}r=12}if(e=Number(e),i=Number(i),r=Number(r),isNaN(e)||isNaN(i)||isNaN(r))throw new Error("Invalid geohash");for(var s=0,c=0,h=!0,u="",l=-90,p=90,d=-180,f=180;u.length<r;){if(h){var m=(d+f)/2;i>=m?(s=2*s+1,d=m):(s*=2,f=m)}else{var g=(l+p)/2;e>=g?(s=2*s+1,l=g):(s*=2,p=g)}h=!h,5==++c&&(u+=t.base32.charAt(s),c=0,s=0)}return u},decode:function(e){var i=t.bounds(e),r=i.sw.lat,n=i.sw.lon,o=i.ne.lat,a=i.ne.lon,s=(r+o)/2,c=(n+a)/2;return s=s.toFixed(Math.floor(2-Math.log(o-r)/Math.LN10)),c=c.toFixed(Math.floor(2-Math.log(a-n)/Math.LN10)),{lat:Number(s),lon:Number(c)}},bounds:function(e){if(0===e.length)throw new Error("Invalid geohash");e=e.toLowerCase();for(var i=!0,r=-90,n=90,o=-180,a=180,s=0;s<e.length;s++){var c=e.charAt(s),h=t.base32.indexOf(c);if(-1==h)throw new Error("Invalid geohash");for(var u=4;u>=0;u--){var l=h>>u&1;if(i){var p=(o+a)/2;1==l?o=p:a=p}else{var d=(r+n)/2;1==l?r=d:n=d}i=!i}}return{sw:{lat:r,lon:o},ne:{lat:n,lon:a}}},adjacent:function(e,i){if(e=e.toLowerCase(),i=i.toLowerCase(),0===e.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(i))throw new Error("Invalid direction");var r=e.slice(-1),n=e.slice(0,-1),o=e.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[i][o].indexOf(r)&&""!==n&&(n=t.adjacent(n,i)),n+t.base32.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[i][o].indexOf(r))},neighbours:function(e){return{n:t.adjacent(e,"n"),ne:t.adjacent(t.adjacent(e,"n"),"e"),e:t.adjacent(e,"e"),se:t.adjacent(t.adjacent(e,"s"),"e"),s:t.adjacent(e,"s"),sw:t.adjacent(t.adjacent(e,"s"),"w"),w:t.adjacent(e,"w"),nw:t.adjacent(t.adjacent(e,"n"),"w")}}};e.exports&&(e.exports=t)}(sa);class ca{constructor(e){this._geoCoords=null!=e?e:new v}encodeH(e,t=14){return sa.exports.encode(e.lat,e.lon,t)}encodeHs(e,t=7,i=20){let r=sa.exports.encode(e.lat,e.lon,t),n=sa.exports.bounds(r),o=n.ne,a=n.sw,s=sa.exports.neighbours(r),c=[0,0,0],h=this._geoCoords.geodeticToEnu(o.lat,o.lon,0,a.lat,a.lon,0),u=this._geoCoords.geodeticToEnu(e.lat,e.lon,0,a.lat,a.lon,0),l=u[0]-c[0]<i,p=h[0]-u[0]<i,d=u[1]-c[1]<i,f=h[1]-u[1]<i,m=[r];return f&&m.push(s.n),f&&l&&m.push(s.nw),l&&m.push(s.w),l&&d&&m.push(s.sw),d&&m.push(s.s),d&&p&&m.push(s.se),p&&m.push(s.e),p&&f&&m.push(s.ne),m}boundingBoxCorners(e,t){let i=this._geoCoords.enuToGeodetic(-t,-t,0,e.lat,e.lon,0),r=this._geoCoords.enuToGeodetic(t,t,0,e.lat,e.lon,0);return[{lat:i[0],lon:i[1]},{lat:r[0],lon:r[1]}]}rotationFromCompass(e,t){let i=0,r=0,n=0;switch(t){case 1:i=Math.PI/2;break;case 3:i=-Math.PI/2,n=Math.PI;break;case 6:r=-Math.PI/2,n=-Math.PI/2;break;case 8:r=Math.PI/2,n=Math.PI/2}let o=(new p.exports.Matrix4).makeRotationZ(n),a=new p.exports.Euler(i,r,e*Math.PI/180,"XYZ"),s=(new p.exports.Matrix4).makeRotationFromEuler(a),c=(new p.exports.Vector4).setAxisAngleFromRotationMatrix(s.multiply(o));return c.multiplyScalar(c.w).toArray().slice(0,3)}}class ha{constructor(e){e.requestAnimationFrame?(this._cancelAnimationFrame=e.cancelAnimationFrame.bind(e),this._requestAnimationFrame=e.requestAnimationFrame.bind(e)):e.mozRequestAnimationFrame?(this._cancelAnimationFrame=e.mozCancelAnimationFrame.bind(e),this._requestAnimationFrame=e.mozRequestAnimationFrame.bind(e)):e.webkitRequestAnimationFrame?(this._cancelAnimationFrame=e.webkitCancelAnimationFrame.bind(e),this._requestAnimationFrame=e.webkitRequestAnimationFrame.bind(e)):e.msRequestAnimationFrame?(this._cancelAnimationFrame=e.msCancelAnimationFrame.bind(e),this._requestAnimationFrame=e.msRequestAnimationFrame.bind(e)):e.oRequestAnimationFrame?(this._cancelAnimationFrame=e.oCancelAnimationFrame.bind(e),this._requestAnimationFrame=e.oRequestAnimationFrame.bind(e)):(this._cancelAnimationFrame=e.clearTimeout.bind(e),this._requestAnimationFrame=t=>e.setTimeout(t,1e3/60))}get cancelAnimationFrame(){return this._cancelAnimationFrame}get requestAnimationFrame(){return this._requestAnimationFrame}}!function(e){e[e.Traversing=0]="Traversing",e[e.Waiting=1]="Waiting"}(aa||(aa={}));class ua{constructor(e){this._spatial=new y,this._geoCoords=new v,this._referenceThreshold=.01,this._reference=e.reference,this._alpha=e.alpha,this._camera=e.camera.clone(),this._zoom=e.zoom,this._currentIndex=e.currentIndex,this._trajectory=e.trajectory.slice(),this._trajectoryTransforms=[],this._trajectoryCameras=[];for(let e of this._trajectory){let t=this._nodeToTranslation(e),i=new b(e,e.image,t);this._trajectoryTransforms.push(i),this._trajectoryCameras.push(new g(i))}this._currentNode=this._trajectory.length>0?this._trajectory[this._currentIndex]:null,this._previousNode=this._trajectory.length>1&&this.currentIndex>0?this._trajectory[this._currentIndex-1]:null,this._currentCamera=this._trajectoryCameras.length>0?this._trajectoryCameras[this._currentIndex].clone():new g,this._previousCamera=this._trajectoryCameras.length>1&&this.currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()}get reference(){return this._reference}get alpha(){return this._getAlpha()}get camera(){return this._camera}get zoom(){return this._zoom}get trajectory(){return this._trajectory}get currentIndex(){return this._currentIndex}get currentNode(){return this._currentNode}get previousNode(){return this._previousNode}get currentCamera(){return this._currentCamera}get currentTransform(){return this._trajectoryTransforms.length>0?this._trajectoryTransforms[this.currentIndex]:null}get previousTransform(){return this._trajectoryTransforms.length>1&&this.currentIndex>0?this._trajectoryTransforms[this.currentIndex-1]:null}get motionless(){return this._motionless}append(e){if(e.length<1)throw Error("Trajectory can not be empty");this._currentIndex<0?this.set(e):(this._trajectory=this._trajectory.concat(e),this._appendToTrajectories(e))}prepend(e){if(e.length<1)throw Error("Trajectory can not be empty");this._trajectory=e.slice().concat(this._trajectory),this._currentIndex+=e.length,this._setCurrentNode(),this._setReference(this._currentNode)?this._setTrajectories():this._prependToTrajectories(e),this._setCurrentCamera()}remove(e){if(e<0)throw Error("n must be a positive integer");if(this._currentIndex-1<e)throw Error("Current and previous nodes can not be removed");for(let t=0;t<e;t++)this._trajectory.shift(),this._trajectoryTransforms.shift(),this._trajectoryCameras.shift(),this._currentIndex--;this._setCurrentNode()}clearPrior(){this._currentIndex>0&&this.remove(this._currentIndex-1)}clear(){this.cut(),this._currentIndex>0&&this.remove(this._currentIndex-1)}cut(){for(;this._trajectory.length-1>this._currentIndex;)this._trajectory.pop(),this._trajectoryTransforms.pop(),this._trajectoryCameras.pop()}set(e){this._setTrajectory(e),this._setCurrentNode(),this._setReference(this._currentNode),this._setTrajectories(),this._setCurrentCamera()}getCenter(){return null!=this._currentNode?this.currentTransform.projectBasic(this._camera.lookat.toArray()):[.5,.5]}_setCurrent(){this._setCurrentNode(),this._setReference(this._currentNode)&&this._setTrajectories(),this._setCurrentCamera()}_setCurrentCamera(){this._currentCamera=this._trajectoryCameras[this._currentIndex].clone(),this._previousCamera=this._currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()}_motionlessTransition(){return null!=this._currentNode&&null!=this._previousNode&&!(this._currentNode.merged&&this._previousNode.merged&&this._withinOriginalDistance()&&this._sameConnectedComponent())}_setReference(e){return!(Math.abs(e.latLon.lat-this.reference.lat)<this._referenceThreshold&&Math.abs(e.latLon.lon-this.reference.lon)<this._referenceThreshold)&&(!(null!=this._previousNode&&!this._motionlessTransition())&&(this._reference.lat=e.latLon.lat,this._reference.lon=e.latLon.lon,this._reference.alt=e.alt,!0))}_setCurrentNode(){this._currentNode=this._trajectory.length>0?this._trajectory[this._currentIndex]:null,this._previousNode=this._currentIndex>0?this._trajectory[this._currentIndex-1]:null}_setTrajectory(e){if(e.length<1)throw new f("Trajectory can not be empty");null!=this._currentNode?(this._trajectory=[this._currentNode].concat(e),this._currentIndex=1):(this._trajectory=e.slice(),this._currentIndex=0)}_setTrajectories(){this._trajectoryTransforms.length=0,this._trajectoryCameras.length=0,this._appendToTrajectories(this._trajectory)}_appendToTrajectories(e){for(let t of e){if(!t.assetsCached)throw new f("Assets must be cached when node is added to trajectory");let e=this._nodeToTranslation(t),i=new b(t,t.image,e);this._trajectoryTransforms.push(i),this._trajectoryCameras.push(new g(i))}}_prependToTrajectories(e){for(let t of e.reverse()){if(!t.assetsCached)throw new f("Assets must be cached when added to trajectory");let e=this._nodeToTranslation(t),i=new b(t,t.image,e);this._trajectoryTransforms.unshift(i),this._trajectoryCameras.unshift(new g(i))}}_nodeToTranslation(e){let t=this._geoCoords.geodeticToEnu(e.latLon.lat,e.latLon.lon,e.alt,this._reference.lat,this._reference.lon,this._reference.alt),i=this._spatial.rotate(t,e.rotation);return[-i.x,-i.y,-i.z]}_sameConnectedComponent(){let e=this._currentNode,t=this._previousNode;return!(e&&e.mergeCC&&t&&t.mergeCC)||e.mergeCC===t.mergeCC}_withinOriginalDistance(){let e=this._currentNode,t=this._previousNode;return!e||!t||this._spatial.distanceFromLatLon(e.originalLatLon.lat,e.originalLatLon.lon,t.originalLatLon.lat,t.originalLatLon.lon)<25}}class la{constructor(e,t){this._phi=e,this._theta=t}get phi(){return this._phi}set phi(e){this._phi=e}get theta(){return this._theta}set theta(e){this._theta=e}get isZero(){return 0===this._phi&&0===this._theta}copy(e){this._phi=e.phi,this._theta=e.theta}lerp(e,t){this._phi=(1-t)*this._phi+t*e.phi,this._theta=(1-t)*this._theta+t*e.theta}multiply(e){this._phi*=e,this._theta*=e}threshold(e){this._phi=Math.abs(this._phi)>e?this._phi:0,this._theta=Math.abs(this._theta)>e?this._theta:0}lengthSquared(){return this._phi*this._phi+this._theta*this._theta}reset(){this._phi=0,this._theta=0}}class pa extends ua{constructor(e){super(e),this._adjustCameras(),this._motionless=this._motionlessTransition(),this._baseAlpha=this._alpha,this._animationSpeed=.025,this._useBezier=!1,this._rotationDelta=new la(0,0),this._requestedRotationDelta=null,this._basicRotation=[0,0],this._requestedBasicRotation=null,this._requestedBasicRotationUnbounded=null,this._rotationAcceleration=.86,this._rotationIncreaseAlpha=.97,this._rotationDecreaseAlpha=.9,this._rotationThreshold=.001,this._unboundedRotationAlpha=.8,this._desiredZoom=e.zoom,this._minZoom=0,this._maxZoom=3,this._lookatDepth=10,this._desiredLookat=null,this._desiredCenter=null}append(e){let t=0===this._trajectory.length;t&&this._resetTransition(),super.append(e),t&&(this._setDesiredCenter(),this._setDesiredZoom())}prepend(e){let t=0===this._trajectory.length;t&&this._resetTransition(),super.prepend(e),t&&(this._setDesiredCenter(),this._setDesiredZoom())}set(e){super.set(e),this._desiredLookat=null,this._resetTransition(),this._clearRotation(),this._setDesiredCenter(),this._setDesiredZoom(),this._trajectory.length<3&&(this._useBezier=!0)}move(e){throw new Error("Not implemented")}moveTo(e){throw new Error("Not implemented")}rotate(e){null!=this._currentNode&&(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedBasicRotation=null,null!=this._requestedRotationDelta?(this._requestedRotationDelta.phi=this._requestedRotationDelta.phi+e.phi,this._requestedRotationDelta.theta=this._requestedRotationDelta.theta+e.theta):this._requestedRotationDelta=new la(e.phi,e.theta))}rotateBasic(e){if(null!=this._currentNode)if(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,null!=this._requestedBasicRotation){this._requestedBasicRotation[0]+=e[0],this._requestedBasicRotation[1]+=e[1];let t=.05/Math.pow(2,this._zoom);this._requestedBasicRotation[0]=this._spatial.clamp(this._requestedBasicRotation[0],-t,t),this._requestedBasicRotation[1]=this._spatial.clamp(this._requestedBasicRotation[1],-t,t)}else this._requestedBasicRotation=e.slice()}rotateBasicUnbounded(e){null!=this._currentNode&&(null!=this._requestedBasicRotationUnbounded?(this._requestedBasicRotationUnbounded[0]+=e[0],this._requestedBasicRotationUnbounded[1]+=e[1]):this._requestedBasicRotationUnbounded=e.slice())}rotateBasicWithoutInertia(e){if(null==this._currentNode)return;this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null;const t=.05/Math.pow(2,this._zoom),i=e.slice();i[0]=this._spatial.clamp(i[0],-t,t),i[1]=this._spatial.clamp(i[1],-t,t),this._applyRotationBasic(i)}rotateToBasic(e){if(null==this._currentNode)return;this._desiredZoom=this._zoom,this._desiredLookat=null,e[0]=this._spatial.clamp(e[0],0,1),e[1]=this._spatial.clamp(e[1],0,1);let t=this.currentTransform.unprojectBasic(e,this._lookatDepth);this._currentCamera.lookat.fromArray(t)}zoomIn(e,t){if(null==this._currentNode)return;this._desiredZoom=Math.max(this._minZoom,Math.min(this._maxZoom,this._desiredZoom+e));let i=this.currentTransform.projectBasic(this._currentCamera.lookat.toArray()),r=i[0],n=i[1],o=Math.pow(2,this._zoom),a=Math.pow(2,this._desiredZoom),s=t[0],c=t[1];null!=this.currentTransform.gpano&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels&&(s-r>.5?s-=1:r-s>.5&&(s=1+s));let h=s-o/a*(s-r),u=c-o/a*(c-n),l=this.currentTransform.gpano;this._currentNode.fullPano?(h=this._spatial.wrap(h+this._basicRotation[0],0,1),u=this._spatial.clamp(u+this._basicRotation[1],.05,.95)):null!=l&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels?(h=this._spatial.wrap(h+this._basicRotation[0],0,1),u=this._spatial.clamp(u+this._basicRotation[1],0,1)):(h=this._spatial.clamp(h,0,1),u=this._spatial.clamp(u,0,1)),this._desiredLookat=(new p.exports.Vector3).fromArray(this.currentTransform.unprojectBasic([h,u],this._lookatDepth))}setCenter(e){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._desiredZoom=this._zoom;let t=[this._spatial.clamp(e[0],0,1),this._spatial.clamp(e[1],0,1)];if(null==this._currentNode)return void(this._desiredCenter=t);this._desiredCenter=null;let i=(new p.exports.Vector3).fromArray(this.currentTransform.unprojectBasic(t,this._lookatDepth)),r=null!=this.previousTransform?this.previousTransform:this.currentTransform,n=(new p.exports.Vector3).fromArray(r.unprojectBasic(t,this._lookatDepth));this._currentCamera.lookat.copy(i),this._previousCamera.lookat.copy(n)}setZoom(e){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._zoom=this._spatial.clamp(e,this._minZoom,this._maxZoom),this._desiredZoom=this._zoom}update(e){1===this._alpha&&this._currentIndex+this._alpha<this._trajectory.length&&(this._currentIndex+=1,this._useBezier=this._trajectory.length<3&&this._currentIndex+1===this._trajectory.length,this._setCurrent(),this._resetTransition(),this._clearRotation(),this._desiredZoom=this._currentNode.fullPano?this._zoom:0,this._desiredLookat=null);let t=this._animationSpeed*(60/e);this._baseAlpha=Math.min(1,this._baseAlpha+t),this._useBezier?this._alpha=p.exports.MathUtils.smootherstep(this._baseAlpha,0,1):this._alpha=this._baseAlpha,this._updateRotation(),this._rotationDelta.isZero||(this._applyRotation(this._previousCamera),this._applyRotation(this._currentCamera)),this._updateRotationBasic(),0===this._basicRotation[0]&&0===this._basicRotation[1]||this._applyRotationBasic(this._basicRotation),this._updateZoom(t),this._updateLookat(t),this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)}_getAlpha(){return this._motionless?Math.ceil(this._alpha):this._alpha}_setCurrentCamera(){super._setCurrentCamera(),this._adjustCameras()}_adjustCameras(){if(null==this._previousNode)return;let e=this._camera.lookat.clone().sub(this._camera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position)),this._currentNode.fullPano&&this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}_resetTransition(){this._alpha=0,this._baseAlpha=0,this._motionless=this._motionlessTransition()}_applyRotation(e){if(null==e)return;let t=(new p.exports.Quaternion).setFromUnitVectors(e.up,new p.exports.Vector3(0,0,1)),i=t.clone().inverse(),r=new p.exports.Vector3;r.copy(e.lookat).sub(e.position),r.applyQuaternion(t);let n=r.length(),o=Math.atan2(r.y,r.x);o+=this._rotationDelta.phi;let a=Math.atan2(Math.sqrt(r.x*r.x+r.y*r.y),r.z);a+=this._rotationDelta.theta,a=Math.max(.1,Math.min(Math.PI-.1,a)),r.x=Math.sin(a)*Math.cos(o),r.y=Math.sin(a)*Math.sin(o),r.z=Math.cos(a),r.applyQuaternion(i),e.lookat.copy(e.position).add(r.multiplyScalar(n))}_applyRotationBasic(e){let t=this._currentNode,i=null!=this._previousNode?this.previousNode:this.currentNode,r=this._currentCamera,n=this._previousCamera,o=this.currentTransform,a=null!=this.previousTransform?this.previousTransform:this.currentTransform,s=o.projectBasic(r.lookat.toArray()),c=a.projectBasic(n.lookat.toArray()),h=o.gpano,u=a.gpano;t.fullPano?(s[0]=this._spatial.wrap(s[0]+e[0],0,1),s[1]=this._spatial.clamp(s[1]+e[1],.05,.95)):null!=h&&o.gpano.CroppedAreaImageWidthPixels===o.gpano.FullPanoWidthPixels?(s[0]=this._spatial.wrap(s[0]+e[0],0,1),s[1]=this._spatial.clamp(s[1]+e[1],0,1)):(s[0]=this._spatial.clamp(s[0]+e[0],0,1),s[1]=this._spatial.clamp(s[1]+e[1],0,1)),i.fullPano?(c[0]=this._spatial.wrap(c[0]+e[0],0,1),c[1]=this._spatial.clamp(c[1]+e[1],.05,.95)):null!=u&&a.gpano.CroppedAreaImageWidthPixels===a.gpano.FullPanoWidthPixels?(c[0]=this._spatial.wrap(c[0]+e[0],0,1),c[1]=this._spatial.clamp(c[1]+e[1],0,1)):(c[0]=this._spatial.clamp(c[0]+e[0],0,1),c[1]=this._spatial.clamp(s[1]+e[1],0,1));let l=o.unprojectBasic(s,this._lookatDepth);r.lookat.fromArray(l);let p=a.unprojectBasic(c,this._lookatDepth);n.lookat.fromArray(p)}_updateZoom(e){let t=this._desiredZoom-this._zoom,i=t>0?1:t<0?-1:0;0!==t&&(Math.abs(t)<.002?(this._zoom=this._desiredZoom,null!=this._desiredLookat&&(this._desiredLookat=null)):this._zoom+=i*Math.max(Math.abs(5*e*t),.002))}_updateLookat(e){if(null===this._desiredLookat)return;let t=this._desiredLookat.distanceToSquared(this._currentCamera.lookat);Math.abs(t)<1e-6?(this._currentCamera.lookat.copy(this._desiredLookat),this._desiredLookat=null):this._currentCamera.lookat.lerp(this._desiredLookat,5*e)}_updateRotation(){if(null!=this._requestedRotationDelta){let e=this._rotationDelta.lengthSquared();return this._requestedRotationDelta.lengthSquared()>e?this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationIncreaseAlpha):this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationDecreaseAlpha),void(this._requestedRotationDelta=null)}this._rotationDelta.isZero||(this._rotationDelta.multiply(this._rotationAcceleration),this._rotationDelta.threshold(this._rotationThreshold))}_updateRotationBasic(){if(null!=this._requestedBasicRotation){let e=this._basicRotation[0],t=this._basicRotation[1],i=this._requestedBasicRotation[0],r=this._requestedBasicRotation[1];return Math.abs(i)>Math.abs(e)?this._basicRotation[0]=(1-this._rotationIncreaseAlpha)*e+this._rotationIncreaseAlpha*i:this._basicRotation[0]=(1-this._rotationDecreaseAlpha)*e+this._rotationDecreaseAlpha*i,Math.abs(r)>Math.abs(t)?this._basicRotation[1]=(1-this._rotationIncreaseAlpha)*t+this._rotationIncreaseAlpha*r:this._basicRotation[1]=(1-this._rotationDecreaseAlpha)*t+this._rotationDecreaseAlpha*r,void(this._requestedBasicRotation=null)}if(null!=this._requestedBasicRotationUnbounded){let e=this._requestedBasicRotationUnbounded[0],t=this._requestedBasicRotationUnbounded[1];if(Math.abs(e)>0&&(this._basicRotation[0]=(1-this._unboundedRotationAlpha)*this._basicRotation[0]+this._unboundedRotationAlpha*e),Math.abs(t)>0&&(this._basicRotation[1]=(1-this._unboundedRotationAlpha)*this._basicRotation[1]+this._unboundedRotationAlpha*t),null!=this._desiredLookat){let i=this.currentTransform.projectBasic(this._desiredLookat.toArray());i[0]+=e,i[1]+=t,this._desiredLookat=(new p.exports.Vector3).fromArray(this.currentTransform.unprojectBasic(i,this._lookatDepth))}this._requestedBasicRotationUnbounded=null}0===this._basicRotation[0]&&0===this._basicRotation[1]||(this._basicRotation[0]=this._rotationAcceleration*this._basicRotation[0],this._basicRotation[1]=this._rotationAcceleration*this._basicRotation[1],Math.abs(this._basicRotation[0])<this._rotationThreshold/Math.pow(2,this._zoom)&&Math.abs(this._basicRotation[1])<this._rotationThreshold/Math.pow(2,this._zoom)&&(this._basicRotation=[0,0]))}_clearRotation(){this._currentNode.fullPano||(null!=this._requestedRotationDelta&&(this._requestedRotationDelta=null),this._rotationDelta.isZero||this._rotationDelta.reset(),null!=this._requestedBasicRotation&&(this._requestedBasicRotation=null),(this._basicRotation[0]>0||this._basicRotation[1]>0)&&(this._basicRotation=[0,0]))}_setDesiredCenter(){if(null==this._desiredCenter)return;let e=(new p.exports.Vector3).fromArray(this.currentTransform.unprojectBasic(this._desiredCenter,this._lookatDepth)).sub(this._currentCamera.position);this._currentCamera.lookat.copy(this._currentCamera.position.clone().add(e)),this._previousCamera.lookat.copy(this._previousCamera.position.clone().add(e)),this._desiredCenter=null}_setDesiredZoom(){this._desiredZoom=this._currentNode.fullPano||null==this._previousNode?this._zoom:0}}class da extends ua{constructor(e){super(e),this._zoom=0,this._adjustCameras(),this._motionless=this._motionlessTransition()}prepend(e){super.prepend(e),this._motionless=this._motionlessTransition()}set(e){super.set(e),this._motionless=this._motionlessTransition()}rotate(e){}rotateBasic(e){}rotateBasicUnbounded(e){}rotateBasicWithoutInertia(e){}rotateToBasic(e){}zoomIn(e,t){}move(e){this._alpha=Math.max(0,Math.min(1,this._alpha+e))}moveTo(e){this._alpha=Math.max(0,Math.min(1,e))}update(e){this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)}setCenter(e){}setZoom(e){}_getAlpha(){return this._motionless?Math.round(this._alpha):this._alpha}_setCurrentCamera(){super._setCurrentCamera(),this._adjustCameras()}_adjustCameras(){if(null!=this._previousNode){if(this._currentNode.fullPano){let e=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){let e=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position))}}}}class fa{constructor(){const e=aa[aa.Traversing],t=aa[aa.Waiting];this._creators=new Map;const i=this._creators;i.set(e,pa),i.set(t,da),this._transitions=new Map;const r=this._transitions;r.set(e,[t]),r.set(t,[e])}getState(e){if(e instanceof pa)return aa.Traversing;if(e instanceof da)return aa.Waiting;throw new Error("Invalid state instance")}generate(e,t){return new(this._creators.get(aa[e]))(t)}transition(e,t){if(!this.validate(e,t))throw new Error("Invalid transition");return this.generate(t,e)}validate(e,t){const i=aa[this.getState(e)],r=aa[t],n=this._transitions;return n.has(i)&&n.get(i).includes(r)}}class ma{constructor(){this._transitions=new fa,this._state=this._transitions.generate(aa.Traversing,{alpha:1,camera:new g,currentIndex:-1,reference:{alt:0,lat:0,lon:0},trajectory:[],zoom:0})}get state(){return this._transitions.getState(this._state)}get reference(){return this._state.reference}get alpha(){return this._state.alpha}get camera(){return this._state.camera}get zoom(){return this._state.zoom}get currentNode(){return this._state.currentNode}get previousNode(){return this._state.previousNode}get currentCamera(){return this._state.currentCamera}get currentTransform(){return this._state.currentTransform}get previousTransform(){return this._state.previousTransform}get trajectory(){return this._state.trajectory}get currentIndex(){return this._state.currentIndex}get lastNode(){return this._state.trajectory[this._state.trajectory.length-1]}get nodesAhead(){return this._state.trajectory.length-1-this._state.currentIndex}get motionless(){return this._state.motionless}traverse(){this._transition(aa.Traversing)}wait(){this._transition(aa.Waiting)}getCenter(){return this._state.getCenter()}setCenter(e){this._state.setCenter(e)}setZoom(e){this._state.setZoom(e)}update(e){this._state.update(e)}append(e){this._state.append(e)}prepend(e){this._state.prepend(e)}remove(e){this._state.remove(e)}clear(){this._state.clear()}clearPrior(){this._state.clearPrior()}cut(){this._state.cut()}set(e){this._state.set(e)}rotate(e){this._state.rotate(e)}rotateBasic(e){this._state.rotateBasic(e)}rotateBasicUnbounded(e){this._state.rotateBasicUnbounded(e)}rotateBasicWithoutInertia(e){this._state.rotateBasicWithoutInertia(e)}rotateToBasic(e){this._state.rotateToBasic(e)}move(e){this._state.move(e)}moveTo(e){this._state.moveTo(e)}zoomIn(e,t){this._state.zoomIn(e,t)}_transition(e){if(!this._transitions.validate(this._state,e)){const t=this._transitions.getState(this._state);return void console.warn(`Transition not valid (${aa[t]} - ${aa[e]})`)}const t=this._transitions.transition(this._state,e);this._state=t}}class ga{constructor(){this._appendNode$=new ci,this._start$=new ci,this._frame$=new ci,this._fpsSampleRate=30,this._contextOperation$=new gi(e=>e),this._context$=this._contextOperation$.pipe(xn((e,t)=>t(e),new ma),Rn(1),ui()),this._state$=this._context$.pipe(Gi(e=>e.state),Xr(),Rn(1),ui()),this._fps$=this._start$.pipe(Un(()=>this._frame$.pipe(Er(1,this._fpsSampleRate),Gi(e=>(new Date).getTime()),Tn(),Gi(e=>Math.max(20,1e3*this._fpsSampleRate/(e[1]-e[0]))),$n(60))),Dn()),this._currentState$=this._frame$.pipe(to(this._fps$,this._context$,(e,t,i)=>[e,t,i]),Jr(e=>null!=e[2].currentNode),rn(e=>{e[2].update(e[1])}),Gi(e=>({fps:e[1],id:e[0],state:e[2]})),Dn()),this._lastState$=this._currentState$.pipe(Rn(1),ui());let e=this._currentState$.pipe(Xr(void 0,e=>e.state.currentNode.key),Rn(1),ui()),t=new ci;e.subscribe(t),this._currentKey$=new gi(null),t.pipe(Gi(e=>e.state.currentNode.key)).subscribe(this._currentKey$),this._currentNode$=t.pipe(Gi(e=>e.state.currentNode),Rn(1),ui()),this._currentCamera$=t.pipe(Gi(e=>e.state.currentCamera),Rn(1),ui()),this._currentTransform$=t.pipe(Gi(e=>e.state.currentTransform),Rn(1),ui()),this._reference$=t.pipe(Gi(e=>e.state.reference),Xr((e,t)=>e.lat===t.lat&&e.lon===t.lon,e=>({lat:e.lat,lon:e.lon})),Rn(1),ui()),this._currentNodeExternal$=e.pipe(Gi(e=>e.state.currentNode),Rn(1),ui()),this._appendNode$.pipe(Gi(e=>t=>(t.append([e]),t))).subscribe(this._contextOperation$),this._inMotionOperation$=new ci,e.pipe(Gi(e=>!0)).subscribe(this._inMotionOperation$),this._inMotionOperation$.pipe(Xr(),Jr(e=>e),Un(e=>this._currentState$.pipe(Jr(e=>0===e.state.nodesAhead),Gi(e=>[e.state.camera.clone(),e.state.zoom]),Tn(),Gi(e=>{let t=e[0][0],i=e[1][0],r=e[0][1],n=e[1][1];return t.diff(i)>1e-5||Math.abs(r-n)>1e-5}),vn(e=>!e)))).subscribe(this._inMotionOperation$),this._inMotion$=this._inMotionOperation$.pipe(Xr(),Rn(1),ui()),this._inTranslationOperation$=new ci,e.pipe(Gi(e=>!0)).subscribe(this._inTranslationOperation$),this._inTranslationOperation$.pipe(Xr(),Jr(e=>e),Un(e=>this._currentState$.pipe(Jr(e=>0===e.state.nodesAhead),Gi(e=>e.state.camera.position.clone()),Tn(),Gi(e=>0!==e[0].distanceToSquared(e[1])),vn(e=>!e)))).subscribe(this._inTranslationOperation$),this._inTranslation$=this._inTranslationOperation$.pipe(Xr(),Rn(1),ui()),this._state$.subscribe(()=>{}),this._currentNode$.subscribe(()=>{}),this._currentCamera$.subscribe(()=>{}),this._currentTransform$.subscribe(()=>{}),this._reference$.subscribe(()=>{}),this._currentNodeExternal$.subscribe(()=>{}),this._lastState$.subscribe(()=>{}),this._inMotion$.subscribe(()=>{}),this._inTranslation$.subscribe(()=>{}),this._frameId=null,this._frameGenerator=new ha(window)}get currentState$(){return this._currentState$}get currentNode$(){return this._currentNode$}get currentKey$(){return this._currentKey$}get currentNodeExternal$(){return this._currentNodeExternal$}get currentCamera$(){return this._currentCamera$}get currentTransform$(){return this._currentTransform$}get state$(){return this._state$}get reference$(){return this._reference$}get inMotion$(){return this._inMotion$}get inTranslation$(){return this._inTranslation$}get appendNode$(){return this._appendNode$}get currentSnapshotTag(){return this._currentSnapshotTag}traverse(){this._inMotionOperation$.next(!0),this._invokeContextOperation(e=>{e.traverse()})}wait(){this._invokeContextOperation(e=>{e.wait()})}appendNodes(e){this._invokeContextOperation(t=>{t.append(e)})}prependNodes(e){this._invokeContextOperation(t=>{t.prepend(e)})}removeNodes(e){this._invokeContextOperation(t=>{t.remove(e)})}clearNodes(){this._invokeContextOperation(e=>{e.clear()})}clearPriorNodes(){this._invokeContextOperation(e=>{e.clearPrior()})}cutNodes(){this._invokeContextOperation(e=>{e.cut()})}setNodes(e){this._invokeContextOperation(t=>{t.set(e)})}rotate(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(t=>{t.rotate(e)})}rotateBasic(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(t=>{t.rotateBasic(e)})}rotateBasicUnbounded(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(t=>{t.rotateBasicUnbounded(e)})}rotateBasicWithoutInertia(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(t=>{t.rotateBasicWithoutInertia(e)})}rotateToBasic(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(t=>{t.rotateToBasic(e)})}move(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(t=>{t.move(e)})}moveTo(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(t=>{t.moveTo(e)})}zoomIn(e,t){this._inMotionOperation$.next(!0),this._invokeContextOperation(i=>{i.zoomIn(e,t)})}getCenter(){return this._lastState$.pipe(vn(),Gi(e=>e.state.getCenter()))}getZoom(){return this._lastState$.pipe(vn(),Gi(e=>e.state.zoom))}setCenter(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(t=>{t.setCenter(e)})}setZoom(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(t=>{t.setZoom(e)})}setCurrentSnapshotTag(e){this._currentSnapshotTag=e}start(){null==this._frameId&&(this._start$.next(null),this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId))}stop(){null!=this._frameId&&(this._frameGenerator.cancelAnimationFrame(this._frameId),this._frameId=null)}_invokeContextOperation(e){this._contextOperation$.next(t=>(e(t),t))}_frame(e){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId)}}class va{constructor(e,t,i,r,n,o,a){this._api=e,this._cachedPaths={},this._cachedNodes={},this._cachedNodeTiles={},this._cachedSpatialEdges={},this._cachedTiles={},this._cachingFill$={},this._cachingFull$={},this._cachingSequences$={},this._cachingSpatialArea$={},this._cachingTiles$={},this._changed$=new ci,this._defaultAlt=2,this._edgeCalculator=null!=r?r:new S,this._filterCreator=null!=n?n:new Ro,this._filter=this._filterCreator.createFilter(void 0),this._graphCalculator=null!=i?i:new ca,this._configuration=null!=o?o:{maxSequences:50,maxUnusedNodes:100,maxUnusedTiles:20},this._nodes={},this._nodeIndex=null!=t?t:new A(16),this._nodeIndexTiles={},this._nodeToTile={},this._preStored={},this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._tilePrecision=7,this._tileThreshold=20,this._stateService=null!=a?a:new ga}get changed$(){return this._changed$}cachePath$(e,t){let i=this.getNode(e);return this._api.imagesWithoutH$(i.latLon,i.floor.id,t).pipe(Gi(e=>{let r=this._graphCalculator.encodeH(i.latLon);return t&&(r+=t),this._cachedPaths[r]=M.exports.values(e),this._cachedPaths[r]}))}cacheOutdoorPath$(e,t,i){const r={lon:e,lat:t};return this._api.outdoorByLatLon$(r,200,i).pipe(Gi(e=>{let t=[];e.forEach(e=>t=t.concat(e.outdoorImages));let n=this._graphCalculator.encodeH(r);return i&&(n+=i),this._cachedPaths[n]=t,this._cachedPaths[n]}))}cacheFill$(e){if(e in this._cachingFull$)throw new m(`Cannot fill node while caching full (${e}).`);if(!this.hasNode(e))throw new m(`Cannot fill node that does not exist in graph (${e}).`);if(e in this._cachingFill$)return this._cachingFill$[e];let t=this.getNode(e);if(t.full)throw new m(`Cannot fill node that is already full (${e}).`);return this._cachingFill$[e]=this._api.imageByKeyFill$([e]).pipe(rn(i=>{t.full||this._makeFull(t,i[e]),delete this._cachingFill$[e]}),Gi(e=>this),fn(()=>{e in this._cachingFill$&&delete this._cachingFill$[e],this._changed$.next(this)}),Dn()),this._cachingFill$[e]}cacheFull$(e){if(e in this._cachingFull$)return this._cachingFull$[e];if(this.hasNode(e))throw new m(`Cannot cache full node that already exist in graph (${e}).`);const t=this._api.imageByKeyFull$([e]).pipe(Nr(()=>this._api.imageByKeyFullForOutdoor$([e])));return this._cachingFull$[e]=t.pipe(rn(t=>{let i=t[e];if(this.hasNode(e)){let t=this.getNode(e);t.full||this._makeFull(t,i)}else{if(null==i.sequence||null==i.sequence.key)throw new m(`Node has no sequence (${e}).`);let t=new No(i);this._makeFull(t,i);let r=this._graphCalculator.encodeH(t.originalLatLon,this._tilePrecision);this._preStore(r,t),this._setNode(t),delete this._cachingFull$[e]}}),Gi(e=>this),fn(()=>{e in this._cachingFull$&&delete this._cachingFull$[e],this._changed$.next(this)}),Dn()),this._cachingFull$[e]}cacheNodeSequence$(e){if(!this.hasNode(e))throw new m(`Cannot cache sequence edges of node that does not exist in graph (${e}).`);let t=this.getNode(e);if(t.sequenceKey in this._sequences)throw new m(`Sequence already cached (${e}), (${t.sequenceKey}).`);return this._cacheSequence$(t.sequenceKey)}cacheSequence$(e){if(e in this._sequences)throw new m(`Sequence already cached (${e})`);return this._cacheSequence$(e)}cacheSequenceEdges(e){let t=this.getNode(e);if(!(t.sequenceKey in this._sequences))throw new m(`Sequence is not cached (${e}), (${t.sequenceKey})`);let i=this._sequences[t.sequenceKey].sequence,r=this._edgeCalculator.computeSequenceEdges(t,i);t.cacheSequenceEdges(r)}cacheSpatialArea$(e){if(!this.hasNode(e))throw new m(`Cannot cache spatial area of node that does not exist in graph (${e}).`);if(e in this._cachedSpatialEdges)throw new m(`Node already spatially cached (${e}).`);if(!(e in this._requiredSpatialArea))throw new m(`Spatial area not determined (${e}).`);let t=this._requiredSpatialArea[e];if(0===Object.keys(t.cacheNodes).length)throw new m(`Spatial nodes already cached (${e}).`);if(e in this._cachingSpatialArea$)return this._cachingSpatialArea$[e];let i=[];for(;t.cacheKeys.length>0;)i.push(t.cacheKeys.splice(0,200));let r=i.length,n=[];for(let o of i){let i=this._api.imageByKeyFill$(o).pipe(rn(i=>{for(let e in i){if(!i.hasOwnProperty(e))continue;let r=t.cacheNodes[e];if(r.full){delete t.cacheNodes[e];continue}let n=i[e];this._makeFull(r,n),delete t.cacheNodes[e]}0===--r&&delete this._cachingSpatialArea$[e]}),Gi(e=>this),Nr(i=>{for(let e of o)e in t.all&&delete t.all[e],e in t.cacheNodes&&delete t.cacheNodes[e];throw 0===--r&&delete this._cachingSpatialArea$[e],i}),fn(()=>{0===Object.keys(t.cacheNodes).length&&this._changed$.next(this)}),Dn());n.push(i)}return this._cachingSpatialArea$[e]=n,n}cacheSpatialEdges(e){if(e in this._cachedSpatialEdges)throw new m(`Spatial edges already cached (${e}).`);let t=this.getNode(e),i=this._sequences[t.sequenceKey].sequence,r=[],n=i.findPrevKey(t.key);null!=n&&r.push(n);let o=i.findNextKey(t.key);null!=o&&r.push(o);let a=this._requiredSpatialArea[e].all,s=[],c=this._filter;for(let e in a){if(!a.hasOwnProperty(e))continue;let t=a[e];c(t)&&s.push(t)}let h=this._edgeCalculator.getPotentialEdges(t,s,r),u=this._edgeCalculator.computeStepEdges(t,h,n,o);u=u.concat(this._edgeCalculator.computeTurnEdges(t,h)),u=u.concat(this._edgeCalculator.computePanoEdges(t,h)),u=u.concat(this._edgeCalculator.computePerspectiveToPanoEdges(t,h)),u=u.concat(this._edgeCalculator.computeSimilarEdges(t,h)),t.cacheSpatialEdges(u),this._cachedSpatialEdges[e]=t,delete this._requiredSpatialArea[e],delete this._cachedNodeTiles[e]}cacheTiles$(e){if(e in this._cachedNodeTiles)throw new m(`Tiles already cached (${e}).`);if(e in this._cachedSpatialEdges)throw new m(`Spatial edges already cached so tiles considered cached (${e}).`);if(!(e in this._requiredNodeTiles))throw new m(`Tiles have not been determined (${e}).`);let t=this._requiredNodeTiles[e];if(0===t.cache.length&&0===t.caching.length)throw new m(`Tiles already cached (${e}).`);if(!this.hasNode(e))throw new m(`Cannot cache tiles of node that does not exist in graph (${e}).`);let i=t.cache.slice();t.caching=this._requiredNodeTiles[e].caching.concat(i),t.cache=[];let r=[];for(let i of t.caching){let n=null;if(i in this._cachingTiles$)n=this._cachingTiles$[i];else{const t=this.getNode(e);n=this._api.imagesByH$(i,t.latLon,t.floorId,this._stateService.currentSnapshotTag).pipe(rn(e=>{let t=e[i];if(i in this._cachedTiles)return;this._nodeIndexTiles[i]=[],this._cachedTiles[i]={accessed:(new Date).getTime(),nodes:[]};let r=this._cachedTiles[i].nodes,n=this._removeFromPreStore(i);for(let e in t){if(!t.hasOwnProperty(e))continue;let o,a,s=t[e];if(null==s)break;null!=s.sequence&&null!=s.sequence.key?null!=n&&s.key in n?(o=n[s.key],delete n[s.key],r.push(o),a={lat:o.latLon.lat,lon:o.latLon.lon,node:o},this._nodeIndex.insert(a),this._nodeIndexTiles[i].push(a),this._nodeToTile[o.key]=i):(o=new No(s),r.push(o),a={lat:o.latLon.lat,lon:o.latLon.lon,node:o},this._nodeIndex.insert(a),this._nodeIndexTiles[i].push(a),this._nodeToTile[o.key]=i,this._setNode(o)):console.warn(`Sequence missing, discarding (${s.key})`)}delete this._cachingTiles$[i]}),Gi(e=>this),Nr(e=>{throw delete this._cachingTiles$[i],e}),Dn()),this._cachingTiles$[i]=n}r.push(n.pipe(rn(r=>{let n=t.caching.indexOf(i);n>-1&&t.caching.splice(n,1),0===t.caching.length&&0===t.cache.length&&(delete this._requiredNodeTiles[e],this._cachedNodeTiles[e]=!0)}),fn(()=>{this._changed$.next(this)}),Dn()))}return r}initializeCache(e){if(e in this._cachedNodes)throw new m(`Node already in cache (${e}).`);let t=this.getNode(e);t.initializeCache(new na);let i=(new Date).getTime();this._cachedNodes[e]={accessed:i,node:t},this._updateCachedTileAccess(e,i)}isCachingFill(e){return e in this._cachingFill$}isCachingFull(e){return e in this._cachingFull$}isCachingNodeSequence(e){return this.getNode(e).sequenceKey in this._cachingSequences$}isCachingSequence(e){return e in this._cachingSequences$}isCachingTiles(e){return e in this._requiredNodeTiles&&0===this._requiredNodeTiles[e].cache.length&&this._requiredNodeTiles[e].caching.length>0}hasInitializedCache(e){return e in this._cachedNodes}hasCachedPaths(e,t){return t&&(e+=t),e in this._cachedPaths}getCachedPaths(e,t){return t&&(e+=t),this._cachedPaths[e]}hasNode(e){let t=(new Date).getTime();return this._updateCachedNodeAccess(e,t),this._updateCachedTileAccess(e,t),e in this._nodes}hasNodeSequence(e){let t=this.getNode(e).sequenceKey,i=t in this._sequences;return i&&(this._sequences[t].accessed=(new Date).getTime()),i}hasSequence(e){let t=e in this._sequences;return t&&(this._sequences[e].accessed=(new Date).getTime()),t}hasSpatialArea(e){if(!this.hasNode(e))throw new m(`Spatial area nodes cannot be determined if node not in graph (${e}).`);if(e in this._cachedSpatialEdges)return!0;if(e in this._requiredSpatialArea)return 0===Object.keys(this._requiredSpatialArea[e].cacheNodes).length;let t=this.getNode(e),i=this._graphCalculator.boundingBoxCorners(t.latLon,this._tileThreshold),r=this._nodeIndex.search({maxX:i[1].lat,maxY:i[1].lon,minX:i[0].lat,minY:i[0].lon}),n={all:{},cacheKeys:[],cacheNodes:{}};for(let e of r)n.all[e.node.key]=e.node,e.node.full||(n.cacheKeys.push(e.node.key),n.cacheNodes[e.node.key]=e.node);return this._requiredSpatialArea[e]=n,0===n.cacheKeys.length}hasTiles(e){if(e in this._cachedNodeTiles)return!0;if(e in this._cachedSpatialEdges)return!0;if(!this.hasNode(e))throw new m(`Node does not exist in graph (${e}).`);let t={cache:[],caching:[]};if(e in this._requiredNodeTiles)t=this._requiredNodeTiles[e];else{let i=this.getNode(e);t.cache=this._graphCalculator.encodeHs(i.latLon,this._tilePrecision,this._tileThreshold).filter(e=>!(e in this._cachedTiles)),t.cache.length>0&&(this._requiredNodeTiles[e]=t)}return 0===t.cache.length&&0===t.caching.length}getNode(e){let t=(new Date).getTime();return this._updateCachedNodeAccess(e,t),this._updateCachedTileAccess(e,t),this._nodes[e]}getSequence(e){let t=this._sequences[e];return t.accessed=(new Date).getTime(),t.sequence}resetSpatialEdges(){let e=Object.keys(this._cachedSpatialEdges);for(let t of e){this._cachedSpatialEdges[t].resetSpatialEdges(),delete this._cachedSpatialEdges[t]}}reset(e){const t=[];for(const i of e){if(!this.hasNode(i))throw new Error(`Node does not exist ${i}`);const e=this.getNode(i);e.resetSequenceEdges(),e.resetSpatialEdges(),t.push(e)}for(let t of Object.keys(this._cachedNodes))-1===e.indexOf(t)&&(this._cachedNodes[t].node.dispose(),delete this._cachedNodes[t]);this._cachedNodeTiles={},this._cachedSpatialEdges={},this._cachedTiles={},this._cachingFill$={},this._cachingFull$={},this._cachingSequences$={},this._cachingSpatialArea$={},this._cachingTiles$={},this._nodes={},this._nodeToTile={},this._preStored={};for(const e of t){this._nodes[e.key]=e;const t=this._graphCalculator.encodeH(e.originalLatLon,this._tilePrecision);this._preStore(t,e)}this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._nodeIndexTiles={},this._nodeIndex.clear()}setFilter(e){this._filter=this._filterCreator.createFilter(e)}uncache(e){let t={};this._addNewKeys(t,this._cachingFull$),this._addNewKeys(t,this._cachingFill$),this._addNewKeys(t,this._cachingTiles$),this._addNewKeys(t,this._cachingSpatialArea$),this._addNewKeys(t,this._requiredNodeTiles),this._addNewKeys(t,this._requiredSpatialArea);for(let i of e)i in t||(t[i]=!0);let i={};for(let e in t){if(!t.hasOwnProperty(e))continue;let r=this._nodes[e],n=this._graphCalculator.encodeHs(r.latLon);for(let e of n)e in i||(i[e]=!0)}let r=[];for(let e in this._cachedTiles)this._cachedTiles.hasOwnProperty(e)&&!(e in i)&&r.push([e,this._cachedTiles[e]]);let n=r.sort((e,t)=>t[1].accessed-e[1].accessed).slice(this._configuration.maxUnusedTiles).map(e=>e[0]);for(let e of n)this._uncacheTile(e);let o=[];for(let e in this._cachedNodes)this._cachedNodes.hasOwnProperty(e)&&!(e in t)&&o.push(this._cachedNodes[e]);let a=o.sort((e,t)=>t.accessed-e.accessed).slice(this._configuration.maxUnusedNodes);for(let e of a){e.node.uncache();let t=e.node.key;delete this._cachedNodes[t],t in this._cachedNodeTiles&&delete this._cachedNodeTiles[t],t in this._cachedSpatialEdges&&delete this._cachedSpatialEdges[t]}let s=[];for(let e in this._sequences)this._sequences.hasOwnProperty(e)&&!(e in this._cachingSequences$)&&s.push(this._sequences[e]);let c=s.sort((e,t)=>t.accessed-e.accessed).slice(this._configuration.maxSequences);for(let e of c){let t=e.sequence.key;delete this._sequences[t],e.sequence.dispose()}}_addNewKeys(e,t){for(let i in t)t.hasOwnProperty(i)&&this.hasNode(i)&&(i in e||(e[i]=!0))}_cacheSequence$(e){if(e in this._cachingSequences$)return this._cachingSequences$[e];const t=this._api.sequenceByKey$([e]).pipe(Nr(()=>this._api.sequenceByKeyForOutdoor$([e])));return this._cachingSequences$[e]=t.pipe(rn(t=>{e in this._sequences||(this._sequences[e]={accessed:(new Date).getTime(),sequence:new oa(t[e])}),delete this._cachingSequences$[e]}),Gi(e=>this),fn(()=>{e in this._cachingSequences$&&delete this._cachingSequences$[e],this._changed$.next(this)}),Dn()),this._cachingSequences$[e]}_makeFull(e,t){null==t.calt&&(t.calt=this._defaultAlt),null==t.c_rotation&&(t.c_rotation=this._graphCalculator.rotationFromCompass(t.ca,t.orientation)),e.makeFull(t)}_preStore(e,t){e in this._preStored||(this._preStored[e]={}),this._preStored[e][t.key]=t}_removeFromPreStore(e){let t=null;return e in this._preStored&&(t=this._preStored[e],delete this._preStored[e]),t}_setNode(e){let t=e.key;this.hasNode(t)||(this._nodes[t]=e)}_uncacheTile(e){for(let t of this._cachedTiles[e].nodes){let e=t.key;delete this._nodes[e],delete this._nodeToTile[e],e in this._cachedNodes&&delete this._cachedNodes[e],e in this._cachedNodeTiles&&delete this._cachedNodeTiles[e],e in this._cachedSpatialEdges&&delete this._cachedSpatialEdges[e],t.dispose()}for(let t of this._nodeIndexTiles[e])this._nodeIndex.remove(t);delete this._nodeIndexTiles[e],delete this._cachedTiles[e]}_updateCachedTileAccess(e,t){e in this._nodeToTile&&(this._cachedTiles[this._nodeToTile[e]].accessed=t)}_updateCachedNodeAccess(e,t){e in this._cachedNodes&&(this._cachedNodes[e].accessed=t)}}class _a{constructor(e,t){this._graph$=Ii(e).pipe(kr(e.changed$),Mn(new Di(1)),ui()),this._graph$.subscribe(()=>{}),this._imageLoadingService=t,this._firstGraphSubjects$=[],this._initializeCacheSubscriptions=[],this._sequenceSubscriptions=[],this._spatialSubscriptions=[],this._graphCalculator=new ca}cachePath$(e,t){let i=this._graph$.pipe(vn(),hr(i=>{const r=i.getNode(e),n=this._graphCalculator.encodeH(r.latLon);return r.floor?i.hasCachedPaths(n,t)?Ii(i.getCachedPaths(n,t)):i.cachePath$(e,t):Ii([]).pipe(Gr(500))}),Mn(new Di(1)),ui());return i.subscribe(e=>{this._imageLoadingService.loadpath$.next(e)},t=>{console.error(`Failed to cache path (${e})`,t)}),i}cacheOutdoorPath$(e,t){let i=this._graph$.pipe(vn(),hr(i=>{const r=i.getNode(e),n=this._graphCalculator.encodeH(r.latLon);return i.hasCachedPaths(n,t)?Ii(i.getCachedPaths(n,t)):i.cacheOutdoorPath$(r.latLon.lon,r.latLon.lat,t)}),Mn(new Di(1)),ui());return i.subscribe(e=>{this._imageLoadingService.loadpathOutdoor$.next(e)},t=>{console.error(`Failed to cache path (${e})`,t)}),i}cacheNode$(e){let t=new ci;this._firstGraphSubjects$.push(t);let i,r,n,o=t.pipe(Mn(new Di(1)),ui()),a=o.pipe(Gi(t=>t.getNode(e)),hr(e=>e.assetsCached?Ii(e):e.cacheAssets$()),Mn(new Di(1)),ui());return a.subscribe(void 0,t=>{console.error(`Failed to cache node (${e})`,t)}),i=this._graph$.pipe(vn(),hr(t=>t.isCachingFull(e)||!t.hasNode(e)?t.cacheFull$(e):t.isCachingFill(e)||!t.getNode(e).full?t.cacheFill$(e):Ii(t)),rn(t=>{t.hasInitializedCache(e)||t.initializeCache(e)}),fn(()=>{null!=i&&(this._removeFromArray(i,this._initializeCacheSubscriptions),this._removeFromArray(t,this._firstGraphSubjects$))})).subscribe(e=>{t.next(e),t.complete()},e=>{t.error(e)}),i.closed||this._initializeCacheSubscriptions.push(i),r=o.pipe(hr(t=>t.isCachingNodeSequence(e)||!t.hasNodeSequence(e)?t.cacheNodeSequence$(e):Ii(t)),rn(t=>{t.getNode(e).sequenceEdges.cached||t.cacheSequenceEdges(e)}),fn(()=>{null!=r&&this._removeFromArray(r,this._sequenceSubscriptions)})).subscribe(e=>{},t=>{console.error(`Failed to cache sequence edges (${e}).`,t)}),r.closed||this._sequenceSubscriptions.push(r),n=o.pipe(Nr(()=>Ai),ln(t=>t.hasTiles(e)?Ai:cr(t.cacheTiles$(e)).pipe(hr(t=>t.pipe(hr(t=>t.isCachingTiles(e)?Ai:Ii(t)),Nr((t,i)=>(console.error(`Failed to cache tile data (${e}).`,t),Ai)))))),bn(),hr(t=>t.hasSpatialArea(e)?Ii(t):cr(t.cacheSpatialArea$(e)).pipe(hr(t=>t.pipe(Nr((t,i)=>(console.error(`Failed to cache spatial nodes (${e}).`,t),Ai)))))),bn(),hr(t=>t.hasNodeSequence(e)?Ii(t):t.cacheNodeSequence$(e)),rn(t=>{t.getNode(e).spatialEdges.cached||t.cacheSpatialEdges(e)}),fn(()=>{null!=n&&this._removeFromArray(n,this._spatialSubscriptions)})).subscribe(e=>{},t=>{console.error(`Failed to cache spatial edges (${e}).`,t)}),n.closed||this._spatialSubscriptions.push(n),a.pipe(vn(e=>e.assetsCached))}cacheSequence$(e){return this._graph$.pipe(vn(),hr(t=>t.isCachingSequence(e)||!t.hasSequence(e)?t.cacheSequence$(e):Ii(t)),Gi(t=>t.getSequence(e)))}setFilter$(e){return this._resetSubscriptions(this._spatialSubscriptions),this._graph$.pipe(vn(),rn(t=>{t.resetSpatialEdges(),t.setFilter(e)}))}reset$(e){return this._abortSubjects(this._firstGraphSubjects$),this._resetSubscriptions(this._initializeCacheSubscriptions),this._resetSubscriptions(this._sequenceSubscriptions),this._resetSubscriptions(this._spatialSubscriptions),this._graph$.pipe(vn(),rn(t=>{t.reset(e)}))}uncache$(e){return this._graph$.pipe(vn(),rn(t=>{t.uncache(e)}))}_abortSubjects(e){for(let t of e.slice())this._removeFromArray(t,e),t.error(new Error("Cache node request was aborted."))}_removeFromArray(e,t){let i=t.indexOf(e);-1!==i&&t.splice(i,1)}_resetSubscriptions(e){for(let t of e.slice())this._removeFromArray(t,e),t.closed||t.unsubscribe()}}class ya{constructor(){this._loadnode$=new ci,this._loadpath$=new ci,this._loadpathOutdoor$=new ci,this._loadstatus$=this._loadnode$.pipe(xn((e,t)=>(e[t.key]=t.loadStatus,e),{}),Mn(new Di(1)),ui()),this._loadpath$.subscribe(()=>{}),this._loadpathOutdoor$.subscribe(()=>{}),this._loadstatus$.subscribe(()=>{})}get loadpath$(){return this._loadpath$}get loadpathOutdoor$(){return this._loadpathOutdoor$}get loadnode$(){return this._loadnode$}get loadstatus$(){return this._loadstatus$}}
|
|
11
11
|
/*! *****************************************************************************
|